From patchwork Tue Jul 12 07:46:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 9224791 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 C28FD60868 for ; Tue, 12 Jul 2016 08:27:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B316027E78 for ; Tue, 12 Jul 2016 08:27:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6BD827F17; Tue, 12 Jul 2016 08:27:38 +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 22A7A27E78 for ; Tue, 12 Jul 2016 08:27:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751546AbcGLI1h (ORCPT ); Tue, 12 Jul 2016 04:27:37 -0400 Received: from mail-by2nam01on0068.outbound.protection.outlook.com ([104.47.34.68]:22240 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751694AbcGLI1f (ORCPT ); Tue, 12 Jul 2016 04:27:35 -0400 X-Greylist: delayed 1049 seconds by postgrey-1.27 at vger.kernel.org; Tue, 12 Jul 2016 04:27:35 EDT Received: from DM2PR03CA0034.namprd03.prod.outlook.com (10.141.96.33) by CY1PR0301MB1995.namprd03.prod.outlook.com (10.164.2.13) 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:16 +0000 Received: from BY2FFO11FD039.protection.gbl (2a01:111:f400:7c0c::179) by DM2PR03CA0034.outlook.office365.com (2a01:111:e400:2428::33) 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:16 +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 BY2FFO11FD039.mail.protection.outlook.com (10.1.14.224) with Microsoft SMTP Server (TLS) id 15.1.534.7 via Frontend Transport; Tue, 12 Jul 2016 07:54:15 +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 u6C7rxtb002725; Tue, 12 Jul 2016 00:54:12 -0700 From: Dong Aisheng To: CC: , , , , , , , Subject: [PATCH V2 04/15] mmc: sdhci-esdhc-imx: restore watermark level setting after resume Date: Tue, 12 Jul 2016 15:46:13 +0800 Message-ID: <1468309584-3591-5-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: 131127836561755859; (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)(1109001)(1110001)(339900001)(189002)(199003)(305945005)(92566002)(104016004)(6806005)(33646002)(8666005)(97736004)(77096005)(230783001)(110136002)(68736007)(48376002)(81156014)(8936002)(2906002)(2950100001)(81166006)(87936001)(50466002)(8676002)(7846002)(86362001)(189998001)(19580405001)(36756003)(106466001)(356003)(105606002)(4326007)(50226002)(19580395003)(2351001)(229853001)(5003940100001)(47776003)(586003)(85426001)(50986999)(11100500001)(76176999)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1995; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD039; 1:VWf44cA8ukdSiQaTf4mgIXOxQbOQXabRTPwBPghK+m4EE3wYOt3N218GasrWrq89w5MgnKzqVZpDLNg+4UIkU6RbKKVNcPBF7QXYy0js1NLaHiSH7uSDsgrrI29bvwPOrEDst70SMgq3CQQZLlGiIlwSwg3IpY90QPZ3TmyvzzQBF8LuOO315ngYsp0KxkoYgKxMvQu6mOnDeOGsSNVmdmdONO8b1x6lWxv0aORYRnE6qhNWHnXlxiOrgjZ3KV5zaeOD69ex1WVE74AjmBT7W5ptuxcTCMDasaSjiJlXXWjkeLZbSGcJXaFVW++hRCRp+P+3G6ySn0MRI4O9ICLYFokXeMBqsaH3/JJlKN/vA9BS/Y8ideYEV3zL+JABgn8xOhlj/2N2q0D8l3UmSOEWcclZgBd+EMeFKgG3F/enolmD0ybySckjjdAdNDgPg5YvvKzN6WyMaHMoD2bimu74N5a8UdwVog2DGsSi7yfxm9Gt3ftM1vS9fvk0nMICwaaR4rYwGe2V54VwUHUS8frJivXOXs7k6zQL3lCjhqclzzD1LxvoeeUNq7w62hj3++8SoFmoZTrkf1W4yW6wpnGhzL3IVUGqcpACJ1ZUdmy3H69LlX5x1AYV/XxzLs24NPHReJEjLwDJQc1f4LU0js718ut9hk/0yqT570MhKWuGTlE= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 6886d8c4-c0d2-40ba-ced3-08d3aa29b8e4 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1995; 2:vN9hhDpNWr1/xBNl0PgIo1Q8m0AnQ2xlWDKa4zW5E/YgWJPsRIRJd4uXmUvWpjMgIFTFv9ztDnuLWFSQzxaZeh94HZoaeBfbZNM51DMUkR+qM4Jep+lOTHkqjlbOZHmQPtQAh0E3Jq08xvLSRkG3q02VR67FGpry7XE7Fftei7qu9mQ+IzrIl5gC9KRc2ldj; 3:hL+4dtlzuTVxP4JwYje5wNxOjexJFg/9aEtdOfwfpykggUq4OekQ0Cd3XwjxoUZUZkispUhZlQ4+RRvou1TXzu8Y5wpQ4Cslc9g6cbPNABNqGb50PNP0/XMCHPGvUEezaP04LfU0zZXCCLgfzIjMFSroy4qOSE2zZC8eS35RQBQtYWan2+gsbRN5LOT7b/Z+QhFheWEX1tWaTEuegyK38ALQX/1aOPmJ8VsuiYEb7cU= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1995; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1995; 25:We4Yj8lrRwSsKk5l5XLQXs7bkfhQf6N2nEM0moZ3i5PMU3IV7mw+iAJmKe1HJJ8D8A7B6pz10XJ+r5Aw/83QZpydTfn7+DLct0MEcfVzp26M0km46XqmAvEpYGfVO3/SBw89jO55tfA1oHHW4qvetokcHJBIcgFyEeinmDrUPC0KqpVIa5KWJgOIs4/BnQFekl52BS/MCImUwIUAjBwACd+9Tlzux4+JX0/JVuW7hna9kRHQTmjadfWAIs+edpMqIGt6Mehoa4qXbthaE43QQ56OsxwdveuBJGWTlMTEU0Qw+4luBqVy7jzo7Li3G/RhhqguZ+Sq/XaqZmS2vvrQh6Il+JX2ZrNFD7HLYY7xcnJ+D504v3TeWUcJFf8JCoMj3+dhiXiCChpOw4EObLbUQOaizXQzbj7aE2oBSwy48Rs0OZcHULt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5nf3OhuMzP82jYbeouahvhB2HOu3JMcWEdfw1Z393Yni05uaVF1N1WUvmR/PpOdBrqVoy/PSbuA3FUQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13015025)(13018025)(13024025)(13017025)(13023025)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:CY1PR0301MB1995; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB1995; X-Forefront-PRVS: 0001227049 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1995; 23:u+8Z/amIPQ/wzzD8E1GcSatATtfhF7n9FjqFjAh?= =?us-ascii?Q?Q9z0DAjV5f0/tUK1alPpN1Dnc6SuJQ5kfkng4oFg346CQgrwiEs5DaoZMXWX?= =?us-ascii?Q?vns55b6rYuMNjqRnf2T2QdVnjIHMGyljK7UhC7KY/+yF/6pbmvLUb3NgwMvo?= =?us-ascii?Q?v8q/Xb1WMucer0N5gUKdjvFD2yC7IY4aLwOr4Q19lHLdbsvhUy4rlvMSgZjp?= =?us-ascii?Q?aTn9Ebx1X4E33N7r7HWttCuQr1YUVq7ccsh0dFy1vcPR7U8OXllRIshR27m7?= =?us-ascii?Q?jPZ73UVoivFObyZ4CrHhiilJL8NykMOvFbZsLdUoTIaXi9U7DsMRgUvb/aSY?= =?us-ascii?Q?wq72R2W+A7nR/fiwj7gS5d6NTwAKwgd0nui/Mz1fMoPNYALAlXDIBACMZCz4?= =?us-ascii?Q?E/Q0e3aopBHNdOiS+F/KCQfn+tUi8j1sZmATISdbJmHyc7br7KQkLPdbZO+T?= =?us-ascii?Q?kb9+n8fTYlSz2Kq1I/flpATOnvzRw7GZAqZkZmyVspscV21nIJv3VB3muBLN?= =?us-ascii?Q?VMrqF92EIy7c2oDddSba2I0IQIYuOLn2/NbeZuij5hFk/kWadyDDzGKIBH1D?= =?us-ascii?Q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=; 5:ua1tUmNhUn1i9miI2mBqJPyroKyZqWFtMjsxYamwnICtq6kY8ppTRC1cvxY0CU/OgjRJdAgLDk7CLrxBbhThDBAD57i0UKLWxxgm/Vx+4qRL+LJpWNoFDOAYqCZQc8yfqHQo7UeVSPxxEwatggt51U9MVG60DTC/SR+1kaCERwQ=; 24:Zdt/M+vvsmAn0qBouiT/BgKTRFtCIdloH1AGIB5r//Hzs97NnRDWxvqCK24YpCokMITJ7wFFNgsDdJ4jMO7wNeZTAql9DkwQZS+HyFXur6I=; 7:UDn8yO7SIwM5Hy1ngqv/w3t+ojE6O/4Q9c4UqXFzODc5DixRCwd6OJxE/S7MmwtgVN2qi3pDVOhCyxkDPW05ScSSDYZ5dAuY3omtJY4ZpOYhnTuPgNfzwGxBnqR5ZNkTlWCEsDKmeINKauFPXjflqfTeQlSGcbASFcqxaNwcb46im8qV0hRuYVsq7msApSP4omHzIbyEU341SuhcBpPNkCbgeZZe8sQmFwNMMeDSFGQM7yh+XKV4S7YFzf6FHZcT SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2016 07:54:15.9727 (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: CY1PR0301MB1995 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 Currently, we config the watermark_level register only in probe. This will cause the mmc write operation timeout issue after system resume back in LPSR mode. Because in LPSR mode, after system resume back, the watermark_level register(0x44) changes to 0x08000880, which set the write watermark level as 0, and set the read watermark level as 128. This value is incorrect. This patch restores the setting of watermark level register after system resume back. Signed-off-by: Dong Aisheng Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-esdhc-imx.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index f94c1efff830..91c6a6864e15 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -39,6 +39,7 @@ #define ESDHC_VENDOR_SPEC_VSELECT (1 << 1) #define ESDHC_VENDOR_SPEC_FRC_SDCLK_ON (1 << 8) #define ESDHC_WTMK_LVL 0x44 +#define ESDHC_WTMK_DEFAULT_VAL 0x10401040 #define ESDHC_MIX_CTRL 0x48 #define ESDHC_MIX_CTRL_DDREN (1 << 3) #define ESDHC_MIX_CTRL_AC23EN (1 << 7) @@ -1157,7 +1158,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) * to something insane. Change it back here. */ if (esdhc_is_usdhc(imx_data)) { - writel(0x10401040, host->ioaddr + ESDHC_WTMK_LVL); + writel(ESDHC_WTMK_DEFAULT_VAL, host->ioaddr + ESDHC_WTMK_LVL); host->quirks2 |= SDHCI_QUIRK2_PRESET_VALUE_BROKEN; host->mmc->caps |= MMC_CAP_1_8V_DDR; @@ -1261,6 +1262,14 @@ static int sdhci_esdhc_suspend(struct device *dev) static int sdhci_esdhc_resume(struct device *dev) { + struct sdhci_host *host = dev_get_drvdata(dev); + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host); + + /* restore watermark setting in case it's lost in low power mode */ + if (esdhc_is_usdhc(imx_data)) + writel(ESDHC_WTMK_DEFAULT_VAL, host->ioaddr + ESDHC_WTMK_LVL); + return sdhci_pltfm_resume(dev); }