[PATCH 2/3] e1000: implement support for smaller flash chips

Andrey Smirnov andrew.smirnov at gmail.com
Mon Oct 9 11:24:35 PDT 2017


On Mon, Oct 9, 2017 at 2:36 AM, Uwe Kleine-König
<u.kleine-koenig at pengutronix.de> wrote:
> In older revisions of the i210 data sheet (rev 2.8) M25PE80 (1 MiB) is still
> listed as supported. So check the full range of FLA.FL_SIZE which also
> simplifies the code.
>

Looks good to me:

Acked-by: Andrey Smirnov <andrew.smirnov at gmail.com>

> Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> ---
>  drivers/net/e1000/e1000.h  |  3 ---
>  drivers/net/e1000/eeprom.c | 14 +++-----------
>  2 files changed, 3 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
> index 2a29ef47e818..1bc57bf2760c 100644
> --- a/drivers/net/e1000/e1000.h
> +++ b/drivers/net/e1000/e1000.h
> @@ -2106,9 +2106,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 1a0c6e15abef..739bc17a519e 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");
> --
> 2.11.0
>



More information about the barebox mailing list