diff options
author | Sergey Kambalin <serg.oker@gmail.com> | 2024-02-25 18:02:20 -0600 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2024-02-27 13:01:42 +0000 |
commit | 7d04d630ba7ada8a9530d8c45f4b0840f557bf31 (patch) | |
tree | 31b5c650bf35746bba3b3e6bde349d48f67c900a /hw/arm/bcm2836.c | |
parent | f932093ae165ac9abfbded10510ff5c891d44ec3 (diff) |
hw/arm/bcm2853_peripherals: Split out common part of peripherals
Pre-setup for BCM2838 introduction
Signed-off-by: Sergey Kambalin <sergey.kambalin@auriga.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20240226000259.2752893-3-sergey.kambalin@auriga.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/arm/bcm2836.c')
-rw-r--r-- | hw/arm/bcm2836.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index e9768f2ab9..7e4c60dd80 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -68,10 +68,10 @@ static void bcm283x_init(Object *obj) "vcram-size"); } -bool bcm283x_common_realize(DeviceState *dev, Error **errp) +bool bcm283x_common_realize(DeviceState *dev, BCMSocPeripheralBaseState *ps, + Error **errp) { - BCM283XState *s = BCM283X(dev); - BCM283XBaseState *s_base = BCM283X_BASE(dev); + BCM283XBaseState *s = BCM283X_BASE(dev); BCM283XBaseClass *bc = BCM283X_BASE_GET_CLASS(dev); Object *obj; @@ -79,17 +79,15 @@ bool bcm283x_common_realize(DeviceState *dev, Error **errp) obj = object_property_get_link(OBJECT(dev), "ram", &error_abort); - object_property_add_const_link(OBJECT(&s->peripherals), "ram", obj); + object_property_add_const_link(OBJECT(ps), "ram", obj); - if (!sysbus_realize(SYS_BUS_DEVICE(&s->peripherals), errp)) { + if (!sysbus_realize(SYS_BUS_DEVICE(ps), errp)) { return false; } - object_property_add_alias(OBJECT(s_base), "sd-bus", - OBJECT(&s->peripherals), "sd-bus"); + object_property_add_alias(OBJECT(s), "sd-bus", OBJECT(ps), "sd-bus"); - sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->peripherals), - 0, bc->peri_base, 1); + sysbus_mmio_map_overlap(SYS_BUS_DEVICE(ps), 0, bc->peri_base, 1); return true; } @@ -97,8 +95,10 @@ static void bcm2835_realize(DeviceState *dev, Error **errp) { BCM283XState *s = BCM283X(dev); BCM283XBaseState *s_base = BCM283X_BASE(dev); + BCMSocPeripheralBaseState *ps_base + = BCM_SOC_PERIPHERALS_BASE(&s->peripherals); - if (!bcm283x_common_realize(dev, errp)) { + if (!bcm283x_common_realize(dev, ps_base, errp)) { return; } @@ -119,8 +119,10 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) BCM283XState *s = BCM283X(dev); BCM283XBaseState *s_base = BCM283X_BASE(dev); BCM283XBaseClass *bc = BCM283X_BASE_GET_CLASS(dev); + BCMSocPeripheralBaseState *ps_base + = BCM_SOC_PERIPHERALS_BASE(&s->peripherals); - if (!bcm283x_common_realize(dev, errp)) { + if (!bcm283x_common_realize(dev, ps_base, errp)) { return; } |