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 2/3] ARM: i.MX: Make debug UART selectable from Kconfig
Date: Sun, 23 Jun 2013 21:44:52 +0200	[thread overview]
Message-ID: <1372016693-30160-3-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1372016693-30160-1-git-send-email-s.hauer@pengutronix.de>

To make early debugging on i.MX a bit simpler. This uses a similar
magic than the kernel does.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/include/mach/debug_ll.h | 31 +++++++++--
 common/Kconfig                            | 92 +++++++++++++++++++++++++++++++
 2 files changed, 117 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-imx/include/mach/debug_ll.h b/arch/arm/mach-imx/include/mach/debug_ll.h
index cb6dd03..0bb28ee 100644
--- a/arch/arm/mach-imx/include/mach/debug_ll.h
+++ b/arch/arm/mach-imx/include/mach/debug_ll.h
@@ -13,13 +13,31 @@
 #include <mach/imx53-regs.h>
 #include <mach/imx6-regs.h>
 
-/* #define IMX_DEBUG_LL_UART_BASE MXxy_UARTx_BASE_ADDR */
-
-#ifndef IMX_DEBUG_LL_UART_BASE
-#warning define IMX_DEBUG_LL_UART_BASE properly for debug_ll
-#define IMX_DEBUG_LL_UART_BASE 0
+#ifdef CONFIG_DEBUG_IMX1_UART
+#define IMX_DEBUG_SOC MX1
+#elif defined CONFIG_DEBUG_IMX21_UART
+#define IMX_DEBUG_SOC MX21
+#elif defined CONFIG_DEBUG_IMX25_UART
+#define IMX_DEBUG_SOC MX25
+#elif defined CONFIG_DEBUG_IMX27_UART
+#define IMX_DEBUG_SOC MX27
+#elif defined CONFIG_DEBUG_IMX31_UART
+#define IMX_DEBUG_SOC MX31
+#elif defined CONFIG_DEBUG_IMX35_UART
+#define IMX_DEBUG_SOC MX35
+#elif defined CONFIG_DEBUG_IMX51_UART
+#define IMX_DEBUG_SOC MX51
+#elif defined CONFIG_DEBUG_IMX53_UART
+#define IMX_DEBUG_SOC MX53
+#elif defined CONFIG_DEBUG_IMX6Q_UART
+#define IMX_DEBUG_SOC MX6
+#else
+#error "unknown i.MX debug uart soc type"
 #endif
 
+#define __IMX_UART_BASE(soc, num) soc##_UART##num##_BASE_ADDR
+#define IMX_UART_BASE(soc, num) __IMX_UART_BASE(soc, num)
+
 #define URTX0		0x40		/* Transmitter Register */
 
 #define UCR1		0x80		/* Control Register 1 */
@@ -30,7 +48,8 @@
 
 static inline void PUTC_LL(int c)
 {
-	void __iomem *base = (void *)IMX_DEBUG_LL_UART_BASE;
+	void __iomem *base = (void *)IMX_UART_BASE(IMX_DEBUG_SOC,
+			CONFIG_DEBUG_IMX_UART_PORT);
 
 	if (!base)
 		return;
diff --git a/common/Kconfig b/common/Kconfig
index d7e2ebd..6a72267 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -618,6 +618,98 @@ config DEBUG_LL
 	  This requires SoC specific support. Most SoCs require the debug UART to be
 	  initialized by a debugger or first stage bootloader.
 
+choice
+	prompt "Kernel low-level debugging port"
+	depends on DEBUG_LL
+
+config DEBUG_IMX1_UART
+	bool "i.MX1 Debug UART"
+	depends on ARCH_IMX1
+	help
+	  Say Y here if you want kernel low-level debugging support
+	  on i.MX1.
+
+config DEBUG_IMX21_UART
+	bool "i.MX21 Debug UART"
+	depends on ARCH_IMX21
+	help
+	  Say Y here if you want kernel low-level debugging support
+	  on i.MX21.
+
+config DEBUG_IMX25_UART
+	bool "i.MX25 Debug UART"
+	depends on ARCH_IMX25
+	help
+	  Say Y here if you want kernel low-level debugging support
+	  on i.MX25.
+
+config DEBUG_IMX27_UART
+	bool "i.MX27 Debug UART"
+	depends on ARCH_IMX1
+	help
+	  Say Y here if you want kernel low-level debugging support
+	  on i.MX27.
+
+config DEBUG_IMX31_UART
+	bool "i.MX31 Debug UART"
+	depends on ARCH_IMX31
+	help
+	  Say Y here if you want kernel low-level debugging support
+	  on i.MX31.
+
+config DEBUG_IMX35_UART
+	bool "i.MX35 Debug UART"
+	depends on ARCH_IMX35
+	help
+	  Say Y here if you want kernel low-level debugging support
+	  on i.MX35.
+
+config DEBUG_IMX51_UART
+	bool "i.MX51 Debug UART"
+	depends on ARCH_IMX51
+	help
+	  Say Y here if you want kernel low-level debugging support
+	  on i.MX51.
+
+config DEBUG_IMX53_UART
+	bool "i.MX53 Debug UART"
+	depends on ARCH_IMX53
+	help
+	  Say Y here if you want kernel low-level debugging support
+	  on i.MX53.
+
+config DEBUG_IMX6Q_UART
+	bool "i.MX6Q Debug UART"
+	depends on ARCH_IMX6Q
+	help
+	  Say Y here if you want kernel low-level debugging support
+	  on i.MX6Q.
+
+config DEBUG_IMX6SL_UART
+	bool "i.MX6SL Debug UART"
+	depends on ARCH_IMX6SL
+	help
+	  Say Y here if you want kernel low-level debugging support
+	  on i.MX6SL.
+
+endchoice
+
+config DEBUG_IMX_UART_PORT
+	int "i.MX Debug UART Port Selection" if DEBUG_IMX1_UART || \
+						DEBUG_IMX25_UART || \
+						DEBUG_IMX21_IMX27_UART || \
+						DEBUG_IMX31_UART || \
+						DEBUG_IMX35_UART || \
+						DEBUG_IMX51_UART || \
+						DEBUG_IMX53_UART || \
+						DEBUG_IMX6Q_UART || \
+						DEBUG_IMX6SL_UART
+	default 1
+	depends on ARCH_IMX
+	help
+	  Choose UART port on which kernel low-level debug messages
+	  should be output.
+
 endmenu
 
 config HAS_DEBUG_LL
-- 
1.8.3.1


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

  parent reply	other threads:[~2013-06-23 19:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-23 19:44 [PATCH] debug patches Sascha Hauer
2013-06-23 19:44 ` [PATCH 1/3] remove unused debug Kconfig options Sascha Hauer
2013-06-23 19:44 ` Sascha Hauer [this message]
2013-06-23 19:44 ` [PATCH 3/3] startup: Add initcall tracing debug option 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=1372016693-30160-3-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