diff mbox

[U-Boot,RFC] add CONFIG_SPI_IDLE_VAL for cf_spi.c to allow use of spi_mmc

Message ID 1272037392-22905-1-git-send-email-w.wegner@astro-kom.de
State Accepted
Commit b97e0cd78837180e122cd9209b9e71e2c2d3f911
Delegated to: Andy Fleming
Headers show

Commit Message

Wolfgang Wegner April 23, 2010, 3:43 p.m. UTC
This patch adds CONFIG_SPI_IDLE_VAL to cf_spi.c
The default setting is 0x0 to behave same as current version, in case
CONFIG_SPI_MMC is set, the value is set to 0xFFFF (all ones). In either
case, the value can be overwritten by board configuration.

Signed-off-by: Wolfgang Wegner <w.wegner@astro-kom.de>
---
 drivers/spi/cf_spi.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

Comments

Terje B. Nilsen June 13, 2011, 6:27 p.m. UTC | #1
Wolfgang Wegner <w.wegner <at> astro-kom.de> writes:

> 
> This patch adds CONFIG_SPI_IDLE_VAL to cf_spi.c
> The default setting is 0x0 to behave same as current version, in case
> CONFIG_SPI_MMC is set, the value is set to 0xFFFF (all ones). In either
> case, the value can be overwritten by board configuration.
> 
> Signed-off-by: Wolfgang Wegner <w.wegner <at> astro-kom.de>
> ---

Dear Wolfgang,

I am about to add support for SPI to SD/MMC to my Coldfire board (MCF5235 
based) both for das u-boot and for uclinux. Do you have any pointers and/or 
code you can assist with? Your words 'I have finally got MMC/SD working on my 
coldfire board' is exciting. 

Thanks for any help in advance.

Best regards,
Terje B. Nilsen
diff mbox

Patch

diff --git a/drivers/spi/cf_spi.c b/drivers/spi/cf_spi.c
index 8cc1d03..7b26f2a 100644
--- a/drivers/spi/cf_spi.c
+++ b/drivers/spi/cf_spi.c
@@ -49,6 +49,14 @@  extern void cfspi_release_bus(uint bus, uint cs);
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#ifndef CONFIG_SPI_IDLE_VAL
+#if defined(CONFIG_SPI_MMC)
+#define CONFIG_SPI_IDLE_VAL	0xFFFF
+#else
+#define CONFIG_SPI_IDLE_VAL	0x0
+#endif
+#endif
+
 #if defined(CONFIG_CF_DSPI)
 /* DSPI specific mode */
 #define SPI_MODE_MOD	0x00200000
@@ -145,7 +153,7 @@  int cfspi_xfer(struct spi_slave *slave, uint bitlen, const void *dout,
 			}
 
 			if (din != NULL) {
-				cfspi_tx(ctrl, 0);
+				cfspi_tx(ctrl, CONFIG_SPI_IDLE_VAL);
 				if (cfslave->charbit == 16)
 					*spi_rd16++ = cfspi_rx();
 				else
@@ -169,7 +177,7 @@  int cfspi_xfer(struct spi_slave *slave, uint bitlen, const void *dout,
 		}
 
 		if (din != NULL) {
-			cfspi_tx(ctrl, 0);
+			cfspi_tx(ctrl, CONFIG_SPI_IDLE_VAL);
 			if (cfslave->charbit == 16)
 				*spi_rd16 = cfspi_rx();
 			else
@@ -177,7 +185,7 @@  int cfspi_xfer(struct spi_slave *slave, uint bitlen, const void *dout,
 		}
 	} else {
 		/* dummy read */
-		cfspi_tx(ctrl, 0);
+		cfspi_tx(ctrl, CONFIG_SPI_IDLE_VAL);
 		cfspi_rx();
 	}