rpi: fix dram bank initialization
PATCH 1/2 rpi: fix dram bank initialization
From: Matthias Brugger <[email protected]>
To update the dram bank information from device-tree we use fdtdec_decode_ram_size() which expectes the the size-cells and address-cells to be defined in the memory node. For normal system RAM these values are defined in the root node. When the values differ from the default values defined in the spec, we can end up with wrong RAM bank information.
Switch to the "standard" way to update the RAM bank information to avoid this.
---
board/raspberrypi/rpi/rpi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
board/raspberrypi/rpi/rpi.c +7 -2
@@ -274,8 +274,13 @@ int dram_init(void)#ifdef CONFIG_BCM2711 int dram_init_banksize (void ) { -return fdtdec_decode_ram_size (gd->fdt_blob,NULL ,0 ,NULL , - (phys_size_t *)&gd->ram_size, gd->bd); +int ret; + + ret =fdtdec_setup_memory_banksize (); +if (ret) +return ret; + +return fdtdec_setup_mem_size_base (); }#endif #endif
Signature · 1 line
2.24.0
PATCH 2/2 rpi: Enable DRAM bank initialization on arm64
From: Matthias Brugger <[email protected]>
Up to now we only update the DRAM banks when we are define CONFIG_BCM2711. But our one binary approach uses a config that supports BCM2837 and BCM2711. As a result we only see one gigabyte of RAM on Raspberry Pi 4, although it has more RAM.
Fix this by calling dram_init_banksize when we are booting a U-Boot build for arm64.
---
board/raspberrypi/rpi/rpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/raspberrypi/rpi/rpi.c +1 -1
@@ -271,7 +271,7 @@ int dram_init(void) } #ifdef CONFIG_OF_BOARD -#ifdef CONFIG_BCM2711 +#ifdef CONFIG_ARM64 int dram_init_banksize(void) { int ret;
Signature · 1 line
2.24.0
PATCH 2/2 rpi: Enable DRAM bank initialization on arm64
Quoted 5 lines · matthias.bgg at kernel.org
From: Matthias Brugger <[email protected]>
Up to now we only update the DRAM banks when we are define
CONFIG_BCM2711. But our one binary approach uses a config that supports BCM2837 and BCM2711. As a result we only see one gigabyte of RAM on
%s/gigabyte/gibibyte/
There are RPi 4 with 1GiB, 2GiB, 4GiB. All have more than 1 GB but only some have more than 1GiB.
Quoted 1 line
Raspberry Pi 4, although it has more RAM.
I guess this should be changed to "even if it has more RAM" as you can also buy a RPi 4 with 1 GiB of RAM.
Quoted 17 lines
Fix this by calling
dram_init_banksizewhen we are booting a U-Boot build for arm64.Fixes 5694090670 ("ARM: defconfig: add unified config for RPi3 and RPi4")Signed-off-by Matthias Brugger <[email protected]>---
board/raspberrypi/rpi/rpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)board/raspberrypi/rpi/rpi.c +0
-0
board/raspberrypi/rpi/rpi.c int dram_init(void) · line 274
Quoted 5 lines
board/raspberrypi/rpi/rpi.c +1
-1@@ -271,7 +271,7 @@ int dram_init(void) }#ifdef CONFIG_OF_BOARD -#ifdef CONFIG_BCM2711 +#ifdef CONFIG_ARM64
The change does not relate to your commit message.
Please, explain why you enable fdtdec_decode_ram_size() on the RPi 3 in 64bit configuration and disables it on the RPi 4 in 32bit configuration.
What happens here if we have a RPi 4 with more than 1 GiB of memory and use a 32bit U-Boot?
Best regards
Heinrich
Quoted 4 lines
board/raspberrypi/rpi/rpi.c +0
-0int dram_init_banksize (void ) {int ret;
PATCH 2/2 rpi: Enable DRAM bank initialization on arm64
Quoted 36 lines · Heinrich Schuchardt
Quoted 5 lines · matthias.bgg at kernel.org
From: Matthias Brugger <[email protected]>
Up to now we only update the DRAM banks when we are define
CONFIG_BCM2711. But our one binary approach uses a config that supports BCM2837 and BCM2711. As a result we only see one gigabyte of RAM on%s/gigabyte/gibibyte/
There are RPi 4 with 1GiB, 2GiB, 4GiB. All have more than 1 GB but only some have more than 1GiB.
Quoted 1 line
Raspberry Pi 4, although it has more RAM.
I guess this should be changed to "even if it has more RAM" as you can also buy a RPi 4 with 1 GiB of RAM.
Quoted 19 lines
Fix this by calling
dram_init_banksizewhen we are booting a U-Boot build for arm64.Fixes 5694090670 ("ARM: defconfig: add unified config for RPi3 and RPi4")Signed-off-by Matthias Brugger <[email protected]>---
board/raspberrypi/rpi/rpi.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)board/raspberrypi/rpi/rpi.c +0
-0@@ -271,7 +271,7 @@ int dram_init(void) }
Quoted 9 lines
board/raspberrypi/rpi/rpi.c int dram_init(void) · line 274
Quoted 3 lines
board/raspberrypi/rpi/rpi.c +1
-1#ifdef CONFIG_OF_BOARD -#ifdef CONFIG_BCM2711 +#ifdef CONFIG_ARM64 The change does not relate to your commit message.
Please, explain why you enable
fdtdec_decode_ram_size()on the RPi 3 in 64bit configuration and disables it on the RPi 4 in 32bit configuration.
Right, I'll test with 32 bit, but I think it does no harm. Will delete the ARM64 ifdef.
Quoted 3 lines
What happens here if we have a RPi 4 with more than 1 GiB of memory and use a 32bit U-Boot?
Just tested that. It will always show you 1 GiB of memory because the rpi_4_32b_defconfig states only one DRAM banks. I'll fix this as well.
Regards,
Matthias
Quoted 9 lines
Best regards
Heinrich
Quoted 4 lines
board/raspberrypi/rpi/rpi.c +0
-0int dram_init_banksize(void) { int ret;