diff options
author | Lior Amsalem <alior@marvell.com> | 2014-01-14 14:09:57 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2014-01-15 07:44:02 -0500 |
commit | 9013d64e661fc2a37a1742670202171c27fef4b5 (patch) | |
tree | e58a512bbc7d8bd815bef96321d2cfc6e24464e9 /drivers/ata/sata_mv.c | |
parent | b1f5c73bd5a4752efb7d7af019034044b08aafe9 (diff) |
ata: sata_mv: fix disk hotplug for Armada 370/XP SoCs
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@vger.kernel.org # v3.6+
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata/sata_mv.c')
-rw-r--r-- | drivers/ata/sata_mv.c | 24 |
1 files changed, 24 insertions, 0 deletions
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 { | |||
304 | MV5_LTMODE = 0x30, | 304 | MV5_LTMODE = 0x30, |
305 | MV5_PHY_CTL = 0x0C, | 305 | MV5_PHY_CTL = 0x0C, |
306 | SATA_IFCFG = 0x050, | 306 | SATA_IFCFG = 0x050, |
307 | LP_PHY_CTL = 0x058, | ||
307 | 308 | ||
308 | MV_M2_PREAMP_MASK = 0x7e0, | 309 | MV_M2_PREAMP_MASK = 0x7e0, |
309 | 310 | ||
@@ -431,6 +432,7 @@ enum { | |||
431 | MV_HP_CUT_THROUGH = (1 << 10), /* can use EDMA cut-through */ | 432 | MV_HP_CUT_THROUGH = (1 << 10), /* can use EDMA cut-through */ |
432 | MV_HP_FLAG_SOC = (1 << 11), /* SystemOnChip, no PCI */ | 433 | MV_HP_FLAG_SOC = (1 << 11), /* SystemOnChip, no PCI */ |
433 | MV_HP_QUIRK_LED_BLINK_EN = (1 << 12), /* is led blinking enabled? */ | 434 | MV_HP_QUIRK_LED_BLINK_EN = (1 << 12), /* is led blinking enabled? */ |
435 | MV_HP_FIX_LP_PHY_CTL = (1 << 13), /* fix speed in LP_PHY_CTL ? */ | ||
434 | 436 | ||
435 | /* Port private flags (pp_flags) */ | 437 | /* Port private flags (pp_flags) */ |
436 | MV_PP_FLAG_EDMA_EN = (1 << 0), /* is EDMA engine enabled? */ | 438 | 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) | |||
1358 | 1360 | ||
1359 | if (ofs != 0xffffffffU) { | 1361 | if (ofs != 0xffffffffU) { |
1360 | void __iomem *addr = mv_ap_base(link->ap) + ofs; | 1362 | void __iomem *addr = mv_ap_base(link->ap) + ofs; |
1363 | struct mv_host_priv *hpriv = link->ap->host->private_data; | ||
1361 | if (sc_reg_in == SCR_CONTROL) { | 1364 | if (sc_reg_in == SCR_CONTROL) { |
1362 | /* | 1365 | /* |
1363 | * Workaround for 88SX60x1 FEr SATA#26: | 1366 | * 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) | |||
1374 | */ | 1377 | */ |
1375 | if ((val & 0xf) == 1 || (readl(addr) & 0xf) == 1) | 1378 | if ((val & 0xf) == 1 || (readl(addr) & 0xf) == 1) |
1376 | val |= 0xf000; | 1379 | val |= 0xf000; |
1380 | |||
1381 | if (hpriv->hp_flags & MV_HP_FIX_LP_PHY_CTL) { | ||
1382 | void __iomem *lp_phy_addr = | ||
1383 | mv_ap_base(link->ap) + LP_PHY_CTL; | ||
1384 | /* | ||
1385 | * Set PHY speed according to SControl speed. | ||
1386 | */ | ||
1387 | if ((val & 0xf0) == 0x10) | ||
1388 | writelfl(0x7, lp_phy_addr); | ||
1389 | else | ||
1390 | writelfl(0x227, lp_phy_addr); | ||
1391 | } | ||
1377 | } | 1392 | } |
1378 | writelfl(val, addr); | 1393 | writelfl(val, addr); |
1379 | return 0; | 1394 | return 0; |
@@ -4110,6 +4125,15 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4110 | if (rc) | 4125 | if (rc) |
4111 | goto err; | 4126 | goto err; |
4112 | 4127 | ||
4128 | /* | ||
4129 | * To allow disk hotplug on Armada 370/XP SoCs, the PHY speed must be | ||
4130 | * updated in the LP_PHY_CTL register. | ||
4131 | */ | ||
4132 | if (pdev->dev.of_node && | ||
4133 | of_device_is_compatible(pdev->dev.of_node, | ||
4134 | "marvell,armada-370-sata")) | ||
4135 | hpriv->hp_flags |= MV_HP_FIX_LP_PHY_CTL; | ||
4136 | |||
4113 | /* initialize adapter */ | 4137 | /* initialize adapter */ |
4114 | rc = mv_init_host(host); | 4138 | rc = mv_init_host(host); |
4115 | if (rc) | 4139 | if (rc) |