sayma: add JESD204 PHY done diagnostics

This commit is contained in:
Sebastien Bourdeauducq 2020-01-20 12:05:56 +08:00
parent 2ad7d2967a
commit eb0ce933c5
1 changed files with 11 additions and 2 deletions

View File

@ -11,7 +11,12 @@ pub mod jesd {
unsafe {
(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 {
@ -80,7 +85,11 @@ pub mod jdac {
fn init_one(dacno: u8) -> Result<(), &'static str> {
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) {
error!("JESD core reported not ready");
return Err("JESD core reported not ready");