/* Poll the i2c status register until the specified bit is set. Returns 0 if timed out (100 msec).  */
static short at91_poll_status(unsigned long bit)
/* Poll the i2c status register until the specified bit is set. Returns 0 if timed out (100 msec).  */
static short at91_poll_status(unsigned long bit)
{
	int loop_cntr = 10000;
	do {
		udelay(10);
	} while (!(at91_twi_read(AT91_TWI_SR) & bit) && (--loop_cntr > 0));
	return (loop_cntr > 0);
}