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

* Re: Converting i2c-omap driver to use device tree
       [not found] ` <BANLkTin0zaE6M=0+9bq6sCvCVO_PJqYseA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-06-24 12:16   ` Manjunatha GK
  0 siblings, 0 replies; 8+ messages in thread
From: Manjunatha GK @ 2011-06-24 12:16 UTC (permalink / raw)
  To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"


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

On 23 June 2011 19:45, Manjunatha GK <manjugk-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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@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", },
>

I tried also with:
 +       {.compatible = "ti,omap_i2c", },
still probe will not get called.

-Manjunath

[-- Attachment #1.2: Type: text/html, Size: 3576 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	[flat|nested] 8+ messages in thread

* Re: Converting i2c-omap driver to use device tree
       [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>
  0 siblings, 1 reply; 8+ messages in thread
From: Manjunatha GK @ 2011-06-24 13:38 UTC (permalink / raw)
  To: Thomas Abraham
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"


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

Hi Thomas,

On 24 June 2011 18:13, Thomas Abraham <thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:

> Hi Manjunath,
>
> I will try to give some comments based on whatever little I know about
> DT. My comments maybe wrong too, I am still learning DT.
>
> On 23 June 2011 19:45, Manjunatha GK <manjugk-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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@48072000 {
> > +               compatible = "ti,omap_i2c";
> > +               reg = <0x48072000 0x80>;
> > +               #address-cells = <1>;
> > +               #size-cells = <0>;
>
> Shouldn't size-cells = 1 ?
>
> > +
> > +               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 */
>
> Is of_platform_prepare still required?
>

not required. removed now.


> > +
> >         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);
>
> Is it not required to provide the second parameter (matches) atleast?
> It depends on your dts file I guess. Maybe a proper matching is not
> happening.
>
yes. updated with second parameter as per entry in dts file.

>
> >  }
> >
> > 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?
>
> What about platform_driver->driver.of_match_table? Is it populated
> (set to omap_i2c_of_match)?
>

Yes. This entry was missing with my changes. With of_match_table, probe is
getting called.
Thanks for the pointer.

-Manjunath

[-- Attachment #1.2: Type: text/html, Size: 5724 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	[flat|nested] 8+ messages in thread

* Re: Converting i2c-omap driver to use device tree
       [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>
  0 siblings, 1 reply; 8+ messages in thread
From: Grant Likely @ 2011-06-26  8:12 UTC (permalink / raw)
  To: Manjunatha GK
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"

On Fri, Jun 24, 2011 at 07:08:34PM +0530, Manjunatha GK wrote:
> Hi Thomas,
> 
> On 24 June 2011 18:13, Thomas Abraham <thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> 
> > Hi Manjunath,
> >
> > I will try to give some comments based on whatever little I know about
> > DT. My comments maybe wrong too, I am still learning DT.
> >
> > On 23 June 2011 19:45, Manjunatha GK <manjugk-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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@48072000 {
> > > +               compatible = "ti,omap_i2c";
> > > +               reg = <0x48072000 0x80>;
> > > +               #address-cells = <1>;
> > > +               #size-cells = <0>;
> >
> > Shouldn't size-cells = 1 ?
> >
> > > +
> > > +               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 */
> >
> > Is of_platform_prepare still required?
> >
> 
> not required. removed now.
> 
> 
> > > +
> > >         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);
> >
> > Is it not required to provide the second parameter (matches) atleast?
> > It depends on your dts file I guess. Maybe a proper matching is not
> > happening.
> >
> yes. updated with second parameter as per entry in dts file.
> 
> >
> > >  }
> > >
> > > 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?
> >
> > What about platform_driver->driver.of_match_table? Is it populated
> > (set to omap_i2c_of_match)?
> >
> 
> Yes. This entry was missing with my changes. With of_match_table, probe is
> getting called.
> Thanks for the pointer.

Glad to hear you got it sorted out.

g.

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

* Re: Converting i2c-omap driver to use device tree
       [not found]           ` <20110626081202.GB24241-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
@ 2011-06-26 18:51             ` Manjunatha GK
       [not found]               ` <BANLkTimJU1ecxAroZMdWDdcAg6icH1mXyA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Manjunatha GK @ 2011-06-26 18:51 UTC (permalink / raw)
  To: Grant Likely
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"


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

Hi Grant,

On 26 June 2011 13:42, Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:

> On Fri, Jun 24, 2011 at 07:08:34PM +0530, Manjunatha GK wrote:
> > Hi Thomas,
> >
> > On 24 June 2011 18:13, Thomas Abraham <thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> >
> > > Hi Manjunath,
> > >
>

[...]

> > >
> > > > 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?
> > >
> > > What about platform_driver->driver.of_match_table? Is it populated
> > > (set to omap_i2c_of_match)?
> > >
> >
> > Yes. This entry was missing with my changes. With of_match_table, probe
> is
> > getting called.
> > Thanks for the pointer.
>
> Glad to hear you got it sorted out.
>

Yes. Now I am able to get i2c base address from DT through device node
structure but not able to get irq number from DT. The .dts entries are:

+       gic: intc@48241000 {
+               compatible = "arm,omap-gic", "arm,gic";
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               reg = <0x48241000 0x1000>;
+       };
+
+       i2c@48072000 {
+               interrupts = <88>;
+               interrupt-parent = <&gic>;
+               compatible = "ti,omap_i2c";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0x48072000 0x80>;
+
+               twl@0x48 {
+                       compatible = "ti,twl6030";
+                       reg = < 0x48 >;
+               };
+
+       };

>From the debug log, it is observed that, the interrupts field will not
exists in device_node data structure. It captures all the fields from the
about i2c DT entries except interrupts field.

[    0.293182] of_irq_map_one: dev=/i2c@48072000, index=0
[    0.293212] of_find_property; pp->name: compatible    name: interrupts
[    0.293212] of_find_property; pp->name: reg   name: interrupts
[    0.293243] of_find_property; pp->name: #address-cells        name:
interrupts
[    0.293243] of_find_property; pp->name: #size-cells   name: interrupts
[    0.293273] of_find_property; pp->name: name  name: interrupts
[    0.293304] omap_i2c_probe: i2c: dev->base: fa072000
[    0.293304] omap_i2c_probe: i2c: dev->irq: ffffffff

Any specific reason for missing entries in device node structures?

Since you explored other ARM boards, is this interrupts field used and
tested?

-Manjunath

[-- Attachment #1.2: Type: text/html, Size: 3539 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	[flat|nested] 8+ messages in thread

* Re: Converting i2c-omap driver to use device tree
       [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>
  0 siblings, 1 reply; 8+ messages in thread
From: Manjunatha GK @ 2011-06-28 14:18 UTC (permalink / raw)
  To: Grant Likely
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"


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

Grant,
I am able to sort out this issue and i can see irq numbers getting populated
in i2c driver.

I have some other queries related to handling SoC specific data. I will post
the query with separate thread.

-Manjunath

On 27 June 2011 00:21, Manjunatha GK <manjugk-l0cyMroinI0@public.gmane.org> wrote:

> Hi Grant,
>
> On 26 June 2011 13:42, Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
>
>> On Fri, Jun 24, 2011 at 07:08:34PM +0530, Manjunatha GK wrote:
>> > Hi Thomas,
>> >
>> > On 24 June 2011 18:13, Thomas Abraham <thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>> wrote:
>> >
>> > > Hi Manjunath,
>> > >
>>
>
> [...]
>
> > > >
>> > > > 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?
>> > >
>> > > What about platform_driver->driver.of_match_table? Is it populated
>> > > (set to omap_i2c_of_match)?
>> > >
>> >
>> > Yes. This entry was missing with my changes. With of_match_table, probe
>> is
>> > getting called.
>> > Thanks for the pointer.
>>
>> Glad to hear you got it sorted out.
>>
>
> Yes. Now I am able to get i2c base address from DT through device node
> structure but not able to get irq number from DT. The .dts entries are:
>
> +       gic: intc@48241000 {
> +               compatible = "arm,omap-gic", "arm,gic";
> +               interrupt-controller;
> +               #interrupt-cells = <1>;
> +               reg = <0x48241000 0x1000>;
> +       };
> +
> +       i2c@48072000 {
> +               interrupts = <88>;
> +               interrupt-parent = <&gic>;
> +               compatible = "ti,omap_i2c";
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +               reg = <0x48072000 0x80>;
> +
> +               twl@0x48 {
> +                       compatible = "ti,twl6030";
> +                       reg = < 0x48 >;
> +               };
> +
> +       };
>
> From the debug log, it is observed that, the interrupts field will not
> exists in device_node data structure. It captures all the fields from the
> about i2c DT entries except interrupts field.
>
> [    0.293182] of_irq_map_one: dev=/i2c@48072000, index=0
> [    0.293212] of_find_property; pp->name: compatible    name: interrupts
> [    0.293212] of_find_property; pp->name: reg   name: interrupts
> [    0.293243] of_find_property; pp->name: #address-cells        name:
> interrupts
> [    0.293243] of_find_property; pp->name: #size-cells   name: interrupts
> [    0.293273] of_find_property; pp->name: name  name: interrupts
> [    0.293304] omap_i2c_probe: i2c: dev->base: fa072000
> [    0.293304] omap_i2c_probe: i2c: dev->irq: ffffffff
>
> Any specific reason for missing entries in device node structures?
>
> Since you explored other ARM boards, is this interrupts field used and
> tested?
>
> -Manjunath
>
>


-- 
Manjunatha GK

Linaro.org <http://www.linaro.org/>* **│ *Open source software for ARM SoCs

Follow *Linaro: *Facebook <http://www.facebook.com/pages/Linaro> |
Twitter<http://twitter.com/#%21/linaroorg>|
Blog <http://www.linaro.org/linaro-blog/>

[-- Attachment #1.2: Type: text/html, Size: 5398 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	[flat|nested] 8+ messages in thread

* Re: Converting i2c-omap driver to use device tree
       [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>
  0 siblings, 1 reply; 8+ messages in thread
From: Grant Likely @ 2011-06-28 19:38 UTC (permalink / raw)
  To: Manjunatha GK
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"

On Tue, Jun 28, 2011 at 07:48:29PM +0530, Manjunatha GK wrote:
> Grant,
> I am able to sort out this issue and i can see irq numbers getting populated
> in i2c driver.
> 
> I have some other queries related to handling SoC specific data. I will post
> the query with separate thread.
> 
> -Manjunath
> 
> On 27 June 2011 00:21, Manjunatha GK <manjugk@ti.com> wrote:
> 
> > Hi Grant,
> >
> > On 26 June 2011 13:42, Grant Likely <grant.likely@secretlab.ca> wrote:
> >
> >> On Fri, Jun 24, 2011 at 07:08:34PM +0530, Manjunatha GK wrote:
> >> > Hi Thomas,
> >> >
> >> > On 24 June 2011 18:13, Thomas Abraham <thomas.abraham@linaro.org>
> >> wrote:
> >> >
> >> > > Hi Manjunath,
> >> > >
> >>
> >
> > [...]
> >
> > > > >
> >> > > > 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?
> >> > >
> >> > > What about platform_driver->driver.of_match_table? Is it populated
> >> > > (set to omap_i2c_of_match)?
> >> > >
> >> >
> >> > Yes. This entry was missing with my changes. With of_match_table, probe
> >> is
> >> > getting called.
> >> > Thanks for the pointer.
> >>
> >> Glad to hear you got it sorted out.
> >>
> >
> > Yes. Now I am able to get i2c base address from DT through device node
> > structure but not able to get irq number from DT. The .dts entries are:
> >
> > +       gic: intc@48241000 {
> > +               compatible = "arm,omap-gic", "arm,gic";
> > +               interrupt-controller;
> > +               #interrupt-cells = <1>;
> > +               reg = <0x48241000 0x1000>;
> > +       };
> > +
> > +       i2c@48072000 {
> > +               interrupts = <88>;
> > +               interrupt-parent = <&gic>;
> > +               compatible = "ti,omap_i2c";
> > +               #address-cells = <1>;
> > +               #size-cells = <0>;
> > +               reg = <0x48072000 0x80>;
> > +
> > +               twl@0x48 {
> > +                       compatible = "ti,twl6030";
> > +                       reg = < 0x48 >;
> > +               };
> > +
> > +       };
> >
> > From the debug log, it is observed that, the interrupts field will not
> > exists in device_node data structure. It captures all the fields from the
> > about i2c DT entries except interrupts field.
> >
> > [    0.293182] of_irq_map_one: dev=/i2c@48072000, index=0
> > [    0.293212] of_find_property; pp->name: compatible    name: interrupts
> > [    0.293212] of_find_property; pp->name: reg   name: interrupts
> > [    0.293243] of_find_property; pp->name: #address-cells        name:
> > interrupts
> > [    0.293243] of_find_property; pp->name: #size-cells   name: interrupts
> > [    0.293273] of_find_property; pp->name: name  name: interrupts
> > [    0.293304] omap_i2c_probe: i2c: dev->base: fa072000
> > [    0.293304] omap_i2c_probe: i2c: dev->irq: ffffffff
> >
> > Any specific reason for missing entries in device node structures?
> >
> > Since you explored other ARM boards, is this interrupts field used and
> > tested?

What tree do you have your work based on top of?  Do you have the
irq_domain patch applied?  If so, then the problem is most likely that an
irq_domain has not been registered for the OMAP interrupt controller
(which is not surprising since the gic has not been converted to use
irq_domain yet).  There are patches that have been posted to the list
to do so, but they are not finished yet.  In the mean time you can use
irq_domain_generate_simple() to create an irq_domain registration for
the OMAP that will get you past this step.

Search the devicetree/test branch for irq_domain_generate_simple() to
see how to use it.

g.

> >
> > -Manjunath
> >
> >
> 
> 
> -- 
> Manjunatha GK
> 
> Linaro.org <http://www.linaro.org/>* **│ *Open source software for ARM SoCs
> 
> Follow *Linaro: *Facebook <http://www.facebook.com/pages/Linaro> |
> Twitter<http://twitter.com/#%21/linaroorg>|
> Blog <http://www.linaro.org/linaro-blog/>
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

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

* Re: Converting i2c-omap driver to use device tree
       [not found]                       ` <20110628193854.GA26182-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
@ 2011-06-29  4:53                         ` Manjunatha GK
  0 siblings, 0 replies; 8+ messages in thread
From: Manjunatha GK @ 2011-06-29  4:53 UTC (permalink / raw)
  To: Grant Likely
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"


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

On 29 June 2011 01:08, Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
[...]

> > >
> > > Any specific reason for missing entries in device node structures?
> > >
> > > Since you explored other ARM boards, is this interrupts field used and
> > > tested?
>
> What tree do you have your work based on top of?


git://git.secretlab.ca/git/linux-2.6.git
branch: devicetree/test

Do you have the irq_domain patch applied?

If so, then the problem is most likely that an
> irq_domain has not been registered for the OMAP interrupt controller
> (which is not surprising since the gic has not been converted to use
> irq_domain yet).  There are patches that have been posted to the list
> to do so, but they are not finished yet.

ok.


> In the mean time you can use
> irq_domain_generate_simple() to create an irq_domain registration for
> the OMAP that will get you past this step.
>
> Search the devicetree/test branch for irq_domain_generate_simple() to
> see how to use it.
>
> I realized this hence used

node = of_find_matching_node_by_address(NULL, omap_dt_gic_match,
                                                OMAP44XX_GIC_DIST_BASE);
        if (node)
                irq_domain_add_simple(node, 0);

which resolved the irq issue.

Thanks for the info.

-Manjunath

[-- Attachment #1.2: Type: text/html, Size: 2284 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	[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).