/* ufshcd_wait_for_register - wait for register value to change  */
static int ufshcd_wait_for_register(struct ufs_hba *hba, u32 reg, u32 mask, u32 val, unsigned long timeout_ms)
/* ufshcd_wait_for_register - wait for register value to change  */
static int ufshcd_wait_for_register(struct ufs_hba *hba, u32 reg, u32 mask, u32 val, unsigned long timeout_ms)
{
	int err = 0;
	unsigned long start = get_timer(0);
	val = val & mask;
	while ((ufshcd_readl(hba, reg) & mask) != val) {
		if (get_timer(start) > timeout_ms) {
			if ((ufshcd_readl(hba, reg) & mask) != val)
				err = -ETIMEDOUT;
			break;
		}
	}
	return err;
}