aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-03-17 09:11:12 -0400
committerTom Rini <trini@konsulko.com>2017-03-17 14:15:17 -0400
commitf9515756b6d76cde99b385dda905dfb20d31ea48 (patch)
treeb2cd0007fb90a43992cb51f1a02d4e191e3dde10 /common
parente245f1a5db086d676cbd97371046ea5c5e554326 (diff)
parent520c174b3564ae183f0e7c118dc8ce3770ae20b0 (diff)
downloadu-boot-f9515756b6d76cde99b385dda905dfb20d31ea48.zip
u-boot-f9515756b6d76cde99b385dda905dfb20d31ea48.tar.gz
u-boot-f9515756b6d76cde99b385dda905dfb20d31ea48.tar.bz2
Merge git://git.denx.de/u-boot-rockchip
This includes support for rk3188 from Heiko Stübner and and rk3328 from Kever Yang. Also included is SPL support for rk3399 and a fix for rk3288 to get it booting again (spl_early_init()).
Diffstat (limited to 'common')
-rw-r--r--common/spl/spl.c46
1 files changed, 35 insertions, 11 deletions
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 766fb3d..2bc8b42 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -170,22 +170,20 @@ __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
image_entry();
}
-int spl_init(void)
+static int spl_common_init(bool setup_malloc)
{
int ret;
- debug("spl_init()\n");
-/*
- * with CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN we set malloc_base and
- * malloc_limit in spl_relocate_stack_gd
- */
-#if defined(CONFIG_SYS_MALLOC_F_LEN) && \
- !defined(CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN)
+ debug("spl_early_init()\n");
+
+#if defined(CONFIG_SYS_MALLOC_F_LEN)
+ if (setup_malloc) {
#ifdef CONFIG_MALLOC_F_ADDR
- gd->malloc_base = CONFIG_MALLOC_F_ADDR;
+ gd->malloc_base = CONFIG_MALLOC_F_ADDR;
#endif
- gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN;
- gd->malloc_ptr = 0;
+ gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN;
+ gd->malloc_ptr = 0;
+ }
#endif
if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
ret = fdtdec_setup();
@@ -202,6 +200,32 @@ int spl_init(void)
return ret;
}
}
+
+ return 0;
+}
+
+int spl_early_init(void)
+{
+ int ret;
+
+ ret = spl_common_init(true);
+ if (ret)
+ return ret;
+ gd->flags |= GD_FLG_SPL_EARLY_INIT;
+
+ return 0;
+}
+
+int spl_init(void)
+{
+ int ret;
+
+ if (!(gd->flags & GD_FLG_SPL_EARLY_INIT)) {
+ ret = spl_common_init(
+ !IS_ENABLED(CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN));
+ if (ret)
+ return ret;
+ }
gd->flags |= GD_FLG_SPL_INIT;
return 0;