diff mbox

[U-Boot,v2,4/7] tegra: Allow boards to perform early GPIO setup

Message ID 1337953588-20696-4-git-send-email-thierry.reding@avionic-design.de
State Accepted
Commit cb7a1cf36a59772670adcd2c90cee40c2ed1bc60
Headers show

Commit Message

Thierry Reding May 25, 2012, 1:46 p.m. UTC
The new gpio_early_init() function, which does nothing by default, can
be overridden by boards to configure GPIOs at an early stage.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
---
Changes in v2:
- new patch required for TEC support

 board/nvidia/common/board.c |    7 +++++++
 board/nvidia/common/board.h |    1 +
 2 files changed, 8 insertions(+)

Comments

Stephen Warren May 25, 2012, 4:24 p.m. UTC | #1
On 05/25/2012 07:46 AM, Thierry Reding wrote:
> The new gpio_early_init() function, which does nothing by default, can
> be overridden by boards to configure GPIOs at an early stage.

> diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c

>  int board_early_init_f(void)
>  {
>  	board_init_uart_f();
>  
>  	/* Initialize periph GPIOs */
> +	gpio_early_init();
>  #ifdef CONFIG_SPI_UART_SWITCH
>  	gpio_early_init_uart();
>  #else

I assert that all early GPIO initialization should be reworked to use
this new gpio_early_init(). In other words, now that there's a single
generic gpio_early_init(), we should remove the following code right
after it:

#ifdef CONFIG_SPI_UART_SWITCH
        gpio_early_init_uart();
#else
        gpio_config_uart();
#endif

and any boards that need to do any of that (which is just Seaboard I
think) should do that from an implementation of the new generic
gpio_early_init() in their board file. That way, common code won't have
to know about crap like the SPI/UART muxing on Seaboard.

That said, this need not be part of this patch or even this series, so I
don't mean to nak this patch with these comments.

And actually, I'd be all for ripping out all the SPI support on Seaboard
and all related code anyway...
Thierry Reding May 25, 2012, 5:31 p.m. UTC | #2
* Stephen Warren wrote:
> On 05/25/2012 07:46 AM, Thierry Reding wrote:
> > The new gpio_early_init() function, which does nothing by default, can
> > be overridden by boards to configure GPIOs at an early stage.
> 
> > diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c
> 
> >  int board_early_init_f(void)
> >  {
> >  	board_init_uart_f();
> >  
> >  	/* Initialize periph GPIOs */
> > +	gpio_early_init();
> >  #ifdef CONFIG_SPI_UART_SWITCH
> >  	gpio_early_init_uart();
> >  #else
> 
> I assert that all early GPIO initialization should be reworked to use
> this new gpio_early_init(). In other words, now that there's a single
> generic gpio_early_init(), we should remove the following code right
> after it:
> 
> #ifdef CONFIG_SPI_UART_SWITCH
>         gpio_early_init_uart();
> #else
>         gpio_config_uart();
> #endif
> 
> and any boards that need to do any of that (which is just Seaboard I
> think) should do that from an implementation of the new generic
> gpio_early_init() in their board file. That way, common code won't have
> to know about crap like the SPI/UART muxing on Seaboard.
> 
> That said, this need not be part of this patch or even this series, so I
> don't mean to nak this patch with these comments.

I just noticed that I forgot to add an entry to MAINTAINERS for the TEC.
Furthermore I'll need to rebase the patches onto the Tegra branch due to the
major restructuring of the configuration files. Since I'll respin the series
anyway, I could add a patch to make the corresponding change to Seaboard.

> And actually, I'd be all for ripping out all the SPI support on Seaboard
> and all related code anyway...

I can't really comment on this because I've never used the Seaboard. Maybe
Simon (CC'ed) can comment on this. If we decide to completely remove the SPI
support then the above patch becomes obsolete.

Thierry
Thierry Reding May 25, 2012, 5:59 p.m. UTC | #3
* Thierry Reding wrote:
> Furthermore I'll need to rebase the patches onto the Tegra branch due to the
> major restructuring of the configuration files.

This isn't true. But I'll still have to respin because of the MAINTAINERS
entry and the other points that you brought up, so let me know if I should
add a patch for Seaboard.

Thierry
Thierry Reding June 4, 2012, 6:09 a.m. UTC | #4
* Tom Warren wrote:
> Thierry,
> 
> > -----Original Message-----
> > From: Thierry Reding [mailto:thierry.reding@avionic-design.de]
> > Sent: Friday, May 25, 2012 11:00 AM
> > To: Stephen Warren
> > Cc: u-boot@lists.denx.de; Tom Warren; Simon Glass
> > Subject: Re: [PATCH v2 4/7] tegra: Allow boards to perform early GPIO setup
> > 
> > * PGP Signed by an unknown key
> > 
> > * Thierry Reding wrote:
> > > Furthermore I'll need to rebase the patches onto the Tegra branch due
> > > to the major restructuring of the configuration files.
> > 
> > This isn't true. But I'll still have to respin because of the MAINTAINERS
> > entry and the other points that you brought up, so let me know if I should
> > add a patch for Seaboard.
> When you respin this, make sure to base it on current u-boot-tegra/master,
> and change any CONFIG_TEGRA2_MMC or _SPI references to CONFIG_TEGRA_MMC &
> _SPI (see my changes to rename tegra periph drivers for the upcoming Tegra3
> rearch).

I saw that you already carry a patch in your next branch that does the
renames in the tec.h configuration. Can I assume that when I respin with
those changes included in the patch that introduces TEC support you'll drop
that hunk from your patch? Or should I rather follow up with patches based on
your next branch?

Thierry
diff mbox

Patch

diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c
index 2e22133..a159deb 100644
--- a/board/nvidia/common/board.c
+++ b/board/nvidia/common/board.c
@@ -132,11 +132,18 @@  int board_init(void)
 }
 
 #ifdef CONFIG_BOARD_EARLY_INIT_F
+static void __gpio_early_init(void)
+{
+}
+
+void gpio_early_init(void) __attribute__((weak, alias("__gpio_early_init")));
+
 int board_early_init_f(void)
 {
 	board_init_uart_f();
 
 	/* Initialize periph GPIOs */
+	gpio_early_init();
 #ifdef CONFIG_SPI_UART_SWITCH
 	gpio_early_init_uart();
 #else
diff --git a/board/nvidia/common/board.h b/board/nvidia/common/board.h
index 09fb158..dada4c4 100644
--- a/board/nvidia/common/board.h
+++ b/board/nvidia/common/board.h
@@ -25,6 +25,7 @@ 
 #define _BOARD_H_
 
 void gpio_config_uart(void);
+void gpio_early_init(void);
 void gpio_early_init_uart(void);
 
 /*