[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/2] hw/sd.c: Implement CMD58
From: |
Paul Brook |
Subject: |
[Qemu-devel] [PATCH 2/2] hw/sd.c: Implement CMD58 |
Date: |
Mon, 30 Apr 2012 13:01:30 +0100 |
Implement CMD58. This command is only valid in SPI mode, and required when we
implement CMD8. Most of the code is already there, we just need to
trigger it.
Signed-off-by: Paul Brook <address@hidden>
---
hw/sd.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/hw/sd.c b/hw/sd.c
index 220562e..952d5d8 100644
--- a/hw/sd.c
+++ b/hw/sd.c
@@ -141,7 +141,7 @@ static const sd_cmd_type_t sd_cmd_type[64] = {
sd_ac, sd_ac, sd_none, sd_none, sd_none, sd_none, sd_ac, sd_none,
sd_none, sd_none, sd_bc, sd_none, sd_none, sd_none, sd_none, sd_none,
sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_ac,
- sd_adtc, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none,
+ sd_adtc, sd_none, sd_bcr, sd_none, sd_none, sd_none, sd_none, sd_none,
};
static const sd_cmd_type_t sd_acmd_type[64] = {
@@ -1223,6 +1223,19 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,
break;
}
break;
+ case 58: /* CMD58: READ_OCR */
+ if (!sd->spi) {
+ goto bad_cmd;
+ }
+ switch (sd->state) {
+ case sd_idle_state:
+ case sd_transfer_state:
+ return sd_r3;
+
+ default:
+ break;
+ }
+ break;
default:
bad_cmd:
--
1.7.10