[U-Boot] use "boot select" jumper on NGW100 to select USART

Wolfgang Denk wd at denx.de
Mon Nov 9 15:38:42 CET 2009


Dear Thomas Sprinkmeier,

In message <E1N7TGC-0000mS-Vq at lego.my-domain> you wrote:
> From: Thomas Sprinkmeier <thomas.sprinkmeier at gmail.com>
> Date: Mon, 9 Nov 2009 09:28:51 +1030
> Subject: [PATCH] use "boot select" jumper on NGW100 to select USART
> 
> Without the "boot select" jumper U-Boot will use the USART selected
> using the CONFIG_USART1, CONFIG_USART2, directive.
> 
> If  CONFIG_ALT_USART1 (or ..2, ..3, ..0) is defined then,
> with the jumper in place, that USART is used instead.
> 
> Signed-off-by: Thomas Sprinkmeier <thomas.sprinkmeier at gmail.com
> ---
>  board/atmel/atngw100/atngw100.c |    6 ++-
>  drivers/serial/atmel_usart.c    |   15 +-------
>  include/atmel_alt_usart.h       |   81 +++++++++++++++++++++++++++++++++++++++
>  include/configs/atngw100.h      |    1 +
>  4 files changed, 88 insertions(+), 15 deletions(-)
>  create mode 100644 include/atmel_alt_usart.h
> 
> diff --git a/board/atmel/atngw100/atngw100.c b/board/atmel/atngw100/atngw100.c
> index 004d8da..841d9ec 100644
> --- a/board/atmel/atngw100/atngw100.c
> +++ b/board/atmel/atngw100/atngw100.c
> @@ -29,6 +29,8 @@
>  #include <asm/arch/portmux.h>
>  #include <netdev.h>
>  
> +#include <atmel_alt_usart.h>
> +
>  DECLARE_GLOBAL_DATA_PTR;
>  
>  static const struct sdram_config sdram_config = {
> @@ -53,7 +55,9 @@ int board_early_init_f(void)
>  	hmatrix_slave_write(EBI, SFR, HMATRIX_BIT(EBI_SDRAM_ENABLE));
>  
>  	portmux_enable_ebi(16, 23, 0, PORTMUX_DRIVE_HIGH);
> -	portmux_enable_usart1(PORTMUX_DRIVE_MIN);
> +
> +	USART_JUMPER_CONFIG;
> +	USART_ENABLE;

Function / Macro when used as funxctions should always look as such,
i. e. have parens with them.


> diff --git a/include/atmel_alt_usart.h b/include/atmel_alt_usart.h
> new file mode 100644
> index 0000000..1ed2fb8
...
> +/* Enable the appropriate USART */
> +#define USART_ENABLE {							\
> +  switch (USART_ID)							\
> +    {									\
> +    case 0:  portmux_enable_usart0(PORTMUX_DRIVE_MIN); break;		\
> +    case 1:  portmux_enable_usart1(PORTMUX_DRIVE_MIN); break;		\
> +    case 2:  portmux_enable_usart2(PORTMUX_DRIVE_MIN); break;		\
> +    default: portmux_enable_usart3(PORTMUX_DRIVE_MIN); break;		\
> +    }									\
> +  } while(0)

NAK.  When you use a function-style macro it should look like one. But
why is this a macro at all? Please make it a (static) inline function
instead.

Also please note that the Coding Style requires indentation by TABs.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
F u cn rd ths u cnt spl wrth a dm!


More information about the U-Boot mailing list