From patchwork Thu Dec 20 11:57:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 10738773 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 9C4036C2 for ; Thu, 20 Dec 2018 11:57:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80CAF28537 for ; Thu, 20 Dec 2018 11:57:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71F6A28578; Thu, 20 Dec 2018 11:57:47 +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 0967F28537 for ; Thu, 20 Dec 2018 11:57:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729695AbeLTL5q (ORCPT ); Thu, 20 Dec 2018 06:57:46 -0500 Received: from mail-eopbgr80054.outbound.protection.outlook.com ([40.107.8.54]:6304 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729103AbeLTL5q (ORCPT ); Thu, 20 Dec 2018 06:57:46 -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=59sB6iH4UdEF2nobmf8ErDboxzdnRpIakLpt5oH62mE=; b=S2p7CkGk6hNNad+HOT9EBcxWiufiQjYB31YZrtIb2X3vBU79Fpoc/RiMip894clEnxG1/kSOtARaWcbJjAMa2ppa/UYbR3k99LcinpZjESuvv3VJPKmVU8cwJGmODe12EJ/Y6seA7eLbgjMqeukbVECi6/GbFAlaBoXBvVn5530= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.50.97) by VI1PR04MB4224.eurprd04.prod.outlook.com (52.134.31.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1446.17; Thu, 20 Dec 2018 11:57:42 +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.1446.020; Thu, 20 Dec 2018 11:57:42 +0000 From: BOUGH CHEN To: "adrian.hunter@intel.com" , "ulf.hansson@linaro.org" CC: "linux-mmc@vger.kernel.org" , dl-linux-imx Subject: [PATCH] mmc: sdhci-esdhc-imx: clear ESDHC_STD_TUNING_EN for manual tuning method Thread-Topic: [PATCH] mmc: sdhci-esdhc-imx: clear ESDHC_STD_TUNING_EN for manual tuning method Thread-Index: AQHUmFs2S1129BOR4U25mnLOxlhbow== Date: Thu, 20 Dec 2018 11:57:41 +0000 Message-ID: <1545307511-15362-1-git-send-email-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 1.9.1 x-clientproxiedby: HK0PR03CA0005.apcprd03.prod.outlook.com (2603:1096:203:2e::17) 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;VI1PR04MB4224;6:Nx++qaCLzX2X8qisMjJvunLlCn7DCa1O1EXsc4G08uGt/rLvNBuQhYqP5frVxwXEU7DYZh1nWYQkJjC6E557kmb3l7gp3KBIGJxDs8ezgHXOIP/Kra9LLMp6w+lHaY7guwji3tN/NTPSEIGF61UKr94Din6U8ztShe7CfxL7fennmL7XjFzGrV0iVI/B31e9gX4NdckeUFrCoBzys7S4AuENG8CwNwMbzSYSM/yKzOPie8BbwOUlp8GCZ66BPKUX4oo/QsedAs/5isKLk92yIzAvYNeYCDpntqMFIpYCus9VRjJjeyAR9YLV7Zrj+MCpYTxVM8LP37NoATDsUWhz2GWq//pMIKxdmF/e5lu8fXuwpXS2ALVYhoHpbgpynQS3MTnvxuHZBQBQqa/Wah+AzlgTrENtPgSJ5UgaWoYid2EM5D4lSPySoajRXmlMJY18H8mPm+nr8wfB0wMNjL4bRQ==;5:SjpBtvkNUAzA7D+zmMDdIVPYEmRHYpFwg8DVY2ZydzIwVNPZYjEmMoaE6DNBCVwE/MbYy23TT2rvGRcweavYoWgWCLVDWCHLwS+Tg/lBV5dspQfAPZ0fhVnG3PVDu22h6kweqvViqWHjQRvpU/j49yp6vjGwm/vPW3zodclwtq8=;7:hNuLer0ZBmGstLv1SnhaxrSc/PG+15CZdnOt6kbMg299puztriSyopCXint7jTFXTA6Nqi7DyK4aKim/21NyEDd/Y+69TGAji097HPjz7SL4T7D8gHNVg3Oom1tnjOCLCJYpUmr5/MfwPSko9WUc2g== x-ms-office365-filtering-correlation-id: 329e9d4c-a433-4a71-2c15-08d666725867 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:VI1PR04MB4224; x-ms-traffictypediagnostic: VI1PR04MB4224: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(3230021)(999002)(5005026)(6040522)(2401047)(8121501046)(10201501046)(3002001)(3231475)(944501520)(52105112)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051)(76991095);SRVR:VI1PR04MB4224;BCL:0;PCL:0;RULEID:;SRVR:VI1PR04MB4224; x-forefront-prvs: 0892FA9A88 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(376002)(396003)(136003)(346002)(366004)(189003)(199004)(14454004)(25786009)(50226002)(478600001)(52116002)(8676002)(81156014)(81166006)(102836004)(6506007)(386003)(2906002)(26005)(186003)(486006)(54906003)(3846002)(97736004)(6116002)(305945005)(8936002)(6486002)(6436002)(2501003)(316002)(2616005)(476003)(110136005)(66066001)(4326008)(68736007)(53346004)(5660300001)(105586002)(71190400001)(106356001)(71200400001)(7736002)(86362001)(53936002)(36756003)(6512007)(256004)(99286004);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4224;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-microsoft-antispam-message-info: qGxIp3K2nQrKSNRaJaggY7XjU0p9VE31pAjpFELfyEZD4h68uFrfXQ005Qy/850TDEKCIBb13F7y9JeufD7FWVeaimIxhf0y3ejrfhkdYgyAG2OlFW0Ej404EWuX/E/AYykAqNfwLg6ZF+TzWeL1+X5OB545QwoZw4+97ar0dysH3xwDcY+RdIsAK/tbUdaZhomGoHAIjOzCwmx2VlKb0J7BIdXnbsYmNQbAwGTxMo3qLMxdS6Nuddj5HUJz9uBk6/CZEY+443qomLa+UJwIWwm8p1EXTRSAptdikunSUthUI57/giemxArwdhZv+0mF spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 329e9d4c-a433-4a71-2c15-08d666725867 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Dec 2018 11:57:41.9928 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4224 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 The bit ESDHC_STD_TUNING_EN may be configed by bootloader code if it choose to use standard tuning method. So on linux side, if choose to use manual tuning method, need to clear the bit ESDHC_STD_TUNING_EN, remove the impact of bootloader code. Signed-off-by: Haibo Chen Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-esdhc-imx.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 75a2484..4b7bf07 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1137,6 +1137,15 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host) << ESDHC_TUNING_STEP_SHIFT; } writel(tmp, host->ioaddr + ESDHC_TUNING_CTRL); + } else if (imx_data->socdata->flags & ESDHC_FLAG_MAN_TUNING) { + /* + * ESDHC_STD_TUNING_EN may be configed in bootloader + * or ROM code, so clear this bit here to make sure + * the manual tuning can work. + */ + tmp = readl(host->ioaddr + ESDHC_TUNING_CTRL); + tmp &= ~ESDHC_STD_TUNING_EN; + writel(tmp, host->ioaddr + ESDHC_TUNING_CTRL); } } }