ARM: imx6q: let users input debug uart port number
authorShawn Guo <shawn.guo@linaro.org>
Mon, 8 Oct 2012 05:44:29 +0000 (13:44 +0800)
committerShawn Guo <shawn.guo@linaro.org>
Fri, 16 Nov 2012 06:18:52 +0000 (14:18 +0800)
imx6q gets 5 uart ports in total.  Different board design may choose
different port as debug uart.  For example, imx6q-sabresd uses UART1,
imx6q-sabrelite uses UART2 and imx6q-arm2 uses UART4.  Rather than
bloating DEBUG_LL choice list with all these uart ports, the patch
introduces DEBUG_IMX6Q_UART_PORT for users to input uart port number
when DEBUG_IMX6Q_UART is selected inside DEBUG_LL choice.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
arch/arm/Kconfig.debug
arch/arm/include/debug/imx.S
arch/arm/mach-imx/lluart.c
arch/arm/mach-imx/mx6q.h

index 5566520686a5a8bcad7d66f9b6bb0e56b494b6e0..5dc7109dffc68741565aae6adf8bab48a21fea54 100644 (file)
@@ -209,20 +209,12 @@ choice
                  Say Y here if you want kernel low-level debugging support
                  on i.MX50 or i.MX53.
 
-       config DEBUG_IMX6Q_UART2
-               bool "i.MX6Q Debug UART2"
+       config DEBUG_IMX6Q_UART
+               bool "i.MX6Q Debug UART"
                depends on SOC_IMX6Q
                help
                  Say Y here if you want kernel low-level debugging support
-                 on i.MX6Q UART2. This is correct for e.g. the SabreLite
-                  board.
-
-       config DEBUG_IMX6Q_UART4
-               bool "i.MX6Q Debug UART4"
-               depends on SOC_IMX6Q
-               help
-                 Say Y here if you want kernel low-level debugging support
-                 on i.MX6Q UART4.
+                 on i.MX6Q.
 
        config DEBUG_MMP_UART2
                bool "Kernel low-level debugging message via MMP UART2"
@@ -409,6 +401,15 @@ choice
 
 endchoice
 
+config DEBUG_IMX6Q_UART_PORT
+       int "i.MX6Q Debug UART Port (1-5)" if DEBUG_IMX6Q_UART
+       range 1 5
+       default 1
+       depends on SOC_IMX6Q
+       help
+         Choose UART port on which kernel low-level debug messages
+         should be output.
+
 config DEBUG_LL_INCLUDE
        string
        default "debug/icedcc.S" if DEBUG_ICEDCC
@@ -418,8 +419,7 @@ config DEBUG_LL_INCLUDE
                                 DEBUG_IMX31_IMX35_UART || \
                                 DEBUG_IMX51_UART || \
                                 DEBUG_IMX50_IMX53_UART ||\
-                                DEBUG_IMX6Q_UART2 || \
-                                DEBUG_IMX6Q_UART4
+                                DEBUG_IMX6Q_UART
        default "debug/highbank.S" if DEBUG_HIGHBANK_UART
        default "debug/mvebu.S" if DEBUG_MVEBU_UART
        default "debug/picoxcell.S" if DEBUG_PICOXCELL_UART
index 0b65d792f6640433a2bc51c3fed50525c899ef63..0c4e17d4d359a42cb372341045068f7dc44462c6 100644 (file)
  * published by the Free Software Foundation.
  *
  */
+#define IMX6Q_UART1_BASE_ADDR  0x02020000
+#define IMX6Q_UART2_BASE_ADDR  0x021e8000
+#define IMX6Q_UART3_BASE_ADDR  0x021ec000
+#define IMX6Q_UART4_BASE_ADDR  0x021f0000
+#define IMX6Q_UART5_BASE_ADDR  0x021f4000
+
+/*
+ * IMX6Q_UART_BASE_ADDR is put in the middle to force the expansion
+ * of IMX6Q_UART##n##_BASE_ADDR.
+ */
+#define IMX6Q_UART_BASE_ADDR(n)        IMX6Q_UART##n##_BASE_ADDR
+#define IMX6Q_UART_BASE(n)     IMX6Q_UART_BASE_ADDR(n)
+#define IMX6Q_DEBUG_UART_BASE  IMX6Q_UART_BASE(CONFIG_DEBUG_IMX6Q_UART_PORT)
+
 #ifdef CONFIG_DEBUG_IMX1_UART
 #define UART_PADDR     0x00206000
 #elif defined (CONFIG_DEBUG_IMX25_UART)
 #define UART_PADDR     0x73fbc000
 #elif defined (CONFIG_DEBUG_IMX50_IMX53_UART)
 #define UART_PADDR     0x53fbc000
-#elif defined (CONFIG_DEBUG_IMX6Q_UART2)
-#define UART_PADDR     0x021e8000
-#elif defined (CONFIG_DEBUG_IMX6Q_UART4)
-#define UART_PADDR     0x021f0000
+#elif defined (CONFIG_DEBUG_IMX6Q_UART)
+#define UART_PADDR     IMX6Q_DEBUG_UART_BASE
 #endif
 
 /*
index 5f1510363ee76f469358be2c86a664eed70f9308..2fdc9bf2fb5e812c177e14d805fc71562a060065 100644 (file)
 
 #include "hardware.h"
 
+#define IMX6Q_UART1_BASE_ADDR  0x02020000
+#define IMX6Q_UART2_BASE_ADDR  0x021e8000
+#define IMX6Q_UART3_BASE_ADDR  0x021ec000
+#define IMX6Q_UART4_BASE_ADDR  0x021f0000
+#define IMX6Q_UART5_BASE_ADDR  0x021f4000
+
+/*
+ * IMX6Q_UART_BASE_ADDR is put in the middle to force the expansion
+ * of IMX6Q_UART##n##_BASE_ADDR.
+ */
+#define IMX6Q_UART_BASE_ADDR(n)        IMX6Q_UART##n##_BASE_ADDR
+#define IMX6Q_UART_BASE(n)     IMX6Q_UART_BASE_ADDR(n)
+#define IMX6Q_DEBUG_UART_BASE  IMX6Q_UART_BASE(CONFIG_DEBUG_IMX6Q_UART_PORT)
+
 static struct map_desc imx_lluart_desc = {
-#ifdef CONFIG_DEBUG_IMX6Q_UART2
-       .virtual        = MX6Q_IO_P2V(MX6Q_UART2_BASE_ADDR),
-       .pfn            = __phys_to_pfn(MX6Q_UART2_BASE_ADDR),
-       .length         = MX6Q_UART2_SIZE,
-       .type           = MT_DEVICE,
-#endif
-#ifdef CONFIG_DEBUG_IMX6Q_UART4
-       .virtual        = MX6Q_IO_P2V(MX6Q_UART4_BASE_ADDR),
-       .pfn            = __phys_to_pfn(MX6Q_UART4_BASE_ADDR),
-       .length         = MX6Q_UART4_SIZE,
+#ifdef CONFIG_DEBUG_IMX6Q_UART
+       .virtual        = IMX_IO_P2V(IMX6Q_DEBUG_UART_BASE),
+       .pfn            = __phys_to_pfn(IMX6Q_DEBUG_UART_BASE),
+       .length         = 0x4000,
        .type           = MT_DEVICE,
 #endif
 };
index f7e7dbac8f4be64464d70aca1d621d7bef52c682..19d3f54db5afa0cd2669f775dbf868ec98da2681 100644 (file)
@@ -27,9 +27,5 @@
 #define MX6Q_CCM_SIZE                  0x4000
 #define MX6Q_ANATOP_BASE_ADDR          0x020c8000
 #define MX6Q_ANATOP_SIZE               0x1000
-#define MX6Q_UART2_BASE_ADDR           0x021e8000
-#define MX6Q_UART2_SIZE                        0x4000
-#define MX6Q_UART4_BASE_ADDR           0x021f0000
-#define MX6Q_UART4_SIZE                        0x4000
 
 #endif /* __MACH_MX6Q_H__ */