• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/arch/mips/mti-sead3/
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc.  All rights reserved.
4 *
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.
8 *
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
12 *  for more details.
13 *
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.
17 *
18 */
19#include <linux/console.h>
20#include <linux/init.h>
21#include <linux/serial_reg.h>
22#include <asm/io.h>
23
24
25#define SEAD_UART1_REGS_BASE    0xbf000800   /* ttyS1 = RS232 port */
26#define SEAD_UART0_REGS_BASE    0xbf000900   /* ttyS0 = USB port   */
27
28#define PORT(base_addr, offset) ((unsigned int __iomem *)(base_addr+(offset)*4))
29
30static inline unsigned int serial_in(int offset, unsigned int base_addr)
31{
32	return __raw_readl(PORT(base_addr, offset)) & 0xff;
33}
34
35static inline void serial_out(int offset, int value, unsigned int base_addr)
36{
37	__raw_writel(value, PORT(base_addr, offset));
38}
39
40int prom_putchar(char c, char port)
41{
42	unsigned int base_addr;
43
44	base_addr = port ? SEAD_UART1_REGS_BASE : SEAD_UART0_REGS_BASE;
45
46	while ((serial_in(UART_LSR, base_addr) & UART_LSR_THRE) == 0)
47		;
48
49	serial_out(UART_TX, c, base_addr);
50
51	return 1;
52}
53