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

Grant Likely grant.likely at secretlab.ca
Fri Jun 6 02:10:15 EST 2008


On Thu, Jun 5, 2008 at 9:50 AM, Timur Tabi <timur at freescale.com> wrote:
> Jochen Friedrich wrote:
>> Hi Timur,
>>
>>> In situations where it doesn't matter which I2C bus is #1 and which one is #2,
>>> then I think the code should just initialize idx based on the order the nodes
>>> are found in the tree.
>>>
>>> In situations where it does matter, then we should use cell-index.
>>
>> that's what I did in i2c-cpm, as well. However, here I use the property
>> "linux,i2c-index" instead (see http://patchwork.ozlabs.org/linuxppc/patch?id=18603).
>
> Well, I just don't see the point of having two different properties that say the
> same thing.  I'm not an IEE 1275 purist, so I don't think we should be hampered
> by old node definitions.  I especially don't like having a property specifically
> for indexing I2C nodes that can't be used to enumerate other nodes.
>
> The DMA and SSI controllers on Freescale parts use cell-index to enumerate them.
>  It just seems dumb to invent a new property.
>
> Will there ever be a situation where a node will contain "cell-index" and
> "linux,i2c-index"?

You are trying to describe 2 different things.  cell-index is purely
for identifying multiple devices within a silicon block that share
resources.  Indexing devices has a very different scope.  The whole
scheme breaks the moment you put down 2 identical multifunction
peripherals into the same system.  If the chip has multiple devices
that share resources, and those resources are described with cell
index; then you'll get something like this (notice how cell-index
values are duplicated):

multifunction at 0 {
        #size-cells = <1>;
        #address-cells = <1>;
        ranges = <0 0xe00000000 0x1000>;
        i2c at 0 {
                cell-index = <0>;
                regs = <0 0x100>;
        }
        i2c at 100 {
                cell-index = <1>;
                regs = <0x100 0x100>;
        }
}
multifunction at 1 {
        #size-cells = <1>;
        #address-cells = <1>;
        ranges = <0 0xe10000000 0x1000>;
        i2c at 0 {
                cell-index = <0>;
                regs = <0 0x100>;
        }
        i2c at 100 {
                cell-index = <1>;
                regs = <0x100 0x100>;
        }
}

cell-index must *not* be repurposed as a system level index.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.



More information about the Linuxppc-dev mailing list