Revision | 1665ba42ee962c08db06e7737e5f24a39669124a (tree) |
---|---|
Time | 2018-01-06 09:17:52 |
Author | Philippe Mathieu-Daudé <f4bug@amsa...> |
Commiter | Philippe Mathieu-Daudé |
sdhci: backport for the zynqmp
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
@@ -1481,7 +1481,6 @@ static void sdhci_sysbus_class_init(ObjectClass *klass, void *data) | ||
1481 | 1481 | } |
1482 | 1482 | |
1483 | 1483 | static const TypeInfo sdhci_sysbus_info = { |
1484 | - .abstract = true, | |
1485 | 1484 | .name = TYPE_SYSBUS_SDHCI, |
1486 | 1485 | .parent = TYPE_SYS_BUS_DEVICE, |
1487 | 1486 | .instance_size = sizeof(SDHCIState), |
@@ -81,13 +81,9 @@ static void zynqmp_sdhci_slottype_handler(void *opaque, int n, int level) | ||
81 | 81 | |
82 | 82 | static void zynqmp_sdhci_reset(DeviceState *dev) |
83 | 83 | { |
84 | - ZynqMPSDHCIState *s = ZYNQMP_SDHCI(dev); | |
85 | - SDHCIState *ss = SYSBUS_SDHCI(dev); | |
86 | 84 | DeviceClass *dc_parent = DEVICE_CLASS(ZYNQMP_SDHCI_PARENT_CLASS); |
87 | 85 | |
88 | 86 | dc_parent->reset(dev); |
89 | - | |
90 | - sd_set_cb(s->card, ss->ro_cb, ss->eject_cb); | |
91 | 87 | } |
92 | 88 | |
93 | 89 | static void zynqmp_sdhci_realize(DeviceState *dev, Error **errp) |
@@ -109,8 +105,24 @@ static void zynqmp_sdhci_realize(DeviceState *dev, Error **errp) | ||
109 | 105 | index_offset++; |
110 | 106 | } |
111 | 107 | |
112 | - qdev_prop_set_uint32(dev, "capareg", | |
113 | - (uint32_t) SDHC_CAPAB_REG_DEFAULT | (1 << 28)); | |
108 | + /* Compatible with: | |
109 | + * - SD Host Controller Specification Version 3.00 | |
110 | + * - SDIO Specification Version 3.0 | |
111 | + * - eMMC Specification Version 4.51 | |
112 | + * | |
113 | + * Host clock rate variable between 0 and 208 MHz | |
114 | + * Transfers the data in SDR104, SDR50, DDR50 modes | |
115 | + * (SDR104 mode: up to 832Mbits/s using 4 parallel data lines) | |
116 | + * Transfers the data in 1 bit and 4 bit SD modes | |
117 | + * UHS speed modes, 1.8V | |
118 | + * voltage switch, tuning commands | |
119 | + */ | |
120 | + qdev_prop_set_uint8(dev, "sd-spec-version", 3); | |
121 | + qdev_prop_set_bit(dev, "suspend", true); | |
122 | + qdev_prop_set_bit(dev, "1v8", true); | |
123 | + qdev_prop_set_bit(dev, "64bit", true); | |
124 | + qdev_prop_set_uint8(dev, "bus-speed", 0b111); | |
125 | + qdev_prop_set_uint8(dev, "driver-strength", 0b111); | |
114 | 126 | carddev_sd = qdev_create(qdev_get_child_bus(DEVICE(dev), "sd-bus"), |
115 | 127 | TYPE_SD_CARD); |
116 | 128 | object_property_set_bool(OBJECT(carddev_sd), false, "spi", &error_fatal); |