Patchwork [U-Boot] mx53loco: Define CONFIG_BOARD_LATE_INIT

login
register
mail settings
Submitter Fabio Estevam
Date July 31, 2012, 7:38 p.m.
Message ID <CAOMZO5CBpA4kVC+J6Yp8RwmL-EbLwK1PcYWC_RLX=SwWRnqsyg@mail.gmail.com>
Download mbox | patch
Permalink /patch/174324/
State Changes Requested
Headers show

Comments

Fabio Estevam - July 31, 2012, 7:38 p.m.
On Tue, Jul 31, 2012 at 4:21 PM, Fabio Estevam
<fabio.estevam@freescale.com> wrote:
> Define CONFIG_BOARD_LATE_INIT so that the serial console messages can be redirected to the serial port.
>
> This is needed because in mx53loco.c we have:
>
> #ifdef CONFIG_BOARD_LATE_INIT
> int board_late_init(void)
> {
>         setenv("stdout", "serial");
>
>         return 0;
> }
> #endif
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  include/configs/mx53loco.h |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h
> index 0a25c7d..bd23387 100644
> --- a/include/configs/mx53loco.h
> +++ b/include/configs/mx53loco.h
> @@ -41,6 +41,7 @@
>  #define CONFIG_SYS_MALLOC_LEN          (10 * 1024 * 1024)
>
>  #define CONFIG_BOARD_EARLY_INIT_F
> +#define CONFIG_BOARD_LATE_INIT
>  #define CONFIG_MXC_GPIO
>  #define CONFIG_REVISION_TAG

Or maybe this is a better approach?
Wolfgang Denk - July 31, 2012, 7:56 p.m.
Dear Fabio Estevam,

In message <CAOMZO5CBpA4kVC+J6Yp8RwmL-EbLwK1PcYWC_RLX=SwWRnqsyg@mail.gmail.com> you wrote:
...
> 
> -#ifdef CONFIG_BOARD_LATE_INIT
>  int board_late_init(void)
>  {
> -	setenv("stdout", "serial");
> +	setenv("preboot", "setenv stdout serial\0");

NAK.  Please never, never ever mandatorily overwrite environment
variables!  The user who sets it to a different value and cannot find
out why his settings don;t work and always get overwritten would be
seriously frustrated.

Best regards,

Wolfgang Denk
Stefano Babic - July 31, 2012, 8:51 p.m.
Am 31/07/2012 21:56, schrieb Wolfgang Denk:
> Dear Fabio Estevam,
> 

Hi Fabio,

> In message <CAOMZO5CBpA4kVC+J6Yp8RwmL-EbLwK1PcYWC_RLX=SwWRnqsyg@mail.gmail.com> you wrote:
> ...
>>
>> -#ifdef CONFIG_BOARD_LATE_INIT
>>  int board_late_init(void)
>>  {
>> -	setenv("stdout", "serial");
>> +	setenv("preboot", "setenv stdout serial\0");
> 
> NAK.  Please never, never ever mandatorily overwrite environment
> variables!  The user who sets it to a different value and cannot find
> out why his settings don;t work and always get overwritten would be
> seriously frustrated.

Maybe a better way is to use CONFIG_PREBOOT as you do, but without
hard-coding the variable. You can add "preboot" to the default
environment (CONFIG_EXTRA_ENV_SETTINGS), and the user can still
overwrite the behavior setting the variable in the u-boot shell.

But I see I did not follow the same approach for the mx51evk (blame on
me !).

Stefano

Patch

diff --git a/board/freescale/mx53loco/mx53loco.c
b/board/freescale/mx53loco/mx53loco.c
index cbdcfad..4176d46 100644
--- a/board/freescale/mx53loco/mx53loco.c
+++ b/board/freescale/mx53loco/mx53loco.c
@@ -495,14 +495,12 @@  int print_cpuinfo(void)
 	return 0;
 }

-#ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {
-	setenv("stdout", "serial");
+	setenv("preboot", "setenv stdout serial\0");

 	return 0;
 }
-#endif

 int board_init(void)
 {