
Dear Thomas Sprinkmeier,
In message E1N7TGC-0000mS-Vq@lego.my-domain you wrote:
From: Thomas Sprinkmeier thomas.sprinkmeier@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@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