summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2018-02-22 15:12:53 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-02-22 15:12:53 +0000
commite8feec808e96163dd82754521383a203b8fe7bce (patch)
treef5e90ffc304d6cc9d819fa8dd37d699e7dd0e1e2
parent9273ea6123f129a66c9d119c124af40419d57423 (diff)
downloadfocaccia-qemu-e8feec808e96163dd82754521383a203b8fe7bce.tar.gz
focaccia-qemu-e8feec808e96163dd82754521383a203b8fe7bce.zip
sdcard: update the CSD CRC register regardless the CSD structure version
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Message-id: 20180215221325.7611-3-f4bug@amsat.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/sd/sd.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index cc347ff782..110f2f1d0a 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -378,7 +378,6 @@ static void sd_set_csd(SDState *sd, uint64_t size)
         sd->csd[13] = 0x20 |	/* Max. write data block length */
             ((HWBLOCK_SHIFT << 6) & 0xc0);
         sd->csd[14] = 0x00;	/* File format group */
-        sd->csd[15] = (sd_crc7(sd->csd, 15) << 1) | 1;
     } else {			/* SDHC */
         size /= 512 * 1024;
         size -= 1;
@@ -397,8 +396,8 @@ static void sd_set_csd(SDState *sd, uint64_t size)
         sd->csd[12] = 0x0a;
         sd->csd[13] = 0x40;
         sd->csd[14] = 0x00;
-        sd->csd[15] = 0x00;
     }
+    sd->csd[15] = (sd_crc7(sd->csd, 15) << 1) | 1;
 }
 
 static void sd_set_rca(SDState *sd)