diff options
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/arch/arm/src/stm32/stm32_sdio.c | 2 | ||||
-rw-r--r-- | nuttx/drivers/mmcsd/mmcsd_sdio.c | 28 |
2 files changed, 14 insertions, 16 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_sdio.c b/nuttx/arch/arm/src/stm32/stm32_sdio.c index f5e9e2ac8..58a028fe5 100644 --- a/nuttx/arch/arm/src/stm32/stm32_sdio.c +++ b/nuttx/arch/arm/src/stm32/stm32_sdio.c @@ -98,7 +98,7 @@ /* HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(2+2)=18 MHz */
#define SDIO_MMCXFR_CLKDIV (2 << SDIO_CLKCR_CLKDIV_SHIFT)
-#define SDIO_CLKCR_MMCXFR (SDIO_SDXFR_CLKDIV|SDIO_CLKCR_RISINGEDGE|\
+#define SDIO_CLKCR_MMCXFR (SDIO_MMCXFR_CLKDIV|SDIO_CLKCR_RISINGEDGE|\
SDIO_CLKCR_WIDBUS_D1)
/* HCLK=72 MHz, SDIOCLK=72MHz, SDIO_CK=HCLK/(1+2)=24 MHz */
diff --git a/nuttx/drivers/mmcsd/mmcsd_sdio.c b/nuttx/drivers/mmcsd/mmcsd_sdio.c index 3e8d4262b..69a924966 100644 --- a/nuttx/drivers/mmcsd/mmcsd_sdio.c +++ b/nuttx/drivers/mmcsd/mmcsd_sdio.c @@ -2252,7 +2252,7 @@ static int mmcsd_sdinitialize(FAR struct mmcsd_state_s *priv) /* Get the SD card Configuration Register (SCR). We need this now because * that configuration register contains the indication whether or not - * this card supports wide bus operation.\ + * this card supports wide bus operation. */ ret = mmcsd_getSCR(priv, scr); @@ -2404,15 +2404,19 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv) * an SD V2.x (via CMD8), then this must be SD V1.x */ + fvdbg("R3: %08x\n", response); if (priv->type == MMCSD_CARDTYPE_UNKNOWN) { fvdbg("SD V1.x card\n"); priv->type = MMCSD_CARDTYPE_SDV1; } - /* Check if the card is busy */ + /* Check if the card is busy. Very confusing, BUSY is set LOW + * if the card has not finished its initialization, so it really + * means NOT busy. + */ - if ((response & MMCSD_CARD_BUSY) == 0) + if ((response & MMCSD_CARD_BUSY) != 0) { /* No.. We really should check the current state to see if * the SD card successfully made it to the IDLE state, but @@ -2476,9 +2480,12 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv) fdbg("CMD1 succeeded, assuming MMC card\n"); priv->type = MMCSD_CARDTYPE_MMC; - /* Check if the card is busy */ + /* Check if the card is busy. Very confusing, BUSY is set LOW + * if the card has not finished its initialization, so it really + * means NOT busy. + */ - if ((response & MMCSD_CARD_BUSY) == 0) + if ((response & MMCSD_CARD_BUSY) != 0) { /* NO.. We really should check the current state to see if the * MMC successfully made it to the IDLE state, but at least for now, @@ -2496,7 +2503,7 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv) elapsed = g_system_timer - start; } - while (elapsed < TICK_PER_SEC && ret != OK); + while (elapsed < TICK_PER_SEC || ret != OK); /* We get here when the above loop completes, either (1) we could not * communicate properly with the card due to errors (and the loop times @@ -2511,15 +2518,6 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv) return -EIO; } - /* Verify that we are in IDLE state */ - - ret = mmcsd_verifystate(priv, MMCSD_R1_STATE_IDLE); - if (ret != OK) - { - fdbg("ERROR: Failed to enter IDLE state\n"); - return ret; - } - return OK; } |