From patchwork Fri Apr 15 17:29:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 8854381 Return-Path: X-Original-To: patchwork-linux-mmc@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 E732FBF29F for ; Fri, 15 Apr 2016 17:53:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0904F2021F for ; Fri, 15 Apr 2016 17:53:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 16C8920218 for ; Fri, 15 Apr 2016 17:53:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751119AbcDORxS (ORCPT ); Fri, 15 Apr 2016 13:53:18 -0400 Received: from mail-bn1bon0055.outbound.protection.outlook.com ([157.56.111.55]:56256 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750776AbcDORxR (ORCPT ); Fri, 15 Apr 2016 13:53:17 -0400 Received: from CH1PR03CA007.namprd03.prod.outlook.com (10.255.156.152) by CY1PR0301MB1225.namprd03.prod.outlook.com (10.161.212.147) with Microsoft SMTP Server (TLS) id 15.1.466.19; Fri, 15 Apr 2016 17:38:12 +0000 Received: from BN1BFFO11FD050.protection.gbl (10.255.156.132) by CH1PR03CA007.outlook.office365.com (10.255.156.152) with Microsoft SMTP Server (TLS) id 15.1.466.19 via Frontend Transport; Fri, 15 Apr 2016 17:38:11 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; gmail.com; dkim=none (message not signed) header.d=none; gmail.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 BN1BFFO11FD050.mail.protection.outlook.com (10.58.145.5) with Microsoft SMTP Server (TLS) id 15.1.453.6 via Frontend Transport; Fri, 15 Apr 2016 17:38:11 +0000 Received: from shlinux2.ap.freescale.net (shlinux2.ap.freescale.net [10.192.224.44]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id u3FHb2HX019919; Fri, 15 Apr 2016 10:38:08 -0700 From: Dong Aisheng To: CC: , , , , , , , Subject: [PATCH 22/23] mmc: sdhci-esdhc-imx: move tuning static configuration into hwinit function Date: Sat, 16 Apr 2016 01:29:46 +0800 Message-ID: <1460741387-23815-23-git-send-email-aisheng.dong@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1460741387-23815-1-git-send-email-aisheng.dong@nxp.com> References: <1460741387-23815-1-git-send-email-aisheng.dong@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131052154919267167; (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)(1110001)(1109001)(339900001)(199003)(189002)(1096002)(19580405001)(1220700001)(19580395003)(50986999)(76176999)(86362001)(4326007)(81166005)(110136002)(5003940100001)(2950100001)(230783001)(77096005)(189998001)(92566002)(2351001)(229853001)(85426001)(106466001)(586003)(105606002)(33646002)(50226001)(47776003)(5008740100001)(2906002)(36756003)(104016004)(87936001)(48376002)(6806005)(50466002)(11100500001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1225; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD050; 1:oMo8argIQJ+smzjk2UC9/E6gTiTpTrPKmtOK0fXV4n3kcZMCUYINPqNjYwXvQyRVCYDfmWsipcVw8bZaxbpYQbEvtuS/xQuekkGBT63TUlVMOJ+rSs6KYSLWapPReoYtet2UU23cEkUYu7ouShsjGIl6kUqRYWMaEa4AsfzfXqxggmI+wAEdn5ApPamkrCcBjD5W+8OZ1Oyk103wOCmgXUu9zCNWnlbMWX7SiVkzdu2q6CpTv+Otrfs/gf6otD6GRqP1CCkNz3stVozlh9UZlAji/w+mjOcYfeeE/wuK5/0pnmbtL45ufepkwrW0GSueTSe1ED4bb3UHijnYOJva3M9eUSmab3yLye43N7+3KeIKgCZnyuT9qjYi79j8lbN5zPQNQahDuhyCzPDeDrLaRr/AecDwfbioA+aPfICLhp83fed1F1PXIL4ZJHp6fcCfDk7y0/PsrxMWwiRRINVDGcRWUcYD6meKv2vho2sbkP+vbPbpBQCxsXbuWvIgkPPGTz5HuzND5LKojQdpsPQmfpbh7nnFock6f9ArVUizORyrVCVoqOxcgCTOVEwM+jP+K5rC+Zf2R+AYcGXYXCaqnlQVxvvpFIivUPrqf2WGTQNyWjs1G8Gr5/NNj+nXUmmd MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 483afdf2-11c1-4f9f-ca00-08d36554b777 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1225; 2:vy9T+8YAtFSlCHcd0YRO0eg3eJizS7xI3wvx+oWtIUIH++Z0ZGeH3gLJLsjNcgXRTN93K2KO+ZzMei5os/zx9Yh/dc8/bM2tanvhEgFksRqLZzwUxpRpV7IBCwJq70mck7FSsfEFoAT18Do6CKMCdyv0yUf45A30qVfTjCGefjFiFrQKHD/AZ2WiVgxsvaai; 3:IhEv6R+hnXBhhb/e1kifAsVwal6JNlHToBHHQ5WWXZXBtCQKKoYhkd6SoqD3lo4wb1Gu3JECfOjcZ/FiuQNeqKr11R8jljRCxWmV+A8ykJdHeE1pkGNDl9jL/ZAE/gNcKHbKhOpiD2dldyLyNDa+zhz/kc+8wjffVn25a1C1GS+W/ZiqHkHSG1quavuSOLQM3lCTPdt4cHT/ebt8no7oeIY05PmGFCrxPZgN8Qt0s/Q=; 25:JX5E/4tk9MB554xImnsGhnNLPRyOXSXr05iGj+QTIUwJcz9wjFzbQO6PCRD3DDDomb11axM3DQ003THs0BvbsppSZ5IukXoxtFmowZlywHrSwBuMInwc0Vlb59beq4IbF0IuXeTFib9U6CcqwMfSn4/sHgToClxpK0+AsUX1i8sFNiugIhBXtGrquRRU8H0SciPcBKIr8Y7n6ATqFMV74KTriHsArnpMGhgZsAsOpV2NUvjd6Oll0vb5LlpNixEGxjsxBcXNsDKaRDQbuZFIfCGDaIOqAgxJxbZuxnW1VTY8sdUdnLH2ij2aOrtRF29hO1NdQrKI93siSu1gmq2lnw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1225; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(13015025)(13023025)(13017025)(5005006)(13018025)(13024025)(3002001)(10201501046)(6055026); SRVR:CY1PR0301MB1225; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB1225; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1225; 4:X5WzK6JX6Us/kKB82f9zXpuE+XSdsN/xWUPyeQhDqXP7KUmkK3m8PodSZo5NNlhAXHeCUeUESV2fi2aNvGKRXcWnk/rcS55gSfOG007xIiOkYQf0FfQlgOpL75zuTKOeornIGef6pk38tfMULQcNBQSnvg7j4wuaR3afoJUwNoNIsqnfBAdHUNN/oFAlckFobb/xW6qRIH2jomCUp/H+wYpMsibdzi4NURX8lmzpP+SXQvwfRW+dIfJ2OMQ7nvs1a+ryyqL4ntKZ7qvpB0lBy4zK/T9CPyu+L+ZOiqBeBp9KcF1H/J76qPVXLfr7w6RMrIuBaQJubJG/eQMaPWFtlsH8TNW/PX3V7d8QRNsbO/218r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iagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2016 17:38:11.6771 (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: CY1PR0301MB1225 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Move tuning static configuration into hwinit function. Tuning configuration may also be lost in low power mode, so need restore in hwinit(). Signed-off-by: Dong Aisheng Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-esdhc-imx.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 95f3632..98aa6b5 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -483,7 +483,6 @@ static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg) } else if (imx_data->socdata->flags & ESDHC_FLAG_STD_TUNING) { u32 v = readl(host->ioaddr + SDHCI_ACMD12_ERR); u32 m = readl(host->ioaddr + ESDHC_MIX_CTRL); - u32 tuning_ctrl; if (val & SDHCI_CTRL_TUNED_CLK) { v |= ESDHC_MIX_CTRL_SMPCLK_SEL; } else { @@ -496,18 +495,6 @@ static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg) v |= ESDHC_MIX_CTRL_EXE_TUNE; m |= ESDHC_MIX_CTRL_FBCLK_SEL; m |= ESDHC_MIX_CTRL_AUTO_TUNE_EN; - tuning_ctrl = readl(host->ioaddr + ESDHC_TUNING_CTRL); - tuning_ctrl |= ESDHC_STD_TUNING_EN | ESDHC_TUNING_START_TAP_DEFAULT; - if (imx_data->boarddata.tuning_start_tap) { - tuning_ctrl &= ~ESDHC_TUNING_START_TAP_MASK; - tuning_ctrl |= imx_data->boarddata.tuning_start_tap; - } - - if (imx_data->boarddata.tuning_step) { - tuning_ctrl &= ~ESDHC_TUNING_STEP_MASK; - tuning_ctrl |= imx_data->boarddata.tuning_step << ESDHC_TUNING_STEP_SHIFT; - } - writel(tuning_ctrl, host->ioaddr + ESDHC_TUNING_CTRL); } else { v &= ~ESDHC_MIX_CTRL_EXE_TUNE; } @@ -982,6 +969,7 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host) { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host); + int tmp; if (esdhc_is_usdhc(imx_data)) { /* @@ -1013,6 +1001,23 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host) /* disable DLL_CTRL delay line settings */ writel(0x0, host->ioaddr + ESDHC_DLL_CTRL); + + if (imx_data->socdata->flags & ESDHC_FLAG_STD_TUNING) { + tmp = readl(host->ioaddr + ESDHC_TUNING_CTRL); + tmp |= ESDHC_STD_TUNING_EN | + ESDHC_TUNING_START_TAP_DEFAULT; + if (imx_data->boarddata.tuning_start_tap) { + tmp &= ~ESDHC_TUNING_START_TAP_MASK; + tmp |= imx_data->boarddata.tuning_start_tap; + } + + if (imx_data->boarddata.tuning_step) { + tmp &= ~ESDHC_TUNING_STEP_MASK; + tmp |= imx_data->boarddata.tuning_step + << ESDHC_TUNING_STEP_SHIFT; + } + writel(tmp, host->ioaddr + ESDHC_TUNING_CTRL); + } } } @@ -1226,11 +1231,6 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) sdhci_esdhc_ops.platform_execute_tuning = esdhc_executing_tuning; - if (imx_data->socdata->flags & ESDHC_FLAG_STD_TUNING) - writel(readl(host->ioaddr + ESDHC_TUNING_CTRL) | - ESDHC_STD_TUNING_EN | ESDHC_TUNING_START_TAP_DEFAULT, - host->ioaddr + ESDHC_TUNING_CTRL); - if (imx_data->socdata->flags & ESDHC_FLAG_ERR004536) host->quirks |= SDHCI_QUIRK_BROKEN_ADMA;