From: Simon Glass Date: Sat, 5 Nov 2011 07:46:50 -0700 Subject: [U-Boot] [PATCH v3 7/8] tegra2: spi: Support SPI / UART switch In-Reply-To: <1320504411-6504-1-git-send-email-sjg@chromium.org> References: <1320504411-6504-1-git-send-email-sjg@chromium.org> Message-ID: <1320504411-6504-8-git-send-email-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- Changes in v2: - Add pinmux logic to SPI driver - Rename uart/spi_enable() to pinmux_select_uart/spi() drivers/spi/tegra2_spi.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/drivers/spi/tegra2_spi.c b/drivers/spi/tegra2_spi.c index 2db5a84..fe37218 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 { @@ -123,6 +125,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; } @@ -140,6 +152,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); } -- 1.7.3.1