linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Fix SATA disk hotplug for Armada 370/XP SoCs
@ 2014-01-14 19:04 Simon Guinot
  2014-01-14 19:04 ` [PATCH v3 1/3] ata: sata_mv: introduce compatible string "marvell, armada-370-sata" Simon Guinot
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Simon Guinot @ 2014-01-14 19:04 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

This patch series fixes a SATA disk hotplug issue for the Armada 370/XP
SoCs: once a disk is removed from a SATA port, then the re-plug events
are not detected by the sata_mv driver.

As this hotplug issue have been emphasized by 9ae6f740b49f
"arm: mach-mvebu: add support for Armada 370 and Armada XP with DT",
then this patches should be applied to the -stable kernels 3.6 and
onwards.

Changes since v1:
- Introduces a new compatible string for the SATA IP found in Armada
  370/XP SoCs.
- Only fix the LP_PHY_CTL register (0x58) if the compatible string
  "marvell,armada-370-xp-sata" is found in the SATA DT node.
- Update compatible string in DT SATA node for Armada 370/XP SoCs. 

Changes since v2:
- Use compatible string "marvell,armada-370-sata" instead of
  "marvell,armada-370-xp-sata".
- Provide more informations for -stable.

Thanks,

Simon

Lior Amsalem (1):
  ata: sata_mv: fix disk hotplug for Armada 370/XP SoCs

Simon Guinot (2):
  ata: sata_mv: introduce compatible string "marvell,armada-370-sata"
  ARM: mvebu: update the SATA compatible string for Armada 370/XP

 Documentation/devicetree/bindings/ata/marvell.txt |  2 +-
 arch/arm/boot/dts/armada-370-xp.dtsi              |  2 +-
 drivers/ata/sata_mv.c                             | 25 +++++++++++++++++++++++
 3 files changed, 27 insertions(+), 2 deletions(-)

-- 
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Gregory Clement <gregory.clement@free-electrons.com>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Lior Amsalem <alior@marvell.com>
Cc: stable at vger.kernel.org
-- 
1.8.5.2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 1/3] ata: sata_mv: introduce compatible string "marvell, armada-370-sata"
  2014-01-14 19:04 [PATCH v3 0/3] Fix SATA disk hotplug for Armada 370/XP SoCs Simon Guinot
@ 2014-01-14 19:04 ` Simon Guinot
  2014-01-14 19:09 ` [PATCH v3 2/3] ata: sata_mv: fix disk hotplug for Armada 370/XP SoCs Simon Guinot
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Simon Guinot @ 2014-01-14 19:04 UTC (permalink / raw)
  To: linux-arm-kernel

The sata_mv driver supports the SATA IP found in several Marvell SoCs.
As some new SATA registers have been introduced with the Armada 370/XP
SoCs, a way to identify them is needed.

This patch introduces a new compatible string for the SATA IP found in
Armada 370/XP SoCs.

Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Gregory Clement <gregory.clement@free-electrons.com>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Lior Amsalem <alior@marvell.com>
Cc: stable at vger.kernel.org # v3.6+
Acked-by: Jason Cooper <jason@lakedaemon.net>
---
Changes since v2:
- Use compatible string "marvell,armada-370-sata" instead of
  "marvell,armada-370-xp-sata".

 Documentation/devicetree/bindings/ata/marvell.txt | 2 +-
 drivers/ata/sata_mv.c                             | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/ata/marvell.txt b/Documentation/devicetree/bindings/ata/marvell.txt
index b5cdd20cde9c..1c8351604d38 100644
--- a/Documentation/devicetree/bindings/ata/marvell.txt
+++ b/Documentation/devicetree/bindings/ata/marvell.txt
@@ -1,7 +1,7 @@
 * Marvell Orion SATA
 
 Required Properties:
-- compatibility : "marvell,orion-sata"
+- compatibility : "marvell,orion-sata" or "marvell,armada-370-sata"
 - reg           : Address range of controller
 - interrupts    : Interrupt controller is using
 - nr-ports      : Number of SATA ports in use.
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 56be31819897..4ec5368c10f7 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -4209,6 +4209,7 @@ static int mv_platform_resume(struct platform_device *pdev)
 
 #ifdef CONFIG_OF
 static struct of_device_id mv_sata_dt_ids[] = {
+	{ .compatible = "marvell,armada-370-sata", },
 	{ .compatible = "marvell,orion-sata", },
 	{},
 };
-- 
1.8.5.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 2/3] ata: sata_mv: fix disk hotplug for Armada 370/XP SoCs
  2014-01-14 19:04 [PATCH v3 0/3] Fix SATA disk hotplug for Armada 370/XP SoCs Simon Guinot
  2014-01-14 19:04 ` [PATCH v3 1/3] ata: sata_mv: introduce compatible string "marvell, armada-370-sata" Simon Guinot
@ 2014-01-14 19:09 ` Simon Guinot
  2014-01-14 19:10 ` [PATCH v3 3/3] ARM: mvebu: update the SATA compatible string for Armada 370/XP Simon Guinot
  2014-01-15 12:44 ` [PATCH v3 0/3] Fix SATA disk hotplug for Armada 370/XP SoCs Tejun Heo
  3 siblings, 0 replies; 5+ messages in thread
From: Simon Guinot @ 2014-01-14 19:09 UTC (permalink / raw)
  To: linux-arm-kernel

From: Lior Amsalem <alior@marvell.com>

On Armada 370/XP SoCs, once a disk is removed from a SATA port, then the
re-plug events are not detected by the sata_mv driver. This patch fixes
the issue by updating the PHY speed in the LP_PHY_CTL register (0x58)
according to the SControl speed.

Note that this fix is only applied if the compatible string
"marvell,armada-370-sata" is found in the SATA DT node.

Fixes: 9ae6f740b49f ("arm: mach-mvebu: add support for Armada 370 and Armada XP with DT")
Signed-off-by: Lior Amsalem <alior@marvell.com>
Signed-off-by: Nadav Haklai <nadavh@marvell.com>
Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Gregory Clement <gregory.clement@free-electrons.com>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: stable at vger.kernel.org # v3.6+
Acked-by: Jason Cooper <jason@lakedaemon.net>
---
Changes since v1:
- Only fix the LP_PHY_CTL register (0x58) if the compatible string
  "marvell,armada-370-xp-sata" is found in the SATA DT node.
- Update the commit message.

Changes since v2:
- Use compatible string "marvell,armada-370-sata" instead of
  "marvell,armada-370-xp-sata".
- Provide more informations for -stable.

 drivers/ata/sata_mv.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 4ec5368c10f7..dc9d4b1ea4ec 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -304,6 +304,7 @@ enum {
 	MV5_LTMODE		= 0x30,
 	MV5_PHY_CTL		= 0x0C,
 	SATA_IFCFG		= 0x050,
+	LP_PHY_CTL		= 0x058,
 
 	MV_M2_PREAMP_MASK	= 0x7e0,
 
@@ -431,6 +432,7 @@ enum {
 	MV_HP_CUT_THROUGH	= (1 << 10),	/* can use EDMA cut-through */
 	MV_HP_FLAG_SOC		= (1 << 11),	/* SystemOnChip, no PCI */
 	MV_HP_QUIRK_LED_BLINK_EN = (1 << 12),	/* is led blinking enabled? */
+	MV_HP_FIX_LP_PHY_CTL	= (1 << 13),	/* fix speed in LP_PHY_CTL ? */
 
 	/* Port private flags (pp_flags) */
 	MV_PP_FLAG_EDMA_EN	= (1 << 0),	/* is EDMA engine enabled? */
@@ -1358,6 +1360,7 @@ static int mv_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val)
 
 	if (ofs != 0xffffffffU) {
 		void __iomem *addr = mv_ap_base(link->ap) + ofs;
+		struct mv_host_priv *hpriv = link->ap->host->private_data;
 		if (sc_reg_in == SCR_CONTROL) {
 			/*
 			 * Workaround for 88SX60x1 FEr SATA#26:
@@ -1374,6 +1377,18 @@ static int mv_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val)
 			 */
 			if ((val & 0xf) == 1 || (readl(addr) & 0xf) == 1)
 				val |= 0xf000;
+
+			if (hpriv->hp_flags & MV_HP_FIX_LP_PHY_CTL) {
+				void __iomem *lp_phy_addr =
+					mv_ap_base(link->ap) + LP_PHY_CTL;
+				/*
+				 * Set PHY speed according to SControl speed.
+				 */
+				if ((val & 0xf0) == 0x10)
+					writelfl(0x7, lp_phy_addr);
+				else
+					writelfl(0x227, lp_phy_addr);
+			}
 		}
 		writelfl(val, addr);
 		return 0;
@@ -4110,6 +4125,15 @@ static int mv_platform_probe(struct platform_device *pdev)
 	if (rc)
 		goto err;
 
+	/*
+	 * To allow disk hotplug on Armada 370/XP SoCs, the PHY speed must be
+	 * updated in the LP_PHY_CTL register.
+	 */
+	if (pdev->dev.of_node &&
+		of_device_is_compatible(pdev->dev.of_node,
+					"marvell,armada-370-sata"))
+		hpriv->hp_flags |= MV_HP_FIX_LP_PHY_CTL;
+
 	/* initialize adapter */
 	rc = mv_init_host(host);
 	if (rc)
-- 
1.8.5.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 3/3] ARM: mvebu: update the SATA compatible string for Armada 370/XP
  2014-01-14 19:04 [PATCH v3 0/3] Fix SATA disk hotplug for Armada 370/XP SoCs Simon Guinot
  2014-01-14 19:04 ` [PATCH v3 1/3] ata: sata_mv: introduce compatible string "marvell, armada-370-sata" Simon Guinot
  2014-01-14 19:09 ` [PATCH v3 2/3] ata: sata_mv: fix disk hotplug for Armada 370/XP SoCs Simon Guinot
@ 2014-01-14 19:10 ` Simon Guinot
  2014-01-15 12:44 ` [PATCH v3 0/3] Fix SATA disk hotplug for Armada 370/XP SoCs Tejun Heo
  3 siblings, 0 replies; 5+ messages in thread
From: Simon Guinot @ 2014-01-14 19:10 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates the Armada 370/XP SATA node with the new compatible
string "marvell,armada-370-sata".

Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Gregory Clement <gregory.clement@free-electrons.com>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Lior Amsalem <alior@marvell.com>
Cc: stable at vger.kernel.org # v3.6+
Acked-by: Jason Cooper <jason@lakedaemon.net>
---
Changes since v2:
- Use compatible string "marvell,armada-370-sata" instead of
  "marvell,armada-370-xp-sata".

 arch/arm/boot/dts/armada-370-xp.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi
index 7f10f627ae5b..80ffacd128f8 100644
--- a/arch/arm/boot/dts/armada-370-xp.dtsi
+++ b/arch/arm/boot/dts/armada-370-xp.dtsi
@@ -152,7 +152,7 @@
 			};
 
 			sata at a0000 {
-				compatible = "marvell,orion-sata";
+				compatible = "marvell,armada-370-sata";
 				reg = <0xa0000 0x5000>;
 				interrupts = <55>;
 				clocks = <&gateclk 15>, <&gateclk 30>;
-- 
1.8.5.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 0/3] Fix SATA disk hotplug for Armada 370/XP SoCs
  2014-01-14 19:04 [PATCH v3 0/3] Fix SATA disk hotplug for Armada 370/XP SoCs Simon Guinot
                   ` (2 preceding siblings ...)
  2014-01-14 19:10 ` [PATCH v3 3/3] ARM: mvebu: update the SATA compatible string for Armada 370/XP Simon Guinot
@ 2014-01-15 12:44 ` Tejun Heo
  3 siblings, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2014-01-15 12:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jan 14, 2014 at 08:04:38PM +0100, Simon Guinot wrote:
> Hello,
> 
> This patch series fixes a SATA disk hotplug issue for the Armada 370/XP
> SoCs: once a disk is removed from a SATA port, then the re-plug events
> are not detected by the sata_mv driver.
> 
> As this hotplug issue have been emphasized by 9ae6f740b49f
> "arm: mach-mvebu: add support for Armada 370 and Armada XP with DT",
> then this patches should be applied to the -stable kernels 3.6 and
> onwards.

Applied to libata/for-3.14.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-15 12:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-14 19:04 [PATCH v3 0/3] Fix SATA disk hotplug for Armada 370/XP SoCs Simon Guinot
2014-01-14 19:04 ` [PATCH v3 1/3] ata: sata_mv: introduce compatible string "marvell, armada-370-sata" Simon Guinot
2014-01-14 19:09 ` [PATCH v3 2/3] ata: sata_mv: fix disk hotplug for Armada 370/XP SoCs Simon Guinot
2014-01-14 19:10 ` [PATCH v3 3/3] ARM: mvebu: update the SATA compatible string for Armada 370/XP Simon Guinot
2014-01-15 12:44 ` [PATCH v3 0/3] Fix SATA disk hotplug for Armada 370/XP SoCs Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).