Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033869AbcJ1HEP (ORCPT ); Fri, 28 Oct 2016 03:04:15 -0400 Received: from mail-cys01nam02on0088.outbound.protection.outlook.com ([104.47.37.88]:10992 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030343AbcJ1HEE (ORCPT ); Fri, 28 Oct 2016 03:04:04 -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: [v15, 7/7] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0 Date: Fri, 28 Oct 2016 14:50:18 +0800 Message-ID: <1477637418-38938-8-git-send-email-yangbo.lu@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 In-Reply-To: <1477637418-38938-1-git-send-email-yangbo.lu@nxp.com> References: <1477637418-38938-1-git-send-email-yangbo.lu@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131221118412822934;(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)(50466002)(48376002)(586003)(106466001)(230783001)(189998001)(36756003)(105606002)(77096005)(92566002)(4326007)(68736007)(2906002)(33646002)(50986999)(76176999)(19580395003)(229853001)(19580405001)(47776003)(97736004)(5001770100001)(8936002)(50226002)(81156014)(5660300001)(86362001)(81166006)(7846002)(5003940100001)(356003)(85426001)(2950100002)(8666005)(6666003)(8676002)(104016004)(305945005)(87936001)(626004)(7416002)(7059030);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR0301MB1627;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11OLC002;1:SnIOnMl2F7XKYfapc3pcxqvWPiiaZW3gIhlKBWFHaTnSs8pKft6AZHwoE42HJVZGuq/ivpHXw4035W7sRZxRR1yP6yd2R+ywkKaFLld+/pCcUyBAWoRBaDA/ucqhB9DZajWEBz5p/f5VW0uBHSdV8HLVubSq7OHHl4PbQth27QIgWqJeRs8V+LcXPK3KAfJ9/DH/o/LDa4GLx/Mn4HeUmpDv8Lwxyv9W2AWeb/1syGTFjP8sdc66JFKo5zG64T5oitQMPi4zxpDikjUpOFHorAg1sRSNRi9fC1+zEaHgOkWr84psiZ/fX15vp4WQ80JueaLgtRSlbxDOsbbABncbrgZEoxbG4ENt4TiqHHHRoPXylt5HqAJarNgLQXwkeE92vUmMgjSMc55oXqxU6PSVogpaYk7RbZ+srbjHjN5cRbMPqa1PyUGMQP7Va7woBz6I3lXn+QDNkAmzBYsL8n5ts4NmZSUsUzdwtR89NMW1Wj5GdQlVoXsaLy2cZAy/BoVzXWBJwCSgvY97QsyMdQbTJH0eFn9cyd2jdVvJxmnPNCq+XBE+SqDgu5m60Jx+ggXhfsScUU6AeznakgvbyQwhwT8tsOFTrDTvrkcvVvnE/HyZD1BzfocWHMRvJoGL4alPu5ab8mL0pvMCQ1HJopC68G7zXCzTRrIJw788jDvj5dqsZjkm+l5P8UFxWspOQR1uZnJHqpiKu0sEN0W5m4ZvCP2ydsEpG+DhKuXgHBtKkJnGsI4OEiU4sCOq/arJyHVI MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 30136734-c5fb-4b94-385a-08d3ff00987b X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB1627;2:7BBYRqQirsrLvVBdNVQiiNGF6uRJ/dS/+KSnQIZwm1rIvyE3eDVG+pDC/7JrUtV2FdSfT+9cJTImn3/qrZYkCZZgZOSOAhScZMUNC7uQQUFFz2b9/nZotsxBTdimRbRSdt08nqe+6VwL94P161rYBqbZZLR3/Rpt4mbol4/xGtZ7nN+F2x1PA9K5GOSJPnybCO9Dv3tMCfyLOWJviKGYBg==;3:U6AqMo9XrnT1X1TspiaG/XkZFCDFsmM6jB2pm1Hc/gIHVjW5rL+pD7XkiQoILoCThlbNhbQikPUQkjPemkgmot/wcn7547ovoYgcFVocEoSJ9HGePFpqRyQ43GydAHLsuzZLIpCE89GJg3G31KdHaBL5DFl1wr2MwkvaIeF1peouyJkBXWQ9yucR6t8d0xuRdY8Xk6XJ+D+ApWMogvwV5Q+h7T+yVfNibhus2YwvfEm+2qNHZpDuAWJyvHDMDY20 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1627; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB1627;25:jJuTSWXn4I25CjpBszeS21KJ5rz6JozmFnMsLNE8B6ARgMl2KuanjEobS+63d/Mz2xBdTYU3596mCpqVWdBwud8Wn5yBANU4LNLgV9ByqSUODjfN0WgQWRmcp5j3U4hZdGnqwH7gKfISjW54iJ2KVfFIBKlDNvs78YKrqgUcLXAjR3kUMgyB6e/Io73QlBIZaJ2kISRyRvWFZ8xo6WX9Mu7IkBkLteM6Q+olEvWr+Vyo8Cqa7CfZybPp1VZQmaljj7awmcrrytiR229mufj0T2JQMP6KZShmRzRdlvY2tvb7/OBqY5omiYQgvvA0tPGJVmicDu7yzR0BPcuKkNxzBT0LZy1ZSikQC05gmnwCPlbmKdnKC5gbkyjSHnu4vYXEColnL0fj+1YFyhwZ+0UWFf/aYonSPW4bsDnwEaWYZlGUzG4513Gqex4waEbaYSuafAViVUucaiE9IdEnugbU3A==;31:P8IgSjpSgQXs3SPDOHDM9bG3trN0j5Q/qMGwCKfirJs8pbIfcVTFLmfpDgoaSy0WqqeLU3UQ80UWz1R21UUzoPlXa1r5Tgt6DZOe88FCQnZNtNSK9cu+ETxJtOz/9aoAUTHhfGZzbbuJWNcClpc35iQ/z8Eq0Is2akBYl8jyaM0RVNWCU7GV5t/Vcm8c8mPd72TdE83TYn386CdNHLcyIP0ZE8GAKIEEPMmz/JwqMm562Zs4qOiJ4/DgoEvpqSOj2yiI8C7gkEGMXw0MZV8vj2kWKIjIoEsAXVRX25Jdg0s= 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)(13023025)(13015025)(13018025)(13017025)(8121501046)(5005006)(10201501046)(3002001)(6055026);SRVR:CY1PR0301MB1627;BCL:0;PCL:0;RULEID:(400006);SRVR:CY1PR0301MB1627; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB1627;4:HJYEmt3UrBgVlFsctUDSC2YWQWJ4gUXB75NnHNmUdG40unJJ2kQ5yORLHM//MXjMSk6ej4FYYwjTMiqviNXeRwdiN5h3ldL7n5iNWJ8jrl66HryRvF3jvxJWwk12T4t6HlVspv1ZUcEKL385UyowNxIIWlFHokSENFkzF0Zv6AwBD0ttXN7PtOckUobjNBht0peG7joOwyqV/PADWstSHxnWEQuNFjny47ebF09pCx9iyETL7ZE4VT91gdFgKwehcgK8Ks1JvOwxGxrmhhCEm7fB8EdgaMNXb2VRC4KrD+f3bsPbkWAP97Az8IlDVzQBOTQGoMLXsGLSzH4g5Ymbis7EkT3mzOajs+dCz2gGKFFh1WiZF0oT2ttRKxYGUc78c/Ze4i3qav3LCIW3qz1EgHXuv1/fPBxi4fZN3mZJhk9EvZKFKdObi+boteYU1MA4vHfAATFF32sPd1sTJO8VcGgXt5/Bqfi5ItZi4O/O1A0x+B6Lu10Y234zPq6pMosErNOFigJvxULZyNFkPDT8378oQVMMRqN98ANAgSYbjZWLhcxFOg7t3dLHIQnDA4ph X-Forefront-PRVS: 0109D382B0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR0301MB1627;23:h6hoUxA/rFTftzlk1dvuSOgvoU+rgWN09t8neC9?= =?us-ascii?Q?82TvGV35o9zGVBpbj6ZA5vaujikroF7b/9pedM/QCVWgIltW+NbRijZBw+9Y?= =?us-ascii?Q?E8xHw/t6K5d13WRtNACHigE5P465joXro1E/Lz22UndSV0Hyw2htGgSmP2x8?= =?us-ascii?Q?fuWgQytWOXInhWkVL8ZO+IThngvPnMzywVwNsr21hbs3JWsmZh0F8u79sGEt?= =?us-ascii?Q?5uaqbf9jYMstGrRZN6VmKkK2Co76qoDucdrYhSVGwhnktm8oj0y0E2g4nuLr?= =?us-ascii?Q?9MKd6ayB1Lk6Yk5SRz0dFbwvly/hx86TDzyLgeOAmuEYbjK4ixrFGTAYb3TA?= =?us-ascii?Q?ZNLWOuOo4fEt1gCpbwI+XksWNQrmAQ2PX6B80CC74g53C28gOnOJ2IjMq4TQ?= =?us-ascii?Q?fE5BlnCPYCHG1frprgcHNIw6dZ233xW5jupG7RB8BYL03zmekGLS+Bg7g7vR?= =?us-ascii?Q?QF7nL8Opm9onuMFp+JtkXouYEn1l+LVM9p5FzoGjgv9e3rpEQ9tDBM2Gmvf0?= =?us-ascii?Q?DjYK1nHGhk7u4bYzdsvpPbzFGBtedwJDVKB6Ncf9GMGwXsJ1BBIpx8W8uRdw?= =?us-ascii?Q?zy0sA833W9WRX3mVbZ3d5gY9QCSODfaauTrUdwGHgpSmRe8G3Y517Umr0+PA?= =?us-ascii?Q?CfBQHAJltXFjV4JfEoruiNooiTkfSRl2oUbd5ZTErj+nG3gw0LdsHrqNx/dV?= =?us-ascii?Q?X0cX9rAUZpRtHAjMJQd6lE9lWIMv2mEeAEtwsc1THHUc71+rb9FXsCDG2b+V?= =?us-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jNz705gWO/DPE05ZYf3AwExgRz8v/wHcmfxA+4cHG;24:T0Vd6Iv/crpFM/R6bU8SfaraAlXdDbWZBjq7lBaTg14SpyAUvmWHVjdAZZqyaUmmDACtSe6I4PeiDUsC+awt/+ZUQYuvq6TR31bthk3mn/E= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB1627;7:TvW63/PWnnfxhk9k7gksNr8wYNF11zXcOCWOn/0Cnr9s0hPm+YvAWyJ5Ja3gg/FTcNvqS2BTeYyVAMkUzRnRtFFEEHZdiP/yeXIalq+SvG76fyzxQUQ6Yd93LSt0/JjntVtlKJndRiPWguPaRkOs5ZXFqUbqowOP/Q4RoLyVvSP0fjF5rRjRvK3cNGsQp2JUPjn+Cifs2T/mN9UDr5R2uxrwhJ9EwPFJ9KU37nXIYHhe2XjO1ufUxL5rWvjWP8lgV9lRpFut0ZblwdQX+/X8jsqAxPts9/oULBIEdWROxwyh+S6lab7d+ZFbhESLTAe+qNWsrkeQIFv2z0MOt92GC4/dDDiuB4Dbz27CLB3HX5k= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2016 07:04:01.0327 (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: CY1PR0301MB1627 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3833 Lines: 124 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 Changes for v15: - 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