* [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup @ 2009-08-21 17:55 Vikram Pandita 2009-08-22 7:23 ` Shilimkar, Santosh 2009-08-22 7:57 ` Kevin Hilman 0 siblings, 2 replies; 12+ messages in thread From: Vikram Pandita @ 2009-08-21 17:55 UTC (permalink / raw) To: linux-omap, linux-arm-kernel; +Cc: Vikram Pandita This patch cleans up the DEBUG_LL infrastructure for omap boards. The three stages of log printing infrastructure is using their own #defines The patch integrates the three stages to use the same variable. Three stages are: Stage 1: Prints - Uncompressing Linux...... File getting used: arch/arm/plat-omap/include/mach/uncompress.h Stage 2: Prints - <5>Linux version 2.6.31 File getting used: arch/arm/plat-omap/include/mach/debug-macro.S Stage 3: Kernel ttyS console takes over On enabling the DEBUG_LL menuconfig item [Kernel Hacking -> Kernel low-level debugging functions] the following entry gets auto selected [Systerm Type -> TI OMAP Implementations -> Low-level Debug console UART] This is the physical address of the UART getting used for the board. The physical address of debug uart is provided as a menuconfig option now. Issue with current system: (a) Zoom2 board has a detachable debug board having the TL16CP754 Quad uart chip. If the debug board is not attached, _NO_ debug uart is available. OMAP internal uarts are not used for traces on zoom2 board. Current framework does not account for boards that may not have a debug uart at all. The Stage 1 always accesses one of the uarts. Thats fixed now. (b) this patch does a cleanup of arch/arm/plat-omap/include/mach/debug-macro.S Signed-off-by: Vikram Pandita <vikram.pandita@ti.com> --- arch/arm/plat-omap/Kconfig | 50 ++++++++++++++++++------- arch/arm/plat-omap/include/mach/common.h | 7 +++ arch/arm/plat-omap/include/mach/debug-macro.S | 40 ++++---------------- arch/arm/plat-omap/include/mach/uncompress.h | 12 +---- 4 files changed, 54 insertions(+), 55 deletions(-) diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index ab9f9ef..2fefb64 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig @@ -162,21 +162,43 @@ 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_DEBUG_LL_UART_PHY_ADDR + hex "Low-level debug console UART Physical Address" + depends on ARCH_OMAP && DEBUG_LL + + default "0xfffb0800" if ARCH_OMAP1 && (MACH_OMAP_PALMTT || MACH_SX1) + default "0xfffb0000" if ARCH_OMAP1 + default "0x4806e000" if ARCH_OMAP2 && MACH_NOKIA_N8X0 + default "0x4806a000" if ARCH_OMAP2 + default "0x49020000" if ARCH_OMAP3 && (MACH_NOKIA_RX51 || MACH_OMAP_BEAGLE) + default "0x49020000" if ARCH_OMAP3 && (MACH_OMAP3_PANDORA || MACH_OMAP_LDP || MACH_OVERO) + default "0x10000000" if ARCH_OMAP3 && MACH_OMAP_ZOOM2 + default "0x4806a000" if ARCH_OMAP3 + default "0x4806a000" if ARCH_OMAP4 + help + Specify the Physical address of Low level debug UART + Specify 0x0 in case you do not want DEBUG_LL functions to iterfere with your board uarts + + OMAP1: + ------------------- + UART1 -> 0xfffb0000 (default) + UART2 -> 0xfffb0800 + UART3 -> 0xfffb9800 (sx1, palmtt) + + OMAP2: + ------------------- + UART1 -> 0x4806a000 (default) + UART2 -> 0x4806c000 + UART3 -> 0x4806e000 (N8X0) + + OMAP3/4: + ------------------- + UART1 -> 0x4806a000 (default: except following) + UART2 -> 0x4806c000 + UART3 -> 0x49020000 (rx51, beagle, pendora, ldp, overo) + UART4 -> 0x4806e000 + UART_EXT -> 0x10000000 (zoom2: Debug uart is on external debug board) config OMAP_SERIAL_WAKE bool "Enable wake-up events for serial ports" diff --git a/arch/arm/plat-omap/include/mach/common.h b/arch/arm/plat-omap/include/mach/common.h index fdeab42..f29d31f 100644 --- a/arch/arm/plat-omap/include/mach/common.h +++ b/arch/arm/plat-omap/include/mach/common.h @@ -68,4 +68,11 @@ void omap2_set_globals_sdrc(struct omap_globals *); void omap2_set_globals_control(struct omap_globals *); void omap2_set_globals_prcm(struct omap_globals *); +/* In case Low Level debug is not defined + * make the low level uart address as zero + */ +#if !defined(CONFIG_DEBUG_LL) +#define CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR 0 +#endif + #endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */ diff --git a/arch/arm/plat-omap/include/mach/debug-macro.S b/arch/arm/plat-omap/include/mach/debug-macro.S index ac24050..f546d6c 100644 --- a/arch/arm/plat-omap/include/mach/debug-macro.S +++ b/arch/arm/plat-omap/include/mach/debug-macro.S @@ -10,43 +10,19 @@ * published by the Free Software Foundation. * */ +#include "io.h" .macro addruart,rx mrc p15, 0, \rx, c1, c0 tst \rx, #1 @ MMU enabled? #ifdef CONFIG_ARCH_OMAP1 - moveq \rx, #0xff000000 @ physical base address - movne \rx, #0xfe000000 @ virtual base - orr \rx, \rx, #0x00fb0000 -#ifdef CONFIG_OMAP_LL_DEBUG_UART3 - orr \rx, \rx, #0x00009000 @ UART 3 -#endif -#if defined(CONFIG_OMAP_LL_DEBUG_UART2) || defined(CONFIG_OMAP_LL_DEBUG_UART3) - orr \rx, \rx, #0x00000800 @ UART 2 & 3 -#endif - -#elif CONFIG_ARCH_OMAP2 - moveq \rx, #0x48000000 @ physical base address - movne \rx, #0xd8000000 @ virtual base - orr \rx, \rx, #0x0006a000 -#ifdef CONFIG_OMAP_LL_DEBUG_UART2 - add \rx, \rx, #0x00002000 @ UART 2 -#endif -#ifdef CONFIG_OMAP_LL_DEBUG_UART3 - add \rx, \rx, #0x00004000 @ UART 3 -#endif - -#elif defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) - moveq \rx, #0x48000000 @ physical base address - movne \rx, #0xd8000000 @ virtual base - orr \rx, \rx, #0x0006a000 -#ifdef CONFIG_OMAP_LL_DEBUG_UART2 - add \rx, \rx, #0x00002000 @ UART 2 -#endif -#ifdef CONFIG_OMAP_LL_DEBUG_UART3 - add \rx, \rx, #0x00fb0000 @ UART 3 - add \rx, \rx, #0x00006000 -#endif + /* omap1 */ + ldr \rx, =CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR @ physical base address + subne \rx, #CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR, #OMAP1_IO_OFFSET @ virtual base +#else + /* omap2/omap3/omap4 */ + ldr \rx, =CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR @ physical base address + orrne \rx, \rx, #OMAP2_IO_OFFSET @ virtual base #endif .endm diff --git a/arch/arm/plat-omap/include/mach/uncompress.h b/arch/arm/plat-omap/include/mach/uncompress.h index 0814c5f..0e21eb3 100644 --- a/arch/arm/plat-omap/include/mach/uncompress.h +++ b/arch/arm/plat-omap/include/mach/uncompress.h @@ -38,14 +38,8 @@ static void putc(int c) 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 defined(CONFIG_DEBUG_LL) + uart = (volatile u8 *)(CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR); #ifdef CONFIG_ARCH_OMAP1 /* Determine which serial port to use */ @@ -62,7 +56,6 @@ static void putc(int c) return; } while (0); #endif /* CONFIG_ARCH_OMAP1 */ -#endif /* * Now, xmit each character @@ -70,6 +63,7 @@ static void putc(int c) while (!(uart[UART_LSR << shift] & UART_LSR_THRE)) barrier(); uart[UART_TX << shift] = c; +#endif /* CONFIG_DEBUG_LL */ } static inline void flush(void) -- 1.6.3.3.334.g916e1 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* RE: [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup 2009-08-21 17:55 [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup Vikram Pandita @ 2009-08-22 7:23 ` Shilimkar, Santosh 2009-08-22 7:57 ` Kevin Hilman 1 sibling, 0 replies; 12+ messages in thread From: Shilimkar, Santosh @ 2009-08-22 7:23 UTC (permalink / raw) To: Pandita, Vikram, linux-omap@vger.kernel.org, linux-arm-kernel@lists.arm.linux.org.uk Vikram, Thanks for this clean-up series !! Couple of comments. <snip snip> > -----Original Message----- > From: linux-omap-owner@vger.kernel.org [mailto:linux-omap- > owner@vger.kernel.org] On Behalf Of Pandita, Vikram > Sent: Friday, August 21, 2009 11:25 PM > To: linux-omap@vger.kernel.org; linux-arm-kernel@lists.arm.linux.org.uk > Cc: Pandita, Vikram > Subject: [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup > of arch/arm/plat-omap/include/mach/debug- > macro.S > > Signed-off-by: Vikram Pandita <vikram.pandita@ti.com> > --- > arch/arm/plat-omap/Kconfig | 50 ++++++++++++++++++-- > ----- > arch/arm/plat-omap/include/mach/common.h | 7 +++ > arch/arm/plat-omap/include/mach/debug-macro.S | 40 ++++---------------- > arch/arm/plat-omap/include/mach/uncompress.h | 12 +---- > 4 files changed, 54 insertions(+), 55 deletions(-) > > diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig > index ab9f9ef..2fefb64 100644 > --- a/arch/arm/plat-omap/Kconfig > +++ b/arch/arm/plat-omap/Kconfig > @@ -162,21 +162,43 @@ config OMAP_DM_TIMER > help > Select this option if you want to use OMAP Dual-Mode timers. > > > + Specify the Physical address of Low level debug UART > + Specify 0x0 in case you do not want DEBUG_LL functions to iterfere > with your board uarts > + > + OMAP1: > + ------------------- > + UART1 -> 0xfffb0000 (default) > + UART2 -> 0xfffb0800 > + UART3 -> 0xfffb9800 (sx1, palmtt) > + > + OMAP2: > + ------------------- > + UART1 -> 0x4806a000 (default) > + UART2 -> 0x4806c000 > + UART3 -> 0x4806e000 (N8X0) > + > + OMAP3/4: > + ------------------- > + UART1 -> 0x4806a000 (default: except following) > + UART2 -> 0x4806c000 > + UART3 -> 0x49020000 (rx51, beagle, pendora, ldp, overo) OMAP4 UART3 base address is 0x48020000 > + UART4 -> 0x4806e000 > + UART_EXT -> 0x10000000 (zoom2: Debug uart is on external debug > board) > > - > -#elif defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) > - moveq \rx, #0x48000000 @ physical base address > - movne \rx, #0xd8000000 @ virtual base > - orr \rx, \rx, #0x0006a000 > -#ifdef CONFIG_OMAP_LL_DEBUG_UART2 > - add \rx, \rx, #0x00002000 @ UART 2 > -#endif > -#ifdef CONFIG_OMAP_LL_DEBUG_UART3 > - add \rx, \rx, #0x00fb0000 @ UART 3 This was already wrong for OMAP4 > - add \rx, \rx, #0x00006000 > -#endif > + /* omap1 */ > + ldr \rx, =CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR @ physical base > address > + subne \rx, #CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR, > #OMAP1_IO_OFFSET @ virtual base > +#else > + /* omap2/omap3/omap4 */ > + ldr \rx, =CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR @ physical base > address > + orrne \rx, \rx, #OMAP2_IO_OFFSET @ virtual base > #endif > .endm > > diff --git a/arch/arm/plat-omap/include/mach/uncompress.h b/arch/arm/plat- > omap/include/mach/uncompress.h > index 0814c5f..0e21eb3 100644 > --- a/arch/arm/plat-omap/include/mach/uncompress.h > +++ b/arch/arm/plat-omap/include/mach/uncompress.h > @@ -38,14 +38,8 @@ static void putc(int c) > 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 defined(CONFIG_DEBUG_LL) > + uart = (volatile u8 *)(CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR); > > #ifdef CONFIG_ARCH_OMAP1 > /* Determine which serial port to use */ > @@ -62,7 +56,6 @@ static void putc(int c) > return; > } while (0); > #endif /* CONFIG_ARCH_OMAP1 */ > -#endif > Regards, Santosh ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup 2009-08-21 17:55 [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup Vikram Pandita 2009-08-22 7:23 ` Shilimkar, Santosh @ 2009-08-22 7:57 ` Kevin Hilman 2009-08-24 14:14 ` Tony Lindgren 2009-08-27 2:38 ` Pandita, Vikram 1 sibling, 2 replies; 12+ messages in thread From: Kevin Hilman @ 2009-08-22 7:57 UTC (permalink / raw) To: Vikram Pandita; +Cc: linux-omap, linux-arm-kernel Vikram Pandita wrote: > This patch cleans up the DEBUG_LL infrastructure for omap boards. Thanks Vikram, this is indeed in need of some cleanup. But I have some comments about the approach taken. This approach still doesn't solve one of the fundamental problems with the current implementation. It prevents using a single kernel across multiple boards. If we could drop the compile-time decision in favor of a runtime one based on machine-type, we could use a single base defconfig that would be able to be tested on all omap3 boards for example. For the zImage UART output (uncompress.h) there is a global variable __machine_arch_type which could be used to check the board type and set variable for UART base and shift. We do this on DaVinci. For debug output (debug-macro.S) those macros should be changed to use variables for UART base and shift also. While you're in changing the board files, you could also add something like this to each: #ifdef CONFIG_SERIAL_8250_CONSOLE static int __init board_console_init(void) { return add_preferred_console("ttyS", <UART#>, "115200"); } console_initcall(board_console_init); #endif This also allows the board to boot using a default UART even without having the console= on the cmdline. There is one catch to doing this at runtime instead of compile time. The variables for the UART base and shift have to be set very early in the boot, otherwise any errors from the early ARM asm boot (head.S) will be missed. For starters, they could be assingned in the board map_io hook, but we'd still miss the debug prints if there were any errors parsing the machine_type and processor_type early in the boot (head.S) I'd be ok with this limitation for a first pass because it's still better than what we currently have in l-o, but I'd like to hear if others had some ideas for how we might do dynamic decisions on UART based on board-type very early in the boot. Kevin > The three stages of log printing infrastructure is using their own #defines > The patch integrates the three stages to use the same variable. > > Three stages are: > Stage 1: Prints - Uncompressing Linux...... > File getting used: arch/arm/plat-omap/include/mach/uncompress.h > Stage 2: Prints - <5>Linux version 2.6.31 > File getting used: arch/arm/plat-omap/include/mach/debug-macro.S > Stage 3: Kernel ttyS console takes over > > On enabling the DEBUG_LL menuconfig item > [Kernel Hacking -> Kernel low-level debugging functions] > > the following entry gets auto selected > [Systerm Type -> TI OMAP Implementations -> Low-level Debug console UART] > > This is the physical address of the UART getting used for the board. > The physical address of debug uart is provided as a menuconfig option now. > > Issue with current system: > (a) Zoom2 board has a detachable debug board having the TL16CP754 Quad uart chip. > If the debug board is not attached, _NO_ debug uart is available. > OMAP internal uarts are not used for traces on zoom2 board. > Current framework does not account for boards that may not have a debug uart > at all. The Stage 1 always accesses one of the uarts. Thats fixed now. > > (b) this patch does a cleanup of arch/arm/plat-omap/include/mach/debug-macro.S > > Signed-off-by: Vikram Pandita <vikram.pandita@ti.com> > --- > arch/arm/plat-omap/Kconfig | 50 ++++++++++++++++++------- > arch/arm/plat-omap/include/mach/common.h | 7 +++ > arch/arm/plat-omap/include/mach/debug-macro.S | 40 ++++---------------- > arch/arm/plat-omap/include/mach/uncompress.h | 12 +---- > 4 files changed, 54 insertions(+), 55 deletions(-) > > diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig > index ab9f9ef..2fefb64 100644 > --- a/arch/arm/plat-omap/Kconfig > +++ b/arch/arm/plat-omap/Kconfig > @@ -162,21 +162,43 @@ 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_DEBUG_LL_UART_PHY_ADDR > + hex "Low-level debug console UART Physical Address" > + depends on ARCH_OMAP && DEBUG_LL > + > + default "0xfffb0800" if ARCH_OMAP1 && (MACH_OMAP_PALMTT || MACH_SX1) > + default "0xfffb0000" if ARCH_OMAP1 > + default "0x4806e000" if ARCH_OMAP2 && MACH_NOKIA_N8X0 > + default "0x4806a000" if ARCH_OMAP2 > + default "0x49020000" if ARCH_OMAP3 && (MACH_NOKIA_RX51 || MACH_OMAP_BEAGLE) > + default "0x49020000" if ARCH_OMAP3 && (MACH_OMAP3_PANDORA || MACH_OMAP_LDP || MACH_OVERO) > + default "0x10000000" if ARCH_OMAP3 && MACH_OMAP_ZOOM2 > + default "0x4806a000" if ARCH_OMAP3 > + default "0x4806a000" if ARCH_OMAP4 > + help > + Specify the Physical address of Low level debug UART > + Specify 0x0 in case you do not want DEBUG_LL functions to iterfere with your board uarts > + > + OMAP1: > + ------------------- > + UART1 -> 0xfffb0000 (default) > + UART2 -> 0xfffb0800 > + UART3 -> 0xfffb9800 (sx1, palmtt) > + > + OMAP2: > + ------------------- > + UART1 -> 0x4806a000 (default) > + UART2 -> 0x4806c000 > + UART3 -> 0x4806e000 (N8X0) > + > + OMAP3/4: > + ------------------- > + UART1 -> 0x4806a000 (default: except following) > + UART2 -> 0x4806c000 > + UART3 -> 0x49020000 (rx51, beagle, pendora, ldp, overo) > + UART4 -> 0x4806e000 > + UART_EXT -> 0x10000000 (zoom2: Debug uart is on external debug board) > > config OMAP_SERIAL_WAKE > bool "Enable wake-up events for serial ports" > diff --git a/arch/arm/plat-omap/include/mach/common.h b/arch/arm/plat-omap/include/mach/common.h > index fdeab42..f29d31f 100644 > --- a/arch/arm/plat-omap/include/mach/common.h > +++ b/arch/arm/plat-omap/include/mach/common.h > @@ -68,4 +68,11 @@ void omap2_set_globals_sdrc(struct omap_globals *); > void omap2_set_globals_control(struct omap_globals *); > void omap2_set_globals_prcm(struct omap_globals *); > > +/* In case Low Level debug is not defined > + * make the low level uart address as zero > + */ > +#if !defined(CONFIG_DEBUG_LL) > +#define CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR 0 > +#endif > + > #endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */ > diff --git a/arch/arm/plat-omap/include/mach/debug-macro.S b/arch/arm/plat-omap/include/mach/debug-macro.S > index ac24050..f546d6c 100644 > --- a/arch/arm/plat-omap/include/mach/debug-macro.S > +++ b/arch/arm/plat-omap/include/mach/debug-macro.S > @@ -10,43 +10,19 @@ > * published by the Free Software Foundation. > * > */ > +#include "io.h" > > .macro addruart,rx > mrc p15, 0, \rx, c1, c0 > tst \rx, #1 @ MMU enabled? > #ifdef CONFIG_ARCH_OMAP1 > - moveq \rx, #0xff000000 @ physical base address > - movne \rx, #0xfe000000 @ virtual base > - orr \rx, \rx, #0x00fb0000 > -#ifdef CONFIG_OMAP_LL_DEBUG_UART3 > - orr \rx, \rx, #0x00009000 @ UART 3 > -#endif > -#if defined(CONFIG_OMAP_LL_DEBUG_UART2) || defined(CONFIG_OMAP_LL_DEBUG_UART3) > - orr \rx, \rx, #0x00000800 @ UART 2 & 3 > -#endif > - > -#elif CONFIG_ARCH_OMAP2 > - moveq \rx, #0x48000000 @ physical base address > - movne \rx, #0xd8000000 @ virtual base > - orr \rx, \rx, #0x0006a000 > -#ifdef CONFIG_OMAP_LL_DEBUG_UART2 > - add \rx, \rx, #0x00002000 @ UART 2 > -#endif > -#ifdef CONFIG_OMAP_LL_DEBUG_UART3 > - add \rx, \rx, #0x00004000 @ UART 3 > -#endif > - > -#elif defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) > - moveq \rx, #0x48000000 @ physical base address > - movne \rx, #0xd8000000 @ virtual base > - orr \rx, \rx, #0x0006a000 > -#ifdef CONFIG_OMAP_LL_DEBUG_UART2 > - add \rx, \rx, #0x00002000 @ UART 2 > -#endif > -#ifdef CONFIG_OMAP_LL_DEBUG_UART3 > - add \rx, \rx, #0x00fb0000 @ UART 3 > - add \rx, \rx, #0x00006000 > -#endif > + /* omap1 */ > + ldr \rx, =CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR @ physical base address > + subne \rx, #CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR, #OMAP1_IO_OFFSET @ virtual base > +#else > + /* omap2/omap3/omap4 */ > + ldr \rx, =CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR @ physical base address > + orrne \rx, \rx, #OMAP2_IO_OFFSET @ virtual base > #endif > .endm > > diff --git a/arch/arm/plat-omap/include/mach/uncompress.h b/arch/arm/plat-omap/include/mach/uncompress.h > index 0814c5f..0e21eb3 100644 > --- a/arch/arm/plat-omap/include/mach/uncompress.h > +++ b/arch/arm/plat-omap/include/mach/uncompress.h > @@ -38,14 +38,8 @@ static void putc(int c) > 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 defined(CONFIG_DEBUG_LL) > + uart = (volatile u8 *)(CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR); > > #ifdef CONFIG_ARCH_OMAP1 > /* Determine which serial port to use */ > @@ -62,7 +56,6 @@ static void putc(int c) > return; > } while (0); > #endif /* CONFIG_ARCH_OMAP1 */ > -#endif > > /* > * Now, xmit each character > @@ -70,6 +63,7 @@ static void putc(int c) > while (!(uart[UART_LSR << shift] & UART_LSR_THRE)) > barrier(); > uart[UART_TX << shift] = c; > +#endif /* CONFIG_DEBUG_LL */ > } > > static inline void flush(void) ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup 2009-08-22 7:57 ` Kevin Hilman @ 2009-08-24 14:14 ` Tony Lindgren 2009-08-27 2:38 ` Pandita, Vikram 1 sibling, 0 replies; 12+ messages in thread From: Tony Lindgren @ 2009-08-24 14:14 UTC (permalink / raw) To: Kevin Hilman; +Cc: Vikram Pandita, linux-omap, linux-arm-kernel * Kevin Hilman <khilman@deeprootsystems.com> [090822 16:31]: > Vikram Pandita wrote: >> This patch cleans up the DEBUG_LL infrastructure for omap boards. > > Thanks Vikram, this is indeed in need of some cleanup. But I have some > comments about the approach taken. > > This approach still doesn't solve one of the fundamental problems with > the current implementation. It prevents using a single kernel across > multiple boards. If we could drop the compile-time decision in favor of > a runtime one based on machine-type, we could use a single base > defconfig that would be able to be tested on all omap3 boards for example. > > For the zImage UART output (uncompress.h) there is a global variable > __machine_arch_type which could be used to check the board type and set > variable for UART base and shift. We do this on DaVinci. I agree we should do this. > For debug output (debug-macro.S) those macros should be changed to use > variables for UART base and shift also. While you're in changing the > board files, you could also add something like this to each: > > #ifdef CONFIG_SERIAL_8250_CONSOLE > static int __init board_console_init(void) > { > return add_preferred_console("ttyS", <UART#>, "115200"); > } > console_initcall(board_console_init); > #endif > > This also allows the board to boot using a default UART even without > having the console= on the cmdline. > > There is one catch to doing this at runtime instead of compile time. > The variables for the UART base and shift have to be set very early in > the boot, otherwise any errors from the early ARM asm boot (head.S) will > be missed. > > For starters, they could be assingned in the board map_io hook, but we'd > still miss the debug prints if there were any errors parsing the > machine_type and processor_type early in the boot (head.S) > > I'd be ok with this limitation for a first pass because it's still > better than what we currently have in l-o, but I'd like to hear if > others had some ideas for how we might do dynamic decisions on UART > based on board-type very early in the boot. Yup, good comments. Tony > > Kevin > >> The three stages of log printing infrastructure is using their own #defines >> The patch integrates the three stages to use the same variable. >> >> Three stages are: >> Stage 1: Prints - Uncompressing Linux...... >> File getting used: arch/arm/plat-omap/include/mach/uncompress.h >> Stage 2: Prints - <5>Linux version 2.6.31 >> File getting used: arch/arm/plat-omap/include/mach/debug-macro.S >> Stage 3: Kernel ttyS console takes over >> >> On enabling the DEBUG_LL menuconfig item >> [Kernel Hacking -> Kernel low-level debugging functions] >> >> the following entry gets auto selected >> [Systerm Type -> TI OMAP Implementations -> Low-level Debug console UART] >> >> This is the physical address of the UART getting used for the board. >> The physical address of debug uart is provided as a menuconfig option now. >> >> Issue with current system: >> (a) Zoom2 board has a detachable debug board having the TL16CP754 Quad uart chip. >> If the debug board is not attached, _NO_ debug uart is available. >> OMAP internal uarts are not used for traces on zoom2 board. >> Current framework does not account for boards that may not have a debug uart >> at all. The Stage 1 always accesses one of the uarts. Thats fixed now. >> >> (b) this patch does a cleanup of arch/arm/plat-omap/include/mach/debug-macro.S >> >> Signed-off-by: Vikram Pandita <vikram.pandita@ti.com> >> --- >> arch/arm/plat-omap/Kconfig | 50 ++++++++++++++++++------- >> arch/arm/plat-omap/include/mach/common.h | 7 +++ >> arch/arm/plat-omap/include/mach/debug-macro.S | 40 ++++---------------- >> arch/arm/plat-omap/include/mach/uncompress.h | 12 +---- >> 4 files changed, 54 insertions(+), 55 deletions(-) >> >> diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig >> index ab9f9ef..2fefb64 100644 >> --- a/arch/arm/plat-omap/Kconfig >> +++ b/arch/arm/plat-omap/Kconfig >> @@ -162,21 +162,43 @@ 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_DEBUG_LL_UART_PHY_ADDR >> + hex "Low-level debug console UART Physical Address" >> + depends on ARCH_OMAP && DEBUG_LL >> + >> + default "0xfffb0800" if ARCH_OMAP1 && (MACH_OMAP_PALMTT || MACH_SX1) >> + default "0xfffb0000" if ARCH_OMAP1 >> + default "0x4806e000" if ARCH_OMAP2 && MACH_NOKIA_N8X0 >> + default "0x4806a000" if ARCH_OMAP2 >> + default "0x49020000" if ARCH_OMAP3 && (MACH_NOKIA_RX51 || MACH_OMAP_BEAGLE) >> + default "0x49020000" if ARCH_OMAP3 && (MACH_OMAP3_PANDORA || MACH_OMAP_LDP || MACH_OVERO) >> + default "0x10000000" if ARCH_OMAP3 && MACH_OMAP_ZOOM2 >> + default "0x4806a000" if ARCH_OMAP3 >> + default "0x4806a000" if ARCH_OMAP4 >> + help >> + Specify the Physical address of Low level debug UART >> + Specify 0x0 in case you do not want DEBUG_LL functions to iterfere with your board uarts >> + >> + OMAP1: >> + ------------------- >> + UART1 -> 0xfffb0000 (default) >> + UART2 -> 0xfffb0800 >> + UART3 -> 0xfffb9800 (sx1, palmtt) >> + >> + OMAP2: >> + ------------------- >> + UART1 -> 0x4806a000 (default) >> + UART2 -> 0x4806c000 >> + UART3 -> 0x4806e000 (N8X0) >> + >> + OMAP3/4: >> + ------------------- >> + UART1 -> 0x4806a000 (default: except following) >> + UART2 -> 0x4806c000 >> + UART3 -> 0x49020000 (rx51, beagle, pendora, ldp, overo) >> + UART4 -> 0x4806e000 >> + UART_EXT -> 0x10000000 (zoom2: Debug uart is on external debug board) >> config OMAP_SERIAL_WAKE >> bool "Enable wake-up events for serial ports" >> diff --git a/arch/arm/plat-omap/include/mach/common.h b/arch/arm/plat-omap/include/mach/common.h >> index fdeab42..f29d31f 100644 >> --- a/arch/arm/plat-omap/include/mach/common.h >> +++ b/arch/arm/plat-omap/include/mach/common.h >> @@ -68,4 +68,11 @@ void omap2_set_globals_sdrc(struct omap_globals *); >> void omap2_set_globals_control(struct omap_globals *); >> void omap2_set_globals_prcm(struct omap_globals *); >> +/* In case Low Level debug is not defined >> + * make the low level uart address as zero >> + */ >> +#if !defined(CONFIG_DEBUG_LL) >> +#define CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR 0 >> +#endif >> + >> #endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */ >> diff --git a/arch/arm/plat-omap/include/mach/debug-macro.S b/arch/arm/plat-omap/include/mach/debug-macro.S >> index ac24050..f546d6c 100644 >> --- a/arch/arm/plat-omap/include/mach/debug-macro.S >> +++ b/arch/arm/plat-omap/include/mach/debug-macro.S >> @@ -10,43 +10,19 @@ >> * published by the Free Software Foundation. >> * >> */ >> +#include "io.h" >> .macro addruart,rx >> mrc p15, 0, \rx, c1, c0 >> tst \rx, #1 @ MMU enabled? >> #ifdef CONFIG_ARCH_OMAP1 >> - moveq \rx, #0xff000000 @ physical base address >> - movne \rx, #0xfe000000 @ virtual base >> - orr \rx, \rx, #0x00fb0000 >> -#ifdef CONFIG_OMAP_LL_DEBUG_UART3 >> - orr \rx, \rx, #0x00009000 @ UART 3 >> -#endif >> -#if defined(CONFIG_OMAP_LL_DEBUG_UART2) || defined(CONFIG_OMAP_LL_DEBUG_UART3) >> - orr \rx, \rx, #0x00000800 @ UART 2 & 3 >> -#endif >> - >> -#elif CONFIG_ARCH_OMAP2 >> - moveq \rx, #0x48000000 @ physical base address >> - movne \rx, #0xd8000000 @ virtual base >> - orr \rx, \rx, #0x0006a000 >> -#ifdef CONFIG_OMAP_LL_DEBUG_UART2 >> - add \rx, \rx, #0x00002000 @ UART 2 >> -#endif >> -#ifdef CONFIG_OMAP_LL_DEBUG_UART3 >> - add \rx, \rx, #0x00004000 @ UART 3 >> -#endif >> - >> -#elif defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) >> - moveq \rx, #0x48000000 @ physical base address >> - movne \rx, #0xd8000000 @ virtual base >> - orr \rx, \rx, #0x0006a000 >> -#ifdef CONFIG_OMAP_LL_DEBUG_UART2 >> - add \rx, \rx, #0x00002000 @ UART 2 >> -#endif >> -#ifdef CONFIG_OMAP_LL_DEBUG_UART3 >> - add \rx, \rx, #0x00fb0000 @ UART 3 >> - add \rx, \rx, #0x00006000 >> -#endif >> + /* omap1 */ >> + ldr \rx, =CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR @ physical base address >> + subne \rx, #CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR, #OMAP1_IO_OFFSET @ virtual base >> +#else >> + /* omap2/omap3/omap4 */ >> + ldr \rx, =CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR @ physical base address >> + orrne \rx, \rx, #OMAP2_IO_OFFSET @ virtual base >> #endif >> .endm >> diff --git a/arch/arm/plat-omap/include/mach/uncompress.h >> b/arch/arm/plat-omap/include/mach/uncompress.h >> index 0814c5f..0e21eb3 100644 >> --- a/arch/arm/plat-omap/include/mach/uncompress.h >> +++ b/arch/arm/plat-omap/include/mach/uncompress.h >> @@ -38,14 +38,8 @@ static void putc(int c) >> 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 defined(CONFIG_DEBUG_LL) >> + uart = (volatile u8 *)(CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR); >> #ifdef CONFIG_ARCH_OMAP1 >> /* Determine which serial port to use */ >> @@ -62,7 +56,6 @@ static void putc(int c) >> return; >> } while (0); >> #endif /* CONFIG_ARCH_OMAP1 */ >> -#endif >> /* >> * Now, xmit each character >> @@ -70,6 +63,7 @@ static void putc(int c) >> while (!(uart[UART_LSR << shift] & UART_LSR_THRE)) >> barrier(); >> uart[UART_TX << shift] = c; >> +#endif /* CONFIG_DEBUG_LL */ >> } >> static inline void flush(void) > > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-omap" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup 2009-08-22 7:57 ` Kevin Hilman 2009-08-24 14:14 ` Tony Lindgren @ 2009-08-27 2:38 ` Pandita, Vikram 2009-08-27 9:21 ` Kevin Hilman 1 sibling, 1 reply; 12+ messages in thread From: Pandita, Vikram @ 2009-08-27 2:38 UTC (permalink / raw) To: Kevin Hilman Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.arm.linux.org.uk Kevin >-----Original Message----- >From: Kevin Hilman [mailto:khilman@deeprootsystems.com] >Sent: Saturday, August 22, 2009 2:57 AM >To: Pandita, Vikram >Cc: linux-omap@vger.kernel.org; linux-arm-kernel@lists.arm.linux.org.uk >Subject: Re: [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup > >Vikram Pandita wrote: >> This patch cleans up the DEBUG_LL infrastructure for omap boards. > >Thanks Vikram, this is indeed in need of some cleanup. But I have some >comments about the approach taken. > >This approach still doesn't solve one of the fundamental problems with >the current implementation. It prevents using a single kernel across >multiple boards. If we could drop the compile-time decision in favor of >a runtime one based on machine-type, we could use a single base >defconfig that would be able to be tested on all omap3 boards for example. > >For the zImage UART output (uncompress.h) there is a global variable >__machine_arch_type which could be used to check the board type and set >variable for UART base and shift. We do this on DaVinci. Could you give reference to this code on DaVinci? Yes this is doable, but the question is, how do we pass these variables to the kernel start: arch/arm/kernel/head.S First stage, arch/arm/boot/compressed/head.S gets the arch type -> shift/uart-addr. Fine. This stage ends with relocated code over righting the decompressor. Second stage, arch/arm/kernel/head.S now starts. I am not sure how to share the data from Stage 1 in this stage? > >For debug output (debug-macro.S) those macros should be changed to use >variables for UART base and shift also. While you're in changing the >board files, you could also add something like this to each: > >#ifdef CONFIG_SERIAL_8250_CONSOLE >static int __init board_console_init(void) >{ > return add_preferred_console("ttyS", <UART#>, "115200"); >} >console_initcall(board_console_init); >#endif > >This also allows the board to boot using a default UART even without >having the console= on the cmdline. > >There is one catch to doing this at runtime instead of compile time. >The variables for the UART base and shift have to be set very early in >the boot, otherwise any errors from the early ARM asm boot (head.S) will >be missed. > >For starters, they could be assingned in the board map_io hook, but we'd >still miss the debug prints if there were any errors parsing the >machine_type and processor_type early in the boot (head.S) > >I'd be ok with this limitation for a first pass because it's still >better than what we currently have in l-o, but I'd like to hear if >others had some ideas for how we might do dynamic decisions on UART >based on board-type very early in the boot. > >Kevin > >> The three stages of log printing infrastructure is using their own #defines >> The patch integrates the three stages to use the same variable. >> >> Three stages are: >> Stage 1: Prints - Uncompressing Linux...... >> File getting used: arch/arm/plat-omap/include/mach/uncompress.h >> Stage 2: Prints - <5>Linux version 2.6.31 >> File getting used: arch/arm/plat-omap/include/mach/debug-macro.S >> Stage 3: Kernel ttyS console takes over >> >> On enabling the DEBUG_LL menuconfig item >> [Kernel Hacking -> Kernel low-level debugging functions] >> >> the following entry gets auto selected >> [Systerm Type -> TI OMAP Implementations -> Low-level Debug console UART] >> >> This is the physical address of the UART getting used for the board. >> The physical address of debug uart is provided as a menuconfig option now. >> >> Issue with current system: >> (a) Zoom2 board has a detachable debug board having the TL16CP754 Quad uart chip. >> If the debug board is not attached, _NO_ debug uart is available. >> OMAP internal uarts are not used for traces on zoom2 board. >> Current framework does not account for boards that may not have a debug uart >> at all. The Stage 1 always accesses one of the uarts. Thats fixed now. >> >> (b) this patch does a cleanup of arch/arm/plat-omap/include/mach/debug-macro.S >> >> Signed-off-by: Vikram Pandita <vikram.pandita@ti.com> >> --- >> arch/arm/plat-omap/Kconfig | 50 ++++++++++++++++++------- >> arch/arm/plat-omap/include/mach/common.h | 7 +++ >> arch/arm/plat-omap/include/mach/debug-macro.S | 40 ++++---------------- >> arch/arm/plat-omap/include/mach/uncompress.h | 12 +---- >> 4 files changed, 54 insertions(+), 55 deletions(-) >> >> diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig >> index ab9f9ef..2fefb64 100644 >> --- a/arch/arm/plat-omap/Kconfig >> +++ b/arch/arm/plat-omap/Kconfig >> @@ -162,21 +162,43 @@ 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_DEBUG_LL_UART_PHY_ADDR >> + hex "Low-level debug console UART Physical Address" >> + depends on ARCH_OMAP && DEBUG_LL >> + >> + default "0xfffb0800" if ARCH_OMAP1 && (MACH_OMAP_PALMTT || MACH_SX1) >> + default "0xfffb0000" if ARCH_OMAP1 >> + default "0x4806e000" if ARCH_OMAP2 && MACH_NOKIA_N8X0 >> + default "0x4806a000" if ARCH_OMAP2 >> + default "0x49020000" if ARCH_OMAP3 && (MACH_NOKIA_RX51 || MACH_OMAP_BEAGLE) >> + default "0x49020000" if ARCH_OMAP3 && (MACH_OMAP3_PANDORA || MACH_OMAP_LDP || MACH_OVERO) >> + default "0x10000000" if ARCH_OMAP3 && MACH_OMAP_ZOOM2 >> + default "0x4806a000" if ARCH_OMAP3 >> + default "0x4806a000" if ARCH_OMAP4 >> + help >> + Specify the Physical address of Low level debug UART >> + Specify 0x0 in case you do not want DEBUG_LL functions to iterfere with your board uarts >> + >> + OMAP1: >> + ------------------- >> + UART1 -> 0xfffb0000 (default) >> + UART2 -> 0xfffb0800 >> + UART3 -> 0xfffb9800 (sx1, palmtt) >> + >> + OMAP2: >> + ------------------- >> + UART1 -> 0x4806a000 (default) >> + UART2 -> 0x4806c000 >> + UART3 -> 0x4806e000 (N8X0) >> + >> + OMAP3/4: >> + ------------------- >> + UART1 -> 0x4806a000 (default: except following) >> + UART2 -> 0x4806c000 >> + UART3 -> 0x49020000 (rx51, beagle, pendora, ldp, overo) >> + UART4 -> 0x4806e000 >> + UART_EXT -> 0x10000000 (zoom2: Debug uart is on external debug board) >> >> config OMAP_SERIAL_WAKE >> bool "Enable wake-up events for serial ports" >> diff --git a/arch/arm/plat-omap/include/mach/common.h b/arch/arm/plat-omap/include/mach/common.h >> index fdeab42..f29d31f 100644 >> --- a/arch/arm/plat-omap/include/mach/common.h >> +++ b/arch/arm/plat-omap/include/mach/common.h >> @@ -68,4 +68,11 @@ void omap2_set_globals_sdrc(struct omap_globals *); >> void omap2_set_globals_control(struct omap_globals *); >> void omap2_set_globals_prcm(struct omap_globals *); >> >> +/* In case Low Level debug is not defined >> + * make the low level uart address as zero >> + */ >> +#if !defined(CONFIG_DEBUG_LL) >> +#define CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR 0 >> +#endif >> + >> #endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */ >> diff --git a/arch/arm/plat-omap/include/mach/debug-macro.S b/arch/arm/plat-omap/include/mach/debug- >macro.S >> index ac24050..f546d6c 100644 >> --- a/arch/arm/plat-omap/include/mach/debug-macro.S >> +++ b/arch/arm/plat-omap/include/mach/debug-macro.S >> @@ -10,43 +10,19 @@ >> * published by the Free Software Foundation. >> * >> */ >> +#include "io.h" >> >> .macro addruart,rx >> mrc p15, 0, \rx, c1, c0 >> tst \rx, #1 @ MMU enabled? >> #ifdef CONFIG_ARCH_OMAP1 >> - moveq \rx, #0xff000000 @ physical base address >> - movne \rx, #0xfe000000 @ virtual base >> - orr \rx, \rx, #0x00fb0000 >> -#ifdef CONFIG_OMAP_LL_DEBUG_UART3 >> - orr \rx, \rx, #0x00009000 @ UART 3 >> -#endif >> -#if defined(CONFIG_OMAP_LL_DEBUG_UART2) || defined(CONFIG_OMAP_LL_DEBUG_UART3) >> - orr \rx, \rx, #0x00000800 @ UART 2 & 3 >> -#endif >> - >> -#elif CONFIG_ARCH_OMAP2 >> - moveq \rx, #0x48000000 @ physical base address >> - movne \rx, #0xd8000000 @ virtual base >> - orr \rx, \rx, #0x0006a000 >> -#ifdef CONFIG_OMAP_LL_DEBUG_UART2 >> - add \rx, \rx, #0x00002000 @ UART 2 >> -#endif >> -#ifdef CONFIG_OMAP_LL_DEBUG_UART3 >> - add \rx, \rx, #0x00004000 @ UART 3 >> -#endif >> - >> -#elif defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) >> - moveq \rx, #0x48000000 @ physical base address >> - movne \rx, #0xd8000000 @ virtual base >> - orr \rx, \rx, #0x0006a000 >> -#ifdef CONFIG_OMAP_LL_DEBUG_UART2 >> - add \rx, \rx, #0x00002000 @ UART 2 >> -#endif >> -#ifdef CONFIG_OMAP_LL_DEBUG_UART3 >> - add \rx, \rx, #0x00fb0000 @ UART 3 >> - add \rx, \rx, #0x00006000 >> -#endif >> + /* omap1 */ >> + ldr \rx, =CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR @ physical base address >> + subne \rx, #CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR, #OMAP1_IO_OFFSET @ virtual base >> +#else >> + /* omap2/omap3/omap4 */ >> + ldr \rx, =CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR @ physical base address >> + orrne \rx, \rx, #OMAP2_IO_OFFSET @ virtual base >> #endif >> .endm >> >> diff --git a/arch/arm/plat-omap/include/mach/uncompress.h b/arch/arm/plat- >omap/include/mach/uncompress.h >> index 0814c5f..0e21eb3 100644 >> --- a/arch/arm/plat-omap/include/mach/uncompress.h >> +++ b/arch/arm/plat-omap/include/mach/uncompress.h >> @@ -38,14 +38,8 @@ static void putc(int c) >> 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 defined(CONFIG_DEBUG_LL) >> + uart = (volatile u8 *)(CONFIG_OMAP_DEBUG_LL_UART_PHY_ADDR); >> >> #ifdef CONFIG_ARCH_OMAP1 >> /* Determine which serial port to use */ >> @@ -62,7 +56,6 @@ static void putc(int c) >> return; >> } while (0); >> #endif /* CONFIG_ARCH_OMAP1 */ >> -#endif >> >> /* >> * Now, xmit each character >> @@ -70,6 +63,7 @@ static void putc(int c) >> while (!(uart[UART_LSR << shift] & UART_LSR_THRE)) >> barrier(); >> uart[UART_TX << shift] = c; >> +#endif /* CONFIG_DEBUG_LL */ >> } >> >> static inline void flush(void) > > > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup 2009-08-27 2:38 ` Pandita, Vikram @ 2009-08-27 9:21 ` Kevin Hilman 2009-08-27 13:04 ` Pandita, Vikram 0 siblings, 1 reply; 12+ messages in thread From: Kevin Hilman @ 2009-08-27 9:21 UTC (permalink / raw) To: Pandita, Vikram Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.arm.linux.org.uk "Pandita, Vikram" <vikram.pandita@ti.com> writes: >>Vikram Pandita wrote: >>> This patch cleans up the DEBUG_LL infrastructure for omap boards. >> >>Thanks Vikram, this is indeed in need of some cleanup. But I have some >>comments about the approach taken. >> >>This approach still doesn't solve one of the fundamental problems with >>the current implementation. It prevents using a single kernel across >>multiple boards. If we could drop the compile-time decision in favor of >>a runtime one based on machine-type, we could use a single base >>defconfig that would be able to be tested on all omap3 boards for example. >> >>For the zImage UART output (uncompress.h) there is a global variable >>__machine_arch_type which could be used to check the board type and set >>variable for UART base and shift. We do this on DaVinci. > > Could you give reference to this code on DaVinci? http://git.kernel.org/?p=linux/kernel/git/khilman/linux-davinci.git;a=blobdiff;f=arch/arm/mach-davinci/include/mach/uncompress.h;h=0f1f12b67875f86232c0e06e1a687a6d7f19b18a;hp=1e27475f9a2322f1a4f61e25fd1a1e5858e29fc2;hb=bb9647f44b091ebff17f400bb2a468c7e419f3ac;hpb=0dc6306a65f30c0483cfed9b3e8ee1eb3d093e84 > > Yes this is doable, but the question is, how do we pass these variables to the kernel start: > arch/arm/kernel/head.S > > First stage, arch/arm/boot/compressed/head.S gets the arch type -> shift/uart-addr. Fine. > This stage ends with relocated code over righting the decompressor. > > Second stage, arch/arm/kernel/head.S now starts. > > I am not sure how to share the data from Stage 1 in this stage? This is already taken care of. The zImage boot passes the machine-type in a register, then arch/arm/kernel/head.S uses that to decide which machine to start. This is where the MACHINE_START/MACHINE_END macros come in to define the machine-specific hooks called at boot time. You should use one of the early machine hooks (probably .map_io) to to set the UART base and shift for the board. The catch is that between the start of the head.S code and the mach->map_io hook, printascii() may be called and use the debug macros to try to print out chars. Care must be taken that if the UART is not yet known/defined, nothing is printed. Kevin ^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup 2009-08-27 9:21 ` Kevin Hilman @ 2009-08-27 13:04 ` Pandita, Vikram 2009-08-27 13:29 ` Kevin Hilman 0 siblings, 1 reply; 12+ messages in thread From: Pandita, Vikram @ 2009-08-27 13:04 UTC (permalink / raw) To: Kevin Hilman Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.arm.linux.org.uk >-----Original Message----- >From: Kevin Hilman [mailto:khilman@deeprootsystems.com] >"Pandita, Vikram" <vikram.pandita@ti.com> writes: > >>>Vikram Pandita wrote: >>>> This patch cleans up the DEBUG_LL infrastructure for omap boards. >>> >> >> Could you give reference to this code on DaVinci? > >http://git.kernel.org/?p=linux/kernel/git/khilman/linux-davinci.git;a=blobdiff;f=arch/arm/mach- >davinci/include/mach/uncompress.h;h=0f1f12b67875f86232c0e06e1a687a6d7f19b18a;hp=1e27475f9a2322f1a4f61 >e25fd1a1e5858e29fc2;hb=bb9647f44b091ebff17f400bb2a468c7e419f3ac;hpb=0dc6306a65f30c0483cfed9b3e8ee1eb3 >d093e84 > >> >> Yes this is doable, but the question is, how do we pass these variables to the kernel start: >> arch/arm/kernel/head.S >> >> First stage, arch/arm/boot/compressed/head.S gets the arch type -> shift/uart-addr. Fine. >> This stage ends with relocated code over righting the decompressor. >> >> Second stage, arch/arm/kernel/head.S now starts. >> >> I am not sure how to share the data from Stage 1 in this stage? > >This is already taken care of. > >The zImage boot passes the machine-type in a register, then >arch/arm/kernel/head.S uses that to decide which machine to start. >This is where the MACHINE_START/MACHINE_END macros come in to >define the machine-specific hooks called at boot time. Yes. I agree. I have reviewed that path. > >You should use one of the early machine hooks (probably .map_io) >to to set the UART base and shift for the board. I am looking at even earlier than that. The idea is to write to phys_io and io_pg_offset from kernel/head.S very early based on the uart address found in compressed/misc.c To make map_io writable, I will have to change the MACHINE_START to remove the const. It so happens that Russell has defined MACHINE_START to be a const. Not sure is removing const from MACHINE_START is acceptable? I can have a sample implementation and post to get review comments. > >The catch is that between the start of the head.S code and the >mach->map_io hook, printascii() may be called and use the debug >macros to try to print out chars. Care must be taken that >if the UART is not yet known/defined, nothing is printed. That is easy and can be taken care of. > >Kevin > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup 2009-08-27 13:04 ` Pandita, Vikram @ 2009-08-27 13:29 ` Kevin Hilman 2009-09-16 19:11 ` Russell King - ARM Linux 0 siblings, 1 reply; 12+ messages in thread From: Kevin Hilman @ 2009-08-27 13:29 UTC (permalink / raw) To: Pandita, Vikram Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.arm.linux.org.uk "Pandita, Vikram" <vikram.pandita@ti.com> writes: >>-----Original Message----- >>From: Kevin Hilman [mailto:khilman@deeprootsystems.com] >>"Pandita, Vikram" <vikram.pandita@ti.com> writes: >> >>>>Vikram Pandita wrote: >>>>> This patch cleans up the DEBUG_LL infrastructure for omap boards. >>>> >>> Could you give reference to this code on DaVinci? >> >>http://git.kernel.org/?p=linux/kernel/git/khilman/linux-davinci.git;a=blobdiff;f=arch/arm/mach- >>davinci/include/mach/uncompress.h;h=0f1f12b67875f86232c0e06e1a687a6d7f19b18a;hp=1e27475f9a2322f1a4f61 >>e25fd1a1e5858e29fc2;hb=bb9647f44b091ebff17f400bb2a468c7e419f3ac;hpb=0dc6306a65f30c0483cfed9b3e8ee1eb3 >>d093e84 >> >>> Yes this is doable, but the question is, how do we pass these >>> variables to the kernel start: arch/arm/kernel/head.S >>> First stage, arch/arm/boot/compressed/head.S gets the arch type -> >>> shift/uart-addr. Fine. This stage ends with relocated code over >>> righting the decompressor. >>> Second stage, arch/arm/kernel/head.S now starts. >>> I am not sure how to share the data from Stage 1 in this stage? >> >>This is already taken care of. >> >>The zImage boot passes the machine-type in a register, then >>arch/arm/kernel/head.S uses that to decide which machine to start. >>This is where the MACHINE_START/MACHINE_END macros come in to >>define the machine-specific hooks called at boot time. > > Yes. I agree. I have reviewed that path. > >> >>You should use one of the early machine hooks (probably .map_io) >>to to set the UART base and shift for the board. > > I am looking at even earlier than that. OK > The idea is to write to phys_io and io_pg_offset from kernel/head.S > very early based on the uart address found in compressed/misc.c > > To make map_io writable, I will have to change the MACHINE_START to > remove the const. It so happens that Russell has defined > MACHINE_START to be a const. > > Not sure is removing const from MACHINE_START is acceptable? we'll find out after you post for RFC. > I can have a sample implementation and post to get review comments. > >> >>The catch is that between the start of the head.S code and the >>mach->map_io hook, printascii() may be called and use the debug >>macros to try to print out chars. Care must be taken that >>if the UART is not yet known/defined, nothing is printed. > > That is easy and can be taken care of. > ok, I look forward to seeing how you handle this. Kevin ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup 2009-08-27 13:29 ` Kevin Hilman @ 2009-09-16 19:11 ` Russell King - ARM Linux 2009-09-17 19:00 ` Pandita, Vikram 0 siblings, 1 reply; 12+ messages in thread From: Russell King - ARM Linux @ 2009-09-16 19:11 UTC (permalink / raw) To: Kevin Hilman Cc: Pandita, Vikram, linux-omap@vger.kernel.org, linux-arm-kernel@lists.arm.linux.org.uk On Thu, Aug 27, 2009 at 04:29:35PM +0300, Kevin Hilman wrote: > > The idea is to write to phys_io and io_pg_offset from kernel/head.S > > very early based on the uart address found in compressed/misc.c > > > > To make map_io writable, I will have to change the MACHINE_START to > > remove the const. It so happens that Russell has defined > > MACHINE_START to be a const. > > > > Not sure is removing const from MACHINE_START is acceptable? > > we'll find out after you post for RFC. The answer is no, it is not acceptable - it'll break XIP kernels because this is placed into the read-only part of the kernel image no matter what. ^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup 2009-09-16 19:11 ` Russell King - ARM Linux @ 2009-09-17 19:00 ` Pandita, Vikram 2009-09-17 19:47 ` Russell King - ARM Linux 0 siblings, 1 reply; 12+ messages in thread From: Pandita, Vikram @ 2009-09-17 19:00 UTC (permalink / raw) To: Russell King - ARM Linux, Kevin Hilman Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.arm.linux.org.uk Russell >-----Original Message----- >From: Russell King - ARM Linux [mailto:linux@arm.linux.org.uk] >Sent: Wednesday, September 16, 2009 2:11 PM >To: Kevin Hilman >Cc: Pandita, Vikram; linux-omap@vger.kernel.org; linux-arm-kernel@lists.arm.linux.org.uk >Subject: Re: [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup > >On Thu, Aug 27, 2009 at 04:29:35PM +0300, Kevin Hilman wrote: >> > The idea is to write to phys_io and io_pg_offset from kernel/head.S >> > very early based on the uart address found in compressed/misc.c >> > >> > To make map_io writable, I will have to change the MACHINE_START to >> > remove the const. It so happens that Russell has defined >> > MACHINE_START to be a const. >> > >> > Not sure is removing const from MACHINE_START is acceptable? >> >> we'll find out after you post for RFC. > >The answer is no, it is not acceptable - it'll break XIP kernels >because this is placed into the read-only part of the kernel image >no matter what. The good news is that Version 2 of DEBUG_LL cleanup patch [1], does not change the const attribute of MACHINE_START. There are review comments by Kevin [2] still getting fixed, but a 'Russell-look' will surely help to the in-lined patch [3] . Regards, Vikram [1] git://dev.omapzoom.org/pub/scm/vikram/omap3.git runtime-debug-ll [2] http://patchwork.kernel.org/patch/46909/ [3] Patch inlined below --- diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 4515728..7fcc21a 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -277,6 +277,20 @@ not_relocated: mov r0, #0 blo 1b add sp, r1, #128 @ relocate the stack + mov r9, r0 + + bl get_uart_base @ get uart phy address + adr r2, __dummy + str r0, [r2] @save uart phy adder in memory + ldm r2, {r13}^ @save phyadder in usermode reg + + bl get_uart_virt_base @ get uart virtual address + adr r2, __dummy + str r0, [r2] @save uart phy adder in memory + ldm r2, {r14}^ @save phyadder in usermode reg + + mov r0, r9 + bl cache_clean_flush add pc, r5, r0 @ call relocation code @@ -303,6 +317,9 @@ LC0: .word LC0 @ r1 LC1: .word reloc_end - reloc_start .size LC0, . - LC0 + .type __dummy, #object +__dummy: .word __dummy + #ifdef CONFIG_ARCH_RPC .globl params params: ldr r0, =params_phys diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index 17153b5..0758656 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c @@ -22,6 +22,15 @@ unsigned int __machine_arch_type; #include <linux/types.h> /* for size_t */ #include <linux/stddef.h> /* for NULL */ #include <asm/string.h> +#include <asm/mach-types.h> +/* TODO: + * Include of this header is not working. + * Gives Error: undefined reference to `omap_rev' + * This header is needed for constant: + * ZOOM2_EXT_QUART_VIRT = 0xFB000000 + * ZOOM2_EXT_QUART_PHYS = 0x10000000 + */ +/* #include <mach/io.h> */ #ifdef STANDALONE_DEBUG #define putstr printf @@ -316,6 +325,103 @@ static void error(char *x) #ifndef STANDALONE_DEBUG +u32 *omap_uart_debug_ll_phy_addr; + +static void find_debug_ll_uart_port(unsigned int arch_type) +{ + omap_uart_debug_ll_phy_addr = 0; + + /* Add logic here for new platforms, using __macine_arch_type */ + + /* TODO: REVISIT -- Check Completeness + * DEFINE PHY ADDRESS for EACH BOARD HERE: omap1/2/3/4 */ +#if defined(CONFIG_ARCH_OMAP1) + switch (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 (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 (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 = (u32 *)0x49020000; + break; + case MACH_TYPE_OMAP_ZOOM2: + /* EXTERNEL UART */ + omap_uart_debug_ll_phy_addr = (u32 *)0x10000000; + break; + default: + /* UART1 */ + omap_uart_debug_ll_phy_addr = (u32 *)0x4806a000; + break; + } +#endif + +#ifdef CONFIG_ARCH_OMAP4 + switch (arch_type) { + /* OMAP3: UART1 */ + case MACH_TYPE_OMAP_4430SDP: + default: + omap_uart_debug_ll_phy_addr = (u32 *)0x4806a000; + putstr("This is an OMAP4 ...\n"); + break; + } +#endif +} + +ulg +get_uart_base(void) +{ + return (ulg)omap_uart_debug_ll_phy_addr; +} + +ulg +get_uart_virt_base(void) +{ + ulg val = 0; + +#ifdef CONFIG_ARCH_OMAP1 + /* omap1 */ + val = 0xfef00000; +#else + /* omap2/3/4... */ + if (MACH_TYPE_OMAP_ZOOM2 == __machine_arch_type) + val = 0xFB000000; /* ZOOM2_EXT_QUART_VIRT */ + else + val = 0xd8000000; +#endif + + return (ulg)(((val) >> 18) & 0xfffc); +} + ulg decompress_kernel(ulg output_start, ulg free_mem_ptr_p, ulg free_mem_ptr_end_p, int arch_id) @@ -325,6 +431,7 @@ decompress_kernel(ulg output_start, ulg free_mem_ptr_p, ulg free_mem_ptr_end_p, free_mem_end_ptr = free_mem_ptr_end_p; __machine_arch_type = arch_id; + find_debug_ll_uart_port(arch_id); arch_decomp_setup(); makecrc(); @@ -348,4 +455,3 @@ int main() return 0; } #endif - diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index 64b3f52..dc00780 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig @@ -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 diff --git a/arch/arm/plat-omap/include/mach/debug-macro.S b/arch/arm/plat-omap/include/mach/debug-macro.S index ac24050..ba80ca4 100644 --- a/arch/arm/plat-omap/include/mach/debug-macro.S +++ b/arch/arm/plat-omap/include/mach/debug-macro.S @@ -10,43 +10,42 @@ * published by the Free Software Foundation. * */ +#include "io.h" + + .align + .type __phy_uart_addr, #object +__phy_uart_addr: .word 0xFF + .type __virt_uart_addr, #object +__virt_uart_addr: .word 0xFF .macro addruart,rx - mrc p15, 0, \rx, c1, c0 - tst \rx, #1 @ MMU enabled? -#ifdef CONFIG_ARCH_OMAP1 - moveq \rx, #0xff000000 @ physical base address - movne \rx, #0xfe000000 @ virtual base - orr \rx, \rx, #0x00fb0000 -#ifdef CONFIG_OMAP_LL_DEBUG_UART3 - orr \rx, \rx, #0x00009000 @ UART 3 -#endif -#if defined(CONFIG_OMAP_LL_DEBUG_UART2) || defined(CONFIG_OMAP_LL_DEBUG_UART3) - orr \rx, \rx, #0x00000800 @ UART 2 & 3 -#endif +1000: + adr r2,__phy_uart_addr + ldr \rx, [r2] + tst \rx, #0xFF + beq 1100f + stm r2, {r13}^ @get uart phy addr + ldr \rx, [r2] -#elif CONFIG_ARCH_OMAP2 - moveq \rx, #0x48000000 @ physical base address - movne \rx, #0xd8000000 @ virtual base - orr \rx, \rx, #0x0006a000 -#ifdef CONFIG_OMAP_LL_DEBUG_UART2 - add \rx, \rx, #0x00002000 @ UART 2 -#endif -#ifdef CONFIG_OMAP_LL_DEBUG_UART3 - add \rx, \rx, #0x00004000 @ UART 3 -#endif + adr r2,__virt_uart_addr + stm r2, {r14}^ @get uart virt addr + ldr \rx, [r2] + lsl \rx, \rx, #18 + adr r2,__phy_uart_addr + ldr r2, [r2] + orr \rx, \rx, r2 + adr r2,__virt_uart_addr + str \rx, [r2] + b 1000b +1100: + mrc p15, 0, r2, c1, c0 + tst r2, #1 @ MMU enabled? -#elif defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) - moveq \rx, #0x48000000 @ physical base address - movne \rx, #0xd8000000 @ virtual base - orr \rx, \rx, #0x0006a000 -#ifdef CONFIG_OMAP_LL_DEBUG_UART2 - add \rx, \rx, #0x00002000 @ UART 2 -#endif -#ifdef CONFIG_OMAP_LL_DEBUG_UART3 - add \rx, \rx, #0x00fb0000 @ UART 3 - add \rx, \rx, #0x00006000 -#endif +#ifdef CONFIG_ARCH_OMAP1 + subne \rx, \rx, #OMAP1_IO_OFFSET @ virtual base +#else + adr r2,__virt_uart_addr @ omap2/omap3/omap4/etc... + ldrne \rx, [r2] #endif .endm @@ -55,13 +54,20 @@ .endm .macro busyuart,rd,rx -1001: ldrb \rd, [\rx, #(0x5 << 2)] @ OMAP-1510 and friends +1001: adr \rd,__phy_uart_addr + ldr \rd, [\rd] + cmp \rd, #ZOOM2_EXT_QUART_PHYS + movne \rd, #(0x5 << 2) + moveq \rd, #(0x5 << 1) + ldrb \rd, [\rx, \rd] and \rd, \rd, #0x60 teq \rd, #0x60 +#ifdef CONFIG_ARCH_OMAP1 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/uncompress.h b/arch/arm/plat-omap/include/mach/uncompress.h index 0814c5f..9121d7a 100644 --- a/arch/arm/plat-omap/include/mach/uncompress.h +++ b/arch/arm/plat-omap/include/mach/uncompress.h @@ -21,7 +21,8 @@ #include <linux/serial_reg.h> #include <mach/serial.h> -unsigned int system_rev; +extern u32 *omap_uart_debug_ll_phy_addr; +extern unsigned int __machine_arch_type; #define UART_OMAP_MDR1 0x08 /* mode definition register */ #define OMAP_ID_730 0x355F @@ -38,14 +39,16 @@ static void putc(int c) 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 + uart = (volatile u8 *)(omap_uart_debug_ll_phy_addr); + if (!uart) + return; + + if (MACH_TYPE_OMAP_ZOOM2 == __machine_arch_type) { + /* External UART has a shift=1 requirement + * Internal OMAP UARTs have shift=2 requirement + */ + shift = 1; + } #ifdef CONFIG_ARCH_OMAP1 /* Determine which serial port to use */ @@ -62,7 +65,6 @@ static void putc(int c) return; } while (0); #endif /* CONFIG_ARCH_OMAP1 */ -#endif /* * Now, xmit each character ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup 2009-09-17 19:00 ` Pandita, Vikram @ 2009-09-17 19:47 ` Russell King - ARM Linux 2009-09-18 21:16 ` Pandita, Vikram 0 siblings, 1 reply; 12+ messages in thread From: Russell King - ARM Linux @ 2009-09-17 19:47 UTC (permalink / raw) To: Pandita, Vikram Cc: Kevin Hilman, linux-omap@vger.kernel.org, linux-arm-kernel@lists.arm.linux.org.uk On Fri, Sep 18, 2009 at 12:30:25AM +0530, Pandita, Vikram wrote: > There are review comments by Kevin [2] still getting fixed, > but a 'Russell-look' will surely help to the in-lined patch [3] . Still not good. > + mov r9, r0 > + > + bl get_uart_base @ get uart phy address > + adr r2, __dummy > + str r0, [r2] @save uart phy adder in memory > + ldm r2, {r13}^ @save phyadder in usermode reg > + > + bl get_uart_virt_base @ get uart virtual address > + adr r2, __dummy > + str r0, [r2] @save uart phy adder in memory > + ldm r2, {r14}^ @save phyadder in usermode reg > + > + mov r0, r9 > + > bl cache_clean_flush > add pc, r5, r0 @ call relocation code > > @@ -303,6 +317,9 @@ LC0: .word LC0 @ r1 > LC1: .word reloc_end - reloc_start > .size LC0, . - LC0 > > + .type __dummy, #object > +__dummy: .word __dummy This appears to be in the text segment, and is written to. That's not going to work if the text segment is stored in flash (and in fact might be dangerous in some cases.) > + > #ifdef CONFIG_ARCH_RPC > .globl params > params: ldr r0, =params_phys > diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c > index 17153b5..0758656 100644 > --- a/arch/arm/boot/compressed/misc.c > +++ b/arch/arm/boot/compressed/misc.c > @@ -22,6 +22,15 @@ unsigned int __machine_arch_type; > #include <linux/types.h> /* for size_t */ > #include <linux/stddef.h> /* for NULL */ > #include <asm/string.h> > +#include <asm/mach-types.h> > +/* TODO: > + * Include of this header is not working. > + * Gives Error: undefined reference to `omap_rev' > + * This header is needed for constant: > + * ZOOM2_EXT_QUART_VIRT = 0xFB000000 > + * ZOOM2_EXT_QUART_PHYS = 0x10000000 > + */ > +/* #include <mach/io.h> */ > > #ifdef STANDALONE_DEBUG > #define putstr printf > @@ -316,6 +325,103 @@ static void error(char *x) > > #ifndef STANDALONE_DEBUG > > +u32 *omap_uart_debug_ll_phy_addr; > + > +static void find_debug_ll_uart_port(unsigned int arch_type) > +{ > + omap_uart_debug_ll_phy_addr = 0; > + > + /* Add logic here for new platforms, using __macine_arch_type */ > + > + /* TODO: REVISIT -- Check Completeness > + * DEFINE PHY ADDRESS for EACH BOARD HERE: omap1/2/3/4 */ > +#if defined(CONFIG_ARCH_OMAP1) > + switch (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 (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 (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 = (u32 *)0x49020000; > + break; > + case MACH_TYPE_OMAP_ZOOM2: > + /* EXTERNEL UART */ > + omap_uart_debug_ll_phy_addr = (u32 *)0x10000000; > + break; > + default: > + /* UART1 */ > + omap_uart_debug_ll_phy_addr = (u32 *)0x4806a000; > + break; > + } > +#endif > + > +#ifdef CONFIG_ARCH_OMAP4 > + switch (arch_type) { > + /* OMAP3: UART1 */ > + case MACH_TYPE_OMAP_4430SDP: > + default: > + omap_uart_debug_ll_phy_addr = (u32 *)0x4806a000; > + putstr("This is an OMAP4 ...\n"); > + break; > + } > +#endif > +} > + > +ulg > +get_uart_base(void) > +{ > + return (ulg)omap_uart_debug_ll_phy_addr; > +} > + > +ulg > +get_uart_virt_base(void) > +{ > + ulg val = 0; > + > +#ifdef CONFIG_ARCH_OMAP1 > + /* omap1 */ > + val = 0xfef00000; > +#else > + /* omap2/3/4... */ > + if (MACH_TYPE_OMAP_ZOOM2 == __machine_arch_type) > + val = 0xFB000000; /* ZOOM2_EXT_QUART_VIRT */ > + else > + val = 0xd8000000; > +#endif > + > + return (ulg)(((val) >> 18) & 0xfffc); > +} > + Clearly, all this code should not be in here. There's a perfectly good header file to contain the platform specifics which it can live in, and there's a perfectly good hook for it to latch into (arch_decomp_setup). > diff --git a/arch/arm/plat-omap/include/mach/debug-macro.S b/arch/arm/plat-omap/include/mach/debug-macro.S > index ac24050..ba80ca4 100644 > --- a/arch/arm/plat-omap/include/mach/debug-macro.S > +++ b/arch/arm/plat-omap/include/mach/debug-macro.S > @@ -10,43 +10,42 @@ > * published by the Free Software Foundation. > * > */ > +#include "io.h" > + > + .align > + .type __phy_uart_addr, #object > +__phy_uart_addr: .word 0xFF > + .type __virt_uart_addr, #object > +__virt_uart_addr: .word 0xFF Again, this ends up in the text segment, and in the XIP case, the text segment is not writable (writes hit the flash chip.) > diff --git a/arch/arm/plat-omap/include/mach/uncompress.h b/arch/arm/plat-omap/include/mach/uncompress.h > index 0814c5f..9121d7a 100644 > --- a/arch/arm/plat-omap/include/mach/uncompress.h > +++ b/arch/arm/plat-omap/include/mach/uncompress.h > @@ -21,7 +21,8 @@ > #include <linux/serial_reg.h> > #include <mach/serial.h> > > -unsigned int system_rev; > +extern u32 *omap_uart_debug_ll_phy_addr; > +extern unsigned int __machine_arch_type; Just include asm/mach-types.h - there's no need to declare this here. ^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup 2009-09-17 19:47 ` Russell King - ARM Linux @ 2009-09-18 21:16 ` Pandita, Vikram 0 siblings, 0 replies; 12+ messages in thread From: Pandita, Vikram @ 2009-09-18 21:16 UTC (permalink / raw) To: Russell King - ARM Linux Cc: Kevin Hilman, linux-omap@vger.kernel.org, linux-arm-kernel@lists.arm.linux.org.uk >-----Original Message----- >From: Russell King - ARM Linux [mailto:linux@arm.linux.org.uk] >Sent: Thursday, September 17, 2009 2:48 PM >To: Pandita, Vikram >Cc: Kevin Hilman; linux-omap@vger.kernel.org; linux-arm-kernel@lists.arm.linux.org.uk >Subject: Re: [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup > >On Fri, Sep 18, 2009 at 12:30:25AM +0530, Pandita, Vikram wrote: >> There are review comments by Kevin [2] still getting fixed, >> but a 'Russell-look' will surely help to the in-lined patch [3] . > >Still not good. I have considered all your comments for this patch and am working on a new approach. I should be able to post V3 patch set in a day or so, which does not touch any of the common files. > >> + mov r9, r0 >> + >> + bl get_uart_base @ get uart phy address >> + adr r2, __dummy >> + str r0, [r2] @save uart phy adder in memory >> + ldm r2, {r13}^ @save phyadder in usermode reg >> + >> + bl get_uart_virt_base @ get uart virtual address >> + adr r2, __dummy >> + str r0, [r2] @save uart phy adder in memory >> + ldm r2, {r14}^ @save phyadder in usermode reg >> + >> + mov r0, r9 >> + >> bl cache_clean_flush >> add pc, r5, r0 @ call relocation code >> >> @@ -303,6 +317,9 @@ LC0: .word LC0 @ r1 >> LC1: .word reloc_end - reloc_start >> .size LC0, . - LC0 >> >> + .type __dummy, #object >> +__dummy: .word __dummy > >This appears to be in the text segment, and is written to. That's not >going to work if the text segment is stored in flash (and in fact might >be dangerous in some cases.) > >> + >> #ifdef CONFIG_ARCH_RPC >> .globl params >> params: ldr r0, =params_phys >> diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c >> index 17153b5..0758656 100644 >> --- a/arch/arm/boot/compressed/misc.c >> +++ b/arch/arm/boot/compressed/misc.c >> @@ -22,6 +22,15 @@ unsigned int __machine_arch_type; >> #include <linux/types.h> /* for size_t */ >> #include <linux/stddef.h> /* for NULL */ >> #include <asm/string.h> >> +#include <asm/mach-types.h> >> +/* TODO: >> + * Include of this header is not working. >> + * Gives Error: undefined reference to `omap_rev' >> + * This header is needed for constant: >> + * ZOOM2_EXT_QUART_VIRT = 0xFB000000 >> + * ZOOM2_EXT_QUART_PHYS = 0x10000000 >> + */ >> +/* #include <mach/io.h> */ >> >> #ifdef STANDALONE_DEBUG >> #define putstr printf >> @@ -316,6 +325,103 @@ static void error(char *x) >> >> #ifndef STANDALONE_DEBUG >> >> +u32 *omap_uart_debug_ll_phy_addr; >> + >> +static void find_debug_ll_uart_port(unsigned int arch_type) >> +{ >> + omap_uart_debug_ll_phy_addr = 0; >> + >> + /* Add logic here for new platforms, using __macine_arch_type */ >> + >> + /* TODO: REVISIT -- Check Completeness >> + * DEFINE PHY ADDRESS for EACH BOARD HERE: omap1/2/3/4 */ >> +#if defined(CONFIG_ARCH_OMAP1) >> + switch (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 (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 (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 = (u32 *)0x49020000; >> + break; >> + case MACH_TYPE_OMAP_ZOOM2: >> + /* EXTERNEL UART */ >> + omap_uart_debug_ll_phy_addr = (u32 *)0x10000000; >> + break; >> + default: >> + /* UART1 */ >> + omap_uart_debug_ll_phy_addr = (u32 *)0x4806a000; >> + break; >> + } >> +#endif >> + >> +#ifdef CONFIG_ARCH_OMAP4 >> + switch (arch_type) { >> + /* OMAP3: UART1 */ >> + case MACH_TYPE_OMAP_4430SDP: >> + default: >> + omap_uart_debug_ll_phy_addr = (u32 *)0x4806a000; >> + putstr("This is an OMAP4 ...\n"); >> + break; >> + } >> +#endif >> +} >> + >> +ulg >> +get_uart_base(void) >> +{ >> + return (ulg)omap_uart_debug_ll_phy_addr; >> +} >> + >> +ulg >> +get_uart_virt_base(void) >> +{ >> + ulg val = 0; >> + >> +#ifdef CONFIG_ARCH_OMAP1 >> + /* omap1 */ >> + val = 0xfef00000; >> +#else >> + /* omap2/3/4... */ >> + if (MACH_TYPE_OMAP_ZOOM2 == __machine_arch_type) >> + val = 0xFB000000; /* ZOOM2_EXT_QUART_VIRT */ >> + else >> + val = 0xd8000000; >> +#endif >> + >> + return (ulg)(((val) >> 18) & 0xfffc); >> +} >> + > >Clearly, all this code should not be in here. There's a perfectly good >header file to contain the platform specifics which it can live in, and >there's a perfectly good hook for it to latch into (arch_decomp_setup). > >> diff --git a/arch/arm/plat-omap/include/mach/debug-macro.S b/arch/arm/plat-omap/include/mach/debug- >macro.S >> index ac24050..ba80ca4 100644 >> --- a/arch/arm/plat-omap/include/mach/debug-macro.S >> +++ b/arch/arm/plat-omap/include/mach/debug-macro.S >> @@ -10,43 +10,42 @@ >> * published by the Free Software Foundation. >> * >> */ >> +#include "io.h" >> + >> + .align >> + .type __phy_uart_addr, #object >> +__phy_uart_addr: .word 0xFF >> + .type __virt_uart_addr, #object >> +__virt_uart_addr: .word 0xFF > >Again, this ends up in the text segment, and in the XIP case, the text >segment is not writable (writes hit the flash chip.) > >> diff --git a/arch/arm/plat-omap/include/mach/uncompress.h b/arch/arm/plat- >omap/include/mach/uncompress.h >> index 0814c5f..9121d7a 100644 >> --- a/arch/arm/plat-omap/include/mach/uncompress.h >> +++ b/arch/arm/plat-omap/include/mach/uncompress.h >> @@ -21,7 +21,8 @@ >> #include <linux/serial_reg.h> >> #include <mach/serial.h> >> >> -unsigned int system_rev; >> +extern u32 *omap_uart_debug_ll_phy_addr; >> +extern unsigned int __machine_arch_type; > >Just include asm/mach-types.h - there's no need to declare this here. ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2009-09-18 21:17 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-08-21 17:55 [PATCH 1/5] OMAP1/2/3/4: DEBUG_LL: cleanup Vikram Pandita 2009-08-22 7:23 ` Shilimkar, Santosh 2009-08-22 7:57 ` Kevin Hilman 2009-08-24 14:14 ` Tony Lindgren 2009-08-27 2:38 ` Pandita, Vikram 2009-08-27 9:21 ` Kevin Hilman 2009-08-27 13:04 ` Pandita, Vikram 2009-08-27 13:29 ` Kevin Hilman 2009-09-16 19:11 ` Russell King - ARM Linux 2009-09-17 19:00 ` Pandita, Vikram 2009-09-17 19:47 ` Russell King - ARM Linux 2009-09-18 21:16 ` Pandita, Vikram
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox