forked from Minki/linux
Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
Jeff Kirsher says: ==================== 1GbE Intel Wired LAN Driver Updates 2015-12-14 This series contains updates to e1000e and igb. Alex Duyck changes e1000_up() to void since it always returned 0, also by making it void, we can drop some code since we no longer have to worry about non-zero return values. Aaron Sierra removes GS40G specific defines and functions since the i210 internal PHY can be accessed with the access functions shared by 82580, i350 and i354 devices. Also removes the code to add the PHY address into the PCDL register address, since there is no real reason to do so. Joe updates the cable length function reports all four pairs true min, max and average cable length for i210. Also updated ethtool to use enum-based labels instead of hard coded values. Benjamin Poirier cleans up code that is never reachable since MSI-X interrupts are not shared in e1000e. Also removes the ICR read in the other interrupt handler, since the information is not needed and IMS is configured such that the only link status change can trigger the other interrupt handler. Fixed in MSI-X mode, there is no handler for the LSC interrupt so there is no point in writing that to ICS now that we always assume other interrupts are caused by LSC. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
335b320940
@ -441,12 +441,13 @@
|
||||
#define E1000_IMS_RXQ1 E1000_ICR_RXQ1 /* Rx Queue 1 Interrupt */
|
||||
#define E1000_IMS_TXQ0 E1000_ICR_TXQ0 /* Tx Queue 0 Interrupt */
|
||||
#define E1000_IMS_TXQ1 E1000_ICR_TXQ1 /* Tx Queue 1 Interrupt */
|
||||
#define E1000_IMS_OTHER E1000_ICR_OTHER /* Other Interrupts */
|
||||
#define E1000_IMS_OTHER E1000_ICR_OTHER /* Other Interrupt */
|
||||
|
||||
/* Interrupt Cause Set */
|
||||
#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */
|
||||
#define E1000_ICS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */
|
||||
#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */
|
||||
#define E1000_ICS_OTHER E1000_ICR_OTHER /* Other Interrupt */
|
||||
|
||||
/* Transmit Descriptor Control */
|
||||
#define E1000_TXDCTL_PTHRESH 0x0000003F /* TXDCTL Prefetch Threshold */
|
||||
|
@ -480,7 +480,7 @@ extern const char e1000e_driver_version[];
|
||||
void e1000e_check_options(struct e1000_adapter *adapter);
|
||||
void e1000e_set_ethtool_ops(struct net_device *netdev);
|
||||
|
||||
int e1000e_up(struct e1000_adapter *adapter);
|
||||
void e1000e_up(struct e1000_adapter *adapter);
|
||||
void e1000e_down(struct e1000_adapter *adapter, bool reset);
|
||||
void e1000e_reinit_locked(struct e1000_adapter *adapter);
|
||||
void e1000e_reset(struct e1000_adapter *adapter);
|
||||
|
@ -1905,30 +1905,15 @@ static irqreturn_t e1000_msix_other(int __always_unused irq, void *data)
|
||||
struct net_device *netdev = data;
|
||||
struct e1000_adapter *adapter = netdev_priv(netdev);
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
u32 icr = er32(ICR);
|
||||
|
||||
if (!(icr & E1000_ICR_INT_ASSERTED)) {
|
||||
if (!test_bit(__E1000_DOWN, &adapter->state))
|
||||
ew32(IMS, E1000_IMS_OTHER);
|
||||
return IRQ_NONE;
|
||||
hw->mac.get_link_status = true;
|
||||
|
||||
/* guard against interrupt when we're going down */
|
||||
if (!test_bit(__E1000_DOWN, &adapter->state)) {
|
||||
mod_timer(&adapter->watchdog_timer, jiffies + 1);
|
||||
ew32(IMS, E1000_IMS_OTHER);
|
||||
}
|
||||
|
||||
if (icr & adapter->eiac_mask)
|
||||
ew32(ICS, (icr & adapter->eiac_mask));
|
||||
|
||||
if (icr & E1000_ICR_OTHER) {
|
||||
if (!(icr & E1000_ICR_LSC))
|
||||
goto no_link_interrupt;
|
||||
hw->mac.get_link_status = true;
|
||||
/* guard against interrupt when we're going down */
|
||||
if (!test_bit(__E1000_DOWN, &adapter->state))
|
||||
mod_timer(&adapter->watchdog_timer, jiffies + 1);
|
||||
}
|
||||
|
||||
no_link_interrupt:
|
||||
if (!test_bit(__E1000_DOWN, &adapter->state))
|
||||
ew32(IMS, E1000_IMS_LSC | E1000_IMS_OTHER);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
@ -1946,6 +1931,9 @@ static irqreturn_t e1000_intr_msix_tx(int __always_unused irq, void *data)
|
||||
/* Ring was not completely cleaned, so fire another interrupt */
|
||||
ew32(ICS, tx_ring->ims_val);
|
||||
|
||||
if (!test_bit(__E1000_DOWN, &adapter->state))
|
||||
ew32(IMS, adapter->tx_ring->ims_val);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
@ -2027,6 +2015,7 @@ static void e1000_configure_msix(struct e1000_adapter *adapter)
|
||||
hw->hw_addr + E1000_EITR_82574(vector));
|
||||
else
|
||||
writel(1, hw->hw_addr + E1000_EITR_82574(vector));
|
||||
adapter->eiac_mask |= E1000_IMS_OTHER;
|
||||
|
||||
/* Cause Tx interrupts on every write back */
|
||||
ivar |= (1 << 31);
|
||||
@ -2034,12 +2023,8 @@ static void e1000_configure_msix(struct e1000_adapter *adapter)
|
||||
ew32(IVAR, ivar);
|
||||
|
||||
/* enable MSI-X PBA support */
|
||||
ctrl_ext = er32(CTRL_EXT);
|
||||
ctrl_ext |= E1000_CTRL_EXT_PBA_CLR;
|
||||
|
||||
/* Auto-Mask Other interrupts upon ICR read */
|
||||
ew32(IAM, ~E1000_EIAC_MASK_82574 | E1000_IMS_OTHER);
|
||||
ctrl_ext |= E1000_CTRL_EXT_EIAME;
|
||||
ctrl_ext = er32(CTRL_EXT) & ~E1000_CTRL_EXT_IAME;
|
||||
ctrl_ext |= E1000_CTRL_EXT_PBA_CLR | E1000_CTRL_EXT_EIAME;
|
||||
ew32(CTRL_EXT, ctrl_ext);
|
||||
e1e_flush();
|
||||
}
|
||||
@ -2255,7 +2240,7 @@ static void e1000_irq_enable(struct e1000_adapter *adapter)
|
||||
|
||||
if (adapter->msix_entries) {
|
||||
ew32(EIAC_82574, adapter->eiac_mask & E1000_EIAC_MASK_82574);
|
||||
ew32(IMS, adapter->eiac_mask | E1000_IMS_OTHER | E1000_IMS_LSC);
|
||||
ew32(IMS, adapter->eiac_mask | E1000_IMS_LSC);
|
||||
} else if ((hw->mac.type == e1000_pch_lpt) ||
|
||||
(hw->mac.type == e1000_pch_spt)) {
|
||||
ew32(IMS, IMS_ENABLE_MASK | E1000_IMS_ECCER);
|
||||
@ -4146,10 +4131,24 @@ void e1000e_reset(struct e1000_adapter *adapter)
|
||||
|
||||
}
|
||||
|
||||
int e1000e_up(struct e1000_adapter *adapter)
|
||||
/**
|
||||
* e1000e_trigger_lsc - trigger an LSC interrupt
|
||||
* @adapter:
|
||||
*
|
||||
* Fire a link status change interrupt to start the watchdog.
|
||||
**/
|
||||
static void e1000e_trigger_lsc(struct e1000_adapter *adapter)
|
||||
{
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
|
||||
if (adapter->msix_entries)
|
||||
ew32(ICS, E1000_ICS_OTHER);
|
||||
else
|
||||
ew32(ICS, E1000_ICS_LSC);
|
||||
}
|
||||
|
||||
void e1000e_up(struct e1000_adapter *adapter)
|
||||
{
|
||||
/* hardware has been reset, we need to reload some things */
|
||||
e1000_configure(adapter);
|
||||
|
||||
@ -4161,13 +4160,7 @@ int e1000e_up(struct e1000_adapter *adapter)
|
||||
|
||||
netif_start_queue(adapter->netdev);
|
||||
|
||||
/* fire a link change interrupt to start the watchdog */
|
||||
if (adapter->msix_entries)
|
||||
ew32(ICS, E1000_ICS_LSC | E1000_ICR_OTHER);
|
||||
else
|
||||
ew32(ICS, E1000_ICS_LSC);
|
||||
|
||||
return 0;
|
||||
e1000e_trigger_lsc(adapter);
|
||||
}
|
||||
|
||||
static void e1000e_flush_descriptors(struct e1000_adapter *adapter)
|
||||
@ -4592,11 +4585,7 @@ static int e1000_open(struct net_device *netdev)
|
||||
hw->mac.get_link_status = true;
|
||||
pm_runtime_put(&pdev->dev);
|
||||
|
||||
/* fire a link status change interrupt to start the watchdog */
|
||||
if (adapter->msix_entries)
|
||||
ew32(ICS, E1000_ICS_LSC | E1000_ICR_OTHER);
|
||||
else
|
||||
ew32(ICS, E1000_ICS_LSC);
|
||||
e1000e_trigger_lsc(adapter);
|
||||
|
||||
return 0;
|
||||
|
||||
@ -6633,7 +6622,7 @@ static int e1000e_pm_runtime_resume(struct device *dev)
|
||||
return rc;
|
||||
|
||||
if (netdev->flags & IFF_UP)
|
||||
rc = e1000e_up(adapter);
|
||||
e1000e_up(adapter);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -6824,13 +6813,8 @@ static void e1000_io_resume(struct pci_dev *pdev)
|
||||
|
||||
e1000_init_manageability_pt(adapter);
|
||||
|
||||
if (netif_running(netdev)) {
|
||||
if (e1000e_up(adapter)) {
|
||||
dev_err(&pdev->dev,
|
||||
"can't bring device back up after reset\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (netif_running(netdev))
|
||||
e1000e_up(adapter);
|
||||
|
||||
netif_device_attach(netdev);
|
||||
|
||||
|
@ -45,8 +45,6 @@ static s32 igb_get_cfg_done_82575(struct e1000_hw *);
|
||||
static s32 igb_init_hw_82575(struct e1000_hw *);
|
||||
static s32 igb_phy_hw_reset_sgmii_82575(struct e1000_hw *);
|
||||
static s32 igb_read_phy_reg_sgmii_82575(struct e1000_hw *, u32, u16 *);
|
||||
static s32 igb_read_phy_reg_82580(struct e1000_hw *, u32, u16 *);
|
||||
static s32 igb_write_phy_reg_82580(struct e1000_hw *, u32, u16);
|
||||
static s32 igb_reset_hw_82575(struct e1000_hw *);
|
||||
static s32 igb_reset_hw_82580(struct e1000_hw *);
|
||||
static s32 igb_set_d0_lplu_state_82575(struct e1000_hw *, bool);
|
||||
@ -205,13 +203,10 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw)
|
||||
case e1000_82580:
|
||||
case e1000_i350:
|
||||
case e1000_i354:
|
||||
phy->ops.read_reg = igb_read_phy_reg_82580;
|
||||
phy->ops.write_reg = igb_write_phy_reg_82580;
|
||||
break;
|
||||
case e1000_i210:
|
||||
case e1000_i211:
|
||||
phy->ops.read_reg = igb_read_phy_reg_gs40g;
|
||||
phy->ops.write_reg = igb_write_phy_reg_gs40g;
|
||||
phy->ops.read_reg = igb_read_phy_reg_82580;
|
||||
phy->ops.write_reg = igb_write_phy_reg_82580;
|
||||
break;
|
||||
default:
|
||||
phy->ops.read_reg = igb_read_phy_reg_igp;
|
||||
@ -2153,7 +2148,7 @@ void igb_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable)
|
||||
* Reads the MDI control register in the PHY at offset and stores the
|
||||
* information read to data.
|
||||
**/
|
||||
static s32 igb_read_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 *data)
|
||||
s32 igb_read_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 *data)
|
||||
{
|
||||
s32 ret_val;
|
||||
|
||||
@ -2177,7 +2172,7 @@ out:
|
||||
*
|
||||
* Writes data to MDI control register in the PHY at offset.
|
||||
**/
|
||||
static s32 igb_write_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 data)
|
||||
s32 igb_write_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 data)
|
||||
{
|
||||
s32 ret_val;
|
||||
|
||||
|
@ -927,7 +927,10 @@
|
||||
|
||||
/* Intel i347-AT4 Registers */
|
||||
|
||||
#define I347AT4_PCDL 0x10 /* PHY Cable Diagnostics Length */
|
||||
#define I347AT4_PCDL0 0x10 /* Pair 0 PHY Cable Diagnostics Length */
|
||||
#define I347AT4_PCDL1 0x11 /* Pair 1 PHY Cable Diagnostics Length */
|
||||
#define I347AT4_PCDL2 0x12 /* Pair 2 PHY Cable Diagnostics Length */
|
||||
#define I347AT4_PCDL3 0x13 /* Pair 3 PHY Cable Diagnostics Length */
|
||||
#define I347AT4_PCDC 0x15 /* PHY Cable Diagnostics Control */
|
||||
#define I347AT4_PAGE_SELECT 0x16
|
||||
|
||||
|
@ -441,6 +441,7 @@ struct e1000_phy_info {
|
||||
u16 cable_length;
|
||||
u16 max_cable_length;
|
||||
u16 min_cable_length;
|
||||
u16 pair_length[4];
|
||||
|
||||
u8 mdix;
|
||||
|
||||
|
@ -861,10 +861,10 @@ s32 igb_pll_workaround_i210(struct e1000_hw *hw)
|
||||
if (ret_val)
|
||||
nvm_word = E1000_INVM_DEFAULT_AL;
|
||||
tmp_nvm = nvm_word | E1000_INVM_PLL_WO_VAL;
|
||||
igb_write_phy_reg_82580(hw, I347AT4_PAGE_SELECT, E1000_PHY_PLL_FREQ_PAGE);
|
||||
for (i = 0; i < E1000_MAX_PLL_TRIES; i++) {
|
||||
/* check current state directly from internal PHY */
|
||||
igb_read_phy_reg_gs40g(hw, (E1000_PHY_PLL_FREQ_PAGE |
|
||||
E1000_PHY_PLL_FREQ_REG), &phy_word);
|
||||
igb_read_phy_reg_82580(hw, E1000_PHY_PLL_FREQ_REG, &phy_word);
|
||||
if ((phy_word & E1000_PHY_PLL_UNCONF)
|
||||
!= E1000_PHY_PLL_UNCONF) {
|
||||
ret_val = 0;
|
||||
@ -896,6 +896,7 @@ s32 igb_pll_workaround_i210(struct e1000_hw *hw)
|
||||
/* restore WUC register */
|
||||
wr32(E1000_WUC, wuc);
|
||||
}
|
||||
igb_write_phy_reg_82580(hw, I347AT4_PAGE_SELECT, 0);
|
||||
/* restore MDICNFG setting */
|
||||
wr32(E1000_MDICNFG, mdicnfg);
|
||||
return ret_val;
|
||||
|
@ -85,7 +85,7 @@ enum E1000_INVM_STRUCTURE_TYPE {
|
||||
#define E1000_PCI_PMCSR_D3 0x03
|
||||
#define E1000_MAX_PLL_TRIES 5
|
||||
#define E1000_PHY_PLL_UNCONF 0xFF
|
||||
#define E1000_PHY_PLL_FREQ_PAGE 0xFC0000
|
||||
#define E1000_PHY_PLL_FREQ_PAGE 0xFC
|
||||
#define E1000_PHY_PLL_FREQ_REG 0x000E
|
||||
#define E1000_INVM_DEFAULT_AL 0x202F
|
||||
#define E1000_INVM_AUTOLOAD 0x0A
|
||||
|
@ -1717,32 +1717,15 @@ s32 igb_get_cable_length_m88_gen2(struct e1000_hw *hw)
|
||||
struct e1000_phy_info *phy = &hw->phy;
|
||||
s32 ret_val;
|
||||
u16 phy_data, phy_data2, index, default_page, is_cm;
|
||||
int len_tot = 0;
|
||||
u16 len_min;
|
||||
u16 len_max;
|
||||
|
||||
switch (hw->phy.id) {
|
||||
case I210_I_PHY_ID:
|
||||
/* Get cable length from PHY Cable Diagnostics Control Reg */
|
||||
ret_val = phy->ops.read_reg(hw, (0x7 << GS40G_PAGE_SHIFT) +
|
||||
(I347AT4_PCDL + phy->addr),
|
||||
&phy_data);
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
|
||||
/* Check if the unit of cable length is meters or cm */
|
||||
ret_val = phy->ops.read_reg(hw, (0x7 << GS40G_PAGE_SHIFT) +
|
||||
I347AT4_PCDC, &phy_data2);
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
|
||||
is_cm = !(phy_data2 & I347AT4_PCDC_CABLE_LENGTH_UNIT);
|
||||
|
||||
/* Populate the phy structure with cable length in meters */
|
||||
phy->min_cable_length = phy_data / (is_cm ? 100 : 1);
|
||||
phy->max_cable_length = phy_data / (is_cm ? 100 : 1);
|
||||
phy->cable_length = phy_data / (is_cm ? 100 : 1);
|
||||
break;
|
||||
case M88E1543_E_PHY_ID:
|
||||
case M88E1512_E_PHY_ID:
|
||||
case I347AT4_E_PHY_ID:
|
||||
case I210_I_PHY_ID:
|
||||
/* Remember the original page select and set it to 7 */
|
||||
ret_val = phy->ops.read_reg(hw, I347AT4_PAGE_SELECT,
|
||||
&default_page);
|
||||
@ -1753,12 +1736,6 @@ s32 igb_get_cable_length_m88_gen2(struct e1000_hw *hw)
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
/* Get cable length from PHY Cable Diagnostics Control Reg */
|
||||
ret_val = phy->ops.read_reg(hw, (I347AT4_PCDL + phy->addr),
|
||||
&phy_data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
/* Check if the unit of cable length is meters or cm */
|
||||
ret_val = phy->ops.read_reg(hw, I347AT4_PCDC, &phy_data2);
|
||||
if (ret_val)
|
||||
@ -1766,10 +1743,50 @@ s32 igb_get_cable_length_m88_gen2(struct e1000_hw *hw)
|
||||
|
||||
is_cm = !(phy_data2 & I347AT4_PCDC_CABLE_LENGTH_UNIT);
|
||||
|
||||
/* Get cable length from Pair 0 length Regs */
|
||||
ret_val = phy->ops.read_reg(hw, I347AT4_PCDL0, &phy_data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
phy->pair_length[0] = phy_data / (is_cm ? 100 : 1);
|
||||
len_tot = phy->pair_length[0];
|
||||
len_min = phy->pair_length[0];
|
||||
len_max = phy->pair_length[0];
|
||||
|
||||
/* Get cable length from Pair 1 length Regs */
|
||||
ret_val = phy->ops.read_reg(hw, I347AT4_PCDL1, &phy_data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
phy->pair_length[1] = phy_data / (is_cm ? 100 : 1);
|
||||
len_tot += phy->pair_length[1];
|
||||
len_min = min(len_min, phy->pair_length[1]);
|
||||
len_max = max(len_max, phy->pair_length[1]);
|
||||
|
||||
/* Get cable length from Pair 2 length Regs */
|
||||
ret_val = phy->ops.read_reg(hw, I347AT4_PCDL2, &phy_data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
phy->pair_length[2] = phy_data / (is_cm ? 100 : 1);
|
||||
len_tot += phy->pair_length[2];
|
||||
len_min = min(len_min, phy->pair_length[2]);
|
||||
len_max = max(len_max, phy->pair_length[2]);
|
||||
|
||||
/* Get cable length from Pair 3 length Regs */
|
||||
ret_val = phy->ops.read_reg(hw, I347AT4_PCDL3, &phy_data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
phy->pair_length[3] = phy_data / (is_cm ? 100 : 1);
|
||||
len_tot += phy->pair_length[3];
|
||||
len_min = min(len_min, phy->pair_length[3]);
|
||||
len_max = max(len_max, phy->pair_length[3]);
|
||||
|
||||
/* Populate the phy structure with cable length in meters */
|
||||
phy->min_cable_length = phy_data / (is_cm ? 100 : 1);
|
||||
phy->max_cable_length = phy_data / (is_cm ? 100 : 1);
|
||||
phy->cable_length = phy_data / (is_cm ? 100 : 1);
|
||||
phy->min_cable_length = len_min;
|
||||
phy->max_cable_length = len_max;
|
||||
phy->cable_length = len_tot / 4;
|
||||
|
||||
/* Reset the page selec to its original value */
|
||||
ret_val = phy->ops.write_reg(hw, I347AT4_PAGE_SELECT,
|
||||
@ -2587,66 +2604,6 @@ out:
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* igb_write_phy_reg_gs40g - Write GS40G PHY register
|
||||
* @hw: pointer to the HW structure
|
||||
* @offset: lower half is register offset to write to
|
||||
* upper half is page to use.
|
||||
* @data: data to write at register offset
|
||||
*
|
||||
* Acquires semaphore, if necessary, then writes the data to PHY register
|
||||
* at the offset. Release any acquired semaphores before exiting.
|
||||
**/
|
||||
s32 igb_write_phy_reg_gs40g(struct e1000_hw *hw, u32 offset, u16 data)
|
||||
{
|
||||
s32 ret_val;
|
||||
u16 page = offset >> GS40G_PAGE_SHIFT;
|
||||
|
||||
offset = offset & GS40G_OFFSET_MASK;
|
||||
ret_val = hw->phy.ops.acquire(hw);
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
|
||||
ret_val = igb_write_phy_reg_mdic(hw, GS40G_PAGE_SELECT, page);
|
||||
if (ret_val)
|
||||
goto release;
|
||||
ret_val = igb_write_phy_reg_mdic(hw, offset, data);
|
||||
|
||||
release:
|
||||
hw->phy.ops.release(hw);
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* igb_read_phy_reg_gs40g - Read GS40G PHY register
|
||||
* @hw: pointer to the HW structure
|
||||
* @offset: lower half is register offset to read to
|
||||
* upper half is page to use.
|
||||
* @data: data to read at register offset
|
||||
*
|
||||
* Acquires semaphore, if necessary, then reads the data in the PHY register
|
||||
* at the offset. Release any acquired semaphores before exiting.
|
||||
**/
|
||||
s32 igb_read_phy_reg_gs40g(struct e1000_hw *hw, u32 offset, u16 *data)
|
||||
{
|
||||
s32 ret_val;
|
||||
u16 page = offset >> GS40G_PAGE_SHIFT;
|
||||
|
||||
offset = offset & GS40G_OFFSET_MASK;
|
||||
ret_val = hw->phy.ops.acquire(hw);
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
|
||||
ret_val = igb_write_phy_reg_mdic(hw, GS40G_PAGE_SELECT, page);
|
||||
if (ret_val)
|
||||
goto release;
|
||||
ret_val = igb_read_phy_reg_mdic(hw, offset, data);
|
||||
|
||||
release:
|
||||
hw->phy.ops.release(hw);
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* igb_set_master_slave_mode - Setup PHY for Master/slave mode
|
||||
* @hw: pointer to the HW structure
|
||||
|
@ -72,8 +72,8 @@ s32 igb_copper_link_setup_82580(struct e1000_hw *hw);
|
||||
s32 igb_get_phy_info_82580(struct e1000_hw *hw);
|
||||
s32 igb_phy_force_speed_duplex_82580(struct e1000_hw *hw);
|
||||
s32 igb_get_cable_length_82580(struct e1000_hw *hw);
|
||||
s32 igb_read_phy_reg_gs40g(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
s32 igb_write_phy_reg_gs40g(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
s32 igb_read_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
s32 igb_write_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
s32 igb_check_polarity_m88(struct e1000_hw *hw);
|
||||
|
||||
/* IGP01E1000 Specific Registers */
|
||||
@ -144,17 +144,6 @@ s32 igb_check_polarity_m88(struct e1000_hw *hw);
|
||||
|
||||
#define E1000_CABLE_LENGTH_UNDEFINED 0xFF
|
||||
|
||||
/* GS40G - I210 PHY defines */
|
||||
#define GS40G_PAGE_SELECT 0x16
|
||||
#define GS40G_PAGE_SHIFT 16
|
||||
#define GS40G_OFFSET_MASK 0xFFFF
|
||||
#define GS40G_PAGE_2 0x20000
|
||||
#define GS40G_MAC_REG2 0x15
|
||||
#define GS40G_MAC_LB 0x4140
|
||||
#define GS40G_MAC_SPEED_1G 0X0006
|
||||
#define GS40G_COPPER_SPEC 0x0010
|
||||
#define GS40G_LINE_LB 0x4000
|
||||
|
||||
/* SFP modules ID memory locations */
|
||||
#define E1000_SFF_IDENTIFIER_OFFSET 0x00
|
||||
#define E1000_SFF_IDENTIFIER_SFF 0x02
|
||||
|
@ -127,10 +127,20 @@ static const struct igb_stats igb_gstrings_net_stats[] = {
|
||||
#define IGB_STATS_LEN \
|
||||
(IGB_GLOBAL_STATS_LEN + IGB_NETDEV_STATS_LEN + IGB_QUEUE_STATS_LEN)
|
||||
|
||||
enum igb_diagnostics_results {
|
||||
TEST_REG = 0,
|
||||
TEST_EEP,
|
||||
TEST_IRQ,
|
||||
TEST_LOOP,
|
||||
TEST_LINK
|
||||
};
|
||||
|
||||
static const char igb_gstrings_test[][ETH_GSTRING_LEN] = {
|
||||
"Register test (offline)", "Eeprom test (offline)",
|
||||
"Interrupt test (offline)", "Loopback test (offline)",
|
||||
"Link test (on/offline)"
|
||||
[TEST_REG] = "Register test (offline)",
|
||||
[TEST_EEP] = "Eeprom test (offline)",
|
||||
[TEST_IRQ] = "Interrupt test (offline)",
|
||||
[TEST_LOOP] = "Loopback test (offline)",
|
||||
[TEST_LINK] = "Link test (on/offline)"
|
||||
};
|
||||
#define IGB_TEST_LEN (sizeof(igb_gstrings_test) / ETH_GSTRING_LEN)
|
||||
|
||||
@ -2002,7 +2012,7 @@ static void igb_diag_test(struct net_device *netdev,
|
||||
/* Link test performed before hardware reset so autoneg doesn't
|
||||
* interfere with test result
|
||||
*/
|
||||
if (igb_link_test(adapter, &data[4]))
|
||||
if (igb_link_test(adapter, &data[TEST_LINK]))
|
||||
eth_test->flags |= ETH_TEST_FL_FAILED;
|
||||
|
||||
if (if_running)
|
||||
@ -2011,21 +2021,21 @@ static void igb_diag_test(struct net_device *netdev,
|
||||
else
|
||||
igb_reset(adapter);
|
||||
|
||||
if (igb_reg_test(adapter, &data[0]))
|
||||
if (igb_reg_test(adapter, &data[TEST_REG]))
|
||||
eth_test->flags |= ETH_TEST_FL_FAILED;
|
||||
|
||||
igb_reset(adapter);
|
||||
if (igb_eeprom_test(adapter, &data[1]))
|
||||
if (igb_eeprom_test(adapter, &data[TEST_EEP]))
|
||||
eth_test->flags |= ETH_TEST_FL_FAILED;
|
||||
|
||||
igb_reset(adapter);
|
||||
if (igb_intr_test(adapter, &data[2]))
|
||||
if (igb_intr_test(adapter, &data[TEST_IRQ]))
|
||||
eth_test->flags |= ETH_TEST_FL_FAILED;
|
||||
|
||||
igb_reset(adapter);
|
||||
/* power up link for loopback test */
|
||||
igb_power_up_link(adapter);
|
||||
if (igb_loopback_test(adapter, &data[3]))
|
||||
if (igb_loopback_test(adapter, &data[TEST_LOOP]))
|
||||
eth_test->flags |= ETH_TEST_FL_FAILED;
|
||||
|
||||
/* restore speed, duplex, autoneg settings */
|
||||
@ -2045,16 +2055,16 @@ static void igb_diag_test(struct net_device *netdev,
|
||||
dev_info(&adapter->pdev->dev, "online testing starting\n");
|
||||
|
||||
/* PHY is powered down when interface is down */
|
||||
if (if_running && igb_link_test(adapter, &data[4]))
|
||||
if (if_running && igb_link_test(adapter, &data[TEST_LINK]))
|
||||
eth_test->flags |= ETH_TEST_FL_FAILED;
|
||||
else
|
||||
data[4] = 0;
|
||||
data[TEST_LINK] = 0;
|
||||
|
||||
/* Online tests aren't run; pass by default */
|
||||
data[0] = 0;
|
||||
data[1] = 0;
|
||||
data[2] = 0;
|
||||
data[3] = 0;
|
||||
data[TEST_REG] = 0;
|
||||
data[TEST_EEP] = 0;
|
||||
data[TEST_IRQ] = 0;
|
||||
data[TEST_LOOP] = 0;
|
||||
|
||||
clear_bit(__IGB_TESTING, &adapter->state);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user