mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] i2c: omap: fix fclk_rate for ti,omap4-i2c
@ 2014-12-10  6:49 Jan Weitzel
  2014-12-11  7:59 ` Sascha Hauer
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Weitzel @ 2014-12-10  6:49 UTC (permalink / raw)
  To: barebox

"ti,am33xx" and "ti,omap4" use "ti,omap4-i2c" with different fclk_rate.
By now set it according to the used cpu compatible.

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
---
 drivers/i2c/busses/i2c-omap.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 094f591..d2254d4 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1015,6 +1015,13 @@ i2c_omap_probe(struct device_d *pdev)
 	i2c_omap->reg_shift = (i2c_data->flags >>
 					OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
 
+	if (!i2c_data->fclk_rate) {
+		if (of_machine_is_compatible("ti,am33xx"))
+			i2c_data->fclk_rate = am33xx_data.fclk_rate;
+		if (of_machine_is_compatible("ti,omap4"))
+			i2c_data->fclk_rate = omap4_data.fclk_rate;
+	}
+
 	if (pdev->platform_data != NULL) {
 		speed = *(u32 *)pdev->platform_data;
 	} else {
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] i2c: omap: fix fclk_rate for ti,omap4-i2c
  2014-12-10  6:49 [PATCH] i2c: omap: fix fclk_rate for ti,omap4-i2c Jan Weitzel
@ 2014-12-11  7:59 ` Sascha Hauer
  2014-12-11  9:47   ` [PATCH v2] " Jan Weitzel
  2014-12-17 13:59   ` [PATCH] " Jan Weitzel
  0 siblings, 2 replies; 7+ messages in thread
From: Sascha Hauer @ 2014-12-11  7:59 UTC (permalink / raw)
  To: Jan Weitzel; +Cc: barebox

On Wed, Dec 10, 2014 at 07:49:28AM +0100, Jan Weitzel wrote:
> "ti,am33xx" and "ti,omap4" use "ti,omap4-i2c" with different fclk_rate.
> By now set it according to the used cpu compatible.
> 
> Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
> ---
>  drivers/i2c/busses/i2c-omap.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 094f591..d2254d4 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -1015,6 +1015,13 @@ i2c_omap_probe(struct device_d *pdev)
>  	i2c_omap->reg_shift = (i2c_data->flags >>
>  					OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
>  
> +	if (!i2c_data->fclk_rate) {
> +		if (of_machine_is_compatible("ti,am33xx"))
> +			i2c_data->fclk_rate = am33xx_data.fclk_rate;
> +		if (of_machine_is_compatible("ti,omap4"))
> +			i2c_data->fclk_rate = omap4_data.fclk_rate;
> +	}

Can't we just do a:

	if (of_machine_is_compatible("ti,am33xx"))
		i2c_omap->data = &am33xx_data;
	if (of_machine_is_compatible("ti,omap4"))
		i2c_omap->data = &omap4_data;

Instead?

With that we could also remove the nonworking omap4_of_data.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH v2] i2c: omap: fix fclk_rate for ti,omap4-i2c
  2014-12-11  7:59 ` Sascha Hauer
@ 2014-12-11  9:47   ` Jan Weitzel
  2015-01-05 12:22     ` Jan Weitzel
  2014-12-17 13:59   ` [PATCH] " Jan Weitzel
  1 sibling, 1 reply; 7+ messages in thread
From: Jan Weitzel @ 2014-12-11  9:47 UTC (permalink / raw)
  To: barebox

The compatible "ti,omap4-i2c" don't help to get fclk_rate. So set it acording to
cpu compatible: "ti,am33xx" and "ti,omap4"

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
---
v2: set i2c_data directly

 drivers/i2c/busses/i2c-omap.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 094f591..96c3c2b 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -271,11 +271,6 @@ static struct omap_i2c_driver_data am33xx_data = {
 	.fclk_rate =	48000,
 };
 
-static struct omap_i2c_driver_data omap4_of_data = {
-	.flags =	OMAP_I2C_FLAG_BUS_SHIFT_NONE,
-	.fclk_rate =	0,
-};
-
 static inline void omap_i2c_write_reg(struct omap_i2c_struct *i2c_omap,
 				      int reg, u16 val)
 {
@@ -1011,6 +1006,11 @@ i2c_omap_probe(struct device_d *pdev)
 	if (r)
 		return r;
 
+	if (of_machine_is_compatible("ti,am33xx"))
+		i2c_data = &am33xx_data;
+	if (of_machine_is_compatible("ti,omap4"))
+		i2c_data = &omap4_data;
+
 	i2c_omap->data = i2c_data;
 	i2c_omap->reg_shift = (i2c_data->flags >>
 					OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
@@ -1140,7 +1140,6 @@ static __maybe_unused struct of_device_id omap_i2c_dt_ids[] = {
 		.data = (unsigned long)&omap3_data,
 	}, {
 		.compatible = "ti,omap4-i2c",
-		.data = (unsigned long)&omap4_of_data,
 	}, {
 		/* sentinel */
 	}
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] i2c: omap: fix fclk_rate for ti,omap4-i2c
  2014-12-11  7:59 ` Sascha Hauer
  2014-12-11  9:47   ` [PATCH v2] " Jan Weitzel
@ 2014-12-17 13:59   ` Jan Weitzel
  1 sibling, 0 replies; 7+ messages in thread
From: Jan Weitzel @ 2014-12-17 13:59 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On Thu, Dec 11, 2014 at 08:59:48AM +0100, Sascha Hauer wrote:
> On Wed, Dec 10, 2014 at 07:49:28AM +0100, Jan Weitzel wrote:
> > "ti,am33xx" and "ti,omap4" use "ti,omap4-i2c" with different fclk_rate.
> > By now set it according to the used cpu compatible.
> > 
> > Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
> > ---
> >  drivers/i2c/busses/i2c-omap.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> > index 094f591..d2254d4 100644
> > --- a/drivers/i2c/busses/i2c-omap.c
> > +++ b/drivers/i2c/busses/i2c-omap.c
> > @@ -1015,6 +1015,13 @@ i2c_omap_probe(struct device_d *pdev)
> >  	i2c_omap->reg_shift = (i2c_data->flags >>
> >  					OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
> >  
> > +	if (!i2c_data->fclk_rate) {
> > +		if (of_machine_is_compatible("ti,am33xx"))
> > +			i2c_data->fclk_rate = am33xx_data.fclk_rate;
> > +		if (of_machine_is_compatible("ti,omap4"))
> > +			i2c_data->fclk_rate = omap4_data.fclk_rate;
> > +	}
> 
> Can't we just do a:
> 
> 	if (of_machine_is_compatible("ti,am33xx"))
> 		i2c_omap->data = &am33xx_data;
> 	if (of_machine_is_compatible("ti,omap4"))
> 		i2c_omap->data = &omap4_data;
> 
> Instead?
Sounds good, I reworked the patch.

Jan
> 
> With that we could also remove the nonworking omap4_of_data.
> 
> Sascha
> 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH v2] i2c: omap: fix fclk_rate for ti,omap4-i2c
  2014-12-11  9:47   ` [PATCH v2] " Jan Weitzel
@ 2015-01-05 12:22     ` Jan Weitzel
  2015-01-06 13:47       ` Sascha Hauer
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Weitzel @ 2015-01-05 12:22 UTC (permalink / raw)
  To: barebox

On Thu, Dec 11, 2014 at 10:47:59AM +0100, Jan Weitzel wrote:
> The compatible "ti,omap4-i2c" don't help to get fclk_rate. So set it acording to
> cpu compatible: "ti,am33xx" and "ti,omap4"
> 
> Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
> ---
> v2: set i2c_data directly
>-9.0.1.i586.deb  

ping

Jan

>  drivers/i2c/busses/i2c-omap.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 094f591..96c3c2b 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -271,11 +271,6 @@ static struct omap_i2c_driver_data am33xx_data = {
>  	.fclk_rate =	48000,
>  };
>  
> -static struct omap_i2c_driver_data omap4_of_data = {
> -	.flags =	OMAP_I2C_FLAG_BUS_SHIFT_NONE,
> -	.fclk_rate =	0,
> -};
> -
>  static inline void omap_i2c_write_reg(struct omap_i2c_struct *i2c_omap,
>  				      int reg, u16 val)
>  {
> @@ -1011,6 +1006,11 @@ i2c_omap_probe(struct device_d *pdev)
>  	if (r)
>  		return r;
>  
> +	if (of_machine_is_compatible("ti,am33xx"))
> +		i2c_data = &am33xx_data;
> +	if (of_machine_is_compatible("ti,omap4"))
> +		i2c_data = &omap4_data;
> +
>  	i2c_omap->data = i2c_data;
>  	i2c_omap->reg_shift = (i2c_data->flags >>
>  					OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
> @@ -1140,7 +1140,6 @@ static __maybe_unused struct of_device_id omap_i2c_dt_ids[] = {
>  		.data = (unsigned long)&omap3_data,
>  	}, {
>  		.compatible = "ti,omap4-i2c",
> -		.data = (unsigned long)&omap4_of_data,
>  	}, {
>  		/* sentinel */
>  	}
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH v2] i2c: omap: fix fclk_rate for ti,omap4-i2c
  2015-01-05 12:22     ` Jan Weitzel
@ 2015-01-06 13:47       ` Sascha Hauer
  2015-01-07 11:00         ` Jan Weitzel
  0 siblings, 1 reply; 7+ messages in thread
From: Sascha Hauer @ 2015-01-06 13:47 UTC (permalink / raw)
  To: Jan Weitzel; +Cc: barebox

On Mon, Jan 05, 2015 at 01:22:04PM +0100, Jan Weitzel wrote:
> On Thu, Dec 11, 2014 at 10:47:59AM +0100, Jan Weitzel wrote:
> > The compatible "ti,omap4-i2c" don't help to get fclk_rate. So set it acording to
> > cpu compatible: "ti,am33xx" and "ti,omap4"
> > 
> > Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
> > ---
> > v2: set i2c_data directly
> >-9.0.1.i586.deb  
> 
> ping

Applied now.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH v2] i2c: omap: fix fclk_rate for ti,omap4-i2c
  2015-01-06 13:47       ` Sascha Hauer
@ 2015-01-07 11:00         ` Jan Weitzel
  0 siblings, 0 replies; 7+ messages in thread
From: Jan Weitzel @ 2015-01-07 11:00 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On Tue, Jan 06, 2015 at 02:47:13PM +0100, Sascha Hauer wrote:
> On Mon, Jan 05, 2015 at 01:22:04PM +0100, Jan Weitzel wrote:
> > On Thu, Dec 11, 2014 at 10:47:59AM +0100, Jan Weitzel wrote:
> > > The compatible "ti,omap4-i2c" don't help to get fclk_rate. So set it acording to
> > > cpu compatible: "ti,am33xx" and "ti,omap4"
> > > 
> > > Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
> > > ---
> > > v2: set i2c_data directly
> > >-9.0.1.i586.deb  
> > 
> > ping
> 
> Applied now.
Thanks :)

Jan
> 
> Sascha
> 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2015-01-07 11:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-10  6:49 [PATCH] i2c: omap: fix fclk_rate for ti,omap4-i2c Jan Weitzel
2014-12-11  7:59 ` Sascha Hauer
2014-12-11  9:47   ` [PATCH v2] " Jan Weitzel
2015-01-05 12:22     ` Jan Weitzel
2015-01-06 13:47       ` Sascha Hauer
2015-01-07 11:00         ` Jan Weitzel
2014-12-17 13:59   ` [PATCH] " Jan Weitzel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox