On Mon, 14 Oct 2019 17:27:51 +0100 Ruslan Bukin <b...@freebsd.org> wrote:
> On Mon, Oct 14, 2019 at 06:10:51PM +0200, Emmanuel Vadot wrote: > > > > On Mon, 14 Oct 2019 15:53:00 +0000 (UTC) > > Ruslan Bukin <b...@freebsd.org> 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 <b...@bsdpad.com> > > > + * Copyright (c) 2014-2019 Ruslan Bukin <b...@bsdpad.com> > > > * 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. > > The change means that the driver will be attached regardless of the return > value from ext resources. Yes and this is a problem. > Why it is not correct? Because if a reset/clock/regulator is present but we failed to parse the node (bad #clock-cell for example) this just assume that the resource isn't present which is not correct. Or worse the underlying gpio cannot be mapped, you now have a non functional driver because you cannot switch the regulator. > It does not hide all errors, the printf will be called and a user will be > warned. If the ressources are present in the DTB and the system support them but they cannot be used the driver should fail. Which is why I suggest you to make an extra case on ENODEV even if I don't like that because it's hacky even for a platform that is, to my knowledge, not really supported (no u-boot port, dtb aren't build, not part of GENERIC). > Ruslan -- Emmanuel Vadot <m...@bidouilliste.com> <m...@freebsd.org> _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"