From patchwork Fri Apr 22 06:27:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangbo Lu X-Patchwork-Id: 8906191 Return-Path: X-Original-To: patchwork-linux-clk@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4D28B9F1D3 for ; Fri, 22 Apr 2016 06:38:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 496A620254 for ; Fri, 22 Apr 2016 06:38:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3CF98201EF for ; Fri, 22 Apr 2016 06:38:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752702AbcDVGiK (ORCPT ); Fri, 22 Apr 2016 02:38:10 -0400 Received: from mail-bn1bon0072.outbound.protection.outlook.com ([157.56.111.72]:3776 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751338AbcDVGh6 (ORCPT ); Fri, 22 Apr 2016 02:37:58 -0400 Received: from BN3PR0301CA0057.namprd03.prod.outlook.com (10.160.152.153) by CY1PR0301MB1227.namprd03.prod.outlook.com (10.161.212.149) with Microsoft SMTP Server (TLS) id 15.1.466.19; Fri, 22 Apr 2016 06:37:55 +0000 Received: from BY2FFO11FD036.protection.gbl (2a01:111:f400:7c0c::148) by BN3PR0301CA0057.outlook.office365.com (2a01:111:e400:401e::25) with Microsoft SMTP Server (TLS) id 15.1.466.19 via Frontend Transport; Fri, 22 Apr 2016 06:37:54 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11FD036.mail.protection.outlook.com (10.1.14.221) with Microsoft SMTP Server (TLS) id 15.1.472.8 via Frontend Transport; Fri, 22 Apr 2016 06:37:54 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id u3M6b1Ca016375; Thu, 21 Apr 2016 23:37:48 -0700 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: [v8, 7/7] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0 Date: Fri, 22 Apr 2016 14:27:44 +0800 Message-ID: <1461306464-19521-8-git-send-email-yangbo.lu@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 In-Reply-To: <1461306464-19521-1-git-send-email-yangbo.lu@nxp.com> References: <1461306464-19521-1-git-send-email-yangbo.lu@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131057806748150304; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(50986999)(33646002)(48376002)(47776003)(87936001)(50466002)(1096002)(11100500001)(189998001)(6806005)(5001770100001)(5003940100001)(104016004)(2906002)(5008740100001)(81166005)(77096005)(1220700001)(586003)(106466001)(229853001)(86362001)(2950100001)(105606002)(2201001)(50226001)(230783001)(85426001)(4326007)(92566002)(36756003)(76176999)(19580395003)(19580405001)(7059030)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1227; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD036; 1:rQynfM+DwSFBSdX5wgac+2OyGyFkPPWpPEdM/Hz6XUeTcMOl+Qpy0vMZZstiEGh8QjQx8HF8PZt9utThhWn0Os5ClT2U0SGZCRXLdUg+JiYFc0pBjxa+b+9ZDAwRpPT+aAOb0xRhmSIS0l8GEjWlg/zfLOM65YksI6QDFIg9tN/Ns0zaxQzHJEqevS9FJRAO/51l0LiiKzCv54lDcRPTo7dyriq8su4kVlfNTem9QRr6yVYl7oiEpPv/dInQru3oyYFoUJFRxQUwYkBHHOioMAx+omhGhEqSG6AsqvCcU36feSPYM82DloCnHIiy+atDLTh/kr1Csb3lGx9mLsTWudbRNUgnSaYdYglqzuUmDyKWCIfuyPeXI1oKhsqk291MJhnpn5MeQ0gngMbUTGSmhkcZyEPR0joBiMmjdR3kE4PuuCTKV/JEuB5ZGYVTVuirRlEgx9LDttBKps6yFnWcK/fSeUYATHAS1EPhT+gnWPe5ZI7qKhnUzVU7iNy8D6DvK8dngLn4805yLGrncPtb45D8q+WwLkKo8+Eo8GJdaS2PDf9LcdIGodw7VNhBcXQROxsNg0hmu354DC3DuPdk3gXfueOL/1KJK1DiUeeIc0IjAyIpGJBcnTF8/7XFpaaM7Q3c1DhYIAlhiBqZRrZ8oHVtXczatTO2MBmiuSD3ehCcM3ARwsUTL7V/YNTKPQW5mmKeYInvi4W1LOCFtX4H59xzXrqHZXjV+hMD+fM+a5Q= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 7ad79f1b-58ba-42b6-ea20-08d36a78a2ba X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1227; 2:RQlnU+bIwH7j1l0nZDv+n+TnByur5qZJRM3PlVNL59YJv2YeiHxqZfPPrr9UwRBaursCNTik5WDQMqCfIliv1sqNTb2lvhBeAxba9W5M8MU30H1qInP1EtY9or1jB8BvMDqt8mK1kyFXtKl1ehjjLYIAG/f4Ac3QMt9o46gACgKsFMpf8+92NM9Fqyve5bbB; 3:hJL/cB/+9UxIREoAYlefPD8GSXQ3rv79ZDLsZq6XMjLaGGPcPzrIiLZp2gOFP3rPYKaOv12fMn22d8qAWzvMx4PdDleEeHHZsRdUGuEt1ocsa87jFqgsz34YWhxHShhq27IQlB1kGE6FP9xjdimaJEzQZrJhNtOo6bb6KxRq2B5KF5rBPSkX6hyEioMFWgvk79g1urgN7yICTymC3MVa+BvpHSlmoicicGdkrcaUbsw=; 25:VSDwm8Lx3hjV6bYdfYmFtXjKuPfZlSvxaNKOANyf0aqgO5XAb3uPgaQm7pPz3LlNW3bMY4Ozrjiwso35z7V/sbdF2c4/Qu1aJo7/oqDoCHeLZ3JLo4bO4YBRvkJrp+yStmbSvHB9HUzBKPJNWa+QJ6MjtHU/77ccSE1FmaRh8tUlN5qvEWP2fsSKTeLVzXJBTySjVD1ZPWFnnkE0M6eAnfwVQIfw3aVs+dMwlE0Ts1kMyFe+LfMW6RHAKNgLBXBeskzMQEhJOXdfDObu1X6QwFc/R/QSk4g1nTyohm0HqsVHK8n1nRllG/at4MKtlhBR6JAnLrCchYtLVo7LT6VrSA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1227; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13017025)(13024025)(5005006)(13018025)(13015025)(8121501046)(13023025)(3002001)(10201501046)(6055026); SRVR:CY1PR0301MB1227; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB1227; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1227; 4:LpPQYzmGCzupUp92DC3G6mfLVO4M93Ba6BD8iVVD3I6YTFrfj9ialII8gbzeFQfDfgENPnXsjg93+GGJ18gtxSmrHxwgCY+eszN96kj9Xlk50Ojau1ZgR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vbg1EkslW4Fr9HueY1JVSiW51KrMIGGtYwfBuKJKxZIDWW+p9O8XGGVo9T3LXZjyDLM3bssvk=; 7:qGAiRytS3Hv/4yvETxcmXL4HVsti0gCBv8Ft6N2+MVihguG1OzTjntMBCTBIAhjRqiVdbIrCykuzAWvWqEPN9d/BFfDEKOOC/AO6FG3HVDM1ctQcPT8iY1SP73P+SYpGSgAf1WkGAPhRuZqfoGnXjEtz1yc5PzTTPxVzJUsdpif37Ab4OUWtmoeogLNAlDyg9PXIYtrYyuo4k6M1EmDdPF3+H6WSqr7fsrdVpe39tj8= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2016 06:37:54.6434 (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.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1227 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 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' --- 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 e657af0..d480742 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -143,6 +143,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;