From owner-svn-src-all@freebsd.org Mon Oct 14 15:53:00 2019 Return-Path: Delivered-To: svn-src-all@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 A8E7FFF0D5; Mon, 14 Oct 2019 15:53:00 +0000 (UTC) (envelope-from br@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 46sNPS3wmwz4WFf; Mon, 14 Oct 2019 15:53:00 +0000 (UTC) (envelope-from br@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 528147884; Mon, 14 Oct 2019 15:53:00 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9EFr0ft010168; Mon, 14 Oct 2019 15:53:00 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9EFr0Zb010167; Mon, 14 Oct 2019 15:53:00 GMT (envelope-from br@FreeBSD.org) Message-Id: <201910141553.x9EFr0Zb010167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 14 Oct 2019 15:53:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353493 - head/sys/dev/mmc/host X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/dev/mmc/host X-SVN-Commit-Revision: 353493 X-SVN-Commit-Repository: base 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.29 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: Mon, 14 Oct 2019 15:53:00 -0000 Author: br Date: Mon Oct 14 15:52:59 2019 New Revision: 353493 URL: https://svnweb.freebsd.org/changeset/base/353493 Log: Fix the driver attachment in cases when the external resource devices (resets, regulators, clocks) are not available. Rely on a system initialization done by a bootloader in that cases. This fixes operation on Terasic DE10-Pro (an Intel Stratix 10 development kit). Sponsored by: DARPA, AFRL Modified: head/sys/dev/mmc/host/dwmmc.c Modified: head/sys/dev/mmc/host/dwmmc.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc.c Mon Oct 14 15:33:53 2019 (r353492) +++ head/sys/dev/mmc/host/dwmmc.c Mon Oct 14 15:52:59 2019 (r353493) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Ruslan Bukin + * Copyright (c) 2014-2019 Ruslan Bukin * All rights reserved. * * This software was developed by SRI International and the University of @@ -457,26 +457,20 @@ parse_fdt(struct dwmmc_softc *sc) /* IP block reset is optional */ error = hwreset_get_by_ofw_name(sc->dev, 0, "reset", &sc->hwreset); - if (error != 0 && error != ENOENT) { + if (error != 0 && error != ENOENT) device_printf(sc->dev, "Cannot get reset\n"); - goto fail; - } /* vmmc regulator is optional */ error = regulator_get_by_ofw_property(sc->dev, 0, "vmmc-supply", &sc->vmmc); - if (error != 0 && error != ENOENT) { + if (error != 0 && error != ENOENT) device_printf(sc->dev, "Cannot get regulator 'vmmc-supply'\n"); - goto fail; - } /* vqmmc regulator is optional */ error = regulator_get_by_ofw_property(sc->dev, 0, "vqmmc-supply", &sc->vqmmc); - if (error != 0 && error != ENOENT) { + if (error != 0 && error != ENOENT) device_printf(sc->dev, "Cannot get regulator 'vqmmc-supply'\n"); - goto fail; - } /* Assert reset first */ if (sc->hwreset != NULL) { @@ -489,10 +483,9 @@ parse_fdt(struct dwmmc_softc *sc) /* BIU (Bus Interface Unit clock) is optional */ error = clk_get_by_ofw_name(sc->dev, 0, "biu", &sc->biu); - if (error != 0 && error != ENOENT) { + if (error != 0 && error != ENOENT) device_printf(sc->dev, "Cannot get 'biu' clock\n"); - goto fail; - } + if (sc->biu) { error = clk_enable(sc->biu); if (error != 0) { @@ -506,10 +499,9 @@ parse_fdt(struct dwmmc_softc *sc) * if no clock-frequency property is given */ error = clk_get_by_ofw_name(sc->dev, 0, "ciu", &sc->ciu); - if (error != 0 && error != ENOENT) { - device_printf(sc->dev, "Cannot get 'ciu'clock\n"); - goto fail; - } + if (error != 0 && error != ENOENT) + device_printf(sc->dev, "Cannot get 'ciu' clock\n"); + if (sc->ciu) { if (bus_hz != 0) { error = clk_set_freq(sc->ciu, bus_hz, 0);