Commit 41b62c30 authored by Grzegorz Daniluk's avatar Grzegorz Daniluk

reset serdes on link down

parent 1223d94f
......@@ -85,6 +85,7 @@ typedef struct {
timeout_t earlyup_timeout;
timeout_t align_to_link_timeout;
timeout_t restart_timeout;
timeout_t watchdog_timeout;
int attempts;
}halPortLpdcRx_t;
......
......@@ -165,9 +165,11 @@ static int _hal_port_rx_setup_state_start(fsm_t *fsm, int eventMsk, int isNewSta
}
if (ps->lpdc.isSupported) {
if (isNewState)
if (isNewState) {
// Restart the time-out
libwr_tmo_restart(&rxSetup->earlyup_timeout);
libwr_tmo_restart(&rxSetup->watchdog_timeout);
}
/* Wait a bit to make sure early_link_up is reseted. This
timeout is initialized in hal_port_rx_setup_init_fsm(),
......@@ -189,6 +191,15 @@ static int _hal_port_rx_setup_state_start(fsm_t *fsm, int eventMsk, int isNewSta
} else {
// Restart the time-out
libwr_tmo_restart(&rxSetup->earlyup_timeout);
/* if there is no early linkup, restart RX of the transceiver, is it stuck?? */
if (libwr_tmo_expired(&rxSetup->watchdog_timeout)) {
pr_warning("--------- restarting transceiver %s ------------\n", ps->name);
pcs_writel(ps, MDIO_LPC_CTRL_TX_ENABLE |
MDIO_LPC_CTRL_DMTD_SOURCE_RXRECCLK |
MDIO_LPC_CTRL_RESET_RX,
MDIO_LPC_CTRL);
libwr_tmo_restart(&rxSetup->watchdog_timeout);
}
}
} else {
/* nothing to do, go waiting for link_up*/
......@@ -452,6 +463,8 @@ void hal_port_rx_setup_fsm_init(struct hal_port_state * ps ) {
// This timer is used to leave enough time to the FSM in the other side to detect a link down
libwr_tmo_init(&ps->lpdc.rxSetup->restart_timeout, 100, 0);
libwr_tmo_init(&rxSetup->watchdog_timeout, 2000, 0);
}
/**
* This time-out is used to impose the same minimum of RX calibration time
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment