* [PATCH 0/6] OMAP/Davinci debug UART code cleanup
@ 2011-09-02 2:59 Nicolas Pitre
2011-09-02 2:59 ` [PATCH 1/6] ARM: add an extra temp register to the addruart low level debugging macro Nicolas Pitre
` (5 more replies)
0 siblings, 6 replies; 17+ messages in thread
From: Nicolas Pitre @ 2011-09-02 2:59 UTC (permalink / raw)
To: linux-arm-kernel
Let's remove some of the most offending parts of this code.
[PATCH 1/6] ARM: add an extra temp register to the addruart low level debugging macro
[PATCH 2/6] ARM: plat-omap: make OMAP_UART_INFO into a relative offset
[PATCH 3/6] ARM: mach-omap1: clean up debug-macro.S
[PATCH 4/6] ARM: mach-omap2: clean up debug-macro.S
[PATCH 5/6] ARM: mach-davinci: make DAVINCI_UART_INFO into a relative offset
[PATCH 6/6] ARM: mach-davinci: clean up debug-macro.S
Nicolas
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/6] ARM: add an extra temp register to the addruart low level debugging macro
2011-09-02 2:59 [PATCH 0/6] OMAP/Davinci debug UART code cleanup Nicolas Pitre
@ 2011-09-02 2:59 ` Nicolas Pitre
2011-09-02 2:59 ` [PATCH 2/6] ARM: plat-omap: make OMAP_UART_INFO into a relative offset Nicolas Pitre
` (4 subsequent siblings)
5 siblings, 0 replies; 17+ messages in thread
From: Nicolas Pitre @ 2011-09-02 2:59 UTC (permalink / raw)
To: linux-arm-kernel
Some platforms (like OMAP not to name it) are doing rather complicated
hacks just to determine the base UART address to use. Let's give the
addruart macro some slack by providing an extra work register which will
allow for further cleanups.
This is basically a no-op as this commit is only adding the extra argument
to the macro but no one is using it yet.
Signed-off-by: nicolas Pitre <nicolas.pitre@linaro.org>
---
arch/arm/kernel/debug.S | 2 +-
arch/arm/kernel/head.S | 2 +-
arch/arm/mach-at91/include/mach/debug-macro.S | 2 +-
arch/arm/mach-clps711x/include/mach/debug-macro.S | 2 +-
arch/arm/mach-cns3xxx/include/mach/debug-macro.S | 2 +-
arch/arm/mach-davinci/include/mach/debug-macro.S | 2 +-
arch/arm/mach-dove/include/mach/debug-macro.S | 2 +-
arch/arm/mach-ebsa110/include/mach/debug-macro.S | 2 +-
arch/arm/mach-ep93xx/include/mach/debug-macro.S | 2 +-
arch/arm/mach-exynos4/include/mach/debug-macro.S | 2 +-
| 4 ++--
arch/arm/mach-gemini/include/mach/debug-macro.S | 2 +-
arch/arm/mach-h720x/include/mach/debug-macro.S | 2 +-
.../arm/mach-integrator/include/mach/debug-macro.S | 2 +-
arch/arm/mach-iop13xx/include/mach/debug-macro.S | 2 +-
arch/arm/mach-iop32x/include/mach/debug-macro.S | 2 +-
arch/arm/mach-iop33x/include/mach/debug-macro.S | 2 +-
arch/arm/mach-ixp2000/include/mach/debug-macro.S | 2 +-
arch/arm/mach-ixp23xx/include/mach/debug-macro.S | 2 +-
arch/arm/mach-ixp4xx/include/mach/debug-macro.S | 2 +-
arch/arm/mach-kirkwood/include/mach/debug-macro.S | 2 +-
arch/arm/mach-ks8695/include/mach/debug-macro.S | 2 +-
arch/arm/mach-l7200/include/mach/debug-macro.S | 2 +-
arch/arm/mach-lpc32xx/include/mach/debug-macro.S | 2 +-
arch/arm/mach-mmp/include/mach/debug-macro.S | 2 +-
arch/arm/mach-msm/include/mach/debug-macro.S | 4 ++--
arch/arm/mach-mv78xx0/include/mach/debug-macro.S | 2 +-
arch/arm/mach-mxs/include/mach/debug-macro.S | 2 +-
arch/arm/mach-netx/include/mach/debug-macro.S | 2 +-
arch/arm/mach-nomadik/include/mach/debug-macro.S | 2 +-
arch/arm/mach-omap1/include/mach/debug-macro.S | 2 +-
arch/arm/mach-omap2/include/mach/debug-macro.S | 2 +-
arch/arm/mach-orion5x/include/mach/debug-macro.S | 2 +-
arch/arm/mach-pnx4008/include/mach/debug-macro.S | 2 +-
arch/arm/mach-prima2/include/mach/debug-macro.S | 2 +-
arch/arm/mach-pxa/include/mach/debug-macro.S | 2 +-
arch/arm/mach-realview/include/mach/debug-macro.S | 2 +-
arch/arm/mach-rpc/include/mach/debug-macro.S | 2 +-
arch/arm/mach-s3c2410/include/mach/debug-macro.S | 2 +-
arch/arm/mach-s3c64xx/include/mach/debug-macro.S | 2 +-
arch/arm/mach-s5p64x0/include/mach/debug-macro.S | 2 +-
arch/arm/mach-s5pc100/include/mach/debug-macro.S | 2 +-
arch/arm/mach-s5pv210/include/mach/debug-macro.S | 2 +-
arch/arm/mach-sa1100/include/mach/debug-macro.S | 2 +-
arch/arm/mach-shark/include/mach/debug-macro.S | 2 +-
arch/arm/mach-tegra/include/mach/debug-macro.S | 2 +-
arch/arm/mach-u300/include/mach/debug-macro.S | 2 +-
arch/arm/mach-ux500/include/mach/debug-macro.S | 2 +-
arch/arm/mach-versatile/include/mach/debug-macro.S | 2 +-
arch/arm/mach-vexpress/include/mach/debug-macro.S | 2 +-
arch/arm/mach-vt8500/include/mach/debug-macro.S | 2 +-
arch/arm/mach-zynq/include/mach/debug-macro.S | 2 +-
arch/arm/plat-mxc/include/mach/debug-macro.S | 2 +-
arch/arm/plat-spear/include/plat/debug-macro.S | 2 +-
arch/arm/plat-tcc/include/mach/debug-macro.S | 2 +-
55 files changed, 57 insertions(+), 57 deletions(-)
diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S
index bcd66e0..dd962ed 100644
--- a/arch/arm/kernel/debug.S
+++ b/arch/arm/kernel/debug.S
@@ -106,7 +106,7 @@
#ifdef CONFIG_MMU
.macro addruart_current, rx, tmp1, tmp2
- addruart \tmp1, \tmp2
+ addruart \tmp1, \tmp2, \rx
mrc p15, 0, \rx, c1, c0
tst \rx, #1
moveq \rx, \tmp1
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 136abb6..7408fd5 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -234,7 +234,7 @@ __create_page_tables:
* This allows debug messages to be output
* via a serial console before paging_init.
*/
- addruart r7, r3
+ addruart r7, r3, r0
mov r3, r3, lsr #20
mov r3, r3, lsl #2
diff --git a/arch/arm/mach-at91/include/mach/debug-macro.S b/arch/arm/mach-at91/include/mach/debug-macro.S
index bc1e0b2..0ed8648 100644
--- a/arch/arm/mach-at91/include/mach/debug-macro.S
+++ b/arch/arm/mach-at91/include/mach/debug-macro.S
@@ -14,7 +14,7 @@
#include <mach/hardware.h>
#include <mach/at91_dbgu.h>
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, =(AT91_BASE_SYS + AT91_DBGU) @ System peripherals (phys address)
ldr \rv, =(AT91_VA_BASE_SYS + AT91_DBGU) @ System peripherals (virt address)
.endm
diff --git a/arch/arm/mach-clps711x/include/mach/debug-macro.S b/arch/arm/mach-clps711x/include/mach/debug-macro.S
index 507c687..b802e8a 100644
--- a/arch/arm/mach-clps711x/include/mach/debug-macro.S
+++ b/arch/arm/mach-clps711x/include/mach/debug-macro.S
@@ -14,7 +14,7 @@
#include <mach/hardware.h>
#include <asm/hardware/clps7111.h>
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
#ifndef CONFIG_DEBUG_CLPS711X_UART2
mov \rp, #0x0000 @ UART1
#else
diff --git a/arch/arm/mach-cns3xxx/include/mach/debug-macro.S b/arch/arm/mach-cns3xxx/include/mach/debug-macro.S
index 56d8286..d04c150 100644
--- a/arch/arm/mach-cns3xxx/include/mach/debug-macro.S
+++ b/arch/arm/mach-cns3xxx/include/mach/debug-macro.S
@@ -10,7 +10,7 @@
* published by the Free Software Foundation.
*/
- .macro addruart,rp,rv
+ .macro addruart,rp,rv,tmp
mov \rp, #0x00009000
orr \rv, \rp, #0xf0000000 @ virtual base
orr \rp, \rp, #0x10000000
diff --git a/arch/arm/mach-davinci/include/mach/debug-macro.S b/arch/arm/mach-davinci/include/mach/debug-macro.S
index f8b7ea4..3cf4c1b 100644
--- a/arch/arm/mach-davinci/include/mach/debug-macro.S
+++ b/arch/arm/mach-davinci/include/mach/debug-macro.S
@@ -32,7 +32,7 @@ davinci_uart_phys: .word 0
davinci_uart_virt: .word 0
.popsection
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
/* Use davinci_uart_phys/virt if already configured */
10: mrc p15, 0, \rp, c1, c0
diff --git a/arch/arm/mach-dove/include/mach/debug-macro.S b/arch/arm/mach-dove/include/mach/debug-macro.S
index da8bf2b..5929cbc 100644
--- a/arch/arm/mach-dove/include/mach/debug-macro.S
+++ b/arch/arm/mach-dove/include/mach/debug-macro.S
@@ -8,7 +8,7 @@
#include <mach/bridge-regs.h>
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, =DOVE_SB_REGS_PHYS_BASE
ldr \rv, =DOVE_SB_REGS_VIRT_BASE
orr \rp, \rp, #0x00012000
diff --git a/arch/arm/mach-ebsa110/include/mach/debug-macro.S b/arch/arm/mach-ebsa110/include/mach/debug-macro.S
index 7ef5690..bb02c05 100644
--- a/arch/arm/mach-ebsa110/include/mach/debug-macro.S
+++ b/arch/arm/mach-ebsa110/include/mach/debug-macro.S
@@ -11,7 +11,7 @@
*
**/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #0xf0000000
orr \rp, \rp, #0x00000be0
mov \rp, \rv
diff --git a/arch/arm/mach-ep93xx/include/mach/debug-macro.S b/arch/arm/mach-ep93xx/include/mach/debug-macro.S
index b25bc907..af54e43 100644
--- a/arch/arm/mach-ep93xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-ep93xx/include/mach/debug-macro.S
@@ -11,7 +11,7 @@
*/
#include <mach/ep93xx-regs.h>
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, =EP93XX_APB_PHYS_BASE @ Physical base
ldr \rv, =EP93XX_APB_VIRT_BASE @ virtual base
orr \rp, \rp, #0x000c0000
diff --git a/arch/arm/mach-exynos4/include/mach/debug-macro.S b/arch/arm/mach-exynos4/include/mach/debug-macro.S
index a442ef8..6cacf16 100644
--- a/arch/arm/mach-exynos4/include/mach/debug-macro.S
+++ b/arch/arm/mach-exynos4/include/mach/debug-macro.S
@@ -20,7 +20,7 @@
* aligned and add in the offset when we load the value here.
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, = S3C_PA_UART
ldr \rv, = S3C_VA_UART
#if CONFIG_DEBUG_S3C_UART != 0
--git a/arch/arm/mach-footbridge/include/mach/debug-macro.S b/arch/arm/mach-footbridge/include/mach/debug-macro.S
index 1be2eeb..e5acde2 100644
--- a/arch/arm/mach-footbridge/include/mach/debug-macro.S
+++ b/arch/arm/mach-footbridge/include/mach/debug-macro.S
@@ -15,7 +15,7 @@
#ifndef CONFIG_DEBUG_DC21285_PORT
/* For NetWinder debugging */
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #0x000003f8
orr \rv, \rp, #0xff000000 @ virtual
orr \rp, \rp, #0x7c000000 @ physical
@@ -31,7 +31,7 @@
.equ dc21285_high, ARMCSR_BASE & 0xff000000
.equ dc21285_low, ARMCSR_BASE & 0x00ffffff
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
.if dc21285_low
mov \rp, #dc21285_low
.else
diff --git a/arch/arm/mach-gemini/include/mach/debug-macro.S b/arch/arm/mach-gemini/include/mach/debug-macro.S
index f40e006..8376707 100644
--- a/arch/arm/mach-gemini/include/mach/debug-macro.S
+++ b/arch/arm/mach-gemini/include/mach/debug-macro.S
@@ -11,7 +11,7 @@
*/
#include <mach/hardware.h>
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, =GEMINI_UART_BASE @ physical
ldr \rv, =IO_ADDRESS(GEMINI_UART_BASE) @ virtual
.endm
diff --git a/arch/arm/mach-h720x/include/mach/debug-macro.S b/arch/arm/mach-h720x/include/mach/debug-macro.S
index c2093e8..8a46157 100644
--- a/arch/arm/mach-h720x/include/mach/debug-macro.S
+++ b/arch/arm/mach-h720x/include/mach/debug-macro.S
@@ -16,7 +16,7 @@
.equ io_virt, IO_VIRT
.equ io_phys, IO_PHYS
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #0x00020000 @ UART1
add \rv, \rp, #io_virt @ virtual address
add \rp, \rp, #io_phys @ physical base address
diff --git a/arch/arm/mach-integrator/include/mach/debug-macro.S b/arch/arm/mach-integrator/include/mach/debug-macro.S
index a1f598f..411b116 100644
--- a/arch/arm/mach-integrator/include/mach/debug-macro.S
+++ b/arch/arm/mach-integrator/include/mach/debug-macro.S
@@ -11,7 +11,7 @@
*
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #0x16000000 @ physical base address
mov \rv, #0xf0000000 @ virtual base
add \rv, \rv, #0x16000000 >> 4
diff --git a/arch/arm/mach-iop13xx/include/mach/debug-macro.S b/arch/arm/mach-iop13xx/include/mach/debug-macro.S
index e664466..d869a6f 100644
--- a/arch/arm/mach-iop13xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-iop13xx/include/mach/debug-macro.S
@@ -11,7 +11,7 @@
* published by the Free Software Foundation.
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #0x00002300
orr \rp, \rp, #0x00000040
orr \rv, \rp, #0xfe000000 @ virtual
diff --git a/arch/arm/mach-iop32x/include/mach/debug-macro.S b/arch/arm/mach-iop32x/include/mach/debug-macro.S
index ff9e76c..363bdf9 100644
--- a/arch/arm/mach-iop32x/include/mach/debug-macro.S
+++ b/arch/arm/mach-iop32x/include/mach/debug-macro.S
@@ -11,7 +11,7 @@
* published by the Free Software Foundation.
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #0xfe000000 @ physical as well as virtual
orr \rp, \rp, #0x00800000 @ location of the UART
mov \rv, \rp
diff --git a/arch/arm/mach-iop33x/include/mach/debug-macro.S b/arch/arm/mach-iop33x/include/mach/debug-macro.S
index 40c500d..361be1f 100644
--- a/arch/arm/mach-iop33x/include/mach/debug-macro.S
+++ b/arch/arm/mach-iop33x/include/mach/debug-macro.S
@@ -11,7 +11,7 @@
* published by the Free Software Foundation.
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #0x00ff0000
orr \rp, \rp, #0x0000f700
orr \rv, #0xfe000000 @ virtual
diff --git a/arch/arm/mach-ixp2000/include/mach/debug-macro.S b/arch/arm/mach-ixp2000/include/mach/debug-macro.S
index 0ef533b..bdd3ccd 100644
--- a/arch/arm/mach-ixp2000/include/mach/debug-macro.S
+++ b/arch/arm/mach-ixp2000/include/mach/debug-macro.S
@@ -11,7 +11,7 @@
*
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #0x00030000
#ifdef __ARMEB__
orr \rp, \rp, #0x00000003
diff --git a/arch/arm/mach-ixp23xx/include/mach/debug-macro.S b/arch/arm/mach-ixp23xx/include/mach/debug-macro.S
index f7c6eef..5ff524c 100644
--- a/arch/arm/mach-ixp23xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-ixp23xx/include/mach/debug-macro.S
@@ -12,7 +12,7 @@
*/
#include <mach/ixp23xx.h>
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, =IXP23XX_PERIPHERAL_PHYS @ physical
ldr \rv, =IXP23XX_PERIPHERAL_VIRT @ virtual
#ifdef __ARMEB__
diff --git a/arch/arm/mach-ixp4xx/include/mach/debug-macro.S b/arch/arm/mach-ixp4xx/include/mach/debug-macro.S
index b974a49..8c9f8d5 100644
--- a/arch/arm/mach-ixp4xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-ixp4xx/include/mach/debug-macro.S
@@ -10,7 +10,7 @@
* published by the Free Software Foundation.
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
#ifdef __ARMEB__
mov \rp, #3 @ Uart regs are at off set of 3 if
@ byte writes used - Big Endian.
diff --git a/arch/arm/mach-kirkwood/include/mach/debug-macro.S b/arch/arm/mach-kirkwood/include/mach/debug-macro.S
index db06ae4..f785d40 100644
--- a/arch/arm/mach-kirkwood/include/mach/debug-macro.S
+++ b/arch/arm/mach-kirkwood/include/mach/debug-macro.S
@@ -8,7 +8,7 @@
#include <mach/bridge-regs.h>
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, =KIRKWOOD_REGS_PHYS_BASE
ldr \rv, =KIRKWOOD_REGS_VIRT_BASE
orr \rp, \rp, #0x00012000
diff --git a/arch/arm/mach-ks8695/include/mach/debug-macro.S b/arch/arm/mach-ks8695/include/mach/debug-macro.S
index bf516ad..a79e489 100644
--- a/arch/arm/mach-ks8695/include/mach/debug-macro.S
+++ b/arch/arm/mach-ks8695/include/mach/debug-macro.S
@@ -14,7 +14,7 @@
#include <mach/hardware.h>
#include <mach/regs-uart.h>
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, =KS8695_UART_PA @ physical base address
ldr \rv, =KS8695_UART_VA @ virtual base address
.endm
diff --git a/arch/arm/mach-l7200/include/mach/debug-macro.S b/arch/arm/mach-l7200/include/mach/debug-macro.S
index b0a2db7..0b4e760 100644
--- a/arch/arm/mach-l7200/include/mach/debug-macro.S
+++ b/arch/arm/mach-l7200/include/mach/debug-macro.S
@@ -14,7 +14,7 @@
.equ io_virt, IO_BASE
.equ io_phys, IO_START
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #0x00044000 @ UART1
@ mov \rp, #0x00045000 @ UART2
add \rv, \rp, #io_virt @ virtual address
diff --git a/arch/arm/mach-lpc32xx/include/mach/debug-macro.S b/arch/arm/mach-lpc32xx/include/mach/debug-macro.S
index 629e744..351bd6c 100644
--- a/arch/arm/mach-lpc32xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-lpc32xx/include/mach/debug-macro.S
@@ -20,7 +20,7 @@
* Debug output is hardcoded to standard UART 5
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldreq \rp, =0x40090000
ldrne \rv, =0xF4090000
.endm
diff --git a/arch/arm/mach-mmp/include/mach/debug-macro.S b/arch/arm/mach-mmp/include/mach/debug-macro.S
index 7e2ebd3..b6f14d2 100644
--- a/arch/arm/mach-mmp/include/mach/debug-macro.S
+++ b/arch/arm/mach-mmp/include/mach/debug-macro.S
@@ -11,7 +11,7 @@
#include <mach/addr-map.h>
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, =APB_PHYS_BASE @ physical
ldr \rv, =APB_VIRT_BASE @ virtual
orr \rp, \rp, #0x00017000
diff --git a/arch/arm/mach-msm/include/mach/debug-macro.S b/arch/arm/mach-msm/include/mach/debug-macro.S
index 646b99e..2dc73cc 100644
--- a/arch/arm/mach-msm/include/mach/debug-macro.S
+++ b/arch/arm/mach-msm/include/mach/debug-macro.S
@@ -20,7 +20,7 @@
#include <mach/msm_iomap.h>
#if defined(CONFIG_HAS_MSM_DEBUG_UART_PHYS) && !defined(CONFIG_MSM_DEBUG_UART_NONE)
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, =MSM_DEBUG_UART_PHYS
ldr \rv, =MSM_DEBUG_UART_BASE
.endm
@@ -37,7 +37,7 @@
beq 1001b
.endm
#else
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rv, #0xff000000
orr \rv, \rv, #0x00f00000
.endm
diff --git a/arch/arm/mach-mv78xx0/include/mach/debug-macro.S b/arch/arm/mach-mv78xx0/include/mach/debug-macro.S
index 0489142..a7df02b 100644
--- a/arch/arm/mach-mv78xx0/include/mach/debug-macro.S
+++ b/arch/arm/mach-mv78xx0/include/mach/debug-macro.S
@@ -8,7 +8,7 @@
#include <mach/mv78xx0.h>
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, =MV78XX0_REGS_PHYS_BASE
ldr \rv, =MV78XX0_REGS_VIRT_BASE
orr \rp, \rp, #0x00012000
diff --git a/arch/arm/mach-mxs/include/mach/debug-macro.S b/arch/arm/mach-mxs/include/mach/debug-macro.S
index 79650a1..714570d 100644
--- a/arch/arm/mach-mxs/include/mach/debug-macro.S
+++ b/arch/arm/mach-mxs/include/mach/debug-macro.S
@@ -30,7 +30,7 @@
#define UART_VADDR MXS_IO_ADDRESS(UART_PADDR)
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, =UART_PADDR @ physical
ldr \rv, =UART_VADDR @ virtual
.endm
diff --git a/arch/arm/mach-netx/include/mach/debug-macro.S b/arch/arm/mach-netx/include/mach/debug-macro.S
index 56a9152..247781e 100644
--- a/arch/arm/mach-netx/include/mach/debug-macro.S
+++ b/arch/arm/mach-netx/include/mach/debug-macro.S
@@ -13,7 +13,7 @@
#include "hardware.h"
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #0x00000a00
orr \rv, \rp, #io_p2v(0x00100000) @ virtual
orr \rp, \rp, #0x00100000 @ physical
diff --git a/arch/arm/mach-nomadik/include/mach/debug-macro.S b/arch/arm/mach-nomadik/include/mach/debug-macro.S
index e7151b4..73541792 100644
--- a/arch/arm/mach-nomadik/include/mach/debug-macro.S
+++ b/arch/arm/mach-nomadik/include/mach/debug-macro.S
@@ -10,7 +10,7 @@
*
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #0x00100000
add \rp, \rp, #0x000fb000
add \rv, \rp, #0xf0000000 @ virtual base
diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
index 6285604..f944ae8 100644
--- a/arch/arm/mach-omap1/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -31,7 +31,7 @@ omap_uart_virt: .word 0x0
* the desired UART phys and virt addresses temporarily into
* the omap_uart_phys and omap_uart_virt above.
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
/* Use omap_uart_phys/virt if already configured */
9: mrc p15, 0, \rp, c1, c0
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S
index 48adfe9..fbd23ec 100644
--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -34,7 +34,7 @@ omap_uart_lsr: .word 0
* the desired UART phys and virt addresses temporarily into
* the omap_uart_phys and omap_uart_virt above.
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
/* Use omap_uart_phys/virt if already configured */
10: mrc p15, 0, \rp, c1, c0
diff --git a/arch/arm/mach-orion5x/include/mach/debug-macro.S b/arch/arm/mach-orion5x/include/mach/debug-macro.S
index 5e3bf5b..f340ed8 100644
--- a/arch/arm/mach-orion5x/include/mach/debug-macro.S
+++ b/arch/arm/mach-orion5x/include/mach/debug-macro.S
@@ -10,7 +10,7 @@
#include <mach/orion5x.h>
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, =ORION5X_REGS_PHYS_BASE
ldr \rv, =ORION5X_REGS_VIRT_BASE
orr \rp, \rp, #0x00012000
diff --git a/arch/arm/mach-pnx4008/include/mach/debug-macro.S b/arch/arm/mach-pnx4008/include/mach/debug-macro.S
index 931afeb..469d60d 100644
--- a/arch/arm/mach-pnx4008/include/mach/debug-macro.S
+++ b/arch/arm/mach-pnx4008/include/mach/debug-macro.S
@@ -11,7 +11,7 @@
*
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #0x00090000
add \rv, \rp, #0xf4000000 @ virtual
add \rp, \rp, #0x40000000 @ physical
diff --git a/arch/arm/mach-prima2/include/mach/debug-macro.S b/arch/arm/mach-prima2/include/mach/debug-macro.S
index bf75106..cd97492 100644
--- a/arch/arm/mach-prima2/include/mach/debug-macro.S
+++ b/arch/arm/mach-prima2/include/mach/debug-macro.S
@@ -9,7 +9,7 @@
#include <mach/hardware.h>
#include <mach/uart.h>
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, =SIRFSOC_UART1_PA_BASE @ physical
ldr \rv, =SIRFSOC_UART1_VA_BASE @ virtual
.endm
diff --git a/arch/arm/mach-pxa/include/mach/debug-macro.S b/arch/arm/mach-pxa/include/mach/debug-macro.S
index 7d5c751..70b112e 100644
--- a/arch/arm/mach-pxa/include/mach/debug-macro.S
+++ b/arch/arm/mach-pxa/include/mach/debug-macro.S
@@ -13,7 +13,7 @@
#include "hardware.h"
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #0x00100000
orr \rv, \rp, #io_p2v(0x40000000) @ virtual
orr \rp, \rp, #0x40000000 @ physical
diff --git a/arch/arm/mach-realview/include/mach/debug-macro.S b/arch/arm/mach-realview/include/mach/debug-macro.S
index 90b687c..fb4901c 100644
--- a/arch/arm/mach-realview/include/mach/debug-macro.S
+++ b/arch/arm/mach-realview/include/mach/debug-macro.S
@@ -33,7 +33,7 @@
#error "Unknown RealView platform"
#endif
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #DEBUG_LL_UART_OFFSET
orr \rv, \rp, #0xfb000000 @ virtual base
orr \rp, \rp, #0x10000000 @ physical base
diff --git a/arch/arm/mach-rpc/include/mach/debug-macro.S b/arch/arm/mach-rpc/include/mach/debug-macro.S
index 85effff..6d28cc9 100644
--- a/arch/arm/mach-rpc/include/mach/debug-macro.S
+++ b/arch/arm/mach-rpc/include/mach/debug-macro.S
@@ -11,7 +11,7 @@
*
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #0x00010000
orr \rp, \rp, #0x00000fe0
orr \rv, \rp, #0xe0000000 @ virtual
diff --git a/arch/arm/mach-s3c2410/include/mach/debug-macro.S b/arch/arm/mach-s3c2410/include/mach/debug-macro.S
index 5882dea..4135de8 100644
--- a/arch/arm/mach-s3c2410/include/mach/debug-macro.S
+++ b/arch/arm/mach-s3c2410/include/mach/debug-macro.S
@@ -19,7 +19,7 @@
#define S3C2410_UART1_OFF (0x4000)
#define SHIFT_2440TXF (14-9)
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, = S3C24XX_PA_UART
ldr \rv, = S3C24XX_VA_UART
#if CONFIG_DEBUG_S3C_UART != 0
diff --git a/arch/arm/mach-s3c64xx/include/mach/debug-macro.S b/arch/arm/mach-s3c64xx/include/mach/debug-macro.S
index a29e705..c0c076a 100644
--- a/arch/arm/mach-s3c64xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-s3c64xx/include/mach/debug-macro.S
@@ -21,7 +21,7 @@
* aligned and add in the offset when we load the value here.
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, = S3C_PA_UART
ldr \rv, = (S3C_VA_UART + S3C_PA_UART & 0xfffff)
#if CONFIG_DEBUG_S3C_UART != 0
diff --git a/arch/arm/mach-s5p64x0/include/mach/debug-macro.S b/arch/arm/mach-s5p64x0/include/mach/debug-macro.S
index 79b04e6..e80ba3c 100644
--- a/arch/arm/mach-s5p64x0/include/mach/debug-macro.S
+++ b/arch/arm/mach-s5p64x0/include/mach/debug-macro.S
@@ -15,7 +15,7 @@
#include <plat/regs-serial.h>
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #0xE0000000
orr \rp, \rp, #0x00100000
ldr \rp, [\rp, #0x118 ]
diff --git a/arch/arm/mach-s5pc100/include/mach/debug-macro.S b/arch/arm/mach-s5pc100/include/mach/debug-macro.S
index b2ba95d..694f759 100644
--- a/arch/arm/mach-s5pc100/include/mach/debug-macro.S
+++ b/arch/arm/mach-s5pc100/include/mach/debug-macro.S
@@ -22,7 +22,7 @@
* aligned and add in the offset when we load the value here.
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, = S3C_PA_UART
ldr \rv, = S3C_VA_UART
#if CONFIG_DEBUG_S3C_UART != 0
diff --git a/arch/arm/mach-s5pv210/include/mach/debug-macro.S b/arch/arm/mach-s5pv210/include/mach/debug-macro.S
index 169fe65..79e5559 100644
--- a/arch/arm/mach-s5pv210/include/mach/debug-macro.S
+++ b/arch/arm/mach-s5pv210/include/mach/debug-macro.S
@@ -21,7 +21,7 @@
* aligned and add in the offset when we load the value here.
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, = S3C_PA_UART
ldr \rv, = S3C_VA_UART
#if CONFIG_DEBUG_S3C_UART != 0
diff --git a/arch/arm/mach-sa1100/include/mach/debug-macro.S b/arch/arm/mach-sa1100/include/mach/debug-macro.S
index 0cd0fc9..530772d 100644
--- a/arch/arm/mach-sa1100/include/mach/debug-macro.S
+++ b/arch/arm/mach-sa1100/include/mach/debug-macro.S
@@ -12,7 +12,7 @@
*/
#include <mach/hardware.h>
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mrc p15, 0, \rp, c1, c0
tst \rp, #1 @ MMU enabled?
moveq \rp, #0x80000000 @ physical base address
diff --git a/arch/arm/mach-shark/include/mach/debug-macro.S b/arch/arm/mach-shark/include/mach/debug-macro.S
index a473f55..20eb2bf 100644
--- a/arch/arm/mach-shark/include/mach/debug-macro.S
+++ b/arch/arm/mach-shark/include/mach/debug-macro.S
@@ -11,7 +11,7 @@
*
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #0xe0000000
orr \rp, \rp, #0x000003f8
mov \rv, \rp
diff --git a/arch/arm/mach-tegra/include/mach/debug-macro.S b/arch/arm/mach-tegra/include/mach/debug-macro.S
index e0ebe65..619abc6 100644
--- a/arch/arm/mach-tegra/include/mach/debug-macro.S
+++ b/arch/arm/mach-tegra/include/mach/debug-macro.S
@@ -21,7 +21,7 @@
#include <mach/io.h>
#include <mach/iomap.h>
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, =IO_APB_PHYS @ physical
ldr \rv, =IO_APB_VIRT @ virtual
orr \rp, \rp, #(TEGRA_DEBUG_UART_BASE & 0xFF)
diff --git a/arch/arm/mach-u300/include/mach/debug-macro.S b/arch/arm/mach-u300/include/mach/debug-macro.S
index df71570..8ae8e4a 100644
--- a/arch/arm/mach-u300/include/mach/debug-macro.S
+++ b/arch/arm/mach-u300/include/mach/debug-macro.S
@@ -10,7 +10,7 @@
*/
#include <mach/hardware.h>
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
/* If we move the address using MMU, use this. */
ldr \rp, = U300_SLOW_PER_PHYS_BASE @ MMU off, physical address
ldr \rv, = U300_SLOW_PER_VIRT_BASE @ MMU on, virtual address
diff --git a/arch/arm/mach-ux500/include/mach/debug-macro.S b/arch/arm/mach-ux500/include/mach/debug-macro.S
index 700fb05..8d74d92 100644
--- a/arch/arm/mach-ux500/include/mach/debug-macro.S
+++ b/arch/arm/mach-ux500/include/mach/debug-macro.S
@@ -35,7 +35,7 @@
#define UX500_UART(n) __UX500_UART(n)
#define UART_BASE UX500_UART(CONFIG_UX500_DEBUG_UART)
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, =UART_BASE @ no, physical address
ldr \rv, =IO_ADDRESS(UART_BASE) @ yes, virtual address
.endm
diff --git a/arch/arm/mach-versatile/include/mach/debug-macro.S b/arch/arm/mach-versatile/include/mach/debug-macro.S
index eb2cf7d..d0fbd7f 100644
--- a/arch/arm/mach-versatile/include/mach/debug-macro.S
+++ b/arch/arm/mach-versatile/include/mach/debug-macro.S
@@ -11,7 +11,7 @@
*
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #0x001F0000
orr \rp, \rp, #0x00001000
orr \rv, \rp, #0xf1000000 @ virtual base
diff --git a/arch/arm/mach-vexpress/include/mach/debug-macro.S b/arch/arm/mach-vexpress/include/mach/debug-macro.S
index 050d65e..fd9e6c7 100644
--- a/arch/arm/mach-vexpress/include/mach/debug-macro.S
+++ b/arch/arm/mach-vexpress/include/mach/debug-macro.S
@@ -12,7 +12,7 @@
#define DEBUG_LL_UART_OFFSET 0x00009000
- .macro addruart,rp,rv
+ .macro addruart,rp,rv,tmp
mov \rp, #DEBUG_LL_UART_OFFSET
orr \rv, \rp, #0xf8000000 @ virtual base
orr \rp, \rp, #0x10000000 @ physical base
diff --git a/arch/arm/mach-vt8500/include/mach/debug-macro.S b/arch/arm/mach-vt8500/include/mach/debug-macro.S
index f119162..ca292f2 100644
--- a/arch/arm/mach-vt8500/include/mach/debug-macro.S
+++ b/arch/arm/mach-vt8500/include/mach/debug-macro.S
@@ -11,7 +11,7 @@
*
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #0x00200000
orr \rv, \rp, #0xf8000000
orr \rp, \rp, #0xd8000000
diff --git a/arch/arm/mach-zynq/include/mach/debug-macro.S b/arch/arm/mach-zynq/include/mach/debug-macro.S
index 9f664d5..3ab0be1 100644
--- a/arch/arm/mach-zynq/include/mach/debug-macro.S
+++ b/arch/arm/mach-zynq/include/mach/debug-macro.S
@@ -17,7 +17,7 @@
#include <mach/zynq_soc.h>
#include <mach/uart.h>
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, =LL_UART_PADDR @ physical
ldr \rv, =LL_UART_VADDR @ virtual
.endm
diff --git a/arch/arm/plat-mxc/include/mach/debug-macro.S b/arch/arm/plat-mxc/include/mach/debug-macro.S
index e4dde91..a304593 100644
--- a/arch/arm/plat-mxc/include/mach/debug-macro.S
+++ b/arch/arm/plat-mxc/include/mach/debug-macro.S
@@ -54,7 +54,7 @@
#define UART_VADDR IMX_IO_ADDRESS(UART_PADDR)
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
ldr \rp, =UART_PADDR @ physical
ldr \rv, =UART_VADDR @ virtual
.endm
diff --git a/arch/arm/plat-spear/include/plat/debug-macro.S b/arch/arm/plat-spear/include/plat/debug-macro.S
index 8501bbf..02b160a 100644
--- a/arch/arm/plat-spear/include/plat/debug-macro.S
+++ b/arch/arm/plat-spear/include/plat/debug-macro.S
@@ -14,7 +14,7 @@
#include <linux/amba/serial.h>
#include <mach/hardware.h>
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
mov \rp, #SPEAR_DBG_UART_BASE @ Physical base
mov \rv, #VA_SPEAR_DBG_UART_BASE @ Virtual base
.endm
diff --git a/arch/arm/plat-tcc/include/mach/debug-macro.S b/arch/arm/plat-tcc/include/mach/debug-macro.S
index 7662f73..cf17d04 100644
--- a/arch/arm/plat-tcc/include/mach/debug-macro.S
+++ b/arch/arm/plat-tcc/include/mach/debug-macro.S
@@ -9,7 +9,7 @@
*
*/
- .macro addruart, rp, rv
+ .macro addruart, rp, rv, tmp
moveq \rp, #0x90000000 @ physical base address
movne \rv, #0xF1000000 @ virtual base
orr \rp, \rp, #0x00007000 @ UART0
--
1.7.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/6] ARM: plat-omap: make OMAP_UART_INFO into a relative offset
2011-09-02 2:59 [PATCH 0/6] OMAP/Davinci debug UART code cleanup Nicolas Pitre
2011-09-02 2:59 ` [PATCH 1/6] ARM: add an extra temp register to the addruart low level debugging macro Nicolas Pitre
@ 2011-09-02 2:59 ` Nicolas Pitre
2011-09-05 9:44 ` Tony Lindgren
2011-09-05 9:46 ` [PATCH 2.5/6] ARM: omap: prepare debug-macro.S for offset based calculation of omap_uart_phys and virt Tony Lindgren
2011-09-02 2:59 ` [PATCH 3/6] ARM: mach-omap1: clean up debug-macro.S Nicolas Pitre
` (3 subsequent siblings)
5 siblings, 2 replies; 17+ messages in thread
From: Nicolas Pitre @ 2011-09-02 2:59 UTC (permalink / raw)
To: linux-arm-kernel
This is the first step to remove PLAT_PHYS_OFFSET usage from the debug
UART code.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
arch/arm/mach-omap1/include/mach/debug-macro.S | 8 +++-----
arch/arm/mach-omap2/include/mach/debug-macro.S | 9 ++++-----
arch/arm/plat-omap/include/plat/serial.h | 6 +++---
arch/arm/plat-omap/include/plat/uncompress.h | 8 +++++++-
4 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
index f944ae8..6a17118 100644
--- a/arch/arm/mach-omap1/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -46,11 +46,9 @@ omap_uart_virt: .word 0x0
bne 99f @ already configured
/* Check the debug UART configuration set in uncompress.h */
- mrc p15, 0, \rp, c1, c0
- tst \rp, #1 @ MMU enabled?
- ldreq \rp, =OMAP_UART_INFO @ MMU not enabled
- ldrne \rp, =omap_uart_p2v(OMAP_UART_INFO) @ MMU enabled
- ldr \rp, [\rp, #0]
+ and \rp, pc, #0xff000000
+ ldr \rv, =OMAP_UART_INFO_OFS
+ ldr \rp, [\rp, \rv]
/* Select the UART to use based on the UART1 scratchpad value */
10: cmp \rp, #0 @ no port configured?
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S
index fbd23ec..745e2ff 100644
--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -49,11 +49,10 @@ omap_uart_lsr: .word 0
bne 99f @ already configured
/* Check the debug UART configuration set in uncompress.h */
- mrc p15, 0, \rp, c1, c0
- tst \rp, #1 @ MMU enabled?
- ldreq \rp, =OMAP_UART_INFO @ MMU not enabled
- ldrne \rp, =omap_uart_p2v(OMAP_UART_INFO) @ MMU enabled
- ldr \rp, [\rp, #0]
+ mov \rp, pc
+ ldr \rv, =OMAP_UART_INFO_OFS
+ and \rp, \rp, #0xff000000
+ ldr \rp, [\rp, \rv]
/* Select the UART to use based on the UART1 scratchpad value */
cmp \rp, #0 @ no port configured?
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h
index de3b10c..1ab9fd6 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/plat-omap/include/plat/serial.h
@@ -16,8 +16,8 @@
#include <linux/init.h>
/*
- * Memory entry used for the DEBUG_LL UART configuration. See also
- * uncompress.h and debug-macro.S.
+ * Memory entry used for the DEBUG_LL UART configuration, relative to
+ * start of RAM. See also uncompress.h and debug-macro.S.
*
* Note that using a memory location for storing the UART configuration
* has at least two limitations:
@@ -27,7 +27,7 @@
* 2. We assume printascii is called at least once before paging_init,
* and addruart has a chance to read OMAP_UART_INFO
*/
-#define OMAP_UART_INFO (PLAT_PHYS_OFFSET + 0x3ffc)
+#define OMAP_UART_INFO_OFS 0x3ffc
/* OMAP1 serial ports */
#define OMAP1_UART1_BASE 0xfffb0000
diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
index a067484..71763db 100644
--- a/arch/arm/plat-omap/include/plat/uncompress.h
+++ b/arch/arm/plat-omap/include/plat/uncompress.h
@@ -36,7 +36,13 @@ int uart_shift;
*/
static void set_omap_uart_info(unsigned char port)
{
- *(volatile u32 *)OMAP_UART_INFO = port;
+ /*
+ * Get address of some.bss variable and round it down
+ * a la CONFIG_AUTO_ZRELADDR.
+ */
+ u32 ram_start = (u32)&uart_shift & 0xf8000000;
+ u32 *uart_info = (u32 *)(ram_start + OMAP_UART_INFO_OFS);
+ *uart_info = port;
}
static void putc(int c)
--
1.7.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 3/6] ARM: mach-omap1: clean up debug-macro.S
2011-09-02 2:59 [PATCH 0/6] OMAP/Davinci debug UART code cleanup Nicolas Pitre
2011-09-02 2:59 ` [PATCH 1/6] ARM: add an extra temp register to the addruart low level debugging macro Nicolas Pitre
2011-09-02 2:59 ` [PATCH 2/6] ARM: plat-omap: make OMAP_UART_INFO into a relative offset Nicolas Pitre
@ 2011-09-02 2:59 ` Nicolas Pitre
2011-09-05 9:49 ` Tony Lindgren
2011-09-02 2:59 ` [PATCH 4/6] ARM: mach-omap2: " Nicolas Pitre
` (2 subsequent siblings)
5 siblings, 1 reply; 17+ messages in thread
From: Nicolas Pitre @ 2011-09-02 2:59 UTC (permalink / raw)
To: linux-arm-kernel
This achieves two goals:
1) Get rid of omap_uart_v2p() and omap_uart_p2v() which were the last users
of PLAT_PHYS_OFFSET.
2) Remove the probing of the M bit in the CP15 control reg and make
the access to the .data variables completely position independent.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
arch/arm/mach-omap1/include/mach/debug-macro.S | 34 ++++++++++-------------
1 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
index 6a17118..be01b66 100644
--- a/arch/arm/mach-omap1/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -13,13 +13,8 @@
#include <linux/serial_reg.h>
-#include <asm/memory.h>
-
#include <plat/serial.h>
-#define omap_uart_v2p(x) ((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET)
-#define omap_uart_p2v(x) ((x) - PLAT_PHYS_OFFSET + PAGE_OFFSET)
-
.pushsection .data
omap_uart_phys: .word 0x0
omap_uart_virt: .word 0x0
@@ -34,13 +29,13 @@ omap_uart_virt: .word 0x0
.macro addruart, rp, rv, tmp
/* Use omap_uart_phys/virt if already configured */
-9: mrc p15, 0, \rp, c1, c0
- tst \rp, #1 @ MMU enabled?
- ldreq \rp, =omap_uart_v2p(omap_uart_phys) @ MMU disabled
- ldrne \rp, =omap_uart_phys @ MMU enabled
- add \rv, \rp, #4 @ omap_uart_virt
- ldr \rp, [\rp, #0]
- ldr \rv, [\rv, #0]
+9: adr \rp, 11f @ get effective addr of 11f
+ ldr \rv, [\rp] @ get absolute addr of 11f
+ sub \rv, \rv, \rp @ offset between the two
+ ldr \rp, [\rp, #4] @ abs addr of omap_uart_phys
+ sub \tmp, \rp, \rv @ make it effective
+ ldr \rp, [\tmp, #0] @ omap_uart_phys
+ ldr \rv, [\tmp, #4] @ omap_uart_virt
cmp \rp, #0 @ is port configured?
cmpne \rv, #0
bne 99f @ already configured
@@ -72,16 +67,17 @@ omap_uart_virt: .word 0x0
/* Store both phys and virt address for the uart */
98: add \rp, \rp, #0xff000000 @ phys base
- mrc p15, 0, \rv, c1, c0
- tst \rv, #1 @ MMU enabled?
- ldreq \rv, =omap_uart_v2p(omap_uart_phys) @ MMU disabled
- ldrne \rv, =omap_uart_phys @ MMU enabled
- str \rp, [\rv, #0]
+ str \rp, [\tmp, #0] @ omap_uart_phys
sub \rp, \rp, #0xff000000 @ phys base
add \rp, \rp, #0xfe000000 @ virt base
- add \rv, \rv, #4 @ omap_uart_lsr
- str \rp, [\rv, #0]
+ str \rp, [\tmp, #4] @ omap_uart_virt
b 9b
+
+ .align
+11: .word .
+ .word omap_uart_phys
+ .ltorg
+
99:
.endm
--
1.7.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 4/6] ARM: mach-omap2: clean up debug-macro.S
2011-09-02 2:59 [PATCH 0/6] OMAP/Davinci debug UART code cleanup Nicolas Pitre
` (2 preceding siblings ...)
2011-09-02 2:59 ` [PATCH 3/6] ARM: mach-omap1: clean up debug-macro.S Nicolas Pitre
@ 2011-09-02 2:59 ` Nicolas Pitre
2011-09-05 9:51 ` Tony Lindgren
2011-09-05 15:07 ` [PATCH 4.5/6] ARM: omap: pass phys, virt and lsr from uncompress.h to debug-macro.S Tony Lindgren
2011-09-02 2:59 ` [PATCH 5/6] ARM: mach-davinci: make DAVINCI_UART_INFO into a relative offset Nicolas Pitre
2011-09-02 2:59 ` [PATCH 6/6] ARM: mach-davinci: clean up debug-macro.S Nicolas Pitre
5 siblings, 2 replies; 17+ messages in thread
From: Nicolas Pitre @ 2011-09-02 2:59 UTC (permalink / raw)
To: linux-arm-kernel
This achieves two goals:
1) Get rid of omap_uart_v2p() and omap_uart_p2v() which were the last users
of PLAT_PHYS_OFFSET.
2) Remove the probing of the M bit in the CP15 control reg and make
the access to the .data variables completely position independent.
There is a catch though: the busyuart macro needs to know where the LSR
register is which might be at a different offset depending on the hardware.
Given that this macro is given only two registers and that one of them
must be preserved, the trick is to always pass the LSR register address
around, and deduce the base address for the THR register by masking out
the LSR offset in senduart instead.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
arch/arm/mach-omap2/include/mach/debug-macro.S | 68 ++++++++++-------------
1 files changed, 30 insertions(+), 38 deletions(-)
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S
index 745e2ff..2f32abb 100644
--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -13,15 +13,10 @@
#include <linux/serial_reg.h>
-#include <asm/memory.h>
-
#include <plat/serial.h>
#define UART_OFFSET(addr) ((addr) & 0x00ffffff)
-#define omap_uart_v2p(x) ((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET)
-#define omap_uart_p2v(x) ((x) - PLAT_PHYS_OFFSET + PAGE_OFFSET)
-
.pushsection .data
omap_uart_phys: .word 0
omap_uart_virt: .word 0
@@ -37,13 +32,13 @@ omap_uart_lsr: .word 0
.macro addruart, rp, rv, tmp
/* Use omap_uart_phys/virt if already configured */
-10: mrc p15, 0, \rp, c1, c0
- tst \rp, #1 @ MMU enabled?
- ldreq \rp, =omap_uart_v2p(omap_uart_phys) @ MMU disabled
- ldrne \rp, =omap_uart_phys @ MMU enabled
- add \rv, \rp, #4 @ omap_uart_virt
- ldr \rp, [\rp, #0]
- ldr \rv, [\rv, #0]
+10: adr \rp, 11f @ get effective addr of 11f
+ ldr \rv, [\rp] @ get absolute addr of 11f
+ sub \rv, \rv, \rp @ offset between the two
+ ldr \rp, [\rp, #4] @ abs addr of omap_uart_phys
+ sub \tmp, \rp, \rv @ make it effective
+ ldr \rp, [\tmp, #0] @ omap_uart_phys
+ ldr \rv, [\tmp, #4] @ omap_uart_virt
cmp \rp, #0 @ is port configured?
cmpne \rv, #0
bne 99f @ already configured
@@ -105,50 +100,47 @@ omap_uart_lsr: .word 0
b 98f
83: mov \rp, #UART_OFFSET(TI816X_UART3_BASE)
b 98f
+
95: ldr \rp, =ZOOM_UART_BASE
- mrc p15, 0, \rv, c1, c0
- tst \rv, #1 @ MMU enabled?
- ldreq \rv, =omap_uart_v2p(omap_uart_phys) @ MMU disabled
- ldrne \rv, =omap_uart_phys @ MMU enabled
- str \rp, [\rv, #0]
+ str \rp, [\tmp, #0] @ omap_uart_phys
ldr \rp, =ZOOM_UART_VIRT
- add \rv, \rv, #4 @ omap_uart_virt
- str \rp, [\rv, #0]
+ str \rp, [\tmp, #4] @ omap_uart_virt
mov \rp, #(UART_LSR << ZOOM_PORT_SHIFT)
- add \rv, \rv, #4 @ omap_uart_lsr
- str \rp, [\rv, #0]
+ str \rp, [\tmp, #8] @ omap_uart_lsr
b 10b
/* Store both phys and virt address for the uart */
98: add \rp, \rp, #0x48000000 @ phys base
- mrc p15, 0, \rv, c1, c0
- tst \rv, #1 @ MMU enabled?
- ldreq \rv, =omap_uart_v2p(omap_uart_phys) @ MMU disabled
- ldrne \rv, =omap_uart_phys @ MMU enabled
- str \rp, [\rv, #0]
+ str \rp, [\tmp, #0] @ omap_uart_phys
sub \rp, \rp, #0x48000000 @ phys base
add \rp, \rp, #0xfa000000 @ virt base
- add \rv, \rv, #4 @ omap_uart_virt
- str \rp, [\rv, #0]
+ str \rp, [\tmp, #4] @ omap_uart_virt
mov \rp, #(UART_LSR << OMAP_PORT_SHIFT)
- add \rv, \rv, #4 @ omap_uart_lsr
- str \rp, [\rv, #0]
+ str \rp, [\tmp, #8] @ omap_uart_lsr
b 10b
-99:
+
+ .align
+11: .word .
+ .word omap_uart_phys
+ .ltorg
+
+99: /* Pass the UART_LSR reg address */
+ ldr \tmp, [\tmp, #8] @ omap_uart_lsr
+ add \rp, \rp, \tmp
+ add \rv, \rv, \tmp
.endm
.macro senduart,rd,rx
- strb \rd, [\rx]
+ orr \rd, \rd, \rx, lsl #24 @ preserve LSR reg offset
+ bic \rx, \rx, #0xff @ get base (THR) reg address
+ strb \rd, [\rx] @ send lower byte of rd
+ orr \rx, \rx, \rd, lsr #24 @ restore original rx (LSR)
+ bic \rd, \rd, #(0xff << 24) @ restore original rd
.endm
.macro busyuart,rd,rx
-1001: mrc p15, 0, \rd, c1, c0
- tst \rd, #1 @ MMU enabled?
- ldreq \rd, =omap_uart_v2p(omap_uart_lsr) @ MMU disabled
- ldrne \rd, =omap_uart_lsr @ MMU enabled
- ldr \rd, [\rd, #0]
- ldrb \rd, [\rx, \rd]
+1001: ldrb \rd, [\rx] @ rx contains UART_LSR address
and \rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
teq \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
bne 1001b
--
1.7.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 5/6] ARM: mach-davinci: make DAVINCI_UART_INFO into a relative offset
2011-09-02 2:59 [PATCH 0/6] OMAP/Davinci debug UART code cleanup Nicolas Pitre
` (3 preceding siblings ...)
2011-09-02 2:59 ` [PATCH 4/6] ARM: mach-omap2: " Nicolas Pitre
@ 2011-09-02 2:59 ` Nicolas Pitre
2011-09-02 2:59 ` [PATCH 6/6] ARM: mach-davinci: clean up debug-macro.S Nicolas Pitre
5 siblings, 0 replies; 17+ messages in thread
From: Nicolas Pitre @ 2011-09-02 2:59 UTC (permalink / raw)
To: linux-arm-kernel
This is the first step to remove PLAT_PHYS_OFFSET usage from the debug
UART code.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
arch/arm/mach-davinci/include/mach/debug-macro.S | 21 ++++++++++-----------
arch/arm/mach-davinci/include/mach/serial.h | 3 ++-
arch/arm/mach-davinci/include/mach/uncompress.h | 7 ++++++-
3 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/arch/arm/mach-davinci/include/mach/debug-macro.S b/arch/arm/mach-davinci/include/mach/debug-macro.S
index 3cf4c1b..45fff2c 100644
--- a/arch/arm/mach-davinci/include/mach/debug-macro.S
+++ b/arch/arm/mach-davinci/include/mach/debug-macro.S
@@ -50,21 +50,20 @@ davinci_uart_virt: .word 0
mrc p15, 0, \rp, c1, c0
tst \rp, #1 @ MMU enabled?
- /* Copy uart phys address from decompressor uart info */
+ and \rp, pc, #0xff000000
+ ldr \rv, =DAVINCI_UART_INFO_OFS
+ add \rp, \rp, \rv
+
ldreq \rv, =davinci_uart_v2p(davinci_uart_phys)
ldrne \rv, =davinci_uart_phys
- ldreq \rp, =DAVINCI_UART_INFO
- ldrne \rp, =davinci_uart_p2v(DAVINCI_UART_INFO)
- ldr \rp, [\rp, #0]
- str \rp, [\rv]
+
+ /* Copy uart phys address from decompressor uart info */
+ ldr \tmp, [\rp, #0]
+ str \tmp, [\rv, #0]
/* Copy uart virt address from decompressor uart info */
- ldreq \rv, =davinci_uart_v2p(davinci_uart_virt)
- ldrne \rv, =davinci_uart_virt
- ldreq \rp, =DAVINCI_UART_INFO
- ldrne \rp, =davinci_uart_p2v(DAVINCI_UART_INFO)
- ldr \rp, [\rp, #4]
- str \rp, [\rv]
+ ldr \tmp, [\rp, #4]
+ str \tmp, [\rv, #4]
b 10b
99:
diff --git a/arch/arm/mach-davinci/include/mach/serial.h b/arch/arm/mach-davinci/include/mach/serial.h
index c9e6ce1..e347d88 100644
--- a/arch/arm/mach-davinci/include/mach/serial.h
+++ b/arch/arm/mach-davinci/include/mach/serial.h
@@ -21,8 +21,9 @@
* macros in debug-macro.S.
*
* This area sits just below the page tables (see arch/arm/kernel/head.S).
+ * We define it as a relative offset from start of usable RAM.
*/
-#define DAVINCI_UART_INFO (PLAT_PHYS_OFFSET + 0x3ff8)
+#define DAVINCI_UART_INFO_OFS 0x3ff8
#define DAVINCI_UART0_BASE (IO_PHYS + 0x20000)
#define DAVINCI_UART1_BASE (IO_PHYS + 0x20400)
diff --git a/arch/arm/mach-davinci/include/mach/uncompress.h b/arch/arm/mach-davinci/include/mach/uncompress.h
index 78d8068..9dc7cf9 100644
--- a/arch/arm/mach-davinci/include/mach/uncompress.h
+++ b/arch/arm/mach-davinci/include/mach/uncompress.h
@@ -43,7 +43,12 @@ static inline void flush(void)
static inline void set_uart_info(u32 phys, void * __iomem virt)
{
- u32 *uart_info = (u32 *)(DAVINCI_UART_INFO);
+ /*
+ * Get address of some.bss variable and round it down
+ * a la CONFIG_AUTO_ZRELADDR.
+ */
+ u32 ram_start = (u32)&uart & 0xf8000000;
+ u32 *uart_info = (u32 *)(ram_start + DAVINCI_UART_INFO_OFS);
uart = (u32 *)phys;
uart_info[0] = phys;
--
1.7.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 6/6] ARM: mach-davinci: clean up debug-macro.S
2011-09-02 2:59 [PATCH 0/6] OMAP/Davinci debug UART code cleanup Nicolas Pitre
` (4 preceding siblings ...)
2011-09-02 2:59 ` [PATCH 5/6] ARM: mach-davinci: make DAVINCI_UART_INFO into a relative offset Nicolas Pitre
@ 2011-09-02 2:59 ` Nicolas Pitre
5 siblings, 0 replies; 17+ messages in thread
From: Nicolas Pitre @ 2011-09-02 2:59 UTC (permalink / raw)
To: linux-arm-kernel
This achieves two goals:
1) Get rid of davinci_uart_v2p() and davinci_uart_p2v() which were the
last users of PLAT_PHYS_OFFSET.
2) Remove the probing of the M bit in the CP15 control reg and make
the access to the .data variables completely position independent.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
arch/arm/mach-davinci/include/mach/debug-macro.S | 39 +++++++++------------
1 files changed, 17 insertions(+), 22 deletions(-)
diff --git a/arch/arm/mach-davinci/include/mach/debug-macro.S b/arch/arm/mach-davinci/include/mach/debug-macro.S
index 45fff2c..2055bcb 100644
--- a/arch/arm/mach-davinci/include/mach/debug-macro.S
+++ b/arch/arm/mach-davinci/include/mach/debug-macro.S
@@ -18,15 +18,10 @@
#include <linux/serial_reg.h>
-#include <asm/memory.h>
-
#include <mach/serial.h>
#define UART_SHIFT 2
-#define davinci_uart_v2p(x) ((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET)
-#define davinci_uart_p2v(x) ((x) - PLAT_PHYS_OFFSET + PAGE_OFFSET)
-
.pushsection .data
davinci_uart_phys: .word 0
davinci_uart_virt: .word 0
@@ -35,37 +30,37 @@ davinci_uart_virt: .word 0
.macro addruart, rp, rv, tmp
/* Use davinci_uart_phys/virt if already configured */
-10: mrc p15, 0, \rp, c1, c0
- tst \rp, #1 @ MMU enabled?
- ldreq \rp, =davinci_uart_v2p(davinci_uart_phys)
- ldrne \rp, =davinci_uart_phys
- add \rv, \rp, #4 @ davinci_uart_virt
- ldr \rp, [\rp, #0]
- ldr \rv, [\rv, #0]
+10: adr \rp, 11f @ get effective addr of 11f
+ ldr \rv, [\rp] @ get absolute addr of 11f
+ sub \rv, \rv, \rp @ offset between the two
+ ldr \rp, [\rp, #4] @ abs addr of omap_uart_phys
+ sub \tmp, \rp, \rv @ make it effective
+ ldr \rp, [\tmp, #0] @ davinci_uart_phys
+ ldr \rv, [\tmp, #4] @ davinci_uart_virt
cmp \rp, #0 @ is port configured?
cmpne \rv, #0
bne 99f @ already configured
/* Check the debug UART address set in uncompress.h */
- mrc p15, 0, \rp, c1, c0
- tst \rp, #1 @ MMU enabled?
-
and \rp, pc, #0xff000000
ldr \rv, =DAVINCI_UART_INFO_OFS
add \rp, \rp, \rv
- ldreq \rv, =davinci_uart_v2p(davinci_uart_phys)
- ldrne \rv, =davinci_uart_phys
-
/* Copy uart phys address from decompressor uart info */
- ldr \tmp, [\rp, #0]
- str \tmp, [\rv, #0]
+ ldr \rv, [\rp, #0]
+ str \rv, [\tmp, #0]
/* Copy uart virt address from decompressor uart info */
- ldr \tmp, [\rp, #4]
- str \tmp, [\rv, #4]
+ ldr \rv, [\rp, #4]
+ str \rv, [\tmp, #4]
b 10b
+
+ .align
+11: .word .
+ .word davinci_uart_phys
+ .ltorg
+
99:
.endm
--
1.7.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/6] ARM: plat-omap: make OMAP_UART_INFO into a relative offset
2011-09-02 2:59 ` [PATCH 2/6] ARM: plat-omap: make OMAP_UART_INFO into a relative offset Nicolas Pitre
@ 2011-09-05 9:44 ` Tony Lindgren
2011-09-05 19:24 ` Nicolas Pitre
2011-09-05 9:46 ` [PATCH 2.5/6] ARM: omap: prepare debug-macro.S for offset based calculation of omap_uart_phys and virt Tony Lindgren
1 sibling, 1 reply; 17+ messages in thread
From: Tony Lindgren @ 2011-09-05 9:44 UTC (permalink / raw)
To: linux-arm-kernel
* Nicolas Pitre <nico@fluxnic.net> [110901 19:27]:
> --- a/arch/arm/mach-omap1/include/mach/debug-macro.S
> +++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
> @@ -46,11 +46,9 @@ omap_uart_virt: .word 0x0
> bne 99f @ already configured
>
> /* Check the debug UART configuration set in uncompress.h */
> - mrc p15, 0, \rp, c1, c0
> - tst \rp, #1 @ MMU enabled?
> - ldreq \rp, =OMAP_UART_INFO @ MMU not enabled
> - ldrne \rp, =omap_uart_p2v(OMAP_UART_INFO) @ MMU enabled
> - ldr \rp, [\rp, #0]
> + and \rp, pc, #0xff000000
> + ldr \rv, =OMAP_UART_INFO_OFS
> + ldr \rp, [\rp, \rv]
>
> /* Select the UART to use based on the UART1 scratchpad value */
> 10: cmp \rp, #0 @ no port configured?
> --- a/arch/arm/mach-omap2/include/mach/debug-macro.S
> +++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
> @@ -49,11 +49,10 @@ omap_uart_lsr: .word 0
> bne 99f @ already configured
>
> /* Check the debug UART configuration set in uncompress.h */
> - mrc p15, 0, \rp, c1, c0
> - tst \rp, #1 @ MMU enabled?
> - ldreq \rp, =OMAP_UART_INFO @ MMU not enabled
> - ldrne \rp, =omap_uart_p2v(OMAP_UART_INFO) @ MMU enabled
> - ldr \rp, [\rp, #0]
> + mov \rp, pc
> + ldr \rv, =OMAP_UART_INFO_OFS
> + and \rp, \rp, #0xff000000
> + ldr \rp, [\rp, \rv]
>
> /* Select the UART to use based on the UART1 scratchpad value */
> cmp \rp, #0 @ no port configured?
Any reason to not make it the same for omap1 and omap2+?
It seems to work both ways, but the omap1 version is one line less
of code :)
Other than that:
Tested-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 2.5/6] ARM: omap: prepare debug-macro.S for offset based calculation of omap_uart_phys and virt
2011-09-02 2:59 ` [PATCH 2/6] ARM: plat-omap: make OMAP_UART_INFO into a relative offset Nicolas Pitre
2011-09-05 9:44 ` Tony Lindgren
@ 2011-09-05 9:46 ` Tony Lindgren
2011-09-06 18:30 ` Nicolas Pitre
1 sibling, 1 reply; 17+ messages in thread
From: Tony Lindgren @ 2011-09-05 9:46 UTC (permalink / raw)
To: linux-arm-kernel
Just change 99 to 100 to allow using 99 for omap_uart_phys in the
following patches.
Signed-off-by: Tony Lindgren <tony@atomide.com>
--- a/arch/arm/mach-omap1/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -43,7 +43,7 @@ omap_uart_virt: .word 0x0
ldr \rv, [\rv, #0]
cmp \rp, #0 @ is port configured?
cmpne \rv, #0
- bne 99f @ already configured
+ bne 100f @ already configured
/* Check the debug UART configuration set in uncompress.h */
and \rp, pc, #0xff000000
@@ -82,7 +82,7 @@ omap_uart_virt: .word 0x0
add \rv, \rv, #4 @ omap_uart_lsr
str \rp, [\rv, #0]
b 9b
-99:
+100:
.endm
.macro senduart,rd,rx
--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -46,7 +46,7 @@ omap_uart_lsr: .word 0
ldr \rv, [\rv, #0]
cmp \rp, #0 @ is port configured?
cmpne \rv, #0
- bne 99f @ already configured
+ bne 100f @ already configured
/* Check the debug UART configuration set in uncompress.h */
mov \rp, pc
@@ -135,7 +135,7 @@ omap_uart_lsr: .word 0
str \rp, [\rv, #0]
b 10b
-99:
+100:
.endm
.macro senduart,rd,rx
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 3/6] ARM: mach-omap1: clean up debug-macro.S
2011-09-02 2:59 ` [PATCH 3/6] ARM: mach-omap1: clean up debug-macro.S Nicolas Pitre
@ 2011-09-05 9:49 ` Tony Lindgren
2011-09-05 9:51 ` Tony Lindgren
2011-09-06 18:33 ` Nicolas Pitre
0 siblings, 2 replies; 17+ messages in thread
From: Tony Lindgren @ 2011-09-05 9:49 UTC (permalink / raw)
To: linux-arm-kernel
* Nicolas Pitre <nico@fluxnic.net> [110901 19:26]:
> --- a/arch/arm/mach-omap1/include/mach/debug-macro.S
> +++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
> @@ -34,13 +29,13 @@ omap_uart_virt: .word 0x0
> .macro addruart, rp, rv, tmp
>
> /* Use omap_uart_phys/virt if already configured */
> -9: mrc p15, 0, \rp, c1, c0
> - tst \rp, #1 @ MMU enabled?
> - ldreq \rp, =omap_uart_v2p(omap_uart_phys) @ MMU disabled
> - ldrne \rp, =omap_uart_phys @ MMU enabled
> - add \rv, \rp, #4 @ omap_uart_virt
> - ldr \rp, [\rp, #0]
> - ldr \rv, [\rv, #0]
> +9: adr \rp, 11f @ get effective addr of 11f
> + ldr \rv, [\rp] @ get absolute addr of 11f
> + sub \rv, \rv, \rp @ offset between the two
> + ldr \rp, [\rp, #4] @ abs addr of omap_uart_phys
> + sub \tmp, \rp, \rv @ make it effective
> + ldr \rp, [\tmp, #0] @ omap_uart_phys
> + ldr \rv, [\tmp, #4] @ omap_uart_virt
> cmp \rp, #0 @ is port configured?
> cmpne \rv, #0
> bne 99f @ already configured
The 11f above will fail for omap1 as we already have 11 defined there
for omap1 uart1. The prepare patch I posted as 2.5/6 fixes that issue.
This will also allow further clean-up to combine omap1 and omap2+
debug-macro.S.
Below is updated version of your patch to use 99f instead of 11f.
Tony
From: Nicolas Pitre <nico@fluxnic.net>
Date: Thu, 1 Sep 2011 22:59:10 -0400
Subject: [PATCH] ARM: mach-omap1: clean up debug-macro.S
This achieves two goals:
1) Get rid of omap_uart_v2p() and omap_uart_p2v() which were the last users
of PLAT_PHYS_OFFSET.
2) Remove the probing of the M bit in the CP15 control reg and make
the access to the .data variables completely position independent.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
index 77a7202..2b36a28 100644
--- a/arch/arm/mach-omap1/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -13,13 +13,8 @@
#include <linux/serial_reg.h>
-#include <asm/memory.h>
-
#include <plat/serial.h>
-#define omap_uart_v2p(x) ((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET)
-#define omap_uart_p2v(x) ((x) - PLAT_PHYS_OFFSET + PAGE_OFFSET)
-
.pushsection .data
omap_uart_phys: .word 0x0
omap_uart_virt: .word 0x0
@@ -34,13 +29,13 @@ omap_uart_virt: .word 0x0
.macro addruart, rp, rv, tmp
/* Use omap_uart_phys/virt if already configured */
-9: mrc p15, 0, \rp, c1, c0
- tst \rp, #1 @ MMU enabled?
- ldreq \rp, =omap_uart_v2p(omap_uart_phys) @ MMU disabled
- ldrne \rp, =omap_uart_phys @ MMU enabled
- add \rv, \rp, #4 @ omap_uart_virt
- ldr \rp, [\rp, #0]
- ldr \rv, [\rv, #0]
+9: adr \rp, 99f @ get effective addr of 99f
+ ldr \rv, [\rp] @ get absolute addr of 99f
+ sub \rv, \rv, \rp @ offset between the two
+ ldr \rp, [\rp, #4] @ abs addr of omap_uart_phys
+ sub \tmp, \rp, \rv @ make it effective
+ ldr \rp, [\tmp, #0] @ omap_uart_phys
+ ldr \rv, [\tmp, #4] @ omap_uart_virt
cmp \rp, #0 @ is port configured?
cmpne \rv, #0
bne 100f @ already configured
@@ -72,16 +67,17 @@ omap_uart_virt: .word 0x0
/* Store both phys and virt address for the uart */
98: add \rp, \rp, #0xff000000 @ phys base
- mrc p15, 0, \rv, c1, c0
- tst \rv, #1 @ MMU enabled?
- ldreq \rv, =omap_uart_v2p(omap_uart_phys) @ MMU disabled
- ldrne \rv, =omap_uart_phys @ MMU enabled
- str \rp, [\rv, #0]
+ str \rp, [\tmp, #0] @ omap_uart_phys
sub \rp, \rp, #0xff000000 @ phys base
add \rp, \rp, #0xfe000000 @ virt base
- add \rv, \rv, #4 @ omap_uart_lsr
- str \rp, [\rv, #0]
+ str \rp, [\tmp, #4] @ omap_uart_virt
b 9b
+
+ .align
+99: .word .
+ .word omap_uart_phys
+ .ltorg
+
100:
.endm
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 4/6] ARM: mach-omap2: clean up debug-macro.S
2011-09-02 2:59 ` [PATCH 4/6] ARM: mach-omap2: " Nicolas Pitre
@ 2011-09-05 9:51 ` Tony Lindgren
2011-09-05 15:07 ` [PATCH 4.5/6] ARM: omap: pass phys, virt and lsr from uncompress.h to debug-macro.S Tony Lindgren
1 sibling, 0 replies; 17+ messages in thread
From: Tony Lindgren @ 2011-09-05 9:51 UTC (permalink / raw)
To: linux-arm-kernel
Here's this one too updated to use 99f. Other than that:
Tested-by: Tony Lindgren <tony@atomide.com>
From: Nicolas Pitre <nico@fluxnic.net>
Date: Thu, 1 Sep 2011 22:59:11 -0400
Subject: [PATCH] ARM: mach-omap2: clean up debug-macro.S
This achieves two goals:
1) Get rid of omap_uart_v2p() and omap_uart_p2v() which were the last users
of PLAT_PHYS_OFFSET.
2) Remove the probing of the M bit in the CP15 control reg and make
the access to the .data variables completely position independent.
There is a catch though: the busyuart macro needs to know where the LSR
register is which might be at a different offset depending on the hardware.
Given that this macro is given only two registers and that one of them
must be preserved, the trick is to always pass the LSR register address
around, and deduce the base address for the THR register by masking out
the LSR offset in senduart instead.
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S
index d48e485..13f98e5 100644
--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -13,15 +13,10 @@
#include <linux/serial_reg.h>
-#include <asm/memory.h>
-
#include <plat/serial.h>
#define UART_OFFSET(addr) ((addr) & 0x00ffffff)
-#define omap_uart_v2p(x) ((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET)
-#define omap_uart_p2v(x) ((x) - PLAT_PHYS_OFFSET + PAGE_OFFSET)
-
.pushsection .data
omap_uart_phys: .word 0
omap_uart_virt: .word 0
@@ -37,13 +32,13 @@ omap_uart_lsr: .word 0
.macro addruart, rp, rv, tmp
/* Use omap_uart_phys/virt if already configured */
-10: mrc p15, 0, \rp, c1, c0
- tst \rp, #1 @ MMU enabled?
- ldreq \rp, =omap_uart_v2p(omap_uart_phys) @ MMU disabled
- ldrne \rp, =omap_uart_phys @ MMU enabled
- add \rv, \rp, #4 @ omap_uart_virt
- ldr \rp, [\rp, #0]
- ldr \rv, [\rv, #0]
+10: adr \rp, 99f @ get effective addr of 99f
+ ldr \rv, [\rp] @ get absolute addr of 99f
+ sub \rv, \rv, \rp @ offset between the two
+ ldr \rp, [\rp, #4] @ abs addr of omap_uart_phys
+ sub \tmp, \rp, \rv @ make it effective
+ ldr \rp, [\tmp, #0] @ omap_uart_phys
+ ldr \rv, [\tmp, #4] @ omap_uart_virt
cmp \rp, #0 @ is port configured?
cmpne \rv, #0
bne 100f @ already configured
@@ -105,50 +100,47 @@ omap_uart_lsr: .word 0
b 98f
83: mov \rp, #UART_OFFSET(TI816X_UART3_BASE)
b 98f
+
95: ldr \rp, =ZOOM_UART_BASE
- mrc p15, 0, \rv, c1, c0
- tst \rv, #1 @ MMU enabled?
- ldreq \rv, =omap_uart_v2p(omap_uart_phys) @ MMU disabled
- ldrne \rv, =omap_uart_phys @ MMU enabled
- str \rp, [\rv, #0]
+ str \rp, [\tmp, #0] @ omap_uart_phys
ldr \rp, =ZOOM_UART_VIRT
- add \rv, \rv, #4 @ omap_uart_virt
- str \rp, [\rv, #0]
+ str \rp, [\tmp, #4] @ omap_uart_virt
mov \rp, #(UART_LSR << ZOOM_PORT_SHIFT)
- add \rv, \rv, #4 @ omap_uart_lsr
- str \rp, [\rv, #0]
+ str \rp, [\tmp, #8] @ omap_uart_lsr
b 10b
/* Store both phys and virt address for the uart */
98: add \rp, \rp, #0x48000000 @ phys base
- mrc p15, 0, \rv, c1, c0
- tst \rv, #1 @ MMU enabled?
- ldreq \rv, =omap_uart_v2p(omap_uart_phys) @ MMU disabled
- ldrne \rv, =omap_uart_phys @ MMU enabled
- str \rp, [\rv, #0]
+ str \rp, [\tmp, #0] @ omap_uart_phys
sub \rp, \rp, #0x48000000 @ phys base
add \rp, \rp, #0xfa000000 @ virt base
- add \rv, \rv, #4 @ omap_uart_virt
- str \rp, [\rv, #0]
+ str \rp, [\tmp, #4] @ omap_uart_virt
mov \rp, #(UART_LSR << OMAP_PORT_SHIFT)
- add \rv, \rv, #4 @ omap_uart_lsr
- str \rp, [\rv, #0]
+ str \rp, [\tmp, #8] @ omap_uart_lsr
b 10b
-100:
+
+ .align
+99: .word .
+ .word omap_uart_phys
+ .ltorg
+
+100: /* Pass the UART_LSR reg address */
+ ldr \tmp, [\tmp, #8] @ omap_uart_lsr
+ add \rp, \rp, \tmp
+ add \rv, \rv, \tmp
.endm
.macro senduart,rd,rx
- strb \rd, [\rx]
+ orr \rd, \rd, \rx, lsl #24 @ preserve LSR reg offset
+ bic \rx, \rx, #0xff @ get base (THR) reg address
+ strb \rd, [\rx] @ send lower byte of rd
+ orr \rx, \rx, \rd, lsr #24 @ restore original rx (LSR)
+ bic \rd, \rd, #(0xff << 24) @ restore original rd
.endm
.macro busyuart,rd,rx
-1001: mrc p15, 0, \rd, c1, c0
- tst \rd, #1 @ MMU enabled?
- ldreq \rd, =omap_uart_v2p(omap_uart_lsr) @ MMU disabled
- ldrne \rd, =omap_uart_lsr @ MMU enabled
- ldr \rd, [\rd, #0]
- ldrb \rd, [\rx, \rd]
+1001: ldrb \rd, [\rx] @ rx contains UART_LSR address
and \rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
teq \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
bne 1001b
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 3/6] ARM: mach-omap1: clean up debug-macro.S
2011-09-05 9:49 ` Tony Lindgren
@ 2011-09-05 9:51 ` Tony Lindgren
2011-09-06 18:33 ` Nicolas Pitre
1 sibling, 0 replies; 17+ messages in thread
From: Tony Lindgren @ 2011-09-05 9:51 UTC (permalink / raw)
To: linux-arm-kernel
* Tony Lindgren <tony@atomide.com> [110905 02:16]:
> * Nicolas Pitre <nico@fluxnic.net> [110901 19:26]:
> > --- a/arch/arm/mach-omap1/include/mach/debug-macro.S
> > +++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
> > @@ -34,13 +29,13 @@ omap_uart_virt: .word 0x0
> > .macro addruart, rp, rv, tmp
> >
> > /* Use omap_uart_phys/virt if already configured */
> > -9: mrc p15, 0, \rp, c1, c0
> > - tst \rp, #1 @ MMU enabled?
> > - ldreq \rp, =omap_uart_v2p(omap_uart_phys) @ MMU disabled
> > - ldrne \rp, =omap_uart_phys @ MMU enabled
> > - add \rv, \rp, #4 @ omap_uart_virt
> > - ldr \rp, [\rp, #0]
> > - ldr \rv, [\rv, #0]
> > +9: adr \rp, 11f @ get effective addr of 11f
> > + ldr \rv, [\rp] @ get absolute addr of 11f
> > + sub \rv, \rv, \rp @ offset between the two
> > + ldr \rp, [\rp, #4] @ abs addr of omap_uart_phys
> > + sub \tmp, \rp, \rv @ make it effective
> > + ldr \rp, [\tmp, #0] @ omap_uart_phys
> > + ldr \rv, [\tmp, #4] @ omap_uart_virt
> > cmp \rp, #0 @ is port configured?
> > cmpne \rv, #0
> > bne 99f @ already configured
>
> The 11f above will fail for omap1 as we already have 11 defined there
> for omap1 uart1. The prepare patch I posted as 2.5/6 fixes that issue.
> This will also allow further clean-up to combine omap1 and omap2+
> debug-macro.S.
>
> Below is updated version of your patch to use 99f instead of 11f.
Other than that change, this too:
Tested-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 4.5/6] ARM: omap: pass phys, virt and lsr from uncompress.h to debug-macro.S
2011-09-02 2:59 ` [PATCH 4/6] ARM: mach-omap2: " Nicolas Pitre
2011-09-05 9:51 ` Tony Lindgren
@ 2011-09-05 15:07 ` Tony Lindgren
2011-09-06 18:45 ` Nicolas Pitre
1 sibling, 1 reply; 17+ messages in thread
From: Tony Lindgren @ 2011-09-05 15:07 UTC (permalink / raw)
To: linux-arm-kernel
Earlier code passed the serial port configuration number as the
code originally used the scratchpad register in the serial port
to pass it from uncompress.h to debug-macro.S. This is no longer
the case as some omaps don't have a serial port. A memory address
is used instead.
Change the code to pass phys, virt and lsr from uncompress.h
to debug-macro.S. Note that the virt value is only used on zoom
boards that have an external 8250 hardware.
This will make it possible to combine omap1 and omap2+ debug-macro.S.
Signed-off-by: Tony Lindgren <tony@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 2b36a28..18b72b9 100644
--- a/arch/arm/mach-omap1/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -18,6 +18,7 @@
.pushsection .data
omap_uart_phys: .word 0x0
omap_uart_virt: .word 0x0
+omap_uart_lsr: .word 0x0
.popsection
/*
@@ -43,34 +44,13 @@ omap_uart_virt: .word 0x0
/* Check the debug UART configuration set in uncompress.h */
and \rp, pc, #0xff000000
ldr \rv, =OMAP_UART_INFO_OFS
- ldr \rp, [\rp, \rv]
-
- /* Select the UART to use based on the UART1 scratchpad value */
-10: cmp \rp, #0 @ no port configured?
- beq 11f @ if none, try to use UART1
- cmp \rp, #OMAP1UART1
- beq 11f @ configure OMAP1UART1
- cmp \rp, #OMAP1UART2
- beq 12f @ configure OMAP1UART2
- cmp \rp, #OMAP1UART3
- beq 13f @ configure OMAP2UART3
-
- /* Configure the UART offset from the phys/virt base */
-11: mov \rp, #0x00fb0000 @ OMAP1UART1
- b 98f
-12: mov \rp, #0x00fb0000 @ OMAP1UART1
- orr \rp, \rp, #0x00000800 @ OMAP1UART2
- b 98f
-13: mov \rp, #0x00fb0000 @ OMAP1UART1
- orr \rp, \rp, #0x00000800 @ OMAP1UART2
- orr \rp, \rp, #0x00009000 @ OMAP1UART3
-
- /* Store both phys and virt address for the uart */
-98: add \rp, \rp, #0xff000000 @ phys base
- str \rp, [\tmp, #0] @ omap_uart_phys
- sub \rp, \rp, #0xff000000 @ phys base
- add \rp, \rp, #0xfe000000 @ virt base
- str \rp, [\tmp, #4] @ omap_uart_virt
+ add \rp, \rp, \rv @ uart_info
+ ldr \rv, [\rp, #0] @ get configured pa
+ str \rv, [\tmp, #0] @ omap_uart_phys
+ ldr \rv, [\rp, #4] @ get configured va
+ str \rv, [\tmp, #4] @ set omap_uart_virt
+ ldr \rv, [\rp, #8] @ get configured lsr
+ str \rv, [\tmp, #8] @ set omap_uart_lsr
b 9b
.align
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S
index d86f6ba..f692140 100644
--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -15,8 +15,6 @@
#include <plat/serial.h>
-#define UART_OFFSET(addr) ((addr) & 0x00ffffff)
-
.pushsection .data
omap_uart_phys: .word 0
omap_uart_virt: .word 0
@@ -46,77 +44,13 @@ omap_uart_lsr: .word 0
/* Check the debug UART configuration set in uncompress.h */
and \rp, pc, #0xff000000
ldr \rv, =OMAP_UART_INFO_OFS
- ldr \rp, [\rp, \rv]
-
- /* Select the UART to use based on the UART1 scratchpad value */
- cmp \rp, #0 @ no port configured?
- beq 21f @ if none, try to use UART1
- cmp \rp, #OMAP2UART1 @ OMAP2/3/4UART1
- beq 21f @ configure OMAP2/3/4UART1
- cmp \rp, #OMAP2UART2 @ OMAP2/3/4UART2
- beq 22f @ configure OMAP2/3/4UART2
- cmp \rp, #OMAP2UART3 @ only on 24xx
- beq 23f @ configure OMAP2UART3
- cmp \rp, #OMAP3UART3 @ only on 34xx
- beq 33f @ configure OMAP3UART3
- cmp \rp, #OMAP4UART3 @ only on 44xx
- beq 43f @ configure OMAP4UART3
- cmp \rp, #OMAP3UART4 @ only on 36xx
- beq 34f @ configure OMAP3UART4
- cmp \rp, #OMAP4UART4 @ only on 44xx
- beq 44f @ configure OMAP4UART4
- cmp \rp, #TI816XUART1 @ ti816x UART offsets different
- beq 81f @ configure UART1
- cmp \rp, #TI816XUART2 @ ti816x UART offsets different
- beq 82f @ configure UART2
- cmp \rp, #TI816XUART3 @ ti816x UART offsets different
- beq 83f @ configure UART3
- cmp \rp, #ZOOM_UART @ only on zoom2/3
- beq 95f @ configure ZOOM_UART
-
- /* Configure the UART offset from the phys/virt base */
-21: mov \rp, #UART_OFFSET(OMAP2_UART1_BASE) @ omap2/3/4
- b 98f
-22: mov \rp, #UART_OFFSET(OMAP2_UART2_BASE) @ omap2/3/4
- b 98f
-23: mov \rp, #UART_OFFSET(OMAP2_UART3_BASE)
- b 98f
-33: mov \rp, #UART_OFFSET(OMAP3_UART1_BASE)
- add \rp, \rp, #0x00fb0000
- add \rp, \rp, #0x00006000 @ OMAP3_UART3_BASE
- b 98f
-34: mov \rp, #UART_OFFSET(OMAP3_UART1_BASE)
- add \rp, \rp, #0x00fb0000
- add \rp, \rp, #0x00028000 @ OMAP3_UART4_BASE
- b 98f
-43: mov \rp, #UART_OFFSET(OMAP4_UART3_BASE)
- b 98f
-44: mov \rp, #UART_OFFSET(OMAP4_UART4_BASE)
- b 98f
-81: mov \rp, #UART_OFFSET(TI816X_UART1_BASE)
- b 98f
-82: mov \rp, #UART_OFFSET(TI816X_UART2_BASE)
- b 98f
-83: mov \rp, #UART_OFFSET(TI816X_UART3_BASE)
- b 98f
-
-95: ldr \rp, =ZOOM_UART_BASE
- str \rp, [\tmp, #0] @ omap_uart_phys
- ldr \rp, =ZOOM_UART_VIRT
- str \rp, [\tmp, #4] @ omap_uart_virt
- mov \rp, #(UART_LSR << ZOOM_PORT_SHIFT)
- str \rp, [\tmp, #8] @ omap_uart_lsr
- b 10b
-
- /* Store both phys and virt address for the uart */
-98: add \rp, \rp, #0x48000000 @ phys base
- str \rp, [\tmp, #0] @ omap_uart_phys
- sub \rp, \rp, #0x48000000 @ phys base
- add \rp, \rp, #0xfa000000 @ virt base
- str \rp, [\tmp, #4] @ omap_uart_virt
- mov \rp, #(UART_LSR << OMAP_PORT_SHIFT)
- str \rp, [\tmp, #8] @ omap_uart_lsr
-
+ add \rp, \rp, \rv @ uart_info
+ ldr \rv, [\rp, #0] @ get configured pa
+ str \rv, [\tmp, #0] @ omap_uart_phys
+ ldr \rv, [\rp, #4] @ get configured va
+ str \rv, [\tmp, #4] @ set omap_uart_virt
+ ldr \rv, [\rp, #8] @ get configured lsr
+ str \rv, [\tmp, #8] @ set omap_uart_lsr
b 10b
.align
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h
index 1ab9fd6..20f43aa 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/plat-omap/include/plat/serial.h
@@ -27,7 +27,7 @@
* 2. We assume printascii is called@least once before paging_init,
* and addruart has a chance to read OMAP_UART_INFO
*/
-#define OMAP_UART_INFO_OFS 0x3ffc
+#define OMAP_UART_INFO_OFS 0x3ff4
/* OMAP1 serial ports */
#define OMAP1_UART1_BASE 0xfffb0000
@@ -71,29 +71,6 @@
#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 OMAP3UART4 34 /* Only on 36xx */
-#define OMAP4UART1 OMAP2UART1
-#define OMAP4UART2 OMAP2UART2
-#define OMAP4UART3 43
-#define OMAP4UART4 44
-#define TI816XUART1 81
-#define TI816XUART2 82
-#define TI816XUART3 83
-#define ZOOM_UART 95 /* Only on zoom2/3 */
-
/* 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 71763db..172cd98 100644
--- a/arch/arm/plat-omap/include/plat/uncompress.h
+++ b/arch/arm/plat-omap/include/plat/uncompress.h
@@ -19,6 +19,7 @@
#include <linux/types.h>
#include <linux/serial_reg.h>
+#include <linux/io.h>
#include <asm/memory.h>
#include <asm/mach-types.h>
@@ -28,21 +29,26 @@
#define MDR1_MODE_MASK 0x07
volatile u8 *uart_base;
+void __iomem *uart_virt;
int uart_shift;
/*
* Store the DEBUG_LL uart number into memory.
* See also debug-macro.S, and serial.c for related code.
*/
-static void set_omap_uart_info(unsigned char port)
+static void set_omap_uart_info(void)
{
- /*
- * Get address of some.bss variable and round it down
+ /*
+ * Get address of some.bss variable and round it down
* a la CONFIG_AUTO_ZRELADDR.
*/
u32 ram_start = (u32)&uart_shift & 0xf8000000;
u32 *uart_info = (u32 *)(ram_start + OMAP_UART_INFO_OFS);
- *uart_info = port;
+ *uart_info = (u32)uart_base;
+ uart_info++;
+ *uart_info = (u32)uart_virt;
+ uart_info++;
+ *uart_info = UART_LSR << uart_shift;
}
static void putc(int c)
@@ -66,47 +72,46 @@ static inline void flush(void)
/*
* Macros to configure UART1 and debug UART
*/
-#define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id) \
+#define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_virt, dbg_shft) \
if (machine_is_##mach()) { \
uart_base = (volatile u8 *)(dbg_uart); \
+ uart_virt = (dbg_virt); \
uart_shift = (dbg_shft); \
- port = (dbg_id); \
- set_omap_uart_info(port); \
+ set_omap_uart_info(); \
break; \
}
#define DEBUG_LL_OMAP7XX(p, mach) \
- _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP7XX_PORT_SHIFT, \
- OMAP1UART##p)
+ _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, \
+ OMAP1_IO_ADDRESS(OMAP1_UART##p##_BASE), OMAP7XX_PORT_SHIFT)
#define DEBUG_LL_OMAP1(p, mach) \
- _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, OMAP_PORT_SHIFT, \
- OMAP1UART##p)
+ _DEBUG_LL_ENTRY(mach, OMAP1_UART##p##_BASE, \
+ OMAP1_IO_ADDRESS(OMAP1_UART##p##_BASE), OMAP_PORT_SHIFT)
#define DEBUG_LL_OMAP2(p, mach) \
- _DEBUG_LL_ENTRY(mach, OMAP2_UART##p##_BASE, OMAP_PORT_SHIFT, \
- OMAP2UART##p)
+ _DEBUG_LL_ENTRY(mach, OMAP2_UART##p##_BASE, \
+ OMAP2_L4_IO_ADDRESS(OMAP2_UART##p##_BASE), OMAP_PORT_SHIFT)
#define DEBUG_LL_OMAP3(p, mach) \
- _DEBUG_LL_ENTRY(mach, OMAP3_UART##p##_BASE, OMAP_PORT_SHIFT, \
- OMAP3UART##p)
+ _DEBUG_LL_ENTRY(mach, OMAP3_UART##p##_BASE, \
+ OMAP2_L4_IO_ADDRESS(OMAP3_UART##p##_BASE), OMAP_PORT_SHIFT)
#define DEBUG_LL_OMAP4(p, mach) \
- _DEBUG_LL_ENTRY(mach, OMAP4_UART##p##_BASE, OMAP_PORT_SHIFT, \
- OMAP4UART##p)
+ _DEBUG_LL_ENTRY(mach, OMAP4_UART##p##_BASE, \
+ OMAP2_L4_IO_ADDRESS(OMAP4_UART##p##_BASE), OMAP_PORT_SHIFT)
/* Zoom2/3 shift is different for UART1 and external port */
#define DEBUG_LL_ZOOM(mach) \
- _DEBUG_LL_ENTRY(mach, ZOOM_UART_BASE, ZOOM_PORT_SHIFT, ZOOM_UART)
+ _DEBUG_LL_ENTRY(mach, ZOOM_UART_BASE, IOMEM(ZOOM_UART_VIRT), \
+ ZOOM_PORT_SHIFT)
#define DEBUG_LL_TI816X(p, mach) \
- _DEBUG_LL_ENTRY(mach, TI816X_UART##p##_BASE, OMAP_PORT_SHIFT, \
- TI816XUART##p)
+ _DEBUG_LL_ENTRY(mach, TI816X_UART##p##_BASE, \
+ OMAP2_L4_IO_ADDRESS(TI816X_UART##p##_BASE), OMAP_PORT_SHIFT)
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
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/6] ARM: plat-omap: make OMAP_UART_INFO into a relative offset
2011-09-05 9:44 ` Tony Lindgren
@ 2011-09-05 19:24 ` Nicolas Pitre
0 siblings, 0 replies; 17+ messages in thread
From: Nicolas Pitre @ 2011-09-05 19:24 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 5 Sep 2011, Tony Lindgren wrote:
> * Nicolas Pitre <nico@fluxnic.net> [110901 19:27]:
> > --- a/arch/arm/mach-omap1/include/mach/debug-macro.S
> > +++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
> > @@ -46,11 +46,9 @@ omap_uart_virt: .word 0x0
> > bne 99f @ already configured
> >
> > /* Check the debug UART configuration set in uncompress.h */
> > - mrc p15, 0, \rp, c1, c0
> > - tst \rp, #1 @ MMU enabled?
> > - ldreq \rp, =OMAP_UART_INFO @ MMU not enabled
> > - ldrne \rp, =omap_uart_p2v(OMAP_UART_INFO) @ MMU enabled
> > - ldr \rp, [\rp, #0]
> > + and \rp, pc, #0xff000000
> > + ldr \rv, =OMAP_UART_INFO_OFS
> > + ldr \rp, [\rp, \rv]
> >
> > /* Select the UART to use based on the UART1 scratchpad value */
> > 10: cmp \rp, #0 @ no port configured?
> > --- a/arch/arm/mach-omap2/include/mach/debug-macro.S
> > +++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
> > @@ -49,11 +49,10 @@ omap_uart_lsr: .word 0
> > bne 99f @ already configured
> >
> > /* Check the debug UART configuration set in uncompress.h */
> > - mrc p15, 0, \rp, c1, c0
> > - tst \rp, #1 @ MMU enabled?
> > - ldreq \rp, =OMAP_UART_INFO @ MMU not enabled
> > - ldrne \rp, =omap_uart_p2v(OMAP_UART_INFO) @ MMU enabled
> > - ldr \rp, [\rp, #0]
> > + mov \rp, pc
> > + ldr \rv, =OMAP_UART_INFO_OFS
> > + and \rp, \rp, #0xff000000
> > + ldr \rp, [\rp, \rv]
> >
> > /* Select the UART to use based on the UART1 scratchpad value */
> > cmp \rp, #0 @ no port configured?
>
> Any reason to not make it the same for omap1 and omap2+?
>
> It seems to work both ways, but the omap1 version is one line less
> of code :)
Because of Thumb2. The shorter version is not available with Thumb2.
> Other than that:
>
> Tested-by: Tony Lindgren <tony@atomide.com>
Thanks.
Nicolas
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 2.5/6] ARM: omap: prepare debug-macro.S for offset based calculation of omap_uart_phys and virt
2011-09-05 9:46 ` [PATCH 2.5/6] ARM: omap: prepare debug-macro.S for offset based calculation of omap_uart_phys and virt Tony Lindgren
@ 2011-09-06 18:30 ` Nicolas Pitre
0 siblings, 0 replies; 17+ messages in thread
From: Nicolas Pitre @ 2011-09-06 18:30 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 5 Sep 2011, Tony Lindgren wrote:
> Just change 99 to 100 to allow using 99 for omap_uart_phys in the
> following patches.
OK I've folded that into 3/6 and 4/6 rather than having a separated
patch just for this.
Nicolas
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 3/6] ARM: mach-omap1: clean up debug-macro.S
2011-09-05 9:49 ` Tony Lindgren
2011-09-05 9:51 ` Tony Lindgren
@ 2011-09-06 18:33 ` Nicolas Pitre
1 sibling, 0 replies; 17+ messages in thread
From: Nicolas Pitre @ 2011-09-06 18:33 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 5 Sep 2011, Tony Lindgren wrote:
> * Nicolas Pitre <nico@fluxnic.net> [110901 19:26]:
> > --- a/arch/arm/mach-omap1/include/mach/debug-macro.S
> > +++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
> > @@ -34,13 +29,13 @@ omap_uart_virt: .word 0x0
> > .macro addruart, rp, rv, tmp
> >
> > /* Use omap_uart_phys/virt if already configured */
> > -9: mrc p15, 0, \rp, c1, c0
> > - tst \rp, #1 @ MMU enabled?
> > - ldreq \rp, =omap_uart_v2p(omap_uart_phys) @ MMU disabled
> > - ldrne \rp, =omap_uart_phys @ MMU enabled
> > - add \rv, \rp, #4 @ omap_uart_virt
> > - ldr \rp, [\rp, #0]
> > - ldr \rv, [\rv, #0]
> > +9: adr \rp, 11f @ get effective addr of 11f
> > + ldr \rv, [\rp] @ get absolute addr of 11f
> > + sub \rv, \rv, \rp @ offset between the two
> > + ldr \rp, [\rp, #4] @ abs addr of omap_uart_phys
> > + sub \tmp, \rp, \rv @ make it effective
> > + ldr \rp, [\tmp, #0] @ omap_uart_phys
> > + ldr \rv, [\tmp, #4] @ omap_uart_virt
> > cmp \rp, #0 @ is port configured?
> > cmpne \rv, #0
> > bne 99f @ already configured
>
> The 11f above will fail for omap1 as we already have 11 defined there
> for omap1 uart1. The prepare patch I posted as 2.5/6 fixes that issue.
Thanks, fixed here now.
> This will also allow further clean-up to combine omap1 and omap2+
> debug-macro.S.
I'll leave that to you. My motive was to get rid of PLAT_PHYS_OFFSET so
that mach/memory.h could eventually be deleted further down my patch
series.
Nicolas
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 4.5/6] ARM: omap: pass phys, virt and lsr from uncompress.h to debug-macro.S
2011-09-05 15:07 ` [PATCH 4.5/6] ARM: omap: pass phys, virt and lsr from uncompress.h to debug-macro.S Tony Lindgren
@ 2011-09-06 18:45 ` Nicolas Pitre
0 siblings, 0 replies; 17+ messages in thread
From: Nicolas Pitre @ 2011-09-06 18:45 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 5 Sep 2011, Tony Lindgren wrote:
> Earlier code passed the serial port configuration number as the
> code originally used the scratchpad register in the serial port
> to pass it from uncompress.h to debug-macro.S. This is no longer
> the case as some omaps don't have a serial port. A memory address
> is used instead.
>
> Change the code to pass phys, virt and lsr from uncompress.h
> to debug-macro.S. Note that the virt value is only used on zoom
> boards that have an external 8250 hardware.
>
> This will make it possible to combine omap1 and omap2+ debug-macro.S.
>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
>
[...]
>
> u32 ram_start = (u32)&uart_shift & 0xf8000000;
> u32 *uart_info = (u32 *)(ram_start + OMAP_UART_INFO_OFS);
> - *uart_info = port;
> + *uart_info = (u32)uart_base;
> + uart_info++;
> + *uart_info = (u32)uart_virt;
> + uart_info++;
> + *uart_info = UART_LSR << uart_shift;
Whouldn't this be clearer as:
uart_info[0] = (u32)uart_base;
uart_info[1] = (u32)uart_virt;
uart_info[2] = UART_LSR << uart_shift;
?
Nicolas
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2011-09-06 18:45 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-02 2:59 [PATCH 0/6] OMAP/Davinci debug UART code cleanup Nicolas Pitre
2011-09-02 2:59 ` [PATCH 1/6] ARM: add an extra temp register to the addruart low level debugging macro Nicolas Pitre
2011-09-02 2:59 ` [PATCH 2/6] ARM: plat-omap: make OMAP_UART_INFO into a relative offset Nicolas Pitre
2011-09-05 9:44 ` Tony Lindgren
2011-09-05 19:24 ` Nicolas Pitre
2011-09-05 9:46 ` [PATCH 2.5/6] ARM: omap: prepare debug-macro.S for offset based calculation of omap_uart_phys and virt Tony Lindgren
2011-09-06 18:30 ` Nicolas Pitre
2011-09-02 2:59 ` [PATCH 3/6] ARM: mach-omap1: clean up debug-macro.S Nicolas Pitre
2011-09-05 9:49 ` Tony Lindgren
2011-09-05 9:51 ` Tony Lindgren
2011-09-06 18:33 ` Nicolas Pitre
2011-09-02 2:59 ` [PATCH 4/6] ARM: mach-omap2: " Nicolas Pitre
2011-09-05 9:51 ` Tony Lindgren
2011-09-05 15:07 ` [PATCH 4.5/6] ARM: omap: pass phys, virt and lsr from uncompress.h to debug-macro.S Tony Lindgren
2011-09-06 18:45 ` Nicolas Pitre
2011-09-02 2:59 ` [PATCH 5/6] ARM: mach-davinci: make DAVINCI_UART_INFO into a relative offset Nicolas Pitre
2011-09-02 2:59 ` [PATCH 6/6] ARM: mach-davinci: clean up debug-macro.S Nicolas Pitre
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).