SM8650 is one of the platforms where board-level clocks (XO, sleep)
definitions are split between the SoC dtsi file and the board file.
This is not correct, as these two clocks are not a part of the SoC. Also
such definitions don't fully follow the DT guidelines. Move these two
clocks to the board files completely.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
arch/arm64/boot/dts/qcom/sm8650-hdk.dts | 22 ++++++++++++++--------
arch/arm64/boot/dts/qcom/sm8650-mtp.dts | 22 ++++++++++++++--------
arch/arm64/boot/dts/qcom/sm8650-qrd.dts | 22 ++++++++++++++--------
arch/arm64/boot/dts/qcom/sm8650.dtsi | 10 ----------
4 files changed, 42 insertions(+), 34 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/sm8650-hdk.dts b/arch/arm64/boot/dts/qcom/sm8650-hdk.dts
index f00bdff4280af22f6f8b23e33238f53c602bc169..641bd817d75439bc6a050189565437e1c5ead3b5 100644
--- a/arch/arm64/boot/dts/qcom/sm8650-hdk.dts
+++ b/arch/arm64/boot/dts/qcom/sm8650-hdk.dts
@@ -30,6 +30,20 @@ chosen {
stdout-path = "serial0:115200n8";
};
+ clocks {
+ xo_board: xo-board {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <76800000>;
+ };
+
+ sleep_clk: sleep-clk {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <32000>;
+ };
+ };
+
hdmi-out {
compatible = "hdmi-connector";
type = "a";
@@ -1112,10 +1126,6 @@ &sdhc_2 {
status = "okay";
};
-&sleep_clk {
- clock-frequency = <32000>;
-};
-
&swr0 {
status = "okay";
@@ -1337,7 +1347,3 @@ &usb_dp_qmpphy {
&usb_dp_qmpphy_out {
remote-endpoint = <&pmic_glink_ss_in>;
};
-
-&xo_board {
- clock-frequency = <76800000>;
-};
diff --git a/arch/arm64/boot/dts/qcom/sm8650-mtp.dts b/arch/arm64/boot/dts/qcom/sm8650-mtp.dts
index 0db2cb03f252d19a1f8b171a562a8e06290c8a21..26ab08715473683082023ba53bef7ff37e1fbb83 100644
--- a/arch/arm64/boot/dts/qcom/sm8650-mtp.dts
+++ b/arch/arm64/boot/dts/qcom/sm8650-mtp.dts
@@ -28,6 +28,20 @@ chosen {
stdout-path = "serial0:115200n8";
};
+ clocks {
+ xo_board: xo-board {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <76800000>;
+ };
+
+ sleep_clk: sleep-clk {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <32000>;
+ };
+ };
+
pmic-glink {
compatible = "qcom,sm8650-pmic-glink",
"qcom,sm8550-pmic-glink",
@@ -729,10 +743,6 @@ &sdhc_2 {
status = "okay";
};
-&sleep_clk {
- clock-frequency = <32000>;
-};
-
&swr0 {
status = "okay";
@@ -884,7 +894,3 @@ &usb_dp_qmpphy {
&usb_dp_qmpphy_out {
remote-endpoint = <&pmic_glink_ss_in>;
};
-
-&xo_board {
- clock-frequency = <76800000>;
-};
diff --git a/arch/arm64/boot/dts/qcom/sm8650-qrd.dts b/arch/arm64/boot/dts/qcom/sm8650-qrd.dts
index c5e8c3c2df91a49476f49832c0bd6418f4dfae3d..2a512d75d15d01b14a1eabda875f6d8fbe70a409 100644
--- a/arch/arm64/boot/dts/qcom/sm8650-qrd.dts
+++ b/arch/arm64/boot/dts/qcom/sm8650-qrd.dts
@@ -30,6 +30,20 @@ chosen {
stdout-path = "serial0:115200n8";
};
+ clocks {
+ xo_board: xo-board {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <76800000>;
+ };
+
+ sleep_clk: sleep-clk {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <32000>;
+ };
+ };
+
gpio-keys {
compatible = "gpio-keys";
@@ -1040,10 +1054,6 @@ &remoteproc_mpss {
status = "okay";
};
-&sleep_clk {
- clock-frequency = <32000>;
-};
-
&spi4 {
status = "okay";
@@ -1320,7 +1330,3 @@ &usb_dp_qmpphy {
&usb_dp_qmpphy_out {
remote-endpoint = <&redriver_ss_in>;
};
-
-&xo_board {
- clock-frequency = <76800000>;
-};
diff --git a/arch/arm64/boot/dts/qcom/sm8650.dtsi b/arch/arm64/boot/dts/qcom/sm8650.dtsi
index 25e47505adcb790d09f1d2726386438487255824..b960d58210f8199e1f4e080ce50cd574314fa3e8 100644
--- a/arch/arm64/boot/dts/qcom/sm8650.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8650.dtsi
@@ -35,16 +35,6 @@ / {
chosen { };
clocks {
- xo_board: xo-board {
- compatible = "fixed-clock";
- #clock-cells = <0>;
- };
-
- sleep_clk: sleep-clk {
- compatible = "fixed-clock";
- #clock-cells = <0>;
- };
-
bi_tcxo_div2: bi-tcxo-div2-clk {
compatible = "fixed-factor-clock";
#clock-cells = <0>;
--
2.39.5
On 15/11/2024 07:59, Dmitry Baryshkov wrote:
> SM8650 is one of the platforms where board-level clocks (XO, sleep)
> definitions are split between the SoC dtsi file and the board file.
> This is not correct, as these two clocks are not a part of the SoC. Also
> such definitions don't fully follow the DT guidelines. Move these two
> clocks to the board files completely.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> arch/arm64/boot/dts/qcom/sm8650-hdk.dts | 22 ++++++++++++++--------
> arch/arm64/boot/dts/qcom/sm8650-mtp.dts | 22 ++++++++++++++--------
> arch/arm64/boot/dts/qcom/sm8650-qrd.dts | 22 ++++++++++++++--------
> arch/arm64/boot/dts/qcom/sm8650.dtsi | 10 ----------
> 4 files changed, 42 insertions(+), 34 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/qcom/sm8650-hdk.dts b/arch/arm64/boot/dts/qcom/sm8650-hdk.dts
> index f00bdff4280af22f6f8b23e33238f53c602bc169..641bd817d75439bc6a050189565437e1c5ead3b5 100644
> --- a/arch/arm64/boot/dts/qcom/sm8650-hdk.dts
> +++ b/arch/arm64/boot/dts/qcom/sm8650-hdk.dts
> @@ -30,6 +30,20 @@ chosen {
> stdout-path = "serial0:115200n8";
> };
>
> + clocks {
> + xo_board: xo-board {
> + compatible = "fixed-clock";
> + #clock-cells = <0>;
> + clock-frequency = <76800000>;
> + };
> +
> + sleep_clk: sleep-clk {
> + compatible = "fixed-clock";
> + #clock-cells = <0>;
> + clock-frequency = <32000>;
> + };
> + };
> +
> hdmi-out {
> compatible = "hdmi-connector";
> type = "a";
> @@ -1112,10 +1126,6 @@ &sdhc_2 {
> status = "okay";
> };
>
> -&sleep_clk {
> - clock-frequency = <32000>;
> -};
No, code has correct style. To avoid duplication, the SoC DTSI keeps the
skeleton of the clock, which also indicates that SoC expects it to be
provided by board. Then the board provides the clock by setting the
frequency.
Best regards,
Krzysztof
On Sat, Nov 23, 2024 at 06:02:06PM +0100, Krzysztof Kozlowski wrote:
> On 15/11/2024 07:59, Dmitry Baryshkov wrote:
> > SM8650 is one of the platforms where board-level clocks (XO, sleep)
> > definitions are split between the SoC dtsi file and the board file.
> > This is not correct, as these two clocks are not a part of the SoC. Also
> > such definitions don't fully follow the DT guidelines. Move these two
> > clocks to the board files completely.
> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > ---
> > arch/arm64/boot/dts/qcom/sm8650-hdk.dts | 22 ++++++++++++++--------
> > arch/arm64/boot/dts/qcom/sm8650-mtp.dts | 22 ++++++++++++++--------
> > arch/arm64/boot/dts/qcom/sm8650-qrd.dts | 22 ++++++++++++++--------
> > arch/arm64/boot/dts/qcom/sm8650.dtsi | 10 ----------
> > 4 files changed, 42 insertions(+), 34 deletions(-)
> >
> > diff --git a/arch/arm64/boot/dts/qcom/sm8650-hdk.dts b/arch/arm64/boot/dts/qcom/sm8650-hdk.dts
> > index f00bdff4280af22f6f8b23e33238f53c602bc169..641bd817d75439bc6a050189565437e1c5ead3b5 100644
> > --- a/arch/arm64/boot/dts/qcom/sm8650-hdk.dts
> > +++ b/arch/arm64/boot/dts/qcom/sm8650-hdk.dts
> > @@ -30,6 +30,20 @@ chosen {
> > stdout-path = "serial0:115200n8";
> > };
> >
> > + clocks {
> > + xo_board: xo-board {
> > + compatible = "fixed-clock";
> > + #clock-cells = <0>;
> > + clock-frequency = <76800000>;
> > + };
> > +
> > + sleep_clk: sleep-clk {
> > + compatible = "fixed-clock";
> > + #clock-cells = <0>;
> > + clock-frequency = <32000>;
> > + };
> > + };
> > +
> > hdmi-out {
> > compatible = "hdmi-connector";
> > type = "a";
> > @@ -1112,10 +1126,6 @@ &sdhc_2 {
> > status = "okay";
> > };
> >
> > -&sleep_clk {
> > - clock-frequency = <32000>;
> > -};
>
> No, code has correct style. To avoid duplication, the SoC DTSI keeps the
> skeleton of the clock, which also indicates that SoC expects it to be
> provided by board. Then the board provides the clock by setting the
> frequency.
So, what is the decision maker: a deduplication or board vs soc
placement? From the duplication point of view we can keep the complete
clock in SoC.dtsi (like we did for older platforms or I did for
sar2130p). Most if not all boards use the same clock for the SoC family.
From the correctness point of view the clock should be completely in the
board DT, the clock is completely on the board and not on the SoC.
Having clock declaration in SoC.dtsi and patching the freq in board.dts
is a strange hack and mix of two solutions. For me as a reviewer and a
porter having such a split is a nightmare.
--
With best wishes
Dmitry
© 2016 - 2026 Red Hat, Inc.