From patchwork Fri Aug 21 18:10:51 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: vikram pandita X-Patchwork-Id: 43175 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7LIBPpX015346 for ; Fri, 21 Aug 2009 18:11:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751412AbZHUSLV (ORCPT ); Fri, 21 Aug 2009 14:11:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755333AbZHUSLV (ORCPT ); Fri, 21 Aug 2009 14:11:21 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:43953 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751412AbZHUSLU (ORCPT ); Fri, 21 Aug 2009 14:11:20 -0400 Received: from dlep36.itg.ti.com ([157.170.170.91]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id n7LIBAWi027489; Fri, 21 Aug 2009 13:11:15 -0500 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id n7LIB7vw023541; Fri, 21 Aug 2009 13:11:07 -0500 (CDT) Received: from vip-tid (lta0307903-128247075087.am.dhcp.ti.com [128.247.75.87]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id n7LIB7Z08186; Fri, 21 Aug 2009 13:11:07 -0500 (CDT) Received: from vip-tid (localhost.localdomain [127.0.0.1]) by vip-tid (Postfix) with ESMTP id D3EC329CCF2; Fri, 21 Aug 2009 13:10:52 -0500 (CDT) Received: (from vikram@localhost) by vip-tid (8.14.3/8.14.3/Submit) id n7LIAq1C010624; Fri, 21 Aug 2009 13:10:52 -0500 X-Authentication-Warning: vip-tid: vikram set sender to vikram.pandita@ti.com using -f From: Vikram Pandita To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.arm.linux.org.uk Cc: konkers@android.com, Vikram Pandita Subject: [PATCH 3/5] OMAP: Zoom2: Add DEBUG_LL interface using external Quart Date: Fri, 21 Aug 2009 13:10:51 -0500 Message-Id: <1250878251-10593-1-git-send-email-vikram.pandita@ti.com> X-Mailer: git-send-email 1.6.3.3.334.g916e1 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org 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 Cc: Erik Gilling --- 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 #include #include +#include #include #include +#include #include #include @@ -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 {