Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp805186imj; Fri, 15 Feb 2019 07:08:08 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia8oWLUcMb96s3KwINx58P2Ao/CCv34i9NiPWCWRSAtqoJU3CNKhRcVIcsQzgBVbPy6/sBN X-Received: by 2002:a17:902:6b87:: with SMTP id p7mr10820207plk.282.1550243288649; Fri, 15 Feb 2019 07:08:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550243288; cv=none; d=google.com; s=arc-20160816; b=jarYkZPDtexTQuq7oYu3EgzkFrzb1iIhEoh4cRgXTu6JGUy7skKERvJLuK4FzOdNWG 5CH/flNYsEIL9UDMUwK/U4q7UwIm1y8mAs+xE3VoE8PgQzjvk9R54MekG0ei0RpAnvBR +J1/ZvlMR0TSrCNAenPFq8CVldkPWX/A+21dzxSQjdJE+6MGqMi5BS0kfOfUE1juDsIU t/VvcBQG/hKhG4VXEGw6WQLgom196vMTQS1Uw/B6GVHd8AoSwNNGOgcHCgZPkUPe9n25 ZKeuTgv30zEyOyTHSQwSSDczFECUeZTuAmPf9Ap1FeTMwyiiEZ1rj6ILvENW0lJfV8k/ v3Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=10xmFiLDmKSzQF+oxRnRXHV6muvVvT4nNYvKB2MJ1Ho=; b=d9ctil7Xk8rl+RX+cgJ8itwkDYqMbMPErKZipXEUq2tnyJ9n2U1x/QWAewzUNQtOUP jFBxohas0gSfz3k1KzHnSjJXcafMYtxYA33gOwITwF6syyGswsoOJGq25K8yo+/KAH2u SMxMK9UebV27OoEX/A+e2ZKp1o7Tq7bYWWTkMih/teRbVxwNarwQEvy+1Koo5zxirqK3 vmwgs+kmEH8ZqlXyTpn9rfe5vPtmz7rre73Jjl8IWDpx6GGJN+JYPpT5tIqu7Y04Kzer S2QpKABE32lASvpGMwwJ1xftJlICYrE3TPj8ABUfXni5t1C7s/zf5VRsJbpwqNmxCiGv e/WA== 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 n4si5691817pgh.427.2019.02.15.07.07.51; Fri, 15 Feb 2019 07:08:08 -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 S1732775AbfBOF7v (ORCPT + 99 others); Fri, 15 Feb 2019 00:59:51 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:47875 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1732516AbfBOF7t (ORCPT ); Fri, 15 Feb 2019 00:59:49 -0500 X-UUID: e51d0c45e26d4af5b7d6f9a7aaee8b38-20190215 X-UUID: e51d0c45e26d4af5b7d6f9a7aaee8b38-20190215 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1533631543; Fri, 15 Feb 2019 13:59:44 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs03n1.mediatek.inc (172.21.101.181) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 15 Feb 2019 13:59:43 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 15 Feb 2019 13:59:42 +0800 From: Chaotian Jing To: Ulf Hansson CC: Matthias Brugger , Shawn Lin , Simon Horman , Chaotian Jing , Avri Altman , Kyle Roeschley , Hongjie Fang , Adrian Hunter , , , , , Subject: [PATCH v2 2/2] mmc: mmc: Fix HS setting in mmc_hs400_to_hs200() Date: Fri, 15 Feb 2019 13:59:35 +0800 Message-ID: <1550210375-32270-3-git-send-email-chaotian.jing@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1550210375-32270-1-git-send-email-chaotian.jing@mediatek.com> References: <1550210375-32270-1-git-send-email-chaotian.jing@mediatek.com> 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. before send CMD6 to switch card's timing to HS mode, it reduce clock frequency to 50Mhz firstly, the original intention of reduce clock is to make "more stable" when doing HS switch. however,reduce clock frequency to 50Mhz but without host timming change may cause CMD6 response CRC error. because host is still running at hs400 mode, and it's hard to find a suitable setting for all eMMC cards when clock frequency reduced to 50Mhz but card & host still in hs400 mode. so that We consider that CMD6 response CRC error is not a fatal error, if host gets CMD6 response CRC error, it means that card has already received this command. Signed-off-by: Chaotian Jing Fixes: ef3d232245ab ("mmc: mmc: Relax checking for switch errors after HS200 switch") --- drivers/mmc/core/mmc.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 09c688f..03d1c17 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1248,8 +1248,25 @@ int mmc_hs400_to_hs200(struct mmc_card *card) err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, val, card->ext_csd.generic_cmd6_time, 0, true, false, true); - if (err) - goto out_err; + /* + * as we are on the way to do re-tune, so if the CMD6 got response CRC + * error, do not treat it as error. + */ + if (err) { + if (err == -EILSEQ) { + /* + * card will busy after sending out response and host + * driver may not wait busy de-assert when get + * response CRC error. so just wait enough time to + * ensure card leave busy state. + */ + mmc_delay(card->ext_csd.generic_cmd6_time); + pr_debug("%s: %s switch to HS got CRC error\n", + mmc_hostname(host), __func__); + } else { + goto out_err; + } + } mmc_set_timing(host, MMC_TIMING_MMC_DDR52); -- 1.8.1.1.dirty