Hi Arnaud,

(Cc'ing Peter and Luc)

On 12/12/23 14:05, Arnaud Minier wrote:
Hi all,

I tried to implement the RCC (Reset and Clock Control) for the STM32L4x5_SoC 
but ran into some problems regarding clock emulation in Qemu.
In this SoC, it is possible to change the source of several clocks used for 
devices like the CPU, the USART, and approximately every other device on the 
SoC.
This change can be made at runtime by writing into a specific register.
I tried to model this by using the clocks in hw/core/clock.c by I noticed that 
it is not possible to change a clock's source once it has been assigned (see 
clock_set_source()).

Ouch.

I thought this was what connect_mux_sources() what doing (see
hw/misc/bcm2835_cprman.c) but it is only called (along the
clock_set_source() calls) from the realize() handler.

It prevents me from implementing a clock tree similar to the one on the 
hardware.

Is this limitation there for some reason or has it simply not been implemented?

There is a /* changing clock source is not supported */ comment in
clock_set_source(), so likely not implemented :)

IIUC the only issue is how to update the src->children qlist.

Thanks,
Arnaud Minier



Reply via email to