2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 2001, 2002, 2004 Ralf Baechle
8 #include <linux/init.h>
9 #include <linux/console.h>
10 #include <linux/kdev_t.h>
11 #include <linux/major.h>
12 #include <linux/termios.h>
13 #include <linux/sched.h>
14 #include <linux/tty.h>
16 #include <linux/serial.h>
17 #include <linux/serial_core.h>
18 #include <asm/serial.h>
21 /* SUPERIO uart register map */
24 volatile u8 rbr; /* read only, DLAB == 0 */
25 volatile u8 thr; /* write only, DLAB == 0 */
26 volatile u8 dll; /* DLAB == 1 */
29 volatile u8 ier; /* DLAB == 0 */
30 volatile u8 dlm; /* DLAB == 1 */
33 volatile u8 iir; /* read only */
34 volatile u8 fcr; /* write only */
51 #define IO_BASE_64 0x9000000000000000ULL
53 static unsigned char readb_outer_space(unsigned long phys)
55 unsigned long long vaddr = IO_BASE_64 | phys;
59 sr = read_c0_status();
60 write_c0_status((sr | ST0_KX) & ~ ST0_IE);
61 __asm__("sll $0, $0, 2\n");
62 __asm__("sll $0, $0, 2\n");
63 __asm__("sll $0, $0, 2\n");
64 __asm__("sll $0, $0, 2\n");
66 __asm__ __volatile__ (
75 __asm__("sll $0, $0, 2\n");
76 __asm__("sll $0, $0, 2\n");
77 __asm__("sll $0, $0, 2\n");
78 __asm__("sll $0, $0, 2\n");
83 static void writeb_outer_space(unsigned long phys, unsigned char c)
85 unsigned long long vaddr = IO_BASE_64 | phys;
89 sr = read_c0_status();
90 write_c0_status((sr | ST0_KX) & ~ ST0_IE);
91 __asm__("sll $0, $0, 2\n");
92 __asm__("sll $0, $0, 2\n");
93 __asm__("sll $0, $0, 2\n");
94 __asm__("sll $0, $0, 2\n");
96 __asm__ __volatile__ (
102 : "r" (&vaddr), "r" (c));
105 __asm__("sll $0, $0, 2\n");
106 __asm__("sll $0, $0, 2\n");
107 __asm__("sll $0, $0, 2\n");
108 __asm__("sll $0, $0, 2\n");
111 void prom_putchar(char c)
113 unsigned long lsr = 0xfd000008UL + offsetof(struct yo_uartregs, iu_lsr);
114 unsigned long thr = 0xfd000008UL + offsetof(struct yo_uartregs, iu_thr);
116 while ((readb_outer_space(lsr) & 0x20) == 0);
117 writeb_outer_space(thr, c);
120 char __init prom_getchar(void)