Skip to contentSkip to conversation

mmc: do not send cmd13 if the parameter 'send_status' is 0 for __mmc_switch

PATCH New haibo.chen at nxp.com 1 participant 2 messages Sep 22, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mmc: do not send cmd13 if the parameter 'send_status' is 0 for __mmc_switch

From: Haibo Chen <[email protected]>

According to the code logic in __mmc_switch, if the parameter 'send_status' is zero, no need to send cmd13, just wait the stated timeout time, then can return directly.

---
 drivers/mmc/mmc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/mmc.c +3 -1
index d79cdef62e..6cb2af4232 100644
@@ -805,8 +805,10 @@ static int __mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value,
 	 * capable of polling by using mmc_wait_dat0, then rely on waiting the
 	 * stated timeout to be sufficient.
 	 */
-	if (ret == -ENOSYS && !send_status)
+	if (ret == -ENOSYS && !send_status) {
 		mdelay(timeout_ms);
+		return 0;
+	}
 
 	/* Finally wait until the card is ready or indicates a failure
 	 * to switch. It doesn't hurt to use CMD13 here even if send_status
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 mmc: fsl_esdhc_imx: remove the 1ms delay before sending command

From: Haibo Chen <[email protected]>

This 1ms delay before sending command already exist from the beginning of the fsl_esdhc driver added in year 2008. Now this driver has been split for two files: fsl_esdhc.c and fsl_esdhc_imx.c. fsl_esdhc_imx.c only for i.MX series. i.MX series esdhc/usdhc do not need this 1ms delay before sending any command. So remove this 1ms, this will save a lot time if handling a large mmc data.

---
 drivers/mmc/fsl_esdhc_imx.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/mmc/fsl_esdhc_imx.c +0 -7
index a0a0903ae4..ac65ed1ee1 100644
@@ -462,13 +462,6 @@ static int esdhc_send_cmd_common(struct fsl_esdhc_priv *priv, struct mmc *mmc,
 	while (esdhc_read32(&regs->prsstat) & PRSSTAT_DLA)
 		;
 
-	/* Wait at least 8 SD clock cycles before the next command */
-	/*
-	 * Note: This is way more than 8 cycles, but 1ms seems to
-	 * resolve timing issues with some cards
-	 */
-	udelay(1000);
-
 	/* Set up for a data transfer if we have one */
 	if (data) {
 		err = esdhc_setup_data(priv, mmc, data);
Signature · 1 line
2.17.1