From: Tony Lindgren <tony@atomide.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-omap@vger.kernel.org
Subject: [PATCH 2/5] omap: Use inituart to configure the debug serial port based on machine ID
Date: Thu, 03 Feb 2011 17:27:07 -0800 [thread overview]
Message-ID: <20110204012707.26410.28508.stgit@baageli.muru.com> (raw)
In-Reply-To: <20110204012317.26410.55157.stgit@baageli.muru.com>
Set the debug serial port based on machine ID. Note that most
of the patch is just trivial checking for the machine ID.
Also note that this code won't work for debugging the uncompress code.
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
arch/arm/mach-omap1/include/mach/debug-macro.S | 77 +++++++++++++-
arch/arm/mach-omap1/serial.c | 7 +
arch/arm/mach-omap2/include/mach/debug-macro.S | 130 ++++++++++++++++++++++--
arch/arm/mach-omap2/serial.c | 7 +
4 files changed, 204 insertions(+), 17 deletions(-)
diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
index db2cdf4..80dcf18 100644
--- a/arch/arm/mach-omap1/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -14,24 +14,87 @@
#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)
- .pushsection .data
-omap_uart_phys: .word 0x0
-omap_uart_virt: .word 0x0
- .popsection
-
+ /*
+ * 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_v2p(omap_uart_phys)
+ 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 UART phys and virt addresses temporarily into
- * the omap_uart_phys and omap_uart_virt above.
+ * 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
diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
index 550ca9d..8b4ce4a 100644
--- a/arch/arm/mach-omap1/serial.c
+++ b/arch/arm/mach-omap1/serial.c
@@ -29,6 +29,13 @@
#include "pm.h"
+#if defined(CONFIG_DEBUG_LL) && !defined(CONFIG_DEBUG_ICEDCC)
+/* Used by inituart, addruart and busyuart. See debug-macro.S */
+void __iomem *omap_uart_phys;
+void __iomem *omap_uart_virt;
+void __iomem *omap_uart_lsr;
+#endif
+
static struct clk * uart1_ck;
static struct clk * uart2_ck;
static struct clk * uart3_ck;
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S
index 336a838..45c29e3 100644
--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -14,27 +14,137 @@
#include <linux/serial_reg.h>
#include <asm/memory.h>
+#include <asm/mach-types.h>
+#include <plat/io.h>
#include <plat/serial.h>
-#define UART_OFFSET(addr) ((addr) & 0x00ffffff)
-
#define omap_uart_v2p(x) ((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET)
- .pushsection .data
-omap_uart_phys: .word 0
-omap_uart_virt: .word 0
-omap_uart_lsr: .word 0
- .popsection
-
+ /*
+ * 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_v2p(omap_uart_phys)
+ ldrne \a, =omap_uart_phys
+ 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 UART phys and virt addresses temporarily into
- * the omap_uart_phys and omap_uart_virt above.
+ * 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
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 32e91a9..9a41d6c 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -104,6 +104,13 @@ struct omap_uart_state {
#endif
};
+#if defined(CONFIG_DEBUG_LL) && !defined(CONFIG_DEBUG_ICEDCC)
+/* Used by inituart, addruart and busyuart. See debug-macro.S */
+void __iomem *omap_uart_phys;
+void __iomem *omap_uart_virt;
+void __iomem *omap_uart_lsr;
+#endif
+
static LIST_HEAD(uart_list);
static u8 num_uarts;
next prev parent reply other threads:[~2011-02-04 1:27 UTC|newest]
Thread overview: 16+ 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: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 [this message]
2011-02-04 12:04 ` [PATCH 2/5] omap: Use inituart to configure the debug serial port based on machine ID Grazvydas Ignotas
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 3:33 ` Nicolas Pitre
2011-02-04 17:02 ` Tony Lindgren
2011-02-04 20:16 ` Nicolas Pitre
2011-02-04 20:24 ` Tony Lindgren
2011-02-04 20:33 ` Nicolas Pitre
2011-02-04 17:15 ` Russell King - ARM Linux
2011-02-04 18:36 ` Tony Lindgren
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-09 6:08 ` [PATCH 0/5] Change omap DEBUG_LL code to use inituart for AUTO_ZRELADDR and ARM_PATCH_PHYS_VIRT 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=20110204012707.26410.28508.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).