From 62fca7c3767a74019b5cb243f2df6bdbdaf3b0a9 Mon Sep 17 00:00:00 2001 From: Dave Marples Date: Sat, 21 Sep 2019 07:26:49 -0600 Subject: [PATCH] arch/arm/src/imxrt/imxrt_usdhc.c: Move some comments. --- arch/arm/src/imxrt/imxrt_usdhc.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/arch/arm/src/imxrt/imxrt_usdhc.c b/arch/arm/src/imxrt/imxrt_usdhc.c index 687ce3c718..2a259fd708 100644 --- a/arch/arm/src/imxrt/imxrt_usdhc.c +++ b/arch/arm/src/imxrt/imxrt_usdhc.c @@ -2011,13 +2011,8 @@ static int imxrt_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd, mcinfo("cmd: %08x arg: %08x regval: %08x mcrval: %08x\n", cmd, arg, regval, mcrregval); - /* The Command Inhibit (CIHB) bit is set in the PRSSTAT bit immediately - * after the transfer type register is written. This bit is cleared - * when the command response is received. If this status bit is 0, it - * indicates that the CMD line is not in use and the USDHC can issue a - * SD/MMC Command using the CMD line. CIHB should always be clear before - * this function is called, but this check is performed here to provide - * overlap and maximum performance. + /* If there has been a response error then perform a reset and wait for it + * to complete. */ if ((getreg32(priv->addr + IMXRT_USDHC_IRQSTAT_OFFSET) & USDHC_RESPERR_INTS) != 0) @@ -2029,6 +2024,15 @@ static int imxrt_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd, } } + /* The Command Inhibit (CIHB) bit is set in the PRSSTAT bit immediately + * after the transfer type register is written. This bit is cleared + * when the command response is received. If this status bit is 0, it + * indicates that the CMD line is not in use and the USDHC can issue a + * SD/MMC Command using the CMD line. CIHB should always be clear before + * this function is called, but this check is performed here to provide + * overlap and maximum performance. + */ + timeout = USDHC_CMDTIMEOUT; start = clock_systimer(); while ((getreg32(priv->addr + IMXRT_USDHC_PRSSTAT_OFFSET) &