diff mbox

[U-Boot,RFC,1/1] meson-gx: reserved memory regions

Message ID 20170609154302.1514-1-xypron.glpk@gmx.de
State RFC
Delegated to: Tom Rini
Headers show

Commit Message

From: Heinrich Schuchardt <xypron.glpk@gmx.de>

The Odroid C2 has two GiB of memory with two reserved regions.
reg = <0x0 0x0 0x0 0x1000000>;
reg = <0x0 0x10000000 0x0 0x200000>;

The description has been created with the following patches:

Patch
bfcef28ae4cf (arm: add initial support for Amlogic Meson and ODROID-C2)
defined the available memory in arch/arm/dts/meson-gxbb-odroidc2.dts
as reg = <0x0 0x0 0x0 0x80000000> and the number of RAM banks
as #define CONFIG_NR_DRAM_BANKS 1.

Patch
4b3ab59d21ef (configs: gxbb: Introduce a common config header file)
moved the number of RAM banks to include/configs/meson-gxbb-common.h.

Patch
a3b02a1d4926 (arm: dts: update Meson GXBB / Odroid-C2 DT with recent)
defined two reserved memory regions in arch/arm/dts/meson-gx.dtsi.

U-Boot does not support the concept of reserved memory regions.

Amongst other mishaps this leads to a wrong memory configuration when
calling bootefi which may cause a memory violation.

The easiest way to correct this is to define multiple memory banks.

In the long run fdt support for reserved-memory might be implemented.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 arch/arm/dts/meson-gxbb-odroidc2.dts | 7 ++++++-
 include/configs/meson-gxbb-common.h  | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

Comments

Andreas Färber June 9, 2017, 4:32 p.m. UTC | #1
Am 09.06.2017 um 17:43 schrieb Heinrich@suse.de:
> From: Heinrich Schuchardt <xypron.glpk@gmx.de>
> 
> The Odroid C2 has two GiB of memory with two reserved regions.
> reg = <0x0 0x0 0x0 0x1000000>;
> reg = <0x0 0x10000000 0x0 0x200000>;
> 
> The description has been created with the following patches:
> 
> Patch
> bfcef28ae4cf (arm: add initial support for Amlogic Meson and ODROID-C2)
> defined the available memory in arch/arm/dts/meson-gxbb-odroidc2.dts
> as reg = <0x0 0x0 0x0 0x80000000> and the number of RAM banks
> as #define CONFIG_NR_DRAM_BANKS 1.
> 
> Patch
> 4b3ab59d21ef (configs: gxbb: Introduce a common config header file)
> moved the number of RAM banks to include/configs/meson-gxbb-common.h.
> 
> Patch
> a3b02a1d4926 (arm: dts: update Meson GXBB / Odroid-C2 DT with recent)
> defined two reserved memory regions in arch/arm/dts/meson-gx.dtsi.
> 
> U-Boot does not support the concept of reserved memory regions.
> 
> Amongst other mishaps this leads to a wrong memory configuration when
> calling bootefi which may cause a memory violation.

Please share what symptoms you are seeing. I have been using bootefi
with GRUB without problems for many months on Odroid-C2, Vega S95 and
recently NanoPi K2. v4.12-rc3 was probably the last kernel I tested.

> 
> The easiest way to correct this is to define multiple memory banks.
> 
> In the long run fdt support for reserved-memory might be implemented.

Have you looked into that at all? It seems a one-time change that would
benefit all platforms rather than a single board here. I'd imagine a
simple loop over sub-nodes of /reserved-memory that then calls the
existing EFI memory reservation function. (In particular I would hope
that might fix e.g. 32-bit sunxi.)

> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  arch/arm/dts/meson-gxbb-odroidc2.dts | 7 ++++++-
>  include/configs/meson-gxbb-common.h  | 2 +-
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/dts/meson-gxbb-odroidc2.dts b/arch/arm/dts/meson-gxbb-odroidc2.dts
> index c737183a29..35b8300e23 100644
> --- a/arch/arm/dts/meson-gxbb-odroidc2.dts
> +++ b/arch/arm/dts/meson-gxbb-odroidc2.dts
> @@ -61,7 +61,12 @@
>  
>  	memory@0 {
>  		device_type = "memory";
> -		reg = <0x0 0x0 0x0 0x80000000>;
> +		reg =<0x0 0x1000000 0x0 0xf000000>;
> +	};
> +
> +	memory@1 {

This is wrong. memory@10200000 if at all.

> +		device_type = "memory";
> +		reg = <0x0 0x10200000 0x0 0x6fe00000>;

Please don't randomly modify the .dts in ways incompatible with Linux.

If we need two DRAM banks, then this needs to be implemented in board or
mach code.

Regards,
Andreas

>  	};
>  
>  	usb_otg_pwr: regulator-usb-pwrs {
> diff --git a/include/configs/meson-gxbb-common.h b/include/configs/meson-gxbb-common.h
> index 89e3807a14..ed55f441a4 100644
> --- a/include/configs/meson-gxbb-common.h
> +++ b/include/configs/meson-gxbb-common.h
> @@ -10,7 +10,7 @@
>  
>  #define CONFIG_CPU_ARMV8
>  #define CONFIG_REMAKE_ELF
> -#define CONFIG_NR_DRAM_BANKS		1
> +#define CONFIG_NR_DRAM_BANKS		2
>  #define CONFIG_ENV_IS_NOWHERE		1
>  #define CONFIG_ENV_SIZE			0x2000
>  #define CONFIG_SYS_MAXARGS		32
>
diff mbox

Patch

diff --git a/arch/arm/dts/meson-gxbb-odroidc2.dts b/arch/arm/dts/meson-gxbb-odroidc2.dts
index c737183a29..35b8300e23 100644
--- a/arch/arm/dts/meson-gxbb-odroidc2.dts
+++ b/arch/arm/dts/meson-gxbb-odroidc2.dts
@@ -61,7 +61,12 @@ 
 
 	memory@0 {
 		device_type = "memory";
-		reg = <0x0 0x0 0x0 0x80000000>;
+		reg =<0x0 0x1000000 0x0 0xf000000>;
+	};
+
+	memory@1 {
+		device_type = "memory";
+		reg = <0x0 0x10200000 0x0 0x6fe00000>;
 	};
 
 	usb_otg_pwr: regulator-usb-pwrs {
diff --git a/include/configs/meson-gxbb-common.h b/include/configs/meson-gxbb-common.h
index 89e3807a14..ed55f441a4 100644
--- a/include/configs/meson-gxbb-common.h
+++ b/include/configs/meson-gxbb-common.h
@@ -10,7 +10,7 @@ 
 
 #define CONFIG_CPU_ARMV8
 #define CONFIG_REMAKE_ELF
-#define CONFIG_NR_DRAM_BANKS		1
+#define CONFIG_NR_DRAM_BANKS		2
 #define CONFIG_ENV_IS_NOWHERE		1
 #define CONFIG_ENV_SIZE			0x2000
 #define CONFIG_SYS_MAXARGS		32