u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: e1000: do not attempt to set hwaddr for i210 without FLASH
@ 2021-04-16 20:25 Tim Harvey
  2021-04-23  0:11 ` Ramon Fried
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Harvey @ 2021-04-16 20:25 UTC (permalink / raw)
  To: u-boot

commit f1bcad22dd19 ("net: e1000: add support for writing to EEPROM")
adds support for storing hwaddr in EEPROM however i210 devices do not
support this and thus results in errors such as:
Warning: e1000#0 failed to set MAC address'

Check if a flash device is present and if not return -ENOSYS indicating
this is not supported.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 drivers/net/e1000.c | 4 ++++
 drivers/net/e1000.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index 694114eca7..60613b7df0 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -5673,6 +5673,10 @@ static int e1000_write_hwaddr(struct eth_device *dev)
 
 	DEBUGOUT("%s: mac=%pM\n", __func__, mac);
 
+	if ((hw->eeprom.type == e1000_eeprom_invm) &&
+	    !(E1000_READ_REG(hw, EECD) & E1000_EECD_FLASH_DETECTED_I210))
+		return -ENOSYS;
+
 	memset(current_mac, 0, 6);
 
 	/* Read from EEPROM, not from registers, to make sure
diff --git a/drivers/net/e1000.h b/drivers/net/e1000.h
index 072851ba31..082154a997 100644
--- a/drivers/net/e1000.h
+++ b/drivers/net/e1000.h
@@ -1245,6 +1245,7 @@ struct e1000_hw {
 #define E1000_EECD_FLUPD     0x00080000 /* Update FLASH */
 #define E1000_EECD_FLUPD_I210       0x00800000 /* Update FLASH */
 #define E1000_EECD_FLUDONE_I210     0x04000000 /* Update FLASH done*/
+#define E1000_EECD_FLASH_DETECTED_I210	0x00080000 /* FLASH detected */
 #define E1000_FLUDONE_ATTEMPTS      20000
 #define E1000_EECD_AUPDEN    0x00100000 /* Enable Autonomous FLASH update */
 #define E1000_EECD_SHADV     0x00200000 /* Shadow RAM Data Valid */
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] net: e1000: do not attempt to set hwaddr for i210 without FLASH
  2021-04-16 20:25 [PATCH] net: e1000: do not attempt to set hwaddr for i210 without FLASH Tim Harvey
@ 2021-04-23  0:11 ` Ramon Fried
  2021-06-11 16:01   ` Tim Harvey
  0 siblings, 1 reply; 4+ messages in thread
From: Ramon Fried @ 2021-04-23  0:11 UTC (permalink / raw)
  To: u-boot

On Fri, Apr 16, 2021 at 11:25 PM Tim Harvey <tharvey@gateworks.com> wrote:
>
> commit f1bcad22dd19 ("net: e1000: add support for writing to EEPROM")
> adds support for storing hwaddr in EEPROM however i210 devices do not
> support this and thus results in errors such as:
> Warning: e1000#0 failed to set MAC address'
>
> Check if a flash device is present and if not return -ENOSYS indicating
> this is not supported.
>
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
>  drivers/net/e1000.c | 4 ++++
>  drivers/net/e1000.h | 1 +
>  2 files changed, 5 insertions(+)
>
> diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
> index 694114eca7..60613b7df0 100644
> --- a/drivers/net/e1000.c
> +++ b/drivers/net/e1000.c
> @@ -5673,6 +5673,10 @@ static int e1000_write_hwaddr(struct eth_device *dev)
>
>         DEBUGOUT("%s: mac=%pM\n", __func__, mac);
>
> +       if ((hw->eeprom.type == e1000_eeprom_invm) &&
> +           !(E1000_READ_REG(hw, EECD) & E1000_EECD_FLASH_DETECTED_I210))
> +               return -ENOSYS;
> +
>         memset(current_mac, 0, 6);
>
>         /* Read from EEPROM, not from registers, to make sure
> diff --git a/drivers/net/e1000.h b/drivers/net/e1000.h
> index 072851ba31..082154a997 100644
> --- a/drivers/net/e1000.h
> +++ b/drivers/net/e1000.h
> @@ -1245,6 +1245,7 @@ struct e1000_hw {
>  #define E1000_EECD_FLUPD     0x00080000 /* Update FLASH */
>  #define E1000_EECD_FLUPD_I210       0x00800000 /* Update FLASH */
>  #define E1000_EECD_FLUDONE_I210     0x04000000 /* Update FLASH done*/
> +#define E1000_EECD_FLASH_DETECTED_I210 0x00080000 /* FLASH detected */
>  #define E1000_FLUDONE_ATTEMPTS      20000
>  #define E1000_EECD_AUPDEN    0x00100000 /* Enable Autonomous FLASH update */
>  #define E1000_EECD_SHADV     0x00200000 /* Shadow RAM Data Valid */
> --
> 2.17.1
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: e1000: do not attempt to set hwaddr for i210 without FLASH
  2021-04-23  0:11 ` Ramon Fried
@ 2021-06-11 16:01   ` Tim Harvey
  2021-06-12 18:23     ` Ramon Fried
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Harvey @ 2021-06-11 16:01 UTC (permalink / raw)
  To: Joe Hershberger, Ramon Fried
  Cc: Hannu Lounento, Martyn Welch, Sebastian Reichel, U-Boot Mailing List

On Thu, Apr 22, 2021 at 5:11 PM Ramon Fried <rfried.dev@gmail.com> wrote:
>
> On Fri, Apr 16, 2021 at 11:25 PM Tim Harvey <tharvey@gateworks.com> wrote:
> >
> > commit f1bcad22dd19 ("net: e1000: add support for writing to EEPROM")
> > adds support for storing hwaddr in EEPROM however i210 devices do not
> > support this and thus results in errors such as:
> > Warning: e1000#0 failed to set MAC address'
> >
> > Check if a flash device is present and if not return -ENOSYS indicating
> > this is not supported.
> >
> > Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> > ---
> >  drivers/net/e1000.c | 4 ++++
> >  drivers/net/e1000.h | 1 +
> >  2 files changed, 5 insertions(+)
> >
> > diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
> > index 694114eca7..60613b7df0 100644
> > --- a/drivers/net/e1000.c
> > +++ b/drivers/net/e1000.c
> > @@ -5673,6 +5673,10 @@ static int e1000_write_hwaddr(struct eth_device *dev)
> >
> >         DEBUGOUT("%s: mac=%pM\n", __func__, mac);
> >
> > +       if ((hw->eeprom.type == e1000_eeprom_invm) &&
> > +           !(E1000_READ_REG(hw, EECD) & E1000_EECD_FLASH_DETECTED_I210))
> > +               return -ENOSYS;
> > +
> >         memset(current_mac, 0, 6);
> >
> >         /* Read from EEPROM, not from registers, to make sure
> > diff --git a/drivers/net/e1000.h b/drivers/net/e1000.h
> > index 072851ba31..082154a997 100644
> > --- a/drivers/net/e1000.h
> > +++ b/drivers/net/e1000.h
> > @@ -1245,6 +1245,7 @@ struct e1000_hw {
> >  #define E1000_EECD_FLUPD     0x00080000 /* Update FLASH */
> >  #define E1000_EECD_FLUPD_I210       0x00800000 /* Update FLASH */
> >  #define E1000_EECD_FLUDONE_I210     0x04000000 /* Update FLASH done*/
> > +#define E1000_EECD_FLASH_DETECTED_I210 0x00080000 /* FLASH detected */
> >  #define E1000_FLUDONE_ATTEMPTS      20000
> >  #define E1000_EECD_AUPDEN    0x00100000 /* Enable Autonomous FLASH update */
> >  #define E1000_EECD_SHADV     0x00200000 /* Shadow RAM Data Valid */
> > --
> > 2.17.1
> >
> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>

Joe / Ramon,

Can one of you pick this up? If I need to re-submit with Ramon's
'reviewed by' please let me know.

Best regards,

Tim

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: e1000: do not attempt to set hwaddr for i210 without FLASH
  2021-06-11 16:01   ` Tim Harvey
@ 2021-06-12 18:23     ` Ramon Fried
  0 siblings, 0 replies; 4+ messages in thread
From: Ramon Fried @ 2021-06-12 18:23 UTC (permalink / raw)
  To: Tim Harvey, Joe Hershberger
  Cc: Hannu Lounento, Martyn Welch, Sebastian Reichel, U-Boot Mailing List

On Fri Jun 11, 2021 at 7:01 PM IDT, Tim Harvey wrote:
> On Thu, Apr 22, 2021 at 5:11 PM Ramon Fried <rfried.dev@gmail.com>
> wrote:
> >
> > On Fri, Apr 16, 2021 at 11:25 PM Tim Harvey <tharvey@gateworks.com> wrote:
> > >
> > > commit f1bcad22dd19 ("net: e1000: add support for writing to EEPROM")
> > > adds support for storing hwaddr in EEPROM however i210 devices do not
> > > support this and thus results in errors such as:
> > > Warning: e1000#0 failed to set MAC address'
> > >
> > > Check if a flash device is present and if not return -ENOSYS indicating
> > > this is not supported.
> > >
> > > Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> > > ---
> > >  drivers/net/e1000.c | 4 ++++
> > >  drivers/net/e1000.h | 1 +
> > >  2 files changed, 5 insertions(+)
> > >
> > > diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
> > > index 694114eca7..60613b7df0 100644
> > > --- a/drivers/net/e1000.c
> > > +++ b/drivers/net/e1000.c
> > > @@ -5673,6 +5673,10 @@ static int e1000_write_hwaddr(struct eth_device *dev)
> > >
> > >         DEBUGOUT("%s: mac=%pM\n", __func__, mac);
> > >
> > > +       if ((hw->eeprom.type == e1000_eeprom_invm) &&
> > > +           !(E1000_READ_REG(hw, EECD) & E1000_EECD_FLASH_DETECTED_I210))
> > > +               return -ENOSYS;
> > > +
> > >         memset(current_mac, 0, 6);
> > >
> > >         /* Read from EEPROM, not from registers, to make sure
> > > diff --git a/drivers/net/e1000.h b/drivers/net/e1000.h
> > > index 072851ba31..082154a997 100644
> > > --- a/drivers/net/e1000.h
> > > +++ b/drivers/net/e1000.h
> > > @@ -1245,6 +1245,7 @@ struct e1000_hw {
> > >  #define E1000_EECD_FLUPD     0x00080000 /* Update FLASH */
> > >  #define E1000_EECD_FLUPD_I210       0x00800000 /* Update FLASH */
> > >  #define E1000_EECD_FLUDONE_I210     0x04000000 /* Update FLASH done*/
> > > +#define E1000_EECD_FLASH_DETECTED_I210 0x00080000 /* FLASH detected */
> > >  #define E1000_FLUDONE_ATTEMPTS      20000
> > >  #define E1000_EECD_AUPDEN    0x00100000 /* Enable Autonomous FLASH update */
> > >  #define E1000_EECD_SHADV     0x00200000 /* Shadow RAM Data Valid */
> > > --
> > > 2.17.1
> > >
> > Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
>
> Joe / Ramon,
>
> Can one of you pick this up? If I need to re-submit with Ramon's
> 'reviewed by' please let me know.
>
> Best regards,
>
> Tim

Applied to u-boot-net/master, thanks!

Best regards,
Ramon Fried

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-12 18:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 20:25 [PATCH] net: e1000: do not attempt to set hwaddr for i210 without FLASH Tim Harvey
2021-04-23  0:11 ` Ramon Fried
2021-06-11 16:01   ` Tim Harvey
2021-06-12 18:23     ` Ramon Fried

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).