Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758695AbcDADRt (ORCPT ); Thu, 31 Mar 2016 23:17:49 -0400 Received: from mail-bn1on0070.outbound.protection.outlook.com ([157.56.110.70]:37568 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758475AbcDADR3 (ORCPT ); Thu, 31 Mar 2016 23:17:29 -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=none action=none header.from=nxp.com; From: Yangbo Lu To: , , , , , , , , CC: Rob Herring , , Russell King , Jochen Friedrich , Joerg Roedel , Claudiu Manoil , , Bhupesh Sharma , "Zhao Qiang" , Kumar Gala , "Santosh Shilimkar" , , , Yangbo Lu Subject: [v7, 5/5] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0 Date: Fri, 1 Apr 2016 11:07:31 +0800 Message-ID: <1459480051-3701-6-git-send-email-yangbo.lu@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 In-Reply-To: <1459480051-3701-1-git-send-email-yangbo.lu@nxp.com> References: <1459480051-3701-1-git-send-email-yangbo.lu@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131039542440080906;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.168.50;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(979002)(6009001)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(50226001)(586003)(1096002)(1220700001)(106466001)(5001770100001)(76176999)(2201001)(36756003)(86362001)(230783001)(81166005)(105606002)(19580405001)(229853001)(19580395003)(5008740100001)(189998001)(92566002)(85426001)(48376002)(50466002)(6806005)(104016004)(50986999)(2906002)(2950100001)(47776003)(87936001)(5003940100001)(4326007)(77096005)(33646002)(11100500001)(7059030)(2101003)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR0301MB1227;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:ovrnspm;A:1;MX:1;PTR:InfoDomainNonexistent;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD028;1:VvpbmMf+h2HgSGJLLlbqPsk07PUpo/IQ498Efci0EeDUB6NM5EXtJYQJPyai8kQkwdBphn1UQkdy9lcd495Fg55OUBGE4N+CItO2d22cjCyHOosW9RyJUdkMSvluQb8HYrBwad8H7trhjNC9G8dch+cAjpXURCTUmuCM+P0TMOE8s+Bq2KdUP8EgpTf1kPcWx0tVQxtz8Bhsxim1B7eD8LsqTJgEk64mUetetOZj5akz9oJfShCiOv82GNB0BUzoG09lZHxGdz/jsVA5RBOLk/sPibMGyCEv/iHx8W3Jw8Pw7yN7/x34yoc0AzEKPCQcJHUwx0zp/NEFROR7H+ZbEq+Rs5tiBVg3Heh83nNT2cN2QHUbLbIaR47ppr3N1LGeeupVORvjsrIYW9lE7s1KjT3AmvS6+dI3zgvIPkcE/Rm2zarkaGjX/5BMaT/giujUMJmJ9Wjn2ELSJxf3e1nEA6t7s4XKnF5NAfYPcZyVQ/yMqXSFNL3jRdjiHRltICUXH1pWysSD4hjfSAqcVdDjvd8Lp6l+GYTikggbXj8ejGIkyre317NQq+jikIz7/UQi+Rzc8w8iJf6CAd7fT7g2C0W57zDEfuw3NuZUDNoOW0eIp3hJeTFZWpIEFkJHNqvS24KHLVaXox3423HNbtSkMhdApGBa8+yqKJ+s5XmdcfM8/4EjjKuX1jgzZm9rF2XZEG0K6bXdUsdP2k0yBpUb8A== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 45e4fe30-ed31-4c5f-b60a-08d359dc2522 X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB1227;2:1Tsztc9AdMkvpakJFiv4dWbV0UaVpL5Hvz8PFQuMEKx4JXr6RMpQSZ3r2FBYcxljPU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3V6lfu+Kvpd5eyZAzcAZV38R4TxH X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(13024025)(8121501046)(13023025)(13018025)(13017025)(13015025)(5005006)(10201501046)(3002001);SRVR:CY1PR0301MB1227;BCL:0;PCL:0;RULEID:(400006);SRVR:CY1PR0301MB1227; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB1227;4:yUCqavW4YCSDPtPxJu9YRs5Ug+dkWUO5YLdLI2wS6oqdSRHyIaU9tg4oAoXuIJ5z7ctHAuUfB9/XlWwOKz+1WA7yGRB/kvA2C0Wo+nmoXqIJRljCi7EfHOLKsESFFzdIfO5RLrHuMadKYYcdDvD4cTTSHyb+7aFOwn33Lfy1QEAbYIaI2z6onKXkGW829fd3qDF56sHEITzEmGHzhS2ESq0k+NzdQcl7eeDjElpxwvxWPXzrSfyjazMx5QMHhUHvkFRK8asBy+7A78QW4EpLNrFm22aFMXQNDgwlkn0uJpLl0mzLzeohN2LKn3grzy3yE9vwRb/9LJRyQCTF4hOgFJDRAjEZa2MMFFUgHZhj3LJOGNpzMFScwTKysreY9qCLOnJG2MqizKKSdhU/x9ttGqD9lZWcuP0OrHRTDguShA+81KSDCrDv2XQxPvhw7uvRMGZz7IBQDP4jRo9YpGqBBw== X-Forefront-PRVS: 0899B47777 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR0301MB1227;23:3P6BXB6FEbnxeVbV/SZRiKua0MS98+W51HAWD+L?= =?us-ascii?Q?bCNpRR6aNIddCP0rphmLKkyP7Mb5WCnl11uycJdzDFZRYVEkuc90Lt4VyEgI?= =?us-ascii?Q?/xuz3jxl+yOAj+Gi0Ujlh97Rx0AMa/r9QnDjJtdTWAnSzUGvBx9XY4Ct/jcp?= =?us-ascii?Q?oUZjkU/tqdIYYad7M4+JwLwnOHqRi89+NqRoMnSk2/RtNI36b7bz54yuhYxt?= =?us-ascii?Q?YOWEmunpN21U9x1HNJtef2mDIyaTt3h1TZn9oUHOxBMia+BY7M12ykC3KQES?= =?us-ascii?Q?jkTWJfOCYW2P89rvjJ2EkFiuHzFBJP9Rd+/4sK0DrPRxBeluEyelGv8/iuvI?= =?us-ascii?Q?cb0M3pWR3bqklNuDpBzJTU1RUYX4KtpivDl/1nrV0nOiQmdiyfYctB4AQGXQ?= =?us-ascii?Q?H6UWvYM71+shIR1tJd4GYYuSS1xbNovT6zAnWHzaX0hyefJaFivogtuIrIA2?= =?us-ascii?Q?ZaPwiIv8In9jttg90LKq7EHc/aFUA3nSZClgLLvIMbSu78CC80L3F3YF1/dg?= =?us-ascii?Q?dlLRfGcQG+Jp7hjB65sFlKoFMH67AEPWsUKs1bKLi23Aema6MDiR6+BPyzis?= =?us-ascii?Q?DL4quvoCVKVR07FZPcPv20I1BX6Hi+XZWwDi3QvJPc3TZTckrF4bRGoQL/qO?= =?us-ascii?Q?JZhcsHMBpW0ROUmd4Et9vtKtrkSH7acRSlwWMiVxvVcjTxi8dNZpm6XnOQe3?= =?us-ascii?Q?eRsTEAo91jYI3YJuiJDwuj9imytMUi80fIhAcrxzcYQPzD9wPfnhMu02elig?= =?us-ascii?Q?5PijmLue5FE98b2tf8vk4SEelHH1TsR5iXBNlOGcUUCH61/eQDWNVrkQkDBd?= =?us-ascii?Q?j8ZHg54bRn7h2G8jGLIb7GnXft4We0olAapECD6DWN7cQgRgnjsUaR+n23JD?= =?us-ascii?Q?oLGkVoBCztq320miJ6MAOESrMZRxCUopz9RBRmHEt55GU3YrGk4iTqE4unfI?= =?us-ascii?Q?5gWg2Xw6escu3Fs5Zrd9yTGa3YgshxEaMt8hjPSqV0+K7D1M0KmuqVqJVkL7?= =?us-ascii?Q?T4jvSqsfTp6yoOQqgV2yFp61Dh/0DcklI61y4mTfSkBAndccx7g0A4LWghGa?= =?us-ascii?Q?FjZGDVWE6+gujHSg0azSnkIwv+F92iDkdUQt1GPwu3XScBAZ68jZH+4t03P/?= =?us-ascii?Q?Wag9uBdTci9mKmso4x3pYdMPUyi7mSWpvbOxzVHciWm/abBTXbdGNSSZ1B2F?= =?us-ascii?Q?RFuDdaTlKyd4l5m5PhdtXLEmnFDMWGMm5Jj3G?= X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB1227;5:x2eE6YvBiE/7HxmCcHDbvH92dOu62T4HUl0E7ZjBvNM9nz9F21BrFvJBy5Oc/dpp09IrKn6NES6Hhjz6gjK3janoDtG0xcqis7frruoiMYAdi+//fCq038w64oChybrx9mGe3OpncGdLp0uyB3i4Uu9RWF4OQv4ayKg+thAWNRI=;24:+95+iKtG4+akZpFoobxuwG7/2W4tZRGzHwA4bsHlZByjfbVa2SajZLhNWHxTcURbVj2sn57Tfi2M/vj2wuLlrPad6sFr2DrNOiKErokpp68= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2016 03:17:23.7584 (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: CY1PR0301MB1227 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3328 Lines: 107 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 get SVR(System version register). 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 --- 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 --- drivers/mmc/host/Kconfig | 1 + drivers/mmc/host/sdhci-of-esdhc.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 04feea8..5743b05 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -142,6 +142,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 3f34d35..68cc020 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include "sdhci-pltfm.h" #include "sdhci-esdhc.h" @@ -28,6 +30,8 @@ struct sdhci_esdhc { u8 vendor_ver; u8 spec_ver; + u32 soc_ver; + u8 soc_rev; }; /** @@ -73,6 +77,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 +86,13 @@ 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->soc_ver == SVR_T4240) && (esdhc->soc_rev <= 0x20)) + ret = (VENDOR_V_23 << SDHCI_VENDOR_VER_SHIFT) | SDHCI_SPEC_200; return ret; } @@ -567,10 +580,20 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host) struct sdhci_pltfm_host *pltfm_host; struct sdhci_esdhc *esdhc; u16 host_ver; + u32 svr; pltfm_host = sdhci_priv(host); esdhc = sdhci_pltfm_priv(pltfm_host); + fsl_guts_init(); + svr = fsl_guts_get_svr(); + if (svr) { + esdhc->soc_ver = SVR_SOC_VER(svr); + esdhc->soc_rev = SVR_REV(svr); + } else { + dev_err(&pdev->dev, "Failed to get SVR value!\n"); + } + host_ver = sdhci_readw(host, SDHCI_HOST_VERSION); esdhc->vendor_ver = (host_ver & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT; -- 2.1.0.27.g96db324