Commit 776ae4b0 authored by Maciej Lipinski's avatar Maciej Lipinski

[HAL] Move around bitslide-measurement-related stuff:

- regardless whether LPDC is supported or not, some calibration
  flags need to be set, more over some of them have tx in name,
  so setting them in hal_port_rx_setup_state_fsm() is messy. So..
- set any LPDC-irrelevant flags in the port_fsm when link_up
- make sure the value of bitslide is cleared when link_down
- measure bitslide only in NO_LPDC state, otherwise leave it zero
parent 028f3abc
......@@ -180,7 +180,7 @@ static int _hal_port_state_link_down(void *vpfg, int eventMsk, int isNewState) {
}
if ( isNewState ) {
_reset_port(ps);
_reset_port(ps);// clears ps->tx_cal_pending & ps->calib*, except ps->calib.bitslide_ps
/* Init the rx state machine */
hal_port_rx_setup_init_fsm(ps);
......@@ -188,12 +188,26 @@ static int _hal_port_state_link_down(void *vpfg, int eventMsk, int isNewState) {
might be overriden later by the rx_setup_state_fsm*/
led_set_wrmode(ps->hw_index,SFP_LED_WRMODE_OFF);
led_set_synched(ps->hw_index, 0);
/* bitslide is measured, if appropriate, in hal_port_rx_setup_state_fsm()*/
ps->calib.bitslide_ps = 0;
}
/* if final state reached for tx setup state machine then
* we can go LINK_UP state
*/
if (hal_port_rx_setup_state_fsm(ps)==1 ) {
/* any calibration, if any, has been done*/
ps->calib.tx_calibrated = 1;
ps->calib.rx_calibrated = 1;
ps->calib.delta_rx_phy = ps->calib.phy_rx_min;
ps->calib.delta_tx_phy = ps->calib.phy_tx_min;
ps->tx_cal_pending = 0;
ps->rx_cal_pending = 0;
/* bitslide was obtained in hal_port_rx_setup_state_fsm() */
pr_info("%s:%s: bitslide= %u [ps]\n",__func__,ps->name,ps->calib.bitslide_ps);
_fireState(vpfg,HAL_PORT_STATE_LINK_UP);
return 0;
}
......
......@@ -174,21 +174,13 @@ static int _hal_port_rx_setup_state_calib_no_lpdc(void *vpfg, int eventMsk, int
uint32_t bit_slide_steps;
if ( pcs_readl(ps, 16,&bit_slide_steps) >=0 ) {
bit_slide_steps= (bit_slide_steps>> 4) & 0x1f;
ps->calib.tx_calibrated = 1;
ps->calib.rx_calibrated = 1;
/* FIXME: use proper register names */
ps->calib.bitslide_ps=bit_slide_steps*(uint32_t)800; /* 1 step = 800ps */
pr_info("%s:%s: bitslide= %u\n",__func__,ps->name,bit_slide_steps);
ps->calib.delta_rx_phy = ps->calib.phy_rx_min;
ps->calib.delta_tx_phy = ps->calib.phy_tx_min;
ps->tx_cal_pending = 0;
ps->rx_cal_pending = 0;
_fireState(vpfg,HAL_PORT_RX_SETUP_STATE_DONE);
}
else
pr_warning("Cannot read bitslide in NO-LPDC mode, retrying...\n");
}
return 0;
}
......
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