Hello there!
I've recently stumbled about the fact that igb driver uses a wrong EEMNGCTL
register for some mac types.
This register is used in e1000_82575.c:igb_get_cfg_done_82575() and defined in
e1000_regs.h:
#define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */
But at least my i210 docs tell me a different offset for this register, 0x12030
to be exact. So I've added some code to use the correct register at least for
the Springville in my application (0x1533):
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c 2015-09-08
19:15:29.000000000 +0200
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c 2015-09-11
16:41:51.000000000 +0200
@@ -1259,8 +1258,18 @@
{
s32 timeout = PHY_CFG_TIMEOUT;
s32 ret_val = 0;
+ u32 reg;
u32 mask = E1000_NVM_CFG_DONE_PORT_0;
+ switch (hw->mac.type) {
+ case e1000_i210:
+ reg = E1000_EEMNGCTL_I210;
+ break;
+ default:
+ reg = E1000_EEMNGCTL;
+ break;
+ }
+
if (hw->bus.func == 1)
mask = E1000_NVM_CFG_DONE_PORT_1;
else if (hw->bus.func == E1000_FUNC_2)
@@ -1269,7 +1278,7 @@
mask = E1000_NVM_CFG_DONE_PORT_3;
while (timeout) {
- if (rd32(E1000_EEMNGCTL) & mask)
+ if (rd32(reg) & mask)
break;
usleep_range(1000,2000);
timeout--;
--- a/drivers/net/ethernet/intel/igb/e1000_regs.h 2015-09-11
16:27:55.000000000 +0200
+++ b/drivers/net/ethernet/intel/igb/e1000_regs.h 2015-09-11
16:42:02.000000000 +0200
@@ -70,6 +70,7 @@
#define E1000_PBS 0x01008 /* Packet Buffer Size */
#define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */
#define E1000_EEARBC_I210 0x12024 /* EEPROM Auto Read Bus Control */
+#define E1000_EEMNGCTL_I210 0x12030 /* MNG EEprom Control */
#define E1000_EEWR 0x0102C /* EEPROM Write Register - RW */
#define E1000_I2CCMD 0x01028 /* SFPI2C Command Register - RW */
#define E1000_FRTIMER 0x01048 /* Free Running Timer - RW */
With that change, I can save ~ 200ms while turning on Ethernet, which otherwise
get lost while waiting for the timeout.
However, I don't know which MAC types are really affected by the move of
EEMNGCTL. Maybe it's better to use a condition like (hw->mac.type >=
e1000_i210) or similar, or to expand the cases in the switch stmt. I think you
might know better ;-)
Roman
------------------------------------------------------------------------------
_______________________________________________
E1000-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit
http://communities.intel.com/community/wired