Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Serial port stubs for kernel decompress status messages |
| 3 | * |
| 4 | * Author: Anant Gole |
| 5 | * (C) Copyright (C) 2006, Texas Instruments, Inc |
| 6 | * |
| 7 | * This file is licensed under the terms of the GNU General Public License |
| 8 | * version 2. This program is licensed "as is" without any warranty of any |
| 9 | * kind, whether express or implied. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/types.h> |
| 13 | #include <linux/serial_reg.h> |
| 14 | #include <mach/serial.h> |
| 15 | |
Mark A. Greer | 27428e3 | 2009-02-18 14:00:36 -0700 | [diff] [blame] | 16 | #include <asm/mach-types.h> |
| 17 | |
| 18 | extern unsigned int __machine_arch_type; |
| 19 | |
| 20 | static u32 *uart; |
| 21 | |
| 22 | static u32 *get_uart_base(void) |
| 23 | { |
Sudhakar Rajashekhara | 0fbc559 | 2009-07-16 06:42:18 -0400 | [diff] [blame] | 24 | if (__machine_arch_type == MACH_TYPE_DAVINCI_DA830_EVM || |
| 25 | __machine_arch_type == MACH_TYPE_DAVINCI_DA850_EVM) |
Mark A. Greer | 8593790 | 2009-06-03 18:41:53 -0700 | [diff] [blame] | 26 | return (u32 *)DA8XX_UART2_BASE; |
| 27 | else |
| 28 | return (u32 *)DAVINCI_UART0_BASE; |
Mark A. Greer | 27428e3 | 2009-02-18 14:00:36 -0700 | [diff] [blame] | 29 | } |
| 30 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 31 | /* PORT_16C550A, in polled non-fifo mode */ |
| 32 | |
| 33 | static void putc(char c) |
| 34 | { |
Mark A. Greer | 27428e3 | 2009-02-18 14:00:36 -0700 | [diff] [blame] | 35 | if (!uart) |
| 36 | uart = get_uart_base(); |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 37 | |
| 38 | while (!(uart[UART_LSR] & UART_LSR_THRE)) |
| 39 | barrier(); |
| 40 | uart[UART_TX] = c; |
| 41 | } |
| 42 | |
| 43 | static inline void flush(void) |
| 44 | { |
Mark A. Greer | 27428e3 | 2009-02-18 14:00:36 -0700 | [diff] [blame] | 45 | if (!uart) |
| 46 | uart = get_uart_base(); |
| 47 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 48 | while (!(uart[UART_LSR] & UART_LSR_THRE)) |
| 49 | barrier(); |
| 50 | } |
| 51 | |
| 52 | #define arch_decomp_setup() |
| 53 | #define arch_decomp_wdog() |