diff options
author | andrew <andrew@FreeBSD.org> | 2015-08-27 16:18:22 +0000 |
---|---|---|
committer | andrew <andrew@FreeBSD.org> | 2015-08-27 16:18:22 +0000 |
commit | c4f0492e5db036803fbb5131e9e87f508d685f8b (patch) | |
tree | d5a18915176c6697f3b15ae87f7fdf91dc53e590 /sys/dev/mmc | |
parent | 6d4420afb792ba49e49cf69b369192fa5946fa0c (diff) | |
download | FreeBSD-src-c4f0492e5db036803fbb5131e9e87f508d685f8b.zip FreeBSD-src-c4f0492e5db036803fbb5131e9e87f508d685f8b.tar.gz |
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
Diffstat (limited to 'sys/dev/mmc')
-rw-r--r-- | sys/dev/mmc/host/dwmmc.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/sys/dev/mmc/host/dwmmc.c b/sys/dev/mmc/host/dwmmc.c index b7cca1b..d147b54 100644 --- a/sys/dev/mmc/host/dwmmc.c +++ b/sys/dev/mmc/host/dwmmc.c @@ -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); |