Skip to content

Commit 2a3cdea

Browse files
Aaron SierraJeff Kirsher
authored andcommitted
igb: Remove GS40G specific defines/functions
The I210 internal PHY can be accessed just as well with the access functions shared by 82580, I350, and I354 devices. A side effect of relying on the common functions, is that I210 cable length support is folded back into the common case which effectively reverts the following commit: commit 59f3010 Author: Carolyn Wyborny <[email protected]> Date: Wed Oct 10 04:42:59 2012 +0000 igb: Update get cable length function for i210/i211 Cc: Carolyn Wyborny <[email protected]> Signed-off-by: Aaron Sierra <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 386164d commit 2a3cdea

File tree

5 files changed

+11
-106
lines changed

5 files changed

+11
-106
lines changed

drivers/net/ethernet/intel/igb/e1000_82575.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ static s32 igb_get_cfg_done_82575(struct e1000_hw *);
4545
static s32 igb_init_hw_82575(struct e1000_hw *);
4646
static s32 igb_phy_hw_reset_sgmii_82575(struct e1000_hw *);
4747
static s32 igb_read_phy_reg_sgmii_82575(struct e1000_hw *, u32, u16 *);
48-
static s32 igb_read_phy_reg_82580(struct e1000_hw *, u32, u16 *);
49-
static s32 igb_write_phy_reg_82580(struct e1000_hw *, u32, u16);
5048
static s32 igb_reset_hw_82575(struct e1000_hw *);
5149
static s32 igb_reset_hw_82580(struct e1000_hw *);
5250
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)
205203
case e1000_82580:
206204
case e1000_i350:
207205
case e1000_i354:
208-
phy->ops.read_reg = igb_read_phy_reg_82580;
209-
phy->ops.write_reg = igb_write_phy_reg_82580;
210-
break;
211206
case e1000_i210:
212207
case e1000_i211:
213-
phy->ops.read_reg = igb_read_phy_reg_gs40g;
214-
phy->ops.write_reg = igb_write_phy_reg_gs40g;
208+
phy->ops.read_reg = igb_read_phy_reg_82580;
209+
phy->ops.write_reg = igb_write_phy_reg_82580;
215210
break;
216211
default:
217212
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)
21532148
* Reads the MDI control register in the PHY at offset and stores the
21542149
* information read to data.
21552150
**/
2156-
static s32 igb_read_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 *data)
2151+
s32 igb_read_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 *data)
21572152
{
21582153
s32 ret_val;
21592154

@@ -2177,7 +2172,7 @@ static s32 igb_read_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 *data)
21772172
*
21782173
* Writes data to MDI control register in the PHY at offset.
21792174
**/
2180-
static s32 igb_write_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 data)
2175+
s32 igb_write_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 data)
21812176
{
21822177
s32 ret_val;
21832178

drivers/net/ethernet/intel/igb/e1000_i210.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,10 +861,10 @@ s32 igb_pll_workaround_i210(struct e1000_hw *hw)
861861
if (ret_val)
862862
nvm_word = E1000_INVM_DEFAULT_AL;
863863
tmp_nvm = nvm_word | E1000_INVM_PLL_WO_VAL;
864+
igb_write_phy_reg_82580(hw, I347AT4_PAGE_SELECT, E1000_PHY_PLL_FREQ_PAGE);
864865
for (i = 0; i < E1000_MAX_PLL_TRIES; i++) {
865866
/* check current state directly from internal PHY */
866-
igb_read_phy_reg_gs40g(hw, (E1000_PHY_PLL_FREQ_PAGE |
867-
E1000_PHY_PLL_FREQ_REG), &phy_word);
867+
igb_read_phy_reg_82580(hw, E1000_PHY_PLL_FREQ_REG, &phy_word);
868868
if ((phy_word & E1000_PHY_PLL_UNCONF)
869869
!= E1000_PHY_PLL_UNCONF) {
870870
ret_val = 0;
@@ -896,6 +896,7 @@ s32 igb_pll_workaround_i210(struct e1000_hw *hw)
896896
/* restore WUC register */
897897
wr32(E1000_WUC, wuc);
898898
}
899+
igb_write_phy_reg_82580(hw, I347AT4_PAGE_SELECT, 0);
899900
/* restore MDICNFG setting */
900901
wr32(E1000_MDICNFG, mdicnfg);
901902
return ret_val;

drivers/net/ethernet/intel/igb/e1000_i210.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ enum E1000_INVM_STRUCTURE_TYPE {
8585
#define E1000_PCI_PMCSR_D3 0x03
8686
#define E1000_MAX_PLL_TRIES 5
8787
#define E1000_PHY_PLL_UNCONF 0xFF
88-
#define E1000_PHY_PLL_FREQ_PAGE 0xFC0000
88+
#define E1000_PHY_PLL_FREQ_PAGE 0xFC
8989
#define E1000_PHY_PLL_FREQ_REG 0x000E
9090
#define E1000_INVM_DEFAULT_AL 0x202F
9191
#define E1000_INVM_AUTOLOAD 0x0A

drivers/net/ethernet/intel/igb/e1000_phy.c

Lines changed: 1 addition & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,30 +1719,10 @@ s32 igb_get_cable_length_m88_gen2(struct e1000_hw *hw)
17191719
u16 phy_data, phy_data2, index, default_page, is_cm;
17201720

17211721
switch (hw->phy.id) {
1722-
case I210_I_PHY_ID:
1723-
/* Get cable length from PHY Cable Diagnostics Control Reg */
1724-
ret_val = phy->ops.read_reg(hw, (0x7 << GS40G_PAGE_SHIFT) +
1725-
(I347AT4_PCDL + phy->addr),
1726-
&phy_data);
1727-
if (ret_val)
1728-
return ret_val;
1729-
1730-
/* Check if the unit of cable length is meters or cm */
1731-
ret_val = phy->ops.read_reg(hw, (0x7 << GS40G_PAGE_SHIFT) +
1732-
I347AT4_PCDC, &phy_data2);
1733-
if (ret_val)
1734-
return ret_val;
1735-
1736-
is_cm = !(phy_data2 & I347AT4_PCDC_CABLE_LENGTH_UNIT);
1737-
1738-
/* Populate the phy structure with cable length in meters */
1739-
phy->min_cable_length = phy_data / (is_cm ? 100 : 1);
1740-
phy->max_cable_length = phy_data / (is_cm ? 100 : 1);
1741-
phy->cable_length = phy_data / (is_cm ? 100 : 1);
1742-
break;
17431722
case M88E1543_E_PHY_ID:
17441723
case M88E1512_E_PHY_ID:
17451724
case I347AT4_E_PHY_ID:
1725+
case I210_I_PHY_ID:
17461726
/* Remember the original page select and set it to 7 */
17471727
ret_val = phy->ops.read_reg(hw, I347AT4_PAGE_SELECT,
17481728
&default_page);
@@ -2587,66 +2567,6 @@ s32 igb_get_cable_length_82580(struct e1000_hw *hw)
25872567
return ret_val;
25882568
}
25892569

2590-
/**
2591-
* igb_write_phy_reg_gs40g - Write GS40G PHY register
2592-
* @hw: pointer to the HW structure
2593-
* @offset: lower half is register offset to write to
2594-
* upper half is page to use.
2595-
* @data: data to write at register offset
2596-
*
2597-
* Acquires semaphore, if necessary, then writes the data to PHY register
2598-
* at the offset. Release any acquired semaphores before exiting.
2599-
**/
2600-
s32 igb_write_phy_reg_gs40g(struct e1000_hw *hw, u32 offset, u16 data)
2601-
{
2602-
s32 ret_val;
2603-
u16 page = offset >> GS40G_PAGE_SHIFT;
2604-
2605-
offset = offset & GS40G_OFFSET_MASK;
2606-
ret_val = hw->phy.ops.acquire(hw);
2607-
if (ret_val)
2608-
return ret_val;
2609-
2610-
ret_val = igb_write_phy_reg_mdic(hw, GS40G_PAGE_SELECT, page);
2611-
if (ret_val)
2612-
goto release;
2613-
ret_val = igb_write_phy_reg_mdic(hw, offset, data);
2614-
2615-
release:
2616-
hw->phy.ops.release(hw);
2617-
return ret_val;
2618-
}
2619-
2620-
/**
2621-
* igb_read_phy_reg_gs40g - Read GS40G PHY register
2622-
* @hw: pointer to the HW structure
2623-
* @offset: lower half is register offset to read to
2624-
* upper half is page to use.
2625-
* @data: data to read at register offset
2626-
*
2627-
* Acquires semaphore, if necessary, then reads the data in the PHY register
2628-
* at the offset. Release any acquired semaphores before exiting.
2629-
**/
2630-
s32 igb_read_phy_reg_gs40g(struct e1000_hw *hw, u32 offset, u16 *data)
2631-
{
2632-
s32 ret_val;
2633-
u16 page = offset >> GS40G_PAGE_SHIFT;
2634-
2635-
offset = offset & GS40G_OFFSET_MASK;
2636-
ret_val = hw->phy.ops.acquire(hw);
2637-
if (ret_val)
2638-
return ret_val;
2639-
2640-
ret_val = igb_write_phy_reg_mdic(hw, GS40G_PAGE_SELECT, page);
2641-
if (ret_val)
2642-
goto release;
2643-
ret_val = igb_read_phy_reg_mdic(hw, offset, data);
2644-
2645-
release:
2646-
hw->phy.ops.release(hw);
2647-
return ret_val;
2648-
}
2649-
26502570
/**
26512571
* igb_set_master_slave_mode - Setup PHY for Master/slave mode
26522572
* @hw: pointer to the HW structure

drivers/net/ethernet/intel/igb/e1000_phy.h

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ s32 igb_copper_link_setup_82580(struct e1000_hw *hw);
7272
s32 igb_get_phy_info_82580(struct e1000_hw *hw);
7373
s32 igb_phy_force_speed_duplex_82580(struct e1000_hw *hw);
7474
s32 igb_get_cable_length_82580(struct e1000_hw *hw);
75-
s32 igb_read_phy_reg_gs40g(struct e1000_hw *hw, u32 offset, u16 *data);
76-
s32 igb_write_phy_reg_gs40g(struct e1000_hw *hw, u32 offset, u16 data);
75+
s32 igb_read_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 *data);
76+
s32 igb_write_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 data);
7777
s32 igb_check_polarity_m88(struct e1000_hw *hw);
7878

7979
/* IGP01E1000 Specific Registers */
@@ -144,17 +144,6 @@ s32 igb_check_polarity_m88(struct e1000_hw *hw);
144144

145145
#define E1000_CABLE_LENGTH_UNDEFINED 0xFF
146146

147-
/* GS40G - I210 PHY defines */
148-
#define GS40G_PAGE_SELECT 0x16
149-
#define GS40G_PAGE_SHIFT 16
150-
#define GS40G_OFFSET_MASK 0xFFFF
151-
#define GS40G_PAGE_2 0x20000
152-
#define GS40G_MAC_REG2 0x15
153-
#define GS40G_MAC_LB 0x4140
154-
#define GS40G_MAC_SPEED_1G 0X0006
155-
#define GS40G_COPPER_SPEC 0x0010
156-
#define GS40G_LINE_LB 0x4000
157-
158147
/* SFP modules ID memory locations */
159148
#define E1000_SFF_IDENTIFIER_OFFSET 0x00
160149
#define E1000_SFF_IDENTIFIER_SFF 0x02

0 commit comments

Comments
 (0)