aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_mv.c
diff options
context:
space:
mode:
authorMark Lord <liml@rtr.ca>2008-05-31 16:46:34 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-06-04 06:29:11 -0400
commitba069e376cc0801cd28352ca5986ce20413acb21 (patch)
treee3e778d9c500132648367c07542858aec091aad2 /drivers/ata/sata_mv.c
parente1fefea9cc4bc231b5c23fe19e3682fe061dc097 (diff)
sata_mv: PHY_MODE4 cleanups
The handling for PHY_MODE4 was originally just cloned from the Marvell proprietary driver (with their blessing). But we can do better than that. Tidy things up with some judicious mask definitions, to improve maintainability. Signed-off-by: Mark Lord <mlord@pobox.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/sata_mv.c')
-rw-r--r--drivers/ata/sata_mv.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index acf347f71a2f..60391e9a84db 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -224,6 +224,11 @@ enum {
224 224
225 PHY_MODE3 = 0x310, 225 PHY_MODE3 = 0x310,
226 PHY_MODE4 = 0x314, 226 PHY_MODE4 = 0x314,
227 PHY_MODE4_CFG_MASK = 0x00000003, /* phy internal config field */
228 PHY_MODE4_CFG_VALUE = 0x00000001, /* phy internal config field */
229 PHY_MODE4_RSVD_ZEROS = 0x5de3fffa, /* Gen2e always write zeros */
230 PHY_MODE4_RSVD_ONES = 0x00000005, /* Gen2e always write ones */
231
227 PHY_MODE2 = 0x330, 232 PHY_MODE2 = 0x330,
228 SATA_IFCTL_OFS = 0x344, 233 SATA_IFCTL_OFS = 0x344,
229 SATA_TESTCTL_OFS = 0x348, 234 SATA_TESTCTL_OFS = 0x348,
@@ -2563,17 +2568,16 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
2563 m3 &= ~0x1c; 2568 m3 &= ~0x1c;
2564 2569
2565 if (fix_phy_mode4) { 2570 if (fix_phy_mode4) {
2566 u32 m4; 2571 u32 m4 = readl(port_mmio + PHY_MODE4);
2567 2572 /*
2568 m4 = readl(port_mmio + PHY_MODE4); 2573 * Enforce reserved-bit restrictions on GenIIe devices only.
2569 2574 * For earlier chipsets, force only the internal config field
2570 /* workaround for errata FEr SATA#10 (part 1) */ 2575 * (workaround for errata FEr SATA#10 part 1).
2571 m4 = (m4 & ~(1 << 1)) | (1 << 0); 2576 */
2572
2573 /* enforce bit restrictions on GenIIe devices */
2574 if (IS_GEN_IIE(hpriv)) 2577 if (IS_GEN_IIE(hpriv))
2575 m4 = (m4 & ~0x5DE3FFFC) | (1 << 2); 2578 m4 = (m4 & ~PHY_MODE4_RSVD_ZEROS) | PHY_MODE4_RSVD_ONES;
2576 2579 else
2580 m4 = (m4 & ~PHY_MODE4_CFG_MASK) | PHY_MODE4_CFG_VALUE;
2577 writel(m4, port_mmio + PHY_MODE4); 2581 writel(m4, port_mmio + PHY_MODE4);
2578 } 2582 }
2579 /* 2583 /*