* [PATCH] mmc: sdhci-esdhc-imx: fix host version read
@ 2013-01-15 15:30 Shawn Guo
2013-01-28 21:27 ` Chris Ball
0 siblings, 1 reply; 2+ messages in thread
From: Shawn Guo @ 2013-01-15 15:30 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, Sascha Hauer, Shawn Guo, stable
When commit 95a2482 (mmc: sdhci-esdhc-imx: add basic imx6q usdhc
support) works around host version issue on imx6q, it gets the
register address fixup "reg ^= 2" lost for imx25/35/51/53 esdhc.
Thus, the controller version on these SoCs is wrongly identified
as v1 while it's actually v2.
Add the address fixup back and take a different approach to correct
imx6q host version, so that the host version read gets back to work
for all SoCs.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: <stable@vger.kernel.org>
---
drivers/mmc/host/sdhci-esdhc-imx.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index e07df81..b503113 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -237,15 +237,18 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
{
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+ struct pltfm_imx_data *imx_data = pltfm_host->priv;
+
if (unlikely(reg == SDHCI_HOST_VERSION)) {
- u16 val = readw(host->ioaddr + (reg ^ 2));
- /*
- * uSDHC supports SDHCI v3.0, but it's encoded as value
- * 0x3 in host controller version register, which violates
- * SDHCI_SPEC_300 definition. Work it around here.
- */
- if ((val & SDHCI_SPEC_VER_MASK) == 3)
- return --val;
+ reg ^= 2;
+ if (is_imx6q_usdhc(imx_data)) {
+ /*
+ * The usdhc register returns a wrong host version.
+ * Correct it here.
+ */
+ return SDHCI_SPEC_300;
+ }
}
return readw(host->ioaddr + reg);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mmc: sdhci-esdhc-imx: fix host version read
2013-01-15 15:30 [PATCH] mmc: sdhci-esdhc-imx: fix host version read Shawn Guo
@ 2013-01-28 21:27 ` Chris Ball
0 siblings, 0 replies; 2+ messages in thread
From: Chris Ball @ 2013-01-28 21:27 UTC (permalink / raw)
To: Shawn Guo; +Cc: linux-mmc, Sascha Hauer, stable
Hi Shawn,
On Tue, Jan 15 2013, Shawn Guo wrote:
> When commit 95a2482 (mmc: sdhci-esdhc-imx: add basic imx6q usdhc
> support) works around host version issue on imx6q, it gets the
> register address fixup "reg ^= 2" lost for imx25/35/51/53 esdhc.
> Thus, the controller version on these SoCs is wrongly identified
> as v1 while it's actually v2.
>
> Add the address fixup back and take a different approach to correct
> imx6q host version, so that the host version read gets back to work
> for all SoCs.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: <stable@vger.kernel.org>
Thanks, pushed to mmc-next for 3.9.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-28 21:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-15 15:30 [PATCH] mmc: sdhci-esdhc-imx: fix host version read Shawn Guo
2013-01-28 21:27 ` Chris Ball
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).