forked from M-Labs/kirdy
net: Set stm32 link speed with the Phy Speed read
This commit is contained in:
parent
76477065be
commit
6fc800e562
|
@ -12,6 +12,7 @@ use smoltcp::{
|
|||
};
|
||||
use stm32_eth::{
|
||||
Parts, EthPins, PartsIn,
|
||||
mac::Speed,
|
||||
dma::{
|
||||
TxRingEntry, RxRingEntry, EthernetDMA
|
||||
}};
|
||||
|
@ -148,6 +149,20 @@ impl ServerHandle {
|
|||
);
|
||||
|
||||
phy.phy_init();
|
||||
while !phy.phy_link_up() {}
|
||||
|
||||
if let Some(speed) = phy.speed().map(|s| match s {
|
||||
PhySpeed::HalfDuplexBase10T => Speed::HalfDuplexBase10T,
|
||||
PhySpeed::FullDuplexBase10T => Speed::FullDuplexBase10T,
|
||||
PhySpeed::HalfDuplexBase100Tx => Speed::HalfDuplexBase100Tx,
|
||||
PhySpeed::FullDuplexBase100Tx => Speed::FullDuplexBase100Tx,
|
||||
}) {
|
||||
phy.get_miim().set_speed(speed);
|
||||
info!("Detected link speed: {:?}", speed);
|
||||
} else {
|
||||
debug!("Failed to detect link speed.");
|
||||
}
|
||||
|
||||
} else {
|
||||
info!("Not resetting unsupported PHY.");
|
||||
}
|
||||
|
@ -218,6 +233,7 @@ use ieee802_3_miim::{
|
|||
phy::{
|
||||
lan87xxa::{LAN8720A, LAN8742A},
|
||||
BarePhy, KSZ8081R,
|
||||
PhySpeed
|
||||
},
|
||||
Miim, Pause, Phy,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue