[PATCH] i2c: omap: fix fclk_rate for ti,omap4-i2c

Jan Weitzel J.Weitzel at phytec.de
Wed Dec 17 05:59:25 PST 2014


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 at 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 |



More information about the barebox mailing list