[U-Boot-Users] [Patch]: A small patch for PPC4xx I2C driver
Frank
frannk_m1 at yahoo.com
Sat Feb 8 04:16:10 CET 2003
You should probably comment the write API. The "i2c_write"
function takes the value to be wriiten as a refernce but your
API implies the parameter could be a literal. You can't pass the
address of a literal...
--- Vladimir Gurevich <vag at paulidav.org> wrote:
> Hello,
>
> Here is a small and obvious patch for PPC4xx I2C driver that
> makes it "API-compatible" with other I2C drivers. I had to
> do it in order to be able to use DS1307 driver, which worked
> right out of the box after that (thanks, Steven Scholz!)
>
> Comments, criticisms, suggestions are very welcome.
> Vladimir Gurevich
> > Index: cpu/ppc4xx/i2c.c
>
===================================================================
> RCS file: /cvsroot/u-boot/u-boot/cpu/ppc4xx/i2c.c,v
> retrieving revision 1.1.1.1
> diff -c -b -w -r1.1.1.1 i2c.c
> *** cpu/ppc4xx/i2c.c 3 Nov 2002 00:32:03 -0000 1.1.1.1
> --- cpu/ppc4xx/i2c.c 8 Feb 2003 01:26:35 -0000
> ***************
> *** 414,417 ****
> --- 414,436 ----
> return (i2c_transfer( 0, chip<<1, &xaddr[4-alen],
> alen, buffer, len ) != 0);
> }
>
> +
>
/*-----------------------------------------------------------------------
> + * Read a register
> + */
> + uchar i2c_reg_read(uchar i2c_addr, uchar reg)
> + {
> + char buf;
> +
> + i2c_read(i2c_addr, reg, 1, &buf, 1);
> +
> + return(buf);
> + }
> +
> +
>
/*-----------------------------------------------------------------------
> + * Write a register
> + */
> + void i2c_reg_write(uchar i2c_addr, uchar reg, uchar val)
> + {
> + i2c_write(i2c_addr, reg, 1, &val, 1);
> + }
> #endif /* CONFIG_HARD_I2C */
>
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
More information about the U-Boot
mailing list