The early startup code is written in assembly, so the C DEBUG_LL implementation isn't as useful, but it can still come in handy as debugging aid, so let's add it. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- arch/openrisc/Kconfig | 1 + arch/openrisc/include/asm/debug_ll.h | 36 ++++++++++++++++++++++++++++ arch/openrisc/lib/board.c | 3 +++ common/Kconfig.debug_ll | 4 ++++ 4 files changed, 44 insertions(+) create mode 100644 arch/openrisc/include/asm/debug_ll.h diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig index 4ae03b748c79..102071686e4f 100644 --- a/arch/openrisc/Kconfig +++ b/arch/openrisc/Kconfig @@ -7,6 +7,7 @@ config OPENRISC select HAVE_CONFIGURABLE_MEMORY_LAYOUT select GENERIC_FIND_NEXT_BIT select ARCH_HAS_SJLJ + select HAS_DEBUG_LL default y # not used diff --git a/arch/openrisc/include/asm/debug_ll.h b/arch/openrisc/include/asm/debug_ll.h new file mode 100644 index 000000000000..35d436094096 --- /dev/null +++ b/arch/openrisc/include/asm/debug_ll.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __ASM_DEBUG_LL__ +#define __ASM_DEBUG_LL__ + +#include <io.h> + +#if defined CONFIG_DEBUG_OPENRISC_NS16550 + +#define DEBUG_LL_UART_BASE IOMEM(0x90000000) + +static inline uint8_t debug_ll_read_reg(void __iomem *base, int reg) +{ + return readb(base + reg); +} + +static inline void debug_ll_write_reg(void __iomem *base, int reg, uint8_t val) +{ + writeb(val, base + reg); +} + +#include <debug_ll/ns16550.h> + +static inline void debug_ll_init(void) +{ + /* already configured */ +} + +static inline void PUTC_LL(int c) +{ + debug_ll_ns16550_putc(DEBUG_LL_UART_BASE, c); +} + +#endif + +#endif diff --git a/arch/openrisc/lib/board.c b/arch/openrisc/lib/board.c index 9591120fee4b..c6f34ed412d7 100644 --- a/arch/openrisc/lib/board.c +++ b/arch/openrisc/lib/board.c @@ -18,6 +18,7 @@ #include <init.h> #include <memory.h> #include <asm-generic/memory_layout.h> +#include <debug_ll.h> /* Called from assembly */ void openrisc_start_barebox(void); @@ -27,5 +28,7 @@ void __noreturn openrisc_start_barebox(void) mem_malloc_init((void *)(OPENRISC_SOPC_TEXT_BASE - MALLOC_SIZE), (void *)(OPENRISC_SOPC_TEXT_BASE - 1)); + putc_ll('>'); + start_barebox(); } diff --git a/common/Kconfig.debug_ll b/common/Kconfig.debug_ll index 3f6f3e7c3bdb..1f9255b1a45b 100644 --- a/common/Kconfig.debug_ll +++ b/common/Kconfig.debug_ll @@ -350,6 +350,10 @@ config DEBUG_SEMIHOSTING Say Y here if you want low-level debugging support using semihosting writec. +config DEBUG_OPENRISC_NS16550 + bool "OpenRISC NS16550 console" + depends on OPENRISC + endchoice config DEBUG_LL_NS16550 -- 2.39.2