Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> Reviewed-by: Alistair Francis <alistair.fran...@xilinx.com> --- hw/sd/sd.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c index d8dd88f872..a0e8a1b46a 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -94,6 +94,10 @@ struct SDState { BlockBackend *blk; bool spi; + /** + * The UHS mode the card supports if any, else #UHS_NOT_SUPPORTED + */ + uint8_t uhs_mode_supported; /* Runtime changeables */ @@ -300,6 +304,9 @@ static void sd_set_ocr(SDState *sd) { /* All voltages OK */ sd->ocr = R_OCR_VDD_VOLTAGE_WIN_HI_MASK; + + sd->ocr = FIELD_DP32(sd->ocr, OCR, ACCEPT_SWITCH_1V8, + sd->uhs_mode_supported != UHS_NOT_SUPPORTED); } static void sd_ocr_powerup(void *opaque) @@ -2240,6 +2247,7 @@ static Property sd_properties[] = { * board to ensure that ssi transfers only occur when the chip select * is asserted. */ DEFINE_PROP_BOOL("spi", SDState, spi, false), + DEFINE_PROP_UINT8("uhs", SDState, uhs_mode_supported, UHS_NOT_SUPPORTED), DEFINE_PROP_END_OF_LIST() }; -- 2.17.0