public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] MIPS: Add board_early_init_f() to init_sequence
@ 2008-11-12 12:18 Stefan Roese
  2008-11-16  7:01 ` Shinya Kuribayashi
  2008-11-17 14:14 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 7+ messages in thread
From: Stefan Roese @ 2008-11-12 12:18 UTC (permalink / raw)
  To: u-boot

This patch adds the board_early_init_f() call to the MIPS init
sequence. A weak dummy implementation is also added which can be
overridden by a board specific version.

This will be used by the upcoming VCTH board support.

Signed-off-by: Stefan Roese <sr@denx.de>
---
 lib_mips/board.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/lib_mips/board.c b/lib_mips/board.c
index 77e1cc8..01dda69 100644
--- a/lib_mips/board.c
+++ b/lib_mips/board.c
@@ -70,6 +70,15 @@ static ulong mem_malloc_brk;
  */
 unsigned long mips_io_port_base = -1;
 
+int __board_early_init_f(void)
+{
+	/*
+	 * Nothing to do in this dummy implementation
+	 */
+	return 0;
+}
+int board_early_init_f(void) __attribute__((weak, alias("__board_early_init_f")));
+
 /*
  * The Malloc area is immediately below the monitor copy in DRAM
  */
@@ -167,6 +176,7 @@ static int init_baudrate (void)
 typedef int (init_fnc_t) (void);
 
 init_fnc_t *init_sequence[] = {
+	board_early_init_f,
 	timer_init,
 	env_init,		/* initialize environment */
 #ifdef CONFIG_INCA_IP
-- 
1.6.0.4

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

* [U-Boot] [PATCH] MIPS: Add board_early_init_f() to init_sequence
  2008-11-12 12:18 [U-Boot] [PATCH] MIPS: Add board_early_init_f() to init_sequence Stefan Roese
@ 2008-11-16  7:01 ` Shinya Kuribayashi
  2008-11-17 13:56   ` Stefan Roese
  2008-11-17 14:14 ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 7+ messages in thread
From: Shinya Kuribayashi @ 2008-11-16  7:01 UTC (permalink / raw)
  To: u-boot

Stefan Roese wrote:
> This patch adds the board_early_init_f() call to the MIPS init
> sequence. A weak dummy implementation is also added which can be
> overridden by a board specific version.
> 
> This will be used by the upcoming VCTH board support.
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> ---
>  lib_mips/board.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/lib_mips/board.c b/lib_mips/board.c
> index 77e1cc8..01dda69 100644
> --- a/lib_mips/board.c
> +++ b/lib_mips/board.c
> @@ -70,6 +70,15 @@ static ulong mem_malloc_brk;
>   */
>  unsigned long mips_io_port_base = -1;
>  
> +int __board_early_init_f(void)
> +{
> +	/*
> +	 * Nothing to do in this dummy implementation
> +	 */
> +	return 0;
> +}
> +int board_early_init_f(void) __attribute__((weak, alias("__board_early_init_f")));
> +
>  /*
>   * The Malloc area is immediately below the monitor copy in DRAM
>   */
> @@ -167,6 +176,7 @@ static int init_baudrate (void)
>  typedef int (init_fnc_t) (void);
>  
>  init_fnc_t *init_sequence[] = {
> +	board_early_init_f,
>  	timer_init,
>  	env_init,		/* initialize environment */
>  #ifdef CONFIG_INCA_IP

This is ok.  I don't know why people prefers alias, though :-)

Acked-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

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

* [U-Boot] [PATCH] MIPS: Add board_early_init_f() to init_sequence
  2008-11-16  7:01 ` Shinya Kuribayashi
@ 2008-11-17 13:56   ` Stefan Roese
  2008-11-18  2:41     ` Shinya Kuribayashi
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Roese @ 2008-11-17 13:56 UTC (permalink / raw)
  To: u-boot

On Sunday 16 November 2008, Shinya Kuribayashi wrote:
> > +int __board_early_init_f(void)
> > +{
> > +	/*
> > +	 * Nothing to do in this dummy implementation
> > +	 */
> > +	return 0;
> > +}
> > +int board_early_init_f(void) __attribute__((weak,
> > alias("__board_early_init_f"))); +
> >  /*
> >   * The Malloc area is immediately below the monitor copy in DRAM
> >   */
> > @@ -167,6 +176,7 @@ static int init_baudrate (void)
> >  typedef int (init_fnc_t) (void);
> >
> >  init_fnc_t *init_sequence[] = {
> > +	board_early_init_f,
> >  	timer_init,
> >  	env_init,		/* initialize environment */
> >  #ifdef CONFIG_INCA_IP
>
> This is ok.  I don't know why people prefers alias, though :-)

Just because we don't need the ugly #ifdef's by using weak aliases. It has 
some drawbacks of course but in general the resulting source code 
looks "cleaner".

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

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

* [U-Boot] [PATCH] MIPS: Add board_early_init_f() to init_sequence
  2008-11-12 12:18 [U-Boot] [PATCH] MIPS: Add board_early_init_f() to init_sequence Stefan Roese
  2008-11-16  7:01 ` Shinya Kuribayashi
@ 2008-11-17 14:14 ` Jean-Christophe PLAGNIOL-VILLARD
  2008-11-18 15:00   ` Shinya Kuribayashi
  1 sibling, 1 reply; 7+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-11-17 14:14 UTC (permalink / raw)
  To: u-boot

On 13:18 Wed 12 Nov     , Stefan Roese wrote:
> This patch adds the board_early_init_f() call to the MIPS init
> sequence. A weak dummy implementation is also added which can be
> overridden by a board specific version.
> 
> This will be used by the upcoming VCTH board support.
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> ---
>  lib_mips/board.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/lib_mips/board.c b/lib_mips/board.c
> index 77e1cc8..01dda69 100644
> --- a/lib_mips/board.c
> +++ b/lib_mips/board.c
> @@ -70,6 +70,15 @@ static ulong mem_malloc_brk;
>   */
>  unsigned long mips_io_port_base = -1;
>  
> +int __board_early_init_f(void)
> +{
> +	/*
> +	 * Nothing to do in this dummy implementation
> +	 */
> +	return 0;
> +}
why not remove this and create a generic dummy function

to reduce to code size impact

Best Regards,
J.

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

* [U-Boot] [PATCH] MIPS: Add board_early_init_f() to init_sequence
  2008-11-17 13:56   ` Stefan Roese
@ 2008-11-18  2:41     ` Shinya Kuribayashi
  0 siblings, 0 replies; 7+ messages in thread
From: Shinya Kuribayashi @ 2008-11-18  2:41 UTC (permalink / raw)
  To: u-boot

Stefan Roese wrote:
>> This is ok.  I don't know why people prefers alias, though :-)
> 
> Just because we don't need the ugly #ifdef's by using weak aliases. It has 
> some drawbacks of course but in general the resulting source code 
> looks "cleaner".

I was being vague.  I prefers something like below, because I don't want
to have a dummy & empty function just for the `alias'.

int __attribute__((weak)) board_early_init_f(void)
{
	return 0;
}

But that's not a big deal.  Using weak function is ok, of course.  Sorry
for the noise.

Thanks,

-- 
Shinya Kuribayashi
NEC Electronics

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

* [U-Boot] [PATCH] MIPS: Add board_early_init_f() to init_sequence
  2008-11-17 14:14 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2008-11-18 15:00   ` Shinya Kuribayashi
  2008-11-18 15:56     ` Stefan Roese
  0 siblings, 1 reply; 7+ messages in thread
From: Shinya Kuribayashi @ 2008-11-18 15:00 UTC (permalink / raw)
  To: u-boot

Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 13:18 Wed 12 Nov     , Stefan Roese wrote:
>> diff --git a/lib_mips/board.c b/lib_mips/board.c
>> index 77e1cc8..01dda69 100644
>> --- a/lib_mips/board.c
>> +++ b/lib_mips/board.c
>> @@ -70,6 +70,15 @@ static ulong mem_malloc_brk;
>>   */
>>  unsigned long mips_io_port_base = -1;
>>  
>> +int __board_early_init_f(void)
>> +{
>> +	/*
>> +	 * Nothing to do in this dummy implementation
>> +	 */
>> +	return 0;
>> +}
> why not remove this and create a generic dummy function
> 
> to reduce to code size impact

+1.  Such dummy function could be shared among all architectures.

Thanks,

  Shinya

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

* [U-Boot] [PATCH] MIPS: Add board_early_init_f() to init_sequence
  2008-11-18 15:00   ` Shinya Kuribayashi
@ 2008-11-18 15:56     ` Stefan Roese
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Roese @ 2008-11-18 15:56 UTC (permalink / raw)
  To: u-boot

On Tuesday 18 November 2008, Shinya Kuribayashi wrote:
> >> +++ b/lib_mips/board.c
> >> @@ -70,6 +70,15 @@ static ulong mem_malloc_brk;
> >>   */
> >>  unsigned long mips_io_port_base = -1;
> >>
> >> +int __board_early_init_f(void)
> >> +{
> >> +	/*
> >> +	 * Nothing to do in this dummy implementation
> >> +	 */
> >> +	return 0;
> >> +}
> >
> > why not remove this and create a generic dummy function
> > to reduce to code size impact
>
> +1.  Such dummy function could be shared among all architectures.

OK, makes perfect sense. We would need different dummy functions for each 
different parameter though, such as:

void dummy_void_void(void);
int dummy_int_void(void);
int dummy_int_int(int);
int dummy_int_pint(* int);
...

And where should those functions be placed? We could create a new file 
probably in lib_generic for this. I suggest we postpone this consolidation 
until after the next release though.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

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

end of thread, other threads:[~2008-11-18 15:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-12 12:18 [U-Boot] [PATCH] MIPS: Add board_early_init_f() to init_sequence Stefan Roese
2008-11-16  7:01 ` Shinya Kuribayashi
2008-11-17 13:56   ` Stefan Roese
2008-11-18  2:41     ` Shinya Kuribayashi
2008-11-17 14:14 ` Jean-Christophe PLAGNIOL-VILLARD
2008-11-18 15:00   ` Shinya Kuribayashi
2008-11-18 15:56     ` Stefan Roese

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox