diff mbox

[U-Boot,2/2] mmc_spi: generate response for send status command

Message ID 1303220912-4091-2-git-send-email-thomas@wytron.com.tw
State Accepted
Commit ed018b21d61614e0431f6bf514bec6e4bf64fe31
Delegated to: Andy Fleming
Headers show

Commit Message

Thomas Chou April 19, 2011, 1:48 p.m. UTC
A "send status" command is added with the commit "mmc: checking
status after commands with R1b response". But the status register
returned from send status command of SPI protocol is different from
that of MMC/SD protocol. We do a simple test and generate a response
in stead of full bit-by-bit translation.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
for u-boot

 drivers/mmc/mmc_spi.c |    5 +++++
 include/mmc.h         |    1 +
 2 files changed, 6 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/drivers/mmc/mmc_spi.c b/drivers/mmc/mmc_spi.c
index dc7574c..49fb9e0 100644
--- a/drivers/mmc/mmc_spi.c
+++ b/drivers/mmc/mmc_spi.c
@@ -208,6 +208,11 @@  static int mmc_spi_request(struct mmc *mmc, struct mmc_cmd *cmd,
 			cmd->response[0] = swab32(cmd->response[0]);
 			debug("r32 %x\n", cmd->response[0]);
 			break;
+		case MMC_CMD_SEND_STATUS:
+			spi_xfer(spi, 1 * 8, NULL, cmd->response, 0);
+			cmd->response[0] = (cmd->response[0] & 0xff) ?
+				MMC_STATUS_ERROR : MMC_STATUS_RDY_FOR_DATA;
+			break;
 		}
 	} else {
 		debug("%s:data %x %x %x\n", __func__,
diff --git a/include/mmc.h b/include/mmc.h
index 1a0d00a..f502d86 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -102,6 +102,7 @@ 
 #define MMC_STATUS_MASK		(~0x0206BF7F)
 #define MMC_STATUS_RDY_FOR_DATA (1 << 8)
 #define MMC_STATUS_CURR_STATE	(0xf << 9)
+#define MMC_STATUS_ERROR	(1 << 19)
 
 #define MMC_VDD_165_195		0x00000080	/* VDD voltage 1.65 - 1.95 */
 #define MMC_VDD_20_21		0x00000100	/* VDD voltage 2.0 ~ 2.1 */