[U-Boot] [PATCH] designware_i2c: Enhance DesignWare I2C driver address support
Chin Liang See
clsee at altera.com
Wed Jan 15 16:41:16 CET 2014
Hi Alexey,
On Wed, 2014-01-15 at 15:30 +0000, Alexey Brodkin wrote:
> On Wed, 2014-01-15 at 08:58 -0600, Chin Liang See wrote:
> > Enhance the DesignWare I2C driver to support address length more
> > than 1 byte. This enhancement is required as some I2C slave
> > device such as EEPROM chip might have 16 bit address byte.
> > diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c
> > index cb2ac04..c0ac5f7 100644
> > --- a/drivers/i2c/designware_i2c.c
> > +++ b/drivers/i2c/designware_i2c.c
> > @@ -205,27 +205,21 @@ static int check_params(uint addr, int alen, uchar *buffer, int len)
> > return 1;
> > }
> >
> > - if (alen > 1) {
> > - printf("addr len %d not supported\n", alen);
> > - return 1;
> > - }
> > -
> > - if (addr + len > 256) {
> > - printf("address out of range\n");
> > - return 1;
> > - }
> > -
> > return 0;
> > }
>
> Hi Chin,
>
> if you strip down functionality of "check_params()" to one single check
> I would recommend you to remove "check_params()" at all and do in-place
> check for "buffer" existence.
>
> Moreover you may just use "assert" for this check because this buffer is
> passed by u-boot (no need to check every parameter passed to any
> function in run-time) so in production/release build it won't exist at
> all.
Good suggestion. I agreed that we can strip off the check_params. Let me
send the v2 patch. Thanks and have a nice day!
Chin Liang
>
> Regards,
> Alexey
>
>
More information about the U-Boot
mailing list