Re: [i2c] [PATCH] Convert i2c-mpc from a platform driver to an of_platform one
From: Jean Delvare <hidden>
Date: 2008-06-29 16:35:40
Also in:
linux-i2c
On Sun, 29 Jun 2008 12:24:39 -0400, Sean MacLennan wrote:
On Sun, 29 Jun 2008 09:17:25 +0200 "Jean Delvare" [off-list ref] wrote:quoted
Ah, OK. If you use i2c_new_device() then it's alright.Correct. I have done the same thing for the i2c-ibm_iic.c driver. Jean, I think you will like this. It gets rid of the index and the numbered drivers. And the walking of the device tree is very clean because the dts knows all the devices. For example here is the relevant portion of the dts for the Warp: IIC0: i2c@ef600700 { compatible = "ibm,iic-440ep", "ibm,iic-440gp", "ibm,iic"; reg = <ef600700 14>; interrupt-parent = <&UIC0>; interrupts = <2 4>; #address-cells = <1>; #size-cells = <0>; ad7414@4a { compatible = "adi,ad7414"; reg = <4a>; interrupts = <19 8>; interrupt-parent = <&UIC0>; }; }; It clearly shows that first i2c controller (IIC0) contains one ad7414 device at address 4A.
That's fine with me. I expected the dts to be converted to platform initialization data (i2c_board_info structures) being registered with i2c_register_board_info() and numbered adapters. But if you prefer unnumbered adapters and the platform code or the bus driver itself calls i2c_new_device() based on the dts, that should work too. -- Jean Delvare