Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【修复】修复ART-PI samrt上读取不到emmc/sd分区问题 #9051

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 19 additions & 20 deletions components/drivers/sdio/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand All @@ -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;
Expand Down
Loading