From patchwork Tue Jul 12 07:46:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 9224793 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 ACE4560868 for ; Tue, 12 Jul 2016 08:27:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BAED27E78 for ; Tue, 12 Jul 2016 08:27:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A4EF27F99; Tue, 12 Jul 2016 08:27:53 +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=unavailable 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 0AAD927EED for ; Tue, 12 Jul 2016 08:27:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752349AbcGLI1s (ORCPT ); Tue, 12 Jul 2016 04:27:48 -0400 Received: from mail-co1nam03on0085.outbound.protection.outlook.com ([104.47.40.85]:9801 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752193AbcGLI1p (ORCPT ); Tue, 12 Jul 2016 04:27:45 -0400 Received: from BN3PR0301CA0038.namprd03.prod.outlook.com (10.160.180.176) by CY1PR0301MB1994.namprd03.prod.outlook.com (10.164.2.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.528.16; Tue, 12 Jul 2016 07:54:43 +0000 Received: from BN1AFFO11FD008.protection.gbl (2a01:111:f400:7c10::165) by BN3PR0301CA0038.outlook.office365.com (2a01:111:e400:4000::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.528.16 via Frontend Transport; Tue, 12 Jul 2016 07:54:43 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; gmail.com; dkim=none (message not signed) header.d=none; gmail.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 BN1AFFO11FD008.mail.protection.outlook.com (10.58.52.68) with Microsoft SMTP Server (TLS) id 15.1.534.7 via Frontend Transport; Tue, 12 Jul 2016 07:54:43 +0000 Received: from shlinux2.ap.freescale.net (shlinux2.ap.freescale.net [10.192.224.44]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u6C7rxtk002725; Tue, 12 Jul 2016 00:54:40 -0700 From: Dong Aisheng To: CC: , , , , , , , Subject: [PATCH V2 13/15] mmc: sdhci-esdhc-imx: move tuning static configuration into hwinit function Date: Tue, 12 Jul 2016 15:46:22 +0800 Message-ID: <1468309584-3591-14-git-send-email-aisheng.dong@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1468309584-3591-1-git-send-email-aisheng.dong@nxp.com> References: <1468309584-3591-1-git-send-email-aisheng.dong@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131127836833959277; (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)(2351001)(230783001)(229853001)(586003)(77096005)(2950100001)(92566002)(87936001)(575784001)(86362001)(50226002)(8936002)(305945005)(50466002)(19580405001)(81156014)(81166006)(33646002)(104016004)(8676002)(97736004)(110136002)(76176999)(189998001)(47776003)(50986999)(11100500001)(106466001)(105606002)(48376002)(5003940100001)(36756003)(356003)(8666005)(4326007)(68736007)(85426001)(6806005)(2906002)(19580395003)(7846002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1994; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD008; 1:281DaqFOEJSsx7SPCGudN69Zrg6LhXLWv73nU62tWK06m/jHG81zreCvG14u6OJFwmPiT/k4N+KU8zN6wgXHPsKtSosnrpfvY6DPCPwR6oBi2EF8uuj32ITVnLyW1fOjAqtP4yzf/zuW8eAdAbDCVaa0pJsBYlJiZ6DhvEq1N2/F8DXvIDdHuONoWSmfFgW6Q4kwEPySIECk9tENzvQAvxUHakZPtKla45Ce3j7FjD6PiL2ppSnAKiPUySBQF7FfhHOwH2aBIb16ISSt8QpH87lXl3ZPJEuB9rddfUDVvOBjmyJeOyNyjrZLUX1iqfvUfX05PXCjmimdVDqSWMudnL2xFZyCkxBuDWGOohyPkTB8RTKk5PWTYYh2eHehzG1COFHL9OR5HudViJIyBJb1qdtD0HhSsMM4AP1i2jgWYILk/D8b2IwTYnFR4llCVsnRDXiAty0otObDkCA/3kD18LTz5QlkTKPCiZ9DLf++NPSMERLPWXsVRw7DpxmSFlW3AwgjdikGCpglompoYmR475GP2k7r9njg7I8/JD4GjElrvo+v7HIlBXstjWHP+mHXlGRf9iGAdFkso/AbAjomghUsS0HJ0CsGIFvdUWv3OyNIQU9axAV1pkyxhOai+86xzsRzLu4+tlzLaikw9r4pcskd9AoHuAbyDpGVxiVrQdE= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 02b71048-70ec-4bd8-4d6d-08d3aa29c91e X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1994; 2:hy/m6/JOBDrVAt89wxM3jcu1c404dWgpYKHwQWlKEtBiZpHOt7UNDjGPguo/376ZcFeSSgVaEW0h8mu5T1ohAzrozycre7KvPIEJjNoy4KzqYhViZuR2wNCC+TH9MiheT7N+cyBZuiz1V04OslNOLthO2qjB5LnCY0GE+jg4w5xxGnvtEBf6J728wLmcch9M; 3:CckjiUshyOCqXC5Ie+3eToA49byV6SEEdz15jy+UxzB/370ed2bl0NeF4h+vYJjimc6BFLKJ1dPr2HwKMbI3fGcC37xV7QaZoFIpiIQ/mYXO3KBfTZhYCdFYFl1pUt6m0CDx1Mt7qJ+UuV84vEeBWrx+zxGL8oO6rgGvfXwaktOVRzv/XoXL5CRUofFyW+V5fGFAtSab40J6RSmb3aHZb4scG96SORSvTfN3Kt+8IRw= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1994; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1994; 25:HcO+USCrsKOEoDJb0RO3CLxb+7FPIWFqU7+nEyU6AsdcnhtlK5sAKQFnucDHzGr2eBwGkOp7U3ee5FpYSOhLnEKXrwPpXtmQpdR1dB6ySZ1WpRaVZVI1Pf3UGPmzohj0d2Xd6mYAGDgwF5flymazrS6GHET588CFv8YxmpJy8ArRhm8re6cQgv5SQbMbuxOudfFKcqPN+Z5iSzhjehu7xjqtUo9J2ojwGOz7c0MDhvi6RAtV6Sp78Gj18KDmuIT4fbQ3J4luhOddWtxMzZAPdMbGi47F1aUFJtS66ayMj8iQNaBOHOVjVbeQ8eV20lobX9Er7pJipS+hx3+JW9yew8GEwrgCeu6r6P+CnYk7uVTEe33eyFWEPqhouz3CZMx6SFyRZufmZ3cqqteWzf31v9YrR/6berNAD+XCpD2wozo9F0AJt/ap6S1+PuiHdNQ1cgimsohD+m2JLwlz6s2kzFXt2I9nNjx7He0wetxxmBWlx0fV9P/MD2l/5m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f7fVGCS36TI+kzRoaSsrBqfscBh3WYpT X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13015025)(13017025)(13018025)(13024025)(13023025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:CY1PR0301MB1994; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB1994; X-Forefront-PRVS: 0001227049 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1994; 23:On6NiJn53aIJO2uf5FfUrX1AzNh0rvCoPHpPwI1?= =?us-ascii?Q?mGY9ZDAWDsEbiC4BNVgwtvHzoWcVcaBpSw3tf5KZIPj+SWB4FmhF5R2qX/pf?= =?us-ascii?Q?Ul+cG/rPaVNSbL6FD3W8if3M0ISNfyqal++6IVmnL46eu+rMO0nyEsUmieQG?= =?us-ascii?Q?21Z/UARuLh1Djb8AAdhMBm5W0OOQgAWb1+T+7L9JNs8EkBtE9892H78v9K8a?= =?us-ascii?Q?KYkZWUMheqIBnhEX4rV4VV6tTPFTTF96XqovIEyESYjSIh/9FbrSr2yfClEG?= =?us-ascii?Q?9iqHeLCJt450tsH2w39pDOWcnRVvOdSkVhzVDASvUq+lfDV5mZTmNEFhl/As?= =?us-ascii?Q?yXyYoFtFyvlXBAROFyusV9hB7sTioMvhBjk3FTGOzo2/3iXqbL7zVvW57E5d?= =?us-ascii?Q?wEuJuCxpfriKpOoCz7gWXYspXEUJ/yrPX+Ypx1qjSDz+GSHBB0O04ezxnWmZ?= =?us-ascii?Q?s0qw66CxVQ8sPMn+ay/K0n8WnwN7yFXInws0pPJQv8P5iU39jmthaHhb9Kml?= =?us-ascii?Q?chRdIHrsgLYMAOumt95j0c//lvmmkKF2nAxYPjuG4na8wymForWJFTRA0Z30?= =?us-ascii?Q?jNWMKlKCtQ3tlT7P2k5pIR/6VAdM5USJMrqLEC48hY+oT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N96CB8pOkP9lozWmcBaBAlxzUCmJLXwuwy5Cf5AyZoWL/gKs2NRdqhGjo6jKexFrRpOLiECg0RNUdGWvgTbz+BKZQ0XLyBYnu89lUw4dGKIAuO54+v1MIffxxNCWiGNB0ehSSyJ009nQqpjJpEoZFSmZ5Hd+RmJ7W+U3UTf6o=; 24:krLhsLtSJWNye1GgQNn8bCIkm2zAvhX+Gc2+EIbbu4Ln7ZH3PebrAJwdjoWmQ8oTEU3fe1X9SHEXNcyvBAkI5gwmguvma9oBF3WVAXi0ZoE=; 7:jyY8scinuxJqRjH3C87xY/4tHmuLHWj8mtOd1njDBisP8tzgFmHYW6pXQQWPh4uag74kFht93hKB21XDZt82/dXbojnfyJNhpF4hqXy1aQgWGWXUpIo+KQgsbh4UP3nxWN+gmyywyE8MifskpCWB5SvEO16JLQ3H4dClJo7bfkNRDb6E3kypJ37l3TMgaR70/7gtRvE6c6k4DYLiByHyuJQvPKu/WmmqTcCnGZkiY93FIll4m71E/pzvua22LlGv SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2016 07:54:43.2243 (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: CY1PR0301MB1994 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 Move tuning static configuration into basic hwinit function. Tuning configuration may also be lost in low power mode, so need restore in hwinit(). Acked-by: Adrian Hunter Signed-off-by: Dong Aisheng --- 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 5a0e5dee977f..c5adf4ba4066 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -484,7 +484,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 { @@ -497,18 +496,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; } @@ -983,6 +970,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)) { /* @@ -1014,6 +1002,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); + } } } @@ -1225,11 +1230,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;