Skip to content

Commit

Permalink
sdio: temporarily add retry logic in sd host controller init procedure
Browse files Browse the repository at this point in the history
Signed-off-by: Zhouqi Jiang <[email protected]>
  • Loading branch information
luojia65 committed Dec 28, 2024
1 parent e83314c commit 1256983
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions bouffalo-hal/src/sdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3655,21 +3655,25 @@ impl<SDH: Deref<Target = RegisterBlock>, PADS, const I: usize> Sdh<SDH, PADS, I>
#[inline]
pub fn init<W: Write>(&mut self, w: &mut W, debug: bool) {
// Sdcard idle.
self.send_command(SDHResp::None, CmdType::Normal, 0, 0, false);
sleep_ms(100);
loop {
self.send_command(SDHResp::None, CmdType::Normal, 0, 0, false);
sleep_ms(100);

// Send CMD8.
self.send_command(SDHResp::R7, CmdType::Normal, 8, 0x1AA, false);
sleep_ms(100);
let data = self.get_resp();
if data != 0x1AA {
writeln!(
*w,
"unexpected response to CMD8: {:#010X}, expected 0x1AA",
data
)
.ok();
loop {}
// Send CMD8.
self.send_command(SDHResp::R7, CmdType::Normal, 8, 0x1AA, false);
sleep_ms(100);
let data = self.get_resp();
if data != 0x1AA {
writeln!(
*w,
"unexpected response to CMD8: {:#010X}, expected 0x1AA",
data
)
.ok();
} else {
break;
}
sleep_ms(1000);
}

loop {
Expand Down

0 comments on commit 1256983

Please sign in to comment.