Author: manu Date: Tue Apr 14 16:35:18 2020 New Revision: 359927 URL: https://svnweb.freebsd.org/changeset/base/359927
Log: arm: dwmmc: Use mmc_fdt_helpers Use the mmc_fdt_parse function instead of parsing everything in the driver. MFC after: 1 month Modified: head/sys/dev/mmc/host/dwmmc.c head/sys/dev/mmc/host/dwmmc_altera.c head/sys/dev/mmc/host/dwmmc_hisi.c head/sys/dev/mmc/host/dwmmc_rockchip.c head/sys/dev/mmc/host/dwmmc_samsung.c head/sys/dev/mmc/host/dwmmc_var.h Modified: head/sys/dev/mmc/host/dwmmc.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc.c Tue Apr 14 16:35:05 2020 (r359926) +++ head/sys/dev/mmc/host/dwmmc.c Tue Apr 14 16:35:18 2020 (r359927) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include <dev/mmc/bridge.h> #include <dev/mmc/mmcbrvar.h> +#include <dev/mmc/mmc_fdt_helpers.h> #include <dev/fdt/fdt_common.h> #include <dev/ofw/openfirm.h> @@ -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,18 +475,13 @@ 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; + /* 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); - /* max-frequency */ - if (OF_getencprop(node, "max-frequency", &sc->host.f_max, sizeof(uint32_t)) <= 0) - sc->host.f_max = 200000000; - /* fifo-depth */ if ((len = OF_getproplen(node, "fifo-depth")) > 0) { OF_getencprop(node, "fifo-depth", dts_value, len); @@ -721,11 +716,6 @@ dwmmc_attach(device_t dev) DWMMC_ERR_FLAGS | 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, Modified: head/sys/dev/mmc/host/dwmmc_altera.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc_altera.c Tue Apr 14 16:35:05 2020 (r359926) +++ head/sys/dev/mmc/host/dwmmc_altera.c Tue Apr 14 16:35:18 2020 (r359927) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include <machine/bus.h> #include <dev/mmc/bridge.h> +#include <dev/mmc/mmc_fdt_helpers.h> #include <dev/ofw/ofw_bus_subr.h> Modified: head/sys/dev/mmc/host/dwmmc_hisi.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc_hisi.c Tue Apr 14 16:35:05 2020 (r359926) +++ head/sys/dev/mmc/host/dwmmc_hisi.c Tue Apr 14 16:35:18 2020 (r359927) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include <machine/bus.h> #include <dev/mmc/bridge.h> +#include <dev/mmc/mmc_fdt_helpers.h> #include <dev/ofw/ofw_bus_subr.h> Modified: head/sys/dev/mmc/host/dwmmc_rockchip.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc_rockchip.c Tue Apr 14 16:35:05 2020 (r359926) +++ head/sys/dev/mmc/host/dwmmc_rockchip.c Tue Apr 14 16:35:18 2020 (r359927) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include <machine/bus.h> #include <dev/mmc/bridge.h> +#include <dev/mmc/mmc_fdt_helpers.h> #include <dev/ofw/ofw_bus_subr.h> Modified: head/sys/dev/mmc/host/dwmmc_samsung.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc_samsung.c Tue Apr 14 16:35:05 2020 (r359926) +++ head/sys/dev/mmc/host/dwmmc_samsung.c Tue Apr 14 16:35:18 2020 (r359927) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include <machine/bus.h> #include <dev/mmc/bridge.h> +#include <dev/mmc/mmc_fdt_helpers.h> #include <dev/ofw/ofw_bus.h> #include <dev/ofw/ofw_bus_subr.h> Modified: head/sys/dev/mmc/host/dwmmc_var.h ============================================================================== --- head/sys/dev/mmc/host/dwmmc_var.h Tue Apr 14 16:35:05 2020 (r359926) +++ head/sys/dev/mmc/host/dwmmc_var.h Tue Apr 14 16:35:18 2020 (r359927) @@ -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; _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"