Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6826024imu; Wed, 30 Jan 2019 23:54:27 -0800 (PST) X-Google-Smtp-Source: ALg8bN7X6aPHfGeZJVkce3sxoiAFvLXBxoT+Z0DiS/abHRK618m1RPYnewelxBQm1Hp8ltb0YoL0 X-Received: by 2002:a17:902:e28e:: with SMTP id cf14mr34390031plb.311.1548921267463; Wed, 30 Jan 2019 23:54:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548921267; cv=none; d=google.com; s=arc-20160816; b=rQMENpFTbAC2r1UcpgKlwc+B1TCTSwSZ1kyc/HfJRXOzZGNr0MmZd2IY2qz1hC9Pl7 4e120LtcXW93gN/Jwq44D7bPKEZTvZT3BHs0Gznpgao9aG6VtNTGxvkTwYeUA5lMaHvw +bcbjskVJxlRDShIwcr9XjHePG5/n+4y3UK6lRyV9UXN1UVNk0EiFOlInBRHgJ4Gtuye 2W2LwpAWxUSVvDUYStGt+/pppeaoIN6v9dr3Lmdb8of7pz5rha0tbleouUu0Hj/zGNXI 7nPfeVZxlUeRNc9zv9yNQuo4/gNiYem/rVaLIMAKevT6Pw35XXz2K3pSo8kQHz3CrJi5 4/kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=AuYq90++IRo7ex8b+PX1/IS5uBDK4V6e9ytltg3aa4A=; b=JZj1U5CPzK1us/ynU/wwxaIfwqwwSN3Ft5n5p2CbNs7TNqM1rxN/OMzIhkSTBOu4mh M+7LQBBn1y7nJOvItOh1clRjvSNBaeMaBQk0+LutAyhBTwAyqMfdImitZQyUkTekRYze zojPLTuIkRWUTAcUoPrtq5+PDgCPg8qPCigOLM3b3oeVIEcHr2EFECJsk8mi1Zenyw5j d6Hs8uXdzKIiQOojm4GKSjdE2vKW3ZjOnL4fQfYoQF5BBPLvuS2ykjIr7fdRhgtRnbMt bC0ta5UdaiXEcY7Ivyz29ytoQ9lCQz2TaDaYU5HtRKZjmo68Hy9Ej5xsNppXuy2NNST2 SnoA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l8si3658970pgr.345.2019.01.30.23.54.11; Wed, 30 Jan 2019 23:54:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728083AbfAaHxo (ORCPT + 99 others); Thu, 31 Jan 2019 02:53:44 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:62739 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725829AbfAaHxo (ORCPT ); Thu, 31 Jan 2019 02:53:44 -0500 X-UUID: ae5b0a36f6bf4a64b723f5e1b5941bb9-20190131 X-UUID: ae5b0a36f6bf4a64b723f5e1b5941bb9-20190131 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 593196214; Thu, 31 Jan 2019 15:53:38 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by mtkmbs03n1.mediatek.inc (172.21.101.181) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 31 Jan 2019 15:53:36 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 31 Jan 2019 15:53:35 +0800 From: Chaotian Jing To: Ulf Hansson CC: Matthias Brugger , Shawn Lin , Simon Horman , Chaotian Jing , Kyle Roeschley , Hongjie Fang , Harish Jenny K N , , , , , Subject: [PATCH] mmc: mmc: Fix HS setting in mmc_hs400_to_hs200() Date: Thu, 31 Jan 2019 15:53:31 +0800 Message-ID: <1548921212-5219-1-git-send-email-chaotian.jing@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org mmc_hs400_to_hs200() begins with the card and host in HS400 mode. Therefore, any commands sent to the card should use HS400 timing. It is incorrect to reduce frequency to 50Mhz before sending the switch command, in this case, only reduce clock frequency to 50Mhz but without host timming change, host is still in hs400 mode but clock changed from 200Mhz to 50Mhz, which makes the tuning result unsuitable and cause the switch command gets response CRC error. this patch refers to mmc_select_hs400(), make the reduce clock frequency after card timing change. Signed-off-by: Chaotian Jing --- drivers/mmc/core/mmc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index da892a5..21b811e 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1239,10 +1239,6 @@ int mmc_hs400_to_hs200(struct mmc_card *card) int err; u8 val; - /* Reduce frequency to HS */ - max_dtr = card->ext_csd.hs_max_dtr; - mmc_set_clock(host, max_dtr); - /* Switch HS400 to HS DDR */ val = EXT_CSD_TIMING_HS; err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, @@ -1253,6 +1249,10 @@ int mmc_hs400_to_hs200(struct mmc_card *card) mmc_set_timing(host, MMC_TIMING_MMC_DDR52); + /* Reduce frequency to HS */ + max_dtr = card->ext_csd.hs_max_dtr; + mmc_set_clock(host, max_dtr); + err = mmc_switch_status(card); if (err) goto out_err; -- 1.8.1.1.dirty