From patchwork Tue Apr 16 06:48:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 10902047 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 D18201515 for ; Tue, 16 Apr 2019 06:48:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA0422892B for ; Tue, 16 Apr 2019 06:48:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE21D2892D; Tue, 16 Apr 2019 06:48: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 220E92892B for ; Tue, 16 Apr 2019 06:48:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727130AbfDPGsa (ORCPT ); Tue, 16 Apr 2019 02:48:30 -0400 Received: from mail-eopbgr150042.outbound.protection.outlook.com ([40.107.15.42]:1284 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726962AbfDPGsa (ORCPT ); Tue, 16 Apr 2019 02:48:30 -0400 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=sr3fvpncAA647+/FO6d7nKvMs58rv7BI+QhZUWr/UXg=; b=TooRd1i07XBMLspkhEyNOu9MCdKE8hHbT2BYpBTqksbE3A/Ppij0psZvGhuktTpuLTw9xHyIQYRVviZh4uJ8LH/ocGH0BdO0pQsEQkcikBH8RLYY6ztKbTbmgbbq9ewOZPaD1vxsSwJWmEtLEV0MiGdiwc4/NMvDZ1ZP73QVtOs= Received: from DB7PR04MB4490.eurprd04.prod.outlook.com (52.135.138.16) by DB7PR04MB4505.eurprd04.prod.outlook.com (52.135.138.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.18; Tue, 16 Apr 2019 06:48:24 +0000 Received: from DB7PR04MB4490.eurprd04.prod.outlook.com ([fe80::9c1e:27f0:1ee9:fdb3]) by DB7PR04MB4490.eurprd04.prod.outlook.com ([fe80::9c1e:27f0:1ee9:fdb3%7]) with mapi id 15.20.1792.020; Tue, 16 Apr 2019 06:48:24 +0000 From: Peng Fan To: "adrian.hunter@intel.com" , "riteshh@codeaurora.org" , "asutoshd@codeaurora.org" , "ulf.hansson@linaro.org" , "linux-mmc@vger.kernel.org" , Marie Cheng CC: "linux-kernel@vger.kernel.org" , dl-linux-imx , "van.freenix@gmail.com" , Peng Fan Subject: [RFC] mmc: cqhci: clear pending interrupt and halt Thread-Topic: [RFC] mmc: cqhci: clear pending interrupt and halt Thread-Index: AQHU9CBjLDnv25kfE0KIwpUzeNUQ4A== Date: Tue, 16 Apr 2019 06:48:24 +0000 Message-ID: <20190416070128.12039-1-peng.fan@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.16.4 x-clientproxiedby: HK2PR02CA0183.apcprd02.prod.outlook.com (2603:1096:201:21::19) To DB7PR04MB4490.eurprd04.prod.outlook.com (2603:10a6:5:35::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peng.fan@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.71] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f3c4fdac-f87d-43d9-d40d-08d6c23785aa x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600140)(711020)(4605104)(4618075)(2017052603328)(7193020);SRVR:DB7PR04MB4505; x-ms-traffictypediagnostic: DB7PR04MB4505: x-microsoft-antispam-prvs: x-forefront-prvs: 000947967F x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(39860400002)(136003)(346002)(366004)(376002)(189003)(199004)(186003)(68736007)(7736002)(2501003)(305945005)(6512007)(8936002)(36756003)(6636002)(99286004)(86362001)(478600001)(6436002)(6486002)(2616005)(53936002)(5660300002)(71190400001)(71200400001)(97736004)(26005)(2201001)(106356001)(105586002)(256004)(14444005)(6116002)(25786009)(81166006)(81156014)(50226002)(14454004)(2906002)(486006)(102836004)(52116002)(54906003)(386003)(476003)(44832011)(1076003)(6506007)(316002)(3846002)(4326008)(110136005)(8676002)(66066001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR04MB4505;H:DB7PR04MB4490.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A: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: AoBJn2cuwtgMSvIpnkAQ7p9uJJdVFniK3zikGrQaLNZnusQ66218GAN9UCcjJcgqkTOWnuUlvi/U6+TqlZwNbKuNoiTX/GruPn2pRIMikNoQ4ewE1TXTskrbQJ1R2KJTa14iwXvxlFVKiTx8BJQK41v5BYcUj1bapG9TzpjYiblcTvUjMjJ0HYfhi20mhZ3MLJ6XmGOAINIu2vqt3oZjJM3cvkQ4qhwGgF603rbxpkiUZyz4RDzdf/J3ZOgzkvwbbFLthemtJTTwhEOj0usen9aWzZklftHP8cRQ+YVY/z49rUlry7hfGYZw00lESDyO2fedy/E96ivqC573Os+tLuaRbhUa/zef8gr0miec/WEl/6e8RzzI526cd1BaMGxxS+InoL3CYgJA14gR15y8jzsjnGhCnz4zntqi5Eo1SCU= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3c4fdac-f87d-43d9-d40d-08d6c23785aa X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Apr 2019 06:48:24.4671 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4505 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 On i.MX8MM, we are running Dual Linux OS, with 1st Linux using SD Card as rootfs storage, 2nd Linux using eMMC as rootfs storage. We let the the 1st linux configure power/clock for the 2nd Linux. When the 2nd Linux is booting into rootfs stage, we let the 1st Linux to destroy the 2nd linux, then restart the 1st linux, we met SDHCI dump as following, after we clear the pending interrupt and halt CQCTL, issue gone. [ 1.334594] mmc2: Got command interrupt 0x00000001 even though no command operation was in progress. [ 1.334595] mmc2: sdhci: ============ SDHCI REGISTER DUMP =========== [ 1.334599] mmc2: sdhci: Sys addr: 0xa05dcc00 | Version: 0x00000002 [ 1.340819] lib80211: common routines for IEEE802.11 drivers [ 1.345538] mmc2: sdhci: Blk size: 0x00000200 | Blk cnt: 0x00000000 [ 1.345541] mmc2: sdhci: Argument: 0x00018000 | Trn mode: 0x00000033 [ 1.345543] mmc2: sdhci: Present: 0x01f88008 | Host ctl: 0x00000031 [ 1.345547] mmc2: sdhci: Power: 0x00000002 | Blk gap: 0x00000080 [ 1.357903] mmc2: sdhci: Wake-up: 0x00000008 | Clock: 0x0000003f [ 1.357905] mmc2: sdhci: Timeout: 0x0000008f | Int stat: 0x00000000 [ 1.357908] mmc2: sdhci: Int enab: 0x107f100b | Sig enab: 0x107f100b [ 1.357911] mmc2: sdhci: AC12 err: 0x00000000 | Slot int: 0x00000502 [ 1.370268] mmc2: sdhci: Caps: 0x07eb0000 | Caps_1: 0x0000b400 [ 1.370270] mmc2: sdhci: Cmd: 0x00000d1a | Max curr: 0x00ffffff [ 1.370273] mmc2: sdhci: Resp[0]: 0x00000b00 | Resp[1]: 0xffffffff [ 1.370276] mmc2: sdhci: Resp[2]: 0x328f5903 | Resp[3]: 0x00d00f00 [ 1.382132] mmc2: sdhci: Host ctl2: 0x00000000 [ 1.382135] mmc2: sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0xa2040208 [ 2.060932] mmc2: Unexpected interrupt 0x00004000. [ 2.065538] mmc2: sdhci: ============ SDHCI REGISTER DUMP =========== [ 2.071720] mmc2: sdhci: Sys addr: 0x00000000 | Version: 0x00000002 [ 2.077902] mmc2: sdhci: Blk size: 0x00000200 | Blk cnt: 0x00000001 [ 2.084083] mmc2: sdhci: Argument: 0x00000000 | Trn mode: 0x00000000 [ 2.090264] mmc2: sdhci: Present: 0x01f88009 | Host ctl: 0x00000011 [ 2.096446] mmc2: sdhci: Power: 0x00000002 | Blk gap: 0x00000080 [ 2.102627] mmc2: sdhci: Wake-up: 0x00000008 | Clock: 0x000010ff [ 2.108809] mmc2: sdhci: Timeout: 0x0000008f | Int stat: 0x00004000 [ 2.114990] mmc2: sdhci: Int enab: 0x007f1003 | Sig enab: 0x007f1003 [ 2.121171] mmc2: sdhci: AC12 err: 0x00000000 | Slot int: 0x00000502 [ 2.127353] mmc2: sdhci: Caps: 0x07eb0000 | Caps_1: 0x0000b400 [ 2.133534] mmc2: sdhci: Cmd: 0x0000371a | Max curr: 0x00ffffff [ 2.139715] mmc2: sdhci: Resp[0]: 0x00000900 | Resp[1]: 0xffffffff [ 2.145896] mmc2: sdhci: Resp[2]: 0x328f5903 | Resp[3]: 0x00d00f00 [ 2.152077] mmc2: sdhci: Host ctl2: 0x00000000 [ 2.156342] mmc2: sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x00000000 Signed-off-by: Peng Fan --- drivers/mmc/host/cqhci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mmc/host/cqhci.c b/drivers/mmc/host/cqhci.c index d59cb0a51964..4f41960ac7ad 100644 --- a/drivers/mmc/host/cqhci.c +++ b/drivers/mmc/host/cqhci.c @@ -1116,6 +1116,7 @@ int cqhci_init(struct cqhci_host *cq_host, struct mmc_host *mmc, bool dma64) { int err; + u32 status; cq_host->dma64 = dma64; cq_host->mmc = mmc; @@ -1139,6 +1140,10 @@ int cqhci_init(struct cqhci_host *cq_host, struct mmc_host *mmc, spin_lock_init(&cq_host->lock); + status = cqhci_readl(cq_host, CQHCI_IS); + cqhci_writel(cq_host, status, CQHCI_IS); + cqhci_writel(cq_host, CQHCI_HALT, CQHCI_CTL); + init_completion(&cq_host->halt_comp); init_waitqueue_head(&cq_host->wait_queue);