Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | |
| 9 | #include <asm/page.h> |
Alexander Sverdlin | 5c93316 | 2018-07-13 17:51:56 +0200 | [diff] [blame] | 10 | #include <asm/setup.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #include <asm/sn/addrs.h> |
Thomas Bogendoerfer | b78e9d6 | 2020-01-09 13:33:40 +0100 | [diff] [blame] | 12 | #include <asm/sn/agent.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include <asm/sn/klconfig.h> |
| 14 | #include <asm/sn/ioc3.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | |
| 16 | #include <linux/serial.h> |
| 17 | #include <linux/serial_core.h> |
| 18 | |
Thomas Bogendoerfer | 9d0aaf9 | 2020-01-09 13:33:48 +0100 | [diff] [blame] | 19 | #include "ip27-common.h" |
| 20 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | #define IOC3_CLK (22000000 / 3) |
| 22 | #define IOC3_FLAGS (0) |
| 23 | |
| 24 | static inline struct ioc3_uartregs *console_uart(void) |
| 25 | { |
| 26 | struct ioc3 *ioc3; |
Ralf Baechle | 01d42ab | 2005-06-27 08:34:27 +0000 | [diff] [blame] | 27 | nasid_t nasid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | |
Ralf Baechle | 01d42ab | 2005-06-27 08:34:27 +0000 | [diff] [blame] | 29 | nasid = (master_nasid == INVALID_NASID) ? get_nasid() : master_nasid; |
| 30 | ioc3 = (struct ioc3 *)KL_CONFIG_CH_CONS_INFO(nasid)->memory_base; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
| 32 | return &ioc3->sregs.uarta; |
| 33 | } |
| 34 | |
Aaro Koskinen | f7be4e7 | 2013-02-11 20:51:49 +0000 | [diff] [blame] | 35 | void prom_putchar(char c) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | { |
| 37 | struct ioc3_uartregs *uart = console_uart(); |
| 38 | |
Thomas Bogendoerfer | cbe7d51 | 2019-08-30 11:25:25 +0200 | [diff] [blame] | 39 | while ((readb(&uart->iu_lsr) & 0x20) == 0) |
| 40 | ; |
| 41 | writeb(c, &uart->iu_thr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | } |