driver/mmcsd: add option to support SD/MMC PHYs that only run in 4-bit mode
This commit is contained in:
parent
d557b87b25
commit
163e3fd93c
2 changed files with 25 additions and 5 deletions
|
|
@ -2881,6 +2881,22 @@ static int mmcsd_sdinitialize(FAR struct mmcsd_state_s *priv)
|
|||
SDIO_CLOCK(priv->dev, CLOCK_SD_TRANSFER_1BIT);
|
||||
nxsig_usleep(MMCSD_CLK_DELAY);
|
||||
|
||||
/* If the hardware only supports 4-bit transfer mode then we forced to
|
||||
* attempt to setup the card in this mode before checking the SCR register.
|
||||
*/
|
||||
|
||||
if ((priv->caps & SDIO_CAPS_4BIT_ONLY) != 0)
|
||||
{
|
||||
/* Select width (4-bit) bus operation */
|
||||
|
||||
priv->buswidth = 4;
|
||||
ret = mmcsd_widebus(priv);
|
||||
if (ret != OK)
|
||||
{
|
||||
ferr("ERROR: Failed to set wide bus operation: %d\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
/* 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.
|
||||
|
|
@ -2895,12 +2911,15 @@ static int mmcsd_sdinitialize(FAR struct mmcsd_state_s *priv)
|
|||
|
||||
mmcsd_decode_scr(priv, scr);
|
||||
|
||||
/* Select width (4-bit) bus operation (if the card supports it) */
|
||||
|
||||
ret = mmcsd_widebus(priv);
|
||||
if (ret != OK)
|
||||
if ((priv->caps & SDIO_CAPS_4BIT_ONLY) == 0)
|
||||
{
|
||||
ferr("ERROR: Failed to set wide bus operation: %d\n", ret);
|
||||
/* Select width (4-bit) bus operation (if the card supports it) */
|
||||
|
||||
ret = mmcsd_widebus(priv);
|
||||
if (ret != OK)
|
||||
{
|
||||
ferr("ERROR: Failed to set wide bus operation: %d\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: If wide-bus selected, then send CMD6 to see if the card supports
|
||||
|
|
|
|||
|
|
@ -477,6 +477,7 @@
|
|||
#define SDIO_CAPS_DMABEFOREWRITE 0x04 /* Bit 2=1: Executes DMA before write command */
|
||||
#define SDIO_CAPS_4BIT 0x08 /* Bit 3=1: Supports 4 bit operation */
|
||||
#define SDIO_CAPS_8BIT 0x10 /* Bit 4=1: Supports 8 bit operation */
|
||||
#define SDIO_CAPS_4BIT_ONLY 0x20 /* Bit 5=1: Supports 4-bit only operation */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: SDIO_STATUS
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue