uncompress.h 4.49 KB
Newer Older
Linus Torvalds's avatar
Linus Torvalds committed
1
/*
2
 * arch/arm/plat-omap/include/mach/uncompress.h
Linus Torvalds's avatar
Linus Torvalds committed
3
4
5
6
 *
 * Serial port stubs for kernel decompress status messages
 *
 * Initially based on:
7
 * linux-2.4.15-rmk1-dsplinux1.6/arch/arm/plat-omap/include/mach1510/uncompress.h
Linus Torvalds's avatar
Linus Torvalds committed
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 * Copyright (C) 2000 RidgeRun, Inc.
 * Author: Greg Lonnon <glonnon@ridgerun.com>
 *
 * Rewritten by:
 * Author: <source@mvista.com>
 * 2004 (c) MontaVista Software, Inc.
 *
 * This file is licensed under the terms of the GNU General Public License
 * version 2. This program is licensed "as is" without any warranty of any
 * kind, whether express or implied.
 */

#include <linux/types.h>
#include <linux/serial_reg.h>
22

23
#include <asm/memory.h>
24
25
#include <asm/mach-types.h>

26
#include <plat/serial.h>
Linus Torvalds's avatar
Linus Torvalds committed
27

28
29
#define MDR1_MODE_MASK			0x07

30
31
static volatile u8 *uart_base;
static int uart_shift;
Linus Torvalds's avatar
Linus Torvalds committed
32

33
/*
34
 * Store the DEBUG_LL uart number into memory.
35
36
 * See also debug-macro.S, and serial.c for related code.
 */
37
static void set_omap_uart_info(unsigned char port)
Linus Torvalds's avatar
Linus Torvalds committed
38
{
39
	*(volatile u32 *)OMAP_UART_INFO = port;
40
}
Linus Torvalds's avatar
Linus Torvalds committed
41

42
43
44
static void putc(int c)
{
	if (!uart_base)
Linus Torvalds's avatar
Linus Torvalds committed
45
46
		return;

47
48
49
50
	/* Check for UART 16x mode */
	if ((uart_base[UART_OMAP_MDR1 << uart_shift] & MDR1_MODE_MASK) != 0)
		return;

51
	while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE))
52
		barrier();
53
	uart_base[UART_TX << uart_shift] = c;
54
55
56
57
}

static inline void flush(void)
{
Linus Torvalds's avatar
Linus Torvalds committed
58
59
}

60
61
62
/*
 * Macros to configure UART1 and debug UART
 */
63
#define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id)		\
64
65
66
67
	if (machine_is_##mach()) {					\
		uart_base = (volatile u8 *)(dbg_uart);			\
		uart_shift = (dbg_shft);				\
		port = (dbg_id);					\
68
		set_omap_uart_info(port);				\
69
70
71
72
		break;							\
	}

#define DEBUG_LL_OMAP7XX(p, mach)					\
73
74
	_DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP7XX_PORT_SHIFT,	\
		OMAP1UART##p)
75
76

#define DEBUG_LL_OMAP1(p, mach)						\
77
78
	_DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP_PORT_SHIFT,	\
		OMAP1UART##p)
79
80

#define DEBUG_LL_OMAP2(p, mach)						\
81
82
	_DEBUG_LL_ENTRY(mach, OMAP2_UART##p##_BASE, OMAP_PORT_SHIFT,	\
		OMAP2UART##p)
83
84

#define DEBUG_LL_OMAP3(p, mach)						\
85
86
	_DEBUG_LL_ENTRY(mach, OMAP3_UART##p##_BASE, OMAP_PORT_SHIFT,	\
		OMAP3UART##p)
87
88

#define DEBUG_LL_OMAP4(p, mach)						\
89
90
	_DEBUG_LL_ENTRY(mach, OMAP4_UART##p##_BASE, OMAP_PORT_SHIFT,	\
		OMAP4UART##p)
91
92
93

/* Zoom2/3 shift is different for UART1 and external port */
#define DEBUG_LL_ZOOM(mach)						\
94
	_DEBUG_LL_ENTRY(mach, ZOOM_UART_BASE, ZOOM_PORT_SHIFT, ZOOM_UART)
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141

static inline void __arch_decomp_setup(unsigned long arch_id)
{
	int port = 0;

	/*
	 * Initialize the port based on the machine ID from the bootloader.
	 * Note that we're using macros here instead of switch statement
	 * as machine_is functions are optimized out for the boards that
	 * are not selected.
	 */
	do {
		/* omap7xx/8xx based boards using UART1 with shift 0 */
		DEBUG_LL_OMAP7XX(1, herald);
		DEBUG_LL_OMAP7XX(1, omap_perseus2);

		/* omap15xx/16xx based boards using UART1 */
		DEBUG_LL_OMAP1(1, ams_delta);
		DEBUG_LL_OMAP1(1, nokia770);
		DEBUG_LL_OMAP1(1, omap_h2);
		DEBUG_LL_OMAP1(1, omap_h3);
		DEBUG_LL_OMAP1(1, omap_innovator);
		DEBUG_LL_OMAP1(1, omap_osk);
		DEBUG_LL_OMAP1(1, omap_palmte);
		DEBUG_LL_OMAP1(1, omap_palmz71);

		/* omap15xx/16xx based boards using UART2 */
		DEBUG_LL_OMAP1(2, omap_palmtt);

		/* omap15xx/16xx based boards using UART3 */
		DEBUG_LL_OMAP1(3, sx1);

		/* omap2 based boards using UART1 */
		DEBUG_LL_OMAP2(1, omap2evm);
		DEBUG_LL_OMAP2(1, omap_2430sdp);
		DEBUG_LL_OMAP2(1, omap_apollon);
		DEBUG_LL_OMAP2(1, omap_h4);

		/* omap2 based boards using UART3 */
		DEBUG_LL_OMAP2(3, nokia_n800);
		DEBUG_LL_OMAP2(3, nokia_n810);
		DEBUG_LL_OMAP2(3, nokia_n810_wimax);

		/* omap3 based boards using UART1 */
		DEBUG_LL_OMAP2(1, omap3evm);
		DEBUG_LL_OMAP3(1, omap_3430sdp);
		DEBUG_LL_OMAP3(1, omap_3630sdp);
142
143
		DEBUG_LL_OMAP3(1, omap3530_lv_som);
		DEBUG_LL_OMAP3(1, omap3_torpedo);
144
145
146

		/* omap3 based boards using UART3 */
		DEBUG_LL_OMAP3(3, cm_t35);
147
		DEBUG_LL_OMAP3(3, cm_t3517);
148
		DEBUG_LL_OMAP3(3, igep0020);
149
		DEBUG_LL_OMAP3(3, igep0030);
150
		DEBUG_LL_OMAP3(3, nokia_rm680);
151
152
153
154
155
156
157
158
159
160
		DEBUG_LL_OMAP3(3, nokia_rx51);
		DEBUG_LL_OMAP3(3, omap3517evm);
		DEBUG_LL_OMAP3(3, omap3_beagle);
		DEBUG_LL_OMAP3(3, omap3_pandora);
		DEBUG_LL_OMAP3(3, omap_ldp);
		DEBUG_LL_OMAP3(3, overo);
		DEBUG_LL_OMAP3(3, touchbook);

		/* omap4 based boards using UART3 */
		DEBUG_LL_OMAP4(3, omap_4430sdp);
161
		DEBUG_LL_OMAP4(3, omap4_panda);
162
163
164
165
166
167
168
169
170
171

		/* zoom2/3 external uart */
		DEBUG_LL_ZOOM(omap_zoom2);
		DEBUG_LL_ZOOM(omap_zoom3);

	} while (0);
}

#define arch_decomp_setup()	__arch_decomp_setup(arch_id)

Linus Torvalds's avatar
Linus Torvalds committed
172
173
174
175
/*
 * nothing to do
 */
#define arch_decomp_wdog()