git: a6222e182c74 - stable/13 - mmc(4): Don't call bridge driver for timings not requiring tuning
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 06 Aug 2023 20:36:19 UTC
The branch stable/13 has been updated by marius: URL: https://cgit.FreeBSD.org/src/commit/?id=a6222e182c7464903f60f288b7784a31d702ce8c commit a6222e182c7464903f60f288b7784a31d702ce8c Author: Marius Strobl <marius@FreeBSD.org> AuthorDate: 2023-04-12 21:46:02 +0000 Commit: Marius Strobl <marius@FreeBSD.org> CommitDate: 2023-08-06 17:03:45 +0000 mmc(4): Don't call bridge driver for timings not requiring tuning The original idea behind calling into the bridge driver was to have the logic deciding whether tuning is actually required for a particular bus timing in a given slot as well as doing the sanity checking only on the controller layer which also generally is better suited for these due to say SDHCI_SDR50_NEEDS_TUNING. On another thought, not every such driver should need to check whether tuning is required at all, though, and not everything is SDHCI in the first place. Adjust sdhci(4) accordingly keeping sdhci_generic_tune() a bit cautious still. (cherry picked from commit bd15d31cef50060d90356384ba7b878d398fc9f3) --- sys/dev/mmc/mmc.c | 9 +++++++++ sys/dev/sdhci/sdhci.c | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/dev/mmc/mmc.c b/sys/dev/mmc/mmc.c index 4e4e3507a1f8..e725cd1c66cb 100644 --- a/sys/dev/mmc/mmc.c +++ b/sys/dev/mmc/mmc.c @@ -2243,6 +2243,15 @@ clock: mmcbr_set_clock(dev, max_dtr); mmcbr_update_ios(dev); + /* + * Don't call into the bridge driver for timings definitely + * not requiring tuning. Note that it's up to the upper + * layer to actually execute tuning otherwise. + */ + if (timing <= bus_timing_uhs_sdr25 || + timing == bus_timing_mmc_ddr52) + goto power_class; + if (mmcbr_tune(dev, hs400) != 0) { device_printf(dev, "Card at relative address %d " "failed to execute initial tuning\n", rca); diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c index 6094e49f2cfa..8ea016093686 100644 --- a/sys/dev/sdhci/sdhci.c +++ b/sys/dev/sdhci/sdhci.c @@ -1373,10 +1373,12 @@ sdhci_generic_tune(device_t brdev __unused, device_t reqdev, bool hs400) case bus_timing_uhs_sdr50: if (slot->opt & SDHCI_SDR50_NEEDS_TUNING) break; - /* FALLTHROUGH */ - default: SDHCI_UNLOCK(slot); return (0); + default: + slot_printf(slot, "Tuning requested but not required.\n"); + SDHCI_UNLOCK(slot); + return (EINVAL); } tune_cmd = slot->tune_cmd;