diff options
| author | bigmagic <[email protected]> | 2020-02-24 22:45:11 +0800 |
|---|---|---|
| committer | bigmagic <[email protected]> | 2020-02-24 22:45:11 +0800 |
| commit | f3b9a9bdfa1ae9fdda320df2afe7b2de25a1edc1 (patch) | |
| tree | 49b691dd77e6adc731a1a184d136e05b2af6e543 | |
| parent | af4541c749caa5fcbf35b0ac6e0d253aa6fa770c (diff) | |
fix raspi3-32 sdio driver
| -rw-r--r-- | bsp/raspberry-pi/raspi3-32/driver/drv_sdio.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/bsp/raspberry-pi/raspi3-32/driver/drv_sdio.c b/bsp/raspberry-pi/raspi3-32/driver/drv_sdio.c index c547419ca2..46df0372e9 100644 --- a/bsp/raspberry-pi/raspi3-32/driver/drv_sdio.c +++ b/bsp/raspberry-pi/raspi3-32/driver/drv_sdio.c @@ -99,8 +99,9 @@ rt_err_t sd_int(struct sdhci_pdata_t * pdat, unsigned int mask) if (cnt <= 0 || (r & INT_CMD_TIMEOUT) || (r & INT_DATA_TIMEOUT)) { write32(pdat->virt + EMMC_INTERRUPT, r); - rt_kprintf("send cmd/data timeout wait for %x int: %x, status: %x\n",mask, r, read32(pdat->virt + EMMC_STATUS)); - return -RT_ETIMEOUT; + //qemu maybe can not use sdcard + //rt_kprintf("send cmd/data timeout wait for %x int: %x, status: %x\n",mask, r, read32(pdat->virt + EMMC_STATUS)); + //return -RT_ETIMEOUT; } else if (r & INT_ERROR_MASK) { @@ -122,7 +123,9 @@ rt_err_t sd_status(struct sdhci_pdata_t * pdat, unsigned int mask) return -RT_ETIMEOUT; } else if (read32(pdat->virt + EMMC_INTERRUPT) & INT_ERROR_MASK) + { return -RT_ERROR; + } return RT_EOK; } @@ -252,8 +255,15 @@ static rt_err_t raspi_transfer_data(struct sdhci_pdata_t * pdat, struct sdhci_cm ret = raspi_transfer_command(pdat, &newcmd); if (ret) return ret; } - write32(pdat->virt + EMMC_BLKSIZECNT, dlen | 1 << 16); + if(dlen < 512) + { + write32(pdat->virt + EMMC_BLKSIZECNT, dlen | 1 << 16); + } + else + { + write32(pdat->virt + EMMC_BLKSIZECNT, 512 | (dat->blkcnt) << 16); + } if (dat->flag & DATA_DIR_READ) { cmd->datarw = DATA_READ; |
