2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 03:08:27 +08:00

drtio: remove remote RTIO PHY resets

This commit is contained in:
Sebastien Bourdeauducq 2018-09-20 11:10:32 +08:00
parent 53a979e74d
commit 1b7f403a4b
4 changed files with 17 additions and 30 deletions

View File

@ -18,7 +18,7 @@ impl<T> From<IoError<T>> for Error<T> {
pub enum Packet {
EchoRequest,
EchoReply,
ResetRequest { phy: bool },
ResetRequest,
ResetAck,
TSCAck,
@ -62,9 +62,7 @@ impl Packet {
Ok(match reader.read_u8()? {
0x00 => Packet::EchoRequest,
0x01 => Packet::EchoReply,
0x02 => Packet::ResetRequest {
phy: reader.read_bool()?
},
0x02 => Packet::ResetRequest,
0x03 => Packet::ResetAck,
0x04 => Packet::TSCAck,
@ -192,10 +190,8 @@ impl Packet {
writer.write_u8(0x00)?,
Packet::EchoReply =>
writer.write_u8(0x01)?,
Packet::ResetRequest { phy } => {
writer.write_u8(0x02)?;
writer.write_bool(phy)?;
},
Packet::ResetRequest =>
writer.write_u8(0x02)?,
Packet::ResetAck =>
writer.write_u8(0x03)?,
Packet::TSCAck =>

View File

@ -334,7 +334,7 @@ pub mod drtio {
let linkno = linkno as u8;
if link_rx_up(linkno) {
let reply = aux_transact(io, aux_mutex, linkno,
&drtioaux::Packet::ResetRequest { phy: false });
&drtioaux::Packet::ResetRequest);
match reply {
Ok(drtioaux::Packet::ResetAck) => (),
Ok(_) => error!("[LINK#{}] reset failed, received unexpected aux packet", linkno),
@ -419,7 +419,7 @@ pub fn startup(io: &Io, aux_mutex: &Mutex,
}
}
unsafe {
csr::rtio_core::reset_phy_write(1);
csr::rtio_core::reset_phy_write(1);
}
drtio::startup(io, aux_mutex, routing_table, up_destinations);

View File

@ -75,18 +75,13 @@ fn process_aux_packet(_repeaters: &mut [repeater::Repeater],
match packet {
drtioaux::Packet::EchoRequest =>
drtioaux::send(0, &drtioaux::Packet::EchoReply),
drtioaux::Packet::ResetRequest { phy } => {
drtioaux::Packet::ResetRequest => {
info!("resetting RTIO");
if phy {
drtiosat_reset_phy(true);
drtiosat_reset_phy(false);
} else {
drtiosat_reset(true);
clock::spin_us(100);
drtiosat_reset(false);
}
drtiosat_reset(true);
clock::spin_us(100);
drtiosat_reset(false);
for rep in _repeaters.iter() {
if let Err(e) = rep.rtio_reset(phy) {
if let Err(e) = rep.rtio_reset() {
error!("failed to issue RTIO reset ({})", e);
}
}

View File

@ -242,21 +242,17 @@ impl Repeater {
Ok(())
}
pub fn rtio_reset(&self, phy: bool) -> Result<(), drtioaux::Error<!>> {
pub fn rtio_reset(&self) -> Result<(), drtioaux::Error<!>> {
let repno = self.repno as usize;
if !phy {
unsafe { (csr::DRTIOREP[repno].reset_write)(1); }
clock::spin_us(100);
unsafe { (csr::DRTIOREP[repno].reset_write)(0); }
}
unsafe { (csr::DRTIOREP[repno].reset_write)(1); }
clock::spin_us(100);
unsafe { (csr::DRTIOREP[repno].reset_write)(0); }
if self.state != RepeaterState::Up {
return Ok(());
}
drtioaux::send(self.auxno, &drtioaux::Packet::ResetRequest {
phy: phy
}).unwrap();
drtioaux::send(self.auxno, &drtioaux::Packet::ResetRequest).unwrap();
let reply = self.recv_aux_timeout(200)?;
if reply != drtioaux::Packet::ResetAck {
return Err(drtioaux::Error::UnexpectedReply);
@ -278,5 +274,5 @@ impl Repeater {
pub fn sync_tsc(&self) -> Result<(), drtioaux::Error<!>> { Ok(()) }
pub fn rtio_reset(&self, _phy: bool) -> Result<(), drtioaux::Error<!>> { Ok(()) }
pub fn rtio_reset(&self) -> Result<(), drtioaux::Error<!>> { Ok(()) }
}