From patchwork Tue Dec 3 12:54:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 11271209 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 234D1109A for ; Tue, 3 Dec 2019 12:54:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0318B2073C for ; Tue, 3 Dec 2019 12:54:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="mUxUfWrm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726079AbfLCMyV (ORCPT ); Tue, 3 Dec 2019 07:54:21 -0500 Received: from mail-eopbgr20072.outbound.protection.outlook.com ([40.107.2.72]:27264 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725957AbfLCMyV (ORCPT ); Tue, 3 Dec 2019 07:54:21 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fpqTJh4izqv1SFJOk7+qGWnH7VHbMhypp3Y4JdCz0w33gL2xwsrDSbqgCGZLLx8HDJhdGLtQtsvEIQBBfNsRNHdjZ3F6Uxjd1q1jooRMA1JBxI2ojEjOJ+H1qnGIDdHMYzLX2W2GQIpxFtUlZ3+P4vB2XvUhJAPYwTOXbR4m4cj/PpFU02yKOBdAvEAuL7wGxaowLOO3rqMyF1PNhxebPygRzEzbhZduJ8gleM/sWv5xxujGnAIn/ytG5agIM3teeGzsDBzh5cWlzqqjGGI5W4gbzbXXXdt/l/l7E1JIob4KTfeYKbp6YV+5Yxuv4jBhXQYU9u7ZQQlYJoc51nKeuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Yg8ayQi7WJtjZFu47YWjYcDwB904GmNWB2I0GbxqTt8=; b=LoQlYM8ZPNyPGocAcSmBdLo560vaQlzRezgXBknLESd3WPVIQycaUHiXFTFUIodeUArA7oHsUyCdyZfXdSqJwSPhq+Y2bAkD770VGjL9EJYIU9dJel35SjRxaUDBbFz0ORvzp1v6w8oiHKnq5RQNndxhKBKQF9X8Z5Q69S9JYu/yL7ZWOgEjEhN2I3vCaNymta2jVbpx1m6Oq0GGN7hMpDw1Wx5KA5Gr5v8dIsw/0YKy5YNHNKbJsLJlrODYhmSsrFsKo2glbB6rERHSINV9XzmUWIdZvo1mN8/+YyMv0hh+4SLZjxnpZTW09wq38s7vlebILCjHUof6qFYP6bTCZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Yg8ayQi7WJtjZFu47YWjYcDwB904GmNWB2I0GbxqTt8=; b=mUxUfWrmEKeTK+4Wx4SE4+3xtZ3bB5m8mlYo2NiJgqgyNkPZKR6NnGEtq6ZNmyZ2Cs7U4ruSfjCkwEGfZRVPgQrX8eTilHQwVO43baSKdntdFJkgK+4FyfKVoD+tHfeCYINJcBNeSIyPKt5NnaIWaYGjr6PM82OuX3ap79Sw+dc= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.52.24) by VI1PR04MB4175.eurprd04.prod.outlook.com (52.133.12.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.17; Tue, 3 Dec 2019 12:54:17 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28%5]) with mapi id 15.20.2495.014; Tue, 3 Dec 2019 12:54:17 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" CC: "shawnguo@kernel.org" , "kernel@pengutronix.de" , dl-linux-imx , BOUGH CHEN , "linus.walleij@linaro.org" , "linux-mmc@vger.kernel.org" Subject: [PATCH v2 01/14] mmc: sdhci: do not enable card detect interrupt for gpio cd type Thread-Topic: [PATCH v2 01/14] mmc: sdhci: do not enable card detect interrupt for gpio cd type Thread-Index: AQHVqdjF4yOvA9ZAokeRqllIJ+d+sQ== Date: Tue, 3 Dec 2019 12:54:17 +0000 Message-ID: <20191203130120.11511-2-haibo.chen@nxp.com> References: <20191203130120.11511-1-haibo.chen@nxp.com> In-Reply-To: <20191203130120.11511-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: HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:60::24) 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-ht: Tenant x-ms-office365-filtering-correlation-id: 45719c26-a00a-4ef9-dfed-08d777efe7fd x-ms-traffictypediagnostic: VI1PR04MB4175:|VI1PR04MB4175: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-forefront-prvs: 02408926C4 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(366004)(396003)(136003)(39860400002)(376002)(189003)(199004)(316002)(54906003)(446003)(2616005)(26005)(110136005)(2906002)(11346002)(50226002)(8936002)(186003)(2501003)(102836004)(99286004)(386003)(305945005)(86362001)(76176011)(52116002)(6506007)(7736002)(6486002)(6436002)(6512007)(1076003)(5660300002)(4744005)(66946007)(66556008)(66476007)(64756008)(66446008)(14454004)(36756003)(25786009)(478600001)(256004)(71190400001)(8676002)(81156014)(81166006)(14444005)(71200400001)(6116002)(3846002)(4326008);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4175;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: BCL:0; x-microsoft-antispam-message-info: wD+YGVbUQq3zTx1QKfgCyVddSNx1ZqBGM5L1st386+2P0q66rixRi5flirEzSMsuMFDxnyWAr+t4GBl/go2wXX0wmdPCUSo/FZXDaspewKHwU9mzPIjb0CvH3h80W2QpYcH69wNt3CMgcK1fxYkW5nHqAkLY4MnJfp+7T3+k1s+fjVw+QmQGF1eWfx21o7rRkOsb5CsgKT6qfHzDjcgYWkGtURoAiIL2z9af+abSkN0Y9OtdWl7UW5MFwRieC1ZxnkeaSrVFyBlleMgp4VwlFKMsvDaAuCplvaT4Bszfwu55wQpW9Q/W/CG0Mbvl64oGEFhw7195+airjvUpZvrIR/dX+NC10dmJTFkAFLlu6Tnjcq3CK0pNul1XnuItaOPsuhb+mNOkbGc8WcDTIrYwUIrkb0JV7TL74j95WhlZSS/T81sV7bCLP1IH6/dKvHrn MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45719c26-a00a-4ef9-dfed-08d777efe7fd X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2019 12:54:17.3136 (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-CrossTenant-userprincipalname: ZfD7pMx33Xr+ZG7FFEVauBrNgtOJuZNWp/r+igVNUz31BNTBbvpz0dgZlbV2DrY2nQ21tlUYqUb7yTaAaP8ojw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4175 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Except SDHCI_QUIRK_BROKEN_CARD_DETECTION and MMC_CAP_NONREMOVABLE, we also do not need to handle controller native card detect interrupt for gpio cd type. If we wrong enabled the card detect interrupt for gpio case, it will cause a lot of unexpected card detect interrupts during data transfer which should not happen. Signed-off-by: Haibo Chen Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 3140fe2e5dba..6dc88b1aee6e 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -152,7 +152,7 @@ static void sdhci_set_card_detection(struct sdhci_host *host, bool enable) u32 present; if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) || - !mmc_card_is_removable(host->mmc)) + !mmc_card_is_removable(host->mmc) || mmc_can_gpio_cd(host->mmc)) return; if (enable) { From patchwork Tue Dec 3 12:54:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 11271211 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4CE941805 for ; Tue, 3 Dec 2019 12:54:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 21F422073B for ; Tue, 3 Dec 2019 12:54:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="SzgHGqq/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726098AbfLCMyX (ORCPT ); Tue, 3 Dec 2019 07:54:23 -0500 Received: from mail-eopbgr20072.outbound.protection.outlook.com ([40.107.2.72]:27264 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725957AbfLCMyX (ORCPT ); Tue, 3 Dec 2019 07:54:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EjtlW5n5z/x5Y5YKD5viGY9+mbcPaEN0ik2+ctKnyjLI92e01ph+nQMc7kzyWQE1Npg/xzbGHGRNXcawOq0IFnGjs4+PabpzcGNFXqpsBACmiQHmVCy0gOzQlyK0v3xDeGeX9gtH91mUkNYODqQ0N82e3z16s2M1Vk87rSNz9XkjZ7tQBp48C6/aVnUI3+kmF18SczRS5e1G19rbHuIv3oPZQjPg1qlD9HIS+sUUm3ZCUvkj0NHtLUFK24XUBH9ryQgbIhubOiea/uyqDvoWM3b3/l68Z73Ghc1+nUldgsap2NVfLz3o3XhqkP3PaQ/9bYbIrmE/er2SSiCmB6ozCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ji3acwXrQpjvGJKPK1p84rflglpGpDmJq0Sk3iGTXI8=; b=I7FTv55jSH7BV5sGd/lF69okzrETksG6RKGFvA/A7gxXAfFzllFvBBxeY/zkXeOK4iVZoM4H3W0CeIP1L0XLRMrhf3brhROtj78p266VEwrbzNI7ojdoL2rHELCU1pXA14TTiqGdvFciz9fTlvTQ9r50T1C3JTe5vdvLRGsH20o0zk/gXch1Ixmku8L1+KU9iVckCHZDIpTJQ8eVTh0iPyZYsYAlEqW1inKH25C/rLyB2w5jQrb57Cr/P3BLgXxJshyyy9Dcg3mZJ2muD+1oBSMBx3eUlgpx5CQUSy9SxbefM4LX4sYVtLz49QEzmdNaqSHlm7MxIP2vNVFwbnc/QQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ji3acwXrQpjvGJKPK1p84rflglpGpDmJq0Sk3iGTXI8=; b=SzgHGqq/TPWbRPTy8CYJPhPQmKO209l5wf9a/zdGyZZqDtk5wNhzSOoNWcXI0K/L1iu2lJjn0fzFQh3ImZ/JaA2XJ17x49nTEotlKF2GsSBATJVAqqKPzLUDhpEGOV0tA6P2UT4IBTGNecH6R41mbIWwdTIKgLYv0ucU4Aflsw0= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.52.24) by VI1PR04MB4175.eurprd04.prod.outlook.com (52.133.12.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.17; Tue, 3 Dec 2019 12:54:20 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28%5]) with mapi id 15.20.2495.014; Tue, 3 Dec 2019 12:54:20 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" CC: "shawnguo@kernel.org" , "kernel@pengutronix.de" , dl-linux-imx , BOUGH CHEN , "linus.walleij@linaro.org" , "linux-mmc@vger.kernel.org" Subject: [PATCH v2 02/14] mmc: sdhci-esdhc-imx: no fail when no pinctrl available Thread-Topic: [PATCH v2 02/14] mmc: sdhci-esdhc-imx: no fail when no pinctrl available Thread-Index: AQHVqdjHL/Yu5f3AL0+NyHrCiy16WA== Date: Tue, 3 Dec 2019 12:54:20 +0000 Message-ID: <20191203130120.11511-3-haibo.chen@nxp.com> References: <20191203130120.11511-1-haibo.chen@nxp.com> In-Reply-To: <20191203130120.11511-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: HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:60::24) 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-ht: Tenant x-ms-office365-filtering-correlation-id: 28d8639d-cafd-44a5-acc6-08d777efe9d9 x-ms-traffictypediagnostic: VI1PR04MB4175:|VI1PR04MB4175: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-forefront-prvs: 02408926C4 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(366004)(396003)(136003)(39860400002)(376002)(189003)(199004)(316002)(54906003)(446003)(2616005)(26005)(110136005)(2906002)(11346002)(50226002)(8936002)(186003)(2501003)(102836004)(99286004)(386003)(305945005)(86362001)(76176011)(52116002)(6506007)(7736002)(6486002)(6436002)(6512007)(1076003)(5660300002)(66946007)(66556008)(66476007)(64756008)(66446008)(14454004)(36756003)(25786009)(478600001)(256004)(71190400001)(8676002)(81156014)(81166006)(14444005)(71200400001)(6116002)(3846002)(4326008);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4175;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: BCL:0; x-microsoft-antispam-message-info: aLef2JJ/Y6h7pS9jbE+4ffT+HL4mJZ06AV+UZZ/2RuIHCgUh8AwZdL1i3xG+awJmgWyOCCuf65Nh15S3mAMALe87/Ujc9vgxnkWnKh50WpmH4XYCZqQj8O1WZEAUKLXqoOvAr8WsU53yw02wBU4UhSC/EUSZIrLyB8/vm3DX7KEkRvPv9GzojY74GoYqw8OmvIIuBojWKV+EY+a51cZKdn51KvePUBlzVkT1WE6lG0fsHkDZ8kl0cjeknSlMsQ9UBQfLj+Kdw4L7U755itKQ9P31B2muXQwq3WK4Vo76HG4KC2B5O6Z1/nqthFK5ylw6GJWmI5g5e5LCSuIMpTUVx88rp9r0b1RqPTJVvX8Z5zZueEYYnx7CZ+p7oVvxoR/iSs6cQGOEpPGJ24DeqvOyRJeLK0paTBk6KVY2GRCDRaOSGRbtKeERe1nNtYNIk0/z MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 28d8639d-cafd-44a5-acc6-08d777efe9d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2019 12:54:20.3938 (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-CrossTenant-userprincipalname: x3QpHt7BeZVpOrWuKZGcuR42yEPtJVlAJLWTMYqLsxW9UNpZXm0KbLbc+pafRWV/edGXd96E7ujcwJwfgg5Yfw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4175 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org When using jailhouse to support two Linux on i.MX8MQ EVK, we use the 1st Linux to configure pinctrl for the 2nd Linux. Then the 2nd Linux could use the mmc without pinctrl driver. So give a warning message when no pinctrl available, but no fail probe. Signed-off-by: Haibo Chen Acked-by: Adrian Hunter Acked-by: Linus Walleij --- drivers/mmc/host/sdhci-esdhc-imx.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 1c988d6a2433..3830f4dc8dfc 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1489,13 +1489,14 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) imx_data->pinctrl = devm_pinctrl_get(&pdev->dev); if (IS_ERR(imx_data->pinctrl)) { err = PTR_ERR(imx_data->pinctrl); - goto disable_ahb_clk; - } - - imx_data->pins_default = pinctrl_lookup_state(imx_data->pinctrl, + dev_warn(mmc_dev(host->mmc), "could not get pinctrl\n"); + imx_data->pins_default = ERR_PTR(-EINVAL); + } else { + imx_data->pins_default = pinctrl_lookup_state(imx_data->pinctrl, PINCTRL_STATE_DEFAULT); - if (IS_ERR(imx_data->pins_default)) - dev_warn(mmc_dev(host->mmc), "could not get default state\n"); + if (IS_ERR(imx_data->pins_default)) + dev_warn(mmc_dev(host->mmc), "could not get default state\n"); + } if (esdhc_is_usdhc(imx_data)) { host->quirks2 |= SDHCI_QUIRK2_PRESET_VALUE_BROKEN; From patchwork Tue Dec 3 12:54: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: 11271213 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DDC54184E for ; Tue, 3 Dec 2019 12:54:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B3BC42070A for ; Tue, 3 Dec 2019 12:54:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="IRPDbhw7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726105AbfLCMy1 (ORCPT ); Tue, 3 Dec 2019 07:54:27 -0500 Received: from mail-eopbgr20070.outbound.protection.outlook.com ([40.107.2.70]:48773 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725957AbfLCMy1 (ORCPT ); Tue, 3 Dec 2019 07:54:27 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CTl9G+1czIEVihPBH7IYpXzLiHEOH/ET7fmURGglUKcDfAw9pbxK7b1bsfpiXwb7Pq4ofb54T63k7vjEKtIOkb9KdH8tuJJdaIcxBZb79OOATnf3q8elA+i+DTg2FuMIstcffP9oMbpXlfXoVCAnHblBi9Ga6aTdj4EGjV2xdKRh4RK6vxHZMslHsam9ID/Pm6G91XHvKpCTKUdCRxS9sezIRz7ShhFTQwwrpNRr2sWUO3778tjg7TnGOt1R3SEk2eioRgNPKNJSXQDnWXoN7asT1kcmsdUpmNNBIb4irKYpbhyoarwi8hmIglHDsTcCrxx7CZvLs8E7v+fJv6yc4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+G0/b+14UhZ0Btt2gn3FkOZ+8pIbfLojhCzwnqoKXXI=; b=naZVFdHlknvyQtRr69256M1VJSLh6IGYbDcVZpv+I8OFbbko/CtXEEPAw1xHfKKszqZyrelL46jaGt6FHeeB6BraEF+YPCQM7QInZEpyqe1aSTIQ2+k+1EGOf/am5Gfgcdxcw7pwKolzt5505Pojm7LA6xrwOx+0daR4CGGU7NWUgV40ON7AFxFqQZHJNCritXUHUz19+CeGLmLFNZaSqTlSYpODCiOIrDyk/EZ8XPrcbxCCmSW5Lt/Alae+13F0X+LPqOMunD8EBVd8TOarl95CgBA4gPhOWrVfbZA19K9PwpP7bwLce/lZFvi1onLUXcSk+u08qvyQoPe3DhA+AQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+G0/b+14UhZ0Btt2gn3FkOZ+8pIbfLojhCzwnqoKXXI=; b=IRPDbhw7T3amufBVEqgIV+xly228jAYIaVcn0YW5EgFt6NOTYuq0MC8KGZJPKeUEmONpcraB2bjx2G0dOPm9c+hek5g3I9B3Y8xwavu1VH6ly4Ox0dxdWud63znATXUpcO8Vwc28nyTayKFfZ15RiglDb5arYAUPLX78lz5u2Pc= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.52.24) by VI1PR04MB4175.eurprd04.prod.outlook.com (52.133.12.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.17; Tue, 3 Dec 2019 12:54:23 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28%5]) with mapi id 15.20.2495.014; Tue, 3 Dec 2019 12:54:23 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" CC: "shawnguo@kernel.org" , "kernel@pengutronix.de" , dl-linux-imx , BOUGH CHEN , "linus.walleij@linaro.org" , "linux-mmc@vger.kernel.org" Subject: [PATCH v2 03/14] mmc: sdhci-esdhci-imx: retune needed for Mega/Mix enabled SoCs Thread-Topic: [PATCH v2 03/14] mmc: sdhci-esdhci-imx: retune needed for Mega/Mix enabled SoCs Thread-Index: AQHVqdjJV29nzvK6906nGa+BobsNyQ== Date: Tue, 3 Dec 2019 12:54:23 +0000 Message-ID: <20191203130120.11511-4-haibo.chen@nxp.com> References: <20191203130120.11511-1-haibo.chen@nxp.com> In-Reply-To: <20191203130120.11511-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: HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:60::24) 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-ht: Tenant x-ms-office365-filtering-correlation-id: a3296471-4a26-45c3-9cda-08d777efebae x-ms-traffictypediagnostic: VI1PR04MB4175:|VI1PR04MB4175: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1122; x-forefront-prvs: 02408926C4 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6029001)(4636009)(346002)(366004)(396003)(136003)(39860400002)(376002)(189003)(199004)(316002)(54906003)(446003)(2616005)(26005)(110136005)(2906002)(11346002)(50226002)(8936002)(186003)(2501003)(102836004)(99286004)(386003)(305945005)(86362001)(76176011)(52116002)(6506007)(7736002)(6486002)(6436002)(6512007)(1076003)(5660300002)(66946007)(66556008)(66476007)(64756008)(66446008)(14454004)(36756003)(25786009)(478600001)(256004)(71190400001)(8676002)(81156014)(81166006)(14444005)(71200400001)(6116002)(3846002)(4326008);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4175;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: BCL:0; x-microsoft-antispam-message-info: nBoorNkwNJ1NfVBseOp1wbIVlqMV9uKawbLyHu7d07AlYZGYiM6KaSqFaySi3U5GMiIk7Kur/bNAJLCIOIpwcMf08bMm6jYBLsVtcXyF2mvCAtNOaazpz4TmC2XhSgHkf9JF2dJ1eGVuOV2B9UdcI1IsDly24kmHnC0zUrthvfjbv3W6O/LHf4oXwioIGgxeScRq86/qOVE1iKNA5xRV1jAdodf+6gW107/Rd7mPw4oDZIdqS/Ep0VHF4TGixw2nBgWtdIwybGw4A8qTFhh/fIiH2tg3hXLn/nPShn3PcG6eJ1/Fnw4dbXmlDuEntF1eytTjNHDYKwCtKocwqy7dBDbzSpwBBzJg/FZf5ffWDwBGxfqkI+hENK16cWhBk6F65nxIw16/MXcWqWrObmhKsEU8kOReZLw6xwCkK/ZtU9fH9ZtxlwK/34Oja/unUt10 MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a3296471-4a26-45c3-9cda-08d777efebae X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2019 12:54:23.3421 (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-CrossTenant-userprincipalname: G88EsepaORr6nCjPzh+1yc5fJHwxGWUPmo7QV9MCOtLGFvz9uab0LyAPktP3Qnn6Ns3xSbSg+oso1hQaai3fWg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4175 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org For Mega/Mix enabled SoCs like MX7D and MX6SX, uSDHC will lost power in LP mode no matter whether the MMC_KEEP_POWER flag is set or not. This may cause state misalign between kernel and HW, especially for SDIO3.0 WiFi cards. e.g. SDIO WiFi driver usually will keep power during system suspend. And after resume, no card re-enumeration called. But the tuning state is lost due to Mega/Mix. Then CRC error may happen during next data transfer. So we should always fire a mmc_retune_needed() for such type SoC to tell MMC core retuning is needed for next data transfer. mmc: sdhci-esdhci-imx: retune needed for Mega/Mix enabled SoCs Signed-off-by: Haibo Chen Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-esdhc-imx.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 3830f4dc8dfc..0f281821a269 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -160,6 +160,8 @@ #define ESDHC_FLAG_CQHCI BIT(12) /* need request pmqos during low power */ #define ESDHC_FLAG_PMQOS BIT(13) +/* The IP state got lost in low power mode */ +#define ESDHC_FLAG_STATE_LOST_IN_LPMODE BIT(14) struct esdhc_soc_data { u32 flags; @@ -193,32 +195,37 @@ static const struct esdhc_soc_data usdhc_imx6sl_data = { static const struct esdhc_soc_data usdhc_imx6sx_data = { .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING - | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200, + | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200 + | ESDHC_FLAG_STATE_LOST_IN_LPMODE, }; static const struct esdhc_soc_data usdhc_imx6ull_data = { .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200 - | ESDHC_FLAG_ERR010450, + | ESDHC_FLAG_ERR010450 + | ESDHC_FLAG_STATE_LOST_IN_LPMODE, }; static const struct esdhc_soc_data usdhc_imx7d_data = { .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200 - | ESDHC_FLAG_HS400, + | ESDHC_FLAG_HS400 + | ESDHC_FLAG_STATE_LOST_IN_LPMODE, }; 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_HS400, + | ESDHC_FLAG_PMQOS | ESDHC_FLAG_HS400 + | ESDHC_FLAG_STATE_LOST_IN_LPMODE, }; static struct esdhc_soc_data usdhc_imx8qxp_data = { .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200 | ESDHC_FLAG_HS400 | ESDHC_FLAG_HS400_ES - | ESDHC_FLAG_CQHCI, + | ESDHC_FLAG_CQHCI + | ESDHC_FLAG_STATE_LOST_IN_LPMODE, }; struct pltfm_imx_data { @@ -1613,6 +1620,8 @@ static int sdhci_esdhc_imx_remove(struct platform_device *pdev) static int sdhci_esdhc_suspend(struct device *dev) { struct sdhci_host *host = dev_get_drvdata(dev); + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host); int ret; if (host->mmc->caps2 & MMC_CAP2_CQE) { @@ -1621,6 +1630,12 @@ static int sdhci_esdhc_suspend(struct device *dev) return ret; } + if ((imx_data->socdata->flags & ESDHC_FLAG_STATE_LOST_IN_LPMODE) && + (host->tuning_mode != SDHCI_TUNING_MODE_1)) { + mmc_retune_timer_stop(host->mmc); + mmc_retune_needed(host->mmc); + } + if (host->tuning_mode != SDHCI_TUNING_MODE_3) mmc_retune_needed(host->mmc); From patchwork Tue Dec 3 12:54:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 11271217 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 632E11892 for ; Tue, 3 Dec 2019 12:54:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 379932073B for ; Tue, 3 Dec 2019 12:54:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="OX+lLs8d" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726114AbfLCMy3 (ORCPT ); Tue, 3 Dec 2019 07:54:29 -0500 Received: from mail-eopbgr20070.outbound.protection.outlook.com ([40.107.2.70]:48773 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725957AbfLCMy3 (ORCPT ); Tue, 3 Dec 2019 07:54:29 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TF8DscDUYhNtzXSwIKdBNv7fnWGMlUHCKTbRyH1PwuUdgaK0Tg4p/SLOsinSp8hXtVrqDl+spO+KFw4u0YTyzV9jnIJZAJmoO2I+6QU2ckK893wvO9dKVzIs8DwZMTOSMxSrncS+KcqllsT5Hc0D+rWOPYm94KSCTg8n1GVQPLZrxki65MXJZqX/rPfhMqYM003DEs3oKg53JJdKccPgElFQm63FP2n4vh26FpdX051oHNHCKl+zqt6VBoh4470rhKvPpF2GpRZUZyHf3gB90U2kSOaxIzaRDgDs17CcJChCwEY9McgTlM1pgoOmL9T1xVdGcvVIvjzl494TC7HQ0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0ACFRw3zCeVNDiJZSKV2jP/6XZ2C/oslyVVCzQYvdIo=; b=hCxSDbJLGP3qrrK6H8LDDubgqKHjUL5towHM2SXEFgE06wbGiQgko7c2JDUpQ//JwSSzfQ7COfseiUE7F9FYqf25oB4XklxT5ePiZ9UGb6K5F85+MnZCG67AmrlC2t1Day5xBrgDqMVC3g0QBdxW45EwPklFXwzNxVCmqi1dmLaErKQlhRcuzkq8N6PIad3S4GVpfdHY0aLWSCyKnLv4mRywYN8SG2fr+CqpLmtyMPGnPEmvg3S5x0Yji9lpc9L+ueI3T484u40gbn2oCYjwPv4C37UdDxrEqQxf9Gwcf/9NNJJc04H8afdD+03C5hdyRKMa7LvXNFwOWuN8sJfLmg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0ACFRw3zCeVNDiJZSKV2jP/6XZ2C/oslyVVCzQYvdIo=; b=OX+lLs8d2KKis/prjZFnYIFQmMqZHQJ+7cD2htb8Cb/JmqW8/ypLJ5xjY4E3h/WHspykrMZ0ZpfRMrXCr7MNGvy2YID1uil2mHeApihneU6mV4ehZ74xpEp8EkmkptheXsI2rlo4uU1AEBd5icrJ2maXw2TCUYXzm9vHsgLaKs0= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.52.24) by VI1PR04MB4175.eurprd04.prod.outlook.com (52.133.12.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.17; Tue, 3 Dec 2019 12:54:26 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28%5]) with mapi id 15.20.2495.014; Tue, 3 Dec 2019 12:54:26 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" CC: "shawnguo@kernel.org" , "kernel@pengutronix.de" , dl-linux-imx , BOUGH CHEN , "linus.walleij@linaro.org" , "linux-mmc@vger.kernel.org" Subject: [PATCH v2 04/14] mmc: sdhci-esdhc-imx: restore the per_clk rate in PM_RUNTIME Thread-Topic: [PATCH v2 04/14] mmc: sdhci-esdhc-imx: restore the per_clk rate in PM_RUNTIME Thread-Index: AQHVqdjLQtGwmcDSKk2xlu+qQhULqA== Date: Tue, 3 Dec 2019 12:54:26 +0000 Message-ID: <20191203130120.11511-5-haibo.chen@nxp.com> References: <20191203130120.11511-1-haibo.chen@nxp.com> In-Reply-To: <20191203130120.11511-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: HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:60::24) 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-ht: Tenant x-ms-office365-filtering-correlation-id: d361ecb1-fe3f-4f3b-e53d-08d777efed6d x-ms-traffictypediagnostic: VI1PR04MB4175:|VI1PR04MB4175: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1332; x-forefront-prvs: 02408926C4 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(366004)(396003)(136003)(39860400002)(376002)(189003)(199004)(316002)(54906003)(446003)(2616005)(26005)(110136005)(2906002)(11346002)(50226002)(8936002)(186003)(2501003)(102836004)(99286004)(386003)(305945005)(86362001)(76176011)(52116002)(6506007)(7736002)(6486002)(6436002)(6512007)(1076003)(5660300002)(66946007)(66556008)(66476007)(64756008)(66446008)(14454004)(36756003)(25786009)(478600001)(256004)(71190400001)(8676002)(81156014)(81166006)(14444005)(71200400001)(6116002)(3846002)(4326008);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4175;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: BCL:0; x-microsoft-antispam-message-info: 8VZ1xwsCfEPpUNkn5tIWMk5OZoe+SFDSj5NyN8XGgnDBMRwLCL5uw1PKtgKmwnm0RcQp9TvXZQLkM/qKgCNCncZHPx+aBSJzALjpxDUh5KPTYk7eLY7wpaI/d2ZQNo5OX5Eu9yhUmfiRSPLsVIhpPNGFX9DZGfqWNor/6bFSzM48IDdUSiJ3eF7rywFgGAm6haRitqyjPTbQ9se+dvxh8Np5f6QkSOJ7QvLagJzcq6Ar7XXHS4o9AXNTDmurI6a0IYG4plEwpz8yTXgMRsYfXDQC1TDBJetYVi4XiAS7ZccQtJvcAdJSdnfA6L/4xvWt4nMV9jpGZo+SJ3oiMxvhgPWZEaIcWXFgvoXajsCSxsbln7fMYea184x323HY77IzjPocjWoQLkzFEuuouKGrVHIUlwvfW0oaDLe0U8QtKQht7S3C/xjMoCTMZvupMoIo MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d361ecb1-fe3f-4f3b-e53d-08d777efed6d X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2019 12:54:26.2194 (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-CrossTenant-userprincipalname: zH8bTelSeC/uG8cozigAp9qPZZlJ0lLYHdR8ZUIaq5JdhTlyEO2IDZgBT1FXZgt5COqt2gtSL9fKo0fPfFfDKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4175 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org When pm_runtime_suspend is run, a call to SCFW power off the SS (SS is a power domain, usdhc belong to this SS power domain) in which the resource resides is made. The SCFW can power off the SS if no other resource in active in that SS. If so, all state associated with all the resources within the SS that is powered off is lost, this includes the clock rates, clock state etc. When pm_runtime_resume is called, the SS associated with that resource is powered up. But the clocks are left in the default state. This patch restore clock rate in pm_runtime_resume, make sure the clock is right rather than depending on the default state setting by SCFW. Signed-off-by: Haibo Chen Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-esdhc-imx.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 0f281821a269..0cce4d97f0a5 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -162,6 +162,8 @@ #define ESDHC_FLAG_PMQOS BIT(13) /* The IP state got lost in low power mode */ #define ESDHC_FLAG_STATE_LOST_IN_LPMODE BIT(14) +/* The IP lost clock rate in PM_RUNTIME */ +#define ESDHC_FLAG_CLK_RATE_LOST_IN_PM_RUNTIME BIT(15) struct esdhc_soc_data { u32 flags; @@ -225,7 +227,8 @@ static struct esdhc_soc_data usdhc_imx8qxp_data = { | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200 | ESDHC_FLAG_HS400 | ESDHC_FLAG_HS400_ES | ESDHC_FLAG_CQHCI - | ESDHC_FLAG_STATE_LOST_IN_LPMODE, + | ESDHC_FLAG_STATE_LOST_IN_LPMODE + | ESDHC_FLAG_CLK_RATE_LOST_IN_PM_RUNTIME, }; struct pltfm_imx_data { @@ -1705,6 +1708,9 @@ static int sdhci_esdhc_runtime_resume(struct device *dev) pm_qos_add_request(&imx_data->pm_qos_req, PM_QOS_CPU_DMA_LATENCY, 0); + if (imx_data->socdata->flags & ESDHC_FLAG_CLK_RATE_LOST_IN_PM_RUNTIME) + clk_set_rate(imx_data->clk_per, pltfm_host->clock); + err = clk_prepare_enable(imx_data->clk_ahb); if (err) goto remove_pm_qos_request; From patchwork Tue Dec 3 12:54:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 11271219 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 41D17186E for ; Tue, 3 Dec 2019 12:54:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 215C72073C for ; Tue, 3 Dec 2019 12:54:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="KXRYMF0x" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726115AbfLCMyc (ORCPT ); Tue, 3 Dec 2019 07:54:32 -0500 Received: from mail-eopbgr30054.outbound.protection.outlook.com ([40.107.3.54]:9306 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725957AbfLCMyc (ORCPT ); Tue, 3 Dec 2019 07:54:32 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lxhweOBKbTY2Z+JejtuTl7U11sCMeGd9IoJjwfIn6HPbU8Pk+0vFvHg8ZIM2aJfmy+FTOvKCC8Ls1Kn8zcFjlI16O8dtC6aOvFRIJGAjZLNI52aVkWemg6AMvHVPne9X/ztlzRpHwO5+vJdfHZmxDZDx1pI0gyz8rCWv5/1Yy5YkITDduKPjMzngDN4MzDO6sdWZUU0LrmDg4dzM/0v5xj4KQ8xOMTbcN+Nlq6jWArYH+PQd3/n9OCX6SDFt+/zQeVM0ohTFK5GSo15DsuUemtR+DYMyM2mcUxvrYILJ5WyZ5rWoWWwwNwmDbccrnLGE4/S6xneaCXM8y0jDIlI1bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dLceWLpfZ2/TghsK04OcCVxmkfHtlBjjJV89+kjwVfc=; b=WxmvtBMSxV392z2hohSpVaMfykhvHnR1ln2qbzWMLBzE4oCXOIFz1Mvc2XlpMFuAqIGrexoTq5Yq8/toK1HW756Ks1B1fKt3smi8s6eyDxX/win4MO352MIfKTkS/1Ol3Y0cA70ngzzfVZ7OhW/JJkKV41qvv22rUWvb38Qf9Z0mraLfrpc3FARUwef/LNo1ruX+v00wOskhPVrh95+PFAWQ90lofYFRZyEsZWp0GbM7YuWamal95ZtzH1ekQYyYBpgbqHKVIqmAY2iQHebCRiy6eVWEurh9g8X5fmNFtDLmKWv6Xw2uff5Jmnd3i+IZuYs2dJMJMopEt6zraue5pw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dLceWLpfZ2/TghsK04OcCVxmkfHtlBjjJV89+kjwVfc=; b=KXRYMF0xSW6o/oUCt9jl8YjFTzFUMiPSwmnVKR35r2SHD02iT0qgyTwNFJpjBfz2l8TkqkvjE7NxzkKBsENFs0qOC+aOFn8cmuywwxMjSayechKLlepqx7eyH6rDkYVsP3qYTZiki11fw9zqg/53os4XnO+syfaz/MQyIs7OlkI= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.52.24) by VI1PR04MB4175.eurprd04.prod.outlook.com (52.133.12.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.17; Tue, 3 Dec 2019 12:54:29 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28%5]) with mapi id 15.20.2495.014; Tue, 3 Dec 2019 12:54:29 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" CC: "shawnguo@kernel.org" , "kernel@pengutronix.de" , dl-linux-imx , BOUGH CHEN , "linus.walleij@linaro.org" , "linux-mmc@vger.kernel.org" Subject: [PATCH v2 05/14] doc: dt: fsl-imx-esdhc: add strobe-dll-delay-target binding Thread-Topic: [PATCH v2 05/14] doc: dt: fsl-imx-esdhc: add strobe-dll-delay-target binding Thread-Index: AQHVqdjM6d0A2BMEJEmSplPKQapDaQ== Date: Tue, 3 Dec 2019 12:54:29 +0000 Message-ID: <20191203130120.11511-6-haibo.chen@nxp.com> References: <20191203130120.11511-1-haibo.chen@nxp.com> In-Reply-To: <20191203130120.11511-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: HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:60::24) 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-ht: Tenant x-ms-office365-filtering-correlation-id: 64db80b8-344e-40e7-84a4-08d777efef29 x-ms-traffictypediagnostic: VI1PR04MB4175:|VI1PR04MB4175: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-forefront-prvs: 02408926C4 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(366004)(396003)(136003)(39860400002)(376002)(43544003)(189003)(199004)(316002)(54906003)(446003)(2616005)(26005)(110136005)(2906002)(11346002)(50226002)(8936002)(186003)(2501003)(102836004)(99286004)(386003)(305945005)(86362001)(76176011)(52116002)(6506007)(7736002)(6486002)(6436002)(6512007)(1076003)(5660300002)(66946007)(66556008)(66476007)(64756008)(66446008)(14454004)(36756003)(25786009)(478600001)(256004)(71190400001)(8676002)(81156014)(81166006)(71200400001)(6116002)(3846002)(4326008);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4175;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: BCL:0; x-microsoft-antispam-message-info: nSQtSgEIo6cG8/a6a6kJEn7I80FKNyYOXOhbLThEuvuTrwTV6jJquLW7swyvWi6CtqBhMUNpj+sDdQXoaNKwUCMae1/dog9gL6OToXECpF1I8j+zlK14K3bTu2I5KbfQ19HTg+UAhZqHDm8CHjamB65Sl/ZvLq5UUTJCkd8ZGkNaCyI3ZLu36C6fpnVopI3qqqigjBvK8nntEGS+nw3s+HpVKczZo1tMXCFmHUzTOXGmziSrUABHr57ZQUXCQE5xHU1yHvdOCyAT+nNkkTiuauQ4JBrGy5ZGVkNuO8bcZZwZrqr4WL5JFFlDPwpNg5nAZJoHLyb9UCFvcpoVtJex2HZN4KqcNcvsse6U8ofCM8H2SglFuvVSWHdOzugWUjsq6HAShA3UEVw8yVrPagKNA64YaaC3tpiSxO8c0hxe9LB+D7Vgod/18SrNUY+EVR17olJfm76J7BxybeRax89nEDajgV7lMKwBEjdvRroOVREyPpDtoqvdiPS3cbvaOsaC MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 64db80b8-344e-40e7-84a4-08d777efef29 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2019 12:54:29.3406 (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-CrossTenant-userprincipalname: xkh5mX0PI+DsH+u3S5yiqbQp9gMW3LoFLE15SvpQeW39RDliR1fe4ABNZmPuJq6zNP1yFN1cG2puico4tvZp0A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4175 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Add fsl,strobe-dll-delay-target binding. Signed-off-by: Haibo Chen --- Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt index 2fb466ca2a9d..89b986a2f9d5 100644 --- a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt +++ b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt @@ -41,6 +41,11 @@ Optional properties: This property allows user to change the tuning step to more than one delay cells which is useful for some special boards or cards when the default tuning step can't find the proper delay window within limited tuning retries. +- fsl,strobe-dll-delay-target: Specify the strobe dll control slave delay target. + This delay target programming host controller loopback read clock, and this + property allows user to change the delay target for the strobe input read clock. + If not use this property, driver default set the delay target to value 7. + Only eMMC HS400 mode need to take care of this property. Examples: From patchwork Tue Dec 3 12:54: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: 11271227 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE234109A for ; Tue, 3 Dec 2019 12:55:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C2BA22070A for ; Tue, 3 Dec 2019 12:55:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="nBmMSHep" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726107AbfLCMzP (ORCPT ); Tue, 3 Dec 2019 07:55:15 -0500 Received: from mail-eopbgr30049.outbound.protection.outlook.com ([40.107.3.49]:58425 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725957AbfLCMzP (ORCPT ); Tue, 3 Dec 2019 07:55:15 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SFJ9TJ9KyyGws6mD+KT0+nQCWx3baCQT0CZbbztqRoH1pz5OIDBXYyBb9twjRSr51+1oE6ygi3zV7GOr4/frxcbY/oHJ36jY8esLcuCE2lDPyE09qMqJtj48MOyizkw/99k5gwRhvjEfgCdbIdoES4sEUg0AgDu0PagAlq5UIPO0tN52dykRc0f6S2E7k0eEd9VR1T7T+f+/3n9luNDRlTaB1ehS4ZjbZZEFVCieLg1+Vi+0J9QRWIxy6wGkg9P54RAOORx1Jm1jD5Of3ySJRbGcfWbHPB2o5aJja2Nx3xyjKWe05tzT35jxpyvpSAEJV3SkgD/ZKoijoviKBcjo3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=If63YVvszuJfkk25g6OT210eHJZClzVbHwdKzVBOdNA=; b=M6nQa65MeQdJEHyuIfhOuJp7GuIELFDd2NsIkygPyCHaB82f0bXIw2ctqZsv2JzILYQizRgzMgh9e7cMY3EkTupw1WjljEkYa3f9JIm9dwUZT4nLOJIS/hgFJMusHYZ0xd1/SlzcgdQBVstYMvU2uPl6NrkJoV6N3fhWHqgiGaPOfJ+yJ0fowu6zCbtnpN2KzYs/p/019SFjM8PFI4ZZkkIFCQ5OuveYkE3t/RKWlvxnM7FCldij9LnMhHGnfC5nlhiGgXwaENQ1gc2l1izmwJYj08/aB9oLTqvJUuNf6WKeUNx1/Hur+Evqxc9pkFH0DVLq8ZrE4i5u7/yYPkwvLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=If63YVvszuJfkk25g6OT210eHJZClzVbHwdKzVBOdNA=; b=nBmMSHepaJwTEDBwX5z0GcwG/0i368ZbSqRjipfSnwnjU+E7PJOjHKzPQS1A1WEOAGpram38+kwJsL/5D0rTYDlPQk880BB5F8OzSUsg4VsVkfeeonGgUnmZkYmG6OXaHd3cwJIdVGz1BVBPLC39JgYZV6C+6wgx8q3JbmveRuU= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.52.24) by VI1PR04MB4175.eurprd04.prod.outlook.com (52.133.12.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.17; Tue, 3 Dec 2019 12:54:32 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28%5]) with mapi id 15.20.2495.014; Tue, 3 Dec 2019 12:54:32 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" CC: "shawnguo@kernel.org" , "kernel@pengutronix.de" , dl-linux-imx , BOUGH CHEN , "linus.walleij@linaro.org" , "linux-mmc@vger.kernel.org" Subject: [PATCH v2 06/14] mmc: sdhci-esdhc-imx: add strobe-dll-delay-target support Thread-Topic: [PATCH v2 06/14] mmc: sdhci-esdhc-imx: add strobe-dll-delay-target support Thread-Index: AQHVqdjO3OyZWtmIiEeElCDyjtyv3w== Date: Tue, 3 Dec 2019 12:54:32 +0000 Message-ID: <20191203130120.11511-7-haibo.chen@nxp.com> References: <20191203130120.11511-1-haibo.chen@nxp.com> In-Reply-To: <20191203130120.11511-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: HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:60::24) 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-ht: Tenant x-ms-office365-filtering-correlation-id: ee7bdb8e-b183-460a-a79d-08d777eff101 x-ms-traffictypediagnostic: VI1PR04MB4175:|VI1PR04MB4175: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 02408926C4 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(366004)(396003)(136003)(39860400002)(376002)(189003)(199004)(316002)(54906003)(446003)(2616005)(26005)(110136005)(2906002)(11346002)(50226002)(8936002)(186003)(2501003)(102836004)(99286004)(386003)(305945005)(86362001)(76176011)(52116002)(6506007)(7736002)(6486002)(6436002)(6512007)(1076003)(5660300002)(66946007)(66556008)(66476007)(64756008)(66446008)(14454004)(36756003)(25786009)(478600001)(256004)(71190400001)(8676002)(81156014)(81166006)(14444005)(71200400001)(6116002)(3846002)(4326008);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4175;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: BCL:0; x-microsoft-antispam-message-info: Ol8KSIarsj0nQjFvBlZzNJtk+LX7EPjRh9W9GYDkcVtVGcWpZcP2gu7xUz/4+rWccDvMlX8HSLsAeuzIoftWrzVxO7cVDDCspX7p5/owgRTwF3ngbEOUJHagW4ZPi+MJusMAv9Htuk1gcC1oAYMy6Akxe2DhDMIe+qict8Q5tqpg5YayuFHzFdqrYTJDQ9RViEYeJ5LieHImMFWX5BFjw6rIJ1JESOWtHHDI1kPgpFBzXudhvjGwN7YEKw3M5hc8sQzlwOHY4AqvxUNpAFb+ONN42HLYdd8hGc03JbiBGATByEQCruLo1W84qmenpbOo0MPG9DlAuBeDY1MJVlyul8ryIo/h6mFNBJStXBl9roZrJuXMQztJNmEvTAOS7Fd85UcgMtxq+GGXSV/6RUs03dc4kZmGwC8AMwiinpT4qCfLjDkOiwKlKt0KzXUDDsZn MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee7bdb8e-b183-460a-a79d-08d777eff101 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2019 12:54:32.3879 (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-CrossTenant-userprincipalname: pmg1chHzShSDj7Lgl3DEpuilI7HBw/PiKcnCQ+S/dUC1U7GxU18lr8Op1hemM/x4pxsQzqIEIbZGeZBrE/Smtw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4175 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org strobe-dll-delay-target is the delay cell add on the strobe line. Strobe line the the uSDHC loopback read clock which is use in HS400 mode. Different strobe-dll-delay-target may need to set for different board/SoC. If this delay cell is not set to an appropriate value, we may see some read operation meet CRC error after HS400 mode select which already pass the tuning. This patch add the strobe-dll-delay-target setting in driver, so that user can easily config this delay cell in dts file. Signed-off-by: Haibo Chen Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-esdhc-imx.c | 12 +++++++++++- include/linux/platform_data/mmc-esdhc-imx.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 0cce4d97f0a5..4b19ac0039f6 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -73,6 +73,7 @@ #define ESDHC_STROBE_DLL_CTRL 0x70 #define ESDHC_STROBE_DLL_CTRL_ENABLE (1 << 0) #define ESDHC_STROBE_DLL_CTRL_RESET (1 << 1) +#define ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_DEFAULT 0x7 #define ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_SHIFT 3 #define ESDHC_STROBE_DLL_CTRL_SLV_UPDATE_INT_DEFAULT (4 << 20) @@ -995,6 +996,9 @@ static int esdhc_change_pinstate(struct sdhci_host *host, */ static void esdhc_set_strobe_dll(struct sdhci_host *host) { + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host); + u32 strobe_delay; u32 v; /* disable clock before enabling strobe dll */ @@ -1012,9 +1016,13 @@ static void esdhc_set_strobe_dll(struct sdhci_host *host) * enable strobe dll ctrl and adjust the delay target * for the uSDHC loopback read clock */ + if (imx_data->boarddata.strobe_dll_delay_target) + strobe_delay = imx_data->boarddata.strobe_dll_delay_target; + else + strobe_delay = ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_DEFAULT; v = ESDHC_STROBE_DLL_CTRL_ENABLE | ESDHC_STROBE_DLL_CTRL_SLV_UPDATE_INT_DEFAULT | - (7 << ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_SHIFT); + (strobe_delay << ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_SHIFT); writel(v, host->ioaddr + ESDHC_STROBE_DLL_CTRL); /* wait 5us to make sure strobe dll status register stable */ udelay(5); @@ -1340,6 +1348,8 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, of_property_read_u32(np, "fsl,tuning-start-tap", &boarddata->tuning_start_tap); + of_property_read_u32(np, "fsl,strobe-dll-delay-target", + &boarddata->strobe_dll_delay_target); if (of_find_property(np, "no-1-8-v", NULL)) host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V; diff --git a/include/linux/platform_data/mmc-esdhc-imx.h b/include/linux/platform_data/mmc-esdhc-imx.h index 6c006078c8a1..0434f68eda86 100644 --- a/include/linux/platform_data/mmc-esdhc-imx.h +++ b/include/linux/platform_data/mmc-esdhc-imx.h @@ -37,5 +37,6 @@ struct esdhc_platform_data { unsigned int delay_line; unsigned int tuning_step; /* The delay cell steps in tuning procedure */ unsigned int tuning_start_tap; /* The start delay cell point in tuning procedure */ + unsigned int strobe_dll_delay_target; /* The delay cell for strobe pad (read clock) */ }; #endif /* __ASM_ARCH_IMX_ESDHC_H */ From patchwork Tue Dec 3 12:54:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 11271221 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F3952109A for ; Tue, 3 Dec 2019 12:54:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C8D7B2073B for ; Tue, 3 Dec 2019 12:54:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="keihz76p" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726138AbfLCMy5 (ORCPT ); Tue, 3 Dec 2019 07:54:57 -0500 Received: from mail-eopbgr30077.outbound.protection.outlook.com ([40.107.3.77]:33645 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726131AbfLCMy5 (ORCPT ); Tue, 3 Dec 2019 07:54:57 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dYTGN4sOwV0EUp6HQuhW30iPeDcBpNhUlRwxEGxlV9JoWUcSm+GZsmWzKPjIOj7adYREIqdXnVfBYDxleOO4jM/fIRD3p7YN696S8B2uirXKgpHP1WVyGrwd8zHmxD84Cv3QfzBLvEp27FjUKsPXdQ4216Gbsot8LcEDWT2vpUrieE0AHJCoHH9tlASeVI6S2OybFrd5BE0HWqeddSJdPA8idp0B68DwgrEBTMSNWcBKJZLKrwxJTUSQrJmKv1hTk5hcG2x2YeyO3Oqli2E9hnorfW/fQVVp3dp7RiadS0Zll2d1wseiGF5Marn0oZxkGy9ufgFMM1J3Hvbj/Aix3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2CSWuS8iS775GTLTNXGu9opYZ44g9Bt+nNmhBfMi/gs=; b=GqWKPET+51qmahbXvbqY42NexfNCiqFWF+plvigtJ2eM8V6FkZC8A9aUwmmcdRgZGOQ73FSuSUtksu5vC56vkrkAKfQq4x5GVxxueKSwB3m5rNt9KeBqfy2FM/j573s5UwPSPPxqDFIcBixFK6AcTDX4t7DUd/gLg9oJz020sZ1ZfDEzTkJ6/SmRVnPnYGWBX555eOHcrkxHGRoFoVUxA9ByzQuDh3OfItuToWcBLeX4irfOrLczKIBsItfUg8nKkdmUCj5z5Al/ov0vlpcnDWveqRf1po8neX7XV+TDv4NOfzGXfcf45XhrzR6nrlDbmlsWXRqKkepHw1yv2lHIwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2CSWuS8iS775GTLTNXGu9opYZ44g9Bt+nNmhBfMi/gs=; b=keihz76pezf8gHs16H+7CYtVknlhOLmE3+hmwIwD6kT7rGGGdVidYoj21+kx2lecGjfLXeaTIvbNJjx90PNZ95eskYXk+zXLNo9pQYPUnQSbsr2AlCv7dFn/qUaziYQ3U14r57g5JTGFAD5pNTq9gtDLCarCpWJjp2vxsMdKOOY= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.52.24) by VI1PR04MB4175.eurprd04.prod.outlook.com (52.133.12.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.17; Tue, 3 Dec 2019 12:54:35 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28%5]) with mapi id 15.20.2495.014; Tue, 3 Dec 2019 12:54:35 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" CC: "shawnguo@kernel.org" , "kernel@pengutronix.de" , dl-linux-imx , BOUGH CHEN , "linus.walleij@linaro.org" , "linux-mmc@vger.kernel.org" Subject: [PATCH v2 07/14] mmc: sdhci-esdhc-imx: optimize the clock setting Thread-Topic: [PATCH v2 07/14] mmc: sdhci-esdhc-imx: optimize the clock setting Thread-Index: AQHVqdjQwIYAkS+0t0OLfL7IPZ1Lcg== Date: Tue, 3 Dec 2019 12:54:35 +0000 Message-ID: <20191203130120.11511-8-haibo.chen@nxp.com> References: <20191203130120.11511-1-haibo.chen@nxp.com> In-Reply-To: <20191203130120.11511-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: HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:60::24) 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-ht: Tenant x-ms-office365-filtering-correlation-id: c1c82076-1898-46c9-61a7-08d777eff2d3 x-ms-traffictypediagnostic: VI1PR04MB4175:|VI1PR04MB4175: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2733; x-forefront-prvs: 02408926C4 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(366004)(396003)(136003)(39860400002)(376002)(189003)(199004)(316002)(54906003)(446003)(2616005)(26005)(110136005)(2906002)(11346002)(50226002)(8936002)(186003)(2501003)(102836004)(99286004)(386003)(305945005)(86362001)(76176011)(52116002)(6506007)(7736002)(6486002)(6436002)(6512007)(1076003)(5660300002)(66946007)(66556008)(66476007)(64756008)(66446008)(14454004)(36756003)(25786009)(478600001)(256004)(71190400001)(8676002)(81156014)(81166006)(14444005)(71200400001)(6116002)(3846002)(4326008);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4175;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: BCL:0; x-microsoft-antispam-message-info: E4yklc2pjiEoggkyXoz35jXQ+l/V7eStQfMr16s7Ldewe0CP1m6D5PrpMJUYeBoC3If6fXm7BjZ2a0h7GdlUm1XX3Vlb5WLI6tvwWTQs0dpLaEqbzAqQTqlHWlA/Dw1lGNNoL4ks9omJEwi0iUVOIuaqq/8oob5NetQTmaQLvBFmqH5B3yX+3CTQ+KAvyLrBLAk6cM2P2U99RsUpPLd0ZgGYY59NJ9Ng3Ee6e74k1OMNGcAgQymKtlN1RPxHRf8ZFaVA2EOBG/qClKIF3w3ZJOZjdKl6bBPqpKfGv1g/44mCLu9hC2fA5Aq9QdIawRi98eutPl0bGyvtt0o5br2gg258+jo7RGzBVyqAbjt7G+JU/UTbESN51EC82Zj+LJ7zB1we8UpmxGA4uJ20af4S1GR7/0j7KwD3/wDKBMlY9YytpYR/axgBMDDl1umM37Tx MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1c82076-1898-46c9-61a7-08d777eff2d3 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2019 12:54:35.2831 (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-CrossTenant-userprincipalname: dJWadzt4MmtppK4IspqGdl/egzqZ/GJmaxI1i0eKniU9Rh0d1NyTBHp7oP0XATz0/r4mnFIYGz1WY5O6BZk4/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4175 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org When force clock off, check the SDOFF of register PRSSTAT to make sure the clock is gate off. Before force clock on, check the SDSTB of register PRSSTAT to make sure the clock is stable, this will eliminate the clock glitch. Signed-off-by: Haibo Chen Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-esdhc-imx.c | 24 +++++++++++++++++++++++- drivers/mmc/host/sdhci-esdhc.h | 1 + 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 4b19ac0039f6..9b03656c7abc 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include @@ -313,6 +314,17 @@ static inline void esdhc_clrset_le(struct sdhci_host *host, u32 mask, u32 val, i writel(((readl(base) & ~(mask << shift)) | (val << shift)), base); } +static inline void esdhc_wait_for_card_clock_gate_off(struct sdhci_host *host) +{ + u32 present_state; + int ret; + + ret = readl_poll_timeout(host->ioaddr + ESDHC_PRSSTAT, present_state, + (present_state & ESDHC_CLOCK_GATE_OFF), 2, 100); + if (ret == -ETIMEDOUT) + dev_warn(mmc_dev(host->mmc), "%s: card clock still not gate off in 100us!.\n", __func__); +} + static u32 esdhc_readl_le(struct sdhci_host *host, int reg) { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); @@ -526,6 +538,8 @@ static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg) else new_val &= ~ESDHC_VENDOR_SPEC_FRC_SDCLK_ON; writel(new_val, host->ioaddr + ESDHC_VENDOR_SPEC); + if (!(new_val & ESDHC_VENDOR_SPEC_FRC_SDCLK_ON)) + esdhc_wait_for_card_clock_gate_off(host); return; case SDHCI_HOST_CONTROL2: new_val = readl(host->ioaddr + ESDHC_VENDOR_SPEC); @@ -754,12 +768,14 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host, int ddr_pre_div = imx_data->is_ddr ? 2 : 1; int pre_div = 1; int div = 1; + int ret; u32 temp, val; if (esdhc_is_usdhc(imx_data)) { val = readl(host->ioaddr + ESDHC_VENDOR_SPEC); writel(val & ~ESDHC_VENDOR_SPEC_FRC_SDCLK_ON, host->ioaddr + ESDHC_VENDOR_SPEC); + esdhc_wait_for_card_clock_gate_off(host); } if (clock == 0) { @@ -814,13 +830,18 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host, | (pre_div << ESDHC_PREDIV_SHIFT)); sdhci_writel(host, temp, ESDHC_SYSTEM_CONTROL); + /* need to wait the bit 3 of the PRSSTAT to be set, make sure card clock is stable */ + ret = readl_poll_timeout(host->ioaddr + ESDHC_PRSSTAT, temp, + (temp & ESDHC_CLOCK_STABLE), 2, 100); + if (ret == -ETIMEDOUT) + dev_warn(mmc_dev(host->mmc), "card clock still not stable in 100us!.\n"); + if (esdhc_is_usdhc(imx_data)) { val = readl(host->ioaddr + ESDHC_VENDOR_SPEC); writel(val | ESDHC_VENDOR_SPEC_FRC_SDCLK_ON, host->ioaddr + ESDHC_VENDOR_SPEC); } - mdelay(1); } static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host) @@ -1005,6 +1026,7 @@ static void esdhc_set_strobe_dll(struct sdhci_host *host) writel(readl(host->ioaddr + ESDHC_VENDOR_SPEC) & ~ESDHC_VENDOR_SPEC_FRC_SDCLK_ON, host->ioaddr + ESDHC_VENDOR_SPEC); + esdhc_wait_for_card_clock_gate_off(host); /* force a reset on strobe dll */ writel(ESDHC_STROBE_DLL_CTRL_RESET, diff --git a/drivers/mmc/host/sdhci-esdhc.h b/drivers/mmc/host/sdhci-esdhc.h index 9289bb4d633e..947212f16bc6 100644 --- a/drivers/mmc/host/sdhci-esdhc.h +++ b/drivers/mmc/host/sdhci-esdhc.h @@ -31,6 +31,7 @@ /* Present State Register */ #define ESDHC_PRSSTAT 0x24 +#define ESDHC_CLOCK_GATE_OFF 0x00000080 #define ESDHC_CLOCK_STABLE 0x00000008 /* Protocol Control Register */ From patchwork Tue Dec 3 12:54:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 11271223 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6B4FC109A for ; Tue, 3 Dec 2019 12:55:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 404C22070A for ; Tue, 3 Dec 2019 12:55:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="nvtbf6Bq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726017AbfLCMzL (ORCPT ); Tue, 3 Dec 2019 07:55:11 -0500 Received: from mail-eopbgr30077.outbound.protection.outlook.com ([40.107.3.77]:33645 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726139AbfLCMzL (ORCPT ); Tue, 3 Dec 2019 07:55:11 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hLkNniiuKms86fL/LmfjAuLuhS1WzkeFADfyLPMHByjoNNnF36Femb1cWvssCzV9nsDqKDrvGI0hmxspNvZ3iPna69f7lBppJc/psHBHEMyRih4FcBH/9twGJmWUcGAdH/lj2yvq8sSp0ibdg+ie00YCX4Go6SwwmegQmNiN3NwUtuP4Vii5Jh3CDZgrVrR4wcaKa0s82DOe+ya1/t3i7w7bPUIb4UVVUPDzaGzWINcm91qIgpzoEmmIockpRT+kvcVY0z8e4PZbOm9FV5uc/eTXkvRJewHAoMFc1mN8WgT4Vl3pfeueEbKIFeUkMHwgxYlg3TNpLzYBBg3JIn4A7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kXu+MVo5qLgsFOkFxGGe+8ZGREiJyR8tA6303DFcETU=; b=DO/pPixAfsdozyZc03IEeUBtcusT5vq9muehoNpjyC5JeJQ8T1t52vYaXuwiiVm2oKJkDkNdQkOKWo1X7CxB6KQGha0oLd3qtGluRX1u3U/eg5aYoZhUKkf4msixtk0znLZtpv8sGRmg4HAt7uVA/iTN71rA3lfqk+TK7IbmifsfL7Nx8TDsi6PVo2QxQabyKH4xn4FCUzSBRAhurnHMMY7QPdMCCMGXx9ClmbSW4ku2S6Kt20jQ46cwDwv9SxDPNaMN6O4q5VCjWLlBysm/Q0WYJyZCSA9ftL0R6wWeVPcyqn9R8+mOOAfoohO2snTRlUSUenMCiRn9TSphQlyM4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kXu+MVo5qLgsFOkFxGGe+8ZGREiJyR8tA6303DFcETU=; b=nvtbf6Bqnm4gwMGvm/w1we8eaVo9u82jBqtJaXIKvHddCK0hQ0zOrSp45HazAOW5G6wt4MTzaDxSANk3z1/c0te/YRmEZki4UOlHXPs49PGHSeVVGu/6ER42GgBFIee2U5HMV59j+4440LOT4tgNRDA2VZeySXANhBPY2If+ONA= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.52.24) by VI1PR04MB4175.eurprd04.prod.outlook.com (52.133.12.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.17; Tue, 3 Dec 2019 12:54:38 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28%5]) with mapi id 15.20.2495.014; Tue, 3 Dec 2019 12:54:38 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" CC: "shawnguo@kernel.org" , "kernel@pengutronix.de" , dl-linux-imx , BOUGH CHEN , "linus.walleij@linaro.org" , "linux-mmc@vger.kernel.org" Subject: [PATCH v2 08/14] mmc: sdhci-esdhc-imx: optimize the strobe dll setting Thread-Topic: [PATCH v2 08/14] mmc: sdhci-esdhc-imx: optimize the strobe dll setting Thread-Index: AQHVqdjSM99eXfGOv0K/Owj1dyyKKg== Date: Tue, 3 Dec 2019 12:54:38 +0000 Message-ID: <20191203130120.11511-9-haibo.chen@nxp.com> References: <20191203130120.11511-1-haibo.chen@nxp.com> In-Reply-To: <20191203130120.11511-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: HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:60::24) 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-ht: Tenant x-ms-office365-filtering-correlation-id: 5e7de3a0-3d17-446f-cb34-08d777eff48b x-ms-traffictypediagnostic: VI1PR04MB4175:|VI1PR04MB4175: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 02408926C4 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(366004)(396003)(136003)(39860400002)(376002)(189003)(199004)(316002)(54906003)(446003)(2616005)(26005)(110136005)(2906002)(11346002)(50226002)(8936002)(186003)(2501003)(102836004)(99286004)(386003)(305945005)(86362001)(76176011)(52116002)(6506007)(7736002)(6486002)(6436002)(6512007)(1076003)(5660300002)(66946007)(66556008)(66476007)(64756008)(66446008)(14454004)(36756003)(25786009)(478600001)(256004)(71190400001)(8676002)(81156014)(81166006)(14444005)(71200400001)(6116002)(3846002)(4326008);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4175;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: BCL:0; x-microsoft-antispam-message-info: x2ZfU0vZKuAfshs4ZRg2Pzrdkq52C2aAy3oNPO3e9XsAMCH+nZiaCe/+HhU2N/NzavuPkdWIdWn9p93Bryq24TSG9nDg58Fq0oAI5DosGuiRk3mQFwKlCDGe9ZXUgn9o4a2+6ocf2KnT0QMhpmlRBXQ7mZsBuAKozXM+UbjyF5e6koyPKJtuIxdj7X769jQoRoFHzXpin3k5xVAQldsYUsfSY2tNhP4UYkmcQ1+JGHEgsqaA18q3AGkxtQKXBz+AwyTkQA/R/+cKqswzCHMXGkSOT4dVAKzvkhu+3q/7eCM9ErZ9oS6jiU2KHWBXbdvyvNscdAxhLiybyF/HKeASeYc+G+ulFZaL06+UiCt/nepFkHLqz4K/dPHuQfPi/S8i4K63ngOW4XQh9Xw0EzCJW76sFbM2v3LF8qOJvJYY8CUD6Kod4pbucA8MD3ilolNN MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e7de3a0-3d17-446f-cb34-08d777eff48b X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2019 12:54:38.2204 (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-CrossTenant-userprincipalname: 0vj/ifZO6cGQGAWiuo1tU1aYkdsm/V6wc0yRVf8mHNiDPpO6EC7QngJDqGPqCEo8WyLfLo7vEbDKVCIzjx6T6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4175 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org After set the STROBE SLV delay target value, it need to wait some time to let the usdhc lock the REF and SLV clock. In normal case, 1~2us is enough for imx8/imx6 and imx7d, and 4~5us is enough for imx7ulp, but when do reboot stress test or do the bind/unbind stress test, sometimes need to wait about 10us to get the status lock. This patch optimize delay handle method, only print the warning message if the status is still not lock after 1ms delay. Signed-off-by: Haibo Chen Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-esdhc-imx.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 9b03656c7abc..54ffb04ab1d1 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1021,6 +1021,7 @@ static void esdhc_set_strobe_dll(struct sdhci_host *host) struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host); u32 strobe_delay; u32 v; + int ret; /* disable clock before enabling strobe dll */ writel(readl(host->ioaddr + ESDHC_VENDOR_SPEC) & @@ -1046,15 +1047,13 @@ static void esdhc_set_strobe_dll(struct sdhci_host *host) ESDHC_STROBE_DLL_CTRL_SLV_UPDATE_INT_DEFAULT | (strobe_delay << ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_SHIFT); writel(v, host->ioaddr + ESDHC_STROBE_DLL_CTRL); - /* 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), - "warning! HS400 strobe DLL status REF not lock!\n"); - if (!(v & ESDHC_STROBE_DLL_STS_SLV_LOCK)) + + /* wait max 50us to get the REF/SLV lock */ + ret = readl_poll_timeout(host->ioaddr + ESDHC_STROBE_DLL_STATUS, v, + ((v & ESDHC_STROBE_DLL_STS_REF_LOCK) && (v & ESDHC_STROBE_DLL_STS_SLV_LOCK)), 1, 50); + if (ret == -ETIMEDOUT) dev_warn(mmc_dev(host->mmc), - "warning! HS400 strobe DLL status SLV not lock!\n"); + "warning! HS400 strobe DLL status REF/SLV not lock in 50us, STROBE DLL status is %x!\n", v); } static void esdhc_reset_tuning(struct sdhci_host *host) From patchwork Tue Dec 3 12:54:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 11271225 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7A4DC14B7 for ; Tue, 3 Dec 2019 12:55:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 595E22073B for ; Tue, 3 Dec 2019 12:55:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="b8H5iKh9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726098AbfLCMzO (ORCPT ); Tue, 3 Dec 2019 07:55:14 -0500 Received: from mail-eopbgr30077.outbound.protection.outlook.com ([40.107.3.77]:33645 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726079AbfLCMzN (ORCPT ); Tue, 3 Dec 2019 07:55:13 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yu0cSeD4dJE00umYmyhPCW8sGXnwJHdSGuyvMBNOZYTfUYz2036+/3AUBCNZLuTYBp1+yuY2/nwEx7IUhtn3T8giBexyp4/t6u3of7hJZVW3D8AJDGBSyto83555hxnnTktlz1Qw0MvKqdrxkPWEbke3drVAYRoRbEVugKTWBkG5VKGErYxVxt4IpqtTVn85Vjn68RXL/3/3TtLq6taCVplgDgSxQw8mVU7ohJCy8m9UEnDxbx1PG5oQKJ31AQzecC6OcuzHxo7zwLWkiDrFHB9TJ18wu8Hn4XQvONJFxAHg0G94KQ90qG0iCQqzoXoqYTm5fbEDiy1WcO/+wkM/6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TjZ1kNn5QabcK8oPIrI9iZtZD8khhk/a53JAZfnKrys=; b=Uj9FscZbwGqMfda21azBqRuPV7Sfm9D1kwYRDsM237POhi3mQbffYmBF+kY+qgVVxHKxR3+9xeDtWIjPSMEz0XAow4WrdoPdA4JNHjdFskfonPJg/jmsZ8NQJQ1eUDjtSyOrEThJ2WAruz7VzAAQRCm8hAKyM+ZCpoXb9JCNiaRDGnuyrXWtYuTGgfhzYR60iF4/26qqA8+8OB8qJ5rkoHg1ZFsvpUB4aAZ57MWkf9eVgIhAGanSGphIpIeqAzkG1ob3gABw5LYOjQIxmm3QBPGe/PIMJIZEakN9Hf0B5EU6eDQBK91AWUMMzDcoo3w4tJpBLksysfDt2A0hevmbTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TjZ1kNn5QabcK8oPIrI9iZtZD8khhk/a53JAZfnKrys=; b=b8H5iKh9e8GbQnqPDeEKI7/yNapn/ZWUFw3fGIl3CbFu9lWHzx98+vWT96x9PVkI0haa4QJdrFQpWzO+/yaKGV32FlAm+/Vj66TvWjhun2ambwOqpaMIBz3ihTRN5jr7CHzOULZLg8YfSNR2VKXFN4ZdVaNyaSvwtVjNhwrUkRs= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.52.24) by VI1PR04MB4175.eurprd04.prod.outlook.com (52.133.12.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.17; Tue, 3 Dec 2019 12:54:41 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28%5]) with mapi id 15.20.2495.014; Tue, 3 Dec 2019 12:54:41 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" CC: "shawnguo@kernel.org" , "kernel@pengutronix.de" , dl-linux-imx , BOUGH CHEN , "linus.walleij@linaro.org" , "linux-mmc@vger.kernel.org" Subject: [PATCH v2 09/14] doc: dt: fsl-imx-esdhc: add auto-cmd23-broken binding Thread-Topic: [PATCH v2 09/14] doc: dt: fsl-imx-esdhc: add auto-cmd23-broken binding Thread-Index: AQHVqdjTjLRtJqjPkketBWV+YO8JRw== Date: Tue, 3 Dec 2019 12:54:41 +0000 Message-ID: <20191203130120.11511-10-haibo.chen@nxp.com> References: <20191203130120.11511-1-haibo.chen@nxp.com> In-Reply-To: <20191203130120.11511-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: HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:60::24) 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-ht: Tenant x-ms-office365-filtering-correlation-id: bf9fd215-2834-4a11-5b25-08d777eff64d x-ms-traffictypediagnostic: VI1PR04MB4175:|VI1PR04MB4175: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-forefront-prvs: 02408926C4 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(366004)(396003)(136003)(39860400002)(376002)(43544003)(189003)(199004)(316002)(54906003)(446003)(2616005)(26005)(110136005)(2906002)(11346002)(50226002)(8936002)(186003)(2501003)(102836004)(99286004)(386003)(305945005)(86362001)(76176011)(52116002)(6506007)(7736002)(6486002)(6436002)(6512007)(1076003)(5660300002)(66946007)(66556008)(66476007)(64756008)(66446008)(14454004)(36756003)(25786009)(478600001)(256004)(71190400001)(8676002)(81156014)(81166006)(71200400001)(6116002)(3846002)(4326008);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4175;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: BCL:0; x-microsoft-antispam-message-info: At9R9nczpeUMq/qjCnR/5+G4SAydp1euP2zRKmPArl9IqaNnvWh4IVnqQGgbwv1vu9x9051LJqX84XIvZSKFotROprBG50974K4YBPNCykK2zy37aW3MV+fr8LP35sH34Sc/1qOqVVNriy7a2W2KaH/fRACYEi/hO0fHmsRpdJEla4z2mzzqQQotVTlDlgj65DAttzdtTLu/J6IB+hHbqXXpyLuAYx5Dc5VgCj4h9mCD5VzvY9RJCdgRsv65qOKuQAzexlmF4OcpIjakEvhF8zAVcOFobeC2fPd0wFMl1lOONBkzvCtbedkHOUlZTElMAy9iY4zbNFWfoz9A9MXo7PLJXkuWBkE/FM9iDXasPHo9quhn69Op2rZaoRxBrceFQBbd99ZgtU6XUGpnCDmDSO+4qK+j89XxV3aB8O9CK9++k2APyyNevrK9WVi38EpmBEShJH8YnOc9Widxeem9SUJNiSaDarbCG2ZrDuUUG7OROZothXJ+CiWHxoRWpWvQ MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf9fd215-2834-4a11-5b25-08d777eff64d X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2019 12:54:41.1407 (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-CrossTenant-userprincipalname: QBLZXpe/YRbYsj0ZlVBtMSUspu9Xxi1BE7l/e7FSPBc8O/lL1Um6yXeDeSrzTerzb6YTM9AM3cfhciuH4qqACg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4175 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Add sdhci,auto-cmd23-broken binding. Signed-off-by: Haibo Chen --- Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt index 89b986a2f9d5..7ea8e0f14e5f 100644 --- a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt +++ b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt @@ -46,6 +46,14 @@ Optional properties: property allows user to change the delay target for the strobe input read clock. If not use this property, driver default set the delay target to value 7. Only eMMC HS400 mode need to take care of this property. +- sdhci,auto-cmd23-broken: disable the ACMD23 function of USDHC. + This is required for eMMC on imx6qpdl/imx6sx/imx7d when it use ADMA mode. Because + for these SoC, it do not support the ACMD23 completely, only take the 16 bit block + count from the 0x4 register (BLK_ATT) as argument for the ACMD23, the upper 16 bit + of the CMD23's argument is ignored. This will impact the reliable write operation + and the RPMB block write operation, because these operations need to set the bit 31 + of the CMD23's argument. SDMA mode will default disable the ACMD23 mode. SD card do + not has this limitation on these SoCs. Examples: From patchwork Tue Dec 3 12:54:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 11271229 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2F95109A for ; Tue, 3 Dec 2019 12:55:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 87F6F2070A for ; Tue, 3 Dec 2019 12:55:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="WI+rVJcN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726115AbfLCMzR (ORCPT ); Tue, 3 Dec 2019 07:55:17 -0500 Received: from mail-eopbgr30077.outbound.protection.outlook.com ([40.107.3.77]:33645 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726105AbfLCMzR (ORCPT ); Tue, 3 Dec 2019 07:55:17 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cb4SkYl4Yy5IultsZhvfKNtXs8Sdcj0QNCsFVUlxQfVvJl/96DHhOLkHMp+P4Yx6dk5/P5rr1829kvOsPxDDbAK8tjUj9ACa6hNL0EAYxCV9hYgbZZRrA1AbSkrbLhJxP9ewuDYXhYor+Vt9ANsj956s3/IcmEujY/FdiFiDY+CUbwcFVByx+bvgNuWysEkyz4IYV5RaGOwayyA1E1OPfR+oHJbntC96RE8eq6ZuEInvszQhWI7untL+nfzxrac0JSLMQyfO/BDmAmFaYzgHCSsdfIxlFKAyudz4r2oNLAfjAH48FM3FGYFAU337bIVxIHdBlJe870wNTPzrY2Rjmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=l8qm0zf1Nh6iwRQ7SQ5NMAEOoCFLgUAb2Aafb82K9N0=; b=HowAhLIf29j+K1csYQIa5w7mhGNTIfiphkcxtaEkgFfgVyqU40sW2zDk22qCm8Vgl984XyXWTorFaXT9wUXLU26n8cboLEgvKln/AGlfZNxQbEKUf25iCi+3h27PrF4flIDz5zTCUvtB0KjNRRZ5NyJ4aT/NIduwlczQ757X0aCyfLD8Lj+diZuBnHpuVZd8cIP+VGpW8dZ6TFvoGNIkaX7JgHrV5oopUQweNsAoN5ddp9ifyHuOtmT3swP1t5WzU/2kE7ScLzaZ/LimhM9QwZRU4UUH5x6XodKugVo1PEgF4VCRLAZMRfLBMgyFUfQ4HhlpP/VkzeFsddK5KbwVgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=l8qm0zf1Nh6iwRQ7SQ5NMAEOoCFLgUAb2Aafb82K9N0=; b=WI+rVJcNU+ZVyo0hP7C8ES51p7j/l5MT9WSY88QJkkiHARuoUxyaVY68x76LVd1chOXzmb13PuOmTIn2tU9xFUcapbbi96wmsKIH9MWTCl/jITP/0omGZPO26q7jFDtVNUtYCk0odetDFHl6cHphvmEHk19fWuGE50buFXJDt3U= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.52.24) by VI1PR04MB4175.eurprd04.prod.outlook.com (52.133.12.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.17; Tue, 3 Dec 2019 12:54:44 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28%5]) with mapi id 15.20.2495.014; Tue, 3 Dec 2019 12:54:44 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" CC: "shawnguo@kernel.org" , "kernel@pengutronix.de" , dl-linux-imx , BOUGH CHEN , "linus.walleij@linaro.org" , "linux-mmc@vger.kernel.org" Subject: [PATCH v2 10/14] mmc: sdhci-esdhc-imx: handle 'sdhci,auto-cmd23-broken' from devicetree Thread-Topic: [PATCH v2 10/14] mmc: sdhci-esdhc-imx: handle 'sdhci,auto-cmd23-broken' from devicetree Thread-Index: AQHVqdjVnj+SfUHe60GBHKj3bIIkxQ== Date: Tue, 3 Dec 2019 12:54:44 +0000 Message-ID: <20191203130120.11511-11-haibo.chen@nxp.com> References: <20191203130120.11511-1-haibo.chen@nxp.com> In-Reply-To: <20191203130120.11511-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: HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:60::24) 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-ht: Tenant x-ms-office365-filtering-correlation-id: 1dbf8318-cae9-467a-7d99-08d777eff81c x-ms-traffictypediagnostic: VI1PR04MB4175:|VI1PR04MB4175: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1265; x-forefront-prvs: 02408926C4 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(366004)(396003)(136003)(39860400002)(376002)(189003)(199004)(316002)(54906003)(446003)(2616005)(26005)(110136005)(2906002)(11346002)(50226002)(8936002)(186003)(2501003)(102836004)(99286004)(386003)(305945005)(86362001)(76176011)(52116002)(6506007)(7736002)(6486002)(6436002)(6512007)(1076003)(5660300002)(66946007)(66556008)(66476007)(64756008)(66446008)(14454004)(36756003)(25786009)(478600001)(256004)(71190400001)(8676002)(81156014)(81166006)(14444005)(71200400001)(6116002)(3846002)(4326008)(142933001);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4175;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: BCL:0; x-microsoft-antispam-message-info: 2ht6oSBEEVdqKaIxT9Wlz5V/eVg2Jg7J8GiDSkTEoNQ3D4h9ATtqHHhV0RmHtih1Ujv3DVzVcvtXM7eXdVeIpj6wxLOWN8GcEkXolT043dc1B+IdmrM+5um7YlMPJAagJ9tjFtKM76q+JgTbe/3aKFOpsiYEu141XWjmiOFX7wjFJPHfzdSbgB2PuNqPTMak9QKIMIJwl42GP8BqQQpO9wlIstNX7YOSBewvjbcwOWpTs8wlmOeSeuE+HyISS6jy8ZrPU44DlbeVhuCUMHGe0U2D2ppo6MHobs5BkwzFfoEBfLYXgKrA5qyTgu6Rfq4psBmqLP8gJopNZZ+pJ2bk5EpFEF5yH8mdVIHEux+1OsUWTkcORyP6pIg58pXjQpKujLhJqedvdyl6ZgBMagYDZ9zPwK8KiYxe2mE6cuIT95CMcEDqYFil6yR67NG66drWGqbbI3TbrovrgtKCZSiQ/y6qoKZGedsdX8wZOnhccXrefEuU9/WJuo0yQDU/eV4a MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1dbf8318-cae9-467a-7d99-08d777eff81c X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2019 12:54:44.1659 (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-CrossTenant-userprincipalname: 26qOxbIyLar7bYvlcKVa1kFHln8KVdb9HR/WsXGd79AXzLFjd9iLu3o5pxkMrYxaeQ9ckANezv6w3VjOyyilPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4175 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Since L4.15, community involve the commit 105819c8a545 ("mmc: core: use mrq->sbc when sending CMD23 for RPMB"), let the usdhc to decide whether to use ACMD23 for RPMB. This CMD23 for RPMB need to set the bit 31 to its argument, if not, the RPMB write operation will return general fail. According to the sdhci logic, SDMA mode will disable the ACMD23, and only in ADMA mode, it will chose to use ACMD23 if the host support. But according to debug, and confirm with IC, the imx6qpdl/imx6sx/imx6sl/imx7d do not support the ACMD23 feature completely. These SoCs only use the 16 bit block count of the register 0x4 (BLOCK_ATT) as the CMD23's argument in ACMD23 mode, which means it will ignore the upper 16 bit of the CMD23's argument. This will block the reliable write operation in RPMB, because RPMB reliable write need to set the bit31 of the CMD23's argument. This is the hardware limitation. Due to imx6sl use SDMA, so for imx6qpdl/imx6sx/imx7d, it need to broke the ACMD23 for eMMC, SD card do not has this limitation, because SD card do not support reliable write. For imx6ul/imx6ull/imx6sll/imx7ulp/imx8, it support the ACMD23 completely, it change to use the 0x0 register (DS_ADDR) to put the CMD23's argument in ADMA mode. This patch handle 'sdhci,auto-cmd23-broken' from devicetree. Signed-off-by: Haibo Chen --- drivers/mmc/host/sdhci-esdhc-imx.c | 5 +++-- drivers/mmc/host/sdhci-pltfm.c | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 54ffb04ab1d1..0a8a7b748341 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1371,8 +1371,6 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, of_property_read_u32(np, "fsl,strobe-dll-delay-target", &boarddata->strobe_dll_delay_target); - if (of_find_property(np, "no-1-8-v", NULL)) - host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V; if (of_property_read_u32(np, "fsl,delay-line", &boarddata->delay_line)) boarddata->delay_line = 0; @@ -1386,6 +1384,9 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, ESDHC_PINCTRL_STATE_200MHZ); } + /* call to generic sdhci_get_property to support additional capabilities */ + sdhci_get_property(pdev); + /* call to generic mmc_of_parse to support additional capabilities */ ret = mmc_of_parse(host->mmc); if (ret) diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c index 328b132bbe57..862d2bb9c2a8 100644 --- a/drivers/mmc/host/sdhci-pltfm.c +++ b/drivers/mmc/host/sdhci-pltfm.c @@ -86,6 +86,9 @@ void sdhci_get_property(struct platform_device *pdev) if (device_property_present(dev, "sdhci,auto-cmd12")) host->quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12; + if (device_property_present(dev, "sdhci,auto-cmd23-broken")) + host->quirks2 |= SDHCI_QUIRK2_ACMD23_BROKEN; + if (device_property_present(dev, "sdhci,1-bit-only") || (device_property_read_u32(dev, "bus-width", &bus_width) == 0 && bus_width == 1)) From patchwork Tue Dec 3 12:54:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 11271231 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 667AA14B7 for ; Tue, 3 Dec 2019 12:55:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3B61D2070A for ; Tue, 3 Dec 2019 12:55:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="p1WfXwmo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726131AbfLCMzS (ORCPT ); Tue, 3 Dec 2019 07:55:18 -0500 Received: from mail-eopbgr30049.outbound.protection.outlook.com ([40.107.3.49]:58425 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726079AbfLCMzS (ORCPT ); Tue, 3 Dec 2019 07:55:18 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dzCAWMGqNnJGUdJqHRdbNnIf2owK2Cd1W4XyaFW61pi7DGocIz37U6GHwkcatPiq7vmmK2S29nmG+gbZCqZl6/EBcPcIzTK42QCqDmGGjlVOMWuFn4+3akIJ0nS9gJ3XcDpe6GUfko506MSip/nj/awrFWU7/dTf4bxxmGAP2hp44MSYemT8eLTj7sau7VTu82mMP/pkCBnA+YOewBS5S5+ka7XMTzvF2Eb87MVSw+0CRViKrTcIXbmw9iH+fFZb9W8LLEVMUeGtdiLUBpwvYvTgbbiOcn7fulTrE/UGwjgFLczfGi49NikCiqflayNOPJ/scFctCtFAPFvN26FReA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N82up276ZK8YNqdMt0ykXPjoixauJLUsOpdGb8NU5jY=; b=b9+QR0Q0w8aaxuvISeGDKKYwFUZqqEtN8rOZ+XIvveHOhLaTtaUEdrB6C4Q834oaoHSe+/dULT9rWuWN8OrPbR+Uo2LiB9s4kiA2zQ9bQSsooGXJK0kDro7+GrAbPt6+M9w5UkZqw9pqd784WekFEo+wzYy8JtI8lKY+M0GmATFDY/JYmbD7bhfIKLJs0Iwe0agHdizzAp1z/6jNvze+MbjVM0rRcd6tO4V85DWpMcDXfo1S0ZRmXr7xWe5oADgg7q5VJVrbv9fAFf24at8dLsHd8E6hLori3kBjOdBVLnDNLVhucOKBgLVZWvvevpcc7mje1w8yytNMHQLPE1vJnw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N82up276ZK8YNqdMt0ykXPjoixauJLUsOpdGb8NU5jY=; b=p1WfXwmonQu7gOBDqBAzKiaLHlKFkZ7vBTJlX+4+NLA7XWlbiY1Ud/tRrSyfyZT4fwyhgzaHYE9f48WEf9zP75hcPx8mnehB+i9JF8PQKKCw/BxxDM/TXwxe1vN+Pg81mri2W8/sHWmi1n+FbpdnMtM3Oi4E+bAUNBDM+C3CeWY= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.52.24) by VI1PR04MB4175.eurprd04.prod.outlook.com (52.133.12.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.17; Tue, 3 Dec 2019 12:54:47 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28%5]) with mapi id 15.20.2495.014; Tue, 3 Dec 2019 12:54:47 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" CC: "shawnguo@kernel.org" , "kernel@pengutronix.de" , dl-linux-imx , BOUGH CHEN , "linus.walleij@linaro.org" , "linux-mmc@vger.kernel.org" Subject: [PATCH v2 11/14] mmc: sdhci-esdhc-imx: clear pending interrupt and halt cqhci Thread-Topic: [PATCH v2 11/14] mmc: sdhci-esdhc-imx: clear pending interrupt and halt cqhci Thread-Index: AQHVqdjXFB/pAp1YnUOX5Myp+8nFGg== Date: Tue, 3 Dec 2019 12:54:47 +0000 Message-ID: <20191203130120.11511-12-haibo.chen@nxp.com> References: <20191203130120.11511-1-haibo.chen@nxp.com> In-Reply-To: <20191203130120.11511-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: HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:60::24) 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-ht: Tenant x-ms-office365-filtering-correlation-id: 017d689d-187d-4515-691d-08d777eff9d8 x-ms-traffictypediagnostic: VI1PR04MB4175:|VI1PR04MB4175: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1148; x-forefront-prvs: 02408926C4 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(366004)(396003)(136003)(39860400002)(376002)(189003)(199004)(316002)(54906003)(446003)(2616005)(26005)(110136005)(2906002)(11346002)(50226002)(8936002)(186003)(2501003)(102836004)(99286004)(386003)(305945005)(86362001)(76176011)(52116002)(6506007)(7736002)(6486002)(6436002)(6512007)(1076003)(5660300002)(66946007)(66556008)(66476007)(64756008)(66446008)(14454004)(36756003)(25786009)(478600001)(256004)(71190400001)(8676002)(81156014)(81166006)(14444005)(71200400001)(6116002)(3846002)(4326008);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4175;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: BCL:0; x-microsoft-antispam-message-info: ISSX3ZlWqclOTBEH+zSl/Ztu1EkDh4YTjMshrq7MPRbh5gVepBPOKUXQTJUXolxmvkJMmEchPKkmepphchktg4/MHvsZabp4fq96gx9lxxL5WsV+RD/pyO2oUs3zo/heykrlcVf4k0I95zek9HmnXw3HXL67Z9Io1NNDQJSAjvcx03dV+hxy64lpoX9Qh884vR5VN/Haz+WOay26zkzXj7cuW2O9fMHpA9CFfHb/4UqMIwbpVq8AcectuYY2a80LHlU7s1818j6uJ859TG/Btwwfv/aBUnhVkdfNNHrvPGRu4uNL95/G2YIADdNvIoqn2+XaMivg2xeq956Itn09qi1ROHWZ0XUqvH3SPgOGuu3ieJXqJcCeCFy+mawQBKvvOI+PhMWA66tWgBYq1KCRI7JBC9DuLgKGifbC40KWS3DPV3oKyf/enranMhiZMjHF MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 017d689d-187d-4515-691d-08d777eff9d8 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2019 12:54:47.0632 (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-CrossTenant-userprincipalname: Ms1u7wgbKxSzwAeNhQjvNFxUCfsSAel6fyPZOOJRLtZOJBHFhaOJnyH6vS7d6qlgxffpakpOb4kwdv0ZeBXsNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4175 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org 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 2nd 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.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: Haibo Chen --- drivers/mmc/host/sdhci-esdhc-imx.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 0a8a7b748341..ae1538e30b23 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1203,6 +1203,7 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host) { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host); + struct cqhci_host *cq_host = host->mmc->cqe_private; int tmp; if (esdhc_is_usdhc(imx_data)) { @@ -1279,6 +1280,21 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host) tmp &= ~ESDHC_STD_TUNING_EN; writel(tmp, host->ioaddr + ESDHC_TUNING_CTRL); } + + /* + * 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 2nd linux, we met SDHCI dump. + * After we clear the pending interrupt and halt CQCTL, issue gone. + */ + if (cq_host) { + tmp = cqhci_readl(cq_host, CQHCI_IS); + cqhci_writel(cq_host, tmp, CQHCI_IS); + cqhci_writel(cq_host, CQHCI_HALT, CQHCI_CTL); + } } } From patchwork Tue Dec 3 12:54:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 11271233 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B63C313A4 for ; Tue, 3 Dec 2019 12:55:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 957B82073B for ; Tue, 3 Dec 2019 12:55:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Tss9S4+4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726139AbfLCMzT (ORCPT ); Tue, 3 Dec 2019 07:55:19 -0500 Received: from mail-eopbgr30077.outbound.protection.outlook.com ([40.107.3.77]:33645 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725957AbfLCMzS (ORCPT ); Tue, 3 Dec 2019 07:55:18 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RD2eJth74UH5UVME3af8S+W/b8gQq7p68TjDOlaWtdKNQ+D7/qw/ifP1+Df23H3oNu589JCLHScGisHR/yRAobRFTOGP4qQBg8kuJXEt1PraBiewrC6aK3ePt0PBF7Z3Pa9ffAoF00m2v+/HxsOeg5ztFRWMz2RMoRcnJCIqcxFvqZaPRLyrpC7eonAlRcyAfO02ZyIBJ87UGyRdIkPqSR//YlL2BRTFi6qVF0Vw8riG8Ce+aRqKuuaAoVlzJahhI8lRjThAwHnyAJ5zTykw/dnW4zaQeIqdBtfzGOUeIFBkgR9pVdwn3Iyn7Jhi0FoTo+Gu3CtBkf+gfCm9bTY3zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BUBhQCZUV11vMiR0FTWaIzsH4A1Ak7odoS0BMkAPyus=; b=GVBRdtdYUOYJQdQZPXR2wxMFK/Rlvssz5MtQlYB7qCQevIViBdPPtJpHEPd18ZfWpBJcnyXmELqhUF2YNeq98hGeq/FBd7dOTXqFiHmk0wtDhZKkuxbyaCFmGfwXEs6u9e0M8RAFaGko97zrsypGOC1eYkWs8DDCsMQYvY57ss3n/DuCPp0YzAi77bo33HMfgkX75MnFhT/vJMfi308IXHbX/GqDFeU54ItnZqjtFCpvX2A3kJUVfjx8I8fYOj5ou+n64eOowt8K+qx9ebsNMtxLbtq7Axg8dMlEtEzoxsqcuMlSSv66FaaaSdzgl3nEBrphlwDXB3imKX3fd0UJnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BUBhQCZUV11vMiR0FTWaIzsH4A1Ak7odoS0BMkAPyus=; b=Tss9S4+47UuFSiuxQSrB/E+A8M/thVf2Fx6aVY92iy/1Uy0sMIpm4zH95hOgFEMHsuSBoYiweeEdR1fivGwQQaUI1gQSYygaKHkAVKEruZoUIUCKBMEQmrPsbama0TVAOP9ToUp7seLChJy2EhER4KeLIQqYR+J47uOlU1xssds= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.52.24) by VI1PR04MB4175.eurprd04.prod.outlook.com (52.133.12.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.17; Tue, 3 Dec 2019 12:54:50 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28%5]) with mapi id 15.20.2495.014; Tue, 3 Dec 2019 12:54:50 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" CC: "shawnguo@kernel.org" , "kernel@pengutronix.de" , dl-linux-imx , BOUGH CHEN , "linus.walleij@linaro.org" , "linux-mmc@vger.kernel.org" Subject: [PATCH v2 12/14] mmc: sdhci-esdhc-imx: restore pin state when resume back Thread-Topic: [PATCH v2 12/14] mmc: sdhci-esdhc-imx: restore pin state when resume back Thread-Index: AQHVqdjZKKRni58SCkegs5GMcEUwwA== Date: Tue, 3 Dec 2019 12:54:50 +0000 Message-ID: <20191203130120.11511-13-haibo.chen@nxp.com> References: <20191203130120.11511-1-haibo.chen@nxp.com> In-Reply-To: <20191203130120.11511-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: HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:60::24) 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-ht: Tenant x-ms-office365-filtering-correlation-id: f2c134bd-6e91-476c-8035-08d777effb92 x-ms-traffictypediagnostic: VI1PR04MB4175:|VI1PR04MB4175: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:608; x-forefront-prvs: 02408926C4 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(366004)(396003)(136003)(39860400002)(376002)(189003)(199004)(316002)(54906003)(446003)(2616005)(26005)(110136005)(2906002)(11346002)(50226002)(8936002)(186003)(2501003)(102836004)(99286004)(386003)(305945005)(86362001)(76176011)(52116002)(6506007)(7736002)(6486002)(6436002)(6512007)(1076003)(5660300002)(66946007)(66556008)(66476007)(64756008)(66446008)(14454004)(36756003)(25786009)(478600001)(256004)(71190400001)(8676002)(81156014)(81166006)(14444005)(71200400001)(6116002)(3846002)(4326008);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4175;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: BCL:0; x-microsoft-antispam-message-info: ThlyK2fpdxzzqO4D0Zc06WCm0o3ACDT2YrKuG9+S/FVg1HLBujId0qdnn4YH/gFr3eh0MIlFP9zAWSsKXSoXXiJ0vfhrXqWV7KILEHNUA5MG9kTILiZysln8OUJL2AYt9SEYCObCIVFVryQYY8UlSpfX03qADVqZVEheSb4zX51i9BIbizeSN+WxKZNh1Oc3G/M5RTXPKD6j2mgd0+GpTj/X9B/0C6Yk5AaRpdN4V63oQnS+G7Eqdf2x/v2eeuEPaG5Y4Ql2Vx3Pf8VMgEudvFrFYIKUNtf6lZeCL52cbIkcfdbEQO6K4b0Lx9HDSgsMJbEdDkGxEeewZmj3cCblbpZsYj/shdT5PEW0Ku4Y+cFt+M25ymJtKp2cwNIbsGnmvQsyoAGbrjRm/R55DqhfArJf0bg2LhVBl1xffemBwwxbG5RG3ZfT9CDWMxFQ/dSA MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2c134bd-6e91-476c-8035-08d777effb92 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2019 12:54:50.1433 (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-CrossTenant-userprincipalname: TvMS+aiexjDYUKlFeE2LGj/FEvBbz8zHDTH6g4MiUaB2DstjtTpbucUTDkUsXx84jJRxXgvj4cZ52rR2gn6bRw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4175 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org In some low power mode, SoC will lose the pin state, so need to restore the pin state when resume back. Signed-off-by: Haibo Chen --- drivers/mmc/host/sdhci-esdhc-imx.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index ae1538e30b23..246b4eb52378 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1690,7 +1690,13 @@ static int sdhci_esdhc_suspend(struct device *dev) if (host->tuning_mode != SDHCI_TUNING_MODE_3) mmc_retune_needed(host->mmc); - return sdhci_suspend_host(host); + ret = sdhci_suspend_host(host); + if (!ret) + if (pinctrl_pm_select_sleep_state(dev)) + dev_warn(mmc_dev(host->mmc), + "%s, failed to select sleep pin state!\n", __func__); + + return ret; } static int sdhci_esdhc_resume(struct device *dev) @@ -1698,6 +1704,10 @@ static int sdhci_esdhc_resume(struct device *dev) struct sdhci_host *host = dev_get_drvdata(dev); int ret; + if (pinctrl_pm_select_default_state(dev)) + dev_warn(mmc_dev(host->mmc), + "%s, failed to select default pin state!\n", __func__); + /* re-initialize hw state in case it's lost in low power mode */ sdhci_esdhc_imx_hwinit(host); From patchwork Tue Dec 3 12:54:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 11271235 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9CF431805 for ; Tue, 3 Dec 2019 12:55:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 729132073B for ; Tue, 3 Dec 2019 12:55:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="RmC1+IM7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725957AbfLCMzV (ORCPT ); Tue, 3 Dec 2019 07:55:21 -0500 Received: from mail-eopbgr30049.outbound.protection.outlook.com ([40.107.3.49]:58425 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726105AbfLCMzU (ORCPT ); Tue, 3 Dec 2019 07:55:20 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TdP7fPdHuVlHE6bTaOVlAuCZ4iFOZ829skIaG5iximOLsfvwhK+vCPFUja3szZx728MLb8Jn4WoOqtH4dLFBllMMYzjdfbkJGn0Oo0OUt7MPFeRCfuNPAjD2etNuUQIFEMOElKToGLun5JtghFWV6X+tbdrZlsoFKkyebbIo6P86/1KSF1QF4dVhsGro6WhmDpwa0bpJqlaEh4a4kswPSymg4oKxe9g1t+shuxec9tY1VTUFVQ5/Hh8KuBksiPkYLsz42+/XRLHZKgnO9a+x9G7hsED06EMTnilaUAEfpJPSIdN4APl6hpm1z7FA/v/tYZS5eQabQ0FhlJN+g4yPgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k82kN0y6ZHBb6o4PXWXzEuWd4nUkhzZBLjzOYObjRsw=; b=EQHaLNDkwvqp2xdot7oO83I3VFSnjeSU20FnAFsypfRgKe+5yhH1vpcinx5l+mysfGWXsDaR06F98dssnK6BDXgQjLrWY8j5lORYWE1CgAWt+OGdu6Wz7f46752VLuVXXZOYFNSZWWu2r4ZuJiwxxVYFDF8q3swPipfMar9IGTD6A5W9aBABhvT62OEoPq8MhgoaEPh1+7TjB3Ac3GP8E6OtHVcVRrFB/iDX5uaqEJN+jDiwcP79OHlPdxwIHm5EjZcqJ4tJzx6NXLPzGaE1fRz+Y3r6SR7zlfL6XgXQTsh9qkkfcJecl0uKqoxEGEyo4gy58mqdyrNX9NFvwlejHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k82kN0y6ZHBb6o4PXWXzEuWd4nUkhzZBLjzOYObjRsw=; b=RmC1+IM7c0GOa4tC2RjDdMsDGOP+b+/LjWhU0dYI4x/4z9usd1gIfGFypP/KQUVPJL7epvc/Nr3PR9YvDuyfNqf7BEsZKUdwOW6wYT4Evdwq5/j3RLmpJFeCcNsUbn2R+IzEmwtjvL2ASMUQso+SOxnjhn2bIY9SU0efxV8j4aw= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.52.24) by VI1PR04MB4175.eurprd04.prod.outlook.com (52.133.12.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.17; Tue, 3 Dec 2019 12:54:53 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28%5]) with mapi id 15.20.2495.014; Tue, 3 Dec 2019 12:54:53 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" CC: "shawnguo@kernel.org" , "kernel@pengutronix.de" , dl-linux-imx , BOUGH CHEN , "linus.walleij@linaro.org" , "linux-mmc@vger.kernel.org" Subject: [PATCH v2 13/14] mmc: sdhci-esdhc-imx: clear DMA_SEL when disable DMA mode Thread-Topic: [PATCH v2 13/14] mmc: sdhci-esdhc-imx: clear DMA_SEL when disable DMA mode Thread-Index: AQHVqdjb8ZrDWWh03E+wXR7jWnQ33g== Date: Tue, 3 Dec 2019 12:54:53 +0000 Message-ID: <20191203130120.11511-14-haibo.chen@nxp.com> References: <20191203130120.11511-1-haibo.chen@nxp.com> In-Reply-To: <20191203130120.11511-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: HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:60::24) 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-ht: Tenant x-ms-office365-filtering-correlation-id: 68a14f48-71bc-4704-69c3-08d777effd69 x-ms-traffictypediagnostic: VI1PR04MB4175:|VI1PR04MB4175: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 02408926C4 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(366004)(396003)(136003)(39860400002)(376002)(189003)(199004)(316002)(54906003)(446003)(2616005)(26005)(110136005)(2906002)(11346002)(50226002)(8936002)(186003)(2501003)(102836004)(99286004)(386003)(305945005)(86362001)(76176011)(52116002)(6506007)(7736002)(6486002)(6436002)(6512007)(1076003)(5660300002)(66946007)(66556008)(66476007)(64756008)(66446008)(14454004)(36756003)(25786009)(478600001)(256004)(71190400001)(8676002)(81156014)(81166006)(14444005)(71200400001)(6116002)(3846002)(4326008);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4175;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: BCL:0; x-microsoft-antispam-message-info: 47C5Bl0lZ2ZnO23c7RRi+BJW6RJRcV6wnp477U5yUvqrjn+ZjDlk7LJpCZfg5CAwTlOpf5hcQHnAeqv0B3n8yfwFG3QdhnRin8APDnrKez3x3lquvjys9o3aOW6zUIZ092qWQLAW9GkAjl7wfNpOTHKSOIGAFyR0LasPUVw4JA6pD4ksGvMqKKL7h8Ueiiu7XD4wJkbNdGZiV/9oocE7Dd+leRA7pYaWthS1FJm4n/Tll9dL4sB1zGoIZ9+4v53wl+Rt+MS1muPTZmsThvF58RBKDGZ3fQ66K9HR33F/yl29WfJxsQznqLNNJKgUqE+qTUBsIii3nrUM5u3+ssSfnetrFDgENpNfABPh1ng59P+e9q7vbHX7BS9pYy1StdxKANA+RYQTTVUAUNQYdtr2Ewmzu+FgkRx1VvAWPdd+IaRvr0hHf1r+D4RXtQoW1LBE MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 68a14f48-71bc-4704-69c3-08d777effd69 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2019 12:54:53.0636 (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-CrossTenant-userprincipalname: Yc/QzqHlmai9upRjr02nsjWXm+E13mA16UVOVzLIgvxelftTqbe99gijbgjL22mFY9UpLJX9w00heh44FJO62A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4175 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Currently, when use standard tuning, driver default disable DMA just before send tuning command. But on i.MX8 usdhc, this is not enough. Need also clear DMA_SEL. If not, once the DMA_SEL select AMDA2 before, even dma already disabled, when send tuning command, usdhc will still prefetch the ADMA script from wrong DMA address, then we will see IOMMU report some error which show lack of TLB mapping. Signed-off-by: Haibo Chen --- drivers/mmc/host/sdhci-esdhc-imx.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 246b4eb52378..7430708f72e1 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -608,10 +608,24 @@ static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg) * For DMA access restore the levels to default value. */ m = readl(host->ioaddr + ESDHC_WTMK_LVL); - if (val & SDHCI_TRNS_DMA) + if (val & SDHCI_TRNS_DMA) { wml = ESDHC_WTMK_LVL_WML_VAL_DEF; - else + } else { + u8 ctrl; wml = ESDHC_WTMK_LVL_WML_VAL_MAX; + + /* + * Since already disable DMA mode, so also need + * to clear the DMASEL. Otherwise, for standard + * tuning, when send tuning command, usdhc will + * still prefetch the ADMA script from wrong + * DMA address, then we will see IOMMU report + * some error which show lack of TLB mapping. + */ + ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL); + ctrl &= ~SDHCI_CTRL_DMA_MASK; + sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL); + } m &= ~(ESDHC_WTMK_LVL_RD_WML_MASK | ESDHC_WTMK_LVL_WR_WML_MASK); m |= (wml << ESDHC_WTMK_LVL_RD_WML_SHIFT) | From patchwork Tue Dec 3 12:54:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 11271237 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F02F5186E for ; Tue, 3 Dec 2019 12:55:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CEF492070A for ; Tue, 3 Dec 2019 12:55:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Set/UuLH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725954AbfLCMzd (ORCPT ); Tue, 3 Dec 2019 07:55:33 -0500 Received: from mail-eopbgr30077.outbound.protection.outlook.com ([40.107.3.77]:33645 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726079AbfLCMzd (ORCPT ); Tue, 3 Dec 2019 07:55:33 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MV/WzrYe5C/396jp1vNjJhno0fU+otf7nKk0UuKjJZizn5BV6hy2Nl8XqWY4tY3mMUqXTwHu3k8gyNtyrOOF9G+F2HCW51wpHmNuHNbRQyNzV6JsHweZHbA/NiJl+KckG5aXU6aqkhZ8FyEuhAN/32wiIS7aTRmWzuyrhJeHbdGomyAxhMJ4q7Gj7QRFp3+5rZNxQBQzDHE16Xh+87LgQO6V/Z+gZ3zcpMPLRv8gl2317ht9Tzec2H23jJ5ZwjuaJT3t+Hqw4y9kX+/QkDXZ5ePZ1XQzK5lefsTqtVca8Lb+wbSuPe5wxDOWe4mUjH7AMzl2pOMjjveCeVIGj4HlGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lr2zT+KpWb9xYimg56x7uy97fyAhfcf7MMI6RAqDEI0=; b=WyfouDKukUp6CSJhWn85+TjjjeVfjkxxpe0a2soaUXBfZhGr2gd5lWHWKBNw18s2i1gnq5hpl6Ldkdm7H61n7vnrEXXZdfZ+ecFt/4oLiG3aKNtl9vE1pCJYQmnX4bSPVzJAbpLnshnooXgRuRr8Vql6EB3DCxS93E3oEAi5CrjkR+KNOvNivpP6MpABXZXWaaCpYbJFNAwfhXCdRHyuSHrz17dQIV6D13Fh1liI95KcTWZ9EUFRF76SZM717Z1rJ2T9vrNsRJOoJcgqHO5NkUTsNRfXJPwv2gBirIXuI8pRb3oxh2qpZ6jPDhX06mueE7kmVFoxDZtHPJ22bX277g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lr2zT+KpWb9xYimg56x7uy97fyAhfcf7MMI6RAqDEI0=; b=Set/UuLHovPpGOAH6MG1QcOuGnVdHJPr4T6l6eCkM0L7yJOJmJbGUp+lYI+ppj7iB8/IZS3FvUQj34feQp1oYvJnv1M/C1JxuuO16Zfby3PieLprhjVL52/WXHWc0kuBsuMgm/kHYImf5uxdFqQwni1gED3fasrozKY1lUJzf70= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.52.24) by VI1PR04MB4175.eurprd04.prod.outlook.com (52.133.12.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2495.17; Tue, 3 Dec 2019 12:54:56 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::c5f3:ba8e:2b17:1f28%5]) with mapi id 15.20.2495.014; Tue, 3 Dec 2019 12:54:56 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" CC: "shawnguo@kernel.org" , "kernel@pengutronix.de" , dl-linux-imx , BOUGH CHEN , "linus.walleij@linaro.org" , "linux-mmc@vger.kernel.org" Subject: [PATCH v2 14/14] mmc: queue: create dev->dma_parms before call dma_set_max_seg_size() Thread-Topic: [PATCH v2 14/14] mmc: queue: create dev->dma_parms before call dma_set_max_seg_size() Thread-Index: AQHVqdjcI3fE0jojPE6E167EE2bQ2Q== Date: Tue, 3 Dec 2019 12:54:55 +0000 Message-ID: <20191203130120.11511-15-haibo.chen@nxp.com> References: <20191203130120.11511-1-haibo.chen@nxp.com> In-Reply-To: <20191203130120.11511-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: HK2PR03CA0052.apcprd03.prod.outlook.com (2603:1096:202:17::22) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:60::24) 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-ht: Tenant x-ms-office365-filtering-correlation-id: ca5a9ae6-7723-40d3-7c62-08d777efff25 x-ms-traffictypediagnostic: VI1PR04MB4175:|VI1PR04MB4175: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4125; x-forefront-prvs: 02408926C4 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(366004)(396003)(136003)(39860400002)(376002)(189003)(199004)(316002)(54906003)(446003)(2616005)(26005)(110136005)(2906002)(11346002)(50226002)(8936002)(186003)(2501003)(102836004)(99286004)(386003)(305945005)(86362001)(76176011)(52116002)(6506007)(7736002)(6486002)(6436002)(6512007)(1076003)(5660300002)(66946007)(66556008)(66476007)(64756008)(66446008)(14454004)(36756003)(25786009)(478600001)(256004)(71190400001)(8676002)(81156014)(81166006)(14444005)(71200400001)(6116002)(3846002)(4326008);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4175;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: BCL:0; x-microsoft-antispam-message-info: CrL7A+WqSnLFo1XqZh+8gLMlTmadPqP8iao5+pd7UinbXXC+n0G+EuJqgMt+cFAqdXVsDN7xiXL/5ps5mmAvlLYDlLjmXOcr3aU6mZLLuWk6396k1BH21gHxrc5JAnd499YW2DzlD3PDAo+icfvYQo8/c8Td5Eu6VzfrOEZT3ef0ypbx6+ppzMZ86tpGTrhhX04ueCMknrrgX4mkngWT51iVT1EH1vXaW8K51NwLhelBAHqqDY+tTZIWVi/ibiEHZhmFjInEsb9e4GspL+vft39vXMSGYYiXPJ2+2UvwDv9+RBNt/FCb6kOygmmUZGYlCRvdgDTEA1lh3GEo03+yKvzYYSztlM4Pu6s1q3WcKv8rpG+kj2SBVkscIQkPluMFaPCNCqclbwAS+lJXaGIl3tRp4UFS+PKqS3nrSuzvYk8hjY7eAR2TJ5FlbUPp2EXG MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca5a9ae6-7723-40d3-7c62-08d777efff25 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2019 12:54:56.0528 (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-CrossTenant-userprincipalname: 17Rbtwiomclfd5uzyv1x3MUQboaGPRvMVTWUttFnuIeZ7uvAu5bTY/iMsGEGrHo2oncNwMaQncLkY4Ml5fGGWA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4175 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org To make dma_set_max_seg_size() work, need to create dev->dma_parms. Find this issue on i.MX8QM mek board, this platform config the max_segment_size to 65535, but this dma_set_max_seg_size do not actuall work, find sometimes the segment size is 65536, exceed the hardware max segment limitation, trigger ADMA error. Signed-off-by: Haibo Chen --- drivers/mmc/core/queue.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c index 9edc08685e86..f74c28c58482 100644 --- a/drivers/mmc/core/queue.c +++ b/drivers/mmc/core/queue.c @@ -359,6 +359,7 @@ static const struct blk_mq_ops mmc_mq_ops = { static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card) { struct mmc_host *host = card->host; + struct device *dev = mmc_dev(host); unsigned block_size = 512; blk_queue_flag_set(QUEUE_FLAG_NONROT, mq->queue); @@ -366,13 +367,12 @@ static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card) if (mmc_can_erase(card)) mmc_queue_setup_discard(mq->queue, card); - if (!mmc_dev(host)->dma_mask || !*mmc_dev(host)->dma_mask) + if (!dev->dma_mask || !*dev->dma_mask) blk_queue_bounce_limit(mq->queue, BLK_BOUNCE_HIGH); blk_queue_max_hw_sectors(mq->queue, min(host->max_blk_count, host->max_req_size / 512)); if (host->can_dma_map_merge) - WARN(!blk_queue_can_use_dma_map_merging(mq->queue, - mmc_dev(host)), + WARN(!blk_queue_can_use_dma_map_merging(mq->queue, dev), "merging was advertised but not possible"); blk_queue_max_segments(mq->queue, mmc_get_max_segments(host)); @@ -389,7 +389,8 @@ static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card) blk_queue_max_segment_size(mq->queue, round_down(host->max_seg_size, block_size)); - dma_set_max_seg_size(mmc_dev(host), queue_max_segment_size(mq->queue)); + dev->dma_parms = devm_kzalloc(dev, sizeof(*dev->dma_parms), GFP_KERNEL); + dma_set_max_seg_size(dev, queue_max_segment_size(mq->queue)); INIT_WORK(&mq->recovery_work, mmc_mq_recovery_handler); INIT_WORK(&mq->complete_work, mmc_blk_mq_complete_work);