From 0034ebe6ee3151e5c54fd13c6f441429bd2cdadf Mon Sep 17 00:00:00 2001 From: Philippe Mathieu-Daudé Date: Thu, 8 Feb 2018 13:48:09 -0300 Subject: sdhci: implement UHS-I voltage switch [based on a patch from Alistair Francis from qemu/xilinx tag xilinx-v2015.2] Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Message-Id: <20180208164818.7961-22-f4bug@amsat.org> --- include/hw/sd/sd.h | 16 ++++++++++++++++ include/hw/sd/sdhci.h | 1 + 2 files changed, 17 insertions(+) (limited to 'include/hw/sd') diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h index 96caefe373..f086679493 100644 --- a/include/hw/sd/sd.h +++ b/include/hw/sd/sd.h @@ -55,6 +55,20 @@ #define AKE_SEQ_ERROR (1 << 3) #define OCR_CCS_BITN 30 +typedef enum { + SD_VOLTAGE_0_4V = 400, /* currently not supported */ + SD_VOLTAGE_1_8V = 1800, + SD_VOLTAGE_3_0V = 3000, + SD_VOLTAGE_3_3V = 3300, +} sd_voltage_mv_t; + +typedef enum { + UHS_NOT_SUPPORTED = 0, + UHS_I = 1, + UHS_II = 2, /* currently not supported */ + UHS_III = 3, /* currently not supported */ +} sd_uhs_mode_t; + typedef enum { sd_none = -1, sd_bc = 0, /* broadcast -- no response */ @@ -88,6 +102,7 @@ typedef struct { void (*write_data)(SDState *sd, uint8_t value); uint8_t (*read_data)(SDState *sd); bool (*data_ready)(SDState *sd); + void (*set_voltage)(SDState *sd, uint16_t millivolts); void (*enable)(SDState *sd, bool enable); bool (*get_inserted)(SDState *sd); bool (*get_readonly)(SDState *sd); @@ -134,6 +149,7 @@ void sd_enable(SDState *sd, bool enable); /* Functions to be used by qdevified callers (working via * an SDBus rather than directly with SDState) */ +void sdbus_set_voltage(SDBus *sdbus, uint16_t millivolts); int sdbus_do_command(SDBus *sd, SDRequest *req, uint8_t *response); void sdbus_write_data(SDBus *sd, uint8_t value); uint8_t sdbus_read_data(SDBus *sd); diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h index fd606e9928..f321767c56 100644 --- a/include/hw/sd/sdhci.h +++ b/include/hw/sd/sdhci.h @@ -96,6 +96,7 @@ typedef struct SDHCIState { bool pending_insert_quirk; /* Quirk for Raspberry Pi card insert int */ uint32_t quirks; uint8_t sd_spec_version; + uint8_t uhs_mode; } SDHCIState; /* -- cgit v1.2.3-55-g7522