drivers/mmcsd/mmcsd_sdio.c: enable clock before issue CMD0

In mmcsd_cardidentify(), the clock is not enabled before issuing
CMD0, and the clock has been disabled in mmcsd_removed(). It makes
no sense to enable the clock after issuing CMD0, because when CMD0
is issued, it will exit with error due to the clock is not enabled.

Signed-off-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Jacky Cao <Jacky.Cao@sony.com>
Tested-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
This commit is contained in:
Windrow14 2024-08-19 11:27:35 +08:00 committed by Xiang Xiao
parent d07e73e684
commit c96a33a12f
1 changed files with 4 additions and 4 deletions

View File

@ -3463,6 +3463,10 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
return -ENODEV; return -ENODEV;
} }
/* Set ID mode clocking (<400KHz) */
SDIO_CLOCK(priv->dev, CLOCK_IDMODE);
/* For eMMC, Send CMD0 with argument 0xf0f0f0f0 as per JEDEC v4.41 /* For eMMC, Send CMD0 with argument 0xf0f0f0f0 as per JEDEC v4.41
* for pre-idle. No effect for SD. * for pre-idle. No effect for SD.
*/ */
@ -3470,10 +3474,6 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
mmcsd_sendcmdpoll(priv, MMCSD_CMD0, 0xf0f0f0f0); mmcsd_sendcmdpoll(priv, MMCSD_CMD0, 0xf0f0f0f0);
nxsig_usleep(MMCSD_IDLE_DELAY); nxsig_usleep(MMCSD_IDLE_DELAY);
/* Set ID mode clocking (<400KHz) */
SDIO_CLOCK(priv->dev, CLOCK_IDMODE);
/* After power up at least 74 clock cycles are required prior to starting /* After power up at least 74 clock cycles are required prior to starting
* bus communication * bus communication
*/ */