Index: dev/sdhci/sdhci.c =================================================================== --- dev/sdhci/sdhci.c (revision 246891) +++ dev/sdhci/sdhci.c (working copy) @@ -69,6 +69,9 @@ TUNABLE_INT("hw.sdhci.debug", &sdhci_debug); SYSCTL_INT(_hw_sdhci, OID_AUTO, debug, CTLFLAG_RW, &sdhci_debug, 0, "Debug level"); +int sdhci_max_freq = 25000000; +TUNABLE_INT("hw.sdhci.max_freq", &sdhci_max_freq); + #define RD1(slot, off) SDHCI_READ_1((slot)->bus, (slot), (off)) #define RD2(slot, off) SDHCI_READ_2((slot)->bus, (slot), (off)) #define RD4(slot, off) SDHCI_READ_4((slot)->bus, (slot), (off)) @@ -231,8 +234,16 @@ if (clock == slot->clock) return; - slot->clock = clock; + if (clock <= sdhci_max_freq) + slot->clock = clock; + else { + device_printf(slot->dev, "%d is more then max_freq, using %d\n", clock, + sdhci_max_freq); + slot->clock = sdhci_max_freq; + clock = sdhci_max_freq; + } + /* Turn off the clock. */ WR2(slot, SDHCI_CLOCK_CONTROL, 0); /* If no clock requested - left it so. */