From owner-svn-src-all@freebsd.org Thu Aug 27 16:18:23 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C5E59C3EF2; Thu, 27 Aug 2015 16:18:23 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D151981; Thu, 27 Aug 2015 16:18:23 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7RGINEo027801; Thu, 27 Aug 2015 16:18:23 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7RGINpl027800; Thu, 27 Aug 2015 16:18:23 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201508271618.t7RGINpl027800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 27 Aug 2015 16:18:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287212 - head/sys/dev/mmc/host X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2015 16:18:23 -0000 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);