From patchwork Mon Apr 29 08:55:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 10921441 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 13E991390 for ; Mon, 29 Apr 2019 08:55:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03E1D28606 for ; Mon, 29 Apr 2019 08:55:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBAF128657; Mon, 29 Apr 2019 08:55:37 +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 9480A28606 for ; Mon, 29 Apr 2019 08:55:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727581AbfD2Izh (ORCPT ); Mon, 29 Apr 2019 04:55:37 -0400 Received: from mail-eopbgr00065.outbound.protection.outlook.com ([40.107.0.65]:23426 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727525AbfD2Izg (ORCPT ); Mon, 29 Apr 2019 04:55:36 -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=00pd9Pw1wwOsGCarAqLBqo51u9OMPM8N3Zf2ovbFfl0=; b=ArmuvJ5DTWdiK4wz5CYGluIcdayzpFgpW41alwVQZRbIvDWv78kUwDsNqJeX2eCwkkgpu9AE6k78CQN/vPO/Lr6uos2qDeTx3ebw/WoA+Xpw+vnxw/HqWNED7uQD6HfCwpGtCJVoxmSKAd9fPJtIQwnOAbM3m+46mNE1noRu+5I= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.50.97) by VI1PR04MB6270.eurprd04.prod.outlook.com (20.179.26.206) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1835.14; Mon, 29 Apr 2019 08:55:33 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::4d83:33f7:38e7:70ec]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::4d83:33f7:38e7:70ec%4]) with mapi id 15.20.1835.018; Mon, 29 Apr 2019 08:55:32 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" CC: "kernel@pengutronix.de" , dl-linux-imx , "linux-mmc@vger.kernel.org" , "devicetree@vger.kernel.org" Subject: [PATCH v2 1/3] dt-bindings: mmc: fsl-imx-esdhc: add imx7ulp compatible string Thread-Topic: [PATCH v2 1/3] dt-bindings: mmc: fsl-imx-esdhc: add imx7ulp compatible string Thread-Index: AQHU/mlNY1RAJx0knE+hyQTJtJwtXA== Date: Mon, 29 Apr 2019 08:55:32 +0000 Message-ID: <20190429090310.25484-2-haibo.chen@nxp.com> References: <20190429090310.25484-1-haibo.chen@nxp.com> In-Reply-To: <20190429090310.25484-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: HK0PR03CA0023.apcprd03.prod.outlook.com (2603:1096:203:2e::35) 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: c2f899ae-b70d-4354-4185-08d6cc806fdd x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020);SRVR:VI1PR04MB6270; x-ms-traffictypediagnostic: VI1PR04MB6270: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:296; x-forefront-prvs: 0022134A87 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(136003)(396003)(366004)(376002)(39860400002)(189003)(199004)(4744005)(53936002)(68736007)(66946007)(66476007)(86362001)(2201001)(66066001)(305945005)(53346004)(97736004)(99286004)(2501003)(66446008)(2906002)(73956011)(66556008)(316002)(54906003)(110136005)(6116002)(64756008)(6486002)(6436002)(6512007)(256004)(36756003)(1076003)(8936002)(81156014)(81166006)(71200400001)(71190400001)(26005)(8676002)(5660300002)(50226002)(478600001)(25786009)(52116002)(3846002)(186003)(446003)(102836004)(11346002)(2616005)(14454004)(486006)(476003)(4326008)(7736002)(76176011)(6506007)(386003);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB6270;H:VI1PR04MB5040.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: ozWdpPAucsA3ku6ZVCZz48IMlj71rP1gP19QqzukUodfbbHqSeIMbA1YNkjP+oLvlOzrsCGg1ww0+CMl/tQpiq3/nnVPboj9U0RdTEKHsx1gWDUsusavqIavGrQxzDfKnShLMkCZHvrYoidSdEdjnsIAxP7KwWv/xYnY4E1yF0srq0i1J8wLPDhB3dRhObQi7UiiOzC8MGC1O34qDkAufa39hL/kz4PZvjvNGhNjhy0BrWIwcIhV5+AK2oYuAjxTtVnC+tT/rdjcPqzjK9Qnwd+ynCJrro+ybh6ziQBRRYvpwFfYyIADtHFUUIpCQNqclpd6xo6ONvS2wGJoNpcaMloadud1PNK7V53NKjBaXpUTElQJMWePjz4Fm1rGvdpaCyYr17SnwtwumrYhI0spFl05BFz0jFuOAFYQVLmQ2uc= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c2f899ae-b70d-4354-4185-08d6cc806fdd X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Apr 2019 08:55:32.8968 (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: VI1PR04MB6270 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 Add imx7ulp compatible string. Signed-off-by: Haibo Chen Reviewed-by: Dong Aisheng Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt index 540c65ed9cba..f707b8bee304 100644 --- a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt +++ b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt @@ -17,6 +17,7 @@ Required properties: "fsl,imx6sx-usdhc" "fsl,imx6ull-usdhc" "fsl,imx7d-usdhc" + "fsl,imx7ulp-usdhc" "fsl,imx8qxp-usdhc" Optional properties: From patchwork Mon Apr 29 08:55:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 10921443 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 049B71390 for ; Mon, 29 Apr 2019 08:55:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8C0F28606 for ; Mon, 29 Apr 2019 08:55:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC89928657; Mon, 29 Apr 2019 08:55:43 +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 5B9A028606 for ; Mon, 29 Apr 2019 08:55:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727525AbfD2Izm (ORCPT ); Mon, 29 Apr 2019 04:55:42 -0400 Received: from mail-eopbgr00061.outbound.protection.outlook.com ([40.107.0.61]:32067 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727560AbfD2Izm (ORCPT ); Mon, 29 Apr 2019 04:55:42 -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=brocor5i2lKMVeTwIMzdtnRRbysoHhqcP6Gukge4qUY=; b=KtS4xg6R4VinfBrtuo209z1N9TzFWDhb0KBRqBGYjpHzM8cVP4pNtv/gyb/nQFoAQkmH3ynxpIANh8h3IngHItzepcrSvMCdPdej6bICr6gOKvuYley3PhzvbZ8XYrVkAYHNEGr45/NyvJe6pwt6/DsJfVYa5cuYnLhcB+JSi4E= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.50.97) by VI1PR04MB4991.eurprd04.prod.outlook.com (20.177.49.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1835.13; Mon, 29 Apr 2019 08:55:37 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::4d83:33f7:38e7:70ec]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::4d83:33f7:38e7:70ec%4]) with mapi id 15.20.1835.018; Mon, 29 Apr 2019 08:55:37 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" CC: "kernel@pengutronix.de" , dl-linux-imx , "linux-mmc@vger.kernel.org" , "devicetree@vger.kernel.org" Subject: [PATCH v2 2/3] mmc: sdhci-esdhc-imx: add pm_qos to interact with cpuidle Thread-Topic: [PATCH v2 2/3] mmc: sdhci-esdhc-imx: add pm_qos to interact with cpuidle Thread-Index: AQHU/mlQ28WGFzYOYke0knyOZOpwCw== Date: Mon, 29 Apr 2019 08:55:37 +0000 Message-ID: <20190429090310.25484-3-haibo.chen@nxp.com> References: <20190429090310.25484-1-haibo.chen@nxp.com> In-Reply-To: <20190429090310.25484-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: HK0PR03CA0023.apcprd03.prod.outlook.com (2603:1096:203:2e::35) 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: 6e303765-5b02-4ebc-6344-08d6cc8072b4 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020);SRVR:VI1PR04MB4991; x-ms-traffictypediagnostic: VI1PR04MB4991: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2803; x-forefront-prvs: 0022134A87 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(366004)(376002)(136003)(346002)(396003)(199004)(189003)(316002)(53936002)(99286004)(6436002)(110136005)(54906003)(36756003)(81156014)(81166006)(2501003)(6512007)(6486002)(8676002)(97736004)(14454004)(50226002)(25786009)(478600001)(4326008)(6116002)(66556008)(3846002)(66476007)(64756008)(7736002)(66946007)(305945005)(71200400001)(71190400001)(66446008)(5660300002)(68736007)(73956011)(66066001)(52116002)(2906002)(14444005)(86362001)(11346002)(256004)(102836004)(6506007)(386003)(8936002)(26005)(186003)(2616005)(476003)(53346004)(446003)(486006)(76176011)(1076003)(2201001);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4991;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: itHJrXznokIzE09kb4UN1r0xMuxPObKC2LrVn6N8sQ2IDv98THLY0qzollAly76kwhK9ogWPwlE+h0+F9YS3HrfxbiWLdjAQOFo9K9lFWwxx4x2LdZWD5oR0HZ1448LkeZVvAu066m7co8oYKjUVbxxsqy0HH7b7UlT+yXIYkdUu+EbDqQBz4oahfoWhBeJRXYWz6YKO0K62Ni0jJ3aGfM02dWgHU3fuWE8JM71DiSXbv0J0ztpgZlvjB00P4lFhD5Mef30X7aNRRLf0ucUgpottxvCOpKIu5K3YGaMGOvJvX6p/pnRkEUrU78w4onR30t5cHtnbb1B3vM6QEMlHCOjeOI983Fo/GZh1bhXXDgao/LeILPnBJHwr8EiHrkSyt2fHEuLcrl3P3hWWFglglGJGh9FgiZTV8lG0vaQ8plw= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6e303765-5b02-4ebc-6344-08d6cc8072b4 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Apr 2019 08:55:37.9053 (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: VI1PR04MB4991 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 some SoCs such as i.MX7ULP, there is no busfreq driver, but cpuidle has some levels which may disable system/bus clocks, so need to add pm_qos to prevent cpuidle from entering low level idles and make sure system/bus clocks are enabled when usdhc is active. Signed-off-by: Anson Huang Signed-off-by: Haibo Chen Reviewed-by: Dong Aisheng Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-esdhc-imx.c | 32 +++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 8dbbc1f62b70..053e8586d557 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -156,6 +157,8 @@ #define ESDHC_FLAG_HS400_ES BIT(11) /* The IP has Host Controller Interface for Command Queuing */ #define ESDHC_FLAG_CQHCI BIT(12) +/* need request pmqos during low power */ +#define ESDHC_FLAG_PMQOS BIT(13) struct esdhc_soc_data { u32 flags; @@ -204,6 +207,12 @@ static const struct esdhc_soc_data usdhc_imx7d_data = { | ESDHC_FLAG_HS400, }; +static struct esdhc_soc_data usdhc_imx7ulp_data = { + .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING + | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200 + | ESDHC_FLAG_PMQOS, +}; + static struct esdhc_soc_data usdhc_imx8qxp_data = { .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200 @@ -229,6 +238,7 @@ struct pltfm_imx_data { WAIT_FOR_INT, /* sent CMD12, waiting for response INT */ } multiblock_status; u32 is_ddr; + struct pm_qos_request pm_qos_req; }; static const struct platform_device_id imx_esdhc_devtype[] = { @@ -257,6 +267,7 @@ static const struct of_device_id imx_esdhc_dt_ids[] = { { .compatible = "fsl,imx6q-usdhc", .data = &usdhc_imx6q_data, }, { .compatible = "fsl,imx6ull-usdhc", .data = &usdhc_imx6ull_data, }, { .compatible = "fsl,imx7d-usdhc", .data = &usdhc_imx7d_data, }, + { .compatible = "fsl,imx7ulp-usdhc", .data = &usdhc_imx7ulp_data, }, { .compatible = "fsl,imx8qxp-usdhc", .data = &usdhc_imx8qxp_data, }, { /* sentinel */ } }; @@ -1436,6 +1447,10 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) imx_data->socdata = of_id ? of_id->data : (struct esdhc_soc_data *) pdev->id_entry->driver_data; + if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS) + pm_qos_add_request(&imx_data->pm_qos_req, + PM_QOS_CPU_DMA_LATENCY, 0); + imx_data->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); if (IS_ERR(imx_data->clk_ipg)) { err = PTR_ERR(imx_data->clk_ipg); @@ -1557,6 +1572,8 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) disable_per_clk: clk_disable_unprepare(imx_data->clk_per); free_sdhci: + if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS) + pm_qos_remove_request(&imx_data->pm_qos_req); sdhci_pltfm_free(pdev); return err; } @@ -1578,6 +1595,9 @@ static int sdhci_esdhc_imx_remove(struct platform_device *pdev) clk_disable_unprepare(imx_data->clk_ipg); clk_disable_unprepare(imx_data->clk_ahb); + if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS) + pm_qos_remove_request(&imx_data->pm_qos_req); + sdhci_pltfm_free(pdev); return 0; @@ -1649,6 +1669,9 @@ static int sdhci_esdhc_runtime_suspend(struct device *dev) } clk_disable_unprepare(imx_data->clk_ahb); + if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS) + pm_qos_remove_request(&imx_data->pm_qos_req); + return ret; } @@ -1659,9 +1682,13 @@ static int sdhci_esdhc_runtime_resume(struct device *dev) struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host); int err; + if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS) + pm_qos_add_request(&imx_data->pm_qos_req, + PM_QOS_CPU_DMA_LATENCY, 0); + err = clk_prepare_enable(imx_data->clk_ahb); if (err) - return err; + goto remove_pm_qos_request; if (!sdhci_sdio_irq_enabled(host)) { err = clk_prepare_enable(imx_data->clk_per); @@ -1690,6 +1717,9 @@ static int sdhci_esdhc_runtime_resume(struct device *dev) clk_disable_unprepare(imx_data->clk_per); disable_ahb_clk: clk_disable_unprepare(imx_data->clk_ahb); +remove_pm_qos_request: + if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS) + pm_qos_remove_request(&imx_data->pm_qos_req); return err; } #endif From patchwork Mon Apr 29 08:55:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 10921445 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 6921A92A for ; Mon, 29 Apr 2019 08:56:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59A372863F for ; Mon, 29 Apr 2019 08:56:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D50628673; Mon, 29 Apr 2019 08:56:02 +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 180C82863F for ; Mon, 29 Apr 2019 08:56:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727591AbfD2I4A (ORCPT ); Mon, 29 Apr 2019 04:56:00 -0400 Received: from mail-eopbgr00043.outbound.protection.outlook.com ([40.107.0.43]:14252 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727584AbfD2I4A (ORCPT ); Mon, 29 Apr 2019 04:56:00 -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=mw4JsQTAR3VN33f1rpui0rIdicbiNvvdzHorELd0lzI=; b=KDI8n9nq6tCTw8jDB40fZK9pjIbDFqQhK1PmBaUIGRbo8Q9XYiLxGivaC2nHaHvJZC++RTJqiswta+Vxc4SFCLr/1F+V02jgl6MSxKpnSmyb3Dp+oS+zIJ9D1ApM23m+bazhi3vyjF1SttdC/gT+75QmvbIOt2VrkqfhwC/ta1c= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.50.97) by VI1PR04MB4991.eurprd04.prod.outlook.com (20.177.49.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1835.13; Mon, 29 Apr 2019 08:55:43 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::4d83:33f7:38e7:70ec]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::4d83:33f7:38e7:70ec%4]) with mapi id 15.20.1835.018; Mon, 29 Apr 2019 08:55:43 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" CC: "kernel@pengutronix.de" , dl-linux-imx , "linux-mmc@vger.kernel.org" , "devicetree@vger.kernel.org" Subject: [PATCH v2 3/3] mmc: add HS400 support for iMX7ULP Thread-Topic: [PATCH v2 3/3] mmc: add HS400 support for iMX7ULP Thread-Index: AQHU/mlTU1dJiR50vEGY9vRlWd2jgA== Date: Mon, 29 Apr 2019 08:55:43 +0000 Message-ID: <20190429090310.25484-4-haibo.chen@nxp.com> References: <20190429090310.25484-1-haibo.chen@nxp.com> In-Reply-To: <20190429090310.25484-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: HK0PR03CA0023.apcprd03.prod.outlook.com (2603:1096:203:2e::35) 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: 733e4963-8733-4362-a918-08d6cc80763a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020);SRVR:VI1PR04MB4991; x-ms-traffictypediagnostic: VI1PR04MB4991: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-forefront-prvs: 0022134A87 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(366004)(376002)(136003)(346002)(396003)(199004)(189003)(316002)(53936002)(99286004)(6436002)(110136005)(54906003)(36756003)(81156014)(81166006)(2501003)(6512007)(6486002)(8676002)(97736004)(14454004)(50226002)(25786009)(478600001)(4326008)(6116002)(66556008)(3846002)(66476007)(64756008)(7736002)(66946007)(305945005)(71200400001)(71190400001)(66446008)(5660300002)(68736007)(73956011)(66066001)(52116002)(2906002)(14444005)(86362001)(11346002)(256004)(102836004)(6506007)(386003)(8936002)(26005)(186003)(2616005)(476003)(53346004)(446003)(486006)(76176011)(1076003)(2201001);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4991;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: xFJmiDveOnuz26W6OUYm1TMhIeSgzShDkpjVoAUxKQbUmg5J4/jxKqdsoxRAhqH/SZwZDXMW4bN3OwJywo0iuHNqAxj34txoq+3J+fd9uqd60Fi5UB258+kuLD7oO+LABCDcSXZ+I0+lagP68wllFA9esQZSiVwgCFZkl8+PzxjRr9EYyNYRc1DoC0CEPENMdhNUtumyNBEJ97xZLoIbFsiW4X0BOCZh+WiCgHioguvSh3UR2cm6n2E3hhy7G8UFSGeQ0/bYdYVlirRwfbSM/ziYreSvNRF5ysV5HgNhL/L9iT+McEVZ24RJk/QWShbnRwQyRv/DvZZAzomzOiPCpcBp4XlQNa1p8+7r1PwvJ5DQ5JqGM972vUg7mXGUUGpCBWD+VhAAOjPjH9Su/R/cZB0HgaBvJGZTpUB6A31Z6Zw= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 733e4963-8733-4362-a918-08d6cc80763a X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Apr 2019 08:55:43.3471 (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: VI1PR04MB4991 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 Add HS400 support for iMX7ULP B0. According to IC suggest, need to clear the STROBE_DLL_CTRL_RESET before any setting of STROBE_DLL_CTRL register. USDHC has register bits(bit[27~20] of register STROBE_DLL_CTRL) for slave sel value. If this register bits value is 0, it needs 256 ref_clk cycles to update slave sel value. IC suggest to set bit[27~20] to 0x4, it only need 4 ref_clk cycle to update slave sel value. This will short the lock time of slave. i.MX7ULP B0 will need more time to lock the REF and SLV, so change to add 5us delay. Signed-off-by: Haibo Chen Reviewed-by: Dong Aisheng Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-esdhc-imx.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 053e8586d557..c391510e9ef4 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -74,6 +74,7 @@ #define ESDHC_STROBE_DLL_CTRL_ENABLE (1 << 0) #define ESDHC_STROBE_DLL_CTRL_RESET (1 << 1) #define ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_SHIFT 3 +#define ESDHC_STROBE_DLL_CTRL_SLV_UPDATE_INT_DEFAULT (4 << 20) #define ESDHC_STROBE_DLL_STATUS 0x74 #define ESDHC_STROBE_DLL_STS_REF_LOCK (1 << 1) @@ -210,7 +211,7 @@ static const struct esdhc_soc_data usdhc_imx7d_data = { static struct esdhc_soc_data usdhc_imx7ulp_data = { .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200 - | ESDHC_FLAG_PMQOS, + | ESDHC_FLAG_PMQOS | ESDHC_FLAG_HS400, }; static struct esdhc_soc_data usdhc_imx8qxp_data = { @@ -994,15 +995,19 @@ static void esdhc_set_strobe_dll(struct sdhci_host *host) /* force a reset on strobe dll */ writel(ESDHC_STROBE_DLL_CTRL_RESET, host->ioaddr + ESDHC_STROBE_DLL_CTRL); + /* clear the reset bit on strobe dll before any setting */ + writel(0, host->ioaddr + ESDHC_STROBE_DLL_CTRL); + /* * enable strobe dll ctrl and adjust the delay target * for the uSDHC loopback read clock */ v = ESDHC_STROBE_DLL_CTRL_ENABLE | + ESDHC_STROBE_DLL_CTRL_SLV_UPDATE_INT_DEFAULT | (7 << ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_SHIFT); writel(v, host->ioaddr + ESDHC_STROBE_DLL_CTRL); - /* wait 1us to make sure strobe dll status register stable */ - udelay(1); + /* wait 5us to make sure strobe dll status register stable */ + udelay(5); v = readl(host->ioaddr + ESDHC_STROBE_DLL_STATUS); if (!(v & ESDHC_STROBE_DLL_STS_REF_LOCK)) dev_warn(mmc_dev(host->mmc),