/* Return the last read status value on success or -1 on failure.  */
static int ich_status_poll(struct ich_spi_priv *ctlr, u16 bitmask, int wait_til_set)
/* Return the last read status value on success or -1 on failure.  */
static int ich_status_poll(struct ich_spi_priv *ctlr, u16 bitmask, int wait_til_set)
{
	int timeout = 600000;
	u16 status = 0;
	while (timeout--) {
		status = ich_readw(ctlr, ctlr->status);
		if (wait_til_set ^ ((status & bitmask) == 0)) {
			if (wait_til_set) {
				ich_writew(ctlr, status & bitmask,
					   ctlr->status);
			}
			return status;
		}
		udelay(10);
	}
	printf("ICH SPI: SCIP timeout, read %x, expected %x\n",
	       status, bitmask);
	return -ETIMEDOUT;
}