From 6a60afcba0e1c9a61e0682c52abf50196d7bd3a9 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 12 Dec 2016 17:48:25 +0800 Subject: [PATCH] runtime: clear all DRTIO FIFOs first, reset remote PHYs on link init --- artiq/runtime.rs/src/rtio_mgt.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/artiq/runtime.rs/src/rtio_mgt.rs b/artiq/runtime.rs/src/rtio_mgt.rs index 88ce44e72..216706f0a 100644 --- a/artiq/runtime.rs/src/rtio_mgt.rs +++ b/artiq/runtime.rs/src/rtio_mgt.rs @@ -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() { unsafe { csr::drtio::set_time_write(1); @@ -94,9 +101,9 @@ mod drtio { waiter.sleep(600).unwrap(); info!("wait for remote side done"); + init(); // clear all FIFOs first + reset_phy(); sync_tsc(); - info!("TSC synced"); - init(); info!("link initialization completed"); waiter.until(|| !link_is_up()).unwrap();