Skip to contentSkip to conversation

mmc: dw-mmc: check whether card is busy or not, before disabling clock

PATCH In review Jaehoon Chung 3 participants 5 messages Nov 8, 2012 – Nov 29, 2012

Subsystems (2)
lore
Share & tools
lore

Jaehoon Chung

author maintainer
#0 lore raw

PATCH v3 3/4 mmc: dw-mmc: check whether card is busy or not, before disabling clock

Before disabling clock, need to check whether card is busy on not.

---
 drivers/mmc/host/dw_mmc.c |   53 +++++++++++++++++++++++++++-----------------
 drivers/mmc/host/dw_mmc.h |    1 +
 2 files changed, 33 insertions(+), 21 deletions(-)
drivers/mmc/host/dw_mmc.c +32 -21
index 0a80b5c..9704b09 100644
@@ -228,6 +228,27 @@ static void dw_mci_set_timeout(struct dw_mci *host)
 	mci_writel(host, TMOUT, 0xffffffff);
 }
 
+static bool mci_wait_reset(struct device *dev, struct dw_mci *host)
+{
+	unsigned long timeout = jiffies + msecs_to_jiffies(500);
+	unsigned int ctrl;
+
+	mci_writel(host, CTRL, (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
+				SDMMC_CTRL_DMA_RESET));
+
+	/* wait till resets clear */
+	do {
+		ctrl = mci_readl(host, CTRL);
+		if (!(ctrl & (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
+			      SDMMC_CTRL_DMA_RESET)))
+			return true;
+	} while (time_before(jiffies, timeout));
+
+	dev_err(dev, "Timeout resetting block (ctrl %#x)\n", ctrl);
+
+	return false;
+}
+
 static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
 {
 	struct mmc_data	*data;
@@ -622,6 +643,7 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot)
 	struct dw_mci *host = slot->host;
 	u32 div;
 	u32 clk_en_a;
+	int timeout = 1000;
 
 	if (slot->clock != host->current_speed) {
 		div = host->bus_hz / slot->clock;
@@ -638,6 +660,16 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot)
 			 "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ"
 			 " div = %d)\n", slot->id, host->bus_hz, slot->clock,
 			 div ? ((host->bus_hz / div) >> 1) : host->bus_hz, div);
+		do {
+			if (!(mci_readl(host, STATUS) & SDMMC_DATA_BUSY))
+				break;
+			if (timeout-- < 0) {
+				dev_err(host->dev, "Can't disable clock"
+					"because Card is busy!!\n");
+				return;
+			}
+			mci_wait_reset(host->dev, host);
+		} while (1);
 
 		/* disable clock */
 		mci_writel(host, CLKENA, 0);
@@ -1995,27 +2027,6 @@ no_dma:
 	return;
 }
 
-static bool mci_wait_reset(struct device *dev, struct dw_mci *host)
-{
-	unsigned long timeout = jiffies + msecs_to_jiffies(500);
-	unsigned int ctrl;
-
-	mci_writel(host, CTRL, (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
-				SDMMC_CTRL_DMA_RESET));
-
-	/* wait till resets clear */
-	do {
-		ctrl = mci_readl(host, CTRL);
-		if (!(ctrl & (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
-			      SDMMC_CTRL_DMA_RESET)))
-			return true;
-	} while (time_before(jiffies, timeout));
-
-	dev_err(dev, "Timeout resetting block (ctrl %#x)\n", ctrl);
-
-	return false;
-}
-
 #ifdef CONFIG_OF
 static struct dw_mci_of_quirks {
 	char *quirk;
drivers/mmc/host/dw_mmc.h +1 -0
index 53b8fd9..4f27357 100644
@@ -127,6 +127,7 @@
 #define SDMMC_CMD_INDX(n)		((n) & 0x1F)
 /* Status register defines */
 #define SDMMC_GET_FCNT(x)		(((x)>>17) & 0x1FFF)
+#define SDMMC_DATA_BUSY			BIT(9)
 /* Internal DMAC interrupt defines */
 #define SDMMC_IDMAC_INT_AI		BIT(9)
 #define SDMMC_IDMAC_INT_NI		BIT(8)
Signature · 1 line
1.7.4.1
#1 lore raw
Quoted 51 lines · Jaehoon Chung

Before disabling clock, need to check whether card is busy on not.

---
 drivers/mmc/host/dw_mmc.c |   53 +++++++++++++++++++++++++++-----------------
 drivers/mmc/host/dw_mmc.h |    1 +
 2 files changed, 33 insertions(+), 21 deletions(-)
drivers/mmc/host/dw_mmc.c +22 -0
index 0a80b5c..9704b09 100644
@@ -228,6 +228,27 @@ static void dw_mci_set_timeout(struct dw_mci *host)
 	mci_writel(host, TMOUT, 0xffffffff);
 }
 
+static bool mci_wait_reset(struct device *dev, struct dw_mci *host)
+{
+	unsigned long timeout = jiffies + msecs_to_jiffies(500);
+	unsigned int ctrl;
+
+	mci_writel(host, CTRL, (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
+				SDMMC_CTRL_DMA_RESET));
+
+	/* wait till resets clear */
+	do {
+		ctrl = mci_readl(host, CTRL);
+		if (!(ctrl & (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
+			      SDMMC_CTRL_DMA_RESET)))
+			return true;
+	} while (time_before(jiffies, timeout));
+
+	dev_err(dev, "Timeout resetting block (ctrl %#x)\n", ctrl);
+
+	return false;
+}
+
 static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
 {
 	struct mmc_data	*data;
@@ -622,6 +643,7 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot)
 	struct dw_mci *host = slot->host;
 	u32 div;
 	u32 clk_en_a;
+	int timeout = 1000;
 
 	if (slot->clock != host->current_speed) {
 		div = host->bus_hz / slot->clock;
@@ -638,6 +660,16 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot)
 			 "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ"
 			 " div = %d)\n", slot->id, host->bus_hz, slot->clock,

drivers/mmc/host/dw_mmc.c static void dw_mci_setup_bus(struct dw_mci_slot *slot) · line 671

Quoted 10 lines
drivers/mmc/host/dw_mmc.c +9 -0
 			 div ? ((host->bus_hz / div) >> 1) : host->bus_hz, div);
+		do {
+			if (!(mci_readl(host, STATUS) & SDMMC_DATA_BUSY))
+				break;
+			if (timeout-- < 0) {
+				dev_err(host->dev, "Can't disable clock"
+					"because Card is busy!!\n");
+				return;
+			}
+			mci_wait_reset(host->dev, host);

Should 'mci_wait_reset' be called every loop?
Only if card status is still busy at the end of while, one time is enough.

drivers/mmc/host/dw_mmc.c static void dw_mci_setup_bus(struct dw_mci_slot *slot) · line 672

Quoted 1 line
drivers/mmc/host/dw_mmc.c +1 -0
+		} while (1);

How about counting jiffies for while-loop with usleep_range? do {
...

	usleep_range(10, 20)
} while (time_before())

Thanks,
Seungwon Jeon

Quoted 49 lines
drivers/mmc/host/dw_mmc.c +0 -21
 		/* disable clock */
 		mci_writel(host, CLKENA, 0);
@@ -1995,27 +2027,6 @@ no_dma:
 	return;
 }
 
-static bool mci_wait_reset(struct device *dev, struct dw_mci *host)
-{
-	unsigned long timeout = jiffies + msecs_to_jiffies(500);
-	unsigned int ctrl;
-
-	mci_writel(host, CTRL, (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
-				SDMMC_CTRL_DMA_RESET));
-
-	/* wait till resets clear */
-	do {
-		ctrl = mci_readl(host, CTRL);
-		if (!(ctrl & (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
-			      SDMMC_CTRL_DMA_RESET)))
-			return true;
-	} while (time_before(jiffies, timeout));
-
-	dev_err(dev, "Timeout resetting block (ctrl %#x)\n", ctrl);
-
-	return false;
-}
-
 #ifdef CONFIG_OF
 static struct dw_mci_of_quirks {
 	char *quirk;
drivers/mmc/host/dw_mmc.h +1 -1
index 53b8fd9..4f27357 100644
@@ -127,6 +127,7 @@
 #define SDMMC_CMD_INDX(n)		((n) & 0x1F)
 /* Status register defines */
 #define SDMMC_GET_FCNT(x)		(((x)>>17) & 0x1FFF)
+#define SDMMC_DATA_BUSY			BIT(9)
 /* Internal DMAC interrupt defines */
 #define SDMMC_IDMAC_INT_AI		BIT(9)
 #define SDMMC_IDMAC_INT_NI		BIT(8)
--

1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#2 lore raw
Quoted 65 lines · Seungwon Jeon
Quoted 51 lines · Jaehoon Chung

Before disabling clock, need to check whether card is busy on not.

---
 drivers/mmc/host/dw_mmc.c |   53 +++++++++++++++++++++++++++-----------------
 drivers/mmc/host/dw_mmc.h |    1 +
 2 files changed, 33 insertions(+), 21 deletions(-)
drivers/mmc/host/dw_mmc.c +22 -0
index 0a80b5c..9704b09 100644
@@ -228,6 +228,27 @@ static void dw_mci_set_timeout(struct dw_mci *host)
 	mci_writel(host, TMOUT, 0xffffffff);
 }
 
+static bool mci_wait_reset(struct device *dev, struct dw_mci *host)
+{
+	unsigned long timeout = jiffies + msecs_to_jiffies(500);
+	unsigned int ctrl;
+
+	mci_writel(host, CTRL, (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
+				SDMMC_CTRL_DMA_RESET));
+
+	/* wait till resets clear */
+	do {
+		ctrl = mci_readl(host, CTRL);
+		if (!(ctrl & (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
+			      SDMMC_CTRL_DMA_RESET)))
+			return true;
+	} while (time_before(jiffies, timeout));
+
+	dev_err(dev, "Timeout resetting block (ctrl %#x)\n", ctrl);
+
+	return false;
+}
+
 static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
 {
 	struct mmc_data	*data;
@@ -622,6 +643,7 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot)
 	struct dw_mci *host = slot->host;
 	u32 div;
 	u32 clk_en_a;
+	int timeout = 1000;
 
 	if (slot->clock != host->current_speed) {
 		div = host->bus_hz / slot->clock;
@@ -638,6 +660,16 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot)
 			 "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ"
 			 " div = %d)\n", slot->id, host->bus_hz, slot->clock,

drivers/mmc/host/dw_mmc.c static void dw_mci_setup_bus(struct dw_mci_slot *slot) · line 671

Quoted 10 lines
drivers/mmc/host/dw_mmc.c +9 -0
 			 div ? ((host->bus_hz / div) >> 1) : host->bus_hz, div);
+		do {
+			if (!(mci_readl(host, STATUS) & SDMMC_DATA_BUSY))
+				break;
+			if (timeout-- < 0) {
+				dev_err(host->dev, "Can't disable clock"
+					"because Card is busy!!\n");
+				return;
+			}
+			mci_wait_reset(host->dev, host);

Should 'mci_wait_reset' be called every loop?
Only if card status is still busy at the end of while, one time is enough.

Quoted 6 lines

drivers/mmc/host/dw_mmc.c static void dw_mci_setup_bus(struct dw_mci_slot *slot) · line 672

Quoted 1 line
drivers/mmc/host/dw_mmc.c +1 -0
+		} while (1);

How about counting jiffies for while-loop with usleep_range? do {
...

	usleep_range(10, 20)
} while (time_before())

Is there reason that use "usleep_range()"?

Quoted 58 lines

Thanks,
Seungwon Jeon

Quoted 44 lines
drivers/mmc/host/dw_mmc.c +0 -21
 		/* disable clock */
 		mci_writel(host, CLKENA, 0);
@@ -1995,27 +2027,6 @@ no_dma:
 	return;
 }
 
-static bool mci_wait_reset(struct device *dev, struct dw_mci *host)
-{
-	unsigned long timeout = jiffies + msecs_to_jiffies(500);
-	unsigned int ctrl;
-
-	mci_writel(host, CTRL, (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
-				SDMMC_CTRL_DMA_RESET));
-
-	/* wait till resets clear */
-	do {
-		ctrl = mci_readl(host, CTRL);
-		if (!(ctrl & (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
-			      SDMMC_CTRL_DMA_RESET)))
-			return true;
-	} while (time_before(jiffies, timeout));
-
-	dev_err(dev, "Timeout resetting block (ctrl %#x)\n", ctrl);
-
-	return false;
-}
-
 #ifdef CONFIG_OF
 static struct dw_mci_of_quirks {
 	char *quirk;
drivers/mmc/host/dw_mmc.h +1 -1
index 53b8fd9..4f27357 100644
@@ -127,6 +127,7 @@
 #define SDMMC_CMD_INDX(n)		((n) & 0x1F)
 /* Status register defines */
 #define SDMMC_GET_FCNT(x)		(((x)>>17) & 0x1FFF)
+#define SDMMC_DATA_BUSY			BIT(9)
 /* Internal DMAC interrupt defines */
 #define SDMMC_IDMAC_INT_AI		BIT(9)
 #define SDMMC_IDMAC_INT_NI		BIT(8)
--
Quoted 5 lines

1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 66 lines · Jaehoon Chung
Quoted 65 lines · Seungwon Jeon
Quoted 51 lines · Jaehoon Chung

Before disabling clock, need to check whether card is busy on not.

---
 drivers/mmc/host/dw_mmc.c |   53 +++++++++++++++++++++++++++-----------------
 drivers/mmc/host/dw_mmc.h |    1 +
 2 files changed, 33 insertions(+), 21 deletions(-)
drivers/mmc/host/dw_mmc.c +22 -0
index 0a80b5c..9704b09 100644
@@ -228,6 +228,27 @@ static void dw_mci_set_timeout(struct dw_mci *host)
 	mci_writel(host, TMOUT, 0xffffffff);
 }
 
+static bool mci_wait_reset(struct device *dev, struct dw_mci *host)
+{
+	unsigned long timeout = jiffies + msecs_to_jiffies(500);
+	unsigned int ctrl;
+
+	mci_writel(host, CTRL, (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
+				SDMMC_CTRL_DMA_RESET));
+
+	/* wait till resets clear */
+	do {
+		ctrl = mci_readl(host, CTRL);
+		if (!(ctrl & (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
+			      SDMMC_CTRL_DMA_RESET)))
+			return true;
+	} while (time_before(jiffies, timeout));
+
+	dev_err(dev, "Timeout resetting block (ctrl %#x)\n", ctrl);
+
+	return false;
+}
+
 static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
 {
 	struct mmc_data	*data;
@@ -622,6 +643,7 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot)
 	struct dw_mci *host = slot->host;
 	u32 div;
 	u32 clk_en_a;
+	int timeout = 1000;
 
 	if (slot->clock != host->current_speed) {
 		div = host->bus_hz / slot->clock;
@@ -638,6 +660,16 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot)
 			 "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ"
 			 " div = %d)\n", slot->id, host->bus_hz, slot->clock,

drivers/mmc/host/dw_mmc.c static void dw_mci_setup_bus(struct dw_mci_slot *slot) · line 671

Quoted 10 lines
drivers/mmc/host/dw_mmc.c +9 -0
 			 div ? ((host->bus_hz / div) >> 1) : host->bus_hz, div);
+		do {
+			if (!(mci_readl(host, STATUS) & SDMMC_DATA_BUSY))
+				break;
+			if (timeout-- < 0) {
+				dev_err(host->dev, "Can't disable clock"
+					"because Card is busy!!\n");
+				return;
+			}
+			mci_wait_reset(host->dev, host);

Should 'mci_wait_reset' be called every loop?
Only if card status is still busy at the end of while, one time is enough.

Quoted 7 lines
Quoted 6 lines

drivers/mmc/host/dw_mmc.c static void dw_mci_setup_bus(struct dw_mci_slot *slot) · line 672

Quoted 1 line
drivers/mmc/host/dw_mmc.c +1 -0
+		} while (1);

How about counting jiffies for while-loop with usleep_range? do {
...

	usleep_range(10, 20)
} while (time_before())

Is there reason that use "usleep_range()"?

If we should wait busy status with long time,
it would be better sleep-wait rather than just busy-wait.

Thanks,
Seungwon Jeon

Quoted 63 lines
Quoted 49 lines

Thanks,
Seungwon Jeon

Quoted 46 lines
drivers/mmc/host/dw_mmc.c +0 -21
 		/* disable clock */
 		mci_writel(host, CLKENA, 0);
@@ -1995,27 +2027,6 @@ no_dma:
 	return;
 }
 
-static bool mci_wait_reset(struct device *dev, struct dw_mci *host)
-{
-	unsigned long timeout = jiffies + msecs_to_jiffies(500);
-	unsigned int ctrl;
-
-	mci_writel(host, CTRL, (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
-				SDMMC_CTRL_DMA_RESET));
-
-	/* wait till resets clear */
-	do {
-		ctrl = mci_readl(host, CTRL);
-		if (!(ctrl & (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
-			      SDMMC_CTRL_DMA_RESET)))
-			return true;
-	} while (time_before(jiffies, timeout));
-
-	dev_err(dev, "Timeout resetting block (ctrl %#x)\n", ctrl);
-
-	return false;
-}
-
 #ifdef CONFIG_OF
 static struct dw_mci_of_quirks {
 	char *quirk;
drivers/mmc/host/dw_mmc.h +1 -1
index 53b8fd9..4f27357 100644
@@ -127,6 +127,7 @@
 #define SDMMC_CMD_INDX(n)		((n) & 0x1F)
 /* Status register defines */
 #define SDMMC_GET_FCNT(x)		(((x)>>17) & 0x1FFF)
+#define SDMMC_DATA_BUSY			BIT(9)
 /* Internal DMAC interrupt defines */
 #define SDMMC_IDMAC_INT_AI		BIT(9)
 #define SDMMC_IDMAC_INT_NI		BIT(8)
--

1.7.4.1
--

Quoted 9 lines
Quoted 3 lines

To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

2012/11/28 Seungwon Jeon <[email protected]>:

Quoted 68 lines · Jaehoon Chung
Quoted 67 lines · Seungwon Jeon
Quoted 66 lines · Jaehoon Chung
Quoted 51 lines

Before disabling clock, need to check whether card is busy on not.

---
 drivers/mmc/host/dw_mmc.c |   53 +++++++++++++++++++++++++++-----------------
 drivers/mmc/host/dw_mmc.h |    1 +
 2 files changed, 33 insertions(+), 21 deletions(-)
drivers/mmc/host/dw_mmc.c +22 -0
index 0a80b5c..9704b09 100644
@@ -228,6 +228,27 @@ static void dw_mci_set_timeout(struct dw_mci *host)
   mci_writel(host, TMOUT, 0xffffffff);
 }
 
+static bool mci_wait_reset(struct device *dev, struct dw_mci *host)
+{
+  unsigned long timeout = jiffies + msecs_to_jiffies(500);
+  unsigned int ctrl;
+
+  mci_writel(host, CTRL, (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
+                          SDMMC_CTRL_DMA_RESET));
+
+  /* wait till resets clear */
+  do {
+          ctrl = mci_readl(host, CTRL);
+          if (!(ctrl & (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
+                        SDMMC_CTRL_DMA_RESET)))
+                  return true;
+  } while (time_before(jiffies, timeout));
+
+  dev_err(dev, "Timeout resetting block (ctrl %#x)\n", ctrl);
+
+  return false;
+}
+
 static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
 {
   struct mmc_data *data;
@@ -622,6 +643,7 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot)
   struct dw_mci *host = slot->host;
   u32 div;
   u32 clk_en_a;
+  int timeout = 1000;
 
   if (slot->clock != host->current_speed) {
           div = host->bus_hz / slot->clock;
@@ -638,6 +660,16 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot)
                    "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ"
                    " div = %d)\n", slot->id, host->bus_hz, slot->clock,

drivers/mmc/host/dw_mmc.c static void dw_mci_setup_bus(struct dw_mci_slot *slot) · line 671

Quoted 10 lines
drivers/mmc/host/dw_mmc.c +9 -0
                    div ? ((host->bus_hz / div) >> 1) : host->bus_hz, div);
+          do {
+                  if (!(mci_readl(host, STATUS) & SDMMC_DATA_BUSY))
+                          break;
+                  if (timeout-- < 0) {
+                          dev_err(host->dev, "Can't disable clock"
+                                  "because Card is busy!!\n");
+                          return;
+                  }
+                  mci_wait_reset(host->dev, host);

Should 'mci_wait_reset' be called every loop?
Only if card status is still busy at the end of while, one time is enough.

Quoted 1 line
drivers/mmc/host/dw_mmc.c +1 -0
+          } while (1);
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

How about counting jiffies for while-loop with usleep_range? do {
...

    usleep_range(10, 20)
} while (time_before())

Is there reason that use "usleep_range()"?

If we should wait busy status with long time,
it would be better sleep-wait rather than just busy-wait.

Thank you for review.
well..it will use the sleep-wait. why use the 10~20? just example? Then i will check this and resend the patch.

Best Regards,
Jaehoon Chung

Quoted 71 lines

Thanks,
Seungwon Jeon

Quoted 59 lines
Quoted 49 lines

Thanks,
Seungwon Jeon

Quoted 46 lines
drivers/mmc/host/dw_mmc.c +0 -21
           /* disable clock */
           mci_writel(host, CLKENA, 0);
@@ -1995,27 +2027,6 @@ no_dma:
   return;
 }
 
-static bool mci_wait_reset(struct device *dev, struct dw_mci *host)
-{
-  unsigned long timeout = jiffies + msecs_to_jiffies(500);
-  unsigned int ctrl;
-
-  mci_writel(host, CTRL, (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
-                          SDMMC_CTRL_DMA_RESET));
-
-  /* wait till resets clear */
-  do {
-          ctrl = mci_readl(host, CTRL);
-          if (!(ctrl & (SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET |
-                        SDMMC_CTRL_DMA_RESET)))
-                  return true;
-  } while (time_before(jiffies, timeout));
-
-  dev_err(dev, "Timeout resetting block (ctrl %#x)\n", ctrl);
-
-  return false;
-}
-
 #ifdef CONFIG_OF
 static struct dw_mci_of_quirks {
   char *quirk;
drivers/mmc/host/dw_mmc.h +1 -1
index 53b8fd9..4f27357 100644
@@ -127,6 +127,7 @@
 #define SDMMC_CMD_INDX(n)         ((n) & 0x1F)
 /* Status register defines */
 #define SDMMC_GET_FCNT(x)         (((x)>>17) & 0x1FFF)
+#define SDMMC_DATA_BUSY                   BIT(9)
 /* Internal DMAC interrupt defines */
 #define SDMMC_IDMAC_INT_AI                BIT(9)
 #define SDMMC_IDMAC_INT_NI                BIT(8)
--

1.7.4.1
--

Quoted 9 lines
Quoted 3 lines

To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html