Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp428926pxp; Wed, 16 Mar 2022 08:34:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKHutRqlaC6VMDXPsx30AgGT+QOmAYFyDpcUPS1Dd28lQJ1PLLVNJzxeLp0AOPDwXueTr8 X-Received: by 2002:a17:906:2a97:b0:6b4:143f:37c6 with SMTP id l23-20020a1709062a9700b006b4143f37c6mr451113eje.133.1647444845210; Wed, 16 Mar 2022 08:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647444845; cv=none; d=google.com; s=arc-20160816; b=rH6MWQwdjSUPX+I8rPFiaW9j2ZuU7a7z2gXvy7Z3PFmKeKG3U+iG8k6UVQtcdF0An3 qbnj36fpQzttvHGEj/206D93Fock37XXUI8JwDDH7THGoGUClRlxTnjlleK65Tn/G7fK UegUgbeU7SYaIfVsEPKnXzFis/ILqfZj7agp2ZhBNYXQI3hTIyaWKsmoIZNSHgpHYU1z PGW48JNnHVetqDGndWzu8OzwukXSHINzFICflMCSf7GKnH+h6EOFxB4PL6DSXxXYldOx zHeMd6PCyr+wHFBZRSP/Pgyizcnw6N33VVQ7XB0/tWhxz6Cw1baazdteztP+DYJPEVVo t9gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Vt8iM9U7s6FXQoqzpmttJcw/8Lujfl4H2Ez3oc36erU=; b=CWhSRf0KWP1k7csM0XFChQ4m6RPz9BsQWKkaVQyAZZJ3LcgQOfgUAyo/F10b0FNE0R 6k6z5LMCJLSa6xwDAUUdoZ6XSv+eRQBuhoIb2HkB/cLS3qVfXYc9EDu2sSM3tDoDABb6 J5BPu/NRIHRL4xa2dPI469Xp6G5lFJLB8w5srSggU/9VRSRQ9IvwbXMzlxTqx+fpvcQJ baZ/FscrxnnzSIUu8MsIz0cWbpgIN8Ovu6a6Ph8nzV8jIUkiQ/pAYu3JrDddWpDe22HI FHxmtbPv/yzRfuJGN5rCul7bVHLWo+fSDyiWAzGGOUzcOuhaojLivtx/JnloQgua82JA LYfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RpPFND2N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a1709060aca00b006dba372e514si1179584ejf.823.2022.03.16.08.33.37; Wed, 16 Mar 2022 08:34:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RpPFND2N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231628AbiCNWEE (ORCPT + 99 others); Mon, 14 Mar 2022 18:04:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239654AbiCNWD5 (ORCPT ); Mon, 14 Mar 2022 18:03:57 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24D61BE0; Mon, 14 Mar 2022 15:02:46 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id y22so21868272eds.2; Mon, 14 Mar 2022 15:02:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=Vt8iM9U7s6FXQoqzpmttJcw/8Lujfl4H2Ez3oc36erU=; b=RpPFND2NXPVAxUhUxus0zI2b/gYpKTwvCTUJ2WuJT4N/F0jIP0tWl2jk78O++fqy92 TGU9YacYn512Jzhed+Z/vU0gpiP45rwA2b3c4ms6S1nWV8r8Anrka2VXmw0qs4RUq6gg xmpUAeyjttWqFC/QeOawTL81IAtGMGBRgFEime6o80sQccgZAbvX+OImng/bxB+b0DOC 5fBL3Psw4SoCPSXJJa5CVBoznfW0VnrFtLQf4sPVH8gbfasaIBoU4DYZW4dhp6RTMMZE pqW+sRrOiojMdAcYCBBOAllLTN9PRtLQmosKK3uF0p25Ct/+T0erHSgQwgl13bCB5Lt3 i6SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=Vt8iM9U7s6FXQoqzpmttJcw/8Lujfl4H2Ez3oc36erU=; b=4kIzxmvd1BSwRX+thfbeZgkrQUQBozTGCv0QC2T1qMESbhU0hp8SnDSUJ9NFkhpFgR C4PPC5qB/s2B72A/zF65PZHLwNV5uXukLNf0l/LFYN7h1A5DXAcfDNM3hS65D1cZGvEV /PTZ+D6YlDzUA7GukwcFIHIONftL5WeLofxfk67B+gjXG4eg9WrtnKaidMRUYpdN0sdz P+4zJpQWERCk4ym3eyS/OeJUSt9LZekNk9Mch9sjnF9ACrIDmlLPXtw9yuJWBL2H0anj /x5wHPiUcOi451Fg17b9sie9skC37/XI4KhR22Eq07vZtW6S2YxtIfsDT99GGYkTRiEG 2nlA== X-Gm-Message-State: AOAM531f9YxDGOXhi6xC5Jq3YEoW53KN3aQ06cZxIkhK27mceu/2MRwx rYJqUxWcIzDevTJlvgO2iMM= X-Received: by 2002:aa7:dbd6:0:b0:408:4a31:97a5 with SMTP id v22-20020aa7dbd6000000b004084a3197a5mr22923203edt.186.1647295364657; Mon, 14 Mar 2022 15:02:44 -0700 (PDT) Received: from ?IPV6:2a01:c23:bcb5:5a00:21ff:806c:601e:d937? (dynamic-2a01-0c23-bcb5-5a00-21ff-806c-601e-d937.c23.pool.telefonica.de. [2a01:c23:bcb5:5a00:21ff:806c:601e:d937]) by smtp.googlemail.com with ESMTPSA id y13-20020a1709060a8d00b006dabeaf86c7sm7295571ejf.137.2022.03.14.15.02.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Mar 2022 15:02:44 -0700 (PDT) Message-ID: Date: Mon, 14 Mar 2022 23:02:37 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] mmc: core: Improve fallback to speed modes if eMMC HS200 fails Content-Language: en-US To: Ulf Hansson Cc: linux-mmc@vger.kernel.org, Adrian Hunter , Wolfram Sang , Yann Gautier , linux-kernel@vger.kernel.org References: <20220303164522.129583-1-ulf.hansson@linaro.org> From: Heiner Kallweit In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14.03.2022 11:54, Ulf Hansson wrote: > On Thu, 3 Mar 2022 at 17:45, Ulf Hansson wrote: >> >> In the error path of mmc_select_hs200() we are trying our best to restore >> the card/host into a valid state. This makes sense, especially if we >> encounter a simple switch error (-EBADMSG). However, rather than then >> continue with using the legacy speed mode, let's try the other better speed >> modes first. Additionally, let's update the card->mmc_avail_type to avoid >> us from trying a broken HS200 mode again. >> >> In an Amlogic S905W based TV box where the switch to HS200 mode fails for >> the eMMC, this allows us to use the eMMC in DDR mode in favor of the legacy >> mode, which greatly improves the performance. >> >> Suggested-by: Heiner Kallweit >> Signed-off-by: Ulf Hansson > > Heiner, does this solve your problems? Can you perhaps run some tests > at your side to see how it works for you? > Tested-by: Heiner Kallweit > Kind regards > Uffe > Heiner >> --- >> drivers/mmc/core/mmc.c | 16 +++++++++++++--- >> 1 file changed, 13 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c >> index 141f851c9f58..6e7db45cb8e0 100644 >> --- a/drivers/mmc/core/mmc.c >> +++ b/drivers/mmc/core/mmc.c >> @@ -1518,13 +1518,23 @@ static int mmc_select_timing(struct mmc_card *card) >> if (!mmc_can_ext_csd(card)) >> goto bus_speed; >> >> - if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES) >> + if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES) { >> err = mmc_select_hs400es(card); >> - else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200) >> + goto out; >> + } >> + >> + if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200) { >> err = mmc_select_hs200(card); >> - else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS) >> + if (err == -EBADMSG) >> + card->mmc_avail_type &= ~EXT_CSD_CARD_TYPE_HS200; >> + else >> + goto out; >> + } >> + >> + if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS) >> err = mmc_select_hs(card); >> >> +out: >> if (err && err != -EBADMSG) >> return err; >> >> -- >> 2.25.1 >>