sayma: add JESD204 PHY done diagnostics

This commit is contained in:
Sebastien Bourdeauducq 2020-01-20 12:47:31 +08:00
parent 6c3e71a83a
commit 45efee724e
1 changed files with 11 additions and 2 deletions

View File

@ -11,7 +11,12 @@ pub mod jesd {
unsafe { unsafe {
(csr::JDCG[dacno as usize].jesd_control_enable_write)(if en {1} else {0}) (csr::JDCG[dacno as usize].jesd_control_enable_write)(if en {1} else {0})
} }
clock::spin_us(5000); }
pub fn phy_done(dacno: u8) -> bool {
unsafe {
(csr::JDCG[dacno as usize].jesd_control_phy_done_read)() != 0
}
} }
pub fn ready(dacno: u8) -> bool { pub fn ready(dacno: u8) -> bool {
@ -84,7 +89,11 @@ pub mod jdac {
info!("DAC-{} initializing...", dacno); info!("DAC-{} initializing...", dacno);
jesd::enable(dacno, true); jesd::enable(dacno, true);
clock::spin_us(10); clock::spin_us(10_000);
if !jesd::phy_done(dacno) {
error!("JESD core PHY not done");
return Err("JESD core PHY not done");
}
if !jesd::ready(dacno) { if !jesd::ready(dacno) {
error!("JESD core reported not ready"); error!("JESD core reported not ready");
return Err("JESD core reported not ready"); return Err("JESD core reported not ready");