The mmc_delay() is a wrapper function for mdelay() and msleep().

    o mdelay() -- block the system when busy-waiting.
    o msleep() -- suspend the currently running task to enable CPU
                  to process other tasks, so it is non-blocking
                  regarding the whole system.

When the desired delay time is more than a period of timer interrupt,
just use msleep(). Change mdelay() to mmc_delay() to avoid chewing
CPU when busy wait.

Signed-off-by: Shengzhou Liu <b36...@freescale.com>
Signed-off-by: Chunhe Lan <chunhe....@freescale.com>
Signed-off-by: Kumar Gala <ga...@kernel.crashing.org>
Cc: Chris Ball <c...@laptop.org>
---
 drivers/mmc/host/sdhci-esdhc.h |    4 ++--
 drivers/mmc/host/sdhci.c       |   10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc.h b/drivers/mmc/host/sdhci-esdhc.h
index b97b2f5..272cea0 100644
--- a/drivers/mmc/host/sdhci-esdhc.h
+++ b/drivers/mmc/host/sdhci-esdhc.h
@@ -1,7 +1,7 @@
 /*
  * Freescale eSDHC controller driver generics for OF and pltfm.
  *
- * Copyright (c) 2007 Freescale Semiconductor, Inc.
+ * Copyright (c) 2007, 2012 Freescale Semiconductor, Inc.
  * Copyright (c) 2009 MontaVista Software, Inc.
  * Copyright (c) 2010 Pengutronix e.K.
  *   Author: Wolfram Sang <w.s...@pengutronix.de>
@@ -73,7 +73,7 @@ static inline void esdhc_set_clock(struct sdhci_host *host, 
unsigned int clock)
                | (div << ESDHC_DIVIDER_SHIFT)
                | (pre_div << ESDHC_PREDIV_SHIFT));
        sdhci_writel(host, temp, ESDHC_SYSTEM_CONTROL);
-       mdelay(1);
+       mmc_delay(1);
 out:
        host->clock = clock;
 }
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 9a11dc3..6e67bc4 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -205,7 +205,7 @@ static void sdhci_reset(struct sdhci_host *host, u8 mask)
                        return;
                }
                timeout--;
-               mdelay(1);
+               mmc_delay(1);
        }
 
        if (host->ops->platform_reset_exit)
@@ -997,7 +997,7 @@ static void sdhci_send_command(struct sdhci_host *host, 
struct mmc_command *cmd)
                        return;
                }
                timeout--;
-               mdelay(1);
+               mmc_delay(1);
        }
 
        mod_timer(&host->timer, jiffies + 10 * HZ);
@@ -1178,7 +1178,7 @@ static void sdhci_set_clock(struct sdhci_host *host, 
unsigned int clock)
                        return;
                }
                timeout--;
-               mdelay(1);
+               mmc_delay(1);
        }
 
        clk |= SDHCI_CLOCK_CARD_EN;
@@ -1243,7 +1243,7 @@ static int sdhci_set_power(struct sdhci_host *host, 
unsigned short power)
         * can apply clock after applying power
         */
        if (host->quirks & SDHCI_QUIRK_DELAY_AFTER_POWER)
-               mdelay(10);
+               mmc_delay(10);
 
        return power;
 }
@@ -1850,7 +1850,7 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 
opcode)
                ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
                tuning_loop_counter--;
                timeout--;
-               mdelay(1);
+               mmc_delay(1);
        } while (ctrl & SDHCI_CTRL_EXEC_TUNING);
 
        /*
-- 
1.7.6.5


_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to