2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 03:08:27 +08:00

firmware: always reset PHY when initializing Ethernet.

Fixes #897.
This commit is contained in:
whitequark 2018-01-19 04:56:11 +00:00
parent 1f82ceaa85
commit 80cbef0031
3 changed files with 8 additions and 5 deletions

View File

@ -158,11 +158,8 @@ fn network_boot() {
println!("Using MAC address {} and IP address {}", eth_addr, ip_addr);
#[allow(unused_mut)]
let mut net_device = unsafe { ethmac::EthernetDevice::new() };
#[cfg(has_ethphy)]
net_device.reset_phy();
net_device.reset_phy_if_any();
let mut neighbor_map = [None; 2];
let neighbor_cache =

View File

@ -57,6 +57,11 @@ impl EthernetDevice {
clock::spin_us(2_000);
}
}
pub fn reset_phy_if_any(&mut self) {
#[cfg(has_ethphy)]
self.reset_phy();
}
}
impl<'a> Device<'a> for EthernetDevice {

View File

@ -150,7 +150,8 @@ fn startup_ethernet() {
}
}
let net_device = unsafe { ethmac::EthernetDevice::new() };
let mut net_device = unsafe { ethmac::EthernetDevice::new() };
net_device.reset_phy_if_any();
// fn _net_trace_writer<U>(timestamp: u64, printer: smoltcp::wire::PrettyPrinter<U>)
// where U: smoltcp::wire::pretty_print::PrettyPrint {