Re: [Qemu-devel] [PATCH v3 33/42] hw/arm/bcm2835_peripherals: implement SDHCI Spec v3

2018-01-08 Thread Andrew Baumann via Qemu-devel
> From: Philippe Mathieu-Daudé [mailto:philippe.mathieu.da...@gmail.com]
> Sent: Friday, 29 December 2017 09:49
> 
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
> 
> Note, the bcm2835 seems to have 1KB minimum blocksize, however the
> current
> model is implemented with 512B.
> 
> Can someone with access to the datasheets verify?

The public BCM2835 peripherals datasheet says:
  "The EMMC module restricts the maximum block size to the size of the internal 
data FIFO
  which is 1k bytes."
... so I think your patch is correct.

Andrew


[Qemu-devel] [PATCH v3 33/42] hw/arm/bcm2835_peripherals: implement SDHCI Spec v3

2017-12-29 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
---

Note, the bcm2835 seems to have 1KB minimum blocksize, however the current
model is implemented with 512B.

Can someone with access to the datasheets verify?

Thanks!
---
 hw/arm/bcm2835_peripherals.c | 35 ---
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c
index 12e0dd11af..b1a7bc1617 100644
--- a/hw/arm/bcm2835_peripherals.c
+++ b/hw/arm/bcm2835_peripherals.c
@@ -18,9 +18,6 @@
 /* Peripheral base address on the VC (GPU) system bus */
 #define BCM2835_VC_PERI_BASE 0x7e00
 
-/* Capabilities for SD controller: no DMA, high-speed, default clocks etc. */
-#define BCM2835_SDHC_CAPAREG 0x52034b4
-
 static void bcm2835_peripherals_init(Object *obj)
 {
 BCM2835PeripheralState *s = BCM2835_PERIPHERALS(obj);
@@ -254,14 +251,30 @@ static void bcm2835_peripherals_realize(DeviceState *dev, 
Error **errp)
 memory_region_add_subregion(>peri_mr, RNG_OFFSET,
 sysbus_mmio_get_region(SYS_BUS_DEVICE(>rng), 0));
 
-/* Extended Mass Media Controller */
-object_property_set_int(OBJECT(>sdhci), BCM2835_SDHC_CAPAREG, "capareg",
-);
-if (err) {
-error_propagate(errp, err);
-return;
-}
-
+/* Extended Mass Media Controller
+ *
+ * Compatible with:
+ * - SD Host Controller Specification Version 3.0 Draft 1.0
+ * - SDIO Specification Version 3.0
+ * - MMC Specification Version 4.4
+ *
+ * - 32-bit access only
+ * - default clocks
+ * - no DMA
+ * - SD high-speed (SDHS) card
+ * - maximum block size: 1kB
+ *
+ * For the exact details please refer to the Arasan documentation:
+ *   SD3.0_Host_AHB_eMMC4.4_Usersguide_ver5.9_jan11_10.pdf   ¯\_(ツ)_/¯
+ */
+object_property_set_uint(OBJECT(>sdhci), 3, "sd-spec-version", );
+object_property_set_uint(OBJECT(>sdhci), 52, "timeout-freq", );
+object_property_set_uint(OBJECT(>sdhci), 52, "clock-freq", );
+object_property_set_bool(OBJECT(>sdhci), false, "dma", );
+object_property_set_bool(OBJECT(>sdhci), true, "1v8", );
+/* FIXME verify/validate with someone from Broadcom?
+object_property_set_uint(OBJECT(>sdhci), 1024, "max-block-length", 
);
+*/
 object_property_set_bool(OBJECT(>sdhci), true, "pending-insert-quirk",
  );
 if (err) {
-- 
2.15.1