From patchwork Fri Dec 28 08:35:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 10744267 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1432E13B5 for ; Fri, 28 Dec 2018 08:35:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 071EF28A5A for ; Fri, 28 Dec 2018 08:35:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED1F128A61; Fri, 28 Dec 2018 08:35:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7ED4228A5A for ; Fri, 28 Dec 2018 08:35:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730708AbeL1Ifu (ORCPT ); Fri, 28 Dec 2018 03:35:50 -0500 Received: from mail-eopbgr150054.outbound.protection.outlook.com ([40.107.15.54]:10704 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730681AbeL1Ifu (ORCPT ); Fri, 28 Dec 2018 03:35:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=22ekbw66NdCv5grKehtl87n2+yMOZNME88TKpl4ODGw=; b=agIgts6hJ9J1nq9kWtlTxVFft8hLwR8HB9lpJpgi7zo77y7G8t9u109SWj5KViWJ7FAUpVpQe5hywKIOePKiyc/75cG1GX7x61DiCm6QqLfnqwRqGAUcvOmxgDmUFPutPkCL6eFGt8almgWoFzBv4ZhGXVnPJujVWRhJd7oeGac= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.50.97) by VI1PR04MB5583.eurprd04.prod.outlook.com (20.178.123.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1471.20; Fri, 28 Dec 2018 08:35:46 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::cd3d:ce97:132b:7148]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::cd3d:ce97:132b:7148%3]) with mapi id 15.20.1471.019; Fri, 28 Dec 2018 08:35:46 +0000 From: BOUGH CHEN To: "adrian.hunter@intel.com" , "ulf.hansson@linaro.org" CC: "linux-mmc@vger.kernel.org" , dl-linux-imx Subject: [PATCH 1/2] mmc: sdhci-esdhc-imx: add delay between tuning cycles Thread-Topic: [PATCH 1/2] mmc: sdhci-esdhc-imx: add delay between tuning cycles Thread-Index: AQHUnohTbJ8kaCxgNEKlOC22YM9cKw== Date: Fri, 28 Dec 2018 08:35:46 +0000 Message-ID: <20181228084327.9664-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: HK0PR03CA0047.apcprd03.prod.outlook.com (2603:1096:203:2f::35) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:59::33) authentication-results: spf=none (sender IP is ) smtp.mailfrom=haibo.chen@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [92.121.68.129] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1PR04MB5583;6:BDw96VmkTNjUhd64lMUBnKcYgNafjnrXmjsDXPjcJJtUOTLUvkpH+atJr/34RJhsEtzyki7IuBoxi3arr0nwK22aKrut0pDcowfalljKoSmJbfNB+ISAHMK4sk6X0zSByMqoBIl5EuRfQJexvc3bzScBz3AJO6qm8dMvZ7N1LJLLAOaahxa6YiiJOC890Z1ul2hcfLcG3G2xyEuc1go95jCfbNp0x2bEQeKgHossPcHjg87azPABsMFswbCJzM52Zow1sGd7uY+rLKKIQBRGJH85CmqsDXkGrS+6mnRBBP4oLSV7FNlKPf7ZdYXidP3E51sX8h9KtU/1pl5ngHOi3fQYQc3t95lY8GjRWC3fTOi1WilDs7GE9BkDR8RQUvbcsg6/rmocUvU/SidRplZo01magea8QmOV5ym3LIa7e7U4xaEp8GziOfGmJvbR7KZyuvW/krE++LJlSmJHecTMxQ==;5:/x9WhJAyCBZi7VWcj1cdprGHFne6ujjzJusOpNW0veu3lcmGCGNy4/3v0spF+UDoQ4xTWqnptv3gvwMm+eSdyRh/rXyy82m/TpbAyRi9FGsMqzUc68pvpJ490nlabl3Hr8e9lubRX4NEgyjHeIKLvqRKn4wEPDLYUbQoR21aRbY=;7:bJ478HGCLczcK0LG59Z/GJWFfqsLvUZU/wTorRzDMY8wawHfuQ8Q57V8og5TwnkvIbDZlg7aW0fnPGak9Dey4jnjR+M51Vt2A2GXdGubBR7PFXzfiF93IK5joL81TyVU4vUA2FxecdInmIBIPb+m+Q== x-ms-office365-filtering-correlation-id: 348af1ec-65a4-44ee-f4bb-08d66c9f7617 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:VI1PR04MB5583; x-ms-traffictypediagnostic: VI1PR04MB5583: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(2401047)(8121501046)(93006095)(93001095)(3231475)(944501520)(52105112)(3002001)(10201501046)(6055026)(6041310)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:VI1PR04MB5583;BCL:0;PCL:0;RULEID:;SRVR:VI1PR04MB5583; x-forefront-prvs: 09007040D4 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(396003)(366004)(136003)(39860400002)(376002)(199004)(189003)(486006)(7736002)(305945005)(81166006)(81156014)(8936002)(71200400001)(71190400001)(50226002)(8676002)(256004)(14454004)(478600001)(5660300001)(97736004)(2501003)(86362001)(36756003)(66066001)(6486002)(54906003)(110136005)(25786009)(6436002)(53936002)(68736007)(6512007)(476003)(2616005)(1076003)(2906002)(106356001)(6506007)(105586002)(386003)(6116002)(3846002)(99286004)(316002)(52116002)(186003)(4326008)(102836004)(26005)(53346004);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB5583;H:VI1PR04MB5040.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: kOEQ85PW814oqzGbVgjB+HIQivfZOSp9ovI4cXdaCa8tSWg9ooJ8+wAOqSGHvY2qwhXYMAUdfbSWN5RIH4RkvrgWkHr9iaw6eoyTMVR//4SvyM039OJ8uzGiQVVVjsomDIEj/jSTYpMqCqBG4D3/WKxrf4q0bN48iT3UAGqgwVUxBpPhp1SXdh2G4nMEjIdvbuYoF6G27S3x4AbWdq39m6D6VspZLZ+gOg+vXD/dM4Y+pHP3/6ENrZjGsIb9TZAtUYw79e9ZllRs5CE6iC6PDJUowKWi5eFLZznwzC3j7hH2YsPiG0pYWN05ySw5Sv4M spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 348af1ec-65a4-44ee-f4bb-08d66c9f7617 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Dec 2018 08:35:46.1639 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5583 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It's observed that i.MX uSDHC needed delay between tuning cycles for HS200 successful tuning. This patch is to set 1ms delay for that. Signed-off-by: Haibo Chen Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-esdhc-imx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index a6075ecf3b08..624ac7914196 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1376,6 +1376,8 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) if (err) goto disable_ahb_clk; + host->tuning_delay = 1; + sdhci_esdhc_imx_hwinit(host); err = sdhci_add_host(host); From patchwork Fri Dec 28 08:35:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 10744269 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 28D3A6C2 for ; Fri, 28 Dec 2018 08:35:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CD5D28A55 for ; Fri, 28 Dec 2018 08:35:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1119B28A60; Fri, 28 Dec 2018 08:35:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0C1528A5A for ; Fri, 28 Dec 2018 08:35:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730715AbeL1Ifx (ORCPT ); Fri, 28 Dec 2018 03:35:53 -0500 Received: from mail-eopbgr130071.outbound.protection.outlook.com ([40.107.13.71]:64592 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730707AbeL1Ifx (ORCPT ); Fri, 28 Dec 2018 03:35:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y7yKEYxpK5ZsNngQVroD29aDhnUspB2dWWA6PUj9AMc=; b=B5uzFsuC/O2psQN39lhri+gpAQb5SJu6s/t1sbFkjNuyJNlPmWrW2kFaTj4A1ZoMy9kfgX+fzzCFND7wa0eiI61l77ix6lwjo3/vhnyEb9D6+QOC3vPBsLTiYeHkevqIw+cqU2uy7eCm1ipCiZSj93pQeLEjZfzKRLDSb0yjzzk= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.50.97) by VI1PR04MB2078.eurprd04.prod.outlook.com (10.166.43.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1471.20; Fri, 28 Dec 2018 08:35:49 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::cd3d:ce97:132b:7148]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::cd3d:ce97:132b:7148%3]) with mapi id 15.20.1471.019; Fri, 28 Dec 2018 08:35:49 +0000 From: BOUGH CHEN To: "adrian.hunter@intel.com" , "ulf.hansson@linaro.org" CC: "linux-mmc@vger.kernel.org" , dl-linux-imx Subject: [PATCH 2/2] mmc: sdhci: add delay after the last tuning command Thread-Topic: [PATCH 2/2] mmc: sdhci: add delay after the last tuning command Thread-Index: AQHUnohVjDwjv3ELtkiDQ/9mNcQNRQ== Date: Fri, 28 Dec 2018 08:35:49 +0000 Message-ID: <20181228084327.9664-2-haibo.chen@nxp.com> References: <20181228084327.9664-1-haibo.chen@nxp.com> In-Reply-To: <20181228084327.9664-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: HK0PR03CA0047.apcprd03.prod.outlook.com (2603:1096:203:2f::35) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:59::33) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [92.121.68.129] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1PR04MB2078;6:5o++n0QF1oTLT6o25mbOtDTkYUf2Uf4TU9VR7ho3LIkVLlELHgxLPSivYm8TMnkUwORuvFUOc1cfOt/pUqy5+bd8OW23LjpdJUqKweou3LdTJtZFgz2muaHK1hw0e+T4EK1f0vB56msn9a9MK2d3HNXyNAZF4TLQevkftUWSnyOtbHVaEImAPY5apnVufJ9gGXLlXgw781dwjbh/WTsb9YXKVJrd9BKJMDiuHPVdaXZlgtQdvia2NyV8pAKQFUKfOGqX4/41AagTXR/KU+14bd8j0Fkd/VG6Mi+RNAfw1y3Kv07hp0kBudEAASC2ZnZrZsvrJPD1oRwYVu3QOoJr62yG/IXX2NPfJW/19r/dx6s/rfEuo6A1ds4IdLIxXH/ymZq8/ZpkF3JIZNreCSvcbKsVeT/zsoZ9DiDlacYX21TWmQAYQ0R4FI2xYtl6JDJ0pV4yvNrWtyygJdzuJE2nHw==;5:FdaIE6YRvu7/YQEX2rlIfyKFVEXEWkpf/1dDRdddgfDRB6Z54h0CGtpx0nMW0BNP4mRK2Smx+E06LVRhLlH4GucnR1HHBVUo839I3yWfL4mlK0SIrgyncMdc4ecsUQJhNWWw8q0Fx9l/rGbcsO2Z6y/ZQBtHc51O+7CgYeaeUpI=;7:F1yqjL1cMh32NiWFZ14FL83dswmlN5FvT1ChDdUP8a3pTrDJTCosl01lE8zxU1HoEpyQKJ1Tqpzo01RSJhm/9BOgoFdtxAwH+Fiwyesoebiaymv4iKpGrfY+ZA7l8YS9sWDNv6FYsHq4oyFfWtGhIw== x-ms-office365-filtering-correlation-id: e23cfb66-efa3-4b3b-b36b-08d66c9f77e7 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600109)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:VI1PR04MB2078; x-ms-traffictypediagnostic: VI1PR04MB2078: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(8220051)(2401047)(8121501046)(3002001)(93006095)(93001095)(3231475)(944501520)(52105112)(10201501046)(6055026)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699051)(76991095);SRVR:VI1PR04MB2078;BCL:0;PCL:0;RULEID:;SRVR:VI1PR04MB2078; x-forefront-prvs: 09007040D4 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(136003)(376002)(396003)(39860400002)(346002)(199004)(189003)(4326008)(110136005)(54906003)(97736004)(2501003)(8676002)(53936002)(6512007)(81156014)(81166006)(25786009)(1076003)(316002)(71190400001)(50226002)(2906002)(71200400001)(8936002)(6486002)(53346004)(6436002)(386003)(6506007)(99286004)(86362001)(66066001)(26005)(105586002)(3846002)(52116002)(446003)(305945005)(7736002)(14454004)(6116002)(102836004)(256004)(76176011)(486006)(68736007)(11346002)(36756003)(186003)(2616005)(476003)(478600001)(106356001)(6346003)(5660300001);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB2078;H:VI1PR04MB5040.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=haibo.chen@nxp.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: w59ukvxHvuzCFYnFhUl93lYAzF677vZWIXwK82JfpZHxbDtvlzDv2CHgO4+kei8J0cH8fJqw0AaneW3fnBSI1IiIEvFnLuHs5dvaKVBj3jH8CRLwulz6WRkYDBYHKAl/VfoHY1LsBgIW6i3/fpqpouuFYHE1DPNzplpZ4DD0r8fo//TmRmU0je0+0vgX/Yiar2mCj+NtmZlHX3hE+IhnXuSbyYzL3k8q8K5jgw1OpLNMuWCAHHWCVXoc1pcBl32aUkWlF/zQCE/T+vjcdCtVvukx+fTrUgHOg9IgkLIB1G1v+H/BcImOCikkevrtaJ2M spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e23cfb66-efa3-4b3b-b36b-08d66c9f77e7 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Dec 2018 08:35:49.1730 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB2078 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When host set the host->tuning_delay, even the last tuning command need a delay, otherwise the first command after the tuning will meet issue. Take i.MX7D as an example, there will be the following log: mmc2: switch to high-speed from hs200 failed, err:-110 mmc2: error -110 whilst initialising MMC card Signed-off-by: Haibo Chen Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index a22e11a65658..6af09740ca59 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2376,6 +2376,10 @@ static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) return -ETIMEDOUT; } + /* Spec does not require a delay between tuning cycles */ + if (host->tuning_delay > 0) + mdelay(host->tuning_delay); + ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2); if (!(ctrl & SDHCI_CTRL_EXEC_TUNING)) { if (ctrl & SDHCI_CTRL_TUNED_CLK) @@ -2383,9 +2387,6 @@ static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) break; } - /* Spec does not require a delay between tuning cycles */ - if (host->tuning_delay > 0) - mdelay(host->tuning_delay); } pr_info("%s: Tuning failed, falling back to fixed sampling clock\n",