All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cousson, Benoit" <b-cousson@ti.com>
To: "G, Manjunath Kondaiah" <manjugk@ti.com>
Cc: "devicetree-discuss@lists.ozlabs.org"
	<devicetree-discuss@lists.ozlabs.org>,
	linux-omap <linux-omap@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: Fwd: [RFC/PATCH v2 08/13] dt: omap: i2c: add dt support for i2c1 controller
Date: Tue, 23 Aug 2011 21:15:11 +0200	[thread overview]
Message-ID: <4E53FC3F.9060203@ti.com> (raw)
In-Reply-To: <4E537F53.4030405@ti.com>

> The device tree support has been added to i2c1 controller and
> corresponding i2c initilization in generic board file is cleaned
> up so that platfom device is registered through dt and omap device
> and not through board i2c initilization.

A couple of typos in the changelog.

That patch should be in two parts: the driver DT update and the beagle 
board update.

> These changes will not affect non dt builds and existing functionality
> is retained.
>
> Tested with dt and non dt builds and boot tested on beagle board.

Is it crashing at boot time like for panda? In that case a big 
disclaimer should be in the broken patch changelog as well.

> Signed-off-by: G, Manjunath Kondaiah<manjugk@ti.com>
> ---
>    arch/arm/mach-omap2/board-omap3-dt.c |   14 +++++++-------
>    drivers/i2c/busses/i2c-omap.c        |   23 ++++++++++++++++++++---
>    2 files changed, 27 insertions(+), 10 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-omap3-dt.c
> b/arch/arm/mach-omap2/board-omap3-dt.c
> index 72c59a4..cd11224 100644
> --- a/arch/arm/mach-omap2/board-omap3-dt.c
> +++ b/arch/arm/mach-omap2/board-omap3-dt.c
> @@ -35,11 +35,11 @@ static struct twl4030_platform_data beagle_twldata = {
>    	/* platform_data for children goes here */
>    };
>
> -static int __init omap3_beagle_i2c_init(void)
> -{
> -	omap3_pmic_init("twl4030",&beagle_twldata);
> -	return 0;
> -}
> +struct of_dev_auxdata omap3_auxdata_lookup[] __initdata = {
> +	OF_DEV_AUXDATA_ID_PDSIZE("ti,omap-i2c", 0x48070000, "i2c1", 1,\
> +				&beagle_twldata, sizeof(beagle_twldata)),
> +	{}
> +};
>
>    static void __init omap3_init_early(void)
>    {
> @@ -61,11 +61,11 @@ static struct of_device_id omap_dt_match_table[]
> __initdata = {
>
>    static void __init omap3_init(void)
>    {
> -	omap3_beagle_i2c_init();
>    	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
>    	omap_serial_init();
>
> -	of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
> +	of_platform_populate(NULL, omap_dt_match_table, omap3_auxdata_lookup,
> +									 NULL);
>    }
>
>    static const char *omap3_dt_match[] __initdata = {
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 2a072ff..9e98014 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -38,6 +38,7 @@
>    #include<linux/clk.h>
>    #include<linux/io.h>
>    #include<linux/of_i2c.h>
> +#include<linux/of_device.h>
>    #include<linux/slab.h>
>    #include<linux/i2c-omap.h>
>    #include<linux/pm_runtime.h>
> @@ -972,6 +973,16 @@ static const struct i2c_algorithm omap_i2c_algo = {
>    	.functionality	= omap_i2c_func,
>    };
>
> +#if defined(CONFIG_OF)
> +static const struct of_device_id omap_i2c_of_match[] = {
> +	{.compatible = "ti,omap-i2c", },
> +	{},
> +}
> +MODULE_DEVICE_TABLE(of, omap_i2c_of_match);
> +#else
> +#define omap_i2c_of_match NULL
> +#endif
> +
>    static int __devinit
>    omap_i2c_probe(struct platform_device *pdev)
>    {
> @@ -1008,12 +1019,17 @@ omap_i2c_probe(struct platform_device *pdev)
>    		goto err_release_region;
>    	}
>
> +	speed = 100;	/* Default speed */
>    	if (pdata != NULL) {
>    		speed = pdata->clkrate;
>    		dev->set_mpu_wkup_lat = pdata->set_mpu_wkup_lat;
> -	} else {
> -		speed = 100;	/* Default speed */
> -		dev->set_mpu_wkup_lat = NULL;
> +#if defined(CONFIG_OF)
> +	} else if (pdev->dev.of_node) {
> +		u32 prop;
> +		if (!of_property_read_u32(pdev->dev.of_node, "clock-frequency",
> +									&prop))
> +			speed = prop/100;

Did you check the frequency? It should be prop/1000 to get Hz -> kHz 
conversion. Otherwise the driver will set the i2c speed at 4 MHz.

Benoit

> +#endif
>    	}
>
>    	dev->speed = speed;
> @@ -1178,6 +1194,7 @@ static struct platform_driver omap_i2c_driver = {
>    		.name	= "omap_i2c",
>    		.owner	= THIS_MODULE,
>    		.pm	= OMAP_I2C_PM_OPS,
> +		.of_match_table = omap_i2c_of_match,
>    	},
>    };
>


WARNING: multiple messages have this Message-ID (diff)
From: b-cousson@ti.com (Cousson, Benoit)
To: linux-arm-kernel@lists.infradead.org
Subject: Fwd: [RFC/PATCH v2 08/13] dt: omap: i2c: add dt support for i2c1 controller
Date: Tue, 23 Aug 2011 21:15:11 +0200	[thread overview]
Message-ID: <4E53FC3F.9060203@ti.com> (raw)
In-Reply-To: <4E537F53.4030405@ti.com>

> The device tree support has been added to i2c1 controller and
> corresponding i2c initilization in generic board file is cleaned
> up so that platfom device is registered through dt and omap device
> and not through board i2c initilization.

A couple of typos in the changelog.

That patch should be in two parts: the driver DT update and the beagle 
board update.

> These changes will not affect non dt builds and existing functionality
> is retained.
>
> Tested with dt and non dt builds and boot tested on beagle board.

Is it crashing at boot time like for panda? In that case a big 
disclaimer should be in the broken patch changelog as well.

> Signed-off-by: G, Manjunath Kondaiah<manjugk@ti.com>
> ---
>    arch/arm/mach-omap2/board-omap3-dt.c |   14 +++++++-------
>    drivers/i2c/busses/i2c-omap.c        |   23 ++++++++++++++++++++---
>    2 files changed, 27 insertions(+), 10 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-omap3-dt.c
> b/arch/arm/mach-omap2/board-omap3-dt.c
> index 72c59a4..cd11224 100644
> --- a/arch/arm/mach-omap2/board-omap3-dt.c
> +++ b/arch/arm/mach-omap2/board-omap3-dt.c
> @@ -35,11 +35,11 @@ static struct twl4030_platform_data beagle_twldata = {
>    	/* platform_data for children goes here */
>    };
>
> -static int __init omap3_beagle_i2c_init(void)
> -{
> -	omap3_pmic_init("twl4030",&beagle_twldata);
> -	return 0;
> -}
> +struct of_dev_auxdata omap3_auxdata_lookup[] __initdata = {
> +	OF_DEV_AUXDATA_ID_PDSIZE("ti,omap-i2c", 0x48070000, "i2c1", 1,\
> +				&beagle_twldata, sizeof(beagle_twldata)),
> +	{}
> +};
>
>    static void __init omap3_init_early(void)
>    {
> @@ -61,11 +61,11 @@ static struct of_device_id omap_dt_match_table[]
> __initdata = {
>
>    static void __init omap3_init(void)
>    {
> -	omap3_beagle_i2c_init();
>    	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
>    	omap_serial_init();
>
> -	of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
> +	of_platform_populate(NULL, omap_dt_match_table, omap3_auxdata_lookup,
> +									 NULL);
>    }
>
>    static const char *omap3_dt_match[] __initdata = {
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 2a072ff..9e98014 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -38,6 +38,7 @@
>    #include<linux/clk.h>
>    #include<linux/io.h>
>    #include<linux/of_i2c.h>
> +#include<linux/of_device.h>
>    #include<linux/slab.h>
>    #include<linux/i2c-omap.h>
>    #include<linux/pm_runtime.h>
> @@ -972,6 +973,16 @@ static const struct i2c_algorithm omap_i2c_algo = {
>    	.functionality	= omap_i2c_func,
>    };
>
> +#if defined(CONFIG_OF)
> +static const struct of_device_id omap_i2c_of_match[] = {
> +	{.compatible = "ti,omap-i2c", },
> +	{},
> +}
> +MODULE_DEVICE_TABLE(of, omap_i2c_of_match);
> +#else
> +#define omap_i2c_of_match NULL
> +#endif
> +
>    static int __devinit
>    omap_i2c_probe(struct platform_device *pdev)
>    {
> @@ -1008,12 +1019,17 @@ omap_i2c_probe(struct platform_device *pdev)
>    		goto err_release_region;
>    	}
>
> +	speed = 100;	/* Default speed */
>    	if (pdata != NULL) {
>    		speed = pdata->clkrate;
>    		dev->set_mpu_wkup_lat = pdata->set_mpu_wkup_lat;
> -	} else {
> -		speed = 100;	/* Default speed */
> -		dev->set_mpu_wkup_lat = NULL;
> +#if defined(CONFIG_OF)
> +	} else if (pdev->dev.of_node) {
> +		u32 prop;
> +		if (!of_property_read_u32(pdev->dev.of_node, "clock-frequency",
> +									&prop))
> +			speed = prop/100;

Did you check the frequency? It should be prop/1000 to get Hz -> kHz 
conversion. Otherwise the driver will set the i2c speed at 4 MHz.

Benoit

> +#endif
>    	}
>
>    	dev->speed = speed;
> @@ -1178,6 +1194,7 @@ static struct platform_driver omap_i2c_driver = {
>    		.name	= "omap_i2c",
>    		.owner	= THIS_MODULE,
>    		.pm	= OMAP_I2C_PM_OPS,
> +		.of_match_table = omap_i2c_of_match,
>    	},
>    };
>

  parent reply	other threads:[~2011-08-23 19:15 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-23  5:03 [RFC/PATCH v2 00/13] dt: omap: dt binding with omap_device and support for i2c1 G, Manjunath Kondaiah
2011-08-23  5:03 ` [RFC/PATCH v2 01/13] OMAP: omap_device: Add device tree node pointer G, Manjunath Kondaiah
2011-08-23  5:03 ` [RFC/PATCH v2 02/13] dt: Add pd_size to AUXDATA structure G, Manjunath Kondaiah
2011-08-23  5:03 ` [RFC/PATCH v2 03/13] dt: omap3: add soc file for handling i2c controllers G, Manjunath Kondaiah
2011-08-23  5:03 ` [RFC/PATCH v2 04/13] dt: omap3: beagle board: set clock freq for i2c devices G, Manjunath Kondaiah
2011-08-23  5:03 ` [RFC/PATCH v2 05/13] dt: omap3: add generic board file for dt support G, Manjunath Kondaiah
2011-08-23  5:03 ` [RFC/PATCH v2 06/13] dt: omap3: add omap-device compatible property G, Manjunath Kondaiah
2011-08-23  5:03 ` [RFC/PATCH v2 07/13] dt: omap: create platform bus for omap devices G, Manjunath Kondaiah
2011-08-23  9:07   ` Jamie Iles
2011-08-23  9:07     ` Jamie Iles
2011-08-23 15:19     ` G, Manjunath Kondaiah
2011-08-23 15:19       ` G, Manjunath Kondaiah
2011-08-23  5:03 ` [RFC/PATCH v2 08/13] dt: omap: i2c: add dt support for i2c1 controller G, Manjunath Kondaiah
2011-08-23 15:46   ` G, Manjunath Kondaiah
2011-08-23 15:46     ` G, Manjunath Kondaiah
2011-09-01 17:34     ` Cousson, Benoit
2011-09-01 17:34       ` Cousson, Benoit
2011-09-02  3:22       ` G, Manjunath Kondaiah
2011-09-02  3:22         ` G, Manjunath Kondaiah
     [not found]   ` <4E537F53.4030405@ti.com>
2011-08-23 19:15     ` Cousson, Benoit [this message]
2011-08-23 19:15       ` Fwd: " Cousson, Benoit
2011-08-23  5:03 ` [RFC/PATCH v2 09/13] dt: omap4: add soc file for handling i2c controllers G, Manjunath Kondaiah
2011-08-23  8:23   ` Rajendra Nayak
2011-08-23  8:23     ` Rajendra Nayak
2011-08-23 15:11     ` G, Manjunath Kondaiah
2011-08-23 15:11       ` G, Manjunath Kondaiah
     [not found]   ` <4E537FA7.3050609@ti.com>
2011-08-23 13:48     ` Fwd: " Cousson, Benoit
2011-08-23 13:48       ` Cousson, Benoit
2011-08-23 15:18       ` G, Manjunath Kondaiah
2011-08-23 15:18         ` G, Manjunath Kondaiah
2011-08-23 19:45         ` Cousson, Benoit
2011-08-23 19:45           ` Cousson, Benoit
2011-08-23  5:03 ` [RFC/PATCH v2 10/13] dt: omap4: panda board: set clock freq for i2c devices G, Manjunath Kondaiah
     [not found]   ` <4E537F6B.4060608@ti.com>
2011-08-23 19:03     ` Cousson, Benoit
2011-08-23 19:03       ` Cousson, Benoit
2011-08-23 19:15       ` G, Manjunath Kondaiah
2011-08-23 19:15         ` G, Manjunath Kondaiah
2011-08-23  5:03 ` [RFC/PATCH v2 11/13] dt: omap4: add generic board file for dt support G, Manjunath Kondaiah
     [not found]   ` <4E537F80.1060001@ti.com>
     [not found]     ` <4E537F80.1060001-l0cyMroinI0@public.gmane.org>
2011-08-23 13:05       ` Fwd: " Cousson, Benoit
2011-08-23 13:05         ` Cousson, Benoit
2011-08-23 15:30         ` G, Manjunath Kondaiah
2011-08-23 15:30           ` G, Manjunath Kondaiah
2011-08-23  5:03 ` [RFC/PATCH v2 12/13] dt: omap4: enable dt support for i2c1 controller G, Manjunath Kondaiah
2011-08-23  5:03 ` [RFC/PATCH v2 13/13] dt: omap: i2c: dt usage model documentation G, Manjunath Kondaiah
     [not found] ` <4E537ECB.1060704@ti.com>
2011-08-23 12:38   ` [RFC/PATCH v2 00/13] dt: omap: dt binding with omap_device and support for i2c1 Cousson, Benoit
2011-08-23 12:38     ` Cousson, Benoit
2011-08-23 15:41 ` G, Manjunath Kondaiah
2011-08-23 15:41   ` G, Manjunath Kondaiah
2011-08-24  9:41   ` Cousson, Benoit
2011-08-24  9:41     ` Cousson, Benoit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E53FC3F.9060203@ti.com \
    --to=b-cousson@ti.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=manjugk@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.