Re: [PATCH 1/4] omap: Clean the serial port defines
Hi, * Pandita, Vikram vikram.pand...@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_BASE0x4806a000 +#define OMAP3_UART2_BASE0x4806c000 +#define OMAP3_UART3_BASE0x4902 Need to add 0x4904 2000 for 3630 UART4 OK, added now. Care to look and ack the attached updated patch? Regards, Tony From ecfb8e2561eb91a76797fdf38204bfa70f1d062b Mon Sep 17 00:00:00 2001 From: Tony Lindgren t...@atomide.com Date: Wed, 20 Jan 2010 14:11:59 -0800 Subject: [PATCH] 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 t...@atomide.com 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/board-3630sdp.c
RE: [PATCH 1/4] omap: Clean the serial port defines
-Original Message- From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of Tony Lindgren Sent: Friday, January 15, 2010 7:35 PM To: linux-arm-ker...@lists.infradead.org Cc: linux-omap@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 t...@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
Re: [PATCH 1/4] omap: Clean the serial port defines
* Shilimkar, Santosh santosh.shilim...@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 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 1/4] omap: Clean the serial port defines
-Original Message- From: Tony Lindgren [mailto:t...@atomide.com] Sent: Sunday, January 17, 2010 12:56 AM To: Shilimkar, Santosh Cc: linux-arm-ker...@lists.infradead.org; linux-omap@vger.kernel.org Subject: Re: [PATCH 1/4] omap: Clean the serial port defines * Shilimkar, Santosh santosh.shilim...@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 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[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 t...@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,
RE: [PATCH 1/4] omap: Clean the serial port defines
Thanks for the nice cleanup. snip -Original Message- From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of Tony Lindgren Sent: Saturday, January 16, 2010 7:05 AM To: linux-arm-ker...@lists.infradead.org Cc: linux-omap@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 t...@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 SantoshN�r��yb�X��ǧv�^�){.n�+{��f��{ay�ʇڙ�,j��f���h���z��w��� ���j:+v���w�j�mzZ+�ݢj��!�i