Subject: Re: "cell-index" vs. "index" vs. no index in I2C device nodes

From: Timur Tabi <[email-masked]>
Date: Thu, 05 Jun 2008 11:09:16 -0500

Segher Boessenkool wrote:

> Sounds to me like both simply need to use adapter->nr. 

How can a non-I2C driver get the adapter structure for another driver that is an
I2C driver?

> For access to
> Linux-internal data structures (and that is what this "index" is), you
> shouldn't have to go via the device tree.  If the Linux data structures
> do not have the information you need, well, fix that.

The fabric driver doesn't have access to any I2C structures when it starts
looking for the codec driver.  The fabric driver is like an OF platform driver,
in that it's OF-aware and machine-specific.  By parsing the device tree (which
is the only tool I have to know how the board is laid out), the fabric driver
can determine that SSI1 is attached to a CS4270 on I2C bus #1, address 0x4F.
That's the only information it has.

The CS4270 driver, on the other hand, knows nothing about OF.  It just knows
whatever is passed to its I2C probe function, i.e. the i2c_adapter and
i2c_client structures.

So in order for the two drivers to be able to link to each other, there needs to
be some code that takes data from the device tree and places it into the I2C
data structures.

-- 
Timur Tabi
Linux kernel developer at Freescale