From: Vincent Palatin <vpala...@chromium.org> Change SET_RELATIVE_ADDR command to assign relative address as requested by user.
Signed-off-by: Vincent Palatin <vpala...@chromium.org> Signed-off-by: Joel Stanley <j...@jms.id.au> Signed-off-by: Cédric Le Goater <c...@kaod.org> [spb: Split original patch series] Signed-off-by: Sai Pavan Boddu <sai.pavan.bo...@xilinx.com> --- hw/sd/sd.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index a23af6d..6de414b 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -436,9 +436,13 @@ static void sd_set_csd(SDState *sd, uint64_t size) sd->csd[15] = (sd_crc7(sd->csd, 15) << 1) | 1; } -static void sd_set_rca(SDState *sd) +static void sd_set_rca(SDState *sd, uint16_t value) { - sd->rca += 0x4567; + if (sd->emmc) { + sd->rca = value; + } else { + sd->rca += 0x4567; + } } FIELD(CSR, AKE_SEQ_ERROR, 3, 1) @@ -984,8 +988,8 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) case sd_identification_state: case sd_standby_state: sd->state = sd_standby_state; - sd_set_rca(sd); - return sd_r6; + sd_set_rca(sd, req.arg >> 16); + return sd->emmc ? sd_r1 : sd_r6; default: break; -- 2.7.4