/* Return: 0 if wait succeeded, -ve if error occurred  */
static int aux_wait_reply(struct udevice *dev)
/* Return: 0 if wait succeeded, -ve if error occurred  */
static int aux_wait_reply(struct udevice *dev)
{
	u32 timeout = 100;
	while (timeout > 0) {
		int status = get_reg(dev, REG_REPLY_STATUS);
		if (status & REPLY_STATUS_REPLY_ERROR_MASK)
			return -ETIMEDOUT;
		if ((status & REPLY_STATUS_REPLY_RECEIVED_MASK) &&
		    !(status &
		      REPLY_STATUS_REQUEST_IN_PROGRESS_MASK) &&
		    !(status &
		      REPLY_STATUS_REPLY_IN_PROGRESS_MASK)) {
			return 0;
		}
		timeout--;
		udelay(20);
	}
	return -ETIMEDOUT;
}