From patchwork Mon Jan 7 10:11: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: 10750259 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 85FEE13B5 for ; Mon, 7 Jan 2019 10:13:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7531B2872E for ; Mon, 7 Jan 2019 10:13:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6762828A0C; Mon, 7 Jan 2019 10:13:09 +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 404272872E for ; Mon, 7 Jan 2019 10:13:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725550AbfAGKNH (ORCPT ); Mon, 7 Jan 2019 05:13:07 -0500 Received: from mail-eopbgr130081.outbound.protection.outlook.com ([40.107.13.81]:26645 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726878AbfAGKNH (ORCPT ); Mon, 7 Jan 2019 05:13:07 -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=Wfc6TsErg7z+j6+QRsZ72//dl5+iqcmuUbMBbWd6wf4=; b=jS9tXb9LxeE75WPBaC1ict3TlOLZ2gHFDX3Fsy+aZOeYngkgEbge6SUCDiLxrDLA5/tllE3t8SWFgaUajBn7eGbh7YwIaH/fbz8cVOUKK6HQJNscy2XL+W/RzUikTx2QWXcMrc1lMc0JI1ESWmyI4kb4CEH67kUVHhyIP0YYqxo= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.50.97) by VI1PR04MB2126.eurprd04.prod.outlook.com (10.166.43.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.7; Mon, 7 Jan 2019 10:11:29 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::ed39:18ba:6fbc:d025]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::ed39:18ba:6fbc:d025%2]) with mapi id 15.20.1495.011; Mon, 7 Jan 2019 10:11:29 +0000 From: BOUGH CHEN To: "ulf.hansson@linaro.org" , "adrian.hunter@intel.com" CC: dl-linux-imx , "linux-mmc@vger.kernel.org" Subject: [PATCH 1/5] mmc: sdhci-esdhc-imx: remove the 100MHz limitation for Strobe DLL Thread-Topic: [PATCH 1/5] mmc: sdhci-esdhc-imx: remove the 100MHz limitation for Strobe DLL Thread-Index: AQHUpnFboK70IJh+k0S1Ny3MYUbf7Q== Date: Mon, 7 Jan 2019 10:11:29 +0000 Message-ID: <20190107101757.27647-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: HK2PR04CA0052.apcprd04.prod.outlook.com (2603:1096:202:14::20) 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;VI1PR04MB2126;6:Z+ksAr+LCcFyNtH69MOW/WlMhpCmQ/KibJ0xQax0/nFwU4Xd8n8chuxEM7v+pkEUYumMBBk/MH+PPdI0BQjnfzOX1v+Jp1gWXOtYqHa8EnmeRPKF+IXNnK8+ZiMKoRJHnGojThZAtFXjr0OqzyJVjcp3JC4zOGsQ+18+SB00M0thVm3bcIYJJFN0rgJmHvbTyHMSLbrDt7q28aa29P9m8E+XZ6Xd7FlRAPG3dS/1nvlRIKAdAD+UXp65Dpae4OlAge4wrpZV0mDkBfUAKa/wCB39tducMlpHmuJZjKVoAG+kiIr4Fb5zr8zPboYAFNJ/uv0QCKwoDX2U6Lv5A6vHp7RCTc7P0wTWre7lnPyYTgHEkankfR/NjoIn72VpKpm9FX8zHUY+XYxHLiV5dhnqr8J+4FZbhC5F9+3yG0a4q36Flu9rgkT5RD+3ve3nEdZSPGPa12t4509EaR5uqr/GPw==;5:p6QCEHs5JJJrynCbouptq1lk1exkIrbj4Tzs0VD/bXjJHmjYuMNTGKLe9XY7lariCkHaxZiBUGKNiGo7wXIl4o/H+9CYpYed/WZkE8MZ/m1HdDqUhr0w0HDJgMq4YHmsr8qHht+rzHZx3qrUcxtbhGMnnoZOVR24ViWQIQ1MVIHachMg09jBpHlalmShvIXhKRKrvSD45e/sRObcfsHRQQ==;7:gEEhgWhpRGJlWm7twdmimJPerZYxdZlt68ZP6C3nfRwihmuQlkgCjanfugN8FzcB4kCb9JILnq8hlLlzlQ3WroTHGLCpB2mWTF4B7b7Weg+OQyT8UAB2gq7jdOjvybTfQ5c07lQ43oZfXHiWYTjfBA== x-ms-office365-filtering-correlation-id: 439f6594-e3a8-4a3c-ad1b-08d674887d90 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:VI1PR04MB2126; x-ms-traffictypediagnostic: VI1PR04MB2126: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(10201501046)(3231475)(944501520)(52105112)(93006095)(93001095)(3002001)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:VI1PR04MB2126;BCL:0;PCL:0;RULEID:;SRVR:VI1PR04MB2126; x-forefront-prvs: 0910AAF391 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(366004)(136003)(396003)(376002)(346002)(199004)(189003)(8676002)(81156014)(81166006)(50226002)(305945005)(5660300001)(106356001)(52116002)(110136005)(71200400001)(2501003)(54906003)(486006)(8936002)(4326008)(102836004)(14444005)(478600001)(7736002)(316002)(14454004)(256004)(71190400001)(86362001)(105586002)(3846002)(6116002)(186003)(6512007)(53936002)(386003)(99286004)(6506007)(97736004)(26005)(2616005)(476003)(66066001)(6436002)(36756003)(25786009)(53346004)(68736007)(1076003)(6486002)(2906002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB2126;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: bTN7a2J/r3zAZDeGy9EO1ev41sfLZeVALlf/MKvj8mAd/6yswhENZBZM1uZnnjhGkPgAUCk8tX35W0xCrET+ibjDj8n9uIZBOR6LO7ghbEcJJtMEt7Muqve1wFfTI/k2vnZw32YOHa3QXqm/rhBpkTddMiQtWLpJK6t5isMjqdnBhWvXfOG59sgaUOsitYXkWXpwwaZWLo8lLwoBD/qlq+2Ou4bZhh01rtUEminkc3iEGBgwkZOyUsQuiE75BZUeMWBMA3+uWIkwGaLax0VMVYKrksSqsL1oMGOZIYOBccA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 439f6594-e3a8-4a3c-ad1b-08d674887d90 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2019 10:11:26.6448 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB2126 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 For some eMMC, after switch to HS400ES mode, it need to config the strobe dll target dealy even if the clock is 50MHZ or 25MHz, otherwise will meet CMD index/crc error when send CMD13 to check the switch status. [ 2.473915] IRQ status 0x000a8001 [ 2.473934] mmc2: mmc_select_hs400es failed, error -84 [ 2.473938] mmc2: error -84 whilst initialising MMC card Signed-off-by: Haibo Chen Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-esdhc-imx.c | 55 +++++++++++++----------------- 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index cf187f8dbc6c..0489b60b8eb4 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -141,9 +141,6 @@ /* The IP supports HS400 mode */ #define ESDHC_FLAG_HS400 BIT(9) -/* A clock frequency higher than this rate requires strobe dll control */ -#define ESDHC_STROBE_DLL_CLK_FREQ 100000000 - struct esdhc_soc_data { u32 flags; }; @@ -907,39 +904,35 @@ static int esdhc_change_pinstate(struct sdhci_host *host, * edge of data_strobe line. Due to the time delay between CLK line and * data_strobe line, if the delay time is larger than one clock cycle, * then CLK and data_strobe line will be misaligned, read error shows up. - * So when the CLK is higher than 100MHz, each clock cycle is short enough, - * host should configure the delay target. */ static void esdhc_set_strobe_dll(struct sdhci_host *host) { u32 v; - if (host->mmc->actual_clock > ESDHC_STROBE_DLL_CLK_FREQ) { - /* disable clock before enabling strobe dll */ - writel(readl(host->ioaddr + ESDHC_VENDOR_SPEC) & - ~ESDHC_VENDOR_SPEC_FRC_SDCLK_ON, - host->ioaddr + ESDHC_VENDOR_SPEC); - - /* force a reset on strobe dll */ - writel(ESDHC_STROBE_DLL_CTRL_RESET, - 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 | - (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); - 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)) - dev_warn(mmc_dev(host->mmc), - "warning! HS400 strobe DLL status SLV not lock!\n"); - } + /* disable clock before enabling strobe dll */ + writel(readl(host->ioaddr + ESDHC_VENDOR_SPEC) & + ~ESDHC_VENDOR_SPEC_FRC_SDCLK_ON, + host->ioaddr + ESDHC_VENDOR_SPEC); + + /* force a reset on strobe dll */ + writel(ESDHC_STROBE_DLL_CTRL_RESET, + 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 | + (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); + 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)) + dev_warn(mmc_dev(host->mmc), + "warning! HS400 strobe DLL status SLV not lock!\n"); } static void esdhc_reset_tuning(struct sdhci_host *host)