diff mbox series

[2/2] rpi: Enable DRAM bank initialization on arm64

Message ID 20191204165242.22463-2-matthias.bgg@kernel.org
State Superseded
Delegated to: Matthias Brugger
Headers show
Series [1/2] rpi: fix dram bank initialization | expand

Commit Message

Matthias Brugger Dec. 4, 2019, 4:52 p.m. UTC
From: Matthias Brugger <mbrugger@suse.com>

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.

Fixes: 5694090670 ("ARM: defconfig: add unified config for RPi3 and RPi4")

Signed-off-by: Matthias Brugger <mbrugger@suse.com>

---

 board/raspberrypi/rpi/rpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Heinrich Schuchardt Dec. 4, 2019, 9:28 p.m. UTC | #1
On 12/4/19 5:52 PM, matthias.bgg@kernel.org wrote:
> From: Matthias Brugger <mbrugger@suse.com>
>
> 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.

> 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.

> Fix this by calling dram_init_banksize when 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 <mbrugger@suse.com>
>
> ---
>
>   board/raspberrypi/rpi/rpi.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
> index 76f1c55b65..35fcef2b56 100644
> --- a/board/raspberrypi/rpi/rpi.c
> +++ b/board/raspberrypi/rpi/rpi.c
> @@ -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

>   int dram_init_banksize(void)
>   {
>   	int ret;
>
Matthias Brugger Dec. 5, 2019, 4:58 p.m. UTC | #2
On 04/12/2019 22:28, Heinrich Schuchardt wrote:
> On 12/4/19 5:52 PM, matthias.bgg@kernel.org wrote:
>> From: Matthias Brugger <mbrugger@suse.com>
>>
>> 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.
> 
>> 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.
> 
>> Fix this by calling dram_init_banksize when 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 <mbrugger@suse.com>
>>
>> ---
>>
>>   board/raspberrypi/rpi/rpi.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
>> index 76f1c55b65..35fcef2b56 100644
>> --- a/board/raspberrypi/rpi/rpi.c
>> +++ b/board/raspberrypi/rpi/rpi.c
>> @@ -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.
> 

Right, I'll test with 32 bit, but I think it does no harm. Will delete the ARM64
ifdef.

> 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

> Best regards
> 
> Heinrich
> 
>>   int dram_init_banksize(void)
>>   {
>>       int ret;
>>
>
diff mbox series

Patch

diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 76f1c55b65..35fcef2b56 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -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;