mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	barebox@lists.infradead.org
Subject: [PATCH 03/11] arm: mvebu: introduce common console UART config
Date: Sun, 19 May 2013 20:23:47 +0200	[thread overview]
Message-ID: <1368987835-13323-4-git-send-email-sebastian.hesselbarth@gmail.com> (raw)
In-Reply-To: <1368987835-13323-1-git-send-email-sebastian.hesselbarth@gmail.com>

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@gmail.com>
Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@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@free-electrons.com>
+ * Copyright (C) 2013
+ *  Thomas Petazzoni <thomas.petazzoni@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2013-05-19 18:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-19 18:23 [PATCH 00/11] arm: mvebu: SoC consolidation Sebastian Hesselbarth
2013-05-19 18:23 ` [PATCH 01/11] arm: mvebu: add more visible SoC separators to Kconfig Sebastian Hesselbarth
2013-05-19 18:23 ` [PATCH 02/11] arm: mvebu: introduce common lowlevel and early init Sebastian Hesselbarth
2013-05-19 18:23 ` Sebastian Hesselbarth [this message]
2013-05-19 18:23 ` [PATCH 04/11] arm: mvebu: convert Dove to common init Sebastian Hesselbarth
2013-05-21 13:49   ` Sascha Hauer
2013-05-21 15:24     ` Sebastian Hesselbarth
2013-05-21 17:49       ` Sascha Hauer
2013-05-19 18:23 ` [PATCH 05/11] arm: mvebu: convert Armada 370/XP " Sebastian Hesselbarth
2013-05-21  6:28   ` Sascha Hauer
2013-05-21  6:32     ` Sebastian Hesselbarth
2013-05-21  6:33     ` Sascha Hauer
2013-05-21  6:38       ` Sebastian Hesselbarth
2013-05-21  6:47         ` Sascha Hauer
2013-05-21  7:16           ` Sebastian Hesselbarth
2013-05-19 18:23 ` [PATCH 06/11] arm: mvebu: convert Kirkwood " Sebastian Hesselbarth
2013-05-19 18:23 ` [PATCH 07/11] arm: mvebu: convert SolidRun CuBox " Sebastian Hesselbarth
2013-05-19 18:23 ` [PATCH 08/11] arm: mvebu: convert Globalscale Mirabox " Sebastian Hesselbarth
2013-05-19 18:23 ` [PATCH 09/11] arm: mvebu: convert PlatHome OpenBlocks AX3 " Sebastian Hesselbarth
2013-05-19 18:23 ` [PATCH 10/11] arm: mvebu: convert Marvell Armada XP GP board " Sebastian Hesselbarth
2013-05-19 18:23 ` [PATCH 11/11] arm: mvebu: convert Globalscale Guruplug " Sebastian Hesselbarth
2013-05-19 18:41 ` [PATCH 00/11] arm: mvebu: SoC consolidation Thomas Petazzoni
2013-05-19 18:42 ` Thomas Petazzoni

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=1368987835-13323-4-git-send-email-sebastian.hesselbarth@gmail.com \
    --to=sebastian.hesselbarth@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=thomas.petazzoni@free-electrons.com \
    /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