Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753180AbcKIDoQ (ORCPT ); Tue, 8 Nov 2016 22:44:16 -0500 Received: from mail-dm3nam03on0057.outbound.protection.outlook.com ([104.47.41.57]:64160 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751226AbcKIDoL (ORCPT ); Tue, 8 Nov 2016 22:44:11 -0500 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; X-IncomingTopHeaderMarker: OriginalChecksum:;UpperCasedChecksum:;SizeAsReceived:1570;Count:10 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 , Leo Li , Xiaobo Xie , Minghuan Lian , Yangbo Lu Subject: [v16, 7/7] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0 Date: Wed, 9 Nov 2016 11:14:12 +0800 Message-ID: <1478661252-42439-8-git-send-email-yangbo.lu@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 In-Reply-To: <1478661252-42439-1-git-send-email-yangbo.lu@nxp.com> References: <1478661252-42439-1-git-send-email-yangbo.lu@nxp.com> X-IncomingHeaderCount: 10 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131231356869946839;(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)(199003)(189002)(97736004)(36756003)(4326007)(6666003)(50226002)(50986999)(76176999)(5001770100001)(2950100002)(586003)(8936002)(77096005)(68736007)(81166006)(104016004)(81156014)(189998001)(5660300001)(86362001)(48376002)(105606002)(47776003)(50466002)(7416002)(33646002)(8676002)(106466001)(305945005)(230783001)(356003)(85426001)(92566002)(8666005)(626004)(7846002)(87936001)(2906002)(5003940100001)(229853001)(7059030);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR03MB2886;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD047;1:1x2YssfIj+FsEI1EtJlmiJt7V9h1BVtX/te4Q+bx8GdbRagDfHCaSlGGOHtkBn2jjKys9XkoJXqJEpXHII7N2sKVeo5JGA2yQn6sXZYFIMUoOsJ4uVTJ1PgUGwKRM5SyS4yA9HkG7gYyNPlGKFpQIiz4d7PsYAg7j4luxNOoO2Tyvs1C4/hcgYIyiY0qu9keWMA9zy7KWkTRuof3eY1NIBoW9/oY81X8gnVTyydFmWuDikZLkJwEQ4kgNMbHwOjYF30oJdP4j/c93LGkqIaOGTluHjNlNVgBLM/LUrtc7op6N9wgGvziUUjciUN4rE01xRSCsdR61bScOZNyEsfPIi+w5RS1AQuYmb68ve0YdUZ5+Z9eZoHHw9UyYf+RQsOM8T/+zNfDlmQIGUNSqH5ikw1tSB2FCauD0ugUeOx04v1gGuYJhZ2D313oWMxHZmBZQKcUAzTu8aUvKRaGP7THdLA/eBMfzMa54GJdue/dwaz+HZW3P581IHvr8dZkZhnDn1lifntzk4o3ulkv0upZ/H87wSRZwdGlAJ7ZrIpdYEGIsL0x8MMCfTqZDtDoUYUsr4rvLjCRx/8cByBjBv0xvBmwtSvPRb78aEg5Gy98AsKNevc2jBHqucFyhzfNjzLwxEN8RM2SWcHtuuLEA/XanMtvSwvdC/rpdp8bxQbM4ZCSRMGzBknyS15H/9HIwdBC58dJ4DuIqBspDv0gDcPybx95xmDYecJW8N8vqgETj9XTgDZ1Dxif4xE9W2QmZOIoGYbQorNQVLk/FCcboMwSVg== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 07b81e05-c8e2-4ede-2307-08d408506c04 X-Microsoft-Exchange-Diagnostics: 1;CY4PR03MB2886;2:KgvCQXEQIJfK00syvqusRGLDPg3eOb0kj2sjBvNaJuu3nvpITLUcb1Udd5EJ0STCwPR5L5XQQpsrrTFTlMsts+4JYwoMzp1ppq9NLpZy+x3ytVDcWJWcI3ALksK7SmdKIdBqsDc5rnm+B9XdZp1jxRhOseAWAYCDVFsEOL2GlJNgObBpovikGffQeekh10uAugBnacL9VFVx1vcCZEJrXg==;3:i42QX7OJaBbz/K5/PXdUWMIy4xgDueXJ93Xs0mXWrnjMR9Rxka5f+iMf2QmfGk58fF36cti1hI51xx0aAAl7icIwFXi7cSKLCUxb0CYpHZBjpfCO/FKCxXpUihq1snthM8qzU54XGGgACLaWdfjIzgVpyCzMzJKhILSSfKzf7BU+tE1Te4pj7is02gEbp9dan+dRQYpSVXBm7Desl9ySfbU+mk3HX/HzHdZV+nuv4+63k/VfkbTmgoTATPNdzgdJ X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY4PR03MB2886; X-Microsoft-Exchange-Diagnostics: 1;CY4PR03MB2886;25:DGDz0SBQmpxhShhv7O1jOxHJyXHSeTH1P4xcZ2qu0JHzczkgDa0Oie73LFTf//PqcOBuaDMjlEcBZjEEYsnHhetPbRjC7v04GIi3OIfJQgqXxohg7H9boBhj2xI4PTVtCvEJrF7XfCKtWrUhYLopvOi6PMQnflU9NG3d3HuA3TlAuQgr+/wFiKKUHctt8sRufTuShpTpP01TozAEKR/+2p8S22qcIP2hgorxWT/XyYi4hbPhYeEMdkYbFM4GnNmfLw1yP5tqeMXDdoRIBgCzlv7beRStZ1tmvMskwepEDn58K+M3NyQhdYMIGuuv4+bg1/sLuFNgfhZ4xa+Qya23WHA6EN6JhIiJuH3xS7pHw1o19iqc0iIs9n5UYpsZYGBSAE+hgA3ky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mXZs7mO/OGYSrSlPIh36cjj51UAJ4SrEeb7JdwijKhKWh1DsPJowkEOtcWXaFqJLp9okfQgBA5yM0heyY0/MV13fh3vnhxfM+t9kMo0MPvby1THMmxgkGUXZI+X/1dlY0TZ5meVa01FCd5FYZFAx5vYcfvFLoqvQVwLkK3CCW6Sr3nhJ5nLtlYYDUJkeW3o0REGxdw5o9eV6qP8MeJoquflTgmumZ0nq1Yde+5m/9CiALk9Y3W819eLIf 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)(13017025)(13018025)(13023025)(8121501046)(5005006)(13015025)(3002001)(10201501046)(6055026);SRVR:CY4PR03MB2886;BCL:0;PCL:0;RULEID:(400006);SRVR:CY4PR03MB2886; X-Forefront-PRVS: 0121F24F22 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY4PR03MB2886;23:1abJZ8fRbY6/U7MddFm8r7QEkRJLrfFqLJxoq5170?= =?us-ascii?Q?YkkL6yp1JXFA1m3huzDjbKpwAEjSXWcOURzH8SjYGpDP8h5TDSwpHYnEHRIR?= =?us-ascii?Q?BmXPjzbQ/3uD+OKoMvPhL74PcWhw9ez+Z+2xex7ACnqbV1fm1x48tnIqMXkv?= =?us-ascii?Q?vRjSbdpS2wTuXwMbgZVt28GlQCRDcCI5bPWJSIHcEmzUbmt1iHxBH9ovoaHY?= =?us-ascii?Q?+iqaIO2g92A9RYGAa2nDWDJ4wDWeX4zbPHwvDybuUMZeqyA+4aQaCQ87XEnW?= =?us-ascii?Q?qTQp+/fa1vWrH47nHl/A9ezQcN19wut4wXR1jcXYfD+JALLI8XNqrM5buN04?= =?us-ascii?Q?q3S75ed7WOSZyGDsj4E5h0R1VHECZKxzOEYjzjjkMghzZJVN3z4nr5XCiAuR?= =?us-ascii?Q?NA4CJ9KlVtZckXy90UTLdrW+DBuuEvskibzL6+Mj1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LWNHAYCZl2P2cAolB5Db9XtPGLbh+OeS36zSmj3muzMheRp9iprtYHxErUeq316eU6FL5ih+JEP6aNIpulg1ZkhRp52082Amb9Za837+0bFN/BSWeyqXUEmzxDdBqBSqXcj0MruDBr0lDQDlsP/Ser+E4;5:FBZrVOPwIObqmisOBLGTTJYoK7cAyVQttG+kN7Mts8v5hAoPRpsK8i7tIEgEWh5SRRw+SS84amipQwgkCy2Atcv+H9FF+srCN7iiCcem+HU2r6PLqpZUtbIJXfrozEwUXZrZkhfxsiZrs9O+sihOBwwXJhtsJm9+Hf+HV0ZcqSMOirnZDzCI7ZvYJU7cxEcp;24:CrayeV2hBwazQmV3PmORgpVNvlPOBzxGpVGB7rAuFzWdyKao053E42VtpOADpTVARCepyZ9wUD6/cxa0K69mbilYppYm7Oh8/tAGVlIetHo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR03MB2886;7:lWlJGMjq8lGv6YOE69iUZwM5vt0zKZ877TwAZsCCKdk6suIagurogMRI4zQoYBZWDEj5M7532QdxKAx1MEFaF70MlFb2N7NARylncOBP1EhXSX6OF5gjB9V7z/n3jgtz7zp+rdBbBGOb0VaHci2T0HiSWi3D3ZQVLymwBelkS9Az2OLZADTZzrnpOHeRhiH6USVX2Y+8IeQtweQFHy1NgRlvByzb+a2ARueXr/DtCbdBAmBNehSbX93nU8k5N94J9bq+APZPNor5HMnB7PI2QhN5lx80I6h0Alh5O5CdgN3v3DBUoAgWerqqA960hvl0V4sVPMfRt7cqmI2kw8O3Tt1ooeuKSt09kdCWBkTvWq4= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2016 03:28:06.0275 (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: CY4PR03MB2886 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3916 Lines: 127 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 Acked-by: Arnd Bergmann --- 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 Changes for v16: - Added 'Acked-by: Arnd' --- 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 5cf7eba..4128a3c 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