Skip to contentSkip to conversation

Add board support for Sipeed LicheeRV Nano

PATCH Superseded Thomas Bonnefille 7 participants 22 messages Jun 12, 2024 – Jun 20, 2024

Subsystems (6)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add board support for Sipeed LicheeRV Nano

The LicheeRV Nano is a RISC-V SBC based on the Sophgo SG2002 chip. Adds minimal device tree files for this board to make it boot to a basic shell.

---
Changes in v2:
- Add SDHCI support
- Change device tree name to match the Makefile
- Add oscillator frequency
- Add aliases to other UARTs
- Add aliases to GPIOs
- Move compatible for SDHCI from common DT to specific DT
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Thomas Bonnefille (6):
riscv: dts: sophgo: Put sdhci compatible in dt of specific SoC
dt-bindings: interrupt-controller: Add SOPHGO SG2002 plic
dt-bindings: timer: Add SOPHGO SG2002 clint
dt-bindings: riscv: Add Sipeed LicheeRV Nano board compatibles
riscv: dts: sophgo: Add initial SG2002 SoC device tree
riscv: dts: sophgo: Add LicheeRV Nano board device tree

 .../interrupt-controller/sifive,plic-1.0.0.yaml    |  1 +
 .../devicetree/bindings/riscv/sophgo.yaml          |  5 ++
 .../devicetree/bindings/timer/sifive,clint.yaml    |  1 +
 arch/riscv/boot/dts/sophgo/Makefile                |  1 +
 arch/riscv/boot/dts/sophgo/cv1800b.dtsi            |  4 ++
 arch/riscv/boot/dts/sophgo/cv18xx.dtsi             |  1 -
 .../boot/dts/sophgo/sg2002-licheerv-nano-b.dts     | 53 ++++++++++++++++++++++
 arch/riscv/boot/dts/sophgo/sg2002.dtsi             | 34 ++++++++++++++
 8 files changed, 99 insertions(+), 1 deletion(-)

---
base-commit: 83a7eefedc9b56fe7bfeff13b6c7356688ffa670
change-id: 20240515-sg2002-93dce1d263be

Best regards,

Signature · 1 line
Thomas Bonnefille <[email protected]>
#1 lore raw

PATCH v2 1/6 riscv: dts: sophgo: Put sdhci compatible in dt of specific SoC

Remove SDHCI compatible for CV1800b from common dtsi file to put it in the specific dtsi file of the CV1800b.
This commits aims at following the same guidelines as in the other nodes of the CV18XX family.

---
 arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 4 ++++
 arch/riscv/boot/dts/sophgo/cv18xx.dtsi  | 1 -
 2 files changed, 4 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/sophgo/cv1800b.dtsi +4 -0
index ec9530972ae2..b9cd51457b4c 100644
@@ -25,3 +25,7 @@ &clint {
 &clk {
 	compatible = "sophgo,cv1800-clk";
 };
+
+&sdhci0 {
+	compatible = "sophgo,cv1800b-dwcmshc";
+};
arch/riscv/boot/dts/sophgo/cv18xx.dtsi +0 -1
index 891932ae470f..7247c7c3013c 100644
@@ -288,7 +288,6 @@ uart4: serial@41c0000 {
 		};
 
 		sdhci0: mmc@4310000 {
-			compatible = "sophgo,cv1800b-dwcmshc";
 			reg = <0x4310000 0x1000>;
 			interrupts = <36 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&clk CLK_AXI4_SD0>,
Signature · 1 line
2.45.2
#2 lore raw

Re: [PATCH v2 1/6] riscv: dts: sophgo: Put sdhci compatible in dt of specific SoC

Quoted 39 lines · Thomas Bonnefille

Remove SDHCI compatible for CV1800b from common dtsi file to put it in the specific dtsi file of the CV1800b.
This commits aims at following the same guidelines as in the other nodes of the CV18XX family.

---
 arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 4 ++++
 arch/riscv/boot/dts/sophgo/cv18xx.dtsi  | 1 -
 2 files changed, 4 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/sophgo/cv1800b.dtsi +4 -0
index ec9530972ae2..b9cd51457b4c 100644
@@ -25,3 +25,7 @@ &clint {
 &clk {
 	compatible = "sophgo,cv1800-clk";
 };
+
+&sdhci0 {
+	compatible = "sophgo,cv1800b-dwcmshc";
+};
arch/riscv/boot/dts/sophgo/cv18xx.dtsi +0 -1
index 891932ae470f..7247c7c3013c 100644
@@ -288,7 +288,6 @@ uart4: serial@41c0000 {
 		};
 
 		sdhci0: mmc@4310000 {
-			compatible = "sophgo,cv1800b-dwcmshc";
 			reg = <0x4310000 0x1000>;
 			interrupts = <36 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&clk CLK_AXI4_SD0>,
Signature · 2 lines
-- 
2.45.2

Hi, Jisheng,

Is this change necessary? IIRC, the sdhci is the same across the whole series.

Regards,
Inochi

#3 lore raw

Re: [PATCH v2 1/6] riscv: dts: sophgo: Put sdhci compatible in dt of specific SoC

Hi

Quoted 5 lines · Inochi Amaoto
Quoted 4 lines · Thomas Bonnefille

Remove SDHCI compatible for CV1800b from common dtsi file to put it in the specific dtsi file of the CV1800b.
This commits aims at following the same guidelines as in the other nodes of the CV18XX family.

is there any URL of guideline? or did I miss anything couldn't find any discussion about this in v1

Quoted 32 lines
Quoted 32 lines
---
 arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 4 ++++
 arch/riscv/boot/dts/sophgo/cv18xx.dtsi  | 1 -
 2 files changed, 4 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/sophgo/cv1800b.dtsi +4 -0
index ec9530972ae2..b9cd51457b4c 100644
@@ -25,3 +25,7 @@ &clint {
 &clk {
 	compatible = "sophgo,cv1800-clk";
 };
+
+&sdhci0 {
+	compatible = "sophgo,cv1800b-dwcmshc";
+};
arch/riscv/boot/dts/sophgo/cv18xx.dtsi +0 -1
index 891932ae470f..7247c7c3013c 100644
@@ -288,7 +288,6 @@ uart4: serial@41c0000 {
 		};
 
 		sdhci0: mmc@4310000 {
-			compatible = "sophgo,cv1800b-dwcmshc";
 			reg = <0x4310000 0x1000>;
 			interrupts = <36 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&clk CLK_AXI4_SD0>,
Quoted 8 lines
Quoted 3 lines
Signature · 1 line
2.45.2

Hi, Jisheng,

Is this change necessary? IIRC, the sdhci is the same across the whole series.

I tend to agree with Inochi here, if it's same across all SoC, then no bother to split, it will cause more trouble to maintain..

Quoted 3 lines

Regards,
Inochi

Signature · 3 lines
Yixun Lan (dlan)
Gentoo Linux Developer
GPG Key ID AABEFD55
#4 lore raw

Re: [PATCH v2 1/6] riscv: dts: sophgo: Put sdhci compatible in dt of specific SoC

Quoted 11 lines · Yixun Lan

Hi

Quoted 5 lines · Inochi Amaoto
Quoted 4 lines · Thomas Bonnefille

Remove SDHCI compatible for CV1800b from common dtsi file to put it in the specific dtsi file of the CV1800b.
This commits aims at following the same guidelines as in the other nodes of the CV18XX family.

is there any URL of guideline? or did I miss anything couldn't find any discussion about this in v1

No, it seems like that this is a new change from Thomas.

Quoted 51 lines
Quoted 32 lines
Quoted 32 lines
---
 arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 4 ++++
 arch/riscv/boot/dts/sophgo/cv18xx.dtsi  | 1 -
 2 files changed, 4 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/sophgo/cv1800b.dtsi +4 -0
index ec9530972ae2..b9cd51457b4c 100644
@@ -25,3 +25,7 @@ &clint {
 &clk {
 	compatible = "sophgo,cv1800-clk";
 };
+
+&sdhci0 {
+	compatible = "sophgo,cv1800b-dwcmshc";
+};
arch/riscv/boot/dts/sophgo/cv18xx.dtsi +0 -1
index 891932ae470f..7247c7c3013c 100644
@@ -288,7 +288,6 @@ uart4: serial@41c0000 {
 		};
 
 		sdhci0: mmc@4310000 {
-			compatible = "sophgo,cv1800b-dwcmshc";
 			reg = <0x4310000 0x1000>;
 			interrupts = <36 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&clk CLK_AXI4_SD0>,
Quoted 8 lines
Quoted 3 lines
Signature · 1 line
2.45.2

Hi, Jisheng,

Is this change necessary? IIRC, the sdhci is the same across the whole series.

I tend to agree with Inochi here, if it's same across all SoC, then no bother to split, it will cause more trouble to maintain..

Quoted 3 lines

Regards,
Inochi

Signature · 3 lines
Yixun Lan (dlan)
Gentoo Linux Developer
GPG Key ID AABEFD55
#5 lore raw

Re: [PATCH v2 1/6] riscv: dts: sophgo: Put sdhci compatible in dt of specific SoC

In reply to Yixun Lan
Quoted 11 lines · Yixun Lan

Hi

Quoted 5 lines · Inochi Amaoto
Quoted 4 lines · Thomas Bonnefille

Remove SDHCI compatible for CV1800b from common dtsi file to put it in the specific dtsi file of the CV1800b.
This commits aims at following the same guidelines as in the other nodes of the CV18XX family.

is there any URL of guideline? or did I miss anything couldn't find any discussion about this in v1

Not explicitly, the fact is that I had to use a specific compatible on SG2002 for the sdhci (it is already defined mainline), I had to choose between :

1. cv18xx.dtsi : compatible cv1800b-dwcmshc
cv1800b.dtsi : no redefined compatible
sg2002.dtsi : overwrite the previous compatible to use sg2002-dwcmshc

2. cv18xx.dtsi : no compatible
cv1800b.dtsi : compatible for cv1800b-dwcmshc
sg2002.dtsi : compatible for sg2002-dwcmshc

As in the plic and clint controllers, the second option was chosen I consider this as a "guideline" and reformat the dtsis accordingly.

Quoted 38 lines
Quoted 38 lines
Quoted 35 lines
---
  arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 4 ++++
  arch/riscv/boot/dts/sophgo/cv18xx.dtsi  | 1 -
  2 files changed, 4 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/sophgo/cv1800b.dtsi +4 -0
index ec9530972ae2..b9cd51457b4c 100644
@@ -25,3 +25,7 @@ &clint {
  &clk {
  	compatible = "sophgo,cv1800-clk";
  };
+
+&sdhci0 {
+	compatible = "sophgo,cv1800b-dwcmshc";
+};
arch/riscv/boot/dts/sophgo/cv18xx.dtsi +0 -1
index 891932ae470f..7247c7c3013c 100644
@@ -288,7 +288,6 @@ uart4: serial@41c0000 {
  		};
 
  		sdhci0: mmc@4310000 {
-			compatible = "sophgo,cv1800b-dwcmshc";
  			reg = <0x4310000 0x1000>;
  			interrupts = <36 IRQ_TYPE_LEVEL_HIGH>;
  			clocks = <&clk CLK_AXI4_SD0>,
Signature · 2 lines
-- 
2.45.2

Hi, Jisheng,

Quoted 5 lines
Quoted 2 lines

Is this change necessary? IIRC, the sdhci is the same across the whole series.

I tend to agree with Inochi here, if it's same across all SoC, then no bother to split, it will cause more trouble to maintain..

To be honest, I agree with this to, but as a specific compatible for the SG2002 was created in commit 849e81817b9b, I thought that the best practice was to use it.

Quoted 4 lines
Quoted 3 lines

Regards,
Inochi

#6 lore raw

Re: [PATCH v2 1/6] riscv: dts: sophgo: Put sdhci compatible in dt of specific SoC

Quoted 23 lines · Thomas Bonnefille
Quoted 11 lines · Yixun Lan

Hi

Quoted 5 lines · Inochi Amaoto
Quoted 4 lines · Thomas Bonnefille

Remove SDHCI compatible for CV1800b from common dtsi file to put it in the specific dtsi file of the CV1800b.
This commits aims at following the same guidelines as in the other nodes of the CV18XX family.

is there any URL of guideline? or did I miss anything couldn't find any discussion about this in v1

Not explicitly, the fact is that I had to use a specific compatible on SG2002 for the sdhci (it is already defined mainline), I had to choose between :

1. cv18xx.dtsi : compatible cv1800b-dwcmshc
cv1800b.dtsi : no redefined compatible
sg2002.dtsi : overwrite the previous compatible to use sg2002-dwcmshc

Quoted 46 lines

2. cv18xx.dtsi : no compatible
cv1800b.dtsi : compatible for cv1800b-dwcmshc
sg2002.dtsi : compatible for sg2002-dwcmshc

As in the plic and clint controllers, the second option was chosen I consider this as a "guideline" and reformat the dtsis accordingly.

Quoted 39 lines
Quoted 39 lines
Quoted 34 lines
---
  arch/riscv/boot/dts/sophgo/cv1800b.dtsi | 4 ++++
  arch/riscv/boot/dts/sophgo/cv18xx.dtsi  | 1 -
  2 files changed, 4 insertions(+), 1 deletion(-)
arch/riscv/boot/dts/sophgo/cv1800b.dtsi +4 -0
index ec9530972ae2..b9cd51457b4c 100644
@@ -25,3 +25,7 @@ &clint {
  &clk {
  	compatible = "sophgo,cv1800-clk";
  };
+
+&sdhci0 {
+	compatible = "sophgo,cv1800b-dwcmshc";
+};
arch/riscv/boot/dts/sophgo/cv18xx.dtsi +0 -1
index 891932ae470f..7247c7c3013c 100644
@@ -288,7 +288,6 @@ uart4: serial@41c0000 {
  		};
  		sdhci0: mmc@4310000 {
-			compatible = "sophgo,cv1800b-dwcmshc";
  			reg = <0x4310000 0x1000>;
  			interrupts = <36 IRQ_TYPE_LEVEL_HIGH>;
  			clocks = <&clk CLK_AXI4_SD0>,
 
Signature · 1 line
2.45.2

Hi, Jisheng,

Is this change necessary? IIRC, the sdhci is the same across the whole series.

Hi,

sorry for being late, I was busy in the past 2.5 month. Per my understanding, the sdhci in cv1800b is the same as the one in sg200x. Maybe I'm wrong, but this was my impression when I cooked the sdhci driver patch for these SoCs.

Quoted 7 lines
Quoted 3 lines

I tend to agree with Inochi here, if it's same across all SoC, then no bother to split, it will cause more trouble to maintain..

To be honest, I agree with this to, but as a specific compatible for the SG2002 was created in commit 849e81817b9b, I thought that the best practice was to use it.

I'd like to take this chance to query DT maintainers: FWICT, in the past even if the PLIC is the same between SoCs, adding a new compatible for them seems a must. So when time goes on, the compatbile list would be longer and longer, is it really necessary? Can we just use the existing compatible string?
DT maintainers may answered the query in the past, if so, sorry for querying again.

Quoted 10 lines
Quoted 5 lines
Quoted 4 lines

Regards,
Inochi

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#7 lore raw

Re: [PATCH v2 1/6] riscv: dts: sophgo: Put sdhci compatible in dt of specific SoC

Quoted 20 lines · Jisheng Zhang
Quoted 5 lines · Thomas Bonnefille
Quoted 4 lines · Yixun Lan
Quoted 2 lines · Inochi Amaoto

Is this change necessary? IIRC, the sdhci is the same across the whole series.

sorry for being late, I was busy in the past 2.5 month. Per my understanding, the sdhci in cv1800b is the same as the one in sg200x. Maybe I'm wrong, but this was my impression when I cooked the sdhci driver patch for these SoCs.

Quoted 7 lines
Quoted 3 lines

I tend to agree with Inochi here, if it's same across all SoC, then no bother to split, it will cause more trouble to maintain..

To be honest, I agree with this to, but as a specific compatible for the SG2002 was created in commit 849e81817b9b, I thought that the best practice was to use it.

Quoted 7 lines

I'd like to take this chance to query DT maintainers: FWICT, in the past even if the PLIC is the same between SoCs, adding a new compatible for them seems a must. So when time goes on, the compatbile list would be longer and longer, is it really necessary? Can we just use the existing compatible string?
DT maintainers may answered the query in the past, if so, sorry for querying again.

For new integrations of an IP, yes, new specific compatibles please. New integrations may have different bugs etc, even if the IP itself is the same. If there's different SoCs that are the same die, but with elements fused off, then sure, use the same compatible.

I expect the list of compatibles in the binding to grow rather large, but that is fine. No one SoC is going to do anything other than something like compatible = "renesas,$soc-plic", "andestech,corecomplex-plic", "riscv,plic"; which I think is perfectly fine.

maintainer
#8 lore raw

Re: [PATCH v2 1/6] riscv: dts: sophgo: Put sdhci compatible in dt of specific SoC

Hi Jisheng, Thomas,

Quoted 34 lines · Conor Dooley
Quoted 20 lines · Jisheng Zhang
Quoted 5 lines · Thomas Bonnefille
Quoted 4 lines · Yixun Lan
Quoted 2 lines · Inochi Amaoto

Is this change necessary? IIRC, the sdhci is the same across the whole series.

sorry for being late, I was busy in the past 2.5 month. Per my understanding, the sdhci in cv1800b is the same as the one in sg200x. Maybe I'm wrong, but this was my impression when I cooked the sdhci driver patch for these SoCs.

Quoted 7 lines
Quoted 3 lines

I tend to agree with Inochi here, if it's same across all SoC, then no bother to split, it will cause more trouble to maintain..

To be honest, I agree with this to, but as a specific compatible for the SG2002 was created in commit 849e81817b9b, I thought that the best practice was to use it.

Quoted 7 lines

I'd like to take this chance to query DT maintainers: FWICT, in the past even if the PLIC is the same between SoCs, adding a new compatible for them seems a must. So when time goes on, the compatbile list would be longer and longer, is it really necessary? Can we just use the existing compatible string?
DT maintainers may answered the query in the past, if so, sorry for querying again.

For new integrations of an IP, yes, new specific compatibles please. New integrations may have different bugs etc, even if the IP itself is the same. If there's different SoCs that are the same die, but with elements fused off, then sure, use the same compatible.

Quoted 4 lines

I expect the list of compatibles in the binding to grow rather large, but that is fine. No one SoC is going to do anything other than something like compatible = "renesas,$soc-plic", "andestech,corecomplex-plic", "riscv,plic"; which I think is perfectly fine.

And you can do the same thing here for the SDHCI controller: if you think sg200x has the same controller (and integration! e.g. number of clocks/resets) as cv1800b, then you should keep sophgo,cv1800b-dwcmshc as a fallback compatible string. Then the driver doesn't need any changes until/unless you eventually find some reason they are not compatible.

It's better to have a SoC-specific compatible string in the DT and not need it, than find out later you need one and not have it. :)

Regards,
Samuel

#9 lore raw

Re: [PATCH v2 1/6] riscv: dts: sophgo: Put sdhci compatible in dt of specific SoC

Quoted 42 lines · Samuel Holland

Hi Jisheng, Thomas,

Quoted 34 lines · Conor Dooley
Quoted 20 lines · Jisheng Zhang
Quoted 5 lines · Thomas Bonnefille
Quoted 4 lines · Yixun Lan
Quoted 2 lines · Inochi Amaoto

Is this change necessary? IIRC, the sdhci is the same across the whole series.

sorry for being late, I was busy in the past 2.5 month. Per my understanding, the sdhci in cv1800b is the same as the one in sg200x. Maybe I'm wrong, but this was my impression when I cooked the sdhci driver patch for these SoCs.

Quoted 7 lines
Quoted 3 lines

I tend to agree with Inochi here, if it's same across all SoC, then no bother to split, it will cause more trouble to maintain..

To be honest, I agree with this to, but as a specific compatible for the SG2002 was created in commit 849e81817b9b, I thought that the best practice was to use it.

Quoted 7 lines

I'd like to take this chance to query DT maintainers: FWICT, in the past even if the PLIC is the same between SoCs, adding a new compatible for them seems a must. So when time goes on, the compatbile list would be longer and longer, is it really necessary? Can we just use the existing compatible string?
DT maintainers may answered the query in the past, if so, sorry for querying again.

For new integrations of an IP, yes, new specific compatibles please. New integrations may have different bugs etc, even if the IP itself is the same. If there's different SoCs that are the same die, but with elements fused off, then sure, use the same compatible.

Quoted 4 lines

I expect the list of compatibles in the binding to grow rather large, but that is fine. No one SoC is going to do anything other than something like compatible = "renesas,$soc-plic", "andestech,corecomplex-plic", "riscv,plic"; which I think is perfectly fine.

Quoted 8 lines

And you can do the same thing here for the SDHCI controller: if you think sg200x has the same controller (and integration! e.g. number of clocks/resets) as cv1800b, then you should keep sophgo,cv1800b-dwcmshc as a fallback compatible string. Then the driver doesn't need any changes until/unless you eventually find some reason they are not compatible.

It's better to have a SoC-specific compatible string in the DT and not need it, than find out later you need one and not have it. :)

Good idea, this solution looks better! Thanks for the suggestion

Quoted 4 lines

Regards,
Samuel

#10 lore raw

Re: [PATCH v2 1/6] riscv: dts: sophgo: Put sdhci compatible in dt of specific SoC

In reply to Samuel Holland
Quoted 48 lines · Samuel Holland

Hi Jisheng, Thomas,

Quoted 34 lines · Conor Dooley
Quoted 20 lines · Jisheng Zhang
Quoted 5 lines · Thomas Bonnefille
Quoted 4 lines · Yixun Lan
Quoted 2 lines · Inochi Amaoto

Is this change necessary? IIRC, the sdhci is the same across the whole series.

sorry for being late, I was busy in the past 2.5 month. Per my understanding, the sdhci in cv1800b is the same as the one in sg200x. Maybe I'm wrong, but this was my impression when I cooked the sdhci driver patch for these SoCs.

Quoted 7 lines
Quoted 3 lines

I tend to agree with Inochi here, if it's same across all SoC, then no bother to split, it will cause more trouble to maintain..

To be honest, I agree with this to, but as a specific compatible for the SG2002 was created in commit 849e81817b9b, I thought that the best practice was to use it.

Quoted 7 lines

I'd like to take this chance to query DT maintainers: FWICT, in the past even if the PLIC is the same between SoCs, adding a new compatible for them seems a must. So when time goes on, the compatbile list would be longer and longer, is it really necessary? Can we just use the existing compatible string?
DT maintainers may answered the query in the past, if so, sorry for querying again.

For new integrations of an IP, yes, new specific compatibles please. New integrations may have different bugs etc, even if the IP itself is the same. If there's different SoCs that are the same die, but with elements fused off, then sure, use the same compatible.

Quoted 4 lines

I expect the list of compatibles in the binding to grow rather large, but that is fine. No one SoC is going to do anything other than something like compatible = "renesas,$soc-plic", "andestech,corecomplex-plic", "riscv,plic"; which I think is perfectly fine.

And you can do the same thing here for the SDHCI controller: if you think sg200x has the same controller (and integration! e.g. number of clocks/resets) as cv1800b, then you should keep sophgo,cv1800b-dwcmshc as a fallback compatible string. Then the driver doesn't need any changes until/unless you eventually find some reason they are not compatible.

Quoted 6 lines

It's better to have a SoC-specific compatible string in the DT and not need it, than find out later you need one and not have it. :)

Regards,
Samuel

This is excellect and reasonable. I will take your advice for the DT change. With your suggetion, I think it may be acceptable to mark the low-profile SoC as the default value and let other override it.

Let take the clk as the example:

// in the base file cv18xx.dtsi

clk: clock-controller@3002000 {
	// set the "sophgo,cv1800-clk" as the fallback.
	compatible = "sophgo,cv1800-clk";
	[...]
};

// in the cv1800b.dtsi
// now no need for the clk override since we have the compatible // default.

// in the cv1812h.dtsi
// we still need this override as it is not compatible

&clk {
	compatible = "sophgo,cv1810-clk";
};

// in the sg2002.dtsi of the patch
// we need this override as it is also not compatible

&clk {
	compatible = "sophgo,sg2000-clk";
};

Do I understand correctly? Or we still need to duplicate these node for SoCs with different profiles.

Regards,
Inochi

#11 lore raw

PATCH v2 2/6 dt-bindings: interrupt-controller: Add SOPHGO SG2002 plic

In reply to Thomas Bonnefille

Add compatible string for SOPHGO SG2002 Platform-Level Interruter Controller.

---
 .../devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml      | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml +1 -0
index 709b2211276b..7e1451f9786a 100644
@@ -67,6 +67,7 @@ properties:
               - allwinner,sun20i-d1-plic
               - sophgo,cv1800b-plic
               - sophgo,cv1812h-plic
+              - sophgo,sg2002-plic
               - sophgo,sg2042-plic
               - thead,th1520-plic
           - const: thead,c900-plic
Signature · 1 line
2.45.2
maintainer
#12 lore raw

Re: [PATCH v2 2/6] dt-bindings: interrupt-controller: Add SOPHGO SG2002 plic

Quoted 4 lines · Thomas Bonnefille

Add compatible string for SOPHGO SG2002 Platform-Level Interruter Controller.

Missing Conor's ack. When sending new versions, it is your responsibility to add tags.

Quoted 20 lines
---
 .../devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml      | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml +1 -0
index 709b2211276b..7e1451f9786a 100644
@@ -67,6 +67,7 @@ properties:
               - allwinner,sun20i-d1-plic
               - sophgo,cv1800b-plic
               - sophgo,cv1812h-plic
+              - sophgo,sg2002-plic
               - sophgo,sg2042-plic
               - thead,th1520-plic
           - const: thead,c900-plic
Signature · 2 lines
-- 
2.45.2
#14 lore raw

PATCH v2 3/6 dt-bindings: timer: Add SOPHGO SG2002 clint

In reply to Thomas Bonnefille

Add compatible string for SOPHGO SG2002 Core-Local Interrupt Controller.

---
 Documentation/devicetree/bindings/timer/sifive,clint.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/timer/sifive,clint.yaml +1 -0
index fced6f2d8ecb..b42d43d2de48 100644
@@ -40,6 +40,7 @@ properties:
               - allwinner,sun20i-d1-clint
               - sophgo,cv1800b-clint
               - sophgo,cv1812h-clint
+              - sophgo,sg2002-clint
               - thead,th1520-clint
           - const: thead,c900-clint
       - items:
Signature · 1 line
2.45.2
#16 lore raw

PATCH v2 4/6 dt-bindings: riscv: Add Sipeed LicheeRV Nano board compatibles

In reply to Thomas Bonnefille

Document the compatible strings for the Sipeed LicheeRV Nano B board which uses the SOPHGO SG2002 SoC.

---
 Documentation/devicetree/bindings/riscv/sophgo.yaml | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/riscv/sophgo.yaml +5 -0
index 9bc813dad098..a14cb10ff3f0 100644
@@ -26,6 +26,11 @@ properties:
           - enum:
               - sophgo,huashan-pi
           - const: sophgo,cv1812h
+      - items:
+          - enum:
+              - sipeed,licheerv-nano-b
+          - const: sipeed,licheerv-nano
+          - const: sophgo,sg2002
       - items:
           - enum:
               - milkv,pioneer
Signature · 1 line
2.45.2
#18 lore raw

PATCH v2 5/6 riscv: dts: sophgo: Add initial SG2002 SoC device tree

In reply to Thomas Bonnefille

Add initial device tree for the SG2002 RISC-V SoC by SOPHGO.

---
 arch/riscv/boot/dts/sophgo/sg2002.dtsi | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
arch/riscv/boot/dts/sophgo/sg2002.dtsi new file +34 -0
new file mode 100644
index 000000000000..0fc80da7c139
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2024 Thomas Bonnefille <[email protected]>
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/interrupt-controller/irq.h>
+#include "cv18xx.dtsi"
+
+/ {
+	compatible = "sophgo,sg2002";
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x10000000>;
+	};
+};
+
+&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";
+};
Signature · 1 line
2.45.2
maintainer
#19 lore raw

Re: [PATCH v2 5/6] riscv: dts: sophgo: Add initial SG2002 SoC device tree

Hi Thomas,

Quoted 13 lines · Thomas Bonnefille

Add initial device tree for the SG2002 RISC-V SoC by SOPHGO.

---
 arch/riscv/boot/dts/sophgo/sg2002.dtsi | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
arch/riscv/boot/dts/sophgo/sg2002.dtsi new file +0 -0
new file mode 100644
index 000000000000..0fc80da7c139

arch/riscv/boot/dts/sophgo/sg2002.dtsi line 6

Quoted 6 lines
arch/riscv/boot/dts/sophgo/sg2002.dtsi new file +6 -0
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2024 Thomas Bonnefille <[email protected]>
+ */
+
+/dts-v1/;

While it doesn't hurt, you don't need this directive in both the .dtsi and each .dts file. It looks like it usually goes in the board .dts file only.

Regards,
Samuel

Quoted 29 lines
arch/riscv/boot/dts/sophgo/sg2002.dtsi new file +28 -0
+
+#include <dt-bindings/interrupt-controller/irq.h>
+#include "cv18xx.dtsi"
+
+/ {
+	compatible = "sophgo,sg2002";
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x10000000>;
+	};
+};
+
+&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";
+};
#20 lore raw

PATCH v2 6/6 riscv: dts: sophgo: Add LicheeRV Nano board device tree

In reply to Thomas Bonnefille

LicheeRV Nano B [1] is an embedded development platform based on the SOPHGO SG2002 chip, the B(ase) version is deprived of Wifi/Bluetooth and Ethernet.

Add only support for UART and SDHCI.

---
 arch/riscv/boot/dts/sophgo/Makefile                |  1 +
 .../boot/dts/sophgo/sg2002-licheerv-nano-b.dts     | 53 ++++++++++++++++++++++
 2 files changed, 54 insertions(+)
arch/riscv/boot/dts/sophgo/Makefile +1 -0
index 57ad82a61ea6..47d4243a8f35 100644
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_ARCH_SOPHGO) += cv1800b-milkv-duo.dtb
 dtb-$(CONFIG_ARCH_SOPHGO) += cv1812h-huashan-pi.dtb
+dtb-$(CONFIG_ARCH_SOPHGO) += sg2002-licheerv-nano-b.dtb
 dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-milkv-pioneer.dtb
arch/riscv/boot/dts/sophgo/sg2002-licheerv-nano-b.dts new file +53 -0

53 lines not on this page · raw message

Signature · 1 line
2.45.2
#21 lore raw

Re: [PATCH v2 6/6] riscv: dts: sophgo: Add LicheeRV Nano board device tree

Quoted 60 lines · Thomas Bonnefille

LicheeRV Nano B [1] is an embedded development platform based on the SOPHGO SG2002 chip, the B(ase) version is deprived of Wifi/Bluetooth and Ethernet.

Add only support for UART and SDHCI.

---
 arch/riscv/boot/dts/sophgo/Makefile                |  1 +
 .../boot/dts/sophgo/sg2002-licheerv-nano-b.dts     | 53 ++++++++++++++++++++++
 2 files changed, 54 insertions(+)
arch/riscv/boot/dts/sophgo/Makefile +1 -0
index 57ad82a61ea6..47d4243a8f35 100644
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_ARCH_SOPHGO) += cv1800b-milkv-duo.dtb
 dtb-$(CONFIG_ARCH_SOPHGO) += cv1812h-huashan-pi.dtb
+dtb-$(CONFIG_ARCH_SOPHGO) += sg2002-licheerv-nano-b.dtb
 dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-milkv-pioneer.dtb
arch/riscv/boot/dts/sophgo/sg2002-licheerv-nano-b.dts new file +31 -0
new file mode 100644
index 000000000000..d011fb15b097
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2024 Thomas Bonnefille <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "sg2002.dtsi"
+
+/ {
+	model = "LicheeRV Nano B";
+	compatible = "sipeed,licheerv-nano-b", "sipeed,licheerv-nano", "sophgo,sg2002";
+
+	aliases {
+		gpio0 = &gpio0;
+		gpio1 = &gpio1;
+		gpio2 = &gpio2;
+		gpio3 = &gpio3;
+		serial0 = &uart0;
+		serial1 = &uart1;
+		serial2 = &uart2;
+		serial3 = &uart3;
+		serial4 = &uart4;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+};
+
+&osc {

arch/riscv/boot/dts/sophgo/sg2002-licheerv-nano-b.dts line 41

Quoted 10 lines
arch/riscv/boot/dts/sophgo/sg2002-licheerv-nano-b.dts new file +10 -0
+	clock-frequency = <25000000>;
+};
+
+&sdhci0 {
+	status = "okay";
+	bus-width = <4>;
+	no-1-8-v;
+	no-mmc;
+	no-sdio;
+};

Please add "disable-wp" property. Otherwise the card will be probed as read-only.

Quoted 16 lines
arch/riscv/boot/dts/sophgo/sg2002-licheerv-nano-b.dts new file +12 -0
+
+&uart0 {
+	status = "okay";
+};
+
+&uart1 {
+	status = "okay";
+};
+
+&i2c0 {
+	status = "okay";
+};
Signature · 2 lines
-- 
2.45.2