aboutsummaryrefslogtreecommitdiff
path: root/hw/arm/musicpal.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/arm/musicpal.c')
-rw-r--r--hw/arm/musicpal.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index 5eb3f969fb..458b1cbeb7 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -27,6 +27,7 @@
#include "ui/console.h"
#include "hw/i2c/i2c.h"
#include "hw/irq.h"
+#include "hw/or-irq.h"
#include "hw/audio/wm8750.h"
#include "sysemu/block-backend.h"
#include "sysemu/runstate.h"
@@ -77,8 +78,7 @@
#define MP_TIMER4_IRQ 7
#define MP_EHCI_IRQ 8
#define MP_ETH_IRQ 9
-#define MP_UART1_IRQ 11
-#define MP_UART2_IRQ 11
+#define MP_UART_SHARED_IRQ 11
#define MP_GPIO_IRQ 12
#define MP_RTC_IRQ 28
#define MP_AUDIO_IRQ 30
@@ -1587,8 +1587,9 @@ static struct arm_boot_info musicpal_binfo = {
static void musicpal_init(MachineState *machine)
{
ARMCPU *cpu;
- qemu_irq pic[32];
DeviceState *dev;
+ DeviceState *pic;
+ DeviceState *uart_orgate;
DeviceState *i2c_dev;
DeviceState *lcd_dev;
DeviceState *key_dev;
@@ -1618,18 +1619,26 @@ static void musicpal_init(MachineState *machine)
&error_fatal);
memory_region_add_subregion(address_space_mem, MP_SRAM_BASE, sram);
- dev = sysbus_create_simple(TYPE_MV88W8618_PIC, MP_PIC_BASE,
+ pic = sysbus_create_simple(TYPE_MV88W8618_PIC, MP_PIC_BASE,
qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ));
- for (i = 0; i < 32; i++) {
- pic[i] = qdev_get_gpio_in(dev, i);
- }
- sysbus_create_varargs(TYPE_MV88W8618_PIT, MP_PIT_BASE, pic[MP_TIMER1_IRQ],
- pic[MP_TIMER2_IRQ], pic[MP_TIMER3_IRQ],
- pic[MP_TIMER4_IRQ], NULL);
-
- serial_mm_init(address_space_mem, MP_UART1_BASE, 2, pic[MP_UART1_IRQ],
+ sysbus_create_varargs(TYPE_MV88W8618_PIT, MP_PIT_BASE,
+ qdev_get_gpio_in(pic, MP_TIMER1_IRQ),
+ qdev_get_gpio_in(pic, MP_TIMER2_IRQ),
+ qdev_get_gpio_in(pic, MP_TIMER3_IRQ),
+ qdev_get_gpio_in(pic, MP_TIMER4_IRQ), NULL);
+
+ /* Logically OR both UART IRQs together */
+ uart_orgate = DEVICE(object_new(TYPE_OR_IRQ));
+ object_property_set_int(OBJECT(uart_orgate), "num-lines", 2, &error_fatal);
+ qdev_realize_and_unref(uart_orgate, NULL, &error_fatal);
+ qdev_connect_gpio_out(DEVICE(uart_orgate), 0,
+ qdev_get_gpio_in(pic, MP_UART_SHARED_IRQ));
+
+ serial_mm_init(address_space_mem, MP_UART1_BASE, 2,
+ qdev_get_gpio_in(uart_orgate, 0),
1825000, serial_hd(0), DEVICE_NATIVE_ENDIAN);
- serial_mm_init(address_space_mem, MP_UART2_BASE, 2, pic[MP_UART2_IRQ],
+ serial_mm_init(address_space_mem, MP_UART2_BASE, 2,
+ qdev_get_gpio_in(uart_orgate, 1),
1825000, serial_hd(1), DEVICE_NATIVE_ENDIAN);
/* Register flash */
@@ -1665,14 +1674,15 @@ static void musicpal_init(MachineState *machine)
OBJECT(get_system_memory()), &error_fatal);
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, MP_ETH_BASE);
- sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[MP_ETH_IRQ]);
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0,
+ qdev_get_gpio_in(pic, MP_ETH_IRQ));
sysbus_create_simple("mv88w8618_wlan", MP_WLAN_BASE, NULL);
sysbus_create_simple(TYPE_MUSICPAL_MISC, MP_MISC_BASE, NULL);
dev = sysbus_create_simple(TYPE_MUSICPAL_GPIO, MP_GPIO_BASE,
- pic[MP_GPIO_IRQ]);
+ qdev_get_gpio_in(pic, MP_GPIO_IRQ));
i2c_dev = sysbus_create_simple("gpio_i2c", -1, NULL);
i2c = (I2CBus *)qdev_get_child_bus(i2c_dev, "i2c");
@@ -1704,7 +1714,7 @@ static void musicpal_init(MachineState *machine)
NULL);
sysbus_realize_and_unref(s, &error_fatal);
sysbus_mmio_map(s, 0, MP_AUDIO_BASE);
- sysbus_connect_irq(s, 0, pic[MP_AUDIO_IRQ]);
+ sysbus_connect_irq(s, 0, qdev_get_gpio_in(pic, MP_AUDIO_IRQ));
musicpal_binfo.ram_size = MP_RAM_DEFAULT_SIZE;
arm_load_kernel(cpu, machine, &musicpal_binfo);