1
0
Fork 0

eth: wait for link

This commit is contained in:
Astro 2019-08-19 02:21:02 +02:00
parent c5a7f059c2
commit 9c73cf130d
1 changed files with 5 additions and 2 deletions

View File

@ -392,17 +392,20 @@ impl<'r, RX, TX> Eth<'r, RX, TX> {
pub fn reset_phy(&mut self) -> bool { pub fn reset_phy(&mut self) -> bool {
match phy::Phy::find(self) { match phy::Phy::find(self) {
Some(phy) => { Some(phy) => {
println!("eth: Found PHY at {}: {}", phy.addr, phy.name());
phy.modify_control(self, |control| phy.modify_control(self, |control|
control.set_reset(true) control.set_reset(true)
); );
while phy.get_control(self).reset() { while phy.get_control(self).reset() {
println!("Wait for PHY reset"); println!("eth: Wait for PHY reset");
} }
phy.modify_control(self, |control| phy.modify_control(self, |control|
control.set_autoneg_enable(true) control.set_autoneg_enable(true)
.set_restart_autoneg(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); Self::setup_gem0_clock(TX_1000);
true true