diff options
author | Damien Le Moal <damien.lemoal@wdc.com> | 2019-09-04 13:27:27 +0900 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2019-09-05 18:47:56 +0530 |
commit | fca8c3be0122d4b90cef572aefddd65c27fcaba6 (patch) | |
tree | e71068ed5e5d0d0e3f2f29a7760e20181556bd2e /platform/kendryte/k210/platform.c | |
parent | 6ed2bc154f99d3c067775d8a83bcd42a44838dcf (diff) |
kendryte/k210: Use sifive UART driver
The Kendryte K210 UARTHS is compatible with SiFive UART. So use the
sifive uart driver and remove the k210 uarths platform code.
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Diffstat (limited to 'platform/kendryte/k210/platform.c')
-rw-r--r-- | platform/kendryte/k210/platform.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/platform/kendryte/k210/platform.c b/platform/kendryte/k210/platform.c index 19c569c..a986651 100644 --- a/platform/kendryte/k210/platform.c +++ b/platform/kendryte/k210/platform.c @@ -14,26 +14,17 @@ #include <sbi/sbi_console.h> #include <sbi_utils/irqchip/plic.h> #include <sbi_utils/sys/clint.h> +#include <sbi_utils/serial/sifive-uart.h> #include "platform.h" -#include "uarths.h" +#include "sysctl.h" -#define K210_UART_BAUDRATE 115200 +#define K210_UART_BASE_ADDR 0x38000000U +#define K210_UART_BAUDRATE 115200 static int k210_console_init(void) { - uarths_init(K210_UART_BAUDRATE, UARTHS_STOP_1); - - return 0; -} - -static void k210_console_putc(char c) -{ - uarths_putc(c); -} - -static int k210_console_getc(void) -{ - return uarths_getc(); + return sifive_uart_init(K210_UART_BASE_ADDR, + sysctl_get_cpu_freq(), K210_UART_BAUDRATE); } static int k210_irqchip_init(bool cold_boot) @@ -95,8 +86,8 @@ static int k210_system_shutdown(u32 type) const struct sbi_platform_operations platform_ops = { .console_init = k210_console_init, - .console_putc = k210_console_putc, - .console_getc = k210_console_getc, + .console_putc = sifive_uart_putc, + .console_getc = sifive_uart_getc, .irqchip_init = k210_irqchip_init, |