From patchwork Tue Feb 26 03:23:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 10829365 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 BE405922 for ; Tue, 26 Feb 2019 03:23:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A83FD2C1A0 for ; Tue, 26 Feb 2019 03:23:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 994C52C1B3; Tue, 26 Feb 2019 03:23:15 +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 F22742C1A0 for ; Tue, 26 Feb 2019 03:23:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726185AbfBZDXO (ORCPT ); Mon, 25 Feb 2019 22:23:14 -0500 Received: from mail-eopbgr80079.outbound.protection.outlook.com ([40.107.8.79]:64920 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726116AbfBZDXO (ORCPT ); Mon, 25 Feb 2019 22:23:14 -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=KK9nrJOijLJlYaBmmvWDZhgSvi1hQa/lCVJGPO/OKb0=; b=s57+DgKi1U/OY4qoeH+Wd4TrDgXVYHwzdsFjGD0IQtg6vijenvVmiCY19FyuJiXxZm1lffp6vBL3K3VMk0uj+JCqLi47J+7rkpWcpEUEGe/vdfS9JcgNMYSupP7LvY2EEumi2WLv4qNLMk1LM4UdlJ5wuE0WMt+AMrRW7oCcbeg= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.50.97) by VI1PR04MB6061.eurprd04.prod.outlook.com (20.179.25.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.18; Tue, 26 Feb 2019 03:23:07 +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; Tue, 26 Feb 2019 03:23:07 +0000 From: BOUGH CHEN To: "adrian.hunter@intel.com" , "ulf.hansson@linaro.org" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "kernel@pengutronix.de" , "festevam@gmail.com" CC: dl-linux-imx , "linux-mmc@vger.kernel.org" , BOUGH CHEN Subject: [PATCH V2] mmc: sdhci-esdhc-imx: clear the HALT bit when enable CQE Thread-Topic: [PATCH V2] mmc: sdhci-esdhc-imx: clear the HALT bit when enable CQE Thread-Index: AQHUzYKX6paxDkb7dUCvJsERziJDRw== Date: Tue, 26 Feb 2019 03:23:07 +0000 Message-ID: <20190226033047.3291-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: HK0PR03CA0054.apcprd03.prod.outlook.com (2603:1096:203:52::18) 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: 22b4d3de-e27a-42e5-851d-08d69b99b9f4 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:VI1PR04MB6061; x-ms-traffictypediagnostic: VI1PR04MB6061: x-microsoft-exchange-diagnostics: =?iso-8859-1?q?1=3BVI1PR04MB6061=3B23=3A8L?= =?iso-8859-1?q?sjxPhd/6saPb94alAMi3nDwxk9TwCWpSWvmj4CEzdSNF2XarJsyVFBFwUVf2?= =?iso-8859-1?q?BVLjtOSxVxGOS6zj9sqcCVvlB1qABvL2R5t0mLlPP/x3dgbSQb9xykUaxWeK?= =?iso-8859-1?q?vXOeTe4JienC6ykcMO+Lp1F9nENcl+pgZdvocpjkAxsSQaol64Dd8d4pNI4M?= =?iso-8859-1?q?MXuFFYNMEykd9j+PhxE5nFun0tsOa/nAhKM2wpaMAMQjnKqHLh9tqREFcszR?= =?iso-8859-1?q?m0ixTnsyM7MT5P6iBBpXtiOXu/A6RkFdzP799AKWmKKkmeOUXhgiot8xUodE?= =?iso-8859-1?q?TWoTnkSd/zXgTOUVWkNKAndSy92d3mqCu8a8poxeRHQ7FevCqdXUR9yRK3oB?= =?iso-8859-1?q?JuF0ggkIdE7dCPqSEyxYLv33C9pD2zWlnEYqebLSretthoW+7lWShwTwcCFU?= =?iso-8859-1?q?nzSK8nxr7GbQ5GQC6Qm4CPYYcbLsvnruSyCkHpPioKYfsZHcTBWaUftf7tab?= =?iso-8859-1?q?oTqez9liZkJ4+wqPs4QpZlAgHgQa+p37JIpH1TrNNLR3OyuaMTRks/47N0KI?= =?iso-8859-1?q?Rev7v/Dg4VreNrfIu16t3TfdMU4+69F4RwyP5Q0mmV/U0EFMNYfcPhG4kjpU?= =?iso-8859-1?q?++Jlpw7deCpTAEI47FkQBAUbRKLmTXKN6PuY0VXP5G9SriI9E8wi99lVOUlr?= =?iso-8859-1?q?3IcRkuvaFTFoVlCn2jcWhLhUcSVmMwAHR/yOVEH2Kcndch5eoyTnrS2HM3Df?= =?iso-8859-1?q?/NZQsXrCvMB5LAloJgcUm8OuHgHfMi3Z8K5xx6K0I2P17EdRZehRBcR55ccD?= =?iso-8859-1?q?L3Q12XNQ/SURsei/lIoVL0aRk1tWj0QZPJa9pCKq+KhOjh4rid1vANPN//IW?= =?iso-8859-1?q?RomPad/4Gel6+07TDyNUdl205nx/vxt+Y/aZUKv8FgeowfUzNZwi5Vx3d8mE?= =?iso-8859-1?q?NqU/9TvhYuxIf8/yI9UtOcubZ7cmIXxOkdBvsWZWLokVPBGNHarGeLOxJP22?= =?iso-8859-1?q?Z9S+cBZhOIw2QG8RB4swZU86B1xh6qffYJ3Surcp6/km2Z6GlY+cLdnpBRqO?= =?iso-8859-1?q?RSPSdCCer+jWzxbDtvGPFt8Y/5lKOULVU7DQ79KIml4AQq5FUnB8kro4uBLt?= =?iso-8859-1?q?fPWe1TfAaeG5iCk7kT1AjJdoRkNFMiU33sS7UPz9e7WHnfmKj0ZDLTx9/SJ1?= =?iso-8859-1?q?VPhqvqqhkcwWSItwjCkrTIWtVLzjlyEbDsA5L9uzwCL34Z8zSp/x2rz01e/C?= =?iso-8859-1?q?vLQd4XDxlhKR/hPcot9+Uq6v09fntXbARVZmqhPL0022swOdGp481hKpk=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 096029FF66 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(39860400002)(396003)(366004)(346002)(136003)(51234002)(199004)(189003)(66066001)(110136005)(2201001)(71200400001)(71190400001)(97736004)(478600001)(8936002)(102836004)(386003)(6512007)(54906003)(50226002)(5660300002)(2906002)(99286004)(6506007)(2501003)(53936002)(52116002)(86362001)(316002)(68736007)(1076003)(6436002)(2616005)(486006)(476003)(7736002)(305945005)(186003)(36756003)(81166006)(8676002)(81156014)(3846002)(6116002)(6486002)(4326008)(256004)(14444005)(53346004)(25786009)(106356001)(26005)(14454004)(105586002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB6061;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: LWA6PVn11TsgdjvOHh1yZpgOaXsMkBbM2hZ36BymbVouFi4zSFea1l9ZsDUtzO6EQ4J+nCEP5m9TwBJEBiKwWGEyiRQRpV6JyRxYZruOnhkYWMANIyFEv86L9fU4OmNof8yu1kLOWYVcfzO5Fm1H+i9Ak73mq4H+n+tICCiugVUjZGnuoM0Gj841bqTM8PxQDCAvwAEU3TiMB/Pns+eUJn/kkYMtxf1RtTMXV0vhv9jBJzVbk/lbKrvw65o65IqR4ZH6YdVhTMzu/iGmVclRTkg6KeJhbF6wEB4CQ3FbDKM3LoyjmVgwjhYNpodi4VbbyMpWwcpazGVpqCqhTGOC2is3LzOQgevZoCvo15GYvBcDZ3ijs8/z5HKmYYWAKoJMKFJVyKi56PJSMdTgM3H060flcoygaxJg/ZVctmUmYpY= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 22b4d3de-e27a-42e5-851d-08d69b99b9f4 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Feb 2019 03:23:03.8762 (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: VI1PR04MB6061 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. Though there is a sdhci reset during sdhci_resume_host(), but this reset do not impact the CQE part, so need to clear this bit when enable CQE, otherwise 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 Acked-by: Adrian Hunter --- Changes for V2 - move the clear HALT behavior from common code __cqhci_enable to platform specific function esdhc_cqe_enable --- drivers/mmc/host/sdhci-esdhc-imx.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index c7215f5321d7..e2523beb495d 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1245,6 +1245,7 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host) static void esdhc_cqe_enable(struct mmc_host *mmc) { struct sdhci_host *host = mmc_priv(mmc); + struct cqhci_host *cq_host = mmc->cqe_private; u32 reg; u16 mode; int count = 10; @@ -1277,6 +1278,18 @@ static void esdhc_cqe_enable(struct mmc_host *mmc) mode |= SDHCI_TRNS_BLK_CNT_EN; sdhci_writew(host, mode, SDHCI_TRANSFER_MODE); + /* + * Though Runtime resume reset the entire host controller, + * but do not impact the CQHCI side, need to clear the + * HALT bit and clear all tasks, avoid CQHCI stuck in the + * first request when system resume back. + */ + cqhci_writel(cq_host, 0, CQHCI_CTL); + if (cqhci_readl(cq_host, CQHCI_CTL) && CQHCI_HALT) + dev_err(mmc_dev(host->mmc), + "failed to exit halt state when enable CQE\n"); + + sdhci_cqe_enable(mmc); }