Path: blob/master/arch/mips/boot/compressed/uart-16550.c
10818 views
/*1* 16550 compatible uart based serial debug support for zboot2*/34#include <linux/types.h>5#include <linux/serial_reg.h>6#include <linux/init.h>78#include <asm/addrspace.h>910#if defined(CONFIG_MACH_LOONGSON) || defined(CONFIG_MIPS_MALTA)11#define UART_BASE 0x1fd003f812#define PORT(offset) (CKSEG1ADDR(UART_BASE) + (offset))13#endif1415#ifdef CONFIG_AR716#include <ar7.h>17#define PORT(offset) (CKSEG1ADDR(AR7_REGS_UART0) + (4 * offset))18#endif1920#ifndef PORT21#error please define the serial port address for your own machine22#endif2324static inline unsigned int serial_in(int offset)25{26return *((char *)PORT(offset));27}2829static inline void serial_out(int offset, int value)30{31*((char *)PORT(offset)) = value;32}3334void putc(char c)35{36int timeout = 1024;3738while (((serial_in(UART_LSR) & UART_LSR_THRE) == 0) && (timeout-- > 0))39;4041serial_out(UART_TX, c);42}434445