| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  *  This program is free software; you can redistribute  it and/or modify it | 
 | 3 |  *  under  the terms of  the GNU General  Public License as published by the | 
 | 4 |  *  Free Software Foundation;  either version 2 of the  License, or (at your | 
 | 5 |  *  option) any later version. | 
 | 6 |  * | 
 | 7 |  *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED | 
 | 8 |  *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF | 
 | 9 |  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN | 
 | 10 |  *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT, | 
 | 11 |  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 
 | 12 |  *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF | 
 | 13 |  *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | 
 | 14 |  *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT | 
 | 15 |  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 
 | 16 |  *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
 | 17 |  * | 
 | 18 |  *  You should have received a copy of the  GNU General Public License along | 
 | 19 |  *  with this program; if not, write  to the Free Software Foundation, Inc., | 
 | 20 |  *  675 Mass Ave, Cambridge, MA 02139, USA. | 
 | 21 |  * | 
 | 22 |  * Copyright 2004 Ralf Baechle <ralf@linux-mips.org> | 
 | 23 |  */ | 
 | 24 | #include <asm/sn/addrs.h> | 
 | 25 | #include <asm/sn/sn0/hub.h> | 
 | 26 | #include <asm/sn/klconfig.h> | 
 | 27 | #include <asm/sn/ioc3.h> | 
 | 28 | #include <asm/sn/sn_private.h> | 
 | 29 |  | 
 | 30 | #include <linux/serial.h> | 
 | 31 | #include <linux/serial_core.h> | 
 | 32 | #include <linux/serial_reg.h> | 
 | 33 |  | 
 | 34 | #define IOC3_CLK        (22000000 / 3) | 
 | 35 | #define IOC3_FLAGS      (0) | 
 | 36 |  | 
 | 37 | static inline struct ioc3_uartregs *console_uart(void) | 
 | 38 | { | 
 | 39 | 	struct ioc3 *ioc3; | 
 | 40 |  | 
 | 41 | 	ioc3 = (struct ioc3 *)KL_CONFIG_CH_CONS_INFO(get_nasid())->memory_base; | 
 | 42 |  | 
 | 43 | 	return &ioc3->sregs.uarta; | 
 | 44 | } | 
 | 45 |  | 
 | 46 | unsigned char getDebugChar(void) | 
 | 47 | { | 
 | 48 | 	struct ioc3_uartregs *uart = console_uart(); | 
 | 49 |  | 
 | 50 | 	while ((uart->iu_lsr & UART_LSR_DR) == 0); | 
 | 51 | 	return uart->iu_rbr; | 
 | 52 | } | 
 | 53 |  | 
 | 54 | void putDebugChar(unsigned char c) | 
 | 55 | { | 
 | 56 | 	struct ioc3_uartregs *uart = console_uart(); | 
 | 57 |  | 
 | 58 | 	while ((uart->iu_lsr & UART_LSR_THRE) == 0); | 
 | 59 | 	uart->iu_thr = c; | 
 | 60 | } |