Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp4042326pxp; Tue, 15 Mar 2022 11:12:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQ4x/n8h6Nhzw9ufNeho5r6l1piGrY9chZNQyMlChTnCA8a8UwGDNvgZrwc/QqgVudLN2k X-Received: by 2002:a17:907:7b86:b0:6da:8a95:35bf with SMTP id ne6-20020a1709077b8600b006da8a9535bfmr23197371ejc.652.1647367953889; Tue, 15 Mar 2022 11:12:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647367953; cv=none; d=google.com; s=arc-20160816; b=cwaw4aTmUNrxUdgV64OKExzbP2a1vLsvuzv+9jgs4ghIvm1ug6i+J30lNB9pSjVRO3 UYkDVsReHfZWNWA8tUU9L5MV4rlw2w6pUByGUZ3gt7N+lfPgFqr28rH+CInQyCE7q0Zd UIE80EUitQfxqkAq4iTMtxP2uVHXkkYYtWIDtioUyr2k+gosUQf9rHzfOeAloRqgKfLW qOU3Dn2+oPvloJjnkRHSwrGenFUFa5fCWipF+yv9S5DQVgE+xlDi8f2wn+QRCH1kGXGR gVTI3Jb6MGN8RWWD6zq+eJAgJUGL5snQPuetnjl6ZMojjQGxDmxpbCXKGNeK0S1hvg/n aUdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=vRzVdmii+d1cRN7UUZvjKYaaOk5b0ubFZRbbFk1xnRM=; b=ik+XZzZ94R5lEnrTQwTh9+cAF/RpNFEdXlZbz544HPG9yWbYs8DVkg+IPgLTeJBXto ExfQijE5tXouzJ8Im1JKI5/Vc8j2iANMbZjB1DCtQKDKwfx0UTbfbmjVGhzG2kcCRXqZ p82QBBxsq2JqRa/9aVWPlfHftSdSQmhRJIV7G8s/aZ8Xsebxww+lVcgy4y/7ewBCr5eh Kiil0fvnbu4lA8FHpM6F6prqFMfMQGR/ua1dKE0B2gm3YE0n42T5oT1vDFknhZ2BT33n c5lBCv4A+hDyFSXJ2vb535pZimErHo6p+GItOX8CIY+AZxGkBqF91Ex5zYu4KHDACaHn TeQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WOfWrWmy; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t22-20020a1709060c5600b006cee03e4d20si11413129ejf.761.2022.03.15.11.12.07; Tue, 15 Mar 2022 11:12:33 -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=@linaro.org header.s=google header.b=WOfWrWmy; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238720AbiCNKz5 (ORCPT + 99 others); Mon, 14 Mar 2022 06:55:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238724AbiCNKzz (ORCPT ); Mon, 14 Mar 2022 06:55:55 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50F442AC50 for ; Mon, 14 Mar 2022 03:54:44 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id g17so26342450lfh.2 for ; Mon, 14 Mar 2022 03:54:43 -0700 (PDT) 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=vRzVdmii+d1cRN7UUZvjKYaaOk5b0ubFZRbbFk1xnRM=; b=WOfWrWmy0naPgZhVqDU9oBsnW9w/GajwOvDdBr8tdiTSrCzoO5S0M0dPAbIpU5oBbv gBHGP5e1shXAYGvRzTab6g/ag4v8nCkOCkvvZ6Sq4xt2XOQaXfDNLPoxIpEwwcit3adK jGSwFUAgxuwohakllItBGBYEkY8j/FrPnFfNH1aPtyJ6rqIjWbNI5fVFAFgB4NHVB1ca 9QiMkrr8EygobsrU0AKovYRFPhNOA1MIBLD2B2GA5dRlEULv8ccSnM3sK71+mpizNyLs +pJK7eTiM9aO6Rr2H9mMduAZIV/M5vYhcle29fwiIJYA+XXmsr9Dw4dOTzlIedNXNCJd 99ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vRzVdmii+d1cRN7UUZvjKYaaOk5b0ubFZRbbFk1xnRM=; b=dJQR0fB+4Kw162I6MipHiYowaVeBUt0hEvlmrlDKNJ22YAUQ3TikjIKrJ1875fE2QJ ddgam4nR9iHk4MJigEKocqjaj4UjsBQrVD5duNPzU7AMXCdH0Xl/DXgxPrf+i1edoUP4 dpelSAt5SXiSvv71UwOapja/ymZSiu2pTB4kRy8xFLN/Qjq9p27qTbkvyfJq9GfGFj0D fZQcTwxHNWnWfNZlKhS5iT/nw5tJS2URKkcKwUGLTJHB0K7skuW9p3I74krCyPo6c1KP YqPS85swDUaT0V79LWDR6wTEpxlM6+VN2KJYg4JxvxhaAGA5D5PeMKK04BQ9raZSzmf2 tsfg== X-Gm-Message-State: AOAM531tcqggJLuk6rV0kOo/A6MXLv5OyLxfgRYYV5JLCQM/Uxn7f/ch cp+NAkvTgz63b8olqlUBg4Ts3bIOZB9QNwrAMtdH9Q== X-Received: by 2002:ac2:4e98:0:b0:448:3039:d170 with SMTP id o24-20020ac24e98000000b004483039d170mr13956278lfr.233.1647255282348; Mon, 14 Mar 2022 03:54:42 -0700 (PDT) MIME-Version: 1.0 References: <20220303164522.129583-1-ulf.hansson@linaro.org> In-Reply-To: <20220303164522.129583-1-ulf.hansson@linaro.org> From: Ulf Hansson Date: Mon, 14 Mar 2022 11:54:06 +0100 Message-ID: Subject: Re: [PATCH] mmc: core: Improve fallback to speed modes if eMMC HS200 fails To: Heiner Kallweit Cc: linux-mmc@vger.kernel.org, Adrian Hunter , Wolfram Sang , Yann Gautier , linux-kernel@vger.kernel.org, Ulf Hansson Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 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? Kind regards Uffe > --- > 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 >