OMAP/Davinci debug UART code cleanup
Subsystems (23)
cover OMAP/Davinci debug UART code cleanup
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
PATCH 1/6 ARM: add an extra temp register to the addruart low level debugging macro
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.
--- 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 +- .../arm/mach-footbridge/include/mach/debug-macro.S | 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(-)
arch/arm/kernel/debug.S +1 -1
@@ -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
arch/arm/kernel/head.S +1 -1
@@ -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
arch/arm/mach-at91/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-clps711x/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-cns3xxx/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-davinci/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-dove/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-ebsa110/include/mach/debug-macro.S +1 -1
@@ -11,7 +11,7 @@ * **/ - .macro addruart, rp, rv + .macro addruart, rp, rv, tmp mov \rp, #0xf0000000 orr \rp, \rp, #0x00000be0 mov \rp, \rv
arch/arm/mach-ep93xx/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-exynos4/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-footbridge/include/mach/debug-macro.S +2 -2
@@ -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
arch/arm/mach-gemini/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-h720x/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-integrator/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-iop13xx/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-iop32x/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-iop33x/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-ixp2000/include/mach/debug-macro.S +1 -1
@@ -11,7 +11,7 @@ * */ - .macro addruart, rp, rv + .macro addruart, rp, rv, tmp mov \rp, #0x00030000 #ifdef __ARMEB__ orr \rp, \rp, #0x00000003
arch/arm/mach-ixp23xx/include/mach/debug-macro.S +1 -1
@@ -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__
arch/arm/mach-ixp4xx/include/mach/debug-macro.S +1 -1
@@ -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.
arch/arm/mach-kirkwood/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-ks8695/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-l7200/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-lpc32xx/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-mmp/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-msm/include/mach/debug-macro.S +2 -2
@@ -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
arch/arm/mach-mv78xx0/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-mxs/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-netx/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-nomadik/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-omap1/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-omap2/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-orion5x/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-pnx4008/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-prima2/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-pxa/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-realview/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-rpc/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-s3c2410/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-s3c64xx/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-s5p64x0/include/mach/debug-macro.S +1 -1
@@ -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 ]
arch/arm/mach-s5pc100/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-s5pv210/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-sa1100/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-shark/include/mach/debug-macro.S +1 -1
@@ -11,7 +11,7 @@ * */ - .macro addruart, rp, rv + .macro addruart, rp, rv, tmp mov \rp, #0xe0000000 orr \rp, \rp, #0x000003f8 mov \rv, \rp
arch/arm/mach-tegra/include/mach/debug-macro.S +1 -1
@@ -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)
arch/arm/mach-u300/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-ux500/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-versatile/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-vexpress/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/mach-vt8500/include/mach/debug-macro.S +1 -1
@@ -11,7 +11,7 @@ * */ - .macro addruart, rp, rv + .macro addruart, rp, rv, tmp mov \rp, #0x00200000 orr \rv, \rp, #0xf8000000 orr \rp, \rp, #0xd8000000
arch/arm/mach-zynq/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/plat-mxc/include/mach/debug-macro.S +1 -1
@@ -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
arch/arm/plat-spear/include/plat/debug-macro.S +1 -1
@@ -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
arch/arm/plat-tcc/include/mach/debug-macro.S +1 -1
@@ -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
Signature · 1 line
1.7.4
PATCH 2/6 ARM: plat-omap: make OMAP_UART_INFO into a relative offset
In reply to Nicolas PitreThis is the first step to remove PLAT_PHYS_OFFSET usage from the debug UART code.
--- 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(-)
arch/arm/mach-omap1/include/mach/debug-macro.S +3 -5
@@ -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?
arch/arm/mach-omap2/include/mach/debug-macro.S +4 -5
@@ -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?
arch/arm/plat-omap/include/plat/serial.h +3 -3
@@ -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
arch/arm/plat-omap/include/plat/uncompress.h +7 -1
@@ -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)
Signature · 1 line
1.7.4
Tony Lindgren
maintainerPATCH 2/6 ARM: plat-omap: make OMAP_UART_INFO into a relative offset
Quoted 25 lines · Nicolas Pitre
arch/arm/mach-omap1/include/mach/debug-macro.S +3
-5@@ -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?arch/arm/mach-omap2/include/mach/debug-macro.S +0
-2@@ -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?
arch/arm/mach-omap2/include/mach/debug-macro.S omap_uart_lsr: .word 0 · line 58
Quoted 10 lines
arch/arm/mach-omap2/include/mach/debug-macro.S +4
-3- 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:
PATCH 2/6 ARM: plat-omap: make OMAP_UART_INFO into a relative offset
Quoted 34 lines · Tony Lindgren
Quoted 33 lines · Nicolas Pitre
arch/arm/mach-omap1/include/mach/debug-macro.S +3
-5@@ -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?arch/arm/mach-omap2/include/mach/debug-macro.S +4
-5@@ -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]
Quoted 7 lines
arch/arm/mach-omap2/include/mach/debug-macro.S omap_uart_lsr: .word 0 · line 58
Quoted 2 lines
arch/arm/mach-omap2/include/mach/debug-macro.S +0
-0/* 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.
Quoted 3 lines
Other than that:
Tested-by Tony Lindgren <[email protected]>
Thanks.
Nicolas
Tony Lindgren
maintainerPATCH 1/1 ARM: omap: prepare debug-macro.S for offset based calculation of omap_uart_phys and virt
In reply to Nicolas PitreJust change 99 to 100 to allow using 99 for omap_uart_phys in the following patches.
arch/arm/mach-omap1/include/mach/debug-macro.S +2 -2
@@ -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
arch/arm/mach-omap2/include/mach/debug-macro.S +2 -2
@@ -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
PATCH 1/1 ARM: omap: prepare debug-macro.S for offset based calculation of omap_uart_phys and virt
Quoted 2 lines · Tony Lindgren
Just change 99 to 100 to allow using 99 for
omap_uart_physin the following patches.
OK I've folded that into 3/6 and 4/6 rather than having a separated patch just for this.
Nicolas
PATCH 3/6 ARM: mach-omap1: clean up debug-macro.S
In reply to Nicolas PitreThis 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.
--- arch/arm/mach-omap1/include/mach/debug-macro.S | 34 ++++++++++------------- 1 files changed, 15 insertions(+), 19 deletions(-)
arch/arm/mach-omap1/include/mach/debug-macro.S +15 -19
@@ -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
Signature · 1 line
1.7.4
Tony Lindgren
maintainerPATCH 3/6 ARM: mach-omap1: clean up debug-macro.S
Quoted 13 lines · Nicolas Pitre
arch/arm/mach-omap1/include/mach/debug-macro.S +0
-7@@ -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]
arch/arm/mach-omap1/include/mach/debug-macro.S omap_uart_virt: .word 0x0 · line 41
Quoted 10 lines
arch/arm/mach-omap1/include/mach/debug-macro.S +7
-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 <[email protected]>
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.
arch/arm/mach-omap1/include/mach/debug-macro.S +15 -19
@@ -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
Tony Lindgren
maintainerPATCH 3/6 ARM: mach-omap1: clean up debug-macro.S
Quoted 30 lines · Tony Lindgren
Quoted 13 lines · Nicolas Pitre
arch/arm/mach-omap1/include/mach/debug-macro.S +0
-7@@ -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]arch/arm/mach-omap1/include/mach/debug-macro.S omap_uart_virt: .word 0x0 · line 41
Quoted 10 lines
arch/arm/mach-omap1/include/mach/debug-macro.S +7
-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 configuredThe 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.
Quoted 1 line
Below is updated version of your patch to use 99f instead of 11f.
Other than that change, this too:
PATCH 3/6 ARM: mach-omap1: clean up debug-macro.S
In reply to Tony LindgrenQuoted 19 lines · Tony Lindgren
Quoted 18 lines · Nicolas Pitre
arch/arm/mach-omap1/include/mach/debug-macro.S +5
-7@@ -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
Quoted 8 lines
arch/arm/mach-omap1/include/mach/debug-macro.S omap_uart_virt: .word 0x0
Quoted 5 lines
arch/arm/mach-omap1/include/mach/debug-macro.S +2
-0+ 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 configuredThe 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.
Quoted 2 lines
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
PATCH 4/6 ARM: mach-omap2: clean up debug-macro.S
In reply to Nicolas PitreThis 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.
--- arch/arm/mach-omap2/include/mach/debug-macro.S | 68 ++++++++++------------- 1 files changed, 30 insertions(+), 38 deletions(-)
arch/arm/mach-omap2/include/mach/debug-macro.S +30 -38
@@ -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
Signature · 1 line
1.7.4
Tony Lindgren
maintainerPATCH 4/6 ARM: mach-omap2: clean up debug-macro.S
Here's this one too updated to use 99f. Other than that:
From: Nicolas Pitre <[email protected]>
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.
arch/arm/mach-omap2/include/mach/debug-macro.S +30 -38
@@ -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
Tony Lindgren
maintainerPATCH 1/1 ARM: omap: pass phys, virt and lsr from uncompress.h to debug-macro.S
In reply to Nicolas PitreEarlier 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.
arch/arm/mach-omap1/include/mach/debug-macro.S +8 -28
@@ -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
arch/arm/mach-omap2/include/mach/debug-macro.S +7 -73
92 lines not on this page · raw message
arch/arm/plat-omap/include/plat/serial.h +1 -24
@@ -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 || \
arch/arm/plat-omap/include/plat/uncompress.h +27 -22
101 lines not on this page · raw message
PATCH 1/1 ARM: omap: pass phys, virt and lsr from uncompress.h to debug-macro.S
Quoted 14 lines · Tony Lindgren
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.htodebug-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.htodebug-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 <[email protected]>
[...]
arch/arm/plat-omap/include/plat/uncompress.h line 51
Quoted 9 lines
arch/arm/plat-omap/include/plat/uncompress.h +5
-1u32 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
PATCH 5/6 ARM: mach-davinci: make DAVINCI_UART_INFO into a relative offset
In reply to Nicolas PitreThis is the first step to remove PLAT_PHYS_OFFSET usage from the debug UART code.
--- 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(-)
arch/arm/mach-davinci/include/mach/debug-macro.S +10 -11
@@ -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:
arch/arm/mach-davinci/include/mach/serial.h +2 -1
@@ -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)
arch/arm/mach-davinci/include/mach/uncompress.h +6 -1
@@ -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;
Signature · 1 line
1.7.4
PATCH 6/6 ARM: mach-davinci: clean up debug-macro.S
In reply to Nicolas PitreThis 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.
--- arch/arm/mach-davinci/include/mach/debug-macro.S | 39 +++++++++------------ 1 files changed, 17 insertions(+), 22 deletions(-)
arch/arm/mach-davinci/include/mach/debug-macro.S +17 -22
@@ -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
Signature · 1 line
1.7.4