[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 19/21] hw/arm/musca: Wire up PL031 RTC
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 19/21] hw/arm/musca: Wire up PL031 RTC |
Date: |
Thu, 21 Feb 2019 18:57:37 +0000 |
Wire up the PL031 RTC for the Musca board.
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
---
hw/arm/musca.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/hw/arm/musca.c b/hw/arm/musca.c
index c4095c4579b..378912b7385 100644
--- a/hw/arm/musca.c
+++ b/hw/arm/musca.c
@@ -30,6 +30,7 @@
#include "hw/misc/tz-mpc.h"
#include "hw/misc/tz-ppc.h"
#include "hw/misc/unimp.h"
+#include "hw/timer/pl031.h"
#define MUSCA_NUMIRQ_MAX 96
#define MUSCA_PPC_MAX 3
@@ -73,7 +74,7 @@ typedef struct {
UnimplementedDeviceState spi;
UnimplementedDeviceState scc;
UnimplementedDeviceState timer;
- UnimplementedDeviceState rtc;
+ PL031State rtc;
UnimplementedDeviceState pvt;
UnimplementedDeviceState sdio;
UnimplementedDeviceState gpio;
@@ -98,6 +99,14 @@ typedef struct {
*/
#define SYSCLK_FRQ 40000000
+static qemu_irq get_sse_irq_in(MuscaMachineState *mms, int irqno)
+{
+ /* Return a qemu_irq which will signal IRQ n to all CPUs in the SSE. */
+ assert(irqno < MUSCA_NUMIRQ_MAX);
+
+ return qdev_get_gpio_in(DEVICE(&mms->cpu_irq_splitter[irqno]), 0);
+}
+
/*
* Most of the devices in the Musca board sit behind Peripheral Protection
* Controllers. These data structures define the layout of which devices
@@ -265,6 +274,17 @@ static MemoryRegion *make_mpc(MuscaMachineState *mms, void
*opaque,
return sysbus_mmio_get_region(SYS_BUS_DEVICE(mpc), 0);
}
+static MemoryRegion *make_rtc(MuscaMachineState *mms, void *opaque,
+ const char *name, hwaddr size)
+{
+ PL031State *rtc = opaque;
+
+ sysbus_init_child_obj(OBJECT(mms), name, rtc, sizeof(mms->rtc),
TYPE_PL031);
+ object_property_set_bool(OBJECT(rtc), true, "realized", &error_fatal);
+ sysbus_connect_irq(SYS_BUS_DEVICE(rtc), 0, get_sse_irq_in(mms, 39));
+ return sysbus_mmio_get_region(SYS_BUS_DEVICE(rtc), 0);
+}
+
static MemoryRegion *make_musca_a_devs(MuscaMachineState *mms, void *opaque,
const char *name, hwaddr size)
{
@@ -287,7 +307,7 @@ static MemoryRegion *make_musca_a_devs(MuscaMachineState
*mms, void *opaque,
{ "i2c1", make_unimp_dev, &mms->i2c[1], 0x5000, 0x1000 },
{ "i2s", make_unimp_dev, &mms->i2s, 0x6000, 0x1000 },
{ "pwm0", make_unimp_dev, &mms->pwm[0], 0x7000, 0x1000 },
- { "rtc", make_unimp_dev, &mms->rtc, 0x8000, 0x1000 },
+ { "rtc", make_rtc, &mms->rtc, 0x8000, 0x1000 },
{ "qspi", make_unimp_dev, &mms->qspi, 0xa000, 0x1000 },
{ "timer", make_unimp_dev, &mms->timer, 0xb000, 0x1000 },
{ "scc", make_unimp_dev, &mms->scc, 0xc000, 0x1000 },
@@ -447,7 +467,7 @@ static void musca_init(MachineState *machine)
{ "spi", make_unimp_dev, &mms->spi, 0x4010a000, 0x1000 },
{ "scc", make_unimp_dev, &mms->scc, 0x5010b000, 0x1000 },
{ "timer", make_unimp_dev, &mms->timer, 0x4010c000, 0x1000 },
- { "rtc", make_unimp_dev, &mms->rtc, 0x4010d000, 0x1000 },
+ { "rtc", make_rtc, &mms->rtc, 0x4010d000, 0x1000 },
{ "pvt", make_unimp_dev, &mms->pvt, 0x4010e000, 0x1000 },
{ "sdio", make_unimp_dev, &mms->sdio, 0x4010f000, 0x1000 },
},
--
2.20.1
- [Qemu-devel] [PULL 14/21] hw/arm/armsse: Document SRAM_ADDR_WIDTH property in header comment, (continued)
- [Qemu-devel] [PULL 14/21] hw/arm/armsse: Document SRAM_ADDR_WIDTH property in header comment, Peter Maydell, 2019/02/21
- [Qemu-devel] [PULL 12/21] hw/char/pl011: Support all interrupt lines, Peter Maydell, 2019/02/21
- [Qemu-devel] [PULL 07/21] target/arm: Implement ARMv8.3-JSConv, Peter Maydell, 2019/02/21
- [Qemu-devel] [PULL 06/21] target/arm: Rearrange Floating-point data-processing (2 regs), Peter Maydell, 2019/02/21
- [Qemu-devel] [PULL 20/21] hw/arm/musca: Wire up PL011 UARTs, Peter Maydell, 2019/02/21
- [Qemu-devel] [PULL 16/21] hw/arm/musca.c: Implement models of the Musca-A and -B1 boards, Peter Maydell, 2019/02/21
- [Qemu-devel] [PULL 17/21] hw/arm/musca: Add PPCs, Peter Maydell, 2019/02/21
- [Qemu-devel] [PULL 08/21] hw/misc/tz-ppc: Support having unused ports in the middle of the range, Peter Maydell, 2019/02/21
- [Qemu-devel] [PULL 15/21] hw/arm/armsse: Allow boards to specify init-svtor, Peter Maydell, 2019/02/21
- [Qemu-devel] [PULL 18/21] hw/arm/musca: Add MPCs, Peter Maydell, 2019/02/21
- [Qemu-devel] [PULL 19/21] hw/arm/musca: Wire up PL031 RTC,
Peter Maydell <=
- [Qemu-devel] [PULL 21/21] hw/arm/armsse: Make 0x5... alias region work for per-CPU devices, Peter Maydell, 2019/02/21
- [Qemu-devel] [PULL 05/21] target/arm: Split out vfp_helper.c, Peter Maydell, 2019/02/21
- Re: [Qemu-devel] [PULL 00/21] target-arm queue, Peter Maydell, 2019/02/22