From: Remy Bohmer <linux@bohmer.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH RFC] at91sam9/at91cap: move common initialisation to cpu
Date: Sun, 16 Nov 2008 13:28:53 +0100 [thread overview]
Message-ID: <3efb10970811160428l5ca27116l3d32d1917b861cda@mail.gmail.com> (raw)
In-Reply-To: <1226611735.8836.25.camel@galileo>
Hello Stelian and Jean-Christophe,
> I agree with the general idea of moving the serial and spi from board
> specific files to the cpu specific files.
I agree partly on this, but I do not like with the way this patch is
doing it, and this is the reason why:
PIN multiplexing is board specific, not only SoC specific. pins can be
multiplexed in different ways per board per SoC.
In this patch all this 'knowledge' is moved to the generic SoC code,
where the assumption is made that all boards use the same pin layout.
This is _not_ true; in the generic code is, for example(!!), assumed
that all 9261 SoC derived boards only configure NPCS0, while a board
can utilise all NPCS pins and can have multiple dataflashes.
It may be true that all boards, currently existing in U-boot, use a
similar pin layout per SoC, but that does not mean that that is a
valid assumption for all future boards. The framework should be that
flexible that boards that are currently not in mainline can be added
in the future, without reverting patches like this, or creating
standalone copies from this framework. We should make it easier for
others to integrate their custom boards, instead of making it
harder...
The current code makes it very easy to create custom boards, this
patch makes that harder!
So, in short: pin layout must be specified by the board specific
files, not by the generic SoC code, although the generic SoC code can
provide (all) the possible options to choose from...
Kind Regards,
Remy
>
> 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>
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
next prev parent reply other threads:[~2008-11-16 12: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
2008-11-13 22:32 ` Jean-Christophe PLAGNIOL-VILLARD
2008-11-14 9:17 ` Stelian Pop
2008-11-16 12:28 ` Remy Bohmer [this message]
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=3efb10970811160428l5ca27116l3d32d1917b861cda@mail.gmail.com \
--to=linux@bohmer.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.