"cell-index" vs. "index" vs. no index in I2C device nodes

Segher Boessenkool segher at kernel.crashing.org
Fri Jun 6 12:40:20 EST 2008


>>> From a device tree perspective, index and cell-index are both
>> incorrect.  The IIC macros don't share register blocks with anything,
>> are enumerated as unique instances per macro in the device tree, and
>> should be able to be distinguished by "regs" and/or unit address.
>>
>> Does anyone disagree with that?
>
> Hear, hear.

x2.

> Aliases can also provide a reasonable way of enumerating devices, if
> "reg" isn't suitable on its own.

Yes.  In almost all cases, drivers and subsystems do not need this at
all though.  In OF, one device points to another by putting the phandle
of that pointed-to device in some property (and buses are represented
by their parent bridge).  If the Linux subsystem wants to use an integer
for distinguishing between its various buses, that's fine, but it can
just make up these numbers -- the numbers themselves have no actual
meaning, only the relationships expressed via those numbers do.

In a few cases, particularly where those numbers are user-visible, like
in ethN, the aliases construct is a good solution.  If a 
driver/subsystem
is relying on the aliases though, it should document this in a 
(platform?)
binding -- and it would better have a very good reason for it!


Segher




More information about the Linuxppc-dev mailing list