karo: tx28: enable U-Boot build with different (or none) console UART
authorLothar Waßmann <LW@KARO-electronics.de>
Thu, 30 Jun 2016 09:59:02 +0000 (11:59 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 30 Jun 2016 09:59:02 +0000 (11:59 +0200)
board/karo/tx28/spl_boot.c
board/karo/tx28/tx28.c
configs/tx28-40x1_defconfig
configs/tx28-40x1_noenv_defconfig
configs/tx28-40x2_defconfig
configs/tx28-40x2_noenv_defconfig
configs/tx28-40x3_defconfig
configs/tx28-40x3_noenv_defconfig
configs/tx28-41x0_defconfig
configs/tx28-41x0_noenv_defconfig
include/configs/tx28.h

index 81a9ee3..3f8fff6 100644 (file)
@@ -47,6 +47,23 @@ static iomux_cfg_t tx28_stk5_pads[] = {
        MX28_PAD_PWM0__GPIO_3_16 | GPIO_PAD_CTRL, /* LCD backlight */
        MX28_PAD_PWM1__GPIO_3_17 | GPIO_PAD_CTRL,
 
+       /* pads for selected console UART */
+#if CONFIG_CONS_INDEX == 0
+       MX28_PAD_AUART0_RX__DUART_CTS | UART_PAD_CTRL,
+       MX28_PAD_AUART0_TX__DUART_RTS | UART_PAD_CTRL,
+       MX28_PAD_AUART0_CTS__DUART_RX | UART_PAD_CTRL,
+       MX28_PAD_AUART0_RTS__DUART_TX | UART_PAD_CTRL,
+#elif CONFIG_CONS_INDEX == 1
+       MX28_PAD_AUART1_RX__AUART1_RX | UART_PAD_CTRL,
+       MX28_PAD_AUART1_TX__AUART1_TX | UART_PAD_CTRL,
+       MX28_PAD_AUART1_CTS__AUART1_CTS | UART_PAD_CTRL,
+       MX28_PAD_AUART1_RTS__AUART1_RTS | UART_PAD_CTRL,
+#elif CONFIG_CONS_INDEX == 2
+       MX28_PAD_AUART3_RX__AUART3_RX | UART_PAD_CTRL,
+       MX28_PAD_AUART3_TX__AUART3_TX | UART_PAD_CTRL,
+       MX28_PAD_AUART3_CTS__AUART3_CTS | UART_PAD_CTRL,
+       MX28_PAD_AUART3_RTS__AUART3_RTS | UART_PAD_CTRL,
+#endif
        /* EMI */
        MX28_PAD_EMI_D00__EMI_DATA0 | EMI_PAD_CTRL,
        MX28_PAD_EMI_D01__EMI_DATA1 | EMI_PAD_CTRL,
index 2759659..4f524b4 100644 (file)
@@ -58,6 +58,13 @@ DECLARE_GLOBAL_DATA_PTR;
 #define GPIO_PAD_CTRL          (MXS_PAD_3V3 | MXS_PAD_4MA | MXS_PAD_PULLUP)
 #define I2C_PAD_CTRL           (MXS_PAD_3V3 | MXS_PAD_12MA | MXS_PAD_PULLUP)
 
+#ifndef CONFIG_CONS_INDEX
+struct serial_device *default_serial_console(void)
+{
+       return NULL;
+}
+#endif
+
 static const struct gpio tx28_gpios[] = {
        { TX28_USBH_VBUSEN_GPIO, GPIOFLAG_OUTPUT_INIT_LOW, "USBH VBUSEN", },
        { TX28_USBH_OC_GPIO, GPIOFLAG_INPUT, "USBH OC", },
@@ -67,23 +74,6 @@ static const struct gpio tx28_gpios[] = {
 };
 
 static const iomux_cfg_t tx28_pads[] = {
-       /* UART pads */
-#if CONFIG_CONS_INDEX == 0
-       MX28_PAD_AUART0_RX__DUART_CTS,
-       MX28_PAD_AUART0_TX__DUART_RTS,
-       MX28_PAD_AUART0_CTS__DUART_RX,
-       MX28_PAD_AUART0_RTS__DUART_TX,
-#elif CONFIG_CONS_INDEX == 1
-       MX28_PAD_AUART1_RX__AUART1_RX,
-       MX28_PAD_AUART1_TX__AUART1_TX,
-       MX28_PAD_AUART1_CTS__AUART1_CTS,
-       MX28_PAD_AUART1_RTS__AUART1_RTS,
-#elif CONFIG_CONS_INDEX == 2
-       MX28_PAD_AUART3_RX__AUART3_RX,
-       MX28_PAD_AUART3_TX__AUART3_TX,
-       MX28_PAD_AUART3_CTS__AUART3_CTS,
-       MX28_PAD_AUART3_RTS__AUART3_RTS,
-#endif
        /* I2C bus for internal DS1339, PCA9554 and on DIMM pins 40/41 */
        MX28_PAD_I2C0_SCL__I2C0_SCL | I2C_PAD_CTRL,
        MX28_PAD_I2C0_SDA__I2C0_SDA | I2C_PAD_CTRL,
index d7d24e5..18c0a67 100644 (file)
@@ -1,4 +1,4 @@
-CONFIG_SYS_EXTRA_OPTIONS="SYS_SDRAM_SIZE=SZ_128M"
+CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=0,SYS_SDRAM_SIZE=SZ_128M"
 CONFIG_ARM=y
 CONFIG_ARCH_MXS=y
 CONFIG_TARGET_TX28=y
index d82c1e6..9045f56 100644 (file)
@@ -1,4 +1,4 @@
-CONFIG_SYS_EXTRA_OPTIONS="SYS_SDRAM_SIZE=SZ_128M"
+CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=0,SYS_SDRAM_SIZE=SZ_128M"
 CONFIG_ARM=y
 CONFIG_ARCH_MXS=y
 CONFIG_TARGET_TX28=y
index d0dd8e4..b076a16 100644 (file)
@@ -1,4 +1,4 @@
-CONFIG_SYS_EXTRA_OPTIONS="SYS_SDRAM_SIZE=SZ_256M"
+CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=0,SYS_SDRAM_SIZE=SZ_256M"
 CONFIG_ARM=y
 CONFIG_ARCH_MXS=y
 CONFIG_TARGET_TX28=y
index ad8aa74..2c61b12 100644 (file)
@@ -1,4 +1,4 @@
-CONFIG_SYS_EXTRA_OPTIONS="SYS_SDRAM_SIZE=SZ_256M"
+CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=0,SYS_SDRAM_SIZE=SZ_256M"
 CONFIG_ARM=y
 CONFIG_ARCH_MXS=y
 CONFIG_TARGET_TX28=y
index c2eb455..909f5b7 100644 (file)
@@ -1,4 +1,4 @@
-CONFIG_SYS_EXTRA_OPTIONS="SYS_SDRAM_SIZE=SZ_128M,SYS_NAND_BLOCKS=2048"
+CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=0,SYS_SDRAM_SIZE=SZ_128M,SYS_NAND_BLOCKS=2048"
 CONFIG_ARM=y
 CONFIG_ARCH_MXS=y
 CONFIG_TARGET_TX28=y
index 220eda9..e443d78 100644 (file)
@@ -1,4 +1,4 @@
-CONFIG_SYS_EXTRA_OPTIONS="SYS_SDRAM_SIZE=SZ_128M,SYS_NAND_BLOCKS=2048"
+CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=0,SYS_SDRAM_SIZE=SZ_128M,SYS_NAND_BLOCKS=2048"
 CONFIG_ARM=y
 CONFIG_ARCH_MXS=y
 CONFIG_TARGET_TX28=y
index 75e5944..15afc36 100644 (file)
@@ -1,4 +1,4 @@
-CONFIG_SYS_EXTRA_OPTIONS="TX28_S,SYS_SDRAM_SIZE=SZ_64M"
+CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=0,TX28_S,SYS_SDRAM_SIZE=SZ_64M"
 CONFIG_ARM=y
 CONFIG_ARCH_MXS=y
 CONFIG_TARGET_TX28=y
index 7d03d96..ffcf433 100644 (file)
@@ -1,4 +1,4 @@
-CONFIG_SYS_EXTRA_OPTIONS="TX28_S,SYS_SDRAM_SIZE=SZ_64M"
+CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=0,TX28_S,SYS_SDRAM_SIZE=SZ_64M"
 CONFIG_ARM=y
 CONFIG_ARCH_MXS=y
 CONFIG_TARGET_TX28=y
index 3877461..d221846 100644 (file)
 /*
  * Serial Driver
  */
+#ifdef CONFIG_CONS_INDEX
+/*
+ * select STK5 UART port 0: 1st UART (DUART) 1,2 2nd,3rd UART (Appl. UART)
+ */
+#if CONFIG_CONS_INDEX == 0
 #define CONFIG_PL011_SERIAL
 #define CONFIG_PL011_CLOCK             24000000
 #define CONFIG_PL01x_PORTS     {       \
        (void *)MXS_UARTDBG_BASE,       \
        }
-#define CONFIG_CONS_INDEX              0               /* do not change! */
+#else /* CONFIG_CONS_INDEX == 0 */
+#define CONFIG_MXS_AUART
+#if CONFIG_CONS_INDEX == 1
+#define CONFIG_MXS_AUART_BASE          ((void *)MXS_UARTAPP1_BASE)
+#elif CONFIG_CONS_INDEX == 2
+#define CONFIG_MXS_AUART_BASE          ((void *)MXS_UARTAPP3_BASE)
+#elif CONFIG_CONS_INDEX != -1
+#error Unsupported console UART selection
+#endif
+#endif /* CONFIG_CONS_INDEX == 0 */
+#endif /* ifdef CONFIG_CONS_INDEX */
 #define CONFIG_BAUDRATE                        115200          /* Default baud rate */
 #define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200, }
 #define CONFIG_SYS_CONSOLE_INFO_QUIET