From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA22FC49361 for ; Mon, 21 Jun 2021 07:15:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C87FC61156 for ; Mon, 21 Jun 2021 07:15:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229905AbhFUHRp (ORCPT ); Mon, 21 Jun 2021 03:17:45 -0400 Received: from mga09.intel.com ([134.134.136.24]:7739 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229597AbhFUHRp (ORCPT ); Mon, 21 Jun 2021 03:17:45 -0400 IronPort-SDR: Evwn95OQ7tnohquUHxVdaep0xLjYq4mBIra6Vkg4GeN5NGpipJVGNCaxNYQfeOKUKKiuCJE8eD Fn+BykNjwixg== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="206739224" X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="206739224" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2021 00:15:30 -0700 IronPort-SDR: uaKlk9fvtXZqJwh5czcYOgo38SBnGxOWNUVj3S92KA1bPIrARpPMVmgfh/3Vat4E8CVrFlJzMW qnAKdp2VA1Eg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="405533862" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.79]) ([10.237.72.79]) by orsmga006.jf.intel.com with ESMTP; 21 Jun 2021 00:15:28 -0700 Subject: Re: [PATCH] mmc: disable tuning when checking card presence To: Ulf Hansson , Wolfram Sang Cc: linux-mmc , Linux-Renesas , Yoshihiro Shimoda , Ulrich Hecht References: <20210618082317.58408-1-wsa+renesas@sang-engineering.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: Date: Mon, 21 Jun 2021 10:15:52 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org On 18/06/21 1:42 pm, Ulf Hansson wrote: > + Adrian > > On Fri, 18 Jun 2021 at 10:23, Wolfram Sang > wrote: >> >> When we use the alive callback, we expect a command to fail if the card >> is not present. We should not trigger a retune then which will confuse >> users with a failed retune on a removed card: >> >> mmc2: tuning execution failed: -5 >> mmc2: card 0001 removed >> >> Disable retuning in this code path. >> >> Reported-by: Ulrich Hecht >> Signed-off-by: Wolfram Sang >> --- >> drivers/mmc/core/core.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c >> index 54f0814f110c..eb792dd845a3 100644 >> --- a/drivers/mmc/core/core.c >> +++ b/drivers/mmc/core/core.c >> @@ -2088,6 +2088,9 @@ int _mmc_detect_card_removed(struct mmc_host *host) >> if (!host->card || mmc_card_removed(host->card)) >> return 1; >> >> + /* we expect a failure if the card is removed */ >> + mmc_retune_disable(host); >> + > > Some controllers require a retune after it has been runtime suspended. > > In the above path, when called via the bus_ops->detect() callback, it > could be that the controller may have been runtime suspended and then > got resumed by the call to mmc_get_card(). > > I think we need something more clever here, to make sure we don't end > up in that situation. I have looped in Adrian, to see if has some > ideas for how this can be fixed. Can we clarify, is the only problem that the error message is confusing? > >> ret = host->bus_ops->alive(host); >> >> /* >> @@ -2107,6 +2110,8 @@ int _mmc_detect_card_removed(struct mmc_host *host) >> pr_debug("%s: card remove detected\n", mmc_hostname(host)); >> } >> >> + mmc_retune_enable(host); >> + >> return ret; >> } >> >> -- >> 2.30.2 >> > > Kind regards > Uffe >