]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mmc: core: Parse and use the new max-sd-hs-hz DT property
authorSarthak Garg <quic_sartgarg@quicinc.com>
Mon, 8 Sep 2025 10:41:21 +0000 (16:11 +0530)
committerUlf Hansson <ulf.hansson@linaro.org>
Fri, 12 Sep 2025 12:49:36 +0000 (14:49 +0200)
Introduce a new device tree flag to cap the maximum High-Speed (HS)
mode frequency for SD cards, accommodating board-specific
electrical limitations which cannot support the default 50Mhz HS
frequency and others.

Signed-off-by: Sarthak Garg <quic_sartgarg@quicinc.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/host.c
drivers/mmc/core/sd.c
include/linux/mmc/host.h

index 5f0ec23aeff553a98837e5ad3a96b35742ace10c..88c95dbfd9cfd51aad2fc6ffbdff99d7347c83ee 100644 (file)
@@ -302,6 +302,8 @@ int mmc_of_parse(struct mmc_host *host)
        /* f_max is obtained from the optional "max-frequency" property */
        device_property_read_u32(dev, "max-frequency", &host->f_max);
 
+       device_property_read_u32(dev, "max-sd-hs-hz", &host->max_sd_hs_hz);
+
        /*
         * Configure CD and WP pins. They are both by default active low to
         * match the SDHCI spec. If GPIOs are provided for CD and / or WP, the
index ec02067f03c5c57788f5ed65471fc9e89348ee77..67cd630048297623119f01e40b79f38df831737d 100644 (file)
@@ -359,7 +359,7 @@ static int mmc_read_switch(struct mmc_card *card)
        }
 
        if (status[13] & SD_MODE_HIGH_SPEED)
-               card->sw_caps.hs_max_dtr = HIGH_SPEED_MAX_DTR;
+               card->sw_caps.hs_max_dtr = card->host->max_sd_hs_hz ?: HIGH_SPEED_MAX_DTR;
 
        if (card->scr.sda_spec3) {
                card->sw_caps.sd3_bus_mode = status[13];
index e0d935a4ac1d5a2d5eab037c9f40b8fffb6f2e30..e0e2c265e5d10100e1a54089a4c3f4fc4654d847 100644 (file)
@@ -576,6 +576,7 @@ struct mmc_host {
        int                     hsq_depth;
 
        u32                     err_stats[MMC_ERR_MAX];
+       u32                     max_sd_hs_hz;
        unsigned long           private[] ____cacheline_aligned;
 };