All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 1/2] board_init: Change the logic to setup malloc_base
@ 2015-11-12 13:10 Fabio Estevam
  2015-11-12 13:10 ` [U-Boot] [PATCH v2 2/2] README: Add more clarification about CONFIG_SYS_SPL_MALLOC_START Fabio Estevam
  0 siblings, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2015-11-12 13:10 UTC (permalink / raw)
  To: u-boot

Prior to commit 5ba534d247d418 ("arm: Switch 32-bit ARM to using generic
global_data setup") we used to have assembly code that configured the
malloc_base address.

Since this commit we use the board_init_f_mem() function in C to setup
malloc_base address.

In board_init_f_mem() there was a deliberate choice to support only 
early malloc() or full malloc() in SPL, but not both. 

Adapt this logic to allow both to be used, one after the other, in SPL.

This issue has been observed in a Congatec board, where we need to
retrieve the manufacturing information from the SPI NOR (the SPI API 
calls malloc) prior to configuring the DRAM. In this case as malloc_base
was not configured we always see malloc to fail.

With this change we are able to use malloc in SPL prior to DRAM gets 
initialized.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v1:
- Improve commit log (Simon)

 common/init/board_init.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/common/init/board_init.c b/common/init/board_init.c
index e74b63b..1c6126d 100644
--- a/common/init/board_init.c
+++ b/common/init/board_init.c
@@ -50,8 +50,7 @@ ulong board_init_f_mem(ulong top)
 #endif
 	arch_setup_gd(gd_ptr);
 
-#if defined(CONFIG_SYS_MALLOC_F) && \
-	(!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SYS_SPL_MALLOC_START))
+#if defined(CONFIG_SYS_MALLOC_F)
 	top -= CONFIG_SYS_MALLOC_F_LEN;
 	gd->malloc_base = top;
 #endif
-- 
1.9.1

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

* [U-Boot] [PATCH v2 2/2] README: Add more clarification about CONFIG_SYS_SPL_MALLOC_START
  2015-11-12 13:10 [U-Boot] [PATCH v2 1/2] board_init: Change the logic to setup malloc_base Fabio Estevam
@ 2015-11-12 13:10 ` Fabio Estevam
  2015-11-12 13:41   ` Albert ARIBAUD
  0 siblings, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2015-11-12 13:10 UTC (permalink / raw)
  To: u-boot

Add some text to clarify the usage of full malloc (when
CONFIG_SYS_SPL_MALLOC_START is selected) and also that simple malloc()
can be used prior to DRAM initialization if CONFIG_SYS_MALLOC_F is defined.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v1:
- Improve README and commit log (Simon)

 README | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/README b/README
index ef8d437..92d36e6 100644
--- a/README
+++ b/README
@@ -3568,6 +3568,9 @@ FIT uImage format:
 
 		CONFIG_SYS_SPL_MALLOC_START
 		Starting address of the malloc pool used in SPL.
+		When this option is set the full malloc is used in SPL and
+		it is set up by spl_init() and before that, the simple malloc()
+		can be used if CONFIG_SYS_MALLOC_F is defined.
 
 		CONFIG_SYS_SPL_MALLOC_SIZE
 		The size of the malloc pool used in SPL.
-- 
1.9.1

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

* [U-Boot] [PATCH v2 2/2] README: Add more clarification about CONFIG_SYS_SPL_MALLOC_START
  2015-11-12 13:10 ` [U-Boot] [PATCH v2 2/2] README: Add more clarification about CONFIG_SYS_SPL_MALLOC_START Fabio Estevam
@ 2015-11-12 13:41   ` Albert ARIBAUD
  2015-11-12 14:29     ` Tom Rini
  0 siblings, 1 reply; 4+ messages in thread
From: Albert ARIBAUD @ 2015-11-12 13:41 UTC (permalink / raw)
  To: u-boot

Hello Fabio,

On Thu, 12 Nov 2015 11:10:11 -0200, Fabio Estevam
<fabio.estevam@freescale.com> wrote:
> Add some text to clarify the usage of full malloc (when
> CONFIG_SYS_SPL_MALLOC_START is selected) and also that simple malloc()
> can be used prior to DRAM initialization if CONFIG_SYS_MALLOC_F is defined.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> Changes since v1:
> - Improve README and commit log (Simon)

Not sure why you made this a 2-patch series -- a single patch would
have been fine.

Amicalement,
-- 
Albert.

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

* [U-Boot] [PATCH v2 2/2] README: Add more clarification about CONFIG_SYS_SPL_MALLOC_START
  2015-11-12 13:41   ` Albert ARIBAUD
@ 2015-11-12 14:29     ` Tom Rini
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2015-11-12 14:29 UTC (permalink / raw)
  To: u-boot

On Thu, Nov 12, 2015 at 02:41:45PM +0100, Albert ARIBAUD wrote:
> Hello Fabio,
> 
> On Thu, 12 Nov 2015 11:10:11 -0200, Fabio Estevam
> <fabio.estevam@freescale.com> wrote:
> > Add some text to clarify the usage of full malloc (when
> > CONFIG_SYS_SPL_MALLOC_START is selected) and also that simple malloc()
> > can be used prior to DRAM initialization if CONFIG_SYS_MALLOC_F is defined.
> > 
> > Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> > ---
> > Changes since v1:
> > - Improve README and commit log (Simon)
> 
> Not sure why you made this a 2-patch series -- a single patch would
> have been fine.

Indeed.  I'll squash them once Simon acks.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151112/210bd1e9/attachment.sig>

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

end of thread, other threads:[~2015-11-12 14:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-12 13:10 [U-Boot] [PATCH v2 1/2] board_init: Change the logic to setup malloc_base Fabio Estevam
2015-11-12 13:10 ` [U-Boot] [PATCH v2 2/2] README: Add more clarification about CONFIG_SYS_SPL_MALLOC_START Fabio Estevam
2015-11-12 13:41   ` Albert ARIBAUD
2015-11-12 14:29     ` Tom Rini

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.