diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-07-19 14:38:44 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-07-25 10:07:43 +0200 |
commit | 3a263a9b02227ebb056eef7bcbbc378cacbd476e (patch) | |
tree | 385585033875178d8e0ce88362036e7edcc26f59 /bsps/riscv/riscv/console/console-config.c | |
parent | bsp/riscv: Disable HTIF support by default (diff) | |
download | rtems-3a263a9b02227ebb056eef7bcbbc378cacbd476e.tar.bz2 |
bsp/riscv: Add and use riscv_fdt_get_address()
Update #3433.
Diffstat (limited to 'bsps/riscv/riscv/console/console-config.c')
-rw-r--r-- | bsps/riscv/riscv/console/console-config.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/bsps/riscv/riscv/console/console-config.c b/bsps/riscv/riscv/console/console-config.c index 50d292dcb8..270646ffe1 100644 --- a/bsps/riscv/riscv/console/console-config.c +++ b/bsps/riscv/riscv/console/console-config.c @@ -17,10 +17,10 @@ #include <rtems/sysinit.h> #include <rtems/termiostypes.h> -#include <bsp.h> #include <bsp/fatal.h> #include <bsp/fdt.h> #include <bsp/irq.h> +#include <bsp/riscv.h> #include <dev/serial/htif.h> #include <libchip/ns16550.h> @@ -119,18 +119,12 @@ static void riscv_console_probe(void) ctx->set_reg = set_register; ctx->initial_baud = BSP_CONSOLE_BAUD; - val = (fdt32_t *) fdt_getprop(fdt, node, "reg", &len); + ctx->port = (uintptr_t) riscv_fdt_get_address(fdt, node); - if (val == NULL || (len != 8 && len != 16)) { + if (ctx->port == 0) { bsp_fatal(RISCV_FATAL_NO_NS16550_REG_IN_DEVICE_TREE); } - if (len == 16) { - ctx->port = fdt32_to_cpu(val[1]); - } else { - ctx->port = fdt32_to_cpu(val[0]); - } - val = (fdt32_t *) fdt_getprop(fdt, node, "clock-frequency", &len); if (val == NULL || len != 4) { |