Allow the fifo-depth and num-slots to be missing. For the former we read

the value from the hardware, for the latter assume a single slot.

Sponsored by:	ABT Systems Ltd
This commit is contained in:
Andrew Turner 2015-08-27 16:18:22 +00:00
parent a86e5c96af
commit 488d593a0c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=287212

View File

@ -466,16 +466,17 @@ parse_fdt(struct dwmmc_softc *sc)
return (ENXIO);
/* fifo-depth */
if ((len = OF_getproplen(node, "fifo-depth")) <= 0)
return (ENXIO);
OF_getencprop(node, "fifo-depth", dts_value, len);
sc->fifo_depth = dts_value[0];
if ((len = OF_getproplen(node, "fifo-depth")) > 0) {
OF_getencprop(node, "fifo-depth", dts_value, len);
sc->fifo_depth = dts_value[0];
}
/* num-slots */
if ((len = OF_getproplen(node, "num-slots")) <= 0)
return (ENXIO);
OF_getencprop(node, "num-slots", dts_value, len);
sc->num_slots = dts_value[0];
sc->num_slots = 1;
if ((len = OF_getproplen(node, "num-slots")) > 0) {
OF_getencprop(node, "num-slots", dts_value, len);
sc->num_slots = dts_value[0];
}
/*
* We need some platform-specific code to know
@ -610,6 +611,13 @@ dwmmc_attach(device_t dev)
dwmmc_setup_bus(sc, sc->host.f_min);
if (sc->fifo_depth == 0) {
sc->fifo_depth = 1 +
((READ4(sc, SDMMC_FIFOTH) >> SDMMC_FIFOTH_RXWMARK_S) & 0xfff);
device_printf(dev, "No fifo-depth, using FIFOTH %x\n",
sc->fifo_depth);
}
if (!sc->use_pio) {
if (dma_setup(sc))
return (ENXIO);