1 /* 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 4 * for more details. 5 * 6 * Copyright (C) 2001, 2002 Ralf Baechle 7 */ 8 #include <linux/init.h> 9 #include <linux/console.h> 10 #include <linux/kdev_t.h> 11 #include <linux/major.h> 12 #include <linux/serial.h> 13 #include <asm/page.h> 14 #include <asm/sn/addrs.h> 15 #include <asm/sn/sn0/hub.h> 16 #include <asm/sn/klconfig.h> 17 #include <asm/sn/ioc3.h> 18 #include <asm/sn/sn_private.h> 19 20 #define IOC3_BAUD (22000000 / (3*16)) 21 #define IOC3_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) 22 console_uart(void)23static inline struct ioc3_uartregs *console_uart(void) 24 { 25 struct ioc3 *ioc3; 26 27 ioc3 = (struct ioc3 *)KL_CONFIG_CH_CONS_INFO(get_nasid())->memory_base; 28 29 return &ioc3->sregs.uarta; 30 } 31 prom_putchar(char c)32void prom_putchar(char c) 33 { 34 struct ioc3_uartregs *uart = console_uart(); 35 36 while ((uart->iu_lsr & 0x20) == 0); 37 uart->iu_thr = c; 38 } 39 prom_getchar(void)40char __init prom_getchar(void) 41 { 42 return 0; 43 } 44 ioc3_console_probe(void)45static void inline ioc3_console_probe(void) 46 { 47 struct serial_struct req; 48 49 /* Register to interrupt zero because we share the interrupt with 50 the serial driver which we don't properly support yet. */ 51 memset(&req, 0, sizeof(req)); 52 req.irq = 0; 53 req.flags = IOC3_COM_FLAGS; 54 req.io_type = SERIAL_IO_MEM; 55 req.iomem_reg_shift = 0; 56 req.baud_base = IOC3_BAUD; 57 58 req.iomem_base = (unsigned char *) console_uart(); 59 register_serial(&req); 60 } 61 ip27_setup_console(void)62__init void ip27_setup_console(void) 63 { 64 ioc3_console_probe(); 65 } 66