[PATCH 1/2] mvebu: make boards pass initial memory size

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Fri Feb 10 07:50:59 PST 2017


While assuming SZ_64M initially is save and fixed up later, the size of the
malloc area is determined from this value. So it might make sense for some
boards to pass the correct version from the start to have more RAM available
for example to write big images into an FPGA.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
---
 arch/arm/boards/globalscale-guruplug/lowlevel.c    |  2 +-
 arch/arm/boards/globalscale-mirabox/lowlevel.c     |  2 +-
 arch/arm/boards/lenovo-ix4-300d/lowlevel.c         |  2 +-
 arch/arm/boards/marvell-armada-xp-gp/lowlevel.c    |  2 +-
 arch/arm/boards/netgear-rn104/lowlevel.c           |  2 +-
 arch/arm/boards/netgear-rn2120/lowlevel.c          |  2 +-
 arch/arm/boards/plathome-openblocks-a6/lowlevel.c  |  2 +-
 arch/arm/boards/plathome-openblocks-ax3/lowlevel.c |  2 +-
 arch/arm/boards/solidrun-cubox/lowlevel.c          |  2 +-
 arch/arm/boards/usi-topkick/lowlevel.c             |  2 +-
 arch/arm/mach-mvebu/include/mach/lowlevel.h        |  2 +-
 arch/arm/mach-mvebu/lowlevel.c                     | 15 +++++++--------
 12 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/arch/arm/boards/globalscale-guruplug/lowlevel.c b/arch/arm/boards/globalscale-guruplug/lowlevel.c
index 91bc1cf5655e..8ec381710025 100644
--- a/arch/arm/boards/globalscale-guruplug/lowlevel.c
+++ b/arch/arm/boards/globalscale-guruplug/lowlevel.c
@@ -31,5 +31,5 @@ ENTRY_FUNCTION(start_globalscale_guruplug, r0, r1, r2)
 	fdt = __dtb_kirkwood_guruplug_server_plus_bb_start -
 		get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/boards/globalscale-mirabox/lowlevel.c b/arch/arm/boards/globalscale-mirabox/lowlevel.c
index 4f55d1acb9d3..1915671db727 100644
--- a/arch/arm/boards/globalscale-mirabox/lowlevel.c
+++ b/arch/arm/boards/globalscale-mirabox/lowlevel.c
@@ -31,5 +31,5 @@ ENTRY_FUNCTION(start_globalscale_mirabox, r0, r1, r2)
 	fdt = __dtb_armada_370_mirabox_bb_start -
 		get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/boards/lenovo-ix4-300d/lowlevel.c b/arch/arm/boards/lenovo-ix4-300d/lowlevel.c
index 8cb8bd40791c..1c346fc1cff5 100644
--- a/arch/arm/boards/lenovo-ix4-300d/lowlevel.c
+++ b/arch/arm/boards/lenovo-ix4-300d/lowlevel.c
@@ -31,5 +31,5 @@ ENTRY_FUNCTION(start_lenovo_ix4_300d, r0, r1, r2)
 	fdt = __dtb_armada_xp_lenovo_ix4_300d_bb_start -
 		get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/boards/marvell-armada-xp-gp/lowlevel.c b/arch/arm/boards/marvell-armada-xp-gp/lowlevel.c
index 59eaa29a5028..428f41429478 100644
--- a/arch/arm/boards/marvell-armada-xp-gp/lowlevel.c
+++ b/arch/arm/boards/marvell-armada-xp-gp/lowlevel.c
@@ -30,5 +30,5 @@ ENTRY_FUNCTION(start_marvell_armada_xp_gp, r0, r1, r2)
 
 	fdt = __dtb_armada_xp_gp_bb_start - get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/boards/netgear-rn104/lowlevel.c b/arch/arm/boards/netgear-rn104/lowlevel.c
index f0d6df0da645..bdb860f3d2dc 100644
--- a/arch/arm/boards/netgear-rn104/lowlevel.c
+++ b/arch/arm/boards/netgear-rn104/lowlevel.c
@@ -18,5 +18,5 @@ ENTRY_FUNCTION(start_netgear_rn104, r0, r1, r2)
 	fdt = __dtb_armada_370_rn104_bb_start -
 		get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/boards/netgear-rn2120/lowlevel.c b/arch/arm/boards/netgear-rn2120/lowlevel.c
index 29c8b43c4467..6df5235a2229 100644
--- a/arch/arm/boards/netgear-rn2120/lowlevel.c
+++ b/arch/arm/boards/netgear-rn2120/lowlevel.c
@@ -37,5 +37,5 @@ ENTRY_FUNCTION(start_netgear_rn2120, r0, r1, r2)
 	fdt = __dtb_armada_xp_rn2120_bb_start -
 		get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/boards/plathome-openblocks-a6/lowlevel.c b/arch/arm/boards/plathome-openblocks-a6/lowlevel.c
index 71bf7aa2ee7c..fa62136705a5 100644
--- a/arch/arm/boards/plathome-openblocks-a6/lowlevel.c
+++ b/arch/arm/boards/plathome-openblocks-a6/lowlevel.c
@@ -28,5 +28,5 @@ ENTRY_FUNCTION(start_plathome_openblocks_a6, r0, r1, r2)
 	fdt = __dtb_kirkwood_openblocks_a6_bb_start -
 		get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/boards/plathome-openblocks-ax3/lowlevel.c b/arch/arm/boards/plathome-openblocks-ax3/lowlevel.c
index 9030a5d0c8cb..c47c2cf1e5bb 100644
--- a/arch/arm/boards/plathome-openblocks-ax3/lowlevel.c
+++ b/arch/arm/boards/plathome-openblocks-ax3/lowlevel.c
@@ -31,5 +31,5 @@ ENTRY_FUNCTION(start_plathome_openblocks_ax3, r0, r1, r2)
 	fdt = __dtb_armada_xp_openblocks_ax3_4_bb_start -
 		get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/boards/solidrun-cubox/lowlevel.c b/arch/arm/boards/solidrun-cubox/lowlevel.c
index 08e31e83507d..6130c64893ca 100644
--- a/arch/arm/boards/solidrun-cubox/lowlevel.c
+++ b/arch/arm/boards/solidrun-cubox/lowlevel.c
@@ -31,5 +31,5 @@ ENTRY_FUNCTION(start_solidrun_cubox, r0, r1, r2)
 
 	fdt = __dtb_dove_cubox_bb_start - get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/boards/usi-topkick/lowlevel.c b/arch/arm/boards/usi-topkick/lowlevel.c
index ed94ee673679..6d6692b79818 100644
--- a/arch/arm/boards/usi-topkick/lowlevel.c
+++ b/arch/arm/boards/usi-topkick/lowlevel.c
@@ -30,5 +30,5 @@ ENTRY_FUNCTION(start_usi_topkick, r0, r1, r2)
 
 	fdt = __dtb_kirkwood_topkick_bb_start - get_runtime_offset();
 
-	mvebu_barebox_entry(fdt);
+	mvebu_barebox_entry(fdt, SZ_64M);
 }
diff --git a/arch/arm/mach-mvebu/include/mach/lowlevel.h b/arch/arm/mach-mvebu/include/mach/lowlevel.h
index c922a27a7c62..572ad4c688f8 100644
--- a/arch/arm/mach-mvebu/include/mach/lowlevel.h
+++ b/arch/arm/mach-mvebu/include/mach/lowlevel.h
@@ -18,6 +18,6 @@
 #ifndef __MACH_LOWLEVEL_H__
 #define __MACH_LOWLEVEL_H__
 
-void mvebu_barebox_entry(void *boarddata);
+void mvebu_barebox_entry(void *boarddata, unsigned long memsize);
 
 #endif
diff --git a/arch/arm/mach-mvebu/lowlevel.c b/arch/arm/mach-mvebu/lowlevel.c
index 8d0ac8453ea3..e4c2131076ba 100644
--- a/arch/arm/mach-mvebu/lowlevel.c
+++ b/arch/arm/mach-mvebu/lowlevel.c
@@ -26,7 +26,7 @@
 void __naked barebox_arm_reset_vector(void)
 {
 	arm_cpu_lowlevel_init();
-	mvebu_barebox_entry(NULL);
+	mvebu_barebox_entry(NULL, SZ_64M);
 }
 
 /*
@@ -50,16 +50,15 @@ static void mvebu_remap_registers(void)
 
 /*
  * Determining the actual memory size is highly SoC dependent,
- * but for all SoCs RAM starts at 0x00000000. Therefore, we start
- * with a minimal memory setup of 64M and probe correct memory size
- * later.
+ * but for all SoCs RAM starts at 0x00000000. If the available RAM isn't known
+ * at the call-site of mvebu_barebox_entry, using a value that is not too big is
+ * safe. The correct memory size will be probed later.
  */
 #define MVEBU_BOOTUP_MEMORY_BASE	0x00000000
-#define MVEBU_BOOTUP_MEMORY_SIZE	SZ_64M
 
-void __naked __noreturn mvebu_barebox_entry(void *boarddata)
+void __naked __noreturn mvebu_barebox_entry(void *boarddata,
+					    unsigned long memsize)
 {
 	mvebu_remap_registers();
-	barebox_arm_entry(MVEBU_BOOTUP_MEMORY_BASE,
-			  MVEBU_BOOTUP_MEMORY_SIZE, boarddata);
+	barebox_arm_entry(MVEBU_BOOTUP_MEMORY_BASE, memsize, boarddata);
 }
-- 
2.11.0




More information about the barebox mailing list