* [PATCH RESEND] natsemi: fix timing issue for reading mac from eeprom via dp8381x
@ 2014-11-19 22:26 Roland Kletzing
2014-11-21 4:00 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Roland Kletzing @ 2014-11-19 22:26 UTC (permalink / raw)
To: netdev; +Cc: David Miller
Natsemi driver does not read MAC correctly from eeprom, while natsemi-diag
from nictools-pci does. Apparently, it`s a timing issue in the kernel driver.
According to ftp://ftp.gwdg.de/pub/linux/misc/donald.becker/diag/natsemi-diag.c
, eeprom_delay(ee_addr) is defined as follows:
/* Delay between EEPROM clock transitions.
This flushes the write buffer to prevent quick double-writes.
*/
#define eeprom_delay(ee_addr) inl(ee_addr); inl(ee_addr)
while in the natsemi linux kernel driver, the delay is done this way :
#define eeprom_delay(ee_addr) readl(ee_addr)
, which results in the MAC being all zero`s on my systems (old Geode GX1 board
like being used in Compaq Evo T20 or Wyse WT3235LE Thin Clients).
So i simply added a second readl() to increase delay (instead of turning into
inl() as proposed before). This may look a little bit ugly, but it`s fixing the
problem for me.
I´m not sure how many natsemi users being left on this planet (probably few),
but i guess this change does not do any harm on platforms where the driver does
not behave buggy, so please consider adding it to mainline/stable/longterm.
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=51791
Reported-by: Roland Kletzing <devzero@web.de>
Signed-off-by: Roland Kletzing <devzero@web.de>
---
drivers/net/ethernet/natsemi/natsemi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/natsemi/natsemi.c b/drivers/net/ethernet/natsemi/natsemi.c
index b83f7c0..96f0029 100644
--- a/drivers/net/ethernet/natsemi/natsemi.c
+++ b/drivers/net/ethernet/natsemi/natsemi.c
@@ -987,7 +987,7 @@ static int natsemi_probe1(struct pci_dev *pdev, const struct pci_device_id *ent)
The old method of using an ISA access as a delay, __SLOW_DOWN_IO__, is
deprecated.
*/
-#define eeprom_delay(ee_addr) readl(ee_addr)
+#define eeprom_delay(ee_addr) readl(ee_addr); readl(ee_addr)
#define EE_Write0 (EE_ChipSelect)
#define EE_Write1 (EE_ChipSelect | EE_DataIn)
--
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH RESEND] natsemi: fix timing issue for reading mac from eeprom via dp8381x
2014-11-19 22:26 [PATCH RESEND] natsemi: fix timing issue for reading mac from eeprom via dp8381x Roland Kletzing
@ 2014-11-21 4:00 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-11-21 4:00 UTC (permalink / raw)
To: devzero; +Cc: netdev
From: "Roland Kletzing" <devzero@web.de>
Date: Wed, 19 Nov 2014 23:26:11 +0100
> diff --git a/drivers/net/ethernet/natsemi/natsemi.c b/drivers/net/ethernet/natsemi/natsemi.c
> index b83f7c0..96f0029 100644
> --- a/drivers/net/ethernet/natsemi/natsemi.c
> +++ b/drivers/net/ethernet/natsemi/natsemi.c
> @@ -987,7 +987,7 @@ static int natsemi_probe1(struct pci_dev *pdev, const struct pci_device_id *ent)
> The old method of using an ISA access as a delay, __SLOW_DOWN_IO__, is
> deprecated.
> */
> -#define eeprom_delay(ee_addr) readl(ee_addr)
> +#define eeprom_delay(ee_addr) readl(ee_addr); readl(ee_addr)
Your email client has corrupted this patch, changing TAB characters
into sequences of spaces.
Also, you should not just have a macro expanding to two statements,
because now things like:
if (x)
eeprom_delay(addr);
doesn't do what you intended.
Either make this an inline function, or enclose the two readl()
statements inside of a "do { } while (0)"
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-21 4:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-19 22:26 [PATCH RESEND] natsemi: fix timing issue for reading mac from eeprom via dp8381x Roland Kletzing
2014-11-21 4:00 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox