[U-Boot-Users] [PATCH] I2C register access functions for omap1510_i2c driver
Ladislav Michl
ladis at linux-mips.org
Sat Feb 9 01:58:20 CET 2008
On Fri, Feb 08, 2008 at 07:17:30PM -0500, Ben Warren wrote:
> While your fix is technically correct, I looked into this last week
> and found that this exact code is duplicated in EVERY I2C controller,
> except one (MPC8xx), where there are calls to i2c_init() in each of
> the functions.
Yup, that's why I give up fixing all that stuff, not mentioning my patch
doesn't containg the same code which reads:
void i2c_reg_write(uchar chip, uchar reg, uchar val)
{
i2c_write(chip, reg, 1, &val, 1);
}
as omap has separate function to read and write single byte and I used
it.
> I posted a request for information about why the
> i2c_init() call is necessary in MPC8xx and nobody has responded yet.
> Maybe somebody has an MPC8xx-based board and could experiment a bit to
> make it the same???
>
> I'd prefer to see these functions as static inlines in i2c.h in order
> to cut down on duplication.
Agree here, except it would be nice to use something like this:
void __i2c_reg_write(uchar chip, uchar reg, uchar val)
{
i2c_write(chip, reg, 1, &val, 1);
}
void void i2c_reg_write(uchar chip, uchar reg, uchar val)
__attribute__((weak, alias("__i2c_reg_write")));
So anyone may still use his own i2c_reg_write implementation and you
do not need to wait for answer to your question about MPC8xx.
Best regards,
ladis
More information about the U-Boot
mailing list