diff mbox series

[v2,18/25] sdcard: add an enum for the SD PHY Spec version

Message ID 20180103212436.15762-19-f4bug@amsat.org
State New
Headers show
Series SDCard: housekeeping, improve SPI, introduce new Specs | expand

Commit Message

Philippe Mathieu-Daudé Jan. 3, 2018, 9:24 p.m. UTC
So far this device intends to model the Spec v2.00

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/sd/sd.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 024a9fa1df..ed5874e4d6 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -58,6 +58,11 @@  do { fprintf(stderr, "SD: " fmt , ## __VA_ARGS__); } while (0)
 
 #define SDCARD_CMD_MAX 64
 
+typedef enum {
+    SD_PHY_SPEC_VER_2_00 = 200,
+    SD_PHY_SPEC_VER_3_01 = 301, /* not yet supported */
+} sd_phy_spec_ver_t;
+
 typedef enum {
     sd_r0 = 0,    /* no response */
     sd_r1,        /* normal response command */
@@ -114,6 +119,7 @@  struct SDState {
     uint32_t pwd_len;
     uint8_t function_group[6];
 
+    int spec_version;
     bool spi;
 
     uint32_t mode;    /* current card mode, one of SDCardModes */
@@ -1977,6 +1983,7 @@  static void sd_realize(DeviceState *dev, Error **errp)
     int ret;
 
     sd->proto_name = sd->spi ? "SPI" : "SD";
+    sd->spec_version = SD_PHY_SPEC_VER_2_00;
 
     if (sd->blk && blk_is_read_only(sd->blk)) {
         error_setg(errp, "Cannot use read-only drive as SD card");