From patchwork Thu May 5 03:12:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangbo Lu X-Patchwork-Id: 9020091 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 188F59F372 for ; Thu, 5 May 2016 03:24:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 14CA7203DF for ; Thu, 5 May 2016 03:24:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 03D8F2037C for ; Thu, 5 May 2016 03:23:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755921AbcEEDXK (ORCPT ); Wed, 4 May 2016 23:23:10 -0400 Received: from mail-by2on0092.outbound.protection.outlook.com ([207.46.100.92]:56144 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756167AbcEEDXG (ORCPT ); Wed, 4 May 2016 23:23:06 -0400 Received: from BLUPR03CA002.namprd03.prod.outlook.com (10.255.124.19) by CY1PR0301MB0716.namprd03.prod.outlook.com (10.160.159.146) with Microsoft SMTP Server (TLS) id 15.1.477.8; Thu, 5 May 2016 03:23:03 +0000 Received: from BY2FFO11FD005.protection.gbl (10.255.124.4) by BLUPR03CA002.outlook.office365.com (10.255.124.19) with Microsoft SMTP Server (TLS) id 15.1.453.26 via Frontend Transport; Thu, 5 May 2016 03:23:02 +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 BY2FFO11FD005.mail.protection.outlook.com (10.1.14.126) with Microsoft SMTP Server (TLS) id 15.1.485.4 via Frontend Transport; Thu, 5 May 2016 03:23:02 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id u453M4sM004368; Wed, 4 May 2016 20:22:56 -0700 From: Yangbo Lu To: , , , , , , , , CC: , Scott Wood , Mark Rutland , Rob Herring , Russell King , Jochen Friedrich , Joerg Roedel , Claudiu Manoil , "Bhupesh Sharma" , Qiang Zhao , "Kumar Gala" , Santosh Shilimkar , , , Yangbo Lu Subject: [v10, 7/7] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0 Date: Thu, 5 May 2016 11:12:30 +0800 Message-ID: <1462417950-46796-8-git-send-email-yangbo.lu@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 In-Reply-To: <1462417950-46796-1-git-send-email-yangbo.lu@nxp.com> References: <1462417950-46796-1-git-send-email-yangbo.lu@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131068921826361187; (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)(229853001)(1220700001)(19580405001)(19580395003)(2201001)(33646002)(106466001)(5001770100001)(81166005)(105606002)(2906002)(36756003)(11100500001)(92566002)(586003)(87936001)(50226002)(86362001)(4326007)(189998001)(85426001)(8936002)(48376002)(230783001)(104016004)(2950100001)(77096005)(50986999)(5008740100001)(6806005)(76176999)(47776003)(50466002)(7059030)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB0716; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD005; 1:JgFAedkRBRgjznVztJPl3FTLqmiOefxXkoHa5QgXjjnJyh3M1ntfUA1svAoyQKIyNB2Jyv/WF6pdN1QIEoBi+eloB+gAJV8hcPZm95WexM9xvuMCGSZLlXy3oZ8/iZ4GUddwcY8oYm2LlR/q3NzCL43b5rEE9aDKj1AHmeQwkjQlhuiFm1J5hwcyuaUzZdn2b+YDLhF81PbEOO/ogd5uXOTKBR3S8kbdYhxoSoJyfqRc2M3GmOdMFGAXmlTaOf+/jqIdpczKyUuVKunH9DCtcV0bi20nPuzv55L2lYRQuV/D/dfb0UV23iZTxv5RLzV550D/0B0DnX8GToydhSlTK4PtAJ3u3zWISfNuBLzexXSlBW+M2RwUWO4GPHOzR+SyxV53TKbQygIF14k1hnb3n3MZpyowEXucLAP5ibs4OegwK7UCgwbnJ+YkbRQ6q5pgENtvxLxtaRbyU4fwDTrM/9krw0VvPGh0eC5eFct7oCj8n2PuM+h1fwzJXSY+gXnaqrNphyKdGAKkp50F6XV1G71n6TsaRkDuLYZXb5JPlTMZ8CJWod90VuEFxvCRVwzH/H66FD/pTM9t9yboK9hlkI0dTdNF0O5lWP8rg48eZzobbmWTVSAsgri/W0HEIZBElAKRNC019oAW/9edjTot0ExAymTC/kk8HhnNvtlI7mhwF47q/bEFJ6ywX7uTsIp6AsEzVsYkvh0EX3lcnQ5CMN3GJpYOHlA/9LIXgPS5mnCBe8d9zK4VTEFUGjpAw1ib MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: fc40d397-8a4f-4e11-5e05-08d374949102 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0716; 2:8b3SL+9b0zPUVXETR1GyAFiqUNTdn/ZZZZsl5I/ZxJAK8GgRACHTpiLa4lQuOZipBftTv5beK4du6ivJm9mj/NHo/sejl/bPxwk8u45cXnap28X1aodnATFdZHJ45LAHjBMPscwwoasfTgoJ0iXapT1C/+FinJMsS7ZT5MxSPKo/4+nWeUS7AcF49i5GuUUE; 3:5ADj9ohHfXQhNxh3OWBb+feK/y+uV4kpep+Z7R0DGjMDKZthPMzcvUKvMzQ8ePr3k6V36NB+LSn6SCg/G+rQ/biMUsmJ4dPL7ZmUBEV6MOQsIE3lAkgFAVdS71o5XgL2uznA519hrlQI5VYZBkO9MmXWjV/j2keblp7Ye4hJmYPiD7/UCoMjjGR+8QUdffh8KOnxshbXaQNGhuWUvx1FzdZVkn7b/dDgmg3P5/ws9jg=; 25:pay42DGn3/AFt+VucOQCX+qN8fUxYXDc/o/YSOUgbx7Dfyq+uPw2MYSiXN181nwVKDasv/pMnpq/SLXNNAb7Vi0R1ulGCEfdEcexd/I3sPoDhE0cMYp6xGonHE0bBSMsMk46CUmF2Gjccc0TukE9llLtbRZMuDFtv25OCVTMJP/abfK3EGQqCoxM7Yj5L3txxl7uorokXQ7LMAhD9q9NeU8zuz7OaF6wqErlm7KhQX3iEeKUHBDkVrzntMp2V3gDxjvWVEo8JrdXhSEpyC1p0KUY3MTHZPW6DGz4XcEsLyfBsd0TACfIEMpOMEvJVNu1c+P91Fv8A9DP8Rqn2tKvkQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB0716; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13015025)(13018025)(13024025)(8121501046)(13017025)(13023025)(5005006)(10201501046)(3002001)(6055026); SRVR:CY1PR0301MB0716; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB0716; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0716; 4:Ab00JYT3FKDReq64j/bFE5CRZxH3OMeXS9xeN5IRFiIRiqmj60n+J5cc9bzqMqAxPw5ncrExgvBYH6VjQpqNaQF4LPvwLlOeWqfn+K3cEanENlGcJdEVQQUseec79lkIIDCoupb3/g5PKaIlK7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lfxmYnkkWe0xX0rNUjnLpAolMTgJf3umn0yWJ4IR46Kzpba+yZbs9+rA39R8nRO9HwDMhaKUBbPRjS4aaOmZotjAxO/QRqO1uUysnMRmFJ53PVdALLE1uHb0PAf3Fomv SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2016 03:23:02.4645 (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: CY1PR0301MB0716 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Spam-Status: No, score=-9.0 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' Changes for v9: - None Changes for v10: - 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 0aa484c..e15e836 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;