Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28362d51 authored by Nicolas Pitre's avatar Nicolas Pitre Committed by Nicolas Pitre
Browse files

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: default avatarNicolas Pitre <nicolas.pitre@linaro.org>
Tested-by: default avatarTony Lindgren <tony@atomide.com>
Reviewed-by: default avatarKevin Hilman <khilman@ti.com>
parent dd185456
Loading
Loading
Loading
Loading
+17 −21
Original line number Original line Diff line number Diff line
@@ -13,13 +13,8 @@


#include <linux/serial_reg.h>
#include <linux/serial_reg.h>


#include <asm/memory.h>

#include <plat/serial.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
		.pushsection .data
omap_uart_phys:	.word	0x0
omap_uart_phys:	.word	0x0
omap_uart_virt:	.word	0x0
omap_uart_virt:	.word	0x0
@@ -34,16 +29,16 @@ omap_uart_virt: .word 0x0
		.macro	addruart, rp, rv, tmp
		.macro	addruart, rp, rv, tmp


		/* Use omap_uart_phys/virt if already configured */
		/* Use omap_uart_phys/virt if already configured */
9:		mrc	p15, 0, \rp, c1, c0
9:		adr	\rp, 99f		@ get effective addr of 99f
		tst	\rp, #1			@ MMU enabled?
		ldr	\rv, [\rp]		@ get absolute addr of 99f
		ldreq	\rp, =omap_uart_v2p(omap_uart_phys)	@ MMU disabled
		sub	\rv, \rv, \rp		@ offset between the two
		ldrne	\rp, =omap_uart_phys	@ MMU enabled
		ldr	\rp, [\rp, #4]		@ abs addr of omap_uart_phys
		add	\rv, \rp, #4		@ omap_uart_virt
		sub	\tmp, \rp, \rv		@ make it effective
		ldr	\rp, [\rp, #0]
		ldr	\rp, [\tmp, #0]		@ omap_uart_phys
		ldr	\rv, [\rv, #0]
		ldr	\rv, [\tmp, #4]		@ omap_uart_virt
		cmp	\rp, #0			@ is port configured?
		cmp	\rp, #0			@ is port configured?
		cmpne	\rv, #0
		cmpne	\rv, #0
		bne	99f			@ already configured
		bne	100f			@ already configured


		/* Check the debug UART configuration set in uncompress.h */
		/* Check the debug UART configuration set in uncompress.h */
		and	\rp, pc, #0xff000000
		and	\rp, pc, #0xff000000
@@ -72,17 +67,18 @@ omap_uart_virt: .word 0x0


		/* Store both phys and virt address for the uart */
		/* Store both phys and virt address for the uart */
98:		add	\rp, \rp, #0xff000000	@ phys base
98:		add	\rp, \rp, #0xff000000	@ phys base
		mrc	p15, 0, \rv, c1, c0
		str	\rp, [\tmp, #0]		@ omap_uart_phys
		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]
		sub	\rp, \rp, #0xff000000	@ phys base
		sub	\rp, \rp, #0xff000000	@ phys base
		add	\rp, \rp, #0xfe000000	@ virt base
		add	\rp, \rp, #0xfe000000	@ virt base
		add	\rv, \rv, #4		@ omap_uart_lsr
		str	\rp, [\tmp, #4]		@ omap_uart_virt
		str	\rp, [\rv, #0]
		b	9b
		b	9b
99:

		.align
99:		.word	.
		.word	omap_uart_phys
		.ltorg

100:
		.endm
		.endm


		.macro	senduart,rd,rx
		.macro	senduart,rd,rx