arm: dwmmc: Use mmc_fdt_helpers

Use the mmc_fdt_parse function instead of parsing everything in the
driver.

MFC after:	1 month
This commit is contained in:
manu 2020-04-14 16:35:18 +00:00
parent 9cf35cacaf
commit 5f6d9b71b7
6 changed files with 13 additions and 18 deletions

View File

@ -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,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);

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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;