linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] omap multiboot improvments for merge window after 2.6.34
@ 2010-01-16  1:35 Tony Lindgren
  2010-01-16  1:35 ` [PATCH 1/4] omap: Clean the serial port defines Tony Lindgren
                   ` (4 more replies)
  0 siblings, 5 replies; 38+ messages in thread
From: Tony Lindgren @ 2010-01-16  1:35 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

Here are some multiboot improvments for review. These patches
are intended for the 2.6.34 merge window.

Comments and testing would be nice, I've tested them so far
on osk, 770, n800, rx51 and overo.

Regards,

Tony

---

Tony Lindgren (4):
      omap: Clean the serial port defines
      omap: Make uncompress code and DEBUG_LL code generic
      omap: Remove old DEBUG_LL serial port options
      omap: Make get_irqnr_and_base common for mach-omap2 multiboot


 arch/arm/mach-omap1/include/mach/debug-macro.S |   83 ++++++++++--
 arch/arm/mach-omap1/serial.c                   |   18 ++-
 arch/arm/mach-omap2/include/mach/debug-macro.S |   91 +++++++++----
 arch/arm/mach-omap2/include/mach/entry-macro.S |   55 +++++---
 arch/arm/mach-omap2/serial.c                   |   26 +++-
 arch/arm/plat-omap/Kconfig                     |   19 ---
 arch/arm/plat-omap/common.c                    |   18 +++
 arch/arm/plat-omap/include/plat/common.h       |    5 +
 arch/arm/plat-omap/include/plat/serial.h       |   62 ++++++---
 arch/arm/plat-omap/include/plat/uncompress.h   |  168 +++++++++++++++++-------
 10 files changed, 390 insertions(+), 155 deletions(-)

-- 
Signature

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 1/4] omap: Clean the serial port defines
  2010-01-16  1:35 [PATCH 0/4] omap multiboot improvments for merge window after 2.6.34 Tony Lindgren
@ 2010-01-16  1:35 ` Tony Lindgren
  2010-01-16  7:48   ` Shilimkar, Santosh
  2010-01-19  0:39   ` Pandita, Vikram
  2010-01-16  1:35 ` [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic Tony Lindgren
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 38+ messages in thread
From: Tony Lindgren @ 2010-01-16  1:35 UTC (permalink / raw)
  To: linux-arm-kernel

This way we don't have conflicts with the defines
with compiling in multiple omaps. Set the addresses
for uarts in struct omap_globals for the early serial
init code.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap1/include/mach/debug-macro.S |   16 +++++----
 arch/arm/mach-omap1/serial.c                   |    6 ++-
 arch/arm/mach-omap2/include/mach/debug-macro.S |   15 ++++----
 arch/arm/mach-omap2/serial.c                   |   15 ++++++--
 arch/arm/plat-omap/common.c                    |   18 ++++++++++
 arch/arm/plat-omap/include/plat/common.h       |    5 +++
 arch/arm/plat-omap/include/plat/serial.h       |   44 +++++++++++++-----------
 7 files changed, 77 insertions(+), 42 deletions(-)

diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
index aedb746..23e4724 100644
--- a/arch/arm/mach-omap1/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -11,6 +11,10 @@
  *
 */
 
+#include <linux/serial_reg.h>
+
+#include <plat/serial.h>
+
 		.macro	addruart,rx
 		mrc	p15, 0, \rx, c1, c0
 		tst	\rx, #1			@ MMU enabled?
@@ -30,13 +34,13 @@
 		.endm
 
 		.macro	busyuart,rd,rx
-1001:		ldrb	\rd, [\rx, #(0x5 << 2)]	@ OMAP-1510 and friends
-		and	\rd, \rd, #0x60
-		teq	\rd, #0x60
+1001:		ldrb	\rd, [\rx, #(UART_LSR << OMAP_PORT_SHIFT)]
+		and	\rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
+		teq	\rd, #(UART_LSR_TEMT | UART_LSR_THRE)
 		beq	1002f
-		ldrb	\rd, [\rx, #(0x5 << 0)]	@ OMAP-730 only
-		and	\rd, \rd, #0x60
-		teq	\rd, #0x60
+		ldrb	\rd, [\rx, #(UART_LSR << OMAP7XX_PORT_SHIFT)]
+		and	\rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
+		teq	\rd, #(UART_LSR_TEMT | UART_LSR_THRE)
 		bne	1001b
 1002:
 		.endm
diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
index 6e5207c..349de90 100644
--- a/arch/arm/mach-omap1/serial.c
+++ b/arch/arm/mach-omap1/serial.c
@@ -64,7 +64,7 @@ static void __init omap_serial_reset(struct plat_serial8250_port *p)
 
 static struct plat_serial8250_port serial_platform_data[] = {
 	{
-		.mapbase	= OMAP_UART1_BASE,
+		.mapbase	= OMAP1_UART1_BASE,
 		.irq		= INT_UART1,
 		.flags		= UPF_BOOT_AUTOCONF,
 		.iotype		= UPIO_MEM,
@@ -72,7 +72,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
 		.uartclk	= OMAP16XX_BASE_BAUD * 16,
 	},
 	{
-		.mapbase	= OMAP_UART2_BASE,
+		.mapbase	= OMAP1_UART2_BASE,
 		.irq		= INT_UART2,
 		.flags		= UPF_BOOT_AUTOCONF,
 		.iotype		= UPIO_MEM,
@@ -80,7 +80,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
 		.uartclk	= OMAP16XX_BASE_BAUD * 16,
 	},
 	{
-		.mapbase	= OMAP_UART3_BASE,
+		.mapbase	= OMAP1_UART3_BASE,
 		.irq		= INT_UART3,
 		.flags		= UPF_BOOT_AUTOCONF,
 		.iotype		= UPIO_MEM,
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S
index e9f255d..0c96e1c 100644
--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -11,6 +11,10 @@
  *
 */
 
+#include <linux/serial_reg.h>
+
+#include <plat/serial.h>
+
 		.macro	addruart,rx
 		mrc	p15, 0, \rx, c1, c0
 		tst	\rx, #1			@ MMU enabled?
@@ -44,15 +48,10 @@
 		.endm
 
 		.macro	busyuart,rd,rx
-1001:		ldrb	\rd, [\rx, #(0x5 << 2)]	@ OMAP-1510 and friends
-		and	\rd, \rd, #0x60
-		teq	\rd, #0x60
-		beq	1002f
-		ldrb	\rd, [\rx, #(0x5 << 0)]	@ OMAP-730 only
-		and	\rd, \rd, #0x60
-		teq	\rd, #0x60
+1001:		ldrb	\rd, [\rx, #(UART_LSR << OMAP_PORT_SHIFT)]
+		and	\rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
+		teq	\rd, #(UART_LSR_TEMT | UART_LSR_THRE)
 		bne	1001b
-1002:
 		.endm
 
 		.macro	waituart,rd,rx
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 837b347..21e51c5 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -74,7 +74,6 @@ static LIST_HEAD(uart_list);
 
 static struct plat_serial8250_port serial_platform_data0[] = {
 	{
-		.mapbase	= OMAP_UART1_BASE,
 		.irq		= 72,
 		.flags		= UPF_BOOT_AUTOCONF,
 		.iotype		= UPIO_MEM,
@@ -87,7 +86,6 @@ static struct plat_serial8250_port serial_platform_data0[] = {
 
 static struct plat_serial8250_port serial_platform_data1[] = {
 	{
-		.mapbase	= OMAP_UART2_BASE,
 		.irq		= 73,
 		.flags		= UPF_BOOT_AUTOCONF,
 		.iotype		= UPIO_MEM,
@@ -100,7 +98,6 @@ static struct plat_serial8250_port serial_platform_data1[] = {
 
 static struct plat_serial8250_port serial_platform_data2[] = {
 	{
-		.mapbase	= OMAP_UART3_BASE,
 		.irq		= 74,
 		.flags		= UPF_BOOT_AUTOCONF,
 		.iotype		= UPIO_MEM,
@@ -114,7 +111,6 @@ static struct plat_serial8250_port serial_platform_data2[] = {
 #ifdef CONFIG_ARCH_OMAP4
 static struct plat_serial8250_port serial_platform_data3[] = {
 	{
-		.mapbase	= OMAP_UART4_BASE,
 		.irq		= 70,
 		.flags		= UPF_BOOT_AUTOCONF,
 		.iotype		= UPIO_MEM,
@@ -125,6 +121,17 @@ static struct plat_serial8250_port serial_platform_data3[] = {
 	}
 };
 #endif
+
+void __init omap2_set_globals_uart(struct omap_globals *omap2_globals)
+{
+	serial_platform_data0[0].mapbase = omap2_globals->uart1_phys;
+	serial_platform_data1[0].mapbase = omap2_globals->uart2_phys;
+	serial_platform_data2[0].mapbase = omap2_globals->uart3_phys;
+#ifdef CONFIG_ARCH_OMAP4
+	serial_platform_data3[0].mapbase = omap2_globals->uart4_phys;
+#endif
+}
+
 static inline unsigned int __serial_read_reg(struct uart_port *up,
 					   int offset)
 {
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index bf1eaf3..1c72b65 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -34,6 +34,7 @@
 #include <plat/control.h>
 #include <plat/mux.h>
 #include <plat/fpga.h>
+#include <plat/serial.h>
 
 #include <plat/clock.h>
 
@@ -233,11 +234,15 @@ static struct omap_globals omap242x_globals = {
 	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP2420_CTRL_BASE),
 	.prm	= OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE),
 	.cm	= OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE),
+	.uart1_phys	= OMAP2_UART1_BASE,
+	.uart2_phys	= OMAP2_UART2_BASE,
+	.uart3_phys	= OMAP2_UART3_BASE,
 };
 
 void __init omap2_set_globals_242x(void)
 {
 	__omap2_set_globals(&omap242x_globals);
+	omap2_set_globals_uart(&omap242x_globals);
 }
 #endif
 
@@ -251,11 +256,15 @@ static struct omap_globals omap243x_globals = {
 	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
 	.prm	= OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
 	.cm	= OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
+	.uart1_phys	= OMAP2_UART1_BASE,
+	.uart2_phys	= OMAP2_UART2_BASE,
+	.uart3_phys	= OMAP2_UART3_BASE,
 };
 
 void __init omap2_set_globals_243x(void)
 {
 	__omap2_set_globals(&omap243x_globals);
+	omap2_set_globals_uart(&omap243x_globals);
 }
 #endif
 
@@ -269,11 +278,15 @@ static struct omap_globals omap343x_globals = {
 	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
 	.prm	= OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
 	.cm	= OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
+	.uart1_phys	= OMAP3_UART1_BASE,
+	.uart2_phys	= OMAP3_UART2_BASE,
+	.uart3_phys	= OMAP3_UART3_BASE,
 };
 
 void __init omap2_set_globals_343x(void)
 {
 	__omap2_set_globals(&omap343x_globals);
+	omap2_set_globals_uart(&omap343x_globals);
 }
 #endif
 
@@ -285,6 +298,10 @@ static struct omap_globals omap4_globals = {
 	.prm	= OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
 	.cm	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
 	.cm2	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
+	.uart1_phys	= OMAP4_UART1_BASE,
+	.uart2_phys	= OMAP4_UART2_BASE,
+	.uart3_phys	= OMAP4_UART3_BASE,
+	.uart4_phys	= OMAP4_UART4_BASE,
 };
 
 void __init omap2_set_globals_443x(void)
@@ -292,6 +309,7 @@ void __init omap2_set_globals_443x(void)
 	omap2_set_globals_tap(&omap4_globals);
 	omap2_set_globals_control(&omap4_globals);
 	omap2_set_globals_prcm(&omap4_globals);
+	omap2_set_globals_uart(&omap4_globals);
 }
 #endif
 
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index 32c2227..a8fa0d7 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -47,6 +47,10 @@ struct omap_globals {
 	void __iomem	*prm;		/* Power and Reset Management */
 	void __iomem	*cm;		/* Clock Management */
 	void __iomem	*cm2;
+	unsigned long	uart1_phys;
+	unsigned long	uart2_phys;
+	unsigned long	uart3_phys;
+	unsigned long	uart4_phys;
 };
 
 void omap2_set_globals_242x(void);
@@ -59,6 +63,7 @@ void omap2_set_globals_tap(struct omap_globals *);
 void omap2_set_globals_sdrc(struct omap_globals *);
 void omap2_set_globals_control(struct omap_globals *);
 void omap2_set_globals_prcm(struct omap_globals *);
+void omap2_set_globals_uart(struct omap_globals *);
 
 /**
  * omap_test_timeout - busy-loop, testing a condition
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h
index f5a4a92..c7e2b85 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/plat-omap/include/plat/serial.h
@@ -15,37 +15,39 @@
 
 #include <linux/init.h>
 
-#if defined(CONFIG_ARCH_OMAP1)
 /* OMAP1 serial ports */
-#define OMAP_UART1_BASE		0xfffb0000
-#define OMAP_UART2_BASE		0xfffb0800
-#define OMAP_UART3_BASE		0xfffb9800
-#elif defined(CONFIG_ARCH_OMAP2)
+#define OMAP1_UART1_BASE	0xfffb0000
+#define OMAP1_UART2_BASE	0xfffb0800
+#define OMAP1_UART3_BASE	0xfffb9800
+
 /* OMAP2 serial ports */
-#define OMAP_UART1_BASE		0x4806a000
-#define OMAP_UART2_BASE		0x4806c000
-#define OMAP_UART3_BASE		0x4806e000
-#elif defined(CONFIG_ARCH_OMAP3)
+#define OMAP2_UART1_BASE	0x4806a000
+#define OMAP2_UART2_BASE	0x4806c000
+#define OMAP2_UART3_BASE	0x4806e000
+
 /* OMAP3 serial ports */
-#define OMAP_UART1_BASE		0x4806a000
-#define OMAP_UART2_BASE		0x4806c000
-#define OMAP_UART3_BASE		0x49020000
-#elif defined(CONFIG_ARCH_OMAP4)
+#define OMAP3_UART1_BASE	0x4806a000
+#define OMAP3_UART2_BASE	0x4806c000
+#define OMAP3_UART3_BASE	0x49020000
+
 /* OMAP4 serial ports */
-#define OMAP_UART1_BASE		0x4806a000
-#define OMAP_UART2_BASE		0x4806c000
-#define OMAP_UART3_BASE		0x48020000
-#define OMAP_UART4_BASE		0x4806e000
-#endif
+#define OMAP4_UART1_BASE	0x4806a000
+#define OMAP4_UART2_BASE	0x4806c000
+#define OMAP4_UART3_BASE	0x48020000
+#define OMAP4_UART4_BASE	0x4806e000
+
+#define OMAP_PORT_SHIFT		2
+#define OMAP7XX_PORT_SHIFT	0
 
 #define OMAP1510_BASE_BAUD	(12000000/16)
 #define OMAP16XX_BASE_BAUD	(48000000/16)
 #define OMAP24XX_BASE_BAUD	(48000000/16)
 
+/* This is only used by 8250.c for omap1510 */
 #define is_omap_port(pt)	({int __ret = 0;			\
-			if ((pt)->port.mapbase == OMAP_UART1_BASE ||	\
-			    (pt)->port.mapbase == OMAP_UART2_BASE ||	\
-			    (pt)->port.mapbase == OMAP_UART3_BASE)	\
+			if ((pt)->port.mapbase == OMAP1_UART1_BASE ||	\
+			    (pt)->port.mapbase == OMAP1_UART2_BASE ||	\
+			    (pt)->port.mapbase == OMAP1_UART3_BASE)	\
 				__ret = 1;				\
 			__ret;						\
 			})

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic
  2010-01-16  1:35 [PATCH 0/4] omap multiboot improvments for merge window after 2.6.34 Tony Lindgren
  2010-01-16  1:35 ` [PATCH 1/4] omap: Clean the serial port defines Tony Lindgren
@ 2010-01-16  1:35 ` Tony Lindgren
  2010-01-16  9:35   ` Russell King - ARM Linux
                     ` (2 more replies)
  2010-01-16  1:35 ` [PATCH 3/4] omap: Remove old DEBUG_LL serial port options Tony Lindgren
                   ` (2 subsequent siblings)
  4 siblings, 3 replies; 38+ messages in thread
From: Tony Lindgren @ 2010-01-16  1:35 UTC (permalink / raw)
  To: linux-arm-kernel

Define arch_decomp_setup() the same way as some other
architectures do. Use arch_id to configure the debug uart
based on the machine_is by storing it into the uart
scratchpad register for DEBUG_LL code to use.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap1/include/mach/debug-macro.S |   67 +++++++++-
 arch/arm/mach-omap1/serial.c                   |   12 ++
 arch/arm/mach-omap2/include/mach/debug-macro.S |   76 ++++++++---
 arch/arm/mach-omap2/serial.c                   |   11 ++
 arch/arm/plat-omap/include/plat/serial.h       |   18 +++
 arch/arm/plat-omap/include/plat/uncompress.h   |  168 +++++++++++++++++-------
 6 files changed, 276 insertions(+), 76 deletions(-)

diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
index 23e4724..0174858 100644
--- a/arch/arm/mach-omap1/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -15,18 +15,71 @@
 
 #include <plat/serial.h>
 
+omap_uart_phys:	.word	0x0
+omap_uart_virt:	.word	0x0
+
+		/*
+		 * Note that this code won't work if the bootloader passes
+		 * a wrong machine ID number in r1. To debug, just hardcode
+		 * the desired UART phys and virt addresses temporarily into
+		 * the omap_uart_phys and omap_uart_virt above.
+		 */
 		.macro	addruart,rx
+
+		/* Use omap_uart_phys/virt if already configured */
+9:		mrc	p15, 0, \rx, c1, c0
+		tst	\rx, #1			@ MMU enabled?
+		ldreq	\rx, omap_uart_phys	@ physical base address
+		ldrne	\rx, omap_uart_virt	@ virtual base
+		cmp	\rx, #0			@ is port configured?
+		bne	99f			@ already configured
+
+		/* Check 7XX UART1 scratchpad register for uart to use */
+		mrc	p15, 0, \rx, c1, c0
+		tst	\rx, #1			@ MMU enabled?
+		moveq	\rx, #0xff000000	@ physical base address
+		movne	\rx, #0xfe000000	@ virtual base
+		orr	\rx, \rx, #0x00fb0000	@ OMAP1UART1
+		ldrb	\rx, [\rx, #(UART_SCR << OMAP7XX_PORT_SHIFT)]
+		cmp	\rx, #0			@ anything in 7XX scratchpad?
+		bne	10f			@ found 7XX uart
+
+		/* Check 15xx/16xx UART1 scratchpad register for uart to use */
 		mrc	p15, 0, \rx, c1, c0
 		tst	\rx, #1			@ MMU enabled?
 		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
+		orr	\rx, \rx, #0x00fb0000	@ OMAP1UART1
+		ldrb	\rx, [\rx, #(UART_SCR << OMAP_PORT_SHIFT)]
+
+		/* Select the UART to use based on the UART1 scratchpad value */
+10:		cmp	\rx, #0			@ no port configured?
+		beq	11f			@ if none, try to use UART1
+		cmp	\rx, #OMAP1UART1
+		beq	11f			@ configure OMAP1UART1
+		cmp	\rx, #OMAP1UART2
+		beq	12f			@ configure OMAP1UART2
+		cmp	\rx, #OMAP1UART3
+		beq	13f			@ configure OMAP2UART3
+
+		/* Configure the UART offset from the phys/virt base */
+11:		mov	\rx, #0x00fb0000	@ OMAP1UART1
+		b	98f
+12:		mov	\rx, #0x00fb0000	@ OMAP1UART1
+		orr	\rx, \rx, #0x00000800	@ OMAP1UART2
+		b	98f
+13:		mov	\rx, #0x00fb0000	@ OMAP1UART1
+		orr	\rx, \rx, #0x00000800	@ OMAP1UART2
+		orr	\rx, \rx, #0x00009000	@ OMAP1UART3
+
+		/* Store both phys and virt address for the uart */
+98:		add	\rx, \rx, #0xff000000	@ phys base
+		str	\rx, omap_uart_phys
+		sub	\rx, \rx, #0xff000000	@ phys base
+		add	\rx, \rx, #0xfe000000	@ virt base
+		str	\rx, omap_uart_virt
+		b	9b
+99:
 		.endm
 
 		.macro	senduart,rd,rx
diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
index 349de90..c36de59 100644
--- a/arch/arm/mach-omap1/serial.c
+++ b/arch/arm/mach-omap1/serial.c
@@ -52,6 +52,15 @@ static inline void omap_serial_outp(struct plat_serial8250_port *p, int offset,
  */
 static void __init omap_serial_reset(struct plat_serial8250_port *p)
 {
+	u8 scratchpad = 0;
+
+	/*
+	 * Save UART1 scratchpad register value for UART1 for DEBUG_LL.
+	 * See also include/plat/uncompress.h and include/mach/debug-macro.S.
+	 */
+	if (p->mapbase == OMAP1_UART1_BASE)
+		scratchpad = omap_serial_in(p, UART_SCR);
+
 	omap_serial_outp(p, UART_OMAP_MDR1, 0x07);	/* disable UART */
 	omap_serial_outp(p, UART_OMAP_SCR, 0x08);	/* TX watermark */
 	omap_serial_outp(p, UART_OMAP_MDR1, 0x00);	/* enable UART */
@@ -60,6 +69,9 @@ static void __init omap_serial_reset(struct plat_serial8250_port *p)
 		omap_serial_outp(p, UART_OMAP_SYSC, 0x01);
 		while (!(omap_serial_in(p, UART_OMAP_SYSC) & 0x01));
 	}
+
+	if (p->mapbase == OMAP1_UART1_BASE)
+		omap_serial_outp(p, UART_SCR, scratchpad);
 }
 
 static struct plat_serial8250_port serial_platform_data[] = {
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S
index 0c96e1c..1b83584 100644
--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -15,32 +15,66 @@
 
 #include <plat/serial.h>
 
+omap_uart_phys:	.word	0x0
+omap_uart_virt:	.word	0x0
+
+		/*
+		 * Note that this code won't work if the bootloader passes
+		 * a wrong machine ID number in r1. To debug, just hardcode
+		 * the desired UART phys and virt addresses temporarily into
+		 * the omap_uart_phys and omap_uart_virt above.
+		 */
 		.macro	addruart,rx
+
+		/* Use omap_uart_phys/virt if already configured */
+10:		mrc	p15, 0, \rx, c1, c0
+		tst	\rx, #1			@ MMU enabled?
+		ldreq	\rx, omap_uart_phys	@ physical base address
+		ldrne	\rx, omap_uart_virt	@ virtual base
+		cmp	\rx, #0			@ is port configured?
+		bne	99f			@ already configured
+
+		/* Check UART1 scratchpad register for uart to use */
 		mrc	p15, 0, \rx, c1, c0
 		tst	\rx, #1			@ MMU enabled?
-#ifdef  CONFIG_ARCH_OMAP2
 		moveq	\rx, #0x48000000	@ physical base address
 		movne	\rx, #0xfa000000	@ 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, #0xfa000000	@ 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
-#endif
+		orr	\rx, \rx, #0x0006a000	@ uart1 on omap2/3/4
+		ldrb	\rx, [\rx, #(UART_SCR << OMAP_PORT_SHIFT)] @ scratchpad
+
+		/* Select the UART to use based on the UART1 scratchpad value */
+		cmp	\rx, #0			@ no port configured?
+		beq	21f			@ if none, try to use UART1
+		cmp	\rx, #OMAP2UART1	@ OMAP2/3/4UART1
+		beq	21f			@ configure OMAP2/3/4UART1
+		cmp	\rx, #OMAP2UART2	@ OMAP2/3/4UART2
+		beq	22f			@ configure OMAP2/3/4UART2
+		cmp	\rx, #OMAP2UART3	@ only on 24xx
+		beq	23f			@ configure OMAP2UART3
+		cmp	\rx, #OMAP3UART3	@ only on 34xx
+		beq	33f			@ configure OMAP3UART3
+
+		/* Configure the UART offset from the phys/virt base */
+21:		mov	\rx, #0x0006a000	@ OMAP2/3/4UART1
+		b	98f
+22:		mov	\rx, #0x0006a000
+		add	\rx, \rx, #0x00002000	@ OMAP2/3/4UART2
+		b	98f
+23:		mov	\rx, #0x0006a000	@ OMAP2/3/4UART1
+		add	\rx, \rx, #0x00004000	@ OMAP2UART3
+		b	98f
+33:		mov	\rx, #0x0006a000	@ OMAP2/3/4UART1
+		add	\rx, \rx, #0x00fb0000
+		add	\rx, \rx, #0x00006000	@ OMAP3UART3
+
+		/* Store both phys and virt address for the uart */
+98:		add	\rx, \rx, #0x48000000	@ phys base
+		str	\rx, omap_uart_phys
+		sub	\rx, \rx, #0x48000000	@ phys base
+		add	\rx, \rx, #0xfa000000	@ virt base
+		str	\rx, omap_uart_virt
+		b	10b
+99:
 		.endm
 
 		.macro	senduart,rd,rx
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 21e51c5..48157ce 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -161,11 +161,22 @@ static inline void serial_write_reg(struct plat_serial8250_port *p, int offset,
 static inline void __init omap_uart_reset(struct omap_uart_state *uart)
 {
 	struct plat_serial8250_port *p = uart->p;
+	u8 scratchpad = 0;
+
+	/*
+	 * Save UART1 scratchpad register value for UART1 for DEBUG_LL.
+	 * See also include/plat/uncompress.h and include/mach/debug-macro.S.
+	 */
+	if (p->mapbase == OMAP2_UART1_BASE)	/* OMAP2/3/4UART1_BASE */
+		scratchpad = serial_read_reg(p, UART_SCR);
 
 	serial_write_reg(p, UART_OMAP_MDR1, 0x07);
 	serial_write_reg(p, UART_OMAP_SCR, 0x08);
 	serial_write_reg(p, UART_OMAP_MDR1, 0x00);
 	serial_write_reg(p, UART_OMAP_SYSC, (0x02 << 3) | (1 << 2) | (1 << 0));
+
+	if (p->mapbase == OMAP2_UART1_BASE)	/* OMAP2/3/4UART1_BASE */
+		serial_write_reg(p, UART_SCR, scratchpad);
 }
 
 #if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3)
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h
index c7e2b85..327362a 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/plat-omap/include/plat/serial.h
@@ -43,6 +43,24 @@
 #define OMAP16XX_BASE_BAUD	(48000000/16)
 #define OMAP24XX_BASE_BAUD	(48000000/16)
 
+/*
+ * DEBUG_LL port encoding stored into the UART1 scratchpad register by
+ * decomp_setup in uncompress.h
+ */
+#define OMAP1UART1		11
+#define OMAP1UART2		12
+#define OMAP1UART3		13
+#define OMAP2UART1		21
+#define OMAP2UART2		22
+#define OMAP2UART3		23
+#define OMAP3UART1		OMAP2UART1
+#define OMAP3UART2		OMAP2UART2
+#define OMAP3UART3		33
+#define OMAP4UART1		OMAP2UART1
+#define OMAP4UART2		OMAP2UART2
+#define OMAP4UART3		43
+#define OMAP4UART4		44
+
 /* This is only used by 8250.c for omap1510 */
 #define is_omap_port(pt)	({int __ret = 0;			\
 			if ((pt)->port.mapbase == OMAP1_UART1_BASE ||	\
diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
index 13c305d..479bac8 100644
--- a/arch/arm/plat-omap/include/plat/uncompress.h
+++ b/arch/arm/plat-omap/include/plat/uncompress.h
@@ -19,62 +19,36 @@
 
 #include <linux/types.h>
 #include <linux/serial_reg.h>
+
+#include <asm/mach-types.h>
+
 #include <plat/serial.h>
 
-unsigned int system_rev;
+static volatile u8 *uart1_base;
+static volatile u8 *uart_base;
+static volatile int uart_shift;
 
-#define UART_OMAP_MDR1		0x08	/* mode definition register */
-#define OMAP_ID_730		0x355F
-#define OMAP_ID_850		0x362C
-#define ID_MASK			0x7fff
-#define check_port(base, shift) ((base[UART_OMAP_MDR1 << shift] & 7) == 0)
-#define omap_get_id() ((*(volatile unsigned int *)(0xfffed404)) >> 12) & ID_MASK
+/*
+ * Store the DEBUG_LL uart number into UART1 scratchpad register.
+ * See also debug-macro.S, and serial.c for related code.
+ *
+ * Please note that we currently assume that:
+ * - UART1 clocks are enabled for register access
+ * - UART1 scratchpad register can be used
+ */
+static void set_uart1_scratchpad(unsigned char port)
+{
+	uart1_base[UART_SCR << uart_shift] = port;
+}
 
 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);
-#elif defined(CONFIG_OMAP_LL_DEBUG_UART1)
-	uart = (volatile u8 *)(OMAP_UART1_BASE);
-#elif defined(CONFIG_OMAP_LL_DEBUG_NONE)
-	return;
-#else
-	return;
-#endif
-
-#ifdef CONFIG_ARCH_OMAP1
-	/* Determine which serial port to use */
-	do {
-		/* MMU is not on, so cpu_is_omapXXXX() won't work here */
-		unsigned int omap_id = omap_get_id();
-
-		if (omap_id == OMAP_ID_730 || omap_id == OMAP_ID_850)
-			shift = 0;
-
-		if (check_port(uart, shift))
-			break;
-		/* Silent boot if no serial ports are enabled. */
+	if (!uart_base)
 		return;
-	} while (0);
-#endif /* CONFIG_ARCH_OMAP1 */
-#endif
 
-	/*
-	 * Now, xmit each character
-	 */
-	while (!(uart[UART_LSR << shift] & UART_LSR_THRE))
+	while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE))
 		barrier();
-	uart[UART_TX << shift] = c;
+	uart_base[UART_TX << uart_shift] = c;
 }
 
 static inline void flush(void)
@@ -82,7 +56,105 @@ static inline void flush(void)
 }
 
 /*
+ * Macros to configure UART1 and debug UART
+ */
+#define _DEBUG_LL_ENTRY(mach, uart1, dbg_uart, shift, dbg_id, reset_fn)	\
+	if (machine_is_##mach()) {					\
+		uart1_base = (volatile u8 *)(uart1);			\
+		uart_base = (volatile u8 *)(dbg_uart);			\
+		uart_shift = (shift);					\
+		port = (dbg_id);					\
+		reset_fn;						\
+		break;							\
+	}
+
+#define DEBUG_LL_OMAP7XX(p, mach)					\
+	_DEBUG_LL_ENTRY(mach, OMAP1_UART1_BASE, OMAP1_UART##p##_BASE,	\
+		OMAP7XX_PORT_SHIFT, OMAP1UART##p, set_uart1_scratchpad(port))
+
+#define DEBUG_LL_OMAP1(p, mach)						\
+	_DEBUG_LL_ENTRY(mach, OMAP1_UART1_BASE, OMAP1_UART##p##_BASE,	\
+		OMAP_PORT_SHIFT, OMAP1UART##p, set_uart1_scratchpad(port))
+
+#define DEBUG_LL_OMAP2(p, mach)						\
+	_DEBUG_LL_ENTRY(mach, OMAP2_UART1_BASE, OMAP2_UART##p##_BASE,	\
+		OMAP_PORT_SHIFT, OMAP2UART##p, set_uart1_scratchpad(port))
+
+#define DEBUG_LL_OMAP3(p, mach)						\
+	_DEBUG_LL_ENTRY(mach, OMAP3_UART1_BASE, OMAP3_UART##p##_BASE,	\
+		OMAP_PORT_SHIFT, OMAP3UART##p, set_uart1_scratchpad(port))
+
+#define DEBUG_LL_OMAP4(p, mach)						\
+	_DEBUG_LL_ENTRY(mach, OMAP4_UART1_BASE, OMAP4_UART##p##_BASE,	\
+		OMAP_PORT_SHIFT, OMAP4UART##p, set_uart1_scratchpad(port))
+
+static inline void __arch_decomp_setup(unsigned long arch_id)
+{
+	int port = 0;
+
+	/*
+	 * Initialize the port based on the machine ID from the bootloader.
+	 * Note that we're using macros here instead of switch statement
+	 * as machine_is functions are optimized out for the boards that
+	 * are not selected.
+	 */
+	do {
+		/* omap7xx/8xx based boards using UART1 with shift 0 */
+		DEBUG_LL_OMAP7XX(1, herald);
+		DEBUG_LL_OMAP7XX(1, omap_perseus2);
+
+		/* omap15xx/16xx based boards using UART1 */
+		DEBUG_LL_OMAP1(1, ams_delta);
+		DEBUG_LL_OMAP1(1, nokia770);
+		DEBUG_LL_OMAP1(1, omap_h2);
+		DEBUG_LL_OMAP1(1, omap_h3);
+		DEBUG_LL_OMAP1(1, omap_innovator);
+		DEBUG_LL_OMAP1(1, omap_osk);
+		DEBUG_LL_OMAP1(1, omap_palmte);
+		DEBUG_LL_OMAP1(1, omap_palmz71);
+
+		/* omap15xx/16xx based boards using UART2 */
+		DEBUG_LL_OMAP1(2, omap_palmtt);
+
+		/* omap15xx/16xx based boards using UART3 */
+		DEBUG_LL_OMAP1(3, sx1);
+
+		/* omap2 based boards using UART1 */
+		DEBUG_LL_OMAP2(1, omap2evm);
+		DEBUG_LL_OMAP2(1, omap_2430sdp);
+		DEBUG_LL_OMAP2(1, omap_apollon);
+		DEBUG_LL_OMAP2(1, omap_h4);
+
+		/* omap2 based boards using UART3 */
+		DEBUG_LL_OMAP2(3, nokia_n800);
+		DEBUG_LL_OMAP2(3, nokia_n810);
+		DEBUG_LL_OMAP2(3, nokia_n810_wimax);
+
+		/* omap3 based boards using UART1 */
+		DEBUG_LL_OMAP2(1, omap3evm);
+		DEBUG_LL_OMAP3(1, omap_3430sdp);
+		DEBUG_LL_OMAP3(1, omap_3630sdp);
+
+		/* omap3 based boards using UART3 */
+		DEBUG_LL_OMAP3(3, cm_t35);
+		DEBUG_LL_OMAP3(3, igep0020);
+		DEBUG_LL_OMAP3(3, nokia_rx51);
+		DEBUG_LL_OMAP3(3, omap3517evm);
+		DEBUG_LL_OMAP3(3, omap3_beagle);
+		DEBUG_LL_OMAP3(3, omap3_pandora);
+		DEBUG_LL_OMAP3(3, omap_ldp);
+		DEBUG_LL_OMAP3(3, overo);
+		DEBUG_LL_OMAP3(3, touchbook);
+
+		/* omap4 based boards using UART3 */
+		DEBUG_LL_OMAP4(3, omap_4430sdp);
+
+	} while (0);
+}
+
+#define arch_decomp_setup()	__arch_decomp_setup(arch_id)
+
+/*
  * nothing to do
  */
-#define arch_decomp_setup()
 #define arch_decomp_wdog()

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 3/4] omap: Remove old DEBUG_LL serial port options
  2010-01-16  1:35 [PATCH 0/4] omap multiboot improvments for merge window after 2.6.34 Tony Lindgren
  2010-01-16  1:35 ` [PATCH 1/4] omap: Clean the serial port defines Tony Lindgren
  2010-01-16  1:35 ` [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic Tony Lindgren
@ 2010-01-16  1:35 ` Tony Lindgren
  2010-01-16  1:35 ` [PATCH 4/4] omap: Make get_irqnr_and_base common for mach-omap2 multiboot Tony Lindgren
  2010-01-16 20:15 ` [PATCH 0/4] omap multiboot improvments for merge window after 2.6.34 Tony Lindgren
  4 siblings, 0 replies; 38+ messages in thread
From: Tony Lindgren @ 2010-01-16  1:35 UTC (permalink / raw)
  To: linux-arm-kernel

These are no longer needed. Note that zoom boards
should now set their own function in uncompress.h
and debug-macro.S for the external UART.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/Kconfig |   19 -------------------
 1 files changed, 0 insertions(+), 19 deletions(-)

diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index e2ea04a..484d6a9 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -141,25 +141,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_NONE
-
-config OMAP_LL_DEBUG_UART1
-	bool "UART1"
-
-config OMAP_LL_DEBUG_UART2
-	bool "UART2"
-
-config OMAP_LL_DEBUG_UART3
-	bool "UART3"
-
-config OMAP_LL_DEBUG_NONE
-	bool "None"
-
-endchoice
-
 config OMAP_SERIAL_WAKE
 	bool "Enable wake-up events for serial ports"
 	depends on ARCH_OMAP1 && OMAP_MUX

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 4/4] omap: Make get_irqnr_and_base common for mach-omap2 multiboot
  2010-01-16  1:35 [PATCH 0/4] omap multiboot improvments for merge window after 2.6.34 Tony Lindgren
                   ` (2 preceding siblings ...)
  2010-01-16  1:35 ` [PATCH 3/4] omap: Remove old DEBUG_LL serial port options Tony Lindgren
@ 2010-01-16  1:35 ` Tony Lindgren
  2010-01-16 11:24   ` Shilimkar, Santosh
  2010-01-16 11:55   ` Russell King - ARM Linux
  2010-01-16 20:15 ` [PATCH 0/4] omap multiboot improvments for merge window after 2.6.34 Tony Lindgren
  4 siblings, 2 replies; 38+ messages in thread
From: Tony Lindgren @ 2010-01-16  1:35 UTC (permalink / raw)
  To: linux-arm-kernel

Make get_irqnr_and_base common for mach-omap2 multiboot

Note that this will only work currently for 24xx and 34xx.

The overhead of this should be minimal, it basically adds one
cmp to see if omap_irq_base has been configured already.
If necessary, we can set separate optimized get_irqnr_and_base
for non-multiboot configurations.

Support for 44xx can be added later on for basic multiboot,
and similar patch should be done for mach-omap1/entry-macro.S.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/include/mach/entry-macro.S |   55 ++++++++++++++++--------
 1 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-omap2/include/mach/entry-macro.S b/arch/arm/mach-omap2/include/mach/entry-macro.S
index c7f1720..3f75a09 100644
--- a/arch/arm/mach-omap2/include/mach/entry-macro.S
+++ b/arch/arm/mach-omap2/include/mach/entry-macro.S
@@ -17,18 +17,7 @@
 
 #include <plat/omap24xx.h>
 #include <plat/omap34xx.h>
-
-/* REVISIT: This should be set dynamically if CONFIG_MULTI_OMAP2 is selected */
-#if defined(CONFIG_ARCH_OMAP2420) || defined(CONFIG_ARCH_OMAP2430)
-#define OMAP2_VA_IC_BASE		OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE)
-#elif defined(CONFIG_ARCH_OMAP34XX)
-#define OMAP2_VA_IC_BASE		OMAP2_L4_IO_ADDRESS(OMAP34XX_IC_BASE)
-#endif
-#if defined(CONFIG_ARCH_OMAP4)
 #include <plat/omap44xx.h>
-#endif
-#define INTCPS_SIR_IRQ_OFFSET	0x0040		/* Active interrupt offset */
-#define	ACTIVEIRQ_MASK		0x7f		/* Active interrupt bits */
 
 		.macro	disable_fiq
 		.endm
@@ -39,23 +28,53 @@
 		.macro  arch_ret_to_user, tmp1, tmp2
 		.endm
 
-#ifndef CONFIG_ARCH_OMAP4
+#if defined(CONFIG_ARCH_OMAP2420) || defined(CONFIG_ARCH_OMAP2430) || \
+	defined(CONFIG_ARCH_OMAP34XX)
+
+#define INTCPS_SIR_IRQ_OFFSET	0x0040		/* Active interrupt offset */
+#define	ACTIVEIRQ_MASK		0x7f		/* Active interrupt bits */
+
+omap_irq_base:	.word	0x0
+
 		.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
-		ldr	\base, =OMAP2_VA_IC_BASE
-		ldr	\irqnr, [\base, #0x98] /* IRQ pending reg 1 */
+		ldr	\base, omap_irq_base
+		cmp	\base, #0		@ is irq base configured?
+		bne	9998f			@ already configured
+
+		/* Check the processor type */
+		mrc	p15, 0, \tmp, c0, c0, 0	@ get processor revision
+		and	\tmp, \tmp, #0x000f0000	@ only check architecture
+		cmp	\tmp, #0x00060000	@ is v6?
+		beq	2400f			@ found v6 so it's omap24xx
+		cmp	\tmp, #0x000f0000	@ is cortex?
+		beq	3400f			@ found v7 so it's omap34xx
+
+2400:		ldr	\base, =OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE)
+		str	\base, omap_irq_base
+		b	9998f
+
+3400:		ldr	\base, =OMAP2_L4_IO_ADDRESS(OMAP34XX_IC_BASE)
+		str	\base, omap_irq_base
+
+		/* Check the pending interrupts */
+9998:		ldr	\irqnr, [\base, #0x98] /* IRQ pending reg 1 */
 		cmp	\irqnr, #0x0
-		bne	2222f
+		bne	9999f
 		ldr	\irqnr, [\base, #0xb8] /* IRQ pending reg 2 */
 		cmp	\irqnr, #0x0
-		bne	2222f
+		bne	9999f
 		ldr	\irqnr, [\base, #0xd8] /* IRQ pending reg 3 */
 		cmp	\irqnr, #0x0
-2222:
+9999:
 		ldrne	\irqnr, [\base, #INTCPS_SIR_IRQ_OFFSET]
 		and	\irqnr, \irqnr, #ACTIVEIRQ_MASK /* Clear spurious bits */
 
 		.endm
-#else
+#endif
+
+
+#ifdef CONFIG_ARCH_OMAP4
+
 #define OMAP44XX_VA_GIC_CPU_BASE	OMAP2_L4_IO_ADDRESS(OMAP44XX_GIC_CPU_BASE)
 
 		/*

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 1/4] omap: Clean the serial port defines
  2010-01-16  1:35 ` [PATCH 1/4] omap: Clean the serial port defines Tony Lindgren
@ 2010-01-16  7:48   ` Shilimkar, Santosh
  2010-01-16 19:25     ` Tony Lindgren
  2010-01-19  0:39   ` Pandita, Vikram
  1 sibling, 1 reply; 38+ messages in thread
From: Shilimkar, Santosh @ 2010-01-16  7:48 UTC (permalink / raw)
  To: linux-arm-kernel

Thanks for the nice cleanup.
<snip>

> -----Original Message-----
> From: linux-omap-owner at vger.kernel.org 
> [mailto:linux-omap-owner at vger.kernel.org] On Behalf Of Tony Lindgren
> Sent: Saturday, January 16, 2010 7:05 AM
> To: linux-arm-kernel at lists.infradead.org
> Cc: linux-omap at vger.kernel.org
> Subject: [PATCH 1/4] omap: Clean the serial port defines
> 
> This way we don't have conflicts with the defines
> with compiling in multiple omaps. Set the addresses
> for uarts in struct omap_globals for the early serial
> init code.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/mach-omap1/include/mach/debug-macro.S |   16 +++++----
>  arch/arm/mach-omap1/serial.c                   |    6 ++-
>  arch/arm/mach-omap2/include/mach/debug-macro.S |   15 ++++----
>  arch/arm/mach-omap2/serial.c                   |   15 ++++++--
>  arch/arm/plat-omap/common.c                    |   18 ++++++++++
>  arch/arm/plat-omap/include/plat/common.h       |    5 +++
>  arch/arm/plat-omap/include/plat/serial.h       |   44 
> +++++++++++++-----------
>  7 files changed, 77 insertions(+), 42 deletions(-)
> 
> diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S 
> b/arch/arm/mach-omap1/include/mach/debug-macro.S
> index aedb746..23e4724 100644
> --- a/arch/arm/mach-omap1/include/mach/debug-macro.S
> +++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
> @@ -11,6 +11,10 @@
...

> diff --git a/arch/arm/mach-omap2/serial.c 
> b/arch/arm/mach-omap2/serial.c
> index 837b347..21e51c5 100644
> --- a/arch/arm/mach-omap2/serial.c
> +++ b/arch/arm/mach-omap2/serial.c
> @@ -74,7 +74,6 @@ static LIST_HEAD(uart_list);

...


> diff --git a/arch/arm/plat-omap/include/plat/common.h 
> b/arch/arm/plat-omap/include/plat/common.h
> index 32c2227..a8fa0d7 100644
> --- a/arch/arm/plat-omap/include/plat/common.h
> +++ b/arch/arm/plat-omap/include/plat/common.h
> @@ -47,6 +47,10 @@ struct omap_globals {
>  	void __iomem	*prm;		/* Power and Reset Management */
>  	void __iomem	*cm;		/* Clock Management */
>  	void __iomem	*cm2;
> +	unsigned long	uart1_phys;
> +	unsigned long	uart2_phys;
> +	unsigned long	uart3_phys;
> +	unsigned long	uart4_phys;
Considering they are register base address, can
these be declared as "void __iomem" instead of "unsigned long"

Regards
Santosh

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic
  2010-01-16  1:35 ` [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic Tony Lindgren
@ 2010-01-16  9:35   ` Russell King - ARM Linux
  2010-01-16 19:18     ` Tony Lindgren
  2010-01-16 11:04   ` Shilimkar, Santosh
  2010-01-19  1:26   ` Pandita, Vikram
  2 siblings, 1 reply; 38+ messages in thread
From: Russell King - ARM Linux @ 2010-01-16  9:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 15, 2010 at 05:35:15PM -0800, Tony Lindgren wrote:
> diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
> index 23e4724..0174858 100644
> --- a/arch/arm/mach-omap1/include/mach/debug-macro.S
> +++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
> @@ -15,18 +15,71 @@
>  
>  #include <plat/serial.h>
>  
> +omap_uart_phys:	.word	0x0
> +omap_uart_virt:	.word	0x0

I assume that you have no plans for XIP kernel support on OMAP, since
these will be placed in the .text section, and is therefore read-only
on XIP kernels.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic
  2010-01-16  1:35 ` [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic Tony Lindgren
  2010-01-16  9:35   ` Russell King - ARM Linux
@ 2010-01-16 11:04   ` Shilimkar, Santosh
  2010-01-16 19:20     ` Tony Lindgren
  2010-01-19  1:26   ` Pandita, Vikram
  2 siblings, 1 reply; 38+ messages in thread
From: Shilimkar, Santosh @ 2010-01-16 11:04 UTC (permalink / raw)
  To: linux-arm-kernel

<snip>
> -----Original Message-----
> From: linux-omap-owner at vger.kernel.org 
> [mailto:linux-omap-owner at vger.kernel.org] On Behalf Of Tony Lindgren
> Sent: Saturday, January 16, 2010 7:05 AM
> To: linux-arm-kernel at lists.infradead.org
> Cc: linux-omap at vger.kernel.org
> Subject: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL 
> code generic
> 
> Define arch_decomp_setup() the same way as some other
> architectures do. Use arch_id to configure the debug uart
> based on the machine_is by storing it into the uart
> scratchpad register for DEBUG_LL code to use.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/mach-omap1/include/mach/debug-macro.S |   67 +++++++++-
>  arch/arm/mach-omap1/serial.c                   |   12 ++
>  arch/arm/mach-omap2/include/mach/debug-macro.S |   76 ++++++++---
>  arch/arm/mach-omap2/serial.c                   |   11 ++
>  arch/arm/plat-omap/include/plat/serial.h       |   18 +++
>  arch/arm/plat-omap/include/plat/uncompress.h   |  168 
> +++++++++++++++++-------
>  6 files changed, 276 insertions(+), 76 deletions(-)
> 
....

>  static struct plat_serial8250_port serial_platform_data[] = {
> diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S 
> b/arch/arm/mach-omap2/include/mach/debug-macro.S
> index 0c96e1c..1b83584 100644
> --- a/arch/arm/mach-omap2/include/mach/debug-macro.S
> +++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
> @@ -15,32 +15,66 @@
>  
>  #include <plat/serial.h>
>  
> +omap_uart_phys:	.word	0x0
> +omap_uart_virt:	.word	0x0
> +
> +		/*
> +		 * Note that this code won't work if the 
> bootloader passes
> +		 * a wrong machine ID number in r1. To debug, 
> just hardcode
> +		 * the desired UART phys and virt addresses 
> temporarily into
> +		 * the omap_uart_phys and omap_uart_virt above.
> +		 */
>  		.macro	addruart,rx
> +
> +		/* Use omap_uart_phys/virt if already configured */
> +10:		mrc	p15, 0, \rx, c1, c0
> +		tst	\rx, #1			@ MMU enabled?
> +		ldreq	\rx, omap_uart_phys	@ physical base address
> +		ldrne	\rx, omap_uart_virt	@ virtual base
> +		cmp	\rx, #0			@ is port configured?
> +		bne	99f			@ already configured
> +
> +		/* Check UART1 scratchpad register for uart to use */
>  		mrc	p15, 0, \rx, c1, c0
>  		tst	\rx, #1			@ MMU enabled?
> -#ifdef  CONFIG_ARCH_OMAP2
>  		moveq	\rx, #0x48000000	@ physical base address
>  		movne	\rx, #0xfa000000	@ 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, #0xfa000000	@ 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
> -#endif
> +		orr	\rx, \rx, #0x0006a000	@ uart1 on omap2/3/4
> +		ldrb	\rx, [\rx, #(UART_SCR << 
> OMAP_PORT_SHIFT)] @ scratchpad
> +
> +		/* Select the UART to use based on the UART1 
> scratchpad value */
> +		cmp	\rx, #0			@ no port configured?
> +		beq	21f			@ if none, try 
> to use UART1
> +		cmp	\rx, #OMAP2UART1	@ OMAP2/3/4UART1
> +		beq	21f			@ configure 
> OMAP2/3/4UART1
> +		cmp	\rx, #OMAP2UART2	@ OMAP2/3/4UART2
> +		beq	22f			@ configure 
> OMAP2/3/4UART2
> +		cmp	\rx, #OMAP2UART3	@ only on 24xx
> +		beq	23f			@ configure OMAP2UART3
> +		cmp	\rx, #OMAP3UART3	@ only on 34xx
> +		beq	33f			@ configure OMAP3UART3
Can you please add add OMAP4 UART3 case as well here using 
"OMAP4UART3". 

Attached patch fixes UART3 support for OMAP4 on top of your patches. Tested 
this on OMAP4430 SDP. You can fold this patch if you like

		@ configure OMAP4UART3
> +
> +		/* Configure the UART offset from the phys/virt base */
> +21:		mov	\rx, #0x0006a000	@ OMAP2/3/4UART1
> +22:		mov	\rx, #0x0006a000
> +		add	\rx, \rx, #0x00002000	@ OMAP2/3/4UART2
> +		b	98f
> +23:		mov	\rx, #0x0006a000	@ OMAP2/3/4UART1
> +		add	\rx, \rx, #0x00004000	@ OMAP2UART3
> +		b	98f
> +33:		mov	\rx, #0x0006a000	@ OMAP2/3/4UART1
> +		add	\rx, \rx, #0x00fb0000
> +		add	\rx, \rx, #0x00006000	@ OMAP3UART3
> +
> +		/* Store both phys and virt address for the uart */
> +98:		add	\rx, \rx, #0x48000000	@ phys base
> +		str	\rx, omap_uart_phys
> +		sub	\rx, \rx, #0x48000000	@ phys base
> +		add	\rx, \rx, #0xfa000000	@ virt base
> +		str	\rx, omap_uart_virt
> +		b	10b
> +99:
>  		.endm
>  
>  		.macro	senduart,rd,rx
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Update-DEBUG_LL-for-OMAP4.patch
Type: application/octet-stream
Size: 1271 bytes
Desc: 0001-Update-DEBUG_LL-for-OMAP4.patch
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100116/d90886a2/attachment-0001.obj>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 4/4] omap: Make get_irqnr_and_base common for mach-omap2 multiboot
  2010-01-16  1:35 ` [PATCH 4/4] omap: Make get_irqnr_and_base common for mach-omap2 multiboot Tony Lindgren
@ 2010-01-16 11:24   ` Shilimkar, Santosh
  2010-01-16 11:55   ` Russell King - ARM Linux
  1 sibling, 0 replies; 38+ messages in thread
From: Shilimkar, Santosh @ 2010-01-16 11:24 UTC (permalink / raw)
  To: linux-arm-kernel

This too is nice fix for multiboot.
> -----Original Message-----
> From: linux-arm-kernel-bounces at lists.infradead.org 
> [mailto:linux-arm-kernel-bounces at lists.infradead.org] On 
> Behalf Of Tony Lindgren
> Sent: Saturday, January 16, 2010 7:05 AM
> To: linux-arm-kernel at lists.infradead.org
> Cc: linux-omap at vger.kernel.org
> Subject: [PATCH 4/4] omap: Make get_irqnr_and_base common for 
> mach-omap2 multiboot
> 
> Make get_irqnr_and_base common for mach-omap2 multiboot
> 
> Note that this will only work currently for 24xx and 34xx.
> 
> The overhead of this should be minimal, it basically adds one
> cmp to see if omap_irq_base has been configured already.
> If necessary, we can set separate optimized get_irqnr_and_base
> for non-multiboot configurations.
Well there is an overhead of two instructions for every interrupt,
so probably having two version of "get_irqnr_and_base" would be good.
> 
> Support for 44xx can be added later on for basic multiboot,
> and similar patch should be done for mach-omap1/entry-macro.S.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/mach-omap2/include/mach/entry-macro.S |   55 
> ++++++++++++++++--------
>  1 files changed, 37 insertions(+), 18 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/include/mach/entry-macro.S 
> b/arch/arm/mach-omap2/include/mach/entry-macro.S
> index c7f1720..3f75a09 100644
> --- a/arch/arm/mach-omap2/include/mach/entry-macro.S
> +++ b/arch/arm/mach-omap2/include/mach/entry-macro.S
> @@ -17,18 +17,7 @@
>  
>  #include <plat/omap24xx.h>
>  #include <plat/omap34xx.h>
> -
> -/* REVISIT: This should be set dynamically if 
> CONFIG_MULTI_OMAP2 is selected */
> -#if defined(CONFIG_ARCH_OMAP2420) || defined(CONFIG_ARCH_OMAP2430)
> -#define OMAP2_VA_IC_BASE		
> OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE)
> -#elif defined(CONFIG_ARCH_OMAP34XX)
> -#define OMAP2_VA_IC_BASE		
> OMAP2_L4_IO_ADDRESS(OMAP34XX_IC_BASE)
> -#endif
> -#if defined(CONFIG_ARCH_OMAP4)
>  #include <plat/omap44xx.h>
> -#endif
> -#define INTCPS_SIR_IRQ_OFFSET	0x0040		/* 
> Active interrupt offset */
> -#define	ACTIVEIRQ_MASK		0x7f		/* 
> Active interrupt bits */
>  
>  		.macro	disable_fiq
>  		.endm
> @@ -39,23 +28,53 @@
>  		.macro  arch_ret_to_user, tmp1, tmp2
>  		.endm
>  
> -#ifndef CONFIG_ARCH_OMAP4
> +#if defined(CONFIG_ARCH_OMAP2420) || 
> defined(CONFIG_ARCH_OMAP2430) || \
> +	defined(CONFIG_ARCH_OMAP34XX)
> +
> +#define INTCPS_SIR_IRQ_OFFSET	0x0040		/* 
> Active interrupt offset */
> +#define	ACTIVEIRQ_MASK		0x7f		/* 
> Active interrupt bits */
> +
> +omap_irq_base:	.word	0x0
> +
>  		.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
> -		ldr	\base, =OMAP2_VA_IC_BASE
> -		ldr	\irqnr, [\base, #0x98] /* IRQ pending reg 1 */
> +		ldr	\base, omap_irq_base
> +		cmp	\base, #0		@ is irq base 
> configured?
> +		bne	9998f			@ already configured
> +
> +		/* Check the processor type */
> +		mrc	p15, 0, \tmp, c0, c0, 0	@ get processor revision
> +		and	\tmp, \tmp, #0x000f0000	@ only check 
> architecture
> +		cmp	\tmp, #0x00060000	@ is v6?
> +		beq	2400f			@ found v6 so 
> it's omap24xx
> +		cmp	\tmp, #0x000f0000	@ is cortex?
> +		beq	3400f			@ found v7 so 
> it's omap34xx
> +
> +2400:		ldr	\base, 
> =OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE)
> +		str	\base, omap_irq_base
> +		b	9998f
> +
> +3400:		ldr	\base, 
> =OMAP2_L4_IO_ADDRESS(OMAP34XX_IC_BASE)
> +		str	\base, omap_irq_base
> +
> +		/* Check the pending interrupts */
> +9998:		ldr	\irqnr, [\base, #0x98] /* IRQ 
> pending reg 1 */
>  		cmp	\irqnr, #0x0
> -		bne	2222f
> +		bne	9999f
>  		ldr	\irqnr, [\base, #0xb8] /* IRQ pending reg 2 */
>  		cmp	\irqnr, #0x0
> -		bne	2222f
> +		bne	9999f
>  		ldr	\irqnr, [\base, #0xd8] /* IRQ pending reg 3 */
>  		cmp	\irqnr, #0x0
> -2222:
> +9999:
>  		ldrne	\irqnr, [\base, #INTCPS_SIR_IRQ_OFFSET]
>  		and	\irqnr, \irqnr, #ACTIVEIRQ_MASK /* 
> Clear spurious bits */
>  
>  		.endm
> -#else
> +#endif
> +
> +
> +#ifdef CONFIG_ARCH_OMAP4
> +
>  #define OMAP44XX_VA_GIC_CPU_BASE	
> OMAP2_L4_IO_ADDRESS(OMAP44XX_GIC_CPU_BASE)
>  
>  		/*
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 4/4] omap: Make get_irqnr_and_base common for mach-omap2 multiboot
  2010-01-16  1:35 ` [PATCH 4/4] omap: Make get_irqnr_and_base common for mach-omap2 multiboot Tony Lindgren
  2010-01-16 11:24   ` Shilimkar, Santosh
@ 2010-01-16 11:55   ` Russell King - ARM Linux
  2010-01-16 19:12     ` Tony Lindgren
  2010-01-22 20:39     ` [PATCH 4/4] omap: Make get_irqnr_and_base common for mach-omap2 multiboot, v2 Tony Lindgren
  1 sibling, 2 replies; 38+ messages in thread
From: Russell King - ARM Linux @ 2010-01-16 11:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 15, 2010 at 05:35:20PM -0800, Tony Lindgren wrote:
> -#ifndef CONFIG_ARCH_OMAP4
> +#if defined(CONFIG_ARCH_OMAP2420) || defined(CONFIG_ARCH_OMAP2430) || \
> +	defined(CONFIG_ARCH_OMAP34XX)
> +
> +#define INTCPS_SIR_IRQ_OFFSET	0x0040		/* Active interrupt offset */
> +#define	ACTIVEIRQ_MASK		0x7f		/* Active interrupt bits */
> +
> +omap_irq_base:	.word	0x0

You have no idea where this word will be placed - it could be in the middle
of a read only section, which might really be read only.  It might also be
out of reach of the "ldr \base, [pc, #offset]" instructions you're using
below - which is what an "ldr \base, address" instruction really is.

> +
>  		.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
> -		ldr	\base, =OMAP2_VA_IC_BASE
> -		ldr	\irqnr, [\base, #0x98] /* IRQ pending reg 1 */
> +		ldr	\base, omap_irq_base
> +		cmp	\base, #0		@ is irq base configured?
> +		bne	9998f			@ already configured

First thing, why not use get_irqnr_preamble to load the base address?
That means you only do all this computation once per group of IRQs
processed.

Secondly, is this really worth the overhead, or can't you move
omap_irq_base into the data section, and have your IRQ initialization
function set the pointer?

You then don't have to make these two tests every time you check for
an interrupt/enter to process interrupts.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 4/4] omap: Make get_irqnr_and_base common for mach-omap2 multiboot
  2010-01-16 11:55   ` Russell King - ARM Linux
@ 2010-01-16 19:12     ` Tony Lindgren
  2010-01-22 20:39     ` [PATCH 4/4] omap: Make get_irqnr_and_base common for mach-omap2 multiboot, v2 Tony Lindgren
  1 sibling, 0 replies; 38+ messages in thread
From: Tony Lindgren @ 2010-01-16 19:12 UTC (permalink / raw)
  To: linux-arm-kernel

* Russell King - ARM Linux <linux@arm.linux.org.uk> [100116 03:53]:
> On Fri, Jan 15, 2010 at 05:35:20PM -0800, Tony Lindgren wrote:
> > -#ifndef CONFIG_ARCH_OMAP4
> > +#if defined(CONFIG_ARCH_OMAP2420) || defined(CONFIG_ARCH_OMAP2430) || \
> > +	defined(CONFIG_ARCH_OMAP34XX)
> > +
> > +#define INTCPS_SIR_IRQ_OFFSET	0x0040		/* Active interrupt offset */
> > +#define	ACTIVEIRQ_MASK		0x7f		/* Active interrupt bits */
> > +
> > +omap_irq_base:	.word	0x0
> 
> You have no idea where this word will be placed - it could be in the middle
> of a read only section, which might really be read only.  It might also be
> out of reach of the "ldr \base, [pc, #offset]" instructions you're using
> below - which is what an "ldr \base, address" instruction really is.

OK
 
> > +
> >  		.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
> > -		ldr	\base, =OMAP2_VA_IC_BASE
> > -		ldr	\irqnr, [\base, #0x98] /* IRQ pending reg 1 */
> > +		ldr	\base, omap_irq_base
> > +		cmp	\base, #0		@ is irq base configured?
> > +		bne	9998f			@ already configured
> 
> First thing, why not use get_irqnr_preamble to load the base address?
> That means you only do all this computation once per group of IRQs
> processed.

Thanks for the tip, will do.
 
> Secondly, is this really worth the overhead, or can't you move
> omap_irq_base into the data section, and have your IRQ initialization
> function set the pointer?

Sounds like a good plan. We can have optimized versions for non-multiomap
configurations.
 
> You then don't have to make these two tests every time you check for
> an interrupt/enter to process interrupts.

Great, that will make things much nicer.

Tony

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic
  2010-01-16  9:35   ` Russell King - ARM Linux
@ 2010-01-16 19:18     ` Tony Lindgren
  2010-01-16 19:33       ` Russell King - ARM Linux
  0 siblings, 1 reply; 38+ messages in thread
From: Tony Lindgren @ 2010-01-16 19:18 UTC (permalink / raw)
  To: linux-arm-kernel

* Russell King - ARM Linux <linux@arm.linux.org.uk> [100116 01:33]:
> On Fri, Jan 15, 2010 at 05:35:15PM -0800, Tony Lindgren wrote:
> > diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
> > index 23e4724..0174858 100644
> > --- a/arch/arm/mach-omap1/include/mach/debug-macro.S
> > +++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
> > @@ -15,18 +15,71 @@
> >  
> >  #include <plat/serial.h>
> >  
> > +omap_uart_phys:	.word	0x0
> > +omap_uart_virt:	.word	0x0
> 
> I assume that you have no plans for XIP kernel support on OMAP, since
> these will be placed in the .text section, and is therefore read-only
> on XIP kernels.

Did not think of that.. Maybe some addruart_premable solution here would.
Or adding \tmp register for addruart and just do the detection for each
character.

Regards,

Tony

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic
  2010-01-16 11:04   ` Shilimkar, Santosh
@ 2010-01-16 19:20     ` Tony Lindgren
  2010-01-16 19:34       ` Shilimkar, Santosh
  0 siblings, 1 reply; 38+ messages in thread
From: Tony Lindgren @ 2010-01-16 19:20 UTC (permalink / raw)
  To: linux-arm-kernel

* Shilimkar, Santosh <santosh.shilimkar@ti.com> [100116 03:02]:

<snip>

> Can you please add add OMAP4 UART3 case as well here using 
> "OMAP4UART3". 

Sure.
 
> Attached patch fixes UART3 support for OMAP4 on top of your patches. Tested 
> this on OMAP4430 SDP. You can fold this patch if you like

Thanks will test. And thanks for testing. Note that once the
issues Russell pointed out are solved, we should also easily
be able to support the external uart on Zoom boards for
DEBUG_LL.

Regards,

Tony

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 1/4] omap: Clean the serial port defines
  2010-01-16  7:48   ` Shilimkar, Santosh
@ 2010-01-16 19:25     ` Tony Lindgren
  2010-01-16 19:33       ` Shilimkar, Santosh
  0 siblings, 1 reply; 38+ messages in thread
From: Tony Lindgren @ 2010-01-16 19:25 UTC (permalink / raw)
  To: linux-arm-kernel

* Shilimkar, Santosh <santosh.shilimkar@ti.com> [100115 23:46]:
> Thanks for the nice cleanup.

Thanks for testing :)

> <snip>
> > --- a/arch/arm/plat-omap/include/plat/common.h
> > +++ b/arch/arm/plat-omap/include/plat/common.h
> > @@ -47,6 +47,10 @@ struct omap_globals {
> >  	void __iomem	*prm;		/* Power and Reset Management */
> >  	void __iomem	*cm;		/* Clock Management */
> >  	void __iomem	*cm2;
> > +	unsigned long	uart1_phys;
> > +	unsigned long	uart2_phys;
> > +	unsigned long	uart3_phys;
> > +	unsigned long	uart4_phys;
> Considering they are register base address, can
> these be declared as "void __iomem" instead of "unsigned long"

These are physical addresses instead of virtual addresses.
They get ioremapped in mach-omap[12]/serial.c. So they should
not be void __iomem * in omap_globals.

BTW, we should eventually change everything in omap_globals
to be physical addresses.

Regards,

Tony

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic
  2010-01-16 19:18     ` Tony Lindgren
@ 2010-01-16 19:33       ` Russell King - ARM Linux
  2010-01-16 20:00         ` Tony Lindgren
  2010-01-21 19:03         ` [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic Tony Lindgren
  0 siblings, 2 replies; 38+ messages in thread
From: Russell King - ARM Linux @ 2010-01-16 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Jan 16, 2010 at 11:18:20AM -0800, Tony Lindgren wrote:
> * Russell King - ARM Linux <linux@arm.linux.org.uk> [100116 01:33]:
> > On Fri, Jan 15, 2010 at 05:35:15PM -0800, Tony Lindgren wrote:
> > > diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
> > > index 23e4724..0174858 100644
> > > --- a/arch/arm/mach-omap1/include/mach/debug-macro.S
> > > +++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
> > > @@ -15,18 +15,71 @@
> > >  
> > >  #include <plat/serial.h>
> > >  
> > > +omap_uart_phys:	.word	0x0
> > > +omap_uart_virt:	.word	0x0
> > 
> > I assume that you have no plans for XIP kernel support on OMAP, since
> > these will be placed in the .text section, and is therefore read-only
> > on XIP kernels.
> 
> Did not think of that.. Maybe some addruart_premable solution here would.
> Or adding \tmp register for addruart and just do the detection for each
> character.

How does doing it per-character help?  The code is:

ENTRY(printascii)
                addruart r3
                b       2f
1:              waituart r2, r3
                senduart r1, r3
                busyuart r2, r3
                teq     r1, #'\n'
                moveq   r1, #'\r'
                beq     1b
2:              teq     r0, #0
                ldrneb  r1, [r0], #1
                teqne   r1, #0
                bne     1b
                mov     pc, lr

Your wait/send/busy macros are just using the already provided base
address which comes via r3 from addruart.  That much is fine.

I'm at a loss to understand why you think moving the address-getting
functionality out of addruart into the individual wait/send/busy
macros is going to help in any way.

Why not do something like this:

		.pushsection .data
omap_uart_phys:	.word 0
omap_uart_virt:	.word 0
		.popsection

		.macro addruart, rx
...		
+               ldreq   \rx, =omap_uart_phys    @ physical base address
+               ldrne   \rx, =omap_uart_virt    @ virtual base
		ldr	\rx, [\rx]
+               cmp     \rx, #0                 @ is port configured?
+               bne     99f                     @ already configured
...

?

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 1/4] omap: Clean the serial port defines
  2010-01-16 19:25     ` Tony Lindgren
@ 2010-01-16 19:33       ` Shilimkar, Santosh
  2010-01-16 20:03         ` Tony Lindgren
  0 siblings, 1 reply; 38+ messages in thread
From: Shilimkar, Santosh @ 2010-01-16 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

> -----Original Message-----
> From: Tony Lindgren [mailto:tony at atomide.com] 
> Sent: Sunday, January 17, 2010 12:56 AM
> To: Shilimkar, Santosh
> Cc: linux-arm-kernel at lists.infradead.org; linux-omap at vger.kernel.org
> Subject: Re: [PATCH 1/4] omap: Clean the serial port defines
> 
> * Shilimkar, Santosh <santosh.shilimkar@ti.com> [100115 23:46]:
> > Thanks for the nice cleanup.
> 
> Thanks for testing :)
> 
> > <snip>
> > > --- a/arch/arm/plat-omap/include/plat/common.h
> > > +++ b/arch/arm/plat-omap/include/plat/common.h
> > > @@ -47,6 +47,10 @@ struct omap_globals {
> > >  	void __iomem	*prm;		/* Power and Reset Management */
> > >  	void __iomem	*cm;		/* Clock Management */
> > >  	void __iomem	*cm2;
> > > +	unsigned long	uart1_phys;
> > > +	unsigned long	uart2_phys;
> > > +	unsigned long	uart3_phys;
> > > +	unsigned long	uart4_phys;
> > Considering they are register base address, can
> > these be declared as "void __iomem" instead of "unsigned long"
> 
> These are physical addresses instead of virtual addresses.
> They get ioremapped in mach-omap[12]/serial.c. So they should
> not be void __iomem * in omap_globals.
Yep. I see your point.  
> BTW, we should eventually change everything in omap_globals
> to be physical addresses.
We did some work for OMAP4 to move most of the things to ioremap
istead of those hardcoded macros. 
Let me know when you want to do this clean up. We can do this together.

Regards
Santosh

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic
  2010-01-16 19:20     ` Tony Lindgren
@ 2010-01-16 19:34       ` Shilimkar, Santosh
  0 siblings, 0 replies; 38+ messages in thread
From: Shilimkar, Santosh @ 2010-01-16 19:34 UTC (permalink / raw)
  To: linux-arm-kernel

> -----Original Message-----
> From: Tony Lindgren [mailto:tony at atomide.com] 
> Sent: Sunday, January 17, 2010 12:51 AM
> To: Shilimkar, Santosh
> Cc: linux-arm-kernel at lists.infradead.org; linux-omap at vger.kernel.org
> Subject: Re: [PATCH 2/4] omap: Make uncompress code and 
> DEBUG_LL code generic
> 
> * Shilimkar, Santosh <santosh.shilimkar@ti.com> [100116 03:02]:
> 
> <snip>
> 
> > Can you please add add OMAP4 UART3 case as well here using 
> > "OMAP4UART3". 
> 
> Sure.
>  
> > Attached patch fixes UART3 support for OMAP4 on top of your 
> patches. Tested 
> > this on OMAP4430 SDP. You can fold this patch if you like
> 
> Thanks will test. And thanks for testing. Note that once the
> issues Russell pointed out are solved, we should also easily
> be able to support the external uart on Zoom boards for
> DEBUG_LL.
Cool. 

Regards
Santosh

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic
  2010-01-16 19:33       ` Russell King - ARM Linux
@ 2010-01-16 20:00         ` Tony Lindgren
  2010-01-19  1:50           ` Pandita, Vikram
  2010-01-21 19:03         ` [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic Tony Lindgren
  1 sibling, 1 reply; 38+ messages in thread
From: Tony Lindgren @ 2010-01-16 20:00 UTC (permalink / raw)
  To: linux-arm-kernel

* Russell King - ARM Linux <linux@arm.linux.org.uk> [100116 11:31]:
> On Sat, Jan 16, 2010 at 11:18:20AM -0800, Tony Lindgren wrote:
> > * Russell King - ARM Linux <linux@arm.linux.org.uk> [100116 01:33]:
> > > On Fri, Jan 15, 2010 at 05:35:15PM -0800, Tony Lindgren wrote:
> > > > diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
> > > > index 23e4724..0174858 100644
> > > > --- a/arch/arm/mach-omap1/include/mach/debug-macro.S
> > > > +++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
> > > > @@ -15,18 +15,71 @@
> > > >  
> > > >  #include <plat/serial.h>
> > > >  
> > > > +omap_uart_phys:	.word	0x0
> > > > +omap_uart_virt:	.word	0x0
> > > 
> > > I assume that you have no plans for XIP kernel support on OMAP, since
> > > these will be placed in the .text section, and is therefore read-only
> > > on XIP kernels.
> > 
> > Did not think of that.. Maybe some addruart_premable solution here would.
> > Or adding \tmp register for addruart and just do the detection for each
> > character.
> 
> How does doing it per-character help?  The code is:
> 
> ENTRY(printascii)
>                 addruart r3
>                 b       2f
> 1:              waituart r2, r3
>                 senduart r1, r3
>                 busyuart r2, r3
>                 teq     r1, #'\n'
>                 moveq   r1, #'\r'
>                 beq     1b
> 2:              teq     r0, #0
>                 ldrneb  r1, [r0], #1
>                 teqne   r1, #0
>                 bne     1b
>                 mov     pc, lr
> 
> Your wait/send/busy macros are just using the already provided base
> address which comes via r3 from addruart.  That much is fine.
> 
> I'm at a loss to understand why you think moving the address-getting
> functionality out of addruart into the individual wait/send/busy
> macros is going to help in any way.

Sorry, I meant doing the detection each time addruart is run, not
for each character.
 
> Why not do something like this:
> 
> 		.pushsection .data
> omap_uart_phys:	.word 0
> omap_uart_virt:	.word 0
> 		.popsection
> 
> 		.macro addruart, rx
> ...		
> +               ldreq   \rx, =omap_uart_phys    @ physical base address
> +               ldrne   \rx, =omap_uart_virt    @ virtual base
> 		ldr	\rx, [\rx]
> +               cmp     \rx, #0                 @ is port configured?
> +               bne     99f                     @ already configured
> ...
> 
> ?

Sounds good to me. Will play with them and post refreshed patches.

Regards,

Tony

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 1/4] omap: Clean the serial port defines
  2010-01-16 19:33       ` Shilimkar, Santosh
@ 2010-01-16 20:03         ` Tony Lindgren
  0 siblings, 0 replies; 38+ messages in thread
From: Tony Lindgren @ 2010-01-16 20:03 UTC (permalink / raw)
  To: linux-arm-kernel

* Shilimkar, Santosh <santosh.shilimkar@ti.com> [100116 11:31]:
> > -----Original Message-----
> > From: Tony Lindgren [mailto:tony at atomide.com] 
> > Sent: Sunday, January 17, 2010 12:56 AM
> > To: Shilimkar, Santosh
> > Cc: linux-arm-kernel at lists.infradead.org; linux-omap at vger.kernel.org
> > Subject: Re: [PATCH 1/4] omap: Clean the serial port defines
> > 
> > * Shilimkar, Santosh <santosh.shilimkar@ti.com> [100115 23:46]:
> > > Thanks for the nice cleanup.
> > 
> > Thanks for testing :)
> > 
> > > <snip>
> > > > --- a/arch/arm/plat-omap/include/plat/common.h
> > > > +++ b/arch/arm/plat-omap/include/plat/common.h
> > > > @@ -47,6 +47,10 @@ struct omap_globals {
> > > >  	void __iomem	*prm;		/* Power and Reset Management */
> > > >  	void __iomem	*cm;		/* Clock Management */
> > > >  	void __iomem	*cm2;
> > > > +	unsigned long	uart1_phys;
> > > > +	unsigned long	uart2_phys;
> > > > +	unsigned long	uart3_phys;
> > > > +	unsigned long	uart4_phys;
> > > Considering they are register base address, can
> > > these be declared as "void __iomem" instead of "unsigned long"
> > 
> > These are physical addresses instead of virtual addresses.
> > They get ioremapped in mach-omap[12]/serial.c. So they should
> > not be void __iomem * in omap_globals.
> Yep. I see your point.  
> > BTW, we should eventually change everything in omap_globals
> > to be physical addresses.
> We did some work for OMAP4 to move most of the things to ioremap
> istead of those hardcoded macros. 
> Let me know when you want to do this clean up. We can do this together.

Great, let's try get some more of that ready for the upcoming
merge window.

Regards,

Tony

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 0/4] omap multiboot improvments for merge window after 2.6.34
  2010-01-16  1:35 [PATCH 0/4] omap multiboot improvments for merge window after 2.6.34 Tony Lindgren
                   ` (3 preceding siblings ...)
  2010-01-16  1:35 ` [PATCH 4/4] omap: Make get_irqnr_and_base common for mach-omap2 multiboot Tony Lindgren
@ 2010-01-16 20:15 ` Tony Lindgren
  4 siblings, 0 replies; 38+ messages in thread
From: Tony Lindgren @ 2010-01-16 20:15 UTC (permalink / raw)
  To: linux-arm-kernel

* Tony Lindgren <tony@atomide.com> [100115 17:32]:
> Hi all,
> 
> Here are some multiboot improvments for review. These patches
> are intended for the 2.6.34 merge window.
> 
> Comments and testing would be nice, I've tested them so far
> on osk, 770, n800, rx51 and overo.

Attached is also an experimental patch to compile in 2420 and 34xx
and the .config I used.

It still fails early during the boot in dmtimer_init, so it's
just for reference in case anybody wants to play with it.

Note that we still have a problem compiling in 2420 and 2430
because of the different clock bases.

Cheers,

Tony

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 1/4] omap: Clean the serial port defines
  2010-01-16  1:35 ` [PATCH 1/4] omap: Clean the serial port defines Tony Lindgren
  2010-01-16  7:48   ` Shilimkar, Santosh
@ 2010-01-19  0:39   ` Pandita, Vikram
  2010-01-20 23:10     ` Tony Lindgren
  1 sibling, 1 reply; 38+ messages in thread
From: Pandita, Vikram @ 2010-01-19  0:39 UTC (permalink / raw)
  To: linux-arm-kernel



>-----Original Message-----
From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner at vger.kernel.org] On Behalf Of Tony
>Lindgren
>Sent: Friday, January 15, 2010 7:35 PM
>To: linux-arm-kernel at lists.infradead.org
>Cc: linux-omap at vger.kernel.org
>Subject: [PATCH 1/4] omap: Clean the serial port defines
>
>This way we don't have conflicts with the defines
>with compiling in multiple omaps. Set the addresses
>for uarts in struct omap_globals for the early serial
>init code.

Nice and much needed cleanup. 

>
>Signed-off-by: Tony Lindgren <tony@atomide.com>
<snip>
>diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
>index 6e5207c..349de90 100644
>--- a/arch/arm/mach-omap1/serial.c
>+++ b/arch/arm/mach-omap1/serial.c
>@@ -64,7 +64,7 @@ static void __init omap_serial_reset(struct plat_serial8250_port *p)
>
> static struct plat_serial8250_port serial_platform_data[] = {
> 	{
>-		.mapbase	= OMAP_UART1_BASE,
>+		.mapbase	= OMAP1_UART1_BASE,

Is it possible to use the same approach as mach-omap2/ for physical address assignments?
I like that approach.
Refer this part from mach-omap2:
	+	serial_platform_data0[0].mapbase = omap2_globals->uart1_phys;
	+	serial_platform_data1[0].mapbase = omap2_globals->uart2_phys;
	+	serial_platform_data2[0].mapbase = omap2_globals->uart3_phys;	

> 		.irq		= INT_UART1,
> 		.flags		= UPF_BOOT_AUTOCONF,
> 		.iotype		= UPIO_MEM,
<snip>
>diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-
>macro.S
>index e9f255d..0c96e1c 100644
>--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
>+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
>@@ -11,6 +11,10 @@
>  *
> */
>
>+#include <linux/serial_reg.h>
>+
>+#include <plat/serial.h>
>+
> 		.macro	addruart,rx
> 		mrc	p15, 0, \rx, c1, c0
> 		tst	\rx, #1			@ MMU enabled?
>@@ -44,15 +48,10 @@
> 		.endm
>
> 		.macro	busyuart,rd,rx
>-1001:		ldrb	\rd, [\rx, #(0x5 << 2)]	@ OMAP-1510 and friends
>-		and	\rd, \rd, #0x60
>-		teq	\rd, #0x60
>-		beq	1002f
>-		ldrb	\rd, [\rx, #(0x5 << 0)]	@ OMAP-730 only
>-		and	\rd, \rd, #0x60
>-		teq	\rd, #0x60
>+1001:		ldrb	\rd, [\rx, #(UART_LSR << OMAP_PORT_SHIFT)]

Zoom2/3 kind of boards have external debug Serial port.
For those boards and maybe others, the shift value is 1 and not OMAP_PORT_SHIFT(2).

This solution is not extensible to zoom2/3 boards with external debug board uarts.
How do we address that? 


>+		and	\rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
>+		teq	\rd, #(UART_LSR_TEMT | UART_LSR_THRE)
> 		bne	1001b
>-1002:
> 		.endm
>
> 		.macro	waituart,rd,rx
<snip>
>diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
<snip>
>@@ -269,11 +278,15 @@ static struct omap_globals omap343x_globals = {
> 	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
> 	.prm	= OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
> 	.cm	= OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
>+	.uart1_phys	= OMAP3_UART1_BASE,
>+	.uart2_phys	= OMAP3_UART2_BASE,
>+	.uart3_phys	= OMAP3_UART3_BASE,

OMAP3630 also has 4 UARTS and this same global is getting used for both 34xx and 36xx.
This is not right.

For 3630 uart4_phys = 0x49042000

> };
>
> void __init omap2_set_globals_343x(void)
> {
> 	__omap2_set_globals(&omap343x_globals);
>+	omap2_set_globals_uart(&omap343x_globals);
> }
> #endif
>
>@@ -285,6 +298,10 @@ static struct omap_globals omap4_globals = {
> 	.prm	= OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
> 	.cm	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
> 	.cm2	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
>+	.uart1_phys	= OMAP4_UART1_BASE,
>+	.uart2_phys	= OMAP4_UART2_BASE,
>+	.uart3_phys	= OMAP4_UART3_BASE,
>+	.uart4_phys	= OMAP4_UART4_BASE,
> };
>
> void __init omap2_set_globals_443x(void)
>@@ -292,6 +309,7 @@ void __init omap2_set_globals_443x(void)
> 	omap2_set_globals_tap(&omap4_globals);
> 	omap2_set_globals_control(&omap4_globals);
> 	omap2_set_globals_prcm(&omap4_globals);
>+	omap2_set_globals_uart(&omap4_globals);
> }
> #endif
>
>diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
>index 32c2227..a8fa0d7 100644
>--- a/arch/arm/plat-omap/include/plat/common.h
>+++ b/arch/arm/plat-omap/include/plat/common.h
>@@ -47,6 +47,10 @@ struct omap_globals {
> 	void __iomem	*prm;		/* Power and Reset Management */
> 	void __iomem	*cm;		/* Clock Management */
> 	void __iomem	*cm2;
>+	unsigned long	uart1_phys;
>+	unsigned long	uart2_phys;
>+	unsigned long	uart3_phys;
>+	unsigned long	uart4_phys;
> };
>
> void omap2_set_globals_242x(void);
>@@ -59,6 +63,7 @@ void omap2_set_globals_tap(struct omap_globals *);
> void omap2_set_globals_sdrc(struct omap_globals *);
> void omap2_set_globals_control(struct omap_globals *);
> void omap2_set_globals_prcm(struct omap_globals *);
>+void omap2_set_globals_uart(struct omap_globals *);
>
> /**
>  * omap_test_timeout - busy-loop, testing a condition
>diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h
>index f5a4a92..c7e2b85 100644
>--- a/arch/arm/plat-omap/include/plat/serial.h
>+++ b/arch/arm/plat-omap/include/plat/serial.h
>@@ -15,37 +15,39 @@
>
> #include <linux/init.h>
>
>-#if defined(CONFIG_ARCH_OMAP1)
> /* OMAP1 serial ports */
>-#define OMAP_UART1_BASE		0xfffb0000
>-#define OMAP_UART2_BASE		0xfffb0800
>-#define OMAP_UART3_BASE		0xfffb9800
>-#elif defined(CONFIG_ARCH_OMAP2)
>+#define OMAP1_UART1_BASE	0xfffb0000
>+#define OMAP1_UART2_BASE	0xfffb0800
>+#define OMAP1_UART3_BASE	0xfffb9800
>+
> /* OMAP2 serial ports */
>-#define OMAP_UART1_BASE		0x4806a000
>-#define OMAP_UART2_BASE		0x4806c000
>-#define OMAP_UART3_BASE		0x4806e000
>-#elif defined(CONFIG_ARCH_OMAP3)
>+#define OMAP2_UART1_BASE	0x4806a000
>+#define OMAP2_UART2_BASE	0x4806c000
>+#define OMAP2_UART3_BASE	0x4806e000
>+
> /* OMAP3 serial ports */
>-#define OMAP_UART1_BASE		0x4806a000
>-#define OMAP_UART2_BASE		0x4806c000
>-#define OMAP_UART3_BASE		0x49020000

Need to add 0x4904 2000 for 3630 UART4

>-#elif defined(CONFIG_ARCH_OMAP4)
>+#define OMAP3_UART1_BASE	0x4806a000
>+#define OMAP3_UART2_BASE	0x4806c000
>+#define OMAP3_UART3_BASE	0x49020000
>+
> /* OMAP4 serial ports */
>-#define OMAP_UART1_BASE		0x4806a000
>-#define OMAP_UART2_BASE		0x4806c000
>-#define OMAP_UART3_BASE		0x48020000
>-#define OMAP_UART4_BASE		0x4806e000
>-#endif
>+#define OMAP4_UART1_BASE	0x4806a000
>+#define OMAP4_UART2_BASE	0x4806c000
>+#define OMAP4_UART3_BASE	0x48020000
>+#define OMAP4_UART4_BASE	0x4806e000
>+
>+#define OMAP_PORT_SHIFT		2
>+#define OMAP7XX_PORT_SHIFT	0
>
> #define OMAP1510_BASE_BAUD	(12000000/16)
> #define OMAP16XX_BASE_BAUD	(48000000/16)
> #define OMAP24XX_BASE_BAUD	(48000000/16)
>
>+/* This is only used by 8250.c for omap1510 */
> #define is_omap_port(pt)	({int __ret = 0;			\
>-			if ((pt)->port.mapbase == OMAP_UART1_BASE ||	\
>-			    (pt)->port.mapbase == OMAP_UART2_BASE ||	\
>-			    (pt)->port.mapbase == OMAP_UART3_BASE)	\
>+			if ((pt)->port.mapbase == OMAP1_UART1_BASE ||	\
>+			    (pt)->port.mapbase == OMAP1_UART2_BASE ||	\
>+			    (pt)->port.mapbase == OMAP1_UART3_BASE)	\
> 				__ret = 1;				\
> 			__ret;						\
> 			})
>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>the body of a message to majordomo at vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic
  2010-01-16  1:35 ` [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic Tony Lindgren
  2010-01-16  9:35   ` Russell King - ARM Linux
  2010-01-16 11:04   ` Shilimkar, Santosh
@ 2010-01-19  1:26   ` Pandita, Vikram
  2010-01-19 17:19     ` Kevin Hilman
  2010-01-26 17:22     ` Tony Lindgren
  2 siblings, 2 replies; 38+ messages in thread
From: Pandita, Vikram @ 2010-01-19  1:26 UTC (permalink / raw)
  To: linux-arm-kernel



>-----Original Message-----
From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner at vger.kernel.org] On Behalf Of Tony
>Lindgren
>Sent: Friday, January 15, 2010 7:35 PM
>To: linux-arm-kernel at lists.infradead.org
>Cc: linux-omap at vger.kernel.org
>Subject: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic

UART_SCR 		-> this is the scratchpad register 
UART_OMAP_SCR	-> This is TI-only Supplementary control register

You probably confused the two (as rightly so since SCR is same name).
So there is no need to save/restore the UART_SCR register as you have done, see inlined -- 

>
>Define arch_decomp_setup() the same way as some other
>architectures do. Use arch_id to configure the debug uart
>based on the machine_is by storing it into the uart
>scratchpad register for DEBUG_LL code to use.
>
>Signed-off-by: Tony Lindgren <tony@atomide.com>
<snip>
>--- a/arch/arm/mach-omap2/serial.c
>+++ b/arch/arm/mach-omap2/serial.c
>@@ -161,11 +161,22 @@ static inline void serial_write_reg(struct plat_serial8250_port *p, int offset,
> static inline void __init omap_uart_reset(struct omap_uart_state *uart)
> {
> 	struct plat_serial8250_port *p = uart->p;
>+	u8 scratchpad = 0;
>+
>+	/*
>+	 * Save UART1 scratchpad register value for UART1 for DEBUG_LL.
>+	 * See also include/plat/uncompress.h and include/mach/debug-macro.S.
>+	 */
>+	if (p->mapbase == OMAP2_UART1_BASE)	/* OMAP2/3/4UART1_BASE */
>+		scratchpad = serial_read_reg(p, UART_SCR);

No need to save and restore the UART_SCR register. 
This never gets used in this function.

What gets used is UART_OMAP_SCR which is OMAP specific supplimantry control register 
and not scratchpad.

>
> 	serial_write_reg(p, UART_OMAP_MDR1, 0x07);
> 	serial_write_reg(p, UART_OMAP_SCR, 0x08);
> 	serial_write_reg(p, UART_OMAP_MDR1, 0x00);
> 	serial_write_reg(p, UART_OMAP_SYSC, (0x02 << 3) | (1 << 2) | (1 << 0));
>+
>+	if (p->mapbase == OMAP2_UART1_BASE)	/* OMAP2/3/4UART1_BASE */
>+		serial_write_reg(p, UART_SCR, scratchpad);

Remove this as well. No need. 


<snip>
>diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-
>omap/include/plat/uncompress.h
>index 13c305d..479bac8 100644
>--- a/arch/arm/plat-omap/include/plat/uncompress.h
>+++ b/arch/arm/plat-omap/include/plat/uncompress.h
>@@ -19,62 +19,36 @@
>
> #include <linux/types.h>
> #include <linux/serial_reg.h>
>+
>+#include <asm/mach-types.h>
>+
> #include <plat/serial.h>
>
>-unsigned int system_rev;
>+static volatile u8 *uart1_base;
>+static volatile u8 *uart_base;
>+static volatile int uart_shift;

Just like uart_base is stored in scratchpad,
Somehow the uart_shift also needs to be stored so that boards with different uart_shift requirements can be addressed. Where can we store this another variable? 

<snip>

> /*
>+ * Macros to configure UART1 and debug UART
>+ */
>+#define _DEBUG_LL_ENTRY(mach, uart1, dbg_uart, shift, dbg_id, reset_fn)	\
>+	if (machine_is_##mach()) {					\
>+		uart1_base = (volatile u8 *)(uart1);			\
>+		uart_base = (volatile u8 *)(dbg_uart);			\
>+		uart_shift = (shift);					\
>+		port = (dbg_id);					\
>+		reset_fn;						\
>+		break;							\
>+	}

Nice Idea... you are the man !!

<snip>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic
  2010-01-16 20:00         ` Tony Lindgren
@ 2010-01-19  1:50           ` Pandita, Vikram
  2010-01-22  3:07             ` [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2 Tony Lindgren
  0 siblings, 1 reply; 38+ messages in thread
From: Pandita, Vikram @ 2010-01-19  1:50 UTC (permalink / raw)
  To: linux-arm-kernel



>-----Original Message-----
From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner at vger.kernel.org] On Behalf Of Tony
>Lindgren
>Sent: Saturday, January 16, 2010 2:00 PM
>To: Russell King - ARM Linux
>Cc: linux-arm-kernel at lists.infradead.org; linux-omap at vger.kernel.org
>Subject: Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic
>
>* Russell King - ARM Linux <linux@arm.linux.org.uk> [100116 11:31]:
>> On Sat, Jan 16, 2010 at 11:18:20AM -0800, Tony Lindgren wrote:
>> > * Russell King - ARM Linux <linux@arm.linux.org.uk> [100116 01:33]:
>> > > On Fri, Jan 15, 2010 at 05:35:15PM -0800, Tony Lindgren wrote:
>> > > > diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-
>omap1/include/mach/debug-macro.S
>> > > > index 23e4724..0174858 100644
>> > > > --- a/arch/arm/mach-omap1/include/mach/debug-macro.S
>> > > > +++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
>> > > > @@ -15,18 +15,71 @@
>> > > >
>> > > >  #include <plat/serial.h>
>> > > >
>> > > > +omap_uart_phys:	.word	0x0
>> > > > +omap_uart_virt:	.word	0x0
>> > >
>> > > I assume that you have no plans for XIP kernel support on OMAP, since
>> > > these will be placed in the .text section, and is therefore read-only
>> > > on XIP kernels.
>> >
>> > Did not think of that.. Maybe some addruart_premable solution here would.
>> > Or adding \tmp register for addruart and just do the detection for each
>> > character.
>>
>> How does doing it per-character help?  The code is:
>>
>> ENTRY(printascii)
>>                 addruart r3
>>                 b       2f
>> 1:              waituart r2, r3
>>                 senduart r1, r3
>>                 busyuart r2, r3
>>                 teq     r1, #'\n'
>>                 moveq   r1, #'\r'
>>                 beq     1b
>> 2:              teq     r0, #0
>>                 ldrneb  r1, [r0], #1
>>                 teqne   r1, #0
>>                 bne     1b
>>                 mov     pc, lr
>>
>> Your wait/send/busy macros are just using the already provided base
>> address which comes via r3 from addruart.  That much is fine.
>>
>> I'm at a loss to understand why you think moving the address-getting
>> functionality out of addruart into the individual wait/send/busy
>> macros is going to help in any way.
>
>Sorry, I meant doing the detection each time addruart is run, not
>for each character.
>
>> Why not do something like this:
>>
>> 		.pushsection .data
>> omap_uart_phys:	.word 0
>> omap_uart_virt:	.word 0

Also We may need a:
	 omap_uart_shift: .word 0 
Since shift also varies depending on different omap boards (external debug board shift=1, internal omap has shift=2)

Bingo..I think this was the key solution to the problem.
I had posted long ago similar kind of implementation [1] 
and I wish rmk had given this nice idea then :)

[1] http://marc.info/?l=linux-omap&m=125269221820632&w=2
	See this part: 
	+		.align
	+		.type   __phy_uart_addr, #object
	+__phy_uart_addr:       .word   0xFF
	+		.type   __virt_uart_addr, #object
	+__virt_uart_addr:       .word   0xFF


>> 		.popsection
>>
>> 		.macro addruart, rx
>> ...
>> +               ldreq   \rx, =omap_uart_phys    @ physical base address
>> +               ldrne   \rx, =omap_uart_virt    @ virtual base
>> 		ldr	\rx, [\rx]
>> +               cmp     \rx, #0                 @ is port configured?
>> +               bne     99f                     @ already configured
>> ...
>>
>> ?
>
>Sounds good to me. Will play with them and post refreshed patches.
>
>Regards,
>
>Tony
>--
>To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>the body of a message to majordomo at vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic
  2010-01-19  1:26   ` Pandita, Vikram
@ 2010-01-19 17:19     ` Kevin Hilman
  2010-01-26 17:22     ` Tony Lindgren
  1 sibling, 0 replies; 38+ messages in thread
From: Kevin Hilman @ 2010-01-19 17:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 2010-01-19 at 06:56 +0530, Pandita, Vikram wrote:
> 
> >-----Original Message-----
> >From: linux-omap-owner at vger.kernel.org [mailto:linux-omap-owner at vger.kernel.org] On Behalf Of Tony
> >Lindgren
> >Sent: Friday, January 15, 2010 7:35 PM
> >To: linux-arm-kernel at lists.infradead.org
> >Cc: linux-omap at vger.kernel.org
> >Subject: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic
> 
> UART_SCR 		-> this is the scratchpad register 
> UART_OMAP_SCR	-> This is TI-only Supplementary control register
> 
> You probably confused the two (as rightly so since SCR is same name).
> So there is no need to save/restore the UART_SCR register as you have done, see inlined -- 
> 
> >
> >Define arch_decomp_setup() the same way as some other
> >architectures do. Use arch_id to configure the debug uart
> >based on the machine_is by storing it into the uart
> >scratchpad register for DEBUG_LL code to use.
> >
> >Signed-off-by: Tony Lindgren <tony@atomide.com>
> <snip>
> >--- a/arch/arm/mach-omap2/serial.c
> >+++ b/arch/arm/mach-omap2/serial.c
> >@@ -161,11 +161,22 @@ static inline void serial_write_reg(struct plat_serial8250_port *p, int offset,
> > static inline void __init omap_uart_reset(struct omap_uart_state *uart)
> > {
> > 	struct plat_serial8250_port *p = uart->p;
> >+	u8 scratchpad = 0;
> >+
> >+	/*
> >+	 * Save UART1 scratchpad register value for UART1 for DEBUG_LL.
> >+	 * See also include/plat/uncompress.h and include/mach/debug-macro.S.
> >+	 */
> >+	if (p->mapbase == OMAP2_UART1_BASE)	/* OMAP2/3/4UART1_BASE */
> >+		scratchpad = serial_read_reg(p, UART_SCR);
> 
> No need to save and restore the UART_SCR register. 
> This never gets used in this function.
> 
> What gets used is UART_OMAP_SCR which is OMAP specific supplimantry control register 
> and not scratchpad.
> 
> >
> > 	serial_write_reg(p, UART_OMAP_MDR1, 0x07);
> > 	serial_write_reg(p, UART_OMAP_SCR, 0x08);
> > 	serial_write_reg(p, UART_OMAP_MDR1, 0x00);
> > 	serial_write_reg(p, UART_OMAP_SYSC, (0x02 << 3) | (1 << 2) | (1 << 0));
> >+
> >+	if (p->mapbase == OMAP2_UART1_BASE)	/* OMAP2/3/4UART1_BASE */
> >+		serial_write_reg(p, UART_SCR, scratchpad);
> 
> Remove this as well. No need. 
> 
> 
> <snip>
> >diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-
> >omap/include/plat/uncompress.h
> >index 13c305d..479bac8 100644
> >--- a/arch/arm/plat-omap/include/plat/uncompress.h
> >+++ b/arch/arm/plat-omap/include/plat/uncompress.h
> >@@ -19,62 +19,36 @@
> >
> > #include <linux/types.h>
> > #include <linux/serial_reg.h>
> >+
> >+#include <asm/mach-types.h>
> >+
> > #include <plat/serial.h>
> >
> >-unsigned int system_rev;
> >+static volatile u8 *uart1_base;
> >+static volatile u8 *uart_base;
> >+static volatile int uart_shift;
> 
> Just like uart_base is stored in scratchpad,
> Somehow the uart_shift also needs to be stored so that boards with different uart_shift requirements can be addressed. Where can we store this another variable? 

Since the base addresses are aligned, how about store the shift in the
least-significant 2 bits, and the rest is the base address.

Kevin

> <snip>
> 
> > /*
> >+ * Macros to configure UART1 and debug UART
> >+ */
> >+#define _DEBUG_LL_ENTRY(mach, uart1, dbg_uart, shift, dbg_id, reset_fn)	\
> >+	if (machine_is_##mach()) {					\
> >+		uart1_base = (volatile u8 *)(uart1);			\
> >+		uart_base = (volatile u8 *)(dbg_uart);			\
> >+		uart_shift = (shift);					\
> >+		port = (dbg_id);					\
> >+		reset_fn;						\
> >+		break;							\
> >+	}
> 
> Nice Idea... you are the man !!
> 
> <snip>
> NrybX?v^)?{.n+{f{ay
??,j\afhz
w\f
j:+vwjm\azZ+?j"!

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 1/4] omap: Clean the serial port defines
  2010-01-19  0:39   ` Pandita, Vikram
@ 2010-01-20 23:10     ` Tony Lindgren
  0 siblings, 0 replies; 38+ messages in thread
From: Tony Lindgren @ 2010-01-20 23:10 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

* Pandita, Vikram <vikram.pandita@ti.com> [100118 16:37]:

<snip>

> Is it possible to use the same approach as mach-omap2/ for physical address assignments?
> I like that approach.
> Refer this part from mach-omap2:
> 	+	serial_platform_data0[0].mapbase = omap2_globals->uart1_phys;
> 	+	serial_platform_data1[0].mapbase = omap2_globals->uart2_phys;
> 	+	serial_platform_data2[0].mapbase = omap2_globals->uart3_phys;	
> 
> > 		.irq		= INT_UART1,
> > 		.flags		= UPF_BOOT_AUTOCONF,
> > 		.iotype		= UPIO_MEM,

It would be possible if we had omap1_globals. But we don't have it as
the address space is so similar across all omap1 processors.

> > 		.macro	busyuart,rd,rx
> >-1001:		ldrb	\rd, [\rx, #(0x5 << 2)]	@ OMAP-1510 and friends
> >-		and	\rd, \rd, #0x60
> >-		teq	\rd, #0x60
> >-		beq	1002f
> >-		ldrb	\rd, [\rx, #(0x5 << 0)]	@ OMAP-730 only
> >-		and	\rd, \rd, #0x60
> >-		teq	\rd, #0x60
> >+1001:		ldrb	\rd, [\rx, #(UART_LSR << OMAP_PORT_SHIFT)]
> 
> Zoom2/3 kind of boards have external debug Serial port.
> For those boards and maybe others, the shift value is 1 and not OMAP_PORT_SHIFT(2).

OK, thanks for pointing that out. Let's add the shift as a variable
in debug-macro.S, see the next patch in the series.
 
> This solution is not extensible to zoom2/3 boards with external debug board uarts.
> How do we address that? 
 
It should be doable, we need to initialize zoom external uart physical
and virtual address in uncompress.h, and also initialize the shift for
it.
 
> >diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
> <snip>
> >@@ -269,11 +278,15 @@ static struct omap_globals omap343x_globals = {
> > 	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
> > 	.prm	= OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
> > 	.cm	= OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
> >+	.uart1_phys	= OMAP3_UART1_BASE,
> >+	.uart2_phys	= OMAP3_UART2_BASE,
> >+	.uart3_phys	= OMAP3_UART3_BASE,
> 
> OMAP3630 also has 4 UARTS and this same global is getting used for both 34xx and 36xx.
> This is not right.
> 
> For 3630 uart4_phys = 0x49042000

OK, updated.

> >+#define OMAP3_UART1_BASE	0x4806a000
> >+#define OMAP3_UART2_BASE	0x4806c000
> >+#define OMAP3_UART3_BASE	0x49020000
> 
> Need to add 0x4904 2000 for 3630 UART4

OK, added now. Care to look and ack the attached updated patch?

Regards,

Tony

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic
  2010-01-16 19:33       ` Russell King - ARM Linux
  2010-01-16 20:00         ` Tony Lindgren
@ 2010-01-21 19:03         ` Tony Lindgren
  1 sibling, 0 replies; 38+ messages in thread
From: Tony Lindgren @ 2010-01-21 19:03 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

* Russell King - ARM Linux <linux@arm.linux.org.uk> [100116 11:31]:
> On Sat, Jan 16, 2010 at 11:18:20AM -0800, Tony Lindgren wrote:
> > * Russell King - ARM Linux <linux@arm.linux.org.uk> [100116 01:33]:
> > > On Fri, Jan 15, 2010 at 05:35:15PM -0800, Tony Lindgren wrote:
> > > > diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
> > > > index 23e4724..0174858 100644
> > > > --- a/arch/arm/mach-omap1/include/mach/debug-macro.S
> > > > +++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
> > > > @@ -15,18 +15,71 @@
> > > >  
> > > >  #include <plat/serial.h>
> > > >  
> > > > +omap_uart_phys:	.word	0x0
> > > > +omap_uart_virt:	.word	0x0
> > > 
> > > I assume that you have no plans for XIP kernel support on OMAP, since
> > > these will be placed in the .text section, and is therefore read-only
> > > on XIP kernels.
> > 
> > Did not think of that.. Maybe some addruart_premable solution here would.
> > Or adding \tmp register for addruart and just do the detection for each
> > character.

<snip>
 
> Why not do something like this:
> 
> 		.pushsection .data
> omap_uart_phys:	.word 0
> omap_uart_virt:	.word 0
> 		.popsection
> 
> 		.macro addruart, rx
> ...		
> +               ldreq   \rx, =omap_uart_phys    @ physical base address
> +               ldrne   \rx, =omap_uart_virt    @ virtual base
> 		ldr	\rx, [\rx]
> +               cmp     \rx, #0                 @ is port configured?
> +               bne     99f                     @ already configured
> ...
> 
> ?

Works fine, but it add one issue. Looks like we need to add tmp register
into addruart to initially save the omap_uart_phys and omap_uart_virt:

+		/* Store both phys and virt address for the uart */
+98:		add	\rx, \rx, #0x48000000	@ phys base
+		ldr	\tmp, =omap_uart_phys
+		str	\rx, [\tmp, #0]
+		sub	\rx, \rx, #0x48000000	@ phys base
+		add	\rx, \rx, #0xfa000000	@ virt base
+		ldr	\tmp, =omap_uart_virt
+		str	\rx, [\tmp, #0]

Does the following patch look OK to you, or do you have some other way
in mind for doing it?

Regards,

Tony

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2
  2010-01-19  1:50           ` Pandita, Vikram
@ 2010-01-22  3:07             ` Tony Lindgren
  2010-01-22 14:48               ` Pandita, Vikram
  0 siblings, 1 reply; 38+ messages in thread
From: Tony Lindgren @ 2010-01-22  3:07 UTC (permalink / raw)
  To: linux-arm-kernel

* Pandita, Vikram <vikram.pandita@ti.com> [100118 17:48]:
>
> >* Russell King - ARM Linux <linux@arm.linux.org.uk> [100116 11:31]:
> >
> >> Why not do something like this:
> >>
> >> 		.pushsection .data
> >> omap_uart_phys:	.word 0
> >> omap_uart_virt:	.word 0
> >> 		.popsection

Updated patch below using .data. This assumes getting an additional
tmp register passed to addruart as in the patch I posted earlier.
 
> Also We may need a:
> 	 omap_uart_shift: .word 0 
> Since shift also varies depending on different omap boards
> (external debug board shift=1, internal omap has shift=2)

OK, I've added that too, but for mach-omap2 only. I've also
added an experimental zoom2/3 support.

Care to take try it out and see what happens on a zoom?
 
> Bingo..I think this was the key solution to the problem.
> I had posted long ago similar kind of implementation [1] 
> and I wish rmk had given this nice idea then :)
> 
> [1] http://marc.info/?l=linux-omap&m=125269221820632&w=2
> 	See this part: 
> 	+		.align
> 	+		.type   __phy_uart_addr, #object
> 	+__phy_uart_addr:       .word   0xFF
> 	+		.type   __virt_uart_addr, #object
> 	+__virt_uart_addr:       .word   0xFF

Yeah hopefully we're pretty close to better DEBUG_LL support
for omaps now :)

BTW, I've also pushed these patches into a temporary multi-omap
branch in the linux-omap tree:

http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=shortlog;h=refs/heads/multi-omap

I'll update also the entry-macro.S tomorrow.

Regards,

Tony

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2
  2010-01-22  3:07             ` [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2 Tony Lindgren
@ 2010-01-22 14:48               ` Pandita, Vikram
  2010-01-22 20:55                 ` Tony Lindgren
  0 siblings, 1 reply; 38+ messages in thread
From: Pandita, Vikram @ 2010-01-22 14:48 UTC (permalink / raw)
  To: linux-arm-kernel



>-----Original Message-----
>From: Tony Lindgren [mailto:tony at atomide.com]
>Sent: Thursday, January 21, 2010 9:07 PM
>To: Pandita, Vikram
>Cc: Russell King - ARM Linux; linux-arm-kernel at lists.infradead.org; linux-omap at vger.kernel.org
>Subject: Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2
>
>* Pandita, Vikram <vikram.pandita@ti.com> [100118 17:48]:
>>
>> >* Russell King - ARM Linux <linux@arm.linux.org.uk> [100116 11:31]:
>> >
>> >> Why not do something like this:
>> >>
>> >> 		.pushsection .data
>> >> omap_uart_phys:	.word 0
>> >> omap_uart_virt:	.word 0
>> >> 		.popsection
>
>Updated patch below using .data. This assumes getting an additional
>tmp register passed to addruart as in the patch I posted earlier.
>
>> Also We may need a:
>> 	 omap_uart_shift: .word 0
>> Since shift also varies depending on different omap boards
>> (external debug board shift=1, internal omap has shift=2)
>
>OK, I've added that too, but for mach-omap2 only. I've also
>added an experimental zoom2/3 support.
>
>Care to take try it out and see what happens on a zoom?

Test on zoom3 failed with multi-omap branch.
Debugging the same, should have a zoom correction patch out today.

>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 4/4] omap: Make get_irqnr_and_base common for mach-omap2 multiboot, v2
  2010-01-16 11:55   ` Russell King - ARM Linux
  2010-01-16 19:12     ` Tony Lindgren
@ 2010-01-22 20:39     ` Tony Lindgren
  2010-01-22 20:56       ` Russell King - ARM Linux
  1 sibling, 1 reply; 38+ messages in thread
From: Tony Lindgren @ 2010-01-22 20:39 UTC (permalink / raw)
  To: linux-arm-kernel

* Russell King - ARM Linux <linux@arm.linux.org.uk> [100116 03:53]:
> On Fri, Jan 15, 2010 at 05:35:20PM -0800, Tony Lindgren wrote:
> > -#ifndef CONFIG_ARCH_OMAP4
> > +#if defined(CONFIG_ARCH_OMAP2420) || defined(CONFIG_ARCH_OMAP2430) || \
> > +	defined(CONFIG_ARCH_OMAP34XX)
> > +
> > +#define INTCPS_SIR_IRQ_OFFSET	0x0040		/* Active interrupt offset */
> > +#define	ACTIVEIRQ_MASK		0x7f		/* Active interrupt bits */
> > +
> > +omap_irq_base:	.word	0x0
> 
> You have no idea where this word will be placed - it could be in the middle
> of a read only section, which might really be read only.  It might also be
> out of reach of the "ldr \base, [pc, #offset]" instructions you're using
> below - which is what an "ldr \base, address" instruction really is.
> 
> > +
> >  		.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
> > -		ldr	\base, =OMAP2_VA_IC_BASE
> > -		ldr	\irqnr, [\base, #0x98] /* IRQ pending reg 1 */
> > +		ldr	\base, omap_irq_base
> > +		cmp	\base, #0		@ is irq base configured?
> > +		bne	9998f			@ already configured
> 
> First thing, why not use get_irqnr_preamble to load the base address?
> That means you only do all this computation once per group of IRQs
> processed.
> 
> Secondly, is this really worth the overhead, or can't you move
> omap_irq_base into the data section, and have your IRQ initialization
> function set the pointer?
> 
> You then don't have to make these two tests every time you check for
> an interrupt/enter to process interrupts.

Here's this patch updated. It should now be actually more optimized for
non-multi-omap configurations as it uses the get_irqnr_preamble :)

Regards,

Tony

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2
  2010-01-22 14:48               ` Pandita, Vikram
@ 2010-01-22 20:55                 ` Tony Lindgren
  2010-01-22 20:58                   ` Pandita, Vikram
  0 siblings, 1 reply; 38+ messages in thread
From: Tony Lindgren @ 2010-01-22 20:55 UTC (permalink / raw)
  To: linux-arm-kernel

* Pandita, Vikram <vikram.pandita@ti.com> [100122 06:46]:
> >
> >OK, I've added that too, but for mach-omap2 only. I've also
> >added an experimental zoom2/3 support.
> >
> >Care to take try it out and see what happens on a zoom?
> 
> Test on zoom3 failed with multi-omap branch.
> Debugging the same, should have a zoom correction patch out today.

Heh OK. I just pushed more updates into the multi-omap branch
if you want to try to boot zoom2/zoom3 using the same .config.

There are still issues with booting 2420 though..

Tony

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 4/4] omap: Make get_irqnr_and_base common for mach-omap2 multiboot, v2
  2010-01-22 20:39     ` [PATCH 4/4] omap: Make get_irqnr_and_base common for mach-omap2 multiboot, v2 Tony Lindgren
@ 2010-01-22 20:56       ` Russell King - ARM Linux
  2010-01-22 21:09         ` Tony Lindgren
  0 siblings, 1 reply; 38+ messages in thread
From: Russell King - ARM Linux @ 2010-01-22 20:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 22, 2010 at 12:39:53PM -0800, Tony Lindgren wrote:
> Here's this patch updated. It should now be actually more optimized for
> non-multi-omap configurations as it uses the get_irqnr_preamble :)

And the patch looks a lot cleaner and easier to read.

> diff --git a/arch/arm/mach-omap2/include/mach/entry-macro.S b/arch/arm/mach-omap2/include/mach/entry-macro.S
> index c7f1720..c5ea026 100644
> --- a/arch/arm/mach-omap2/include/mach/entry-macro.S
> +++ b/arch/arm/mach-omap2/include/mach/entry-macro.S
> @@ -17,47 +17,85 @@
>  
>  #include <plat/omap24xx.h>
>  #include <plat/omap34xx.h>
> -
> -/* REVISIT: This should be set dynamically if CONFIG_MULTI_OMAP2 is selected */
> -#if defined(CONFIG_ARCH_OMAP2420) || defined(CONFIG_ARCH_OMAP2430)
> -#define OMAP2_VA_IC_BASE		OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE)
> -#elif defined(CONFIG_ARCH_OMAP34XX)
> -#define OMAP2_VA_IC_BASE		OMAP2_L4_IO_ADDRESS(OMAP34XX_IC_BASE)
> -#endif
> -#if defined(CONFIG_ARCH_OMAP4)
>  #include <plat/omap44xx.h>
> -#endif
> -#define INTCPS_SIR_IRQ_OFFSET	0x0040		/* Active interrupt offset */
> -#define	ACTIVEIRQ_MASK		0x7f		/* Active interrupt bits */
>  
>  		.macro	disable_fiq
>  		.endm
>  
> -		.macro  get_irqnr_preamble, base, tmp
> -		.endm
> -
>  		.macro  arch_ret_to_user, tmp1, tmp2
>  		.endm
>  
> -#ifndef CONFIG_ARCH_OMAP4
> +#if defined(CONFIG_ARCH_OMAP2420) || defined(CONFIG_ARCH_OMAP2430) || \
> +	defined(CONFIG_ARCH_OMAP34XX)

Isn't this equivalent to:

#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)

?

> +
> +#define OMAP2_IRQ_BASE		OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE)
> +#define OMAP3_IRQ_BASE		OMAP2_L4_IO_ADDRESS(OMAP34XX_IC_BASE)
> +#define INTCPS_SIR_IRQ_OFFSET	0x0040		/* Active interrupt offset */
> +#define	ACTIVEIRQ_MASK		0x7f		/* Active interrupt bits */
> +
> +		.pushsection .data
> +omap_irq_base:	.word	0
> +		.popsection
> +
> +#if defined(CONFIG_ARCH_OMAP2) && defined(CONFIG_ARCH_OMAP3)
> +		/* Configure the interrupt base on the first interrupt */
> +		.macro  get_irqnr_preamble, base, tmp
> +9:
> +		ldr	\base, =omap_irq_base	@ irq base address
> +		ldr	\base, [\base, #0]	@ irq base value
> +		cmp	\base, #0		@ already configured?
> +		bne	9998f			@ nothing to do
> +
> +		mrc	p15, 0, \tmp, c0, c0, 0	@ get processor revision
> +		and	\tmp, \tmp, #0x000f0000	@ only check architecture
> +		cmp	\tmp, #0x00060000	@ is v6?
> +		beq	2400f			@ found v6 so it's omap24xx
> +		cmp	\tmp, #0x000f0000	@ is cortex?
> +		beq	3400f			@ found v7 so it's omap34xx
> +2400:		ldr	\base, =OMAP2_IRQ_BASE
> +		ldr	\tmp, =omap_irq_base
> +		str	\base, [\tmp, #0]
> +		b	9b
> +3400:		ldr	\base, =OMAP3_IRQ_BASE
> +		ldr	\tmp, =omap_irq_base
> +		str	\base, [\tmp, #0]
> +		b	9b
> +9998:
> +		.endm
> +#else
> +		.macro  get_irqnr_preamble, base, tmp
> +#if defined(CONFIG_ARCH_OMAP2420) || defined(CONFIG_ARCH_OMAP2430)

And this

#elif defined(CONFIG_ARCH_OMAP2)

?

> +		ldr	\base, =OMAP2_IRQ_BASE
> +#else
> +		ldr	\base, =OMAP3_IRQ_BASE
> +#endif

Whereas I can see the sense in loading 'base' here directly, I don't see
the point of finding a value for omap_irq_base in assembly code, when you
have to do IRQ initialization in C code.  In fact, you're already sorting
this out in omap_init_irq().

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2
  2010-01-22 20:55                 ` Tony Lindgren
@ 2010-01-22 20:58                   ` Pandita, Vikram
  2010-01-22 21:10                     ` Tony Lindgren
  0 siblings, 1 reply; 38+ messages in thread
From: Pandita, Vikram @ 2010-01-22 20:58 UTC (permalink / raw)
  To: linux-arm-kernel



>-----Original Message-----
>From: Tony Lindgren [mailto:tony at atomide.com]
>Sent: Friday, January 22, 2010 2:55 PM
>To: Pandita, Vikram
>Cc: Russell King - ARM Linux; linux-arm-kernel at lists.infradead.org; linux-omap at vger.kernel.org
>Subject: Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2
>
>* Pandita, Vikram <vikram.pandita@ti.com> [100122 06:46]:
>> >
>> >OK, I've added that too, but for mach-omap2 only. I've also
>> >added an experimental zoom2/3 support.
>> >
>> >Care to take try it out and see what happens on a zoom?
>>
>> Test on zoom3 failed with multi-omap branch.
>> Debugging the same, should have a zoom correction patch out today.
>
>Heh OK. I just pushed more updates into the multi-omap branch
>if you want to try to boot zoom2/zoom3 using the same .config.

Refreshed my tree and I don't see your patches yet.

>
>There are still issues with booting 2420 though..
>
>Tony

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 4/4] omap: Make get_irqnr_and_base common for mach-omap2 multiboot, v2
  2010-01-22 20:56       ` Russell King - ARM Linux
@ 2010-01-22 21:09         ` Tony Lindgren
  2010-01-22 21:16           ` Tony Lindgren
  0 siblings, 1 reply; 38+ messages in thread
From: Tony Lindgren @ 2010-01-22 21:09 UTC (permalink / raw)
  To: linux-arm-kernel

* Russell King - ARM Linux <linux@arm.linux.org.uk> [100122 12:54]:
> On Fri, Jan 22, 2010 at 12:39:53PM -0800, Tony Lindgren wrote:
> > Here's this patch updated. It should now be actually more optimized for
> > non-multi-omap configurations as it uses the get_irqnr_preamble :)
> 
> And the patch looks a lot cleaner and easier to read.
> 
> > diff --git a/arch/arm/mach-omap2/include/mach/entry-macro.S b/arch/arm/mach-omap2/include/mach/entry-macro.S
> > index c7f1720..c5ea026 100644
> > --- a/arch/arm/mach-omap2/include/mach/entry-macro.S
> > +++ b/arch/arm/mach-omap2/include/mach/entry-macro.S
> > @@ -17,47 +17,85 @@
> >  
> >  #include <plat/omap24xx.h>
> >  #include <plat/omap34xx.h>
> > -
> > -/* REVISIT: This should be set dynamically if CONFIG_MULTI_OMAP2 is selected */
> > -#if defined(CONFIG_ARCH_OMAP2420) || defined(CONFIG_ARCH_OMAP2430)
> > -#define OMAP2_VA_IC_BASE		OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE)
> > -#elif defined(CONFIG_ARCH_OMAP34XX)
> > -#define OMAP2_VA_IC_BASE		OMAP2_L4_IO_ADDRESS(OMAP34XX_IC_BASE)
> > -#endif
> > -#if defined(CONFIG_ARCH_OMAP4)
> >  #include <plat/omap44xx.h>
> > -#endif
> > -#define INTCPS_SIR_IRQ_OFFSET	0x0040		/* Active interrupt offset */
> > -#define	ACTIVEIRQ_MASK		0x7f		/* Active interrupt bits */
> >  
> >  		.macro	disable_fiq
> >  		.endm
> >  
> > -		.macro  get_irqnr_preamble, base, tmp
> > -		.endm
> > -
> >  		.macro  arch_ret_to_user, tmp1, tmp2
> >  		.endm
> >  
> > -#ifndef CONFIG_ARCH_OMAP4
> > +#if defined(CONFIG_ARCH_OMAP2420) || defined(CONFIG_ARCH_OMAP2430) || \
> > +	defined(CONFIG_ARCH_OMAP34XX)
> 
> Isn't this equivalent to:
> 
> #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
> 
> ?

Hmm, I guess it's not like that yet, but will be hopefully
soon.

Currently I believe we have CONFIG_ARCH_OMAP2 selected
for CONFIG_ARCH_OMAP3 too..

I have a set of patches that will remove the overlapping
Kconfig options. Basically I'm planning to convert:

CONFIG_ARCH_OMAP1	= arch/arm/mach-omap1
CONFIG_ARCH_OMAP2PLUS	= arch/arm/mach-omap2
CONFIG_ARCH_OMAP2	= defined(CONFIG_CPU_OMAP2420) || defined(CONFIG_CPU_OMAP2430)
CONFIG_ARCH_OMAP3	= defined(CONFIG_CPU_OMAP3430) || defined(CONFIG_CPU_OMAP3630)
CONFIG_ARCH_OMAP4	= stays the same

That will get rid of the double meaning for current
CONFIG_ARCH_OMAP2, and get rid of CONFIG_ARCH_OMAP24XX
and CONFIG_ARCH_OMAP34XX. Will post after I've updated
those patches again, hopefully during next week.

Regards,

Tony

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2
  2010-01-22 20:58                   ` Pandita, Vikram
@ 2010-01-22 21:10                     ` Tony Lindgren
  2010-01-22 23:10                       ` Pandita, Vikram
  0 siblings, 1 reply; 38+ messages in thread
From: Tony Lindgren @ 2010-01-22 21:10 UTC (permalink / raw)
  To: linux-arm-kernel

* Pandita, Vikram <vikram.pandita@ti.com> [100122 12:56]:
> 
> 
> >-----Original Message-----
> >From: Tony Lindgren [mailto:tony at atomide.com]
> >Sent: Friday, January 22, 2010 2:55 PM
> >To: Pandita, Vikram
> >Cc: Russell King - ARM Linux; linux-arm-kernel at lists.infradead.org; linux-omap at vger.kernel.org
> >Subject: Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2
> >
> >* Pandita, Vikram <vikram.pandita@ti.com> [100122 06:46]:
> >> >
> >> >OK, I've added that too, but for mach-omap2 only. I've also
> >> >added an experimental zoom2/3 support.
> >> >
> >> >Care to take try it out and see what happens on a zoom?
> >>
> >> Test on zoom3 failed with multi-omap branch.
> >> Debugging the same, should have a zoom correction patch out today.
> >
> >Heh OK. I just pushed more updates into the multi-omap branch
> >if you want to try to boot zoom2/zoom3 using the same .config.
> 
> Refreshed my tree and I don't see your patches yet.

Takes a few minutes to get mirrored from master.kernel.org..

Tony

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 4/4] omap: Make get_irqnr_and_base common for mach-omap2 multiboot, v2
  2010-01-22 21:09         ` Tony Lindgren
@ 2010-01-22 21:16           ` Tony Lindgren
  0 siblings, 0 replies; 38+ messages in thread
From: Tony Lindgren @ 2010-01-22 21:16 UTC (permalink / raw)
  To: linux-arm-kernel

* Tony Lindgren <tony@atomide.com> [100122 13:07]:
> * Russell King - ARM Linux <linux@arm.linux.org.uk> [100122 12:54]:
> > On Fri, Jan 22, 2010 at 12:39:53PM -0800, Tony Lindgren wrote:
> > > Here's this patch updated. It should now be actually more optimized for
> > > non-multi-omap configurations as it uses the get_irqnr_preamble :)
> > 
> > And the patch looks a lot cleaner and easier to read.
> > 
> > > diff --git a/arch/arm/mach-omap2/include/mach/entry-macro.S b/arch/arm/mach-omap2/include/mach/entry-macro.S
> > > index c7f1720..c5ea026 100644
> > > --- a/arch/arm/mach-omap2/include/mach/entry-macro.S
> > > +++ b/arch/arm/mach-omap2/include/mach/entry-macro.S
> > > @@ -17,47 +17,85 @@
> > >  
> > >  #include <plat/omap24xx.h>
> > >  #include <plat/omap34xx.h>
> > > -
> > > -/* REVISIT: This should be set dynamically if CONFIG_MULTI_OMAP2 is selected */
> > > -#if defined(CONFIG_ARCH_OMAP2420) || defined(CONFIG_ARCH_OMAP2430)
> > > -#define OMAP2_VA_IC_BASE		OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE)
> > > -#elif defined(CONFIG_ARCH_OMAP34XX)
> > > -#define OMAP2_VA_IC_BASE		OMAP2_L4_IO_ADDRESS(OMAP34XX_IC_BASE)
> > > -#endif
> > > -#if defined(CONFIG_ARCH_OMAP4)
> > >  #include <plat/omap44xx.h>
> > > -#endif
> > > -#define INTCPS_SIR_IRQ_OFFSET	0x0040		/* Active interrupt offset */
> > > -#define	ACTIVEIRQ_MASK		0x7f		/* Active interrupt bits */
> > >  
> > >  		.macro	disable_fiq
> > >  		.endm
> > >  
> > > -		.macro  get_irqnr_preamble, base, tmp
> > > -		.endm
> > > -
> > >  		.macro  arch_ret_to_user, tmp1, tmp2
> > >  		.endm
> > >  
> > > -#ifndef CONFIG_ARCH_OMAP4
> > > +#if defined(CONFIG_ARCH_OMAP2420) || defined(CONFIG_ARCH_OMAP2430) || \
> > > +	defined(CONFIG_ARCH_OMAP34XX)
> > 
> > Isn't this equivalent to:
> > 
> > #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
> > 
> > ?
> 
> Hmm, I guess it's not like that yet, but will be hopefully
> soon.
> 
> Currently I believe we have CONFIG_ARCH_OMAP2 selected
> for CONFIG_ARCH_OMAP3 too..

Hmm, never mind, I guess that issue is sorted out already.
So will update the patch accordingly. Other confusing
Kconfig options still remain, see below.
 
> I have a set of patches that will remove the overlapping
> Kconfig options. Basically I'm planning to convert:
> 
> CONFIG_ARCH_OMAP1	= arch/arm/mach-omap1
> CONFIG_ARCH_OMAP2PLUS	= arch/arm/mach-omap2
> CONFIG_ARCH_OMAP2	= defined(CONFIG_CPU_OMAP2420) || defined(CONFIG_CPU_OMAP2430)
> CONFIG_ARCH_OMAP3	= defined(CONFIG_CPU_OMAP3430) || defined(CONFIG_CPU_OMAP3630)
> CONFIG_ARCH_OMAP4	= stays the same
> 
> That will get rid of the double meaning for current
> CONFIG_ARCH_OMAP2, and get rid of CONFIG_ARCH_OMAP24XX
> and CONFIG_ARCH_OMAP34XX. Will post after I've updated
> those patches again, hopefully during next week.
> 
> Regards,
> 
> Tony
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2
  2010-01-22 21:10                     ` Tony Lindgren
@ 2010-01-22 23:10                       ` Pandita, Vikram
  2010-01-23 17:13                         ` Tony Lindgren
  0 siblings, 1 reply; 38+ messages in thread
From: Pandita, Vikram @ 2010-01-22 23:10 UTC (permalink / raw)
  To: linux-arm-kernel

Tony

>-----Original Message-----
>From: Tony Lindgren [mailto:tony at atomide.com]
>Sent: Friday, January 22, 2010 3:11 PM
>To: Pandita, Vikram
>Cc: Russell King - ARM Linux; linux-arm-kernel at lists.infradead.org; linux-omap at vger.kernel.org
>Subject: Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2
>
>* Pandita, Vikram <vikram.pandita@ti.com> [100122 12:56]:
>>
>>
>> >-----Original Message-----
>> >From: Tony Lindgren [mailto:tony at atomide.com]
>> >Sent: Friday, January 22, 2010 2:55 PM
>> >To: Pandita, Vikram
>> >Cc: Russell King - ARM Linux; linux-arm-kernel at lists.infradead.org; linux-omap at vger.kernel.org
>> >Subject: Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2
>> >
>> >* Pandita, Vikram <vikram.pandita@ti.com> [100122 06:46]:
>> >> >
>> >> >OK, I've added that too, but for mach-omap2 only. I've also
>> >> >added an experimental zoom2/3 support.
>> >> >
>> >> >Care to take try it out and see what happens on a zoom?
>> >>
>> >> Test on zoom3 failed with multi-omap branch.
>> >> Debugging the same, should have a zoom correction patch out today.
>> >
>> >Heh OK. I just pushed more updates into the multi-omap branch
>> >if you want to try to boot zoom2/zoom3 using the same .config.
>>
>> Refreshed my tree and I don't see your patches yet.
>
>Takes a few minutes to get mirrored from master.kernel.org..

Yes I tried with new branch and zoom2/3 does not work.
Root cause: 
There is a very basic issue in low level code.

We are allowed to create only one Physical to Virtual mapping using MACHINE_START() phys_io and io_pg_offst of size 0x100000(1MB).

Now for zoom2/3 we need to do following:
MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
-       .phys_io        = 0x48000000,
-       .io_pg_offst    = ((0xfa000000) >> 18) & 0xfffc,
+       .phys_io        = 0x1000000, /*ZOOM_UART_BASE*/
+       .io_pg_offst    = ((0xfb000000) >> 18) & 0xfffc, /*ZOOM_UART_VIRT*/
        .boot_params    = 0x80000100,
        .map_io         = omap_zoom_map_io,
        .init_irq       = omap_zoom_init_irq,

This will create mapping:
0x1000000 <-> 0xfb000000 of 1MB

Now that leaves the phy address 0x4800000 omap register mapping, unmapped.

So the code to get scratchpad contents will abort:
arch/arm/mach-omap2/include/mach/debug-macro.S
	moveq   \rx, #0x48000000        @ physical base address
	movne   \rx, #0xfa000000        @ virtual base
	orr     \rx, \rx, #0x0006a000   @ uart1 on omap2/3/4


This seems to be a basic limitation of low level code and I have not clue how to circumvent this.
Thoughts?

Regards,
Vikram 

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2
  2010-01-22 23:10                       ` Pandita, Vikram
@ 2010-01-23 17:13                         ` Tony Lindgren
  0 siblings, 0 replies; 38+ messages in thread
From: Tony Lindgren @ 2010-01-23 17:13 UTC (permalink / raw)
  To: linux-arm-kernel

* Pandita, Vikram <vikram.pandita@ti.com> [100122 15:08]:
> Tony
> 
> >-----Original Message-----
> >From: Tony Lindgren [mailto:tony at atomide.com]
> >Sent: Friday, January 22, 2010 3:11 PM
> >To: Pandita, Vikram
> >Cc: Russell King - ARM Linux; linux-arm-kernel at lists.infradead.org; linux-omap at vger.kernel.org
> >Subject: Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2
> >
> >* Pandita, Vikram <vikram.pandita@ti.com> [100122 12:56]:
> >>
> >>
> >> >-----Original Message-----
> >> >From: Tony Lindgren [mailto:tony at atomide.com]
> >> >Sent: Friday, January 22, 2010 2:55 PM
> >> >To: Pandita, Vikram
> >> >Cc: Russell King - ARM Linux; linux-arm-kernel at lists.infradead.org; linux-omap at vger.kernel.org
> >> >Subject: Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2
> >> >
> >> >* Pandita, Vikram <vikram.pandita@ti.com> [100122 06:46]:
> >> >> >
> >> >> >OK, I've added that too, but for mach-omap2 only. I've also
> >> >> >added an experimental zoom2/3 support.
> >> >> >
> >> >> >Care to take try it out and see what happens on a zoom?
> >> >>
> >> >> Test on zoom3 failed with multi-omap branch.
> >> >> Debugging the same, should have a zoom correction patch out today.
> >> >
> >> >Heh OK. I just pushed more updates into the multi-omap branch
> >> >if you want to try to boot zoom2/zoom3 using the same .config.
> >>
> >> Refreshed my tree and I don't see your patches yet.
> >
> >Takes a few minutes to get mirrored from master.kernel.org..
> 
> Yes I tried with new branch and zoom2/3 does not work.
> Root cause: 
> There is a very basic issue in low level code.
> 
> We are allowed to create only one Physical to Virtual mapping using MACHINE_START() phys_io and io_pg_offst of size 0x100000(1MB).
> 
> Now for zoom2/3 we need to do following:
> MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
> -       .phys_io        = 0x48000000,
> -       .io_pg_offst    = ((0xfa000000) >> 18) & 0xfffc,
> +       .phys_io        = 0x1000000, /*ZOOM_UART_BASE*/
> +       .io_pg_offst    = ((0xfb000000) >> 18) & 0xfffc, /*ZOOM_UART_VIRT*/
>         .boot_params    = 0x80000100,
>         .map_io         = omap_zoom_map_io,
>         .init_irq       = omap_zoom_init_irq,
> 
> This will create mapping:
> 0x1000000 <-> 0xfb000000 of 1MB
> 
> Now that leaves the phy address 0x4800000 omap register mapping, unmapped.

Right, we really need 0x48000000 mapped :)
 
> So the code to get scratchpad contents will abort:
> arch/arm/mach-omap2/include/mach/debug-macro.S
> 	moveq   \rx, #0x48000000        @ physical base address
> 	movne   \rx, #0xfa000000        @ virtual base
> 	orr     \rx, \rx, #0x0006a000   @ uart1 on omap2/3/4
> 
> 
> This seems to be a basic limitation of low level code and I have not clue how to circumvent this.
> Thoughts?

Please take a look at arch/arm/kernel/head.S where you can add
the extra mapping early on.

Hmm, I wonder if we cand nowadays do the extra mapping for zoom
external uart in arch/arm/kernel/early_printk.c?

Are you getting anything out of the zoom uart before MMU is
enabled?

To test this you can temporarily break your kernel by commenting
out the start_kernel line in head-common.S. Then the code falls
through to __error_p and prints out a processor error..

Regards,

Tony

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic
  2010-01-19  1:26   ` Pandita, Vikram
  2010-01-19 17:19     ` Kevin Hilman
@ 2010-01-26 17:22     ` Tony Lindgren
  1 sibling, 0 replies; 38+ messages in thread
From: Tony Lindgren @ 2010-01-26 17:22 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

* Pandita, Vikram <vikram.pandita@ti.com> [100118 17:24]:
> 
> 
> >-----Original Message-----
> >From: linux-omap-owner at vger.kernel.org [mailto:linux-omap-owner at vger.kernel.org] On Behalf Of Tony
> >Lindgren
> >Sent: Friday, January 15, 2010 7:35 PM
> >To: linux-arm-kernel at lists.infradead.org
> >Cc: linux-omap at vger.kernel.org
> >Subject: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic
> 
> UART_SCR 		-> this is the scratchpad register 
> UART_OMAP_SCR	-> This is TI-only Supplementary control register
> 
> You probably confused the two (as rightly so since SCR is same name).
> So there is no need to save/restore the UART_SCR register as you have done, see inlined -- 
> 
> >
> >Define arch_decomp_setup() the same way as some other
> >architectures do. Use arch_id to configure the debug uart
> >based on the machine_is by storing it into the uart
> >scratchpad register for DEBUG_LL code to use.
> >
> >Signed-off-by: Tony Lindgren <tony@atomide.com>
> <snip>
> >--- a/arch/arm/mach-omap2/serial.c
> >+++ b/arch/arm/mach-omap2/serial.c
> >@@ -161,11 +161,22 @@ static inline void serial_write_reg(struct plat_serial8250_port *p, int offset,
> > static inline void __init omap_uart_reset(struct omap_uart_state *uart)
> > {
> > 	struct plat_serial8250_port *p = uart->p;
> >+	u8 scratchpad = 0;
> >+
> >+	/*
> >+	 * Save UART1 scratchpad register value for UART1 for DEBUG_LL.
> >+	 * See also include/plat/uncompress.h and include/mach/debug-macro.S.
> >+	 */
> >+	if (p->mapbase == OMAP2_UART1_BASE)	/* OMAP2/3/4UART1_BASE */
> >+		scratchpad = serial_read_reg(p, UART_SCR);
> 
> No need to save and restore the UART_SCR register. 
> This never gets used in this function.
> 
> What gets used is UART_OMAP_SCR which is OMAP specific supplimantry control register 
> and not scratchpad.
> 
> >
> > 	serial_write_reg(p, UART_OMAP_MDR1, 0x07);
> > 	serial_write_reg(p, UART_OMAP_SCR, 0x08);
> > 	serial_write_reg(p, UART_OMAP_MDR1, 0x00);
> > 	serial_write_reg(p, UART_OMAP_SYSC, (0x02 << 3) | (1 << 2) | (1 << 0));
> >+
> >+	if (p->mapbase == OMAP2_UART1_BASE)	/* OMAP2/3/4UART1_BASE */
> >+		serial_write_reg(p, UART_SCR, scratchpad);
> 
> Remove this as well. No need. 

Just to clarify, the uncompress.h code is using the UART_SCR to store the
DEBUG_LL port number based on the machine ID.

The reason this code is not needed is that the earlyprintk code prints
out something already before we get to this code.

If earlyprintk did not print anything before this code, we would need
to save UART_SCR here as the debug serial port gets initialized the first
time something is printed.

Although the code above uses UART_OMAP_SCR and not UART_SCR, it resets
the uart so we lose UART_SCR.

So in any case I've dropped the code above.

Regards,

Tony

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2010-01-26 17:22 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-16  1:35 [PATCH 0/4] omap multiboot improvments for merge window after 2.6.34 Tony Lindgren
2010-01-16  1:35 ` [PATCH 1/4] omap: Clean the serial port defines Tony Lindgren
2010-01-16  7:48   ` Shilimkar, Santosh
2010-01-16 19:25     ` Tony Lindgren
2010-01-16 19:33       ` Shilimkar, Santosh
2010-01-16 20:03         ` Tony Lindgren
2010-01-19  0:39   ` Pandita, Vikram
2010-01-20 23:10     ` Tony Lindgren
2010-01-16  1:35 ` [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic Tony Lindgren
2010-01-16  9:35   ` Russell King - ARM Linux
2010-01-16 19:18     ` Tony Lindgren
2010-01-16 19:33       ` Russell King - ARM Linux
2010-01-16 20:00         ` Tony Lindgren
2010-01-19  1:50           ` Pandita, Vikram
2010-01-22  3:07             ` [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2 Tony Lindgren
2010-01-22 14:48               ` Pandita, Vikram
2010-01-22 20:55                 ` Tony Lindgren
2010-01-22 20:58                   ` Pandita, Vikram
2010-01-22 21:10                     ` Tony Lindgren
2010-01-22 23:10                       ` Pandita, Vikram
2010-01-23 17:13                         ` Tony Lindgren
2010-01-21 19:03         ` [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic Tony Lindgren
2010-01-16 11:04   ` Shilimkar, Santosh
2010-01-16 19:20     ` Tony Lindgren
2010-01-16 19:34       ` Shilimkar, Santosh
2010-01-19  1:26   ` Pandita, Vikram
2010-01-19 17:19     ` Kevin Hilman
2010-01-26 17:22     ` Tony Lindgren
2010-01-16  1:35 ` [PATCH 3/4] omap: Remove old DEBUG_LL serial port options Tony Lindgren
2010-01-16  1:35 ` [PATCH 4/4] omap: Make get_irqnr_and_base common for mach-omap2 multiboot Tony Lindgren
2010-01-16 11:24   ` Shilimkar, Santosh
2010-01-16 11:55   ` Russell King - ARM Linux
2010-01-16 19:12     ` Tony Lindgren
2010-01-22 20:39     ` [PATCH 4/4] omap: Make get_irqnr_and_base common for mach-omap2 multiboot, v2 Tony Lindgren
2010-01-22 20:56       ` Russell King - ARM Linux
2010-01-22 21:09         ` Tony Lindgren
2010-01-22 21:16           ` Tony Lindgren
2010-01-16 20:15 ` [PATCH 0/4] omap multiboot improvments for merge window after 2.6.34 Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).