summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2019-11-29 21:59:56 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2019-11-29 21:59:56 +0000
commit4e51579610cd162543f31fa98d0188026ad032e3 (patch)
tree337328826c4bc71f43b9226c3c26042b279a9d2d /sys
parentf1b6312039c35b671a5fc48b307acebf90e6dd4f (diff)
Make rkgrf(4) behave like a simplebus(4) so we can attach drivers
to its subnodes, which are some PHYs. Tested by kurt@ ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/fdt/files.fdt4
-rw-r--r--sys/dev/fdt/rkgrf.c13
2 files changed, 13 insertions, 4 deletions
diff --git a/sys/dev/fdt/files.fdt b/sys/dev/fdt/files.fdt
index 6556a32883d..3d80daa27f2 100644
--- a/sys/dev/fdt/files.fdt
+++ b/sys/dev/fdt/files.fdt
@@ -1,4 +1,4 @@
-# $OpenBSD: files.fdt,v 1.102 2019/10/23 20:32:20 kettenis Exp $
+# $OpenBSD: files.fdt,v 1.103 2019/11/29 21:59:55 patrick Exp $
#
# Config file and device description for machine-independent FDT code.
# Included by ports that need it.
@@ -216,7 +216,7 @@ device rkdwusb: fdt
attach rkdwusb at fdt
file dev/fdt/rkdwusb.c rkdwusb
-device rkgrf
+device rkgrf: fdt
attach rkgrf at fdt
file dev/fdt/rkgrf.c rkgrf
diff --git a/sys/dev/fdt/rkgrf.c b/sys/dev/fdt/rkgrf.c
index 697da02e46b..76946e59369 100644
--- a/sys/dev/fdt/rkgrf.c
+++ b/sys/dev/fdt/rkgrf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rkgrf.c,v 1.2 2017/07/23 17:07:18 kettenis Exp $ */
+/* $OpenBSD: rkgrf.c,v 1.3 2019/11/29 21:59:55 patrick Exp $ */
/*
* Copyright (c) 2017 Mark Kettenis <kettenis@openbsd.org>
*
@@ -27,8 +27,14 @@
#include <dev/ofw/ofw_misc.h>
#include <dev/ofw/fdt.h>
+#ifdef __armv7__
+#include <arm/simplebus/simplebusvar.h>
+#else
+#include <arm64/dev/simplebusvar.h>
+#endif
+
struct rkgrf_softc {
- struct device sc_dev;
+ struct simplebus_softc sc_sbus;
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
};
@@ -79,4 +85,7 @@ rkgrf_attach(struct device *parent, struct device *self, void *aux)
regmap_register(faa->fa_node, sc->sc_iot, sc->sc_ioh,
faa->fa_reg[0].size);
+
+ /* Attach PHYs. */
+ simplebus_attach(parent, &sc->sc_sbus.sc_dev, faa);
}