From 045c1c1d4d5c5b84abe47f5789f2fbb54d9fdce8 Mon Sep 17 00:00:00 2001 From: mrm Date: Sun, 13 Mar 2022 03:55:17 +0900 Subject: [PATCH] add raspi4_platform and connect uart0 irq to bcm2838 --- hw/arm/bcm2836.c | 6 ++++++ include/hw/arm/raspi4_platform.h | 7 +++++++ 2 files changed, 13 insertions(+) create mode 100644 include/hw/arm/raspi4_platform.h diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 5364e447a0..c5097aa1f8 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -14,6 +14,7 @@ #include "qemu/module.h" #include "hw/arm/bcm2836.h" #include "hw/arm/raspi_platform.h" +#include "hw/arm/raspi4_platform.h" #include "hw/sysbus.h" #include "trace.h" @@ -342,6 +343,10 @@ static void bcm2838_realize(DeviceState *dev, Error **errp) qdev_get_gpio_in(gicdev, PPI(n, GIC400_MAINTAINANCE_IRQ))); + /* Connect UART0 to the interrupt controller */ + sysbus_connect_irq(SYS_BUS_DEVICE(&s->peripherals.uart0), 0, + qdev_get_gpio_in(gicdev, RPI4_INTERRUPT_UART0)); + /* Connect timers from the CPU to the interrupt controller */ qdev_connect_gpio_out(cpudev, GTIMER_PHYS, qdev_get_gpio_in(gicdev, PPI(n, GIC400_TIMER_NS_EL1_IRQ))); @@ -362,6 +367,7 @@ static void bcm2838_realize(DeviceState *dev, Error **errp) /* Pass through outbound IRQ lines from the GIC */ qdev_pass_gpios(DEVICE(&s->gic), DEVICE(&s->peripherals), NULL); } + static void bcm2837_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); diff --git a/include/hw/arm/raspi4_platform.h b/include/hw/arm/raspi4_platform.h new file mode 100644 index 0000000000..eb555fd033 --- /dev/null +++ b/include/hw/arm/raspi4_platform.h @@ -0,0 +1,7 @@ +#ifndef HW_ARM_RASPI4_PLATFROM_H +#define HW_ARM_RASPI4_PLATFROM_H + +/* SPI */ +#define RPI4_INTERRUPT_UART0 121 + +#endif