diff options
| author | zhuzhuzhu <[email protected]> | 2024-06-12 18:14:48 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-06-12 18:14:48 +0800 |
| commit | 1b4b338ed1b2beb1d8ee8614df42abfa6646d90c (patch) | |
| tree | 0559247d4ef56a2101b08041b65597f28af55f24 /components | |
| parent | a12736e4c8e81178ac0cb8639f820028b0d23230 (diff) | |
【修复】修复ART-PI samrt上读取不到emmc/sd分区问题 (#9051)
Update sd.c
Diffstat (limited to 'components')
| -rw-r--r-- | components/drivers/sdio/sd.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/components/drivers/sdio/sd.c b/components/drivers/sdio/sd.c index 222c1fd95f..d2e18b2631 100644 --- a/components/drivers/sdio/sd.c +++ b/components/drivers/sdio/sd.c @@ -755,6 +755,25 @@ static rt_int32_t mmcsd_sd_init_card(struct rt_mmcsd_host *host, goto err1; } + /* + * change SD card to the highest supported speed + */ + err = mmcsd_switch(card); + if (err) + goto err1; + + /* set bus speed */ + max_data_rate = (unsigned int)-1; + if (max_data_rate < card->hs_max_data_rate) + { + max_data_rate = card->hs_max_data_rate; + } + if (max_data_rate < card->max_data_rate) + { + max_data_rate = card->max_data_rate; + } + + mmcsd_set_clock(host, max_data_rate); /*switch bus width*/ if ((host->flags & MMCSD_BUSWIDTH_4) && (card->scr.sd_bus_widths & SD_SCR_BUS_WIDTH_4)) { @@ -780,26 +799,6 @@ static rt_int32_t mmcsd_sd_init_card(struct rt_mmcsd_host *host, card->flags |= CARD_FLAG_SDR50 | CARD_FLAG_SDR104 | CARD_FLAG_DDR50; } - /* - * change SD card to the highest supported speed - */ - err = mmcsd_switch(card); - if (err) - goto err1; - - /* set bus speed */ - max_data_rate = (unsigned int)-1; - if (max_data_rate < card->hs_max_data_rate) - { - max_data_rate = card->hs_max_data_rate; - } - if (max_data_rate < card->max_data_rate) - { - max_data_rate = card->max_data_rate; - } - - mmcsd_set_clock(host, max_data_rate); - host->card = card; return 0; |
