]> git.proxmox.com Git - mirror_qemu.git/commit
hw/timer/armv7m_systick: Update clock source before enabling timer
authorRichard Petri <git@rpls.de>
Tue, 1 Feb 2022 19:26:51 +0000 (20:26 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 8 Feb 2022 10:56:28 +0000 (10:56 +0000)
commit77cd997161cc853c758b68eebb52827d56bc020e
tree1d9488f860a15d153f1021f848112e3f8f1c663c
parentc737d868047f6ae91325adcd3a40f509753a1d85
hw/timer/armv7m_systick: Update clock source before enabling timer

Starting the SysTick timer and changing the clock source a the same time
will result in an error, if the previous clock period was zero. For exmaple,
on the mps2-tz platforms, no refclk is present. Right after reset, the
configured ptimer period is zero, and trying to enabling it will turn it off
right away. E.g., code running on the platform setting

    SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk;

should change the clock source and enable the timer on real hardware, but
resulted in an error in qemu.

Signed-off-by: Richard Petri <git@rpls.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20220201192650.289584-1-git@rpls.de
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/timer/armv7m_systick.c