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 | |
| 23 | #include <asm/mach-types.h> |
| 24 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 25 | #include <plat/serial.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 26 | |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame^] | 27 | static volatile u8 *uart1_base; |
| 28 | static int uart1_shift; |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 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 | /* |
| 34 | * Store the DEBUG_LL uart number into UART1 scratchpad register. |
| 35 | * See also debug-macro.S, and serial.c for related code. |
| 36 | * |
| 37 | * Please note that we currently assume that: |
| 38 | * - UART1 clocks are enabled for register access |
| 39 | * - UART1 scratchpad register can be used |
| 40 | */ |
| 41 | static void set_uart1_scratchpad(unsigned char port) |
| 42 | { |
| 43 | uart1_base[UART_SCR << uart1_shift] = port; |
| 44 | } |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 45 | |
| 46 | static void putc(int c) |
| 47 | { |
Tony Lindgren | 0c8219f | 2010-02-15 08:49:01 -0800 | [diff] [blame^] | 48 | if (!uart_base) |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 49 | return; |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 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 | */ |
| 63 | #define _DEBUG_LL_ENTRY(mach, uart1_phys, uart1_shft, \ |
| 64 | dbg_uart, dbg_shft, dbg_id) \ |
| 65 | if (machine_is_##mach()) { \ |
| 66 | uart1_base = (volatile u8 *)(uart1_phys); \ |
| 67 | uart1_shift = (uart1_shft); \ |
| 68 | uart_base = (volatile u8 *)(dbg_uart); \ |
| 69 | uart_shift = (dbg_shft); \ |
| 70 | port = (dbg_id); \ |
| 71 | set_uart1_scratchpad(port); \ |
| 72 | break; \ |
| 73 | } |
| 74 | |
| 75 | #define DEBUG_LL_OMAP7XX(p, mach) \ |
| 76 | _DEBUG_LL_ENTRY(mach, OMAP1_UART1_BASE, OMAP7XX_PORT_SHIFT, \ |
| 77 | OMAP1_UART##p##_BASE, OMAP7XX_PORT_SHIFT, OMAP1UART##p) |
| 78 | |
| 79 | #define DEBUG_LL_OMAP1(p, mach) \ |
| 80 | _DEBUG_LL_ENTRY(mach, OMAP1_UART1_BASE, OMAP_PORT_SHIFT, \ |
| 81 | OMAP1_UART##p##_BASE, OMAP_PORT_SHIFT, OMAP1UART##p) |
| 82 | |
| 83 | #define DEBUG_LL_OMAP2(p, mach) \ |
| 84 | _DEBUG_LL_ENTRY(mach, OMAP2_UART1_BASE, OMAP_PORT_SHIFT, \ |
| 85 | OMAP2_UART##p##_BASE, OMAP_PORT_SHIFT, OMAP2UART##p) |
| 86 | |
| 87 | #define DEBUG_LL_OMAP3(p, mach) \ |
| 88 | _DEBUG_LL_ENTRY(mach, OMAP3_UART1_BASE, OMAP_PORT_SHIFT, \ |
| 89 | OMAP3_UART##p##_BASE, OMAP_PORT_SHIFT, OMAP3UART##p) |
| 90 | |
| 91 | #define DEBUG_LL_OMAP4(p, mach) \ |
| 92 | _DEBUG_LL_ENTRY(mach, OMAP4_UART1_BASE, OMAP_PORT_SHIFT, \ |
| 93 | OMAP4_UART##p##_BASE, OMAP_PORT_SHIFT, OMAP4UART##p) |
| 94 | |
| 95 | /* Zoom2/3 shift is different for UART1 and external port */ |
| 96 | #define DEBUG_LL_ZOOM(mach) \ |
| 97 | _DEBUG_LL_ENTRY(mach, OMAP2_UART1_BASE, OMAP_PORT_SHIFT, \ |
| 98 | ZOOM_UART_BASE, ZOOM_PORT_SHIFT, ZOOM_UART) |
| 99 | |
| 100 | static inline void __arch_decomp_setup(unsigned long arch_id) |
| 101 | { |
| 102 | int port = 0; |
| 103 | |
| 104 | /* |
| 105 | * Initialize the port based on the machine ID from the bootloader. |
| 106 | * Note that we're using macros here instead of switch statement |
| 107 | * as machine_is functions are optimized out for the boards that |
| 108 | * are not selected. |
| 109 | */ |
| 110 | do { |
| 111 | /* omap7xx/8xx based boards using UART1 with shift 0 */ |
| 112 | DEBUG_LL_OMAP7XX(1, herald); |
| 113 | DEBUG_LL_OMAP7XX(1, omap_perseus2); |
| 114 | |
| 115 | /* omap15xx/16xx based boards using UART1 */ |
| 116 | DEBUG_LL_OMAP1(1, ams_delta); |
| 117 | DEBUG_LL_OMAP1(1, nokia770); |
| 118 | DEBUG_LL_OMAP1(1, omap_h2); |
| 119 | DEBUG_LL_OMAP1(1, omap_h3); |
| 120 | DEBUG_LL_OMAP1(1, omap_innovator); |
| 121 | DEBUG_LL_OMAP1(1, omap_osk); |
| 122 | DEBUG_LL_OMAP1(1, omap_palmte); |
| 123 | DEBUG_LL_OMAP1(1, omap_palmz71); |
| 124 | |
| 125 | /* omap15xx/16xx based boards using UART2 */ |
| 126 | DEBUG_LL_OMAP1(2, omap_palmtt); |
| 127 | |
| 128 | /* omap15xx/16xx based boards using UART3 */ |
| 129 | DEBUG_LL_OMAP1(3, sx1); |
| 130 | |
| 131 | /* omap2 based boards using UART1 */ |
| 132 | DEBUG_LL_OMAP2(1, omap2evm); |
| 133 | DEBUG_LL_OMAP2(1, omap_2430sdp); |
| 134 | DEBUG_LL_OMAP2(1, omap_apollon); |
| 135 | DEBUG_LL_OMAP2(1, omap_h4); |
| 136 | |
| 137 | /* omap2 based boards using UART3 */ |
| 138 | DEBUG_LL_OMAP2(3, nokia_n800); |
| 139 | DEBUG_LL_OMAP2(3, nokia_n810); |
| 140 | DEBUG_LL_OMAP2(3, nokia_n810_wimax); |
| 141 | |
| 142 | /* omap3 based boards using UART1 */ |
| 143 | DEBUG_LL_OMAP2(1, omap3evm); |
| 144 | DEBUG_LL_OMAP3(1, omap_3430sdp); |
| 145 | DEBUG_LL_OMAP3(1, omap_3630sdp); |
| 146 | |
| 147 | /* omap3 based boards using UART3 */ |
| 148 | DEBUG_LL_OMAP3(3, cm_t35); |
| 149 | DEBUG_LL_OMAP3(3, igep0020); |
| 150 | DEBUG_LL_OMAP3(3, nokia_rx51); |
| 151 | DEBUG_LL_OMAP3(3, omap3517evm); |
| 152 | DEBUG_LL_OMAP3(3, omap3_beagle); |
| 153 | DEBUG_LL_OMAP3(3, omap3_pandora); |
| 154 | DEBUG_LL_OMAP3(3, omap_ldp); |
| 155 | DEBUG_LL_OMAP3(3, overo); |
| 156 | DEBUG_LL_OMAP3(3, touchbook); |
| 157 | |
| 158 | /* omap4 based boards using UART3 */ |
| 159 | DEBUG_LL_OMAP4(3, omap_4430sdp); |
| 160 | |
| 161 | /* zoom2/3 external uart */ |
| 162 | DEBUG_LL_ZOOM(omap_zoom2); |
| 163 | DEBUG_LL_ZOOM(omap_zoom3); |
| 164 | |
| 165 | } while (0); |
| 166 | } |
| 167 | |
| 168 | #define arch_decomp_setup() __arch_decomp_setup(arch_id) |
| 169 | |
| 170 | /* |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 171 | * nothing to do |
| 172 | */ |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 173 | #define arch_decomp_wdog() |