@@ -446,6 +446,23 @@ static void sd_set_cid(SDState *sd)
sd->cid[15] = (sd_crc7(sd->cid, 15) << 1) | 1;
}
+static void emmc_set_cid(SDState *sd)
+{
+ sd->cid[0] = MID; /* Fake card manufacturer ID (MID) */
+ sd->cid[1] = 0b01; /* CBX: BGA */
+ sd->cid[2] = OID[0]; /* OEM/Application ID (OID) */
+ sd->cid[3] = PNM[0]; /* Fake product name (PNM) */
+ sd->cid[4] = PNM[1];
+ sd->cid[5] = PNM[2];
+ sd->cid[6] = PNM[3];
+ sd->cid[7] = PNM[4];
+ sd->cid[8] = PNM[4];
+ sd->cid[9] = PRV; /* Fake product revision (PRV) */
+ stl_be_p(&sd->cid[10], 0xdeadbeef); /* Fake serial number (PSN) */
+ sd->cid[14] = (MDT_MON << 4) | (MDT_YR - 1997); /* Manufacture date (MDT) */
+ sd->cid[15] = (sd_crc7(sd->cid, 15) << 1) | 1;
+}
+
/* Card-Specific Data register */
#define HWBLOCK_SHIFT 9 /* 512 bytes */
@@ -2581,6 +2598,8 @@ static void emmc_class_init(ObjectClass *klass, void *data)
dc->user_creatable = false;
sc->proto = &sd_proto_emmc;
+
+ sc->set_cid = emmc_set_cid;
}
static const TypeInfo sd_types[] = {
eMMC CID register is slightly different from SD: - One extra PNM (5 -> 6) - MDT is only 1 byte (2 -> 1). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/sd/sd.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)