qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v3 03/21] sd: emmc: Update SET_RELATIVE_ADDR command


From: Sai Pavan Boddu
Subject: [PATCH v3 03/21] sd: emmc: Update SET_RELATIVE_ADDR command
Date: Mon, 1 Mar 2021 01:03:09 +0530

From: Vincent Palatin <vpalatin@chromium.org>

Change SET_RELATIVE_ADDR command to assign relative address
as requested by user.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: C├ędric Le Goater <clg@kaod.org>
[spb: Split original patch series]
Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]