All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stelian Pop <stelian@popies.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH RFC] at91sam9/at91cap: move common	initialisation to cpu
Date: Thu, 13 Nov 2008 22:28:55 +0100	[thread overview]
Message-ID: <1226611735.8836.25.camel@galileo> (raw)
In-Reply-To: <1226086706-5419-1-git-send-email-plagnioj@jcrosoft.com>

Le vendredi 07 novembre 2008 ? 20:38 +0100, Jean-Christophe
PLAGNIOL-VILLARD a ?crit :

> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@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@popies.net>

  reply	other threads:[~2008-11-13 21:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-07 19:38 [U-Boot] [PATCH RFC] at91sam9/at91cap: move common initialisation to cpu Jean-Christophe PLAGNIOL-VILLARD
2008-11-13 21:28 ` Stelian Pop [this message]
2008-11-13 22:32   ` Jean-Christophe PLAGNIOL-VILLARD
2008-11-14  9:17     ` Stelian Pop
2008-11-16 12:28   ` Remy Bohmer
2009-02-05 21:38 ` Jean-Christophe PLAGNIOL-VILLARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1226611735.8836.25.camel@galileo \
    --to=stelian@popies.net \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.