2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 #include <linux/console.h>
20 #include <linux/init.h>
21 #include <linux/serial_reg.h>
25 #define SEAD_UART1_REGS_BASE 0xbf000800 /* ttyS1 = RS232 port */
26 #define SEAD_UART0_REGS_BASE 0xbf000900 /* ttyS0 = USB port */
28 #define PORT(base_addr, offset) ((unsigned int __iomem *)(base_addr+(offset)*4))
30 static inline unsigned int serial_in(int offset
, unsigned int base_addr
)
32 return __raw_readl(PORT(base_addr
, offset
)) & 0xff;
35 static inline void serial_out(int offset
, int value
, unsigned int base_addr
)
37 __raw_writel(value
, PORT(base_addr
, offset
));
40 int prom_putchar(char c
, char port
)
42 unsigned int base_addr
;
44 base_addr
= port
? SEAD_UART1_REGS_BASE
: SEAD_UART0_REGS_BASE
;
46 while ((serial_in(UART_LSR
, base_addr
) & UART_LSR_THRE
) == 0)
49 serial_out(UART_TX
, c
, base_addr
);