Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756408AbcJ1GAF (ORCPT ); Fri, 28 Oct 2016 02:00:05 -0400 Received: from mail-bl2nam02on0053.outbound.protection.outlook.com ([104.47.38.53]:11218 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756157AbcJ1F7N (ORCPT ); Fri, 28 Oct 2016 01:59:13 -0400 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com;nxp.com; dkim=none (message not signed) header.d=none; From: Yangbo Lu To: , , Scott Wood , Arnd Bergmann CC: , , , , , , , , Greg Kroah-Hartman , Mark Rutland , Rob Herring , Russell King , Jochen Friedrich , Joerg Roedel , Claudiu Manoil , Bhupesh Sharma , Qiang Zhao , Kumar Gala , Santosh Shilimkar , Leo Li , Xiaobo Xie , Minghuan Lian , Yangbo Lu Subject: [v14, 8/8] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0 Date: Fri, 28 Oct 2016 13:45:21 +0800 Message-ID: <1477633521-7391-9-git-send-email-yangbo.lu@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 In-Reply-To: <1477633521-7391-1-git-send-email-yangbo.lu@nxp.com> References: <1477633521-7391-1-git-send-email-yangbo.lu@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131221079492177240;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.168.50;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(7916002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(50986999)(48376002)(50466002)(19580395003)(19580405001)(47776003)(87936001)(2906002)(106466001)(8676002)(105606002)(92566002)(2950100002)(230783001)(77096005)(229853001)(85426001)(86362001)(626004)(5660300001)(6666003)(36756003)(33646002)(5003940100001)(7416002)(68736007)(11100500001)(81156014)(305945005)(97736004)(104016004)(8666005)(8936002)(81166006)(50226002)(7846002)(5001770100001)(4326007)(189998001)(356003)(586003)(76176999)(7059030);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR0301MB1629;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD005;1:T3JJjfTMYVGeNdoA+WZRuPZ4CFICDtea6kkvrdYW4eKk4MgxelRzSlJFL0B3gj8YTSVQIAI5t+mZ8pmrZMan+RcDhx+VRWTHqgUvxLL1MDAhfrPf2JA8MtxzTkDeDQLduZ3IJ+/3dymdo++SgHpxtkp3MASG9zBG06oyaQ780jxcuzRv+1yc7R652zduOfBmm2TDgVOI1IKdIZpGbMFZmL24gVrYzHUp4DM0UxswRvDPqJPqr0MDZlkWfoLzZL+b3JeGMhNUxZBt23V/YZTNBGtAYPpKdNLBJRZl8EBsrG9EASlil93pbgFGoNpECwy3zK+Sp/ENblCPjWGOj6wnkrCMMGIBerRIfzfEompwpj98Mixtzwlgjg27/99lTpVs9RS2emwdU9A0ppGRFHO9gmvdcTvKVonwx1Tx1LdA56x2QLZOh6kAvmabbdTrZ7SCbmcx55DVkc7w1B9/kvdU93M3ZWTZcT1nhUDPf8jRPMcNgqlCNxOeJlQSFG0kdje3zDwFugvuIU5YgBEM05ylu3dHQtMANIyZlEIZxaDkuhrO6HCSz0vdPk7NsIzSNcaDLV8PwuE3tahwmojj7Q16eUvR7wUYgnHRWjhyJI/em7hC94KOO9E5gLNslgJqt0nTRjed2XlAK+UScwq1bJn/r1Wh4XaY7an5MU7rOL80GHRTolZYH4AGiJH1DzXxDKLMv4NXrIru4mD4ZKocZbraWsQWf2JvVYsEE97CMc9zLY4BOsxb/KmpnXo+aL8pjzig MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 0e08c8be-63e1-4e12-40ef-08d3fef7888e X-Microsoft-Exchange-Diagnostics: 1;SN1PR0301MB1629;2:7oVGWRI9wNucxDn62C3NE3hCr5H3cFNyAvYl6xAACdUgZjbr4cIricCfdmVVxzjeYcmNbNEttE3i7YZo/dRNG2RrCTSz8LvmiE+pNLX0Ygr20kFcHJGhQpCjNAtXYJsr6U9zh84IZdGaz2vdjZFpLq4TLP6uOxgR5VJIzInXO+Q04zuW6stzhkt3MOK+5OtAuyjF9NsIWroKjVoNK68rcg==;3:pqSxH94yDDnkejG9hqYhGp2x21gHJhbvtRtASOROEFMnwCICOY3G+MDmU0gUrkAz1Olj0U+N1CcARSpeEHzvo0Lr8RjHk6nZRqtwCGX0RW5MIQ9VCktjWdYalnZT9qArDwQzJr9eWJZbDC23O0uNtJ/MjmJLHOSvDvZNMFsqlTpEWxcutxMmMjq84Lv69TUi/6z1/ePQN5hbL6iKat2m06d9uNtACvHgiYJ3VkFcUBVPbOF5l3z35553NUuu8ZVn X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR0301MB1629; X-Microsoft-Exchange-Diagnostics: 1;SN1PR0301MB1629;25:b78FYWwHCIO5bWd4/GrZ8+1q17Pl3/Yr815x0e1ZWsiVi9wFxnqTEuXBo86BcnOaYEhfBzFfklo2WEZc4FjZbYT8iV1q5seQwYh9+qwFunfDa3MuEAb44dGBtswOhrLTtUawfraxNHBCpPgtSGrreDF7gAq3KNAt+FnOA3QP77Ouzaj4h3s6boIPEJl761AVT3SATOUMI/5xt19cyZNpKF7mrIMnqgwO5/jSAktiDiMzYo1eVeTFRopVRLUuGBM/pk/hGMAqGVSJchVhpngBQ5S7dZu4ZTwIV7QSBlkZt454Pf/RWVb242st53J3n1Vji+byGZm/9oC/yLt26NwqOC0lviJzqd1Z3JN9F33tGs9qiODrmKHEIN+lZIlFO+xpibTXzKgOPB0TrloaMyfnbRn8kWokNxqcYzmcfqAc0tR0Blb91cXybVL9flegZ2doVYEtaCVzgJxB54M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1OqykkFyKHUFr7hrji/U2juKODStQdogh/tIZJ7zc3bm5bZLN5ICDJlJmXoEF3FsnQFTFvT+tsYEUXWiC70wiRto9PImiVAStalfWkakQ2k+CqT+fsys6iYNpThSeGr9a55QVcCeh+JMEnHrqInMTVnDrURjmHYT7Du8wGYC0kFg+gHK0YZSWbDlBzKvfNgBqhBI/ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(13024025)(13015025)(8121501046)(13017025)(13018025)(13023025)(5005006)(3002001)(10201501046)(6055026);SRVR:SN1PR0301MB1629;BCL:0;PCL:0;RULEID:(400006);SRVR:SN1PR0301MB1629; X-Forefront-PRVS: 0109D382B0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR0301MB1629;23:yx8a3MIvUEI+badTz+15RamODvVVyf6U+yvvmwW?= =?us-ascii?Q?iDG3Ed2NpQLLihyvGhD4sFZGkO8e9NZ3YbTSx79tkk7ku7hVpiTTLTZhQXly?= =?us-ascii?Q?2dE3mD3qFr7s4UAiB8RL/dBZkr7+ECP3Qn/BlnzC8IKhBR3vtXzWK+u4nin4?= =?us-ascii?Q?Oau8FFdIRTt0CzPxoUAhJ4a5m0DfF0Tu0ntIMuR44bzk8Dx5b4K2zPyVdWy5?= =?us-ascii?Q?UmLo0GYuB2wtpchKEY4rlgLTD9tksb2roE+EAwCKPlstU8AiSko7AMJeTb3V?= =?us-ascii?Q?zPOFgatOFGjkXJwF1womEvIPgbLzLZqT4tQHKjvwEAF3rhHNo4V5TY3teGwE?= =?us-ascii?Q?ZVphLVbJmVkxT4bZOTovI6yOHaw2QdvnMnxT//XrU2zF95Uq+1ycT4LJaahW?= =?us-ascii?Q?c2ELL+yxCp/pAUJePoYPfJlGY8JHKQ+kCAXfeY5z45HMSrjW+M9uWzE/YwDn?= =?us-ascii?Q?MpdOakVYLhOqjUiMpohDetE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saTGWxbbfR8bLEHAX5RUAlM1d30Ed/xYMplaZxhIGqhRcjzWEXUmdlAZQlFa22Igq93lRxb1gBLTM8LO8+RcgpKejUETkYSZNrFx797J6P9yLaBafqU5UJn7VHYlA4KOpcn3TOAvjpTZ0vxoA+g2HEhdXoHJ1+Vu7bE+yupF2bxQ8ZlIHBUUDrI5EDKfeQE+kwQL9bUnyHEQph7Aj8IRqU8ivTmZZ7zTULaMs;5:cdXvWPm07+DUWzAf6+lgUdJeTLwenfKSIkDcrKF2VlWUocDVwVmw4VMqATiZ+PynbUIs4KlyrOHXvfIggbqesx6CfLmBoF+JG8mfbhPFLupxZwz62CrfefuZLyViMBDG1lc4pffW1BoP+jYZN4wtnOjhrtjbEtxM1BIzTuj6wWnW0OUFAOqnL99dZmKkiB12;24:zKAIF4YnPlIJTpc2MSJfDgSijpccpsicf0ML9dRiHD4B9CjM93KEThpYnaO8yFsFzGJDosLVbCane0feSdKUHG3Ds+vmL4gVkuARrG7uBc0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN1PR0301MB1629;7:PjW5AapIMOhiT5JIJi6EwSBRo/fUObu/4HySuBHW3OAyrhH5RqogCBwlHp/2H+kTnyRCG7pd0VPd/NytORzJqTOzFAbv4TdaEYH31WH0pzWV3JqLy4zaLMGD3abTJq31+v3v3MNIave4tNaymVMV45Cs6gtfJNGfxrDCW44W0W1p4BZczu6/mqpuq6oq0rQxmeHFsMM0BZa850lUlkmUPUr1WqDUENnXzbwONJkB5k81eCB2mnv2zjMkmIRCuOs5MAf4PMRFWsI6aJTQVMyAK+kvgoYyKz2MS+Vm0fPawdxokpBgsxHOCy6B0+dzu9DZEqbrkXmsUJBA/UX9SXNCpYk1sKeDQr7eheQJEJxjwls= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2016 05:59:08.8121 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0301MB1629 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3808 Lines: 122 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 Acked-by: Ulf Hansson Acked-by: Scott Wood --- Changes for v2: - Got SVR through iomap instead of dts Changes for v3: - Managed GUTS through syscon instead of iomap in eSDHC driver Changes for v4: - Got SVR by GUTS driver instead of SYSCON Changes for v5: - Changed to get SVR through API fsl_guts_get_svr() - Combined patch 4, patch 5 and patch 6 into one Changes for v6: - Added 'Acked-by: Ulf Hansson' Changes for v7: - None Changes for v8: - Added 'Acked-by: Scott Wood' Changes for v9: - None Changes for v10: - None Changes for v11: - Changed to use soc_device_match Changes for v12: - Matched soc through .family field instead of .soc_id Changes for v13: - None Changes for v14: - None --- drivers/mmc/host/Kconfig | 1 + drivers/mmc/host/sdhci-of-esdhc.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 5274f50..a1135a9 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -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. diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index fb71c86..57bdb9e 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #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; }; /** @@ -73,6 +75,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; @@ -80,6 +84,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; } @@ -558,6 +568,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; @@ -571,6 +587,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) -- 2.1.0.27.g96db324