All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot]  rockchip: rk3288: init malloc_base, limit, ptr before spl_init
@ 2017-02-21  8:15 Eddie Cai
  2017-02-22  4:00 ` Simon Glass
  0 siblings, 1 reply; 4+ messages in thread
From: Eddie Cai @ 2017-02-21  8:15 UTC (permalink / raw)
  To: u-boot

Andrew F. Davis's below patch broke rk3288 based board. that is because we call
spl_init in board_init_f which is at very early stage. What Andrew want to fix
is calling spl_init very late. That patch will make malloc_base, limit, ptr not
initualized in spl_init when we call spl_init in board_init_f.  It seems
impossible to meet two requirement in spl_init. So i simply init malloc_base,
limit, ptr before spl_init.

commit b3d2861eb20a795b99292b823c923935df26dfc6
Author: Andrew F. Davis <afd@ti.com>
Date:   Fri Jan 27 10:39:19 2017 -0600

    spl: Remove overwrite of relocated malloc limit

Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
---
 arch/arm/mach-rockchip/rk3288-board-spl.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/mach-rockchip/rk3288-board-spl.c b/arch/arm/mach-rockchip/rk3288-board-spl.c
index 930939a..1f3170d 100644
--- a/arch/arm/mach-rockchip/rk3288-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3288-board-spl.c
@@ -184,6 +184,16 @@ void board_init_f(ulong dummy)
 	debug_uart_init();
 #endif
 
+#if defined(CONFIG_SYS_MALLOC_F_LEN)
+#ifdef CONFIG_MALLOC_F_ADDR
+	gd->malloc_base = CONFIG_MALLOC_F_ADDR;
+#endif
+#ifdef CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN
+	gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN;
+#endif
+	gd->malloc_ptr = 0;
+#endif
+
 	ret = spl_init();
 	if (ret) {
 		debug("spl_init() failed: %d\n", ret);
-- 
2.7.4

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

* [U-Boot] rockchip: rk3288: init malloc_base, limit, ptr before spl_init
  2017-02-21  8:15 [U-Boot] rockchip: rk3288: init malloc_base, limit, ptr before spl_init Eddie Cai
@ 2017-02-22  4:00 ` Simon Glass
  2017-02-23  2:04   ` Eddie Cai
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Glass @ 2017-02-22  4:00 UTC (permalink / raw)
  To: u-boot

Hi Eddie,

On 21 February 2017 at 01:15, Eddie Cai <eddie.cai.linux@gmail.com> wrote:
> Andrew F. Davis's below patch broke rk3288 based board. that is because we call
> spl_init in board_init_f which is at very early stage. What Andrew want to fix
> is calling spl_init very late. That patch will make malloc_base, limit, ptr not
> initualized in spl_init when we call spl_init in board_init_f.  It seems
> impossible to meet two requirement in spl_init. So i simply init malloc_base,
> limit, ptr before spl_init.
>
> commit b3d2861eb20a795b99292b823c923935df26dfc6
> Author: Andrew F. Davis <afd@ti.com>
> Date:   Fri Jan 27 10:39:19 2017 -0600
>
>     spl: Remove overwrite of relocated malloc limit
>
> Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
> ---
>  arch/arm/mach-rockchip/rk3288-board-spl.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/arch/arm/mach-rockchip/rk3288-board-spl.c b/arch/arm/mach-rockchip/rk3288-board-spl.c
> index 930939a..1f3170d 100644
> --- a/arch/arm/mach-rockchip/rk3288-board-spl.c
> +++ b/arch/arm/mach-rockchip/rk3288-board-spl.c
> @@ -184,6 +184,16 @@ void board_init_f(ulong dummy)
>         debug_uart_init();
>  #endif
>
> +#if defined(CONFIG_SYS_MALLOC_F_LEN)
> +#ifdef CONFIG_MALLOC_F_ADDR
> +       gd->malloc_base = CONFIG_MALLOC_F_ADDR;
> +#endif
> +#ifdef CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN
> +       gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN;
> +#endif
> +       gd->malloc_ptr = 0;
> +#endif
> +

Yuck we should not repeat this code. Can we instead have two versions
of spl_init()? Perhaps call the one that always sets things up
spl_early_init() since it is called before board_init_r()?

>         ret = spl_init();
>         if (ret) {
>                 debug("spl_init() failed: %d\n", ret);
> --
> 2.7.4
>

Regards,
Simon

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

* [U-Boot] rockchip: rk3288: init malloc_base, limit, ptr before spl_init
  2017-02-22  4:00 ` Simon Glass
@ 2017-02-23  2:04   ` Eddie Cai
  2017-02-23  2:23     ` Simon Glass
  0 siblings, 1 reply; 4+ messages in thread
From: Eddie Cai @ 2017-02-23  2:04 UTC (permalink / raw)
  To: u-boot

Hi Simon

2017-02-22 12:00 GMT+08:00 Simon Glass <sjg@chromium.org>:

> Hi Eddie,
>
> On 21 February 2017 at 01:15, Eddie Cai <eddie.cai.linux@gmail.com> wrote:
> > Andrew F. Davis's below patch broke rk3288 based board. that is because
> we call
> > spl_init in board_init_f which is at very early stage. What Andrew want
> to fix
> > is calling spl_init very late. That patch will make malloc_base, limit,
> ptr not
> > initualized in spl_init when we call spl_init in board_init_f.  It seems
> > impossible to meet two requirement in spl_init. So i simply init
> malloc_base,
> > limit, ptr before spl_init.
> >
> > commit b3d2861eb20a795b99292b823c923935df26dfc6
> > Author: Andrew F. Davis <afd@ti.com>
> > Date:   Fri Jan 27 10:39:19 2017 -0600
> >
> >     spl: Remove overwrite of relocated malloc limit
> >
> > Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
> > ---
> >  arch/arm/mach-rockchip/rk3288-board-spl.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> >
> > diff --git a/arch/arm/mach-rockchip/rk3288-board-spl.c
> b/arch/arm/mach-rockchip/rk3288-board-spl.c
> > index 930939a..1f3170d 100644
> > --- a/arch/arm/mach-rockchip/rk3288-board-spl.c
> > +++ b/arch/arm/mach-rockchip/rk3288-board-spl.c
> > @@ -184,6 +184,16 @@ void board_init_f(ulong dummy)
> >         debug_uart_init();
> >  #endif
> >
> > +#if defined(CONFIG_SYS_MALLOC_F_LEN)
> > +#ifdef CONFIG_MALLOC_F_ADDR
> > +       gd->malloc_base = CONFIG_MALLOC_F_ADDR;
> > +#endif
> > +#ifdef CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN
> > +       gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN;
> > +#endif
> > +       gd->malloc_ptr = 0;
> > +#endif
> > +
>
> Yuck we should not repeat this code. Can we instead have two versions
> of spl_init()? Perhaps call the one that always sets things up
> spl_early_init() since it is called before board_init_r()?
>
 I search but did find spl_early_init in mainline U-Boot. I found exynos
U-Boot for chromium os have spl_early_init. But it is far away from what we
need. So i add one by myself.

>
> >         ret = spl_init();
> >         if (ret) {
> >                 debug("spl_init() failed: %d\n", ret);
> > --
> > 2.7.4
> >
>
> Regards,
> Simon
>

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

* [U-Boot] rockchip: rk3288: init malloc_base, limit, ptr before spl_init
  2017-02-23  2:04   ` Eddie Cai
@ 2017-02-23  2:23     ` Simon Glass
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2017-02-23  2:23 UTC (permalink / raw)
  To: u-boot

Hi Eddie,

On 22 February 2017 at 19:04, Eddie Cai <eddie.cai.linux@gmail.com> wrote:
> Hi Simon
>
> 2017-02-22 12:00 GMT+08:00 Simon Glass <sjg@chromium.org>:
>>
>> Hi Eddie,
>>
>> On 21 February 2017 at 01:15, Eddie Cai <eddie.cai.linux@gmail.com> wrote:
>> > Andrew F. Davis's below patch broke rk3288 based board. that is because
>> > we call
>> > spl_init in board_init_f which is at very early stage. What Andrew want
>> > to fix
>> > is calling spl_init very late. That patch will make malloc_base, limit,
>> > ptr not
>> > initualized in spl_init when we call spl_init in board_init_f.  It seems
>> > impossible to meet two requirement in spl_init. So i simply init
>> > malloc_base,
>> > limit, ptr before spl_init.
>> >
>> > commit b3d2861eb20a795b99292b823c923935df26dfc6
>> > Author: Andrew F. Davis <afd@ti.com>
>> > Date:   Fri Jan 27 10:39:19 2017 -0600
>> >
>> >     spl: Remove overwrite of relocated malloc limit
>> >
>> > Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
>> > ---
>> >  arch/arm/mach-rockchip/rk3288-board-spl.c | 10 ++++++++++
>> >  1 file changed, 10 insertions(+)
>> >
>> > diff --git a/arch/arm/mach-rockchip/rk3288-board-spl.c
>> > b/arch/arm/mach-rockchip/rk3288-board-spl.c
>> > index 930939a..1f3170d 100644
>> > --- a/arch/arm/mach-rockchip/rk3288-board-spl.c
>> > +++ b/arch/arm/mach-rockchip/rk3288-board-spl.c
>> > @@ -184,6 +184,16 @@ void board_init_f(ulong dummy)
>> >         debug_uart_init();
>> >  #endif
>> >
>> > +#if defined(CONFIG_SYS_MALLOC_F_LEN)
>> > +#ifdef CONFIG_MALLOC_F_ADDR
>> > +       gd->malloc_base = CONFIG_MALLOC_F_ADDR;
>> > +#endif
>> > +#ifdef CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN
>> > +       gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN;
>> > +#endif
>> > +       gd->malloc_ptr = 0;
>> > +#endif
>> > +
>>
>> Yuck we should not repeat this code. Can we instead have two versions
>> of spl_init()? Perhaps call the one that always sets things up
>> spl_early_init() since it is called before board_init_r()?
>
>  I search but did find spl_early_init in mainline U-Boot. I found exynos
> U-Boot for chromium os have spl_early_init. But it is far away from what we
> need. So i add one by myself.

Sorry I wasn't clear. Yes I meant to create a new one, like (and next
to) the existing one, pulling out any common code that you can.

>>
>>
>> >         ret = spl_init();
>> >         if (ret) {
>> >                 debug("spl_init() failed: %d\n", ret);
>> > --
>> > 2.7.4
>> >
>>
>> Regards,
>> Simon
>
>

Regards,
Simon

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

end of thread, other threads:[~2017-02-23  2:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-21  8:15 [U-Boot] rockchip: rk3288: init malloc_base, limit, ptr before spl_init Eddie Cai
2017-02-22  4:00 ` Simon Glass
2017-02-23  2:04   ` Eddie Cai
2017-02-23  2:23     ` Simon Glass

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.