Skip to content

Commit f338529

Browse files
Sarthak GargUlf Hansson
authored andcommitted
mmc: core: Parse and use the new max-sd-hs-hz DT property
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 <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
1 parent 9868268 commit f338529

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/mmc/core/host.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,8 @@ int mmc_of_parse(struct mmc_host *host)
302302
/* f_max is obtained from the optional "max-frequency" property */
303303
device_property_read_u32(dev, "max-frequency", &host->f_max);
304304

305+
device_property_read_u32(dev, "max-sd-hs-hz", &host->max_sd_hs_hz);
306+
305307
/*
306308
* Configure CD and WP pins. They are both by default active low to
307309
* match the SDHCI spec. If GPIOs are provided for CD and / or WP, the

drivers/mmc/core/sd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ static int mmc_read_switch(struct mmc_card *card)
359359
}
360360

361361
if (status[13] & SD_MODE_HIGH_SPEED)
362-
card->sw_caps.hs_max_dtr = HIGH_SPEED_MAX_DTR;
362+
card->sw_caps.hs_max_dtr = card->host->max_sd_hs_hz ?: HIGH_SPEED_MAX_DTR;
363363

364364
if (card->scr.sda_spec3) {
365365
card->sw_caps.sd3_bus_mode = status[13];

include/linux/mmc/host.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@ struct mmc_host {
576576
int hsq_depth;
577577

578578
u32 err_stats[MMC_ERR_MAX];
579+
u32 max_sd_hs_hz;
579580
unsigned long private[] ____cacheline_aligned;
580581
};
581582

0 commit comments

Comments
 (0)