Hi, I'm trying to rationalize some very common I2C code and came across the following:
Every controller except cpu/mpc8xx implements functions like this: --- uchar i2c_reg_read(uchar i2c_addr, uchar reg) { uchar buf; i2c_read(i2c_addr, reg, 1, &buf, 1); return buf; } void i2c_reg_write(uchar i2c_addr, uchar reg, uchar val) { i2c_write(i2c_addr, reg, 1, &val, 1); } --- cpu/mpc8xx, however, adds i2c_init() calls: --- uchar i2c_reg_read(uchar i2c_addr, uchar reg) { uchar buf; i2c_init(CFG_I2C_SPEED, CFG_I2C_SLAVE); i2c_read(i2c_addr, reg, 1, &buf, 1); return (buf); } void i2c_reg_write(uchar i2c_addr, uchar reg, uchar val) { i2c_init(CFG_I2C_SPEED, CFG_I2C_SLAVE); i2c_write(i2c_addr, reg, 1, &val, 1); } --- Can somebody lend historical perspective as to why these i2c_init() calls are needed? thanks, Ben ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users