aboutsummaryrefslogtreecommitdiff
path: root/hw/misc/stm32l4x5_rcc.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/misc/stm32l4x5_rcc.c')
-rw-r--r--hw/misc/stm32l4x5_rcc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/hw/misc/stm32l4x5_rcc.c b/hw/misc/stm32l4x5_rcc.c
index bc2d63528b..ed2dbd9dc3 100644
--- a/hw/misc/stm32l4x5_rcc.c
+++ b/hw/misc/stm32l4x5_rcc.c
@@ -48,6 +48,8 @@ static void clock_mux_update(RccClockMuxState *mux, bool bypass_source)
uint64_t src_freq;
Clock *current_source = mux->srcs[mux->src];
uint32_t freq_multiplier = 0;
+ bool clk_changed = false;
+
/*
* To avoid rounding errors, we use the clock period instead of the
* frequency.
@@ -59,8 +61,11 @@ static void clock_mux_update(RccClockMuxState *mux, bool bypass_source)
freq_multiplier = mux->divider;
}
- clock_set_mul_div(mux->out, freq_multiplier, mux->multiplier);
- clock_update(mux->out, clock_get(current_source));
+ clk_changed |= clock_set_mul_div(mux->out, freq_multiplier, mux->multiplier);
+ clk_changed |= clock_set(mux->out, clock_get(current_source));
+ if (clk_changed) {
+ clock_propagate(mux->out);
+ }
src_freq = clock_get_hz(current_source);
/* TODO: can we simply detect if the config changed so that we reduce log spam ? */