From 6f91fd858cea07655928c3920539acb1c1646235 Mon Sep 17 00:00:00 2001 From: Franciszek Zdobylak Date: Tue, 3 Oct 2023 10:37:10 +0200 Subject: [PATCH] dts: arm: silabs: Configure hfxo in dtsi This commit moves configuration of hfxo from headers defined on board level to device trees of SoCs. Signed-off-by: Franciszek Zdobylak --- boards/arm/efr32_radio/CMakeLists.txt | 2 -- boards/arm/efr32_thunderboard/CMakeLists.txt | 2 -- .../sl_device_init_hfxo_config.h | 14 -------------- boards/arm/efr32xg24_dk2601b/CMakeLists.txt | 5 ----- .../efr32xg24_dk2601b/sl_device_init_hfxo_config.h | 14 -------------- dts/arm/silabs/efr32bg2x.dtsi | 10 ++++++++++ dts/arm/silabs/efr32mg24.dtsi | 10 ++++++++++ dts/bindings/clock/silabs,hfxo.yaml | 9 +++++++++ .../common}/sl_device_init_hfxo_config.h | 8 +++----- 9 files changed, 32 insertions(+), 42 deletions(-) delete mode 100644 boards/arm/efr32_radio/CMakeLists.txt delete mode 100644 boards/arm/efr32_thunderboard/sl_device_init_hfxo_config.h delete mode 100644 boards/arm/efr32xg24_dk2601b/CMakeLists.txt delete mode 100644 boards/arm/efr32xg24_dk2601b/sl_device_init_hfxo_config.h create mode 100644 dts/bindings/clock/silabs,hfxo.yaml rename {boards/arm/efr32_radio => soc/arm/silabs_exx32/common}/sl_device_init_hfxo_config.h (58%) diff --git a/boards/arm/efr32_radio/CMakeLists.txt b/boards/arm/efr32_radio/CMakeLists.txt deleted file mode 100644 index 77a7880c491..00000000000 --- a/boards/arm/efr32_radio/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -zephyr_include_directories(.) diff --git a/boards/arm/efr32_thunderboard/CMakeLists.txt b/boards/arm/efr32_thunderboard/CMakeLists.txt index 17faf560add..ca93e65ac91 100644 --- a/boards/arm/efr32_thunderboard/CMakeLists.txt +++ b/boards/arm/efr32_thunderboard/CMakeLists.txt @@ -5,5 +5,3 @@ if(CONFIG_UART_GECKO) zephyr_library() zephyr_library_sources(board.c) endif() - -zephyr_include_directories(.) diff --git a/boards/arm/efr32_thunderboard/sl_device_init_hfxo_config.h b/boards/arm/efr32_thunderboard/sl_device_init_hfxo_config.h deleted file mode 100644 index 1b803c74f3d..00000000000 --- a/boards/arm/efr32_thunderboard/sl_device_init_hfxo_config.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2022 Antmicro - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef SL_DEVICE_INIT_HFXO_CONFIG_H -#define SL_DEVICE_INIT_HFXO_CONFIG_H - -#define SL_DEVICE_INIT_HFXO_MODE cmuHfxoOscMode_Crystal -#define SL_DEVICE_INIT_HFXO_FREQ 38400000 -#define SL_DEVICE_INIT_HFXO_CTUNE 120 - -#endif /* SL_DEVICE_INIT_HFXO_CONFIG_H */ diff --git a/boards/arm/efr32xg24_dk2601b/CMakeLists.txt b/boards/arm/efr32xg24_dk2601b/CMakeLists.txt deleted file mode 100644 index 7997d692379..00000000000 --- a/boards/arm/efr32xg24_dk2601b/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2021 Sateesh Kotapati -# SPDX-License-Identifier: Apache-2.0 - -zephyr_library() -zephyr_library_sources(board.c) diff --git a/boards/arm/efr32xg24_dk2601b/sl_device_init_hfxo_config.h b/boards/arm/efr32xg24_dk2601b/sl_device_init_hfxo_config.h deleted file mode 100644 index 7f9e211748e..00000000000 --- a/boards/arm/efr32xg24_dk2601b/sl_device_init_hfxo_config.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2023 Antmicro - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef SL_DEVICE_INIT_HFXO_CONFIG_H -#define SL_DEVICE_INIT_HFXO_CONFIG_H - -#define SL_DEVICE_INIT_HFXO_MODE cmuHfxoOscMode_Crystal -#define SL_DEVICE_INIT_HFXO_FREQ 39000000 -#define SL_DEVICE_INIT_HFXO_CTUNE 140 - -#endif /* SL_DEVICE_INIT_HFXO_CONFIG_H */ diff --git a/dts/arm/silabs/efr32bg2x.dtsi b/dts/arm/silabs/efr32bg2x.dtsi index e1f3726e429..5202acd350a 100644 --- a/dts/arm/silabs/efr32bg2x.dtsi +++ b/dts/arm/silabs/efr32bg2x.dtsi @@ -10,6 +10,7 @@ #include #include #include +#include / { chosen { @@ -17,6 +18,15 @@ zephyr,entropy = &trng; }; + clocks { + clk_hfxo: clk-hfxo { + #clock-cells = <0>; + compatible = "silabs,hfxo"; + clock-frequency = ; + ctune = <120>; + }; + }; + cpus { #address-cells = <1>; #size-cells = <0>; diff --git a/dts/arm/silabs/efr32mg24.dtsi b/dts/arm/silabs/efr32mg24.dtsi index 1ee015b7334..b42b775397f 100644 --- a/dts/arm/silabs/efr32mg24.dtsi +++ b/dts/arm/silabs/efr32mg24.dtsi @@ -10,6 +10,7 @@ #include #include #include +#include / { chosen { @@ -17,6 +18,15 @@ zephyr,entropy = &se; }; + clocks { + clk_hfxo: clk-hfxo { + #clock-cells = <0>; + compatible = "silabs,hfxo"; + clock-frequency = ; + ctune = <140>; + }; + }; + cpus { #address-cells = <1>; #size-cells = <0>; diff --git a/dts/bindings/clock/silabs,hfxo.yaml b/dts/bindings/clock/silabs,hfxo.yaml new file mode 100644 index 00000000000..cd0d3ad1742 --- /dev/null +++ b/dts/bindings/clock/silabs,hfxo.yaml @@ -0,0 +1,9 @@ +compatible: "silabs,hfxo" + +include: fixed-clock.yaml + +properties: + ctune: + type: int + required: true + description: Load capacitance configuration diff --git a/boards/arm/efr32_radio/sl_device_init_hfxo_config.h b/soc/arm/silabs_exx32/common/sl_device_init_hfxo_config.h similarity index 58% rename from boards/arm/efr32_radio/sl_device_init_hfxo_config.h rename to soc/arm/silabs_exx32/common/sl_device_init_hfxo_config.h index c410e7c4093..533a591fbde 100644 --- a/boards/arm/efr32_radio/sl_device_init_hfxo_config.h +++ b/soc/arm/silabs_exx32/common/sl_device_init_hfxo_config.h @@ -7,12 +7,10 @@ #ifndef SL_DEVICE_INIT_HFXO_CONFIG_H #define SL_DEVICE_INIT_HFXO_CONFIG_H -#ifdef CONFIG_BOARD_EFR32_RADIO_BRD4187C +#include #define SL_DEVICE_INIT_HFXO_MODE cmuHfxoOscMode_Crystal -#define SL_DEVICE_INIT_HFXO_FREQ 39000000 -#define SL_DEVICE_INIT_HFXO_CTUNE 140 - -#endif /* CONFIG_BOARD_EFR32_RADIO_BRD4187C */ +#define SL_DEVICE_INIT_HFXO_FREQ DT_PROP(DT_NODELABEL(clk_hfxo), clock_frequency) +#define SL_DEVICE_INIT_HFXO_CTUNE DT_PROP(DT_NODELABEL(clk_hfxo), ctune) #endif /* SL_DEVICE_INIT_HFXO_CONFIG_H */