From patchwork Wed Aug 9 12:24:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangbo Lu X-Patchwork-Id: 9890603 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 26FBE60384 for ; Wed, 9 Aug 2017 12:41:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13C2128A65 for ; Wed, 9 Aug 2017 12:41:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0866528A7E; Wed, 9 Aug 2017 12:41:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6393128A65 for ; Wed, 9 Aug 2017 12:41:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751987AbdHIMlf (ORCPT ); Wed, 9 Aug 2017 08:41:35 -0400 Received: from mail-sn1nam02on0058.outbound.protection.outlook.com ([104.47.36.58]:57366 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751560AbdHIMld (ORCPT ); Wed, 9 Aug 2017 08:41:33 -0400 Received: from CY4PR03CA0013.namprd03.prod.outlook.com (10.168.162.23) by DM5PR03MB3323.namprd03.prod.outlook.com (10.174.241.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1320.16; Wed, 9 Aug 2017 12:41:32 +0000 Received: from BN1BFFO11FD010.protection.gbl (2a01:111:f400:7c10::1:154) by CY4PR03CA0013.outlook.office365.com (2603:10b6:903:33::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1320.16 via Frontend Transport; Wed, 9 Aug 2017 12:41:31 +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=fail 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 BN1BFFO11FD010.mail.protection.outlook.com (10.58.144.73) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1304.16 via Frontend Transport; Wed, 9 Aug 2017 12:41:31 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id v79CfSNP026905; Wed, 9 Aug 2017 05:41:28 -0700 From: Yangbo Lu To: , , Adrian Hunter CC: Xiaobo Xie , Yangbo Lu Subject: [PATCH] mmc: sdhci-of-esdhc: support ESDHC_CAPABILITIES_1 accessing Date: Wed, 9 Aug 2017 20:24:50 +0800 Message-ID: <1502281490-975-1-git-send-email-yangbo.lu@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131467560917406066; (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)(336005)(39400400002)(39450400003)(39380400002)(39410400002)(39860400002)(39850400002)(39840400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(86362001)(2906002)(106466001)(50226002)(105606002)(50466002)(5003940100001)(356003)(8656003)(8676002)(81156014)(48376002)(81166006)(85426001)(54906002)(5660300001)(68736007)(69596002)(53936002)(6666003)(8936002)(305945005)(104016004)(77096006)(50986999)(33646002)(498600001)(189998001)(38730400002)(47776003)(626005)(4326008)(230783001)(97736004)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB3323; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1BFFO11FD010; 1:+LhQR8uqUxHVqlAcXoyEKknzjwxanouG4/00GCOqK?= =?us-ascii?Q?kBic1cn/9HrBakjXkpf480rnXCx7HzZEvXnOwB1f4njTP5Not1g3Zon4hWPC?= =?us-ascii?Q?Us9WWJxSFibQbJGWpNB31d2Iux7fLGyWxLVFK9QxF7r3kcnakx4X6NT/pA7z?= =?us-ascii?Q?MO3qODDQJkXx4uy6DENPYPHXwQUaNZxWufTFWO1kBfgPERPA98RQhskMoctt?= =?us-ascii?Q?J/8je1aokgN/MsvazMOgqAa6/tFyeusjrF4E+2mkwpPlKdbOHzHYVyh1NxHr?= =?us-ascii?Q?v1V0Ix4xpWrmetr/SdWnsJ73UnEoDdWLeuJTEKb6h/YxbcJgBLbmA/hZ/Lxw?= =?us-ascii?Q?R/A79BxnH3I1q6LU0EPrcFvQDNoznAphyv+lnbVFekyrD+RyX2YoHdKzboD7?= =?us-ascii?Q?JN2vMhB0PNMRqJ3SNGZLA/fV4zWuN+GjBYEUyVPMxPiqoJMpzsSessC1Hh8U?= =?us-ascii?Q?a0U95HTGpQU7AhBtojPu2CEFhelR7ClGa/tcSSyaeaq4T+oLAoVDVZPEbn8d?= =?us-ascii?Q?x//VDtDtw+4hlS5gIQwZJkmRD4onJQgTeNSZaNL1MvmDGPdgskBQ5jH10eIy?= =?us-ascii?Q?z6POZJSCSFHFZ7HggIZsywR87IZdiqkY+hxQsqU7q+G06F0IaFgyl44I1pkm?= =?us-ascii?Q?TkYGO0+MytVX943l5lQnOu5zo5EFOWbWQKWCDsTETQcwf/rGKyFD15pcdxTC?= =?us-ascii?Q?oQRlZJpI/zifuv8j/GVB8n0WAVMvWc2Izp1N3EwsuY3gt/6fYZWGdRMYf2gI?= =?us-ascii?Q?H7nv9/lvoHyCuctr6awojxdCzbkzu+awXV9lpAKWkghhXKrDkE93TVfHkASn?= =?us-ascii?Q?ZURq7PbtHnMNaNrGFnMmJOvT3CTu33IXl+3ej2GyJ5RsePOPzPkzv3UoPAu5?= =?us-ascii?Q?X5HAdoo6gfo5IjNmChC0tOonikNvLmyY+WY7P9zc0XI0hX4vyOtt7RWwHg+u?= =?us-ascii?Q?7SrvIypG33YufYHZrOdyfd1QPJWlETovC+Pdq0dg1dIOEG1fBuBMeryGwqy7?= =?us-ascii?Q?MECZusp7yOsmg+NUs03Jpsz?= MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cc495357-1b16-4f96-b011-08d4df23f66c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603031)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM5PR03MB3323; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB3323; 3:MiN9HCL/WuxyjUb7WntWCHcuGpLI4tlXmUCKfqoVYiFR0nJfPaR7CeoxO6t/gkt8XopgWD66sUoV3ZVuA+wvAVt58u/imayXH1ZsRSb7uQL1oO88n37mZub5kAqb0hFnB3jQEWGIYF3iGjCP0n7oRQXU+Q0Oh8RMFaavzM2JMC7FZKI9Gp5v46Ox8QfhiZy4f3Hwiv4EGu1kgZUqY34t2Pdzfer3JImkjYue/G6WV1NenTtSfU+MROWIIuA3dx1sWPzX6Ij4fSgO4/1PkgyyiEHohoc3FPkBwfjHQeVyaOxCwGbToU+cMZX925+q1HJaEOvvOh0pwzCjVx77PjsFbQ==; 25:Y2f/CKNaQmlNkji0+mIm2PBrJN/1aMIGblFFyo9ALhbyVzaC1AKL5oQ8ppdxXfCbIRgqkw03qRANl7OqOZkHzj4waU2ISe2SkGXGXwKUJEAmDwtk94mm9WilX9uOyBSyETdqx8G6pZJSCaPfQzOTarkdDkq/207MRlnDxQqnXwcEYvszpIvBFEHfMO43PCBq/NoIEcYeBy7ptJZpd7D/EgMZAs40/RvGl79WARpuB9wyzqyK2yiVOYWMHgA/shq6n7+3kr2TNr7v4xEGmvdaDzSNU4rjSTX8ioKzZ/09NUOsYcmeeMMvk9gyXj5AGpEEOtgo7DTotaNPNZ/fBjbqzg==; 31:s5miL5A2jwLT6t5Ox0Aye4x6bLSGG46Gi8mYpt96e/TYIyzDmkg24jEviRaT/1mhCSVoQvrioadMrVpmfNTHpgP9bKyAdkzDgeR1hQnpWj1SNAnSRiqqfXKt+Hwx7kOqVZGqVFtkN/dZum2L2uBvR0FQzw4tZekjzysMyylBtLg5+euIj2gX9q5Q0PQMbwwcSbpG785xlw5rT+aX4lyCJNXR69u8r1Zqm2X83X1ZEfQ= X-MS-TrafficTypeDiagnostic: DM5PR03MB3323: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(601004)(2401047)(13018025)(8121501046)(5005006)(13016025)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(3002001)(6055026)(6096035)(20161123561025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123559100)(20161123556025)(20161123563025)(20161123565025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR03MB3323; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR03MB3323; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB3323; 4:HiI1+/qGp+FoatwcH+sjwS567FxjN+/i/YN6zMqDEbLXA8LRlakhqAvJrw6/VxOnKZsemriG61Bd95rFWPUjRw8Z6xRGeoO+Xbakxf4Au7YPyBqVbIdP1FAl8jJblXS473L5A4srWCuVinyXGPg1wTP86mpyXAozAHI/3f3izZo4HldOcZxDp+UP6jlSMGheHto9y8PFJOaGYk2VoP0B9i73pdt/a9JpOQv+cZh24qaHe5F87FwXaPayGWTMR9Tf3WJV3uOB2HvPvrnFFt/uMX/6KwohQFvJ3OGCSeYJkxI= X-Forefront-PRVS: 0394259C80 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB3323; 23:eQuQpcKzcUb1GeI0mvsYeyW5G6LF3EjDFR/qcn/H7?= =?us-ascii?Q?1AV0qn98b20faLIWrT2yE51XVSJdRXRQFyVUktHMbO98/xiAPrdEYU/SUDmX?= =?us-ascii?Q?y5jMwBqDDM0HnJsA2f2y6jemXivjju80f6eEwjaaZ+bneyCoN+6N/ZQOqFTc?= =?us-ascii?Q?j8aeQiLwHnZlKmn2glEWA5w0M03/VIRZZ7ezh9naiPpD62KTW2H7bZ4yg7b4?= =?us-ascii?Q?tSkDLcDpBKz4QAJrFvDdS6G6BRYknNtO5VJycOLJYLeZOE5SA+vfMRTEVGjr?= =?us-ascii?Q?5YhtJVYXUN6mijy3DElfn17EUXdead4puDl2YuCkYJ/uhXKp5DBzwjJi1dyI?= =?us-ascii?Q?TlQH0JCl/g9/2P4u7wQ4+QXOP1v5fpQDP/na0EQzARRw45NG7N54DYncdDli?= =?us-ascii?Q?gqMIqU8JmiwOd3kEQyJx+fEbEeHmEQ1/PnbXD/u0LTnH2uIojp5OPaFy2lui?= =?us-ascii?Q?NJtoKT/PzoHJBpCfF1tAeKag4wRH/fOQ+WMfReoRyV8+L/0pLH5MQsDteG44?= =?us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JGIX1iHuMvJiG1V59dwj/YRZIb6TmYgOfkxZ6Z7yukk/Gj1fYBb4vlGFIDURg9ybLKk1NTqsvIGHGmcHlV3Zwzbuiw+KxNDvMKu3QcaQhnSlD1GpUT2ec28fCWwY8HUkWLwPFeP7nElDTN8It9eKIy04nfEN3/BD7cdKatLRdtrtACAknILjwWbWwYwbjCVSsTfffHyukg==; 5:rHzK1XlgKfYJaBh/T8rf8V/FE1nhr0Tq/FNaUce1mZwOQt8VvEvn3fdLLLU4p/hMk0Tcp6ll7A8U1ahwAjKU1k0Wo4tS46TgsPfaZu0/k/01GIs2Lj6l76iQsPortxnfgYSQmp+wPzPIxYwMoebcjg==; 24:rKQKIMXW/Pu28aCJjySjzTsoEjzMmVO3Fsk9dHlEjFnXSfmuFI39YIeZvxbdDZVtkSQLNxm51F/dIZOoC54ucOuWFc2n/twu1pMwm1fD9EI=; 7:cP6jCfXmGKVIdZCwE3NCJm8TbIeNQpxZOodxRToMch8mkahMlsZUJRTvKVWagNJlZnokButRWkcvSRgTbmrdqFEF/yrGHijIQlOOQAQWzQq6V+Iopno71nQ5m5gn3+j+gSJpCwn3dFKOnHaVMbpQmW40fIhSm1IAR86KKHaucEphXqXxximiahyMPxp3jumhQ6KEpv/TJRuqze3s4bvQazdxspYUbLYG5mkg0fuxpXA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2017 12:41:31.4910 (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: DM5PR03MB3323 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP eSDHC is not a standard SD host controller. SDHCI_CAPABILITIES_1 register address is 0x44 while it's 0x114 (ESDHC_CAPABILITIES_1) for eSDHC. Signed-off-by: Yangbo Lu Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-esdhc.h | 3 +++ drivers/mmc/host/sdhci-of-esdhc.c | 23 +++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc.h b/drivers/mmc/host/sdhci-esdhc.h index c4bbd74..98898a3 100644 --- a/drivers/mmc/host/sdhci-esdhc.h +++ b/drivers/mmc/host/sdhci-esdhc.h @@ -53,6 +53,9 @@ #define ESDHC_CLOCK_HCKEN 0x00000002 #define ESDHC_CLOCK_IPGEN 0x00000001 +/* Host Controller Capabilities Register 2 */ +#define ESDHC_CAPABILITIES_1 0x114 + /* Tuning Block Control Register */ #define ESDHC_TBCTL 0x120 #define ESDHC_TB_EN 0x00000004 diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index d10f831..cd85a18 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -86,6 +86,17 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host, return ret; } + /* + * DTS properties of mmc host are used to enable each speed mode + * according to soc and board capability. So clean up + * SDR50/SDR104/DDR50 support bits here. + */ + if (spec_reg == SDHCI_CAPABILITIES_1) { + ret = value & (~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_SDR104 | + SDHCI_SUPPORT_DDR50)); + return ret; + } + ret = value; return ret; } @@ -249,7 +260,11 @@ static u32 esdhc_be_readl(struct sdhci_host *host, int reg) u32 ret; u32 value; - value = ioread32be(host->ioaddr + reg); + if (reg == SDHCI_CAPABILITIES_1) + value = ioread32be(host->ioaddr + ESDHC_CAPABILITIES_1); + else + value = ioread32be(host->ioaddr + reg); + ret = esdhc_readl_fixup(host, reg, value); return ret; @@ -260,7 +275,11 @@ static u32 esdhc_le_readl(struct sdhci_host *host, int reg) u32 ret; u32 value; - value = ioread32(host->ioaddr + reg); + if (reg == SDHCI_CAPABILITIES_1) + value = ioread32(host->ioaddr + ESDHC_CAPABILITIES_1); + else + value = ioread32(host->ioaddr + reg); + ret = esdhc_readl_fixup(host, reg, value); return ret;