Skip to contentSkip to conversation

riscv: dts: nezha-d1: Add memory

RFC PATCH In review Evan Green 2 participants 3 messages Mar 31, 2023

Subsystems (3)
lore
Share & tools
lore

Evan Green

author
#0 lore raw

RFC PATCH 1/1 riscv: dts: nezha-d1: Add memory

Add memory info for the D1 Nezha, which seems to be required for it to boot with the stock firmware. Note that this hardcodes 1GB, which is not technically correct as they also make models with different amounts of RAM. Is the firmware supposed to populate this?

---

 arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts | 6 ++++++
 1 file changed, 6 insertions(+)
arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts +6 -0
index 4ed33c1e7c9c..6aba68cf5541 100644
@@ -32,6 +32,12 @@ / {
 	model = "Allwinner D1 Nezha";
 	compatible = "allwinner,d1-nezha", "allwinner,sun20i-d1";
 
+	// FIXME: this is temporary.
+	memory@40000000 {
+		device_type = "memory";
+		reg = <0x40000000 0x40000000>; /* 1 GB */
+	};
+
 	aliases {
 		ethernet0 = &emac;
 		ethernet1 = &xr829;
Signature · 1 line
2.25.1
#1 lore raw
Quoted 6 lines · Evan Green

Add memory info for the D1 Nezha, which seems to be required for it to boot with the stock firmware. Note that this hardcodes 1GB, which is not technically correct as they also make models with different amounts of RAM.

Is the firmware supposed to populate this?

Yup. Samuel intentionally did it this way:
https://lore.kernel.org/linux-riscv/[email protected]/

Since I don't like using the firmware provided stuff to more easily test I do this in my u-boot boot script:

tftp 0x54000000 d1-fitImage.fit
bootm start 0x54000000
bootm loados 0x54000000
bootm ramdisk;
bootm prep;
fdt memory 0x40000000 0x20000000
bootm go;

Hope either of the above are helpful,
Conor.

Quoted 28 lines

---

 arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts | 6 ++++++
 1 file changed, 6 insertions(+)
arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts +6 -0
index 4ed33c1e7c9c..6aba68cf5541 100644
@@ -32,6 +32,12 @@ / {
 	model = "Allwinner D1 Nezha";
 	compatible = "allwinner,d1-nezha", "allwinner,sun20i-d1";
 
+	// FIXME: this is temporary.
+	memory@40000000 {
+		device_type = "memory";
+		reg = <0x40000000 0x40000000>; /* 1 GB */
+	};
+
 	aliases {
 		ethernet0 = &emac;
 		ethernet1 = &xr829;
Signature · 1 line
2.25.1
author
#2 lore raw
Quoted 23 lines · Conor Dooley
Quoted 6 lines · Evan Green

Add memory info for the D1 Nezha, which seems to be required for it to boot with the stock firmware. Note that this hardcodes 1GB, which is not technically correct as they also make models with different amounts of RAM.

Is the firmware supposed to populate this?

Yup. Samuel intentionally did it this way:
https://lore.kernel.org/linux-riscv/[email protected]/

Since I don't like using the firmware provided stuff to more easily test I do this in my u-boot boot script:

tftp 0x54000000 d1-fitImage.fit
bootm start 0x54000000
bootm loados 0x54000000
bootm ramdisk;
bootm prep;
fdt memory 0x40000000 0x20000000
bootm go;

Quoted 2 lines

Hope either of the above are helpful,
Conor.

Ah, I see, thanks for the pointers. I've got whatever firmware came with the "dd and go" Fedora image I found on the internet somewhere, which doesn't seem to do the memory node population for me. I've been hesitant to rebuild the firmware as I don't want to break the Fedora "safe OS", and if there's a way to get mired in some build environment, I seem to have a nose for finding it.

I'll probably just keep the patch locally in my tree, and if I'm forced to update the firmware for some other reason I'll try removing it.

-Evan