All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH u-boot git] dm9000 EEPROM reading bugfix
@ 2009-04-12 22:35 David Brownell
  2009-04-12 23:04 ` David Brownell
  0 siblings, 1 reply; 8+ messages in thread
From: David Brownell @ 2009-04-12 22:35 UTC (permalink / raw)
  To: u-boot

From: David Brownell <dbrownell@users.sourceforge.net>

Make the U-Boot dm9000 driver read addresses from EEPROM just
like Linux does ... read six bytes, instead of reading twelve
bytes then discarding every one.

Using the right Ethernet address is a big win.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
 drivers/net/dm9000x.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -113,7 +113,7 @@ void eth_halt(void);
 static int dm9000_probe(void);
 static u16 phy_read(int);
 static void phy_write(int, u16);
-u16 read_srom_word(int);
+static void read_srom_word(int, u8 *);
 static u8 DM9000_ior(int);
 static void DM9000_iow(int reg, u8 value);
 
@@ -348,8 +348,8 @@ eth_init(bd_t * bd)
 	/* Set Node address */
 	if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
 #if !defined(CONFIG_AT91SAM9261EK)
-		for (i = 0; i < 6; i++)
-			enetaddr[i] = read_srom_word(i);
+		for (i = 0; i < 3; i++)
+			read_srom_word(i, enetaddr + 2 * i);
 		eth_setenv_enetaddr("ethaddr", enetaddr);
 #endif
 	}
@@ -541,14 +541,14 @@ eth_rx(void)
 /*
   Read a word data from SROM
 */
-u16
-read_srom_word(int offset)
+static void read_srom_word(int offset, u8 *to)
 {
 	DM9000_iow(DM9000_EPAR, offset);
 	DM9000_iow(DM9000_EPCR, 0x4);
 	udelay(8000);
 	DM9000_iow(DM9000_EPCR, 0x0);
-	return (DM9000_ior(DM9000_EPDRL) + (DM9000_ior(DM9000_EPDRH) << 8));
+	to[0] = DM9000_ior(DM9000_EPDRL);
+	to[1] = DM9000_ior(DM9000_EPDRH);
 }
 
 void

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

* [U-Boot] [PATCH u-boot git] dm9000 EEPROM reading bugfix
  2009-04-12 22:35 [U-Boot] [PATCH u-boot git] dm9000 EEPROM reading bugfix David Brownell
@ 2009-04-12 23:04 ` David Brownell
  2009-04-17  5:38   ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 8+ messages in thread
From: David Brownell @ 2009-04-12 23:04 UTC (permalink / raw)
  To: u-boot

On Sunday 12 April 2009, David Brownell wrote:
> 	 ... read six bytes, instead of reading twelve
> bytes then discarding every one.

Urgh, editing goof.  Should read "discarding every other one".

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

* [U-Boot] [PATCH u-boot git] dm9000 EEPROM reading bugfix
  2009-04-12 23:04 ` David Brownell
@ 2009-04-17  5:38   ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-17  6:15     ` David Brownell
  0 siblings, 1 reply; 8+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-04-17  5:38 UTC (permalink / raw)
  To: u-boot

On 16:04 Sun 12 Apr     , David Brownell wrote:
> On Sunday 12 April 2009, David Brownell wrote:
> > 	 ... read six bytes, instead of reading twelve
> > bytes then discarding every one.
> 
> Urgh, editing goof.  Should read "discarding every other one".
please send a new version

Best Regards,
J.

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

* [U-Boot] [PATCH u-boot git] dm9000 EEPROM reading bugfix
  2009-04-17  5:38   ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-17  6:15     ` David Brownell
  2009-04-17  7:29       ` Jean-Christophe PLAGNIOL-VILLARD
                         ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: David Brownell @ 2009-04-17  6:15 UTC (permalink / raw)
  To: u-boot

From: David Brownell <dbrownell@users.sourceforge.net>

Make the U-Boot dm9000 driver read addresses from EEPROM just
like Linux does ... read six bytes, instead of reading twelve
bytes and then discarding every other one.

Using the right Ethernet address is a big win.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
 drivers/net/dm9000x.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -113,7 +113,7 @@ void eth_halt(void);
 static int dm9000_probe(void);
 static u16 phy_read(int);
 static void phy_write(int, u16);
-u16 read_srom_word(int);
+static void read_srom_word(int, u8 *);
 static u8 DM9000_ior(int);
 static void DM9000_iow(int reg, u8 value);
 
@@ -348,8 +348,8 @@ eth_init(bd_t * bd)
 	/* Set Node address */
 	if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
 #if !defined(CONFIG_AT91SAM9261EK)
-		for (i = 0; i < 6; i++)
-			enetaddr[i] = read_srom_word(i);
+		for (i = 0; i < 3; i++)
+			read_srom_word(i, enetaddr + 2 * i);
 		eth_setenv_enetaddr("ethaddr", enetaddr);
 #endif
 	}
@@ -541,14 +541,14 @@ eth_rx(void)
 /*
   Read a word data from SROM
 */
-u16
-read_srom_word(int offset)
+static void read_srom_word(int offset, u8 *to)
 {
 	DM9000_iow(DM9000_EPAR, offset);
 	DM9000_iow(DM9000_EPCR, 0x4);
 	udelay(8000);
 	DM9000_iow(DM9000_EPCR, 0x0);
-	return (DM9000_ior(DM9000_EPDRL) + (DM9000_ior(DM9000_EPDRH) << 8));
+	to[0] = DM9000_ior(DM9000_EPDRL);
+	to[1] = DM9000_ior(DM9000_EPDRH);
 }
 
 void

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

* [U-Boot] [PATCH u-boot git] dm9000 EEPROM reading bugfix
  2009-04-17  6:15     ` David Brownell
@ 2009-04-17  7:29       ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-20  4:09         ` Ben Warren
  2009-04-25  7:44       ` Ben Warren
  2009-04-27 22:28       ` Wolfgang Denk
  2 siblings, 1 reply; 8+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-04-17  7:29 UTC (permalink / raw)
  To: u-boot

On 23:15 Thu 16 Apr     , David Brownell wrote:
> From: David Brownell <dbrownell@users.sourceforge.net>
> 
> Make the U-Boot dm9000 driver read addresses from EEPROM just
> like Linux does ... read six bytes, instead of reading twelve
> bytes and then discarding every other one.
> 
> Using the right Ethernet address is a big win.
> 
> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
look fine for me

Ben any comments?

Best Regards,
J.

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

* [U-Boot] [PATCH u-boot git] dm9000 EEPROM reading bugfix
  2009-04-17  7:29       ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-20  4:09         ` Ben Warren
  0 siblings, 0 replies; 8+ messages in thread
From: Ben Warren @ 2009-04-20  4:09 UTC (permalink / raw)
  To: u-boot

Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 23:15 Thu 16 Apr     , David Brownell wrote:
>   
>> From: David Brownell <dbrownell@users.sourceforge.net>
>>
>> Make the U-Boot dm9000 driver read addresses from EEPROM just
>> like Linux does ... read six bytes, instead of reading twelve
>> bytes and then discarding every other one.
>>
>> Using the right Ethernet address is a big win.
>>     
:)
>> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
>>     
> look fine for me
>
> Ben any comments?
>
> Best Regards,
> J.
>   
I'll apply to net/next

regards,
Ben

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

* [U-Boot] [PATCH u-boot git] dm9000 EEPROM reading bugfix
  2009-04-17  6:15     ` David Brownell
  2009-04-17  7:29       ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-25  7:44       ` Ben Warren
  2009-04-27 22:28       ` Wolfgang Denk
  2 siblings, 0 replies; 8+ messages in thread
From: Ben Warren @ 2009-04-25  7:44 UTC (permalink / raw)
  To: u-boot

Wolfgang,

David Brownell wrote:
> From: David Brownell <dbrownell@users.sourceforge.net>
>
> Make the U-Boot dm9000 driver read addresses from EEPROM just
> like Linux does ... read six bytes, instead of reading twelve
> bytes and then discarding every other one.
>
> Using the right Ethernet address is a big win.
>
> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
> ---
>  drivers/net/dm9000x.c |   12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> --- a/drivers/net/dm9000x.c
> +++ b/drivers/net/dm9000x.c
> @@ -113,7 +113,7 @@ void eth_halt(void);
>  static int dm9000_probe(void);
>  static u16 phy_read(int);
>  static void phy_write(int, u16);
> -u16 read_srom_word(int);
> +static void read_srom_word(int, u8 *);
>  static u8 DM9000_ior(int);
>  static void DM9000_iow(int reg, u8 value);
>  
> @@ -348,8 +348,8 @@ eth_init(bd_t * bd)
>  	/* Set Node address */
>  	if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
>  #if !defined(CONFIG_AT91SAM9261EK)
> -		for (i = 0; i < 6; i++)
> -			enetaddr[i] = read_srom_word(i);
> +		for (i = 0; i < 3; i++)
> +			read_srom_word(i, enetaddr + 2 * i);
>  		eth_setenv_enetaddr("ethaddr", enetaddr);
>  #endif
>  	}
> @@ -541,14 +541,14 @@ eth_rx(void)
>  /*
>    Read a word data from SROM
>  */
> -u16
> -read_srom_word(int offset)
> +static void read_srom_word(int offset, u8 *to)
>  {
>  	DM9000_iow(DM9000_EPAR, offset);
>  	DM9000_iow(DM9000_EPCR, 0x4);
>  	udelay(8000);
>  	DM9000_iow(DM9000_EPCR, 0x0);
> -	return (DM9000_ior(DM9000_EPDRL) + (DM9000_ior(DM9000_EPDRH) << 8));
> +	to[0] = DM9000_ior(DM9000_EPDRL);
> +	to[1] = DM9000_ior(DM9000_EPDRH);
>  }
>  
>  void
>
> ____
Please apply this directly. I incorrectly looked at it as a feature 
rather than a bug fix.

regards,
Ben

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

* [U-Boot] [PATCH u-boot git] dm9000 EEPROM reading bugfix
  2009-04-17  6:15     ` David Brownell
  2009-04-17  7:29       ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-25  7:44       ` Ben Warren
@ 2009-04-27 22:28       ` Wolfgang Denk
  2 siblings, 0 replies; 8+ messages in thread
From: Wolfgang Denk @ 2009-04-27 22:28 UTC (permalink / raw)
  To: u-boot

Dear David Brownell,

In message <200904162315.15209.david-b@pacbell.net> you wrote:
> From: David Brownell <dbrownell@users.sourceforge.net>
> 
> Make the U-Boot dm9000 driver read addresses from EEPROM just
> like Linux does ... read six bytes, instead of reading twelve
> bytes and then discarding every other one.
> 
> Using the right Ethernet address is a big win.
> 
> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
> ---
>  drivers/net/dm9000x.c |   12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I have a very small mind and must live with it.    -- Edsger Dijkstra

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

end of thread, other threads:[~2009-04-27 22:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-12 22:35 [U-Boot] [PATCH u-boot git] dm9000 EEPROM reading bugfix David Brownell
2009-04-12 23:04 ` David Brownell
2009-04-17  5:38   ` Jean-Christophe PLAGNIOL-VILLARD
2009-04-17  6:15     ` David Brownell
2009-04-17  7:29       ` Jean-Christophe PLAGNIOL-VILLARD
2009-04-20  4:09         ` Ben Warren
2009-04-25  7:44       ` Ben Warren
2009-04-27 22:28       ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.