mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
drivers/mmcsd/mmcsd_sdio.c: Enter a removed card state On a failure. If we fail to read cardstatus in mmcsd_transferready consider this a hard error and set the card to removed.
This commit is contained in:
committed by
Gregory Nutt
parent
b7073a366b
commit
5f65012449
@@ -1252,7 +1252,7 @@ static int mmcsd_transferready(FAR struct mmcsd_state_s *priv)
|
|||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
ferr("ERROR: mmcsd_getR1 failed: %d\n", ret);
|
ferr("ERROR: mmcsd_getR1 failed: %d\n", ret);
|
||||||
return ret;
|
goto errorout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now check if the card is in the expected transfer state. */
|
/* Now check if the card is in the expected transfer state. */
|
||||||
@@ -1282,7 +1282,8 @@ static int mmcsd_transferready(FAR struct mmcsd_state_s *priv)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ferr("ERROR: Unexpected R1 state: %08x\n", r1);
|
ferr("ERROR: Unexpected R1 state: %08x\n", r1);
|
||||||
return -EINVAL;
|
ret = -EINVAL;
|
||||||
|
goto errorout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We are still in the programming state. Calculate the elapsed
|
/* We are still in the programming state. Calculate the elapsed
|
||||||
@@ -1294,6 +1295,10 @@ static int mmcsd_transferready(FAR struct mmcsd_state_s *priv)
|
|||||||
while (elapsed < TICK_PER_SEC);
|
while (elapsed < TICK_PER_SEC);
|
||||||
|
|
||||||
return -ETIMEDOUT;
|
return -ETIMEDOUT;
|
||||||
|
|
||||||
|
errorout:
|
||||||
|
mmcsd_removed(priv);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user