summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-03-26 15:42:12 -0400
committerMike Frysinger <vapier@gentoo.org>2009-04-02 06:42:18 -0400
commitbc72f50a659d0d1b551817e1910b9b2be1c7e496 (patch)
tree619589e1569b7ad9dd8686b33030b6a5ca179873
parent46ac352f0f9406a5f9aa157ac62867fb4650dfd3 (diff)
Blackfin: add BF538/BF539 SPI portmux handling
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--drivers/spi/bfin_spi.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/spi/bfin_spi.c b/drivers/spi/bfin_spi.c
index 0472c1a72fa..bc3394ad59f 100644
--- a/drivers/spi/bfin_spi.c
+++ b/drivers/spi/bfin_spi.c
@@ -36,6 +36,11 @@ MAKE_SPI_FUNC(SPI_BAUD, 0x14)
__attribute__((weak))
int spi_cs_is_valid(unsigned int bus, unsigned int cs)
{
+#if defined(__ADSPBF538__) || defined(__ADSPBF539__)
+ /* The SPI1/SPI2 buses are weird ... only 1 CS */
+ if (bus > 0 && cs != 1)
+ return 0;
+#endif
return (cs >= 1 && cs <= 7);
}
@@ -204,6 +209,19 @@ static void spi_portmux(struct spi_slave *slave)
}
bfin_write_PORT_MUX(mux);
bfin_write_PORTF_FER(f_fer);
+#elif defined(__ADSPBF538__) || defined(__ADSPBF539__)
+ u16 fer, pins;
+ if (slave->bus == 1)
+ pins = PD0 | PD1 | PD2 | (slave->cs == 1 ? PD4 : 0);
+ else if (slave->bus == 2)
+ pins = PD5 | PD6 | PD7 | (slave->cs == 1 ? PD9 : 0);
+ else
+ pins = 0;
+ if (pins) {
+ fer = bfin_read_PORTDIO_FER();
+ fer &= ~pins;
+ bfin_write_PORTDIO_FER(fer);
+ }
#elif defined(__ADSPBF54x__)
#define DO_MUX(port, pin) \
mux = ((mux & ~PORT_x_MUX_##pin##_MASK) | PORT_x_MUX_##pin##_FUNC_1); \