drm/panel: panel-himax-hx83102: support for csot-pna957qt1-1 MIPI-DSI panel
[drm/drm-misc.git] / arch / mips / boot / compressed / uart-16550.c
blobdb618e72a0c42a9da610a881eeb851c1b357c745
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * 16550 compatible uart based serial debug support for zboot
4 */
6 #include <linux/types.h>
7 #include <linux/serial_reg.h>
9 #include <asm/addrspace.h>
11 #include "decompress.h"
13 #if defined(CONFIG_MACH_LOONGSON64) || defined(CONFIG_MIPS_MALTA)
14 #define UART_BASE 0x1fd003f8
15 #define PORT(offset) (CKSEG1ADDR(UART_BASE) + (offset))
16 #endif
18 #ifdef CONFIG_MACH_INGENIC
19 #define INGENIC_UART_BASE_ADDR (0x10030000 + 0x1000 * CONFIG_ZBOOT_INGENIC_UART)
20 #define PORT(offset) (CKSEG1ADDR(INGENIC_UART_BASE_ADDR) + (4 * offset))
21 #endif
23 #ifndef IOTYPE
24 #define IOTYPE char
25 #endif
27 #ifndef PORT
28 #error please define the serial port address for your own machine
29 #endif
31 static inline unsigned int serial_in(int offset)
33 return *((volatile IOTYPE *)PORT(offset)) & 0xFF;
36 static inline void serial_out(int offset, int value)
38 *((volatile IOTYPE *)PORT(offset)) = value & 0xFF;
41 void putc(char c)
43 int timeout = 1000000;
45 while (((serial_in(UART_LSR) & UART_LSR_THRE) == 0) && (timeout-- > 0))
48 serial_out(UART_TX, c);