From patchwork Wed May 4 03:24:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangbo Lu X-Patchwork-Id: 9009281 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4A95CBF29F for ; Wed, 4 May 2016 03:37:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4D30020373 for ; Wed, 4 May 2016 03:37:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C189202FF for ; Wed, 4 May 2016 03:37:45 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1axnbg-0002Pf-5o; Wed, 04 May 2016 03:36:12 +0000 Received: from mail-bn1bon0083.outbound.protection.outlook.com ([157.56.111.83] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1axnaw-0000cJ-Q1 for linux-arm-kernel@lists.infradead.org; Wed, 04 May 2016 03:35:29 +0000 Received: from BN3PR0301CA0047.namprd03.prod.outlook.com (10.160.152.143) by BN3PR0301MB1217.namprd03.prod.outlook.com (10.161.207.17) with Microsoft SMTP Server (TLS) id 15.1.485.9; Wed, 4 May 2016 03:35:05 +0000 Received: from BY2FFO11FD015.protection.gbl (2a01:111:f400:7c0c::170) by BN3PR0301CA0047.outlook.office365.com (2a01:111:e400:401e::15) with Microsoft SMTP Server (TLS) id 15.1.485.9 via Frontend Transport; Wed, 4 May 2016 03:35:05 +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 BY2FFO11FD015.mail.protection.outlook.com (10.1.14.131) with Microsoft SMTP Server (TLS) id 15.1.485.4 via Frontend Transport; Wed, 4 May 2016 03:35:04 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id u443Y8X6009000; Tue, 3 May 2016 20:34:58 -0700 From: Yangbo Lu To: , , , , , , , , Subject: [v9, 7/7] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0 Date: Wed, 4 May 2016 11:24:34 +0800 Message-ID: <1462332274-13744-8-git-send-email-yangbo.lu@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 In-Reply-To: <1462332274-13744-1-git-send-email-yangbo.lu@nxp.com> References: <1462332274-13744-1-git-send-email-yangbo.lu@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131068065045115508; (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)(199003)(189002)(5003940100001)(586003)(77096005)(229853001)(8936002)(5001770100001)(11100500001)(1220700001)(4326007)(76176999)(2950100001)(105606002)(85426001)(104016004)(6806005)(5008740100001)(92566002)(106466001)(87936001)(81166005)(47776003)(86362001)(19580405001)(36756003)(19580395003)(2201001)(50466002)(50226002)(50986999)(230783001)(2906002)(48376002)(33646002)(189998001)(7059030)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0301MB1217; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD015; 1:XLEPID+KqViLwjfdP6c3U7poWN8yw9cudapXhzw4ryAIL0CUTRNkrnF6/jXuKQJgD/VzdDy/1nd0KZJ8EAU1AmvaG9gnI6T9uLj7WqyaVdJteCv5ywrmbRAIqzO7ef6T9n/210aw0C3EKUUEsIiaZ18k/wAvc3JUE3hrgdyi9SsGuM3kUSYSIOK+fXLj0Z6/LfJRKrcjDfNJIWuyyEvI3seTQXJ5FOGd4Xye4s1fPKFAap8dHWFkGTuGIH2tIh5KSjmeSRES+DmIfMti3csFVCgRrUdMtQs1iBNv0wnHXlQ4zxknhxfHbuzJqDnYLYLfoc7Mw93YE1yxjzg4YVRGaJEqCvd9LGm/A7jrQX/ochSOjVri+BkdDRoZZAErOfqleVvNHoCl9bKKPXn3bnfF2sziLjrs6mLTOMRm+kA+7PPAdae+ooxlA9KLhbDEBb/sgMxf/GJBa8ZsfKFd+hmPskJUftmIYXL6mrIldGp0VCqcpbK5VzHM9ul8uxcFG2VEWYSgRV+JKcm6GjJISE5pU7JL8dw4Hi47HjGjpcjHd5GEetFNWTfiaKmC3Fb6L+lcB02FoCXtLS5DKt1j3BkIo6FiUfPwSjljnaiglrhs9oXD5TE/sR2wtK9LO3G4WZgJ7y5YCg5sXQTJSoeTUOJ8bkxKbf1Iqm7oq3OgP7WnMbKP+QL5RJTGPnZSVK5egBzshytBYrhCcKJSK67VX+K4gRwgndqiCdFBcQ4LST6TbpgVYarprmhP1gWzBxVNwrJh MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 513ee536-c1a4-4021-1112-08d373cd14de X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB1217; 2:LUv71EmFJPGioS9G6ztwNfn/pODPFaqveeHej5dYf7OqPwdk6U4qoa+ddXo7VF40dxmglbnNGwmWwl1sDqWTDYktzIm/gjD9a7NSbmrTX3vS2INE6084NiUA5pRX6Ix9P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T5nyD5/a036jjZ86cwu8dqaOHZJAlFfB36EEAGEjXOJrPkGF0+Ptqfmgevrr+jdF9OpW6YB9yHWXpnSSyv7vEvoRjj2GTl5mA1lx1Opqug== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(13018025)(5005006)(13017025)(13024025)(13023025)(13015025)(3002001)(10201501046)(6055026); SRVR:BN3PR0301MB1217; BCL:0; PCL:0; RULEID:(400006); SRVR:BN3PR0301MB1217; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB1217; 4:nl1rihEQFF0cNTXqyzTSifQTcSJM1MYvy/m0Sr9lVD6btJ22CJoJX3X6DZ0jtYGi8kNfFiUcVA2Avvn3t0Fwa81pDqerJloZOVBw/TnR6pREmdmOuQ6aAxZAgx8X+GN3LtxxurBW/29t/F8ldPIvugilqF15hScBgEGWVtq/jYPxY8g6GvM6vmNvZwF2fEH+o4l5iflSTCphIjrQmWoPSgoLCyctBWq490HAKLPkjXCAa4W/SOM9skEU/O0Ejv/frS4sqjHGtYl74HHkcekKoHH+KVDtun2+eS8PLYKpcNQ2GViLvVPl6gaJeE4xlQ5uuEwwCafrh/hDkmWSViy6X8n6hv39cr0mpZllTb2d7Vqz0XhPF7WARFV3+9y/8EYjEl1uoctolmBrlrWtziZ87ksnJLEQ/uGX8QEJkt1wMYJ3yGG0ERLJoNx7RyMxx0e7oHGZdpkmu3bG0lBlU3f1OS64AgCVlvA6pbd+yhGkWy0= X-Forefront-PRVS: 093290AD39 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0301MB1217; 23:g2zpGez/wKNoXyyH84C2DhNuZg3e4GHNWRSuABP?= =?us-ascii?Q?YP35a0t0E6K+/uGtr1tOy5jQVKj9BXR3RNryAoHRO3S12OBxFxdEXD4W4r+W?= =?us-ascii?Q?v/xIvvEbAVgDWk1M5NuQ0upWv+/ZTz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4s+zOCjQUIDNo/nfu1BXNo4oX8j13GNHLydwTGdqbaSeKohs8cQS?= =?us-ascii?Q?pdKKQn8mHuIIFhM71C4klY5op8NsgMpC0p2J/Oy66Vmhe4+ppXGj2e+c8fdb?= =?us-ascii?Q?2UYaT5VZyorI=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB1217; 5:B+ZsdUenMsr3Dwi9Ru1BSdeMqHxue1YncYomw1TcLN7kpt1vHJVWnsjlHD/rixlBNBMJZMgR/m1cISifayYpB9X6k4VIw3046cVfQqjlL/aTSopxoJwkLcQpBd6pstfVulLh7d5xFSFlkRQKQcelRdzsaiaPz41uWvtk7ir1bts=; 24:FhZ48e8LkdsmRGZlTNQoLYceMDx0GuISmIebFKxcjqyqB+NqESIv+m5BPXnijBmfuXue5RMqVVwneIHdRwAmd0w4uqayEvGrh6uxy3yWRwY=; 7:O5r2Ej+3aCeBkqVT6KJaAWffGxUIqAclYoGZNtu3ek55Iu4LOsD+5mK+1ItqZnx6HTq3cV/3+iUDeHzalbDP1uyjBjBZCoERy4UTYQrNoQ77jxjwSUPR/uuJEqRI1rkVcGKBmx2fMYqD43I0dE4lkrR9XyRGuSoF+SkZGsZq+ONgXntavXGfjcKUl2s4I/ot SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2016 03:35:04.3555 (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: BN3PR0301MB1217 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160503_203527_266575_7AB4E76B X-CRM114-Status: GOOD ( 16.38 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , ulf.hansson@linaro.org, Russell King , Yangbo Lu , Bhupesh Sharma , Joerg Roedel , Santosh Shilimkar , Jochen Friedrich , leoyang.li@nxp.com, Scott Wood , Rob Herring , Claudiu Manoil , Kumar Gala , xiaobo.xie@nxp.com, Qiang Zhao Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, 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 --- 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;