mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-10 04:26:19 -04:00
mxc_i2c: check for arbitration lost
No need to continue waiting if arbitration lost. Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com> Acked-by: Marek Vasut <marex@denx.de>
This commit is contained in:
parent
ca741da106
commit
d5383a63cd
@ -55,6 +55,7 @@ struct mxc_i2c_regs {
|
|||||||
|
|
||||||
#define I2SR_ICF (1 << 7)
|
#define I2SR_ICF (1 << 7)
|
||||||
#define I2SR_IBB (1 << 5)
|
#define I2SR_IBB (1 << 5)
|
||||||
|
#define I2SR_IAL (1 << 4)
|
||||||
#define I2SR_IIF (1 << 1)
|
#define I2SR_IIF (1 << 1)
|
||||||
#define I2SR_RX_NO_AK (1 << 0)
|
#define I2SR_RX_NO_AK (1 << 0)
|
||||||
|
|
||||||
@ -165,6 +166,12 @@ static int wait_for_sr_state(struct mxc_i2c_regs *i2c_regs, unsigned state)
|
|||||||
ulong start_time = get_timer(0);
|
ulong start_time = get_timer(0);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
sr = readb(&i2c_regs->i2sr);
|
sr = readb(&i2c_regs->i2sr);
|
||||||
|
if (sr & I2SR_IAL) {
|
||||||
|
writeb(sr & ~I2SR_IAL, &i2c_regs->i2sr);
|
||||||
|
printf("%s: Arbitration lost sr=%x cr=%x state=%x\n",
|
||||||
|
__func__, sr, readb(&i2c_regs->i2cr), state);
|
||||||
|
return -ERESTART;
|
||||||
|
}
|
||||||
if ((sr & (state >> 8)) == (unsigned char)state)
|
if ((sr & (state >> 8)) == (unsigned char)state)
|
||||||
return sr;
|
return sr;
|
||||||
WATCHDOG_RESET();
|
WATCHDOG_RESET();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user