diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h index e6b493c..f2da08b 100644 --- a/drivers/net/e1000/e1000.h +++ b/drivers/net/e1000/e1000.h @@ -447,11 +447,11 @@ #define E1000_FLASHT 0x01028 /* FLASH Timer Register */ #define E1000_EEWR (E1000_MIGHT_BE_REMAPPED | 0x0102C) /* EEPROM Write Register - RW */ #define E1000_I210_EEWR 0x12018 /* EEPROM Write Register - RW */ -#define E1000_FLSWCTL 0x01030 /* FLASH control register */ +#define E1000_FLSWCTL (E1000_MIGHT_BE_REMAPPED | 0x01030) /* FLASH control register */ #define E1000_I210_FLSWCTL 0x12048 /* FLASH control register */ -#define E1000_FLSWDATA 0x01034 /* FLASH data register */ +#define E1000_FLSWDATA (E1000_MIGHT_BE_REMAPPED | 0x01034) /* FLASH data register */ #define E1000_I210_FLSWDATA 0x1204C /* FLASH data register */ -#define E1000_FLSWCNT 0x01038 /* FLASH Access Counter */ +#define E1000_FLSWCNT (E1000_MIGHT_BE_REMAPPED | 0x01038) /* FLASH Access Counter */ #define E1000_I210_FLSWCNT 0x12050 /* FLASH Access Counter */ #define E1000_FLOP 0x0103C /* FLASH Opcode Register */ #define E1000_ERT 0x02008 /* Early Rx Threshold - RW */ @@ -2105,9 +2105,6 @@ #define E1000_FLA 0x1201C #define E1000_FLA_FL_SIZE_SHIFT 17 #define E1000_FLA_FL_SIZE_MASK (0b111 << E1000_FLA_FL_SIZE_SHIFT) /* EEprom Size */ -#define E1000_FLA_FL_SIZE_2MB 0b101 -#define E1000_FLA_FL_SIZE_4MB 0b110 -#define E1000_FLA_FL_SIZE_8MB 0b111 #define E1000_FLSWCTL_ADDR(a) ((a) & 0x00FFFFFF) diff --git a/drivers/net/e1000/eeprom.c b/drivers/net/e1000/eeprom.c index 1a0c6e1..2a71fb1 100644 --- a/drivers/net/e1000/eeprom.c +++ b/drivers/net/e1000/eeprom.c @@ -414,17 +414,9 @@ fla &= E1000_FLA_FL_SIZE_MASK; fla >>= E1000_FLA_FL_SIZE_SHIFT; - switch (fla) { - case E1000_FLA_FL_SIZE_8MB: - eeprom->word_size = SZ_8M / 2; - break; - case E1000_FLA_FL_SIZE_4MB: - eeprom->word_size = SZ_4M / 2; - break; - case E1000_FLA_FL_SIZE_2MB: - eeprom->word_size = SZ_2M / 2; - break; - default: + if (fla) { + eeprom->word_size = (SZ_64K << fla) / 2; + } else { eeprom->word_size = 2048; dev_info(hw->dev, "Unprogrammed Flash detected, " "limiting access to first 4KB\n"); @@ -709,17 +701,8 @@ static int e1000_flash_mode_wait_for_idle(struct e1000_hw *hw) { - /* Strictly speaking we need to poll FLSWCTL.DONE only if we - * are executing this code after a reset event, but it - * shouldn't hurt to do this everytime, besided we need to - * poll got FLSWCTL.GLDONE to make sure that back to back - * calls to that function work correctly, since we finish - * execution by polling only FLSWCTL.DONE */ - - const int ret = e1000_poll_reg(hw, E1000_FLSWCTL, - E1000_FLSWCTL_DONE | E1000_FLSWCTL_GLDONE, - E1000_FLSWCTL_DONE | E1000_FLSWCTL_GLDONE, - SECOND); + const int ret = e1000_poll_reg(hw, E1000_FLSWCTL, E1000_FLSWCTL_DONE, + E1000_FLSWCTL_DONE, SECOND); if (ret < 0) dev_err(hw->dev, "Timeout waiting for FLSWCTL.DONE to be set\n"); diff --git a/drivers/net/e1000/regio.c b/drivers/net/e1000/regio.c index 1610d58..5b2740f 100644 --- a/drivers/net/e1000/regio.c +++ b/drivers/net/e1000/regio.c @@ -16,6 +16,15 @@ case E1000_EEMNGCTL: reg = E1000_I210_EEMNGCTL; break; + case E1000_FLSWCTL: + reg = E1000_I210_FLSWCTL; + break; + case E1000_FLSWCNT: + reg = E1000_I210_FLSWCNT; + break; + case E1000_FLSWDATA: + reg = E1000_I210_FLSWDATA; + break; } } reg &= ~E1000_MIGHT_BE_REMAPPED;