From: Mark Lord <liml@rtr.ca>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: IDE/ATA development list <linux-ide@vger.kernel.org>
Subject: [PATCH 01/01] sata_mv: PHY_MODE4 cleanups
Date: Sat, 31 May 2008 16:46:34 -0400 [thread overview]
Message-ID: <4841B92A.1050508@rtr.ca> (raw)
In-Reply-To: <48407B79.4090303@pobox.com>
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>
---
As requested..
--- old/drivers/ata/sata_mv.c 2008-05-28 12:20:05.000000000 -0400
+++ linux/drivers/ata/sata_mv.c 2008-05-30 19:36:52.000000000 -0400
@@ -224,6 +224,11 @@
PHY_MODE3 = 0x310,
PHY_MODE4 = 0x314,
+ PHY_MODE4_CFG_MASK = 0x00000003, /* phy internal config field */
+ PHY_MODE4_CFG_VALUE = 0x00000001, /* phy internal config field */
+ PHY_MODE4_RSVD_ZEROS = 0x5de3fffa, /* Gen2e always write zeros */
+ PHY_MODE4_RSVD_ONES = 0x00000005, /* Gen2e always write ones */
+
PHY_MODE2 = 0x330,
SATA_IFCTL_OFS = 0x344,
SATA_TESTCTL_OFS = 0x348,
@@ -2563,17 +2568,16 @@
m3 &= ~0x1c;
if (fix_phy_mode4) {
- u32 m4;
-
- m4 = readl(port_mmio + PHY_MODE4);
-
- /* workaround for errata FEr SATA#10 (part 1) */
- m4 = (m4 & ~(1 << 1)) | (1 << 0);
-
- /* enforce bit restrictions on GenIIe devices */
+ u32 m4 = readl(port_mmio + PHY_MODE4);
+ /*
+ * Enforce reserved-bit restrictions on GenIIe devices only.
+ * For earlier chipsets, force only the internal config field
+ * (workaround for errata FEr SATA#10 part 1).
+ */
if (IS_GEN_IIE(hpriv))
- m4 = (m4 & ~0x5DE3FFFC) | (1 << 2);
-
+ m4 = (m4 & ~PHY_MODE4_RSVD_ZEROS) | PHY_MODE4_RSVD_ONES;
+ else
+ m4 = (m4 & ~PHY_MODE4_CFG_MASK) | PHY_MODE4_CFG_VALUE;
writel(m4, port_mmio + PHY_MODE4);
}
/*
next prev parent reply other threads:[~2008-05-31 20:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-27 21:54 [PATCH 01/03] sata_mv: move SOC_FLAG to hpriv Mark Lord
2008-05-27 21:56 ` [PATCH 02/03] sata_mv: PHY_MODEx errata fixes Mark Lord
2008-05-27 21:58 ` [PATCH 03/03] sata_mv: nuke unreleased GenIIe revisions Mark Lord
2008-05-28 16:01 ` [PATCH 04/04] sata_mv: workaround for 60x1 errata sata13 Mark Lord
2008-05-28 17:41 ` [PATCH 05/05] sata_mv: implement SoC guideline SATA_S11 Mark Lord
2008-05-30 22:11 ` [PATCH 02/03] sata_mv: PHY_MODEx errata fixes Jeff Garzik
2008-05-30 23:20 ` Mark Lord
2008-05-31 20:46 ` Mark Lord [this message]
2008-06-04 10:29 ` [PATCH 01/01] sata_mv: PHY_MODE4 cleanups Jeff Garzik
2008-05-30 22:10 ` [PATCH 01/03] sata_mv: move SOC_FLAG to hpriv Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4841B92A.1050508@rtr.ca \
--to=liml@rtr.ca \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).