[U-Boot] [PATCH RFC] at91sam9/at91cap: move common initialisation to cpu
Stelian Pop
stelian at popies.net
Thu Nov 13 22:28:55 CET 2008
Le vendredi 07 novembre 2008 à 20:38 +0100, Jean-Christophe
PLAGNIOL-VILLARD a écrit :
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> ---
> The idea is to reduce common code initialisation which is actually in board.
> as done on afeb9260 and Ronetix eval board for 9260 & 9263
[...]
I agree with the general idea of moving the serial and spi from board
specific files to the cpu specific files.
Note however that serial and spi are not the only initialisations that
can be moved: the very same thing can be done with all the other device
initialisations. Some devices will need to specify which GPIOs are used
when it's board specific, and this can be passed as arguments to the cpu
specfic function. One can look at the Linux kernel files which nicely
separates the cpu specific GPIOs (in arch/arm/mach-at91/XXX_devices.c)
and the board specific GPIOs (in arch/arm/mach-at91/board-YYY.c). Or one
can also RTFM of course.
I also don't like this:
> --- a/board/atmel/at91cap9adk/at91cap9adk.c
> +++ b/board/atmel/at91cap9adk/at91cap9adk.c
> #ifdef CONFIG_USART0
> - at91_set_A_periph(AT91_PIN_PA22, 1); /* TXD0 */
> - at91_set_A_periph(AT91_PIN_PA23, 0); /* RXD0 */
> - at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_US0);
> + at91_serial_hw_init(0);
> #endif
Why don't just do at91_serial_hw_init() once, and test the CONFIG_USART*
inside the cpu specific at91_serial_hw_init function() ?
This also eliminates that unneeded switch case in that function.
Stelian.
--
Stelian Pop <stelian at popies.net>
More information about the U-Boot
mailing list