[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+ASDXM_RdU3qucLSZ421rw3uzDdf0-_459os-Ox_JFM8kn1bQ@mail.gmail.com>
Date: Wed, 30 Mar 2022 13:28:55 -0700
From: Brian Norris <briannorris@...omium.org>
To: Ulf Hansson <ulf.hansson@...aro.org>
Cc: Douglas Anderson <dianders@...omium.org>,
Adrian Hunter <adrian.hunter@...el.com>,
linux-mmc@...r.kernel.org,
Linux Kernel <linux-kernel@...r.kernel.org>,
Shawn Lin <shawn.lin@...k-chips.com>,
Heiner Kallweit <hkallweit1@...il.com>
Subject: Re: [PATCH v2] mmc: core: Set HS clock speed before sending HS CMD13
On Thu, Mar 24, 2022 at 5:13 AM Ulf Hansson <ulf.hansson@...aro.org> wrote:
> On Sat, 19 Mar 2022 at 02:52, Brian Norris <briannorris@...omium.org> wrote:
> > @@ -1482,6 +1487,12 @@ static int mmc_select_hs200(struct mmc_card *card)
> > old_timing = host->ios.timing;
> > mmc_set_timing(host, MMC_TIMING_MMC_HS200);
> >
> > + /*
> > + * Bump to HS200 frequency. Some cards don't handle SEND_STATUS
> > + * reliably at the initial frequency.
> > + */
> > + mmc_set_clock(host, card->ext_csd.hs200_max_dtr);
> > +
>
> If the mmc_switch_status() fails with -EBADMSG, we should probably
> restore the clock to its previous value. Otherwise I think we could
> potentially break the fallback implemented in 3b6c472822f8 ("mmc:
> core: Improve fallback to speed modes if eMMC HS200 fails")
OK, done for v3.
> Moreover, this change means that we will be calling
> mmc_set_bus_speed() from mmc_select_timing(), to actually set the same
> HS200 clock rate again. That is unnecessary, can we please avoid that
> in some way.
There's not a super clean way to track which paths pre-bumped the
frequency, especially once you account for host->f_max (as
mmc_set_clock() does). I've chosen to teach mmc_set_clock() how to
return early if the clock change is redundant.
Brian
Powered by blists - more mailing lists