From 40e7b6058e3fa0bd1e0ba14213ed3532c9cdb6bb Mon Sep 17 00:00:00 2001 From: Harry Ho Date: Mon, 13 Sep 2021 12:34:55 +0800 Subject: [PATCH] sayma: support reading EUI48 from MMCSPI --- artiq/firmware/libboard_misoc/net_settings.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/artiq/firmware/libboard_misoc/net_settings.rs b/artiq/firmware/libboard_misoc/net_settings.rs index 2663be5db..dcabe17d8 100644 --- a/artiq/firmware/libboard_misoc/net_settings.rs +++ b/artiq/firmware/libboard_misoc/net_settings.rs @@ -5,6 +5,8 @@ use smoltcp::wire::{EthernetAddress, IpAddress}; use config; #[cfg(soc_platform = "kasli")] use i2c_eeprom; +#[cfg(soc_platform = "sayma_amc")] +use mmcspi; pub struct NetAddresses { @@ -40,7 +42,12 @@ pub fn get_adresses() -> NetAddresses { .unwrap_or_else(|_e| EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x21])); } #[cfg(soc_platform = "sayma_amc")] - { hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x11]); } + { + let mut eui48 = [0_u8; 6]; + mmcspi::read_eui48(&mut eui48) + .expect("Failed to detect EUI48 from MMC"); + hardware_addr = EthernetAddress(eui48); + } #[cfg(soc_platform = "metlino")] { hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x19]); } #[cfg(soc_platform = "kc705")]