* Passing I2C platform_data from device tree to i2c driver
@ 2008-11-03 23:54 Nate Case
2008-11-06 18:54 ` Scott Wood
0 siblings, 1 reply; 2+ messages in thread
From: Nate Case @ 2008-11-03 23:54 UTC (permalink / raw)
To: linuxppc-dev
Is there a plan for providing a way to set pdata for an I2C chip in a
way that could be shared across all OF platforms?
For example, the pca953x I2C GPIO driver requires that pdata != NULL so
it can get the gpio_base field. It can also take in a default 'invert'
value to initialize a chip register with. Currently, there's no obvious
way to get this to work on PowerPC without hardcoding things in the
arch/powerpc/platforms/*.c file.
On ARM platforms, they currently handle this by declaring
I2C_BOARD_INFO() in their board-specific files. For OF platforms, I
think the obvious choice would be to specify platform data in the device
tree. We already register I2C devices automatically as found in the
device tree (see drivers/of/of_i2c.c), but this registration method does
not provide any way to set platform_data.
Of course, I could put some code in my board specific file to parse the
device tree properties and set pdata accordingly, but this hardly seems
ideal. After all, the device tree bindings -> pdata translation itself
does not have to be board-specific.
Basically, I think we need to have some common code somewhere that does
the task of populating platform_data for a specific I2C chip based on a
device tree node -- similarly to how we register the I2C devices
already. Is anyone working on this? Did anyone have anything else in
mind?
--
Nate Case <ncase@xes-inc.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Passing I2C platform_data from device tree to i2c driver
2008-11-03 23:54 Passing I2C platform_data from device tree to i2c driver Nate Case
@ 2008-11-06 18:54 ` Scott Wood
0 siblings, 0 replies; 2+ messages in thread
From: Scott Wood @ 2008-11-06 18:54 UTC (permalink / raw)
To: Nate Case; +Cc: linuxppc-dev
On Mon, Nov 03, 2008 at 05:54:46PM -0600, Nate Case wrote:
> Of course, I could put some code in my board specific file to parse the
> device tree properties and set pdata accordingly, but this hardly seems
> ideal. After all, the device tree bindings -> pdata translation itself
> does not have to be board-specific.
>
> Basically, I think we need to have some common code somewhere that does
> the task of populating platform_data for a specific I2C chip based on a
> device tree node -- similarly to how we register the I2C devices
> already. Is anyone working on this? Did anyone have anything else in
> mind?
It should be fairly straightforward to add an optional function pointer to
the i2c device table that turns the device tree properties into platform
data.
-Scott
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-11-06 18:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-03 23:54 Passing I2C platform_data from device tree to i2c driver Nate Case
2008-11-06 18:54 ` Scott Wood
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).