-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decouple timers from system clock #16958
Decouple timers from system clock #16958
Conversation
The clock control initialization code used system clock frequency as a CPU clock frequency. This commit corrects that by obtaining the needed value from DTS. Signed-off-by: Piotr Zięcik <[email protected]>
The log_backend_swo used system clock frequency as a base for SWO clock calculation. This commit corrects that by obtaining the needed value from DTS. Signed-off-by: Piotr Zięcik <[email protected]>
The spi_dw driver used system clock frequency as a base for SPI bus frequency calculation. This commit corrects that by obtaining the needed value from DTS. Signed-off-by: Piotr Zięcik <[email protected]>
The uart_cmsdk_apb driver used system clock frequency as a base for baudrate calculation. This commit corrects that by obtaining the needed value from DTS. Signed-off-by: Piotr Zięcik <[email protected]>
The uart_pl011 driver used system clock frequency as a base for baudrate calculation. This commit corrects that by obtaining the needed value from DTS. Signed-off-by: Piotr Zięcik <[email protected]>
The uart_cc32xx driver used system clock frequency as a base for baudrate calculation. This commit corrects that by obtaining the needed value from DTS. Signed-off-by: Piotr Zięcik <[email protected]>
The uart_msp432p4xx driver used system clock frequency as a base for baudrate calculation. This commit corrects that by obtaining the needed value from DTS. Signed-off-by: Piotr Zięcik <[email protected]>
The uart_qmsi driver used system clock frequency as a base for baudrate calculation. This commit corrects that by obtaining the needed value from DTS. Signed-off-by: Piotr Zięcik <[email protected]>
The uart_stellaris driver used system clock frequency as a base for baudrate calculation. This commit corrects that by obtaining the needed value from DTS. Signed-off-by: Piotr Zięcik <[email protected]>
The uart_cc13xx_cc26xx driver used system clock frequency as a base for baudrate calculation. This commit corrects that by obtaining the needed value from DTS. Signed-off-by: Piotr Zięcik <[email protected]>
The wdog_cmsdk_apb driver used system clock frequency as a base for timeout calculation. This commit corrects that by obtaining the needed value from DTS. Signed-off-by: Piotr Zięcik <[email protected]>
The adc_stm32 driver used system timer frequency as a base for busy-wait delay calculation. This commit corrects that by obtaining the needed value from SystemCoreClock variable. Signed-off-by: Piotr Zięcik <[email protected]>
This commit adds the kernel.h include in order to provide sys_clock_hw_cycles_per_sec() declaration. Signed-off-by: Piotr Zięcik <[email protected]>
23f777d
to
7850fb5
Compare
We use
|
So does that mean |
This is indeed the case before clock_control driver init (done before kernel init). Also, practically, I'm not 100% sure |
Anyway, point is for now STM32 don't use I agree STM32 should also move to clock_control configuration to DT, and eventually get rid of |
Do any of these still need cleaning up:
|
From what I can tell, no, but we need to confirm it. Since Piotr is away what I will do is merge this PR to avoid it getting stale, and make sure he takes a look at the list once he's back. |
The code above configures the clocking tree. Ideally, the information to perform this task should be taken from DTS, not the CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC. On the other hand, it also configures SysTick, which has to be set basing on CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC. I do not know STM SoC enough to say if the two things mentioned above could be easily decoupled.
These are parts of system timer implementation. The value of CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC has to be known there in order to configure hardware for given frequency.
Here I do not know why the value of CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC is used. Maybe someone knowing ztest will tell us why this is not taken form the board configuration.
This looks like hack ensuring precise measurement of time. I am not sure it this is still needed after @andyross fixes in the area. |
Second split out from #16469. Includes #16957.
Do not merge until #16957 is merged