All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 1/2] spl: Add spl_early_init()
@ 2017-03-15  0:06 Simon Glass
  2017-03-15  0:06 ` [U-Boot] [PATCH v3 2/2] rockchip: rk3288: use spl_early_init() instead of spl_init() Simon Glass
  2017-03-16 22:17 ` [U-Boot] [PATCH v3 1/2] spl: Add spl_early_init() Marek Vasut
  0 siblings, 2 replies; 10+ messages in thread
From: Simon Glass @ 2017-03-15  0:06 UTC (permalink / raw)
  To: u-boot

From: Eddie Cai <eddie.cai.linux@gmail.com>

At present malloc_base/_limit/_ptr are not initialised in spl_init() when
we call spl_init() in board_init_f(). This is due to a recent change aimed
at avoiding overwriting the malloc area set up on some boards by
spl_relocate_stack_gd().

However if CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN is not defined, we now
skip setting up the memory area in spl_init() which is obviously wrong.

To fix this, add a new function spl_early_init() which can be called in
board_init_f().

Fixes: b3d2861e (spl: Remove overwrite of relocated malloc limit)
Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
Rewrote spl_{,early_}init() to avoid duplicate code:
Rewrite/expand commit message:
Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v3: None
Changes in v2: None

 common/spl/spl.c                  | 46 +++++++++++++++++++++++++++++----------
 include/asm-generic/global_data.h |  1 +
 include/spl.h                     | 24 +++++++++++++++++---
 3 files changed, 57 insertions(+), 14 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 766fb3d6f4..2bc8b42027 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;
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index e02863dc03..5b356dd231 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -127,5 +127,6 @@ typedef struct global_data {
 #define GD_FLG_SKIP_RELOC	0x00800	/* Don't relocate		   */
 #define GD_FLG_RECORD		0x01000	/* Record console		   */
 #define GD_FLG_ENV_DEFAULT	0x02000 /* Default variable flag	   */
+#define GD_FLG_SPL_EARLY_INIT	0x04000 /* Early SPL init is done	   */
 
 #endif /* __ASM_GENERIC_GBL_DATA_H */
diff --git a/include/spl.h b/include/spl.h
index bde44374ea..cdd196d187 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -213,11 +213,29 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
 			  struct blk_desc *block_dev, int partition);
 
 /**
- * spl_init() - Set up device tree and driver model in SPL if enabled
+ * spl_early_init() - Set up device tree and driver model in SPL if enabled
  *
  * Call this function in board_init_f() if you want to use device tree and
- * driver model early, before board_init_r() is called. This function will
- * be called from board_init_r() if not called earlier.
+ * driver model early, before board_init_r() is called.
+ *
+ * If this is not called, then driver model will be inactive in SPL's
+ * board_init_f(), and no device tree will be available.
+ */
+int spl_early_init(void);
+
+/**
+ * spl_init() - Set up device tree and driver model in SPL if enabled
+ *
+ * You can optionally call spl_early_init(), then optionally call spl_init().
+ * This function will be called from board_init_r() if not called earlier.
+ *
+ * Both spl_early_init() and spl_init() perform a similar function except that
+ * the latter will not set up the malloc() area if
+ * CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN is enabled, since it is assumed to
+ * already be done by a calll to spl_relocate_stack_gd() before board_init_r()
+ * is reached.
+ *
+ * This function will be called from board_init_r() if not called earlier.
  *
  * If this is not called, then driver model will be inactive in SPL's
  * board_init_f(), and no device tree will be available.
-- 
2.12.0.367.g23dc2f6d3c-goog

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

* [U-Boot] [PATCH v3 2/2] rockchip: rk3288: use spl_early_init() instead of spl_init()
  2017-03-15  0:06 [U-Boot] [PATCH v3 1/2] spl: Add spl_early_init() Simon Glass
@ 2017-03-15  0:06 ` Simon Glass
  2017-03-15  8:21   ` Andy Pont
  2017-03-16 22:17 ` [U-Boot] [PATCH v3 1/2] spl: Add spl_early_init() Marek Vasut
  1 sibling, 1 reply; 10+ messages in thread
From: Simon Glass @ 2017-03-15  0:06 UTC (permalink / raw)
  To: u-boot

From: Eddie Cai <eddie.cai.linux@gmail.com>

Use spl_early_init() to make sure that early malloc() is initialised. This
fixes booting on firefly-rk3288, for example.

Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v3:
- Rewrite both commit messages

Changes in v2:
- Add v2 to the series since this is a new version

 arch/arm/mach-rockchip/rk3288-board-spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/rk3288-board-spl.c b/arch/arm/mach-rockchip/rk3288-board-spl.c
index e51e19bb2d..f494843663 100644
--- a/arch/arm/mach-rockchip/rk3288-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3288-board-spl.c
@@ -185,7 +185,7 @@ void board_init_f(ulong dummy)
 	debug_uart_init();
 #endif
 
-	ret = spl_init();
+	ret = spl_early_init();
 	if (ret) {
 		debug("spl_init() failed: %d\n", ret);
 		hang();
-- 
2.12.0.367.g23dc2f6d3c-goog

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

* [U-Boot] [PATCH v3 2/2] rockchip: rk3288: use spl_early_init() instead of spl_init()
  2017-03-15  0:06 ` [U-Boot] [PATCH v3 2/2] rockchip: rk3288: use spl_early_init() instead of spl_init() Simon Glass
@ 2017-03-15  8:21   ` Andy Pont
  0 siblings, 0 replies; 10+ messages in thread
From: Andy Pont @ 2017-03-15  8:21 UTC (permalink / raw)
  To: u-boot

Simon wrote...

> diff --git a/arch/arm/mach-rockchip/rk3288-board-spl.c b/arch/arm/mach-
> rockchip/rk3288-board-spl.c
> index e51e19bb2d..f494843663 100644
> --- a/arch/arm/mach-rockchip/rk3288-board-spl.c
> +++ b/arch/arm/mach-rockchip/rk3288-board-spl.c
> @@ -185,7 +185,7 @@ void board_init_f(ulong dummy)
>  	debug_uart_init();
>  #endif
> 
> -	ret = spl_init();
> +	ret = spl_early_init();
>  	if (ret) {
>  		debug("spl_init() failed: %d\n", ret);

Shouldn't the function name used in the debug statement be changed to spl_early_init()?

-Andy.

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

* [U-Boot] [PATCH v3 1/2] spl: Add spl_early_init()
  2017-03-15  0:06 [U-Boot] [PATCH v3 1/2] spl: Add spl_early_init() Simon Glass
  2017-03-15  0:06 ` [U-Boot] [PATCH v3 2/2] rockchip: rk3288: use spl_early_init() instead of spl_init() Simon Glass
@ 2017-03-16 22:17 ` Marek Vasut
  2017-03-16 22:21   ` Simon Glass
  1 sibling, 1 reply; 10+ messages in thread
From: Marek Vasut @ 2017-03-16 22:17 UTC (permalink / raw)
  To: u-boot

On 03/15/2017 01:06 AM, Simon Glass wrote:
> From: Eddie Cai <eddie.cai.linux@gmail.com>
> 
> At present malloc_base/_limit/_ptr are not initialised in spl_init() when
> we call spl_init() in board_init_f().

Are you even supposed to call spl_init() from board_init_f() ?
I was under the impression that's supposed to be called by
board_init_r() only.

> This is due to a recent change aimed
> at avoiding overwriting the malloc area set up on some boards by
> spl_relocate_stack_gd().
> 
> However if CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN is not defined, we now
> skip setting up the memory area in spl_init() which is obviously wrong.
> 
> To fix this, add a new function spl_early_init() which can be called in
> board_init_f().
> 
> Fixes: b3d2861e (spl: Remove overwrite of relocated malloc limit)
> Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
> Rewrote spl_{,early_}init() to avoid duplicate code:
> Rewrite/expand commit message:
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
> Changes in v3: None
> Changes in v2: None
> 
>  common/spl/spl.c                  | 46 +++++++++++++++++++++++++++++----------
>  include/asm-generic/global_data.h |  1 +
>  include/spl.h                     | 24 +++++++++++++++++---
>  3 files changed, 57 insertions(+), 14 deletions(-)
> 
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 766fb3d6f4..2bc8b42027 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;
> diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
> index e02863dc03..5b356dd231 100644
> --- a/include/asm-generic/global_data.h
> +++ b/include/asm-generic/global_data.h
> @@ -127,5 +127,6 @@ typedef struct global_data {
>  #define GD_FLG_SKIP_RELOC	0x00800	/* Don't relocate		   */
>  #define GD_FLG_RECORD		0x01000	/* Record console		   */
>  #define GD_FLG_ENV_DEFAULT	0x02000 /* Default variable flag	   */
> +#define GD_FLG_SPL_EARLY_INIT	0x04000 /* Early SPL init is done	   */
>  
>  #endif /* __ASM_GENERIC_GBL_DATA_H */
> diff --git a/include/spl.h b/include/spl.h
> index bde44374ea..cdd196d187 100644
> --- a/include/spl.h
> +++ b/include/spl.h
> @@ -213,11 +213,29 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
>  			  struct blk_desc *block_dev, int partition);
>  
>  /**
> - * spl_init() - Set up device tree and driver model in SPL if enabled
> + * spl_early_init() - Set up device tree and driver model in SPL if enabled
>   *
>   * Call this function in board_init_f() if you want to use device tree and
> - * driver model early, before board_init_r() is called. This function will
> - * be called from board_init_r() if not called earlier.
> + * driver model early, before board_init_r() is called.
> + *
> + * If this is not called, then driver model will be inactive in SPL's
> + * board_init_f(), and no device tree will be available.
> + */
> +int spl_early_init(void);
> +
> +/**
> + * spl_init() - Set up device tree and driver model in SPL if enabled
> + *
> + * You can optionally call spl_early_init(), then optionally call spl_init().
> + * This function will be called from board_init_r() if not called earlier.
> + *
> + * Both spl_early_init() and spl_init() perform a similar function except that
> + * the latter will not set up the malloc() area if
> + * CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN is enabled, since it is assumed to
> + * already be done by a calll to spl_relocate_stack_gd() before board_init_r()
> + * is reached.
> + *
> + * This function will be called from board_init_r() if not called earlier.
>   *
>   * If this is not called, then driver model will be inactive in SPL's
>   * board_init_f(), and no device tree will be available.
> 


-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v3 1/2] spl: Add spl_early_init()
  2017-03-16 22:17 ` [U-Boot] [PATCH v3 1/2] spl: Add spl_early_init() Marek Vasut
@ 2017-03-16 22:21   ` Simon Glass
  2017-03-16 22:24     ` Marek Vasut
  0 siblings, 1 reply; 10+ messages in thread
From: Simon Glass @ 2017-03-16 22:21 UTC (permalink / raw)
  To: u-boot

Hi Marek,

On 16 March 2017 at 16:17, Marek Vasut <marex@denx.de> wrote:
> On 03/15/2017 01:06 AM, Simon Glass wrote:
>> From: Eddie Cai <eddie.cai.linux@gmail.com>
>>
>> At present malloc_base/_limit/_ptr are not initialised in spl_init() when
>> we call spl_init() in board_init_f().
>
> Are you even supposed to call spl_init() from board_init_f() ?
> I was under the impression that's supposed to be called by
> board_init_r() only.
>

If you need to use DM then yes you must call it. At present with SPL
it is not normally available until board_init_r(). At some point we
will have all the boards consistent and we might be able to change
this by default.

[..]

Regards,
Simon

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

* [U-Boot] [PATCH v3 1/2] spl: Add spl_early_init()
  2017-03-16 22:21   ` Simon Glass
@ 2017-03-16 22:24     ` Marek Vasut
  2017-03-16 22:28       ` Simon Glass
  0 siblings, 1 reply; 10+ messages in thread
From: Marek Vasut @ 2017-03-16 22:24 UTC (permalink / raw)
  To: u-boot

On 03/16/2017 11:21 PM, Simon Glass wrote:
> Hi Marek,
> 
> On 16 March 2017 at 16:17, Marek Vasut <marex@denx.de> wrote:
>> On 03/15/2017 01:06 AM, Simon Glass wrote:
>>> From: Eddie Cai <eddie.cai.linux@gmail.com>
>>>
>>> At present malloc_base/_limit/_ptr are not initialised in spl_init() when
>>> we call spl_init() in board_init_f().
>>
>> Are you even supposed to call spl_init() from board_init_f() ?
>> I was under the impression that's supposed to be called by
>> board_init_r() only.
>>
> 
> If you need to use DM then yes you must call it.

SoCFPGA uses DM and doesn't call it until board_init_r() . I think
there's some significant confusion about how this whole malloc stuff
should work.

> At present with SPL
> it is not normally available until board_init_r(). At some point we
> will have all the boards consistent and we might be able to change
> this by default.
> 
> [..]
> 
> Regards,
> Simon
> 


-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v3 1/2] spl: Add spl_early_init()
  2017-03-16 22:24     ` Marek Vasut
@ 2017-03-16 22:28       ` Simon Glass
  2017-03-16 22:37         ` Marek Vasut
  0 siblings, 1 reply; 10+ messages in thread
From: Simon Glass @ 2017-03-16 22:28 UTC (permalink / raw)
  To: u-boot

Hi Marek,

On 16 March 2017 at 16:24, Marek Vasut <marex@denx.de> wrote:
> On 03/16/2017 11:21 PM, Simon Glass wrote:
>> Hi Marek,
>>
>> On 16 March 2017 at 16:17, Marek Vasut <marex@denx.de> wrote:
>>> On 03/15/2017 01:06 AM, Simon Glass wrote:
>>>> From: Eddie Cai <eddie.cai.linux@gmail.com>
>>>>
>>>> At present malloc_base/_limit/_ptr are not initialised in spl_init() when
>>>> we call spl_init() in board_init_f().
>>>
>>> Are you even supposed to call spl_init() from board_init_f() ?
>>> I was under the impression that's supposed to be called by
>>> board_init_r() only.
>>>
>>
>> If you need to use DM then yes you must call it.
>
> SoCFPGA uses DM and doesn't call it until board_init_r() . I think
> there's some significant confusion about how this whole malloc stuff
> should work.

OK, well if you want to use DM within board_init_f() you must call
this function  If not, then board_init_r() will do it for you. When
does SoCFPGA start using DM?

>
>> At present with SPL
>> it is not normally available until board_init_r(). At some point we
>> will have all the boards consistent and we might be able to change
>> this by default.
>>
>> [..]

Regards,
Simon

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

* [U-Boot] [PATCH v3 1/2] spl: Add spl_early_init()
  2017-03-16 22:28       ` Simon Glass
@ 2017-03-16 22:37         ` Marek Vasut
  2017-03-16 22:39           ` Simon Glass
  0 siblings, 1 reply; 10+ messages in thread
From: Marek Vasut @ 2017-03-16 22:37 UTC (permalink / raw)
  To: u-boot

On 03/16/2017 11:28 PM, Simon Glass wrote:
> Hi Marek,
> 
> On 16 March 2017 at 16:24, Marek Vasut <marex@denx.de> wrote:
>> On 03/16/2017 11:21 PM, Simon Glass wrote:
>>> Hi Marek,
>>>
>>> On 16 March 2017 at 16:17, Marek Vasut <marex@denx.de> wrote:
>>>> On 03/15/2017 01:06 AM, Simon Glass wrote:
>>>>> From: Eddie Cai <eddie.cai.linux@gmail.com>
>>>>>
>>>>> At present malloc_base/_limit/_ptr are not initialised in spl_init() when
>>>>> we call spl_init() in board_init_f().
>>>>
>>>> Are you even supposed to call spl_init() from board_init_f() ?
>>>> I was under the impression that's supposed to be called by
>>>> board_init_r() only.
>>>>
>>>
>>> If you need to use DM then yes you must call it.
>>
>> SoCFPGA uses DM and doesn't call it until board_init_r() . I think
>> there's some significant confusion about how this whole malloc stuff
>> should work.
> 
> OK, well if you want to use DM within board_init_f() you must call
> this function  If not, then board_init_r() will do it for you. When
> does SoCFPGA start using DM?

In _r . I don't see anyone using DM in _f though. What is that needed
for , serial ?


-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v3 1/2] spl: Add spl_early_init()
  2017-03-16 22:37         ` Marek Vasut
@ 2017-03-16 22:39           ` Simon Glass
  2017-03-16 22:45             ` Marek Vasut
  0 siblings, 1 reply; 10+ messages in thread
From: Simon Glass @ 2017-03-16 22:39 UTC (permalink / raw)
  To: u-boot

Hi Marek,

On 16 March 2017 at 16:37, Marek Vasut <marex@denx.de> wrote:
> On 03/16/2017 11:28 PM, Simon Glass wrote:
>> Hi Marek,
>>
>> On 16 March 2017 at 16:24, Marek Vasut <marex@denx.de> wrote:
>>> On 03/16/2017 11:21 PM, Simon Glass wrote:
>>>> Hi Marek,
>>>>
>>>> On 16 March 2017 at 16:17, Marek Vasut <marex@denx.de> wrote:
>>>>> On 03/15/2017 01:06 AM, Simon Glass wrote:
>>>>>> From: Eddie Cai <eddie.cai.linux@gmail.com>
>>>>>>
>>>>>> At present malloc_base/_limit/_ptr are not initialised in spl_init() when
>>>>>> we call spl_init() in board_init_f().
>>>>>
>>>>> Are you even supposed to call spl_init() from board_init_f() ?
>>>>> I was under the impression that's supposed to be called by
>>>>> board_init_r() only.
>>>>>
>>>>
>>>> If you need to use DM then yes you must call it.
>>>
>>> SoCFPGA uses DM and doesn't call it until board_init_r() . I think
>>> there's some significant confusion about how this whole malloc stuff
>>> should work.
>>
>> OK, well if you want to use DM within board_init_f() you must call
>> this function  If not, then board_init_r() will do it for you. When
>> does SoCFPGA start using DM?
>
> In _r . I don't see anyone using DM in _f though. What is that needed
> for , serial ?

See for example board_init_f() in arch/arm/mach-rockchip/rk3288-board-spl.c

It include sclock, pintctrl, SDRAM at least.

Regards,
Simon

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

* [U-Boot] [PATCH v3 1/2] spl: Add spl_early_init()
  2017-03-16 22:39           ` Simon Glass
@ 2017-03-16 22:45             ` Marek Vasut
  0 siblings, 0 replies; 10+ messages in thread
From: Marek Vasut @ 2017-03-16 22:45 UTC (permalink / raw)
  To: u-boot

On 03/16/2017 11:39 PM, Simon Glass wrote:
> Hi Marek,
> 
> On 16 March 2017 at 16:37, Marek Vasut <marex@denx.de> wrote:
>> On 03/16/2017 11:28 PM, Simon Glass wrote:
>>> Hi Marek,
>>>
>>> On 16 March 2017 at 16:24, Marek Vasut <marex@denx.de> wrote:
>>>> On 03/16/2017 11:21 PM, Simon Glass wrote:
>>>>> Hi Marek,
>>>>>
>>>>> On 16 March 2017 at 16:17, Marek Vasut <marex@denx.de> wrote:
>>>>>> On 03/15/2017 01:06 AM, Simon Glass wrote:
>>>>>>> From: Eddie Cai <eddie.cai.linux@gmail.com>
>>>>>>>
>>>>>>> At present malloc_base/_limit/_ptr are not initialised in spl_init() when
>>>>>>> we call spl_init() in board_init_f().
>>>>>>
>>>>>> Are you even supposed to call spl_init() from board_init_f() ?
>>>>>> I was under the impression that's supposed to be called by
>>>>>> board_init_r() only.
>>>>>>
>>>>>
>>>>> If you need to use DM then yes you must call it.
>>>>
>>>> SoCFPGA uses DM and doesn't call it until board_init_r() . I think
>>>> there's some significant confusion about how this whole malloc stuff
>>>> should work.
>>>
>>> OK, well if you want to use DM within board_init_f() you must call
>>> this function  If not, then board_init_r() will do it for you. When
>>> does SoCFPGA start using DM?
>>
>> In _r . I don't see anyone using DM in _f though. What is that needed
>> for , serial ?
> 
> See for example board_init_f() in arch/arm/mach-rockchip/rk3288-board-spl.c
> 
> It include sclock, pintctrl, SDRAM at least.

Haaa, OK

-- 
Best regards,
Marek Vasut

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

end of thread, other threads:[~2017-03-16 22:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-15  0:06 [U-Boot] [PATCH v3 1/2] spl: Add spl_early_init() Simon Glass
2017-03-15  0:06 ` [U-Boot] [PATCH v3 2/2] rockchip: rk3288: use spl_early_init() instead of spl_init() Simon Glass
2017-03-15  8:21   ` Andy Pont
2017-03-16 22:17 ` [U-Boot] [PATCH v3 1/2] spl: Add spl_early_init() Marek Vasut
2017-03-16 22:21   ` Simon Glass
2017-03-16 22:24     ` Marek Vasut
2017-03-16 22:28       ` Simon Glass
2017-03-16 22:37         ` Marek Vasut
2017-03-16 22:39           ` Simon Glass
2017-03-16 22:45             ` Marek Vasut

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.