|
@@ -26,6 +26,9 @@
|
|
#include "trace.h"
|
|
#include "trace.h"
|
|
#include "hw/irq.h"
|
|
#include "hw/irq.h"
|
|
#include "migration/vmstate.h"
|
|
#include "migration/vmstate.h"
|
|
|
|
+#include "hw/clock.h"
|
|
|
|
+#include "hw/qdev-clock.h"
|
|
|
|
+#include "qapi/error.h"
|
|
#include "hw/misc/stm32l4x5_syscfg.h"
|
|
#include "hw/misc/stm32l4x5_syscfg.h"
|
|
#include "hw/gpio/stm32l4x5_gpio.h"
|
|
#include "hw/gpio/stm32l4x5_gpio.h"
|
|
|
|
|
|
@@ -225,12 +228,22 @@ static void stm32l4x5_syscfg_init(Object *obj)
|
|
qdev_init_gpio_in(DEVICE(obj), stm32l4x5_syscfg_set_irq,
|
|
qdev_init_gpio_in(DEVICE(obj), stm32l4x5_syscfg_set_irq,
|
|
GPIO_NUM_PINS * NUM_GPIOS);
|
|
GPIO_NUM_PINS * NUM_GPIOS);
|
|
qdev_init_gpio_out(DEVICE(obj), s->gpio_out, GPIO_NUM_PINS);
|
|
qdev_init_gpio_out(DEVICE(obj), s->gpio_out, GPIO_NUM_PINS);
|
|
|
|
+ s->clk = qdev_init_clock_in(DEVICE(s), "clk", NULL, s, 0);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void stm32l4x5_syscfg_realize(DeviceState *dev, Error **errp)
|
|
|
|
+{
|
|
|
|
+ Stm32l4x5SyscfgState *s = STM32L4X5_SYSCFG(dev);
|
|
|
|
+ if (!clock_has_source(s->clk)) {
|
|
|
|
+ error_setg(errp, "SYSCFG: clk input must be connected");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
static const VMStateDescription vmstate_stm32l4x5_syscfg = {
|
|
static const VMStateDescription vmstate_stm32l4x5_syscfg = {
|
|
.name = TYPE_STM32L4X5_SYSCFG,
|
|
.name = TYPE_STM32L4X5_SYSCFG,
|
|
- .version_id = 1,
|
|
|
|
- .minimum_version_id = 1,
|
|
|
|
|
|
+ .version_id = 2,
|
|
|
|
+ .minimum_version_id = 2,
|
|
.fields = (VMStateField[]) {
|
|
.fields = (VMStateField[]) {
|
|
VMSTATE_UINT32(memrmp, Stm32l4x5SyscfgState),
|
|
VMSTATE_UINT32(memrmp, Stm32l4x5SyscfgState),
|
|
VMSTATE_UINT32(cfgr1, Stm32l4x5SyscfgState),
|
|
VMSTATE_UINT32(cfgr1, Stm32l4x5SyscfgState),
|
|
@@ -241,6 +254,7 @@ static const VMStateDescription vmstate_stm32l4x5_syscfg = {
|
|
VMSTATE_UINT32(swpr, Stm32l4x5SyscfgState),
|
|
VMSTATE_UINT32(swpr, Stm32l4x5SyscfgState),
|
|
VMSTATE_UINT32(skr, Stm32l4x5SyscfgState),
|
|
VMSTATE_UINT32(skr, Stm32l4x5SyscfgState),
|
|
VMSTATE_UINT32(swpr2, Stm32l4x5SyscfgState),
|
|
VMSTATE_UINT32(swpr2, Stm32l4x5SyscfgState),
|
|
|
|
+ VMSTATE_CLOCK(clk, Stm32l4x5SyscfgState),
|
|
VMSTATE_END_OF_LIST()
|
|
VMSTATE_END_OF_LIST()
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -251,6 +265,7 @@ static void stm32l4x5_syscfg_class_init(ObjectClass *klass, void *data)
|
|
ResettableClass *rc = RESETTABLE_CLASS(klass);
|
|
ResettableClass *rc = RESETTABLE_CLASS(klass);
|
|
|
|
|
|
dc->vmsd = &vmstate_stm32l4x5_syscfg;
|
|
dc->vmsd = &vmstate_stm32l4x5_syscfg;
|
|
|
|
+ dc->realize = stm32l4x5_syscfg_realize;
|
|
rc->phases.hold = stm32l4x5_syscfg_hold_reset;
|
|
rc->phases.hold = stm32l4x5_syscfg_hold_reset;
|
|
}
|
|
}
|
|
|
|
|