diff options
Diffstat (limited to 'arch/mips/mips-boards/generic/console.c')
-rw-r--r-- | arch/mips/mips-boards/generic/console.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/arch/mips/mips-boards/generic/console.c b/arch/mips/mips-boards/generic/console.c new file mode 100644 index 000000000000..4d8ab99e4155 --- /dev/null +++ b/arch/mips/mips-boards/generic/console.c | |||
@@ -0,0 +1,68 @@ | |||
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 | * Putting things on the screen/serial line using YAMONs facilities. | ||
19 | */ | ||
20 | #include <linux/console.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/serial_reg.h> | ||
23 | #include <asm/io.h> | ||
24 | |||
25 | #ifdef CONFIG_MIPS_ATLAS | ||
26 | #include <asm/mips-boards/atlas.h> | ||
27 | |||
28 | #ifdef CONFIG_CPU_LITTLE_ENDIAN | ||
29 | #define PORT(offset) (ATLAS_UART_REGS_BASE + ((offset)<<3)) | ||
30 | #else | ||
31 | #define PORT(offset) (ATLAS_UART_REGS_BASE + 3 + ((offset)<<3)) | ||
32 | #endif | ||
33 | |||
34 | #elif defined(CONFIG_MIPS_SEAD) | ||
35 | |||
36 | #include <asm/mips-boards/sead.h> | ||
37 | |||
38 | #ifdef CONFIG_CPU_LITTLE_ENDIAN | ||
39 | #define PORT(offset) (SEAD_UART0_REGS_BASE + ((offset)<<3)) | ||
40 | #else | ||
41 | #define PORT(offset) (SEAD_UART0_REGS_BASE + 3 + ((offset)<<3)) | ||
42 | #endif | ||
43 | |||
44 | #else | ||
45 | |||
46 | #define PORT(offset) (0x3f8 + (offset)) | ||
47 | |||
48 | #endif | ||
49 | |||
50 | static inline unsigned int serial_in(int offset) | ||
51 | { | ||
52 | return inb(PORT(offset)); | ||
53 | } | ||
54 | |||
55 | static inline void serial_out(int offset, int value) | ||
56 | { | ||
57 | outb(value, PORT(offset)); | ||
58 | } | ||
59 | |||
60 | int prom_putchar(char c) | ||
61 | { | ||
62 | while ((serial_in(UART_LSR) & UART_LSR_THRE) == 0) | ||
63 | ; | ||
64 | |||
65 | serial_out(UART_TX, c); | ||
66 | |||
67 | return 1; | ||
68 | } | ||