From e9821fb49add1256ab6ae354ecf94c9604bc03ba Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lothar=20Wa=C3=9Fmann?= Date: Wed, 1 Aug 2012 13:06:04 +0200 Subject: [PATCH] Fix bogus handling of get_timer() --- drivers/mmc/omap_hsmmc.c | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c index e3670d4ad4..14e6a18ba1 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -145,8 +145,8 @@ void mmc_init_stream(struct hsmmc *mmc_base) writel(MMC_CMD0, &mmc_base->cmd); start = get_timer(0); while (!(readl(&mmc_base->stat) & CC_MASK)) { - if (get_timer(0) - start > MAX_RETRY_MS) { - printf("%s: timedout waiting for cc!\n", __func__); + if (get_timer(start) > MAX_RETRY_MS) { + printf("%s: timeout waiting for cc!\n", __func__); return; } } @@ -156,8 +156,8 @@ void mmc_init_stream(struct hsmmc *mmc_base) ; start = get_timer(0); while (!(readl(&mmc_base->stat) & CC_MASK)) { - if (get_timer(0) - start > MAX_RETRY_MS) { - printf("%s: timedout waiting for cc2!\n", __func__); + if (get_timer(start) > MAX_RETRY_MS) { + printf("%s: timeout waiting for cc2!\n", __func__); return; } } @@ -178,16 +178,16 @@ static int mmc_init_setup(struct mmc *mmc) &mmc_base->sysconfig); start = get_timer(0); while ((readl(&mmc_base->sysstatus) & RESETDONE) == 0) { - if (get_timer(0) - start > MAX_RETRY_MS) { - printf("%s: timedout waiting for cc2!\n", __func__); + if (get_timer(start) > MAX_RETRY_MS) { + printf("%s: timeout waiting for cc2!\n", __func__); return TIMEOUT; } } writel(readl(&mmc_base->sysctl) | SOFTRESETALL, &mmc_base->sysctl); start = get_timer(0); while ((readl(&mmc_base->sysctl) & SOFTRESETALL) != 0x0) { - if (get_timer(0) - start > MAX_RETRY_MS) { - printf("%s: timedout waiting for softresetall!\n", + if (get_timer(start) > MAX_RETRY_MS) { + printf("%s: timeout waiting for softresetall!\n", __func__); return TIMEOUT; } @@ -209,8 +209,8 @@ static int mmc_init_setup(struct mmc *mmc) (dsor << CLKD_OFFSET) | ICE_OSCILLATE); start = get_timer(0); while ((readl(&mmc_base->sysctl) & ICS_MASK) == ICS_NOTREADY) { - if (get_timer(0) - start > MAX_RETRY_MS) { - printf("%s: timedout waiting for ics!\n", __func__); + if (get_timer(start) > MAX_RETRY_MS) { + printf("%s: timeout waiting for ics!\n", __func__); return TIMEOUT; } } @@ -231,14 +231,14 @@ static int mmc_init_setup(struct mmc *mmc) static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) { - struct hsmmc *mmc_base = (struct hsmmc *)mmc->priv; + struct hsmmc *mmc_base = mmc->priv; unsigned int flags, mmc_stat; ulong start; start = get_timer(0); while ((readl(&mmc_base->pstate) & (DATI_MASK | CMDI_MASK)) != 0) { - if (get_timer(0) - start > MAX_RETRY_MS) { - printf("%s: timedout waiting on cmd inhibit to clear\n", + if (get_timer(start) > MAX_RETRY_MS) { + printf("%s: timeout waiting on cmd inhibit to clear\n", __func__); return TIMEOUT; } @@ -246,8 +246,8 @@ static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, writel(0xFFFFFFFF, &mmc_base->stat); start = get_timer(0); while (readl(&mmc_base->stat)) { - if (get_timer(0) - start > MAX_RETRY_MS) { - printf("%s: timedout waiting for stat!\n", __func__); + if (get_timer(start) > MAX_RETRY_MS) { + printf("%s: timeout waiting for stat!\n", __func__); return TIMEOUT; } } @@ -309,7 +309,7 @@ static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, start = get_timer(0); do { mmc_stat = readl(&mmc_base->stat); - if (get_timer(0) - start > MAX_RETRY_MS) { + if (get_timer(start) > MAX_RETRY_MS) { printf("%s : timeout: No status update\n", __func__); return TIMEOUT; } @@ -361,8 +361,8 @@ static int mmc_read_data(struct hsmmc *mmc_base, char *buf, unsigned int size) ulong start = get_timer(0); do { mmc_stat = readl(&mmc_base->stat); - if (get_timer(0) - start > MAX_RETRY_MS) { - printf("%s: timedout waiting for status!\n", + if (get_timer(start) > MAX_RETRY_MS) { + printf("%s: timeout waiting for status!\n", __func__); return TIMEOUT; } @@ -413,8 +413,8 @@ static int mmc_write_data(struct hsmmc *mmc_base, const char *buf, ulong start = get_timer(0); do { mmc_stat = readl(&mmc_base->stat); - if (get_timer(0) - start > MAX_RETRY_MS) { - printf("%s: timedout waiting for status!\n", + if (get_timer(start) > MAX_RETRY_MS) { + printf("%s: timeout waiting for status!\n", __func__); return TIMEOUT; } @@ -493,8 +493,8 @@ static void mmc_set_ios(struct mmc *mmc) start = get_timer(0); while ((readl(&mmc_base->sysctl) & ICS_MASK) == ICS_NOTREADY) { - if (get_timer(0) - start > MAX_RETRY_MS) { - printf("%s: timedout waiting for ics!\n", __func__); + if (get_timer(start) > MAX_RETRY_MS) { + printf("%s: timeout waiting for ics!\n", __func__); return; } } -- 2.39.2