[PATCH 03/11] arm: mvebu: introduce common console UART config

Sebastian Hesselbarth sebastian.hesselbarth at gmail.com
Sun May 19 14:23:47 EDT 2013


With all SoCs remapped to common internal register base address, we
also switch debug_ll to use the correct base address. This also adds
a config option to select the UART number the console will sit on
limited to the available controllers for each SoC.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth at gmail.com>
Tested-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
---
Cc: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
Cc: Sascha Hauer <s.hauer at pengutronix.de>
Cc: barebox at lists.infradead.org
---
 arch/arm/mach-mvebu/Kconfig                 |   14 ++++++++++++++
 arch/arm/mach-mvebu/include/mach/debug_ll.h |   23 +++++++++++++----------
 2 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 400e41b..11e4550 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -107,4 +107,18 @@ endchoice
 
 endif # ARCH_KIRKWOOD
 
+#
+# Common options
+#
+
+config MVEBU_CONSOLE_UART
+	int "UART number for console"
+	default 0
+	range 0 1 if ARCH_ARMADA_370
+	range 0 1 if ARCH_ARMADA_XP
+	range 0 3 if ARCH_DOVE
+	range 0 1 if ARCH_KIRKWOOD
+	help
+	 Select the UART number the barebox console will sit on.
+
 endif # ARCH_MVEBU
diff --git a/arch/arm/mach-mvebu/include/mach/debug_ll.h b/arch/arm/mach-mvebu/include/mach/debug_ll.h
index 2653573..1cf821e 100644
--- a/arch/arm/mach-mvebu/include/mach/debug_ll.h
+++ b/arch/arm/mach-mvebu/include/mach/debug_ll.h
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2013 Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
+ * Copyright (C) 2013
+ *  Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -18,23 +19,25 @@
 
 #include <io.h>
 
-#define UART_BASE 0xd0012000
-#define UART_THR  0x0
-#define UART_LSR  0x14
-#define   UART_LSR_THRE   (1 << 5)
+#define UART_BASE	0xf1012000
+#define UARTn_BASE(n)	(UART_BASE + ((n) * 0x100))
+#define UART_THR	0x00
+#define UART_LSR	0x14
+#define   LSR_THRE	BIT(5)
+
+#define EARLY_UART	UARTn_BASE(CONFIG_MVEBU_CONSOLE_UART)
 
 static inline void PUTC_LL(char c)
 {
 	/* Wait until there is space in the FIFO */
-	while (!(readl(UART_BASE + UART_LSR) & UART_LSR_THRE))
+	while (!(readl(EARLY_UART + UART_LSR) & LSR_THRE))
 		;
 
 	/* Send the character */
-	writel(c, UART_BASE + UART_THR)
-		;
+	writel(c, EARLY_UART + UART_THR);
 
-	/* Wait to make sure it hits the line, in case we die too soon. */
-	while (!(readl(UART_BASE + UART_LSR) & UART_LSR_THRE))
+	/* Wait to make sure it hits the line */
+	while (!(readl(EARLY_UART + UART_LSR) & LSR_THRE))
 		;
 }
 #endif
-- 
1.7.10.4




More information about the barebox mailing list