Cleanup DEBUG_LL infrastructure
Subsystems (3)
v3 cover Cleanup DEBUG_LL infrastructure
Patch1: clean up the DEBUG_LL infrastructure for run time detection
Patch2: add DEBUG_LL support for Zoom2 board that has external UART
Patchs are also hosted at:git://dev.omapzoom.org/pub/scm/vikram/omap3.git debug-ll-ver3
Tested on OMAP3: SDP3430/Zoom2/Zoom1/Beagleboard Will appreciate if some can verify for OMAP2 and OMAP1 boards
Vikram Pandita (2):
OMAP1/2/3/4: DEBUG_LL run time detection
OMAP: Zoom2: Add DEBUG_LL interface using Quart
arch/arm/mach-omap2/board-zoom-debugboard.c | 5 +- arch/arm/mach-omap2/board-zoom2.c | 18 +++- arch/arm/plat-omap/Kconfig | 16 --- arch/arm/plat-omap/Makefile | 2 +- arch/arm/plat-omap/debug-low-level.c | 125 +++++++++++++++++++++++++ arch/arm/plat-omap/include/mach/debug-macro.S | 60 +++++------- arch/arm/plat-omap/include/mach/io.h | 6 + arch/arm/plat-omap/include/mach/uncompress.h | 27 +++--- 8 files changed, 188 insertions(+), 71 deletions(-) create mode 100644 arch/arm/plat-omap/debug-low-level.c
PATCH v3 1/2 OMAP1/2/3/4: DEBUG_LL run time detection
This patch cleans up the DEBUG_LL infrastructure for omap boards.
The decision of finding the physical address of debug uart is done at runtime now, making possible to use a single defconfig for multiple boards.
This patch gets rid of menuconfig options of choosing low level debug uarts.
Changes are:
Implement dynamic uart detection functions in a new file:
arch/arm/plat-omap/debug-low-level.c Functions:
get_uart_base() Returns debug uart physical address
get_uart_virt_base() Returns debug uart virtual address
get_uart_shift() Returns debug uart register shift
The same functions get used in the uncompressing stage of kernel as well as for debug low level functions of kernel
Following comments from Russell King have been incorporated:
http://marc.info/?l=linux-arm-kernel&m=125321699528719&w=2
Changes have been tested on:
SDP3430: UART1 Zoom1: UART3 Beagle: UART3 Zoom2: External Uart
--- arch/arm/mach-omap2/board-zoom-debugboard.c | 5 +- arch/arm/plat-omap/Kconfig | 16 --- arch/arm/plat-omap/Makefile | 2 +- arch/arm/plat-omap/debug-low-level.c | 123 +++++++++++++++++++++++++ arch/arm/plat-omap/include/mach/debug-macro.S | 60 +++++-------- arch/arm/plat-omap/include/mach/uncompress.h | 27 +++--- 6 files changed, 164 insertions(+), 69 deletions(-) create mode 100644 arch/arm/plat-omap/debug-low-level.c
arch/arm/mach-omap2/board-zoom-debugboard.c +3 -2
@@ -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 ,
arch/arm/plat-omap/Kconfig +0 -16
@@ -162,22 +162,6 @@ config OMAP_DM_TIMER help Select this option if you want to use OMAP Dual-Mode timers. -choice - prompt "Low-level debug console UART" - depends on ARCH_OMAP - default OMAP_LL_DEBUG_UART1 - -config OMAP_LL_DEBUG_UART1 - bool "UART1" - -config OMAP_LL_DEBUG_UART2 - bool "UART2" - -config OMAP_LL_DEBUG_UART3 - bool "UART3" - -endchoice - config OMAP_SERIAL_WAKE bool "Enable wake-up events for serial ports" depends on ARCH_OMAP1 && OMAP_MUX
arch/arm/plat-omap/Makefile +1 -1
@@ -4,7 +4,7 @@ # Common support obj-y := common.o sram.o clock.o devices.o dma.o mux.o gpio.o \ - usb.o fb.o io.o + usb.o fb.o io.o debug-low-level.o obj-m := obj-n := obj- :=
arch/arm/plat-omap/debug-low-level.c new file +123 -0
123 lines not on this page · raw message
arch/arm/plat-omap/include/mach/debug-macro.S +23 -37
78 lines not on this page · raw message
arch/arm/plat-omap/include/mach/uncompress.h +14 -13
@@ -20,8 +20,8 @@#include <linux/types.h> #include <linux/serial_reg.h> #include <mach/serial.h> - -unsigned int system_rev; +#include <asm/mach-types.h> +#include "../../debug-low-level.c" #define UART_OMAP_MDR1 0x08/* mode definition register */ #define OMAP_ID_730 0x355F
@@ -29,23 +29,20 @@ unsigned int system_rev;#define check_port (base, shift) ((base[UART_OMAP_MDR1 << shift] & 7) == 0)#define omap_get_id () ((*(volatile unsigned int *)(0xfffed404)) >> 12) & ID_MASK +static volatile u8 *uart; +static void putc (int c) { -volatile u8 * uart =0 ;int shift =2 ;#ifdef CONFIG_MACH_OMAP_PALMTE return ;#endif -#ifdef CONFIG_ARCH_OMAP -#ifdef CONFIG_OMAP_LL_DEBUG_UART3 - uart = (volatile u8 *)(OMAP_UART3_BASE ); -#elif defined(CONFIG_OMAP_LL_DEBUG_UART2 ) - uart = (volatile u8 *)(OMAP_UART2_BASE ); -#else - uart = (volatile u8 *)(OMAP_UART1_BASE ); -#endif +if (!uart) +return ; + + shift =get_uart_shift ();#ifdef CONFIG_ARCH_OMAP1 /* Determine which serial port to use */
@@ -62,7 +59,6 @@ static void putc(int c) return; }while (0 );#endif /* CONFIG_ARCH_OMAP1 */ -#endif /* * Now, xmit each character
@@ -76,8 +72,13 @@ static inline void flush(void) { } +static inline void __arch_decomp_setup (void ) +{ + uart = (u8 *)get_uart_base (); +} +/* * nothing to do */ -#define arch_decomp_setup () +#define arch_decomp_setup () __arch_decomp_setup()#define arch_decomp_wdog ()
Signature · 1 line
1.6.5.rc0
PATCH v3 2/2 OMAP: Zoom2: Add DEBUG_LL interface using 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.
This patch is adapted from a version by Erik Gilling:
http://android.git.kernel.org/?p=kernel/omap.git;
a=commit;h=e9d72efdd88877d2d6ea74a08983ace0dcc771d3
--- arch/arm/mach-omap2/board-zoom2.c | 18 ++++++++++++++++-- arch/arm/plat-omap/debug-low-level.c | 2 ++ arch/arm/plat-omap/include/mach/io.h | 6 ++++++ 3 files changed, 24 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/board-zoom2.c +16 -2
@@ -19,6 +19,7 @@#include <asm/mach-types.h> #include <asm/mach/arch.h> +#include <asm/mach/map.h> #include <mach/common.h> #include <mach/usb.h>
@@ -269,15 +270,28 @@ 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 (); }MACHINE_START (OMAP_ZOOM2 ,"OMAP Zoom2 board" ) - .phys_io = 0x48000000, - .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, + .phys_io = ZOOM2_EXT_QUART_PHYS, + .io_pg_offst = ((ZOOM2_EXT_QUART_VIRT) >> 18) & 0xfffc, .boot_params = 0x80000100, .map_io = omap_zoom2_map_io, .init_irq = omap_zoom2_init_irq,
arch/arm/plat-omap/debug-low-level.c +2 -0
@@ -15,6 +15,8 @@ u32 get_uart_base(void) {static u32 omap_uart_debug_ll_phy_addr; + omap_uart_debug_ll_phy_addr =0 ; +if (omap_uart_debug_ll_phy_addr)return omap_uart_debug_ll_phy_addr;
arch/arm/plat-omap/include/mach/io.h +6 -0
@@ -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
Signature · 1 line
1.6.5.rc0
PATCH 1/2 OMAP1/2/3/4: DEBUG_LL run time detection
In reply to Vikram PanditaVikram,
Quoted 72 lines
-----Original Message-----
From: linux-omap-owner at vger.kernel.org [mailto:linux-omap- owner at vger.kernel.org] On Behalf Of Pandita, Vikram
Sent: Saturday, September 19, 2009 6:10 AM
To: linux-arm-kernel at lists.infradead.org; linux-omap at vger.kernel.org
Cc: Pandita, Vikram; Russell King; Kevin Hilman
Subject: [PATCH 1/2] OMAP1/2/3/4:DEBUG_LLrun time detectionarch/arm/plat-omap/debug-low-level.c new file +63
-0+u32 get_uart_base (void ) +{ +static u32 omap_uart_debug_ll_phy_addr; + +if (omap_uart_debug_ll_phy_addr) +return omap_uart_debug_ll_phy_addr; + +/* Add logic here for new platforms, using __machine_arch_type */ + +/* TODO: REVISIT -- Check Completeness +* DEFINE PHY ADDRESS for EACH BOARD HERE: omap1/2/3/4 */ +#if defined(CONFIG_ARCH_OMAP1 ) +switch (__machine_arch_type) { +case MACH_TYPE_OMAP_PALMTT : +case MACH_TYPE_SX1 : +/* UART2 */ + omap_uart_debug_ll_phy_addr = (u32 *)0xfffb0800 ; +break ; +default : +/* UART1 */ + omap_uart_debug_ll_phy_addr = (u32 *)0xfffb0000 ; +break ; + } +#endif + +#if defined(CONFIG_ARCH_OMAP2 ) +switch (__machine_arch_type) { +case MACH_TYPE_NOKIA_N800 : +case MACH_TYPE_NOKIA_N810 : +case MACH_TYPE_NOKIA_N810_WIMAX : +/* UART3 */ + omap_uart_debug_ll_phy_addr = (u32 *)0x4806e000 ; +break ; +default : +/* UART1 */ + omap_uart_debug_ll_phy_addr = (u32 *)0x4806a000 ; +break ; + } +#endif + +#if defined(CONFIG_ARCH_OMAP3 ) +switch (__machine_arch_type) { +case MACH_TYPE_OMAP_LDP : +case MACH_TYPE_OVERO : +case MACH_TYPE_OMAP3_PANDORA : +case MACH_TYPE_NOKIA_RX51 : +case MACH_TYPE_OMAP3_BEAGLE : +/* UART3 */ + omap_uart_debug_ll_phy_addr =0x49020000 ; +break ; +case MACH_TYPE_OMAP_ZOOM2 : +/* EXTERNEL UART */ + omap_uart_debug_ll_phy_addr =0x10000000 ; +break ; +default : +/* UART1 */ + omap_uart_debug_ll_phy_addr =0x4806a000 ; +break ; + } +#endif + +#ifdef CONFIG_ARCH_OMAP4 +switch (__machine_arch_type) {
arch/arm/plat-omap/debug-low-level.c line 86
Quoted 10 lines
arch/arm/plat-omap/debug-low-level.c new file +10
-0+/* OMAP3: UART1 */ +case MACH_TYPE_OMAP_4430SDP : +default : + omap_uart_debug_ll_phy_addr = (u32 *)0x4806a000 ; + break; + } +#endif + +return omap_uart_debug_ll_phy_addr; +}
This makes only UART1 as a DEBUG_LL option for OMAP4. Will we not have options any more to select rest of the UARTs for DEBUG_LL as it was supported with previous Russell's implementation?
Regards,
Santosh
PATCH 1/2 OMAP1/2/3/4: DEBUG_LL run time detection
In reply to Vikram PanditaQuoted 4 lines · Vikram Pandita
The decision of finding the physical address of debug uart is done at runtime now, making possible to use a single defconfig for multiple boards.
This patch gets rid of menuconfig options of choosing low level debug uarts.
This approach won't work in all cases where the debug functions are called (which can be before the MMU is enabled.)
The problem is that you can't run C code before the MMU is setup because C code always encodes absolute address locations, which won't be valid at that time.
Also, since there is no stack during the initial kernel boot, you can't stack registers in the LL debug functions.