From 9c73cf130d52f7ab0f3f4581356173b6e6d1cd27 Mon Sep 17 00:00:00 2001 From: Astro Date: Mon, 19 Aug 2019 02:21:02 +0200 Subject: [PATCH] eth: wait for link --- src/eth/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/eth/mod.rs b/src/eth/mod.rs index 3e248a8a..bf955c62 100644 --- a/src/eth/mod.rs +++ b/src/eth/mod.rs @@ -392,17 +392,20 @@ impl<'r, RX, TX> Eth<'r, RX, TX> { pub fn reset_phy(&mut self) -> bool { match phy::Phy::find(self) { Some(phy) => { + println!("eth: Found PHY at {}: {}", phy.addr, phy.name()); phy.modify_control(self, |control| control.set_reset(true) ); while phy.get_control(self).reset() { - println!("Wait for PHY reset"); + println!("eth: Wait for PHY reset"); } phy.modify_control(self, |control| control.set_autoneg_enable(true) .set_restart_autoneg(true) ); - // 125 MHz for 1000base-TX + println!("eth: Wait for link"); + while !phy.get_status(self).link_status() {} + println!("eth: Got link, setting clock for gigabit"); Self::setup_gem0_clock(TX_1000); true