All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 00/10] make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN
@ 2017-07-24  9:42 Andy Yan
  2017-07-24  9:43 ` [U-Boot] [PATCH v3 01/10] " Andy Yan
                   ` (9 more replies)
  0 siblings, 10 replies; 47+ messages in thread
From: Andy Yan @ 2017-07-24  9:42 UTC (permalink / raw)
  To: u-boot


Some platforms like RK3036 has very small sram to run spl code, so
it has no enough sapce for so much malloc pool before relocation in
spl stage as the normal u-boot stage.
As the long discussion in [1] [2], I make this series out, try to
make spl and normal u-boot stage use independent SYS_MALLOC_F_LEN.

[1]https://lists.denx.de/pipermail/u-boot/2017-July/297370.html
[2]https://lists.denx.de/pipermail/u-boot/2017-July/297504.html


Changes in v3:
- use CONFIG_VAL(), which suggested by Simon
- disable SPL_DM_SERIAL
- use puts instead of printf, which suggested by Simon

Changes in v2:
- introduce a new control CONFIG_SPL_SYS_MALLOC_F_LEN, adviced by Simon

Andy Yan (10):
  make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN
  mips: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  powerpc: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  microblaze: spl and normal u-boot stage set SYS_MALLOC_F_LEN
    indepently
  sandbox: use CONFIG_VAL(SYS_MALLOC_F_LEN) to distinguish malloc pool
    size before relocation
  rockchip: set malloc pool size to 0 before relocation in spl state on
    rk3036 based board
  rockchip: disable SPL_ARCH_MEMCPY/MEMSET for rk3036
  rockchip: enable SPL_LIBGENERIC for rk3036 based boards
  rockchip: use puts instead of printf when back to bootrom
  rockchip: add u-boot specific dts for rk3036 sdk

 Kconfig                                   | 10 ++++++++++
 arch/arm/dts/rk3036-sdk-u-boot.dtsi       | 11 +++++++++++
 arch/arm/mach-rockchip/bootrom.c          |  4 ++--
 arch/arm/mach-rockchip/rk3036-board-spl.c |  6 ------
 arch/microblaze/cpu/start.S               |  8 ++++----
 arch/mips/cpu/start.S                     |  6 +++---
 arch/powerpc/cpu/mpc83xx/start.S          |  8 ++++----
 arch/powerpc/cpu/mpc85xx/start.S          | 11 +++++------
 arch/sandbox/cpu/start.c                  |  2 +-
 cmd/bdinfo.c                              |  4 ++--
 common/Makefile                           |  4 +++-
 common/board_f.c                          |  4 ++--
 common/board_r.c                          |  2 +-
 common/dlmalloc.c                         | 12 ++++++------
 common/init/board_init.c                  |  8 ++++----
 common/spl/spl.c                          |  8 ++++----
 configs/evb-rk3036_defconfig              |  7 ++++++-
 configs/kylin-rk3036_defconfig            |  7 ++++++-
 drivers/core/Kconfig                      |  8 ++++----
 drivers/serial/serial-uclass.c            |  4 ++--
 include/asm-generic/global_data.h         |  2 +-
 lib/asm-offsets.c                         |  2 +-
 lib/efi/efi_app.c                         |  2 +-
 23 files changed, 83 insertions(+), 57 deletions(-)
 create mode 100644 arch/arm/dts/rk3036-sdk-u-boot.dtsi

-- 
2.7.4

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

* [U-Boot] [PATCH v3 01/10] make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN
  2017-07-24  9:42 [U-Boot] [PATCH v3 00/10] make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN Andy Yan
@ 2017-07-24  9:43 ` Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
                     ` (2 more replies)
  2017-07-24  9:45 ` [U-Boot] [PATCH v3 02/10] mips: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently Andy Yan
                   ` (8 subsequent siblings)
  9 siblings, 3 replies; 47+ messages in thread
From: Andy Yan @ 2017-07-24  9:43 UTC (permalink / raw)
  To: u-boot

Some platforms has very small sram to run spl code, so it has no
enough sapce for so much malloc pool before relocation in
spl stage as the normal u-boot stage.
Make spl and normal u-boot stage use independent SYS_MALLOC_F_LEN,
Then people can sets the pre-relocation malloc pool according to
the memory space indepently.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

---

Changes in v3:
- use CONFIG_VAL(), which suggested by Simon

Changes in v2:
- introduce a new control CONFIG_SPL_SYS_MALLOC_F_LEN, adviced by Simon

 Kconfig                           | 10 ++++++++++
 cmd/bdinfo.c                      |  4 ++--
 common/Makefile                   |  4 +++-
 common/board_f.c                  |  4 ++--
 common/board_r.c                  |  2 +-
 common/dlmalloc.c                 | 12 ++++++------
 common/init/board_init.c          |  8 ++++----
 common/spl/spl.c                  |  8 ++++----
 drivers/core/Kconfig              |  8 ++++----
 drivers/serial/serial-uclass.c    |  4 ++--
 include/asm-generic/global_data.h |  2 +-
 lib/asm-offsets.c                 |  2 +-
 lib/efi/efi_app.c                 |  2 +-
 13 files changed, 41 insertions(+), 29 deletions(-)

diff --git a/Kconfig b/Kconfig
index bb80ada..c1451bc 100644
--- a/Kconfig
+++ b/Kconfig
@@ -95,6 +95,16 @@ config SYS_MALLOC_F_LEN
 	  particular needs this to operate, so that it can allocate the
 	  initial serial device and any others that are needed.
 
+config SPL_SYS_MALLOC_F_LEN
+        hex "Size of malloc() pool in spl before relocation"
+        depends on SYS_MALLOC_F
+        default SYS_MALLOC_F_LEN
+        help
+          Before relocation, memory is very limited on many platforms. Still,
+          we can provide a small malloc() pool if needed. Driver model in
+          particular needs this to operate, so that it can allocate the
+          initial serial device and any others that are needed.
+
 menuconfig EXPERT
 	bool "Configure standard U-Boot features (expert users)"
 	default y
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 8971697..81ac78d 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -344,9 +344,9 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
 #ifdef CONFIG_BOARD_TYPES
 	printf("Board Type  = %ld\n", gd->board_type);
 #endif
-#ifdef CONFIG_SYS_MALLOC_F
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
 	printf("Early malloc usage: %lx / %x\n", gd->malloc_ptr,
-	       CONFIG_SYS_MALLOC_F_LEN);
+	       CONFIG_VAL(SYS_MALLOC_F_LEN));
 #endif
 	if (gd->fdt_blob)
 		printf("fdt_blob = %p\n", gd->fdt_blob);
diff --git a/common/Makefile b/common/Makefile
index 17a92ea..60681c8 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -139,9 +139,11 @@ obj-y += console.o
 endif
 obj-$(CONFIG_CROS_EC) += cros_ec.o
 obj-y += dlmalloc.o
-ifdef CONFIG_SYS_MALLOC_F_LEN
+ifdef CONFIG_SYS_MALLOC_F
+ifneq ($(CONFIG_$(SPL_)SYS_MALLOC_F_LEN),0)
 obj-y += malloc_simple.o
 endif
+endif
 obj-y += image.o
 obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o
 obj-$(CONFIG_$(SPL_)OF_LIBFDT) += image-fdt.o
diff --git a/common/board_f.c b/common/board_f.c
index ffa84e3..a2af660 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -727,7 +727,7 @@ static int initf_bootstage(void)
 
 static int initf_console_record(void)
 {
-#if defined(CONFIG_CONSOLE_RECORD) && defined(CONFIG_SYS_MALLOC_F_LEN)
+#if defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)
 	return console_record_init();
 #else
 	return 0;
@@ -736,7 +736,7 @@ static int initf_console_record(void)
 
 static int initf_dm(void)
 {
-#if defined(CONFIG_DM) && defined(CONFIG_SYS_MALLOC_F_LEN)
+#if defined(CONFIG_DM) && CONFIG_VAL(SYS_MALLOC_F_LEN)
 	int ret;
 
 	bootstage_start(BOOTSTATE_ID_ACCUM_DM_F, "dm_f");
diff --git a/common/board_r.c b/common/board_r.c
index ecca1ed..985aa95 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -256,7 +256,7 @@ static int initr_malloc(void)
 {
 	ulong malloc_start;
 
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
 	debug("Pre-reloc malloc() used %#lx bytes (%ld KB)\n", gd->malloc_ptr,
 	      gd->malloc_ptr / 1024);
 #endif
diff --git a/common/dlmalloc.c b/common/dlmalloc.c
index fc1e8b3..c37979b 100644
--- a/common/dlmalloc.c
+++ b/common/dlmalloc.c
@@ -1254,7 +1254,7 @@ Void_t* mALLOc(bytes) size_t bytes;
 
   INTERNAL_SIZE_T nb;
 
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
 	if (!(gd->flags & GD_FLG_FULL_MALLOC_INIT))
 		return malloc_simple(bytes);
 #endif
@@ -1522,7 +1522,7 @@ void fREe(mem) Void_t* mem;
   mchunkptr fwd;       /* misc temp for linking */
   int       islr;      /* track whether merging with last_remainder */
 
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
 	/* free() is a no-op - all the memory will be freed on relocation */
 	if (!(gd->flags & GD_FLG_FULL_MALLOC_INIT))
 		return;
@@ -1679,7 +1679,7 @@ Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes;
   /* realloc of null is supposed to be same as malloc */
   if (oldmem == NULL) return mALLOc(bytes);
 
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
 	if (!(gd->flags & GD_FLG_FULL_MALLOC_INIT)) {
 		/* This is harder to support and should not be needed */
 		panic("pre-reloc realloc() is not supported");
@@ -2074,7 +2074,7 @@ Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size;
     return NULL;
   else
   {
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
 	if (!(gd->flags & GD_FLG_FULL_MALLOC_INIT)) {
 		MALLOC_ZERO(mem, sz);
 		return mem;
@@ -2375,9 +2375,9 @@ int mALLOPt(param_number, value) int param_number; int value;
 
 int initf_malloc(void)
 {
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
 	assert(gd->malloc_base);	/* Set up by crt0.S */
-	gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN;
+	gd->malloc_limit = CONFIG_VAL(SYS_MALLOC_F_LEN);
 	gd->malloc_ptr = 0;
 #endif
 
diff --git a/common/init/board_init.c b/common/init/board_init.c
index bf4255b..4a391be 100644
--- a/common/init/board_init.c
+++ b/common/init/board_init.c
@@ -46,8 +46,8 @@ __weak void arch_setup_gd(struct global_data *gd_ptr)
 ulong board_init_f_alloc_reserve(ulong top)
 {
 	/* Reserve early malloc arena */
-#if defined(CONFIG_SYS_MALLOC_F)
-	top -= CONFIG_SYS_MALLOC_F_LEN;
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+	top -= CONFIG_VAL(SYS_MALLOC_F_LEN);
 #endif
 	/* LAST : reserve GD (rounded up to a multiple of 16 bytes) */
 	top = rounddown(top-sizeof(struct global_data), 16);
@@ -121,11 +121,11 @@ void board_init_f_init_reserve(ulong base)
 	 * Use gd as it is now properly set for all architectures.
 	 */
 
-#if defined(CONFIG_SYS_MALLOC_F)
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
 	/* go down one 'early malloc arena' */
 	gd->malloc_base = base;
 	/* next alloc will be higher by one 'early malloc arena' size */
-	base += CONFIG_SYS_MALLOC_F_LEN;
+	base += CONFIG_VAL(SYS_MALLOC_F_LEN);
 #endif
 }
 
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 7f3fd92..c56cc6f 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -220,12 +220,12 @@ static int spl_common_init(bool setup_malloc)
 
 	debug("spl_early_init()\n");
 
-#if defined(CONFIG_SYS_MALLOC_F_LEN)
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
 	if (setup_malloc) {
 #ifdef CONFIG_MALLOC_F_ADDR
 		gd->malloc_base = CONFIG_MALLOC_F_ADDR;
 #endif
-		gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN;
+		gd->malloc_limit = CONFIG_VAL(SYS_MALLOC_F_LEN);
 		gd->malloc_ptr = 0;
 	}
 #endif
@@ -419,7 +419,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 	default:
 		debug("Unsupported OS image.. Jumping nevertheless..\n");
 	}
-#if defined(CONFIG_SYS_MALLOC_F_LEN) && !defined(CONFIG_SYS_SPL_MALLOC_SIZE)
+#if CONFIG_VAL(SYS_MALLOC_F_LEN) && !defined(CONFIG_SYS_SPL_MALLOC_SIZE)
 	debug("SPL malloc() used %#lx bytes (%ld KB)\n", gd->malloc_ptr,
 	      gd->malloc_ptr / 1024);
 #endif
@@ -486,7 +486,7 @@ ulong spl_relocate_stack_gd(void)
 	gd_t *new_gd;
 	ulong ptr = CONFIG_SPL_STACK_R_ADDR;
 
-#ifdef CONFIG_SPL_SYS_MALLOC_SIMPLE
+#if defined(CONFIG_SPL_SYS_MALLOC_SIMPLE) && CONFIG_SPL_SYS_MALLOC_F_LEN
 	if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN) {
 		ptr -= CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN;
 		gd->malloc_base = ptr;
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig
index fb5c4e8..f8b19a4 100644
--- a/drivers/core/Kconfig
+++ b/drivers/core/Kconfig
@@ -16,10 +16,10 @@ config SPL_DM
 	  suitable malloc() implementation. If you are not using the
 	  full malloc() enabled by CONFIG_SYS_SPL_MALLOC_START,
 	  consider using CONFIG_SYS_MALLOC_SIMPLE. In that case you
-	  must provide CONFIG_SYS_MALLOC_F_LEN to set the size.
+	  must provide CONFIG_SPL_SYS_MALLOC_F_LEN to set the size.
 	  In most cases driver model will only allocate a few uclasses
 	  and devices in SPL, so 1KB should be enable. See
-	  CONFIG_SYS_MALLOC_F_LEN for more details on how to enable it.
+	  CONFIG_SPL_SYS_MALLOC_F_LEN for more details on how to enable it.
 
 config TPL_DM
 	bool "Enable Driver Model for TPL"
@@ -29,10 +29,10 @@ config TPL_DM
 	  suitable malloc() implementation. If you are not using the
 	  full malloc() enabled by CONFIG_SYS_SPL_MALLOC_START,
 	  consider using CONFIG_SYS_MALLOC_SIMPLE. In that case you
-	  must provide CONFIG_SYS_MALLOC_F_LEN to set the size.
+	  must provide CONFIG_SPL_SYS_MALLOC_F_LEN to set the size.
 	  In most cases driver model will only allocate a few uclasses
 	  and devices in SPL, so 1KB should be enough. See
-	  CONFIG_SYS_MALLOC_F_LEN for more details on how to enable it.
+	  CONFIG_SPL_SYS_MALLOC_F_LEN for more details on how to enable it.
 	  Disable this for very small implementations.
 
 config DM_WARN
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index f360534..9cae9fb 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -23,8 +23,8 @@ DECLARE_GLOBAL_DATA_PTR;
  */
 static const unsigned long baudrate_table[] = CONFIG_SYS_BAUDRATE_TABLE;
 
-#ifndef CONFIG_SYS_MALLOC_F_LEN
-#error "Serial is required before relocation - define CONFIG_SYS_MALLOC_F_LEN to make this work"
+#if !CONFIG_VAL(SYS_MALLOC_F_LEN)
+#error "Serial is required before relocation - define CONFIG_$(SPL_)SYS_MALLOC_F_LEN to make this work"
 #endif
 
 static int serial_check_stdout(const void *blob, struct udevice **devp)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index fb90be9..86bf656 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -88,7 +88,7 @@ typedef struct global_data {
 #endif
 	unsigned int timebase_h;
 	unsigned int timebase_l;
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
 	unsigned long malloc_base;	/* base address of early malloc() */
 	unsigned long malloc_limit;	/* limit address */
 	unsigned long malloc_ptr;	/* current address */
diff --git a/lib/asm-offsets.c b/lib/asm-offsets.c
index 221ebbf..b04f7c6 100644
--- a/lib/asm-offsets.c
+++ b/lib/asm-offsets.c
@@ -28,7 +28,7 @@ int main(void)
 	DEFINE(GD_SIZE, sizeof(struct global_data));
 
 	DEFINE(GD_BD, offsetof(struct global_data, bd));
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
 	DEFINE(GD_MALLOC_BASE, offsetof(struct global_data, malloc_base));
 #endif
 
diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c
index 452ab5d..f1afd9c 100644
--- a/lib/efi/efi_app.c
+++ b/lib/efi/efi_app.c
@@ -48,7 +48,7 @@ static efi_status_t setup_memory(struct efi_priv *priv)
 		return ret;
 	memset(gd, '\0', sizeof(*gd));
 
-	gd->malloc_base = (ulong)efi_malloc(priv, CONFIG_SYS_MALLOC_F_LEN,
+	gd->malloc_base = (ulong)efi_malloc(priv, CONFIG_VAL(SYS_MALLOC_F_LEN),
 					    &ret);
 	if (!gd->malloc_base)
 		return ret;
-- 
2.7.4

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

* [U-Boot] [PATCH v3 02/10] mips: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  2017-07-24  9:42 [U-Boot] [PATCH v3 00/10] make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN Andy Yan
  2017-07-24  9:43 ` [U-Boot] [PATCH v3 01/10] " Andy Yan
@ 2017-07-24  9:45 ` Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
                     ` (3 more replies)
  2017-07-24  9:47 ` [U-Boot] [PATCH v3 03/10] powerpc: " Andy Yan
                   ` (7 subsequent siblings)
  9 siblings, 4 replies; 47+ messages in thread
From: Andy Yan @ 2017-07-24  9:45 UTC (permalink / raw)
  To: u-boot

Some platforms has very small sram to run spl code, so
it may have no enough sapce for so much malloc pool before
relocation in spl stage as the normal u-boot stage.
Use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit this condition.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Acked-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>

---

Changes in v3:
- use CONFIG_VAL(), which suggested by Simon

Changes in v2: None

 arch/mips/cpu/start.S | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/cpu/start.S b/arch/mips/cpu/start.S
index d01ee9f..aa07654 100644
--- a/arch/mips/cpu/start.S
+++ b/arch/mips/cpu/start.S
@@ -60,8 +60,8 @@
 		sp, sp, GD_SIZE		# reserve space for gd
 	and	sp, sp, t0		# force 16 byte alignment
 	move	k0, sp			# save gd pointer
-#ifdef CONFIG_SYS_MALLOC_F_LEN
-	li	t2, CONFIG_SYS_MALLOC_F_LEN
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+	li	t2, CONFIG_VAL(SYS_MALLOC_F_LEN)
 	PTR_SUBU \
 		sp, sp, t2		# reserve space for early malloc
 	and	sp, sp, t0		# force 16 byte alignment
@@ -75,7 +75,7 @@
 	blt	t0, t1, 1b
 	 PTR_ADDIU t0, PTRSIZE
 
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
 	PTR_S	sp, GD_MALLOC_BASE(k0)	# gd->malloc_base offset
 #endif
 	.endm
-- 
2.7.4

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

* [U-Boot] [PATCH v3 03/10] powerpc: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  2017-07-24  9:42 [U-Boot] [PATCH v3 00/10] make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN Andy Yan
  2017-07-24  9:43 ` [U-Boot] [PATCH v3 01/10] " Andy Yan
  2017-07-24  9:45 ` [U-Boot] [PATCH v3 02/10] mips: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently Andy Yan
@ 2017-07-24  9:47 ` Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
                     ` (3 more replies)
  2017-07-24  9:49 ` [U-Boot] [PATCH v3 04/10] microblaze: " Andy Yan
                   ` (6 subsequent siblings)
  9 siblings, 4 replies; 47+ messages in thread
From: Andy Yan @ 2017-07-24  9:47 UTC (permalink / raw)
  To: u-boot

Some platforms has very small sram to run spl code, so
it may have no enough sapce for so much malloc pool before
relocation in spl stage as the normal u-boot stage.
Use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit this condition.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>

---

Changes in v3:
- use CONFIG_VAL(), which suggested by Simon

Changes in v2: None

 arch/powerpc/cpu/mpc83xx/start.S |  8 ++++----
 arch/powerpc/cpu/mpc85xx/start.S | 11 +++++------
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S
index 2fed4a1..1c3c737 100644
--- a/arch/powerpc/cpu/mpc83xx/start.S
+++ b/arch/powerpc/cpu/mpc83xx/start.S
@@ -274,14 +274,14 @@ in_flash:
 	cmplw	r3, r4
 	bne	1b
 
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
 
-#if CONFIG_SYS_MALLOC_F_LEN + GENERATED_GBL_DATA_SIZE > CONFIG_SYS_INIT_RAM_SIZE
-#error "CONFIG_SYS_MALLOC_F_LEN too large to fit into initial RAM."
+#if CONFIG_VAL(SYS_MALLOC_F_LEN) + GENERATED_GBL_DATA_SIZE > CONFIG_SYS_INIT_RAM_SIZE
+#error "SYS_MALLOC_F_LEN too large to fit into initial RAM."
 #endif
 
 	/* r3 = new stack pointer / pre-reloc malloc area */
-	subi    r3, r3, CONFIG_SYS_MALLOC_F_LEN
+	subi    r3, r3, CONFIG_VAL(SYS_MALLOC_F_LEN)
 
 	/* Set pointer to pre-reloc malloc area in GD */
 	stw     r3, GD_MALLOC_BASE(r4)
diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S
index 63fdffd..58cb9fc 100644
--- a/arch/powerpc/cpu/mpc85xx/start.S
+++ b/arch/powerpc/cpu/mpc85xx/start.S
@@ -1183,14 +1183,13 @@ _start_cont:
 	lis	r3,(CONFIG_SYS_INIT_RAM_ADDR)@h
 	ori	r3,r3,((CONFIG_SYS_INIT_SP_OFFSET-16)&~0xf)@l /* Align to 16 */
 
-#ifdef CONFIG_SYS_MALLOC_F_LEN
-
-#if CONFIG_SYS_MALLOC_F_LEN + GENERATED_GBL_DATA_SIZE > CONFIG_SYS_INIT_RAM_SIZE
-#error "CONFIG_SYS_MALLOC_F_LEN too large to fit into initial RAM."
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_VAL(SYS_MALLOC_F_LEN) + GENERATED_GBL_DATA_SIZE > CONFIG_SYS_INIT_RAM_SIZE
+#error "SYS_MALLOC_F_LEN too large to fit into initial RAM."
 #endif
 
 	/* Leave 16+ byte for back chain termination and NULL return address */
-	subi	r3,r3,((CONFIG_SYS_MALLOC_F_LEN+16+15)&~0xf)
+	subi	r3,r3,((CONFIG_VAL(SYS_MALLOC_F_LEN)+16+15)&~0xf)
 #endif
 
 	/* End of RAM */
@@ -1204,7 +1203,7 @@ _start_cont:
 	cmplw 	r4,r3
 	bne	1b
 
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
 	lis	r4,(CONFIG_SYS_INIT_RAM_ADDR)@h
 	ori	r4,r4,(CONFIG_SYS_GBL_DATA_OFFSET)@l
 
-- 
2.7.4

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

* [U-Boot] [PATCH v3 04/10] microblaze: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  2017-07-24  9:42 [U-Boot] [PATCH v3 00/10] make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN Andy Yan
                   ` (2 preceding siblings ...)
  2017-07-24  9:47 ` [U-Boot] [PATCH v3 03/10] powerpc: " Andy Yan
@ 2017-07-24  9:49 ` Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
                     ` (3 more replies)
  2017-07-24  9:49 ` [U-Boot] [PATCH v3 05/10] sandbox: use CONFIG_VAL(SYS_MALLOC_F_LEN) to distinguish malloc pool size before relocation Andy Yan
                   ` (5 subsequent siblings)
  9 siblings, 4 replies; 47+ messages in thread
From: Andy Yan @ 2017-07-24  9:49 UTC (permalink / raw)
  To: u-boot

Some platforms has very small sram to run spl code, so
it may have no enough sapce for so much malloc pool before
relocation in spl stage as the normal u-boot stage.
Use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit this condition.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>

---

Changes in v3:
- use CONFIG_VAL(), which suggested by Simon

Changes in v2: None

 arch/microblaze/cpu/start.S | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S
index 79dc0cf..baf4f51 100644
--- a/arch/microblaze/cpu/start.S
+++ b/arch/microblaze/cpu/start.S
@@ -31,8 +31,8 @@ _start:
 	mts	rshr, r1
 	addi	r1, r1, -4	/* Decrement SP to top of memory */
 #else
-#if defined(CONFIG_SYS_MALLOC_F_LEN)
-	addi	r1, r0, CONFIG_SYS_INIT_SP_OFFSET - CONFIG_SYS_MALLOC_F_LEN
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+	addi	r1, r0, CONFIG_SYS_INIT_SP_OFFSET - CONFIG_VAL(SYS_MALLOC_F_LEN)
 #else
 	addi	r1, r0, CONFIG_SYS_INIT_SP_OFFSET
 #endif
@@ -162,14 +162,14 @@ clear_bss:
 #ifndef CONFIG_SPL_BUILD
 	or	r5, r0, r0	/* flags - empty */
 	addi    r31, r0, _gd
-#if defined(CONFIG_SYS_MALLOC_F_LEN)
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
 	addi	r6, r0, CONFIG_SYS_INIT_SP_OFFSET
 	swi	r6, r31, GD_MALLOC_BASE
 #endif
 	brai	board_init_f
 #else
 	addi	r31, r0, _gd
-#if defined(CONFIG_SYS_MALLOC_F_LEN)
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
 	addi	r6, r0, CONFIG_SPL_STACK_ADDR
 	swi	r6, r31, GD_MALLOC_BASE
 #endif
-- 
2.7.4

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

* [U-Boot] [PATCH v3 05/10] sandbox: use CONFIG_VAL(SYS_MALLOC_F_LEN) to distinguish malloc pool size before relocation
  2017-07-24  9:42 [U-Boot] [PATCH v3 00/10] make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN Andy Yan
                   ` (3 preceding siblings ...)
  2017-07-24  9:49 ` [U-Boot] [PATCH v3 04/10] microblaze: " Andy Yan
@ 2017-07-24  9:49 ` Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
                     ` (2 more replies)
  2017-07-24  9:50 ` [U-Boot] [PATCH v3 06/10] rockchip: set malloc pool size to 0 before relocation in spl state on rk3036 based board Andy Yan
                   ` (4 subsequent siblings)
  9 siblings, 3 replies; 47+ messages in thread
From: Andy Yan @ 2017-07-24  9:49 UTC (permalink / raw)
  To: u-boot

From: Andy Yan <andyshrk@gmail.com>

SPL and normal u-boot stage use different malloc pool size
configuration before relocation, so use CONFIG_VAL(SYS_MALLOC_F_LEN)
to fit different boot stage.

Signed-off-by: Andy Yan <andyshrk@gmail.com>

Changes in v3:
- use CONFIG_VAL(), which suggested by Simon

Changes in v2: None

 arch/sandbox/cpu/start.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index f605d4d..00742fd 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -310,7 +310,7 @@ int main(int argc, char *argv[])
 
 	memset(&data, '\0', sizeof(data));
 	gd = &data;
-#ifdef CONFIG_SYS_MALLOC_F_LEN
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
 	gd->malloc_base = CONFIG_MALLOC_F_ADDR;
 #endif
 	setup_ram_buf(state);
-- 
2.7.4

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

* [U-Boot] [PATCH v3 06/10] rockchip: set malloc pool size to 0 before relocation in spl state on rk3036 based board
  2017-07-24  9:42 [U-Boot] [PATCH v3 00/10] make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN Andy Yan
                   ` (4 preceding siblings ...)
  2017-07-24  9:49 ` [U-Boot] [PATCH v3 05/10] sandbox: use CONFIG_VAL(SYS_MALLOC_F_LEN) to distinguish malloc pool size before relocation Andy Yan
@ 2017-07-24  9:50 ` Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
                     ` (2 more replies)
  2017-07-24  9:51 ` [U-Boot] [PATCH v3 07/10] rockchip: disable SPL_ARCH_MEMCPY/MEMSET for rk3036 Andy Yan
                   ` (3 subsequent siblings)
  9 siblings, 3 replies; 47+ messages in thread
From: Andy Yan @ 2017-07-24  9:50 UTC (permalink / raw)
  To: u-boot

RK3036 only has 4kb sram, the spl code will use
3.4 ~ 3.5 kb, the last 0.5kb are used for SP and
GD, so there is no space for malloc. Also, the spl
will directly return to bootrom after dram initialized,
they never need the space for malloc.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v3: None
Changes in v2: None

 configs/evb-rk3036_defconfig   | 1 +
 configs/kylin-rk3036_defconfig | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/evb-rk3036_defconfig b/configs/evb-rk3036_defconfig
index 321ef71..78e2095 100644
--- a/configs/evb-rk3036_defconfig
+++ b/configs/evb-rk3036_defconfig
@@ -4,6 +4,7 @@ CONFIG_ROCKCHIP_RK3036=y
 CONFIG_TARGET_EVB_RK3036=y
 CONFIG_SPL_STACK_R_ADDR=0x80000
 CONFIG_DEFAULT_DEVICE_TREE="rk3036-sdk"
+CONFIG_SPL_SYS_MALLOC_F_LEN=0x0
 CONFIG_DEBUG_UART=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_STACK_R=y
diff --git a/configs/kylin-rk3036_defconfig b/configs/kylin-rk3036_defconfig
index 715e4b2..fd20eff 100644
--- a/configs/kylin-rk3036_defconfig
+++ b/configs/kylin-rk3036_defconfig
@@ -4,6 +4,7 @@ CONFIG_ROCKCHIP_RK3036=y
 CONFIG_TARGET_KYLIN_RK3036=y
 CONFIG_SPL_STACK_R_ADDR=0x80000
 CONFIG_DEFAULT_DEVICE_TREE="rk3036-sdk"
+CONFIG_SPL_SYS_MALLOC_F_LEN=0x0
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_STACK_R=y
 # CONFIG_CMD_IMLS is not set
-- 
2.7.4

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

* [U-Boot] [PATCH v3 07/10] rockchip: disable SPL_ARCH_MEMCPY/MEMSET for rk3036
  2017-07-24  9:42 [U-Boot] [PATCH v3 00/10] make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN Andy Yan
                   ` (5 preceding siblings ...)
  2017-07-24  9:50 ` [U-Boot] [PATCH v3 06/10] rockchip: set malloc pool size to 0 before relocation in spl state on rk3036 based board Andy Yan
@ 2017-07-24  9:51 ` Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
                     ` (2 more replies)
  2017-07-24  9:51 ` [U-Boot] [PATCH v3 08/10] rockchip: enable SPL_LIBGENERIC for rk3036 based boards Andy Yan
                   ` (2 subsequent siblings)
  9 siblings, 3 replies; 47+ messages in thread
From: Andy Yan @ 2017-07-24  9:51 UTC (permalink / raw)
  To: u-boot

RK3036 has no enough sapce use ARCH_MEMCPY/MEMSET in spl stage

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v3: None
Changes in v2: None

 configs/evb-rk3036_defconfig   | 2 ++
 configs/kylin-rk3036_defconfig | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/configs/evb-rk3036_defconfig b/configs/evb-rk3036_defconfig
index 78e2095..8e7a65b 100644
--- a/configs/evb-rk3036_defconfig
+++ b/configs/evb-rk3036_defconfig
@@ -1,4 +1,6 @@
 CONFIG_ARM=y
+# CONFIG_SPL_USE_ARCH_MEMCPY is not set
+# CONFIG_SPL_USE_ARCH_MEMSET is not set
 CONFIG_ARCH_ROCKCHIP=y
 CONFIG_ROCKCHIP_RK3036=y
 CONFIG_TARGET_EVB_RK3036=y
diff --git a/configs/kylin-rk3036_defconfig b/configs/kylin-rk3036_defconfig
index fd20eff..266ac94 100644
--- a/configs/kylin-rk3036_defconfig
+++ b/configs/kylin-rk3036_defconfig
@@ -1,4 +1,6 @@
 CONFIG_ARM=y
+# CONFIG_SPL_USE_ARCH_MEMCPY is not set
+# CONFIG_SPL_USE_ARCH_MEMSET is not set
 CONFIG_ARCH_ROCKCHIP=y
 CONFIG_ROCKCHIP_RK3036=y
 CONFIG_TARGET_KYLIN_RK3036=y
-- 
2.7.4

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

* [U-Boot] [PATCH v3 08/10] rockchip: enable SPL_LIBGENERIC for rk3036 based boards
  2017-07-24  9:42 [U-Boot] [PATCH v3 00/10] make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN Andy Yan
                   ` (6 preceding siblings ...)
  2017-07-24  9:51 ` [U-Boot] [PATCH v3 07/10] rockchip: disable SPL_ARCH_MEMCPY/MEMSET for rk3036 Andy Yan
@ 2017-07-24  9:51 ` Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
                     ` (2 more replies)
  2017-07-24  9:52 ` [U-Boot] [PATCH v3 09/10] rockchip: use puts instead of printf when back to bootrom Andy Yan
  2017-07-24  9:52 ` [U-Boot] [PATCH v3 10/10] rockchip: add u-boot specific dts for rk3036 sdk Andy Yan
  9 siblings, 3 replies; 47+ messages in thread
From: Andy Yan @ 2017-07-24  9:51 UTC (permalink / raw)
  To: u-boot

function board_init_f_init_reserve will call memset, which
is implemented in lib, and enabled by CONFIG_SPL_LIBGENERIC_SUPPORT
in spl stage.
To reduce the code size, also enable SPL_TINY_MEMSET.
As rk3036 will return to bootrom immediately after dram
initialization, there is no need to run DM, so disable
SPL_DM_SERIAL.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

---

Changes in v3:
- disable SPL_DM_SERIAL

Changes in v2: None

 arch/arm/mach-rockchip/rk3036-board-spl.c | 6 ------
 configs/evb-rk3036_defconfig              | 4 +++-
 configs/kylin-rk3036_defconfig            | 4 +++-
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-rockchip/rk3036-board-spl.c b/arch/arm/mach-rockchip/rk3036-board-spl.c
index 7b8d0ee..9458201 100644
--- a/arch/arm/mach-rockchip/rk3036-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3036-board-spl.c
@@ -53,9 +53,3 @@ void board_init_r(gd_t *id, ulong dest_addr)
 	while (1)
 		;
 }
-
-void hang(void)
-{
-	while (1)
-		;
-}
diff --git a/configs/evb-rk3036_defconfig b/configs/evb-rk3036_defconfig
index 8e7a65b..dd03816 100644
--- a/configs/evb-rk3036_defconfig
+++ b/configs/evb-rk3036_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
 CONFIG_ARCH_ROCKCHIP=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_ROCKCHIP_RK3036=y
 CONFIG_TARGET_EVB_RK3036=y
 CONFIG_SPL_STACK_R_ADDR=0x80000
@@ -33,10 +34,11 @@ CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_ROCKCHIP_RK3036=y
-# CONFIG_SPL_SERIAL_PRESENT is not set
+# CONFIG_SPL_DM_SERIAL is not set
 CONFIG_DEBUG_UART_BASE=0x20068000
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYSRESET=y
+CONFIG_SPL_TINY_MEMSET=y
 CONFIG_CMD_DHRYSTONE=y
 CONFIG_ERRNO_STR=y
diff --git a/configs/kylin-rk3036_defconfig b/configs/kylin-rk3036_defconfig
index 266ac94..cd3074a 100644
--- a/configs/kylin-rk3036_defconfig
+++ b/configs/kylin-rk3036_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMCPY is not set
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
 CONFIG_ARCH_ROCKCHIP=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_ROCKCHIP_RK3036=y
 CONFIG_TARGET_KYLIN_RK3036=y
 CONFIG_SPL_STACK_R_ADDR=0x80000
@@ -22,7 +23,6 @@ CONFIG_CMD_TIME=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_ISO_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
-CONFIG_SPL_PARTITION_UUIDS=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_CLK=y
@@ -34,9 +34,11 @@ CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_ROCKCHIP_RK3036=y
 CONFIG_DM_REGULATOR_FIXED=y
+# CONFIG_SPL_DM_SERIAL is not set
 CONFIG_SYSRESET=y
 CONFIG_USB=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_STORAGE=y
+CONFIG_SPL_TINY_MEMSET=y
 CONFIG_CMD_DHRYSTONE=y
 CONFIG_ERRNO_STR=y
-- 
2.7.4

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

* [U-Boot] [PATCH v3 09/10] rockchip: use puts instead of printf when back to bootrom
  2017-07-24  9:42 [U-Boot] [PATCH v3 00/10] make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN Andy Yan
                   ` (7 preceding siblings ...)
  2017-07-24  9:51 ` [U-Boot] [PATCH v3 08/10] rockchip: enable SPL_LIBGENERIC for rk3036 based boards Andy Yan
@ 2017-07-24  9:52 ` Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
                     ` (2 more replies)
  2017-07-24  9:52 ` [U-Boot] [PATCH v3 10/10] rockchip: add u-boot specific dts for rk3036 sdk Andy Yan
  9 siblings, 3 replies; 47+ messages in thread
From: Andy Yan @ 2017-07-24  9:52 UTC (permalink / raw)
  To: u-boot

printf will increase the code size more than 1kb, but platform
like rk3036 has no enough space for it.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>

---

Changes in v3:
- use puts instead of printf, which suggested by Simon

Changes in v2: None

 arch/arm/mach-rockchip/bootrom.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-rockchip/bootrom.c b/arch/arm/mach-rockchip/bootrom.c
index da36f92..4ca9962 100644
--- a/arch/arm/mach-rockchip/bootrom.c
+++ b/arch/arm/mach-rockchip/bootrom.c
@@ -9,8 +9,8 @@
 
 void back_to_bootrom(void)
 {
-#if defined(CONFIG_SPL_LIBGENERIC_SUPPORT) && !defined(CONFIG_TPL_BUILD)
-	printf("Returning to boot ROM...");
+#if defined(CONFIG_SPL_LIBCOMMON_SUPPORT) && !defined(CONFIG_TPL_BUILD)
+	puts("Returning to boot ROM...");
 #endif
 	_back_to_bootrom_s();
 }
-- 
2.7.4

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

* [U-Boot] [PATCH v3 10/10] rockchip: add u-boot specific dts for rk3036 sdk
  2017-07-24  9:42 [U-Boot] [PATCH v3 00/10] make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN Andy Yan
                   ` (8 preceding siblings ...)
  2017-07-24  9:52 ` [U-Boot] [PATCH v3 09/10] rockchip: use puts instead of printf when back to bootrom Andy Yan
@ 2017-07-24  9:52 ` Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
                     ` (2 more replies)
  9 siblings, 3 replies; 47+ messages in thread
From: Andy Yan @ 2017-07-24  9:52 UTC (permalink / raw)
  To: u-boot

Add this dts to enable debug uart releated devices
before relocation.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v3: None
Changes in v2: None

 arch/arm/dts/rk3036-sdk-u-boot.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 arch/arm/dts/rk3036-sdk-u-boot.dtsi

diff --git a/arch/arm/dts/rk3036-sdk-u-boot.dtsi b/arch/arm/dts/rk3036-sdk-u-boot.dtsi
new file mode 100644
index 0000000..6f15f4a
--- /dev/null
+++ b/arch/arm/dts/rk3036-sdk-u-boot.dtsi
@@ -0,0 +1,11 @@
+&uart2 {
+	u-boot,dm-pre-reloc;
+};
+
+&grf {
+	u-boot,dm-pre-reloc;
+};
+
+&pinctrl {
+	u-boot,dm-pre-reloc;
+};
-- 
2.7.4

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

* [U-Boot] [U-Boot, v3, 01/10] make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN
  2017-07-24  9:43 ` [U-Boot] [PATCH v3 01/10] " Andy Yan
@ 2017-07-24 10:42   ` Philipp Tomsich
  2017-07-27 10:37   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-24 10:42 UTC (permalink / raw)
  To: u-boot

> Some platforms has very small sram to run spl code, so it has no
> enough sapce for so much malloc pool before relocation in
> spl stage as the normal u-boot stage.
> Make spl and normal u-boot stage use independent SYS_MALLOC_F_LEN,
> Then people can sets the pre-relocation malloc pool according to
> the memory space indepently.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> ---
> 
> Changes in v3:
> - use CONFIG_VAL(), which suggested by Simon
> 
> Changes in v2:
> - introduce a new control CONFIG_SPL_SYS_MALLOC_F_LEN, adviced by Simon
> 
>  Kconfig                           | 10 ++++++++++
>  cmd/bdinfo.c                      |  4 ++--
>  common/Makefile                   |  4 +++-
>  common/board_f.c                  |  4 ++--
>  common/board_r.c                  |  2 +-
>  common/dlmalloc.c                 | 12 ++++++------
>  common/init/board_init.c          |  8 ++++----
>  common/spl/spl.c                  |  8 ++++----
>  drivers/core/Kconfig              |  8 ++++----
>  drivers/serial/serial-uclass.c    |  4 ++--
>  include/asm-generic/global_data.h |  2 +-
>  lib/asm-offsets.c                 |  2 +-
>  lib/efi/efi_app.c                 |  2 +-
>  13 files changed, 41 insertions(+), 29 deletions(-)
> 

Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 02/10] mips: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  2017-07-24  9:45 ` [U-Boot] [PATCH v3 02/10] mips: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently Andy Yan
@ 2017-07-24 10:42   ` Philipp Tomsich
  2017-07-27 10:44   ` Philipp Tomsich
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-24 10:42 UTC (permalink / raw)
  To: u-boot

> Some platforms has very small sram to run spl code, so
> it may have no enough sapce for so much malloc pool before
> relocation in spl stage as the normal u-boot stage.
> Use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit this condition.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Acked-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> ---
> 
> Changes in v3:
> - use CONFIG_VAL(), which suggested by Simon
> 
> Changes in v2: None
> 
>  arch/mips/cpu/start.S | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 04/10] microblaze: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  2017-07-24  9:49 ` [U-Boot] [PATCH v3 04/10] microblaze: " Andy Yan
@ 2017-07-24 10:42   ` Philipp Tomsich
  2017-07-27 10:50   ` Philipp Tomsich
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-24 10:42 UTC (permalink / raw)
  To: u-boot

> Some platforms has very small sram to run spl code, so
> it may have no enough sapce for so much malloc pool before
> relocation in spl stage as the normal u-boot stage.
> Use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit this condition.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> ---
> 
> Changes in v3:
> - use CONFIG_VAL(), which suggested by Simon
> 
> Changes in v2: None
> 
>  arch/microblaze/cpu/start.S | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 

Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 03/10] powerpc: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  2017-07-24  9:47 ` [U-Boot] [PATCH v3 03/10] powerpc: " Andy Yan
@ 2017-07-24 10:42   ` Philipp Tomsich
  2017-07-27 10:48   ` Philipp Tomsich
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-24 10:42 UTC (permalink / raw)
  To: u-boot

> Some platforms has very small sram to run spl code, so
> it may have no enough sapce for so much malloc pool before
> relocation in spl stage as the normal u-boot stage.
> Use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit this condition.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> ---
> 
> Changes in v3:
> - use CONFIG_VAL(), which suggested by Simon
> 
> Changes in v2: None
> 
>  arch/powerpc/cpu/mpc83xx/start.S |  8 ++++----
>  arch/powerpc/cpu/mpc85xx/start.S | 11 +++++------
>  2 files changed, 9 insertions(+), 10 deletions(-)
> 

Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 05/10] sandbox: use CONFIG_VAL(SYS_MALLOC_F_LEN) to distinguish malloc pool size before relocation
  2017-07-24  9:49 ` [U-Boot] [PATCH v3 05/10] sandbox: use CONFIG_VAL(SYS_MALLOC_F_LEN) to distinguish malloc pool size before relocation Andy Yan
@ 2017-07-24 10:42   ` Philipp Tomsich
  2017-07-27 10:52   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-24 10:42 UTC (permalink / raw)
  To: u-boot

> From: Andy Yan <andyshrk@gmail.com>
> 
> SPL and normal u-boot stage use different malloc pool size
> configuration before relocation, so use CONFIG_VAL(SYS_MALLOC_F_LEN)
> to fit different boot stage.
> 
> Signed-off-by: Andy Yan <andyshrk@gmail.com>
> 
> Changes in v3:
> - use CONFIG_VAL(), which suggested by Simon
> 
> Changes in v2: None
> 
>  arch/sandbox/cpu/start.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 06/10] rockchip: set malloc pool size to 0 before relocation in spl state on rk3036 based board
  2017-07-24  9:50 ` [U-Boot] [PATCH v3 06/10] rockchip: set malloc pool size to 0 before relocation in spl state on rk3036 based board Andy Yan
@ 2017-07-24 10:42   ` Philipp Tomsich
  2017-07-27 10:38   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-24 10:42 UTC (permalink / raw)
  To: u-boot

> RK3036 only has 4kb sram, the spl code will use
> 3.4 ~ 3.5 kb, the last 0.5kb are used for SP and
> GD, so there is no space for malloc. Also, the spl
> will directly return to bootrom after dram initialized,
> they never need the space for malloc.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> 
> Changes in v3: None
> Changes in v2: None
> 
>  configs/evb-rk3036_defconfig   | 1 +
>  configs/kylin-rk3036_defconfig | 1 +
>  2 files changed, 2 insertions(+)
> 

Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 07/10] rockchip: disable SPL_ARCH_MEMCPY/MEMSET for rk3036
  2017-07-24  9:51 ` [U-Boot] [PATCH v3 07/10] rockchip: disable SPL_ARCH_MEMCPY/MEMSET for rk3036 Andy Yan
@ 2017-07-24 10:42   ` Philipp Tomsich
  2017-07-27 10:38   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-24 10:42 UTC (permalink / raw)
  To: u-boot

> RK3036 has no enough sapce use ARCH_MEMCPY/MEMSET in spl stage
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> 
> Changes in v3: None
> Changes in v2: None
> 
>  configs/evb-rk3036_defconfig   | 2 ++
>  configs/kylin-rk3036_defconfig | 2 ++
>  2 files changed, 4 insertions(+)
> 

Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 08/10] rockchip: enable SPL_LIBGENERIC for rk3036 based boards
  2017-07-24  9:51 ` [U-Boot] [PATCH v3 08/10] rockchip: enable SPL_LIBGENERIC for rk3036 based boards Andy Yan
@ 2017-07-24 10:42   ` Philipp Tomsich
  2017-07-27 10:38   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-24 10:42 UTC (permalink / raw)
  To: u-boot

> function board_init_f_init_reserve will call memset, which
> is implemented in lib, and enabled by CONFIG_SPL_LIBGENERIC_SUPPORT
> in spl stage.
> To reduce the code size, also enable SPL_TINY_MEMSET.
> As rk3036 will return to bootrom immediately after dram
> initialization, there is no need to run DM, so disable
> SPL_DM_SERIAL.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> 
> Changes in v3:
> - disable SPL_DM_SERIAL
> 
> Changes in v2: None
> 
>  arch/arm/mach-rockchip/rk3036-board-spl.c | 6 ------
>  configs/evb-rk3036_defconfig              | 4 +++-
>  configs/kylin-rk3036_defconfig            | 4 +++-
>  3 files changed, 6 insertions(+), 8 deletions(-)
> 

Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 09/10] rockchip: use puts instead of printf when back to bootrom
  2017-07-24  9:52 ` [U-Boot] [PATCH v3 09/10] rockchip: use puts instead of printf when back to bootrom Andy Yan
@ 2017-07-24 10:42   ` Philipp Tomsich
  2017-07-27 10:38   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-24 10:42 UTC (permalink / raw)
  To: u-boot

> printf will increase the code size more than 1kb, but platform
> like rk3036 has no enough space for it.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> ---
> 
> Changes in v3:
> - use puts instead of printf, which suggested by Simon
> 
> Changes in v2: None
> 
>  arch/arm/mach-rockchip/bootrom.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 10/10] rockchip: add u-boot specific dts for rk3036 sdk
  2017-07-24  9:52 ` [U-Boot] [PATCH v3 10/10] rockchip: add u-boot specific dts for rk3036 sdk Andy Yan
@ 2017-07-24 10:42   ` Philipp Tomsich
  2017-07-27 10:38   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-24 10:42 UTC (permalink / raw)
  To: u-boot

> Add this dts to enable debug uart releated devices
> before relocation.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> 
> Changes in v3: None
> Changes in v2: None
> 
>  arch/arm/dts/rk3036-sdk-u-boot.dtsi | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>  create mode 100644 arch/arm/dts/rk3036-sdk-u-boot.dtsi
> 

Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 01/10] make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN
  2017-07-24  9:43 ` [U-Boot] [PATCH v3 01/10] " Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
@ 2017-07-27 10:37   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 10:37 UTC (permalink / raw)
  To: u-boot

> Some platforms has very small sram to run spl code, so it has no
> enough sapce for so much malloc pool before relocation in
> spl stage as the normal u-boot stage.
> Make spl and normal u-boot stage use independent SYS_MALLOC_F_LEN,
> Then people can sets the pre-relocation malloc pool according to
> the memory space indepently.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> Changes in v3:
> - use CONFIG_VAL(), which suggested by Simon
> 
> Changes in v2:
> - introduce a new control CONFIG_SPL_SYS_MALLOC_F_LEN, adviced by Simon
> 
>  Kconfig                           | 10 ++++++++++
>  cmd/bdinfo.c                      |  4 ++--
>  common/Makefile                   |  4 +++-
>  common/board_f.c                  |  4 ++--
>  common/board_r.c                  |  2 +-
>  common/dlmalloc.c                 | 12 ++++++------
>  common/init/board_init.c          |  8 ++++----
>  common/spl/spl.c                  |  8 ++++----
>  drivers/core/Kconfig              |  8 ++++----
>  drivers/serial/serial-uclass.c    |  4 ++--
>  include/asm-generic/global_data.h |  2 +-
>  lib/asm-offsets.c                 |  2 +-
>  lib/efi/efi_app.c                 |  2 +-
>  13 files changed, 41 insertions(+), 29 deletions(-)
> 

Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 06/10] rockchip: set malloc pool size to 0 before relocation in spl state on rk3036 based board
  2017-07-24  9:50 ` [U-Boot] [PATCH v3 06/10] rockchip: set malloc pool size to 0 before relocation in spl state on rk3036 based board Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
@ 2017-07-27 10:38   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 10:38 UTC (permalink / raw)
  To: u-boot

> RK3036 only has 4kb sram, the spl code will use
> 3.4 ~ 3.5 kb, the last 0.5kb are used for SP and
> GD, so there is no space for malloc. Also, the spl
> will directly return to bootrom after dram initialized,
> they never need the space for malloc.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> Changes in v3: None
> Changes in v2: None
> 
>  configs/evb-rk3036_defconfig   | 1 +
>  configs/kylin-rk3036_defconfig | 1 +
>  2 files changed, 2 insertions(+)
> 

Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 07/10] rockchip: disable SPL_ARCH_MEMCPY/MEMSET for rk3036
  2017-07-24  9:51 ` [U-Boot] [PATCH v3 07/10] rockchip: disable SPL_ARCH_MEMCPY/MEMSET for rk3036 Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
@ 2017-07-27 10:38   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 10:38 UTC (permalink / raw)
  To: u-boot

> RK3036 has no enough sapce use ARCH_MEMCPY/MEMSET in spl stage
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> Changes in v3: None
> Changes in v2: None
> 
>  configs/evb-rk3036_defconfig   | 2 ++
>  configs/kylin-rk3036_defconfig | 2 ++
>  2 files changed, 4 insertions(+)
> 

Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 08/10] rockchip: enable SPL_LIBGENERIC for rk3036 based boards
  2017-07-24  9:51 ` [U-Boot] [PATCH v3 08/10] rockchip: enable SPL_LIBGENERIC for rk3036 based boards Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
@ 2017-07-27 10:38   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 10:38 UTC (permalink / raw)
  To: u-boot

> function board_init_f_init_reserve will call memset, which
> is implemented in lib, and enabled by CONFIG_SPL_LIBGENERIC_SUPPORT
> in spl stage.
> To reduce the code size, also enable SPL_TINY_MEMSET.
> As rk3036 will return to bootrom immediately after dram
> initialization, there is no need to run DM, so disable
> SPL_DM_SERIAL.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> Changes in v3:
> - disable SPL_DM_SERIAL
> 
> Changes in v2: None
> 
>  arch/arm/mach-rockchip/rk3036-board-spl.c | 6 ------
>  configs/evb-rk3036_defconfig              | 4 +++-
>  configs/kylin-rk3036_defconfig            | 4 +++-
>  3 files changed, 6 insertions(+), 8 deletions(-)
> 

Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 10/10] rockchip: add u-boot specific dts for rk3036 sdk
  2017-07-24  9:52 ` [U-Boot] [PATCH v3 10/10] rockchip: add u-boot specific dts for rk3036 sdk Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
@ 2017-07-27 10:38   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 10:38 UTC (permalink / raw)
  To: u-boot

> Add this dts to enable debug uart releated devices
> before relocation.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> Changes in v3: None
> Changes in v2: None
> 
>  arch/arm/dts/rk3036-sdk-u-boot.dtsi | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>  create mode 100644 arch/arm/dts/rk3036-sdk-u-boot.dtsi
> 

Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 09/10] rockchip: use puts instead of printf when back to bootrom
  2017-07-24  9:52 ` [U-Boot] [PATCH v3 09/10] rockchip: use puts instead of printf when back to bootrom Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
@ 2017-07-27 10:38   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 10:38 UTC (permalink / raw)
  To: u-boot

> printf will increase the code size more than 1kb, but platform
> like rk3036 has no enough space for it.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> Changes in v3:
> - use puts instead of printf, which suggested by Simon
> 
> Changes in v2: None
> 
>  arch/arm/mach-rockchip/bootrom.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 02/10] mips: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  2017-07-24  9:45 ` [U-Boot] [PATCH v3 02/10] mips: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
@ 2017-07-27 10:44   ` Philipp Tomsich
  2017-07-27 12:18     ` Daniel Schwierzeck
  2017-07-27 12:22   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  3 siblings, 1 reply; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 10:44 UTC (permalink / raw)
  To: u-boot



On Mon, 24 Jul 2017, Andy Yan wrote:

> Some platforms has very small sram to run spl code, so
> it may have no enough sapce for so much malloc pool before
> relocation in spl stage as the normal u-boot stage.
> Use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit this condition.
>
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Acked-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>
> Changes in v3:
> - use CONFIG_VAL(), which suggested by Simon
>
> Changes in v2: None
>
> arch/mips/cpu/start.S | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/mips/cpu/start.S b/arch/mips/cpu/start.S
> index d01ee9f..aa07654 100644
> --- a/arch/mips/cpu/start.S
> +++ b/arch/mips/cpu/start.S
> @@ -60,8 +60,8 @@
> 		sp, sp, GD_SIZE		# reserve space for gd
> 	and	sp, sp, t0		# force 16 byte alignment
> 	move	k0, sp			# save gd pointer
> -#ifdef CONFIG_SYS_MALLOC_F_LEN
> -	li	t2, CONFIG_SYS_MALLOC_F_LEN
> +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
> +	li	t2, CONFIG_VAL(SYS_MALLOC_F_LEN)

With CONFIG_VAL(...) there should always be a value returned.

Could we drop the #if guard around this, as the PTR_SUBU below will 
then an identity transform (i.e. it will compute "sp = sp - 0")?

> 	PTR_SUBU \
> 		sp, sp, t2		# reserve space for early malloc
> 	and	sp, sp, t0		# force 16 byte alignment
> @@ -75,7 +75,7 @@
> 	blt	t0, t1, 1b
> 	 PTR_ADDIU t0, PTRSIZE
>
> -#ifdef CONFIG_SYS_MALLOC_F_LEN
> +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
> 	PTR_S	sp, GD_MALLOC_BASE(k0)	# gd->malloc_base offset
> #endif
> 	.endm
>

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

* [U-Boot] [U-Boot, v3, 03/10] powerpc: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  2017-07-24  9:47 ` [U-Boot] [PATCH v3 03/10] powerpc: " Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
@ 2017-07-27 10:48   ` Philipp Tomsich
  2017-07-27 11:45     ` Mario Six
  2017-07-27 12:23   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  3 siblings, 1 reply; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 10:48 UTC (permalink / raw)
  To: u-boot



On Mon, 24 Jul 2017, Andy Yan wrote:

> Some platforms has very small sram to run spl code, so
> it may have no enough sapce for so much malloc pool before
> relocation in spl stage as the normal u-boot stage.
> Use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit this condition.
>
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>
> Changes in v3:
> - use CONFIG_VAL(), which suggested by Simon
>
> Changes in v2: None
>
> arch/powerpc/cpu/mpc83xx/start.S |  8 ++++----
> arch/powerpc/cpu/mpc85xx/start.S | 11 +++++------
> 2 files changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/arch/powerpc/cpu/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S
> index 2fed4a1..1c3c737 100644
> --- a/arch/powerpc/cpu/mpc83xx/start.S
> +++ b/arch/powerpc/cpu/mpc83xx/start.S
> @@ -274,14 +274,14 @@ in_flash:
> 	cmplw	r3, r4
> 	bne	1b
>
> -#ifdef CONFIG_SYS_MALLOC_F_LEN
> +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
>
> -#if CONFIG_SYS_MALLOC_F_LEN + GENERATED_GBL_DATA_SIZE > CONFIG_SYS_INIT_RAM_SIZE
> -#error "CONFIG_SYS_MALLOC_F_LEN too large to fit into initial RAM."
> +#if CONFIG_VAL(SYS_MALLOC_F_LEN) + GENERATED_GBL_DATA_SIZE > CONFIG_SYS_INIT_RAM_SIZE
> +#error "SYS_MALLOC_F_LEN too large to fit into initial RAM."
> #endif
>
> 	/* r3 = new stack pointer / pre-reloc malloc area */
> -	subi    r3, r3, CONFIG_SYS_MALLOC_F_LEN
> +	subi    r3, r3, CONFIG_VAL(SYS_MALLOC_F_LEN)
>
> 	/* Set pointer to pre-reloc malloc area in GD */
> 	stw     r3, GD_MALLOC_BASE(r4)
> diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S
> index 63fdffd..58cb9fc 100644
> --- a/arch/powerpc/cpu/mpc85xx/start.S
> +++ b/arch/powerpc/cpu/mpc85xx/start.S
> @@ -1183,14 +1183,13 @@ _start_cont:
> 	lis	r3,(CONFIG_SYS_INIT_RAM_ADDR)@h
> 	ori	r3,r3,((CONFIG_SYS_INIT_SP_OFFSET-16)&~0xf)@l /* Align to 16 */
>
> -#ifdef CONFIG_SYS_MALLOC_F_LEN
> -
> -#if CONFIG_SYS_MALLOC_F_LEN + GENERATED_GBL_DATA_SIZE > CONFIG_SYS_INIT_RAM_SIZE
> -#error "CONFIG_SYS_MALLOC_F_LEN too large to fit into initial RAM."
> +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
> +#if CONFIG_VAL(SYS_MALLOC_F_LEN) + GENERATED_GBL_DATA_SIZE > CONFIG_SYS_INIT_RAM_SIZE
> +#error "SYS_MALLOC_F_LEN too large to fit into initial RAM."
> #endif
>
> 	/* Leave 16+ byte for back chain termination and NULL return address */
> -	subi	r3,r3,((CONFIG_SYS_MALLOC_F_LEN+16+15)&~0xf)
> +	subi	r3,r3,((CONFIG_VAL(SYS_MALLOC_F_LEN)+16+15)&~0xf)
> #endif

Could we now just drop the outermost "#if CONFIG_VAL(SYS_MALLOC_F_LEN)" 
guard?

(And as a question to someone with knowledge of the history of this code:) 
Why are those 16 bytes ("for back chain termination and NULL return 
address") consumed only when CONFIG_SYS_MALLOC_F_LEN is defined? Shouldn't 
this be required both with SYS_MALLOC_F_LEN and without?

>
> 	/* End of RAM */
> @@ -1204,7 +1203,7 @@ _start_cont:
> 	cmplw 	r4,r3
> 	bne	1b
>
> -#ifdef CONFIG_SYS_MALLOC_F_LEN
> +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
> 	lis	r4,(CONFIG_SYS_INIT_RAM_ADDR)@h
> 	ori	r4,r4,(CONFIG_SYS_GBL_DATA_OFFSET)@l
>
>

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

* [U-Boot] [U-Boot, v3, 04/10] microblaze: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  2017-07-24  9:49 ` [U-Boot] [PATCH v3 04/10] microblaze: " Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
@ 2017-07-27 10:50   ` Philipp Tomsich
  2017-07-27 12:23   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  3 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 10:50 UTC (permalink / raw)
  To: u-boot



On Mon, 24 Jul 2017, Andy Yan wrote:

> Some platforms has very small sram to run spl code, so
> it may have no enough sapce for so much malloc pool before

[nit] typo: "space"

> relocation in spl stage as the normal u-boot stage.
> Use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit this condition.
>
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>
> Changes in v3:
> - use CONFIG_VAL(), which suggested by Simon
>
> Changes in v2: None
>
> arch/microblaze/cpu/start.S | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S
> index 79dc0cf..baf4f51 100644
> --- a/arch/microblaze/cpu/start.S
> +++ b/arch/microblaze/cpu/start.S
> @@ -31,8 +31,8 @@ _start:
> 	mts	rshr, r1
> 	addi	r1, r1, -4	/* Decrement SP to top of memory */
> #else
> -#if defined(CONFIG_SYS_MALLOC_F_LEN)
> -	addi	r1, r0, CONFIG_SYS_INIT_SP_OFFSET - CONFIG_SYS_MALLOC_F_LEN
> +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
> +	addi	r1, r0, CONFIG_SYS_INIT_SP_OFFSET - CONFIG_VAL(SYS_MALLOC_F_LEN)
> #else
> 	addi	r1, r0, CONFIG_SYS_INIT_SP_OFFSET
> #endif

This #if-guard should now be unnecessary (i.e. "CONFIG_SYS_INIT_SP_OFFSET - 
CONFIG_VAL(SYS_MALLOC_F_LEN)" will evaluate to "CONFIG_SYS_INIT_SP_OFFSET",
if CONFIG_VAL(SYS_MALLOC_F_LEN) is 0.

> @@ -162,14 +162,14 @@ clear_bss:
> #ifndef CONFIG_SPL_BUILD
> 	or	r5, r0, r0	/* flags - empty */
> 	addi    r31, r0, _gd
> -#if defined(CONFIG_SYS_MALLOC_F_LEN)
> +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
> 	addi	r6, r0, CONFIG_SYS_INIT_SP_OFFSET
> 	swi	r6, r31, GD_MALLOC_BASE
> #endif
> 	brai	board_init_f
> #else
> 	addi	r31, r0, _gd
> -#if defined(CONFIG_SYS_MALLOC_F_LEN)
> +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
> 	addi	r6, r0, CONFIG_SPL_STACK_ADDR
> 	swi	r6, r31, GD_MALLOC_BASE
> #endif
>

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

* [U-Boot] [U-Boot, v3, 05/10] sandbox: use CONFIG_VAL(SYS_MALLOC_F_LEN) to distinguish malloc pool size before relocation
  2017-07-24  9:49 ` [U-Boot] [PATCH v3 05/10] sandbox: use CONFIG_VAL(SYS_MALLOC_F_LEN) to distinguish malloc pool size before relocation Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
@ 2017-07-27 10:52   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 10:52 UTC (permalink / raw)
  To: u-boot

> From: Andy Yan <andyshrk@gmail.com>
> 
> SPL and normal u-boot stage use different malloc pool size
> configuration before relocation, so use CONFIG_VAL(SYS_MALLOC_F_LEN)
> to fit different boot stage.
> 
> Signed-off-by: Andy Yan <andyshrk@gmail.com>
> 
> Changes in v3:
> - use CONFIG_VAL(), which suggested by Simon
> 
> Changes in v2: None
> 
>  arch/sandbox/cpu/start.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> 

Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 03/10] powerpc: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  2017-07-27 10:48   ` Philipp Tomsich
@ 2017-07-27 11:45     ` Mario Six
  2017-07-27 12:05       ` Dr. Philipp Tomsich
  0 siblings, 1 reply; 47+ messages in thread
From: Mario Six @ 2017-07-27 11:45 UTC (permalink / raw)
  To: u-boot

Hi Phillip,

On Thu, Jul 27, 2017 at 12:48 PM, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
>
>
> On Mon, 24 Jul 2017, Andy Yan wrote:
>
>> Some platforms has very small sram to run spl code, so
>> it may have no enough sapce for so much malloc pool before
>> relocation in spl stage as the normal u-boot stage.
>> Use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit this condition.
>>
>> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
>> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>>
>> ---
>>
>> Changes in v3:
>> - use CONFIG_VAL(), which suggested by Simon
>>
>> Changes in v2: None
>>
>> arch/powerpc/cpu/mpc83xx/start.S |  8 ++++----
>> arch/powerpc/cpu/mpc85xx/start.S | 11 +++++------
>> 2 files changed, 9 insertions(+), 10 deletions(-)
>>
>> diff --git a/arch/powerpc/cpu/mpc83xx/start.S
>> b/arch/powerpc/cpu/mpc83xx/start.S
>> index 2fed4a1..1c3c737 100644
>> --- a/arch/powerpc/cpu/mpc83xx/start.S
>> +++ b/arch/powerpc/cpu/mpc83xx/start.S
>> @@ -274,14 +274,14 @@ in_flash:
>>         cmplw   r3, r4
>>         bne     1b
>>
>> -#ifdef CONFIG_SYS_MALLOC_F_LEN
>> +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
>>
>> -#if CONFIG_SYS_MALLOC_F_LEN + GENERATED_GBL_DATA_SIZE >
>> CONFIG_SYS_INIT_RAM_SIZE
>> -#error "CONFIG_SYS_MALLOC_F_LEN too large to fit into initial RAM."
>> +#if CONFIG_VAL(SYS_MALLOC_F_LEN) + GENERATED_GBL_DATA_SIZE >
>> CONFIG_SYS_INIT_RAM_SIZE
>> +#error "SYS_MALLOC_F_LEN too large to fit into initial RAM."
>> #endif
>>
>>         /* r3 = new stack pointer / pre-reloc malloc area */
>> -       subi    r3, r3, CONFIG_SYS_MALLOC_F_LEN
>> +       subi    r3, r3, CONFIG_VAL(SYS_MALLOC_F_LEN)
>>
>>         /* Set pointer to pre-reloc malloc area in GD */
>>         stw     r3, GD_MALLOC_BASE(r4)
>> diff --git a/arch/powerpc/cpu/mpc85xx/start.S
>> b/arch/powerpc/cpu/mpc85xx/start.S
>> index 63fdffd..58cb9fc 100644
>> --- a/arch/powerpc/cpu/mpc85xx/start.S
>> +++ b/arch/powerpc/cpu/mpc85xx/start.S
>> @@ -1183,14 +1183,13 @@ _start_cont:
>>         lis     r3,(CONFIG_SYS_INIT_RAM_ADDR)@h
>>         ori     r3,r3,((CONFIG_SYS_INIT_SP_OFFSET-16)&~0xf)@l /* Align to
>> 16 */
>>
>> -#ifdef CONFIG_SYS_MALLOC_F_LEN
>> -
>> -#if CONFIG_SYS_MALLOC_F_LEN + GENERATED_GBL_DATA_SIZE >
>> CONFIG_SYS_INIT_RAM_SIZE
>> -#error "CONFIG_SYS_MALLOC_F_LEN too large to fit into initial RAM."
>> +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
>> +#if CONFIG_VAL(SYS_MALLOC_F_LEN) + GENERATED_GBL_DATA_SIZE >
>> CONFIG_SYS_INIT_RAM_SIZE
>> +#error "SYS_MALLOC_F_LEN too large to fit into initial RAM."
>> #endif
>>
>>         /* Leave 16+ byte for back chain termination and NULL return
>> address */
>> -       subi    r3,r3,((CONFIG_SYS_MALLOC_F_LEN+16+15)&~0xf)
>> +       subi    r3,r3,((CONFIG_VAL(SYS_MALLOC_F_LEN)+16+15)&~0xf)
>> #endif
>
>
> Could we now just drop the outermost "#if CONFIG_VAL(SYS_MALLOC_F_LEN)"
> guard?
>
> (And as a question to someone with knowledge of the history of this code:)
> Why are those 16 bytes ("for back chain termination and NULL return
> address") consumed only when CONFIG_SYS_MALLOC_F_LEN is defined? Shouldn't
> this be required both with SYS_MALLOC_F_LEN and without?
>

The code is a bit tricky here: The actual back chain termination and NULL
return address setting is further down:

stw     r0,0(r3)        /* Terminate Back Chain *
stw     r0,+4(r3)       /* NULL return address. */

Now, if we don't have a pre-reloc malloc area, the r3 we computed via

lis     r3,(CONFIG_SYS_INIT_RAM_ADDR)@h
ori     r3,r3,((CONFIG_SYS_INIT_SP_OFFSET-16)&~0xf)@l /* Align to 16 */

will just become our stack pointer.

The global data are starts right after the stack area
(CONFIG_SYS_INIT_SP_OFFSET == CONFIG_SYS_GBL_DATA_OFFSET), which is OK at first
glance, since the stack "grows downwards", but since the back chain termination
and null address setting write beyond the stack pointer (see above), they would
write into the GD area (and might be overwritten). But since we subtracted 16
in the above statement, we have room left to store them.

The case where we have a pre-reloc malloc area is similar: Here we subtract the
pre-reloc malloc area's size from the computed r3 and also a bit more to keep
enough space for the back chain termination and null address:

subi    r3,r3,((CONFIG_SYS_MALLOC_F_LEN+16+15)&~0xf)

Otherwise, the addresses of these would lie in the pre-reloc malloc area, and
might be overwritten.

So the statement basically exists to "fix" what the substraction of the
pre-reloc malloc area size disturbed. If we don't have pre-reloc malloc, the
initial setting of r3 (with the -16 offset) takes care of that already.

>>
>>         /* End of RAM */
>> @@ -1204,7 +1203,7 @@ _start_cont:
>>         cmplw   r4,r3
>>         bne     1b
>>
>> -#ifdef CONFIG_SYS_MALLOC_F_LEN
>> +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
>>         lis     r4,(CONFIG_SYS_INIT_RAM_ADDR)@h
>>         ori     r4,r4,(CONFIG_SYS_GBL_DATA_OFFSET)@l
>>
>>

Best regards,

Mario

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

* [U-Boot] [U-Boot, v3, 03/10] powerpc: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  2017-07-27 11:45     ` Mario Six
@ 2017-07-27 12:05       ` Dr. Philipp Tomsich
  0 siblings, 0 replies; 47+ messages in thread
From: Dr. Philipp Tomsich @ 2017-07-27 12:05 UTC (permalink / raw)
  To: u-boot

Mario,

> On 27 Jul 2017, at 13:45, Mario Six <mariosix1986@gmail.com> wrote:
> 
> Hi Phillip,
> 
> On Thu, Jul 27, 2017 at 12:48 PM, Philipp Tomsich
> <philipp.tomsich@theobroma-systems.com> wrote:
>> 
>> 
>> On Mon, 24 Jul 2017, Andy Yan wrote:
>> 
>>> Some platforms has very small sram to run spl code, so
>>> it may have no enough sapce for so much malloc pool before
>>> relocation in spl stage as the normal u-boot stage.
>>> Use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit this condition.
>>> 
>>> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
>>> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>>> 
>>> ---
>>> 
>>> Changes in v3:
>>> - use CONFIG_VAL(), which suggested by Simon
>>> 
>>> Changes in v2: None
>>> 
>>> arch/powerpc/cpu/mpc83xx/start.S |  8 ++++----
>>> arch/powerpc/cpu/mpc85xx/start.S | 11 +++++------
>>> 2 files changed, 9 insertions(+), 10 deletions(-)
>>> 
>>> diff --git a/arch/powerpc/cpu/mpc83xx/start.S
>>> b/arch/powerpc/cpu/mpc83xx/start.S
>>> index 2fed4a1..1c3c737 100644
>>> --- a/arch/powerpc/cpu/mpc83xx/start.S
>>> +++ b/arch/powerpc/cpu/mpc83xx/start.S
>>> @@ -274,14 +274,14 @@ in_flash:
>>>        cmplw   r3, r4
>>>        bne     1b
>>> 
>>> -#ifdef CONFIG_SYS_MALLOC_F_LEN
>>> +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
>>> 
>>> -#if CONFIG_SYS_MALLOC_F_LEN + GENERATED_GBL_DATA_SIZE >
>>> CONFIG_SYS_INIT_RAM_SIZE
>>> -#error "CONFIG_SYS_MALLOC_F_LEN too large to fit into initial RAM."
>>> +#if CONFIG_VAL(SYS_MALLOC_F_LEN) + GENERATED_GBL_DATA_SIZE >
>>> CONFIG_SYS_INIT_RAM_SIZE
>>> +#error "SYS_MALLOC_F_LEN too large to fit into initial RAM."
>>> #endif
>>> 
>>>        /* r3 = new stack pointer / pre-reloc malloc area */
>>> -       subi    r3, r3, CONFIG_SYS_MALLOC_F_LEN
>>> +       subi    r3, r3, CONFIG_VAL(SYS_MALLOC_F_LEN)
>>> 
>>>        /* Set pointer to pre-reloc malloc area in GD */
>>>        stw     r3, GD_MALLOC_BASE(r4)
>>> diff --git a/arch/powerpc/cpu/mpc85xx/start.S
>>> b/arch/powerpc/cpu/mpc85xx/start.S
>>> index 63fdffd..58cb9fc 100644
>>> --- a/arch/powerpc/cpu/mpc85xx/start.S
>>> +++ b/arch/powerpc/cpu/mpc85xx/start.S
>>> @@ -1183,14 +1183,13 @@ _start_cont:
>>>        lis     r3,(CONFIG_SYS_INIT_RAM_ADDR)@h
>>>        ori     r3,r3,((CONFIG_SYS_INIT_SP_OFFSET-16)&~0xf)@l /* Align to
>>> 16 */
>>> 
>>> -#ifdef CONFIG_SYS_MALLOC_F_LEN
>>> -
>>> -#if CONFIG_SYS_MALLOC_F_LEN + GENERATED_GBL_DATA_SIZE >
>>> CONFIG_SYS_INIT_RAM_SIZE
>>> -#error "CONFIG_SYS_MALLOC_F_LEN too large to fit into initial RAM."
>>> +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
>>> +#if CONFIG_VAL(SYS_MALLOC_F_LEN) + GENERATED_GBL_DATA_SIZE >
>>> CONFIG_SYS_INIT_RAM_SIZE
>>> +#error "SYS_MALLOC_F_LEN too large to fit into initial RAM."
>>> #endif
>>> 
>>>        /* Leave 16+ byte for back chain termination and NULL return
>>> address */
>>> -       subi    r3,r3,((CONFIG_SYS_MALLOC_F_LEN+16+15)&~0xf)
>>> +       subi    r3,r3,((CONFIG_VAL(SYS_MALLOC_F_LEN)+16+15)&~0xf)
>>> #endif
>> 
>> 
>> Could we now just drop the outermost "#if CONFIG_VAL(SYS_MALLOC_F_LEN)"
>> guard?
>> 
>> (And as a question to someone with knowledge of the history of this code:)
>> Why are those 16 bytes ("for back chain termination and NULL return
>> address") consumed only when CONFIG_SYS_MALLOC_F_LEN is defined? Shouldn't
>> this be required both with SYS_MALLOC_F_LEN and without?
>> 
> 
> The code is a bit tricky here: The actual back chain termination and NULL
> return address setting is further down:
> 
> stw     r0,0(r3)        /* Terminate Back Chain *
> stw     r0,+4(r3)       /* NULL return address. */
> 
> Now, if we don't have a pre-reloc malloc area, the r3 we computed via
> 
> lis     r3,(CONFIG_SYS_INIT_RAM_ADDR)@h
> ori     r3,r3,((CONFIG_SYS_INIT_SP_OFFSET-16)&~0xf)@l /* Align to 16 */
> 
> will just become our stack pointer.
> 
> The global data are starts right after the stack area
> (CONFIG_SYS_INIT_SP_OFFSET == CONFIG_SYS_GBL_DATA_OFFSET), which is OK at first
> glance, since the stack "grows downwards", but since the back chain termination
> and null address setting write beyond the stack pointer (see above), they would
> write into the GD area (and might be overwritten). But since we subtracted 16
> in the above statement, we have room left to store them.
> 
> The case where we have a pre-reloc malloc area is similar: Here we subtract the
> pre-reloc malloc area's size from the computed r3 and also a bit more to keep
> enough space for the back chain termination and null address:
> 
> subi    r3,r3,((CONFIG_SYS_MALLOC_F_LEN+16+15)&~0xf)
> 
> Otherwise, the addresses of these would lie in the pre-reloc malloc area, and
> might be overwritten.
> 
> So the statement basically exists to "fix" what the substraction of the
> pre-reloc malloc area size disturbed. If we don't have pre-reloc malloc, the
> initial setting of r3 (with the -16 offset) takes care of that already.

Thanks for reviewing.

So how do you want to handle this: should I just merge this as-is (as it’s in
a series that will go through the rockchip tree) or should we try to simplify
this code in the same go?

> 
>>> 
>>>        /* End of RAM */
>>> @@ -1204,7 +1203,7 @@ _start_cont:
>>>        cmplw   r4,r3
>>>        bne     1b
>>> 
>>> -#ifdef CONFIG_SYS_MALLOC_F_LEN
>>> +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
>>>        lis     r4,(CONFIG_SYS_INIT_RAM_ADDR)@h
>>>        ori     r4,r4,(CONFIG_SYS_GBL_DATA_OFFSET)@l
>>> 
>>> 
> 
> Best regards,
> 
> Mario

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

* [U-Boot] [U-Boot, v3, 02/10] mips: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  2017-07-27 10:44   ` Philipp Tomsich
@ 2017-07-27 12:18     ` Daniel Schwierzeck
  0 siblings, 0 replies; 47+ messages in thread
From: Daniel Schwierzeck @ 2017-07-27 12:18 UTC (permalink / raw)
  To: u-boot

2017-07-27 12:44 GMT+02:00 Philipp Tomsich
<philipp.tomsich@theobroma-systems.com>:
>
>
> On Mon, 24 Jul 2017, Andy Yan wrote:
>
>> Some platforms has very small sram to run spl code, so
>> it may have no enough sapce for so much malloc pool before
>> relocation in spl stage as the normal u-boot stage.
>> Use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit this condition.
>>
>> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
>> Acked-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
>> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>> ---
>>
>> Changes in v3:
>> - use CONFIG_VAL(), which suggested by Simon
>>
>> Changes in v2: None
>>
>> arch/mips/cpu/start.S | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/mips/cpu/start.S b/arch/mips/cpu/start.S
>> index d01ee9f..aa07654 100644
>> --- a/arch/mips/cpu/start.S
>> +++ b/arch/mips/cpu/start.S
>> @@ -60,8 +60,8 @@
>>                 sp, sp, GD_SIZE         # reserve space for gd
>>         and     sp, sp, t0              # force 16 byte alignment
>>         move    k0, sp                  # save gd pointer
>> -#ifdef CONFIG_SYS_MALLOC_F_LEN
>> -       li      t2, CONFIG_SYS_MALLOC_F_LEN
>> +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
>> +       li      t2, CONFIG_VAL(SYS_MALLOC_F_LEN)
>
>
> With CONFIG_VAL(...) there should always be a value returned.
>
> Could we drop the #if guard around this, as the PTR_SUBU below will then an
> identity transform (i.e. it will compute "sp = sp - 0")?

I don't see any advantage in it. This code is compiled with "set
.noreorder" so the assembler can't optimize or eliminate the dummy
instructions in case of "CONFIG_SYS_MALLOC_F_LEN = 0".Also there is
another instruction below which also needs this guard. Thus it would
be more consistent if both places use the same #if guard.

>
>
>>         PTR_SUBU \
>>                 sp, sp, t2              # reserve space for early malloc
>>         and     sp, sp, t0              # force 16 byte alignment
>> @@ -75,7 +75,7 @@
>>         blt     t0, t1, 1b
>>          PTR_ADDIU t0, PTRSIZE
>>
>> -#ifdef CONFIG_SYS_MALLOC_F_LEN
>> +#if CONFIG_VAL(SYS_MALLOC_F_LEN)
>>         PTR_S   sp, GD_MALLOC_BASE(k0)  # gd->malloc_base offset
>> #endif
>>         .endm
>>
>



-- 
- Daniel

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

* [U-Boot] [U-Boot, v3, 02/10] mips: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  2017-07-24  9:45 ` [U-Boot] [PATCH v3 02/10] mips: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
  2017-07-27 10:44   ` Philipp Tomsich
@ 2017-07-27 12:22   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  3 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 12:22 UTC (permalink / raw)
  To: u-boot

> Some platforms has very small sram to run spl code, so
> it may have no enough sapce for so much malloc pool before
> relocation in spl stage as the normal u-boot stage.
> Use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit this condition.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Acked-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> Changes in v3:
> - use CONFIG_VAL(), which suggested by Simon
> 
> Changes in v2: None
> 
>  arch/mips/cpu/start.S | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 04/10] microblaze: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  2017-07-24  9:49 ` [U-Boot] [PATCH v3 04/10] microblaze: " Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
  2017-07-27 10:50   ` Philipp Tomsich
@ 2017-07-27 12:23   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  3 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 12:23 UTC (permalink / raw)
  To: u-boot

> Some platforms has very small sram to run spl code, so
> it may have no enough sapce for so much malloc pool before
> relocation in spl stage as the normal u-boot stage.
> Use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit this condition.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> Changes in v3:
> - use CONFIG_VAL(), which suggested by Simon
> 
> Changes in v2: None
> 
>  arch/microblaze/cpu/start.S | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 

Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 03/10] powerpc: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  2017-07-24  9:47 ` [U-Boot] [PATCH v3 03/10] powerpc: " Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
  2017-07-27 10:48   ` Philipp Tomsich
@ 2017-07-27 12:23   ` Philipp Tomsich
  2017-07-27 12:44   ` Philipp Tomsich
  3 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 12:23 UTC (permalink / raw)
  To: u-boot

> Some platforms has very small sram to run spl code, so
> it may have no enough sapce for so much malloc pool before
> relocation in spl stage as the normal u-boot stage.
> Use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit this condition.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> Changes in v3:
> - use CONFIG_VAL(), which suggested by Simon
> 
> Changes in v2: None
> 
>  arch/powerpc/cpu/mpc83xx/start.S |  8 ++++----
>  arch/powerpc/cpu/mpc85xx/start.S | 11 +++++------
>  2 files changed, 9 insertions(+), 10 deletions(-)
> 

Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

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

* [U-Boot] [U-Boot, v3, 02/10] mips: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  2017-07-24  9:45 ` [U-Boot] [PATCH v3 02/10] mips: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently Andy Yan
                     ` (2 preceding siblings ...)
  2017-07-27 12:22   ` Philipp Tomsich
@ 2017-07-27 12:44   ` Philipp Tomsich
  3 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 12:44 UTC (permalink / raw)
  To: u-boot

> Some platforms has very small sram to run spl code, so
> it may have no enough sapce for so much malloc pool before
> relocation in spl stage as the normal u-boot stage.
> Use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit this condition.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Acked-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> Changes in v3:
> - use CONFIG_VAL(), which suggested by Simon
> 
> Changes in v2: None
> 
>  arch/mips/cpu/start.S | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

Applied to u-boot-rockchip, thanks!

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

* [U-Boot] [U-Boot, v3, 01/10] make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN
  2017-07-24  9:43 ` [U-Boot] [PATCH v3 01/10] " Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
  2017-07-27 10:37   ` Philipp Tomsich
@ 2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 12:44 UTC (permalink / raw)
  To: u-boot

> Some platforms has very small sram to run spl code, so it has no
> enough sapce for so much malloc pool before relocation in
> spl stage as the normal u-boot stage.
> Make spl and normal u-boot stage use independent SYS_MALLOC_F_LEN,
> Then people can sets the pre-relocation malloc pool according to
> the memory space indepently.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> Changes in v3:
> - use CONFIG_VAL(), which suggested by Simon
> 
> Changes in v2:
> - introduce a new control CONFIG_SPL_SYS_MALLOC_F_LEN, adviced by Simon
> 
>  Kconfig                           | 10 ++++++++++
>  cmd/bdinfo.c                      |  4 ++--
>  common/Makefile                   |  4 +++-
>  common/board_f.c                  |  4 ++--
>  common/board_r.c                  |  2 +-
>  common/dlmalloc.c                 | 12 ++++++------
>  common/init/board_init.c          |  8 ++++----
>  common/spl/spl.c                  |  8 ++++----
>  drivers/core/Kconfig              |  8 ++++----
>  drivers/serial/serial-uclass.c    |  4 ++--
>  include/asm-generic/global_data.h |  2 +-
>  lib/asm-offsets.c                 |  2 +-
>  lib/efi/efi_app.c                 |  2 +-
>  13 files changed, 41 insertions(+), 29 deletions(-)
> 

Applied to u-boot-rockchip, thanks!

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

* [U-Boot] [U-Boot, v3, 04/10] microblaze: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  2017-07-24  9:49 ` [U-Boot] [PATCH v3 04/10] microblaze: " Andy Yan
                     ` (2 preceding siblings ...)
  2017-07-27 12:23   ` Philipp Tomsich
@ 2017-07-27 12:44   ` Philipp Tomsich
  3 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 12:44 UTC (permalink / raw)
  To: u-boot

> Some platforms has very small sram to run spl code, so
> it may have no enough sapce for so much malloc pool before
> relocation in spl stage as the normal u-boot stage.
> Use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit this condition.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> Changes in v3:
> - use CONFIG_VAL(), which suggested by Simon
> 
> Changes in v2: None
> 
>  arch/microblaze/cpu/start.S | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 

Applied to u-boot-rockchip, thanks!

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

* [U-Boot] [U-Boot, v3, 03/10] powerpc: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently
  2017-07-24  9:47 ` [U-Boot] [PATCH v3 03/10] powerpc: " Andy Yan
                     ` (2 preceding siblings ...)
  2017-07-27 12:23   ` Philipp Tomsich
@ 2017-07-27 12:44   ` Philipp Tomsich
  3 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 12:44 UTC (permalink / raw)
  To: u-boot

> Some platforms has very small sram to run spl code, so
> it may have no enough sapce for so much malloc pool before
> relocation in spl stage as the normal u-boot stage.
> Use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit this condition.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> Changes in v3:
> - use CONFIG_VAL(), which suggested by Simon
> 
> Changes in v2: None
> 
>  arch/powerpc/cpu/mpc83xx/start.S |  8 ++++----
>  arch/powerpc/cpu/mpc85xx/start.S | 11 +++++------
>  2 files changed, 9 insertions(+), 10 deletions(-)
> 

Applied to u-boot-rockchip, thanks!

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

* [U-Boot] [U-Boot, v3, 05/10] sandbox: use CONFIG_VAL(SYS_MALLOC_F_LEN) to distinguish malloc pool size before relocation
  2017-07-24  9:49 ` [U-Boot] [PATCH v3 05/10] sandbox: use CONFIG_VAL(SYS_MALLOC_F_LEN) to distinguish malloc pool size before relocation Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
  2017-07-27 10:52   ` Philipp Tomsich
@ 2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 12:44 UTC (permalink / raw)
  To: u-boot

> From: Andy Yan <andyshrk@gmail.com>
> 
> SPL and normal u-boot stage use different malloc pool size
> configuration before relocation, so use CONFIG_VAL(SYS_MALLOC_F_LEN)
> to fit different boot stage.
> 
> Signed-off-by: Andy Yan <andyshrk@gmail.com>
> 
> Changes in v3:
> - use CONFIG_VAL(), which suggested by Simon
> 
> Changes in v2: None
> 
>  arch/sandbox/cpu/start.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> 

Applied to u-boot-rockchip, thanks!

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

* [U-Boot] [U-Boot, v3, 06/10] rockchip: set malloc pool size to 0 before relocation in spl state on rk3036 based board
  2017-07-24  9:50 ` [U-Boot] [PATCH v3 06/10] rockchip: set malloc pool size to 0 before relocation in spl state on rk3036 based board Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
  2017-07-27 10:38   ` Philipp Tomsich
@ 2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 12:44 UTC (permalink / raw)
  To: u-boot

> RK3036 only has 4kb sram, the spl code will use
> 3.4 ~ 3.5 kb, the last 0.5kb are used for SP and
> GD, so there is no space for malloc. Also, the spl
> will directly return to bootrom after dram initialized,
> they never need the space for malloc.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> Changes in v3: None
> Changes in v2: None
> 
>  configs/evb-rk3036_defconfig   | 1 +
>  configs/kylin-rk3036_defconfig | 1 +
>  2 files changed, 2 insertions(+)
> 

Applied to u-boot-rockchip, thanks!

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

* [U-Boot] [U-Boot, v3, 07/10] rockchip: disable SPL_ARCH_MEMCPY/MEMSET for rk3036
  2017-07-24  9:51 ` [U-Boot] [PATCH v3 07/10] rockchip: disable SPL_ARCH_MEMCPY/MEMSET for rk3036 Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
  2017-07-27 10:38   ` Philipp Tomsich
@ 2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 12:44 UTC (permalink / raw)
  To: u-boot

> RK3036 has no enough sapce use ARCH_MEMCPY/MEMSET in spl stage
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> Changes in v3: None
> Changes in v2: None
> 
>  configs/evb-rk3036_defconfig   | 2 ++
>  configs/kylin-rk3036_defconfig | 2 ++
>  2 files changed, 4 insertions(+)
> 

Applied to u-boot-rockchip, thanks!

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

* [U-Boot] [U-Boot, v3, 08/10] rockchip: enable SPL_LIBGENERIC for rk3036 based boards
  2017-07-24  9:51 ` [U-Boot] [PATCH v3 08/10] rockchip: enable SPL_LIBGENERIC for rk3036 based boards Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
  2017-07-27 10:38   ` Philipp Tomsich
@ 2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 12:44 UTC (permalink / raw)
  To: u-boot

> function board_init_f_init_reserve will call memset, which
> is implemented in lib, and enabled by CONFIG_SPL_LIBGENERIC_SUPPORT
> in spl stage.
> To reduce the code size, also enable SPL_TINY_MEMSET.
> As rk3036 will return to bootrom immediately after dram
> initialization, there is no need to run DM, so disable
> SPL_DM_SERIAL.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> Changes in v3:
> - disable SPL_DM_SERIAL
> 
> Changes in v2: None
> 
>  arch/arm/mach-rockchip/rk3036-board-spl.c | 6 ------
>  configs/evb-rk3036_defconfig              | 4 +++-
>  configs/kylin-rk3036_defconfig            | 4 +++-
>  3 files changed, 6 insertions(+), 8 deletions(-)
> 

Applied to u-boot-rockchip, thanks!

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

* [U-Boot] [U-Boot, v3, 09/10] rockchip: use puts instead of printf when back to bootrom
  2017-07-24  9:52 ` [U-Boot] [PATCH v3 09/10] rockchip: use puts instead of printf when back to bootrom Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
  2017-07-27 10:38   ` Philipp Tomsich
@ 2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 12:44 UTC (permalink / raw)
  To: u-boot

> printf will increase the code size more than 1kb, but platform
> like rk3036 has no enough space for it.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> Changes in v3:
> - use puts instead of printf, which suggested by Simon
> 
> Changes in v2: None
> 
>  arch/arm/mach-rockchip/bootrom.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Applied to u-boot-rockchip, thanks!

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

* [U-Boot] [U-Boot, v3, 10/10] rockchip: add u-boot specific dts for rk3036 sdk
  2017-07-24  9:52 ` [U-Boot] [PATCH v3 10/10] rockchip: add u-boot specific dts for rk3036 sdk Andy Yan
  2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
  2017-07-27 10:38   ` Philipp Tomsich
@ 2017-07-27 12:44   ` Philipp Tomsich
  2 siblings, 0 replies; 47+ messages in thread
From: Philipp Tomsich @ 2017-07-27 12:44 UTC (permalink / raw)
  To: u-boot

> Add this dts to enable debug uart releated devices
> before relocation.
> 
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
> Changes in v3: None
> Changes in v2: None
> 
>  arch/arm/dts/rk3036-sdk-u-boot.dtsi | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>  create mode 100644 arch/arm/dts/rk3036-sdk-u-boot.dtsi
> 

Applied to u-boot-rockchip, thanks!

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

end of thread, other threads:[~2017-07-27 12:44 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-24  9:42 [U-Boot] [PATCH v3 00/10] make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN Andy Yan
2017-07-24  9:43 ` [U-Boot] [PATCH v3 01/10] " Andy Yan
2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
2017-07-27 10:37   ` Philipp Tomsich
2017-07-27 12:44   ` Philipp Tomsich
2017-07-24  9:45 ` [U-Boot] [PATCH v3 02/10] mips: spl and normal u-boot stage set SYS_MALLOC_F_LEN indepently Andy Yan
2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
2017-07-27 10:44   ` Philipp Tomsich
2017-07-27 12:18     ` Daniel Schwierzeck
2017-07-27 12:22   ` Philipp Tomsich
2017-07-27 12:44   ` Philipp Tomsich
2017-07-24  9:47 ` [U-Boot] [PATCH v3 03/10] powerpc: " Andy Yan
2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
2017-07-27 10:48   ` Philipp Tomsich
2017-07-27 11:45     ` Mario Six
2017-07-27 12:05       ` Dr. Philipp Tomsich
2017-07-27 12:23   ` Philipp Tomsich
2017-07-27 12:44   ` Philipp Tomsich
2017-07-24  9:49 ` [U-Boot] [PATCH v3 04/10] microblaze: " Andy Yan
2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
2017-07-27 10:50   ` Philipp Tomsich
2017-07-27 12:23   ` Philipp Tomsich
2017-07-27 12:44   ` Philipp Tomsich
2017-07-24  9:49 ` [U-Boot] [PATCH v3 05/10] sandbox: use CONFIG_VAL(SYS_MALLOC_F_LEN) to distinguish malloc pool size before relocation Andy Yan
2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
2017-07-27 10:52   ` Philipp Tomsich
2017-07-27 12:44   ` Philipp Tomsich
2017-07-24  9:50 ` [U-Boot] [PATCH v3 06/10] rockchip: set malloc pool size to 0 before relocation in spl state on rk3036 based board Andy Yan
2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
2017-07-27 10:38   ` Philipp Tomsich
2017-07-27 12:44   ` Philipp Tomsich
2017-07-24  9:51 ` [U-Boot] [PATCH v3 07/10] rockchip: disable SPL_ARCH_MEMCPY/MEMSET for rk3036 Andy Yan
2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
2017-07-27 10:38   ` Philipp Tomsich
2017-07-27 12:44   ` Philipp Tomsich
2017-07-24  9:51 ` [U-Boot] [PATCH v3 08/10] rockchip: enable SPL_LIBGENERIC for rk3036 based boards Andy Yan
2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
2017-07-27 10:38   ` Philipp Tomsich
2017-07-27 12:44   ` Philipp Tomsich
2017-07-24  9:52 ` [U-Boot] [PATCH v3 09/10] rockchip: use puts instead of printf when back to bootrom Andy Yan
2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
2017-07-27 10:38   ` Philipp Tomsich
2017-07-27 12:44   ` Philipp Tomsich
2017-07-24  9:52 ` [U-Boot] [PATCH v3 10/10] rockchip: add u-boot specific dts for rk3036 sdk Andy Yan
2017-07-24 10:42   ` [U-Boot] [U-Boot, v3, " Philipp Tomsich
2017-07-27 10:38   ` Philipp Tomsich
2017-07-27 12:44   ` Philipp Tomsich

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.