未验证 提交 1916135b 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #4608 from majianjia/master

Add more trys when switching MMC card data width
...@@ -300,7 +300,7 @@ static int mmc_select_bus_width(struct rt_mmcsd_card *card, rt_uint8_t *ext_csd) ...@@ -300,7 +300,7 @@ static int mmc_select_bus_width(struct rt_mmcsd_card *card, rt_uint8_t *ext_csd)
MMCSD_BUS_WIDTH_1 MMCSD_BUS_WIDTH_1
}; };
struct rt_mmcsd_host *host = card->host; struct rt_mmcsd_host *host = card->host;
unsigned idx, bus_width = 0; unsigned idx, trys, bus_width = 0;
int err = 0; int err = 0;
if (GET_BITS(card->resp_cid, 122, 4) < 4) 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) ...@@ -335,10 +335,13 @@ static int mmc_select_bus_width(struct rt_mmcsd_card *card, rt_uint8_t *ext_csd)
if (err) if (err)
continue; continue;
bus_width = bus_widths[idx]; for(trys = 0; trys < 5; trys++){
mmcsd_set_bus_width(host, bus_width); mmcsd_set_bus_width(host, bus_width);
mmcsd_delay_ms(20); //delay 10ms mmcsd_delay_ms(10);
err = mmc_compare_ext_csds(card, ext_csd, bus_width); err = mmc_compare_ext_csds(card, ext_csd, bus_width);
if(!err)
break;
}
if (!err) { if (!err) {
err = bus_width; err = bus_width;
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册