Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0

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>

authored by

yangbo lu and committed by
Ulf Hansson
151ede40 1b48706f

+21
+1
drivers/mmc/host/Kconfig
··· 144 144 depends on MMC_SDHCI_PLTFM 145 145 depends on PPC || ARCH_MXC || ARCH_LAYERSCAPE 146 146 select MMC_SDHCI_IO_ACCESSORS 147 + select FSL_GUTS 147 148 help 148 149 This selects the Freescale eSDHC controller support. 149 150
+20
drivers/mmc/host/sdhci-of-esdhc.c
··· 18 18 #include <linux/of.h> 19 19 #include <linux/delay.h> 20 20 #include <linux/module.h> 21 + #include <linux/sys_soc.h> 21 22 #include <linux/mmc/host.h> 22 23 #include "sdhci-pltfm.h" 23 24 #include "sdhci-esdhc.h" ··· 29 28 struct sdhci_esdhc { 30 29 u8 vendor_ver; 31 30 u8 spec_ver; 31 + bool quirk_incorrect_hostver; 32 32 }; 33 33 34 34 /** ··· 89 87 static u16 esdhc_readw_fixup(struct sdhci_host *host, 90 88 int spec_reg, u32 value) 91 89 { 90 + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 91 + struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host); 92 92 u16 ret; 93 93 int shift = (spec_reg & 0x2) * 8; 94 94 ··· 98 94 ret = value & 0xffff; 99 95 else 100 96 ret = (value >> shift) & 0xffff; 97 + /* Workaround for T4240-R1.0-R2.0 eSDHC which has incorrect 98 + * vendor version and spec version information. 99 + */ 100 + if ((spec_reg == SDHCI_HOST_VERSION) && 101 + (esdhc->quirk_incorrect_hostver)) 102 + ret = (VENDOR_V_23 << SDHCI_VENDOR_VER_SHIFT) | SDHCI_SPEC_200; 101 103 return ret; 102 104 } 103 105 ··· 582 572 .ops = &sdhci_esdhc_le_ops, 583 573 }; 584 574 575 + static struct soc_device_attribute soc_incorrect_hostver[] = { 576 + { .family = "QorIQ T4240", .revision = "1.0", }, 577 + { .family = "QorIQ T4240", .revision = "2.0", }, 578 + { }, 579 + }; 580 + 585 581 static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host) 586 582 { 587 583 struct sdhci_pltfm_host *pltfm_host; ··· 601 585 esdhc->vendor_ver = (host_ver & SDHCI_VENDOR_VER_MASK) >> 602 586 SDHCI_VENDOR_VER_SHIFT; 603 587 esdhc->spec_ver = host_ver & SDHCI_SPEC_VER_MASK; 588 + if (soc_device_match(soc_incorrect_hostver)) 589 + esdhc->quirk_incorrect_hostver = true; 590 + else 591 + esdhc->quirk_incorrect_hostver = false; 604 592 } 605 593 606 594 static int sdhci_esdhc_probe(struct platform_device *pdev)