summary refs log tree commit diff stats
path: root/hw/sd/sd.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2018-02-22 15:12:52 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-02-22 15:12:52 +0000
commit9273ea6123f129a66c9d119c124af40419d57423 (patch)
treeb2196f3c3393b4a86696766442324122539e0c71 /hw/sd/sd.c
parent6f296421f8963bfd2cae13b4648b2c115f7562c9 (diff)
downloadfocaccia-qemu-9273ea6123f129a66c9d119c124af40419d57423.tar.gz
focaccia-qemu-9273ea6123f129a66c9d119c124af40419d57423.zip
sdcard: Don't always set the high capacity bit
Don't set the high capacity bit by default as it will be set if required
in the sd_set_csd() function.

[based on a patch from Alistair Francis <alistair.francis@xilinx.com>
 and Peter Ogden <ogden@xilinx.com> from qemu/xilinx tag xilinx-v2015.4]
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Message-id: 20180215221325.7611-2-f4bug@amsat.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/sd/sd.c')
-rw-r--r--hw/sd/sd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 706cb52668..cc347ff782 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -290,6 +290,10 @@ static void sd_ocr_powerup(void *opaque)
 
     /* card power-up OK */
     sd->ocr = FIELD_DP32(sd->ocr, OCR, CARD_POWER_UP, 1);
+
+    if (sd->size > 1 * G_BYTE) {
+        sd->ocr = FIELD_DP32(sd->ocr, OCR, CARD_CAPACITY, 1);
+    }
 }
 
 static void sd_set_scr(SDState *sd)
@@ -394,7 +398,6 @@ static void sd_set_csd(SDState *sd, uint64_t size)
         sd->csd[13] = 0x40;
         sd->csd[14] = 0x00;
         sd->csd[15] = 0x00;
-        sd->ocr |= 1 << 30;     /* High Capacity SD Memory Card */
     }
 }