qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] integrator/cp: Wire up MMC card detection


From: Jan Kiszka
Subject: [Qemu-devel] [PATCH] integrator/cp: Wire up MMC card detection
Date: Fri, 30 Jan 2015 21:19:19 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

This allows to use MMC emulation with the Integrator/CP model. Well,
mostly. There seems to be timing issues with Linux so that the card is
not always detected (but most of the time).

Note that the read-only pin is intentionally left unconnected because
the PIC model could deliver it incorrectly as interrupt to the guest
while the spec says that this pin is just for status reading.

Signed-off-by: Jan Kiszka <address@hidden>
---
 hw/arm/integratorcp.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
index 8c48b68..0efadc4 100644
--- a/hw/arm/integratorcp.c
+++ b/hw/arm/integratorcp.c
@@ -477,7 +477,7 @@ static void integratorcp_init(MachineState *machine)
     MemoryRegion *ram = g_new(MemoryRegion, 1);
     MemoryRegion *ram_alias = g_new(MemoryRegion, 1);
     qemu_irq pic[32];
-    DeviceState *dev;
+    DeviceState *dev, *sic;
     int i;
     Error *err = NULL;
 
@@ -535,7 +535,7 @@ static void integratorcp_init(MachineState *machine)
     for (i = 0; i < 32; i++) {
         pic[i] = qdev_get_gpio_in(dev, i);
     }
-    sysbus_create_simple(TYPE_INTEGRATOR_PIC, 0xca000000, pic[26]);
+    sic = sysbus_create_simple(TYPE_INTEGRATOR_PIC, 0xca000000, pic[26]);
     sysbus_create_varargs("integrator_pit", 0x13000000,
                           pic[5], pic[6], pic[7], NULL);
     sysbus_create_simple("pl031", 0x15000000, pic[8]);
@@ -545,7 +545,10 @@ static void integratorcp_init(MachineState *machine)
     sysbus_create_simple("pl050_keyboard", 0x18000000, pic[3]);
     sysbus_create_simple("pl050_mouse", 0x19000000, pic[4]);
     sysbus_create_simple(TYPE_INTEGRATOR_DEBUG, 0x1a000000, 0);
-    sysbus_create_varargs("pl181", 0x1c000000, pic[23], pic[24], NULL);
+    dev = sysbus_create_varargs("pl181", 0x1c000000, pic[23], pic[24], NULL);
+    /* Wire up MMC card detect */
+    qdev_connect_gpio_out(dev, 1, qdev_get_gpio_in(sic, 3));
+
     if (nd_table[0].used)
         smc91c111_init(&nd_table[0], 0xc8000000, pic[27]);
 
-- 
2.1.4



reply via email to

[Prev in Thread] Current Thread [Next in Thread]