[U-Boot] add SPI_CS_HIGH option to cf_spi.c

Submitted by Wolfgang Wegner on April 23, 2010, 8:47 a.m.

Details

Message ID 1272012457-32140-1-git-send-email-w.wegner@astro-kom.de
State Awaiting Upstream
Delegated to: Marek Vasut
Headers show

Commit Message

Wolfgang Wegner April 23, 2010, 8:47 a.m.
Signed-off-by: Wolfgang Wegner <w.wegner@astro-kom.de>
---
I tested this patch on a MCF54455. The basic intention was to make using
DSPI for MMC/SD-Card possible.

 drivers/spi/cf_spi.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/spi/cf_spi.c b/drivers/spi/cf_spi.c
index 722aafc..8cc1d03 100644
--- a/drivers/spi/cf_spi.c
+++ b/drivers/spi/cf_spi.c
@@ -256,6 +256,11 @@  struct spi_slave *cfspi_setup_slave(struct cf_spi_slave *cfslave, uint mode)
 	} else
 		bus_setup |= (dspi->ctar[cfslave->slave.bus] & 0x78FCFFF0);
 
+	if (mode & SPI_CS_HIGH)
+		dspi->mcr &= ~(1 << (16 + cfslave->slave.cs));
+	else
+		dspi->mcr |= (1 << (16 + cfslave->slave.cs));
+
 	cfslave->charbit =
 	    ((dspi->ctar[cfslave->slave.bus] & 0x78000000) ==
 	     0x78000000) ? 16 : 8;