Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp136373imj; Wed, 13 Feb 2019 06:01:20 -0800 (PST) X-Google-Smtp-Source: AHgI3IaVtqNuPkFwD8LgmhURzWJ4cKuUFKA4Ecep9XlGNQHNkMJMQp33Jz4qVhVQlHvgU/oUXBTn X-Received: by 2002:a63:200e:: with SMTP id g14mr588785pgg.235.1550066480271; Wed, 13 Feb 2019 06:01:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550066480; cv=none; d=google.com; s=arc-20160816; b=c9tdPcMd2DSAf+BkJUuUqnUgM1/dPpiSg1TIccmF0KvNX13OmSw5eXjZF+YO/ruiX3 jNyvq+DSk2A4YUMIIygTw4e42cyZBDwysjGj8noKOpOrXHiE5oarTsVS3/Seqj7e7y4O 2IS+OdcwxCCHWohhB0WqNnmIiF7aVfroftBapBlSRi7bBYskRJMjE33Labl8SNlomwNz NCUQM8yKSGJJC2URv4gqoKuo9Wxve/pmfY1n199GuCd3nzA0Sk6VHSx0E+82Q3fxQNTC tY4DsTUZekirG1uVnERvilaQqPu1tf9KdxMm0M8kJSZKyDxomBznLiwQcx89HG7NB/0j U6XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Tomadc5NLuTEZWSBt9A/Z/OxsLDygmn8C6sD5u1RnAk=; b=zMJtjc++1SzF5tjTA3xDrvk7JlCKsh7EA0tsxN8lmVEw+u8SHB7I2bMzc+8RNcSK6H eUTw++focZoVbPMxw8rfDmC5tQKmp1scIWu1U33SQM0gY++16a1PHiGEYXnMRQ4r+QYZ m6WiqvHVM9k/Ln/6nsR2T+Z3tUBzG2DpXEWUTVALCK50XbIq371+QcPXKrNKVb6RWnnW TJ+CLROPROjbwEbUkQiT9aR503gyPGKErBehPLInXc/z7Eyh2bReh5LrOOaNCA7rHkD6 I1wGN1W9KtbXXkBT2Rxrp5g83JrR+xhle8yWry/oOcyJUcCH3GNj1Kr8u26V4Wh2LrpC 4Rnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="s/+MFZFQ"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11si16063223plo.184.2019.02.13.06.01.03; Wed, 13 Feb 2019 06:01:20 -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; dkim=pass header.i=@linaro.org header.s=google header.b="s/+MFZFQ"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389380AbfBMMJV (ORCPT + 99 others); Wed, 13 Feb 2019 07:09:21 -0500 Received: from mail-ua1-f68.google.com ([209.85.222.68]:34542 "EHLO mail-ua1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730096AbfBMMJV (ORCPT ); Wed, 13 Feb 2019 07:09:21 -0500 Received: by mail-ua1-f68.google.com with SMTP id a42so211926uad.1 for ; Wed, 13 Feb 2019 04:09:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Tomadc5NLuTEZWSBt9A/Z/OxsLDygmn8C6sD5u1RnAk=; b=s/+MFZFQdJ5wc+fCrcDEdY98PFQKR/CkdOol5xVzknngHj2Mf6EjCRTZYeMbClJyXJ Vt1zdHaQp/xFOIFVa/MV3L5vdiG0+9av6+IYIy8Dgm7NEoBag56GjgFoGq8Vhz0k3lMV F9fShJEFK1IFPGdiXCL8bz0JvsMJqDbig1PH31wnLCSs61EY7WEOi3JST6O6obqQWC4s jApFMc5UjrgfNgTLUr0kFKH29B6thd5h0CLSvIwFGEL2xY0Ik9VFUbOv4nKg5clbUOhn vujiF7hqOujrN3GA+B/IqO0klktNmmlJj4SEV8Zq/xGHFF+ItvbDFeNUXPRkrfEx54aL 1P9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Tomadc5NLuTEZWSBt9A/Z/OxsLDygmn8C6sD5u1RnAk=; b=H4aGRxamFwehHAZ7cUNPZjE+oFefB9SOItAjhWZqOpcOH6KRYQF1TVQVpNdRFx5C2M R50lCIiBn4xQbY96N0t5Y7xjzg+bvnh9W1BWxzItfrni/ffYel9GyiCR0jaAa1d05iJB gybpnfpo0AI9YgKOe7otfoT2cpGZChPfcV45bWcmnWj82Igrv6iSCVNxKLyOqwUHkXBo bW4nr7dIdWLRibwz2ljKO1mT3wZoBfGHFNXrHy1NACZN5osiIAyTD4ByoSTSlO0I80r/ zFh5b/npqrvRfC7hAJjorLyMmNIESNeIuONXKXYjYAEHMN2MfmCNEjMC3QQmbRnESB56 dAvQ== X-Gm-Message-State: AHQUAubLjA9b4x4fsmvxd99o/4Rbx6KiFdQB8vaR4gEkbxCbNYK/LLHS mNIRELnhtY310wIm7h2IwI+Q9Fc8AO3SkGQ5yVEOFw== X-Received: by 2002:ab0:238e:: with SMTP id b14mr48222uan.119.1550059759809; Wed, 13 Feb 2019 04:09:19 -0800 (PST) MIME-Version: 1.0 References: <1550048812-29068-1-git-send-email-chaotian.jing@mediatek.com> In-Reply-To: <1550048812-29068-1-git-send-email-chaotian.jing@mediatek.com> From: Ulf Hansson Date: Wed, 13 Feb 2019 13:08:43 +0100 Message-ID: Subject: Re: [PATCH v1] mmc: mmc: Fix HS setting in mmc_hs400_to_hs200() To: Chaotian Jing Cc: Matthias Brugger , Shawn Lin , Simon Horman , Kyle Roeschley , Hongjie Fang , Harish Jenny K N , "linux-mmc@vger.kernel.org" , Linux Kernel Mailing List , Linux ARM , linux-mediatek@lists.infradead.org, srv_heupstream , Adrian Hunter Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 13 Feb 2019 at 10:07, Chaotian Jing wrote: > > mmc_hs400_to_hs200() begins with the card and host in HS400 mode. > Therefore, any commands sent to the card should use HS400 timing. > reduce clock frequency to 50Mhz but without host timming change > may cause CMD6 response CRC error. because host 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. > this patch refers to mmc_select_hs400(), make the reduce clock frequency > after card timing change. > > Signed-off-by: Chaotian Jing > Fixes: ef3d232245ab ("mmc: mmc: Relax checking for switch errors after HS200 switch") > --- > drivers/mmc/core/mmc.c | 29 +++++++++++++++++++++++------ > 1 file changed, 23 insertions(+), 6 deletions(-) > > diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c > index 09c688f..00adc2d 100644 > --- a/drivers/mmc/core/mmc.c > +++ b/drivers/mmc/core/mmc.c > @@ -1239,20 +1239,37 @@ 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, > 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); > > + /* Reduce frequency to HS */ > + max_dtr = card->ext_csd.hs_max_dtr; > + mmc_set_clock(host, max_dtr); > + What Adrian suggested was to not to move this part, but instead, only allow CRC errors from the CMD6 as above. I guess it didn't work for you? > err = mmc_switch_status(card); > if (err) > goto out_err; > -- > 1.8.1.1.dirty > Kind regards Uffe