diff --git a/sys/dev/mmc/host/dwmmc.c b/sys/dev/mmc/host/dwmmc.c index 76ac61d94776..c3922d08c1dd 100644 --- a/sys/dev/mmc/host/dwmmc.c +++ b/sys/dev/mmc/host/dwmmc.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -446,7 +447,6 @@ dwmmc_card_task(void *arg, int pending __unused) } } else DWMMC_UNLOCK(sc); - } else { /* Card isn't present, detach if necessary */ if (sc->child != NULL) { @@ -466,7 +466,7 @@ parse_fdt(struct dwmmc_softc *sc) { pcell_t dts_value[3]; phandle_t node; - uint32_t bus_hz = 0, bus_width; + uint32_t bus_hz = 0; int len; #ifdef EXT_RESOURCES int error; @@ -475,17 +475,12 @@ parse_fdt(struct dwmmc_softc *sc) if ((node = ofw_bus_get_node(sc->dev)) == -1) return (ENXIO); - /* bus-width */ - if (OF_getencprop(node, "bus-width", &bus_width, sizeof(uint32_t)) <= 0) - bus_width = 4; - if (bus_width >= 4) - sc->host.caps |= MMC_CAP_4_BIT_DATA; - if (bus_width >= 8) - sc->host.caps |= MMC_CAP_8_BIT_DATA; - - /* max-frequency */ - if (OF_getencprop(node, "max-frequency", &sc->host.f_max, sizeof(uint32_t)) <= 0) - sc->host.f_max = 200000000; + /* Set some defaults for freq and supported mode */ + sc->host.f_min = 400000; + sc->host.f_max = 200000000; + sc->host.host_ocr = MMC_OCR_320_330 | MMC_OCR_330_340; + sc->host.caps = MMC_CAP_HSPEED | MMC_CAP_SIGNALING_330; + mmc_fdt_parse(sc->dev, node, &sc->mmc_helper, &sc->host); /* fifo-depth */ if ((len = OF_getproplen(node, "fifo-depth")) > 0) { @@ -722,11 +717,6 @@ dwmmc_attach(device_t dev) SDMMC_INTMASK_CD)); WRITE4(sc, SDMMC_CTRL, SDMMC_CTRL_INT_ENABLE); - sc->host.f_min = 400000; - sc->host.host_ocr = MMC_OCR_320_330 | MMC_OCR_330_340; - sc->host.caps |= MMC_CAP_HSPEED; - sc->host.caps |= MMC_CAP_SIGNALING_330; - TASK_INIT(&sc->card_task, 0, dwmmc_card_task, sc); TIMEOUT_TASK_INIT(taskqueue_swi_giant, &sc->card_delayed_task, 0, dwmmc_card_task, sc); diff --git a/sys/dev/mmc/host/dwmmc_altera.c b/sys/dev/mmc/host/dwmmc_altera.c index 016d9330895c..54c227254ff4 100644 --- a/sys/dev/mmc/host/dwmmc_altera.c +++ b/sys/dev/mmc/host/dwmmc_altera.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include diff --git a/sys/dev/mmc/host/dwmmc_hisi.c b/sys/dev/mmc/host/dwmmc_hisi.c index 5f08fb937b45..5d6a95cfdd37 100644 --- a/sys/dev/mmc/host/dwmmc_hisi.c +++ b/sys/dev/mmc/host/dwmmc_hisi.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include diff --git a/sys/dev/mmc/host/dwmmc_rockchip.c b/sys/dev/mmc/host/dwmmc_rockchip.c index 273f9d703178..25baffb267e3 100644 --- a/sys/dev/mmc/host/dwmmc_rockchip.c +++ b/sys/dev/mmc/host/dwmmc_rockchip.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include diff --git a/sys/dev/mmc/host/dwmmc_samsung.c b/sys/dev/mmc/host/dwmmc_samsung.c index 9f2137a5c74e..4443cda58736 100644 --- a/sys/dev/mmc/host/dwmmc_samsung.c +++ b/sys/dev/mmc/host/dwmmc_samsung.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include diff --git a/sys/dev/mmc/host/dwmmc_var.h b/sys/dev/mmc/host/dwmmc_var.h index c586ffb55457..a9a77223f9e1 100644 --- a/sys/dev/mmc/host/dwmmc_var.h +++ b/sys/dev/mmc/host/dwmmc_var.h @@ -52,6 +52,7 @@ struct dwmmc_softc { device_t dev; void *intr_cookie; struct mmc_host host; + struct mmc_fdt_helper mmc_helper; struct mtx sc_mtx; struct mmc_request *req; struct mmc_command *curcmd;