* [U-Boot-Users] MPC8xx I2C
@ 2008-01-30 16:33 Ben Warren
0 siblings, 0 replies; only message in thread
From: Ben Warren @ 2008-01-30 16:33 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-01-30 16:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-30 16:33 [U-Boot-Users] MPC8xx I2C Ben Warren
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.