forked from M-Labs/artiq
kasli: support EEPROM on v2
This commit is contained in:
parent
77e6fdb7a7
commit
9bc43b2dbf
|
@ -13,7 +13,7 @@ pub struct EEPROM {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EEPROM {
|
impl EEPROM {
|
||||||
pub fn kasli_eeprom() -> Self {
|
pub fn kasli1_eeprom() -> Self {
|
||||||
EEPROM {
|
EEPROM {
|
||||||
busno: 0,
|
busno: 0,
|
||||||
/// Same port as Si5324
|
/// Same port as Si5324
|
||||||
|
@ -22,6 +22,15 @@ impl EEPROM {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn kasli2_eeprom() -> Self {
|
||||||
|
EEPROM {
|
||||||
|
busno: 0,
|
||||||
|
/// SHARED I2C bus
|
||||||
|
port: 11,
|
||||||
|
address: 0xae,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn select(&self) -> Result<(), &'static str> {
|
fn select(&self) -> Result<(), &'static str> {
|
||||||
let mask: u16 = 1 << self.port;
|
let mask: u16 = 1 << self.port;
|
||||||
i2c::pca9548_select(self.busno, I2C_SWITCH0, mask as u8)?;
|
i2c::pca9548_select(self.busno, I2C_SWITCH0, mask as u8)?;
|
||||||
|
|
|
@ -33,7 +33,10 @@ pub fn get_adresses() -> NetAddresses {
|
||||||
_ => {
|
_ => {
|
||||||
#[cfg(soc_platform = "kasli")]
|
#[cfg(soc_platform = "kasli")]
|
||||||
{
|
{
|
||||||
let eeprom = i2c_eeprom::EEPROM::kasli_eeprom();
|
#[cfg(any(hw_rev = "v1.0", hw_rev = "v1.1"))]
|
||||||
|
let eeprom = i2c_eeprom::EEPROM::kasli1_eeprom();
|
||||||
|
#[cfg(hw_rev = "v2.0")]
|
||||||
|
let eeprom = i2c_eeprom::EEPROM::kasli2_eeprom();
|
||||||
hardware_addr =
|
hardware_addr =
|
||||||
eeprom.read_eui48()
|
eeprom.read_eui48()
|
||||||
.map(|addr_buf| EthernetAddress(addr_buf))
|
.map(|addr_buf| EthernetAddress(addr_buf))
|
||||||
|
|
Loading…
Reference in New Issue