All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-omap@vger.kernel.org
Subject: [PATCH 4/5] omap: Combine debug-macro.S for omap1 and omap2+
Date: Thu, 03 Feb 2011 17:27:12 -0800	[thread overview]
Message-ID: <20110204012712.26410.70158.stgit@baageli.muru.com> (raw)
In-Reply-To: <20110204012317.26410.55157.stgit@baageli.muru.com>

Now the DEBUG_LL code is the same for all omaps.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap1/include/mach/debug-macro.S |  140 -------------
 arch/arm/mach-omap2/include/mach/debug-macro.S |  191 ------------------
 arch/arm/plat-omap/include/plat/debug-macro.S  |  257 ++++++++++++++++++++++++
 3 files changed, 259 insertions(+), 329 deletions(-)
 create mode 100644 arch/arm/plat-omap/include/plat/debug-macro.S

diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
index bae924e..fbf6f34 100644
--- a/arch/arm/mach-omap1/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -11,142 +11,4 @@
  *
 */
 
-#include <linux/serial_reg.h>
-
-#include <asm/memory.h>
-#include <asm/mach-types.h>
-
-#include <plat/io.h>
-#include <plat/serial.h>
-
-#define omap_uart_v2p(x)	((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET)
-
-		/*
-		 * Intialize the debug serial port based on machine ID
-		 */
-		.macro	inituart, id, a, v
-		mrc	p15, 0, \a, c1, c0
-		tst	\a, #1			@ MMU enabled?
-#ifdef CONFIG_AUTO_ZRELADDR
-		ldreq	\a, =omap_uart_phys
-		biceq	\a, \a, #0xf8000000	@ clear top bits of virt addr
-		moveq	\v, pc			@ copy pc
-		andeq	\v, \v, #0xf8000000	@ clear lower bits
-		orreq	\a, \v			@ combile to get phys addr
-#else
-		ldreq	\a, =omap_uart_v2p(omap_uart_phys)
-#endif
-		ldrne	\a, =omap_uart_phys
-		mov	\v, #(UART_LSR << OMAP_PORT_SHIFT)
-		str	\v, [\a, #8]		@ save lsr, different for 7xx
-
-		/* omap7xx/8xx based boards using uart1 with shift 0 */
-		ldr	\v, =MACH_TYPE_HERALD
-		cmp	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_PERSEUS2
-		cmpne	\id, \v
-		ldreq	\v, =OMAP1_UART1_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =(OMAP1_UART1_BASE - OMAP1_IO_OFFSET)
-		streq	\v, [\a, #4]		@ save port virt addr
-		moveq	\v, #(UART_LSR << OMAP7XX_PORT_SHIFT)
-		streq	\v, [\a, #8]		@ save lsr, different for 7xx
-		beq	999f
-
-		/* omap15xx/16xx based boards using uart1 */
-		ldr	\v, =MACH_TYPE_AMS_DELTA
-		cmp	\id, \v
-		ldrne	\v, =MACH_TYPE_NOKIA770
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_H2
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_H3
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_INNOVATOR
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_OSK
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_PALMTE
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_PALMZ71
-		cmpne	\id, \v
-		ldreq	\v, =OMAP1_UART1_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =(OMAP1_UART1_BASE - OMAP1_IO_OFFSET)
-		streq	\v, [\a, #4]		@ save port virt addr
-		beq	999f
-
-		/* omap15xx/16xx based boards using uart2 */
-		ldr	\v, =MACH_TYPE_OMAP_PALMTT
-		cmp	\id, \v
-		ldreq	\v, =OMAP1_UART2_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =(OMAP1_UART2_BASE - OMAP1_IO_OFFSET)
-		streq	\v, [\a, #4]		@ save port virt addr
-		beq	999f
-
-		/* omap15xx/16xx based boards using uart3 */
-		ldr	\v, =MACH_TYPE_SX1
-		cmp	\id, \v
-		ldreq	\v, =OMAP1_UART3_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =(OMAP1_UART3_BASE - OMAP1_IO_OFFSET)
-		streq	\v, [\a, #4]		@ save port virt addr
-		beq	999f
-
-999:
-		.endm
-
-		/*
-		 * Note that this code won't work if the bootloader passes
-		 * a wrong machine ID number in r1. To debug, just hardcode
-		 * the desired omap_uart_phys, omap_uart_virt and omap_uart_lsr
-		 * temporarily into mach-omap[12]/serial.c and comment out
-		 * the inituart macro above.
-		 */
-		.macro	addruart, rp, rv
-
-		/* Use omap_uart_phys/virt if already configured */
-		mrc	p15, 0, \rp, c1, c0
-		tst	\rp, #1			@ MMU enabled?
-#ifdef CONFIG_AUTO_ZRELADDR
-		ldreq	\rp, =omap_uart_phys	@ MMU disabled
-		biceq	\rp, \rp, #0xf8000000	@ clear top bits of virt addr
-		moveq	\rv, pc			@ copy pc
-		andeq	\rv, \rv, #0xf8000000	@ clear lower bits
-		orreq	\rp, \rv		@ combine to get phys addr
-#else
-		ldreq	\rp, =omap_uart_v2p(omap_uart_phys)	@ MMU disabled
-#endif
-		ldrne	\rp, =omap_uart_phys	@ MMU enabled
-		add	\rv, \rp, #4		@ omap_uart_virt
-		ldr	\rp, [\rp, #0]
-		ldr	\rv, [\rv, #0]
-		.endm
-
-		.macro	senduart,rd,rx
-		strb	\rd, [\rx]
-		.endm
-
-		.macro	busyuart,rd,rx
-1001:		mrc	p15, 0, \rd, c1, c0
-		tst	\rd, #1			@ MMU enabled?
-#ifdef CONFIG_AUTO_ZRELADDR
-		ldreq	\rd, =omap_uart_lsr	@ MMU disabled
-		biceq	\rd, \rd, #0xf8000000	@ clear top bits of virt addr
-		roreq	\rd, \rd, #27		@ rotate bits
-		orreq	\rd, pc, lsr #27	@ orr with top bits of pc
-		roreq	\rd, \rd, #5		@ rotate bits back
-#else
-		ldreq	\rd, =omap_uart_v2p(omap_uart_lsr)	@ MMU disabled
-#endif
-		ldrne	\rd, =omap_uart_lsr	@ MMU enabled
-		ldr	\rd, [\rd, #0]
-		ldrb	\rd, [\rx, \rd]
-		and	\rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
-		teq	\rd, #(UART_LSR_TEMT | UART_LSR_THRE)
-		bne	1001b
-		.endm
-
-		.macro	waituart,rd,rx
-		.endm
+#include <plat/debug-macro.S>
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S
index 80e0bdc..9a7edaf 100644
--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -11,193 +11,4 @@
  *
 */
 
-#include <linux/serial_reg.h>
-
-#include <asm/memory.h>
-#include <asm/mach-types.h>
-
-#include <plat/io.h>
-#include <plat/serial.h>
-
-#define omap_uart_v2p(x)	((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET)
-
-		/*
-		 * Intialize the debug serial port based on machine ID
-		 */
-		.macro	inituart, id, a, v
-		mrc	p15, 0, \a, c1, c0
-		tst	\a, #1			@ MMU enabled?
-		ldreq	\a, =omap_uart_phys
-#ifdef CONFIG_AUTO_ZRELADDR
-		ldreq	\a, =omap_uart_phys
-		biceq	\a, \a, #0xf8000000	@ clear top bits of virt addr
-		moveq	\v, pc			@ copy pc
-		andeq	\v, \v, #0xf8000000	@ clear lower bits
-		orreq	\a, \v			@ combile to get phys addr
-#else
-		ldreq	\a, =omap_uart_v2p(omap_uart_phys)
-#endif
-		ldrne	\a, =omap_uart_phys	@ MMU enabled
-		mov	\v, #(UART_LSR << OMAP_PORT_SHIFT)
-		str	\v, [\a, #8]		@ save lsr, different for zoom
-
-		/* omap2 based boards using uart1 */
-		ldr	\v, =MACH_TYPE_OMAP2EVM
-		cmp	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_2430SDP
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_APOLLON
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_H4
-		cmpne	\id, \v
-		ldreq	\v, =OMAP2_UART1_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =(OMAP2_UART1_BASE + OMAP2_L4_IO_OFFSET)
-		streq	\v, [\a, #4]		@ save port virt addr
-		beq	999f
-
-		/* omap2 based boards using uart3 */
-		ldr	\v, =MACH_TYPE_NOKIA_N800
-		cmp	\id, \v
-		ldrne	\v, =MACH_TYPE_NOKIA_N810
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_NOKIA_N810_WIMAX
-		cmpne	\id, \v
-		ldreq	\v, =OMAP2_UART3_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =(OMAP2_UART3_BASE + OMAP2_L4_IO_OFFSET)
-		streq	\v, [\a, #4]		@ save port virt addr
-		beq	999f
-
-		/* omap3 based boards using uart1 */
-		ldr	\v, =MACH_TYPE_OMAP3EVM
-		cmp	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_3430SDP
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_3630SDP
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP3530_LV_SOM
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP3_TORPEDO
-		cmpne	\id, \v
-		ldreq	\v, =OMAP3_UART1_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =(OMAP3_UART1_BASE + OMAP2_L4_IO_OFFSET)
-		streq	\v, [\a, #4]		@ save port virt addr
-		beq	999f
-
-		/* omap3 based boards using uart3 */
-		ldr	\v, =MACH_TYPE_CM_T35
-		cmp	\id, \v
-		ldrne	\v, =MACH_TYPE_CM_T3517
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_CRANEBOARD
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_DEVKIT8000
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_IGEP0020
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_IGEP0030
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_NOKIA_RM680
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_NOKIA_RX51
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP3517EVM
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP3_BEAGLE
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP3_PANDORA
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_LDP
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OVERO
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_TOUCHBOOK
-		cmpne	\id, \v
-		ldreq	\v, =OMAP3_UART3_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =(OMAP3_UART3_BASE + OMAP2_L4_IO_OFFSET)
-		streq	\v, [\a, #4]		@ save port virt addr
-		beq	999f
-
-		/* omap4 based boards using uart3 */
-		ldr	\v, =MACH_TYPE_OMAP_4430SDP
-		cmp	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP4_PANDA
-		cmpne	\id, \v
-		ldreq	\v, =OMAP4_UART3_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =(OMAP4_UART3_BASE + OMAP2_L4_IO_OFFSET)
-		streq	\v, [\a, #4]		@ save port virt addr
-		beq	999f
-
-		/* zoom2/3 external uart */
-		ldr	\v, =MACH_TYPE_OMAP_ZOOM2
-		cmp	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_ZOOM3
-		cmpne	\id, \v
-		ldreq	\v, =ZOOM_UART_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =ZOOM_UART_VIRT
-		streq	\v, [\a, #4]		@ save port virt addr
-		moveq	\v, #(UART_LSR << ZOOM_PORT_SHIFT)
-		streq	\v, [\a, #8]		@ save lsr, different for zoom
-		beq	999f
-
-999:
-		.endm
-
-		/*
-		 * Note that this code won't work if the bootloader passes
-		 * a wrong machine ID number in r1. To debug, just hardcode
-		 * the desired omap_uart_phys, omap_uart_virt and omap_uart_lsr
-		 * temporarily into mach-omap[12]/serial.c and comment out
-		 * the inituart macro above.
-		 */
-		.macro	addruart, rp, rv
-
-		/* Use omap_uart_phys/virt if already configured */
-		mrc	p15, 0, \rp, c1, c0
-		tst	\rp, #1			@ MMU enabled?
-#ifdef CONFIG_AUTO_ZRELADDR
-		ldreq	\rp, =omap_uart_phys	@ MMU disabled
-		biceq	\rp, \rp, #0xf8000000	@ clear top bits of virt addr
-		moveq	\rv, pc			@ copy pc
-		andeq	\rv, \rv, #0xf8000000	@ clear lower bits
-		orreq	\rp, \rv		@ combine to get phys addr
-#else
-		ldreq	\rp, =omap_uart_v2p(omap_uart_phys)	@ MMU disabled
-#endif
-		ldrne	\rp, =omap_uart_phys	@ MMU enabled
-		add	\rv, \rp, #4		@ omap_uart_virt
-		ldr	\rp, [\rp, #0]
-		ldr	\rv, [\rv, #0]
-		.endm
-
-		.macro	senduart,rd,rx
-		strb	\rd, [\rx]
-		.endm
-
-		.macro	busyuart,rd,rx
-1001:		mrc	p15, 0, \rd, c1, c0
-		tst	\rd, #1			@ MMU enabled?
-#ifdef CONFIG_AUTO_ZRELADDR
-		ldreq	\rd, =omap_uart_lsr	@ MMU disabled
-		biceq	\rd, \rd, #0xf8000000	@ clear top bits of virt addr
-		roreq	\rd, \rd, #27		@ rotate bits
-		orreq	\rd, pc, lsr #27	@ orr with top bits of pc
-		roreq	\rd, \rd, #5		@ rotate bits back
-#else
-		ldreq	\rd, =omap_uart_v2p(omap_uart_lsr)	@ MMU disabled
-#endif
-		ldrne	\rd, =omap_uart_lsr	@ MMU enabled
-		ldr	\rd, [\rd, #0]
-		ldrb	\rd, [\rx, \rd]
-		and	\rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
-		teq	\rd, #(UART_LSR_TEMT | UART_LSR_THRE)
-		bne	1001b
-		.endm
-
-		.macro	waituart,rd,rx
-		.endm
+#include <plat/debug-macro.S>
diff --git a/arch/arm/plat-omap/include/plat/debug-macro.S b/arch/arm/plat-omap/include/plat/debug-macro.S
new file mode 100644
index 0000000..1a1a5e8
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/debug-macro.S
@@ -0,0 +1,257 @@
+/* arch/arm/plat-omap/include/mach/debug-macro.S
+ *
+ * Debugging macro include header
+ *
+ *  Copyright (C) 1994-1999 Russell King
+ *  Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+*/
+
+#include <linux/serial_reg.h>
+
+#include <asm/memory.h>
+#include <asm/mach-types.h>
+
+#include <plat/io.h>
+#include <plat/serial.h>
+
+#define omap_uart_v2p(x)	((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET)
+
+		/*
+		 * Intialize the debug serial port based on machine ID
+		 */
+		.macro	inituart, id, a, v
+		mrc	p15, 0, \a, c1, c0
+		tst	\a, #1			@ MMU enabled?
+		ldreq	\a, =omap_uart_phys
+#ifdef CONFIG_AUTO_ZRELADDR
+		ldreq	\a, =omap_uart_phys
+		biceq	\a, \a, #0xf8000000	@ clear top bits of virt addr
+		moveq	\v, pc			@ copy pc
+		andeq	\v, \v, #0xf8000000	@ clear lower bits
+		orreq	\a, \v			@ combile to get phys addr
+#else
+		ldreq	\a, =omap_uart_v2p(omap_uart_phys)
+#endif
+		ldrne	\a, =omap_uart_phys	@ MMU enabled
+		mov	\v, #(UART_LSR << OMAP_PORT_SHIFT)
+		str	\v, [\a, #8]		@ save lsr, different for zoom
+
+		/* omap7xx/8xx based boards using uart1 with shift 0 */
+		ldr	\v, =MACH_TYPE_HERALD
+		cmp	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_PERSEUS2
+		cmpne	\id, \v
+		ldreq	\v, =OMAP1_UART1_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =(OMAP1_UART1_BASE - OMAP1_IO_OFFSET)
+		streq	\v, [\a, #4]		@ save port virt addr
+		moveq	\v, #(UART_LSR << OMAP7XX_PORT_SHIFT)
+		streq	\v, [\a, #8]		@ save lsr, different for 7xx
+		beq	999f
+
+		/* omap15xx/16xx based boards using uart1 */
+		ldr	\v, =MACH_TYPE_AMS_DELTA
+		cmp	\id, \v
+		ldrne	\v, =MACH_TYPE_NOKIA770
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_H2
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_H3
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_INNOVATOR
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_OSK
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_PALMTE
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_PALMZ71
+		cmpne	\id, \v
+		ldreq	\v, =OMAP1_UART1_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =(OMAP1_UART1_BASE - OMAP1_IO_OFFSET)
+		streq	\v, [\a, #4]		@ save port virt addr
+		beq	999f
+
+		/* omap15xx/16xx based boards using uart2 */
+		ldr	\v, =MACH_TYPE_OMAP_PALMTT
+		cmp	\id, \v
+		ldreq	\v, =OMAP1_UART2_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =(OMAP1_UART2_BASE - OMAP1_IO_OFFSET)
+		streq	\v, [\a, #4]		@ save port virt addr
+		beq	999f
+
+		/* omap15xx/16xx based boards using uart3 */
+		ldr	\v, =MACH_TYPE_SX1
+		cmp	\id, \v
+		ldreq	\v, =OMAP1_UART3_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =(OMAP1_UART3_BASE - OMAP1_IO_OFFSET)
+		streq	\v, [\a, #4]		@ save port virt addr
+		beq	999f
+
+		/* omap2 based boards using uart1 */
+		ldr	\v, =MACH_TYPE_OMAP2EVM
+		cmp	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_2430SDP
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_APOLLON
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_H4
+		cmpne	\id, \v
+		ldreq	\v, =OMAP2_UART1_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =(OMAP2_UART1_BASE + OMAP2_L4_IO_OFFSET)
+		streq	\v, [\a, #4]		@ save port virt addr
+		beq	999f
+
+		/* omap2 based boards using uart3 */
+		ldr	\v, =MACH_TYPE_NOKIA_N800
+		cmp	\id, \v
+		ldrne	\v, =MACH_TYPE_NOKIA_N810
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_NOKIA_N810_WIMAX
+		cmpne	\id, \v
+		ldreq	\v, =OMAP2_UART3_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =(OMAP2_UART3_BASE + OMAP2_L4_IO_OFFSET)
+		streq	\v, [\a, #4]		@ save port virt addr
+		beq	999f
+
+		/* omap3 based boards using uart1 */
+		ldr	\v, =MACH_TYPE_OMAP3EVM
+		cmp	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_3430SDP
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_3630SDP
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP3530_LV_SOM
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP3_TORPEDO
+		cmpne	\id, \v
+		ldreq	\v, =OMAP3_UART1_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =(OMAP3_UART1_BASE + OMAP2_L4_IO_OFFSET)
+		streq	\v, [\a, #4]		@ save port virt addr
+		beq	999f
+
+		/* omap3 based boards using uart3 */
+		ldr	\v, =MACH_TYPE_CM_T35
+		cmp	\id, \v
+		ldrne	\v, =MACH_TYPE_CM_T3517
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_CRANEBOARD
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_DEVKIT8000
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_IGEP0020
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_IGEP0030
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_NOKIA_RM680
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_NOKIA_RX51
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP3517EVM
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP3_BEAGLE
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP3_PANDORA
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_LDP
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OVERO
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_TOUCHBOOK
+		cmpne	\id, \v
+		ldreq	\v, =OMAP3_UART3_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =(OMAP3_UART3_BASE + OMAP2_L4_IO_OFFSET)
+		streq	\v, [\a, #4]		@ save port virt addr
+		beq	999f
+
+		/* omap4 based boards using uart3 */
+		ldr	\v, =MACH_TYPE_OMAP_4430SDP
+		cmp	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP4_PANDA
+		cmpne	\id, \v
+		ldreq	\v, =OMAP4_UART3_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =(OMAP4_UART3_BASE + OMAP2_L4_IO_OFFSET)
+		streq	\v, [\a, #4]		@ save port virt addr
+		beq	999f
+
+		/* zoom2/3 external uart */
+		ldr	\v, =MACH_TYPE_OMAP_ZOOM2
+		cmp	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_ZOOM3
+		cmpne	\id, \v
+		ldreq	\v, =ZOOM_UART_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =ZOOM_UART_VIRT
+		streq	\v, [\a, #4]		@ save port virt addr
+		moveq	\v, #(UART_LSR << ZOOM_PORT_SHIFT)
+		streq	\v, [\a, #8]		@ save lsr, different for zoom
+		beq	999f
+
+999:
+		.endm
+
+		/*
+		 * Note that this code won't work if the bootloader passes
+		 * a wrong machine ID number in r1. To debug, just hardcode
+		 * the desired omap_uart_phys, omap_uart_virt and omap_uart_lsr
+		 * temporarily into mach-omap[12]/serial.c and comment out
+		 * the inituart macro above.
+		 */
+		.macro	addruart, rp, rv
+
+		/* Use omap_uart_phys/virt if already configured */
+		mrc	p15, 0, \rp, c1, c0
+		tst	\rp, #1			@ MMU enabled?
+#ifdef CONFIG_AUTO_ZRELADDR
+		ldreq	\rp, =omap_uart_phys	@ MMU disabled
+		biceq	\rp, \rp, #0xf8000000	@ clear top bits of virt addr
+		moveq	\rv, pc			@ copy pc
+		andeq	\rv, \rv, #0xf8000000	@ clear lower bits
+		orreq	\rp, \rv		@ combine to get phys addr
+#else
+		ldreq	\rp, =omap_uart_v2p(omap_uart_phys)	@ MMU disabled
+#endif
+		ldrne	\rp, =omap_uart_phys	@ MMU enabled
+		add	\rv, \rp, #4		@ omap_uart_virt
+		ldr	\rp, [\rp, #0]
+		ldr	\rv, [\rv, #0]
+		.endm
+
+		.macro	senduart,rd,rx
+		strb	\rd, [\rx]
+		.endm
+
+		.macro	busyuart,rd,rx
+1001:		mrc	p15, 0, \rd, c1, c0
+		tst	\rd, #1			@ MMU enabled?
+#ifdef CONFIG_AUTO_ZRELADDR
+		ldreq	\rd, =omap_uart_lsr	@ MMU disabled
+		biceq	\rd, \rd, #0xf8000000	@ clear top bits of virt addr
+		roreq	\rd, \rd, #27		@ rotate bits
+		orreq	\rd, pc, lsr #27	@ orr with top bits of pc
+		roreq	\rd, \rd, #5		@ rotate bits back
+#else
+		ldreq	\rd, =omap_uart_v2p(omap_uart_lsr)	@ MMU disabled
+#endif
+		ldrne	\rd, =omap_uart_lsr	@ MMU enabled
+		ldr	\rd, [\rd, #0]
+		ldrb	\rd, [\rx, \rd]
+		and	\rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
+		teq	\rd, #(UART_LSR_TEMT | UART_LSR_THRE)
+		bne	1001b
+		.endm
+
+		.macro	waituart,rd,rx
+		.endm


WARNING: multiple messages have this Message-ID (diff)
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/5] omap: Combine debug-macro.S for omap1 and omap2+
Date: Thu, 03 Feb 2011 17:27:12 -0800	[thread overview]
Message-ID: <20110204012712.26410.70158.stgit@baageli.muru.com> (raw)
In-Reply-To: <20110204012317.26410.55157.stgit@baageli.muru.com>

Now the DEBUG_LL code is the same for all omaps.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap1/include/mach/debug-macro.S |  140 -------------
 arch/arm/mach-omap2/include/mach/debug-macro.S |  191 ------------------
 arch/arm/plat-omap/include/plat/debug-macro.S  |  257 ++++++++++++++++++++++++
 3 files changed, 259 insertions(+), 329 deletions(-)
 create mode 100644 arch/arm/plat-omap/include/plat/debug-macro.S

diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
index bae924e..fbf6f34 100644
--- a/arch/arm/mach-omap1/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -11,142 +11,4 @@
  *
 */
 
-#include <linux/serial_reg.h>
-
-#include <asm/memory.h>
-#include <asm/mach-types.h>
-
-#include <plat/io.h>
-#include <plat/serial.h>
-
-#define omap_uart_v2p(x)	((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET)
-
-		/*
-		 * Intialize the debug serial port based on machine ID
-		 */
-		.macro	inituart, id, a, v
-		mrc	p15, 0, \a, c1, c0
-		tst	\a, #1			@ MMU enabled?
-#ifdef CONFIG_AUTO_ZRELADDR
-		ldreq	\a, =omap_uart_phys
-		biceq	\a, \a, #0xf8000000	@ clear top bits of virt addr
-		moveq	\v, pc			@ copy pc
-		andeq	\v, \v, #0xf8000000	@ clear lower bits
-		orreq	\a, \v			@ combile to get phys addr
-#else
-		ldreq	\a, =omap_uart_v2p(omap_uart_phys)
-#endif
-		ldrne	\a, =omap_uart_phys
-		mov	\v, #(UART_LSR << OMAP_PORT_SHIFT)
-		str	\v, [\a, #8]		@ save lsr, different for 7xx
-
-		/* omap7xx/8xx based boards using uart1 with shift 0 */
-		ldr	\v, =MACH_TYPE_HERALD
-		cmp	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_PERSEUS2
-		cmpne	\id, \v
-		ldreq	\v, =OMAP1_UART1_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =(OMAP1_UART1_BASE - OMAP1_IO_OFFSET)
-		streq	\v, [\a, #4]		@ save port virt addr
-		moveq	\v, #(UART_LSR << OMAP7XX_PORT_SHIFT)
-		streq	\v, [\a, #8]		@ save lsr, different for 7xx
-		beq	999f
-
-		/* omap15xx/16xx based boards using uart1 */
-		ldr	\v, =MACH_TYPE_AMS_DELTA
-		cmp	\id, \v
-		ldrne	\v, =MACH_TYPE_NOKIA770
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_H2
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_H3
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_INNOVATOR
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_OSK
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_PALMTE
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_PALMZ71
-		cmpne	\id, \v
-		ldreq	\v, =OMAP1_UART1_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =(OMAP1_UART1_BASE - OMAP1_IO_OFFSET)
-		streq	\v, [\a, #4]		@ save port virt addr
-		beq	999f
-
-		/* omap15xx/16xx based boards using uart2 */
-		ldr	\v, =MACH_TYPE_OMAP_PALMTT
-		cmp	\id, \v
-		ldreq	\v, =OMAP1_UART2_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =(OMAP1_UART2_BASE - OMAP1_IO_OFFSET)
-		streq	\v, [\a, #4]		@ save port virt addr
-		beq	999f
-
-		/* omap15xx/16xx based boards using uart3 */
-		ldr	\v, =MACH_TYPE_SX1
-		cmp	\id, \v
-		ldreq	\v, =OMAP1_UART3_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =(OMAP1_UART3_BASE - OMAP1_IO_OFFSET)
-		streq	\v, [\a, #4]		@ save port virt addr
-		beq	999f
-
-999:
-		.endm
-
-		/*
-		 * Note that this code won't work if the bootloader passes
-		 * a wrong machine ID number in r1. To debug, just hardcode
-		 * the desired omap_uart_phys, omap_uart_virt and omap_uart_lsr
-		 * temporarily into mach-omap[12]/serial.c and comment out
-		 * the inituart macro above.
-		 */
-		.macro	addruart, rp, rv
-
-		/* Use omap_uart_phys/virt if already configured */
-		mrc	p15, 0, \rp, c1, c0
-		tst	\rp, #1			@ MMU enabled?
-#ifdef CONFIG_AUTO_ZRELADDR
-		ldreq	\rp, =omap_uart_phys	@ MMU disabled
-		biceq	\rp, \rp, #0xf8000000	@ clear top bits of virt addr
-		moveq	\rv, pc			@ copy pc
-		andeq	\rv, \rv, #0xf8000000	@ clear lower bits
-		orreq	\rp, \rv		@ combine to get phys addr
-#else
-		ldreq	\rp, =omap_uart_v2p(omap_uart_phys)	@ MMU disabled
-#endif
-		ldrne	\rp, =omap_uart_phys	@ MMU enabled
-		add	\rv, \rp, #4		@ omap_uart_virt
-		ldr	\rp, [\rp, #0]
-		ldr	\rv, [\rv, #0]
-		.endm
-
-		.macro	senduart,rd,rx
-		strb	\rd, [\rx]
-		.endm
-
-		.macro	busyuart,rd,rx
-1001:		mrc	p15, 0, \rd, c1, c0
-		tst	\rd, #1			@ MMU enabled?
-#ifdef CONFIG_AUTO_ZRELADDR
-		ldreq	\rd, =omap_uart_lsr	@ MMU disabled
-		biceq	\rd, \rd, #0xf8000000	@ clear top bits of virt addr
-		roreq	\rd, \rd, #27		@ rotate bits
-		orreq	\rd, pc, lsr #27	@ orr with top bits of pc
-		roreq	\rd, \rd, #5		@ rotate bits back
-#else
-		ldreq	\rd, =omap_uart_v2p(omap_uart_lsr)	@ MMU disabled
-#endif
-		ldrne	\rd, =omap_uart_lsr	@ MMU enabled
-		ldr	\rd, [\rd, #0]
-		ldrb	\rd, [\rx, \rd]
-		and	\rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
-		teq	\rd, #(UART_LSR_TEMT | UART_LSR_THRE)
-		bne	1001b
-		.endm
-
-		.macro	waituart,rd,rx
-		.endm
+#include <plat/debug-macro.S>
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S
index 80e0bdc..9a7edaf 100644
--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -11,193 +11,4 @@
  *
 */
 
-#include <linux/serial_reg.h>
-
-#include <asm/memory.h>
-#include <asm/mach-types.h>
-
-#include <plat/io.h>
-#include <plat/serial.h>
-
-#define omap_uart_v2p(x)	((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET)
-
-		/*
-		 * Intialize the debug serial port based on machine ID
-		 */
-		.macro	inituart, id, a, v
-		mrc	p15, 0, \a, c1, c0
-		tst	\a, #1			@ MMU enabled?
-		ldreq	\a, =omap_uart_phys
-#ifdef CONFIG_AUTO_ZRELADDR
-		ldreq	\a, =omap_uart_phys
-		biceq	\a, \a, #0xf8000000	@ clear top bits of virt addr
-		moveq	\v, pc			@ copy pc
-		andeq	\v, \v, #0xf8000000	@ clear lower bits
-		orreq	\a, \v			@ combile to get phys addr
-#else
-		ldreq	\a, =omap_uart_v2p(omap_uart_phys)
-#endif
-		ldrne	\a, =omap_uart_phys	@ MMU enabled
-		mov	\v, #(UART_LSR << OMAP_PORT_SHIFT)
-		str	\v, [\a, #8]		@ save lsr, different for zoom
-
-		/* omap2 based boards using uart1 */
-		ldr	\v, =MACH_TYPE_OMAP2EVM
-		cmp	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_2430SDP
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_APOLLON
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_H4
-		cmpne	\id, \v
-		ldreq	\v, =OMAP2_UART1_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =(OMAP2_UART1_BASE + OMAP2_L4_IO_OFFSET)
-		streq	\v, [\a, #4]		@ save port virt addr
-		beq	999f
-
-		/* omap2 based boards using uart3 */
-		ldr	\v, =MACH_TYPE_NOKIA_N800
-		cmp	\id, \v
-		ldrne	\v, =MACH_TYPE_NOKIA_N810
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_NOKIA_N810_WIMAX
-		cmpne	\id, \v
-		ldreq	\v, =OMAP2_UART3_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =(OMAP2_UART3_BASE + OMAP2_L4_IO_OFFSET)
-		streq	\v, [\a, #4]		@ save port virt addr
-		beq	999f
-
-		/* omap3 based boards using uart1 */
-		ldr	\v, =MACH_TYPE_OMAP3EVM
-		cmp	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_3430SDP
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_3630SDP
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP3530_LV_SOM
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP3_TORPEDO
-		cmpne	\id, \v
-		ldreq	\v, =OMAP3_UART1_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =(OMAP3_UART1_BASE + OMAP2_L4_IO_OFFSET)
-		streq	\v, [\a, #4]		@ save port virt addr
-		beq	999f
-
-		/* omap3 based boards using uart3 */
-		ldr	\v, =MACH_TYPE_CM_T35
-		cmp	\id, \v
-		ldrne	\v, =MACH_TYPE_CM_T3517
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_CRANEBOARD
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_DEVKIT8000
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_IGEP0020
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_IGEP0030
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_NOKIA_RM680
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_NOKIA_RX51
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP3517EVM
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP3_BEAGLE
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP3_PANDORA
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_LDP
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_OVERO
-		cmpne	\id, \v
-		ldrne	\v, =MACH_TYPE_TOUCHBOOK
-		cmpne	\id, \v
-		ldreq	\v, =OMAP3_UART3_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =(OMAP3_UART3_BASE + OMAP2_L4_IO_OFFSET)
-		streq	\v, [\a, #4]		@ save port virt addr
-		beq	999f
-
-		/* omap4 based boards using uart3 */
-		ldr	\v, =MACH_TYPE_OMAP_4430SDP
-		cmp	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP4_PANDA
-		cmpne	\id, \v
-		ldreq	\v, =OMAP4_UART3_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =(OMAP4_UART3_BASE + OMAP2_L4_IO_OFFSET)
-		streq	\v, [\a, #4]		@ save port virt addr
-		beq	999f
-
-		/* zoom2/3 external uart */
-		ldr	\v, =MACH_TYPE_OMAP_ZOOM2
-		cmp	\id, \v
-		ldrne	\v, =MACH_TYPE_OMAP_ZOOM3
-		cmpne	\id, \v
-		ldreq	\v, =ZOOM_UART_BASE
-		streq	\v, [\a, #0]		@ save port phys addr
-		ldreq	\v, =ZOOM_UART_VIRT
-		streq	\v, [\a, #4]		@ save port virt addr
-		moveq	\v, #(UART_LSR << ZOOM_PORT_SHIFT)
-		streq	\v, [\a, #8]		@ save lsr, different for zoom
-		beq	999f
-
-999:
-		.endm
-
-		/*
-		 * Note that this code won't work if the bootloader passes
-		 * a wrong machine ID number in r1. To debug, just hardcode
-		 * the desired omap_uart_phys, omap_uart_virt and omap_uart_lsr
-		 * temporarily into mach-omap[12]/serial.c and comment out
-		 * the inituart macro above.
-		 */
-		.macro	addruart, rp, rv
-
-		/* Use omap_uart_phys/virt if already configured */
-		mrc	p15, 0, \rp, c1, c0
-		tst	\rp, #1			@ MMU enabled?
-#ifdef CONFIG_AUTO_ZRELADDR
-		ldreq	\rp, =omap_uart_phys	@ MMU disabled
-		biceq	\rp, \rp, #0xf8000000	@ clear top bits of virt addr
-		moveq	\rv, pc			@ copy pc
-		andeq	\rv, \rv, #0xf8000000	@ clear lower bits
-		orreq	\rp, \rv		@ combine to get phys addr
-#else
-		ldreq	\rp, =omap_uart_v2p(omap_uart_phys)	@ MMU disabled
-#endif
-		ldrne	\rp, =omap_uart_phys	@ MMU enabled
-		add	\rv, \rp, #4		@ omap_uart_virt
-		ldr	\rp, [\rp, #0]
-		ldr	\rv, [\rv, #0]
-		.endm
-
-		.macro	senduart,rd,rx
-		strb	\rd, [\rx]
-		.endm
-
-		.macro	busyuart,rd,rx
-1001:		mrc	p15, 0, \rd, c1, c0
-		tst	\rd, #1			@ MMU enabled?
-#ifdef CONFIG_AUTO_ZRELADDR
-		ldreq	\rd, =omap_uart_lsr	@ MMU disabled
-		biceq	\rd, \rd, #0xf8000000	@ clear top bits of virt addr
-		roreq	\rd, \rd, #27		@ rotate bits
-		orreq	\rd, pc, lsr #27	@ orr with top bits of pc
-		roreq	\rd, \rd, #5		@ rotate bits back
-#else
-		ldreq	\rd, =omap_uart_v2p(omap_uart_lsr)	@ MMU disabled
-#endif
-		ldrne	\rd, =omap_uart_lsr	@ MMU enabled
-		ldr	\rd, [\rd, #0]
-		ldrb	\rd, [\rx, \rd]
-		and	\rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
-		teq	\rd, #(UART_LSR_TEMT | UART_LSR_THRE)
-		bne	1001b
-		.endm
-
-		.macro	waituart,rd,rx
-		.endm
+#include <plat/debug-macro.S>
diff --git a/arch/arm/plat-omap/include/plat/debug-macro.S b/arch/arm/plat-omap/include/plat/debug-macro.S
new file mode 100644
index 0000000..1a1a5e8
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/debug-macro.S
@@ -0,0 +1,257 @@
+/* arch/arm/plat-omap/include/mach/debug-macro.S
+ *
+ * Debugging macro include header
+ *
+ *  Copyright (C) 1994-1999 Russell King
+ *  Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+*/
+
+#include <linux/serial_reg.h>
+
+#include <asm/memory.h>
+#include <asm/mach-types.h>
+
+#include <plat/io.h>
+#include <plat/serial.h>
+
+#define omap_uart_v2p(x)	((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET)
+
+		/*
+		 * Intialize the debug serial port based on machine ID
+		 */
+		.macro	inituart, id, a, v
+		mrc	p15, 0, \a, c1, c0
+		tst	\a, #1			@ MMU enabled?
+		ldreq	\a, =omap_uart_phys
+#ifdef CONFIG_AUTO_ZRELADDR
+		ldreq	\a, =omap_uart_phys
+		biceq	\a, \a, #0xf8000000	@ clear top bits of virt addr
+		moveq	\v, pc			@ copy pc
+		andeq	\v, \v, #0xf8000000	@ clear lower bits
+		orreq	\a, \v			@ combile to get phys addr
+#else
+		ldreq	\a, =omap_uart_v2p(omap_uart_phys)
+#endif
+		ldrne	\a, =omap_uart_phys	@ MMU enabled
+		mov	\v, #(UART_LSR << OMAP_PORT_SHIFT)
+		str	\v, [\a, #8]		@ save lsr, different for zoom
+
+		/* omap7xx/8xx based boards using uart1 with shift 0 */
+		ldr	\v, =MACH_TYPE_HERALD
+		cmp	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_PERSEUS2
+		cmpne	\id, \v
+		ldreq	\v, =OMAP1_UART1_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =(OMAP1_UART1_BASE - OMAP1_IO_OFFSET)
+		streq	\v, [\a, #4]		@ save port virt addr
+		moveq	\v, #(UART_LSR << OMAP7XX_PORT_SHIFT)
+		streq	\v, [\a, #8]		@ save lsr, different for 7xx
+		beq	999f
+
+		/* omap15xx/16xx based boards using uart1 */
+		ldr	\v, =MACH_TYPE_AMS_DELTA
+		cmp	\id, \v
+		ldrne	\v, =MACH_TYPE_NOKIA770
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_H2
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_H3
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_INNOVATOR
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_OSK
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_PALMTE
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_PALMZ71
+		cmpne	\id, \v
+		ldreq	\v, =OMAP1_UART1_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =(OMAP1_UART1_BASE - OMAP1_IO_OFFSET)
+		streq	\v, [\a, #4]		@ save port virt addr
+		beq	999f
+
+		/* omap15xx/16xx based boards using uart2 */
+		ldr	\v, =MACH_TYPE_OMAP_PALMTT
+		cmp	\id, \v
+		ldreq	\v, =OMAP1_UART2_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =(OMAP1_UART2_BASE - OMAP1_IO_OFFSET)
+		streq	\v, [\a, #4]		@ save port virt addr
+		beq	999f
+
+		/* omap15xx/16xx based boards using uart3 */
+		ldr	\v, =MACH_TYPE_SX1
+		cmp	\id, \v
+		ldreq	\v, =OMAP1_UART3_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =(OMAP1_UART3_BASE - OMAP1_IO_OFFSET)
+		streq	\v, [\a, #4]		@ save port virt addr
+		beq	999f
+
+		/* omap2 based boards using uart1 */
+		ldr	\v, =MACH_TYPE_OMAP2EVM
+		cmp	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_2430SDP
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_APOLLON
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_H4
+		cmpne	\id, \v
+		ldreq	\v, =OMAP2_UART1_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =(OMAP2_UART1_BASE + OMAP2_L4_IO_OFFSET)
+		streq	\v, [\a, #4]		@ save port virt addr
+		beq	999f
+
+		/* omap2 based boards using uart3 */
+		ldr	\v, =MACH_TYPE_NOKIA_N800
+		cmp	\id, \v
+		ldrne	\v, =MACH_TYPE_NOKIA_N810
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_NOKIA_N810_WIMAX
+		cmpne	\id, \v
+		ldreq	\v, =OMAP2_UART3_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =(OMAP2_UART3_BASE + OMAP2_L4_IO_OFFSET)
+		streq	\v, [\a, #4]		@ save port virt addr
+		beq	999f
+
+		/* omap3 based boards using uart1 */
+		ldr	\v, =MACH_TYPE_OMAP3EVM
+		cmp	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_3430SDP
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_3630SDP
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP3530_LV_SOM
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP3_TORPEDO
+		cmpne	\id, \v
+		ldreq	\v, =OMAP3_UART1_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =(OMAP3_UART1_BASE + OMAP2_L4_IO_OFFSET)
+		streq	\v, [\a, #4]		@ save port virt addr
+		beq	999f
+
+		/* omap3 based boards using uart3 */
+		ldr	\v, =MACH_TYPE_CM_T35
+		cmp	\id, \v
+		ldrne	\v, =MACH_TYPE_CM_T3517
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_CRANEBOARD
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_DEVKIT8000
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_IGEP0020
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_IGEP0030
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_NOKIA_RM680
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_NOKIA_RX51
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP3517EVM
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP3_BEAGLE
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP3_PANDORA
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_LDP
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_OVERO
+		cmpne	\id, \v
+		ldrne	\v, =MACH_TYPE_TOUCHBOOK
+		cmpne	\id, \v
+		ldreq	\v, =OMAP3_UART3_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =(OMAP3_UART3_BASE + OMAP2_L4_IO_OFFSET)
+		streq	\v, [\a, #4]		@ save port virt addr
+		beq	999f
+
+		/* omap4 based boards using uart3 */
+		ldr	\v, =MACH_TYPE_OMAP_4430SDP
+		cmp	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP4_PANDA
+		cmpne	\id, \v
+		ldreq	\v, =OMAP4_UART3_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =(OMAP4_UART3_BASE + OMAP2_L4_IO_OFFSET)
+		streq	\v, [\a, #4]		@ save port virt addr
+		beq	999f
+
+		/* zoom2/3 external uart */
+		ldr	\v, =MACH_TYPE_OMAP_ZOOM2
+		cmp	\id, \v
+		ldrne	\v, =MACH_TYPE_OMAP_ZOOM3
+		cmpne	\id, \v
+		ldreq	\v, =ZOOM_UART_BASE
+		streq	\v, [\a, #0]		@ save port phys addr
+		ldreq	\v, =ZOOM_UART_VIRT
+		streq	\v, [\a, #4]		@ save port virt addr
+		moveq	\v, #(UART_LSR << ZOOM_PORT_SHIFT)
+		streq	\v, [\a, #8]		@ save lsr, different for zoom
+		beq	999f
+
+999:
+		.endm
+
+		/*
+		 * Note that this code won't work if the bootloader passes
+		 * a wrong machine ID number in r1. To debug, just hardcode
+		 * the desired omap_uart_phys, omap_uart_virt and omap_uart_lsr
+		 * temporarily into mach-omap[12]/serial.c and comment out
+		 * the inituart macro above.
+		 */
+		.macro	addruart, rp, rv
+
+		/* Use omap_uart_phys/virt if already configured */
+		mrc	p15, 0, \rp, c1, c0
+		tst	\rp, #1			@ MMU enabled?
+#ifdef CONFIG_AUTO_ZRELADDR
+		ldreq	\rp, =omap_uart_phys	@ MMU disabled
+		biceq	\rp, \rp, #0xf8000000	@ clear top bits of virt addr
+		moveq	\rv, pc			@ copy pc
+		andeq	\rv, \rv, #0xf8000000	@ clear lower bits
+		orreq	\rp, \rv		@ combine to get phys addr
+#else
+		ldreq	\rp, =omap_uart_v2p(omap_uart_phys)	@ MMU disabled
+#endif
+		ldrne	\rp, =omap_uart_phys	@ MMU enabled
+		add	\rv, \rp, #4		@ omap_uart_virt
+		ldr	\rp, [\rp, #0]
+		ldr	\rv, [\rv, #0]
+		.endm
+
+		.macro	senduart,rd,rx
+		strb	\rd, [\rx]
+		.endm
+
+		.macro	busyuart,rd,rx
+1001:		mrc	p15, 0, \rd, c1, c0
+		tst	\rd, #1			@ MMU enabled?
+#ifdef CONFIG_AUTO_ZRELADDR
+		ldreq	\rd, =omap_uart_lsr	@ MMU disabled
+		biceq	\rd, \rd, #0xf8000000	@ clear top bits of virt addr
+		roreq	\rd, \rd, #27		@ rotate bits
+		orreq	\rd, pc, lsr #27	@ orr with top bits of pc
+		roreq	\rd, \rd, #5		@ rotate bits back
+#else
+		ldreq	\rd, =omap_uart_v2p(omap_uart_lsr)	@ MMU disabled
+#endif
+		ldrne	\rd, =omap_uart_lsr	@ MMU enabled
+		ldr	\rd, [\rd, #0]
+		ldrb	\rd, [\rx, \rd]
+		and	\rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
+		teq	\rd, #(UART_LSR_TEMT | UART_LSR_THRE)
+		bne	1001b
+		.endm
+
+		.macro	waituart,rd,rx
+		.endm

  parent reply	other threads:[~2011-02-04  1:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-04  1:26 [PATCH 0/5] Change omap DEBUG_LL code to use inituart for AUTO_ZRELADDR and ARM_PATCH_PHYS_VIRT Tony Lindgren
2011-02-04  1:26 ` Tony Lindgren
2011-02-04  1:27 ` [PATCH 1/5] omap: Remove code configuring the DEBUG_LL serial port using uncompress code Tony Lindgren
2011-02-04  1:27   ` Tony Lindgren
2011-02-04  1:27 ` [PATCH 2/5] omap: Use inituart to configure the debug serial port based on machine ID Tony Lindgren
2011-02-04  1:27   ` Tony Lindgren
2011-02-04 12:04   ` Grazvydas Ignotas
2011-02-04 12:04     ` Grazvydas Ignotas
2011-02-04 16:49     ` Tony Lindgren
2011-02-04 16:49       ` Tony Lindgren
2011-02-04  1:27 ` [PATCH 3/5] omap: Add support for CONFIG_AUTO_ZRELADDR for DEBUG_LL Tony Lindgren
2011-02-04  1:27   ` Tony Lindgren
2011-02-04  3:33   ` Nicolas Pitre
2011-02-04  3:33     ` Nicolas Pitre
2011-02-04 17:02     ` Tony Lindgren
2011-02-04 17:02       ` Tony Lindgren
2011-02-04 20:16       ` Nicolas Pitre
2011-02-04 20:16         ` Nicolas Pitre
2011-02-04 20:24         ` Tony Lindgren
2011-02-04 20:24           ` Tony Lindgren
2011-02-04 20:33           ` Nicolas Pitre
2011-02-04 20:33             ` Nicolas Pitre
2011-02-04 17:15     ` Russell King - ARM Linux
2011-02-04 17:15       ` Russell King - ARM Linux
2011-02-04 18:36       ` Tony Lindgren
2011-02-04 18:36         ` Tony Lindgren
2011-02-04  1:27 ` Tony Lindgren [this message]
2011-02-04  1:27   ` [PATCH 4/5] omap: Combine debug-macro.S for omap1 and omap2+ Tony Lindgren
2011-02-04  1:27 ` [PATCH 5/5] omap: Add CONFIG_AUTO_ZRELADDR and CONFIG_ARM_PATCH_PHYS_VIRT to defconfigs Tony Lindgren
2011-02-04  1:27   ` Tony Lindgren
2011-02-09  6:08 ` [PATCH 0/5] Change omap DEBUG_LL code to use inituart for AUTO_ZRELADDR and ARM_PATCH_PHYS_VIRT Poddar, Sourav
2011-02-09  6:08   ` Poddar, Sourav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110204012712.26410.70158.stgit@baageli.muru.com \
    --to=tony@atomide.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.