On Thu, Mar 24, 2022 at 5:13 AM Ulf Hansson <ulf.hansson@xxxxxxxxxx> wrote: > On Sat, 19 Mar 2022 at 02:52, Brian Norris <briannorris@xxxxxxxxxxxx> 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