summaryrefslogtreecommitdiff
path: root/sys/arch/armv7/vexpress
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/armv7/vexpress')
-rw-r--r--sys/arch/armv7/vexpress/pl011.c22
-rw-r--r--sys/arch/armv7/vexpress/vexpress_machdep.c22
2 files changed, 22 insertions, 22 deletions
diff --git a/sys/arch/armv7/vexpress/pl011.c b/sys/arch/armv7/vexpress/pl011.c
index 50a902b6be3..5006388ec7c 100644
--- a/sys/arch/armv7/vexpress/pl011.c
+++ b/sys/arch/armv7/vexpress/pl011.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pl011.c,v 1.2 2016/04/24 00:57:23 patrick Exp $ */
+/* $OpenBSD: pl011.c,v 1.3 2016/06/08 15:27:05 jsg Exp $ */
/*
* Copyright (c) 2014 Patrick Wildt <patrick@blueri.se>
@@ -42,9 +42,13 @@
#if NFDT > 0
#include <machine/fdt.h>
#endif
+#include <arm/armv7/armv7var.h>
#include <armv7/vexpress/pl011reg.h>
#include <armv7/vexpress/pl011var.h>
#include <armv7/armv7/armv7var.h>
+#include <armv7/armv7/armv7_machdep.h>
+
+#include <dev/ofw/fdt.h>
#define DEVUNIT(x) (minor(x) & 0x7f)
#define DEVCUA(x) (minor(x) & 0x80)
@@ -112,6 +116,8 @@ struct pl011_softc *pl011_sc(dev_t dev);
int pl011_intr(void *);
+extern int comcnspeed;
+extern int comcnmode;
/* XXX - we imitate 'com' serial ports and take over their entry points */
/* XXX: These belong elsewhere */
@@ -131,6 +137,20 @@ bus_addr_t pl011consaddr;
tcflag_t pl011conscflag = TTYDEF_CFLAG;
int pl011defaultrate = B38400;
+void
+pl011_init_cons(void)
+{
+ struct fdt_memory mem;
+ void *node;
+
+ if ((node = fdt_find_cons("arm,pl011")) == NULL)
+ return;
+ if (fdt_get_memory_address(node, 0, &mem))
+ return;
+
+ pl011cnattach(&armv7_bs_tag, mem.addr, comcnspeed, comcnmode);
+}
+
int
pl011probe(struct device *parent, void *self, void *aux)
{
diff --git a/sys/arch/armv7/vexpress/vexpress_machdep.c b/sys/arch/armv7/vexpress/vexpress_machdep.c
index 2d9104276a9..005cbe57973 100644
--- a/sys/arch/armv7/vexpress/vexpress_machdep.c
+++ b/sys/arch/armv7/vexpress/vexpress_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vexpress_machdep.c,v 1.3 2016/06/04 18:09:16 jsg Exp $ */
+/* $OpenBSD: vexpress_machdep.c,v 1.4 2016/06/08 15:27:05 jsg Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@@ -38,8 +38,6 @@ extern void sysconf_shutdown(void);
extern struct board_dev *vexpress_board_devs(void);
extern void vexpress_board_init(void);
extern int vexpress_legacy_map(void);
-extern int comcnspeed;
-extern int comcnmode;
void
vexpress_platform_smc_write(bus_space_tag_t iot, bus_space_handle_t ioh, bus_size_t off,
@@ -49,23 +47,6 @@ vexpress_platform_smc_write(bus_space_tag_t iot, bus_space_handle_t ioh, bus_siz
}
void
-vexpress_platform_init_cons(void)
-{
- paddr_t paddr;
-
- switch (board_id) {
- default:
- case BOARD_ID_VEXPRESS:
- if (vexpress_legacy_map())
- paddr = 0x10009000;
- else
- paddr = 0x1c090000;
- break;
- }
- pl011cnattach(&armv7_bs_tag, paddr, comcnspeed, comcnmode);
-}
-
-void
vexpress_platform_init_mainbus(struct device *self)
{
mainbus_legacy_found(self, "cortex");
@@ -99,7 +80,6 @@ vexpress_platform_board_init(void)
struct armv7_platform vexpress_platform = {
.board_init = vexpress_platform_board_init,
.smc_write = vexpress_platform_smc_write,
- .init_cons = vexpress_platform_init_cons,
.watchdog_reset = vexpress_platform_watchdog_reset,
.powerdown = vexpress_platform_powerdown,
.disable_l2_if_needed = vexpress_platform_disable_l2_if_needed,