diff mbox series

[RFC] riscv: dts: nezha-d1: Add memory

Message ID 20230331182727.4062790-1-evan@rivosinc.com (mailing list archive)
State Handled Elsewhere
Headers show
Series [RFC] riscv: dts: nezha-d1: Add memory | expand

Checks

Context Check Description
conchuod/cover_letter success Single patches do not need cover letters
conchuod/tree_selection success Guessed tree name to be for-next at HEAD d34a6b715a23
conchuod/fixes_present success Fixes tag not required for -next series
conchuod/maintainers_pattern success MAINTAINERS pattern errors before the patch: 1 and now 1
conchuod/verify_signedoff success Signed-off-by tag matches author and committer
conchuod/kdoc success Errors and warnings before: 0 this patch: 0
conchuod/build_rv64_clang_allmodconfig success Errors and warnings before: 18 this patch: 18
conchuod/module_param success Was 0 now: 0
conchuod/build_rv64_gcc_allmodconfig success Errors and warnings before: 18 this patch: 18
conchuod/build_rv32_defconfig success Build OK
conchuod/dtb_warn_rv64 success Errors and warnings before: 3 this patch: 3
conchuod/header_inline success No static functions without inline keyword in header files
conchuod/checkpatch success total: 0 errors, 0 warnings, 0 checks, 12 lines checked
conchuod/source_inline success Was 0 now: 0
conchuod/build_rv64_nommu_k210_defconfig success Build OK
conchuod/verify_fixes success No Fixes tag
conchuod/build_rv64_nommu_virt_defconfig success Build OK

Commit Message

Evan Green March 31, 2023, 6:27 p.m. UTC
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?

Signed-off-by: Evan Green <evan@rivosinc.com>

---

 arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Conor Dooley March 31, 2023, 6:39 p.m. UTC | #1
On Fri, Mar 31, 2023 at 11:27:27AM -0700, Evan Green wrote:
> 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/8a2194bf-93bd-de4d-8d39-0cd72aabb0a9@sholland.org/

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.

> 
> Signed-off-by: Evan Green <evan@rivosinc.com>
> 
> ---
> 
>  arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts b/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts
> index 4ed33c1e7c9c..6aba68cf5541 100644
> --- a/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts
> +++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts
> @@ -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;
> -- 
> 2.25.1
>
Evan Green March 31, 2023, 7:02 p.m. UTC | #2
On Fri, Mar 31, 2023 at 11:39 AM Conor Dooley <conor@kernel.org> wrote:
>
> On Fri, Mar 31, 2023 at 11:27:27AM -0700, Evan Green wrote:
> > 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/8a2194bf-93bd-de4d-8d39-0cd72aabb0a9@sholland.org/
>
> 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.

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
diff mbox series

Patch

diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts b/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts
index 4ed33c1e7c9c..6aba68cf5541 100644
--- a/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts
+++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts
@@ -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;