浏览代码

tegra2: Plumb in SPI/UART switch code

On Seaboard the UART and SPI interfere with each other. This causes the UART
to receive spurious zero bytes after SPI transactions and also means that
SPI can corrupt a few output characters when it starts up if they are still
in the UART buffer.

This updates the board to use the SPI/UART switch to avoid the problem.

For now this feature is turned off since it needs changes to the NS16550
UART to operate.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
Simon Glass 13 年之前
父节点
当前提交
a04eba99f5
共有 3 个文件被更改,包括 12 次插入0 次删除
  1. 8 0
      board/nvidia/common/board.c
  2. 1 0
      board/nvidia/common/board.h
  3. 3 0
      board/nvidia/seaboard/seaboard.c

+ 8 - 0
board/nvidia/common/board.c

@@ -112,9 +112,13 @@ static void pin_mux_uart(int uart_ids)
  */
  */
 int board_init(void)
 int board_init(void)
 {
 {
+	/* Do clocks and UART first so that printf() works */
 	clock_init();
 	clock_init();
 	clock_verify();
 	clock_verify();
 
 
+#ifdef CONFIG_SPI_UART_SWITCH
+	gpio_config_uart();
+#endif
 #ifdef CONFIG_TEGRA2_SPI
 #ifdef CONFIG_TEGRA2_SPI
 	spi_init();
 	spi_init();
 #endif
 #endif
@@ -152,7 +156,11 @@ int board_early_init_f(void)
 	pin_mux_uart(uart_ids);
 	pin_mux_uart(uart_ids);
 
 
 	/* Initialize periph GPIOs */
 	/* Initialize periph GPIOs */
+#ifdef CONFIG_SPI_UART_SWITCH
+	gpio_early_init_uart();
+#else
 	gpio_config_uart();
 	gpio_config_uart();
+#endif
 	return 0;
 	return 0;
 }
 }
 #endif	/* EARLY_INIT */
 #endif	/* EARLY_INIT */

+ 1 - 0
board/nvidia/common/board.h

@@ -26,5 +26,6 @@
 
 
 void gpio_config_uart(void);
 void gpio_config_uart(void);
 int tegra2_mmc_init(int dev_index, int bus_width, int pwr_gpio, int cd_gpio);
 int tegra2_mmc_init(int dev_index, int bus_width, int pwr_gpio, int cd_gpio);
+void gpio_early_init_uart(void);
 
 
 #endif	/* BOARD_H */
 #endif	/* BOARD_H */

+ 3 - 0
board/nvidia/seaboard/seaboard.c

@@ -31,6 +31,8 @@
 #endif
 #endif
 #include "../common/board.h"
 #include "../common/board.h"
 
 
+/* TODO: Remove this code when the SPI switch is working */
+#ifndef CONFIG_SPI_UART_SWITCH
 /*
 /*
  * Routine: gpio_config_uart_seaboard
  * Routine: gpio_config_uart_seaboard
  * Description: Force GPIO_PI3 low on Seaboard so UART4 works.
  * Description: Force GPIO_PI3 low on Seaboard so UART4 works.
@@ -48,6 +50,7 @@ void gpio_config_uart(void)
 		return;
 		return;
 	gpio_config_uart_seaboard();
 	gpio_config_uart_seaboard();
 }
 }
+#endif
 
 
 #ifdef CONFIG_TEGRA2_MMC
 #ifdef CONFIG_TEGRA2_MMC
 /*
 /*