diff options
Diffstat (limited to 'board/hisilicon')
-rw-r--r-- | board/hisilicon/hikey/Kconfig | 7 | ||||
-rw-r--r-- | board/hisilicon/hikey/hikey.c | 43 |
2 files changed, 50 insertions, 0 deletions
diff --git a/board/hisilicon/hikey/Kconfig b/board/hisilicon/hikey/Kconfig index f7f1055e17..9171502a19 100644 --- a/board/hisilicon/hikey/Kconfig +++ b/board/hisilicon/hikey/Kconfig @@ -12,4 +12,11 @@ config SYS_SOC config SYS_CONFIG_NAME default "hikey" +config CONS_INDEX + int "UART used for console" + range 1 4 + default 4 + help + The hi6220 SoC has 5 UARTs. For example to use UART0 enter 1 here. + endif diff --git a/board/hisilicon/hikey/hikey.c b/board/hisilicon/hikey/hikey.c index 9948747217..c4ae40bfb4 100644 --- a/board/hisilicon/hikey/hikey.c +++ b/board/hisilicon/hikey/hikey.c @@ -6,6 +6,7 @@ */ #include <common.h> #include <dm.h> +#include <dm/platform_data/serial_pl01x.h> #include <errno.h> #include <malloc.h> #include <netdev.h> @@ -69,6 +70,48 @@ U_BOOT_DEVICES(hi6220_gpios) = { DECLARE_GLOBAL_DATA_PTR; +static const struct pl01x_serial_platdata serial_platdata = { +#if CONFIG_CONS_INDEX == 1 + .base = HI6220_UART0_BASE, +#elif CONFIG_CONS_INDEX == 4 + .base = HI6220_UART3_BASE, +#else +#error "Unsuported console index value." +#endif + .type = TYPE_PL011, + .clock = 19200000 +}; + +U_BOOT_DEVICE(hikey_seriala) = { + .name = "serial_pl01x", + .platdata = &serial_platdata, +}; + +#ifdef CONFIG_BOARD_EARLY_INIT_F +int board_uart_init(void) +{ + switch (CONFIG_CONS_INDEX) { + case 1: + hi6220_pinmux_config(PERIPH_ID_UART0); + break; + case 4: + hi6220_pinmux_config(PERIPH_ID_UART3); + break; + default: + debug("%s: Unsupported UART selected\n", __func__); + return -1; + } + + return 0; +} + +int board_early_init_f(void) +{ + board_uart_init(); + return 0; +} +#endif + struct peri_sc_periph_regs *peri_sc = (struct peri_sc_periph_regs *)HI6220_PERI_BASE; |