Converting i2c-omap driver to use device tree
Manjunatha GK
manjugk at linaro.org
Fri Jun 24 22:16:21 EST 2011
On 23 June 2011 19:45, Manjunatha GK <manjugk at linaro.org> wrote:
> Hi Grant,
> I am trying to convert i2c-omap driver to use device tree. Since omap i2c
> driver uses it's own mechanism to register as platform device, I have
> commented out i2c device registration part from board file and trying to use
> DT data in probe function of i2c driver.
>
> I have i2c node declared under omap4-panda.dts as:
>
> + i2c at 48072000 {
> + compatible = "ti,omap_i2c";
> + reg = <0x48072000 0x80>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + twl at 48 {
> + compatible = "twl6030,4030-6030";
> + reg = < 0x48 >;
> + };
> + };
>
> and board file is changed as:
>
> @@ -685,6 +686,10 @@ static void __init omap4_panda_init(void)
> {
> int package = OMAP_PACKAGE_CBS;
>
> +#ifdef CONFIG_OF
> + of_platform_prepare(NULL, NULL);
> +#endif /* CONFIG_OF */
> +
> if (omap_rev() == OMAP4430_REV_ES1_0)
> package = OMAP_PACKAGE_CBL;
> omap4_mux_init(board_mux, NULL, package);
> @@ -700,6 +705,7 @@ static void __init omap4_panda_init(void)
> omap4_ehci_init();
> usb_musb_init(&musb_board_data);
> omap4_panda_display_init();
> + of_platform_populate(NULL, NULL, NULL, NULL);
> }
>
> I have commented out device registration for I2C1 in board file:
>
> diff --git a/arch/arm/mach-omap2/board-omap4panda.c
> b/arch/arm/mach-omap2/board-omap4panda.c
> index c9d1e13..0c31f35 100644
> --- a/arch/arm/mach-omap2/board-omap4panda.c
> +++ b/arch/arm/mach-omap2/board-omap4panda.c
> @@ -409,7 +410,7 @@ static struct i2c_board_info __initdata
> panda_i2c_eeprom[] = {
>
> static int __init omap4_panda_i2c_init(void)
> {
> - omap4_pmic_init("twl6030", &omap4_panda_twldata);
> + //omap4_pmic_init("twl6030", &omap4_panda_twldata);
> @@ -685,6 +686,10 @@ static void __init omap4_panda_init(void)
> {
> int package = OMAP_PACKAGE_CBS;
>
> +#ifdef CONFIG_OF
> + of_platform_prepare(NULL, NULL);
> +#endif /* CONFIG_OF */
> +
> if (omap_rev() == OMAP4430_REV_ES1_0)
> package = OMAP_PACKAGE_CBL;
> omap4_mux_init(board_mux, NULL, package);
> @@ -700,6 +705,7 @@ static void __init omap4_panda_init(void)
> omap4_ehci_init();
> usb_musb_init(&musb_board_data);
> omap4_panda_display_init();
> + of_platform_populate(NULL, NULL, NULL, NULL);
> }
>
> and i2c-omap is modified as:
>
> +static const struct of_device_id omap_i2c_of_match[];
> static int __devinit
> omap_i2c_probe(struct platform_device *pdev)
> {
> @@ -1162,6 +1169,12 @@ static int omap_i2c_resume(struct device *dev)
> return 0;
> }
>
> +static const struct of_device_id omap_i2c_of_match[] = {
> + {.compatible = "omap_i2c", },
>
I tried also with:
+ {.compatible = "ti,omap_i2c", },
still probe will not get called.
-Manjunath
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/devicetree-discuss/attachments/20110624/ec052a9b/attachment.html>
More information about the devicetree-discuss
mailing list