All of lore.kernel.org
 help / color / mirror / Atom feed
From: pawel.moll@arm.com (Pawel Moll)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] ARM: vexpress: Config option for early printk console
Date: Wed, 11 Jul 2012 17:21:47 +0100	[thread overview]
Message-ID: <1342023707-9645-1-git-send-email-pawel.moll@arm.com> (raw)
In-Reply-To: <1342013791-19516-10-git-send-email-pawel.moll@arm.com>

Versatile Express platform can be used in different configurations,
the console UART used by early printk may be located at different
addresses in the address space.

This patch makes it possible to select the base address of a PL011
UART to be used as a console output in the kernel configuration.
The default behaviour is still the heuristic detecting memory map
on Cortex-A core tiles.

The zImage decompressor will use the same configuration values
or print out nothing if DEBUG_LL is not enabled.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
---
 arch/arm/Kconfig.debug                            |   26 +++++++++++++
 arch/arm/mach-vexpress/include/mach/debug-macro.S |   41 +++++++++++++++++++++
 arch/arm/mach-vexpress/include/mach/uncompress.h  |   14 +++++++
 3 files changed, 81 insertions(+)

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 01a1341..a03b5a7 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -310,6 +310,32 @@ choice
 		  The uncompressor code port configuration is now handled
 		  by CONFIG_S3C_LOWLEVEL_UART_PORT.
 
+	config DEBUG_VEXPRESS_UART0_DETECT
+		bool "Autodetect UART0 on Versatile Express Cortex-A core tiles"
+		depends on ARCH_VEXPRESS && CPU_CP15_MMU
+		help
+		  This option enables a simple heuristic which tries to determine
+		  the motherboard's memory map variant (original or RS1) and then
+		  choose the relevant UART0 base address.
+
+		  Note that this will only work with standard A-class core tiles,
+		  and may fail with non-standard SMM or custom software models.
+
+	config DEBUG_VEXPRESS_UART0_CA9
+		bool "Use PL011 UART0 at 0x10009000 (V2P-CA9 core tile)"
+		depends on ARCH_VEXPRESS
+		help
+		  This option selects UART0 at 0x10009000. Except for custom models,
+		  this applies only to the V2P-CA9 tile.
+
+	config DEBUG_VEXPRESS_UART0_RS1
+		bool "Use PL011 UART0 at 0x1c090000 (RS1 complaint tiles)"
+		depends on ARCH_VEXPRESS
+		help
+		  This option selects UART0 at 0x1c090000. This applies to most
+		  of the tiles using the RS1 memory map, including all new A-class
+		  core tiles, FPGA-based SMMs and software models.
+
 	config DEBUG_LL_UART_NONE
 		bool "No low-level debugging UART"
 		help
diff --git a/arch/arm/mach-vexpress/include/mach/debug-macro.S b/arch/arm/mach-vexpress/include/mach/debug-macro.S
index fa82247..9f509f5 100644
--- a/arch/arm/mach-vexpress/include/mach/debug-macro.S
+++ b/arch/arm/mach-vexpress/include/mach/debug-macro.S
@@ -18,6 +18,8 @@
 
 #define DEBUG_LL_VIRT_BASE		0xf8000000
 
+#if defined(CONFIG_DEBUG_VEXPRESS_UART0_DETECT)
+
 		.macro	addruart,rp,rv,tmp
 
 		@ Make an educated guess regarding the memory map:
@@ -41,3 +43,42 @@
 		.endm
 
 #include <asm/hardware/debug-pl01x.S>
+
+#elif defined(CONFIG_DEBUG_VEXPRESS_UART0_CA9)
+
+		.macro	addruart,rp,rv,tmp
+		mov	\rp, #DEBUG_LL_UART_OFFSET
+		orr	\rv, \rp, #DEBUG_LL_VIRT_BASE
+		orr	\rp, \rp, #DEBUG_LL_PHYS_BASE
+		.endm
+
+#include <asm/hardware/debug-pl01x.S>
+
+#elif defined(CONFIG_DEBUG_VEXPRESS_UART0_RS1)
+
+		.macro	addruart,rp,rv,tmp
+		mov	\rp, #DEBUG_LL_UART_OFFSET_RS1
+		orr	\rv, \rp, #DEBUG_LL_VIRT_BASE
+		orr	\rp, \rp, #DEBUG_LL_PHYS_BASE_RS1
+		.endm
+
+#include <asm/hardware/debug-pl01x.S>
+
+#else /* CONFIG_DEBUG_LL_UART_NONE */
+
+		.macro	addruart, rp, rv, tmp
+		/* Safe dummy values */
+		mov	\rp, #0
+		mov	\rv, #DEBUG_LL_VIRT_BASE
+		.endm
+
+		.macro	senduart,rd,rx
+		.endm
+
+		.macro	waituart,rd,rx
+		.endm
+
+		.macro	busyuart,rd,rx
+		.endm
+
+#endif
diff --git a/arch/arm/mach-vexpress/include/mach/uncompress.h b/arch/arm/mach-vexpress/include/mach/uncompress.h
index 7dab559..1e472eb 100644
--- a/arch/arm/mach-vexpress/include/mach/uncompress.h
+++ b/arch/arm/mach-vexpress/include/mach/uncompress.h
@@ -27,6 +27,7 @@
 
 static unsigned long get_uart_base(void)
 {
+#if defined(CONFIG_DEBUG_VEXPRESS_UART0_DETECT)
 	unsigned long mpcore_periph;
 
 	/*
@@ -42,6 +43,13 @@ static unsigned long get_uart_base(void)
 		return UART_BASE;
 	else
 		return UART_BASE_RS1;
+#elif defined(CONFIG_DEBUG_VEXPRESS_UART0_CA9)
+	return UART_BASE;
+#elif defined(CONFIG_DEBUG_VEXPRESS_UART0_RS1)
+	return UART_BASE_RS1;
+#else
+	return 0;
+#endif
 }
 
 /*
@@ -51,6 +59,9 @@ static inline void putc(int c)
 {
 	unsigned long base = get_uart_base();
 
+	if (!base)
+		return;
+
 	while (AMBA_UART_FR(base) & (1 << 5))
 		barrier();
 
@@ -61,6 +72,9 @@ static inline void flush(void)
 {
 	unsigned long base = get_uart_base();
 
+	if (!base)
+		return;
+
 	while (AMBA_UART_FR(base) & (1 << 3))
 		barrier();
 }
-- 
1.7.9.5

      parent reply	other threads:[~2012-07-11 16:21 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-11 13:36 [PATCH 0/9] Versatile Express updates for 3.6 Pawel Moll
2012-07-11 13:36 ` [PATCH 1/9] ARM: vexpress: remove automatic errata workaround selection Pawel Moll
2012-07-11 15:02   ` Rob Herring
2012-07-11 15:18     ` Will Deacon
2012-07-11 15:45       ` Rob Herring
2012-07-11 15:53         ` Will Deacon
2012-07-11 18:06           ` Rob Herring
2012-07-11 18:14             ` Will Deacon
2012-07-12 10:17   ` [PATCH v2] " Pawel Moll
2012-07-12 14:14     ` Will Deacon
2012-07-12 14:39     ` Rob Herring
2012-07-11 13:36 ` [PATCH 2/9] ARM: vexpress: Check master site in daughterboard's sysctl operations Pawel Moll
2012-07-11 13:36 ` [PATCH 3/9] ARM: versatile: Make plat-versatile clock optional Pawel Moll
2012-07-11 16:43   ` Linus Walleij
2012-07-11 16:58     ` Pawel Moll
2012-07-12  0:11     ` Mike Turquette
2012-07-11 13:36 ` [PATCH 4/9] ARM: vexpress: Initial common clock support Pawel Moll
2012-07-11 16:51   ` Linus Walleij
2012-07-11 16:57     ` Pawel Moll
2012-07-16 20:15       ` Turquette, Mike
2012-07-17  9:48         ` Pawel Moll
2012-07-11 13:36 ` [PATCH 5/9] ARM: vexpress: Add missing SP804 interrupt in motherboard's DTS files Pawel Moll
2012-07-11 13:36 ` [PATCH 6/9] ARM: vexpress: Add fixed regulator for SMSC Pawel Moll
2012-07-11 13:36 ` [PATCH 7/9] ARM: vexpress: Convert V2P-CA15 Device Tree to 64 bit addresses Pawel Moll
2012-07-11 13:36 ` [PATCH 8/9] ARM: vexpress: Add Device Tree for V2P-CA15_CA7 core tile Pawel Moll
2012-07-11 13:36 ` [PATCH 9/9] ARM: vexpress: Config option for early printk console Pawel Moll
2012-07-11 14:09   ` Will Deacon
2012-07-11 14:16     ` Pawel Moll
2012-07-11 14:23       ` Pawel Moll
2012-07-11 14:23   ` Jonathan Austin
2012-07-11 14:24     ` Pawel Moll
2012-07-11 16:21   ` Pawel Moll [this message]

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=1342023707-9645-1-git-send-email-pawel.moll@arm.com \
    --to=pawel.moll@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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.