1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (C) 2016 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
11 #include <linux/serial_reg.h>
13 #define DEBUG_UART_BASE 0x54006800
16 #define UNIPHIER_UART_TX 0
17 #define UNIPHIER_UART_LSR (5 * 4)
19 /* All functions are inline so that they can be called from .secure section. */
22 static inline void debug_putc(int c)
24 void __iomem *base = (void __iomem *)DEBUG_UART_BASE;
26 while (!(readl(base + UNIPHIER_UART_LSR) & UART_LSR_THRE))
29 writel(c, base + UNIPHIER_UART_TX);
32 static inline void debug_puts(const char *s)
42 static inline void debug_puth(unsigned long val)
48 c = ((val >> (i * 4)) & 0xf);
49 c += (c >= 10) ? 'a' - 10 : '0';
54 static inline void debug_putc(int c)
58 static inline void debug_puts(const char *s)
62 static inline void debug_puth(unsigned long val)
67 #endif /* __DEBUG_H__ */