/* Used to reset command or data internal state machines, using respectively SRC or SRD bit of SYSCTL register Can be called from interrupt context  */
static void omap_hsmmc_reset_controller_fsm(struct omap_hsmmc_host *host, unsigned long bit)
/* Used to reset command or data internal state machines, using respectively SRC or SRD bit of SYSCTL register Can be called from interrupt context  */
static void omap_hsmmc_reset_controller_fsm(struct omap_hsmmc_host *host, unsigned long bit)
{
	unsigned long i = 0;
	unsigned long limit = (loops_per_jiffy *
				msecs_to_jiffies(MMC_TIMEOUT_MS));
	OMAP_HSMMC_WRITE(host->base, SYSCTL,
			 OMAP_HSMMC_READ(host->base, SYSCTL) | bit);
	while ((OMAP_HSMMC_READ(host->base, SYSCTL) & bit) &&
		(i++ < limit))
		cpu_relax();
	if (OMAP_HSMMC_READ(host->base, SYSCTL) & bit)
		dev_err(mmc_dev(host->mmc),
			"Timeout waiting on controller reset in %s\n",
			__func__);
}