diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2019-03-06 10:12:31 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-03-06 10:27:03 +0100 |
commit | 70187de497f36213e2bb243022a3474d631d19a4 (patch) | |
tree | a38fd6ec53e2eeec9a40e75a92e05a88116569af /arch | |
parent | b4db05f2cb2addf8b6f5933cab7903b18e966227 (diff) | |
download | barebox-70187de497f36213e2bb243022a3474d631d19a4.tar.gz barebox-70187de497f36213e2bb243022a3474d631d19a4.tar.xz |
ARM: rpi: Add mini UART debug_ll support
The raspberry pi 3 comes up with the mini UART as default, so allow to
use it for debug_ll output.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-bcm283x/include/mach/debug_ll.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/arch/arm/mach-bcm283x/include/mach/debug_ll.h b/arch/arm/mach-bcm283x/include/mach/debug_ll.h index 2d2103e338..99c59d011b 100644 --- a/arch/arm/mach-bcm283x/include/mach/debug_ll.h +++ b/arch/arm/mach-bcm283x/include/mach/debug_ll.h @@ -22,14 +22,51 @@ #ifdef CONFIG_DEBUG_RPI1_UART +static inline void debug_ll_init(void) +{ + /* Configured by ROM */ +} + #define DEBUG_LL_UART_ADDR BCM2835_PL011_BASE #include <debug_ll/pl011.h> #elif defined CONFIG_DEBUG_RPI2_3_UART +static inline void debug_ll_init(void) +{ + /* Configured by ROM */ +} + #define DEBUG_LL_UART_ADDR BCM2836_PL011_BASE #include <debug_ll/pl011.h> +#elif defined CONFIG_DEBUG_RPI3_MINI_UART + +static inline uint8_t debug_ll_read_reg(int reg) +{ + return readb(BCM2836_MINIUART_BASE + (reg << 2)); +} + +static inline void debug_ll_write_reg(int reg, uint8_t val) +{ + writeb(val, BCM2836_MINIUART_BASE + (reg << 2)); +} + +#define BCM2836_AUX_CLOCK_ENB 0x3f215004 /* BCM2835 AUX Clock enable register */ +#define BCM2836_AUX_CLOCK_EN_UART BIT(0) /* Bit 0 enables the Miniuart */ + +#include <debug_ll/ns16550.h> + +static inline void debug_ll_init(void) +{ + uint16_t divisor; + + writeb(BCM2836_AUX_CLOCK_EN_UART, BCM2836_AUX_CLOCK_ENB); + + divisor = debug_ll_ns16550_calc_divisor(250000000 * 2); + debug_ll_ns16550_init(divisor); +} + #endif #endif /* __MACH_BCM2835_DEBUG_LL_H__ */ |