diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-06-08 15:27:06 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-06-08 15:27:06 +0000 |
commit | ec781b303bcbf6dd62c55d5f3ea74f879b01b753 (patch) | |
tree | c748a2dfdb13a80884b4f8475254c3fb9bb6bf57 /sys/arch/armv7/imx | |
parent | cacefc814f032ba3ab4bc7b8a36c3f305c0883ac (diff) |
Use fdt to find the console to initialise. Try to use /chosen/stdout-path
if present otherwise fallback to /aliases/serial0.
Don't require a platform match to run the various console init functions
so the init functions will run for unknown board ids.
With and ok kettenis@ on a earlier version.
Diffstat (limited to 'sys/arch/armv7/imx')
-rw-r--r-- | sys/arch/armv7/imx/imx_machdep.c | 36 | ||||
-rw-r--r-- | sys/arch/armv7/imx/imxuart.c | 22 |
2 files changed, 22 insertions, 36 deletions
diff --git a/sys/arch/armv7/imx/imx_machdep.c b/sys/arch/armv7/imx/imx_machdep.c index 91226433440..23b96d45c4b 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.18 2016/06/04 18:09:16 jsg Exp $ */ +/* $OpenBSD: imx_machdep.c,v 1.19 2016/06/08 15:27:05 jsg Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -36,8 +36,6 @@ extern void imxdog_reset(void); extern struct board_dev *imx_board_devs(void); extern void imx_board_init(void); -extern int comcnspeed; -extern int comcnmode; void imx_platform_smc_write(bus_space_tag_t iot, bus_space_handle_t ioh, bus_size_t off, @@ -47,37 +45,6 @@ imx_platform_smc_write(bus_space_tag_t iot, bus_space_handle_t ioh, bus_size_t o } void -imx_platform_init_cons(void) -{ - paddr_t paddr; - - switch (board_id) { - /* UART1 */ - case BOARD_ID_IMX6_CUBOXI: - case BOARD_ID_IMX6_HUMMINGBOARD: - case BOARD_ID_IMX6_SABRESD: - case BOARD_ID_IMX6_WANDBOARD: - paddr = 0x02020000; - break; - /* UART2 */ - case BOARD_ID_IMX6_SABRELITE: - case BOARD_ID_IMX6_UDOO: - case BOARD_ID_IMX6_NOVENA: - paddr = 0x021e8000; - break; - /* UART4 */ - case BOARD_ID_IMX6_UTILITE: - paddr = 0x021f0000; - break; - default: - printf("board type %x unknown", board_id); - return; - /* XXX - HELP */ - } - imxuartcnattach(&armv7_bs_tag, paddr, comcnspeed, comcnmode); -} - -void imx_platform_init_mainbus(struct device *self) { mainbus_legacy_found(self, "cortex"); @@ -111,7 +78,6 @@ imx_platform_board_init(void) struct armv7_platform imx_platform = { .board_init = imx_platform_board_init, .smc_write = imx_platform_smc_write, - .init_cons = imx_platform_init_cons, .watchdog_reset = imx_platform_watchdog_reset, .powerdown = imx_platform_powerdown, .disable_l2_if_needed = imx_platform_disable_l2_if_needed, diff --git a/sys/arch/armv7/imx/imxuart.c b/sys/arch/armv7/imx/imxuart.c index 54fbb777ee4..1b284fdb221 100644 --- a/sys/arch/armv7/imx/imxuart.c +++ b/sys/arch/armv7/imx/imxuart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxuart.c,v 1.4 2016/05/18 06:49:28 kettenis Exp $ */ +/* $OpenBSD: imxuart.c,v 1.5 2016/06/08 15:27:05 jsg Exp $ */ /* * Copyright (c) 2005 Dale Rahn <drahn@motorola.com> * @@ -37,11 +37,15 @@ #endif #include <machine/bus.h> +#include <arm/armv7/armv7var.h> #include <armv7/imx/imxuartreg.h> #include <armv7/imx/imxuartvar.h> #include <armv7/armv7/armv7var.h> +#include <armv7/armv7/armv7_machdep.h> #include <armv7/imx/imxccmvar.h> +#include <dev/ofw/fdt.h> + #define DEVUNIT(x) (minor(x) & 0x7f) #define DEVCUA(x) (minor(x) & 0x80) @@ -104,6 +108,8 @@ struct imxuart_softc *imxuart_sc(dev_t dev); int imxuart_intr(void *); +extern int comcnspeed; +extern int comcnmode; /* XXX - we imitate 'com' serial ports and take over their entry points */ /* XXX: These belong elsewhere */ @@ -127,6 +133,20 @@ struct cdevsw imxuartdev = cdev_tty_init(3/*XXX NIMXUART */ ,imxuart); /* 12: serial port */ void +imxuart_init_cons(void) +{ + struct fdt_memory mem; + void *node; + + if ((node = fdt_find_cons("fsl,imx21-uart")) == NULL) + return; + if (fdt_get_memory_address(node, 0, &mem)) + return; + + imxuartcnattach(&armv7_bs_tag, mem.addr, comcnspeed, comcnmode); +} + +void imxuartattach(struct device *parent, struct device *self, void *args) { struct armv7_attach_args *aa = args; |