Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753254AbcCIKeJ (ORCPT ); Wed, 9 Mar 2016 05:34:09 -0500 Received: from mail-bl2on0084.outbound.protection.outlook.com ([65.55.169.84]:51506 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752325AbcCIKdz (ORCPT ); Wed, 9 Mar 2016 05:33:55 -0500 X-Greylist: delayed 917 seconds by postgrey-1.27 at vger.kernel.org; Wed, 09 Mar 2016 05:33:54 EST 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: [v6, 5/5] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0 Date: Wed, 9 Mar 2016 18:08:51 +0800 Message-ID: <1457518131-11339-6-git-send-email-yangbo.lu@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 In-Reply-To: <1457518131-11339-1-git-send-email-yangbo.lu@nxp.com> References: <1457518131-11339-1-git-send-email-yangbo.lu@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131019923329502356;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11OLC013;1:EwPA0Ke0sy4sGGYdbvuklVbsUD6Em9XpqoqB8scHV6qLPznbM6/CaaJYhBncAL5Ib00+evL7EYSCdS1vaVgmrO5ZN+ONaJOJltAVHYWAFBbQKtF0Un9LWzb1J8K+KGSf/c5vXACbXaXMnES259xmd+zc2oPbai/3wOuh6AMCJ9q2ZO35OJysqbNaHOEopENXkVS105fMZjFrkKvQj+1dHfZhOrJNOts1e6Y43PgA5ja39sn0SybTP8rBx34qMoKRQulWhwjSZMRZIUWevMeCqj6cxaFmH5Kx5p6og5n2NEsybmTtGOGejOxpTDBxQamsD+siaG/fsciqgaTDvoRtF+AJzNPWIzWdVH+u+JUFPwmYiCaSDQuPvQ87kkIk+sZ3M0MutDjVO/uVIwQqvgAtxYwVp9op/w6/rccsDSUYabgV/OIClUr+tFcgxW5PeWPqeYFscPGhqnFfJWQGWgbInUDiTZhlLgeeiwHxhWIp0kcqla+mDJ5VXMBlvlZYGYUauLjSJh8V6dG4OrP5QLcBTKG4wMXgrxDZnPvrU+7PkqHsrSGoIX27kxbgVF2U/2FMjzpdFRvUFrPKi/wQZuLNtJwQ/WIdW97GoRs5osOWZqlp2qldfpTwfqEzSKx6EViD X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(81166005)(85426001)(2201001)(104016004)(6806005)(48376002)(5008740100001)(36756003)(1096002)(4326007)(1220700001)(50986999)(2906002)(77096005)(105606002)(86362001)(11100500001)(230783001)(586003)(87936001)(2950100001)(50226001)(106466001)(229853001)(33646002)(92566002)(47776003)(19580405001)(76176999)(19580395003)(5001770100001)(5003940100001)(50466002)(189998001)(7059030)(2101003);DIR:OUT;SFP:1101;SCL:1;SRVR:BY1PR03MB1465;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:sfv;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 577ed7fe-1662-4cd1-cc94-08d348043704 X-Microsoft-Exchange-Diagnostics: 1;BY1PR03MB1465;2:viu7o60JGv9DiotQLUjTcE97sy3Tct82XJWORIeUfhqX/95PUlIEoQoNiI1L91IreOCY8n0+SWvHQU/H4uM0AXW6dsQszJR9alCLWht+fXA0yvPfW8YbslErvPq9jU/BtbEJpcArlyw2+2oWKeXRl6YutFo5cSIEx7N9MluXMCmrNj0hbHTDz0hzBBPQL2Lq;3:SmkiG6O4CUBV7Hn3LHA0PHK93I+RCBYnMdgRN2vVnZJAoPdyGZtRosRU9IFQiWG1qLCV1yKLrlRIVa1TSDxbWQ56IErj0VYWgdIBRPeq83ADca5abAk8myq9VhDECHJH37/c6AegLGhns3nBjPSPGTZq9gqnLPPqxBauafVNQOAySF6yg2GrNLkPlPOkHTmg/UiQ5d2ZU1LHNZLVBVleUiTKcAN8oSVS61ZUqQDSOmc=;25:76OxDuzQ8letLAQnZ7mYlsFgET93lCjBtv/O5Imc5o8PRmH637ybfU4JAbax8YJ0wLwMgX28BVKmA8Qg5rPbijXxd9FvdRiZ/y/wZScZGf8FYZDD2B2mAqCYI916HkImdO282ZJj8vcamoOSBY+5RTwkrQf84dQvgL0p+176en4B0NkQAJftmnt63XAmPEKBt31m56lHRDSlHHTCCB18M6Wr34y4zkT3Hs7SqMu3YhhKY4PipmEqNiya9hPu39YO5Tkd1j3PLMiNPothrqLZ7hScH35Y5GlBfiWEYSgRpbIUk+2bE/VJ+LSDqbRmxDnbOoBWf70LCFsTL5tE4t0x1A== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1465; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(13018025)(13015025)(8121501046)(5005006)(13024025)(13023025)(13017025)(10201501046)(3002001);SRVR:BY1PR03MB1465;BCL:0;PCL:0;RULEID:(400006);SRVR:BY1PR03MB1465; X-Microsoft-Exchange-Diagnostics: 1;BY1PR03MB1465;4:dI140kzNzvKffFqqo9aiGkPlTxo05W4H2/z8Z5j2q3HyggXR7QsYEtAXzfFlrWeGR+LX2ijNc4P1ZABpQeH/1/4HqTrLEaQZF1J2CqDu/YdCPTN9wpkmhZGGV+8ERAXI5nN6P54w15g/T446EqSUdO4ovghLf8IcYjRQm1ZDr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?= =?us-ascii?Q?1zlVyipGknwRpH3i/tr4yMNXPczwSH79HKLXwosD1t46h4g2ngoyMFsoJtw/?= =?us-ascii?Q?C4xhsKhl92oGX5G3dzFAYnxBKueRKS8OyGgJVcCVYGDq7n+BVDeTHWGWrC0y?= =?us-ascii?Q?9HEaPbUpOepBnUrY6kF0OQCle2gHkXP32Gb7X1HItFd5ukQlBqCv9fuMEZPX?= =?us-ascii?Q?XjuIUHlZPD4s27ipblWmoWcJ7qcfInsXokFa66fW5ecrQHh5k8+eOerOJBUx?= =?us-ascii?Q?2Dkz4XEG6E85y04VdERQ1mo7o56JIj9MFm8wCgbm9AmwiB6IkAgaUt8IGS7b?= =?us-ascii?Q?VYjZA/BtxZnYjBN/rzb77wPSCWLGKtdXaEavnQc7S3xF0kZ9GRki5VQXcKna?= =?us-ascii?Q?MscT3BtHNUjSVi5zSbvRcZ6e4WD5ztmNZBgo/bG8zqUFRa0ugcCH98tBj8e6?= =?us-ascii?Q?guoxs4OZrTzoAuoVPzikYwbY+qKL7376mQAxIYKnMIdR9DBMFxw1v8DJjwRb?= =?us-ascii?Q?uMTp0kl1qiR1/F/wEb9xvhcog9GYgfYpd3vtaoeY3uzH97X4h6TzZStcU7Bp?= =?us-ascii?Q?eH0LtixoG8=3D?= X-Microsoft-Exchange-Diagnostics: 1;BY1PR03MB1465;5:XT1DRTgJErSpV+3KoZrXdIuN9fsQRGAW9ED54ukxLO86m/RwIxCZTJGT2mEImAp2iTmiQyqPVDwv0grJkzp/8jahYUeQcWBZNDd57LFeZKRKDF3/RJaQ7i3cY1HwYog7cakyCarUmWCaqRT1pYk9BI422D7IKEB37CHk9hFzCew=;24:P8YM7igfHapfRBJd83AC2Zdd51/ORmvNzFvl6mOnmWLTCAFd7WOjhuh0fvSzleFQxuw8vhG3yFOMKC6INSgGbks5DQsW4aeNRtGp96tfTmQ= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2016 10:18:52.7006 (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: BY1PR03MB1465 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3304 Lines: 105 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' --- 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