forked from M-Labs/artiq
1
0
Fork 0

ad9154: retry initialization (#727)

This commit is contained in:
Sebastien Bourdeauducq 2017-12-31 11:27:43 +08:00
parent 6e0288e568
commit a897d82324
1 changed files with 12 additions and 1 deletions

View File

@ -473,6 +473,17 @@ fn dac_cfg(dacno: u8) -> Result<(), &'static str> {
Ok(()) Ok(())
} }
fn dac_cfg_retry(dacno: u8) -> Result<(), &'static str> {
for i in 0..99 {
let outcome = dac_cfg(dacno);
match outcome {
Ok(_) => return outcome,
Err(e) => warn!("AD9154-{} config attempt #{} failed ({}), retrying", dacno, i, e)
}
}
dac_cfg(dacno)
}
pub fn init() -> Result<(), &'static str> { pub fn init() -> Result<(), &'static str> {
// Release the JESD clock domain reset late, as we need to // Release the JESD clock domain reset late, as we need to
// set up clock chips before. // set up clock chips before.
@ -481,7 +492,7 @@ pub fn init() -> Result<(), &'static str> {
for dacno in 0..csr::AD9154.len() { for dacno in 0..csr::AD9154.len() {
let dacno = dacno as u8; let dacno = dacno as u8;
debug!("setting up AD9154-{} DAC...", dacno); debug!("setting up AD9154-{} DAC...", dacno);
dac_cfg(dacno)?; dac_cfg_retry(dacno)?;
} }
Ok(()) Ok(())
} }