Skip to content

soc: rpi_pico: Set the default SYS_CLOCK_HW_CYCLES_PER_SEC from dt #90893

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

Merged
merged 1 commit into from
Jun 4, 2025

Conversation

soburi
Copy link
Member

@soburi soburi commented May 30, 2025

Avoid the individual CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC for each board instead to referencing the dt value.

Note: CI has a problem. We need to address #90896 first.

@soburi soburi requested a review from Copilot May 30, 2025 23:41
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates how SYS_CLOCK_HW_CYCLES_PER_SEC is defined by switching from board-specific hardcoded values to a devicetree-based default. The changes add new devicetree variable assignments and configuration settings for Raspberry Pi Pico SOCs while removing the static definitions from various board defconfig files.

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
soc/raspberrypi/rpi_pico/rp2350/Kconfig.defconfig Adds dt-based default for SYS_CLOCK_HW_CYCLES_PER_SEC using the dt_nodelabel_path and dt_node_int_prop_int macros.
soc/raspberrypi/rpi_pico/rp2040/Kconfig.defconfig Similar update to use the devicetree value for SYS_CLOCK_HW_CYCLES_PER_SEC.
boards/wiznet/w5500_evb_pico2/Kconfig.defconfig Removes the hardcoded SYS_CLOCK_HW_CYCLES_PER_SEC value.
boards/wiznet/w5500_evb_pico/w5500_evb_pico_defconfig Removes static clock frequency definition to rely on the new dt-based approach.
boards/waveshare/rp2040_zero/rp2040_zero_defconfig Deletes the static SYS_CLOCK_HW_CYCLES_PER_SEC setting.
boards/sparkfun/pro_micro_rp2040/sparkfun_pro_micro_rp2040_defconfig Removes the board-specific clock definition.
boards/seeed/xiao_rp2040/xiao_rp2040_defconfig Eliminates the static SYS_CLOCK_HW_CYCLES_PER_SEC.
boards/raspberrypi/rpi_pico2/rpi_pico2_rp2350a_m33_defconfig Hardcoded clock value is removed in favor of using the devicetree source.
boards/raspberrypi/rpi_pico/rpi_pico_rp2040_w_defconfig Removes the static configuration for SYS_CLOCK_HW_CYCLES_PER_SEC.
boards/raspberrypi/rpi_pico/rpi_pico_defconfig Eliminates the board-specific clock frequency definition.
boards/pimoroni/pico_plus2/pico_plus2_rp2350b_m33_defconfig Removes the explicit clock value setting.
boards/kws/pico_spe/pico_spe_defconfig Deletes the hardcoded SYS_CLOCK_HW_CYCLES_PER_SEC line.
boards/kws/pico2_spe/pico2_spe_rp2350a_m33_defconfig Removes the static definition to follow the dt-based approach.
boards/adafruit/qt_py_rp2040/adafruit_qt_py_rp2040_defconfig Deletes the board-specific clock frequency setting.
boards/adafruit/macropad_rp2040/adafruit_macropad_rp2040_defconfig Removes the hardcoded clock value to utilize the global devicetree default.
boards/adafruit/kb2040/adafruit_kb2040_defconfig Eliminates the static clock frequency configuration.
Comments suppressed due to low confidence (2)

boards/wiznet/w5500_evb_pico2/Kconfig.defconfig:13

  • Adding a clarifying comment in the defconfig to note that the SYS_CLOCK_HW_CYCLES_PER_SEC value is now sourced from the devicetree could help future maintainers.
-CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC

boards/adafruit/qt_py_rp2040/adafruit_qt_py_rp2040_defconfig:1

  • Consider adding documentation in this defconfig to mention that the clock frequency is now managed through the devicetree instead of a static value.
-CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000

@soburi soburi force-pushed the rp2xxx_hw_cycle_per_sec branch from ef6b4ad to 4a7e53e Compare May 30, 2025 23:43
@soburi soburi changed the title Set the SYS_CLOCK_HW_CYCLES_PER_SEC default value from devicetree soc: rpi_pico: Set the default SYS_CLOCK_HW_CYCLES_PER_SEC from dt May 30, 2025
@soburi soburi force-pushed the rp2xxx_hw_cycle_per_sec branch from 4a7e53e to 3468a31 Compare May 30, 2025 23:48
@soburi soburi marked this pull request as ready for review May 30, 2025 23:58
@github-actions github-actions bot added the platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico) label May 30, 2025
@github-actions github-actions bot requested review from ajf58, ThreeEights and yonsch May 30, 2025 23:59
@soburi soburi requested a review from nordicjm May 31, 2025 00:02
Copy link
Collaborator

@ajf58 ajf58 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@soburi
Copy link
Member Author

soburi commented Jun 4, 2025

CI was failed, but it is not related this PR.
#91036

Avoid the individual `CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC` for each
board instead to referencing the dt value.

Signed-off-by: TOKITA Hiroshi <[email protected]>
@soburi soburi force-pushed the rp2xxx_hw_cycle_per_sec branch from 93f7205 to 770f674 Compare June 4, 2025 15:25
Copy link

sonarqubecloud bot commented Jun 4, 2025

@nashif nashif merged commit a76ed22 into zephyrproject-rtos:main Jun 4, 2025
38 checks passed
@soburi soburi deleted the rp2xxx_hw_cycle_per_sec branch June 4, 2025 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants