Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic

2010-01-26 Thread Tony Lindgren
Hi,

* Pandita, Vikram vikram.pand...@ti.com [100118 17:24]:
 
 
 -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 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 t...@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
--
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 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2

2010-01-23 Thread Tony Lindgren
* Pandita, Vikram vikram.pand...@ti.com [100122 15:08]:
 Tony
 
 -Original Message-
 From: Tony Lindgren [mailto:t...@atomide.com]
 Sent: Friday, January 22, 2010 3:11 PM
 To: Pandita, Vikram
 Cc: Russell King - ARM Linux; linux-arm-ker...@lists.infradead.org; 
 linux-omap@vger.kernel.org
 Subject: Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code 
 generic, v2
 
 * Pandita, Vikram vikram.pand...@ti.com [100122 12:56]:
 
 
  -Original Message-
  From: Tony Lindgren [mailto:t...@atomide.com]
  Sent: Friday, January 22, 2010 2:55 PM
  To: Pandita, Vikram
  Cc: Russell King - ARM Linux; linux-arm-ker...@lists.infradead.org; 
  linux-omap@vger.kernel.org
  Subject: Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code 
  generic, v2
  
  * Pandita, Vikram vikram.pand...@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 0x10(1MB).
 
 Now for zoom2/3 we need to do following:
 MACHINE_START(OMAP_ZOOM3, OMAP Zoom3 board)
 -   .phys_io= 0x4800,
 -   .io_pg_offst= ((0xfa00)  18)  0xfffc,
 +   .phys_io= 0x100, /*ZOOM_UART_BASE*/
 +   .io_pg_offst= ((0xfb00)  18)  0xfffc, /*ZOOM_UART_VIRT*/
 .boot_params= 0x8100,
 .map_io = omap_zoom_map_io,
 .init_irq   = omap_zoom_init_irq,
 
 This will create mapping:
 0x100 - 0xfb00 of 1MB
 
 Now that leaves the phy address 0x480 omap register mapping, unmapped.

Right, we really need 0x4800 mapped :)
 
 So the code to get scratchpad contents will abort:
 arch/arm/mach-omap2/include/mach/debug-macro.S
   moveq   \rx, #0x4800@ physical base address
   movne   \rx, #0xfa00@ 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
--
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 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2

2010-01-22 Thread Pandita, Vikram


-Original Message-
From: Tony Lindgren [mailto:t...@atomide.com]
Sent: Thursday, January 21, 2010 9:07 PM
To: Pandita, Vikram
Cc: Russell King - ARM Linux; linux-arm-ker...@lists.infradead.org; 
linux-omap@vger.kernel.org
Subject: Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, 
v2

* Pandita, Vikram vikram.pand...@ti.com [100118 17:48]:

 * Russell King - ARM Linux li...@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.


--
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 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2

2010-01-22 Thread Tony Lindgren
* Pandita, Vikram vikram.pand...@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
--
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 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2

2010-01-22 Thread Pandita, Vikram


-Original Message-
From: Tony Lindgren [mailto:t...@atomide.com]
Sent: Friday, January 22, 2010 2:55 PM
To: Pandita, Vikram
Cc: Russell King - ARM Linux; linux-arm-ker...@lists.infradead.org; 
linux-omap@vger.kernel.org
Subject: Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, 
v2

* Pandita, Vikram vikram.pand...@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
--
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 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2

2010-01-22 Thread Tony Lindgren
* Pandita, Vikram vikram.pand...@ti.com [100122 12:56]:
 
 
 -Original Message-
 From: Tony Lindgren [mailto:t...@atomide.com]
 Sent: Friday, January 22, 2010 2:55 PM
 To: Pandita, Vikram
 Cc: Russell King - ARM Linux; linux-arm-ker...@lists.infradead.org; 
 linux-omap@vger.kernel.org
 Subject: Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code 
 generic, v2
 
 * Pandita, Vikram vikram.pand...@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
--
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 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2

2010-01-22 Thread Pandita, Vikram
Tony

-Original Message-
From: Tony Lindgren [mailto:t...@atomide.com]
Sent: Friday, January 22, 2010 3:11 PM
To: Pandita, Vikram
Cc: Russell King - ARM Linux; linux-arm-ker...@lists.infradead.org; 
linux-omap@vger.kernel.org
Subject: Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, 
v2

* Pandita, Vikram vikram.pand...@ti.com [100122 12:56]:


 -Original Message-
 From: Tony Lindgren [mailto:t...@atomide.com]
 Sent: Friday, January 22, 2010 2:55 PM
 To: Pandita, Vikram
 Cc: Russell King - ARM Linux; linux-arm-ker...@lists.infradead.org; 
 linux-omap@vger.kernel.org
 Subject: Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code 
 generic, v2
 
 * Pandita, Vikram vikram.pand...@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 0x10(1MB).

Now for zoom2/3 we need to do following:
MACHINE_START(OMAP_ZOOM3, OMAP Zoom3 board)
-   .phys_io= 0x4800,
-   .io_pg_offst= ((0xfa00)  18)  0xfffc,
+   .phys_io= 0x100, /*ZOOM_UART_BASE*/
+   .io_pg_offst= ((0xfb00)  18)  0xfffc, /*ZOOM_UART_VIRT*/
.boot_params= 0x8100,
.map_io = omap_zoom_map_io,
.init_irq   = omap_zoom_init_irq,

This will create mapping:
0x100 - 0xfb00 of 1MB

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

So the code to get scratchpad contents will abort:
arch/arm/mach-omap2/include/mach/debug-macro.S
moveq   \rx, #0x4800@ physical base address
movne   \rx, #0xfa00@ 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 

--
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 2/4] omap: Make uncompress code and DEBUG_LL code generic

2010-01-21 Thread Tony Lindgren
Hi,

* Russell King - ARM Linux li...@arm.linux.org.uk [100116 11:31]:
 On Sat, Jan 16, 2010 at 11:18:20AM -0800, Tony Lindgren wrote:
  * Russell King - ARM Linux li...@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, #0x4800   @ phys base
+   ldr \tmp, =omap_uart_phys
+   str \rx, [\tmp, #0]
+   sub \rx, \rx, #0x4800   @ phys base
+   add \rx, \rx, #0xfa00   @ 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
From fae696043ad94ce83709ae72564623f42e66488c Mon Sep 17 00:00:00 2001
From: Tony Lindgren t...@atomide.com
Date: Wed, 20 Jan 2010 18:26:32 -0800
Subject: [PATCH] arm: Add \tmp register for addruart and loadsp

Otherwise more complicated uart configuration won't be possible.
We can use r1 for tmp register for both head.S and debug.S.

NOTE: This patch depends on another patch to add the the \tmp register
into all debug-macro.S files. That can be done with:

$ find arch/arm -name debug-macro.S | xargs -n1 -i sed -i \
-e s/addruart,rx\|addruart, rx/addruart, rx, tmp/ {}

Signed-off-by: Tony Lindgren t...@atomide.com

diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 4fddc50..99b75aa 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -22,13 +22,13 @@
 #if defined(CONFIG_DEBUG_ICEDCC)
 
 #ifdef CONFIG_CPU_V6
-		.macro	loadsp, rb
+		.macro	loadsp, rb, tmp
 		.endm
 		.macro	writeb, ch, rb
 		mcr	p14, 0, \ch, c0, c5, 0
 		.endm
 #elif defined(CONFIG_CPU_V7)
-		.macro	loadsp, rb
+		.macro	loadsp, rb, tmp
 		.endm
 		.macro	writeb, ch, rb
 wait:		mrc	p14, 0, pc, c0, c1, 0
@@ -36,13 +36,13 @@ wait:		mrc	p14, 0, pc, c0, c1, 0
 		mcr	p14, 0, \ch, c0, c5, 0
 		.endm
 #elif defined(CONFIG_CPU_XSCALE)
-		.macro	loadsp, rb
+		.macro	loadsp, rb, tmp
 		.endm
 		.macro	writeb, ch, rb
 		mcr	p14, 0, \ch, c8, c0, 0
 		.endm
 #else
-		.macro	loadsp, rb
+		.macro	loadsp, rb, tmp
 		.endm
 		.macro	writeb, ch, rb
 		mcr	p14, 0, \ch, c1, c0, 0
@@ -58,7 +58,7 @@ wait:		mrc	p14, 0, pc, c0, c1, 0
 		.endm
 
 #if defined(CONFIG_ARCH_SA1100)
-		.macro	loadsp, rb
+		.macro	loadsp, rb, tmp
 		mov	\rb, #0x8000	@ physical base address
 #ifdef CONFIG_DEBUG_LL_SER3
 		add	\rb, \rb, #0x0005	@ Ser3
@@ -67,13 +67,13 @@ wait:		mrc	p14, 0, pc, c0, c1, 0
 #endif
 		.endm
 #elif defined(CONFIG_ARCH_S3C2410)
-		.macro loadsp, rb
+		.macro loadsp, rb, tmp
 		mov	\rb, #0x5000
 		add	\rb, \rb, #0x4000 * CONFIG_S3C_LOWLEVEL_UART_PORT
 		.endm
 #else
-		.macro	loadsp,	rb
-		addruart \rb
+		.macro	loadsp,	rb, tmp
+		addruart \rb, \tmp
 		.endm
 #endif
 #endif
@@ -1025,7 +1025,7 @@ phex:		adr	r3, phexbuf
 		strb	r2, [r3, r1]
 		b	1b
 
-puts:		loadsp	r3
+puts:		loadsp	r3, r1
 1:		ldrb	r2, [r0], #1
 		teq	r2, #0
 		moveq	pc, lr
@@ -1042,7 +1042,7 @@ puts:		loadsp	r3
 putc:
 		mov	r2, r0
 		mov	r0, #0
-		loadsp	r3
+		loadsp	r3, r1
 		b	2b
 
 memdump:	mov	r12, r0
diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S
index 5c91add..a38b487 100644
--- a/arch/arm/kernel/debug.S
+++ b/arch/arm/kernel/debug.S
@@ -24,7 +24,7 @@
 
 #if defined(CONFIG_CPU_V6)
 
-		.macro	addruart, rx
+		.macro	addruart, rx, tmp
 		.endm
 
 		.macro	senduart, rd, rx
@@ -51,7 +51,7 @@
 
 #elif 

Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic, v2

2010-01-21 Thread Tony Lindgren
* Pandita, Vikram vikram.pand...@ti.com [100118 17:48]:

 * Russell King - ARM Linux li...@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-omapm=125269221820632w=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
From 94e3a455b9fb6bdfa1c6b3594d85fee313546e85 Mon Sep 17 00:00:00 2001
From: Tony Lindgren t...@atomide.com
Date: Thu, 21 Jan 2010 18:53:30 -0800
Subject: [PATCH] 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 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 9ea12f2..b6d9584 100644
--- a/arch/arm/mach-omap1/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -15,18 +15,76 @@
 
 #include plat/serial.h
 
+		.pushsection .data
+omap_uart_phys:	.word	0x0
+omap_uart_virt:	.word	0x0
+		.popsection
+
+		/*
+		 * 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, tmp
+
+		/* 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
+		ldr	\rx, [\rx, #0]
+		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, #0xff00	@ physical base address
+		movne	\rx, #0xfe00	@ virtual base
+		orr	\rx, \rx, #0x00fb	@ 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, #0xff00	@ physical base address
 		movne	\rx, #0xfe00	@ virtual base
-		orr	\rx, \rx, #0x00fb
-#ifdef CONFIG_OMAP_LL_DEBUG_UART3
-		orr	\rx, \rx, #0x9000	@ UART 3
-#endif
-#if defined(CONFIG_OMAP_LL_DEBUG_UART2) || defined(CONFIG_OMAP_LL_DEBUG_UART3)
-		orr	\rx, \rx, #0x0800	@ UART 2  3
-#endif
+		orr	\rx, \rx, #0x00fb	@ 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, #0x00fb	@ OMAP1UART1
+		b	98f
+12:		mov	\rx, #0x00fb	@ OMAP1UART1
+		orr	\rx, \rx, #0x0800	@ OMAP1UART2
+		b	98f
+13:		mov	\rx, #0x00fb	@ OMAP1UART1
+		orr	\rx, \rx, #0x0800	@ OMAP1UART2
+		orr	\rx, \rx, #0x9000	@ OMAP1UART3
+
+		/* Store both phys and virt address for the uart */
+98:		add	\rx, \rx, #0xff00	@ phys base
+		ldr	\tmp, =omap_uart_phys
+		str	\rx, [\tmp, #0]
+		sub	\rx, \rx, #0xff00	@ phys base
+		add	\rx, \rx, #0xfe00	@ virt base
+		ldr	\tmp, =omap_uart_virt
+		str	\rx, [\tmp, #0]
+		b	9b
+99:
 		.endm
 
 		.macro	senduart,rd,rx
diff --git 

RE: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic

2010-01-19 Thread Kevin Hilman
On Tue, 2010-01-19 at 06:56 +0530, Pandita, Vikram wrote:
 
 -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 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 t...@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ʇڙ,jfhzwj:+vwjmzZ+ݢj!


--
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 2/4] omap: Make uncompress code and DEBUG_LL code generic

2010-01-18 Thread Pandita, Vikram


-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 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 t...@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
N�r��yb�X��ǧv�^�)޺{.n�+{��f��{ay�ʇڙ�,j��f���h���z��w���
���j:+v���w�j�mzZ+�ݢj��!�i

RE: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic

2010-01-18 Thread Pandita, Vikram


-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 2:00 PM
To: Russell King - ARM Linux
Cc: linux-arm-ker...@lists.infradead.org; linux-omap@vger.kernel.org
Subject: Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic

* Russell King - ARM Linux li...@arm.linux.org.uk [100116 11:31]:
 On Sat, Jan 16, 2010 at 11:18:20AM -0800, Tony Lindgren wrote:
  * Russell King - ARM Linux li...@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-omapm=125269221820632w=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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
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 2/4] omap: Make uncompress code and DEBUG_LL code generic

2010-01-16 Thread Russell King - ARM Linux
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.
--
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 2/4] omap: Make uncompress code and DEBUG_LL code generic

2010-01-16 Thread Shilimkar, Santosh
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 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 t...@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, #0x4800@ physical base address
   movne   \rx, #0xfa00@ virtual base
 - orr \rx, \rx, #0x0006a000
 -#ifdef CONFIG_OMAP_LL_DEBUG_UART2
 - add \rx, \rx, #0x2000   @ UART 2
 -#endif
 -#ifdef CONFIG_OMAP_LL_DEBUG_UART3
 - add \rx, \rx, #0x4000   @ UART 3
 -#endif
 -
 -#elif defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
 - moveq   \rx, #0x4800@ physical base address
 - movne   \rx, #0xfa00@ virtual base
 - orr \rx, \rx, #0x0006a000
 -#ifdef CONFIG_OMAP_LL_DEBUG_UART2
 - add \rx, \rx, #0x2000   @ UART 2
 -#endif
 -#ifdef CONFIG_OMAP_LL_DEBUG_UART3
 - add \rx, \rx, #0x00fb   @ UART 3
 - add \rx, \rx, #0x6000
 -#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, #0x2000   @ OMAP2/3/4UART2
 + b   98f
 +23:  mov \rx, #0x0006a000@ OMAP2/3/4UART1
 + add \rx, \rx, #0x4000   @ OMAP2UART3
 + b   98f
 

Re: [PATCH 2/4] omap: Make uncompress code and DEBUG_LL code generic

2010-01-16 Thread Tony Lindgren
* Russell King - ARM Linux li...@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
--
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 2/4] omap: Make uncompress code and DEBUG_LL code generic

2010-01-16 Thread Tony Lindgren
* Shilimkar, Santosh santosh.shilim...@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
--
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 2/4] omap: Make uncompress code and DEBUG_LL code generic

2010-01-16 Thread Russell King - ARM Linux
On Sat, Jan 16, 2010 at 11:18:20AM -0800, Tony Lindgren wrote:
 * Russell King - ARM Linux li...@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
...

?
--
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 2/4] omap: Make uncompress code and DEBUG_LL code generic

2010-01-16 Thread Shilimkar, Santosh
 -Original Message-
 From: Tony Lindgren [mailto:t...@atomide.com] 
 Sent: Sunday, January 17, 2010 12:51 AM
 To: Shilimkar, Santosh
 Cc: linux-arm-ker...@lists.infradead.org; linux-omap@vger.kernel.org
 Subject: Re: [PATCH 2/4] omap: Make uncompress code and 
 DEBUG_LL code generic
 
 * Shilimkar, Santosh santosh.shilim...@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--
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 2/4] omap: Make uncompress code and DEBUG_LL code generic

2010-01-16 Thread Tony Lindgren
* Russell King - ARM Linux li...@arm.linux.org.uk [100116 11:31]:
 On Sat, Jan 16, 2010 at 11:18:20AM -0800, Tony Lindgren wrote:
  * Russell King - ARM Linux li...@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
--
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