firmware: support configuration without ethphy (#886).

Currently, this is kasli.
This commit is contained in:
whitequark 2018-01-08 22:15:52 +00:00
parent 34a5445802
commit 07ccb9eebd
4 changed files with 9 additions and 6 deletions

View File

@ -159,7 +159,9 @@ 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);
let mut net_device = unsafe { ethmac::EthernetDevice::new() }; 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 mut neighbor_map = [None; 2];
let neighbor_cache = let neighbor_cache =

View File

@ -4,7 +4,6 @@ use smoltcp::phy::{self, DeviceCapabilities, Device};
use csr; use csr;
use mem::ETHMAC_BASE; use mem::ETHMAC_BASE;
use clock;
const RX_SLOTS: usize = csr::ETHMAC_RX_SLOTS as usize; const RX_SLOTS: usize = csr::ETHMAC_RX_SLOTS as usize;
const TX_SLOTS: usize = csr::ETHMAC_TX_SLOTS as usize; const TX_SLOTS: usize = csr::ETHMAC_TX_SLOTS as usize;
@ -47,7 +46,10 @@ impl EthernetDevice {
EthernetDevice(()) EthernetDevice(())
} }
pub fn reset(&mut self) { #[cfg(has_ethphy)]
pub fn reset_phy(&mut self) {
use clock;
unsafe { unsafe {
csr::ethphy::crg_reset_write(1); csr::ethphy::crg_reset_write(1);
clock::spin_us(2_000); clock::spin_us(2_000);

View File

@ -149,7 +149,6 @@ fn startup_ethernet() {
} }
let mut net_device = unsafe { ethmac::EthernetDevice::new() }; let mut net_device = unsafe { ethmac::EthernetDevice::new() };
net_device.reset();
// 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 {

View File

@ -39,7 +39,7 @@ def get_argparser():
parser.add_argument("-t", "--target", metavar="TARGET", parser.add_argument("-t", "--target", metavar="TARGET",
type=str, default="kc705_dds", type=str, default="kc705_dds",
help="Target to build, one of: " 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") "sayma_amc_drtio_master sayma_amc_drtio_satellite")
parser.add_argument("actions", metavar="ACTION", parser.add_argument("actions", metavar="ACTION",
@ -56,7 +56,7 @@ def main():
if args.verbose == args.quiet == 0: if args.verbose == args.quiet == 0:
logging.getLogger().setLevel(logging.INFO) 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" firmware = "runtime"
elif args.target == "sayma_amc_drtio_satellite": elif args.target == "sayma_amc_drtio_satellite":
firmware = "satman" firmware = "satman"