Add eMMC device built on top of SD card. Signed-off-by: Sai Pavan Boddu <sai.pavan.bo...@xilinx.com> --- include/hw/sd/sd.h | 2 ++ hw/sd/sd.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+)
diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h index 05ef9b7..b402dad 100644 --- a/include/hw/sd/sd.h +++ b/include/hw/sd/sd.h @@ -90,6 +90,8 @@ typedef struct { } SDRequest; +#define TYPE_EMMC "emmc" +OBJECT_DECLARE_SIMPLE_TYPE(EMMCState, EMMC) #define TYPE_SD_CARD "sd-card" OBJECT_DECLARE_TYPE(SDState, SDCardClass, SD_CARD) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 74b9162..a23af6d 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -108,6 +108,7 @@ struct SDState { uint8_t spec_version; BlockBackend *blk; bool spi; + bool emmc; /* Runtime changeables */ @@ -143,6 +144,10 @@ struct SDState { bool cmd_line; }; +struct EMMCState { + SDState parent; +}; + static void sd_realize(DeviceState *dev, Error **errp); static const char *sd_state_name(enum SDCardStates state) @@ -2105,6 +2110,13 @@ static void sd_instance_init(Object *obj) sd->ocr_power_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sd_ocr_powerup, sd); } +static void emmc_instance_init(Object *obj) +{ + SDState *sd = SD_CARD(obj); + + sd->emmc = true; +} + static void sd_instance_finalize(Object *obj) { SDState *sd = SD_CARD(obj); @@ -2213,9 +2225,17 @@ static const TypeInfo sd_info = { .instance_finalize = sd_instance_finalize, }; +static const TypeInfo emmc_info = { + .name = TYPE_EMMC, + .parent = TYPE_SD_CARD, + .instance_size = sizeof(EMMCState), + .instance_init = emmc_instance_init, +}; + static void sd_register_types(void) { type_register_static(&sd_info); + type_register_static(&emmc_info); } type_init(sd_register_types) -- 2.7.4