sd: utilize sdmmc_wait_ready with SPI mode.
Update sdmmc framework to use sdmmc_wait_ready when accessing card in SPI mode. this will allow cards that do not return to ready to be polled for busy status until the SD data timeout expires Fixes #52931 Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
parent
b59c89123c
commit
9a63abc5c6
1 changed files with 7 additions and 21 deletions
|
@ -1248,13 +1248,11 @@ static int sdmmc_read(struct sd_card *card, uint8_t *rbuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Verify card is back in transfer state after read */
|
/* Verify card is back in transfer state after read */
|
||||||
if (!card->host_props.is_spi) {
|
ret = sdmmc_wait_ready(card);
|
||||||
ret = sdmmc_wait_ready(card);
|
if (ret) {
|
||||||
if (ret) {
|
LOG_ERR("Card did not return to ready state");
|
||||||
LOG_ERR("Card did not return to ready state");
|
k_mutex_unlock(&card->lock);
|
||||||
k_mutex_unlock(&card->lock);
|
return -ETIMEDOUT;
|
||||||
return -ETIMEDOUT;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1403,13 +1401,7 @@ static int sdmmc_write(struct sd_card *card, const uint8_t *wbuf,
|
||||||
ret = sdhc_request(card->sdhc, &cmd, &data);
|
ret = sdhc_request(card->sdhc, &cmd, &data);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
LOG_DBG("Write failed: %d", ret);
|
LOG_DBG("Write failed: %d", ret);
|
||||||
if (card->host_props.is_spi) {
|
ret = sdmmc_wait_ready(card);
|
||||||
/* Just check card status */
|
|
||||||
ret = sdmmc_read_status(card);
|
|
||||||
} else {
|
|
||||||
/* Wait for card to be idle */
|
|
||||||
ret = sdmmc_wait_ready(card);
|
|
||||||
}
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1422,13 +1414,7 @@ static int sdmmc_write(struct sd_card *card, const uint8_t *wbuf,
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
/* Verify card is back in transfer state after write */
|
/* Verify card is back in transfer state after write */
|
||||||
if (card->host_props.is_spi) {
|
ret = sdmmc_wait_ready(card);
|
||||||
/* Just check card status */
|
|
||||||
ret = sdmmc_read_status(card);
|
|
||||||
} else {
|
|
||||||
/* Wait for card to be idle */
|
|
||||||
ret = sdmmc_wait_ready(card);
|
|
||||||
}
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
LOG_ERR("Card did not return to ready state");
|
LOG_ERR("Card did not return to ready state");
|
||||||
return -ETIMEDOUT;
|
return -ETIMEDOUT;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue