aboutsummaryrefslogtreecommitdiff
path: root/hw/arm/allwinner-a10.c
diff options
context:
space:
mode:
authorNiek Linnenbank <nieklinnenbank@gmail.com>2020-03-11 23:18:44 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-03-12 16:27:33 +0000
commit82e4838249b23c3fe20cee295f9c1b3e6abd68d1 (patch)
tree74024e6c97b7e6d90ccc64b3cf5ac8c79849526e /hw/arm/allwinner-a10.c
parent6556617ce1a3c4a2ad91e5c5d1c936ee9134ed04 (diff)
downloadqemu-82e4838249b23c3fe20cee295f9c1b3e6abd68d1.zip
qemu-82e4838249b23c3fe20cee295f9c1b3e6abd68d1.tar.gz
qemu-82e4838249b23c3fe20cee295f9c1b3e6abd68d1.tar.bz2
hw/arm/allwinner: add SD/MMC host controller
The Allwinner System on Chip families sun4i and above contain an integrated storage controller for Secure Digital (SD) and Multi Media Card (MMC) interfaces. This commit adds support for the Allwinner SD/MMC storage controller with the following emulated features: * DMA transfers * Direct FIFO I/O * Short/Long format command responses * Auto-Stop command (CMD12) * Insert & remove card detection The following boards are extended with the SD host controller: * Cubieboard (hw/arm/cubieboard.c) * Orange Pi PC (hw/arm/orangepi.c) Signed-off-by: Niek Linnenbank <nieklinnenbank@gmail.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20200311221854.30370-9-nieklinnenbank@gmail.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/arm/allwinner-a10.c')
-rw-r--r--hw/arm/allwinner-a10.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
index 2ae9c15..dc62c76 100644
--- a/hw/arm/allwinner-a10.c
+++ b/hw/arm/allwinner-a10.c
@@ -27,6 +27,7 @@
#include "hw/boards.h"
#include "hw/usb/hcd-ohci.h"
+#define AW_A10_MMC0_BASE 0x01c0f000
#define AW_A10_PIC_REG_BASE 0x01c20400
#define AW_A10_PIT_REG_BASE 0x01c20c00
#define AW_A10_UART0_REG_BASE 0x01c28000
@@ -64,6 +65,9 @@ static void aw_a10_init(Object *obj)
sizeof(s->ohci[i]), TYPE_SYSBUS_OHCI);
}
}
+
+ sysbus_init_child_obj(obj, "mmc0", &s->mmc0, sizeof(s->mmc0),
+ TYPE_AW_SDHOST_SUN4I);
}
static void aw_a10_realize(DeviceState *dev, Error **errp)
@@ -164,6 +168,13 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
qdev_get_gpio_in(dev, 64 + i));
}
}
+
+ /* SD/MMC */
+ qdev_init_nofail(DEVICE(&s->mmc0));
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->mmc0), 0, AW_A10_MMC0_BASE);
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->mmc0), 0, qdev_get_gpio_in(dev, 32));
+ object_property_add_alias(OBJECT(s), "sd-bus", OBJECT(&s->mmc0),
+ "sd-bus", &error_abort);
}
static void aw_a10_class_init(ObjectClass *oc, void *data)