MIPS: Whitespace cleanup.
[deliverable/linux.git] / arch / mips / loongson / common / early_printk.c
CommitLineData
f6a2740d
WZ
1/* early printk support
2 *
3 * Copyright (c) 2009 Philippe Vachon <philippe@cowpig.ca>
db54ff24 4 * Copyright (c) 2009 Lemote Inc.
f7a904df 5 * Author: Wu Zhangjin, wuzhangjin@gmail.com
f6a2740d 6 *
70342287
RB
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
f6a2740d
WZ
10 * option) any later version.
11 */
f6a2740d
WZ
12#include <linux/serial_reg.h>
13
5e983ff6 14#include <loongson.h>
f6a2740d
WZ
15
16#define PORT(base, offset) (u8 *)(base + offset)
17
db54ff24 18static inline unsigned int serial_in(unsigned char *base, int offset)
f6a2740d
WZ
19{
20 return readb(PORT(base, offset));
21}
22
db54ff24 23static inline void serial_out(unsigned char *base, int offset, int value)
f6a2740d
WZ
24{
25 writeb(value, PORT(base, offset));
26}
27
28void prom_putchar(char c)
29{
a3ed4951
WZ
30 int timeout;
31 unsigned char *uart_base;
f6a2740d 32
a3ed4951
WZ
33 uart_base = (unsigned char *)_loongson_uart_base;
34 timeout = 1024;
35
36 while (((serial_in(uart_base, UART_LSR) & UART_LSR_THRE) == 0) &&
37 (timeout-- > 0))
f6a2740d
WZ
38 ;
39
40 serial_out(uart_base, UART_TX, c);
41}
This page took 0.22167 seconds and 5 git commands to generate.