[PATCH 1/3] e1000: implement register mapping for E1000_{EERD,FLSW{CTL,DATA,CNT}}

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Mon Oct 9 11:33:00 PDT 2017


On Mon, Oct 09, 2017 at 11:22:34AM -0700, Andrey Smirnov wrote:
> On Mon, Oct 9, 2017 at 2:36 AM, Uwe Kleine-König
> <u.kleine-koenig at pengutronix.de> wrote:
> > Fixes: 4ff3269a70b5 ("e1000: Expose i210's external flash as MTD")
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> > ---
> >  drivers/net/e1000/e1000.h |  9 +++++----
> >  drivers/net/e1000/regio.c | 12 ++++++++++++
> >  2 files changed, 17 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
> > index e6b493c84cc1..2a29ef47e818 100644
> > --- a/drivers/net/e1000/e1000.h
> > +++ b/drivers/net/e1000/e1000.h
> > @@ -410,7 +410,8 @@ struct e1000_tx_desc {
> >  #define E1000_CTRL     0x00000 /* Device Control - RW */
> >  #define E1000_STATUS   0x00008 /* Device Status - RO */
> >  #define E1000_EECD     0x00010 /* EEPROM/Flash Control - RW */
> > -#define E1000_EERD     0x00014 /* EEPROM Read - RW */
> > +#define E1000_EERD     (E1000_MIGHT_BE_REMAPPED | 0x00014)     /* EEPROM Read - RW */
> > +#define E1000_I210_EERD     0x12014    /* EEPROM Read - RW */
> >  #define E1000_CTRL_EXT 0x00018 /* Extended Device Control - RW */
> >  #define E1000_MDIC     0x00020 /* MDI Control - RW */
> >  #define E1000_FCAL     0x00028 /* Flow Control Address Low - RW */
> > @@ -447,11 +448,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 */
> > diff --git a/drivers/net/e1000/regio.c b/drivers/net/e1000/regio.c
> > index 1610d5851f05..9ef325fb8581 100644
> > --- a/drivers/net/e1000/regio.c
> > +++ b/drivers/net/e1000/regio.c
> > @@ -7,6 +7,9 @@ static uint32_t e1000_true_offset(struct e1000_hw *hw, uint32_t reg)
> >         if (reg & E1000_MIGHT_BE_REMAPPED) {
> >                 if (hw->mac_type == e1000_igb) {
> >                         switch (reg) {
> > +                       case E1000_EERD:
> > +                               reg = E1000_I210_EERD;
> > +                               break;
> 
> Rev. 2.8 lists 0x00014 as alias for 0x12014 (that's why I didn't do
> any "re-mapping" here) is it not true?

I have 3.1 and didn't see the alias, but indeed it's there. So this hunk
can be dropped. Will send a v2.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |



More information about the barebox mailing list