Always reset the XGMAC's XAUI PCS on a link up.

MFC after:	3 days
This commit is contained in:
Navdeep Parhar 2010-08-15 20:45:16 +00:00
parent 61cb6c9076
commit 3dd6d7570f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=211346
3 changed files with 58 additions and 12 deletions

View File

@ -745,6 +745,7 @@ int t3_mc7_bd_read(struct mc7 *mc7, unsigned int start, unsigned int n,
int t3_mac_init(struct cmac *mac);
void t3b_pcs_reset(struct cmac *mac);
void t3c_pcs_force_los(struct cmac *mac);
void t3_mac_disable_exact_filters(struct cmac *mac);
void t3_mac_enable_exact_filters(struct cmac *mac);
int t3_mac_enable(struct cmac *mac, int which);

View File

@ -1558,6 +1558,13 @@ void t3_link_changed(adapter_t *adapter, int port_id)
pi->link_fault = LF_YES;
}
if (uses_xaui(adapter)) {
if (adapter->params.rev >= T3_REV_C)
t3c_pcs_force_los(mac);
else
t3b_pcs_reset(mac);
}
/* Don't report link up */
link_ok = 0;
} else {
@ -1584,12 +1591,20 @@ void t3_link_changed(adapter_t *adapter, int port_id)
/* down -> up, or up -> up with changed settings */
if (adapter->params.rev > 0 && uses_xaui(adapter)) {
if (adapter->params.rev >= T3_REV_C)
t3c_pcs_force_los(mac);
else
t3b_pcs_reset(mac);
t3_write_reg(adapter, A_XGM_XAUI_ACT_CTRL + mac->offset,
F_TXACTENABLE | F_RXEN);
}
/* disable TX FIFO drain */
t3_set_reg_field(adapter, A_XGM_TXFIFO_CFG + mac->offset,
F_ENDROPPKT, 0);
t3_mac_enable(mac, MAC_DIRECTION_TX | MAC_DIRECTION_RX);
t3_set_reg_field(adapter, A_XGM_STAT_CTRL + mac->offset,
F_CLRSTATS, 1);
@ -1609,20 +1624,21 @@ void t3_link_changed(adapter_t *adapter, int port_id)
t3_set_reg_field(adapter,
A_XGM_INT_ENABLE + mac->offset,
F_XGM_INT, 0);
}
if (!link_fault)
t3_mac_disable(mac, MAC_DIRECTION_RX);
/*
* Make sure Tx FIFO continues to drain, even as rxen is left
* high to help detect and indicate remote faults.
*/
t3_set_reg_field(adapter, A_XGM_TXFIFO_CFG + mac->offset, 0,
F_ENDROPPKT);
t3_write_reg(adapter, A_XGM_RX_CTRL + mac->offset, 0);
t3_write_reg(adapter, A_XGM_TX_CTRL + mac->offset, F_TXEN);
t3_write_reg(adapter, A_XGM_RX_CTRL + mac->offset, F_RXEN);
/*
* Make sure Tx FIFO continues to drain, even as rxen is
* left high to help detect and indicate remote faults.
*/
t3_set_reg_field(adapter,
A_XGM_TXFIFO_CFG + mac->offset, 0, F_ENDROPPKT);
t3_write_reg(adapter, A_XGM_RX_CTRL + mac->offset, 0);
t3_write_reg(adapter,
A_XGM_TX_CTRL + mac->offset, F_TXEN);
t3_write_reg(adapter,
A_XGM_RX_CTRL + mac->offset, F_RXEN);
}
}
t3_os_link_changed(adapter, port_id, link_ok, speed, duplex, fc,

View File

@ -97,11 +97,40 @@ void t3b_pcs_reset(struct cmac *mac)
{
t3_set_reg_field(mac->adapter, A_XGM_RESET_CTRL + mac->offset,
F_PCS_RESET_, 0);
udelay(20);
/* No delay required */
t3_set_reg_field(mac->adapter, A_XGM_RESET_CTRL + mac->offset, 0,
F_PCS_RESET_);
}
void t3c_pcs_force_los(struct cmac *mac)
{
t3_set_reg_field(mac->adapter, A_XGM_SERDES_STAT0 + mac->offset,
F_LOWSIGFORCEEN0 | F_LOWSIGFORCEVALUE0,
F_LOWSIGFORCEEN0 | F_LOWSIGFORCEVALUE0);
t3_set_reg_field(mac->adapter, A_XGM_SERDES_STAT1 + mac->offset,
F_LOWSIGFORCEEN1 | F_LOWSIGFORCEVALUE1,
F_LOWSIGFORCEEN1 | F_LOWSIGFORCEVALUE1);
t3_set_reg_field(mac->adapter, A_XGM_SERDES_STAT2 + mac->offset,
F_LOWSIGFORCEEN2 | F_LOWSIGFORCEVALUE2,
F_LOWSIGFORCEEN2 | F_LOWSIGFORCEVALUE2);
t3_set_reg_field(mac->adapter, A_XGM_SERDES_STAT3 + mac->offset,
F_LOWSIGFORCEEN3 | F_LOWSIGFORCEVALUE3,
F_LOWSIGFORCEEN3 | F_LOWSIGFORCEVALUE3);
/* No delay required */
t3_set_reg_field(mac->adapter, A_XGM_SERDES_STAT0 + mac->offset,
F_LOWSIGFORCEEN0, 0);
t3_set_reg_field(mac->adapter, A_XGM_SERDES_STAT1 + mac->offset,
F_LOWSIGFORCEEN1, 0);
t3_set_reg_field(mac->adapter, A_XGM_SERDES_STAT2 + mac->offset,
F_LOWSIGFORCEEN2, 0);
t3_set_reg_field(mac->adapter, A_XGM_SERDES_STAT3 + mac->offset,
F_LOWSIGFORCEEN3, 0);
}
/**
* t3_mac_init - initialize a MAC
* @mac: the MAC to initialize