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 <p...@codesourcery.com> --- 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