Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755913AbcJ1Edl (ORCPT ); Fri, 28 Oct 2016 00:33:41 -0400 Received: from mail-sn1nam02on0083.outbound.protection.outlook.com ([104.47.36.83]:32096 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755185AbcJ1Edh (ORCPT ); Fri, 28 Oct 2016 00:33:37 -0400 X-Greylist: delayed 1951 seconds by postgrey-1.27 at vger.kernel.org; Fri, 28 Oct 2016 00:33:36 EDT 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: [v13, 8/8] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0 Date: Fri, 28 Oct 2016 11:32:34 +0800 Message-ID: <1477625554-46700-9-git-send-email-yangbo.lu@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 In-Reply-To: <1477625554-46700-1-git-send-email-yangbo.lu@nxp.com> References: <1477625554-46700-1-git-send-email-yangbo.lu@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131220999828040133;(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)(1109001)(1110001)(339900001)(189002)(199003)(105606002)(47776003)(48376002)(230783001)(5003940100001)(50466002)(106466001)(68736007)(229853001)(104016004)(8936002)(77096005)(189998001)(586003)(87936001)(86362001)(2906002)(4326007)(36756003)(50226002)(92566002)(97736004)(5001770100001)(50986999)(76176999)(2950100002)(356003)(6666003)(11100500001)(8666005)(626004)(85426001)(7416002)(305945005)(7846002)(81166006)(5660300001)(81156014)(33646002)(8676002)(19580395003)(19580405001)(7059030);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR0301MB1630;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD037;1:JJJEiPHKlLZ4MiZrtxZTkXMh3sxzS0T3rZvMJnEQhtVj75Ya7V/7uVxJO9zgnT/otly2Cw/Msm8hWZsehtkAuVY02ErQtxS/9sZ5kb1Vb/agM92VHvYf2816DkD3pdlh9Mbhg2O/KOSF39T9dt1MZOSHhFofY5aZfjWpmyoC9zJupw8CV4lY8Bz7sjTMyO0T1sax+w0cRHSkF2PUKQij1KfSDfXJqc4K4L8XMDBr0lQhckvI7N3F60fGvfwEDu9Sukg78afXAB2qxeXLTpc2w6MBkEvR+jUyXWVCGqEwNiT7MPyeZ2oXGFPabIm4tlckcxahPvBjo16fwlpuZm8+6Se4hhR26UEb5pLIk4+QTLfpTdtXSP4Ko0TgeaM4kGDj4/EqmnEBD6JRIa6atDlDWQ64h1TzApK0o5ApiCToAekjBx7Ai80HVeMCxvJOAWRaevtKx6U3HP8MEuSh6xPEOMQVNgOXeXoUJ3htc8LJBijzke0yE3NtAO8NdL46GOjjiERIheXP5k5g15aGLeqTUQGMv7JAMbt/UbK8lZEMCmtUdYii9zSU9l6Qlw4Cb8QYjxoZhg/j9iuxDmIaIE3x0GU26f6uZL+ZTf9RyKG+ie+5JKom+MWOs4lrRiKYYwmJ6O3IeVlc8fIi2iG+oXfkDXvcP6EoDlSboVSRxlY2WwfpcSv917RaWzvuFYwu4MOYrB2O9+6dk68c5Jxqh5N/tba9oXOuuMTreeQSj2m7hTpNk1mX5P3il9yb1r7lpXFj MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: bf1f3b59-3d7b-4a8d-0864-08d3fee4fc47 X-Microsoft-Exchange-Diagnostics: 1;SN1PR0301MB1630;2:2VJ2WVxcPKSw/pYJkJocDZGfZ+1orGDBvLZ4UHlVlriZW2u5x1ApCYNwt9w4uTPun8CDktovoZY2TPXKe1r0rbE6DVor8ogcEhFtSvAdw3jSSeP0BWpj6JTvcrat900ERq54xNMnGZVdW+U81ZcnR6nN+nDCSClsUqrH1HyJ/GYgGSvoK6wvJRkWrmJAo6cpmEC5vP277jGfOnEmm0oqBw==;3:na44YpauxRUGjV90Kt+Negg4rsqr7aq62VsdpESxo1P0xSC3RFtlcsGdRo9Up5sHAnW0IWP5xqCvmKhvT61663R+oos6Wo31t7cHVs8EyX0+wOwUtxXGYp/BIF4rwiP1548derslldK/ru9Rj+lTjEpNWmVpGL2zNvXGIrYc+eLL7vATM7V+EaL7lyjz0kQcR0no0gatQ+I6RUhktWEsCfzxcAcHGB0UwLzhpKwbE71Dx8PERHflqhEV0ra1EIAt X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR0301MB1630; X-Microsoft-Exchange-Diagnostics: 1;SN1PR0301MB1630;25:bcFXFk+5d7xB5V20d5Ajnltd2oHlvyOu1EVjxVgS/uU5H03VVsPpUc1RMSbroYtizzLUJ6nm5OlRQ0yzZVYKz+PZ/fsYrTi78dVLHwcE3iqUhK2Lrc5wGwSv1bZZQmyFHv/svTE0xmM2qkzt4IzJgOKYB+uKZdiu+S5PyJiAkcAt3snviP5/ZMLA9LqLacUuT3xrykcqMTt641V0NJ9NdF9ioReLpY/T/gYjsiJcjxLr/Ritt1ZR7rAwIxMIbreHUIN9XNOM6PmyeEvPCLqJ8riOpCvWtmBV3vG+ftteoeIVAU03dFcJ7BawNgerO8hKeKjhkLoE0/A8sT9xBmTUfk1rMQUdwnnGVo/DdlaVRTJ2HoQg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7f/W2vmRPkFvSXSuOvL0ogeYCz/t7PXiv6VfNTSUpk2yycAmsEvx3iBkfy5JEr2OH/QdzTscWdiRbM3qA0CE+o5721fueKyjUJdUkvEcvZtdFGpccQUj8fhXtC8sY5BwPdsieMZoFQJYgIwxgrg8xU90t6iXE+mMikUyMgWnFKdmDOatX9A5RDYPc81eDT477QPJHiXSJp2E+M4w9yoALO+kG1sE+ZGO3duEv6A4RqIgplkDaA497kg 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)(13018025)(13015025)(13017025)(13024025)(8121501046)(5005006)(13023025)(3002001)(10201501046)(6055026);SRVR:SN1PR0301MB1630;BCL:0;PCL:0;RULEID:(400006);SRVR:SN1PR0301MB1630; X-Forefront-PRVS: 0109D382B0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR0301MB1630;23:/AvpZymkdHJQCpmblRQZuDnvbBatWpxBHcQjNJE?= =?us-ascii?Q?SLVRT7QB4zMuYjRlbvm8aVdjIk3Nyx+FCHr5TJtzYp5t8U4PTxY+2PkdiLkz?= =?us-ascii?Q?aoBli7VDA1Eo/WV2VlToztRE8TlRFcXY5xVuS2u4dgOZib9EADV7QvsZf52d?= =?us-ascii?Q?KqYBlK2tIvFbn30E5PGMTawX7xOR8wbDZ1/ITEbu5I1cptBEC1uA4lVDu+6n?= =?us-ascii?Q?PFatMbV0GPGreuj6PEq862vxtB4a0PRcRsaI+E8h68a9bsrvEUG1vvs56UXM?= =?us-ascii?Q?eRv8xgvYjWrLVtqqTPcqkqkr30D4MbusCGNTWmDhEXLAELUnEdbx5W/adZxW?= =?us-ascii?Q?2iO1EnBGqbujR99YPi7naAbXvJcrErVGIw8OlmE7UfAhYegZn7q/bBlfdVzT?= =?us-ascii?Q?vBGy0Vahc8dkCpTCcCx/J3eGUlcoCcNlyxP4h73atnbQzBu10Mb2KNl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6L/t4ePr1MfeZyYZFmgS2MVicym3n632ipx8sxu/kBc+uzXSTYl7KMn65qHUKKQqFrSZi5Sx+T2PqCY/0F0QlM1gGCYNtVzkRi+s2WXeC2eaviqUlBDX4w6PQhCxibIwSuEpIC5dBT0NJRSzZcfwMC8oDeVn9nIhvtl8Jvl2AJrYmnLeT5VbH8AqYI9IWdv/azkplWLxKJzceBSrE4ysNNjXXduHFfE4QokGCBpsaLJkk+WI7mHGUUMtOy+ihU3JhVG6UIThkxpJl;5:0jutQujASJ/tMtV3TOgqamkwXLrYLvwtm7M97EvqII+64LuDtBXIH3EJhbT1EGSg9XK1TowKHuDxn85YpZO18GbGbX+re/OwfbWkEeynIOhSWpgFiFJE3LsC2cshTwxvh/3+ynmjtUAiRUku4WVvG+ycGlf1oW50FJyRMzKyPGqFrPLUAwYCRernOm/iqaL+;24:56FZUZfkUR/MzjM7tRv/avw3CfCq+Hy+fJzy6qtdGptvmtkOu/XUaiT2SzvOOygMtesIfkL7YPaOto1OY8K8uIi2zcjmPW7N7rb9zthukOw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN1PR0301MB1630;7:f7JJiNNeVH+eGr93cQtgGL4qWDO1zX0ZNsGBm9mjYz1zYFtk5M+U/o1uf5Sg9oaU1PbqUd9WaFRhZBXkqThBM/zUO3ibS5UgD2pOqrWe6RRht19Wij1CtlRgG+jX+baNBeyjm1qZ3NAfNQ4MsLSZEputFFW0zs9Tw8sXRo05OzXW/vLzMAEEvDCV9+BozlW1TiaippN25v4AClCCxc62UpEH1GeR4FGca94Ra75F4sY2iKRPl4CL+RdWvTGyHXmZL4ux5AcK1Ue+so5Kj4YwBQLG6EtJW92jQSe79f0CW4B71phSMGPexd8B7mHasWAARQ7N6oO4ZxzmsPfN+DjMq9gM8/W7sMMH/XoUWHfIRBY= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2016 03:46:22.5076 (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: SN1PR0301MB1630 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3783 Lines: 120 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 --- 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