mirror of https://github.com/xemu-project/xemu.git
hw/sd/sdcard: Add sd_acmd_SD_STATUS handler (ACMD13)
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Message-Id: <20240628070216.92609-70-philmd@linaro.org>
This commit is contained in:
parent
55f2645eab
commit
cc7c6bda3f
22
hw/sd/sd.c
22
hw/sd/sd.c
|
@ -258,7 +258,6 @@ static const char *sd_cmd_name(SDState *sd, uint8_t cmd)
|
||||||
static const char *sd_acmd_name(SDState *sd, uint8_t cmd)
|
static const char *sd_acmd_name(SDState *sd, uint8_t cmd)
|
||||||
{
|
{
|
||||||
static const char *acmd_abbrev[SDMMC_CMD_MAX] = {
|
static const char *acmd_abbrev[SDMMC_CMD_MAX] = {
|
||||||
[13] = "SD_STATUS",
|
|
||||||
[14] = "DPS_spec", [15] = "DPS_spec",
|
[14] = "DPS_spec", [15] = "DPS_spec",
|
||||||
[16] = "DPS_spec",
|
[16] = "DPS_spec",
|
||||||
[18] = "SECU_spec",
|
[18] = "SECU_spec",
|
||||||
|
@ -1664,6 +1663,13 @@ static sd_rsp_type_t sd_acmd_SET_BUS_WIDTH(SDState *sd, SDRequest req)
|
||||||
return sd_r1;
|
return sd_r1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ACMD13 */
|
||||||
|
static sd_rsp_type_t sd_acmd_SD_STATUS(SDState *sd, SDRequest req)
|
||||||
|
{
|
||||||
|
return sd_cmd_to_sendingdata(sd, req, 0,
|
||||||
|
sd->sd_status, sizeof(sd->sd_status));
|
||||||
|
}
|
||||||
|
|
||||||
static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
|
static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
|
||||||
{
|
{
|
||||||
uint64_t addr;
|
uint64_t addr;
|
||||||
|
@ -1788,18 +1794,6 @@ static sd_rsp_type_t sd_app_command(SDState *sd,
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (req.cmd) {
|
switch (req.cmd) {
|
||||||
case 13: /* ACMD13: SD_STATUS */
|
|
||||||
switch (sd->state) {
|
|
||||||
case sd_transfer_state:
|
|
||||||
return sd_cmd_to_sendingdata(sd, req, 0,
|
|
||||||
sd->sd_status,
|
|
||||||
sizeof(sd->sd_status));
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */
|
case 22: /* ACMD22: SEND_NUM_WR_BLOCKS */
|
||||||
switch (sd->state) {
|
switch (sd->state) {
|
||||||
case sd_transfer_state:
|
case sd_transfer_state:
|
||||||
|
@ -2335,6 +2329,7 @@ static const SDProto sd_proto_spi = {
|
||||||
[59] = {0, sd_spi, "CRC_ON_OFF", spi_cmd_CRC_ON_OFF},
|
[59] = {0, sd_spi, "CRC_ON_OFF", spi_cmd_CRC_ON_OFF},
|
||||||
},
|
},
|
||||||
.acmd = {
|
.acmd = {
|
||||||
|
[13] = {8, sd_spi, "SD_STATUS", sd_acmd_SD_STATUS},
|
||||||
[41] = {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND},
|
[41] = {8, sd_spi, "SEND_OP_COND", spi_cmd_SEND_OP_COND},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -2391,6 +2386,7 @@ static const SDProto sd_proto_sd = {
|
||||||
},
|
},
|
||||||
.acmd = {
|
.acmd = {
|
||||||
[6] = {8, sd_ac, "SET_BUS_WIDTH", sd_acmd_SET_BUS_WIDTH},
|
[6] = {8, sd_ac, "SET_BUS_WIDTH", sd_acmd_SET_BUS_WIDTH},
|
||||||
|
[13] = {8, sd_adtc, "SD_STATUS", sd_acmd_SD_STATUS},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue