summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2021-02-14 10:57:41 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2021-02-14 10:57:41 +0000
commit32f8b2621ccd16d0ef1667fa6fe5918c121285ee (patch)
tree5c3b9489b39abec8d44bf80e8fc79c5b83ff7448 /sys
parent6f975808d91c293634b80141f815684559a71090 (diff)
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@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/armv7/exynos/expower.c29
-rw-r--r--sys/arch/armv7/exynos/files.exynos4
2 files changed, 22 insertions, 11 deletions
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 <patrick@blueri.se>
*
@@ -27,6 +27,8 @@
#include <dev/ofw/ofw_misc.h>
#include <dev/ofw/fdt.h>
+#include <arm/simplebus/simplebusvar.h>
+
#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