From owner-svn-src-head@freebsd.org Tue Apr 14 16:35:20 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 506602C4726; Tue, 14 Apr 2020 16:35:20 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 491rgr1V1pz4RQb; Tue, 14 Apr 2020 16:35:20 +0000 (UTC) (envelope-from manu@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 269DC857C; Tue, 14 Apr 2020 16:35:20 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03EGZKv5009885; Tue, 14 Apr 2020 16:35:20 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03EGZIux009877; Tue, 14 Apr 2020 16:35:18 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202004141635.03EGZIux009877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 14 Apr 2020 16:35:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359927 - head/sys/dev/mmc/host X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/mmc/host X-SVN-Commit-Revision: 359927 X-SVN-Commit-Repository: base 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.29 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, 14 Apr 2020 16:35:20 -0000 Author: manu Date: Tue Apr 14 16:35:18 2020 New Revision: 359927 URL: https://svnweb.freebsd.org/changeset/base/359927 Log: arm: dwmmc: Use mmc_fdt_helpers Use the mmc_fdt_parse function instead of parsing everything in the driver. MFC after: 1 month Modified: head/sys/dev/mmc/host/dwmmc.c head/sys/dev/mmc/host/dwmmc_altera.c head/sys/dev/mmc/host/dwmmc_hisi.c head/sys/dev/mmc/host/dwmmc_rockchip.c head/sys/dev/mmc/host/dwmmc_samsung.c head/sys/dev/mmc/host/dwmmc_var.h Modified: head/sys/dev/mmc/host/dwmmc.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc.c Tue Apr 14 16:35:05 2020 (r359926) +++ head/sys/dev/mmc/host/dwmmc.c Tue Apr 14 16:35:18 2020 (r359927) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -446,7 +447,6 @@ dwmmc_card_task(void *arg, int pending __unused) } } else DWMMC_UNLOCK(sc); - } else { /* Card isn't present, detach if necessary */ if (sc->child != NULL) { @@ -466,7 +466,7 @@ parse_fdt(struct dwmmc_softc *sc) { pcell_t dts_value[3]; phandle_t node; - uint32_t bus_hz = 0, bus_width; + uint32_t bus_hz = 0; int len; #ifdef EXT_RESOURCES int error; @@ -475,18 +475,13 @@ parse_fdt(struct dwmmc_softc *sc) if ((node = ofw_bus_get_node(sc->dev)) == -1) return (ENXIO); - /* bus-width */ - if (OF_getencprop(node, "bus-width", &bus_width, sizeof(uint32_t)) <= 0) - bus_width = 4; - if (bus_width >= 4) - sc->host.caps |= MMC_CAP_4_BIT_DATA; - if (bus_width >= 8) - sc->host.caps |= MMC_CAP_8_BIT_DATA; + /* Set some defaults for freq and supported mode */ + sc->host.f_min = 400000; + sc->host.f_max = 200000000; + sc->host.host_ocr = MMC_OCR_320_330 | MMC_OCR_330_340; + sc->host.caps = MMC_CAP_HSPEED | MMC_CAP_SIGNALING_330; + mmc_fdt_parse(sc->dev, node, &sc->mmc_helper, &sc->host); - /* max-frequency */ - if (OF_getencprop(node, "max-frequency", &sc->host.f_max, sizeof(uint32_t)) <= 0) - sc->host.f_max = 200000000; - /* fifo-depth */ if ((len = OF_getproplen(node, "fifo-depth")) > 0) { OF_getencprop(node, "fifo-depth", dts_value, len); @@ -721,11 +716,6 @@ dwmmc_attach(device_t dev) DWMMC_ERR_FLAGS | SDMMC_INTMASK_CD)); WRITE4(sc, SDMMC_CTRL, SDMMC_CTRL_INT_ENABLE); - - sc->host.f_min = 400000; - sc->host.host_ocr = MMC_OCR_320_330 | MMC_OCR_330_340; - sc->host.caps |= MMC_CAP_HSPEED; - sc->host.caps |= MMC_CAP_SIGNALING_330; TASK_INIT(&sc->card_task, 0, dwmmc_card_task, sc); TIMEOUT_TASK_INIT(taskqueue_swi_giant, &sc->card_delayed_task, 0, Modified: head/sys/dev/mmc/host/dwmmc_altera.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc_altera.c Tue Apr 14 16:35:05 2020 (r359926) +++ head/sys/dev/mmc/host/dwmmc_altera.c Tue Apr 14 16:35:18 2020 (r359927) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include Modified: head/sys/dev/mmc/host/dwmmc_hisi.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc_hisi.c Tue Apr 14 16:35:05 2020 (r359926) +++ head/sys/dev/mmc/host/dwmmc_hisi.c Tue Apr 14 16:35:18 2020 (r359927) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include Modified: head/sys/dev/mmc/host/dwmmc_rockchip.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc_rockchip.c Tue Apr 14 16:35:05 2020 (r359926) +++ head/sys/dev/mmc/host/dwmmc_rockchip.c Tue Apr 14 16:35:18 2020 (r359927) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include Modified: head/sys/dev/mmc/host/dwmmc_samsung.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc_samsung.c Tue Apr 14 16:35:05 2020 (r359926) +++ head/sys/dev/mmc/host/dwmmc_samsung.c Tue Apr 14 16:35:18 2020 (r359927) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Modified: head/sys/dev/mmc/host/dwmmc_var.h ============================================================================== --- head/sys/dev/mmc/host/dwmmc_var.h Tue Apr 14 16:35:05 2020 (r359926) +++ head/sys/dev/mmc/host/dwmmc_var.h Tue Apr 14 16:35:18 2020 (r359927) @@ -52,6 +52,7 @@ struct dwmmc_softc { device_t dev; void *intr_cookie; struct mmc_host host; + struct mmc_fdt_helper mmc_helper; struct mtx sc_mtx; struct mmc_request *req; struct mmc_command *curcmd;