From patchwork Mon Feb 25 09:01:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 10828361 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5387F1399 for ; Mon, 25 Feb 2019 09:01:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 407432A373 for ; Mon, 25 Feb 2019 09:01:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3422E2A8E0; Mon, 25 Feb 2019 09:01:31 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 0DA5F2A373 for ; Mon, 25 Feb 2019 09:01:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726374AbfBYJB3 (ORCPT ); Mon, 25 Feb 2019 04:01:29 -0500 Received: from mail-eopbgr50079.outbound.protection.outlook.com ([40.107.5.79]:48928 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725863AbfBYJB3 (ORCPT ); Mon, 25 Feb 2019 04:01:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=THJhcCr04Bvv0Of08gBxpUaoLLU+4/RJ+hJqbkNNKHU=; b=MRbqousLUkpYc34xo9tQtfJjmk0fmv/0BE3tuutNnNMEF6p8/hQoUacxSO98U7R9S82XiU5eosj45G7gYhMjNS6a21WxMupm4txrK04Mo7srpbHhfk5XbmWs8iaf/qDshysfY+JlD5LahBGJyOKjpqNsIuoT0+ex2Xd/guw8gRk= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.50.97) by VI1PR04MB4701.eurprd04.prod.outlook.com (20.177.48.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.16; Mon, 25 Feb 2019 09:01:24 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::6c6c:b113:a6c1:dcb4]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::6c6c:b113:a6c1:dcb4%5]) with mapi id 15.20.1643.019; Mon, 25 Feb 2019 09:01:23 +0000 From: BOUGH CHEN To: "adrian.hunter@intel.com" , "riteshh@codeaurora.org" , "asutoshd@codeaurora.org" , "ulf.hansson@linaro.org" CC: "linux-mmc@vger.kernel.org" , BOUGH CHEN , dl-linux-imx Subject: [PATCH] mmc: cqhci: clear the HALT bit in the first request when resume back Thread-Topic: [PATCH] mmc: cqhci: clear the HALT bit in the first request when resume back Thread-Index: AQHUzOiunDosITgFxUqrUxZwdWMW0Q== Date: Mon, 25 Feb 2019 09:01:23 +0000 Message-ID: <20190225090907.6293-1-haibo.chen@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.17.1 x-clientproxiedby: HK0P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:203:17::14) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:59::33) authentication-results: spf=none (sender IP is ) smtp.mailfrom=haibo.chen@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.71] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 430fca95-43ab-42fe-48b1-08d69affd11c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:VI1PR04MB4701; x-ms-traffictypediagnostic: VI1PR04MB4701: x-microsoft-exchange-diagnostics: =?iso-8859-1?q?1=3BVI1PR04MB4701=3B23=3AWn?= =?iso-8859-1?q?TYKxdJ2IhKHeXkup1XgqD2aAEwVk7qT5cMInNFzFkNwSXDBOBQFHYhlUxdMi?= =?iso-8859-1?q?ynxPDc6BKcQbWyoXwGhgKxcuYbp7viTe/YxdC0yA6RRoyrZ5sgM5R96nCcYW?= =?iso-8859-1?q?MZKk0/s9X3lyQ3WQXZYBn0pQzv9FolFXwXqDnNbqIpuhyDsyWdCzSBZV5t+P?= =?iso-8859-1?q?LbPIbc42nEPeYG3pxKB6iHmpJNYUE3l2T2SxSwDnsNSZnI0ISmokZsCQIbDg?= =?iso-8859-1?q?Wb2yj3Kffme4N2pKhrBqJ22UDoEYRhOBopzyOxJuHJmdn31b8IMLBlSfdlMJ?= =?iso-8859-1?q?enP6y6S2oaOej+lk+4vl5q2vmc7oZRcqLA2jUUUqtIWit70IwD3hDuhdlLL4?= =?iso-8859-1?q?l3/GEchvHWbRDeWa/gxQVUh/LtcDssPi3q7OD3+gns42SKx2kCcRJM8VZFdJ?= =?iso-8859-1?q?aWFnzv2ZZnfU2VMtDkx2AgdeU9cmYmpWmjxmxDxjBwZTpu67BcHZMlo4C0DB?= =?iso-8859-1?q?y2HS11sA5HuM+mah6Dps+6gLrd9sPf5rwEtlUWA+s9qxZkJaEw5D8vpbb6S2?= =?iso-8859-1?q?FGXeoob7s+c6pr5RzGhXHPN+vNwOjml58I/rhg0NhQ9oceplahqAWplrdSkR?= =?iso-8859-1?q?AdMH3vJql0A2qocqOpSajPJvcY1ApcdHSFz+S37JEs+1AS21WLb6J9EVzy7P?= =?iso-8859-1?q?+YoijpsuLUtpzLO7k/VRDYhNjFNh/eLinstSOaXziEvQDAoH80K3R+zYBUrW?= =?iso-8859-1?q?hwLt7CrnJzA5lfQpY6F8S5LNy2GfwXazcF0kabPeq0iqIAsLdp24qWZxJRUP?= =?iso-8859-1?q?Zaf682w/2hV/w3XDx8yNfksK7QGdlmfZ9ky1c81riRMpB4MD3YmVjQlPyq5A?= =?iso-8859-1?q?khGvoJAcPOF5P9dUegvW6BLSbymZwlS33DgySNmqaZGmkku64ZYN2SFD9mCn?= =?iso-8859-1?q?u6OVZWCF7Y+b9MvQkdJbebcP8+A4wE/SaGPAN3FqHH057/Las6IjMa9sDUJ9?= =?iso-8859-1?q?G+fl/HKz9K9WBHdhyLSyG8X3FOKguInqadE2Uy9kbUCey+f9/TNMGM3gbH34?= =?iso-8859-1?q?kSL39TYEbX620TTc4gHT1QnWKiwk2V8aZDykBzRRy7pUs9NGmkt+vqp4nzuK?= =?iso-8859-1?q?hnEfuSH3fVFPwQ7IhxNNGEmBUvNLIR3EPkP5s7jxWecMP5Wk50eMpqe4qlPy?= =?iso-8859-1?q?seNO0aywF1NtQ3lzzo6iqwI6FRWRIoQby4o1PO91VZjtL0ryxjwDGA049JYA?= =?iso-8859-1?q?LxR4UfzSeSNgUu8LtgfiBCljSRzZMlQ7lXr7VVk+OeVgMyZTwFwzFyziI=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 095972DF2F x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(396003)(39860400002)(366004)(346002)(136003)(51234002)(199004)(189003)(71190400001)(71200400001)(5660300002)(66066001)(186003)(7736002)(2201001)(256004)(105586002)(1076003)(86362001)(486006)(106356001)(26005)(6486002)(97736004)(305945005)(476003)(2616005)(8676002)(68736007)(6116002)(52116002)(50226002)(81156014)(81166006)(102836004)(478600001)(25786009)(6506007)(6512007)(99286004)(4326008)(14454004)(3846002)(6436002)(53346004)(386003)(14444005)(36756003)(54906003)(110136005)(8936002)(2906002)(316002)(2501003)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4701;H:VI1PR04MB5040.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: Ht/LNMeUgmC/vdCdnyz1t84QlFu8ynxgLHS/l9SgUN3CiUM2nnAUqOAvuNXyoKwkho73SPw++dkabDmYTxorWS3F+9uja4vTJUE/uYJ2s/m55NUHKHoAPboTmxoLbv+RVRybQ3wMsf73bKPD7VEAmRKvIv1J5cP3wFsMLqUazgLpMhIbOP4DiqPJPhWSWGuULCy9bNwmSi/z3TYhWOrs8A/ZfYLMDU2I9BnvvK8jCBMfSUMuBR8ct5QLvByUr1JgyHYX3zMzVTeTL2gUJyCUwrVPLYPJglCkNjgrUUfj2UK+M+bJ/CVYNer0PPqnBGPttv9xJCkdAT7anKuTGXzCqfjJGi0kl64SnIUfkxbvUNabSO7pyyqHAA5+fetCuqMccbdiQDcRTykjVeiiwURuEVo8MSazKbRg2M5Kd7lz0vY= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 430fca95-43ab-42fe-48b1-08d69affd11c X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Feb 2019 09:01:21.0385 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4701 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 After system suspend, CQE is in cqhci_off state, which set the HALT bit, make CQE in HALT state. If the SoC do not power down the USDHC module, then when system resume back, this bit keep the same, still set. So need to clear this bit when enable CQE for the first request after system resume back. If not, CQE will stuck in the first CMDQ request after system resume back. Find this issue on NXP i.MX845s-mek board [ 105.919862] mmc2: cqhci: timeout for tag 6 [ 105.923965] mmc2: cqhci: ============ CQHCI REGISTER DUMP =========== [ 105.930407] mmc2: cqhci: Caps: 0x0000310a | Version: 0x00000510 [ 105.936847] mmc2: cqhci: Config: 0x00001001 | Control: 0x00000001 [ 105.943286] mmc2: cqhci: Int stat: 0x00000000 | Int enab: 0x00000006 [ 105.949725] mmc2: cqhci: Int sig: 0x00000006 | Int Coal: 0x00000000 [ 105.956164] mmc2: cqhci: TDL base: 0x7809b000 | TDL up32: 0x00000000 [ 105.962604] mmc2: cqhci: Doorbell: 0x00000040 | TCN: 0x00000000 [ 105.969043] mmc2: cqhci: Dev queue: 0x00000000 | Dev Pend: 0x00000000 [ 105.975483] mmc2: cqhci: Task clr: 0x00000000 | SSC1: 0x00011000 [ 105.981922] mmc2: cqhci: SSC2: 0x00000001 | DCMD rsp: 0x00000000 [ 105.988362] mmc2: cqhci: RED mask: 0xfdf9a080 | TERRI: 0x00000000 [ 105.994801] mmc2: cqhci: Resp idx: 0x00000000 | Resp arg: 0x00000000 [ 106.001240] mmc2: sdhci: ============ SDHCI REGISTER DUMP =========== [ 106.007680] mmc2: sdhci: Sys addr: 0xb2b37800 | Version: 0x00000002 [ 106.014120] mmc2: sdhci: Blk size: 0x00000200 | Blk cnt: 0x00000001 [ 106.020560] mmc2: sdhci: Argument: 0x00010000 | Trn mode: 0x00000013 [ 106.026999] mmc2: sdhci: Present: 0x01f88008 | Host ctl: 0x00000030 [ 106.033439] mmc2: sdhci: Power: 0x00000002 | Blk gap: 0x00000080 [ 106.039878] mmc2: sdhci: Wake-up: 0x00000008 | Clock: 0x0000000f [ 106.046318] mmc2: sdhci: Timeout: 0x0000008f | Int stat: 0x00000000 [ 106.052757] mmc2: sdhci: Int enab: 0x107f4000 | Sig enab: 0x107f4000 [ 106.059196] mmc2: sdhci: AC12 err: 0x00000000 | Slot int: 0x00000502 [ 106.065635] mmc2: sdhci: Caps: 0x07eb0000 | Caps_1: 0x8000b407 [ 106.072075] mmc2: sdhci: Cmd: 0x00000d1a | Max curr: 0x00ffffff [ 106.078514] mmc2: sdhci: Resp[0]: 0x00000900 | Resp[1]: 0x31360181 [ 106.084954] mmc2: sdhci: Resp[2]: 0x44473430 | Resp[3]: 0x00450100 [ 106.091392] mmc2: sdhci: Host ctl2: 0x00000008 [ 106.095836] mmc2: sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x7804b208 [ 106.102274] mmc2: sdhci: ============================================ [ 106.108785] mmc2: running CQE recovery Signed-off-by: Haibo Chen --- drivers/mmc/host/cqhci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/mmc/host/cqhci.c b/drivers/mmc/host/cqhci.c index 159270e947cf..48550c572bb6 100644 --- a/drivers/mmc/host/cqhci.c +++ b/drivers/mmc/host/cqhci.c @@ -271,6 +271,12 @@ static void __cqhci_enable(struct cqhci_host *cq_host) cqhci_writel(cq_host, cqcfg, CQHCI_CFG); + /* Clear halt and clear all tasks */ + cqhci_writel(cq_host, 0, CQHCI_CTL); + if (cqhci_readl(cq_host, CQHCI_CTL) && CQHCI_HALT) + pr_err("%s: cqhci: failed to exit halt state when enable CQE\n", + mmc_hostname(mmc)); + mmc->cqe_on = true; if (cq_host->ops->enable)