blob: 7f7b112acccb897b90066a6b8357a943284c3a14 [file] [log] [blame]
Russell Kinga09e64f2008-08-05 16:14:15 +01001/*
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 Lindgren0c8219f2010-02-15 08:49:01 -080022
Tony Lindgren96554d72010-04-30 17:39:19 -070023#include <asm/memory.h>
Tony Lindgren0c8219f2010-02-15 08:49:01 -080024#include <asm/mach-types.h>
25
Tony Lindgrence491cf2009-10-20 09:40:47 -070026#include <plat/serial.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010027
Tony Lindgren35ddf7c2010-08-02 14:21:39 +030028#define MDR1_MODE_MASK 0x07
29
Nicolas Pitre8ea0de42011-04-28 17:00:17 -040030volatile u8 *uart_base;
31int uart_shift;
Tony Lindgren0c8219f2010-02-15 08:49:01 -080032
33/*
Tony Lindgren96554d72010-04-30 17:39:19 -070034 * Store the DEBUG_LL uart number into memory.
Tony Lindgren0c8219f2010-02-15 08:49:01 -080035 * See also debug-macro.S, and serial.c for related code.
Tony Lindgren0c8219f2010-02-15 08:49:01 -080036 */
Tony Lindgren96554d72010-04-30 17:39:19 -070037static void set_omap_uart_info(unsigned char port)
Tony Lindgren0c8219f2010-02-15 08:49:01 -080038{
Nicolas Pitredd1854562011-08-31 13:57:37 -040039 /*
40 * Get address of some.bss variable and round it down
41 * a la CONFIG_AUTO_ZRELADDR.
42 */
43 u32 ram_start = (u32)&uart_shift & 0xf8000000;
44 u32 *uart_info = (u32 *)(ram_start + OMAP_UART_INFO_OFS);
45 *uart_info = port;
Tony Lindgren0c8219f2010-02-15 08:49:01 -080046}
Russell Kinga09e64f2008-08-05 16:14:15 +010047
48static void putc(int c)
49{
Tony Lindgren0c8219f2010-02-15 08:49:01 -080050 if (!uart_base)
Russell Kinga09e64f2008-08-05 16:14:15 +010051 return;
Russell Kinga09e64f2008-08-05 16:14:15 +010052
Tony Lindgren35ddf7c2010-08-02 14:21:39 +030053 /* Check for UART 16x mode */
54 if ((uart_base[UART_OMAP_MDR1 << uart_shift] & MDR1_MODE_MASK) != 0)
55 return;
56
Tony Lindgren0c8219f2010-02-15 08:49:01 -080057 while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE))
Russell Kinga09e64f2008-08-05 16:14:15 +010058 barrier();
Tony Lindgren0c8219f2010-02-15 08:49:01 -080059 uart_base[UART_TX << uart_shift] = c;
Russell Kinga09e64f2008-08-05 16:14:15 +010060}
61
62static inline void flush(void)
63{
64}
65
66/*
Tony Lindgren0c8219f2010-02-15 08:49:01 -080067 * Macros to configure UART1 and debug UART
68 */
Tony Lindgren96554d72010-04-30 17:39:19 -070069#define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id) \
Tony Lindgren0c8219f2010-02-15 08:49:01 -080070 if (machine_is_##mach()) { \
Tony Lindgren0c8219f2010-02-15 08:49:01 -080071 uart_base = (volatile u8 *)(dbg_uart); \
72 uart_shift = (dbg_shft); \
73 port = (dbg_id); \
Tony Lindgren96554d72010-04-30 17:39:19 -070074 set_omap_uart_info(port); \
Tony Lindgren0c8219f2010-02-15 08:49:01 -080075 break; \
76 }
77
78#define DEBUG_LL_OMAP7XX(p, mach) \
Tony Lindgren96554d72010-04-30 17:39:19 -070079 _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP7XX_PORT_SHIFT, \
80 OMAP1UART##p)
Tony Lindgren0c8219f2010-02-15 08:49:01 -080081
82#define DEBUG_LL_OMAP1(p, mach) \
Tony Lindgren96554d72010-04-30 17:39:19 -070083 _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP_PORT_SHIFT, \
84 OMAP1UART##p)
Tony Lindgren0c8219f2010-02-15 08:49:01 -080085
86#define DEBUG_LL_OMAP2(p, mach) \
Tony Lindgren96554d72010-04-30 17:39:19 -070087 _DEBUG_LL_ENTRY(mach, OMAP2_UART##p##_BASE, OMAP_PORT_SHIFT, \
88 OMAP2UART##p)
Tony Lindgren0c8219f2010-02-15 08:49:01 -080089
90#define DEBUG_LL_OMAP3(p, mach) \
Tony Lindgren96554d72010-04-30 17:39:19 -070091 _DEBUG_LL_ENTRY(mach, OMAP3_UART##p##_BASE, OMAP_PORT_SHIFT, \
92 OMAP3UART##p)
Tony Lindgren0c8219f2010-02-15 08:49:01 -080093
94#define DEBUG_LL_OMAP4(p, mach) \
Tony Lindgren96554d72010-04-30 17:39:19 -070095 _DEBUG_LL_ENTRY(mach, OMAP4_UART##p##_BASE, OMAP_PORT_SHIFT, \
96 OMAP4UART##p)
Tony Lindgren0c8219f2010-02-15 08:49:01 -080097
R Sricharan05e152c2012-06-05 16:21:32 +053098#define DEBUG_LL_OMAP5(p, mach) \
99 _DEBUG_LL_ENTRY(mach, OMAP5_UART##p##_BASE, OMAP_PORT_SHIFT, \
100 OMAP5UART##p)
Tony Lindgren0c8219f2010-02-15 08:49:01 -0800101/* Zoom2/3 shift is different for UART1 and external port */
102#define DEBUG_LL_ZOOM(mach) \
Tony Lindgren96554d72010-04-30 17:39:19 -0700103 _DEBUG_LL_ENTRY(mach, ZOOM_UART_BASE, ZOOM_PORT_SHIFT, ZOOM_UART)
Tony Lindgren0c8219f2010-02-15 08:49:01 -0800104
Hemant Pedanekara9203602011-12-13 10:46:44 -0800105#define DEBUG_LL_TI81XX(p, mach) \
106 _DEBUG_LL_ENTRY(mach, TI81XX_UART##p##_BASE, OMAP_PORT_SHIFT, \
107 TI81XXUART##p)
Hemant Pedanekar4d887a252011-02-15 23:06:17 +0530108
Afzal Mohammedd0a90012012-05-10 14:23:01 +0530109#define DEBUG_LL_AM33XX(p, mach) \
110 _DEBUG_LL_ENTRY(mach, AM33XX_UART##p##_BASE, OMAP_PORT_SHIFT, \
111 AM33XXUART##p)
112
Domenico Andreoli128aa922012-07-14 22:49:54 +0200113static inline void arch_decomp_setup(void)
Tony Lindgren0c8219f2010-02-15 08:49:01 -0800114{
115 int port = 0;
116
117 /*
118 * Initialize the port based on the machine ID from the bootloader.
119 * Note that we're using macros here instead of switch statement
120 * as machine_is functions are optimized out for the boards that
121 * are not selected.
122 */
123 do {
124 /* omap7xx/8xx based boards using UART1 with shift 0 */
125 DEBUG_LL_OMAP7XX(1, herald);
126 DEBUG_LL_OMAP7XX(1, omap_perseus2);
127
128 /* omap15xx/16xx based boards using UART1 */
129 DEBUG_LL_OMAP1(1, ams_delta);
130 DEBUG_LL_OMAP1(1, nokia770);
131 DEBUG_LL_OMAP1(1, omap_h2);
132 DEBUG_LL_OMAP1(1, omap_h3);
133 DEBUG_LL_OMAP1(1, omap_innovator);
134 DEBUG_LL_OMAP1(1, omap_osk);
135 DEBUG_LL_OMAP1(1, omap_palmte);
136 DEBUG_LL_OMAP1(1, omap_palmz71);
137
138 /* omap15xx/16xx based boards using UART2 */
139 DEBUG_LL_OMAP1(2, omap_palmtt);
140
141 /* omap15xx/16xx based boards using UART3 */
142 DEBUG_LL_OMAP1(3, sx1);
143
144 /* omap2 based boards using UART1 */
Tony Lindgren0c8219f2010-02-15 08:49:01 -0800145 DEBUG_LL_OMAP2(1, omap_2430sdp);
146 DEBUG_LL_OMAP2(1, omap_apollon);
147 DEBUG_LL_OMAP2(1, omap_h4);
148
149 /* omap2 based boards using UART3 */
150 DEBUG_LL_OMAP2(3, nokia_n800);
151 DEBUG_LL_OMAP2(3, nokia_n810);
152 DEBUG_LL_OMAP2(3, nokia_n810_wimax);
153
154 /* omap3 based boards using UART1 */
155 DEBUG_LL_OMAP2(1, omap3evm);
156 DEBUG_LL_OMAP3(1, omap_3430sdp);
157 DEBUG_LL_OMAP3(1, omap_3630sdp);
Tim Nordelld40f3f12010-09-27 16:05:47 +0000158 DEBUG_LL_OMAP3(1, omap3530_lv_som);
159 DEBUG_LL_OMAP3(1, omap3_torpedo);
Tony Lindgren0c8219f2010-02-15 08:49:01 -0800160
161 /* omap3 based boards using UART3 */
162 DEBUG_LL_OMAP3(3, cm_t35);
Igor Grinbergd04b6202010-09-21 16:03:09 +0000163 DEBUG_LL_OMAP3(3, cm_t3517);
Igor Grinbergc3146972011-07-05 03:38:23 -0700164 DEBUG_LL_OMAP3(3, cm_t3730);
Srinath1cb125ca2010-11-16 14:26:58 -0800165 DEBUG_LL_OMAP3(3, craneboard);
Thomas Weber79c5f682010-12-21 11:07:09 +0000166 DEBUG_LL_OMAP3(3, devkit8000);
Tony Lindgren0c8219f2010-02-15 08:49:01 -0800167 DEBUG_LL_OMAP3(3, igep0020);
Enric Balletbo i Serrae844b1d2010-10-08 10:22:11 -0700168 DEBUG_LL_OMAP3(3, igep0030);
Aaro Koskinen2d200662010-12-17 15:13:47 -0800169 DEBUG_LL_OMAP3(3, nokia_rm680);
Aaro Koskinen63fc5f32012-03-05 11:08:37 -0800170 DEBUG_LL_OMAP3(3, nokia_rm696);
Tony Lindgren0c8219f2010-02-15 08:49:01 -0800171 DEBUG_LL_OMAP3(3, nokia_rx51);
172 DEBUG_LL_OMAP3(3, omap3517evm);
173 DEBUG_LL_OMAP3(3, omap3_beagle);
174 DEBUG_LL_OMAP3(3, omap3_pandora);
175 DEBUG_LL_OMAP3(3, omap_ldp);
176 DEBUG_LL_OMAP3(3, overo);
177 DEBUG_LL_OMAP3(3, touchbook);
178
179 /* omap4 based boards using UART3 */
180 DEBUG_LL_OMAP4(3, omap_4430sdp);
David Andersb5be6b62010-09-16 18:44:47 +0530181 DEBUG_LL_OMAP4(3, omap4_panda);
Tony Lindgren0c8219f2010-02-15 08:49:01 -0800182
R Sricharan05e152c2012-06-05 16:21:32 +0530183 /* omap5 based boards using UART3 */
184 DEBUG_LL_OMAP5(3, omap5_sevm);
185
Tony Lindgren0c8219f2010-02-15 08:49:01 -0800186 /* zoom2/3 external uart */
187 DEBUG_LL_ZOOM(omap_zoom2);
188 DEBUG_LL_ZOOM(omap_zoom3);
189
Hemant Pedanekar4d887a252011-02-15 23:06:17 +0530190 /* TI8168 base boards using UART3 */
Hemant Pedanekara9203602011-12-13 10:46:44 -0800191 DEBUG_LL_TI81XX(3, ti8168evm);
Hemant Pedanekar4d887a252011-02-15 23:06:17 +0530192
Hemant Pedanekara890b672011-12-13 10:48:55 -0800193 /* TI8148 base boards using UART1 */
194 DEBUG_LL_TI81XX(1, ti8148evm);
195
Afzal Mohammedd0a90012012-05-10 14:23:01 +0530196 /* AM33XX base boards using UART1 */
197 DEBUG_LL_AM33XX(1, am335xevm);
Tony Lindgren0c8219f2010-02-15 08:49:01 -0800198 } while (0);
199}
200
Tony Lindgren0c8219f2010-02-15 08:49:01 -0800201/*
Russell Kinga09e64f2008-08-05 16:14:15 +0100202 * nothing to do
203 */
Russell Kinga09e64f2008-08-05 16:14:15 +0100204#define arch_decomp_wdog()