runtime: clear all DRTIO FIFOs first, reset remote PHYs on link init

This commit is contained in:
Sebastien Bourdeauducq 2016-12-12 17:48:25 +08:00
parent 8f747fa209
commit 6a60afcba0
1 changed files with 9 additions and 2 deletions

View File

@ -53,6 +53,13 @@ mod drtio {
} }
} }
fn reset_phy() {
unsafe {
csr::drtio::reset_phy_write(1);
while csr::drtio::o_wait_read() == 1 {}
}
}
fn sync_tsc() { fn sync_tsc() {
unsafe { unsafe {
csr::drtio::set_time_write(1); csr::drtio::set_time_write(1);
@ -94,9 +101,9 @@ mod drtio {
waiter.sleep(600).unwrap(); waiter.sleep(600).unwrap();
info!("wait for remote side done"); info!("wait for remote side done");
init(); // clear all FIFOs first
reset_phy();
sync_tsc(); sync_tsc();
info!("TSC synced");
init();
info!("link initialization completed"); info!("link initialization completed");
waiter.until(|| !link_is_up()).unwrap(); waiter.until(|| !link_is_up()).unwrap();