Commit 8859942e authored by Domen Puncer's avatar Domen Puncer Committed by Greg Kroah-Hartman

i2c-au1550: Fix timeout problem

i2c-au1550: Fix timeout problem

Fix from Jordan Crouse:
If the transmit and recieve FIFOS are not empty, forceably flush them
rather then waiting for them to drain on their own.

This solves at least a problem reported by Clem Taylor:
http://www.linux-mips.org/archives/linux-mips/2006-05/msg00240.html
(1% of I2C transactions would timeout)
Signed-off-by: default avatarDomen Puncer <domen.puncer@ultra.si>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 643bd3fb
...@@ -118,13 +118,19 @@ do_address(struct i2c_au1550_data *adap, unsigned int addr, int rd) ...@@ -118,13 +118,19 @@ do_address(struct i2c_au1550_data *adap, unsigned int addr, int rd)
/* Reset the FIFOs, clear events. /* Reset the FIFOs, clear events.
*/ */
sp->psc_smbpcr = PSC_SMBPCR_DC; stat = sp->psc_smbstat;
sp->psc_smbevnt = PSC_SMBEVNT_ALLCLR; sp->psc_smbevnt = PSC_SMBEVNT_ALLCLR;
au_sync(); au_sync();
do {
stat = sp->psc_smbpcr; if (!(stat & PSC_SMBSTAT_TE) || !(stat & PSC_SMBSTAT_RE)) {
sp->psc_smbpcr = PSC_SMBPCR_DC;
au_sync(); au_sync();
} while ((stat & PSC_SMBPCR_DC) != 0); do {
stat = sp->psc_smbpcr;
au_sync();
} while ((stat & PSC_SMBPCR_DC) != 0);
udelay(50);
}
/* Write out the i2c chip address and specify operation /* Write out the i2c chip address and specify operation
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment