[PATCH] powerpc: Add of_register_i2c_devices()
segher at kernel.crashing.org
Wed Jul 4 09:02:12 EST 2007
>> Just use "compatible" exactly the way it is meant to be
>> used and your life will be so much simpler. And don't
>> even think about using a very generic property like "model"
>> for a purpose totally different from its intended purpose.
> AFAIU, the only way currently to attach an i2c device to a driver
> is to
> match against driver's name. Let's take the rtc-rs5c372.c example. It
> services rs5c372a, rs5c372b, rv5c386, rv5c387a. And it registers
> with the name "rtc-rs5c372". We want to just specify in our dts, e.g.,
> 'compatible = "rs5c372b";', right? And ask the i2c layer to find a
> suitable driver for us. Which means a pretty big change to i2c
> core. Is
> this what you think is the proper solution? I could try to think
> about it
> / discuss on i2c and eventually cook up a patch, just want to make
> sure I
> understand you right.
Your device is an rs5c372b. So, that's what you put in
your device tree. Simple so far, right?
Now some OF I2C code goes looking for IIC devices in the
device tree. It finds this thing, and from a table or
something it derives that it has to tell the kernel I2C
layer this is an "rtc-rs5c372". [It would be nicer if it
could just instantiate the correct driver directly, but
if that's how the Linux I2C layer works, so be it].
No change in the I2C "core" needed, just an OF "compatible"
matching thing like is needed *everywhere else* too.
More information about the Linuxppc-dev