[PATCH 2/2] i2c: Add devtree-aware iic support for PPC4xx

Grant Likely grant.likely at secretlab.ca
Tue Oct 16 02:57:48 EST 2007


On 10/15/07, Eugene Surovegin <ebs at ebshome.net> wrote:
> On Mon, Oct 15, 2007 at 03:29:11PM +0200, Stefan Roese wrote:
>
> <snip>
>
> > +#ifdef CONFIG_PPC_MERGE
> > +static int device_idx = -1;
> > +#endif
> > +
>
> <snip>
>
> > +     dev->idx = ++device_idx;
> > +     adap->nr = dev->idx;
>
> Hmm, this doesn't look right. That mighty powerpc device everybody
> was so excited about for the last years doesn't provide a device
> instance number/index?
>
> I think this approach is wrong, because I want i2c bus numbers for the
> on-chip i2c to be fixed. This code makes it dependent on the order
> devices were described in the device tree; how do you handle a
> situation when only the second i2c adapter is connected? For OCP I
> would just remove ocp_def for the IIC0.

Segher is recommending that we use an aliases node as per the open
firmware example for this.  I think in this case it would look
something like this (but I'm not the expert):

aliases {
     IIC0 = "/path/to/bus/iic at 0x2000";
     IIC1 = "/path/to/bus/iic at 0x2000";
};

Which seems to make sense to me.  And it keeps it easy to have
multiple iic bus types sharing the same IIC bus number space (each
device does not try to maintain it's own little 'next index' value).

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely at secretlab.ca
(403) 399-0195



More information about the Linuxppc-dev mailing list