2 * Copyright (C) 2016 Socionext Inc.
3 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
5 * SPDX-License-Identifier: GPL-2.0+
12 #include <linux/serial_reg.h>
14 #define DEBUG_UART_BASE 0x54006800
17 #define UNIPHIER_UART_TX 0
18 #define UNIPHIER_UART_LSR (5 * 4)
20 /* All functions are inline so that they can be called from .secure section. */
23 static inline void debug_putc(int c)
25 void __iomem *base = (void __iomem *)DEBUG_UART_BASE;
27 while (!(readl(base + UNIPHIER_UART_LSR) & UART_LSR_THRE))
30 writel(c, base + UNIPHIER_UART_TX);
33 static inline void debug_puts(const char *s)
43 static inline void debug_puth(unsigned long val)
49 c = ((val >> (i * 4)) & 0xf);
50 c += (c >= 10) ? 'a' - 10 : '0';
55 static inline void debug_putc(int c)
59 static inline void debug_puts(const char *s)
63 static inline void debug_puth(unsigned long val)
68 #endif /* __DEBUG_H__ */