Although the cv1800b/cv1812h/sg2000/sg2002 share most peripherals,
some basic peripherals, like clock, pinctrl, clint and plint, are
not shared. These are caused by not only historical reason (plic,
clint), but also the fact the device is not the same (clock, pinctrl).
It is good to override device compatible when the soc number is small,
but now it is a burden for maintenance, and it is kind of annoyed to
explain why using override. So it is time to move this out of the
common peripheral header.
Move all soc related peripherla device from common peripheral header
to the soc specific header to get rid of most compatible override.
Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
---
arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 38 +++++++++++++++++--------
arch/riscv/boot/dts/sophgo/cv1812h.dtsi | 38 +++++++++++++++++--------
arch/riscv/boot/dts/sophgo/cv18xx.dtsi | 22 --------------
arch/riscv/boot/dts/sophgo/sg2002.dtsi | 38 +++++++++++++++++--------
4 files changed, 78 insertions(+), 58 deletions(-)
diff --git a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
index aa1f5df100f0..fc9e6b56790f 100644
--- a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
+++ b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
@@ -15,23 +15,37 @@ memory@80000000 {
};
soc {
+ interrupt-parent = <&plic>;
+ dma-noncoherent;
+
pinctrl: pinctrl@3001000 {
compatible = "sophgo,cv1800b-pinctrl";
reg = <0x03001000 0x1000>,
<0x05027000 0x1000>;
reg-names = "sys", "rtc";
};
+
+ clk: clock-controller@3002000 {
+ compatible = "sophgo,cv1800-clk";
+ reg = <0x03002000 0x1000>;
+ clocks = <&osc>;
+ #clock-cells = <1>;
+ };
+
+ plic: interrupt-controller@70000000 {
+ compatible = "sophgo,cv1800b-plic", "thead,c900-plic";
+ reg = <0x70000000 0x4000000>;
+ interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>;
+ interrupt-controller;
+ #address-cells = <0>;
+ #interrupt-cells = <2>;
+ riscv,ndev = <101>;
+ };
+
+ clint: timer@74000000 {
+ compatible = "sophgo,cv1800b-clint", "thead,c900-clint";
+ reg = <0x74000000 0x10000>;
+ interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>;
+ };
};
};
-
-&plic {
- compatible = "sophgo,cv1800b-plic", "thead,c900-plic";
-};
-
-&clint {
- compatible = "sophgo,cv1800b-clint", "thead,c900-clint";
-};
-
-&clk {
- compatible = "sophgo,cv1800-clk";
-};
diff --git a/arch/riscv/boot/dts/sophgo/cv1812h.dtsi b/arch/riscv/boot/dts/sophgo/cv1812h.dtsi
index 8a1b95c5116b..fcea4376fb79 100644
--- a/arch/riscv/boot/dts/sophgo/cv1812h.dtsi
+++ b/arch/riscv/boot/dts/sophgo/cv1812h.dtsi
@@ -17,23 +17,37 @@ memory@80000000 {
};
soc {
+ interrupt-parent = <&plic>;
+ dma-noncoherent;
+
pinctrl: pinctrl@3001000 {
compatible = "sophgo,cv1812h-pinctrl";
reg = <0x03001000 0x1000>,
<0x05027000 0x1000>;
reg-names = "sys", "rtc";
};
+
+ clk: clock-controller@3002000 {
+ compatible = "sophgo,cv1810-clk";
+ reg = <0x03002000 0x1000>;
+ clocks = <&osc>;
+ #clock-cells = <1>;
+ };
+
+ plic: interrupt-controller@70000000 {
+ compatible = "sophgo,cv1812h-plic", "thead,c900-plic";
+ reg = <0x70000000 0x4000000>;
+ interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>;
+ interrupt-controller;
+ #address-cells = <0>;
+ #interrupt-cells = <2>;
+ riscv,ndev = <101>;
+ };
+
+ clint: timer@74000000 {
+ compatible = "sophgo,cv1812h-clint", "thead,c900-clint";
+ reg = <0x74000000 0x10000>;
+ interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>;
+ };
};
};
-
-&plic {
- compatible = "sophgo,cv1812h-plic", "thead,c900-plic";
-};
-
-&clint {
- compatible = "sophgo,cv1812h-clint", "thead,c900-clint";
-};
-
-&clk {
- compatible = "sophgo,cv1810-clk";
-};
diff --git a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
index c18822ec849f..805b694aa814 100644
--- a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
+++ b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
@@ -49,18 +49,10 @@ osc: oscillator {
soc {
compatible = "simple-bus";
- interrupt-parent = <&plic>;
#address-cells = <1>;
#size-cells = <1>;
- dma-noncoherent;
ranges;
- clk: clock-controller@3002000 {
- reg = <0x03002000 0x1000>;
- clocks = <&osc>;
- #clock-cells = <1>;
- };
-
gpio0: gpio@3020000 {
compatible = "snps,dw-apb-gpio";
reg = <0x3020000 0x1000>;
@@ -344,19 +336,5 @@ dmac: dma-controller@4330000 {
snps,data-width = <4>;
status = "disabled";
};
-
- plic: interrupt-controller@70000000 {
- reg = <0x70000000 0x4000000>;
- interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>;
- interrupt-controller;
- #address-cells = <0>;
- #interrupt-cells = <2>;
- riscv,ndev = <101>;
- };
-
- clint: timer@74000000 {
- reg = <0x74000000 0x10000>;
- interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>;
- };
};
};
diff --git a/arch/riscv/boot/dts/sophgo/sg2002.dtsi b/arch/riscv/boot/dts/sophgo/sg2002.dtsi
index 7f79de33163c..df133831bd3e 100644
--- a/arch/riscv/boot/dts/sophgo/sg2002.dtsi
+++ b/arch/riscv/boot/dts/sophgo/sg2002.dtsi
@@ -17,27 +17,41 @@ memory@80000000 {
};
soc {
+ interrupt-parent = <&plic>;
+ dma-noncoherent;
+
pinctrl: pinctrl@3001000 {
compatible = "sophgo,sg2002-pinctrl";
reg = <0x03001000 0x1000>,
<0x05027000 0x1000>;
reg-names = "sys", "rtc";
};
+
+ clk: clock-controller@3002000 {
+ compatible = "sophgo,sg2000-clk";
+ reg = <0x03002000 0x1000>;
+ clocks = <&osc>;
+ #clock-cells = <1>;
+ };
+
+ plic: interrupt-controller@70000000 {
+ compatible = "sophgo,sg2002-plic", "thead,c900-plic";
+ reg = <0x70000000 0x4000000>;
+ interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>;
+ interrupt-controller;
+ #address-cells = <0>;
+ #interrupt-cells = <2>;
+ riscv,ndev = <101>;
+ };
+
+ clint: timer@74000000 {
+ compatible = "sophgo,sg2002-clint", "thead,c900-clint";
+ reg = <0x74000000 0x10000>;
+ interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>;
+ };
};
};
-&plic {
- compatible = "sophgo,sg2002-plic", "thead,c900-plic";
-};
-
-&clint {
- compatible = "sophgo,sg2002-clint", "thead,c900-clint";
-};
-
-&clk {
- compatible = "sophgo,sg2000-clk";
-};
-
&sdhci0 {
compatible = "sophgo,sg2002-dwcmshc";
};
--
2.49.0
On 09:26 Wed 30 Apr , Inochi Amaoto wrote:
> Although the cv1800b/cv1812h/sg2000/sg2002 share most peripherals,
> some basic peripherals, like clock, pinctrl, clint and plint, are
> not shared. These are caused by not only historical reason (plic,
> clint), but also the fact the device is not the same (clock, pinctrl).
>
> It is good to override device compatible when the soc number is small,
~~~SoC, we usually
> but now it is a burden for maintenance, and it is kind of annoyed to
> explain why using override. So it is time to move this out of the
> common peripheral header.
>
> Move all soc related peripherla device from common peripheral header
~~~~~~~~~~typo, peripheral
> to the soc specific header to get rid of most compatible override.
>
> Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
otherwise, looks good
Reviewed-by: Yixun Lan <dlan@gentoo.org>
> ---
> arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 38 +++++++++++++++++--------
> arch/riscv/boot/dts/sophgo/cv1812h.dtsi | 38 +++++++++++++++++--------
> arch/riscv/boot/dts/sophgo/cv18xx.dtsi | 22 --------------
> arch/riscv/boot/dts/sophgo/sg2002.dtsi | 38 +++++++++++++++++--------
> 4 files changed, 78 insertions(+), 58 deletions(-)
>
> diff --git a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
> index aa1f5df100f0..fc9e6b56790f 100644
> --- a/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
> +++ b/arch/riscv/boot/dts/sophgo/cv1800b.dtsi
> @@ -15,23 +15,37 @@ memory@80000000 {
> };
>
> soc {
> + interrupt-parent = <&plic>;
> + dma-noncoherent;
> +
> pinctrl: pinctrl@3001000 {
> compatible = "sophgo,cv1800b-pinctrl";
> reg = <0x03001000 0x1000>,
> <0x05027000 0x1000>;
> reg-names = "sys", "rtc";
> };
> +
> + clk: clock-controller@3002000 {
> + compatible = "sophgo,cv1800-clk";
> + reg = <0x03002000 0x1000>;
> + clocks = <&osc>;
> + #clock-cells = <1>;
> + };
> +
> + plic: interrupt-controller@70000000 {
> + compatible = "sophgo,cv1800b-plic", "thead,c900-plic";
> + reg = <0x70000000 0x4000000>;
> + interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>;
> + interrupt-controller;
> + #address-cells = <0>;
> + #interrupt-cells = <2>;
> + riscv,ndev = <101>;
> + };
> +
> + clint: timer@74000000 {
> + compatible = "sophgo,cv1800b-clint", "thead,c900-clint";
> + reg = <0x74000000 0x10000>;
> + interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>;
> + };
> };
> };
> -
> -&plic {
> - compatible = "sophgo,cv1800b-plic", "thead,c900-plic";
> -};
> -
> -&clint {
> - compatible = "sophgo,cv1800b-clint", "thead,c900-clint";
> -};
> -
> -&clk {
> - compatible = "sophgo,cv1800-clk";
> -};
> diff --git a/arch/riscv/boot/dts/sophgo/cv1812h.dtsi b/arch/riscv/boot/dts/sophgo/cv1812h.dtsi
> index 8a1b95c5116b..fcea4376fb79 100644
> --- a/arch/riscv/boot/dts/sophgo/cv1812h.dtsi
> +++ b/arch/riscv/boot/dts/sophgo/cv1812h.dtsi
> @@ -17,23 +17,37 @@ memory@80000000 {
> };
>
> soc {
> + interrupt-parent = <&plic>;
> + dma-noncoherent;
> +
> pinctrl: pinctrl@3001000 {
> compatible = "sophgo,cv1812h-pinctrl";
> reg = <0x03001000 0x1000>,
> <0x05027000 0x1000>;
> reg-names = "sys", "rtc";
> };
> +
> + clk: clock-controller@3002000 {
> + compatible = "sophgo,cv1810-clk";
> + reg = <0x03002000 0x1000>;
> + clocks = <&osc>;
> + #clock-cells = <1>;
> + };
> +
> + plic: interrupt-controller@70000000 {
> + compatible = "sophgo,cv1812h-plic", "thead,c900-plic";
> + reg = <0x70000000 0x4000000>;
> + interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>;
> + interrupt-controller;
> + #address-cells = <0>;
> + #interrupt-cells = <2>;
> + riscv,ndev = <101>;
> + };
> +
> + clint: timer@74000000 {
> + compatible = "sophgo,cv1812h-clint", "thead,c900-clint";
> + reg = <0x74000000 0x10000>;
> + interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>;
> + };
> };
> };
> -
> -&plic {
> - compatible = "sophgo,cv1812h-plic", "thead,c900-plic";
> -};
> -
> -&clint {
> - compatible = "sophgo,cv1812h-clint", "thead,c900-clint";
> -};
> -
> -&clk {
> - compatible = "sophgo,cv1810-clk";
> -};
> diff --git a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
> index c18822ec849f..805b694aa814 100644
> --- a/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
> +++ b/arch/riscv/boot/dts/sophgo/cv18xx.dtsi
> @@ -49,18 +49,10 @@ osc: oscillator {
>
> soc {
> compatible = "simple-bus";
> - interrupt-parent = <&plic>;
> #address-cells = <1>;
> #size-cells = <1>;
> - dma-noncoherent;
> ranges;
>
> - clk: clock-controller@3002000 {
> - reg = <0x03002000 0x1000>;
> - clocks = <&osc>;
> - #clock-cells = <1>;
> - };
> -
> gpio0: gpio@3020000 {
> compatible = "snps,dw-apb-gpio";
> reg = <0x3020000 0x1000>;
> @@ -344,19 +336,5 @@ dmac: dma-controller@4330000 {
> snps,data-width = <4>;
> status = "disabled";
> };
> -
> - plic: interrupt-controller@70000000 {
> - reg = <0x70000000 0x4000000>;
> - interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>;
> - interrupt-controller;
> - #address-cells = <0>;
> - #interrupt-cells = <2>;
> - riscv,ndev = <101>;
> - };
> -
> - clint: timer@74000000 {
> - reg = <0x74000000 0x10000>;
> - interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>;
> - };
> };
> };
> diff --git a/arch/riscv/boot/dts/sophgo/sg2002.dtsi b/arch/riscv/boot/dts/sophgo/sg2002.dtsi
> index 7f79de33163c..df133831bd3e 100644
> --- a/arch/riscv/boot/dts/sophgo/sg2002.dtsi
> +++ b/arch/riscv/boot/dts/sophgo/sg2002.dtsi
> @@ -17,27 +17,41 @@ memory@80000000 {
> };
>
> soc {
> + interrupt-parent = <&plic>;
> + dma-noncoherent;
> +
> pinctrl: pinctrl@3001000 {
> compatible = "sophgo,sg2002-pinctrl";
> reg = <0x03001000 0x1000>,
> <0x05027000 0x1000>;
> reg-names = "sys", "rtc";
> };
> +
> + clk: clock-controller@3002000 {
> + compatible = "sophgo,sg2000-clk";
> + reg = <0x03002000 0x1000>;
> + clocks = <&osc>;
> + #clock-cells = <1>;
> + };
> +
> + plic: interrupt-controller@70000000 {
> + compatible = "sophgo,sg2002-plic", "thead,c900-plic";
> + reg = <0x70000000 0x4000000>;
> + interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>;
> + interrupt-controller;
> + #address-cells = <0>;
> + #interrupt-cells = <2>;
> + riscv,ndev = <101>;
> + };
> +
> + clint: timer@74000000 {
> + compatible = "sophgo,sg2002-clint", "thead,c900-clint";
> + reg = <0x74000000 0x10000>;
> + interrupts-extended = <&cpu0_intc 3>, <&cpu0_intc 7>;
> + };
> };
> };
>
> -&plic {
> - compatible = "sophgo,sg2002-plic", "thead,c900-plic";
> -};
> -
> -&clint {
> - compatible = "sophgo,sg2002-clint", "thead,c900-clint";
> -};
> -
> -&clk {
> - compatible = "sophgo,sg2000-clk";
> -};
> -
> &sdhci0 {
> compatible = "sophgo,sg2002-dwcmshc";
> };
> --
> 2.49.0
>
--
Yixun Lan (dlan)
Hi Inochi! On Wed, 2025-04-30 at 09:26 +0800, Inochi Amaoto wrote: > Although the cv1800b/cv1812h/sg2000/sg2002 share most peripherals, > some basic peripherals, like clock, pinctrl, clint and plint, are > not shared. These are caused by not only historical reason (plic, > clint), but also the fact the device is not the same (clock, pinctrl). > > It is good to override device compatible when the soc number is small, > but now it is a burden for maintenance, and it is kind of annoyed to > explain why using override. So it is time to move this out of the > common peripheral header. > > Move all soc related peripherla device from common peripheral header > to the soc specific header to get rid of most compatible override. > > Signed-off-by: Inochi Amaoto <inochiama@gmail.com> Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> > --- > arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 38 +++++++++++++++++-------- > arch/riscv/boot/dts/sophgo/cv1812h.dtsi | 38 +++++++++++++++++-------- > arch/riscv/boot/dts/sophgo/cv18xx.dtsi | 22 -------------- > arch/riscv/boot/dts/sophgo/sg2002.dtsi | 38 +++++++++++++++++-------- > 4 files changed, 78 insertions(+), 58 deletions(-) -- Alexander Sverdlin.
© 2016 - 2026 Red Hat, Inc.