[PATCH v3 2/2] i2c: imx: Add Vybrid VF610 I2C controller support

Lu Jingchang-B35083 B35083 at freescale.com
Mon Aug 5 05:32:11 EDT 2013


> Subject: Re: [PATCH v3 2/2] i2c: imx: Add Vybrid VF610 I2C controller
> > +struct imx_i2c_clk_pair {
> > +	u16	div;
> > +	u16	regval;
> > +}i;
> 
> Converting this to a struct should be a separate patch. This is an
> obvious cleanup which makes maintainers happy and more willing to take
> the features you are adding later.
> 
[Lu Jingchang-B35083] 
Do you mean all changes to i.MX common should be a separate patch including the clk div pair, and 
the struct imx_i2c_hwdata, struct imx_i2c_drvdata and other things changed to be easier to
use adding other SoCs support later. Thanks.
> >
> > +#define IMX_I2C_IADR	(0x00 << i2c_imx->i2c_hwdata->regshift)
> > +#define IMX_I2C_IFDR	(0x01 << i2c_imx->i2c_hwdata->regshift)
> > +#define IMX_I2C_I2CR	(0x02 << i2c_imx->i2c_hwdata->regshift)
> > +#define IMX_I2C_I2SR	(0x03 << i2c_imx->i2c_hwdata->regshift)
> > +#define IMX_I2C_I2DR	(0x04 << i2c_imx->i2c_hwdata->regshift)
> 
> Macros should not assume there is a i2c_imx variable present in a
> function. Instead, add static inline accessor functions.
[Lu Jingchang-B35083] 
Ok, I will add inline functions instead. Thanks.
> 
> 
> > +	[VF610_I2C] = {
> > +		.devtype = VF610_I2C,
> > +		.hwdata = &vf610_i2c_hwdata
> > +	},
> >  };
> 
> Why add this array?
> You should reference imx_i2c_hwdata/vf610_i2c_hwdata directly here.
[Lu Jingchang-B35083] 
The "is_imx1_i2c()"function need the devtype variable the test the arch, so the devtype is out of the
imx_i2c_hwdata struct to let all other i.MX i2c device can sharing the same imx_i2c_hwdata setting. Thanks.
> 
> >
> >  	if (of_id)
> >  		pdev->id_entry = of_id->data;
> 
> This is wrong in the original driver code. This field should be changed
> in a driver.
[Lu Jingchang-B35083] 
Could you please give some more comments on this? Thanks.



Best Regards





More information about the linux-arm-kernel mailing list