diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-11-22 13:47:58 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-11-22 15:34:36 +0100 |
commit | dd04578bb23db1bf31ee40c002cc53ca58b1a372 (patch) | |
tree | 69d2a687c4f6835690344fc9629b5f4864a3eed8 /arch/arm/mach-omap/include/mach/debug_ll.h | |
parent | 5a4d27516e2b65aa623ad289ae798a505fb272d6 (diff) | |
download | barebox-dd04578bb23db1bf31ee40c002cc53ca58b1a372.tar.gz barebox-dd04578bb23db1bf31ee40c002cc53ca58b1a372.tar.xz |
ARM: OMAP: Make debug_ll UART Kconfig selectable
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-omap/include/mach/debug_ll.h')
-rw-r--r-- | arch/arm/mach-omap/include/mach/debug_ll.h | 71 |
1 files changed, 35 insertions, 36 deletions
diff --git a/arch/arm/mach-omap/include/mach/debug_ll.h b/arch/arm/mach-omap/include/mach/debug_ll.h index 2917558732..25ddd485be 100644 --- a/arch/arm/mach-omap/include/mach/debug_ll.h +++ b/arch/arm/mach-omap/include/mach/debug_ll.h @@ -18,31 +18,9 @@ #define __MACH_DEBUG_LL_H__ #include <io.h> - -#ifdef CONFIG_ARCH_OMAP3 #include <mach/omap3-silicon.h> - -#ifdef CONFIG_OMAP_UART1 -#define UART_BASE OMAP3_UART1_BASE -#else -#define UART_BASE OMAP3_UART3_BASE -#endif - -#endif - -#ifdef CONFIG_ARCH_OMAP4 #include <mach/omap4-silicon.h> -#ifdef CONFIG_OMAP_UART1 -#define UART_BASE OMAP44XX_UART1_BASE -#else -#define UART_BASE OMAP44XX_UART3_BASE -#endif -#endif - -#ifdef CONFIG_ARCH_AM33XX #include <mach/am33xx-silicon.h> -#define UART_BASE AM33XX_UART0_BASE -#endif #define LSR_THRE 0x20 /* Xmit holding register empty */ #define LCR_BKSE 0x80 /* Bank select enable */ @@ -56,26 +34,47 @@ #define MCR (4 << 2) #define MDR (8 << 2) -static inline void omap_uart_lowlevel_init(void) +static inline void omap_uart_lowlevel_init(void __iomem *base) { - writeb(0x00, UART_BASE + LCR); - writeb(0x00, UART_BASE + IER); - writeb(0x07, UART_BASE + MDR); - writeb(LCR_BKSE, UART_BASE + LCR); - writeb(26, UART_BASE + DLL); /* 115200 */ - writeb(0, UART_BASE + DLM); - writeb(0x03, UART_BASE + LCR); - writeb(0x03, UART_BASE + MCR); - writeb(0x07, UART_BASE + FCR); - writeb(0x00, UART_BASE + MDR); + writeb(0x00, base + LCR); + writeb(0x00, base + IER); + writeb(0x07, base + MDR); + writeb(LCR_BKSE, base + LCR); + writeb(26, base + DLL); /* 115200 */ + writeb(0, base + DLM); + writeb(0x03, base + LCR); + writeb(0x03, base + MCR); + writeb(0x07, base + FCR); + writeb(0x00, base + MDR); } + +#ifdef CONFIG_DEBUG_LL + +#ifdef CONFIG_DEBUG_OMAP3_UART +#define OMAP_DEBUG_SOC OMAP3 +#elif defined CONFIG_DEBUG_OMAP4_UART +#define OMAP_DEBUG_SOC OMAP44XX +#elif defined CONFIG_DEBUG_AM33XX_UART +#define OMAP_DEBUG_SOC AM33XX +#else +#error "unknown OMAP debug uart soc type" +#endif + +#define __OMAP_UART_BASE(soc, num) soc##_UART##num##_BASE +#define OMAP_UART_BASE(soc, num) __OMAP_UART_BASE(soc, num) + static inline void PUTC_LL(char c) { + void __iomem *base = (void *)OMAP_UART_BASE(OMAP_DEBUG_SOC, + CONFIG_DEBUG_OMAP_UART_PORT); + /* Wait until there is space in the FIFO */ - while ((readb(UART_BASE + LSR) & LSR_THRE) == 0); + while ((readb(base + LSR) & LSR_THRE) == 0); /* Send the character */ - writeb(c, UART_BASE + THR); + writeb(c, base + THR); /* Wait to make sure it hits the line, in case we die too soon. */ - while ((readb(UART_BASE + LSR) & LSR_THRE) == 0); + while ((readb(base + LSR) & LSR_THRE) == 0); } #endif + +#endif |