Re: [U-Boot] [PATCH 2/2] usb: eth: smsc95xx: Add EEPROM access support

2014-10-07 Thread Pavel Machek
On Tue 2014-10-07 11:19:37, Alban Bedel wrote:
 Use the new ethernet eeprom API to allow the user to read/write the
 EEPROM.
 
 Change-Id: I21233b6ee805a75bd8a03ca12e22c41421b7629c
 Signed-off-by: Alban Bedel alban.be...@avionic-design.de
 ---
  drivers/usb/eth/smsc95xx.c | 199 
 +++--
  1 file changed, 192 insertions(+), 7 deletions(-)
 
 diff --git a/drivers/usb/eth/smsc95xx.c b/drivers/usb/eth/smsc95xx.c
 index 6bca34d..eb29565 100644
 --- a/drivers/usb/eth/smsc95xx.c
 +++ b/drivers/usb/eth/smsc95xx.c
 @@ -59,6 +59,8 @@
  
  #define E2P_CMD  0x30
  #define E2P_CMD_BUSY_0x8000
 +#define E2P_CMD_EWEN_0x2000
 +#define E2P_CMD_WRITE_   0x3000
  #define E2P_CMD_READ_0x
  #define E2P_CMD_TIMEOUT_ 0x0400
  #define E2P_CMD_LOADED_  0x0200
 @@ -146,6 +148,131 @@ struct smsc95xx_private {
   int have_hwaddr;  /* 1 if we have a hardware MAC address */
  };
  
 +#ifdef CONFIG_CMD_ETH_EEPROM

Is this layout common for all machines using this driver? If not, is
it worth comment which machine is it?

 +static u8 eeprom_defaults[] = {
 + /* 0x00 */
 + 0xA5,   /* Signature */
 + 0xFF, 0xFF, /* MAC bytes 0-1 */
 + 0xFF, 0xFF, /* MAC bytes 2-3 */
 + 0xFF, 0xFF, /* MAC bytes 4-5 */

Normally, we use all zeros for unset...?

Best regards,
Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] usb: eth: smsc95xx: Add EEPROM access support

2014-10-07 Thread Alban Bedel
On Tue, 7 Oct 2014 14:22:09 +0200
Pavel Machek pa...@denx.de wrote:

 On Tue 2014-10-07 11:19:37, Alban Bedel wrote:
  Use the new ethernet eeprom API to allow the user to read/write the
  EEPROM.
  
  Change-Id: I21233b6ee805a75bd8a03ca12e22c41421b7629c
  Signed-off-by: Alban Bedel alban.be...@avionic-design.de
  ---
   drivers/usb/eth/smsc95xx.c | 199 
  +++--
   1 file changed, 192 insertions(+), 7 deletions(-)
  
  diff --git a/drivers/usb/eth/smsc95xx.c b/drivers/usb/eth/smsc95xx.c
  index 6bca34d..eb29565 100644
  --- a/drivers/usb/eth/smsc95xx.c
  +++ b/drivers/usb/eth/smsc95xx.c
  @@ -59,6 +59,8 @@
   
   #define E2P_CMD0x30
   #define E2P_CMD_BUSY_  0x8000
  +#define E2P_CMD_EWEN_  0x2000
  +#define E2P_CMD_WRITE_ 0x3000
   #define E2P_CMD_READ_  0x
   #define E2P_CMD_TIMEOUT_   0x0400
   #define E2P_CMD_LOADED_0x0200
  @@ -146,6 +148,131 @@ struct smsc95xx_private {
  int have_hwaddr;  /* 1 if we have a hardware MAC address */
   };
   
  +#ifdef CONFIG_CMD_ETH_EEPROM
 
 Is this layout common for all machines using this driver? If not, is
 it worth comment which machine is it?

These are supposed to be the same values as would be used by the
controller when the eeprom is not programmed. So they are not machine
specific, however it is specific to the LAN9514, looking at the
datasheet for the LAN9500 the eeprom layout is different.

Then I'll submit a new version that use per chip defaults, as well
as allowing the board file to override the default data.

  +static u8 eeprom_defaults[] = {
  +   /* 0x00 */
  +   0xA5,   /* Signature */
  +   0xFF, 0xFF, /* MAC bytes 0-1 */
  +   0xFF, 0xFF, /* MAC bytes 2-3 */
  +   0xFF, 0xFF, /* MAC bytes 4-5 */
 
 Normally, we use all zeros for unset...?

That's what the controller use when the EEPROM hasn't been programmed,
but I'll change it to all 0.

Alban



signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] usb: eth: smsc95xx: Add EEPROM access support

2014-10-07 Thread Marek Vasut
On Tuesday, October 07, 2014 at 03:35:40 PM, Alban Bedel wrote:
 On Tue, 7 Oct 2014 14:22:09 +0200
 
 Pavel Machek pa...@denx.de wrote:
  On Tue 2014-10-07 11:19:37, Alban Bedel wrote:
   Use the new ethernet eeprom API to allow the user to read/write the
   EEPROM.
   
   Change-Id: I21233b6ee805a75bd8a03ca12e22c41421b7629c
   Signed-off-by: Alban Bedel alban.be...@avionic-design.de
   ---
   
drivers/usb/eth/smsc95xx.c | 199
+++-- 1 file changed, 192
insertions(+), 7 deletions(-)
   
   diff --git a/drivers/usb/eth/smsc95xx.c b/drivers/usb/eth/smsc95xx.c
   index 6bca34d..eb29565 100644
   --- a/drivers/usb/eth/smsc95xx.c
   +++ b/drivers/usb/eth/smsc95xx.c
   @@ -59,6 +59,8 @@
   
#define E2P_CMD  0x30
#define E2P_CMD_BUSY_0x8000
   
   +#define E2P_CMD_EWEN_0x2000
   +#define E2P_CMD_WRITE_   0x3000
   
#define E2P_CMD_READ_0x
#define E2P_CMD_TIMEOUT_ 0x0400
#define E2P_CMD_LOADED_  0x0200
   
   @@ -146,6 +148,131 @@ struct smsc95xx_private {
   
 int have_hwaddr;  /* 1 if we have a hardware MAC address */

};
   
   +#ifdef CONFIG_CMD_ETH_EEPROM
  
  Is this layout common for all machines using this driver? If not, is
  it worth comment which machine is it?
 
 These are supposed to be the same values as would be used by the
 controller when the eeprom is not programmed. So they are not machine
 specific, however it is specific to the LAN9514, looking at the
 datasheet for the LAN9500 the eeprom layout is different.
 
 Then I'll submit a new version that use per chip defaults, as well
 as allowing the board file to override the default data.
 
   +static u8 eeprom_defaults[] = {
   + /* 0x00 */
   + 0xA5,   /* Signature */
   + 0xFF, 0xFF, /* MAC bytes 0-1 */
   + 0xFF, 0xFF, /* MAC bytes 2-3 */
   + 0xFF, 0xFF, /* MAC bytes 4-5 */
  
  Normally, we use all zeros for unset...?
 
 That's what the controller use when the EEPROM hasn't been programmed,
 but I'll change it to all 0.

Well isn't it better to use these settings as defaults then ?

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] usb: eth: smsc95xx: Add EEPROM access support

2014-10-07 Thread Pavel Machek
Hi!

   +static u8 eeprom_defaults[] = {
   + /* 0x00 */
   + 0xA5,   /* Signature */
   + 0xFF, 0xFF, /* MAC bytes 0-1 */
   + 0xFF, 0xFF, /* MAC bytes 2-3 */
   + 0xFF, 0xFF, /* MAC bytes 4-5 */
  
  Normally, we use all zeros for unset...?
 
 That's what the controller use when the EEPROM hasn't been programmed,
 but I'll change it to all 0.

Aha, if this is in-controller-default, don't change it. But comment
explaining where this comes from would be nice.

Thanks,
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot