From patchwork Tue Mar 26 06:24: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: 1065216 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="YeBY2SCt"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44T1Lm4WPNz9sSN for ; Tue, 26 Mar 2019 17:24:30 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id B97D2C21E0D; Tue, 26 Mar 2019 06:24:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 29C6BC21C50; Tue, 26 Mar 2019 06:24:23 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9875BC21C29; Tue, 26 Mar 2019 06:24:21 +0000 (UTC) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00045.outbound.protection.outlook.com [40.107.0.45]) by lists.denx.de (Postfix) with ESMTPS id 17671C21C51 for ; Tue, 26 Mar 2019 06:24:21 +0000 (UTC) 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=hmgaFPo+izWOJCxdO8E5X480+PdQCek7q0BHw/6MY1c=; b=YeBY2SCtg3dlZ0xAVLf8IEJIWPDOswSnlW2t645coskeEFZv6dx2OGHpUvnY+Di7Kmwut/4Gc4FIP5mAqXFHbJgO/4VXR9sWIxDju6faKEyqAVMk02szDZD2bJ1oh24pljnMqyzal4/ikSc+oq3zTEwu+hRSo74+IJt7gz/1kss= Received: from VI1PR04MB5040.eurprd04.prod.outlook.com (20.177.50.97) by VI1PR04MB4112.eurprd04.prod.outlook.com (52.133.14.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18; Tue, 26 Mar 2019 06:24:19 +0000 Received: from VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::2920:3947:20da:de56]) by VI1PR04MB5040.eurprd04.prod.outlook.com ([fe80::2920:3947:20da:de56%2]) with mapi id 15.20.1730.019; Tue, 26 Mar 2019 06:24:18 +0000 From: BOUGH CHEN To: "jh80.chung@samsung.com" , "trini@konsulko.com" , "marek.vasut@gmail.com" Thread-Topic: [PATCH v2] mmc: correct the HS400 initialization process Thread-Index: AQHU45yKaNk2VMUHIkKU2SMUJW0r/w== Date: Tue, 26 Mar 2019 06:24:17 +0000 Message-ID: <20190326063200.7172-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: HK2PR0302CA0021.apcprd03.prod.outlook.com (2603:1096:202::31) 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: 28b047a6-5c84-4691-a156-08d6b1b3ac95 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR04MB4112; x-ms-traffictypediagnostic: VI1PR04MB4112: x-microsoft-antispam-prvs: x-forefront-prvs: 09888BC01D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(396003)(346002)(366004)(376002)(39860400002)(199004)(189003)(316002)(25786009)(3846002)(6116002)(86362001)(386003)(6506007)(71190400001)(71200400001)(53936002)(186003)(2501003)(26005)(106356001)(52116002)(105586002)(5660300002)(68736007)(1076003)(53346004)(102836004)(50226002)(4326008)(486006)(99286004)(305945005)(54906003)(8936002)(478600001)(6486002)(36756003)(66066001)(14454004)(2616005)(476003)(2906002)(97736004)(256004)(6512007)(110136005)(2201001)(7736002)(8676002)(81156014)(6436002)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB4112; 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: gDoLoohrkWbCd5GADzqR9znJIynOGntdHJyjJexSqwn7XsrlAwI56Ss/iCYbzQEPIuwqiMxoI3YxqUNps6aNjnkacr5/sUV+9lqrIFN1MgjfNFS/bBwEa0TooNmWFhdinG4t+1mdcE9xAq3AS2b9uBfsRts3qPmUY/QYebIF/5qAnjJQg5sQzhA9ZRkugCU0EMnz3a63EA7uPR5/l+iO+DLTidstWasF3EmAuu8ZdhmCC6nU4foknwJbLDoYneCk4wFe7OHB5Vv+TDMWChSBCxZg7LHw0jPNHuagVKfcuscqvVV+TYsdYd+WTLyiy0XZzpiIjY7LtP5rFLBU4dyiF38AYUCSkeEyUUzB/yiHidwfN0PjKJLRubmdwT92HJosjh5YODmOmy5PLvXIKAM561XrQzTq2/LeTi9xiaYAGEc= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 28b047a6-5c84-4691-a156-08d6b1b3ac95 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Mar 2019 06:24:18.5493 (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: VI1PR04MB4112 Cc: "u-boot@lists.denx.de" , BOUGH CHEN , dl-uboot-imx , "marek.vasut+renesas@gmail.com" Subject: [U-Boot] [PATCH v2] mmc: correct the HS400 initialization process X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" After the commit b9a2a0e2e9c0 ("mmc: Add support for downgrading HS200/HS400 to HS mode"), it add a parameter in mmc_set_card_speed() which indicates that the HS200/HS400 to HS downgrade is happening. During the HS400 initialization, first select to HS200, and config the related clock rate, then downgrade to HS mode. So here also need to config the downgrade value to be true for two reasons. First, make sure in the function mmc_set_card_speed(), after switch to HS mode, first config the clock rate, then read the EXT_CSD, avoid receiving data of EXT_CSD in HS mode at 200MHz. Second, after issue the MMC_CMD_SWITCH command, it need to wait a bit then switch bus properties. Test on i.MX8QM MEK board, some Micron eMMC will stuck in transfer mode in this case, and USDHC will never get data transfer complete status, cause the uboot hang. Signed-off-by: Haibo Chen Acked-by: Marek Vasut --- drivers/mmc/mmc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 89b255daf4..456c1b4cc9 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1892,8 +1892,7 @@ static int mmc_select_hs400(struct mmc *mmc) } /* Set back to HS */ - mmc_set_card_speed(mmc, MMC_HS, false); - mmc_set_clock(mmc, mmc_mode2freq(mmc, MMC_HS), false); + mmc_set_card_speed(mmc, MMC_HS, true); err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, EXT_CSD_BUS_WIDTH_8 | EXT_CSD_DDR_FLAG);