Skip to contentSkip to conversation

riscv: sophgo: cv18xx: dts rework, part 2

PATCH Superseded Inochi Amaoto 3 participants 12 messages Apr 30, 2025 – May 1, 2025

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Inochi Amaoto

author maintainer
#0 lore raw

cover riscv: sophgo: cv18xx: dts rework, part 2

The part 2 of dts rework replaces precise compatible for existed clock device with old wildcard one.

Inochi Amaoto (3):
dt-bindings: clock: sophgo: Use precise compatible for CV1800 series
SoC
clk: sophgo: Add support for newly added precise compatible
riscv: dts: sophgo: switch precise compatible for existed clock device
for CV18XX

 .../bindings/clock/sophgo,cv1800-clk.yaml           | 13 +++++++++----
 arch/riscv/boot/dts/sophgo/cv1800b.dtsi             |  2 +-
 arch/riscv/boot/dts/sophgo/cv1812h.dtsi             |  2 +-
 arch/riscv/boot/dts/sophgo/sg2002.dtsi              |  2 +-
 drivers/clk/sophgo/clk-cv1800.c                     |  3 +++
 5 files changed, 15 insertions(+), 7 deletions(-)

base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
prerequisite-patch-id: 94fb3d26e017cf839b4dcb4bf85624614a94b9ac
prerequisite-patch-id: 8f4a8bdead0e4e3d6904adbc0fd150b7dffefc85
prerequisite-patch-id: b30e850690903c3ddc3d8bb77a99e97934dc9dde
prerequisite-patch-id: 6e1117694a53a0059b145ad4751ec204cae0db35 --
2.49.0

author maintainer
#1 lore raw

PATCH 1/3 dt-bindings: clock: sophgo: Use precise compatible for CV1800 series SoC

As previous binding uses a wildcard compatible for existed clock device of CV1800 series SoC, it is not suitable for existed requirement.

Add new precise compatible for existed clock devices of CV1800 series SoCs.

---
 .../bindings/clock/sophgo,cv1800-clk.yaml           | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/clock/sophgo,cv1800-clk.yaml +9 -4
index 59ef41adb539..c52e130db887 100644
@@ -11,10 +11,15 @@ maintainers:
 
 properties:
   compatible:
-    enum:
-      - sophgo,cv1800-clk
-      - sophgo,cv1810-clk
-      - sophgo,sg2000-clk
+    oneOf:
+      - const: sophgo,cv1800-clk
+        deprecated: true
+      - const: sophgo,cv1800b-clk
+      - const: sophgo,cv1810-clk
+        deprecated: true
+      - const: sophgo,cv1812h-clk
+      - const: sophgo,sg2000-clk
+      - const: sophgo,sg2002-clk
 
   reg:
     maxItems: 1
Signature · 1 line
2.49.0
author maintainer
#2 lore raw

PATCH 2/3 clk: sophgo: Add support for newly added precise compatible

In reply to Inochi Amaoto

Add of device id definition for newly added precise compatible.

---
 drivers/clk/sophgo/clk-cv1800.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/clk/sophgo/clk-cv1800.c +3 -0
index e0c4dc347579..e10221df6385 100644
@@ -1519,8 +1519,11 @@ static int cv1800_clk_probe(struct platform_device *pdev)
 
 static const struct of_device_id cv1800_clk_ids[] = {
 	{ .compatible = "sophgo,cv1800-clk", .data = &cv1800_desc },
+	{ .compatible = "sophgo,cv1800b-clk", .data = &cv1800_desc },
 	{ .compatible = "sophgo,cv1810-clk", .data = &cv1810_desc },
+	{ .compatible = "sophgo,cv1812h-clk", .data = &cv1800_desc },
 	{ .compatible = "sophgo,sg2000-clk", .data = &sg2000_desc },
+	{ .compatible = "sophgo,sg2002-clk", .data = &sg2000_desc },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, cv1800_clk_ids);
Signature · 1 line
2.49.0
#3 lore raw

Re: [PATCH 2/3] clk: sophgo: Add support for newly added precise compatible

Quoted 12 lines · Inochi Amaoto

Add of device id definition for newly added precise compatible.

---
 drivers/clk/sophgo/clk-cv1800.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/clk/sophgo/clk-cv1800.c +0 -0
index e0c4dc347579..e10221df6385 100644

drivers/clk/sophgo/clk-cv1800.c static int cv1800_clk_probe(struct platform_device *pdev) · line 1522

Quoted 4 lines
drivers/clk/sophgo/clk-cv1800.c +1 -0
@@ -1519,8 +1519,11 @@ static int cv1800_clk_probe(struct platform_device *pdev)
 
 static const struct of_device_id cv1800_clk_ids[] = {
 	{ .compatible = "sophgo,cv1800-clk", .data = &cv1800_desc },
+	{ .compatible = "sophgo,cv1800b-clk", .data = &cv1800_desc },

Given the same data is used here, should there not be fallbacks in the dt for some of these? For example, 1812 to 1800? Or is that not okay, because 1800 is not a real device id?

Quoted 10 lines
drivers/clk/sophgo/clk-cv1800.c +2 -0
 	{ .compatible = "sophgo,cv1810-clk", .data = &cv1810_desc },
+	{ .compatible = "sophgo,cv1812h-clk", .data = &cv1800_desc },
 	{ .compatible = "sophgo,sg2000-clk", .data = &sg2000_desc },
+	{ .compatible = "sophgo,sg2002-clk", .data = &sg2000_desc },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, cv1800_clk_ids);
Signature · 1 line
2.49.0
#4 lore raw

Re: [PATCH 2/3] clk: sophgo: Add support for newly added precise compatible

Quoted 22 lines · Conor Dooley
Quoted 12 lines · Inochi Amaoto

Add of device id definition for newly added precise compatible.

---
 drivers/clk/sophgo/clk-cv1800.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/clk/sophgo/clk-cv1800.c +0 -0
index e0c4dc347579..e10221df6385 100644

drivers/clk/sophgo/clk-cv1800.c static int cv1800_clk_probe(struct platform_device *pdev) · line 1522

Quoted 4 lines
drivers/clk/sophgo/clk-cv1800.c +1 -0
@@ -1519,8 +1519,11 @@ static int cv1800_clk_probe(struct platform_device *pdev)
 
 static const struct of_device_id cv1800_clk_ids[] = {
 	{ .compatible = "sophgo,cv1800-clk", .data = &cv1800_desc },
+	{ .compatible = "sophgo,cv1800b-clk", .data = &cv1800_desc },

Given the same data is used here, should there not be fallbacks in the dt for some of these? For example, 1812 to 1800? Or is that not okay, because 1800 is not a real device id?

Quoted 4 lines

drivers/clk/sophgo/clk-cv1800.c static int cv1800_clk_probe(struct platform_device *pdev) · line 1526

Quoted 4 lines
drivers/clk/sophgo/clk-cv1800.c +2 -0
 	{ .compatible = "sophgo,cv1810-clk", .data = &cv1810_desc },
+	{ .compatible = "sophgo,cv1812h-clk", .data = &cv1800_desc },
 	{ .compatible = "sophgo,sg2000-clk", .data = &sg2000_desc },
+	{ .compatible = "sophgo,sg2002-clk", .data = &sg2000_desc },

Actually, this one is a better example. sg2000 is not marked deprecated. sg2002 uses the same match data. Why is no fallback to sg2000 used for the sg2002 case?

author maintainer
#5 lore raw

Re: [PATCH 2/3] clk: sophgo: Add support for newly added precise compatible

Quoted 23 lines · Conor Dooley
Quoted 22 lines · Conor Dooley
Quoted 12 lines · Inochi Amaoto

Add of device id definition for newly added precise compatible.

---
 drivers/clk/sophgo/clk-cv1800.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/clk/sophgo/clk-cv1800.c +0 -0
index e0c4dc347579..e10221df6385 100644

drivers/clk/sophgo/clk-cv1800.c static int cv1800_clk_probe(struct platform_device *pdev) · line 1522

Quoted 4 lines
drivers/clk/sophgo/clk-cv1800.c +1 -0
@@ -1519,8 +1519,11 @@ static int cv1800_clk_probe(struct platform_device *pdev)
 
 static const struct of_device_id cv1800_clk_ids[] = {
 	{ .compatible = "sophgo,cv1800-clk", .data = &cv1800_desc },
+	{ .compatible = "sophgo,cv1800b-clk", .data = &cv1800_desc },

Given the same data is used here, should there not be fallbacks in the dt for some of these? For example, 1812 to 1800? Or is that not okay, because 1800 is not a real device id?

Quoted 8 lines
Quoted 4 lines

drivers/clk/sophgo/clk-cv1800.c static int cv1800_clk_probe(struct platform_device *pdev) · line 1526

Quoted 4 lines
drivers/clk/sophgo/clk-cv1800.c +2 -0
 	{ .compatible = "sophgo,cv1810-clk", .data = &cv1810_desc },
+	{ .compatible = "sophgo,cv1812h-clk", .data = &cv1800_desc },
 	{ .compatible = "sophgo,sg2000-clk", .data = &sg2000_desc },
+	{ .compatible = "sophgo,sg2002-clk", .data = &sg2000_desc },

Actually, this one is a better example. sg2000 is not marked deprecated. sg2002 uses the same match data. Why is no fallback to sg2000 used for the sg2002 case?

Yeah, It is a good idea. I will take it, thanks,

Regards,
Inochi

#6 lore raw

Re: [PATCH 2/3] clk: sophgo: Add support for newly added precise compatible

Quoted 33 lines · Inochi Amaoto
Quoted 23 lines · Conor Dooley
Quoted 22 lines · Conor Dooley
Quoted 12 lines · Inochi Amaoto

Add of device id definition for newly added precise compatible.

---
 drivers/clk/sophgo/clk-cv1800.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/clk/sophgo/clk-cv1800.c +0 -0
index e0c4dc347579..e10221df6385 100644

drivers/clk/sophgo/clk-cv1800.c static int cv1800_clk_probe(struct platform_device *pdev) · line 1522

Quoted 4 lines
drivers/clk/sophgo/clk-cv1800.c +1 -0
@@ -1519,8 +1519,11 @@ static int cv1800_clk_probe(struct platform_device *pdev)
 
 static const struct of_device_id cv1800_clk_ids[] = {
 	{ .compatible = "sophgo,cv1800-clk", .data = &cv1800_desc },
+	{ .compatible = "sophgo,cv1800b-clk", .data = &cv1800_desc },

Given the same data is used here, should there not be fallbacks in the dt for some of these? For example, 1812 to 1800? Or is that not okay, because 1800 is not a real device id?

Quoted 8 lines
Quoted 4 lines

drivers/clk/sophgo/clk-cv1800.c static int cv1800_clk_probe(struct platform_device *pdev) · line 1526

Quoted 4 lines
drivers/clk/sophgo/clk-cv1800.c +2 -0
 	{ .compatible = "sophgo,cv1810-clk", .data = &cv1810_desc },
+	{ .compatible = "sophgo,cv1812h-clk", .data = &cv1800_desc },
 	{ .compatible = "sophgo,sg2000-clk", .data = &sg2000_desc },
+	{ .compatible = "sophgo,sg2002-clk", .data = &sg2000_desc },

Actually, this one is a better example. sg2000 is not marked deprecated. sg2002 uses the same match data. Why is no fallback to sg2000 used for the sg2002 case?

Quoted 1 line

Yeah, It is a good idea. I will take it, thanks,

Can you point out the difference in the dt-binding patch when you do, between the sg2000 being a real device and the others not?

author maintainer
#7 lore raw

Re: [PATCH 2/3] clk: sophgo: Add support for newly added precise compatible

Quoted 34 lines · Conor Dooley
Quoted 33 lines · Inochi Amaoto
Quoted 31 lines · Conor Dooley
Quoted 22 lines · Conor Dooley
Quoted 12 lines · Inochi Amaoto

Add of device id definition for newly added precise compatible.

---
 drivers/clk/sophgo/clk-cv1800.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/clk/sophgo/clk-cv1800.c +0 -0
index e0c4dc347579..e10221df6385 100644

drivers/clk/sophgo/clk-cv1800.c static int cv1800_clk_probe(struct platform_device *pdev) · line 1522

Quoted 4 lines
drivers/clk/sophgo/clk-cv1800.c +1 -0
@@ -1519,8 +1519,11 @@ static int cv1800_clk_probe(struct platform_device *pdev)
 
 static const struct of_device_id cv1800_clk_ids[] = {
 	{ .compatible = "sophgo,cv1800-clk", .data = &cv1800_desc },
+	{ .compatible = "sophgo,cv1800b-clk", .data = &cv1800_desc },

Given the same data is used here, should there not be fallbacks in the dt for some of these? For example, 1812 to 1800? Or is that not okay, because 1800 is not a real device id?

Quoted 4 lines

drivers/clk/sophgo/clk-cv1800.c static int cv1800_clk_probe(struct platform_device *pdev) · line 1526

Quoted 4 lines
drivers/clk/sophgo/clk-cv1800.c +2 -0
 	{ .compatible = "sophgo,cv1810-clk", .data = &cv1810_desc },
+	{ .compatible = "sophgo,cv1812h-clk", .data = &cv1800_desc },
 	{ .compatible = "sophgo,sg2000-clk", .data = &sg2000_desc },
+	{ .compatible = "sophgo,sg2002-clk", .data = &sg2000_desc },

Actually, this one is a better example. sg2000 is not marked deprecated. sg2002 uses the same match data. Why is no fallback to sg2000 used for the sg2002 case?

Quoted 4 lines
Quoted 1 line

Yeah, It is a good idea. I will take it, thanks,

Can you point out the difference in the dt-binding patch when you do, between the sg2000 being a real device and the others not?

I will, thanks for the reminder.

Regards,
Inochi

author maintainer
#8 lore raw

Re: [PATCH 2/3] clk: sophgo: Add support for newly added precise compatible

In reply to Conor Dooley
Quoted 14 lines · Conor Dooley
Quoted 13 lines · Inochi Amaoto

Add of device id definition for newly added precise compatible.

---
 drivers/clk/sophgo/clk-cv1800.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/clk/sophgo/clk-cv1800.c +0 -0
index e0c4dc347579..e10221df6385 100644
@@ -1519,8 +1519,11 @@ static int cv1800_clk_probe(struct platform_device *pdev)
 
Quoted 6 lines

drivers/clk/sophgo/clk-cv1800.c static int cv1800_clk_probe(struct platform_device *pdev) · line 1522

Quoted 3 lines
drivers/clk/sophgo/clk-cv1800.c +1 -0
 static const struct of_device_id cv1800_clk_ids[] = {
 	{ .compatible = "sophgo,cv1800-clk", .data = &cv1800_desc },
+	{ .compatible = "sophgo,cv1800b-clk", .data = &cv1800_desc },

Given the same data is used here, should there not be fallbacks in the dt for some of these? For example, 1812 to 1800?

In default, there maybe not fallback for the whole series, I think. But it is possible to use cv1800b as

Quoted 1 line

Or is that not okay, because 1800 is not a real device id?

Yes, cv1800-clk and cv1810-clk is a old wildcard compatible, not a real one. As this is not prefered, I want to fix this to have a meaningful compatible.

Regards,
Inochi

#9 lore raw

Re: [PATCH 2/3] clk: sophgo: Add support for newly added precise compatible

In reply to Inochi Amaoto

Hi Inochi!

Quoted 17 lines · Inochi Amaoto

Add of device id definition for newly added precise compatible.

---
 drivers/clk/sophgo/clk-cv1800.c | 3 +++

 1 file changed, 3 insertions(+)
drivers/clk/sophgo/clk-cv1800.c +0 -0
index e0c4dc347579..e10221df6385 100644
@@ -1519,8 +1519,11 @@ static int cv1800_clk_probe(struct platform_device *pdev)


 static const struct of_device_id cv1800_clk_ids[] = {
  { .compatible = "sophgo,cv1800-clk", .data = &cv1800_desc },

drivers/clk/sophgo/clk-cv1800.c +1 -0
+	{ .compatible = "sophgo,cv1800b-clk", .data = &cv1800_desc },

  { .compatible = "sophgo,cv1810-clk", .data = &cv1810_desc },

drivers/clk/sophgo/clk-cv1800.c static int cv1800_clk_probe(struct platform_device *pdev) · line 1524

Quoted 1 line
drivers/clk/sophgo/clk-cv1800.c +1 -0
+	{ .compatible = "sophgo,cv1812h-clk", .data = &cv1800_desc },
                                                           ^

Should it have been "cv1810_desc" instead?

Quoted 5 lines

  { .compatible = "sophgo,sg2000-clk", .data = &sg2000_desc },

drivers/clk/sophgo/clk-cv1800.c +1 -0
+	{ .compatible = "sophgo,sg2002-clk", .data = &sg2000_desc },

  { }
 };
 MODULE_DEVICE_TABLE(of, cv1800_clk_ids);

Signature · 1 line
Alexander Sverdlin.
author maintainer
#10 lore raw

Re: [PATCH 2/3] clk: sophgo: Add support for newly added precise compatible

Quoted 22 lines · Alexander Sverdlin

Hi Inochi!

Quoted 17 lines · Inochi Amaoto

Add of device id definition for newly added precise compatible.

---
 drivers/clk/sophgo/clk-cv1800.c | 3 +++

 1 file changed, 3 insertions(+)
drivers/clk/sophgo/clk-cv1800.c +0 -0
index e0c4dc347579..e10221df6385 100644
@@ -1519,8 +1519,11 @@ static int cv1800_clk_probe(struct platform_device *pdev)


 static const struct of_device_id cv1800_clk_ids[] = {
  { .compatible = "sophgo,cv1800-clk", .data = &cv1800_desc },

drivers/clk/sophgo/clk-cv1800.c +1 -0
+	{ .compatible = "sophgo,cv1800b-clk", .data = &cv1800_desc },

  { .compatible = "sophgo,cv1810-clk", .data = &cv1810_desc },

drivers/clk/sophgo/clk-cv1800.c static int cv1800_clk_probe(struct platform_device *pdev) · line 1524

Quoted 1 line
drivers/clk/sophgo/clk-cv1800.c +1 -0
+	{ .compatible = "sophgo,cv1812h-clk", .data = &cv1800_desc },
                                                           ^
Quoted 2 lines

Should it have been "cv1810_desc" instead?

Yeah, this is a mistake. I will fix it.

Quoted 8 lines
Quoted 5 lines

  { .compatible = "sophgo,sg2000-clk", .data = &sg2000_desc },

drivers/clk/sophgo/clk-cv1800.c +1 -0
+	{ .compatible = "sophgo,sg2002-clk", .data = &sg2000_desc },

  { }
 };
 MODULE_DEVICE_TABLE(of, cv1800_clk_ids);

Signature · 1 line
Alexander Sverdlin.
author maintainer
#11 lore raw

PATCH 3/3 riscv: dts: sophgo: switch precise compatible for existed clock device for CV18XX

In reply to Inochi Amaoto

replace newly added precise compatible with old one for existed clock device of CV18XX series SoCs.

---
 arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 2 +-
 arch/riscv/boot/dts/sophgo/cv1812h.dtsi | 2 +-
 arch/riscv/boot/dts/sophgo/sg2002.dtsi  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
arch/riscv/boot/dts/sophgo/cv1800b.dtsi +1 -1
index 88707cc13fb4..90de978f69c1 100644
@@ -29,7 +29,7 @@ pinctrl: pinctrl@3001000 {
 		};
 
 		clk: clock-controller@3002000 {
-			compatible = "sophgo,cv1800-clk";
+			compatible = "sophgo,cv1800b-clk";
 			reg = <0x03002000 0x1000>;
 			clocks = <&osc>;
 			#clock-cells = <1>;
arch/riscv/boot/dts/sophgo/cv1812h.dtsi +1 -1
index 0974955e4e05..9a2a314d3347 100644
@@ -31,7 +31,7 @@ pinctrl: pinctrl@3001000 {
 		};
 
 		clk: clock-controller@3002000 {
-			compatible = "sophgo,cv1810-clk";
+			compatible = "sophgo,cv1812h-clk";
 			reg = <0x03002000 0x1000>;
 			clocks = <&osc>;
 			#clock-cells = <1>;
arch/riscv/boot/dts/sophgo/sg2002.dtsi +1 -1
index 6f09c9199102..b9e4b4687046 100644
@@ -31,7 +31,7 @@ pinctrl: pinctrl@3001000 {
 		};
 
 		clk: clock-controller@3002000 {
-			compatible = "sophgo,sg2000-clk";
+			compatible = "sophgo,sg2002-clk";
 			reg = <0x03002000 0x1000>;
 			clocks = <&osc>;
 			#clock-cells = <1>;
Signature · 1 line
2.49.0