From patchwork Sun Apr 28 08:19:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 10920829 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 CA40E912 for ; Sun, 28 Apr 2019 08:20:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B69E928A00 for ; Sun, 28 Apr 2019 08:20:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4FA328AB9; Sun, 28 Apr 2019 08:20:35 +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 2BC5428A00 for ; Sun, 28 Apr 2019 08:20:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726369AbfD1IUe (ORCPT ); Sun, 28 Apr 2019 04:20:34 -0400 Received: from mail-eopbgr150074.outbound.protection.outlook.com ([40.107.15.74]:61923 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726553AbfD1IUe (ORCPT ); Sun, 28 Apr 2019 04:20:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OhnSxT5GqkOfh7+kHBeSINyGE7JN1upovXUL+/CXQBE=; b=He07mHWRCTZwU9EE5VE0VADnd8DlkNprVDNuQwv94+dS/dh78lrp2xdHp3Uan0rTBCI8Qhh1/0dkbEZmpk8RZ4BXllNz22EbhlkLOKm4gz9NU5bFkxjra2Z/fHJmmXaQ3LoLhMrO9TroHjcB4rgn7nawqFUXFguPqZA0Z2psRvs= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.50.97) by VI1PR04MB4990.eurprd04.prod.outlook.com (20.177.49.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1835.12; Sun, 28 Apr 2019 08:19:51 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::4d83:33f7:38e7:70ec]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::4d83:33f7:38e7:70ec%4]) with mapi id 15.20.1835.016; Sun, 28 Apr 2019 08:19:51 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "kernel@pengutronix.de" , "adrian.hunter@intel.com" CC: dl-linux-imx , "linux-mmc@vger.kernel.org" Subject: [PATCH 3/3] mmc: add HS400 support for iMX7ULP Thread-Topic: [PATCH 3/3] mmc: add HS400 support for iMX7ULP Thread-Index: AQHU/ZsmzDLDg6BIi0i3xVK559eX9Q== Date: Sun, 28 Apr 2019 08:19:51 +0000 Message-ID: <20190428082727.3419-3-haibo.chen@nxp.com> References: <20190428082727.3419-1-haibo.chen@nxp.com> In-Reply-To: <20190428082727.3419-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: HK0PR01CA0052.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::16) To VI1PR04MB5040.eurprd04.prod.outlook.com (2603:10a6:803:59::33) authentication-results: spf=none (sender IP is ) smtp.mailfrom=haibo.chen@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.71] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2a92d533-40a8-4a0f-0e3d-08d6cbb24926 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020);SRVR:VI1PR04MB4990; x-ms-traffictypediagnostic: VI1PR04MB4990: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-forefront-prvs: 0021920B5A x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(39860400002)(366004)(136003)(396003)(346002)(189003)(199004)(6436002)(81156014)(81166006)(6486002)(25786009)(2906002)(68736007)(8676002)(486006)(50226002)(4326008)(8936002)(11346002)(52116002)(86362001)(36756003)(446003)(2201001)(476003)(2616005)(73956011)(76176011)(66946007)(97736004)(66476007)(66446008)(66556008)(53346004)(64756008)(71200400001)(71190400001)(2501003)(110136005)(54906003)(478600001)(1076003)(14454004)(386003)(6506007)(102836004)(256004)(14444005)(7736002)(305945005)(66066001)(6512007)(186003)(99286004)(3846002)(53936002)(6116002)(316002)(26005)(5660300002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4990;H:VI1PR04MB5040.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: tMcWFsHivFFOGnInRoPkR9xZXdl0FBNqwfsy9lJ4LjvprIq2vZRNo5gSlxAxg7xQX0M9PRSl0qlqd1WrKBzhcRrj5qA1IivCZj/+EKMzlOnM2DNX0VoJk4doyEvoC3X2nb1dc0Zw5zoaZSYKQrxy2Wd7MpqjR/+OenvjUaiQFMXKBVzrZ94slt03lqTYAPgtguhVaj2BXSLbYWSWQPWQo4SySXYj0FXIz1ac+fxnzPAQwPCYBPNYlBTdqTu3vSnSJaKvIHTtyc6PMKcpoENejOOzVaZ0MMKugvWVYZJMox2HLBKW11bd5f7alGugBMAZIEx2NvUtfUR5P/xxeA+JL6tLp2s6Ynz7YuNC5SfAOBJvoSP7X6gRdeJtS+mqGNaRCLo5wCDOSL1q8vfmWXOSeIO2Dko4dkO1rdXV5Zvq+xs= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a92d533-40a8-4a0f-0e3d-08d6cbb24926 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Apr 2019 08:19:51.4994 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4990 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add HS400 support for iMX7ULP B0. According to IC suggest, need to clear the STROBE_DLL_CTRL_RESET before any setting of STROBE_DLL_CTRL register. USDHC has register bits(bit[27~20] of register STROBE_DLL_CTRL) for slave sel value. If this register bits value is 0, it needs 256 ref_clk cycles to update slave sel value. IC suggest to set bit[27~20] to 0x4, it only need 4 ref_clk cycle to update slave sel value. This will short the lock time of slave. i.MX7ULP B0 will need more time to lock the REF and SLV, so change to add 5us delay. Signed-off-by: Haibo Chen --- drivers/mmc/host/sdhci-esdhc-imx.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 6a02e8b50dc7..f56d073c87e0 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -74,6 +74,7 @@ #define ESDHC_STROBE_DLL_CTRL_ENABLE (1 << 0) #define ESDHC_STROBE_DLL_CTRL_RESET (1 << 1) #define ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_SHIFT 3 +#define ESDHC_STROBE_DLL_CTRL_SLV_UPDATE_INT_DEFAULT (4 << 20) #define ESDHC_STROBE_DLL_STATUS 0x74 #define ESDHC_STROBE_DLL_STS_REF_LOCK (1 << 1) @@ -210,7 +211,7 @@ static const struct esdhc_soc_data usdhc_imx7d_data = { static struct esdhc_soc_data usdhc_imx7ulp_data = { .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200 - | ESDHC_FLAG_PMQOS, + | ESDHC_FLAG_PMQOS | ESDHC_FLAG_HS400, }; static struct esdhc_soc_data usdhc_imx8qxp_data = { @@ -994,15 +995,19 @@ static void esdhc_set_strobe_dll(struct sdhci_host *host) /* force a reset on strobe dll */ writel(ESDHC_STROBE_DLL_CTRL_RESET, host->ioaddr + ESDHC_STROBE_DLL_CTRL); + /* clear the reset bit on strobe dll before any setting */ + writel(0, host->ioaddr + ESDHC_STROBE_DLL_CTRL); + /* * enable strobe dll ctrl and adjust the delay target * for the uSDHC loopback read clock */ v = ESDHC_STROBE_DLL_CTRL_ENABLE | + ESDHC_STROBE_DLL_CTRL_SLV_UPDATE_INT_DEFAULT | (7 << ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_SHIFT); writel(v, host->ioaddr + ESDHC_STROBE_DLL_CTRL); - /* wait 1us to make sure strobe dll status register stable */ - udelay(1); + /* wait 5us to make sure strobe dll status register stable */ + udelay(5); v = readl(host->ioaddr + ESDHC_STROBE_DLL_STATUS); if (!(v & ESDHC_STROBE_DLL_STS_REF_LOCK)) dev_warn(mmc_dev(host->mmc),