Skip to content
Snippets Groups Projects
Commit 4560c7de authored by Simon Glass's avatar Simon Glass Committed by Albert ARIBAUD
Browse files

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: default avatarSimon Glass <sjg@chromium.org>
Signed-off-by: default avatarTom Warren <twarren@nvidia.com>
parent cb934812
No related merge requests found
...@@ -28,9 +28,11 @@ ...@@ -28,9 +28,11 @@
#include <spi.h> #include <spi.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/gpio.h> #include <asm/gpio.h>
#include <ns16550.h>
#include <asm/arch/clk_rst.h> #include <asm/arch/clk_rst.h>
#include <asm/arch/clock.h> #include <asm/arch/clock.h>
#include <asm/arch/pinmux.h> #include <asm/arch/pinmux.h>
#include <asm/arch/uart-spi-switch.h>
#include <asm/arch/tegra2_spi.h> #include <asm/arch/tegra2_spi.h>
struct tegra_spi_slave { struct tegra_spi_slave {
...@@ -128,6 +130,16 @@ int spi_claim_bus(struct spi_slave *slave) ...@@ -128,6 +130,16 @@ int spi_claim_bus(struct spi_slave *slave)
*/ */
pinmux_set_func(PINGRP_GMD, PMUX_FUNC_SFLASH); pinmux_set_func(PINGRP_GMD, PMUX_FUNC_SFLASH);
pinmux_tristate_disable(PINGRP_LSPI); 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; return 0;
} }
...@@ -145,6 +157,8 @@ void spi_cs_activate(struct spi_slave *slave) ...@@ -145,6 +157,8 @@ void spi_cs_activate(struct spi_slave *slave)
{ {
struct tegra_spi_slave *spi = to_tegra_spi(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 */ /* CS is negated on Tegra, so drive a 1 to get a 0 */
setbits_le32(&spi->regs->command, SPI_CMD_CS_VAL); setbits_le32(&spi->regs->command, SPI_CMD_CS_VAL);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment