Skip to content

Commit a4f58f5

Browse files
bwallandavem330
authored andcommitted
e1000e: add support for 82577/82578 GbE LOM parts
This patch provides support for the next generation Intel desktop and mobile gigabit ethernet LOM adapters. These adapters are the follow-on parts to the LOMs tied to the prior ICH chipsets and are comprised of a MAC in the PCH chipset and an external PHY (82577 for mobile and 82578 for desktop versions). New features consist of PHY wakeup to save power by completely turning off the MAC while in Sx state, and 4K jumbo frames. Signed-off-by: Bruce Allan <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2adc55c commit a4f58f5

File tree

10 files changed

+1441
-68
lines changed

10 files changed

+1441
-68
lines changed

drivers/net/e1000e/82571.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,6 +1587,7 @@ static void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw)
15871587
static struct e1000_mac_operations e82571_mac_ops = {
15881588
/* .check_mng_mode: mac type dependent */
15891589
/* .check_for_link: media type dependent */
1590+
.id_led_init = e1000e_id_led_init,
15901591
.cleanup_led = e1000e_cleanup_led_generic,
15911592
.clear_hw_cntrs = e1000_clear_hw_cntrs_82571,
15921593
.get_bus_info = e1000e_get_bus_info_pcie,
@@ -1598,6 +1599,7 @@ static struct e1000_mac_operations e82571_mac_ops = {
15981599
.init_hw = e1000_init_hw_82571,
15991600
.setup_link = e1000_setup_link_82571,
16001601
/* .setup_physical_interface: media type dependent */
1602+
.setup_led = e1000e_setup_led_generic,
16011603
};
16021604

16031605
static struct e1000_phy_operations e82_phy_ops_igp = {

drivers/net/e1000e/defines.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
/* Wake Up Control */
5757
#define E1000_WUC_APME 0x00000001 /* APM Enable */
5858
#define E1000_WUC_PME_EN 0x00000002 /* PME Enable */
59+
#define E1000_WUC_PHY_WAKE 0x00000100 /* if PHY supports wakeup */
5960

6061
/* Wake Up Filter Control */
6162
#define E1000_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */
@@ -65,6 +66,13 @@
6566
#define E1000_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */
6667
#define E1000_WUFC_ARP 0x00000020 /* ARP Request Packet Wakeup Enable */
6768

69+
/* Wake Up Status */
70+
#define E1000_WUS_LNKC E1000_WUFC_LNKC
71+
#define E1000_WUS_MAG E1000_WUFC_MAG
72+
#define E1000_WUS_EX E1000_WUFC_EX
73+
#define E1000_WUS_MC E1000_WUFC_MC
74+
#define E1000_WUS_BC E1000_WUFC_BC
75+
6876
/* Extended Device Control */
6977
#define E1000_CTRL_EXT_SDP7_DATA 0x00000080 /* Value of SW Definable Pin 7 */
7078
#define E1000_CTRL_EXT_EE_RST 0x00002000 /* Reinitialize from EEPROM */
@@ -77,6 +85,7 @@
7785
#define E1000_CTRL_EXT_IAME 0x08000000 /* Interrupt acknowledge Auto-mask */
7886
#define E1000_CTRL_EXT_INT_TIMER_CLR 0x20000000 /* Clear Interrupt timers after IMS clear */
7987
#define E1000_CTRL_EXT_PBA_CLR 0x80000000 /* PBA Clear */
88+
#define E1000_CTRL_EXT_PHYPDEN 0x00100000
8089

8190
/* Receive Descriptor bit definitions */
8291
#define E1000_RXD_STAT_DD 0x01 /* Descriptor Done */
@@ -140,6 +149,7 @@
140149
#define E1000_RCTL_DTYP_PS 0x00000400 /* Packet Split descriptor */
141150
#define E1000_RCTL_RDMTS_HALF 0x00000000 /* Rx desc min threshold size */
142151
#define E1000_RCTL_MO_SHIFT 12 /* multicast offset shift */
152+
#define E1000_RCTL_MO_3 0x00003000 /* multicast offset 15:4 */
143153
#define E1000_RCTL_BAM 0x00008000 /* broadcast enable */
144154
/* these buffer sizes are valid if E1000_RCTL_BSEX is 0 */
145155
#define E1000_RCTL_SZ_2048 0x00000000 /* Rx buffer size 2048 */
@@ -153,6 +163,7 @@
153163
#define E1000_RCTL_VFE 0x00040000 /* vlan filter enable */
154164
#define E1000_RCTL_CFIEN 0x00080000 /* canonical form enable */
155165
#define E1000_RCTL_CFI 0x00100000 /* canonical form indicator */
166+
#define E1000_RCTL_PMCF 0x00800000 /* pass MAC control frames */
156167
#define E1000_RCTL_BSEX 0x02000000 /* Buffer size extension */
157168
#define E1000_RCTL_SECRC 0x04000000 /* Strip Ethernet CRC */
158169

@@ -255,11 +266,16 @@
255266
#define AUTONEG_ADVERTISE_SPEED_DEFAULT E1000_ALL_SPEED_DUPLEX
256267

257268
/* LED Control */
269+
#define E1000_PHY_LED0_MODE_MASK 0x00000007
270+
#define E1000_PHY_LED0_IVRT 0x00000008
271+
#define E1000_PHY_LED0_MASK 0x0000001F
272+
258273
#define E1000_LEDCTL_LED0_MODE_MASK 0x0000000F
259274
#define E1000_LEDCTL_LED0_MODE_SHIFT 0
260275
#define E1000_LEDCTL_LED0_IVRT 0x00000040
261276
#define E1000_LEDCTL_LED0_BLINK 0x00000080
262277

278+
#define E1000_LEDCTL_MODE_LINK_UP 0x2
263279
#define E1000_LEDCTL_MODE_LED_ON 0xE
264280
#define E1000_LEDCTL_MODE_LED_OFF 0xF
265281

@@ -676,6 +692,8 @@
676692
#define IFE_C_E_PHY_ID 0x02A80310
677693
#define BME1000_E_PHY_ID 0x01410CB0
678694
#define BME1000_E_PHY_ID_R2 0x01410CB1
695+
#define I82577_E_PHY_ID 0x01540050
696+
#define I82578_E_PHY_ID 0x004DD040
679697

680698
/* M88E1000 Specific Registers */
681699
#define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Register */
@@ -729,6 +747,9 @@
729747
#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK 0x0E00
730748
#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X 0x0800
731749

750+
#define I82578_EPSCR_DOWNSHIFT_ENABLE 0x0020
751+
#define I82578_EPSCR_DOWNSHIFT_COUNTER_MASK 0x001C
752+
732753
/* BME1000 PHY Specific Control Register */
733754
#define BME1000_PSCR_ENABLE_DOWNSHIFT 0x0800 /* 1 = enable downshift */
734755

drivers/net/e1000e/e1000.h

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,49 @@ struct e1000_info;
9898

9999
#define DEFAULT_JUMBO 9234
100100

101+
/* BM/HV Specific Registers */
102+
#define BM_PORT_CTRL_PAGE 769
103+
104+
#define PHY_UPPER_SHIFT 21
105+
#define BM_PHY_REG(page, reg) \
106+
(((reg) & MAX_PHY_REG_ADDRESS) |\
107+
(((page) & 0xFFFF) << PHY_PAGE_SHIFT) |\
108+
(((reg) & ~MAX_PHY_REG_ADDRESS) << (PHY_UPPER_SHIFT - PHY_PAGE_SHIFT)))
109+
110+
/* PHY Wakeup Registers and defines */
111+
#define BM_RCTL PHY_REG(BM_WUC_PAGE, 0)
112+
#define BM_WUC PHY_REG(BM_WUC_PAGE, 1)
113+
#define BM_WUFC PHY_REG(BM_WUC_PAGE, 2)
114+
#define BM_WUS PHY_REG(BM_WUC_PAGE, 3)
115+
#define BM_RAR_L(_i) (BM_PHY_REG(BM_WUC_PAGE, 16 + ((_i) << 2)))
116+
#define BM_RAR_M(_i) (BM_PHY_REG(BM_WUC_PAGE, 17 + ((_i) << 2)))
117+
#define BM_RAR_H(_i) (BM_PHY_REG(BM_WUC_PAGE, 18 + ((_i) << 2)))
118+
#define BM_RAR_CTRL(_i) (BM_PHY_REG(BM_WUC_PAGE, 19 + ((_i) << 2)))
119+
#define BM_MTA(_i) (BM_PHY_REG(BM_WUC_PAGE, 128 + ((_i) << 1)))
120+
121+
#define BM_RCTL_UPE 0x0001 /* Unicast Promiscuous Mode */
122+
#define BM_RCTL_MPE 0x0002 /* Multicast Promiscuous Mode */
123+
#define BM_RCTL_MO_SHIFT 3 /* Multicast Offset Shift */
124+
#define BM_RCTL_MO_MASK (3 << 3) /* Multicast Offset Mask */
125+
#define BM_RCTL_BAM 0x0020 /* Broadcast Accept Mode */
126+
#define BM_RCTL_PMCF 0x0040 /* Pass MAC Control Frames */
127+
#define BM_RCTL_RFCE 0x0080 /* Rx Flow Control Enable */
128+
129+
#define HV_SCC_UPPER PHY_REG(778, 16) /* Single Collision Count */
130+
#define HV_SCC_LOWER PHY_REG(778, 17)
131+
#define HV_ECOL_UPPER PHY_REG(778, 18) /* Excessive Collision Count */
132+
#define HV_ECOL_LOWER PHY_REG(778, 19)
133+
#define HV_MCC_UPPER PHY_REG(778, 20) /* Multiple Collision Count */
134+
#define HV_MCC_LOWER PHY_REG(778, 21)
135+
#define HV_LATECOL_UPPER PHY_REG(778, 23) /* Late Collision Count */
136+
#define HV_LATECOL_LOWER PHY_REG(778, 24)
137+
#define HV_COLC_UPPER PHY_REG(778, 25) /* Collision Count */
138+
#define HV_COLC_LOWER PHY_REG(778, 26)
139+
#define HV_DC_UPPER PHY_REG(778, 27) /* Defer Count */
140+
#define HV_DC_LOWER PHY_REG(778, 28)
141+
#define HV_TNCRS_UPPER PHY_REG(778, 29) /* Transmit with no CRS */
142+
#define HV_TNCRS_LOWER PHY_REG(778, 30)
143+
101144
enum e1000_boards {
102145
board_82571,
103146
board_82572,
@@ -108,6 +151,7 @@ enum e1000_boards {
108151
board_ich8lan,
109152
board_ich9lan,
110153
board_ich10lan,
154+
board_pchlan,
111155
};
112156

113157
struct e1000_queue_stats {
@@ -305,6 +349,7 @@ struct e1000_adapter {
305349
unsigned int flags2;
306350
struct work_struct downshift_task;
307351
struct work_struct update_phy_task;
352+
struct work_struct led_blink_task;
308353
};
309354

310355
struct e1000_info {
@@ -355,6 +400,7 @@ struct e1000_info {
355400

356401
/* CRC Stripping defines */
357402
#define FLAG2_CRC_STRIPPING (1 << 0)
403+
#define FLAG2_HAS_PHY_WAKEUP (1 << 1)
358404

359405
#define E1000_RX_DESC_PS(R, i) \
360406
(&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
@@ -408,6 +454,7 @@ extern struct e1000_info e1000_82583_info;
408454
extern struct e1000_info e1000_ich8_info;
409455
extern struct e1000_info e1000_ich9_info;
410456
extern struct e1000_info e1000_ich10_info;
457+
extern struct e1000_info e1000_pch_info;
411458
extern struct e1000_info e1000_es2_info;
412459

413460
extern s32 e1000e_read_pba_num(struct e1000_hw *hw, u32 *pba_num);
@@ -429,6 +476,7 @@ extern void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw);
429476
extern s32 e1000e_check_for_copper_link(struct e1000_hw *hw);
430477
extern s32 e1000e_check_for_fiber_link(struct e1000_hw *hw);
431478
extern s32 e1000e_check_for_serdes_link(struct e1000_hw *hw);
479+
extern s32 e1000e_setup_led_generic(struct e1000_hw *hw);
432480
extern s32 e1000e_cleanup_led_generic(struct e1000_hw *hw);
433481
extern s32 e1000e_led_on_generic(struct e1000_hw *hw);
434482
extern s32 e1000e_led_off_generic(struct e1000_hw *hw);
@@ -497,6 +545,15 @@ extern s32 e1000e_phy_reset_dsp(struct e1000_hw *hw);
497545
extern s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data);
498546
extern s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data);
499547
extern s32 e1000e_check_downshift(struct e1000_hw *hw);
548+
extern s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data);
549+
extern s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data);
550+
extern s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow);
551+
extern s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw);
552+
extern s32 e1000_copper_link_setup_82577(struct e1000_hw *hw);
553+
extern s32 e1000_check_polarity_82577(struct e1000_hw *hw);
554+
extern s32 e1000_get_phy_info_82577(struct e1000_hw *hw);
555+
extern s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw);
556+
extern s32 e1000_get_cable_length_82577(struct e1000_hw *hw);
500557

501558
static inline s32 e1000_phy_hw_reset(struct e1000_hw *hw)
502559
{

drivers/net/e1000e/es2lan.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,6 +1366,7 @@ static void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw)
13661366
}
13671367

13681368
static struct e1000_mac_operations es2_mac_ops = {
1369+
.id_led_init = e1000e_id_led_init,
13691370
.check_mng_mode = e1000e_check_mng_mode_generic,
13701371
/* check_for_link dependent on media type */
13711372
.cleanup_led = e1000e_cleanup_led_generic,
@@ -1379,6 +1380,7 @@ static struct e1000_mac_operations es2_mac_ops = {
13791380
.init_hw = e1000_init_hw_80003es2lan,
13801381
.setup_link = e1000e_setup_link,
13811382
/* setup_physical_interface dependent on media type */
1383+
.setup_led = e1000e_setup_led_generic,
13821384
};
13831385

13841386
static struct e1000_phy_operations es2_phy_ops = {

drivers/net/e1000e/ethtool.c

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
776776
u32 after;
777777
u32 i;
778778
u32 toggle;
779+
u32 mask;
779780

780781
/*
781782
* The status register is Read Only, so a write should fail.
@@ -788,17 +789,9 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
788789
case e1000_80003es2lan:
789790
toggle = 0x7FFFF3FF;
790791
break;
791-
case e1000_82573:
792-
case e1000_82574:
793-
case e1000_82583:
794-
case e1000_ich8lan:
795-
case e1000_ich9lan:
796-
case e1000_ich10lan:
792+
default:
797793
toggle = 0x7FFFF033;
798794
break;
799-
default:
800-
toggle = 0xFFFFF833;
801-
break;
802795
}
803796

804797
before = er32(STATUS);
@@ -844,11 +837,18 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
844837
REG_PATTERN_TEST(E1000_TXCW, 0xC000FFFF, 0x0000FFFF);
845838
REG_PATTERN_TEST(E1000_TDBAL, 0xFFFFFFF0, 0xFFFFFFFF);
846839
REG_PATTERN_TEST(E1000_TIDV, 0x0000FFFF, 0x0000FFFF);
840+
mask = 0x8003FFFF;
841+
switch (mac->type) {
842+
case e1000_ich10lan:
843+
case e1000_pchlan:
844+
mask |= (1 << 18);
845+
break;
846+
default:
847+
break;
848+
}
847849
for (i = 0; i < mac->rar_entry_count; i++)
848850
REG_PATTERN_TEST_ARRAY(E1000_RA, ((i << 1) + 1),
849-
((mac->type == e1000_ich10lan) ?
850-
0x8007FFFF : 0x8003FFFF),
851-
0xFFFFFFFF);
851+
mask, 0xFFFFFFFF);
852852

853853
for (i = 0; i < mac->mta_reg_count; i++)
854854
REG_PATTERN_TEST_ARRAY(E1000_MTA, i, 0xFFFFFFFF, 0xFFFFFFFF);
@@ -1786,15 +1786,22 @@ static int e1000_set_wol(struct net_device *netdev,
17861786
/* bit defines for adapter->led_status */
17871787
#define E1000_LED_ON 0
17881788

1789-
static void e1000_led_blink_callback(unsigned long data)
1789+
static void e1000e_led_blink_task(struct work_struct *work)
17901790
{
1791-
struct e1000_adapter *adapter = (struct e1000_adapter *) data;
1791+
struct e1000_adapter *adapter = container_of(work,
1792+
struct e1000_adapter, led_blink_task);
17921793

17931794
if (test_and_change_bit(E1000_LED_ON, &adapter->led_status))
17941795
adapter->hw.mac.ops.led_off(&adapter->hw);
17951796
else
17961797
adapter->hw.mac.ops.led_on(&adapter->hw);
1798+
}
1799+
1800+
static void e1000_led_blink_callback(unsigned long data)
1801+
{
1802+
struct e1000_adapter *adapter = (struct e1000_adapter *) data;
17971803

1804+
schedule_work(&adapter->led_blink_task);
17981805
mod_timer(&adapter->blink_timer, jiffies + E1000_ID_INTERVAL);
17991806
}
18001807

@@ -1807,7 +1814,9 @@ static int e1000_phys_id(struct net_device *netdev, u32 data)
18071814
data = INT_MAX;
18081815

18091816
if ((hw->phy.type == e1000_phy_ife) ||
1817+
(hw->mac.type == e1000_pchlan) ||
18101818
(hw->mac.type == e1000_82574)) {
1819+
INIT_WORK(&adapter->led_blink_task, e1000e_led_blink_task);
18111820
if (!adapter->blink_timer.function) {
18121821
init_timer(&adapter->blink_timer);
18131822
adapter->blink_timer.function =

drivers/net/e1000e/hw.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,11 @@ enum e1e_registers {
193193
E1000_RXCSUM = 0x05000, /* Rx Checksum Control - RW */
194194
E1000_RFCTL = 0x05008, /* Receive Filter Control */
195195
E1000_MTA = 0x05200, /* Multicast Table Array - RW Array */
196-
E1000_RA = 0x05400, /* Receive Address - RW Array */
196+
E1000_RAL_BASE = 0x05400, /* Receive Address Low - RW */
197+
#define E1000_RAL(_n) (E1000_RAL_BASE + ((_n) * 8))
198+
#define E1000_RA (E1000_RAL(0))
199+
E1000_RAH_BASE = 0x05404, /* Receive Address High - RW */
200+
#define E1000_RAH(_n) (E1000_RAH_BASE + ((_n) * 8))
197201
E1000_VFTA = 0x05600, /* VLAN Filter Table Array - RW Array */
198202
E1000_WUC = 0x05800, /* Wakeup Control - RW */
199203
E1000_WUFC = 0x05808, /* Wakeup Filter Control - RW */
@@ -368,6 +372,10 @@ enum e1e_registers {
368372
#define E1000_DEV_ID_ICH10_R_BM_V 0x10CE
369373
#define E1000_DEV_ID_ICH10_D_BM_LM 0x10DE
370374
#define E1000_DEV_ID_ICH10_D_BM_LF 0x10DF
375+
#define E1000_DEV_ID_PCH_M_HV_LM 0x10EA
376+
#define E1000_DEV_ID_PCH_M_HV_LC 0x10EB
377+
#define E1000_DEV_ID_PCH_D_HV_DM 0x10EF
378+
#define E1000_DEV_ID_PCH_D_HV_DC 0x10F0
371379

372380
#define E1000_REVISION_4 4
373381

@@ -383,6 +391,7 @@ enum e1000_mac_type {
383391
e1000_ich8lan,
384392
e1000_ich9lan,
385393
e1000_ich10lan,
394+
e1000_pchlan,
386395
};
387396

388397
enum e1000_media_type {
@@ -417,6 +426,8 @@ enum e1000_phy_type {
417426
e1000_phy_igp_3,
418427
e1000_phy_ife,
419428
e1000_phy_bm,
429+
e1000_phy_82578,
430+
e1000_phy_82577,
420431
};
421432

422433
enum e1000_bus_width {
@@ -720,6 +731,7 @@ struct e1000_host_mng_command_info {
720731

721732
/* Function pointers and static data for the MAC. */
722733
struct e1000_mac_operations {
734+
s32 (*id_led_init)(struct e1000_hw *);
723735
bool (*check_mng_mode)(struct e1000_hw *);
724736
s32 (*check_for_link)(struct e1000_hw *);
725737
s32 (*cleanup_led)(struct e1000_hw *);
@@ -733,11 +745,13 @@ struct e1000_mac_operations {
733745
s32 (*init_hw)(struct e1000_hw *);
734746
s32 (*setup_link)(struct e1000_hw *);
735747
s32 (*setup_physical_interface)(struct e1000_hw *);
748+
s32 (*setup_led)(struct e1000_hw *);
736749
};
737750

738751
/* Function pointers for the PHY. */
739752
struct e1000_phy_operations {
740753
s32 (*acquire_phy)(struct e1000_hw *);
754+
s32 (*check_polarity)(struct e1000_hw *);
741755
s32 (*check_reset_block)(struct e1000_hw *);
742756
s32 (*commit_phy)(struct e1000_hw *);
743757
s32 (*force_speed_duplex)(struct e1000_hw *);

0 commit comments

Comments
 (0)