blob: 7737a88c65693f42054a7b40f5323cba422154e7 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 Torvalds1da177e2005-04-16 15:20:36 -07008
9#include <asm/page.h>
Alexander Sverdlin5c933162018-07-13 17:51:56 +020010#include <asm/setup.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#include <asm/sn/addrs.h>
Thomas Bogendoerferb78e9d62020-01-09 13:33:40 +010012#include <asm/sn/agent.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <asm/sn/klconfig.h>
14#include <asm/sn/ioc3.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
16#include <linux/serial.h>
17#include <linux/serial_core.h>
18
Thomas Bogendoerfer9d0aaf92020-01-09 13:33:48 +010019#include "ip27-common.h"
20
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#define IOC3_CLK (22000000 / 3)
22#define IOC3_FLAGS (0)
23
24static inline struct ioc3_uartregs *console_uart(void)
25{
26 struct ioc3 *ioc3;
Ralf Baechle01d42ab2005-06-27 08:34:27 +000027 nasid_t nasid;
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Ralf Baechle01d42ab2005-06-27 08:34:27 +000029 nasid = (master_nasid == INVALID_NASID) ? get_nasid() : master_nasid;
30 ioc3 = (struct ioc3 *)KL_CONFIG_CH_CONS_INFO(nasid)->memory_base;
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
32 return &ioc3->sregs.uarta;
33}
34
Aaro Koskinenf7be4e72013-02-11 20:51:49 +000035void prom_putchar(char c)
Linus Torvalds1da177e2005-04-16 15:20:36 -070036{
37 struct ioc3_uartregs *uart = console_uart();
38
Thomas Bogendoerfercbe7d512019-08-30 11:25:25 +020039 while ((readb(&uart->iu_lsr) & 0x20) == 0)
40 ;
41 writeb(c, &uart->iu_thr);
Linus Torvalds1da177e2005-04-16 15:20:36 -070042}