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 ssnop() __asm__ __volatile__("sll $0, $0, 1\n");
52 #define ssnop_4() do { ssnop(); ssnop(); ssnop(); ssnop(); } while (0)
54 #define IO_BASE_64 0x9000000000000000ULL
56 static unsigned char readb_outer_space(unsigned long long phys
)
58 unsigned long long vaddr
= IO_BASE_64
| phys
;
62 sr
= read_c0_status();
63 write_c0_status((sr
| ST0_KX
) & ~ ST0_IE
);
66 __asm__
__volatile__ (
84 static void writeb_outer_space(unsigned long long phys
, unsigned char c
)
86 unsigned long long vaddr
= IO_BASE_64
| phys
;
90 sr
= read_c0_status();
91 write_c0_status((sr
| ST0_KX
) & ~ ST0_IE
);
94 __asm__
__volatile__ (
104 : "R" (vaddr
), "r" (c
));
110 void prom_putchar(char c
)
112 unsigned long lsr
= 0xfd000008ULL
+ offsetof(struct yo_uartregs
, iu_lsr
);
113 unsigned long thr
= 0xfd000008ULL
+ offsetof(struct yo_uartregs
, iu_thr
);
115 while ((readb_outer_space(lsr
) & 0x20) == 0);
116 writeb_outer_space(thr
, c
);