[i2c] [PATCH 0/4] Series to add device tree naming to i2c

Jon Smirl jonsmirl at gmail.com
Tue Dec 11 05:06:34 EST 2007


On 12/10/07, Scott Wood <scottwood at freescale.com> wrote:
> On Mon, Dec 10, 2007 at 08:38:46AM +1100, Benjamin Herrenschmidt wrote:
> > The more I think about it, the more I tend to agree that tagging isn't
> > necessary and you are right. We should just match the name against the
> > "compatible" property of the OF nodes (which mean we need to support
> > multiple matches though since "compatible" is a list of strings).
>
> It may not be strictly necessary, but I think it's a good idea not just for
> safety reasons, but as an indication to the driver what additional
> information it has access to.  We could put a match data pointer in the i2c
> device, and have it be a valid node pointer if the match was an OF one (and
> a device-specific struct for a straight platform device, etc).  This could
> be useful if a device needs to have more properties than standard
> address/type/interrupt for some reason.

I can't see an easy way to do this. The basic problem is that the i2c
drivers are assumed to be cross platform. I would need to add a path
through the i2c core for getting a void pointer from the bus to the
device But then when the device code gets this pointer it has no way
of knowing what it was. Assuming the void is a pointer to an of_node
would make the driver for the i2c device platform specific.

Another way that would work cross platform would be for the module to
have module parameters for the extra attributes. The bus code could
then look in the of_node for extra attributes and use them to set the
module parameters. I know this can be done, but doing it is a little
above my understanding of the module code. You need to ask the module
it's parameter names, addresses and types and then match them to
attributes in the of_node and do the copy.

>
> -Scott
>


-- 
Jon Smirl
jonsmirl at gmail.com



More information about the Linuxppc-dev mailing list