From owner-svn-src-head@freebsd.org Mon Oct 14 16:11:01 2019 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 938E1FF652; Mon, 14 Oct 2019 16:11:01 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46sNpD0RfTz4X04; Mon, 14 Oct 2019 16:10:59 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 63d169eb; Mon, 14 Oct 2019 18:10:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=epLA7UcjgU8LNSV4rrmkA9Rf6e0=; b=d7fhfC5vKHhF0rRtAxL4wDp4ImyR +I0jCp92kpZRJbuNYNWmEFZ2/nGBlTPOm868gX6O8B4vF5V8PNZcd3VX8t5AMkzx 3QIyy1Qoji1sWMBOZ7+Fi5wbqbRQcUaGRmCL9swraew1efGuwfzZ+o5sHKjXHOLi 1TNg3eKuS6+35Cc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=bbZ8ubPUasdcYmK+ve30xaELYVL6SUpaal0LcyoqiRpwcdZ7VsLqZNfa E7IuXOAPHb8DYQjIr2BomV2pxQO4pYExYMZDvmQe3u4j6kaXQHbBwGTKaNKr6LpJ 2la1wedIPNke1ewpYuMVThBj5Cyb3RRoA7PTrwHgW1s4+WgeR6Y= Received: from skull.home.blih.net (ip-9.net-89-3-105.rev.numericable.fr [89.3.105.9]) by mail.blih.net (OpenSMTPD) with ESMTPSA id dd50d674 TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Mon, 14 Oct 2019 18:10:52 +0200 (CEST) Date: Mon, 14 Oct 2019 18:10:51 +0200 From: Emmanuel Vadot To: Ruslan Bukin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353493 - head/sys/dev/mmc/host Message-Id: <20191014181051.bd8c7a3dbb7b07a636d81ed9@bidouilliste.com> In-Reply-To: <201910141553.x9EFr0Zb010167@repo.freebsd.org> References: <201910141553.x9EFr0Zb010167@repo.freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46sNpD0RfTz4X04 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bidouilliste.com header.s=mail header.b=d7fhfC5v; dmarc=none; spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates 212.83.177.182 as permitted sender) smtp.mailfrom=manu@bidouilliste.com X-Spamd-Result: default: False [-0.53 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mail]; NEURAL_HAM_MEDIUM(-0.14)[-0.145,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:212.83.177.182/32]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MV_CASE(0.50)[]; DMARC_NA(0.00)[bidouilliste.com]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-0.86)[-0.861,0]; DKIM_TRACE(0.00)[bidouilliste.com:+]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; IP_SCORE(0.38)[ip: (-0.70), ipnet: 212.83.160.0/19(2.47), asn: 12876(0.12), country: FR(-0.00)]; ASN(0.00)[asn:12876, ipnet:212.83.160.0/19, country:FR]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] 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: Mon, 14 Oct 2019 16:11:01 -0000 Hi Ruslan, On Mon, 14 Oct 2019 15:53:00 +0000 (UTC) Ruslan Bukin wrote: > 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; > - } This is not correct, on a system without reset/clock/regulator support you will get ENODEV as the phandle is present but no device is associated with it. This is the case that you want to test. Currently this hide all errors. But you should really consider implementing reset/clock/regulator the correct way for your platform otherwise a lot of thing will not work and relying on bootloader leftover is a bad habit. Even simple thing like sd probing can fail is the sd module clock is really high and the controller internal divider cannot be large enough to reach the 400khz discovery frequency. > /* 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); -- Emmanuel Vadot