forked from M-Labs/artiq
1
0
Fork 0

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); println!("Using MAC address {} and IP address {}", eth_addr, ip_addr);
#[allow(unused_mut)]
let mut net_device = unsafe { ethmac::EthernetDevice::new() }; let mut net_device = unsafe { ethmac::EthernetDevice::new() };
net_device.reset_phy_if_any();
#[cfg(has_ethphy)]
net_device.reset_phy();
let mut neighbor_map = [None; 2]; let mut neighbor_map = [None; 2];
let neighbor_cache = let neighbor_cache =

View File

@ -57,6 +57,11 @@ impl EthernetDevice {
clock::spin_us(2_000); 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 { 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>) // fn _net_trace_writer<U>(timestamp: u64, printer: smoltcp::wire::PrettyPrinter<U>)
// where U: smoltcp::wire::pretty_print::PrettyPrint { // where U: smoltcp::wire::pretty_print::PrettyPrint {