All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] rpi: fix dram bank initialization
@ 2019-12-04 16:52 matthias.bgg at kernel.org
  2019-12-04 16:52 ` [PATCH 2/2] rpi: Enable DRAM bank initialization on arm64 matthias.bgg at kernel.org
  0 siblings, 1 reply; 4+ messages in thread
From: matthias.bgg at kernel.org @ 2019-12-04 16:52 UTC (permalink / raw)
  To: u-boot

From: Matthias Brugger <mbrugger@suse.com>

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.

Fixes: 9de5b89e4c ("rpi4: enable dram bank initialization")

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

 board/raspberrypi/rpi/rpi.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] rpi: Enable DRAM bank initialization on arm64
  2019-12-04 16:52 [PATCH 1/2] rpi: fix dram bank initialization matthias.bgg at kernel.org
@ 2019-12-04 16:52 ` matthias.bgg at kernel.org
  2019-12-04 21:28   ` Heinrich Schuchardt
  0 siblings, 1 reply; 4+ messages in thread
From: matthias.bgg at kernel.org @ 2019-12-04 16:52 UTC (permalink / raw)
  To: u-boot

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(-)

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;
-- 
2.24.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] rpi: Enable DRAM bank initialization on arm64
  2019-12-04 16:52 ` [PATCH 2/2] rpi: Enable DRAM bank initialization on arm64 matthias.bgg at kernel.org
@ 2019-12-04 21:28   ` Heinrich Schuchardt
  2019-12-05 16:58     ` Matthias Brugger
  0 siblings, 1 reply; 4+ messages in thread
From: Heinrich Schuchardt @ 2019-12-04 21:28 UTC (permalink / raw)
  To: u-boot

On 12/4/19 5:52 PM, matthias.bgg at 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;
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] rpi: Enable DRAM bank initialization on arm64
  2019-12-04 21:28   ` Heinrich Schuchardt
@ 2019-12-05 16:58     ` Matthias Brugger
  0 siblings, 0 replies; 4+ messages in thread
From: Matthias Brugger @ 2019-12-05 16:58 UTC (permalink / raw)
  To: u-boot



On 04/12/2019 22:28, Heinrich Schuchardt wrote:
> On 12/4/19 5:52 PM, matthias.bgg at 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;
>>
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-05 16:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-04 16:52 [PATCH 1/2] rpi: fix dram bank initialization matthias.bgg at kernel.org
2019-12-04 16:52 ` [PATCH 2/2] rpi: Enable DRAM bank initialization on arm64 matthias.bgg at kernel.org
2019-12-04 21:28   ` Heinrich Schuchardt
2019-12-05 16:58     ` Matthias Brugger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.