diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2017-10-19 15:07:39 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-10-19 15:07:39 +0200 |
commit | 489e3a0c1458f0cbe0513bed8adbc5bac101b6bf (patch) | |
tree | 2c1c1394afc41f969c0f698d122e7fb4c87f06fd /drivers | |
parent | b8c48a1111c8ddebe859860f16e2176fb6148c9f (diff) | |
parent | 2be8662f257e32370062fe5cdbbf7fb2eb1ff44e (diff) | |
download | barebox-489e3a0c1458f0cbe0513bed8adbc5bac101b6bf.tar.gz barebox-489e3a0c1458f0cbe0513bed8adbc5bac101b6bf.tar.xz |
Merge branch 'for-next/e1000'
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/e1000/e1000.h | 9 | ||||
-rw-r--r-- | drivers/net/e1000/eeprom.c | 27 | ||||
-rw-r--r-- | drivers/net/e1000/regio.c | 9 |
3 files changed, 17 insertions, 28 deletions
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h index e6b493c84c..f2da08b4d5 100644 --- a/drivers/net/e1000/e1000.h +++ b/drivers/net/e1000/e1000.h @@ -447,11 +447,11 @@ struct e1000_tx_desc { #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 @@ struct e1000_eeprom_info { #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 1a0c6e15ab..2a71fb1b15 100644 --- a/drivers/net/e1000/eeprom.c +++ b/drivers/net/e1000/eeprom.c @@ -414,17 +414,9 @@ int32_t e1000_init_eeprom_params(struct e1000_hw *hw) 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 int32_t e1000_spi_eeprom_ready(struct e1000_hw *hw) 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 1610d5851f..5b2740fbc2 100644 --- a/drivers/net/e1000/regio.c +++ b/drivers/net/e1000/regio.c @@ -16,6 +16,15 @@ static uint32_t e1000_true_offset(struct e1000_hw *hw, uint32_t reg) 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; |