MAX78000: Add GCR to SOC
This commit adds the Global Control Register to max78000_soc Signed-off-by: Jackson Donaldson <jcksn@duck.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20250704223239.248781-8-jcksn@duck.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
a017f53e09
commit
035a38fa97
2 changed files with 18 additions and 2 deletions
|
|
@ -30,6 +30,8 @@ static void max78000_soc_initfn(Object *obj)
|
|||
|
||||
object_initialize_child(obj, "armv7m", &s->armv7m, TYPE_ARMV7M);
|
||||
|
||||
object_initialize_child(obj, "gcr", &s->gcr, TYPE_MAX78000_GCR);
|
||||
|
||||
for (i = 0; i < MAX78000_NUM_ICC; i++) {
|
||||
g_autofree char *name = g_strdup_printf("icc%d", i);
|
||||
object_initialize_child(obj, name, &s->icc[i], TYPE_MAX78000_ICC);
|
||||
|
|
@ -48,7 +50,7 @@ static void max78000_soc_realize(DeviceState *dev_soc, Error **errp)
|
|||
{
|
||||
MAX78000State *s = MAX78000_SOC(dev_soc);
|
||||
MemoryRegion *system_memory = get_system_memory();
|
||||
DeviceState *dev, *armv7m;
|
||||
DeviceState *dev, *gcrdev, *armv7m;
|
||||
SysBusDevice *busdev;
|
||||
Error *err = NULL;
|
||||
int i;
|
||||
|
|
@ -69,6 +71,11 @@ static void max78000_soc_realize(DeviceState *dev_soc, Error **errp)
|
|||
|
||||
memory_region_init_ram(&s->sram, NULL, "MAX78000.sram", SRAM_SIZE,
|
||||
&err);
|
||||
|
||||
gcrdev = DEVICE(&s->gcr);
|
||||
object_property_set_link(OBJECT(gcrdev), "sram", OBJECT(&s->sram),
|
||||
&err);
|
||||
|
||||
if (err != NULL) {
|
||||
error_propagate(errp, err);
|
||||
return;
|
||||
|
|
@ -101,19 +108,26 @@ static void max78000_soc_realize(DeviceState *dev_soc, Error **errp)
|
|||
}
|
||||
|
||||
for (i = 0; i < MAX78000_NUM_UART; i++) {
|
||||
g_autofree char *link = g_strdup_printf("uart%d", i);
|
||||
dev = DEVICE(&(s->uart[i]));
|
||||
qdev_prop_set_chr(dev, "chardev", serial_hd(i));
|
||||
if (!sysbus_realize(SYS_BUS_DEVICE(&s->uart[i]), errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
object_property_set_link(OBJECT(gcrdev), link, OBJECT(dev),
|
||||
&err);
|
||||
|
||||
busdev = SYS_BUS_DEVICE(dev);
|
||||
sysbus_mmio_map(busdev, 0, max78000_uart_addr[i]);
|
||||
sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(armv7m,
|
||||
max78000_uart_irq[i]));
|
||||
}
|
||||
|
||||
create_unimplemented_device("globalControl", 0x40000000, 0x400);
|
||||
dev = DEVICE(&s->gcr);
|
||||
sysbus_realize(SYS_BUS_DEVICE(dev), errp);
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x40000000);
|
||||
|
||||
create_unimplemented_device("systemInterface", 0x40000400, 0x400);
|
||||
create_unimplemented_device("functionControl", 0x40000800, 0x400);
|
||||
create_unimplemented_device("watchdogTimer0", 0x40003000, 0x400);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "hw/or-irq.h"
|
||||
#include "hw/arm/armv7m.h"
|
||||
#include "hw/misc/max78000_gcr.h"
|
||||
#include "hw/misc/max78000_icc.h"
|
||||
#include "hw/char/max78000_uart.h"
|
||||
#include "qom/object.h"
|
||||
|
|
@ -35,6 +36,7 @@ struct MAX78000State {
|
|||
MemoryRegion sram;
|
||||
MemoryRegion flash;
|
||||
|
||||
Max78000GcrState gcr;
|
||||
Max78000IccState icc[MAX78000_NUM_ICC];
|
||||
Max78000UartState uart[MAX78000_NUM_UART];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue