rework debug_ll
Convert to static inline functions and use lower case letters for function names. Also, include mach/debug_ll.h when an architecture provides support for debug_ll, not only when it's actually enabled. This allows architecures to put some UART initialization code into mach/debug_ll.h which is compiled out when debug_ll is disabled. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
abd545d2f9
commit
4960dc9db0
|
@ -54,7 +54,7 @@ ENTRY_FUNCTION(start_imx6q_mba6x)(void)
|
||||||
if (IS_ENABLED(CONFIG_DEBUG_LL)) {
|
if (IS_ENABLED(CONFIG_DEBUG_LL)) {
|
||||||
writel(0x2, 0x020e0338);
|
writel(0x2, 0x020e0338);
|
||||||
setup_uart();
|
setup_uart();
|
||||||
PUTC_LL('a');
|
putc_ll('a');
|
||||||
}
|
}
|
||||||
|
|
||||||
arm_early_mmu_cache_invalidate();
|
arm_early_mmu_cache_invalidate();
|
||||||
|
@ -77,7 +77,7 @@ ENTRY_FUNCTION(start_imx6dl_mba6x)(void)
|
||||||
if (IS_ENABLED(CONFIG_DEBUG_LL)) {
|
if (IS_ENABLED(CONFIG_DEBUG_LL)) {
|
||||||
writel(0x2, 0x020e035c);
|
writel(0x2, 0x020e035c);
|
||||||
setup_uart();
|
setup_uart();
|
||||||
PUTC_LL('a');
|
putc_ll('a');
|
||||||
}
|
}
|
||||||
|
|
||||||
arm_early_mmu_cache_invalidate();
|
arm_early_mmu_cache_invalidate();
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
#include <mach/imx53-regs.h>
|
#include <mach/imx53-regs.h>
|
||||||
#include <mach/imx6-regs.h>
|
#include <mach/imx6-regs.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_LL
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_IMX1_UART
|
#ifdef CONFIG_DEBUG_IMX1_UART
|
||||||
#define IMX_DEBUG_SOC MX1
|
#define IMX_DEBUG_SOC MX1
|
||||||
#elif defined CONFIG_DEBUG_IMX21_UART
|
#elif defined CONFIG_DEBUG_IMX21_UART
|
||||||
|
@ -61,5 +63,5 @@ static inline void PUTC_LL(int c)
|
||||||
|
|
||||||
writel(c, base + URTX0);
|
writel(c, base + URTX0);
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_DEBUG_LL */
|
||||||
#endif /* __MACH_DEBUG_LL_H__ */
|
#endif /* __MACH_DEBUG_LL_H__ */
|
||||||
|
|
|
@ -51,7 +51,7 @@ void __section(.text_entry) pbl_main_entry(void)
|
||||||
u32 pg_start, pg_end, pg_len;
|
u32 pg_start, pg_end, pg_len;
|
||||||
void (*barebox)(void);
|
void (*barebox)(void);
|
||||||
|
|
||||||
PUTS_LL("pbl_main_entry()\n");
|
puts_ll("pbl_main_entry()\n");
|
||||||
|
|
||||||
/* clear bss */
|
/* clear bss */
|
||||||
memset(__bss_start, 0, __bss_stop - __bss_start);
|
memset(__bss_start, 0, __bss_stop - __bss_start);
|
||||||
|
|
|
@ -93,9 +93,9 @@ static int console_std_set(struct device_d *dev, struct param_d *param,
|
||||||
if (initialized < CONSOLE_INIT_FULL) {
|
if (initialized < CONSOLE_INIT_FULL) {
|
||||||
char ch;
|
char ch;
|
||||||
initialized = CONSOLE_INIT_FULL;
|
initialized = CONSOLE_INIT_FULL;
|
||||||
PUTS_LL("Switch to console [");
|
puts_ll("Switch to console [");
|
||||||
PUTS_LL(dev_name(dev));
|
puts_ll(dev_name(dev));
|
||||||
PUTS_LL("]\n");
|
puts_ll("]\n");
|
||||||
barebox_banner();
|
barebox_banner();
|
||||||
while (kfifo_getc(console_output_fifo, &ch) == 0)
|
while (kfifo_getc(console_output_fifo, &ch) == 0)
|
||||||
console_putc(CONSOLE_STDOUT, ch);
|
console_putc(CONSOLE_STDOUT, ch);
|
||||||
|
@ -282,7 +282,7 @@ void console_putc(unsigned int ch, char c)
|
||||||
|
|
||||||
case CONSOLE_INITIALIZED_BUFFER:
|
case CONSOLE_INITIALIZED_BUFFER:
|
||||||
kfifo_putc(console_output_fifo, c);
|
kfifo_putc(console_output_fifo, c);
|
||||||
PUTC_LL(c);
|
putc_ll(c);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case CONSOLE_INIT_FULL:
|
case CONSOLE_INIT_FULL:
|
||||||
|
|
|
@ -28,7 +28,7 @@ EXPORT_SYMBOL(console_puts);
|
||||||
void console_putc(unsigned int ch, char c)
|
void console_putc(unsigned int ch, char c)
|
||||||
{
|
{
|
||||||
if (!console) {
|
if (!console) {
|
||||||
PUTC_LL(c);
|
putc_ll(c);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,7 @@
|
||||||
#ifndef __INCLUDE_DEBUG_LL_H__
|
#ifndef __INCLUDE_DEBUG_LL_H__
|
||||||
#define __INCLUDE_DEBUG_LL_H__
|
#define __INCLUDE_DEBUG_LL_H__
|
||||||
|
|
||||||
#if defined (CONFIG_DEBUG_LL)
|
#ifdef CONFIG_HAS_DEBUG_LL
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* mach/debug_ll.h should implement PUTC_LL. This can be a macro or a static
|
* mach/debug_ll.h should implement PUTC_LL. This can be a macro or a static
|
||||||
* inline function. Note that several SoCs expect the UART to be initialized
|
* inline function. Note that several SoCs expect the UART to be initialized
|
||||||
|
@ -29,35 +28,61 @@
|
||||||
* this initialization. Depending on the PUTC_LL implementation the board might
|
* this initialization. Depending on the PUTC_LL implementation the board might
|
||||||
* also hang in PUTC_LL without proper initialization.
|
* also hang in PUTC_LL without proper initialization.
|
||||||
*/
|
*/
|
||||||
# include <mach/debug_ll.h>
|
#include <mach/debug_ll.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
# define PUTHEX_LL(value) ({ unsigned long v = (unsigned long) (value); \
|
#if defined (CONFIG_DEBUG_LL)
|
||||||
int i; unsigned char ch; \
|
|
||||||
for (i = 8; i--; ) {\
|
static inline void putc_ll(unsigned char value)
|
||||||
ch = ((v >> (i*4)) & 0xf);\
|
{
|
||||||
ch += (ch >= 10) ? 'a' - 10 : '0';\
|
PUTC_LL(value);
|
||||||
PUTC_LL (ch); }})
|
}
|
||||||
|
|
||||||
|
static inline void puthex_ll(unsigned long value)
|
||||||
|
{
|
||||||
|
int i; unsigned char ch;
|
||||||
|
|
||||||
|
for (i = 8; i--; ) {
|
||||||
|
ch = ((value >> (i * 4)) & 0xf);
|
||||||
|
ch += (ch >= 10) ? 'a' - 10 : '0';
|
||||||
|
putc_ll(ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Be careful with PUTS_LL, it only works if the binary is running at the
|
* Be careful with puts_ll, it only works if the binary is running at the
|
||||||
* link address which often is not the case during early startup. If in doubt
|
* link address which often is not the case during early startup. If in doubt
|
||||||
* don't use it.
|
* don't use it.
|
||||||
*/
|
*/
|
||||||
static __inline__ void PUTS_LL(const char * str)
|
static inline void puts_ll(const char * str)
|
||||||
{
|
{
|
||||||
while (*str) {
|
while (*str) {
|
||||||
if (*str == '\n') {
|
if (*str == '\n')
|
||||||
PUTC_LL('\r');
|
putc_ll('\r');
|
||||||
}
|
|
||||||
PUTC_LL(*str);
|
putc_ll(*str);
|
||||||
str++;
|
str++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# define PUTC_LL(c) do {} while (0)
|
|
||||||
# define PUTHEX_LL(v) do {} while (0)
|
static inline void putc_ll(unsigned char value)
|
||||||
# define PUTS_LL(c) do {} while (0)
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void puthex_ll(unsigned long value)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Be careful with puts_ll, it only works if the binary is running at the
|
||||||
|
* link address which often is not the case during early startup. If in doubt
|
||||||
|
* don't use it.
|
||||||
|
*/
|
||||||
|
static inline void puts_ll(const char * str)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue