drivers/mmcsd/mmcsd_sdio.c: use dma to receive setup if dma is enabled

Call SDIO_DMARECVSETUP instead of SDIO_RECVSETUP if CONFIG_SDIO_DMA
is defined, aligning with other callings of in mmcsd_sdio.c.

Signed-off-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Jacky Cao <Jacky.Cao@sony.com>
Tested-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
This commit is contained in:
Windrow14 2025-05-07 16:04:41 +08:00 committed by Xiang Xiao
parent 5fc950e608
commit b05ec7729d

View file

@ -493,6 +493,25 @@ 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])
{
int ret;
#ifdef CONFIG_SDIO_DMA
bool drop = false;
#endif
#if defined(CONFIG_SDIO_DMA) && defined(CONFIG_ARCH_HAVE_SDIO_PREFLIGHT)
/* If we think we are going to perform a DMA transfer, make sure that we
* will be able to before we commit the card to the operation.
*/
if ((priv->caps & SDIO_CAPS_DMASUPPORTED) != 0)
{
ret = SDIO_DMAPREFLIGHT(priv->dev, (FAR uint8_t *)scr, 8);
if (ret != OK)
{
finfo("SDIO_DMAPREFLIGHT: error %d, drop to RECVSETUP\n", ret);
drop = true;
}
}
#endif
/* Set Block Size To 8 Bytes */
@ -506,7 +525,22 @@ static int mmcsd_get_scr(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
/* Setup up to receive data with interrupt mode */
SDIO_BLOCKSETUP(priv->dev, 8, 1);
SDIO_RECVSETUP(priv->dev, (FAR uint8_t *)scr, 8);
#ifdef CONFIG_SDIO_DMA
if (!drop && (priv->caps & SDIO_CAPS_DMASUPPORTED) != 0)
{
ret = SDIO_DMARECVSETUP(priv->dev, (FAR uint8_t *)scr, 8);
if (ret != OK)
{
finfo("SDIO_DMARECVSETUP: error %d, drop to RECVSETUP\n", ret);
drop = true;
}
}
if (drop)
#endif
{
SDIO_RECVSETUP(priv->dev, (FAR uint8_t *)scr, 8);
}
SDIO_WAITENABLE(priv->dev,
SDIOWAIT_TRANSFERDONE | SDIOWAIT_TIMEOUT | SDIOWAIT_ERROR,
@ -2621,7 +2655,7 @@ static int mmcsd_ioctl(FAR struct inode *inode, int cmd, unsigned long arg)
}
break;
case MMC_IOC_MULTI_CMD: /* MMCSD device ioctl muti commands */
case MMC_IOC_MULTI_CMD: /* MMCSD device ioctl multi commands */
{
finfo("MMC_IOC_MULTI_CMD\n");
ret = mmcsd_multi_iocmd(part, (FAR struct mmc_ioc_multi_cmd *)arg);