[U-Boot] [PATCH 2/2] IOMUX: Add console multiplexing support.

Gary Jennejohn garyj at denx.de
Sun Sep 14 19:19:18 CEST 2008


On Sun, 14 Sep 2008 18:07:42 +0200
Wolfgang Denk <wd at denx.de> wrote:

> In message <20080914164530.0a59c6ca at peedub.jennejohn.org> you wrote:
> > 
> > Since this patch touches net/eth.c it is being sent separately.
> > 
> > When CONFIG_IO_MUX, CONFIG_NETCONSOLE and CFG_CONSOLE_IS_IN_ENV are all
> > defined together it is possible that nc (netconsole) is defined as an
> > output device.  In this case it is necessary to set GD_FLG_DEVINIT
> > after the network devices have been initialized, otherwise u-boot
> > might try to send output to a device before it is ready, which leads
> > to various errors.
> 
> I don't understand this patch for two reasons:
> 
> 1) What has CONFIG_IO_MUX to do with that? We can have a netconsole
> defined with or without that new feature, so why would it make any
> difference?
> 

This is a valid comment.  I had IOMUX on the brain when I wrote this
code since I had to make this change in the course of developing it.
This patch would still be valid without CONFIG_IO_MUX.

> > Signed-off-by: Gary Jennejohn <garyj at denx.de>
> > ---
> >  net/eth.c |   24 ++++++++++++++++++++++++
> >  1 files changed, 24 insertions(+), 0 deletions(-)
> > 
> > diff --git a/net/eth.c b/net/eth.c
> > index 432dd60..94b6e3a 100644
> > --- a/net/eth.c
> > +++ b/net/eth.c
> > @@ -26,6 +26,11 @@
> >  #include <net.h>
> >  #include <miiphy.h>
> >  
> > +#if defined(CONFIG_IO_MUX) && defined(CONFIG_NETCONSOLE) && \
> > +	defined(CFG_CONSOLE_IS_IN_ENV)
> > +DECLARE_GLOBAL_DATA_PTR;
> > +#endif
> > +
> >  #if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI)
> >  
> >  /*
> > @@ -256,6 +261,15 @@ int eth_initialize(bd_t *bis)
> >  		putc ('\n');
> >  	}
> >  
> > +#if defined(CONFIG_IO_MUX) && defined(CONFIG_NETCONSOLE) && \
> > +	defined(CFG_CONSOLE_IS_IN_ENV)
> > +	/*
> > +	 * Must do this very late because a network device may be set as a
> > +	 * console at boot time.
> > +	 */
> > +	gd->flags |= GD_FLG_DEVINIT;	/* device initialization completed */
> > +#endif
> > +
> >  	return eth_number;
> >  }
> >  
> > @@ -532,6 +546,16 @@ int eth_initialize(bd_t *bis)
> >  #if defined(CONFIG_DRIVER_TI_EMAC)
> >  	davinci_eth_miiphy_initialize(bis);
> >  #endif
> > +
> > +#if defined(CONFIG_IO_MUX) && defined(CONFIG_NETCONSOLE) && \
> > +	defined(CFG_CONSOLE_IS_IN_ENV)
> > +	/*
> > +	 * Must do this very late because a network device may be set as a
> > +	 * console at boot time.
> > +	 */
> > +	gd->flags |= GD_FLG_DEVINIT;	/* device initialization completed */
> > +#endif
> > +
> 
> 2) You only add new points where the GD_FLG_DEVINIT bit gets set in
> gd->flags. That means there are two possibilities when your newly
> added code is run: either, this bit is already set by other parts of
> the codem than the operation was redundant and couldbe omitted; or,
> the flasg was not set yet, then you set it now, which means you set it
> EARLIE than it would have been set before.
> 
> But your comment suggests that that would be done LATER now.
> 
> 
> So what exactly is the purpose of this patch?
> 

This bit is normally ser in console_init_r, which is called very early.

You have to look at this patch in conjunction with the first patch and
not as a separate entity, which it most definitely is not.

---
Gary Jennejohn
*********************************************************************
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
*********************************************************************


More information about the U-Boot mailing list