From a76ed223d562f2d0ccc1873014d39f412f8fafdd Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 31 May 2025 07:38:01 +0900 Subject: [PATCH] soc: rpi_pico: Set the default `SYS_CLOCK_HW_CYCLES_PER_SEC` from dt Avoid the individual `CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC` for each board instead to referencing the dt value. Signed-off-by: TOKITA Hiroshi --- boards/adafruit/kb2040/adafruit_kb2040_defconfig | 2 -- .../macropad_rp2040/adafruit_macropad_rp2040_defconfig | 1 - boards/adafruit/qt_py_rp2040/adafruit_qt_py_rp2040_defconfig | 2 -- boards/kws/pico2_spe/pico2_spe_rp2350a_m33_defconfig | 1 - boards/kws/pico_spe/pico_spe_defconfig | 1 - boards/pimoroni/pico_plus2/pico_plus2_rp2350b_m33_defconfig | 1 - boards/raspberrypi/rpi_pico/rpi_pico_defconfig | 1 - boards/raspberrypi/rpi_pico/rpi_pico_rp2040_w_defconfig | 1 - boards/raspberrypi/rpi_pico2/rpi_pico2_rp2350a_m33_defconfig | 1 - boards/seeed/xiao_rp2040/xiao_rp2040_defconfig | 1 - .../pro_micro_rp2040/sparkfun_pro_micro_rp2040_defconfig | 1 - boards/waveshare/rp2040_zero/rp2040_zero_defconfig | 1 - boards/wiznet/w5500_evb_pico/w5500_evb_pico_defconfig | 1 - boards/wiznet/w5500_evb_pico2/Kconfig.defconfig | 3 --- soc/raspberrypi/rpi_pico/rp2040/Kconfig.defconfig | 5 +++++ soc/raspberrypi/rpi_pico/rp2350/Kconfig.defconfig | 5 +++++ 16 files changed, 10 insertions(+), 18 deletions(-) diff --git a/boards/adafruit/kb2040/adafruit_kb2040_defconfig b/boards/adafruit/kb2040/adafruit_kb2040_defconfig index f2202a534b6..7b2969a065a 100644 --- a/boards/adafruit/kb2040/adafruit_kb2040_defconfig +++ b/boards/adafruit/kb2040/adafruit_kb2040_defconfig @@ -1,7 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000 - # Enable UART driver CONFIG_SERIAL=y CONFIG_UART_INTERRUPT_DRIVEN=y diff --git a/boards/adafruit/macropad_rp2040/adafruit_macropad_rp2040_defconfig b/boards/adafruit/macropad_rp2040/adafruit_macropad_rp2040_defconfig index 2fb65b60022..7eab1729202 100644 --- a/boards/adafruit/macropad_rp2040/adafruit_macropad_rp2040_defconfig +++ b/boards/adafruit/macropad_rp2040/adafruit_macropad_rp2040_defconfig @@ -1,7 +1,6 @@ # Copyright (c) 2025 Benjamin Cabé # SPDX-License-Identifier: Apache-2.0 -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000 CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y diff --git a/boards/adafruit/qt_py_rp2040/adafruit_qt_py_rp2040_defconfig b/boards/adafruit/qt_py_rp2040/adafruit_qt_py_rp2040_defconfig index f2202a534b6..7b2969a065a 100644 --- a/boards/adafruit/qt_py_rp2040/adafruit_qt_py_rp2040_defconfig +++ b/boards/adafruit/qt_py_rp2040/adafruit_qt_py_rp2040_defconfig @@ -1,7 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000 - # Enable UART driver CONFIG_SERIAL=y CONFIG_UART_INTERRUPT_DRIVEN=y diff --git a/boards/kws/pico2_spe/pico2_spe_rp2350a_m33_defconfig b/boards/kws/pico2_spe/pico2_spe_rp2350a_m33_defconfig index 8bd68e35113..4da77bdb95c 100644 --- a/boards/kws/pico2_spe/pico2_spe_rp2350a_m33_defconfig +++ b/boards/kws/pico2_spe/pico2_spe_rp2350a_m33_defconfig @@ -8,7 +8,6 @@ CONFIG_CONSOLE=y CONFIG_GPIO=y CONFIG_RESET=y CONFIG_SERIAL=y -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=150000000 CONFIG_UART_CONSOLE=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_USE_DT_CODE_PARTITION=y diff --git a/boards/kws/pico_spe/pico_spe_defconfig b/boards/kws/pico_spe/pico_spe_defconfig index df003531af9..aaaa51cbdb9 100644 --- a/boards/kws/pico_spe/pico_spe_defconfig +++ b/boards/kws/pico_spe/pico_spe_defconfig @@ -1,4 +1,3 @@ -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000 CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y diff --git a/boards/pimoroni/pico_plus2/pico_plus2_rp2350b_m33_defconfig b/boards/pimoroni/pico_plus2/pico_plus2_rp2350b_m33_defconfig index 8bd68e35113..4da77bdb95c 100644 --- a/boards/pimoroni/pico_plus2/pico_plus2_rp2350b_m33_defconfig +++ b/boards/pimoroni/pico_plus2/pico_plus2_rp2350b_m33_defconfig @@ -8,7 +8,6 @@ CONFIG_CONSOLE=y CONFIG_GPIO=y CONFIG_RESET=y CONFIG_SERIAL=y -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=150000000 CONFIG_UART_CONSOLE=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_USE_DT_CODE_PARTITION=y diff --git a/boards/raspberrypi/rpi_pico/rpi_pico_defconfig b/boards/raspberrypi/rpi_pico/rpi_pico_defconfig index df003531af9..aaaa51cbdb9 100644 --- a/boards/raspberrypi/rpi_pico/rpi_pico_defconfig +++ b/boards/raspberrypi/rpi_pico/rpi_pico_defconfig @@ -1,4 +1,3 @@ -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000 CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y diff --git a/boards/raspberrypi/rpi_pico/rpi_pico_rp2040_w_defconfig b/boards/raspberrypi/rpi_pico/rpi_pico_rp2040_w_defconfig index d1e96b968c5..9438a979c63 100644 --- a/boards/raspberrypi/rpi_pico/rpi_pico_rp2040_w_defconfig +++ b/boards/raspberrypi/rpi_pico/rpi_pico_rp2040_w_defconfig @@ -1,4 +1,3 @@ -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000 CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y diff --git a/boards/raspberrypi/rpi_pico2/rpi_pico2_rp2350a_m33_defconfig b/boards/raspberrypi/rpi_pico2/rpi_pico2_rp2350a_m33_defconfig index 8bd68e35113..4da77bdb95c 100644 --- a/boards/raspberrypi/rpi_pico2/rpi_pico2_rp2350a_m33_defconfig +++ b/boards/raspberrypi/rpi_pico2/rpi_pico2_rp2350a_m33_defconfig @@ -8,7 +8,6 @@ CONFIG_CONSOLE=y CONFIG_GPIO=y CONFIG_RESET=y CONFIG_SERIAL=y -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=150000000 CONFIG_UART_CONSOLE=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_USE_DT_CODE_PARTITION=y diff --git a/boards/seeed/xiao_rp2040/xiao_rp2040_defconfig b/boards/seeed/xiao_rp2040/xiao_rp2040_defconfig index ef4e863884a..e382af25445 100644 --- a/boards/seeed/xiao_rp2040/xiao_rp2040_defconfig +++ b/boards/seeed/xiao_rp2040/xiao_rp2040_defconfig @@ -1,6 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000 CONFIG_RESET=y # Enable UART driver diff --git a/boards/sparkfun/pro_micro_rp2040/sparkfun_pro_micro_rp2040_defconfig b/boards/sparkfun/pro_micro_rp2040/sparkfun_pro_micro_rp2040_defconfig index ef4e863884a..e382af25445 100644 --- a/boards/sparkfun/pro_micro_rp2040/sparkfun_pro_micro_rp2040_defconfig +++ b/boards/sparkfun/pro_micro_rp2040/sparkfun_pro_micro_rp2040_defconfig @@ -1,6 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000 CONFIG_RESET=y # Enable UART driver diff --git a/boards/waveshare/rp2040_zero/rp2040_zero_defconfig b/boards/waveshare/rp2040_zero/rp2040_zero_defconfig index 3be05ed9862..ec7e8e3f931 100644 --- a/boards/waveshare/rp2040_zero/rp2040_zero_defconfig +++ b/boards/waveshare/rp2040_zero/rp2040_zero_defconfig @@ -1,6 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000 CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y diff --git a/boards/wiznet/w5500_evb_pico/w5500_evb_pico_defconfig b/boards/wiznet/w5500_evb_pico/w5500_evb_pico_defconfig index df003531af9..aaaa51cbdb9 100644 --- a/boards/wiznet/w5500_evb_pico/w5500_evb_pico_defconfig +++ b/boards/wiznet/w5500_evb_pico/w5500_evb_pico_defconfig @@ -1,4 +1,3 @@ -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000 CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y diff --git a/boards/wiznet/w5500_evb_pico2/Kconfig.defconfig b/boards/wiznet/w5500_evb_pico2/Kconfig.defconfig index 1af3e24b6f0..4601f32b16a 100644 --- a/boards/wiznet/w5500_evb_pico2/Kconfig.defconfig +++ b/boards/wiznet/w5500_evb_pico2/Kconfig.defconfig @@ -13,7 +13,4 @@ endif # NETWORKING config USB_SELF_POWERED default n -config SYS_CLOCK_HW_CYCLES_PER_SEC - default 150000000 - endif # BOARD_W5500_EVB_PICO2 diff --git a/soc/raspberrypi/rpi_pico/rp2040/Kconfig.defconfig b/soc/raspberrypi/rpi_pico/rp2040/Kconfig.defconfig index adaa1e69101..7128387545f 100644 --- a/soc/raspberrypi/rpi_pico/rp2040/Kconfig.defconfig +++ b/soc/raspberrypi/rpi_pico/rp2040/Kconfig.defconfig @@ -11,4 +11,9 @@ rsource "Kconfig.defconfig.rp2*" config NUM_IRQS default 26 +DT_CLK_SYS_PATH := $(dt_nodelabel_path,clk_sys) + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default $(dt_node_int_prop_int,$(DT_CLK_SYS_PATH),clock-frequency) + endif # SOC_SERIES_RP2040 diff --git a/soc/raspberrypi/rpi_pico/rp2350/Kconfig.defconfig b/soc/raspberrypi/rpi_pico/rp2350/Kconfig.defconfig index 6e5cfe93e44..4fed033b804 100644 --- a/soc/raspberrypi/rpi_pico/rp2350/Kconfig.defconfig +++ b/soc/raspberrypi/rpi_pico/rp2350/Kconfig.defconfig @@ -14,4 +14,9 @@ config BUILD_OUTPUT_UF2_USE_FLASH_OFFSET config NUM_IRQS default 52 +DT_CLK_SYS_PATH := $(dt_nodelabel_path,clk_sys) + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default $(dt_node_int_prop_int,$(DT_CLK_SYS_PATH),clock-frequency) + endif # SOC_SERIES_RP2350