MIPS: Yosemite, Emma: Fix off-by-two in arcs_cmdline buffer size check
[linux-2.6/linux-mips.git] / arch / arm / plat-omap / include / plat / uncompress.h
blob2f472e989ec6b9ee66e592c0d314a696a578c829
1 /*
2 * arch/arm/plat-omap/include/mach/uncompress.h
4 * Serial port stubs for kernel decompress status messages
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>
11 * Rewritten by:
12 * Author: <source@mvista.com>
13 * 2004 (c) MontaVista Software, Inc.
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.
20 #include <linux/types.h>
21 #include <linux/serial_reg.h>
23 #include <asm/memory.h>
24 #include <asm/mach-types.h>
26 #include <plat/serial.h>
28 #define MDR1_MODE_MASK 0x07
30 volatile u8 *uart_base;
31 int uart_shift;
34 * Store the DEBUG_LL uart number into memory.
35 * See also debug-macro.S, and serial.c for related code.
37 static void set_omap_uart_info(unsigned char port)
40 * Get address of some.bss variable and round it down
41 * a la CONFIG_AUTO_ZRELADDR.
43 u32 ram_start = (u32)&uart_shift & 0xf8000000;
44 u32 *uart_info = (u32 *)(ram_start + OMAP_UART_INFO_OFS);
45 *uart_info = port;
48 static void putc(int c)
50 if (!uart_base)
51 return;
53 /* Check for UART 16x mode */
54 if ((uart_base[UART_OMAP_MDR1 << uart_shift] & MDR1_MODE_MASK) != 0)
55 return;
57 while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE))
58 barrier();
59 uart_base[UART_TX << uart_shift] = c;
62 static inline void flush(void)
67 * Macros to configure UART1 and debug UART
69 #define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id) \
70 if (machine_is_##mach()) { \
71 uart_base = (volatile u8 *)(dbg_uart); \
72 uart_shift = (dbg_shft); \
73 port = (dbg_id); \
74 set_omap_uart_info(port); \
75 break; \
78 #define DEBUG_LL_OMAP7XX(p, mach) \
79 _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP7XX_PORT_SHIFT, \
80 OMAP1UART##p)
82 #define DEBUG_LL_OMAP1(p, mach) \
83 _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP_PORT_SHIFT, \
84 OMAP1UART##p)
86 #define DEBUG_LL_OMAP2(p, mach) \
87 _DEBUG_LL_ENTRY(mach, OMAP2_UART##p##_BASE, OMAP_PORT_SHIFT, \
88 OMAP2UART##p)
90 #define DEBUG_LL_OMAP3(p, mach) \
91 _DEBUG_LL_ENTRY(mach, OMAP3_UART##p##_BASE, OMAP_PORT_SHIFT, \
92 OMAP3UART##p)
94 #define DEBUG_LL_OMAP4(p, mach) \
95 _DEBUG_LL_ENTRY(mach, OMAP4_UART##p##_BASE, OMAP_PORT_SHIFT, \
96 OMAP4UART##p)
98 /* Zoom2/3 shift is different for UART1 and external port */
99 #define DEBUG_LL_ZOOM(mach) \
100 _DEBUG_LL_ENTRY(mach, ZOOM_UART_BASE, ZOOM_PORT_SHIFT, ZOOM_UART)
102 #define DEBUG_LL_TI816X(p, mach) \
103 _DEBUG_LL_ENTRY(mach, TI816X_UART##p##_BASE, OMAP_PORT_SHIFT, \
104 TI816XUART##p)
106 static inline void __arch_decomp_setup(unsigned long arch_id)
108 int port = 0;
111 * Initialize the port based on the machine ID from the bootloader.
112 * Note that we're using macros here instead of switch statement
113 * as machine_is functions are optimized out for the boards that
114 * are not selected.
116 do {
117 /* omap7xx/8xx based boards using UART1 with shift 0 */
118 DEBUG_LL_OMAP7XX(1, herald);
119 DEBUG_LL_OMAP7XX(1, omap_perseus2);
121 /* omap15xx/16xx based boards using UART1 */
122 DEBUG_LL_OMAP1(1, ams_delta);
123 DEBUG_LL_OMAP1(1, nokia770);
124 DEBUG_LL_OMAP1(1, omap_h2);
125 DEBUG_LL_OMAP1(1, omap_h3);
126 DEBUG_LL_OMAP1(1, omap_innovator);
127 DEBUG_LL_OMAP1(1, omap_osk);
128 DEBUG_LL_OMAP1(1, omap_palmte);
129 DEBUG_LL_OMAP1(1, omap_palmz71);
131 /* omap15xx/16xx based boards using UART2 */
132 DEBUG_LL_OMAP1(2, omap_palmtt);
134 /* omap15xx/16xx based boards using UART3 */
135 DEBUG_LL_OMAP1(3, sx1);
137 /* omap2 based boards using UART1 */
138 DEBUG_LL_OMAP2(1, omap_2430sdp);
139 DEBUG_LL_OMAP2(1, omap_apollon);
140 DEBUG_LL_OMAP2(1, omap_h4);
142 /* omap2 based boards using UART3 */
143 DEBUG_LL_OMAP2(3, nokia_n800);
144 DEBUG_LL_OMAP2(3, nokia_n810);
145 DEBUG_LL_OMAP2(3, nokia_n810_wimax);
147 /* omap3 based boards using UART1 */
148 DEBUG_LL_OMAP2(1, omap3evm);
149 DEBUG_LL_OMAP3(1, omap_3430sdp);
150 DEBUG_LL_OMAP3(1, omap_3630sdp);
151 DEBUG_LL_OMAP3(1, omap3530_lv_som);
152 DEBUG_LL_OMAP3(1, omap3_torpedo);
154 /* omap3 based boards using UART3 */
155 DEBUG_LL_OMAP3(3, cm_t35);
156 DEBUG_LL_OMAP3(3, cm_t3517);
157 DEBUG_LL_OMAP3(3, cm_t3730);
158 DEBUG_LL_OMAP3(3, craneboard);
159 DEBUG_LL_OMAP3(3, devkit8000);
160 DEBUG_LL_OMAP3(3, igep0020);
161 DEBUG_LL_OMAP3(3, igep0030);
162 DEBUG_LL_OMAP3(3, nokia_rm680);
163 DEBUG_LL_OMAP3(3, nokia_rx51);
164 DEBUG_LL_OMAP3(3, omap3517evm);
165 DEBUG_LL_OMAP3(3, omap3_beagle);
166 DEBUG_LL_OMAP3(3, omap3_pandora);
167 DEBUG_LL_OMAP3(3, omap_ldp);
168 DEBUG_LL_OMAP3(3, overo);
169 DEBUG_LL_OMAP3(3, touchbook);
171 /* omap4 based boards using UART3 */
172 DEBUG_LL_OMAP4(3, omap_4430sdp);
173 DEBUG_LL_OMAP4(3, omap4_panda);
175 /* zoom2/3 external uart */
176 DEBUG_LL_ZOOM(omap_zoom2);
177 DEBUG_LL_ZOOM(omap_zoom3);
179 /* TI8168 base boards using UART3 */
180 DEBUG_LL_TI816X(3, ti8168evm);
182 } while (0);
185 #define arch_decomp_setup() __arch_decomp_setup(arch_id)
188 * nothing to do
190 #define arch_decomp_wdog()