diff options
| author | Meco Jianting Man <[email protected]> | 2021-04-21 05:58:37 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-04-21 05:58:37 +0800 |
| commit | 09f04bee8fef92ace93fb89e498dbf15301448ac (patch) | |
| tree | 9c0e8b8ed8fbcde5ab196f9af1c1ad690f71497b /components/drivers | |
| parent | 349a85e83f2a9db7786335674bb65d6d1d7f1dab (diff) | |
| parent | 4188301bda4f7309aa6ee5d3d35b7c65a2b59905 (diff) | |
Merge pull request #43 from RT-Thread/master
update
Diffstat (limited to 'components/drivers')
| -rw-r--r-- | components/drivers/sdio/mmc.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/components/drivers/sdio/mmc.c b/components/drivers/sdio/mmc.c index 5aba3dba7a..d8f3a9e0a5 100644 --- a/components/drivers/sdio/mmc.c +++ b/components/drivers/sdio/mmc.c @@ -300,7 +300,7 @@ static int mmc_select_bus_width(struct rt_mmcsd_card *card, rt_uint8_t *ext_csd) MMCSD_BUS_WIDTH_1 }; struct rt_mmcsd_host *host = card->host; - unsigned idx, bus_width = 0; + unsigned idx, trys, bus_width = 0; int err = 0; if (GET_BITS(card->resp_cid, 122, 4) < 4) @@ -335,10 +335,13 @@ static int mmc_select_bus_width(struct rt_mmcsd_card *card, rt_uint8_t *ext_csd) if (err) continue; - bus_width = bus_widths[idx]; - mmcsd_set_bus_width(host, bus_width); - mmcsd_delay_ms(20); //delay 10ms - err = mmc_compare_ext_csds(card, ext_csd, bus_width); + for(trys = 0; trys < 5; trys++){ + mmcsd_set_bus_width(host, bus_width); + mmcsd_delay_ms(10); + err = mmc_compare_ext_csds(card, ext_csd, bus_width); + if(!err) + break; + } if (!err) { err = bus_width; break; |
