All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] da830: add support to read mac addr from EEPROM
@ 2011-09-30 11:39 nagabhushana.netagunte at ti.com
  2011-09-30 15:49 ` Mike Frysinger
  2011-10-03 12:01 ` Nick Thompson
  0 siblings, 2 replies; 4+ messages in thread
From: nagabhushana.netagunte at ti.com @ 2011-09-30 11:39 UTC (permalink / raw)
  To: u-boot

From: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>

da830 boards have mac address stored in I2C EEPROM. This patch
adds support to restore mac address from EEPROM if environment variable
'ethaddr' is not set.

Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
Signed-off-by: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
---
 board/davinci/da8xxevm/da830evm.c |   20 ++++++++++++++++++++
 include/configs/da830evm.h        |    1 +
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/board/davinci/da8xxevm/da830evm.c b/board/davinci/da8xxevm/da830evm.c
index 0650653..69ed293 100644
--- a/board/davinci/da8xxevm/da830evm.c
+++ b/board/davinci/da8xxevm/da830evm.c
@@ -188,6 +188,26 @@ int board_init(void)
 
 #define PHY_SW_I2C_ADDR	0x5f /* Address of PHY on i2c bus */
 
+int misc_init_r(void)
+{
+	uint8_t eeprom_enetaddr[6];
+	uint8_t val[2];
+
+	if (!eth_getenv_enetaddr("ethaddr", eeprom_enetaddr)) {
+		/* Read Ethernet MAC address from EEPROM if available. */
+		if (dvevm_read_mac_address(eeprom_enetaddr))
+			/* Set Ethernet MAC address from EEPROM */
+			davinci_sync_env_enetaddr(eeprom_enetaddr);
+	}
+
+	val[0] = 0x01;
+	val[1] = 0x23;
+
+	if (i2c_write(PHY_SW_I2C_ADDR, 0, 0, val, 2))
+		printf("Ethernet switch start failed!\n");
+
+}
+
 /*
  * Initializes on-board ethernet controllers.
  */
diff --git a/include/configs/da830evm.h b/include/configs/da830evm.h
index 66fdea2..a451513 100644
--- a/include/configs/da830evm.h
+++ b/include/configs/da830evm.h
@@ -160,6 +160,7 @@
 /*
  * U-Boot general configuration
  */
+#define CONFIG_MISC_INIT_R
 #undef CONFIG_USE_IRQ			/* No IRQ/FIQ in U-Boot */
 #undef CONFIG_MISC_INIT_R
 #undef CONFIG_BOOTDELAY
-- 
1.6.2.4

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

* [U-Boot] [PATCH] da830: add support to read mac addr from EEPROM
  2011-09-30 11:39 [U-Boot] [PATCH] da830: add support to read mac addr from EEPROM nagabhushana.netagunte at ti.com
@ 2011-09-30 15:49 ` Mike Frysinger
  2011-10-03 12:01 ` Nick Thompson
  1 sibling, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2011-09-30 15:49 UTC (permalink / raw)
  To: u-boot

On Friday, September 30, 2011 07:39:59 nagabhushana.netagunte at ti.com wrote:
> --- a/board/davinci/da8xxevm/da830evm.c
> +++ b/board/davinci/da8xxevm/da830evm.c

this code looks fine ...

> --- a/include/configs/da830evm.h
> +++ b/include/configs/da830evm.h
>
> +#define CONFIG_MISC_INIT_R
>  #undef CONFIG_MISC_INIT_R

but NAK on this since i'm pretty sure this isn't doing what you're expecting
-mike

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

* [U-Boot] [PATCH] da830: add support to read mac addr from EEPROM
  2011-09-30 11:39 [U-Boot] [PATCH] da830: add support to read mac addr from EEPROM nagabhushana.netagunte at ti.com
  2011-09-30 15:49 ` Mike Frysinger
@ 2011-10-03 12:01 ` Nick Thompson
  2011-10-04 13:50   ` Netagunte, Nagabhushana
  1 sibling, 1 reply; 4+ messages in thread
From: Nick Thompson @ 2011-10-03 12:01 UTC (permalink / raw)
  To: u-boot

On 30/09/11 12:39, nagabhushana.netagunte at ti.com wrote:
> From: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
>
> da830 boards have mac address stored in I2C EEPROM. This patch
> adds support to restore mac address from EEPROM if environment variable
> 'ethaddr' is not set.
>
> Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
> Signed-off-by: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
> ---
>  board/davinci/da8xxevm/da830evm.c |   20 ++++++++++++++++++++
>  include/configs/da830evm.h        |    1 +
>  2 files changed, 21 insertions(+), 0 deletions(-)
>
> diff --git a/board/davinci/da8xxevm/da830evm.c b/board/davinci/da8xxevm/da830evm.c
> index 0650653..69ed293 100644
> --- a/board/davinci/da8xxevm/da830evm.c
> +++ b/board/davinci/da8xxevm/da830evm.c
> @@ -188,6 +188,26 @@ int board_init(void)
>  
>  #define PHY_SW_I2C_ADDR	0x5f /* Address of PHY on i2c bus */
>  
> +int misc_init_r(void)
> +{
> +	uint8_t eeprom_enetaddr[6];
> +	uint8_t val[2];
> +
> +	if (!eth_getenv_enetaddr("ethaddr", eeprom_enetaddr)) {
> +		/* Read Ethernet MAC address from EEPROM if available. */
> +		if (dvevm_read_mac_address(eeprom_enetaddr))
> +			/* Set Ethernet MAC address from EEPROM */
> +			davinci_sync_env_enetaddr(eeprom_enetaddr);
> +	}
> +
> +	val[0] = 0x01;
> +	val[1] = 0x23;
> +
> +	if (i2c_write(PHY_SW_I2C_ADDR, 0, 0, val, 2))
> +		printf("Ethernet switch start failed!\n");
> +
> +}
> +

There is already code to do this, in the same file, in board_eth_init(). Why the new code?

Nick.

>  /*
>   * Initializes on-board ethernet controllers.
>   */
> diff --git a/include/configs/da830evm.h b/include/configs/da830evm.h
> index 66fdea2..a451513 100644
> --- a/include/configs/da830evm.h
> +++ b/include/configs/da830evm.h
> @@ -160,6 +160,7 @@
>  /*
>   * U-Boot general configuration
>   */
> +#define CONFIG_MISC_INIT_R
>  #undef CONFIG_USE_IRQ			/* No IRQ/FIQ in U-Boot */
>  #undef CONFIG_MISC_INIT_R
>  #undef CONFIG_BOOTDELAY

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

* [U-Boot] [PATCH] da830: add support to read mac addr from EEPROM
  2011-10-03 12:01 ` Nick Thompson
@ 2011-10-04 13:50   ` Netagunte, Nagabhushana
  0 siblings, 0 replies; 4+ messages in thread
From: Netagunte, Nagabhushana @ 2011-10-04 13:50 UTC (permalink / raw)
  To: u-boot

Hi Nick,
On Mon, Oct 03, 2011 at 17:31:05, Nick Thompson wrote:
> On 30/09/11 12:39, nagabhushana.netagunte at ti.com wrote:
> > From: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
> >
> > da830 boards have mac address stored in I2C EEPROM. This patch adds 
> > support to restore mac address from EEPROM if environment variable 
> > 'ethaddr' is not set.
> >
> > Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
> > Signed-off-by: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
> > ---
> >  board/davinci/da8xxevm/da830evm.c |   20 ++++++++++++++++++++
> >  include/configs/da830evm.h        |    1 +
> >  2 files changed, 21 insertions(+), 0 deletions(-)
> >
> > diff --git a/board/davinci/da8xxevm/da830evm.c 
> > b/board/davinci/da8xxevm/da830evm.c
> > index 0650653..69ed293 100644
> > --- a/board/davinci/da8xxevm/da830evm.c
> > +++ b/board/davinci/da8xxevm/da830evm.c
> > @@ -188,6 +188,26 @@ int board_init(void)
> >  
> >  #define PHY_SW_I2C_ADDR	0x5f /* Address of PHY on i2c bus */
> >  
> > +int misc_init_r(void)
> > +{
> > +	uint8_t eeprom_enetaddr[6];
> > +	uint8_t val[2];
> > +
> > +	if (!eth_getenv_enetaddr("ethaddr", eeprom_enetaddr)) {
> > +		/* Read Ethernet MAC address from EEPROM if available. */
> > +		if (dvevm_read_mac_address(eeprom_enetaddr))
> > +			/* Set Ethernet MAC address from EEPROM */
> > +			davinci_sync_env_enetaddr(eeprom_enetaddr);
> > +	}
> > +
> > +	val[0] = 0x01;
> > +	val[1] = 0x23;
> > +
> > +	if (i2c_write(PHY_SW_I2C_ADDR, 0, 0, val, 2))
> > +		printf("Ethernet switch start failed!\n");
> > +
> > +}
> > +
> 
> There is already code to do this, in the same file, in board_eth_init(). Why the new code?
My bad. Will correct it.

Rgds,
Nag
> 
> Nick.
> 
> >  /*
> >   * Initializes on-board ethernet controllers.
> >   */
> > diff --git a/include/configs/da830evm.h b/include/configs/da830evm.h 
> > index 66fdea2..a451513 100644
> > --- a/include/configs/da830evm.h
> > +++ b/include/configs/da830evm.h
> > @@ -160,6 +160,7 @@
> >  /*
> >   * U-Boot general configuration
> >   */
> > +#define CONFIG_MISC_INIT_R
> >  #undef CONFIG_USE_IRQ			/* No IRQ/FIQ in U-Boot */
> >  #undef CONFIG_MISC_INIT_R
> >  #undef CONFIG_BOOTDELAY
> 
> 

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

end of thread, other threads:[~2011-10-04 13:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-30 11:39 [U-Boot] [PATCH] da830: add support to read mac addr from EEPROM nagabhushana.netagunte at ti.com
2011-09-30 15:49 ` Mike Frysinger
2011-10-03 12:01 ` Nick Thompson
2011-10-04 13:50   ` Netagunte, Nagabhushana

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.