Date: Thu, 27 Aug 2015 16:18:23 +0000 (UTC) From: Andrew Turner <andrew@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287212 - head/sys/dev/mmc/host Message-ID: <201508271618.t7RGINpl027800@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: andrew Date: Thu Aug 27 16:18:22 2015 New Revision: 287212 URL: https://svnweb.freebsd.org/changeset/base/287212 Log: 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 Modified: head/sys/dev/mmc/host/dwmmc.c Modified: head/sys/dev/mmc/host/dwmmc.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc.c Thu Aug 27 15:27:41 2015 (r287211) +++ head/sys/dev/mmc/host/dwmmc.c Thu Aug 27 16:18:22 2015 (r287212) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508271618.t7RGINpl027800>