drivers/mmcsd: Change mmsd_ prefix to mmcsd_ prefix

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-09-06 00:59:29 +08:00 committed by Alan Carvalho de Assis
parent b70ae9ae82
commit 76a725cab2

View File

@ -155,9 +155,10 @@ static int mmcsd_takesem(FAR struct mmcsd_state_s *priv);
static int mmcsd_sendcmdpoll(FAR struct mmcsd_state_s *priv,
uint32_t cmd, uint32_t arg);
static int mmsd_recv_r1(FAR struct mmcsd_state_s *priv, uint32_t cmd);
static int mmsd_recv_r6(FAR struct mmcsd_state_s *priv, uint32_t cmd);
static int mmsd_get_scr(FAR struct mmcsd_state_s *priv, uint32_t scr[2]);
static int mmcsd_recv_r1(FAR struct mmcsd_state_s *priv, uint32_t cmd);
static int mmcsd_recv_r6(FAR struct mmcsd_state_s *priv, uint32_t cmd);
static int mmcsd_get_scr(FAR struct mmcsd_state_s *priv,
uint32_t scr[2]);
static void mmcsd_decode_csd(FAR struct mmcsd_state_s *priv,
uint32_t csd[4]);
@ -167,8 +168,8 @@ static void mmcsd_decode_cid(FAR struct mmcsd_state_s *priv,
#else
# define mmcsd_decode_cid(priv,cid)
#endif
static void mmsd_decode_scr(FAR struct mmcsd_state_s *priv,
uint32_t scr[2]);
static void mmcsd_decode_scr(FAR struct mmcsd_state_s *priv,
uint32_t scr[2]);
static int mmcsd_get_r1(FAR struct mmcsd_state_s *priv,
FAR uint32_t *r1);
@ -374,14 +375,14 @@ static inline int mmcsd_sendcmd4(FAR struct mmcsd_state_s *priv)
}
/****************************************************************************
* Name: mmsd_recv_r1
* Name: mmcsd_recv_r1
*
* Description:
* Receive R1 response and check for errors.
*
****************************************************************************/
static int mmsd_recv_r1(FAR struct mmcsd_state_s *priv, uint32_t cmd)
static int mmcsd_recv_r1(FAR struct mmcsd_state_s *priv, uint32_t cmd)
{
uint32_t r1;
int ret;
@ -409,7 +410,7 @@ static int mmsd_recv_r1(FAR struct mmcsd_state_s *priv, uint32_t cmd)
}
/****************************************************************************
* Name: mmsd_recv_r6
* Name: mmcsd_recv_r6
*
* Description:
* Receive R6 response and check for errors. On success, priv->rca is set
@ -417,7 +418,7 @@ static int mmsd_recv_r1(FAR struct mmcsd_state_s *priv, uint32_t cmd)
*
****************************************************************************/
static int mmsd_recv_r6(FAR struct mmcsd_state_s *priv, uint32_t cmd)
static int mmcsd_recv_r6(FAR struct mmcsd_state_s *priv, uint32_t cmd)
{
uint32_t r6 = 0;
int ret;
@ -432,7 +433,7 @@ static int mmsd_recv_r6(FAR struct mmcsd_state_s *priv, uint32_t cmd)
* 7:1 bit6 - bit0 CRC7
* 0 1 End bit
*
* Get the R1 response from the hardware
* Get the R6 response from the hardware
*/
ret = SDIO_RECVR6(priv->dev, cmd, &r6);
@ -458,7 +459,7 @@ static int mmsd_recv_r6(FAR struct mmcsd_state_s *priv, uint32_t cmd)
}
/****************************************************************************
* Name: mmsd_get_scr
* Name: mmcsd_get_scr
*
* Description:
* Obtain the SD card's Configuration Register (SCR)
@ -468,7 +469,7 @@ static int mmsd_recv_r6(FAR struct mmcsd_state_s *priv, uint32_t cmd)
*
****************************************************************************/
static int mmsd_get_scr(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
static int mmcsd_get_scr(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
{
int ret;
@ -493,7 +494,7 @@ static int mmsd_get_scr(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
/* Send CMD55 APP_CMD with argument as card's RCA */
mmcsd_sendcmdpoll(priv, SD_CMD55, (uint32_t)priv->rca << 16);
ret = mmsd_recv_r1(priv, SD_CMD55);
ret = mmcsd_recv_r1(priv, SD_CMD55);
if (ret != OK)
{
ferr("ERROR: RECVR1 for CMD55 failed: %d\n", ret);
@ -504,7 +505,7 @@ static int mmsd_get_scr(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
/* Send ACMD51 SD_APP_SEND_SCR with argument as 0 to start data receipt */
mmcsd_sendcmdpoll(priv, SD_ACMD51, 0);
ret = mmsd_recv_r1(priv, SD_ACMD51);
ret = mmcsd_recv_r1(priv, SD_ACMD51);
if (ret != OK)
{
ferr("ERROR: RECVR1 for ACMD51 failed: %d\n", ret);
@ -795,7 +796,7 @@ static void mmcsd_decode_csd(FAR struct mmcsd_state_s *priv, uint32_t csd[4])
#ifdef CONFIG_DEBUG_FS_INFO
decoded.wpgrpen = csd[3] >> 31;
decoded.mmcdfltecc = (csd[3] >> 29) & 3;
decoded.r2wfactor = (csd[3] >> 26) & 7;
decoded.r2wfactor = (csd[3] >> 26) & 7;
decoded.writebllen = (csd[3] >> 22) & 0x0f;
decoded.writeblpartial = (csd[3] >> 21) & 1;
decoded.fileformatgrp = (csd[3] >> 15) & 1;
@ -964,7 +965,7 @@ static void mmcsd_decode_cid(FAR struct mmcsd_state_s *priv, uint32_t cid[4])
#endif
/****************************************************************************
* Name: mmsd_decode_scr
* Name: mmcsd_decode_scr
*
* Description:
* Show the contents of the SD Configuration Register (SCR). The only
@ -972,7 +973,7 @@ static void mmcsd_decode_cid(FAR struct mmcsd_state_s *priv, uint32_t cid[4])
*
****************************************************************************/
static void mmsd_decode_scr(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
static void mmcsd_decode_scr(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
{
#ifdef CONFIG_DEBUG_FS_INFO
struct mmcsd_scr_s decoded;
@ -1128,8 +1129,7 @@ static int mmcsd_verifystate(FAR struct mmcsd_state_s *priv, uint32_t state)
* Name: mmcsd_wrprotected
*
* Description:
* Return true if the card is unlocked an not write protected. The
*
* Return true if the card is nlocked or write protected.
*
****************************************************************************/
@ -1270,7 +1270,7 @@ static int mmcsd_transferready(FAR struct mmcsd_state_s *priv)
/* Any other state would be an error in this context. There is
* a possibility that the card is not selected. In this case,
* it could be in STANDBY or DISCONNECTED state and the fix
* might b to send CMD7 to re-select the card. Consider this
* might be to send CMD7 to re-select the card. Consider this
* if this error occurs.
*/
@ -1310,10 +1310,10 @@ static int mmcsd_stoptransmission(FAR struct mmcsd_state_s *priv)
/* Send CMD12, STOP_TRANSMISSION, and verify good R1 return status */
mmcsd_sendcmdpoll(priv, MMCSD_CMD12, 0);
ret = mmsd_recv_r1(priv, MMCSD_CMD12);
ret = mmcsd_recv_r1(priv, MMCSD_CMD12);
if (ret != OK)
{
ferr("ERROR: mmsd_recv_r1 for CMD12 failed: %d\n", ret);
ferr("ERROR: mmcsd_recv_r1 for CMD12 failed: %d\n", ret);
}
return ret;
@ -1324,7 +1324,7 @@ static int mmcsd_stoptransmission(FAR struct mmcsd_state_s *priv)
* Name: mmcsd_setblocklen
*
* Description:
* Read a single block of data.
* Set the block length.
*
****************************************************************************/
@ -1343,14 +1343,14 @@ static int mmcsd_setblocklen(FAR struct mmcsd_state_s *priv,
*/
mmcsd_sendcmdpoll(priv, MMCSD_CMD16, blocklen);
ret = mmsd_recv_r1(priv, MMCSD_CMD16);
ret = mmcsd_recv_r1(priv, MMCSD_CMD16);
if (ret == OK)
{
priv->selblocklen = blocklen;
}
else
{
ferr("ERROR: mmsd_recv_r1 for CMD16 failed: %d\n", ret);
ferr("ERROR: mmcsd_recv_r1 for CMD16 failed: %d\n", ret);
}
}
@ -1467,10 +1467,10 @@ static ssize_t mmcsd_readsingle(FAR struct mmcsd_state_s *priv,
*/
mmcsd_sendcmdpoll(priv, MMCSD_CMD17, offset);
ret = mmsd_recv_r1(priv, MMCSD_CMD17);
ret = mmcsd_recv_r1(priv, MMCSD_CMD17);
if (ret != OK)
{
ferr("ERROR: mmsd_recv_r1 for CMD17 failed: %d\n", ret);
ferr("ERROR: mmcsd_recv_r1 for CMD17 failed: %d\n", ret);
SDIO_CANCEL(priv->dev);
return ret;
}
@ -1602,10 +1602,10 @@ static ssize_t mmcsd_readmultiple(FAR struct mmcsd_state_s *priv,
*/
mmcsd_sendcmdpoll(priv, MMCSD_CMD18, offset);
ret = mmsd_recv_r1(priv, MMCSD_CMD18);
ret = mmcsd_recv_r1(priv, MMCSD_CMD18);
if (ret != OK)
{
ferr("ERROR: mmsd_recv_r1 for CMD18 failed: %d\n", ret);
ferr("ERROR: mmcsd_recv_r1 for CMD18 failed: %d\n", ret);
SDIO_CANCEL(priv->dev);
return ret;
}
@ -1788,10 +1788,10 @@ static ssize_t mmcsd_writesingle(FAR struct mmcsd_state_s *priv,
/* Send CMD24, WRITE_BLOCK, and verify good R1 status is returned */
mmcsd_sendcmdpoll(priv, MMCSD_CMD24, offset);
ret = mmsd_recv_r1(priv, MMCSD_CMD24);
ret = mmcsd_recv_r1(priv, MMCSD_CMD24);
if (ret != OK)
{
ferr("ERROR: mmsd_recv_r1 for CMD24 failed: %d\n", ret);
ferr("ERROR: mmcsd_recv_r1 for CMD24 failed: %d\n", ret);
return ret;
}
}
@ -1827,10 +1827,10 @@ static ssize_t mmcsd_writesingle(FAR struct mmcsd_state_s *priv,
/* Send CMD24, WRITE_BLOCK, and verify good R1 status is returned */
mmcsd_sendcmdpoll(priv, MMCSD_CMD24, offset);
ret = mmsd_recv_r1(priv, MMCSD_CMD24);
ret = mmcsd_recv_r1(priv, MMCSD_CMD24);
if (ret != OK)
{
ferr("ERROR: mmsd_recv_r1 for CMD24 failed: %d\n", ret);
ferr("ERROR: mmcsd_recv_r1 for CMD24 failed: %d\n", ret);
SDIO_CANCEL(priv->dev);
return ret;
}
@ -1963,10 +1963,10 @@ static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
/* Send CMD55, APP_CMD, a verify that good R1 status is returned */
mmcsd_sendcmdpoll(priv, SD_CMD55, (uint32_t)priv->rca << 16);
ret = mmsd_recv_r1(priv, SD_CMD55);
ret = mmcsd_recv_r1(priv, SD_CMD55);
if (ret != OK)
{
ferr("ERROR: mmsd_recv_r1 for CMD55 (ACMD23) failed: %d\n", ret);
ferr("ERROR: mmcsd_recv_r1 for CMD55 (ACMD23) failed: %d\n", ret);
return ret;
}
@ -1975,10 +1975,10 @@ static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
*/
mmcsd_sendcmdpoll(priv, SD_ACMD23, nblocks);
ret = mmsd_recv_r1(priv, SD_ACMD23);
ret = mmcsd_recv_r1(priv, SD_ACMD23);
if (ret != OK)
{
ferr("ERROR: mmsd_recv_r1 for ACMD23 failed: %d\n", ret);
ferr("ERROR: mmcsd_recv_r1 for ACMD23 failed: %d\n", ret);
return ret;
}
}
@ -1994,10 +1994,10 @@ static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
*/
mmcsd_sendcmdpoll(priv, MMCSD_CMD25, offset);
ret = mmsd_recv_r1(priv, MMCSD_CMD25);
ret = mmcsd_recv_r1(priv, MMCSD_CMD25);
if (ret != OK)
{
ferr("ERROR: mmsd_recv_r1 for CMD25 failed: %d\n", ret);
ferr("ERROR: mmcsd_recv_r1 for CMD25 failed: %d\n", ret);
return ret;
}
}
@ -2035,10 +2035,10 @@ static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
*/
mmcsd_sendcmdpoll(priv, MMCSD_CMD25, offset);
ret = mmsd_recv_r1(priv, MMCSD_CMD25);
ret = mmcsd_recv_r1(priv, MMCSD_CMD25);
if (ret != OK)
{
ferr("ERROR: mmsd_recv_r1 for CMD25 failed: %d\n", ret);
ferr("ERROR: mmcsd_recv_r1 for CMD25 failed: %d\n", ret);
SDIO_CANCEL(priv->dev);
return ret;
}
@ -2536,7 +2536,7 @@ static void mmcsd_mediachange(FAR void *arg)
if (SDIO_PRESENT(priv->dev))
{
/* No... process the card insertion. This could cause chaos if we
/* Yes... process the card insertion. This could cause chaos if we
* think that a card is already present and there are mounted file
* systems! NOTE that mmcsd_probe() will always re-enable callbacks
* appropriately.
@ -2595,7 +2595,7 @@ static int mmcsd_widebus(FAR struct mmcsd_state_s *priv)
*/
mmcsd_sendcmdpoll(priv, SD_CMD55, (uint32_t)priv->rca << 16);
ret = mmsd_recv_r1(priv, SD_CMD55);
ret = mmcsd_recv_r1(priv, SD_CMD55);
if (ret != OK)
{
ferr("ERROR: RECVR1 for CMD55 of ACMD42: %d\n", ret);
@ -2610,7 +2610,7 @@ static int mmcsd_widebus(FAR struct mmcsd_state_s *priv)
*/
mmcsd_sendcmdpoll(priv, SD_ACMD42, MMCSD_ACMD42_CD_DISCONNECT);
ret = mmsd_recv_r1(priv, SD_ACMD42);
ret = mmcsd_recv_r1(priv, SD_ACMD42);
if (ret != OK)
{
fwarn("WARNING: SD card does not support ACMD42: %d\n", ret);
@ -2622,7 +2622,7 @@ static int mmcsd_widebus(FAR struct mmcsd_state_s *priv)
*/
mmcsd_sendcmdpoll(priv, SD_CMD55, (uint32_t)priv->rca << 16);
ret = mmsd_recv_r1(priv, SD_CMD55);
ret = mmcsd_recv_r1(priv, SD_CMD55);
if (ret != OK)
{
ferr("ERROR: RECVR1 for CMD55 of ACMD6: %d\n", ret);
@ -2632,7 +2632,7 @@ static int mmcsd_widebus(FAR struct mmcsd_state_s *priv)
/* Then send ACMD6 */
mmcsd_sendcmdpoll(priv, SD_ACMD6, MMCSD_ACMD6_BUSWIDTH_4);
ret = mmsd_recv_r1(priv, SD_ACMD6);
ret = mmcsd_recv_r1(priv, SD_ACMD6);
if (ret != OK)
{
return ret;
@ -2701,15 +2701,15 @@ static int mmcsd_mmcinitialize(FAR struct mmcsd_state_s *priv)
priv->rca = 1; /* There is only one card */
mmcsd_sendcmdpoll(priv, MMC_CMD3, priv->rca << 16);
ret = mmsd_recv_r1(priv, MMC_CMD3);
ret = mmcsd_recv_r1(priv, MMC_CMD3);
if (ret != OK)
{
ferr("ERROR: mmsd_recv_r1(CMD3) failed: %d\n", ret);
ferr("ERROR: mmcsd_recv_r1(CMD3) failed: %d\n", ret);
return ret;
}
/* This should have caused a transition to standby state. However, this
* will not be reflected in the present R1 status. R1/6 contains the
* will not be reflected in the present R1/6 status. R1/6 contains the
* state of the card when the command was received, not when it completed
* execution.
*
@ -2749,10 +2749,10 @@ static int mmcsd_mmcinitialize(FAR struct mmcsd_state_s *priv)
*/
mmcsd_sendcmdpoll(priv, MMCSD_CMD7S, (uint32_t)priv->rca << 16);
ret = mmsd_recv_r1(priv, MMCSD_CMD7S);
ret = mmcsd_recv_r1(priv, MMCSD_CMD7S);
if (ret != OK)
{
ferr("ERROR: mmsd_recv_r1 for CMD7 failed: %d\n", ret);
ferr("ERROR: mmcsd_recv_r1 for CMD7 failed: %d\n", ret);
return ret;
}
@ -2876,7 +2876,7 @@ static int mmcsd_read_csd(FAR struct mmcsd_state_s *priv)
*/
mmcsd_sendcmdpoll(priv, MMC_CMD8, 0);
ret = mmsd_recv_r1(priv, MMC_CMD8);
ret = mmcsd_recv_r1(priv, MMC_CMD8);
if (ret != OK)
{
ferr("ERROR: Could not get MMC extended CSD register: %d\n", ret);
@ -2948,7 +2948,7 @@ static int mmcsd_sdinitialize(FAR struct mmcsd_state_s *priv)
mmcsd_decode_cid(priv, cid);
/* Send CMD3, SET_RELATIVE_ADDR. In both protocols, this command is used
/* Send CMD3, SEND_RELATIVE_ADDR. In both protocols, this command is used
* to assign a logical address to the card. For MMC, the host assigns the
* address; for SD, the memory card has this responsibility. CMD3 causes
* transition to standby state/data-transfer mode
@ -2957,17 +2957,17 @@ static int mmcsd_sdinitialize(FAR struct mmcsd_state_s *priv)
*/
mmcsd_sendcmdpoll(priv, SD_CMD3, 0);
ret = mmsd_recv_r6(priv, SD_CMD3);
ret = mmcsd_recv_r6(priv, SD_CMD3);
if (ret != OK)
{
ferr("ERROR: mmsd_recv_r6 for SD RCA failed: %d\n", ret);
ferr("ERROR: mmcsd_recv_r6 for SD RCA failed: %d\n", ret);
return ret;
}
finfo("RCA: %04x\n", priv->rca);
/* This should have caused a transition to standby state. However, this
* will not be reflected in the present R1 status. R1/6 contains the
* will not be reflected in the present R1/6 status. R1/6 contains the
* state of the card when the command was received, not when it
* completed execution.
*
@ -3003,10 +3003,10 @@ static int mmcsd_sdinitialize(FAR struct mmcsd_state_s *priv)
*/
mmcsd_sendcmdpoll(priv, MMCSD_CMD7S, (uint32_t)priv->rca << 16);
ret = mmsd_recv_r1(priv, MMCSD_CMD7S);
ret = mmcsd_recv_r1(priv, MMCSD_CMD7S);
if (ret != OK)
{
ferr("ERROR: mmsd_recv_r1 for CMD7 failed: %d\n", ret);
ferr("ERROR: mmcsd_recv_r1 for CMD7 failed: %d\n", ret);
return ret;
}
@ -3027,14 +3027,14 @@ static int mmcsd_sdinitialize(FAR struct mmcsd_state_s *priv)
* this card supports wide bus operation.
*/
ret = mmsd_get_scr(priv, scr);
ret = mmcsd_get_scr(priv, scr);
if (ret != OK)
{
ferr("ERROR: Could not get SD SCR register(%d)\n", ret);
return ret;
}
mmsd_decode_scr(priv, scr);
mmcsd_decode_scr(priv, scr);
/* Select width (4-bit) bus operation (if the card supports it) */
@ -3213,7 +3213,7 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
do
{
/* We may have already determined that his card is an MMC card from
* an earlier pass through through this loop. In that case, we should
* an earlier pass through this loop. In that case, we should
* skip the SD-specific commands.
*/
#ifdef CONFIG_MMCSD_MMCSUPPORT
@ -3223,7 +3223,7 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
/* Send CMD55 with argument = 0 */
mmcsd_sendcmdpoll(priv, SD_CMD55, 0);
ret = mmsd_recv_r1(priv, SD_CMD55);
ret = mmcsd_recv_r1(priv, SD_CMD55);
if (ret != OK)
{
/* I am a little confused.. I think both SD and MMC cards
@ -3232,7 +3232,7 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
* ACMD41.
*/
ferr("ERROR: mmsd_recv_r1(CMD55) failed: %d\n", ret);
ferr("ERROR: mmcsd_recv_r1(CMD55) failed: %d\n", ret);
}
else
{
@ -3379,7 +3379,7 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
/* 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
* out), or (3) it is an MMC or SD card that has successfully transitioned
* out), or (2) it is an MMC or SD card that has successfully transitioned
* to the IDLE state (well, at least, it provided its OCR saying that it
* it is no longer busy).
*/