From: kettenis Date: Sun, 14 Feb 2021 10:57:40 +0000 (+0000) Subject: Recent device trees have the syscon-reboot and syscon-poweroff nodes as X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=6f08a9834abbf968a2a7e5df7f6b4e41b8e8cfbc;p=openbsd Recent device trees have the syscon-reboot and syscon-poweroff nodes as children of the node claimed by expower(4). That node also fained a "syscon" compatible in the process. Deal with these changes, ok patrick@ --- diff --git a/sys/arch/armv7/exynos/expower.c b/sys/arch/armv7/exynos/expower.c index 6242160a123..16d366eaf62 100644 --- a/sys/arch/armv7/exynos/expower.c +++ b/sys/arch/armv7/exynos/expower.c @@ -1,4 +1,4 @@ -/* $OpenBSD: expower.c,v 1.7 2017/03/10 21:26:19 kettenis Exp $ */ +/* $OpenBSD: expower.c,v 1.8 2021/02/14 10:57:40 kettenis Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt * @@ -27,6 +27,8 @@ #include #include +#include + #define HREAD4(sc, reg) \ (bus_space_read_4((sc)->sc_iot, (sc)->sc_ioh, (reg))) #define HWRITE4(sc, reg, val) \ @@ -37,7 +39,7 @@ HWRITE4((sc), (reg), HREAD4((sc), (reg)) & ~(bits)) struct expower_softc { - struct device sc_dev; + struct simplebus_softc sc_sbus; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; }; @@ -58,8 +60,11 @@ expower_match(struct device *parent, void *match, void *aux) { struct fdt_attach_args *faa = aux; - return (OF_is_compatible(faa->fa_node, "samsung,exynos5250-pmu") || - OF_is_compatible(faa->fa_node, "samsung,exynos5420-pmu")); + if (OF_is_compatible(faa->fa_node, "samsung,exynos5250-pmu") || + OF_is_compatible(faa->fa_node, "samsung,exynos5420-pmu")) + return 10; /* Must beat syscon(4). */ + + return 0; } void @@ -68,14 +73,20 @@ expower_attach(struct device *parent, struct device *self, void *aux) struct expower_softc *sc = (struct expower_softc *)self; struct fdt_attach_args *faa = aux; - sc->sc_iot = faa->fa_iot; + if (faa->fa_nreg < 1) { + printf(": no registers\n"); + return; + } + sc->sc_iot = faa->fa_iot; if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr, - faa->fa_reg[0].size, 0, &sc->sc_ioh)) - panic("%s: bus_space_map failed!", __func__); - - printf("\n"); + faa->fa_reg[0].size, 0, &sc->sc_ioh)) { + printf(": can't map registers\n"); + return; + } regmap_register(faa->fa_node, sc->sc_iot, sc->sc_ioh, faa->fa_reg[0].size); + + simplebus_attach(parent, &sc->sc_sbus.sc_dev, faa); } diff --git a/sys/arch/armv7/exynos/files.exynos b/sys/arch/armv7/exynos/files.exynos index f332937899d..290c8acdf43 100644 --- a/sys/arch/armv7/exynos/files.exynos +++ b/sys/arch/armv7/exynos/files.exynos @@ -1,4 +1,4 @@ -# $OpenBSD: files.exynos,v 1.13 2021/02/05 00:05:20 patrick Exp $ +# $OpenBSD: files.exynos,v 1.14 2021/02/14 10:57:40 kettenis Exp $ #device exdisplay: wsemuldisplaydev, rasops16 #attach exdisplay at exynos @@ -8,7 +8,7 @@ device exclock attach exclock at fdt file arch/armv7/exynos/exclock.c exclock -device expower +device expower: fdt attach expower at fdt file arch/armv7/exynos/expower.c expower