Commit ef4d0888 authored by Shawn Guo's avatar Shawn Guo Committed by Chris Ball

mmc: sdhci-esdhc-imx: fix host version read

When commit 95a2482a (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: default avatarShawn Guo <shawn.guo@linaro.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 893613b0
...@@ -220,15 +220,18 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg) ...@@ -220,15 +220,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) 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)) { if (unlikely(reg == SDHCI_HOST_VERSION)) {
u16 val = readw(host->ioaddr + (reg ^ 2)); reg ^= 2;
if (is_imx6q_usdhc(imx_data)) {
/* /*
* uSDHC supports SDHCI v3.0, but it's encoded as value * The usdhc register returns a wrong host version.
* 0x3 in host controller version register, which violates * Correct it here.
* SDHCI_SPEC_300 definition. Work it around here.
*/ */
if ((val & SDHCI_SPEC_VER_MASK) == 3) return SDHCI_SPEC_300;
return --val; }
} }
return readw(host->ioaddr + reg); return readw(host->ioaddr + reg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment