From mboxrd@z Thu Jan 1 00:00:00 1970 From: Manjunatha GK Subject: Re: Converting i2c-omap driver to use device tree Date: Fri, 24 Jun 2011 17:46:21 +0530 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1090741046076939273==" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Sender: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org To: "devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org\"" List-Id: devicetree@vger.kernel.org --===============1090741046076939273== Content-Type: multipart/alternative; boundary=000e0ce0ccf26e9bde04a6742b0f --000e0ce0ccf26e9bde04a6742b0f Content-Type: text/plain; charset=ISO-8859-1 On 23 June 2011 19:45, Manjunatha GK 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 --000e0ce0ccf26e9bde04a6742b0f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

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. Sin= ce omap i2c driver uses it's own mechanism to register as platform devi= ce, I have commented out i2c device registration part from board file and t= rying to use DT data in probe function of i2c driver.

I have i2c node declared under omap4-panda.dts as:

+=A0=A0=A0=A0= =A0=A0 i2c@48072000 {
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 compat= ible =3D "ti,omap_i2c";
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 reg =3D <0x48072000 0x80>;
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 #address-cells =3D <1>;
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 #size-cells =3D <0>;
+=
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 twl@48 {
+=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 compatible =3D "= ;twl6030,4030-6030";
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 reg =3D < 0x48 >;
+=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 };
+=A0=A0=A0=A0=A0=A0 };

and board file is changed as:

@@ -685,6 +686,10 @@ static void _= _init omap4_panda_init(void)
=A0{
=A0=A0=A0=A0=A0=A0=A0 int package = =3D OMAP_PACKAGE_CBS;
=A0
+#ifdef CONFIG_OF
+=A0=A0=A0=A0=A0=A0 of= _platform_prepare(NULL, NULL);
+#endif /* CONFIG_OF */
+
=A0=A0=A0=A0=A0=A0=A0 if (omap_rev() =3D=3D= OMAP4430_REV_ES1_0)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 packa= ge =3D OMAP_PACKAGE_CBL;
=A0=A0=A0=A0=A0=A0=A0 omap4_mux_init(board_mux,= NULL, package);
@@ -700,6 +705,7 @@ static void __init omap4_panda_init= (void)
=A0=A0=A0=A0=A0=A0=A0 omap4_ehci_init();
=A0=A0=A0=A0=A0=A0=A0 usb_musb_= init(&musb_board_data);
=A0=A0=A0=A0=A0=A0=A0 omap4_panda_display_in= it();
+=A0=A0=A0=A0=A0=A0 of_platform_populate(NULL, NULL, NULL, NULL);<= br>=A0}

I have commented out device registration for I2C1 in board f= ile:

diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-oma= p2/board-omap4panda.c
index c9d1e13..0c31f35 100644
--- a/arch/arm/ma= ch-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c=
@@ -409,7 +410,7 @@ static struct i2c_board_info __initdata panda_i2c_eepro= m[] =3D {
=A0
=A0static int __init omap4_panda_i2c_init(void)
=A0{=
-=A0=A0=A0=A0=A0=A0 omap4_pmic_init("twl6030", &omap4_pan= da_twldata);
+=A0=A0=A0=A0=A0=A0 //omap4_pmic_init("twl6030", &omap4_panda= _twldata);
@@ -685,6 +686,10 @@ static void __init omap4_panda_init(void= )
=A0{
=A0=A0=A0=A0=A0=A0=A0 int package =3D OMAP_PACKAGE_CBS;
=A0=
+#ifdef CONFIG_OF
+=A0=A0=A0=A0=A0=A0 of_platform_prepare(NULL, NULL= );
+#endif /* CONFIG_OF */
+
=A0=A0=A0=A0=A0=A0=A0 if (omap_rev() =3D=3D= OMAP4430_REV_ES1_0)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 packa= ge =3D OMAP_PACKAGE_CBL;
=A0=A0=A0=A0=A0=A0=A0 omap4_mux_init(board_mux,= NULL, package);
@@ -700,6 +705,7 @@ static void __init omap4_panda_init= (void)
=A0=A0=A0=A0=A0=A0=A0 omap4_ehci_init();
=A0=A0=A0=A0=A0=A0=A0 usb_musb_= init(&musb_board_data);
=A0=A0=A0=A0=A0=A0=A0 omap4_panda_display_in= it();
+=A0=A0=A0=A0=A0=A0 of_platform_populate(NULL, NULL, NULL, NULL);<= br>=A0}

and i2c-omap is modified as:

+static const struct of_device_id omap_i2c_of_match[];
=A0static int __devinit
=A0omap_i2c_probe(struct platform_device *pdev)<= br>=A0{
@@ -1162,6 +1169,12 @@ static int omap_i2c_resume(struct device = *dev)
=A0=A0=A0=A0=A0=A0=A0 return 0;
=A0}
=A0
+static const st= ruct of_device_id omap_i2c_of_match[] =3D {
+=A0=A0=A0=A0=A0=A0 {.compatible =3D "omap_i2c", },
=A0
I tried also with:
=A0+=A0=A0=A0=A0=A0=A0 {.compat= ible =3D "ti,omap_i2c", },
still probe will not get called.
-Manjunath

--000e0ce0ccf26e9bde04a6742b0f-- --===============1090741046076939273== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org https://lists.ozlabs.org/listinfo/devicetree-discuss --===============1090741046076939273==--