diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2016-05-18 22:55:24 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2016-05-18 22:55:24 +0000 |
commit | 242c5841110a7ae4dc1cc7247dbca585cb677344 (patch) | |
tree | 356e345c3fc83d8adfac9d69b26d15821c29193a /sys/arch | |
parent | dfa61228962db91293426cd4a998572bd0ef0260 (diff) |
Introduce a per-platform init_mainbus() hook that can be used to attach
platform-specific devices to mainbus before we start walking the FDT.
ok patrick@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/arm/mainbus/mainbus.c | 7 | ||||
-rw-r--r-- | sys/arch/arm/mainbus/mainbus.h | 4 | ||||
-rw-r--r-- | sys/arch/armv7/armv7/armv7_machdep.h | 4 | ||||
-rw-r--r-- | sys/arch/armv7/armv7/platform.c | 9 | ||||
-rw-r--r-- | sys/arch/armv7/imx/imx_machdep.c | 11 |
5 files changed, 29 insertions, 6 deletions
diff --git a/sys/arch/arm/mainbus/mainbus.c b/sys/arch/arm/mainbus/mainbus.c index c42e0dcbdf6..91b5811f043 100644 --- a/sys/arch/arm/mainbus/mainbus.c +++ b/sys/arch/arm/mainbus/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.8 2016/05/02 08:15:55 patrick Exp $ */ +/* $OpenBSD: mainbus.c,v 1.9 2016/05/18 22:55:23 kettenis Exp $ */ /* * Copyright (c) 2016 Patrick Wildt <patrick@blueri.se> * @@ -30,7 +30,6 @@ void mainbus_attach(struct device *, struct device *, void *); void mainbus_attach_node(struct device *, int); int mainbus_legacy_search(struct device *, void *, void *); -void mainbus_legacy_found(struct device *, char *); struct mainbus_softc { struct device sc_dev; @@ -102,6 +101,10 @@ mainbus_attach(struct device *parent, struct device *self, void *aux) /* Attach CPU first. */ mainbus_legacy_found(self, "cpu"); +#ifdef CPU_ARMv7 + extern void platform_init_mainbus(struct device *); + platform_init_mainbus(self); +#endif /* TODO: Scan for interrupt controllers and attach them first? */ diff --git a/sys/arch/arm/mainbus/mainbus.h b/sys/arch/arm/mainbus/mainbus.h index 42a4076de34..059ca2550e8 100644 --- a/sys/arch/arm/mainbus/mainbus.h +++ b/sys/arch/arm/mainbus/mainbus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.h,v 1.3 2016/05/02 08:15:55 patrick Exp $ */ +/* $OpenBSD: mainbus.h,v 1.4 2016/05/18 22:55:23 kettenis Exp $ */ /* * Copyright (c) 2016 Patrick Wildt <patrick@blueri.se> * @@ -26,4 +26,6 @@ union mainbus_attach_args { struct fdt_attach_args ma_faa; }; +void mainbus_legacy_found(struct device *, char *); + #endif /* __MAINBUS_H__ */ diff --git a/sys/arch/armv7/armv7/armv7_machdep.h b/sys/arch/armv7/armv7/armv7_machdep.h index 5b4d16773b1..466b40b5a16 100644 --- a/sys/arch/armv7/armv7/armv7_machdep.h +++ b/sys/arch/armv7/armv7/armv7_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: armv7_machdep.h,v 1.5 2015/07/15 21:09:40 jsg Exp $ */ +/* $OpenBSD: armv7_machdep.h,v 1.6 2016/05/18 22:55:23 kettenis Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -22,6 +22,7 @@ void platform_init(void); void platform_powerdown(void); void platform_watchdog_reset(void); void platform_init_cons(void); +void platform_init_mainbus(struct device *); void platform_disable_l2_if_needed(void); const char *platform_boot_name(void); const char *platform_board_name(void); @@ -38,6 +39,7 @@ struct armv7_platform { void (*watchdog_reset)(void); void (*powerdown)(void); void (*disable_l2_if_needed)(void); + void (*init_mainbus)(struct device *); }; #endif /* __PLATFORMVAR_H__ */ diff --git a/sys/arch/armv7/armv7/platform.c b/sys/arch/armv7/armv7/platform.c index ffe5b99a1f2..83e7928bf5a 100644 --- a/sys/arch/armv7/armv7/platform.c +++ b/sys/arch/armv7/armv7/platform.c @@ -1,4 +1,4 @@ -/* $OpenBSD: platform.c,v 1.4 2015/07/15 21:09:40 jsg Exp $ */ +/* $OpenBSD: platform.c,v 1.5 2016/05/18 22:55:23 kettenis Exp $ */ /* * Copyright (c) 2014 Patrick Wildt <patrick@blueri.se> * @@ -92,6 +92,13 @@ platform_init_cons(void) } void +platform_init_mainbus(struct device *self) +{ + if (platform->init_mainbus) + platform->init_mainbus(self); +} + +void platform_watchdog_reset(void) { platform->watchdog_reset(); diff --git a/sys/arch/armv7/imx/imx_machdep.c b/sys/arch/armv7/imx/imx_machdep.c index d36da87f02f..dd661a327ad 100644 --- a/sys/arch/armv7/imx/imx_machdep.c +++ b/sys/arch/armv7/imx/imx_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imx_machdep.c,v 1.15 2015/05/19 03:30:54 jsg Exp $ */ +/* $OpenBSD: imx_machdep.c,v 1.16 2016/05/18 22:55:23 kettenis Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -28,6 +28,7 @@ #include <arm/cortex/smc.h> #include <arm/armv7/armv7var.h> +#include <arm/mainbus/mainbus.h> #include <armv7/armv7/armv7var.h> #include <armv7/imx/imxuartvar.h> #include <armv7/armv7/armv7_machdep.h> @@ -79,6 +80,13 @@ imx_platform_init_cons(void) } void +imx_platform_init_mainbus(struct device *self) +{ + mainbus_legacy_found(self, "cortex"); + mainbus_legacy_found(self, "imx"); +} + +void imx_platform_watchdog_reset(void) { imxdog_reset(); @@ -117,6 +125,7 @@ struct armv7_platform imx_platform = { .watchdog_reset = imx_platform_watchdog_reset, .powerdown = imx_platform_powerdown, .disable_l2_if_needed = imx_platform_disable_l2_if_needed, + .init_mainbus = imx_platform_init_mainbus, }; struct armv7_platform * |