From patchwork Mon Mar 27 07:49:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangbo Lu X-Patchwork-Id: 9645535 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 4F680602C8 for ; Mon, 27 Mar 2017 08:18:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E35427F07 for ; Mon, 27 Mar 2017 08:18:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 323B3282ED; Mon, 27 Mar 2017 08:18:00 +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=-1.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C870027F07 for ; Mon, 27 Mar 2017 08:17:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZlngQD6nvtgaMKvWOF6zWKxbug5JrQ02mvwBP5lnPa4=; b=aKVA518OnottfT nu9f464cnh6hr6qnzMToSeBb/yXbYJpiLpTCfuLuT0xZ7wsLMJdmO5Wb2397V3M1d8Cg7SKJa0mwt /v4dPOCcgDYqKC3Pul+XENrrVWV0mA8YwoZDH142ERtSAIKUKqJsLrv2IU30H7ZqSdT39vk7Gfw/A WzD9putsN7V0FAWmhVHoOdFN2819d1bxaTqxTUtZGqNGIDyRcwSOd7DP/IVfDakrZBzbNo2Hf05mq s/L/NgNyGiYQrN+KvzWDg58v3h4z+YBTRhBRqG9XF2Mi/xfg/R/doxVU1+2tDYNk3hpfJ0gRzdckx acgYsAy0rsyeoVLwAAnA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1csPqe-000600-Jg; Mon, 27 Mar 2017 08:17:56 +0000 Received: from mail-dm3nam03on0041.outbound.protection.outlook.com ([104.47.41.41] helo=NAM03-DM3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1csPdq-0005go-2K for linux-arm-kernel@lists.infradead.org; Mon, 27 Mar 2017 08:04:46 +0000 Received: from BY2PR03CA046.namprd03.prod.outlook.com (10.141.249.19) by BY2PR03MB190.namprd03.prod.outlook.com (10.242.36.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.977.11; Mon, 27 Mar 2017 08:04:19 +0000 Received: from BN1AFFO11OLC004.protection.gbl (2a01:111:f400:7c10::184) by BY2PR03CA046.outlook.office365.com (2a01:111:e400:2c5d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.991.14 via Frontend Transport; Mon, 27 Mar 2017 08:04:19 +0000 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; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11OLC004.mail.protection.outlook.com (10.58.53.75) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.977.7 via Frontend Transport; Mon, 27 Mar 2017 08:04:18 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v2R842kn024493; Mon, 27 Mar 2017 01:04:15 -0700 From: Yangbo Lu To: , , , , Adrian Hunter , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon Subject: [v3, 3/7] mmc: sdhci-of-esdhc: add tuning support Date: Mon, 27 Mar 2017 15:49:38 +0800 Message-ID: <1490600982-5410-4-git-send-email-yangbo.lu@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 In-Reply-To: <1490600982-5410-1-git-send-email-yangbo.lu@nxp.com> References: <1490600982-5410-1-git-send-email-yangbo.lu@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131350754591999290; (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)(336005)(39400400002)(39450400003)(39840400002)(39860400002)(39380400002)(39410400002)(39850400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(9170700003)(105606002)(8656002)(5660300001)(77096006)(76176999)(50986999)(104016004)(305945005)(189998001)(47776003)(81166006)(8676002)(4326008)(38730400002)(6666003)(2906002)(7416002)(33646002)(68736007)(50466002)(2950100002)(5003940100001)(356003)(36756003)(50226002)(53936002)(106466001)(8936002)(2201001)(54906002)(86362001)(85426001)(230783001)(48376002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR03MB190; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11OLC004; 1:czxBY5/wqy3snjdi4/wIkg8JqZHnIHRUCXHI5t5MSupgvjO4B1TJ/yya8VVhi6Ax0MjvaLuRuuOG/L1G4YqLrYIKouLl17dEpdOLMSo0L2tD/AncToybdZAhkZRvMBz0AnMbGiD02URd/kYVYyMxp/rzdVfaeOPcXOHn095+UhrKnlfp5T1PBy6xzXcJzLnb/05tUgoPHkfhc5J20M4f88726+vfCV3wkUjXyPbglOwWbQb997HfYqDXTcHvkJ11GMnY4kQfeSImkf4Lhjhh+eor3v7S8JTXVEY46VpofPDtD7eP39ZQz+92cdEXlHda0kXz4Mpuc9z7ejPKjy3+E1hueAKrjCxKnm7iMS7o+fqXpKo+u1VX2zaW80L/Sx6/lLwXhLdrk5jobgBPF3wzkz/1vk/1bgn3u9c0pqtjr+1keID+BsDLR31Z3q81DpkJ0BL6Xd+E+o8Uy2ea6mB3GqPQwuea+UKSlCzh0Y5Mw2K0rv//Iq7s9plghndXUzG4mtpNHdUVx8lwlGmpZWT/5+o6bWidJTadOe3eHnuUp5UFKiPRsKHUf6l36/RnLZB1lrrrg+THdF7GSEhqiDYDOKFm5TbdsKQsoUKCdHUIlxCqL4jKr4ml1QvIF/gPj4VpsgZelLu01Bx6PJgo6OUJBxRjy7NcBAZUs6f7icSiYixwfCQJCa8DvLmdjdFYikGUukKFfPNsSH1bcNcgAO1Rf9VPZDf8urk6C0PX2XaYhyC+86a2PabII+MWn2N3ozj5 MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: a077c346-5f2d-499a-23df-08d474e7dee4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY2PR03MB190; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB190; 3:4cBAMfIwYXCAMkjLCW534WxUn+U4ppiL0z6CTSw8R3NSXYh6ZMCj/2rU1pQE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/Df8VGlSxE3bST4Zh44rxT+fKloadUPnyoQsvSadfUltdgoK7DMvX1N4f9c= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13024025)(13023025)(13018025)(8121501046)(13017025)(13015025)(5005006)(10201501046)(3002001)(6055026)(6096035)(20161123563025)(20161123559025)(20161123565025)(20161123561025)(20161123556025); SRVR:BY2PR03MB190; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR03MB190; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB190; 4:ptCDUgjkMsIEk9iZaq1EYjUDZUAxKTj+zZ/ulzff4j77bxfK0ZA0f0HgAbqAx0kVSwq9ZJH+1aunLdZ4FWejtV2+iBMHwukNiynLMNksO94LH7jig3BD4TgBt25MuKlu7wk84+gKqpJq08d/nuH0YrAxOdEoc+aaLeZWq3eloRNVT43Vt1xpFQqEr2qnOhuDusXGYi8Lwy2IF7y9U+nWPp54fIEq7rJfwaAqo9wriB6J/47fhvIbEmbdLgzPwEjlHUnYojnjqc/xNpyr9CH0B6bMWcjvReYjoQ0LIukuFzo8L2eN548qiUNSvV4ev4ArrpcFIVhGSiW5haK/kbxTCsWIitsTlC0q9/73KL2LB6XSsQ6gF60Jd35Tf0yapWi4zeWyJqUygYIoQSK7D8de67RE48LN/aXowOOOsih19QD8nvJ/GFWRzT7kzximV/sKy4YnbOjyPqVX8dZu1gCwLFBMqI4EvqpFe0BNcr4yESx8yibsnbkjtmyCMYfYHL8Wp9a1vNJdXLdVBZQ1jhIKtk4LivkprIzhpCIRGfxeOgcSfbPAp2j1ZngpQgSmlSfJkzIXQYhahQTUN4HZ2RF9wIFsmdmFgvbCG0Geu5uHDayczBHNMAlg3D/ot8amWrRC+JVxpoRDuLEZIgCf9JMNAwHMprKW/GI04MLwh1XtNYgTBfh2/Kt4VJyDH3j65K4kAOUyHXGoVZ6e/2nZn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C3QuDGSXgASz5beBqHMuF/CJC0J8xEQzOVmXwHbeoBdij71EgUSASlCsP7JPfCcdP86u0+6eaXhlYrBjGRBs/TIC1U2x6cDO7HSBUbhPbYJDczcE9yUqyvq+/qrn9+H/xQ71FxazYUqvpqgoB7bCZc9QJCAccQQJ; 24:/GdrY8iMrVVj8WG5OICI2rC8BXiCHStFy6P5gtuJVIqWZGH7wjx6//GeChecMY3mRZg3LLJpUg2r4WteBtYtAj3QlfzLXl1533K9Aw51pKg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB190; 7:e8efDj7ySI9+jQc2F7PEXa5Ckg4StGumjZ8p1Jg+Pn1ayJovEe1DS/bJ2dpiW2aNDEFymM5jwXjodpWtyOy1M8HQkZyy2DviF4UN7v6dDAqjazO8BqkEzw3iyDyMIh8nQD9N8mAKMHisAfaqS3i1O6VznWOyy20vJDl0tAUBVHKKLW/o5H6UHwww3+wN3zqe6SxiinuIM9fNawZPcH/zEaX611UFuEX8ZYN6wPxVSL4jCaGb7p3hN6hQt0waSvD9nWQtCfc70CsKOLjvrU9Tx9c63XZbvJwTS6D5KH9kokXoOmGdztsQo8pTbkG7GL7tJ702EQnYRf7NKCUSr1SKWg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2017 08:04:18.9503 (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: BY2PR03MB190 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170327_010442_804929_14185870 X-CRM114-Status: GOOD ( 13.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Xiaobo Xie , Yangbo Lu Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP eSDHC uses tuning block for tuning procedure. So the tuning block control register must be configured properly before tuning. Signed-off-by: Yangbo Lu Acked-by: Adrian Hunter --- Changes for v2: - Replaced old function for mmc_host_ops.execute_tuning with esdhc_execute_tuning to support eSDHC tuning. Changes for v3: - Put .execute_tuning assigning after after IS_ERR(host) check. --- drivers/mmc/host/sdhci-esdhc.h | 5 +++++ drivers/mmc/host/sdhci-of-esdhc.c | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/drivers/mmc/host/sdhci-esdhc.h b/drivers/mmc/host/sdhci-esdhc.h index 6869567..c4bbd74 100644 --- a/drivers/mmc/host/sdhci-esdhc.h +++ b/drivers/mmc/host/sdhci-esdhc.h @@ -53,9 +53,14 @@ #define ESDHC_CLOCK_HCKEN 0x00000002 #define ESDHC_CLOCK_IPGEN 0x00000001 +/* Tuning Block Control Register */ +#define ESDHC_TBCTL 0x120 +#define ESDHC_TB_EN 0x00000004 + /* Control Register for DMA transfer */ #define ESDHC_DMA_SYSCTL 0x40c #define ESDHC_PERIPHERAL_CLK_SEL 0x00080000 +#define ESDHC_FLUSH_ASYNC_FIFO 0x00040000 #define ESDHC_DMA_SNOOP 0x00000040 #endif /* _DRIVERS_MMC_SDHCI_ESDHC_H */ diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index a70499a..8c8e147 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -630,6 +630,25 @@ static int esdhc_signal_voltage_switch(struct mmc_host *mmc, } } +static int esdhc_execute_tuning(struct mmc_host *mmc, u32 opcode) +{ + struct sdhci_host *host = mmc_priv(mmc); + u32 val; + + /* Use tuning block for tuning procedure */ + esdhc_clock_enable(host, false); + val = sdhci_readl(host, ESDHC_DMA_SYSCTL); + val |= ESDHC_FLUSH_ASYNC_FIFO; + sdhci_writel(host, val, ESDHC_DMA_SYSCTL); + + val = sdhci_readl(host, ESDHC_TBCTL); + val |= ESDHC_TB_EN; + sdhci_writel(host, val, ESDHC_TBCTL); + esdhc_clock_enable(host, true); + + return sdhci_execute_tuning(mmc, opcode); +} + #ifdef CONFIG_PM_SLEEP static u32 esdhc_proctl; static int esdhc_of_suspend(struct device *dev) @@ -787,6 +806,7 @@ static int sdhci_esdhc_probe(struct platform_device *pdev) host->mmc_host_ops.start_signal_voltage_switch = esdhc_signal_voltage_switch; + host->mmc_host_ops.execute_tuning = esdhc_execute_tuning; esdhc_init(pdev, host);