1 From 98d46e88ffe23a9adcf6ae1acf19b210d5ac3737 Mon Sep 17 00:00:00 2001
2 From: Vikram Pandita <vikram.pandita@ti.com>
3 Date: Thu, 20 Aug 2009 17:16:24 -0500
4 Subject: [PATCH 3/5] OMAP: Zoom2: Add DEBUG_LL interface using external Quart
6 This patch adds DEBUG_LL interface for Zoom2 board.
7 The low level debug uart now points corrctly to External Quad uart
8 controller on detachable debug board.
10 The Quad uart is available over GPMC chip select with physical address
13 This physical address has been mapped to virtual address 0xFB000000
14 as per static mapping.
16 Also the register accesses to Quad uart have a requirement of shift=1
17 based on the h/w mapping of the registers
19 This patch is adapted from a version by Erik Gilling:
20 http://android.git.kernel.org/?p=kernel/omap.git;
21 a=commit;h=e9d72efdd88877d2d6ea74a08983ace0dcc771d3
23 Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
24 Cc: Erik Gilling <konkers@android.com>
26 arch/arm/mach-omap2/board-zoom-debugboard.c | 5 +++--
27 arch/arm/mach-omap2/board-zoom2.c | 15 +++++++++++++++
28 arch/arm/plat-omap/include/mach/debug-macro.S | 14 ++++++++++++--
29 arch/arm/plat-omap/include/mach/io.h | 6 ++++++
30 arch/arm/plat-omap/include/mach/uncompress.h | 7 +++++++
31 5 files changed, 43 insertions(+), 4 deletions(-)
33 diff --git a/arch/arm/mach-omap2/board-zoom-debugboard.c b/arch/arm/mach-omap2/board-zoom-debugboard.c
34 index f546063..f8b0726 100644
35 --- a/arch/arm/mach-omap2/board-zoom-debugboard.c
36 +++ b/arch/arm/mach-omap2/board-zoom-debugboard.c
37 @@ -82,9 +82,10 @@ static inline void __init zoom2_init_smsc911x(void)
39 static struct plat_serial8250_port serial_platform_data[] = {
41 - .mapbase = 0x10000000,
42 + .membase = IOMEM(ZOOM2_EXT_QUART_VIRT),
43 + .mapbase = ZOOM2_EXT_QUART_PHYS,
44 .irq = OMAP_GPIO_IRQ(102),
45 - .flags = UPF_BOOT_AUTOCONF|UPF_IOREMAP|UPF_SHARE_IRQ,
46 + .flags = UPF_BOOT_AUTOCONF|UPF_SHARE_IRQ,
47 .irqflags = IRQF_SHARED | IRQF_TRIGGER_RISING,
50 diff --git a/arch/arm/mach-omap2/board-zoom2.c b/arch/arm/mach-omap2/board-zoom2.c
51 index 58baee3..fc27b07 100644
52 --- a/arch/arm/mach-omap2/board-zoom2.c
53 +++ b/arch/arm/mach-omap2/board-zoom2.c
55 #include <linux/gpio.h>
56 #include <linux/i2c/twl4030.h>
57 #include <linux/regulator/machine.h>
58 +#include <linux/io.h>
60 #include <asm/mach-types.h>
61 #include <asm/mach/arch.h>
62 +#include <asm/mach/map.h>
64 #include <mach/common.h>
66 @@ -273,9 +275,22 @@ static void __init omap_zoom2_init(void)
70 +static struct map_desc zoom2_io_desc[] __initdata = {
72 + .virtual = ZOOM2_EXT_QUART_VIRT,
73 + .pfn = __phys_to_pfn(ZOOM2_EXT_QUART_PHYS),
74 + .length = ZOOM2_EXT_QUART_SIZE,
79 static void __init omap_zoom2_map_io(void)
81 omap2_set_globals_343x();
83 + /* Map external quad UART virt to phy mapping */
84 + iotable_init(zoom2_io_desc, ARRAY_SIZE(zoom2_io_desc));
86 omap2_map_common_io();
89 diff --git a/arch/arm/plat-omap/include/mach/debug-macro.S b/arch/arm/plat-omap/include/mach/debug-macro.S
90 index f546d6c..a97f2fb 100644
91 --- a/arch/arm/plat-omap/include/mach/debug-macro.S
92 +++ b/arch/arm/plat-omap/include/mach/debug-macro.S
97 +#if (CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR == 0x10000000)
99 +#define UART_VIRT_TO_PHY_OFFSET ZOOM2_EXT_QUART_PHY_TO_VIRT_OFF
102 +#define UART_VIRT_TO_PHY_OFFSET OMAP2_IO_OFFSET
106 mrc p15, 0, \rx, c1, c0
107 tst \rx, #1 @ MMU enabled?
110 /* omap2/omap3/omap4 */
111 ldr \rx, =CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR @ physical base address
112 - orrne \rx, \rx, #OMAP2_IO_OFFSET @ virtual base
113 + orrne \rx, \rx, #UART_VIRT_TO_PHY_OFFSET @ virtual base
120 .macro busyuart,rd,rx
121 -1001: ldrb \rd, [\rx, #(0x5 << 2)] @ OMAP-1510 and friends
122 +1001: ldrb \rd, [\rx, #(0x5 << REGSHIFT)] @ OMAP-1510 and friends
125 +#if (CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR != 0x10000000)
127 ldrb \rd, [\rx, #(0x5 << 0)] @ OMAP-730 only
134 diff --git a/arch/arm/plat-omap/include/mach/io.h b/arch/arm/plat-omap/include/mach/io.h
135 index 8d32df3..97702e6 100644
136 --- a/arch/arm/plat-omap/include/mach/io.h
137 +++ b/arch/arm/plat-omap/include/mach/io.h
139 #define DSP_MMU_34XX_VIRT 0xe2000000
140 #define DSP_MMU_34XX_SIZE SZ_4K
142 +/* Map External Quad UART for Zoom2 board */
143 +#define ZOOM2_EXT_QUART_PHYS 0x10000000 /* PHY address if fixed */
144 +#define ZOOM2_EXT_QUART_PHY_TO_VIRT_OFF 0xeb000000
145 +#define ZOOM2_EXT_QUART_VIRT 0xfb000000
146 +#define ZOOM2_EXT_QUART_SIZE SZ_16
149 * ----------------------------------------------------------------------------
150 * Omap4 specific IO mapping
151 diff --git a/arch/arm/plat-omap/include/mach/uncompress.h b/arch/arm/plat-omap/include/mach/uncompress.h
152 index 0e21eb3..959195a 100644
153 --- a/arch/arm/plat-omap/include/mach/uncompress.h
154 +++ b/arch/arm/plat-omap/include/mach/uncompress.h
155 @@ -41,6 +41,13 @@ static void putc(int c)
156 #if defined(CONFIG_DEBUG_LL)
157 uart = (volatile u8 *)(CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR);
159 +#if (CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR == 0x10000000)
160 + /* External UART has a shift=1 requirement
161 + * Internal OMAP UARTs have shift=2 requirement
166 #ifdef CONFIG_ARCH_OMAP1
167 /* Determine which serial port to use */