summaryrefslogtreecommitdiffstats
path: root/sys/arm/freescale
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arm/freescale')
-rw-r--r--sys/arm/freescale/imx/imx_sdhci.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/arm/freescale/imx/imx_sdhci.c b/sys/arm/freescale/imx/imx_sdhci.c
index 6acc86e..17edf07 100644
--- a/sys/arm/freescale/imx/imx_sdhci.c
+++ b/sys/arm/freescale/imx/imx_sdhci.c
@@ -522,12 +522,19 @@ imx_sdhc_set_clock(struct imx_sdhci_softc *sc, int enable)
else
freq = sc->baseclk_hz / (2 * divisor);
- for (prescale = 2; prescale < freq / prescale / 16;)
+ for (prescale = 2; freq < sc->baseclk_hz / (prescale * 16);)
prescale <<= 1;
- for (divisor = 1; freq < freq / prescale / divisor;)
+ for (divisor = 1; freq < sc->baseclk_hz / (prescale * divisor);)
++divisor;
+#ifdef DEBUG
+ device_printf(sc->dev,
+ "desired SD freq: %d, actual: %d; base %d prescale %d divisor %d\n",
+ freq, sc->baseclk_hz / (prescale * divisor), sc->baseclk_hz,
+ prescale, divisor);
+#endif
+
prescale >>= 1;
divisor -= 1;
OpenPOWER on IntegriCloud