From 07ccb9eebdf81e394644e17e7080233b37b9b702 Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 8 Jan 2018 22:15:52 +0000 Subject: [PATCH] firmware: support configuration without ethphy (#886). Currently, this is kasli. --- artiq/firmware/bootloader/main.rs | 4 +++- artiq/firmware/libboard/ethmac.rs | 6 ++++-- artiq/firmware/runtime/main.rs | 1 - artiq/frontend/artiq_devtool.py | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/artiq/firmware/bootloader/main.rs b/artiq/firmware/bootloader/main.rs index 2a9325fac..91e101f08 100644 --- a/artiq/firmware/bootloader/main.rs +++ b/artiq/firmware/bootloader/main.rs @@ -159,7 +159,9 @@ fn network_boot() { println!("Using MAC address {} and IP address {}", eth_addr, ip_addr); let mut net_device = unsafe { ethmac::EthernetDevice::new() }; - net_device.reset(); + + #[cfg(has_ethphy)] + net_device.reset_phy(); let mut neighbor_map = [None; 2]; let neighbor_cache = diff --git a/artiq/firmware/libboard/ethmac.rs b/artiq/firmware/libboard/ethmac.rs index ff9c1149e..90cd1faa4 100644 --- a/artiq/firmware/libboard/ethmac.rs +++ b/artiq/firmware/libboard/ethmac.rs @@ -4,7 +4,6 @@ use smoltcp::phy::{self, DeviceCapabilities, Device}; use csr; use mem::ETHMAC_BASE; -use clock; const RX_SLOTS: usize = csr::ETHMAC_RX_SLOTS as usize; const TX_SLOTS: usize = csr::ETHMAC_TX_SLOTS as usize; @@ -47,7 +46,10 @@ impl EthernetDevice { EthernetDevice(()) } - pub fn reset(&mut self) { + #[cfg(has_ethphy)] + pub fn reset_phy(&mut self) { + use clock; + unsafe { csr::ethphy::crg_reset_write(1); clock::spin_us(2_000); diff --git a/artiq/firmware/runtime/main.rs b/artiq/firmware/runtime/main.rs index a2645c028..37c455b78 100644 --- a/artiq/firmware/runtime/main.rs +++ b/artiq/firmware/runtime/main.rs @@ -149,7 +149,6 @@ fn startup_ethernet() { } let mut net_device = unsafe { ethmac::EthernetDevice::new() }; - net_device.reset(); // fn _net_trace_writer(timestamp: u64, printer: smoltcp::wire::PrettyPrinter) // where U: smoltcp::wire::pretty_print::PrettyPrint { diff --git a/artiq/frontend/artiq_devtool.py b/artiq/frontend/artiq_devtool.py index 951c04db7..fa3236fd7 100755 --- a/artiq/frontend/artiq_devtool.py +++ b/artiq/frontend/artiq_devtool.py @@ -39,7 +39,7 @@ def get_argparser(): parser.add_argument("-t", "--target", metavar="TARGET", type=str, default="kc705_dds", help="Target to build, one of: " - "kc705_dds sayma_amc_standalone " + "kc705_dds kasli sayma_amc_standalone " "sayma_amc_drtio_master sayma_amc_drtio_satellite") parser.add_argument("actions", metavar="ACTION", @@ -56,7 +56,7 @@ def main(): if args.verbose == args.quiet == 0: logging.getLogger().setLevel(logging.INFO) - if args.target in ["kc705_dds", "sayma_amc_standalone", "sayma_amc_drtio_master"]: + if args.target in ["kc705_dds", "kasli", "sayma_amc_standalone", "sayma_amc_drtio_master"]: firmware = "runtime" elif args.target == "sayma_amc_drtio_satellite": firmware = "satman"