aboutsummaryrefslogtreecommitdiff
path: root/hw/arm/nrf51_soc.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/arm/nrf51_soc.c')
-rw-r--r--hw/arm/nrf51_soc.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c
index c278827b09..5a8961ddbb 100644
--- a/hw/arm/nrf51_soc.c
+++ b/hw/arm/nrf51_soc.c
@@ -71,7 +71,7 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
error_propagate(errp, err);
return;
}
- object_property_set_bool(OBJECT(&s->cpu), true, "realized", &err);
+ sysbus_realize(SYS_BUS_DEVICE(&s->cpu), &err);
if (err) {
error_propagate(errp, err);
return;
@@ -88,7 +88,7 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
memory_region_add_subregion(&s->container, NRF51_SRAM_BASE, &s->sram);
/* UART */
- object_property_set_bool(OBJECT(&s->uart), true, "realized", &err);
+ sysbus_realize(SYS_BUS_DEVICE(&s->uart), &err);
if (err) {
error_propagate(errp, err);
return;
@@ -100,7 +100,7 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
BASE_TO_IRQ(NRF51_UART_BASE)));
/* RNG */
- object_property_set_bool(OBJECT(&s->rng), true, "realized", &err);
+ sysbus_realize(SYS_BUS_DEVICE(&s->rng), &err);
if (err) {
error_propagate(errp, err);
return;
@@ -120,7 +120,7 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
return;
}
- object_property_set_bool(OBJECT(&s->nvm), true, "realized", &err);
+ sysbus_realize(SYS_BUS_DEVICE(&s->nvm), &err);
if (err) {
error_propagate(errp, err);
return;
@@ -136,7 +136,7 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
memory_region_add_subregion_overlap(&s->container, NRF51_FLASH_BASE, mr, 0);
/* GPIO */
- object_property_set_bool(OBJECT(&s->gpio), true, "realized", &err);
+ sysbus_realize(SYS_BUS_DEVICE(&s->gpio), &err);
if (err) {
error_propagate(errp, err);
return;
@@ -155,7 +155,7 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
error_propagate(errp, err);
return;
}
- object_property_set_bool(OBJECT(&s->timer[i]), true, "realized", &err);
+ sysbus_realize(SYS_BUS_DEVICE(&s->timer[i]), &err);
if (err) {
error_propagate(errp, err);
return;
@@ -189,27 +189,23 @@ static void nrf51_soc_init(Object *obj)
memory_region_init(&s->container, obj, "nrf51-container", UINT64_MAX);
- sysbus_init_child_obj(OBJECT(s), "armv6m", &s->cpu, sizeof(s->cpu),
- TYPE_ARMV7M);
+ object_initialize_child(OBJECT(s), "armv6m", &s->cpu, TYPE_ARMV7M);
qdev_prop_set_string(DEVICE(&s->cpu), "cpu-type",
ARM_CPU_TYPE_NAME("cortex-m0"));
qdev_prop_set_uint32(DEVICE(&s->cpu), "num-irq", 32);
- sysbus_init_child_obj(obj, "uart", &s->uart, sizeof(s->uart),
- TYPE_NRF51_UART);
+ object_initialize_child(obj, "uart", &s->uart, TYPE_NRF51_UART);
object_property_add_alias(obj, "serial0", OBJECT(&s->uart), "chardev");
- sysbus_init_child_obj(obj, "rng", &s->rng, sizeof(s->rng),
- TYPE_NRF51_RNG);
+ object_initialize_child(obj, "rng", &s->rng, TYPE_NRF51_RNG);
- sysbus_init_child_obj(obj, "nvm", &s->nvm, sizeof(s->nvm), TYPE_NRF51_NVM);
+ object_initialize_child(obj, "nvm", &s->nvm, TYPE_NRF51_NVM);
- sysbus_init_child_obj(obj, "gpio", &s->gpio, sizeof(s->gpio),
- TYPE_NRF51_GPIO);
+ object_initialize_child(obj, "gpio", &s->gpio, TYPE_NRF51_GPIO);
for (i = 0; i < NRF51_NUM_TIMERS; i++) {
- sysbus_init_child_obj(obj, "timer[*]", &s->timer[i],
- sizeof(s->timer[i]), TYPE_NRF51_TIMER);
+ object_initialize_child(obj, "timer[*]", &s->timer[i],
+ TYPE_NRF51_TIMER);
}
}