mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 13/16] ARM: OMAP: Make debug_ll UART Kconfig selectable
Date: Fri, 22 Nov 2013 15:54:40 +0100	[thread overview]
Message-ID: <1385132083-7484-14-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1385132083-7484-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/beaglebone/lowlevel.c      |  2 +-
 arch/arm/mach-omap/include/mach/debug_ll.h | 71 +++++++++++++++---------------
 common/Kconfig                             | 34 ++++++++++++++
 3 files changed, 70 insertions(+), 37 deletions(-)

diff --git a/arch/arm/boards/beaglebone/lowlevel.c b/arch/arm/boards/beaglebone/lowlevel.c
index a4d3232..992e3e4 100644
--- a/arch/arm/boards/beaglebone/lowlevel.c
+++ b/arch/arm/boards/beaglebone/lowlevel.c
@@ -137,7 +137,7 @@ static int beaglebone_board_init(void)
 
 	am33xx_uart0_soft_reset();
 	am33xx_enable_uart0_pin_mux();
-	omap_uart_lowlevel_init();
+	omap_uart_lowlevel_init((void *)AM33XX_UART0_BASE);
 	putc_ll('>');
 
 	return 0;
diff --git a/arch/arm/mach-omap/include/mach/debug_ll.h b/arch/arm/mach-omap/include/mach/debug_ll.h
index 2917558..25ddd48 100644
--- a/arch/arm/mach-omap/include/mach/debug_ll.h
+++ b/arch/arm/mach-omap/include/mach/debug_ll.h
@@ -18,31 +18,9 @@
 #define   __MACH_DEBUG_LL_H__
 
 #include <io.h>
-
-#ifdef CONFIG_ARCH_OMAP3
 #include <mach/omap3-silicon.h>
-
-#ifdef CONFIG_OMAP_UART1
-#define UART_BASE	OMAP3_UART1_BASE
-#else
-#define UART_BASE	OMAP3_UART3_BASE
-#endif
-
-#endif
-
-#ifdef CONFIG_ARCH_OMAP4
 #include <mach/omap4-silicon.h>
-#ifdef CONFIG_OMAP_UART1
-#define UART_BASE	OMAP44XX_UART1_BASE
-#else
-#define UART_BASE	OMAP44XX_UART3_BASE
-#endif
-#endif
-
-#ifdef CONFIG_ARCH_AM33XX
 #include <mach/am33xx-silicon.h>
-#define UART_BASE	AM33XX_UART0_BASE
-#endif
 
 #define LSR_THRE	0x20	/* Xmit holding register empty */
 #define LCR_BKSE	0x80	/* Bank select enable */
@@ -56,26 +34,47 @@
 #define MCR		(4 << 2)
 #define MDR		(8 << 2)
 
-static inline void omap_uart_lowlevel_init(void)
+static inline void omap_uart_lowlevel_init(void __iomem *base)
 {
-	writeb(0x00, UART_BASE + LCR);
-	writeb(0x00, UART_BASE + IER);
-	writeb(0x07, UART_BASE + MDR);
-	writeb(LCR_BKSE, UART_BASE + LCR);
-	writeb(26, UART_BASE + DLL); /* 115200 */
-	writeb(0, UART_BASE + DLM);
-	writeb(0x03, UART_BASE + LCR);
-	writeb(0x03, UART_BASE + MCR);
-	writeb(0x07, UART_BASE + FCR);
-	writeb(0x00, UART_BASE + MDR);
+	writeb(0x00, base + LCR);
+	writeb(0x00, base + IER);
+	writeb(0x07, base + MDR);
+	writeb(LCR_BKSE, base + LCR);
+	writeb(26, base + DLL); /* 115200 */
+	writeb(0, base + DLM);
+	writeb(0x03, base + LCR);
+	writeb(0x03, base + MCR);
+	writeb(0x07, base + FCR);
+	writeb(0x00, base + MDR);
 }
+
+#ifdef CONFIG_DEBUG_LL
+
+#ifdef CONFIG_DEBUG_OMAP3_UART
+#define OMAP_DEBUG_SOC OMAP3
+#elif defined CONFIG_DEBUG_OMAP4_UART
+#define OMAP_DEBUG_SOC OMAP44XX
+#elif defined CONFIG_DEBUG_AM33XX_UART
+#define OMAP_DEBUG_SOC AM33XX
+#else
+#error "unknown OMAP debug uart soc type"
+#endif
+
+#define __OMAP_UART_BASE(soc, num) soc##_UART##num##_BASE
+#define OMAP_UART_BASE(soc, num) __OMAP_UART_BASE(soc, num)
+
 static inline void PUTC_LL(char c)
 {
+	void __iomem *base = (void *)OMAP_UART_BASE(OMAP_DEBUG_SOC,
+			CONFIG_DEBUG_OMAP_UART_PORT);
+
 	/* Wait until there is space in the FIFO */
-	while ((readb(UART_BASE + LSR) & LSR_THRE) == 0);
+	while ((readb(base + LSR) & LSR_THRE) == 0);
 	/* Send the character */
-	writeb(c, UART_BASE + THR);
+	writeb(c, base + THR);
 	/* Wait to make sure it hits the line, in case we die too soon. */
-	while ((readb(UART_BASE + LSR) & LSR_THRE) == 0);
+	while ((readb(base + LSR) & LSR_THRE) == 0);
 }
 #endif
+
+#endif
diff --git a/common/Kconfig b/common/Kconfig
index 06edbc2..8fd23aa 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -746,6 +746,27 @@ config DEBUG_IMX6Q_UART
 	  Say Y here if you want kernel low-level debugging support
 	  on i.MX6Q.
 
+config DEBUG_OMAP3_UART
+	bool "OMAP3 Debug UART"
+	depends on ARCH_OMAP3
+	help
+	  Say Y here if you want kernel low-level debugging support
+	  on OMAP3.
+
+config DEBUG_OMAP4_UART
+	bool "OMAP4 Debug UART"
+	depends on ARCH_OMAP4
+	help
+	  Say Y here if you want kernel low-level debugging support
+	  on OMAP4.
+
+config DEBUG_AM33XX_UART
+	bool "AM33XX Debug UART"
+	depends on ARCH_AM33XX
+	help
+	  Say Y here if you want kernel low-level debugging support
+	  on AM33XX.
+
 endchoice
 
 config DEBUG_IMX_UART_PORT
@@ -765,6 +786,19 @@ config DEBUG_IMX_UART_PORT
 	  Choose UART port on which kernel low-level debug messages
 	  should be output.
 
+config DEBUG_OMAP_UART_PORT
+	int "OMAP Debug UART Port Selection" if DEBUG_OMAP3_UART || \
+						DEBUG_OMAP4_UART || \
+						DEBUG_AM33XX_UART
+	default 1
+	depends on ARCH_OMAP
+	help
+	  Choose UART port on which kernel low-level debug messages
+	  should be output. Possible values are:
+	  OMAP3: 1 - 3
+	  OMAP4: 1 - 3
+	  AM33XX: 0 - 2
+
 config DEBUG_INITCALLS
 	bool "Trace initcalls"
 	help
-- 
1.8.4.2


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

  parent reply	other threads:[~2013-11-22 14:55 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-22 14:54 OMAP: devicetree preparation patches Sascha Hauer
2013-11-22 14:54 ` [PATCH 01/16] ARM: OMAP: select SoC variant from boards Sascha Hauer
2013-11-22 14:54 ` [PATCH 02/16] ARM: OMAP: Add SoC prefix to running_in_* functions Sascha Hauer
2013-11-22 14:54 ` [PATCH 03/16] ARM: OMAP: select correct reset_cpu function at runtime Sascha Hauer
2013-11-22 14:54 ` [PATCH 04/16] ARM: OMAP: Make cpu_is_* macros runtime if necessary Sascha Hauer
2013-11-22 14:54 ` [PATCH 05/16] ARM: dtb: create dt-bindings link Sascha Hauer
2013-11-22 14:54 ` [PATCH 06/16] dt-bindings: Add gpio header file Sascha Hauer
2013-11-22 14:54 ` [PATCH 07/16] dt-bindings: Add omap/am33xx pinctrl " Sascha Hauer
2013-11-22 14:54 ` [PATCH 08/16] images: socfpga: Do not pollute Make variable namespace Sascha Hauer
2013-11-22 14:54 ` [PATCH 09/16] ARM: Add am33xx SoC dtsi file Sascha Hauer
2013-11-22 14:54 ` [PATCH 10/16] ARM: am335x: Add reg-shift property to uarts Sascha Hauer
2013-11-22 14:54 ` [PATCH 11/16] ARM: dts: AM33xx: Add gpio aliases Sascha Hauer
2013-11-22 14:54 ` [PATCH 12/16] ARM: am33xx: Add am33xx_ prefix to SoC specific functions Sascha Hauer
2013-11-22 14:54 ` Sascha Hauer [this message]
2013-11-22 14:54 ` [PATCH 14/16] ARM: OMAP: centralize omap startup Sascha Hauer
2013-11-22 14:54 ` [PATCH 15/16] ARM: am33xx: compile SoC files for pbl aswell Sascha Hauer
2013-11-22 18:23   ` [SPAM] " Jean-Christophe PLAGNIOL-VILLARD
2013-11-22 18:35     ` Sascha Hauer
2013-11-22 18:41       ` Alexander Aring
2013-11-22 20:30         ` Sascha Hauer
2013-11-23 14:54       ` Jean-Christophe PLAGNIOL-VILLARD
2013-11-25  8:13         ` Sascha Hauer
2013-11-25 15:59           ` Jean-Christophe PLAGNIOL-VILLARD
2013-11-22 14:54 ` [PATCH 16/16] ARM: OMAP: let UART selection depend on its only user Sascha Hauer

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=1385132083-7484-14-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox