/* Waits for as per specified amount of time for the "result" to match with "done" */
static int handshake(uint32_t volatile *ptr, uint32_t mask, uint32_t done, int usec)
/* Waits for as per specified amount of time for the "result" to match with "done" */
static int handshake(uint32_t volatile *ptr, uint32_t mask, uint32_t done, int usec)
{
	uint32_t result;
	do {
		result = xhci_readl(ptr);
		if (result == ~(uint32_t)0)
			return -ENODEV;
		result &= mask;
		if (result == done)
			return 0;
		usec--;
		udelay(1);
	} while (usec > 0);
	return -ETIMEDOUT;
}