From owner-svn-src-head@freebsd.org Tue Apr 26 12:02:37 2016 Return-Path: Delivered-To: svn-src-head@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 7CB65B1C2F6; Tue, 26 Apr 2016 12:02:37 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 488E6171B; Tue, 26 Apr 2016 12:02:37 +0000 (UTC) (envelope-from jmcneill@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3QC2aMn080940; Tue, 26 Apr 2016 12:02:36 GMT (envelope-from jmcneill@FreeBSD.org) Received: (from jmcneill@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3QC2aJm080939; Tue, 26 Apr 2016 12:02:36 GMT (envelope-from jmcneill@FreeBSD.org) Message-Id: <201604261202.u3QC2aJm080939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmcneill set sender to jmcneill@FreeBSD.org using -f From: Jared McNeill Date: Tue, 26 Apr 2016 12:02:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298630 - head/sys/arm/allwinner X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 12:02:37 -0000 Author: jmcneill Date: Tue Apr 26 12:02:36 2016 New Revision: 298630 URL: https://svnweb.freebsd.org/changeset/base/298630 Log: Add support for 8-bit eMMC. Set MMC_CAP_4_BIT_DATA and MMC_CAP_8_BIT_DATA based on the "bus-width" DT property and reduce maximum bus frequency from 52MHz to 50MHz to match the capabilities of the clock provider. Tested on a BananaPi BPI-M3 (A83T). Modified: head/sys/arm/allwinner/a10_mmc.c Modified: head/sys/arm/allwinner/a10_mmc.c ============================================================================== --- head/sys/arm/allwinner/a10_mmc.c Tue Apr 26 12:00:04 2016 (r298629) +++ head/sys/arm/allwinner/a10_mmc.c Tue Apr 26 12:02:36 2016 (r298630) @@ -152,8 +152,11 @@ a10_mmc_attach(device_t dev) struct a10_mmc_softc *sc; struct sysctl_ctx_list *ctx; struct sysctl_oid_list *tree; + uint32_t bus_width; + phandle_t node; int error; + node = ofw_bus_get_node(dev); sc = device_get_softc(dev); sc->a10_dev = dev; sc->a10_req = NULL; @@ -251,11 +254,18 @@ a10_mmc_attach(device_t dev) device_printf(sc->a10_dev, "DMA status: %s\n", a10_mmc_pio_mode ? "disabled" : "enabled"); + if (OF_getencprop(node, "bus-width", &bus_width, sizeof(uint32_t)) <= 0) + bus_width = 1; + sc->a10_host.f_min = 400000; - sc->a10_host.f_max = 52000000; + sc->a10_host.f_max = 50000000; sc->a10_host.host_ocr = MMC_OCR_320_330 | MMC_OCR_330_340; - sc->a10_host.caps = MMC_CAP_4_BIT_DATA | MMC_CAP_HSPEED; sc->a10_host.mode = mode_sd; + sc->a10_host.caps = MMC_CAP_HSPEED; + if (bus_width >= 4) + sc->a10_host.caps |= MMC_CAP_4_BIT_DATA; + if (bus_width >= 8) + sc->a10_host.caps |= MMC_CAP_8_BIT_DATA; child = device_add_child(dev, "mmc", -1); if (child == NULL) {