Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
hw/sd: Add sd_cmd_SEND_TUNING_BLOCK() handler
Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
  • Loading branch information
shenki authored and legoater committed Sep 1, 2023
1 parent 41a0349 commit 793d04f
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions hw/sd/sd.c
Expand Up @@ -1062,6 +1062,22 @@ static sd_rsp_type_t sd_cmd_SEND_RELATIVE_ADDR(SDState *sd, SDRequest req)
}
}

static sd_rsp_type_t sd_cmd_SEND_TUNING_BLOCK(SDState *sd, SDRequest req)
{
if (sd->spec_version < SD_PHY_SPECv3_01_VERS) {
return sd_cmd_illegal(sd, req);
}

if (sd->state != sd_transfer_state) {
return sd_invalid_state_for_cmd(sd, req);
}

sd->state = sd_sendingdata_state;
sd->data_offset = 0;

return sd_r1;
}

static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
{
uint32_t rca = 0x0000;
Expand Down Expand Up @@ -1305,17 +1321,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
}
break;

case 19: /* CMD19: SEND_TUNING_BLOCK (SD) */
if (sd->spec_version < SD_PHY_SPECv3_01_VERS) {
return sd_invalid_state_for_cmd(sd, req);
}
if (sd->state == sd_transfer_state) {
sd->state = sd_sendingdata_state;
sd->data_offset = 0;
return sd_r1;
}
break;

case 23: /* CMD23: SET_BLOCK_COUNT */
if (sd->spec_version < SD_PHY_SPECv3_01_VERS) {
return sd_invalid_state_for_cmd(sd, req);
Expand Down Expand Up @@ -2152,6 +2157,7 @@ static const SDProto sd_proto_sd = {
[2] = sd_cmd_ALL_SEND_CID,
[3] = sd_cmd_SEND_RELATIVE_ADDR,
[5] = sd_cmd_illegal,
[19] = sd_cmd_SEND_TUNING_BLOCK,
[52 ... 54] = sd_cmd_illegal,
[58] = sd_cmd_illegal,
[59] = sd_cmd_illegal,
Expand Down

0 comments on commit 793d04f

Please sign in to comment.