/* Polls the 'busy' register until the command is complete. NOTE: Assumes data->lock is held.  */
static void pmcmsptwi_poll_complete(struct pmcmsptwi_data *data)
/* Polls the 'busy' register until the command is complete. NOTE: Assumes data->lock is held.  */
static void pmcmsptwi_poll_complete(struct pmcmsptwi_data *data)
{
	int i;
	for (i = 0; i < MSP_MAX_POLL; i++) {
		u32 val = pmcmsptwi_readl(data->iobase +
						MSP_TWI_BUSY_REG_OFFSET);
		if (val == 0) {
			u32 reason = pmcmsptwi_readl(data->iobase +
						MSP_TWI_INT_STS_REG_OFFSET);
			pmcmsptwi_writel(reason, data->iobase +
						MSP_TWI_INT_STS_REG_OFFSET);
			data->last_result = pmcmsptwi_get_result(reason);
			return;
		}
		udelay(MSP_POLL_DELAY);
	}
	dev_dbg(&pmcmsptwi_adapter.dev, "Result: Poll timeout\n");
	data->last_result = MSP_TWI_XFER_TIMEOUT;
}