drivers/wireless/ieee80211/mmc_sdio.c: In sdio_io_rw_extended(), the behavior of the DMA setup differs, depending on the hardware capability SDIO_CAPS_DMABEFOREWRITE. If this capability is set, then the DMA setup much be done before the transfer setup. Dave Marples modified this file for the i.MXRT USDHC which does have the SDIO_CAPS_DMABEFOREWRITE (commit 970295d0fe). Xiao Xiang reports that this change breaks the Wifi on the Photon which does not report the SDIO_CAPS_DMABEFOREWRITE and suggests reverting the change. In reality both changes are correct but must be conditioned on the DMA capability of the underlying SDIO device.

This commit is contained in:
Gregory Nutt 2019-10-29 16:02:33 -06:00
parent 894a108743
commit 2a22a64f36

View File

@ -227,11 +227,25 @@ int sdio_io_rw_extended(FAR struct sdio_dev_s *dev, bool write,
if (write) if (write)
{ {
wlinfo("prep write %d %d\n", blocklen, nblocks); wlinfo("prep write %d %d\n", blocklen, nblocks);
SDIO_DMASENDSETUP(dev, buf, blocklen * nblocks);
SDIO_SENDCMD(dev, SD_ACMD53, (uint32_t)arg.value);
wkupevent = SDIO_EVENTWAIT(dev, SDIO_CMD53_TIMEOUT_MS); /* Get the capabilities of the SDIO hardware */
ret = SDIO_RECVR5(dev, SD_ACMD53, (uint32_t *)&resp);
if ((SDIO_CAPABILITIES(dev) & SDIO_CAPS_DMABEFOREWRITE) != 0)
{
SDIO_DMASENDSETUP(dev, buf, blocklen * nblocks);
SDIO_SENDCMD(dev, SD_ACMD53, (uint32_t)arg.value);
wkupevent = SDIO_EVENTWAIT(dev, SDIO_CMD53_TIMEOUT_MS);
ret = SDIO_RECVR5(dev, SD_ACMD53, (uint32_t *)&resp);
}
else
{
sdio_sendcmdpoll(dev, SD_ACMD53, (uint32_t)arg.value);
ret = SDIO_RECVR5(dev, SD_ACMD53, (uint32_t *)&resp);
SDIO_DMASENDSETUP(dev, buf, blocklen * nblocks);
wkupevent = SDIO_EVENTWAIT(dev, SDIO_CMD53_TIMEOUT_MS);
}
} }
else else
{ {