static int smbus_wait_until_done(u16 smbus_base) { unsigned loops = SMBUS_TIMEOUT; unsigned char byte; do { smbus_delay(); if (--loops == 0) break; byte = inb(smbus_base + SMBHSTSTAT); } while ((byte & 1) || (byte & ~((1 << 6) | (1 << 0))) == 0); return loops ? 0 : -1; }
/** \brief block until the SMBus is no longer busy, or it times out * * \param smbus_base IO base address of the SMBus */ static int smbus_wait_until_ready(u16 smbus_base) { unsigned loops = SMBUS_TIMEOUT; unsigned char byte; do { smbus_delay(); if (--loops == 0) break; byte = inb(smbus_base + SMBHSTSTAT); } while (byte & HSTSTS_HOST_BUSY); return loops ? 0 : -1; }
static int smbus_wait_until_active(void) { unsigned long loops; loops = SMBUS_TIMEOUT; do { unsigned char val; smbus_delay(); val = inb(SMBUS_IO_BASE + SMBHSTSTAT); if ((val & 1)) { break; } } while (--loops); return loops ? 0 : -4; }
static int smbus_wait_until_done(void) { unsigned long loops; unsigned char byte; loops = SMBUS_TIMEOUT; do { smbus_delay(); byte = inb(SMBUS_IO_BASE + SMBHSTSTAT); if (byte & 1) break; } while(--loops); return loops?0:-1; }
int smbus_check_stop_condition(unsigned smbus_io_base) { unsigned char val; unsigned long loops; loops = SMBUS_TIMEOUT; /* check for SDA status */ do { smbus_delay(); val = inb(smbus_io_base + SMB_CTRL1); if ((val & SMB_CTRL1_STOP) == 0) { break; } outb((0x7F << 1) | SMB_CTRL2_ENABLE, smbus_io_base + SMB_CTRL2); } while (--loops); return loops ? 0 : SMBUS_WAIT_UNTIL_READY_TIMEOUT; }
static int smbus_wait(unsigned smbus_io_base) { unsigned long loops = SMBUS_TIMEOUT; unsigned char val; do { smbus_delay(); val = inb(smbus_io_base + SMB_STS); if ((val & SMB_STS_SDAST) != 0) break; if (val & (SMB_STS_BER | SMB_STS_NEGACK)) { /*printk(BIOS_DEBUG, "SMBUS WAIT ERROR %x\n", val); */ return SMBUS_ERROR; } } while (--loops); return loops ? 0 : SMBUS_WAIT_UNTIL_READY_TIMEOUT; }
static int smbus_wait_until_ready(void) { unsigned long loops; loops = SMBUS_TIMEOUT; do { unsigned char val; smbus_delay(); val = inb(SMBUS_IO_BASE + SMBHSTSTAT); if ((val & 1) == 0) { break; } if (loops == (SMBUS_TIMEOUT / 2)) { outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT); } } while (--loops); return loops ? 0 : -2; }
static int smbus_wait_until_done(void) { unsigned long loops; loops = SMBUS_TIMEOUT; do { unsigned char val; smbus_delay(); val = inb(SMBUS_IO_BASE + SMBHSTSTAT); if ((val & 1) == 0) { break; } if ((val & ~((1 << 6) | (1 << 0))) != 0) { break; } } while (--loops); return loops ? 0 : -3; }
static int smbus_wait_until_ready(void) { unsigned char c; unsigned long loops; loops = SMBUS_TIMEOUT; do { smbus_delay(); c = inb(SMBUS_IO_BASE + SMBHSTSTAT); while((c & 1) == 1) { print_debug("c is "); print_debug_hex8(c); print_debug("\n"); c = inb(SMBUS_IO_BASE + SMBHSTSTAT); /* nop */ } } while(--loops); return loops?0:-1; }