From: Simon Glass Date: Sat, 5 Nov 2011 04:46:50 +0000 (+0000) Subject: tegra2: spi: Support SPI / UART switch X-Git-Tag: v2012.04-rc1~329^2~16 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4560c7decc1b13121072621cee9874e042c059b7;p=u-boot tegra2: spi: Support SPI / UART switch Add the SPI / UART switch logic into the Tegra2 SPI driver so that it can co-exist with the NS16550 UART. We need the ns16550.h header for NS16550_t for now. Signed-off-by: Simon Glass Signed-off-by: Tom Warren --- diff --git a/drivers/spi/tegra2_spi.c b/drivers/spi/tegra2_spi.c index fdcad093cf..56cb22963d 100644 --- a/drivers/spi/tegra2_spi.c +++ b/drivers/spi/tegra2_spi.c @@ -28,9 +28,11 @@ #include #include #include +#include #include #include #include +#include #include struct tegra_spi_slave { @@ -128,6 +130,16 @@ int spi_claim_bus(struct spi_slave *slave) */ pinmux_set_func(PINGRP_GMD, PMUX_FUNC_SFLASH); pinmux_tristate_disable(PINGRP_LSPI); + +#ifndef CONFIG_SPI_UART_SWITCH + /* + * NOTE: + * Only set PinMux bits 3:2 to SPI here on boards that don't have the + * SPI UART switch or subsequent UART data won't go out! See + * spi_uart_switch(). + */ + /* TODO: pinmux_set_func(PINGRP_GMC, PMUX_FUNC_SFLASH); */ +#endif return 0; } @@ -145,6 +157,8 @@ void spi_cs_activate(struct spi_slave *slave) { struct tegra_spi_slave *spi = to_tegra_spi(slave); + pinmux_select_spi(); + /* CS is negated on Tegra, so drive a 1 to get a 0 */ setbits_le32(&spi->regs->command, SPI_CMD_CS_VAL); }