[U-Boot] [PATCH 16/24] mxc_i2c: prep work for multiple busses support

Marek Vasut
2012-06-24T20:08:51Z

Dear Heiko Schocher,

> Hello Troy,
>
> On 22.06.2012 06:12, Troy Kisky wrote:
> > Signed-off-by: Troy Kisky<troy.kisky@boundarydevices.com>
> > ---
> >
> > drivers/i2c/mxc_i2c.c | 121
> > ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 100
> > insertions(+), 21 deletions(-)
> >
> > diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c
> > index cb061f7..ec05798 100644
> > --- a/drivers/i2c/mxc_i2c.c
> > +++ b/drivers/i2c/mxc_i2c.c
>
> [...]
>
> > @@ -359,10 +351,97 @@ int i2c_write(uchar chip, uint addr, int alen,
> > uchar *buf, int len)
> >
> > return ret;
> >
> > }
> >
> > +typedef void (*toggle_i2c_fn)(void *p);
> > +
> > +#ifdef CONFIG_I2C_MULTI_BUS
> > +static unsigned g_bus;
>
> This is only valid after relocation ... and i2c is maybe used before
> relocation.
>
> Try something (not tested) like that:
>
> static unsigned int __attribute__((section (".data"))) g_bus = 0;

This is a good knowledge to have, adding it amongst important emails :)

>
> > +#else
> > +#define g_bus 0
> > +#endif
> > +
> > +struct i2c_parms {
> > + void *base;
> > + void *toggle_data;
> > + toggle_i2c_fn toggle_fn;
>
> For what is this toggle_* needed?
>
> bye,
> Heiko

Best regards,
Marek Vasut