Skip to content

[fix] 修复ART-PI smart在sd/emmc读取不到分区的问题 #9058

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

Merged
merged 1 commit into from
Jun 13, 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
42 changes: 21 additions & 21 deletions components/drivers/sdio/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,25 +755,8 @@ 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);
mmcsd_set_timing(host, MMCSD_TIMING_LEGACY);
mmcsd_set_clock(host, 25000000);
/*switch bus width*/
if ((host->flags & MMCSD_BUSWIDTH_4) && (card->scr.sd_bus_widths & SD_SCR_BUS_WIDTH_4))
{
Expand All @@ -783,8 +766,6 @@ static rt_int32_t mmcsd_sd_init_card(struct rt_mmcsd_host *host,

mmcsd_set_bus_width(host, MMCSD_BUS_WIDTH_4);
}
mmcsd_set_timing(host, MMCSD_TIMING_LEGACY);
mmcsd_set_clock(host, 25000000);

/* Read and decode SD Status and check whether UHS mode is supported */
union rt_sd_status sd_status;
Expand All @@ -799,6 +780,25 @@ 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