Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/plat-omap/include/mach/uncompress.h |
| 3 | * |
| 4 | * Serial port stubs for kernel decompress status messages |
| 5 | * |
| 6 | * Initially based on: |
| 7 | * linux-2.4.15-rmk1-dsplinux1.6/arch/arm/plat-omap/include/mach1510/uncompress.h |
| 8 | * Copyright (C) 2000 RidgeRun, Inc. |
| 9 | * Author: Greg Lonnon <glonnon@ridgerun.com> |
| 10 | * |
| 11 | * Rewritten by: |
| 12 | * Author: <source@mvista.com> |
| 13 | * 2004 (c) MontaVista Software, Inc. |
| 14 | * |
| 15 | * This file is licensed under the terms of the GNU General Public License |
| 16 | * version 2. This program is licensed "as is" without any warranty of any |
| 17 | * kind, whether express or implied. |
| 18 | */ |
| 19 | |
| 20 | #include <linux/types.h> |
| 21 | #include <linux/serial_reg.h> |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 22 | |
Tony Lindgren | 96554d7 | 2010-04-30 17:39:19 -0700 | [diff] [blame] | 23 | #include <asm/memory.h> |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 24 | #include <asm/mach-types.h> |
| 25 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 26 | #include <plat/serial.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 27 | |
Tony Lindgren | 35ddf7c | 2010-08-02 14:21:39 +0300 | [diff] [blame] | 28 | #define MDR1_MODE_MASK 0x07 |
| 29 | |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 30 | static volatile u8 *uart_base; |
| 31 | static int uart_shift; |
| 32 | |
| 33 | /* |
Tony Lindgren | 96554d7 | 2010-04-30 17:39:19 -0700 | [diff] [blame] | 34 | * Store the DEBUG_LL uart number into memory. |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 35 | * See also debug-macro.S, and serial.c for related code. |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 36 | */ |
Tony Lindgren | 96554d7 | 2010-04-30 17:39:19 -0700 | [diff] [blame] | 37 | static void set_omap_uart_info(unsigned char port) |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 38 | { |
Tony Lindgren | 96554d7 | 2010-04-30 17:39:19 -0700 | [diff] [blame] | 39 | *(volatile u32 *)OMAP_UART_INFO = port; |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 40 | } |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 41 | |
| 42 | static void putc(int c) |
| 43 | { |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 44 | if (!uart_base) |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 45 | return; |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 46 | |
Tony Lindgren | 35ddf7c | 2010-08-02 14:21:39 +0300 | [diff] [blame] | 47 | /* Check for UART 16x mode */ |
| 48 | if ((uart_base[UART_OMAP_MDR1 << uart_shift] & MDR1_MODE_MASK) != 0) |
| 49 | return; |
| 50 | |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 51 | while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE)) |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 52 | barrier(); |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 53 | uart_base[UART_TX << uart_shift] = c; |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | static inline void flush(void) |
| 57 | { |
| 58 | } |
| 59 | |
| 60 | /* |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 61 | * Macros to configure UART1 and debug UART |
| 62 | */ |
Tony Lindgren | 96554d7 | 2010-04-30 17:39:19 -0700 | [diff] [blame] | 63 | #define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id) \ |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 64 | if (machine_is_##mach()) { \ |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 65 | uart_base = (volatile u8 *)(dbg_uart); \ |
| 66 | uart_shift = (dbg_shft); \ |
| 67 | port = (dbg_id); \ |
Tony Lindgren | 96554d7 | 2010-04-30 17:39:19 -0700 | [diff] [blame] | 68 | set_omap_uart_info(port); \ |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 69 | break; \ |
| 70 | } |
| 71 | |
| 72 | #define DEBUG_LL_OMAP7XX(p, mach) \ |
Tony Lindgren | 96554d7 | 2010-04-30 17:39:19 -0700 | [diff] [blame] | 73 | _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP7XX_PORT_SHIFT, \ |
| 74 | OMAP1UART##p) |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 75 | |
| 76 | #define DEBUG_LL_OMAP1(p, mach) \ |
Tony Lindgren | 96554d7 | 2010-04-30 17:39:19 -0700 | [diff] [blame] | 77 | _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP_PORT_SHIFT, \ |
| 78 | OMAP1UART##p) |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 79 | |
| 80 | #define DEBUG_LL_OMAP2(p, mach) \ |
Tony Lindgren | 96554d7 | 2010-04-30 17:39:19 -0700 | [diff] [blame] | 81 | _DEBUG_LL_ENTRY(mach, OMAP2_UART##p##_BASE, OMAP_PORT_SHIFT, \ |
| 82 | OMAP2UART##p) |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 83 | |
| 84 | #define DEBUG_LL_OMAP3(p, mach) \ |
Tony Lindgren | 96554d7 | 2010-04-30 17:39:19 -0700 | [diff] [blame] | 85 | _DEBUG_LL_ENTRY(mach, OMAP3_UART##p##_BASE, OMAP_PORT_SHIFT, \ |
| 86 | OMAP3UART##p) |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 87 | |
| 88 | #define DEBUG_LL_OMAP4(p, mach) \ |
Tony Lindgren | 96554d7 | 2010-04-30 17:39:19 -0700 | [diff] [blame] | 89 | _DEBUG_LL_ENTRY(mach, OMAP4_UART##p##_BASE, OMAP_PORT_SHIFT, \ |
| 90 | OMAP4UART##p) |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 91 | |
| 92 | /* Zoom2/3 shift is different for UART1 and external port */ |
| 93 | #define DEBUG_LL_ZOOM(mach) \ |
Tony Lindgren | 96554d7 | 2010-04-30 17:39:19 -0700 | [diff] [blame] | 94 | _DEBUG_LL_ENTRY(mach, ZOOM_UART_BASE, ZOOM_PORT_SHIFT, ZOOM_UART) |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame] | 95 | |
| 96 | static inline void __arch_decomp_setup(unsigned long arch_id) |
| 97 | { |
| 98 | int port = 0; |
| 99 | |
| 100 | /* |
| 101 | * Initialize the port based on the machine ID from the bootloader. |
| 102 | * Note that we're using macros here instead of switch statement |
| 103 | * as machine_is functions are optimized out for the boards that |
| 104 | * are not selected. |
| 105 | */ |
| 106 | do { |
| 107 | /* omap7xx/8xx based boards using UART1 with shift 0 */ |
| 108 | DEBUG_LL_OMAP7XX(1, herald); |
| 109 | DEBUG_LL_OMAP7XX(1, omap_perseus2); |
| 110 | |
| 111 | /* omap15xx/16xx based boards using UART1 */ |
| 112 | DEBUG_LL_OMAP1(1, ams_delta); |
| 113 | DEBUG_LL_OMAP1(1, nokia770); |
| 114 | DEBUG_LL_OMAP1(1, omap_h2); |
| 115 | DEBUG_LL_OMAP1(1, omap_h3); |
| 116 | DEBUG_LL_OMAP1(1, omap_innovator); |
| 117 | DEBUG_LL_OMAP1(1, omap_osk); |
| 118 | DEBUG_LL_OMAP1(1, omap_palmte); |
| 119 | DEBUG_LL_OMAP1(1, omap_palmz71); |
| 120 | |
| 121 | /* omap15xx/16xx based boards using UART2 */ |
| 122 | DEBUG_LL_OMAP1(2, omap_palmtt); |
| 123 | |
| 124 | /* omap15xx/16xx based boards using UART3 */ |
| 125 | DEBUG_LL_OMAP1(3, sx1); |
| 126 | |
| 127 | /* omap2 based boards using UART1 */ |
| 128 | DEBUG_LL_OMAP2(1, omap2evm); |
| 129 | DEBUG_LL_OMAP2(1, omap_2430sdp); |
| 130 | DEBUG_LL_OMAP2(1, omap_apollon); |
| 131 | DEBUG_LL_OMAP2(1, omap_h4); |
| 132 | |
| 133 | /* omap2 based boards using UART3 */ |
| 134 | DEBUG_LL_OMAP2(3, nokia_n800); |
| 135 | DEBUG_LL_OMAP2(3, nokia_n810); |
| 136 | DEBUG_LL_OMAP2(3, nokia_n810_wimax); |
| 137 | |
| 138 | /* omap3 based boards using UART1 */ |
| 139 | DEBUG_LL_OMAP2(1, omap3evm); |
| 140 | DEBUG_LL_OMAP3(1, omap_3430sdp); |
| 141 | DEBUG_LL_OMAP3(1, omap_3630sdp); |
| 142 | |
| 143 | /* omap3 based boards using UART3 */ |
| 144 | DEBUG_LL_OMAP3(3, cm_t35); |
| 145 | DEBUG_LL_OMAP3(3, igep0020); |
| 146 | DEBUG_LL_OMAP3(3, nokia_rx51); |
| 147 | DEBUG_LL_OMAP3(3, omap3517evm); |
| 148 | DEBUG_LL_OMAP3(3, omap3_beagle); |
| 149 | DEBUG_LL_OMAP3(3, omap3_pandora); |
| 150 | DEBUG_LL_OMAP3(3, omap_ldp); |
| 151 | DEBUG_LL_OMAP3(3, overo); |
| 152 | DEBUG_LL_OMAP3(3, touchbook); |
| 153 | |
| 154 | /* omap4 based boards using UART3 */ |
| 155 | DEBUG_LL_OMAP4(3, omap_4430sdp); |
| 156 | |
| 157 | /* zoom2/3 external uart */ |
| 158 | DEBUG_LL_ZOOM(omap_zoom2); |
| 159 | DEBUG_LL_ZOOM(omap_zoom3); |
| 160 | |
| 161 | } while (0); |
| 162 | } |
| 163 | |
| 164 | #define arch_decomp_setup() __arch_decomp_setup(arch_id) |
| 165 | |
| 166 | /* |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 167 | * nothing to do |
| 168 | */ |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 169 | #define arch_decomp_wdog() |