]> code.ossystems Code Review - openembedded-core.git/blob
e39090f6cf0f2fa1ff04d1877de1d8b0097cb0b1
[openembedded-core.git] /
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
5
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.
9
10 The Quad uart is available over GPMC chip select with physical address
11 0x10000000.
12
13 This physical address has been mapped to virtual address 0xFB000000
14 as per static mapping.
15
16 Also the register accesses to Quad uart have a requirement of shift=1
17 based on the h/w mapping of the registers
18
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
22
23 Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
24 Cc: Erik Gilling <konkers@android.com>
25 ---
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(-)
32
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)
38  
39  static struct plat_serial8250_port serial_platform_data[] = {
40         {
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,
48                 .iotype         = UPIO_MEM,
49                 .regshift       = 1,
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
54 @@ -16,9 +16,11 @@
55  #include <linux/gpio.h>
56  #include <linux/i2c/twl4030.h>
57  #include <linux/regulator/machine.h>
58 +#include <linux/io.h>
59  
60  #include <asm/mach-types.h>
61  #include <asm/mach/arch.h>
62 +#include <asm/mach/map.h>
63  
64  #include <mach/common.h>
65  #include <mach/usb.h>
66 @@ -273,9 +275,22 @@ static void __init omap_zoom2_init(void)
67         usb_musb_init();
68  }
69  
70 +static struct map_desc zoom2_io_desc[] __initdata = {
71 +       {
72 +               .virtual        = ZOOM2_EXT_QUART_VIRT,
73 +               .pfn            = __phys_to_pfn(ZOOM2_EXT_QUART_PHYS),
74 +               .length         = ZOOM2_EXT_QUART_SIZE,
75 +               .type           = MT_DEVICE
76 +       }
77 +};
78 +
79  static void __init omap_zoom2_map_io(void)
80  {
81         omap2_set_globals_343x();
82 +
83 +       /* Map external quad UART virt to phy mapping */
84 +       iotable_init(zoom2_io_desc, ARRAY_SIZE(zoom2_io_desc));
85 +
86         omap2_map_common_io();
87  }
88  
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
93 @@ -12,6 +12,14 @@
94  */
95  #include "io.h"
96  
97 +#if (CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR == 0x10000000)
98 +#define REGSHIFT 1
99 +#define UART_VIRT_TO_PHY_OFFSET ZOOM2_EXT_QUART_PHY_TO_VIRT_OFF
100 +#else
101 +#define REGSHIFT 2
102 +#define UART_VIRT_TO_PHY_OFFSET OMAP2_IO_OFFSET
103 +#endif
104 +
105                 .macro  addruart,rx
106                 mrc     p15, 0, \rx, c1, c0
107                 tst     \rx, #1                 @ MMU enabled?
108 @@ -22,7 +30,7 @@
109  #else
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
114  #endif
115                 .endm
116  
117 @@ -31,13 +39,15 @@
118                 .endm
119  
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
123                 and     \rd, \rd, #0x60
124                 teq     \rd, #0x60
125 +#if (CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR != 0x10000000)
126                 beq     1002f
127                 ldrb    \rd, [\rx, #(0x5 << 0)] @ OMAP-730 only
128                 and     \rd, \rd, #0x60
129                 teq     \rd, #0x60
130 +#endif
131                 bne     1001b
132  1002:
133                 .endm
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
138 @@ -169,6 +169,12 @@
139  #define DSP_MMU_34XX_VIRT      0xe2000000
140  #define DSP_MMU_34XX_SIZE      SZ_4K
141  
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
147 +
148  /*
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);
158  
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
162 +        */
163 +       shift = 1;
164 +#endif
165 +
166  #ifdef CONFIG_ARCH_OMAP1
167         /* Determine which serial port to use */
168         do {
169 -- 
170 1.6.3.2
171