]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0
authoryangbo lu <yangbo.lu@nxp.com>
Wed, 9 Nov 2016 03:14:12 +0000 (11:14 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 29 Nov 2016 08:17:21 +0000 (09:17 +0100)
The eSDHC of T4240-R1.0-R2.0 has incorrect vender version and spec version.
Acturally the right version numbers should be VVN=0x13 and SVN = 0x1.
This patch adds the GUTS driver support for eSDHC driver to match SoC.
And fix host version to avoid that incorrect version numbers break down
the ADMA data transfer.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Scott Wood <oss@buserror.net>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/Kconfig
drivers/mmc/host/sdhci-of-esdhc.c

index 5cf7ebaf1e8bb86c6680accf887e8eb1767cb1ff..4128a3c5fa23c9f5b95d44fafc2e3d2f909efa4c 100644 (file)
@@ -144,6 +144,7 @@ config MMC_SDHCI_OF_ESDHC
        depends on MMC_SDHCI_PLTFM
        depends on PPC || ARCH_MXC || ARCH_LAYERSCAPE
        select MMC_SDHCI_IO_ACCESSORS
+       select FSL_GUTS
        help
          This selects the Freescale eSDHC controller support.
 
index 1bb11e4a9fe53f7e01eb81bb87482f6bd96a56f1..9a6eb4492172fafd81cc9a2e6162f7d8b331b0c4 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/of.h>
 #include <linux/delay.h>
 #include <linux/module.h>
+#include <linux/sys_soc.h>
 #include <linux/mmc/host.h>
 #include "sdhci-pltfm.h"
 #include "sdhci-esdhc.h"
@@ -28,6 +29,7 @@
 struct sdhci_esdhc {
        u8 vendor_ver;
        u8 spec_ver;
+       bool quirk_incorrect_hostver;
 };
 
 /**
@@ -87,6 +89,8 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host,
 static u16 esdhc_readw_fixup(struct sdhci_host *host,
                                     int spec_reg, u32 value)
 {
+       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+       struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
        u16 ret;
        int shift = (spec_reg & 0x2) * 8;
 
@@ -94,6 +98,12 @@ static u16 esdhc_readw_fixup(struct sdhci_host *host,
                ret = value & 0xffff;
        else
                ret = (value >> shift) & 0xffff;
+       /* Workaround for T4240-R1.0-R2.0 eSDHC which has incorrect
+        * vendor version and spec version information.
+        */
+       if ((spec_reg == SDHCI_HOST_VERSION) &&
+           (esdhc->quirk_incorrect_hostver))
+               ret = (VENDOR_V_23 << SDHCI_VENDOR_VER_SHIFT) | SDHCI_SPEC_200;
        return ret;
 }
 
@@ -572,6 +582,12 @@ static const struct sdhci_pltfm_data sdhci_esdhc_le_pdata = {
        .ops = &sdhci_esdhc_le_ops,
 };
 
+static struct soc_device_attribute soc_incorrect_hostver[] = {
+       { .family = "QorIQ T4240", .revision = "1.0", },
+       { .family = "QorIQ T4240", .revision = "2.0", },
+       { },
+};
+
 static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
 {
        struct sdhci_pltfm_host *pltfm_host;
@@ -585,6 +601,10 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
        esdhc->vendor_ver = (host_ver & SDHCI_VENDOR_VER_MASK) >>
                             SDHCI_VENDOR_VER_SHIFT;
        esdhc->spec_ver = host_ver & SDHCI_SPEC_VER_MASK;
+       if (soc_device_match(soc_incorrect_hostver))
+               esdhc->quirk_incorrect_hostver = true;
+       else
+               esdhc->quirk_incorrect_hostver = false;
 }
 
 static int sdhci_esdhc_probe(struct platform_device *pdev)