[U-Boot] [PATCH] 1/12 Multiadapter/multibus I2C, common part 1

ksi at koi8.net ksi at koi8.net
Tue Feb 17 07:04:46 CET 2009


On Mon, 16 Feb 2009, Wolfgang Denk wrote:

> Dear ksi at koi8.net,
> 
> In message <Pine.LNX.4.64ksi.0902121409460.21067 at home-gw.koi8.net> you wrote:
> > Signed-off-by: Sergey Kubushyn <ksi at koi8.net>
> > ---
> > diff -purN u-boot-i2c.orig/common/cmd_date.c u-boot-i2c/common/cmd_date.c
> > --- u-boot-i2c.orig/common/cmd_date.c	2009-02-12 10:43:41.000000000 -0800
> > +++ u-boot-i2c/common/cmd_date.c	2009-02-12 10:46:00.000000000 -0800
> > @@ -46,8 +46,13 @@ int do_date (cmd_tbl_t *cmdtp, int flag,
> >  	int old_bus;
> >  
> >  	/* switch to correct I2C bus */
> > +#ifdef CONFIG_NEW_I2C
> > +	old_bus = i2c_get_bus_num();
> > +	i2c_set_bus_num(CONFIG_SYS_RTC_BUS_NUM);
> > +#else
> >  	old_bus = I2C_GET_BUS();
> >  	I2C_SET_BUS(CONFIG_SYS_RTC_BUS_NUM);
> > +#endif
> >  
> >  	switch (argc) {
> >  	case 2:			/* set date & time */
> > @@ -94,7 +99,11 @@ int do_date (cmd_tbl_t *cmdtp, int flag,
> >  	}
> >  
> >  	/* switch back to original I2C bus */
> > +#ifdef CONFIG_NEW_I2C
> > +	i2c_set_bus_num(old_bus);
> > +#else
> >  	I2C_SET_BUS(old_bus);
> > +#endif
> 
> Just a global note:
> 
> This makes no sense to me. If we assume that the new code works, then
> it will replace the old code. These #ifdef's make no sense.
> 
> We will probably hold this code in some testing branch (for a  longer
> period  of  time to allow for extensive testing), but I don;t see the
> need to support both the old and the new code at the same time.  This
> makes the code and your patches only more difficult to read.

I totally agree with you. That was done before a separate branch has been
created so I tried to make something working in the main tree. The idea was
make everything with that CONFIG_NEW_I2C first, one thing at a time and
then, when everything was converted to the new format, remove all those
stubs with a single patch.

You are totally right, it is not needed any more. I will rebase those
patches and get rid of all old (legacy) code.

Ok, it's getting late here in Vegas so I will reply the rest of postings
tomorrow when I'm back in the office.

I'm glad that there is interest in getting that I2C thing done...

---
******************************************************************
*  KSI at home    KOI8 Net  < >  The impossible we do immediately.  *
*  Las Vegas   NV, USA   < >  Miracles require 24-hour notice.   *
******************************************************************


More information about the U-Boot mailing list