From patchwork Mon Jan 7 10:11:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 10750257 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 E42E86C5 for ; Mon, 7 Jan 2019 10:12:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D51962872E for ; Mon, 7 Jan 2019 10:12:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C966C28A0A; Mon, 7 Jan 2019 10:12: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=-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 62E732872E for ; Mon, 7 Jan 2019 10:12:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726633AbfAGKMw (ORCPT ); Mon, 7 Jan 2019 05:12:52 -0500 Received: from mail-eopbgr140074.outbound.protection.outlook.com ([40.107.14.74]:31822 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725550AbfAGKMw (ORCPT ); Mon, 7 Jan 2019 05:12:52 -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=Vjwcv0XSOxGSKYmCCXqEQAkWHYAVqOsVYj4gGZU/u7E=; b=wvsg3gfvf9Zgsj8gfOmfP0bzGFwIN3cCFpOi+NBNqyBKK2g9D5LvichCY7zFY04NUfZcax7FLDiWt0Dlms/+YdZL8gyRvm05igTLAHTK+j7joYrdmB8w+Z2VUf6i2L7ztlD7AwT+yfyQvYADS3DmEmpjG0nVeI0YOz3hb8A6Ojo= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.50.97) by VI1PR04MB2126.eurprd04.prod.outlook.com (10.166.43.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.7; Mon, 7 Jan 2019 10:11:42 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::ed39:18ba:6fbc:d025]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::ed39:18ba:6fbc:d025%2]) with mapi id 15.20.1495.011; Mon, 7 Jan 2019 10:11:42 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" CC: dl-linux-imx , "linux-mmc@vger.kernel.org" Subject: [PATCH 5/5] mmc: sdhci-esdhc-imx: add DCMD support for CMDQ Thread-Topic: [PATCH 5/5] mmc: sdhci-esdhc-imx: add DCMD support for CMDQ Thread-Index: AQHUpnFjESzkZh/nzk+nDXRxsTjnqw== Date: Mon, 7 Jan 2019 10:11:42 +0000 Message-ID: <20190107101757.27647-5-haibo.chen@nxp.com> References: <20190107101757.27647-1-haibo.chen@nxp.com> In-Reply-To: <20190107101757.27647-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: HK2PR04CA0052.apcprd04.prod.outlook.com (2603:1096:202:14::20) 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: [92.121.68.129] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1PR04MB2126;6:r6wgGH9f3nBXDnNuRePWtSpfgRfedQ8Q42iNk7v4YknnjpDgu70ZGHqGI8x2gJJputy2pcuKbhDUh3aSdjJPpovKzS2ZiYk3Lk6FnUnA3CSU7C496vgPrhoSjz0vZGzUa8dTnHu9vssiBgPrvqSCk6KbEc01u/B2a8LgLkhW5cPX/b073bTcNSE1GCFt8H8qp8FNaMLwKLt03XM8pY8Qq6EajPxZwf5GhfEpEZDGiG9FqxXl3MNk0V8xrk5k7+zsfIXr17u0ty7A6X1pxzpG0rzPCTVJv1wLIxKKgJDkCdygJyieHuQaTq0EBfoPqV33VrYbz4Kelti8DQSNw9bQrpJsqbwmGgyscN3WKwhBQ3nG/rvl1pq/RGoCI6i/1KoskB7CPZytO4pD2UfbpCtKlomXFfaYM3kq8bgNPJnubYxRqSFr+yguBXI6hhqPILQ7yaVkfWzZN/eOaaL3V5E9lA==;5:MaR9TROVBlj2bkDDijkVGyQqDNs3eXfBexfBlB4289qQTQgk++UqRHvw5d71uaNe1SmK60CfOZwywU3bux2QuadOX6mdrj9JGOEJV1k2Jmr4CS9OLFEy1QyrpAiHDnvo0L7OQI0cTKfb0IDcDS7setGv87h3BKIi23jt/JUolUHG918m+T8+KjEJEddqRx5FKCFfUxUUhRmHBMDHk5WqlQ==;7:Ft7pZ1ICxHb+PvCzaUo8CqNr16gQAAOeqmzlUVNDE+jbazOInrWhYyAs5oNFY44+6jUTOh3P+RUBm6Thv4S/+uDU270beu2sKv2yui6crzIHystc3G+bawWjUosWnYlkAnZnDhPx+fab9xOAF3Gk0A== x-ms-office365-filtering-correlation-id: 101a3f86-3229-46b7-f719-08d67488856c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:VI1PR04MB2126; x-ms-traffictypediagnostic: VI1PR04MB2126: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(10201501046)(3231475)(944501520)(52105112)(93006095)(93001095)(3002001)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:VI1PR04MB2126;BCL:0;PCL:0;RULEID:;SRVR:VI1PR04MB2126; x-forefront-prvs: 0910AAF391 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(366004)(136003)(396003)(376002)(346002)(199004)(189003)(8676002)(76176011)(81156014)(81166006)(50226002)(305945005)(5660300001)(106356001)(52116002)(110136005)(71200400001)(2501003)(54906003)(486006)(8936002)(4326008)(102836004)(575784001)(14444005)(478600001)(7736002)(316002)(14454004)(256004)(71190400001)(86362001)(105586002)(3846002)(6116002)(186003)(6512007)(53936002)(386003)(99286004)(6506007)(97736004)(26005)(2616005)(11346002)(476003)(66066001)(6436002)(36756003)(25786009)(53346004)(68736007)(446003)(1076003)(6486002)(2906002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB2126;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: igIuWLi9USZVCKZN9kaVQm3ZdBoQ8EPFufqiLiCwmhQ7UzG8yUAruOdDcEJ4toNO+x918iRtn7MoNlSQI/kF4OUFmq35+pJho+HJmriQCcKaTs6YXvXaKSIOLt/juCVBJl18ndL6nzer/TK4QAvDw8bA/+9MBloUxxm+twTUmXLj5Hl+fboQn3Xmt1jHxxylP8TEoOSlDULZiXQLFKPh1drObF8G9CbqnS1ilyDZ8KXEZVSDomB5EqHfXJJA3MCURtDXtL9R4+UbNBUFA8fYJVUFMNDlIVUC2LGvdiVdRjOpJxP1Q30y0Hj5DfTyp7XH spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 101a3f86-3229-46b7-f719-08d67488856c X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2019 10:11:39.8326 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB2126 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, USDHC do not generate transfer complete interrupt when send a non-data-command with R1b response. But if want to support DCMD in CMDQ, need to change this, the DCMD IC logic require the USDHC to enable this function, otherwise DCMD will never get a CC(command complete) interrupt. This patch set ESDHC_VEND_SPEC2_EN_BUSY_IRQ and add DCMD support. Signed-off-by: Haibo Chen Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-esdhc-imx.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 3ada951f9df5..e5676beb7ec1 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -80,6 +80,9 @@ #define ESDHC_STROBE_DLL_STS_REF_LOCK (1 << 1) #define ESDHC_STROBE_DLL_STS_SLV_LOCK 0x1 +#define ESDHC_VEND_SPEC2 0xc8 +#define ESDHC_VEND_SPEC2_EN_BUSY_IRQ (1 << 8) + #define ESDHC_TUNING_CTRL 0xcc #define ESDHC_STD_TUNING_EN (1 << 24) /* NOTE: the minimum valid tuning start tap for mx6sl is 1 */ @@ -1145,6 +1148,23 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host) /* disable DLL_CTRL delay line settings */ writel(0x0, host->ioaddr + ESDHC_DLL_CTRL); + /* + * For the case of command with busy, if set the bit + * ESDHC_VEND_SPEC2_EN_BUSY_IRQ, USDHC will generate a + * transfer complete interrupt when busy is deasserted. + * When CQHCI use DCMD to send a CMD need R1b respons, + * CQHCI require to set ESDHC_VEND_SPEC2_EN_BUSY_IRQ, + * otherwise DCMD will always meet timeout waiting for + * hardware interrupt issue. + */ + if (imx_data->socdata->flags & ESDHC_FLAG_CQHCI) { + tmp = readl(host->ioaddr + ESDHC_VEND_SPEC2); + tmp |= ESDHC_VEND_SPEC2_EN_BUSY_IRQ; + writel(tmp, host->ioaddr + ESDHC_VEND_SPEC2); + + host->quirks &= ~SDHCI_QUIRK_NO_BUSY_IRQ; + } + if (imx_data->socdata->flags & ESDHC_FLAG_STD_TUNING) { tmp = readl(host->ioaddr + ESDHC_TUNING_CTRL); tmp |= ESDHC_STD_TUNING_EN | @@ -1435,7 +1455,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) } if (imx_data->socdata->flags & ESDHC_FLAG_CQHCI) { - host->mmc->caps2 |= MMC_CAP2_CQE; + host->mmc->caps2 |= MMC_CAP2_CQE | MMC_CAP2_CQE_DCMD; cq_host = devm_kzalloc(&pdev->dev, sizeof(*cq_host), GFP_KERNEL); if (IS_ERR(cq_host)) { err = PTR_ERR(cq_host);