summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/linux/linux-omap3-pm-git/zoom2/0003-OMAP-Zoom2-Add-DEBUG_LL-interface-using-external-Qua.patch
blob: e39090f6cf0f2fa1ff04d1877de1d8b0097cb0b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
From 98d46e88ffe23a9adcf6ae1acf19b210d5ac3737 Mon Sep 17 00:00:00 2001
From: Vikram Pandita <vikram.pandita@ti.com>
Date: Thu, 20 Aug 2009 17:16:24 -0500
Subject: [PATCH 3/5] OMAP: Zoom2: Add DEBUG_LL interface using external Quart

This patch adds DEBUG_LL interface for Zoom2 board.
The low level debug uart now points corrctly to External Quad uart
controller on detachable debug board.

The Quad uart is available over GPMC chip select with physical address
0x10000000.

This physical address has been mapped to virtual address 0xFB000000
as per static mapping.

Also the register accesses to Quad uart have a requirement of shift=1
based on the h/w mapping of the registers

This patch is adapted from a version by Erik Gilling:
http://android.git.kernel.org/?p=kernel/omap.git;
a=commit;h=e9d72efdd88877d2d6ea74a08983ace0dcc771d3

Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
Cc: Erik Gilling <konkers@android.com>
---
 arch/arm/mach-omap2/board-zoom-debugboard.c   |    5 +++--
 arch/arm/mach-omap2/board-zoom2.c             |   15 +++++++++++++++
 arch/arm/plat-omap/include/mach/debug-macro.S |   14 ++++++++++++--
 arch/arm/plat-omap/include/mach/io.h          |    6 ++++++
 arch/arm/plat-omap/include/mach/uncompress.h  |    7 +++++++
 5 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/board-zoom-debugboard.c b/arch/arm/mach-omap2/board-zoom-debugboard.c
index f546063..f8b0726 100644
--- a/arch/arm/mach-omap2/board-zoom-debugboard.c
+++ b/arch/arm/mach-omap2/board-zoom-debugboard.c
@@ -82,9 +82,10 @@ static inline void __init zoom2_init_smsc911x(void)
 
 static struct plat_serial8250_port serial_platform_data[] = {
 	{
-		.mapbase	= 0x10000000,
+		.membase	= IOMEM(ZOOM2_EXT_QUART_VIRT),
+		.mapbase	= ZOOM2_EXT_QUART_PHYS,
 		.irq		= OMAP_GPIO_IRQ(102),
-		.flags		= UPF_BOOT_AUTOCONF|UPF_IOREMAP|UPF_SHARE_IRQ,
+		.flags		= UPF_BOOT_AUTOCONF|UPF_SHARE_IRQ,
 		.irqflags	= IRQF_SHARED | IRQF_TRIGGER_RISING,
 		.iotype		= UPIO_MEM,
 		.regshift	= 1,
diff --git a/arch/arm/mach-omap2/board-zoom2.c b/arch/arm/mach-omap2/board-zoom2.c
index 58baee3..fc27b07 100644
--- a/arch/arm/mach-omap2/board-zoom2.c
+++ b/arch/arm/mach-omap2/board-zoom2.c
@@ -16,9 +16,11 @@
 #include <linux/gpio.h>
 #include <linux/i2c/twl4030.h>
 #include <linux/regulator/machine.h>
+#include <linux/io.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
+#include <asm/mach/map.h>
 
 #include <mach/common.h>
 #include <mach/usb.h>
@@ -273,9 +275,22 @@ static void __init omap_zoom2_init(void)
 	usb_musb_init();
 }
 
+static struct map_desc zoom2_io_desc[] __initdata = {
+	{
+		.virtual        = ZOOM2_EXT_QUART_VIRT,
+		.pfn            = __phys_to_pfn(ZOOM2_EXT_QUART_PHYS),
+		.length         = ZOOM2_EXT_QUART_SIZE,
+		.type           = MT_DEVICE
+	}
+};
+
 static void __init omap_zoom2_map_io(void)
 {
 	omap2_set_globals_343x();
+
+	/* Map external quad UART virt to phy mapping */
+	iotable_init(zoom2_io_desc, ARRAY_SIZE(zoom2_io_desc));
+
 	omap2_map_common_io();
 }
 
diff --git a/arch/arm/plat-omap/include/mach/debug-macro.S b/arch/arm/plat-omap/include/mach/debug-macro.S
index f546d6c..a97f2fb 100644
--- a/arch/arm/plat-omap/include/mach/debug-macro.S
+++ b/arch/arm/plat-omap/include/mach/debug-macro.S
@@ -12,6 +12,14 @@
 */
 #include "io.h"
 
+#if (CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR == 0x10000000)
+#define REGSHIFT 1
+#define UART_VIRT_TO_PHY_OFFSET ZOOM2_EXT_QUART_PHY_TO_VIRT_OFF
+#else
+#define REGSHIFT 2
+#define UART_VIRT_TO_PHY_OFFSET OMAP2_IO_OFFSET
+#endif
+
 		.macro	addruart,rx
 		mrc	p15, 0, \rx, c1, c0
 		tst	\rx, #1			@ MMU enabled?
@@ -22,7 +30,7 @@
 #else
 					/* omap2/omap3/omap4 */
 		ldr	\rx, =CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR @ physical base address
-		orrne	\rx, \rx, #OMAP2_IO_OFFSET	 @ virtual base
+		orrne	\rx, \rx, #UART_VIRT_TO_PHY_OFFSET	 @ virtual base
 #endif
 		.endm
 
@@ -31,13 +39,15 @@
 		.endm
 
 		.macro	busyuart,rd,rx
-1001:		ldrb	\rd, [\rx, #(0x5 << 2)]	@ OMAP-1510 and friends
+1001:		ldrb	\rd, [\rx, #(0x5 << REGSHIFT)] @ OMAP-1510 and friends
 		and	\rd, \rd, #0x60
 		teq	\rd, #0x60
+#if (CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR != 0x10000000)
 		beq	1002f
 		ldrb	\rd, [\rx, #(0x5 << 0)]	@ OMAP-730 only
 		and	\rd, \rd, #0x60
 		teq	\rd, #0x60
+#endif
 		bne	1001b
 1002:
 		.endm
diff --git a/arch/arm/plat-omap/include/mach/io.h b/arch/arm/plat-omap/include/mach/io.h
index 8d32df3..97702e6 100644
--- a/arch/arm/plat-omap/include/mach/io.h
+++ b/arch/arm/plat-omap/include/mach/io.h
@@ -169,6 +169,12 @@
 #define DSP_MMU_34XX_VIRT	0xe2000000
 #define DSP_MMU_34XX_SIZE	SZ_4K
 
+/* Map External Quad UART for Zoom2 board */
+#define ZOOM2_EXT_QUART_PHYS		0x10000000 /* PHY address if fixed */
+#define ZOOM2_EXT_QUART_PHY_TO_VIRT_OFF	0xeb000000
+#define ZOOM2_EXT_QUART_VIRT		0xfb000000
+#define ZOOM2_EXT_QUART_SIZE		SZ_16
+
 /*
  * ----------------------------------------------------------------------------
  * Omap4 specific IO mapping
diff --git a/arch/arm/plat-omap/include/mach/uncompress.h b/arch/arm/plat-omap/include/mach/uncompress.h
index 0e21eb3..959195a 100644
--- a/arch/arm/plat-omap/include/mach/uncompress.h
+++ b/arch/arm/plat-omap/include/mach/uncompress.h
@@ -41,6 +41,13 @@ static void putc(int c)
 #if defined(CONFIG_DEBUG_LL)
 	uart = (volatile u8 *)(CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR);
 
+#if (CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR == 0x10000000)
+	/* External UART has a shift=1 requirement
+	 * Internal OMAP UARTs have shift=2 requirement
+	 */
+	shift = 1;
+#endif
+
 #ifdef CONFIG_ARCH_OMAP1
 	/* Determine which serial port to use */
 	do {
-- 
1.6.3.2