diff --git a/artiq/firmware/bootloader/main.rs b/artiq/firmware/bootloader/main.rs index 2507cf14f..34bc58094 100644 --- a/artiq/firmware/bootloader/main.rs +++ b/artiq/firmware/bootloader/main.rs @@ -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 = diff --git a/artiq/firmware/libboard/ethmac.rs b/artiq/firmware/libboard/ethmac.rs index 90cd1faa4..ce8af0e42 100644 --- a/artiq/firmware/libboard/ethmac.rs +++ b/artiq/firmware/libboard/ethmac.rs @@ -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 { diff --git a/artiq/firmware/runtime/main.rs b/artiq/firmware/runtime/main.rs index 6ce66595c..95916a8dc 100644 --- a/artiq/firmware/runtime/main.rs +++ b/artiq/firmware/runtime/main.rs @@ -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(timestamp: u64, printer: smoltcp::wire::PrettyPrinter) // where U: smoltcp::wire::pretty_print::PrettyPrint {