From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44932) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecGzz-0000T2-9R for qemu-devel@nongnu.org; Thu, 18 Jan 2018 15:41:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecGzw-0007Sy-62 for qemu-devel@nongnu.org; Thu, 18 Jan 2018 15:41:23 -0500 Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 18 Jan 2018 17:40:47 -0300 Message-Id: <20180118204058.5768-4-f4bug@amsat.org> In-Reply-To: <20180118204058.5768-1-f4bug@amsat.org> References: <20180118204058.5768-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v7 03/14] hw/arm/bcm2835_peripherals: implement SDHCI Spec v3 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alistair Francis , Peter Maydell Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, "Edgar E . Iglesias" , Andrey Smirnov , Prasad J Pandit , Sai Pavan Boddu , Peter Crosthwaite , "open list:ARM" Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/bcm2835_peripherals.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c index 12e0dd11af..79d680cb1b 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 0x7e000000 -/* 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,27 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp) memory_region_add_subregion(&s->peri_mr, RNG_OFFSET, sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->rng), 0)); - /* Extended Mass Media Controller */ - object_property_set_int(OBJECT(&s->sdhci), BCM2835_SDHC_CAPAREG, "capareg", - &err); - 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(&s->sdhci), 3, "sd-spec-version", &err); + object_property_set_uint(OBJECT(&s->sdhci), 52, "timeout-freq", &err); + object_property_set_uint(OBJECT(&s->sdhci), 52, "max-frequency", &err); + object_property_set_bool(OBJECT(&s->sdhci), false, "adma1", &err); + object_property_set_bool(OBJECT(&s->sdhci), true, "1v8", &err); object_property_set_bool(OBJECT(&s->sdhci), true, "pending-insert-quirk", &err); if (err) { -- 2.15.1