devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Converting i2c-omap driver to use device tree
@ 2011-06-23 14:15 Manjunatha GK
       [not found] ` <BANLkTin0zaE6M=0+9bq6sCvCVO_PJqYseA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
       [not found] ` <BANLkTi=DmNC6BbwDU+4smFvbc+LzFLiiOA@mail.gmail.com>
  0 siblings, 2 replies; 8+ messages in thread
From: Manjunatha GK @ 2011-06-23 14:15 UTC (permalink / raw)
  To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"


[-- Attachment #1.1: Type: text/plain, Size: 2920 bytes --]

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@48072000 {
+               compatible = "ti,omap_i2c";
+               reg = <0x48072000 0x80>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               twl@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", },
+       {},
+}
+MODULE_DEVICE_TABLE(of, omap_i2c_of_match);

With the above changes, i was expecting probe function to be called since
device gets binded to driver. But probe will never get called.

Did I miss anything with above procedure?

[-- Attachment #1.2: Type: text/html, Size: 3304 bytes --]

[-- Attachment #2: Type: text/plain, Size: 192 bytes --]

_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-06-29  4:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-23 14:15 Converting i2c-omap driver to use device tree Manjunatha GK
     [not found] ` <BANLkTin0zaE6M=0+9bq6sCvCVO_PJqYseA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-24 12:16   ` Manjunatha GK
     [not found] ` <BANLkTi=DmNC6BbwDU+4smFvbc+LzFLiiOA@mail.gmail.com>
     [not found]   ` <BANLkTi=DmNC6BbwDU+4smFvbc+LzFLiiOA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-24 13:38     ` Manjunatha GK
     [not found]       ` <BANLkTi==YKS854=YDGG44BRy_km31LqifQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-26  8:12         ` Grant Likely
     [not found]           ` <20110626081202.GB24241-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-06-26 18:51             ` Manjunatha GK
     [not found]               ` <BANLkTimJU1ecxAroZMdWDdcAg6icH1mXyA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-28 14:18                 ` Manjunatha GK
     [not found]                   ` <BANLkTinNVzgGhEXSfQf+WpSMtoUDN-5Jag-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-28 19:38                     ` Grant Likely
     [not found]                       ` <20110628193854.GA26182-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-06-29  4:53                         ` Manjunatha GK

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).