staging: erofs: fix warning Comparison to bool
[linux/fpc-iii.git] / arch / mips / loongson64 / common / early_printk.c
blob5e2a151aa30c810ccb9a06ca3a636ba94a8c0e2b
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* early printk support
4 * Copyright (c) 2009 Philippe Vachon <philippe@cowpig.ca>
5 * Copyright (c) 2009 Lemote Inc.
6 * Author: Wu Zhangjin, wuzhangjin@gmail.com
7 */
8 #include <linux/serial_reg.h>
9 #include <asm/setup.h>
11 #include <loongson.h>
13 #define PORT(base, offset) (u8 *)(base + offset)
15 static inline unsigned int serial_in(unsigned char *base, int offset)
17 return readb(PORT(base, offset));
20 static inline void serial_out(unsigned char *base, int offset, int value)
22 writeb(value, PORT(base, offset));
25 void prom_putchar(char c)
27 int timeout;
28 unsigned char *uart_base;
30 uart_base = (unsigned char *)_loongson_uart_base[0];
31 timeout = 1024;
33 while (((serial_in(uart_base, UART_LSR) & UART_LSR_THRE) == 0) &&
34 (timeout-- > 0))
37 serial_out(uart_base, UART_TX, c);