All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] da850evm: basic MII EMAC support
@ 2010-09-10 20:10 Ben Gardiner
  2010-09-11  4:01 ` Mike Frysinger
  2010-09-13  3:45 ` Ben Warren
  0 siblings, 2 replies; 31+ messages in thread
From: Ben Gardiner @ 2010-09-10 20:10 UTC (permalink / raw)
  To: u-boot

The current da850evm support in u-boot/master [1] omits any use of
the davinci EMAC. This patch adds basic support for the EMAC using
the MII PHY found on the baseboard of the EVM. The MAC address is
read from the environment variable 'ethadd'. Note that this is
different from the da850evm support in the u-boot omapl1 tree
where the MAC address is read from SPI flash [2].

CC: Sandeep Paulraj <s-paulraj@ti.com>
CC: Sudhakar Rajashekhara <sudhakar.raj@ti.com>

[1] http://git.denx.de/?p=u-boot.git
[2] http://arago-project.org/git/projects/?p=u-boot-omapl1.git

---

I am submitting this patch for inclusion in v2010.12, not v2010.09 since it
introduces a new feature.

---
 board/davinci/da8xxevm/da850evm.c |   60 +++++++++++++++++++++++++++++++++++++
 include/configs/da850evm.h        |   15 +++++++++
 2 files changed, 75 insertions(+), 0 deletions(-)

diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index eeb456c..30645e5 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -23,7 +23,11 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <net.h>
+#include <netdev.h>
 #include <asm/arch/hardware.h>
+#include <asm/arch/emif_defs.h>
+#include <asm/arch/emac_defs.h>
 #include <asm/io.h>
 #include "../common/misc.h"
 #include "common.h"
@@ -48,6 +52,28 @@ static const struct pinmux_config uart_pins[] = {
 	{ pinmux(4), 2, 5 }
 };
 
+#ifdef CONFIG_DRIVER_TI_EMAC
+const struct pinmux_config emac_pins[] = {
+	{ pinmux(2), 8, 1 },
+	{ pinmux(2), 8, 2 },
+	{ pinmux(2), 8, 3 },
+	{ pinmux(2), 8, 4 },
+	{ pinmux(2), 8, 5 },
+	{ pinmux(2), 8, 6 },
+	{ pinmux(2), 8, 7 },
+	{ pinmux(3), 8, 0 },
+	{ pinmux(3), 8, 1 },
+	{ pinmux(3), 8, 2 },
+	{ pinmux(3), 8, 3 },
+	{ pinmux(3), 8, 4 },
+	{ pinmux(3), 8, 5 },
+	{ pinmux(3), 8, 6 },
+	{ pinmux(3), 8, 7 },
+	{ pinmux(4), 8, 0 },
+	{ pinmux(4), 8, 1 }
+};
+#endif /* CONFIG_DRIVER_TI_EMAC */
+
 /* I2C pin muxer settings */
 static const struct pinmux_config i2c_pins[] = {
 	{ pinmux(4), 2, 2 },
@@ -102,6 +128,14 @@ int board_init(void)
 	if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes)))
 		return 1;
 
+#ifdef CONFIG_DRIVER_TI_EMAC
+	if (davinci_configure_pin_mux(emac_pins, ARRAY_SIZE(emac_pins)) != 0)
+		return 1;
+	/* set cfgchip3 to select MII */
+	writel(readl(&davinci_syscfg_regs->cfgchip3) & ~(1 << 8),
+			     &davinci_syscfg_regs->cfgchip3);
+#endif /* CONFIG_DRIVER_TI_EMAC */
+
 	/* enable the console UART */
 	writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
 		DAVINCI_UART_PWREMU_MGMT_UTRST),
@@ -109,3 +143,29 @@ int board_init(void)
 
 	return 0;
 }
+
+#ifdef CONFIG_DRIVER_TI_EMAC
+
+/*
+ * Initializes on-board ethernet controllers.
+ */
+int board_eth_init(bd_t *bis)
+{
+	u_int8_t mac_addr[6];
+
+	/* read the address from env */
+	if (!eth_getenv_enetaddr("ethaddr", mac_addr))
+		return -1;
+
+	/* provide the resulting addr to the driver */
+	davinci_eth_set_mac_addr(mac_addr);
+
+	/* finally, initialise the driver */
+	if (!davinci_emac_initialize()) {
+		printf("Error: Ethernet init failed!\n");
+		return -1;
+	}
+
+	return 0;
+}
+#endif /* CONFIG_DRIVER_TI_EMAC */
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index 357715d..432c5e6 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -26,6 +26,7 @@
 /*
  * Board
  */
+#define CONFIG_DRIVER_TI_EMAC
 
 /*
  * SoC Configuration
@@ -79,6 +80,20 @@
 #define CONFIG_SYS_I2C_SLAVE		10 /* Bogus, master-only in U-Boot */
 
 /*
+ * Network & Ethernet Configuration
+ */
+#ifdef CONFIG_DRIVER_TI_EMAC
+#define CONFIG_EMAC_MDIO_PHY_NUM	0
+#define CONFIG_MII
+#define CONFIG_BOOTP_DEFAULT
+#define CONFIG_BOOTP_DNS
+#define CONFIG_BOOTP_DNS2
+#define CONFIG_BOOTP_SEND_HOSTNAME
+#define CONFIG_NET_RETRY_COUNT	10
+#define CONFIG_NET_MULTI
+#endif
+
+/*
  * U-Boot general configuration
  */
 #define CONFIG_BOOTFILE		"uImage" /* Boot file name */
-- 
1.7.0.4

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

* [U-Boot] [PATCH] da850evm: basic MII EMAC support
  2010-09-10 20:10 [U-Boot] [PATCH] da850evm: basic MII EMAC support Ben Gardiner
@ 2010-09-11  4:01 ` Mike Frysinger
  2010-09-13 12:55   ` Ben Gardiner
  2010-09-13  3:45 ` Ben Warren
  1 sibling, 1 reply; 31+ messages in thread
From: Mike Frysinger @ 2010-09-11  4:01 UTC (permalink / raw)
  To: u-boot

On Friday, September 10, 2010 16:10:16 Ben Gardiner wrote:
> The current da850evm support in u-boot/master [1] omits any use of
> the davinci EMAC. This patch adds basic support for the EMAC using
> the MII PHY found on the baseboard of the EVM. The MAC address is
> read from the environment variable 'ethadd'. Note that this is
> different from the da850evm support in the u-boot omapl1 tree
> where the MAC address is read from SPI flash [2].
> 
> CC: Sandeep Paulraj <s-paulraj@ti.com>
> CC: Sudhakar Rajashekhara <sudhakar.raj@ti.com>

where is your sign-off-by ?  patches cant be merged without it.

> [1] http://git.denx.de/?p=u-boot.git
> [2] http://arago-project.org/git/projects/?p=u-boot-omapl1.git

these URLs are useless.  just drop them.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100911/c179caaa/attachment.pgp 

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

* [U-Boot] [PATCH] da850evm: basic MII EMAC support
  2010-09-10 20:10 [U-Boot] [PATCH] da850evm: basic MII EMAC support Ben Gardiner
  2010-09-11  4:01 ` Mike Frysinger
@ 2010-09-13  3:45 ` Ben Warren
  2010-09-13 13:07   ` Ben Gardiner
  1 sibling, 1 reply; 31+ messages in thread
From: Ben Warren @ 2010-09-13  3:45 UTC (permalink / raw)
  To: u-boot

  Hi Ben,

On 9/10/2010 1:10 PM, Ben Gardiner wrote:
> The current da850evm support in u-boot/master [1] omits any use of
> the davinci EMAC. This patch adds basic support for the EMAC using
> the MII PHY found on the baseboard of the EVM. The MAC address is
> read from the environment variable 'ethadd'. Note that this is
> different from the da850evm support in the u-boot omapl1 tree
> where the MAC address is read from SPI flash [2].
>
> CC: Sandeep Paulraj<s-paulraj@ti.com>
> CC: Sudhakar Rajashekhara<sudhakar.raj@ti.com>
>
> [1] http://git.denx.de/?p=u-boot.git
> [2] http://arago-project.org/git/projects/?p=u-boot-omapl1.git
>
> ---
>
> I am submitting this patch for inclusion in v2010.12, not v2010.09 since it
> introduces a new feature.
>
> ---
>   board/davinci/da8xxevm/da850evm.c |   60 +++++++++++++++++++++++++++++++++++++
>   include/configs/da850evm.h        |   15 +++++++++
>   2 files changed, 75 insertions(+), 0 deletions(-)
>
> diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
> index eeb456c..30645e5 100644
> --- a/board/davinci/da8xxevm/da850evm.c
> +++ b/board/davinci/da8xxevm/da850evm.c
> @@ -23,7 +23,11 @@
>
>   #include<common.h>
>   #include<i2c.h>
> +#include<net.h>
> +#include<netdev.h>
>   #include<asm/arch/hardware.h>
> +#include<asm/arch/emif_defs.h>
> +#include<asm/arch/emac_defs.h>
>   #include<asm/io.h>
>   #include "../common/misc.h"
>   #include "common.h"
> @@ -48,6 +52,28 @@ static const struct pinmux_config uart_pins[] = {
>   	{ pinmux(4), 2, 5 }
>   };
>
> +#ifdef CONFIG_DRIVER_TI_EMAC
> +const struct pinmux_config emac_pins[] = {
> +	{ pinmux(2), 8, 1 },
> +	{ pinmux(2), 8, 2 },
> +	{ pinmux(2), 8, 3 },
> +	{ pinmux(2), 8, 4 },
> +	{ pinmux(2), 8, 5 },
> +	{ pinmux(2), 8, 6 },
> +	{ pinmux(2), 8, 7 },
> +	{ pinmux(3), 8, 0 },
> +	{ pinmux(3), 8, 1 },
> +	{ pinmux(3), 8, 2 },
> +	{ pinmux(3), 8, 3 },
> +	{ pinmux(3), 8, 4 },
> +	{ pinmux(3), 8, 5 },
> +	{ pinmux(3), 8, 6 },
> +	{ pinmux(3), 8, 7 },
> +	{ pinmux(4), 8, 0 },
> +	{ pinmux(4), 8, 1 }
> +};
> +#endif /* CONFIG_DRIVER_TI_EMAC */
> +
>   /* I2C pin muxer settings */
>   static const struct pinmux_config i2c_pins[] = {
>   	{ pinmux(4), 2, 2 },
> @@ -102,6 +128,14 @@ int board_init(void)
>   	if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes)))
>   		return 1;
>
> +#ifdef CONFIG_DRIVER_TI_EMAC
> +	if (davinci_configure_pin_mux(emac_pins, ARRAY_SIZE(emac_pins)) != 0)
> +		return 1;
> +	/* set cfgchip3 to select MII */
> +	writel(readl(&davinci_syscfg_regs->cfgchip3)&  ~(1<<  8),
> +			&davinci_syscfg_regs->cfgchip3);
> +#endif /* CONFIG_DRIVER_TI_EMAC */
> +
>   	/* enable the console UART */
>   	writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
>   		DAVINCI_UART_PWREMU_MGMT_UTRST),
> @@ -109,3 +143,29 @@ int board_init(void)
>
>   	return 0;
>   }
> +
> +#ifdef CONFIG_DRIVER_TI_EMAC
> +
> +/*
> + * Initializes on-board ethernet controllers.
> + */
> +int board_eth_init(bd_t *bis)
> +{
> +	u_int8_t mac_addr[6];
> +
> +	/* read the address from env */
> +	if (!eth_getenv_enetaddr("ethaddr", mac_addr))
> +		return -1;
> +
> +	/* provide the resulting addr to the driver */
> +	davinci_eth_set_mac_addr(mac_addr);
> +
> +	/* finally, initialise the driver */
> +	if (!davinci_emac_initialize()) {
> +		printf("Error: Ethernet init failed!\n");
> +		return -1;
> +	}
> +
Please consider doing this differently.  If you change the driver to 
make 'davinci_eth_set_mac_addr()' meet the signature of 
'eth_device->write_hwaddr()', all the environment handling is done 
automagically.  Let me know if you're confused and I'll provide more 
guidance.
> +	return 0;
> +}
> +#endif /* CONFIG_DRIVER_TI_EMAC */
> diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
> index 357715d..432c5e6 100644
> --- a/include/configs/da850evm.h
> +++ b/include/configs/da850evm.h
> @@ -26,6 +26,7 @@
>   /*
>    * Board
>    */
> +#define CONFIG_DRIVER_TI_EMAC
>
>   /*
>    * SoC Configuration
> @@ -79,6 +80,20 @@
>   #define CONFIG_SYS_I2C_SLAVE		10 /* Bogus, master-only in U-Boot */
>
>   /*
> + * Network&  Ethernet Configuration
> + */
> +#ifdef CONFIG_DRIVER_TI_EMAC
> +#define CONFIG_EMAC_MDIO_PHY_NUM	0
> +#define CONFIG_MII
> +#define CONFIG_BOOTP_DEFAULT
> +#define CONFIG_BOOTP_DNS
> +#define CONFIG_BOOTP_DNS2
> +#define CONFIG_BOOTP_SEND_HOSTNAME
> +#define CONFIG_NET_RETRY_COUNT	10
> +#define CONFIG_NET_MULTI
> +#endif
> +
> +/*
>    * U-Boot general configuration
>    */
>   #define CONFIG_BOOTFILE		"uImage" /* Boot file name */
regards,
Ben W.

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

* [U-Boot] [PATCH] da850evm: basic MII EMAC support
  2010-09-11  4:01 ` Mike Frysinger
@ 2010-09-13 12:55   ` Ben Gardiner
  2010-09-14 13:00     ` Mike Frysinger
  0 siblings, 1 reply; 31+ messages in thread
From: Ben Gardiner @ 2010-09-13 12:55 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On Sat, Sep 11, 2010 at 12:01 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Friday, September 10, 2010 16:10:16 Ben Gardiner wrote:
>> The current da850evm support in u-boot/master [1] omits any use of
>> the davinci EMAC. This patch adds basic support for the EMAC using
>> the MII PHY found on the baseboard of the EVM. The MAC address is
>> read from the environment variable 'ethadd'. Note that this is
>> different from the da850evm support in the u-boot omapl1 tree
>> where the MAC address is read from SPI flash [2].
>>
>> CC: Sandeep Paulraj <s-paulraj@ti.com>
>> CC: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
>
> where is your sign-off-by ? ?patches cant be merged without it.

Right. My mistake, sorry.

>> [1] http://git.denx.de/?p=u-boot.git
>> [2] http://arago-project.org/git/projects/?p=u-boot-omapl1.git
>
> these URLs are useless. ?just drop them.

Thanks for the feedback on these -- I have been wondering whether URL
footnotes were desirable in commit messages. I put them there since I
can remember that it is sometimes difficult to find the trees that are
being referred to when you are a newcomer.  Would SHA1's and/or git
URLs be more acceptable? Or is the point that nothing before the '---'
should have links?

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca

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

* [U-Boot] [PATCH] da850evm: basic MII EMAC support
  2010-09-13  3:45 ` Ben Warren
@ 2010-09-13 13:07   ` Ben Gardiner
  2010-09-13 13:16     ` Ben Warren
  0 siblings, 1 reply; 31+ messages in thread
From: Ben Gardiner @ 2010-09-13 13:07 UTC (permalink / raw)
  To: u-boot

Hi Ben,

On Sun, Sep 12, 2010 at 11:45 PM, Ben Warren <biggerbadderben@gmail.com> wrote:
> Please consider doing this differently. ?If you change the driver to make
> 'davinci_eth_set_mac_addr()' meet the signature of
> 'eth_device->write_hwaddr()', all the environment handling is done
> automagically. ?Let me know if you're confused and I'll provide more
> guidance.

Thanks for pointing me in the right direction here. I think I get it
now; please correct me if I am wrong: board_eth_init should assign the
eth_device->write_hwaddr() function pointer then eth_initialize() will
handle calling board_eth_init and will set the MAC address from the
ethaddr env var if the MAC address in the eth_device struct is
all-zeroes.

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca

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

* [U-Boot] [PATCH] da850evm: basic MII EMAC support
  2010-09-13 13:07   ` Ben Gardiner
@ 2010-09-13 13:16     ` Ben Warren
  2010-09-13 21:04       ` [U-Boot] [PATCH v2 0/2] da850evm " Ben Gardiner
  0 siblings, 1 reply; 31+ messages in thread
From: Ben Warren @ 2010-09-13 13:16 UTC (permalink / raw)
  To: u-boot

Hi Ben,

On Monday, September 13, 2010, Ben Gardiner <bengardiner@nanometrics.ca> wrote:
> Hi Ben,
>
> On Sun, Sep 12, 2010 at 11:45 PM, Ben Warren <biggerbadderben@gmail.com> wrote:
>> Please consider doing this differently. ?If you change the driver to make
>> 'davinci_eth_set_mac_addr()' meet the signature of
>> 'eth_device->write_hwaddr()', all the environment handling is done
>> automagically. ?Let me know if you're confused and I'll provide more
>> guidance.
>
> Thanks for pointing me in the right direction here. I think I get it
> now; please correct me if I am wrong: board_eth_init should assign the
> eth_device->write_hwaddr() function pointer then eth_initialize() will
> handle calling board_eth_init and will set the MAC address from the
> ethaddr env var if the MAC address in the eth_device struct is
> all-zeroes.
>
Almost.  The driver should set the function pointer, just as it does
'send()', 'init()', 'halt()', etc.  This is a recent feature and the
davinci driver hasn't been updated yet
> Best Regards,
> Ben Gardiner
>
> ---
> Nanometrics Inc.
> http://www.nanometrics.ca

Regards,
Ben

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

* [U-Boot] [PATCH v2 0/2] da850evm basic MII EMAC support
  2010-09-13 13:16     ` Ben Warren
@ 2010-09-13 21:04       ` Ben Gardiner
  2010-09-13 21:04         ` [U-Boot] [PATCH v2 1/2] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
                           ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Ben Gardiner @ 2010-09-13 21:04 UTC (permalink / raw)
  To: u-boot

This patch series proposes to add basic MII support to the da850evm; the first
patch in the series refactors davinci EMAC setup. The second patch in the
series enables MII support.

Ben Gardiner (2):
  davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr
  da850evm: basic MII EMAC support

 arch/arm/include/asm/arch-davinci/emac_defs.h |    1 -
 arch/arm/lib/board.c                          |    9 ---
 board/davinci/common/misc.c                   |   41 +++----------
 board/davinci/common/misc.h                   |    2 +-
 board/davinci/da8xxevm/da830evm.c             |   15 ++++-
 board/davinci/da8xxevm/da850evm.c             |   50 +++++++++++++++
 board/davinci/dm365evm/dm365evm.c             |    2 +-
 board/davinci/dvevm/dvevm.c                   |    2 +-
 board/davinci/sffsdr/sffsdr.c                 |    2 +-
 board/davinci/sonata/sonata.c                 |    2 +-
 drivers/net/davinci_emac.c                    |   80 ++++++++++++-------------
 include/configs/da850evm.h                    |   15 +++++
 12 files changed, 129 insertions(+), 92 deletions(-)

---

I am submitting this patch for inclusion in v2010.12, not v2010.09.

V2:
 * added patch 1/2 to refactor davinci_emac setup
 * added SOB to 2/2
 
./MAKEALL ARM9 showed no errors or additional warnings. 

Tested on da850evm with MII PHY on baseboard.

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

* [U-Boot] [PATCH v2 1/2] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr
  2010-09-13 21:04       ` [U-Boot] [PATCH v2 0/2] da850evm " Ben Gardiner
@ 2010-09-13 21:04         ` Ben Gardiner
  2010-09-14  8:37           ` Nick Thompson
  2010-09-13 21:04         ` [U-Boot] [PATCH v2 2/2] da850evm: basic MII EMAC support Ben Gardiner
  2010-09-22 17:16         ` [U-Boot] [PATCH v3 0/2][NEXT] da850evm " Ben Gardiner
  2 siblings, 1 reply; 31+ messages in thread
From: Ben Gardiner @ 2010-09-13 21:04 UTC (permalink / raw)
  To: u-boot

This patch proposes to migrate the davinci_emac driver to using the
eth_device->write_hwaddr function pointer as suggested by Ben Warren.

All the davinci boards had the behaviour, prior to this patch, of
sync'ing the environment variable enetaddr with the MAC address read
from non-volatile storage on boot -- when the two locations disagreed,
the environment variable value took precendence. This patch keeps the
same behaviour but makes eth_initialize take care of it.

This patch refactors davinci_emac setup in the boards so that the MAC
address is read from non-volatile storage into the environment variable
and then the environment variable value is use in eth_intialize. The
only exception is the direct call to davinci_eth_set_mac_addr made by
the da830evm board init which was changed into an assignment of the
enetaddr field.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Ben Warren <biggerbadderben@gmail.com>
CC: Nick Thompson <nick.thompson@ge.com>

---

V2:
  * introduced this patch

---
 arch/arm/include/asm/arch-davinci/emac_defs.h |    1 -
 arch/arm/lib/board.c                          |    9 ---
 board/davinci/common/misc.c                   |   41 +++----------
 board/davinci/common/misc.h                   |    2 +-
 board/davinci/da8xxevm/da830evm.c             |   15 ++++-
 board/davinci/dm365evm/dm365evm.c             |    2 +-
 board/davinci/dvevm/dvevm.c                   |    2 +-
 board/davinci/sffsdr/sffsdr.c                 |    2 +-
 board/davinci/sonata/sonata.c                 |    2 +-
 drivers/net/davinci_emac.c                    |   80 ++++++++++++-------------
 10 files changed, 64 insertions(+), 92 deletions(-)

diff --git a/arch/arm/include/asm/arch-davinci/emac_defs.h b/arch/arm/include/asm/arch-davinci/emac_defs.h
index 35a1585..76493a1 100644
--- a/arch/arm/include/asm/arch-davinci/emac_defs.h
+++ b/arch/arm/include/asm/arch-davinci/emac_defs.h
@@ -367,7 +367,6 @@ typedef struct  {
 
 int davinci_eth_phy_read(u_int8_t phy_addr, u_int8_t reg_num, u_int16_t *data);
 int davinci_eth_phy_write(u_int8_t phy_addr, u_int8_t reg_num, u_int16_t data);
-void davinci_eth_set_mac_addr(const u_int8_t *addr);
 
 typedef struct
 {
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 54519b0..094e420 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -386,15 +386,6 @@ void start_armboot (void)
 	enable_interrupts ();
 
 	/* Perform network card initialisation if necessary */
-#ifdef CONFIG_DRIVER_TI_EMAC
-	/* XXX: this needs to be moved to board init */
-extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
-	if (getenv ("ethaddr")) {
-		uchar enetaddr[6];
-		eth_getenv_enetaddr("ethaddr", enetaddr);
-		davinci_eth_set_mac_addr(enetaddr);
-	}
-#endif
 
 #if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96)
 	/* XXX: this needs to be moved to board init */
diff --git a/board/davinci/common/misc.c b/board/davinci/common/misc.c
index 25ca326..8ad3cca 100644
--- a/board/davinci/common/misc.c
+++ b/board/davinci/common/misc.c
@@ -68,45 +68,22 @@ err:
 	return 0;
 }
 
-/* If there is a MAC address in the environment, and if it is not identical to
- * the MAC address in the EEPROM, then a warning is printed and the MAC address
- * from the environment is used.
- *
+/*
  * If there is no MAC address in the environment, then it will be initialized
  * (silently) from the value in the EEPROM.
  */
-void dv_configure_mac_address(uint8_t *rom_enetaddr)
+void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr)
 {
-	int i;
-	u_int8_t env_enetaddr[6];
-	char *tmp = getenv("ethaddr");
-	char *end;
-
-	/* Read Ethernet MAC address from the U-Boot environment.
-	 * If it is not defined, env_enetaddr[] will be cleared. */
-	for (i = 0; i < 6; i++) {
-		env_enetaddr[i] = tmp ? simple_strtoul(tmp, &end, 16) : 0;
-		if (tmp)
-			tmp = (*end) ? end+1 : end;
-	}
-
-	/* Check if EEPROM and U-Boot environment MAC addresses match. */
-	if (memcmp(env_enetaddr, "\0\0\0\0\0\0", 6) != 0 &&
-	    memcmp(env_enetaddr, rom_enetaddr, 6) != 0) {
-		printf("Warning: MAC addresses don't match:\n");
-		printf("  EEPROM MAC address: %pM\n", rom_enetaddr);
-		printf("     \"ethaddr\" value: %pM\n", env_enetaddr) ;
-		debug("### Using MAC address from environment\n");
-	}
-	if (!tmp) {
-		char ethaddr[20];
+	uint8_t env_enetaddr[6];
 
+	eth_getenv_enetaddr_by_index(0, env_enetaddr);
+	if (!memcmp(env_enetaddr, "\0\0\0\0\0\0", 6)) {
 		/* There is no MAC address in the environment, so we initialize
 		 * it from the value in the EEPROM. */
-		sprintf(ethaddr, "%pM", rom_enetaddr) ;
-		debug("### Setting environment from EEPROM MAC address = \"%s\"\n",
-		      ethaddr);
-		setenv("ethaddr", ethaddr);
+		debug("### Setting environment from EEPROM MAC address = "
+			"\"%pM\"\n",
+			env_enetaddr);
+		eth_setenv_enetaddr("ethaddr", rom_enetaddr);
 	}
 }
 
diff --git a/board/davinci/common/misc.h b/board/davinci/common/misc.h
index 329c369..a6ac3b9 100644
--- a/board/davinci/common/misc.h
+++ b/board/davinci/common/misc.h
@@ -46,7 +46,7 @@ struct pinmux_resource {
 			  }
 
 int dvevm_read_mac_address(uint8_t *buf);
-void dv_configure_mac_address(uint8_t *rom_enetaddr);
+void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr);
 int davinci_configure_pin_mux(const struct pinmux_config *pins, int n_pins);
 int davinci_configure_pin_mux_items(const struct pinmux_resource *item,
 				    int n_items);
diff --git a/board/davinci/da8xxevm/da830evm.c b/board/davinci/da8xxevm/da830evm.c
index 6baa860..d5a228f 100644
--- a/board/davinci/da8xxevm/da830evm.c
+++ b/board/davinci/da8xxevm/da830evm.c
@@ -196,19 +196,17 @@ int board_eth_init(bd_t *bis)
 {
 	u_int8_t mac_addr[6];
 	u_int8_t switch_start_cmd[2] = { 0x01, 0x23 };
+	struct eth_device *dev;
 
 	/* Read Ethernet MAC address from EEPROM */
 	if (dvevm_read_mac_address(mac_addr))
 		/* set address env if not already set */
-		dv_configure_mac_address(mac_addr);
+		davinci_sync_env_enetaddr(mac_addr);
 
 	/* read the address back from env */
 	if (!eth_getenv_enetaddr("ethaddr", mac_addr))
 		return -1;
 
-	/* provide the resulting addr to the driver */
-	davinci_eth_set_mac_addr(mac_addr);
-
 	/* enable the Ethernet switch in the 3 port PHY */
 	if (i2c_write(PHY_SW_I2C_ADDR, 0, 0,
 			switch_start_cmd, sizeof(switch_start_cmd))) {
@@ -222,6 +220,15 @@ int board_eth_init(bd_t *bis)
 		return -1;
 	}
 
+	dev = eth_get_dev();
+
+	/* provide the resulting addr to the driver */
+	memcpy(dev->enetaddr, mac_addr, 6);
+	if (!dev->write_hwaddr(dev)) {
+		printf("Error: Could not set MAC address\n");
+		return -1;
+	}
+
 	return 0;
 }
 #endif /* CONFIG_DRIVER_TI_EMAC */
diff --git a/board/davinci/dm365evm/dm365evm.c b/board/davinci/dm365evm/dm365evm.c
index 290eb99..85dbe2a 100644
--- a/board/davinci/dm365evm/dm365evm.c
+++ b/board/davinci/dm365evm/dm365evm.c
@@ -68,7 +68,7 @@ int board_eth_init(bd_t *bis)
 
 	/* Read Ethernet MAC address from EEPROM */
 	if (dvevm_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	davinci_emac_initialize();
 
diff --git a/board/davinci/dvevm/dvevm.c b/board/davinci/dvevm/dvevm.c
index 98937a9..073c21a 100644
--- a/board/davinci/dvevm/dvevm.c
+++ b/board/davinci/dvevm/dvevm.c
@@ -71,7 +71,7 @@ int misc_init_r(void)
 
 	/* Read Ethernet MAC address from EEPROM if available. */
 	if (dvevm_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	i2c_read(0x39, 0x00, 1, &video_mode, 1);
 
diff --git a/board/davinci/sffsdr/sffsdr.c b/board/davinci/sffsdr/sffsdr.c
index c24b9e1..657cf2b 100644
--- a/board/davinci/sffsdr/sffsdr.c
+++ b/board/davinci/sffsdr/sffsdr.c
@@ -141,7 +141,7 @@ int misc_init_r(void)
 
 	/* Read Ethernet MAC address from EEPROM if available. */
 	if (sffsdr_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	return(0);
 }
diff --git a/board/davinci/sonata/sonata.c b/board/davinci/sonata/sonata.c
index 817970a..1dc42c4 100644
--- a/board/davinci/sonata/sonata.c
+++ b/board/davinci/sonata/sonata.c
@@ -70,7 +70,7 @@ int misc_init_r(void)
 
 	/* Read Ethernet MAC address from EEPROM if available. */
 	if (dvevm_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	return(0);
 }
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 41a9910..e06896f 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -65,21 +65,6 @@ void eth_mdio_enable(void)
 	davinci_eth_mdio_enable();
 }
 
-static u_int8_t davinci_eth_mac_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-
-/*
- * This function must be called before emac_open() if you want to override
- * the default mac address.
- */
-void davinci_eth_set_mac_addr(const u_int8_t *addr)
-{
-	int i;
-
-	for (i = 0; i < sizeof (davinci_eth_mac_addr); i++) {
-		davinci_eth_mac_addr[i] = addr[i];
-	}
-}
-
 /* EMAC Addresses */
 static volatile emac_regs	*adap_emac = (emac_regs *)EMAC_BASE_ADDR;
 static volatile ewrap_regs	*adap_ewrap = (ewrap_regs *)EMAC_WRAPPER_BASE_ADDR;
@@ -100,6 +85,43 @@ static volatile u_int8_t	active_phy_addr = 0xff;
 
 phy_t				phy;
 
+static int davinci_eth_set_mac_addr(struct eth_device *dev)
+{
+	unsigned long		mac_hi;
+	unsigned long		mac_lo;
+
+	/*
+	 * Set MAC Addresses & Init multicast Hash to 0 (disable any multicast
+	 * receive)
+	 *  Using channel 0 only - other channels are disabled
+	 *  */
+	writel(0, &adap_emac->MACINDEX);
+	mac_hi = (dev->enetaddr[3] << 24) |
+		 (dev->enetaddr[2] << 16) |
+		 (dev->enetaddr[1] << 8)  |
+		 (dev->enetaddr[0]);
+	mac_lo = (dev->enetaddr[5] << 8) |
+		 (dev->enetaddr[4]);
+
+	writel(mac_hi, &adap_emac->MACADDRHI);
+#if defined(DAVINCI_EMAC_VERSION2)
+	writel(mac_lo | EMAC_MAC_ADDR_IS_VALID | EMAC_MAC_ADDR_MATCH,
+	       &adap_emac->MACADDRLO);
+#else
+	writel(mac_lo, &adap_emac->MACADDRLO);
+#endif
+
+	writel(0, &adap_emac->MACHASH1);
+	writel(0, &adap_emac->MACHASH2);
+
+	/* Set source MAC address - REQUIRED */
+	writel(mac_hi, &adap_emac->MACSRCADDRHI);
+	writel(mac_lo, &adap_emac->MACSRCADDRLO);
+
+
+	return 0;
+}
+
 static void davinci_eth_mdio_enable(void)
 {
 	u_int32_t	clkdiv;
@@ -286,8 +308,6 @@ static int davinci_eth_open(struct eth_device *dev, bd_t *bis)
 	dv_reg_p		addr;
 	u_int32_t		clkdiv, cnt;
 	volatile emac_desc	*rx_desc;
-	unsigned long		mac_hi;
-	unsigned long		mac_lo;
 
 	debug_emac("+ emac_open\n");
 
@@ -311,30 +331,7 @@ static int davinci_eth_open(struct eth_device *dev, bd_t *bis)
 	writel(1, &adap_emac->TXCONTROL);
 	writel(1, &adap_emac->RXCONTROL);
 
-	/* Set MAC Addresses & Init multicast Hash to 0 (disable any multicast receive) */
-	/* Using channel 0 only - other channels are disabled */
-	writel(0, &adap_emac->MACINDEX);
-	mac_hi = (davinci_eth_mac_addr[3] << 24) |
-		 (davinci_eth_mac_addr[2] << 16) |
-		 (davinci_eth_mac_addr[1] << 8)  |
-		 (davinci_eth_mac_addr[0]);
-	mac_lo = (davinci_eth_mac_addr[5] << 8) |
-		 (davinci_eth_mac_addr[4]);
-
-	writel(mac_hi, &adap_emac->MACADDRHI);
-#if defined(DAVINCI_EMAC_VERSION2)
-	writel(mac_lo | EMAC_MAC_ADDR_IS_VALID | EMAC_MAC_ADDR_MATCH,
-	       &adap_emac->MACADDRLO);
-#else
-	writel(mac_lo, &adap_emac->MACADDRLO);
-#endif
-
-	writel(0, &adap_emac->MACHASH1);
-	writel(0, &adap_emac->MACHASH2);
-
-	/* Set source MAC address - REQUIRED */
-	writel(mac_hi, &adap_emac->MACSRCADDRHI);
-	writel(mac_lo, &adap_emac->MACSRCADDRLO);
+	davinci_eth_set_mac_addr(dev);
 
 	/* Set DMA 8 TX / 8 RX Head pointers to 0 */
 	addr = &adap_emac->TX0HDP;
@@ -636,6 +633,7 @@ int davinci_emac_initialize(void)
 	dev->halt = davinci_eth_close;
 	dev->send = davinci_eth_send_packet;
 	dev->recv = davinci_eth_rcv_packet;
+	dev->write_hwaddr = davinci_eth_set_mac_addr;
 
 	eth_register(dev);
 
-- 
1.7.0.4

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

* [U-Boot] [PATCH v2 2/2] da850evm: basic MII EMAC support
  2010-09-13 21:04       ` [U-Boot] [PATCH v2 0/2] da850evm " Ben Gardiner
  2010-09-13 21:04         ` [U-Boot] [PATCH v2 1/2] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
@ 2010-09-13 21:04         ` Ben Gardiner
  2010-09-22 17:16         ` [U-Boot] [PATCH v3 0/2][NEXT] da850evm " Ben Gardiner
  2 siblings, 0 replies; 31+ messages in thread
From: Ben Gardiner @ 2010-09-13 21:04 UTC (permalink / raw)
  To: u-boot

The current da850evm support in u-boot/master omits any use of
the davinci EMAC. This patch adds basic support for the EMAC using
the MII PHY found on the baseboard of the EVM. The MAC address is
read from the environment variable 'ethadd'. Note that this is
different from the da850evm support in the u-boot omapl1 tree
where the MAC address is read from SPI flash.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Sandeep Paulraj <s-paulraj@ti.com>
CC: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
CC: Ben Warren <biggerbadderben@gmail.com>
CC: Mike Frysinger <vapier@gentoo.org>

---

V2:
 * added SOB
 * renumbered this patch from 1/1 to 2/2
 * just initialize the driver and let eth_initialize() take care of
   setting the MAC address from the environment variable enetaddr

---
 board/davinci/da8xxevm/da850evm.c |   50 +++++++++++++++++++++++++++++++++++++
 include/configs/da850evm.h        |   15 +++++++++++
 2 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index eeb456c..0521643 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -23,7 +23,11 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <net.h>
+#include <netdev.h>
 #include <asm/arch/hardware.h>
+#include <asm/arch/emif_defs.h>
+#include <asm/arch/emac_defs.h>
 #include <asm/io.h>
 #include "../common/misc.h"
 #include "common.h"
@@ -48,6 +52,28 @@ static const struct pinmux_config uart_pins[] = {
 	{ pinmux(4), 2, 5 }
 };
 
+#ifdef CONFIG_DRIVER_TI_EMAC
+const struct pinmux_config emac_pins[] = {
+	{ pinmux(2), 8, 1 },
+	{ pinmux(2), 8, 2 },
+	{ pinmux(2), 8, 3 },
+	{ pinmux(2), 8, 4 },
+	{ pinmux(2), 8, 5 },
+	{ pinmux(2), 8, 6 },
+	{ pinmux(2), 8, 7 },
+	{ pinmux(3), 8, 0 },
+	{ pinmux(3), 8, 1 },
+	{ pinmux(3), 8, 2 },
+	{ pinmux(3), 8, 3 },
+	{ pinmux(3), 8, 4 },
+	{ pinmux(3), 8, 5 },
+	{ pinmux(3), 8, 6 },
+	{ pinmux(3), 8, 7 },
+	{ pinmux(4), 8, 0 },
+	{ pinmux(4), 8, 1 }
+};
+#endif /* CONFIG_DRIVER_TI_EMAC */
+
 /* I2C pin muxer settings */
 static const struct pinmux_config i2c_pins[] = {
 	{ pinmux(4), 2, 2 },
@@ -102,6 +128,14 @@ int board_init(void)
 	if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes)))
 		return 1;
 
+#ifdef CONFIG_DRIVER_TI_EMAC
+	if (davinci_configure_pin_mux(emac_pins, ARRAY_SIZE(emac_pins)) != 0)
+		return 1;
+	/* set cfgchip3 to select MII */
+	writel(readl(&davinci_syscfg_regs->cfgchip3) & ~(1 << 8),
+			     &davinci_syscfg_regs->cfgchip3);
+#endif /* CONFIG_DRIVER_TI_EMAC */
+
 	/* enable the console UART */
 	writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
 		DAVINCI_UART_PWREMU_MGMT_UTRST),
@@ -109,3 +143,19 @@ int board_init(void)
 
 	return 0;
 }
+
+#ifdef CONFIG_DRIVER_TI_EMAC
+
+/*
+ * Initializes on-board ethernet controllers.
+ */
+int board_eth_init(bd_t *bis)
+{
+	if (!davinci_emac_initialize()) {
+		printf("Error: Ethernet init failed!\n");
+		return -1;
+	}
+
+	return 0;
+}
+#endif /* CONFIG_DRIVER_TI_EMAC */
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index 357715d..432c5e6 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -26,6 +26,7 @@
 /*
  * Board
  */
+#define CONFIG_DRIVER_TI_EMAC
 
 /*
  * SoC Configuration
@@ -79,6 +80,20 @@
 #define CONFIG_SYS_I2C_SLAVE		10 /* Bogus, master-only in U-Boot */
 
 /*
+ * Network & Ethernet Configuration
+ */
+#ifdef CONFIG_DRIVER_TI_EMAC
+#define CONFIG_EMAC_MDIO_PHY_NUM	0
+#define CONFIG_MII
+#define CONFIG_BOOTP_DEFAULT
+#define CONFIG_BOOTP_DNS
+#define CONFIG_BOOTP_DNS2
+#define CONFIG_BOOTP_SEND_HOSTNAME
+#define CONFIG_NET_RETRY_COUNT	10
+#define CONFIG_NET_MULTI
+#endif
+
+/*
  * U-Boot general configuration
  */
 #define CONFIG_BOOTFILE		"uImage" /* Boot file name */
-- 
1.7.0.4

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

* [U-Boot] [PATCH v2 1/2] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr
  2010-09-13 21:04         ` [U-Boot] [PATCH v2 1/2] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
@ 2010-09-14  8:37           ` Nick Thompson
  0 siblings, 0 replies; 31+ messages in thread
From: Nick Thompson @ 2010-09-14  8:37 UTC (permalink / raw)
  To: u-boot

On 13/09/10 22:04, Ben Gardiner wrote:
> This patch proposes to migrate the davinci_emac driver to using the
> eth_device->write_hwaddr function pointer as suggested by Ben Warren.
> 
> All the davinci boards had the behaviour, prior to this patch, of
> sync'ing the environment variable enetaddr with the MAC address read
> from non-volatile storage on boot -- when the two locations disagreed,
> the environment variable value took precendence. This patch keeps the
> same behaviour but makes eth_initialize take care of it.
> 
> This patch refactors davinci_emac setup in the boards so that the MAC
> address is read from non-volatile storage into the environment variable
> and then the environment variable value is use in eth_intialize. The
> only exception is the direct call to davinci_eth_set_mac_addr made by
> the da830evm board init which was changed into an assignment of the
> enetaddr field.
> 
> Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
> CC: Ben Warren <biggerbadderben@gmail.com>
> CC: Nick Thompson <nick.thompson@ge.com>

This change seem reasonable to me from the da830evm point of view. I
don't have access to hardware for the next week or so, so I can't test
it now, but the da830 specific changes are minor.

Reviewed-by: Nick Thompson <nick.thompson@ge.com>

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

* [U-Boot] [PATCH] da850evm: basic MII EMAC support
  2010-09-13 12:55   ` Ben Gardiner
@ 2010-09-14 13:00     ` Mike Frysinger
  2010-09-14 13:07       ` Ben Gardiner
  0 siblings, 1 reply; 31+ messages in thread
From: Mike Frysinger @ 2010-09-14 13:00 UTC (permalink / raw)
  To: u-boot

On Monday, September 13, 2010 08:55:47 Ben Gardiner wrote:
> On Sat, Sep 11, 2010 at 12:01 AM, Mike Frysinger wrote:
> > On Friday, September 10, 2010 16:10:16 Ben Gardiner wrote:
> >> The current da850evm support in u-boot/master [1] omits any use of
> >> the davinci EMAC. This patch adds basic support for the EMAC using
> >> the MII PHY found on the baseboard of the EVM. The MAC address is
> >> read from the environment variable 'ethadd'. Note that this is
> >> different from the da850evm support in the u-boot omapl1 tree
> >> where the MAC address is read from SPI flash [2].
> >> 
> >> [1] http://git.denx.de/?p=u-boot.git
> >> [2] http://arago-project.org/git/projects/?p=u-boot-omapl1.git
> > 
> > these URLs are useless.  just drop them.
> 
> Thanks for the feedback on these -- I have been wondering whether URL
> footnotes were desirable in commit messages. I put them there since I
> can remember that it is sometimes difficult to find the trees that are
> being referred to when you are a newcomer.  Would SHA1's and/or git
> URLs be more acceptable? Or is the point that nothing before the '---'
> should have links?

it depends on the URLs.  i dont think referring to the mainline git tree is 
useful at all considering that's what they're using if they have this patch in 
their tree.  as for the omap1 reference, i'm not sure mentioning at all is 
useful in the commit.  presumably the tree in question will drop its code and 
move to the mainline stuff one yours is merged.  imo, that would make it a 
"note" which goes below the "---".

if the URL is generally useful, then some people use a dedicated tag in the 
"s-o-b" section such as "URL: xxx".  this isnt exactly standardized.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100914/714c8fe8/attachment.pgp 

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

* [U-Boot] [PATCH] da850evm: basic MII EMAC support
  2010-09-14 13:00     ` Mike Frysinger
@ 2010-09-14 13:07       ` Ben Gardiner
  0 siblings, 0 replies; 31+ messages in thread
From: Ben Gardiner @ 2010-09-14 13:07 UTC (permalink / raw)
  To: u-boot

Hi Mike,

Thanks for following-up.

On Tue, Sep 14, 2010 at 9:00 AM, Mike Frysinger <vapier@gentoo.org> wrote:
>
> it depends on the URLs. ?i dont think referring to the mainline git tree is
> useful at all considering that's what they're using if they have this patch in

Yes, I see your point: the mainline tree's URL is superfluous.

> their tree.  as for the omap1 reference, i'm not sure mentioning at all is
> useful in the commit.  presumably the tree in question will drop its code and
> move to the mainline stuff one yours is merged.  imo, that would make it a
> "note" which goes below the "---".

Ok -- I hadn't fully considered the ramifications of the fact that the
commit message would be around long after the state of the omap-l1
tree had changed. I agree that this URL would be a note below the
'---', if included at all.

> if the URL is generally useful, then some people use a dedicated tag in the
> "s-o-b" section such as "URL: xxx".  this isnt exactly standardized.

Neat. I'll keep that one in mind too, but not for external commits --
you have convinced me that it is not useful to include these in he
commit message.

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca

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

* [U-Boot] [PATCH v3 0/2][NEXT] da850evm basic MII EMAC support
  2010-09-13 21:04       ` [U-Boot] [PATCH v2 0/2] da850evm " Ben Gardiner
  2010-09-13 21:04         ` [U-Boot] [PATCH v2 1/2] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
  2010-09-13 21:04         ` [U-Boot] [PATCH v2 2/2] da850evm: basic MII EMAC support Ben Gardiner
@ 2010-09-22 17:16         ` Ben Gardiner
  2010-09-22 17:16           ` [U-Boot] [PATCH v3 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
                             ` (2 more replies)
  2 siblings, 3 replies; 31+ messages in thread
From: Ben Gardiner @ 2010-09-22 17:16 UTC (permalink / raw)
  To: u-boot

This patch series proposes to add basic MII support to the da850evm; the first
patch in the series refactors davinci EMAC setup. The second patch in the
series enables MII support.

Ben Gardiner (2):
  [NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr
  [NEXT] da850evm: basic MII EMAC support

 arch/arm/include/asm/arch-davinci/emac_defs.h |    1 -
 arch/arm/lib/board.c                          |   19 ------
 board/davinci/common/misc.c                   |   41 +++----------
 board/davinci/common/misc.h                   |    2 +-
 board/davinci/da8xxevm/da830evm.c             |   15 ++++-
 board/davinci/da8xxevm/da850evm.c             |   50 +++++++++++++++
 board/davinci/dm365evm/dm365evm.c             |    2 +-
 board/davinci/dvevm/dvevm.c                   |    2 +-
 board/davinci/sffsdr/sffsdr.c                 |    2 +-
 board/davinci/sonata/sonata.c                 |    2 +-
 drivers/net/davinci_emac.c                    |   80 ++++++++++++-------------
 include/configs/da850evm.h                    |   15 +++++
 12 files changed, 129 insertions(+), 102 deletions(-)

---

V3:
 * rebased to u-boot/next
 * removed additional direct call of davinci_eth_set_mac_addr added to
   board_init_r by Heiko's relocation patches
V2:
 * added patch 1/2 to refactor davinci_emac setup
 * added SOB to 2/2

Tested on da850evm with MII PHY on baseboard.

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

* [U-Boot] [PATCH v3 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr
  2010-09-22 17:16         ` [U-Boot] [PATCH v3 0/2][NEXT] da850evm " Ben Gardiner
@ 2010-09-22 17:16           ` Ben Gardiner
  2010-09-22 17:16           ` [U-Boot] [PATCH v3 2/2][NEXT] da850evm: basic MII EMAC support Ben Gardiner
  2010-09-22 18:44           ` [U-Boot] [PATCH v4 0/2][NEXT] da850evm " Ben Gardiner
  2 siblings, 0 replies; 31+ messages in thread
From: Ben Gardiner @ 2010-09-22 17:16 UTC (permalink / raw)
  To: u-boot

This patch proposes to migrate the davinci_emac driver to using the
eth_device->write_hwaddr function pointer as suggested by Ben Warren.

All the davinci boards had the behaviour, prior to this patch, of
sync'ing the environment variable enetaddr with the MAC address read
from non-volatile storage on boot -- when the two locations disagreed,
the environment variable value took precendence. This patch keeps the
same behaviour but lets eth_initialize take care of it.

This patch refactors davinci_emac setup in the boards so that the MAC
address is read from non-volatile storage into the environment variable
and then the environment variable value is use in eth_intialize. The
only exception is the direct call to davinci_eth_set_mac_addr made by
the da830evm board init which was changed into an assignment of the
enetaddr field.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Ben Warren <biggerbadderben@gmail.com>
CC: Nick Thompson <nick.thompson@ge.com>

--
V3:
  * rebased to u-boot/next, removed additional direct call of
    davinci_eth_set_mac_addr added to board_init_r by Heiko's
    relocation patches
V2:
  * introduced this patch
---
 arch/arm/include/asm/arch-davinci/emac_defs.h |    1 -
 arch/arm/lib/board.c                          |   19 ------
 board/davinci/common/misc.c                   |   41 +++----------
 board/davinci/common/misc.h                   |    2 +-
 board/davinci/da8xxevm/da830evm.c             |   15 ++++-
 board/davinci/dm365evm/dm365evm.c             |    2 +-
 board/davinci/dvevm/dvevm.c                   |    2 +-
 board/davinci/sffsdr/sffsdr.c                 |    2 +-
 board/davinci/sonata/sonata.c                 |    2 +-
 drivers/net/davinci_emac.c                    |   80 ++++++++++++-------------
 10 files changed, 64 insertions(+), 102 deletions(-)

diff --git a/arch/arm/include/asm/arch-davinci/emac_defs.h b/arch/arm/include/asm/arch-davinci/emac_defs.h
index 35a1585..76493a1 100644
--- a/arch/arm/include/asm/arch-davinci/emac_defs.h
+++ b/arch/arm/include/asm/arch-davinci/emac_defs.h
@@ -367,7 +367,6 @@ typedef struct  {
 
 int davinci_eth_phy_read(u_int8_t phy_addr, u_int8_t reg_num, u_int16_t *data);
 int davinci_eth_phy_write(u_int8_t phy_addr, u_int8_t reg_num, u_int16_t data);
-void davinci_eth_set_mac_addr(const u_int8_t *addr);
 
 typedef struct
 {
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 5f2dfd0..22bd2c9 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -409,15 +409,6 @@ void start_armboot (void)
 	enable_interrupts ();
 
 	/* Perform network card initialisation if necessary */
-#ifdef CONFIG_DRIVER_TI_EMAC
-	/* XXX: this needs to be moved to board init */
-extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
-	if (getenv ("ethaddr")) {
-		uchar enetaddr[6];
-		eth_getenv_enetaddr("ethaddr", enetaddr);
-		davinci_eth_set_mac_addr(enetaddr);
-	}
-#endif
 
 #if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96)
 	/* XXX: this needs to be moved to board init */
@@ -821,16 +812,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	enable_interrupts ();
 
 	/* Perform network card initialisation if necessary */
-#ifdef CONFIG_DRIVER_TI_EMAC
-	/* XXX: this needs to be moved to board init */
-extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
-	if (getenv ("ethaddr")) {
-		uchar enetaddr[6];
-		eth_getenv_enetaddr("ethaddr", enetaddr);
-		davinci_eth_set_mac_addr(enetaddr);
-	}
-#endif
-
 #if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96)
 	/* XXX: this needs to be moved to board init */
 	if (getenv ("ethaddr")) {
diff --git a/board/davinci/common/misc.c b/board/davinci/common/misc.c
index 86a875e..b60a46e 100644
--- a/board/davinci/common/misc.c
+++ b/board/davinci/common/misc.c
@@ -85,45 +85,22 @@ err:
 	return 0;
 }
 
-/* If there is a MAC address in the environment, and if it is not identical to
- * the MAC address in the EEPROM, then a warning is printed and the MAC address
- * from the environment is used.
- *
+/*
  * If there is no MAC address in the environment, then it will be initialized
  * (silently) from the value in the EEPROM.
  */
-void dv_configure_mac_address(uint8_t *rom_enetaddr)
+void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr)
 {
-	int i;
-	u_int8_t env_enetaddr[6];
-	char *tmp = getenv("ethaddr");
-	char *end;
-
-	/* Read Ethernet MAC address from the U-Boot environment.
-	 * If it is not defined, env_enetaddr[] will be cleared. */
-	for (i = 0; i < 6; i++) {
-		env_enetaddr[i] = tmp ? simple_strtoul(tmp, &end, 16) : 0;
-		if (tmp)
-			tmp = (*end) ? end+1 : end;
-	}
-
-	/* Check if EEPROM and U-Boot environment MAC addresses match. */
-	if (memcmp(env_enetaddr, "\0\0\0\0\0\0", 6) != 0 &&
-	    memcmp(env_enetaddr, rom_enetaddr, 6) != 0) {
-		printf("Warning: MAC addresses don't match:\n");
-		printf("  EEPROM MAC address: %pM\n", rom_enetaddr);
-		printf("     \"ethaddr\" value: %pM\n", env_enetaddr) ;
-		debug("### Using MAC address from environment\n");
-	}
-	if (!tmp) {
-		char ethaddr[20];
+	uint8_t env_enetaddr[6];
 
+	eth_getenv_enetaddr_by_index(0, env_enetaddr);
+	if (!memcmp(env_enetaddr, "\0\0\0\0\0\0", 6)) {
 		/* There is no MAC address in the environment, so we initialize
 		 * it from the value in the EEPROM. */
-		sprintf(ethaddr, "%pM", rom_enetaddr) ;
-		debug("### Setting environment from EEPROM MAC address = \"%s\"\n",
-		      ethaddr);
-		setenv("ethaddr", ethaddr);
+		debug("### Setting environment from EEPROM MAC address = "
+			"\"%pM\"\n",
+			env_enetaddr);
+		eth_setenv_enetaddr("ethaddr", rom_enetaddr);
 	}
 }
 
diff --git a/board/davinci/common/misc.h b/board/davinci/common/misc.h
index 329c369..a6ac3b9 100644
--- a/board/davinci/common/misc.h
+++ b/board/davinci/common/misc.h
@@ -46,7 +46,7 @@ struct pinmux_resource {
 			  }
 
 int dvevm_read_mac_address(uint8_t *buf);
-void dv_configure_mac_address(uint8_t *rom_enetaddr);
+void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr);
 int davinci_configure_pin_mux(const struct pinmux_config *pins, int n_pins);
 int davinci_configure_pin_mux_items(const struct pinmux_resource *item,
 				    int n_items);
diff --git a/board/davinci/da8xxevm/da830evm.c b/board/davinci/da8xxevm/da830evm.c
index 6baa860..d5a228f 100644
--- a/board/davinci/da8xxevm/da830evm.c
+++ b/board/davinci/da8xxevm/da830evm.c
@@ -196,19 +196,17 @@ int board_eth_init(bd_t *bis)
 {
 	u_int8_t mac_addr[6];
 	u_int8_t switch_start_cmd[2] = { 0x01, 0x23 };
+	struct eth_device *dev;
 
 	/* Read Ethernet MAC address from EEPROM */
 	if (dvevm_read_mac_address(mac_addr))
 		/* set address env if not already set */
-		dv_configure_mac_address(mac_addr);
+		davinci_sync_env_enetaddr(mac_addr);
 
 	/* read the address back from env */
 	if (!eth_getenv_enetaddr("ethaddr", mac_addr))
 		return -1;
 
-	/* provide the resulting addr to the driver */
-	davinci_eth_set_mac_addr(mac_addr);
-
 	/* enable the Ethernet switch in the 3 port PHY */
 	if (i2c_write(PHY_SW_I2C_ADDR, 0, 0,
 			switch_start_cmd, sizeof(switch_start_cmd))) {
@@ -222,6 +220,15 @@ int board_eth_init(bd_t *bis)
 		return -1;
 	}
 
+	dev = eth_get_dev();
+
+	/* provide the resulting addr to the driver */
+	memcpy(dev->enetaddr, mac_addr, 6);
+	if (!dev->write_hwaddr(dev)) {
+		printf("Error: Could not set MAC address\n");
+		return -1;
+	}
+
 	return 0;
 }
 #endif /* CONFIG_DRIVER_TI_EMAC */
diff --git a/board/davinci/dm365evm/dm365evm.c b/board/davinci/dm365evm/dm365evm.c
index 290eb99..85dbe2a 100644
--- a/board/davinci/dm365evm/dm365evm.c
+++ b/board/davinci/dm365evm/dm365evm.c
@@ -68,7 +68,7 @@ int board_eth_init(bd_t *bis)
 
 	/* Read Ethernet MAC address from EEPROM */
 	if (dvevm_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	davinci_emac_initialize();
 
diff --git a/board/davinci/dvevm/dvevm.c b/board/davinci/dvevm/dvevm.c
index 98937a9..073c21a 100644
--- a/board/davinci/dvevm/dvevm.c
+++ b/board/davinci/dvevm/dvevm.c
@@ -71,7 +71,7 @@ int misc_init_r(void)
 
 	/* Read Ethernet MAC address from EEPROM if available. */
 	if (dvevm_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	i2c_read(0x39, 0x00, 1, &video_mode, 1);
 
diff --git a/board/davinci/sffsdr/sffsdr.c b/board/davinci/sffsdr/sffsdr.c
index c24b9e1..657cf2b 100644
--- a/board/davinci/sffsdr/sffsdr.c
+++ b/board/davinci/sffsdr/sffsdr.c
@@ -141,7 +141,7 @@ int misc_init_r(void)
 
 	/* Read Ethernet MAC address from EEPROM if available. */
 	if (sffsdr_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	return(0);
 }
diff --git a/board/davinci/sonata/sonata.c b/board/davinci/sonata/sonata.c
index 817970a..1dc42c4 100644
--- a/board/davinci/sonata/sonata.c
+++ b/board/davinci/sonata/sonata.c
@@ -70,7 +70,7 @@ int misc_init_r(void)
 
 	/* Read Ethernet MAC address from EEPROM if available. */
 	if (dvevm_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	return(0);
 }
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 41a9910..e06896f 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -65,21 +65,6 @@ void eth_mdio_enable(void)
 	davinci_eth_mdio_enable();
 }
 
-static u_int8_t davinci_eth_mac_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-
-/*
- * This function must be called before emac_open() if you want to override
- * the default mac address.
- */
-void davinci_eth_set_mac_addr(const u_int8_t *addr)
-{
-	int i;
-
-	for (i = 0; i < sizeof (davinci_eth_mac_addr); i++) {
-		davinci_eth_mac_addr[i] = addr[i];
-	}
-}
-
 /* EMAC Addresses */
 static volatile emac_regs	*adap_emac = (emac_regs *)EMAC_BASE_ADDR;
 static volatile ewrap_regs	*adap_ewrap = (ewrap_regs *)EMAC_WRAPPER_BASE_ADDR;
@@ -100,6 +85,43 @@ static volatile u_int8_t	active_phy_addr = 0xff;
 
 phy_t				phy;
 
+static int davinci_eth_set_mac_addr(struct eth_device *dev)
+{
+	unsigned long		mac_hi;
+	unsigned long		mac_lo;
+
+	/*
+	 * Set MAC Addresses & Init multicast Hash to 0 (disable any multicast
+	 * receive)
+	 *  Using channel 0 only - other channels are disabled
+	 *  */
+	writel(0, &adap_emac->MACINDEX);
+	mac_hi = (dev->enetaddr[3] << 24) |
+		 (dev->enetaddr[2] << 16) |
+		 (dev->enetaddr[1] << 8)  |
+		 (dev->enetaddr[0]);
+	mac_lo = (dev->enetaddr[5] << 8) |
+		 (dev->enetaddr[4]);
+
+	writel(mac_hi, &adap_emac->MACADDRHI);
+#if defined(DAVINCI_EMAC_VERSION2)
+	writel(mac_lo | EMAC_MAC_ADDR_IS_VALID | EMAC_MAC_ADDR_MATCH,
+	       &adap_emac->MACADDRLO);
+#else
+	writel(mac_lo, &adap_emac->MACADDRLO);
+#endif
+
+	writel(0, &adap_emac->MACHASH1);
+	writel(0, &adap_emac->MACHASH2);
+
+	/* Set source MAC address - REQUIRED */
+	writel(mac_hi, &adap_emac->MACSRCADDRHI);
+	writel(mac_lo, &adap_emac->MACSRCADDRLO);
+
+
+	return 0;
+}
+
 static void davinci_eth_mdio_enable(void)
 {
 	u_int32_t	clkdiv;
@@ -286,8 +308,6 @@ static int davinci_eth_open(struct eth_device *dev, bd_t *bis)
 	dv_reg_p		addr;
 	u_int32_t		clkdiv, cnt;
 	volatile emac_desc	*rx_desc;
-	unsigned long		mac_hi;
-	unsigned long		mac_lo;
 
 	debug_emac("+ emac_open\n");
 
@@ -311,30 +331,7 @@ static int davinci_eth_open(struct eth_device *dev, bd_t *bis)
 	writel(1, &adap_emac->TXCONTROL);
 	writel(1, &adap_emac->RXCONTROL);
 
-	/* Set MAC Addresses & Init multicast Hash to 0 (disable any multicast receive) */
-	/* Using channel 0 only - other channels are disabled */
-	writel(0, &adap_emac->MACINDEX);
-	mac_hi = (davinci_eth_mac_addr[3] << 24) |
-		 (davinci_eth_mac_addr[2] << 16) |
-		 (davinci_eth_mac_addr[1] << 8)  |
-		 (davinci_eth_mac_addr[0]);
-	mac_lo = (davinci_eth_mac_addr[5] << 8) |
-		 (davinci_eth_mac_addr[4]);
-
-	writel(mac_hi, &adap_emac->MACADDRHI);
-#if defined(DAVINCI_EMAC_VERSION2)
-	writel(mac_lo | EMAC_MAC_ADDR_IS_VALID | EMAC_MAC_ADDR_MATCH,
-	       &adap_emac->MACADDRLO);
-#else
-	writel(mac_lo, &adap_emac->MACADDRLO);
-#endif
-
-	writel(0, &adap_emac->MACHASH1);
-	writel(0, &adap_emac->MACHASH2);
-
-	/* Set source MAC address - REQUIRED */
-	writel(mac_hi, &adap_emac->MACSRCADDRHI);
-	writel(mac_lo, &adap_emac->MACSRCADDRLO);
+	davinci_eth_set_mac_addr(dev);
 
 	/* Set DMA 8 TX / 8 RX Head pointers to 0 */
 	addr = &adap_emac->TX0HDP;
@@ -636,6 +633,7 @@ int davinci_emac_initialize(void)
 	dev->halt = davinci_eth_close;
 	dev->send = davinci_eth_send_packet;
 	dev->recv = davinci_eth_rcv_packet;
+	dev->write_hwaddr = davinci_eth_set_mac_addr;
 
 	eth_register(dev);
 
-- 
1.7.0.4

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

* [U-Boot] [PATCH v3 2/2][NEXT] da850evm: basic MII EMAC support
  2010-09-22 17:16         ` [U-Boot] [PATCH v3 0/2][NEXT] da850evm " Ben Gardiner
  2010-09-22 17:16           ` [U-Boot] [PATCH v3 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
@ 2010-09-22 17:16           ` Ben Gardiner
  2010-09-22 18:21             ` Mike Frysinger
  2010-09-22 18:44           ` [U-Boot] [PATCH v4 0/2][NEXT] da850evm " Ben Gardiner
  2 siblings, 1 reply; 31+ messages in thread
From: Ben Gardiner @ 2010-09-22 17:16 UTC (permalink / raw)
  To: u-boot

The current da850evm support in u-boot/master omits any use of
the davinci EMAC. This patch adds basic support for the EMAC using
the MII PHY found on the baseboard of the EVM. The MAC address is
read from the environment variable 'ethadd'. Note that this is
different from the da850evm support in the u-boot omapl1 tree
where the MAC address is read from SPI flash.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Sandeep Paulraj <s-paulraj@ti.com>
CC: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
CC: Ben Warren <biggerbadderben@gmail.com>
CC: Mike Frysinger <vapier@gentoo.org>

---

V3:
 * rebased to u-boot/next
V2:
 * added SOB
 * renumbered this patch from 1/1 to 2/2
 * just initialize the driver and let eth_initialize() take care of
   setting the MAC address from the environment variable enetaddr
---
 board/davinci/da8xxevm/da850evm.c |   50 +++++++++++++++++++++++++++++++++++++
 include/configs/da850evm.h        |   15 +++++++++++
 2 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index eeb456c..0521643 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -23,7 +23,11 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <net.h>
+#include <netdev.h>
 #include <asm/arch/hardware.h>
+#include <asm/arch/emif_defs.h>
+#include <asm/arch/emac_defs.h>
 #include <asm/io.h>
 #include "../common/misc.h"
 #include "common.h"
@@ -48,6 +52,28 @@ static const struct pinmux_config uart_pins[] = {
 	{ pinmux(4), 2, 5 }
 };
 
+#ifdef CONFIG_DRIVER_TI_EMAC
+const struct pinmux_config emac_pins[] = {
+	{ pinmux(2), 8, 1 },
+	{ pinmux(2), 8, 2 },
+	{ pinmux(2), 8, 3 },
+	{ pinmux(2), 8, 4 },
+	{ pinmux(2), 8, 5 },
+	{ pinmux(2), 8, 6 },
+	{ pinmux(2), 8, 7 },
+	{ pinmux(3), 8, 0 },
+	{ pinmux(3), 8, 1 },
+	{ pinmux(3), 8, 2 },
+	{ pinmux(3), 8, 3 },
+	{ pinmux(3), 8, 4 },
+	{ pinmux(3), 8, 5 },
+	{ pinmux(3), 8, 6 },
+	{ pinmux(3), 8, 7 },
+	{ pinmux(4), 8, 0 },
+	{ pinmux(4), 8, 1 }
+};
+#endif /* CONFIG_DRIVER_TI_EMAC */
+
 /* I2C pin muxer settings */
 static const struct pinmux_config i2c_pins[] = {
 	{ pinmux(4), 2, 2 },
@@ -102,6 +128,14 @@ int board_init(void)
 	if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes)))
 		return 1;
 
+#ifdef CONFIG_DRIVER_TI_EMAC
+	if (davinci_configure_pin_mux(emac_pins, ARRAY_SIZE(emac_pins)) != 0)
+		return 1;
+	/* set cfgchip3 to select MII */
+	writel(readl(&davinci_syscfg_regs->cfgchip3) & ~(1 << 8),
+			     &davinci_syscfg_regs->cfgchip3);
+#endif /* CONFIG_DRIVER_TI_EMAC */
+
 	/* enable the console UART */
 	writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
 		DAVINCI_UART_PWREMU_MGMT_UTRST),
@@ -109,3 +143,19 @@ int board_init(void)
 
 	return 0;
 }
+
+#ifdef CONFIG_DRIVER_TI_EMAC
+
+/*
+ * Initializes on-board ethernet controllers.
+ */
+int board_eth_init(bd_t *bis)
+{
+	if (!davinci_emac_initialize()) {
+		printf("Error: Ethernet init failed!\n");
+		return -1;
+	}
+
+	return 0;
+}
+#endif /* CONFIG_DRIVER_TI_EMAC */
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index d02b196..236aa06 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -26,6 +26,7 @@
 /*
  * Board
  */
+#define CONFIG_DRIVER_TI_EMAC
 
 /*
  * SoC Configuration
@@ -79,6 +80,20 @@
 #define CONFIG_SYS_I2C_SLAVE		10 /* Bogus, master-only in U-Boot */
 
 /*
+ * Network & Ethernet Configuration
+ */
+#ifdef CONFIG_DRIVER_TI_EMAC
+#define CONFIG_EMAC_MDIO_PHY_NUM	0
+#define CONFIG_MII
+#define CONFIG_BOOTP_DEFAULT
+#define CONFIG_BOOTP_DNS
+#define CONFIG_BOOTP_DNS2
+#define CONFIG_BOOTP_SEND_HOSTNAME
+#define CONFIG_NET_RETRY_COUNT	10
+#define CONFIG_NET_MULTI
+#endif
+
+/*
  * U-Boot general configuration
  */
 #define CONFIG_BOOTFILE		"uImage" /* Boot file name */
-- 
1.7.0.4

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

* [U-Boot] [PATCH v3 2/2][NEXT] da850evm: basic MII EMAC support
  2010-09-22 17:16           ` [U-Boot] [PATCH v3 2/2][NEXT] da850evm: basic MII EMAC support Ben Gardiner
@ 2010-09-22 18:21             ` Mike Frysinger
  2010-09-22 18:38               ` Ben Gardiner
  0 siblings, 1 reply; 31+ messages in thread
From: Mike Frysinger @ 2010-09-22 18:21 UTC (permalink / raw)
  To: u-boot

On Wednesday, September 22, 2010 13:16:49 Ben Gardiner wrote:
> +const struct pinmux_config emac_pins[] = {

seems to only be used in this file ?  mark it static too ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100922/aaa13354/attachment.pgp 

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

* [U-Boot] [PATCH v3 2/2][NEXT] da850evm: basic MII EMAC support
  2010-09-22 18:21             ` Mike Frysinger
@ 2010-09-22 18:38               ` Ben Gardiner
  0 siblings, 0 replies; 31+ messages in thread
From: Ben Gardiner @ 2010-09-22 18:38 UTC (permalink / raw)
  To: u-boot

Hi Mike,

On Wed, Sep 22, 2010 at 2:21 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Wednesday, September 22, 2010 13:16:49 Ben Gardiner wrote:
>> +const struct pinmux_config emac_pins[] = {
>
> seems to only be used in this file ? ?mark it static too ?
> -mike

Good catch. It definitely should be static.

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca

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

* [U-Boot] [PATCH v4 0/2][NEXT] da850evm basic MII EMAC support
  2010-09-22 17:16         ` [U-Boot] [PATCH v3 0/2][NEXT] da850evm " Ben Gardiner
  2010-09-22 17:16           ` [U-Boot] [PATCH v3 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
  2010-09-22 17:16           ` [U-Boot] [PATCH v3 2/2][NEXT] da850evm: basic MII EMAC support Ben Gardiner
@ 2010-09-22 18:44           ` Ben Gardiner
  2010-09-22 18:44             ` [U-Boot] [PATCH v4 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
                               ` (2 more replies)
  2 siblings, 3 replies; 31+ messages in thread
From: Ben Gardiner @ 2010-09-22 18:44 UTC (permalink / raw)
  To: u-boot

This patch series proposes to add basic MII support to the da850evm; the first
patch in the series refactors davinci EMAC setup. The second patch in the
series enables MII support.

Ben Gardiner (2):
  [NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr
  [NEXT] da850evm: basic MII EMAC support

 arch/arm/include/asm/arch-davinci/emac_defs.h |    1 -
 arch/arm/lib/board.c                          |   19 ------
 board/davinci/common/misc.c                   |   41 +++----------
 board/davinci/common/misc.h                   |    2 +-
 board/davinci/da8xxevm/da830evm.c             |   15 ++++-
 board/davinci/da8xxevm/da850evm.c             |   50 +++++++++++++++
 board/davinci/dm365evm/dm365evm.c             |    2 +-
 board/davinci/dvevm/dvevm.c                   |    2 +-
 board/davinci/sffsdr/sffsdr.c                 |    2 +-
 board/davinci/sonata/sonata.c                 |    2 +-
 drivers/net/davinci_emac.c                    |   80 ++++++++++++-------------
 include/configs/da850evm.h                    |   15 +++++
 12 files changed, 129 insertions(+), 102 deletions(-)

---

V4:
 * make the emac_pins static
V3:
 * rebased to u-boot/next
 * removed additional direct call of davinci_eth_set_mac_addr added to
   board_init_r by Heiko's relocation patches
V2:
 * added patch 1/2 to refactor davinci_emac setup
 * added SOB to 2/2

Tested on da850evm with MII PHY on baseboard.

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

* [U-Boot] [PATCH v4 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr
  2010-09-22 18:44           ` [U-Boot] [PATCH v4 0/2][NEXT] da850evm " Ben Gardiner
@ 2010-09-22 18:44             ` Ben Gardiner
  2010-09-23  9:03               ` Nick Thompson
  2010-09-22 18:44             ` [U-Boot] [PATCH v4 2/2][NEXT] da850evm: basic MII EMAC support Ben Gardiner
  2010-09-23 13:33             ` [U-Boot] [PATCH v5 0/2][NEXT] da850evm " Ben Gardiner
  2 siblings, 1 reply; 31+ messages in thread
From: Ben Gardiner @ 2010-09-22 18:44 UTC (permalink / raw)
  To: u-boot

This patch proposes to migrate the davinci_emac driver to using the
eth_device->write_hwaddr function pointer as suggested by Ben Warren.

All the davinci boards had the behaviour, prior to this patch, of
sync'ing the environment variable enetaddr with the MAC address read
from non-volatile storage on boot -- when the two locations disagreed,
the environment variable value took precendence. This patch keeps the
same behaviour but lets eth_initialize take care of it.

This patch refactors davinci_emac setup in the boards so that the MAC
address is read from non-volatile storage into the environment variable
and then the environment variable value is use in eth_intialize. The
only exception is the direct call to davinci_eth_set_mac_addr made by
the da830evm board init which was changed into an assignment of the
enetaddr field.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Ben Warren <biggerbadderben@gmail.com>
CC: Nick Thompson <nick.thompson@ge.com>

--

V4:
  * no changes
V3:
  * rebased to u-boot/next, removed additional direct call of
    davinci_eth_set_mac_addr added to board_init_r by Heiko's
    relocation patches
V2:
  * introduced this patch
---
 arch/arm/include/asm/arch-davinci/emac_defs.h |    1 -
 arch/arm/lib/board.c                          |   19 ------
 board/davinci/common/misc.c                   |   41 +++----------
 board/davinci/common/misc.h                   |    2 +-
 board/davinci/da8xxevm/da830evm.c             |   15 ++++-
 board/davinci/dm365evm/dm365evm.c             |    2 +-
 board/davinci/dvevm/dvevm.c                   |    2 +-
 board/davinci/sffsdr/sffsdr.c                 |    2 +-
 board/davinci/sonata/sonata.c                 |    2 +-
 drivers/net/davinci_emac.c                    |   80 ++++++++++++-------------
 10 files changed, 64 insertions(+), 102 deletions(-)

diff --git a/arch/arm/include/asm/arch-davinci/emac_defs.h b/arch/arm/include/asm/arch-davinci/emac_defs.h
index 35a1585..76493a1 100644
--- a/arch/arm/include/asm/arch-davinci/emac_defs.h
+++ b/arch/arm/include/asm/arch-davinci/emac_defs.h
@@ -367,7 +367,6 @@ typedef struct  {
 
 int davinci_eth_phy_read(u_int8_t phy_addr, u_int8_t reg_num, u_int16_t *data);
 int davinci_eth_phy_write(u_int8_t phy_addr, u_int8_t reg_num, u_int16_t data);
-void davinci_eth_set_mac_addr(const u_int8_t *addr);
 
 typedef struct
 {
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 5f2dfd0..22bd2c9 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -409,15 +409,6 @@ void start_armboot (void)
 	enable_interrupts ();
 
 	/* Perform network card initialisation if necessary */
-#ifdef CONFIG_DRIVER_TI_EMAC
-	/* XXX: this needs to be moved to board init */
-extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
-	if (getenv ("ethaddr")) {
-		uchar enetaddr[6];
-		eth_getenv_enetaddr("ethaddr", enetaddr);
-		davinci_eth_set_mac_addr(enetaddr);
-	}
-#endif
 
 #if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96)
 	/* XXX: this needs to be moved to board init */
@@ -821,16 +812,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	enable_interrupts ();
 
 	/* Perform network card initialisation if necessary */
-#ifdef CONFIG_DRIVER_TI_EMAC
-	/* XXX: this needs to be moved to board init */
-extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
-	if (getenv ("ethaddr")) {
-		uchar enetaddr[6];
-		eth_getenv_enetaddr("ethaddr", enetaddr);
-		davinci_eth_set_mac_addr(enetaddr);
-	}
-#endif
-
 #if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96)
 	/* XXX: this needs to be moved to board init */
 	if (getenv ("ethaddr")) {
diff --git a/board/davinci/common/misc.c b/board/davinci/common/misc.c
index 86a875e..b60a46e 100644
--- a/board/davinci/common/misc.c
+++ b/board/davinci/common/misc.c
@@ -85,45 +85,22 @@ err:
 	return 0;
 }
 
-/* If there is a MAC address in the environment, and if it is not identical to
- * the MAC address in the EEPROM, then a warning is printed and the MAC address
- * from the environment is used.
- *
+/*
  * If there is no MAC address in the environment, then it will be initialized
  * (silently) from the value in the EEPROM.
  */
-void dv_configure_mac_address(uint8_t *rom_enetaddr)
+void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr)
 {
-	int i;
-	u_int8_t env_enetaddr[6];
-	char *tmp = getenv("ethaddr");
-	char *end;
-
-	/* Read Ethernet MAC address from the U-Boot environment.
-	 * If it is not defined, env_enetaddr[] will be cleared. */
-	for (i = 0; i < 6; i++) {
-		env_enetaddr[i] = tmp ? simple_strtoul(tmp, &end, 16) : 0;
-		if (tmp)
-			tmp = (*end) ? end+1 : end;
-	}
-
-	/* Check if EEPROM and U-Boot environment MAC addresses match. */
-	if (memcmp(env_enetaddr, "\0\0\0\0\0\0", 6) != 0 &&
-	    memcmp(env_enetaddr, rom_enetaddr, 6) != 0) {
-		printf("Warning: MAC addresses don't match:\n");
-		printf("  EEPROM MAC address: %pM\n", rom_enetaddr);
-		printf("     \"ethaddr\" value: %pM\n", env_enetaddr) ;
-		debug("### Using MAC address from environment\n");
-	}
-	if (!tmp) {
-		char ethaddr[20];
+	uint8_t env_enetaddr[6];
 
+	eth_getenv_enetaddr_by_index(0, env_enetaddr);
+	if (!memcmp(env_enetaddr, "\0\0\0\0\0\0", 6)) {
 		/* There is no MAC address in the environment, so we initialize
 		 * it from the value in the EEPROM. */
-		sprintf(ethaddr, "%pM", rom_enetaddr) ;
-		debug("### Setting environment from EEPROM MAC address = \"%s\"\n",
-		      ethaddr);
-		setenv("ethaddr", ethaddr);
+		debug("### Setting environment from EEPROM MAC address = "
+			"\"%pM\"\n",
+			env_enetaddr);
+		eth_setenv_enetaddr("ethaddr", rom_enetaddr);
 	}
 }
 
diff --git a/board/davinci/common/misc.h b/board/davinci/common/misc.h
index 329c369..a6ac3b9 100644
--- a/board/davinci/common/misc.h
+++ b/board/davinci/common/misc.h
@@ -46,7 +46,7 @@ struct pinmux_resource {
 			  }
 
 int dvevm_read_mac_address(uint8_t *buf);
-void dv_configure_mac_address(uint8_t *rom_enetaddr);
+void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr);
 int davinci_configure_pin_mux(const struct pinmux_config *pins, int n_pins);
 int davinci_configure_pin_mux_items(const struct pinmux_resource *item,
 				    int n_items);
diff --git a/board/davinci/da8xxevm/da830evm.c b/board/davinci/da8xxevm/da830evm.c
index 6baa860..d5a228f 100644
--- a/board/davinci/da8xxevm/da830evm.c
+++ b/board/davinci/da8xxevm/da830evm.c
@@ -196,19 +196,17 @@ int board_eth_init(bd_t *bis)
 {
 	u_int8_t mac_addr[6];
 	u_int8_t switch_start_cmd[2] = { 0x01, 0x23 };
+	struct eth_device *dev;
 
 	/* Read Ethernet MAC address from EEPROM */
 	if (dvevm_read_mac_address(mac_addr))
 		/* set address env if not already set */
-		dv_configure_mac_address(mac_addr);
+		davinci_sync_env_enetaddr(mac_addr);
 
 	/* read the address back from env */
 	if (!eth_getenv_enetaddr("ethaddr", mac_addr))
 		return -1;
 
-	/* provide the resulting addr to the driver */
-	davinci_eth_set_mac_addr(mac_addr);
-
 	/* enable the Ethernet switch in the 3 port PHY */
 	if (i2c_write(PHY_SW_I2C_ADDR, 0, 0,
 			switch_start_cmd, sizeof(switch_start_cmd))) {
@@ -222,6 +220,15 @@ int board_eth_init(bd_t *bis)
 		return -1;
 	}
 
+	dev = eth_get_dev();
+
+	/* provide the resulting addr to the driver */
+	memcpy(dev->enetaddr, mac_addr, 6);
+	if (!dev->write_hwaddr(dev)) {
+		printf("Error: Could not set MAC address\n");
+		return -1;
+	}
+
 	return 0;
 }
 #endif /* CONFIG_DRIVER_TI_EMAC */
diff --git a/board/davinci/dm365evm/dm365evm.c b/board/davinci/dm365evm/dm365evm.c
index 290eb99..85dbe2a 100644
--- a/board/davinci/dm365evm/dm365evm.c
+++ b/board/davinci/dm365evm/dm365evm.c
@@ -68,7 +68,7 @@ int board_eth_init(bd_t *bis)
 
 	/* Read Ethernet MAC address from EEPROM */
 	if (dvevm_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	davinci_emac_initialize();
 
diff --git a/board/davinci/dvevm/dvevm.c b/board/davinci/dvevm/dvevm.c
index 98937a9..073c21a 100644
--- a/board/davinci/dvevm/dvevm.c
+++ b/board/davinci/dvevm/dvevm.c
@@ -71,7 +71,7 @@ int misc_init_r(void)
 
 	/* Read Ethernet MAC address from EEPROM if available. */
 	if (dvevm_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	i2c_read(0x39, 0x00, 1, &video_mode, 1);
 
diff --git a/board/davinci/sffsdr/sffsdr.c b/board/davinci/sffsdr/sffsdr.c
index c24b9e1..657cf2b 100644
--- a/board/davinci/sffsdr/sffsdr.c
+++ b/board/davinci/sffsdr/sffsdr.c
@@ -141,7 +141,7 @@ int misc_init_r(void)
 
 	/* Read Ethernet MAC address from EEPROM if available. */
 	if (sffsdr_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	return(0);
 }
diff --git a/board/davinci/sonata/sonata.c b/board/davinci/sonata/sonata.c
index 817970a..1dc42c4 100644
--- a/board/davinci/sonata/sonata.c
+++ b/board/davinci/sonata/sonata.c
@@ -70,7 +70,7 @@ int misc_init_r(void)
 
 	/* Read Ethernet MAC address from EEPROM if available. */
 	if (dvevm_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	return(0);
 }
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 41a9910..e06896f 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -65,21 +65,6 @@ void eth_mdio_enable(void)
 	davinci_eth_mdio_enable();
 }
 
-static u_int8_t davinci_eth_mac_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-
-/*
- * This function must be called before emac_open() if you want to override
- * the default mac address.
- */
-void davinci_eth_set_mac_addr(const u_int8_t *addr)
-{
-	int i;
-
-	for (i = 0; i < sizeof (davinci_eth_mac_addr); i++) {
-		davinci_eth_mac_addr[i] = addr[i];
-	}
-}
-
 /* EMAC Addresses */
 static volatile emac_regs	*adap_emac = (emac_regs *)EMAC_BASE_ADDR;
 static volatile ewrap_regs	*adap_ewrap = (ewrap_regs *)EMAC_WRAPPER_BASE_ADDR;
@@ -100,6 +85,43 @@ static volatile u_int8_t	active_phy_addr = 0xff;
 
 phy_t				phy;
 
+static int davinci_eth_set_mac_addr(struct eth_device *dev)
+{
+	unsigned long		mac_hi;
+	unsigned long		mac_lo;
+
+	/*
+	 * Set MAC Addresses & Init multicast Hash to 0 (disable any multicast
+	 * receive)
+	 *  Using channel 0 only - other channels are disabled
+	 *  */
+	writel(0, &adap_emac->MACINDEX);
+	mac_hi = (dev->enetaddr[3] << 24) |
+		 (dev->enetaddr[2] << 16) |
+		 (dev->enetaddr[1] << 8)  |
+		 (dev->enetaddr[0]);
+	mac_lo = (dev->enetaddr[5] << 8) |
+		 (dev->enetaddr[4]);
+
+	writel(mac_hi, &adap_emac->MACADDRHI);
+#if defined(DAVINCI_EMAC_VERSION2)
+	writel(mac_lo | EMAC_MAC_ADDR_IS_VALID | EMAC_MAC_ADDR_MATCH,
+	       &adap_emac->MACADDRLO);
+#else
+	writel(mac_lo, &adap_emac->MACADDRLO);
+#endif
+
+	writel(0, &adap_emac->MACHASH1);
+	writel(0, &adap_emac->MACHASH2);
+
+	/* Set source MAC address - REQUIRED */
+	writel(mac_hi, &adap_emac->MACSRCADDRHI);
+	writel(mac_lo, &adap_emac->MACSRCADDRLO);
+
+
+	return 0;
+}
+
 static void davinci_eth_mdio_enable(void)
 {
 	u_int32_t	clkdiv;
@@ -286,8 +308,6 @@ static int davinci_eth_open(struct eth_device *dev, bd_t *bis)
 	dv_reg_p		addr;
 	u_int32_t		clkdiv, cnt;
 	volatile emac_desc	*rx_desc;
-	unsigned long		mac_hi;
-	unsigned long		mac_lo;
 
 	debug_emac("+ emac_open\n");
 
@@ -311,30 +331,7 @@ static int davinci_eth_open(struct eth_device *dev, bd_t *bis)
 	writel(1, &adap_emac->TXCONTROL);
 	writel(1, &adap_emac->RXCONTROL);
 
-	/* Set MAC Addresses & Init multicast Hash to 0 (disable any multicast receive) */
-	/* Using channel 0 only - other channels are disabled */
-	writel(0, &adap_emac->MACINDEX);
-	mac_hi = (davinci_eth_mac_addr[3] << 24) |
-		 (davinci_eth_mac_addr[2] << 16) |
-		 (davinci_eth_mac_addr[1] << 8)  |
-		 (davinci_eth_mac_addr[0]);
-	mac_lo = (davinci_eth_mac_addr[5] << 8) |
-		 (davinci_eth_mac_addr[4]);
-
-	writel(mac_hi, &adap_emac->MACADDRHI);
-#if defined(DAVINCI_EMAC_VERSION2)
-	writel(mac_lo | EMAC_MAC_ADDR_IS_VALID | EMAC_MAC_ADDR_MATCH,
-	       &adap_emac->MACADDRLO);
-#else
-	writel(mac_lo, &adap_emac->MACADDRLO);
-#endif
-
-	writel(0, &adap_emac->MACHASH1);
-	writel(0, &adap_emac->MACHASH2);
-
-	/* Set source MAC address - REQUIRED */
-	writel(mac_hi, &adap_emac->MACSRCADDRHI);
-	writel(mac_lo, &adap_emac->MACSRCADDRLO);
+	davinci_eth_set_mac_addr(dev);
 
 	/* Set DMA 8 TX / 8 RX Head pointers to 0 */
 	addr = &adap_emac->TX0HDP;
@@ -636,6 +633,7 @@ int davinci_emac_initialize(void)
 	dev->halt = davinci_eth_close;
 	dev->send = davinci_eth_send_packet;
 	dev->recv = davinci_eth_rcv_packet;
+	dev->write_hwaddr = davinci_eth_set_mac_addr;
 
 	eth_register(dev);
 
-- 
1.7.0.4

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

* [U-Boot] [PATCH v4 2/2][NEXT] da850evm: basic MII EMAC support
  2010-09-22 18:44           ` [U-Boot] [PATCH v4 0/2][NEXT] da850evm " Ben Gardiner
  2010-09-22 18:44             ` [U-Boot] [PATCH v4 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
@ 2010-09-22 18:44             ` Ben Gardiner
  2010-09-23 13:33             ` [U-Boot] [PATCH v5 0/2][NEXT] da850evm " Ben Gardiner
  2 siblings, 0 replies; 31+ messages in thread
From: Ben Gardiner @ 2010-09-22 18:44 UTC (permalink / raw)
  To: u-boot

The current da850evm support in u-boot/master omits any use of
the davinci EMAC. This patch adds basic support for the EMAC using
the MII PHY found on the baseboard of the EVM. The MAC address is
read from the environment variable 'ethadd'. Note that this is
different from the da850evm support in the u-boot omapl1 tree
where the MAC address is read from SPI flash.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Sandeep Paulraj <s-paulraj@ti.com>
CC: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
CC: Ben Warren <biggerbadderben@gmail.com>
CC: Mike Frysinger <vapier@gentoo.org>

---

V4:
 * make the emac_pins static
V3:
 * rebased to u-boot/next
V2:
 * added SOB
 * renumbered this patch from 1/1 to 2/2
 * just initialize the driver and let eth_initialize() take care of
   setting the MAC address from the environment variable enetaddr
---
 board/davinci/da8xxevm/da850evm.c |   50 +++++++++++++++++++++++++++++++++++++
 include/configs/da850evm.h        |   15 +++++++++++
 2 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index eeb456c..c063bbe 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -23,7 +23,11 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <net.h>
+#include <netdev.h>
 #include <asm/arch/hardware.h>
+#include <asm/arch/emif_defs.h>
+#include <asm/arch/emac_defs.h>
 #include <asm/io.h>
 #include "../common/misc.h"
 #include "common.h"
@@ -48,6 +52,28 @@ static const struct pinmux_config uart_pins[] = {
 	{ pinmux(4), 2, 5 }
 };
 
+#ifdef CONFIG_DRIVER_TI_EMAC
+static const struct pinmux_config emac_pins[] = {
+	{ pinmux(2), 8, 1 },
+	{ pinmux(2), 8, 2 },
+	{ pinmux(2), 8, 3 },
+	{ pinmux(2), 8, 4 },
+	{ pinmux(2), 8, 5 },
+	{ pinmux(2), 8, 6 },
+	{ pinmux(2), 8, 7 },
+	{ pinmux(3), 8, 0 },
+	{ pinmux(3), 8, 1 },
+	{ pinmux(3), 8, 2 },
+	{ pinmux(3), 8, 3 },
+	{ pinmux(3), 8, 4 },
+	{ pinmux(3), 8, 5 },
+	{ pinmux(3), 8, 6 },
+	{ pinmux(3), 8, 7 },
+	{ pinmux(4), 8, 0 },
+	{ pinmux(4), 8, 1 }
+};
+#endif /* CONFIG_DRIVER_TI_EMAC */
+
 /* I2C pin muxer settings */
 static const struct pinmux_config i2c_pins[] = {
 	{ pinmux(4), 2, 2 },
@@ -102,6 +128,14 @@ int board_init(void)
 	if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes)))
 		return 1;
 
+#ifdef CONFIG_DRIVER_TI_EMAC
+	if (davinci_configure_pin_mux(emac_pins, ARRAY_SIZE(emac_pins)) != 0)
+		return 1;
+	/* set cfgchip3 to select MII */
+	writel(readl(&davinci_syscfg_regs->cfgchip3) & ~(1 << 8),
+			     &davinci_syscfg_regs->cfgchip3);
+#endif /* CONFIG_DRIVER_TI_EMAC */
+
 	/* enable the console UART */
 	writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
 		DAVINCI_UART_PWREMU_MGMT_UTRST),
@@ -109,3 +143,19 @@ int board_init(void)
 
 	return 0;
 }
+
+#ifdef CONFIG_DRIVER_TI_EMAC
+
+/*
+ * Initializes on-board ethernet controllers.
+ */
+int board_eth_init(bd_t *bis)
+{
+	if (!davinci_emac_initialize()) {
+		printf("Error: Ethernet init failed!\n");
+		return -1;
+	}
+
+	return 0;
+}
+#endif /* CONFIG_DRIVER_TI_EMAC */
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index d02b196..236aa06 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -26,6 +26,7 @@
 /*
  * Board
  */
+#define CONFIG_DRIVER_TI_EMAC
 
 /*
  * SoC Configuration
@@ -79,6 +80,20 @@
 #define CONFIG_SYS_I2C_SLAVE		10 /* Bogus, master-only in U-Boot */
 
 /*
+ * Network & Ethernet Configuration
+ */
+#ifdef CONFIG_DRIVER_TI_EMAC
+#define CONFIG_EMAC_MDIO_PHY_NUM	0
+#define CONFIG_MII
+#define CONFIG_BOOTP_DEFAULT
+#define CONFIG_BOOTP_DNS
+#define CONFIG_BOOTP_DNS2
+#define CONFIG_BOOTP_SEND_HOSTNAME
+#define CONFIG_NET_RETRY_COUNT	10
+#define CONFIG_NET_MULTI
+#endif
+
+/*
  * U-Boot general configuration
  */
 #define CONFIG_BOOTFILE		"uImage" /* Boot file name */
-- 
1.7.0.4

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

* [U-Boot] [PATCH v4 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr
  2010-09-22 18:44             ` [U-Boot] [PATCH v4 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
@ 2010-09-23  9:03               ` Nick Thompson
  2010-09-23 13:24                 ` Ben Gardiner
  0 siblings, 1 reply; 31+ messages in thread
From: Nick Thompson @ 2010-09-23  9:03 UTC (permalink / raw)
  To: u-boot

On 22/09/10 19:44, Ben Gardiner wrote:
> This patch proposes to migrate the davinci_emac driver to using the
> eth_device->write_hwaddr function pointer as suggested by Ben Warren.
> 
> All the davinci boards had the behaviour, prior to this patch, of
> sync'ing the environment variable enetaddr with the MAC address read
> from non-volatile storage on boot -- when the two locations disagreed,
> the environment variable value took precendence. This patch keeps the
> same behaviour but lets eth_initialize take care of it.
> 
> This patch refactors davinci_emac setup in the boards so that the MAC
> address is read from non-volatile storage into the environment variable
> and then the environment variable value is use in eth_intialize. The
> only exception is the direct call to davinci_eth_set_mac_addr made by
> the da830evm board init which was changed into an assignment of the
> enetaddr field.
> 
> Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
> CC: Ben Warren <biggerbadderben@gmail.com>
> CC: Nick Thompson <nick.thompson@ge.com>
> 
> --
> 
> V4:
>   * no changes
> V3:
>   * rebased to u-boot/next, removed additional direct call of
>     davinci_eth_set_mac_addr added to board_init_r by Heiko's
>     relocation patches
> V2:
>   * introduced this patch
> ---
>  arch/arm/include/asm/arch-davinci/emac_defs.h |    1 -
>  arch/arm/lib/board.c                          |   19 ------
>  board/davinci/common/misc.c                   |   41 +++----------
>  board/davinci/common/misc.h                   |    2 +-
>  board/davinci/da8xxevm/da830evm.c             |   15 ++++-
>  board/davinci/dm365evm/dm365evm.c             |    2 +-
>  board/davinci/dvevm/dvevm.c                   |    2 +-
>  board/davinci/sffsdr/sffsdr.c                 |    2 +-
>  board/davinci/sonata/sonata.c                 |    2 +-
>  drivers/net/davinci_emac.c                    |   80 ++++++++++++-------------
>  10 files changed, 64 insertions(+), 102 deletions(-)
> 

[snip]

> diff --git a/board/davinci/da8xxevm/da830evm.c b/board/davinci/da8xxevm/da830evm.c
> index 6baa860..d5a228f 100644
> --- a/board/davinci/da8xxevm/da830evm.c
> +++ b/board/davinci/da8xxevm/da830evm.c
> @@ -196,19 +196,17 @@ int board_eth_init(bd_t *bis)
>  {
>  	u_int8_t mac_addr[6];
>  	u_int8_t switch_start_cmd[2] = { 0x01, 0x23 };
> +	struct eth_device *dev;
>  
>  	/* Read Ethernet MAC address from EEPROM */
>  	if (dvevm_read_mac_address(mac_addr))
>  		/* set address env if not already set */
> -		dv_configure_mac_address(mac_addr);
> +		davinci_sync_env_enetaddr(mac_addr);
>  
>  	/* read the address back from env */
>  	if (!eth_getenv_enetaddr("ethaddr", mac_addr))
>  		return -1;
>  
> -	/* provide the resulting addr to the driver */
> -	davinci_eth_set_mac_addr(mac_addr);
> -
>  	/* enable the Ethernet switch in the 3 port PHY */
>  	if (i2c_write(PHY_SW_I2C_ADDR, 0, 0,
>  			switch_start_cmd, sizeof(switch_start_cmd))) {
> @@ -222,6 +220,15 @@ int board_eth_init(bd_t *bis)
>  		return -1;
>  	}
>  
> +	dev = eth_get_dev();
> +
> +	/* provide the resulting addr to the driver */
> +	memcpy(dev->enetaddr, mac_addr, 6);
> +	if (!dev->write_hwaddr(dev)) {
> +		printf("Error: Could not set MAC address\n");
> +		return -1;
> +	}
> +
>  	return 0;
>  }
>  #endif /* CONFIG_DRIVER_TI_EMAC */

Hi Ben,

davinci_eth_set_mac_addr() always returns zero, so "if (!dev->write_hwaddr(dev))"
always appears to fail here. 

In net/eth.c the return code is not checked, so da830 should probably ignore it to:

diff --git a/board/davinci/da8xxevm/da830evm.c b/board/davinci/da8xxevm/da830evm.c
index d5a228f..8a9f988 100644
--- a/board/davinci/da8xxevm/da830evm.c
+++ b/board/davinci/da8xxevm/da830evm.c
@@ -224,10 +224,7 @@ int board_eth_init(bd_t *bis)
 
        /* provide the resulting addr to the driver */
        memcpy(dev->enetaddr, mac_addr, 6);
-       if (!dev->write_hwaddr(dev)) {
-               printf("Error: Could not set MAC address\n");
-               return -1;
-       }
+       dev->write_hwaddr(dev);
 
        return 0;
 }

With this change, this patch works on da830. I'll retest when you resubmit.

Nick.

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

* [U-Boot] [PATCH v4 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr
  2010-09-23  9:03               ` Nick Thompson
@ 2010-09-23 13:24                 ` Ben Gardiner
  0 siblings, 0 replies; 31+ messages in thread
From: Ben Gardiner @ 2010-09-23 13:24 UTC (permalink / raw)
  To: u-boot

On Thu, Sep 23, 2010 at 5:03 AM, Nick Thompson <nick.thompson@ge.com> wrote:
> davinci_eth_set_mac_addr() always returns zero, so "if (!dev->write_hwaddr(dev))"
> always appears to fail here.
>
> In net/eth.c the return code is not checked, so da830 should probably ignore it to:

You're absolutely right, Nick. Thanks for the review and testing; patch coming.

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca

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

* [U-Boot] [PATCH v5 0/2][NEXT] da850evm basic MII EMAC support
  2010-09-22 18:44           ` [U-Boot] [PATCH v4 0/2][NEXT] da850evm " Ben Gardiner
  2010-09-22 18:44             ` [U-Boot] [PATCH v4 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
  2010-09-22 18:44             ` [U-Boot] [PATCH v4 2/2][NEXT] da850evm: basic MII EMAC support Ben Gardiner
@ 2010-09-23 13:33             ` Ben Gardiner
  2010-09-23 13:33               ` [U-Boot] [PATCH v5 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
                                 ` (2 more replies)
  2 siblings, 3 replies; 31+ messages in thread
From: Ben Gardiner @ 2010-09-23 13:33 UTC (permalink / raw)
  To: u-boot

This patch series proposes to add basic MII support to the da850evm; the first
patch in the series refactors davinci EMAC setup. The second patch in the
series enables MII support.

Ben Gardiner (2):
  [NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr
  [NEXT] da850evm: basic MII EMAC support

 arch/arm/include/asm/arch-davinci/emac_defs.h |    1 -
 arch/arm/lib/board.c                          |   19 ------
 board/davinci/common/misc.c                   |   41 +++----------
 board/davinci/common/misc.h                   |    2 +-
 board/davinci/da8xxevm/da830evm.c             |   12 +++-
 board/davinci/da8xxevm/da850evm.c             |   50 +++++++++++++++
 board/davinci/dm365evm/dm365evm.c             |    2 +-
 board/davinci/dvevm/dvevm.c                   |    2 +-
 board/davinci/sffsdr/sffsdr.c                 |    2 +-
 board/davinci/sonata/sonata.c                 |    2 +-
 drivers/net/davinci_emac.c                    |   80 ++++++++++++-------------
 include/configs/da850evm.h                    |   15 +++++
 12 files changed, 126 insertions(+), 102 deletions(-)

---

V5:
 * don't check return code of write_hwaddr in da830 board setup
V4:
 * make the emac_pins static
V3:
 * rebased to u-boot/next
 * removed additional direct call of davinci_eth_set_mac_addr added to
   board_init_r by Heiko's relocation patches
V2:
 * added patch 1/2 to refactor davinci_emac setup
 * added SOB to 2/2

Tested on da850evm with MII PHY on baseboard.

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

* [U-Boot] [PATCH v5 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr
  2010-09-23 13:33             ` [U-Boot] [PATCH v5 0/2][NEXT] da850evm " Ben Gardiner
@ 2010-09-23 13:33               ` Ben Gardiner
  2010-09-23 13:49                 ` Nick Thompson
  2010-09-23 13:39               ` [U-Boot] [PATCH v5 2/2][NEXT] da850evm: basic MII EMAC support Ben Gardiner
  2010-09-23 13:58               ` [U-Boot] [PATCH v6 0/2][NEXT] da850evm " Ben Gardiner
  2 siblings, 1 reply; 31+ messages in thread
From: Ben Gardiner @ 2010-09-23 13:33 UTC (permalink / raw)
  To: u-boot

This patch proposes to migrate the davinci_emac driver to using the
eth_device->write_hwaddr function pointer as suggested by Ben Warren.

All the davinci boards had the behaviour, prior to this patch, of
sync'ing the environment variable enetaddr with the MAC address read
from non-volatile storage on boot -- when the two locations disagreed,
the environment variable value took precendence. This patch keeps the
same behaviour but lets eth_initialize take care of it.

This patch refactors davinci_emac setup in the boards so that the MAC
address is read from non-volatile storage into the environment variable
and then the environment variable value is use in eth_intialize. The
only exception is the direct call to davinci_eth_set_mac_addr made by
the da830evm board init which was changed into an assignment of the
enetaddr field.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Ben Warren <biggerbadderben@gmail.com>
CC: Nick Thompson <nick.thompson@ge.com>

--
V5:
  * don't check return code of write_hwaddr in da830 board setup
V4:
  * No change
V3:
  * rebased to u-boot/next, removed additional direct call of
    davinci_eth_set_mac_addr added to board_init_r by Heiko's
    relocation patches
V2:
  * introduced this patch
---
 arch/arm/include/asm/arch-davinci/emac_defs.h |    1 -
 arch/arm/lib/board.c                          |   19 ------
 board/davinci/common/misc.c                   |   41 +++----------
 board/davinci/common/misc.h                   |    2 +-
 board/davinci/da8xxevm/da830evm.c             |   12 +++-
 board/davinci/dm365evm/dm365evm.c             |    2 +-
 board/davinci/dvevm/dvevm.c                   |    2 +-
 board/davinci/sffsdr/sffsdr.c                 |    2 +-
 board/davinci/sonata/sonata.c                 |    2 +-
 drivers/net/davinci_emac.c                    |   80 ++++++++++++-------------
 10 files changed, 61 insertions(+), 102 deletions(-)

diff --git a/arch/arm/include/asm/arch-davinci/emac_defs.h b/arch/arm/include/asm/arch-davinci/emac_defs.h
index 35a1585..76493a1 100644
--- a/arch/arm/include/asm/arch-davinci/emac_defs.h
+++ b/arch/arm/include/asm/arch-davinci/emac_defs.h
@@ -367,7 +367,6 @@ typedef struct  {
 
 int davinci_eth_phy_read(u_int8_t phy_addr, u_int8_t reg_num, u_int16_t *data);
 int davinci_eth_phy_write(u_int8_t phy_addr, u_int8_t reg_num, u_int16_t data);
-void davinci_eth_set_mac_addr(const u_int8_t *addr);
 
 typedef struct
 {
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 5f2dfd0..22bd2c9 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -409,15 +409,6 @@ void start_armboot (void)
 	enable_interrupts ();
 
 	/* Perform network card initialisation if necessary */
-#ifdef CONFIG_DRIVER_TI_EMAC
-	/* XXX: this needs to be moved to board init */
-extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
-	if (getenv ("ethaddr")) {
-		uchar enetaddr[6];
-		eth_getenv_enetaddr("ethaddr", enetaddr);
-		davinci_eth_set_mac_addr(enetaddr);
-	}
-#endif
 
 #if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96)
 	/* XXX: this needs to be moved to board init */
@@ -821,16 +812,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	enable_interrupts ();
 
 	/* Perform network card initialisation if necessary */
-#ifdef CONFIG_DRIVER_TI_EMAC
-	/* XXX: this needs to be moved to board init */
-extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
-	if (getenv ("ethaddr")) {
-		uchar enetaddr[6];
-		eth_getenv_enetaddr("ethaddr", enetaddr);
-		davinci_eth_set_mac_addr(enetaddr);
-	}
-#endif
-
 #if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96)
 	/* XXX: this needs to be moved to board init */
 	if (getenv ("ethaddr")) {
diff --git a/board/davinci/common/misc.c b/board/davinci/common/misc.c
index 86a875e..b60a46e 100644
--- a/board/davinci/common/misc.c
+++ b/board/davinci/common/misc.c
@@ -85,45 +85,22 @@ err:
 	return 0;
 }
 
-/* If there is a MAC address in the environment, and if it is not identical to
- * the MAC address in the EEPROM, then a warning is printed and the MAC address
- * from the environment is used.
- *
+/*
  * If there is no MAC address in the environment, then it will be initialized
  * (silently) from the value in the EEPROM.
  */
-void dv_configure_mac_address(uint8_t *rom_enetaddr)
+void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr)
 {
-	int i;
-	u_int8_t env_enetaddr[6];
-	char *tmp = getenv("ethaddr");
-	char *end;
-
-	/* Read Ethernet MAC address from the U-Boot environment.
-	 * If it is not defined, env_enetaddr[] will be cleared. */
-	for (i = 0; i < 6; i++) {
-		env_enetaddr[i] = tmp ? simple_strtoul(tmp, &end, 16) : 0;
-		if (tmp)
-			tmp = (*end) ? end+1 : end;
-	}
-
-	/* Check if EEPROM and U-Boot environment MAC addresses match. */
-	if (memcmp(env_enetaddr, "\0\0\0\0\0\0", 6) != 0 &&
-	    memcmp(env_enetaddr, rom_enetaddr, 6) != 0) {
-		printf("Warning: MAC addresses don't match:\n");
-		printf("  EEPROM MAC address: %pM\n", rom_enetaddr);
-		printf("     \"ethaddr\" value: %pM\n", env_enetaddr) ;
-		debug("### Using MAC address from environment\n");
-	}
-	if (!tmp) {
-		char ethaddr[20];
+	uint8_t env_enetaddr[6];
 
+	eth_getenv_enetaddr_by_index(0, env_enetaddr);
+	if (!memcmp(env_enetaddr, "\0\0\0\0\0\0", 6)) {
 		/* There is no MAC address in the environment, so we initialize
 		 * it from the value in the EEPROM. */
-		sprintf(ethaddr, "%pM", rom_enetaddr) ;
-		debug("### Setting environment from EEPROM MAC address = \"%s\"\n",
-		      ethaddr);
-		setenv("ethaddr", ethaddr);
+		debug("### Setting environment from EEPROM MAC address = "
+			"\"%pM\"\n",
+			env_enetaddr);
+		eth_setenv_enetaddr("ethaddr", rom_enetaddr);
 	}
 }
 
diff --git a/board/davinci/common/misc.h b/board/davinci/common/misc.h
index 329c369..a6ac3b9 100644
--- a/board/davinci/common/misc.h
+++ b/board/davinci/common/misc.h
@@ -46,7 +46,7 @@ struct pinmux_resource {
 			  }
 
 int dvevm_read_mac_address(uint8_t *buf);
-void dv_configure_mac_address(uint8_t *rom_enetaddr);
+void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr);
 int davinci_configure_pin_mux(const struct pinmux_config *pins, int n_pins);
 int davinci_configure_pin_mux_items(const struct pinmux_resource *item,
 				    int n_items);
diff --git a/board/davinci/da8xxevm/da830evm.c b/board/davinci/da8xxevm/da830evm.c
index 6baa860..8a9f988 100644
--- a/board/davinci/da8xxevm/da830evm.c
+++ b/board/davinci/da8xxevm/da830evm.c
@@ -196,19 +196,17 @@ int board_eth_init(bd_t *bis)
 {
 	u_int8_t mac_addr[6];
 	u_int8_t switch_start_cmd[2] = { 0x01, 0x23 };
+	struct eth_device *dev;
 
 	/* Read Ethernet MAC address from EEPROM */
 	if (dvevm_read_mac_address(mac_addr))
 		/* set address env if not already set */
-		dv_configure_mac_address(mac_addr);
+		davinci_sync_env_enetaddr(mac_addr);
 
 	/* read the address back from env */
 	if (!eth_getenv_enetaddr("ethaddr", mac_addr))
 		return -1;
 
-	/* provide the resulting addr to the driver */
-	davinci_eth_set_mac_addr(mac_addr);
-
 	/* enable the Ethernet switch in the 3 port PHY */
 	if (i2c_write(PHY_SW_I2C_ADDR, 0, 0,
 			switch_start_cmd, sizeof(switch_start_cmd))) {
@@ -222,6 +220,12 @@ int board_eth_init(bd_t *bis)
 		return -1;
 	}
 
+	dev = eth_get_dev();
+
+	/* provide the resulting addr to the driver */
+	memcpy(dev->enetaddr, mac_addr, 6);
+	dev->write_hwaddr(dev);
+
 	return 0;
 }
 #endif /* CONFIG_DRIVER_TI_EMAC */
diff --git a/board/davinci/dm365evm/dm365evm.c b/board/davinci/dm365evm/dm365evm.c
index 290eb99..85dbe2a 100644
--- a/board/davinci/dm365evm/dm365evm.c
+++ b/board/davinci/dm365evm/dm365evm.c
@@ -68,7 +68,7 @@ int board_eth_init(bd_t *bis)
 
 	/* Read Ethernet MAC address from EEPROM */
 	if (dvevm_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	davinci_emac_initialize();
 
diff --git a/board/davinci/dvevm/dvevm.c b/board/davinci/dvevm/dvevm.c
index 98937a9..073c21a 100644
--- a/board/davinci/dvevm/dvevm.c
+++ b/board/davinci/dvevm/dvevm.c
@@ -71,7 +71,7 @@ int misc_init_r(void)
 
 	/* Read Ethernet MAC address from EEPROM if available. */
 	if (dvevm_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	i2c_read(0x39, 0x00, 1, &video_mode, 1);
 
diff --git a/board/davinci/sffsdr/sffsdr.c b/board/davinci/sffsdr/sffsdr.c
index c24b9e1..657cf2b 100644
--- a/board/davinci/sffsdr/sffsdr.c
+++ b/board/davinci/sffsdr/sffsdr.c
@@ -141,7 +141,7 @@ int misc_init_r(void)
 
 	/* Read Ethernet MAC address from EEPROM if available. */
 	if (sffsdr_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	return(0);
 }
diff --git a/board/davinci/sonata/sonata.c b/board/davinci/sonata/sonata.c
index 817970a..1dc42c4 100644
--- a/board/davinci/sonata/sonata.c
+++ b/board/davinci/sonata/sonata.c
@@ -70,7 +70,7 @@ int misc_init_r(void)
 
 	/* Read Ethernet MAC address from EEPROM if available. */
 	if (dvevm_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	return(0);
 }
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 41a9910..e06896f 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -65,21 +65,6 @@ void eth_mdio_enable(void)
 	davinci_eth_mdio_enable();
 }
 
-static u_int8_t davinci_eth_mac_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-
-/*
- * This function must be called before emac_open() if you want to override
- * the default mac address.
- */
-void davinci_eth_set_mac_addr(const u_int8_t *addr)
-{
-	int i;
-
-	for (i = 0; i < sizeof (davinci_eth_mac_addr); i++) {
-		davinci_eth_mac_addr[i] = addr[i];
-	}
-}
-
 /* EMAC Addresses */
 static volatile emac_regs	*adap_emac = (emac_regs *)EMAC_BASE_ADDR;
 static volatile ewrap_regs	*adap_ewrap = (ewrap_regs *)EMAC_WRAPPER_BASE_ADDR;
@@ -100,6 +85,43 @@ static volatile u_int8_t	active_phy_addr = 0xff;
 
 phy_t				phy;
 
+static int davinci_eth_set_mac_addr(struct eth_device *dev)
+{
+	unsigned long		mac_hi;
+	unsigned long		mac_lo;
+
+	/*
+	 * Set MAC Addresses & Init multicast Hash to 0 (disable any multicast
+	 * receive)
+	 *  Using channel 0 only - other channels are disabled
+	 *  */
+	writel(0, &adap_emac->MACINDEX);
+	mac_hi = (dev->enetaddr[3] << 24) |
+		 (dev->enetaddr[2] << 16) |
+		 (dev->enetaddr[1] << 8)  |
+		 (dev->enetaddr[0]);
+	mac_lo = (dev->enetaddr[5] << 8) |
+		 (dev->enetaddr[4]);
+
+	writel(mac_hi, &adap_emac->MACADDRHI);
+#if defined(DAVINCI_EMAC_VERSION2)
+	writel(mac_lo | EMAC_MAC_ADDR_IS_VALID | EMAC_MAC_ADDR_MATCH,
+	       &adap_emac->MACADDRLO);
+#else
+	writel(mac_lo, &adap_emac->MACADDRLO);
+#endif
+
+	writel(0, &adap_emac->MACHASH1);
+	writel(0, &adap_emac->MACHASH2);
+
+	/* Set source MAC address - REQUIRED */
+	writel(mac_hi, &adap_emac->MACSRCADDRHI);
+	writel(mac_lo, &adap_emac->MACSRCADDRLO);
+
+
+	return 0;
+}
+
 static void davinci_eth_mdio_enable(void)
 {
 	u_int32_t	clkdiv;
@@ -286,8 +308,6 @@ static int davinci_eth_open(struct eth_device *dev, bd_t *bis)
 	dv_reg_p		addr;
 	u_int32_t		clkdiv, cnt;
 	volatile emac_desc	*rx_desc;
-	unsigned long		mac_hi;
-	unsigned long		mac_lo;
 
 	debug_emac("+ emac_open\n");
 
@@ -311,30 +331,7 @@ static int davinci_eth_open(struct eth_device *dev, bd_t *bis)
 	writel(1, &adap_emac->TXCONTROL);
 	writel(1, &adap_emac->RXCONTROL);
 
-	/* Set MAC Addresses & Init multicast Hash to 0 (disable any multicast receive) */
-	/* Using channel 0 only - other channels are disabled */
-	writel(0, &adap_emac->MACINDEX);
-	mac_hi = (davinci_eth_mac_addr[3] << 24) |
-		 (davinci_eth_mac_addr[2] << 16) |
-		 (davinci_eth_mac_addr[1] << 8)  |
-		 (davinci_eth_mac_addr[0]);
-	mac_lo = (davinci_eth_mac_addr[5] << 8) |
-		 (davinci_eth_mac_addr[4]);
-
-	writel(mac_hi, &adap_emac->MACADDRHI);
-#if defined(DAVINCI_EMAC_VERSION2)
-	writel(mac_lo | EMAC_MAC_ADDR_IS_VALID | EMAC_MAC_ADDR_MATCH,
-	       &adap_emac->MACADDRLO);
-#else
-	writel(mac_lo, &adap_emac->MACADDRLO);
-#endif
-
-	writel(0, &adap_emac->MACHASH1);
-	writel(0, &adap_emac->MACHASH2);
-
-	/* Set source MAC address - REQUIRED */
-	writel(mac_hi, &adap_emac->MACSRCADDRHI);
-	writel(mac_lo, &adap_emac->MACSRCADDRLO);
+	davinci_eth_set_mac_addr(dev);
 
 	/* Set DMA 8 TX / 8 RX Head pointers to 0 */
 	addr = &adap_emac->TX0HDP;
@@ -636,6 +633,7 @@ int davinci_emac_initialize(void)
 	dev->halt = davinci_eth_close;
 	dev->send = davinci_eth_send_packet;
 	dev->recv = davinci_eth_rcv_packet;
+	dev->write_hwaddr = davinci_eth_set_mac_addr;
 
 	eth_register(dev);
 
-- 
1.7.0.4

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

* [U-Boot] [PATCH v5 2/2][NEXT] da850evm: basic MII EMAC support
  2010-09-23 13:33             ` [U-Boot] [PATCH v5 0/2][NEXT] da850evm " Ben Gardiner
  2010-09-23 13:33               ` [U-Boot] [PATCH v5 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
@ 2010-09-23 13:39               ` Ben Gardiner
  2010-09-23 13:58               ` [U-Boot] [PATCH v6 0/2][NEXT] da850evm " Ben Gardiner
  2 siblings, 0 replies; 31+ messages in thread
From: Ben Gardiner @ 2010-09-23 13:39 UTC (permalink / raw)
  To: u-boot

The current da850evm support in u-boot/master omits any use of
the davinci EMAC. This patch adds basic support for the EMAC using
the MII PHY found on the baseboard of the EVM. The MAC address is
read from the environment variable 'ethadd'. Note that this is
different from the da850evm support in the u-boot omapl1 tree
where the MAC address is read from SPI flash.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Sandeep Paulraj <s-paulraj@ti.com>
CC: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
CC: Ben Warren <biggerbadderben@gmail.com>
CC: Mike Frysinger <vapier@gentoo.org>

---
V5:
 * no changes
V4:
 * make the emac_pins static
V3:
 * rebased to u-boot/next
V2:
 * added SOB
 * renumbered this patch from 1/1 to 2/2
 * just initialize the driver and let eth_initialize() take care of
   setting the MAC address from the environment variable enetaddr
---
 board/davinci/da8xxevm/da850evm.c |   50 +++++++++++++++++++++++++++++++++++++
 include/configs/da850evm.h        |   15 +++++++++++
 2 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index eeb456c..c063bbe 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -23,7 +23,11 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <net.h>
+#include <netdev.h>
 #include <asm/arch/hardware.h>
+#include <asm/arch/emif_defs.h>
+#include <asm/arch/emac_defs.h>
 #include <asm/io.h>
 #include "../common/misc.h"
 #include "common.h"
@@ -48,6 +52,28 @@ static const struct pinmux_config uart_pins[] = {
 	{ pinmux(4), 2, 5 }
 };
 
+#ifdef CONFIG_DRIVER_TI_EMAC
+static const struct pinmux_config emac_pins[] = {
+	{ pinmux(2), 8, 1 },
+	{ pinmux(2), 8, 2 },
+	{ pinmux(2), 8, 3 },
+	{ pinmux(2), 8, 4 },
+	{ pinmux(2), 8, 5 },
+	{ pinmux(2), 8, 6 },
+	{ pinmux(2), 8, 7 },
+	{ pinmux(3), 8, 0 },
+	{ pinmux(3), 8, 1 },
+	{ pinmux(3), 8, 2 },
+	{ pinmux(3), 8, 3 },
+	{ pinmux(3), 8, 4 },
+	{ pinmux(3), 8, 5 },
+	{ pinmux(3), 8, 6 },
+	{ pinmux(3), 8, 7 },
+	{ pinmux(4), 8, 0 },
+	{ pinmux(4), 8, 1 }
+};
+#endif /* CONFIG_DRIVER_TI_EMAC */
+
 /* I2C pin muxer settings */
 static const struct pinmux_config i2c_pins[] = {
 	{ pinmux(4), 2, 2 },
@@ -102,6 +128,14 @@ int board_init(void)
 	if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes)))
 		return 1;
 
+#ifdef CONFIG_DRIVER_TI_EMAC
+	if (davinci_configure_pin_mux(emac_pins, ARRAY_SIZE(emac_pins)) != 0)
+		return 1;
+	/* set cfgchip3 to select MII */
+	writel(readl(&davinci_syscfg_regs->cfgchip3) & ~(1 << 8),
+			     &davinci_syscfg_regs->cfgchip3);
+#endif /* CONFIG_DRIVER_TI_EMAC */
+
 	/* enable the console UART */
 	writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
 		DAVINCI_UART_PWREMU_MGMT_UTRST),
@@ -109,3 +143,19 @@ int board_init(void)
 
 	return 0;
 }
+
+#ifdef CONFIG_DRIVER_TI_EMAC
+
+/*
+ * Initializes on-board ethernet controllers.
+ */
+int board_eth_init(bd_t *bis)
+{
+	if (!davinci_emac_initialize()) {
+		printf("Error: Ethernet init failed!\n");
+		return -1;
+	}
+
+	return 0;
+}
+#endif /* CONFIG_DRIVER_TI_EMAC */
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index d02b196..236aa06 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -26,6 +26,7 @@
 /*
  * Board
  */
+#define CONFIG_DRIVER_TI_EMAC
 
 /*
  * SoC Configuration
@@ -79,6 +80,20 @@
 #define CONFIG_SYS_I2C_SLAVE		10 /* Bogus, master-only in U-Boot */
 
 /*
+ * Network & Ethernet Configuration
+ */
+#ifdef CONFIG_DRIVER_TI_EMAC
+#define CONFIG_EMAC_MDIO_PHY_NUM	0
+#define CONFIG_MII
+#define CONFIG_BOOTP_DEFAULT
+#define CONFIG_BOOTP_DNS
+#define CONFIG_BOOTP_DNS2
+#define CONFIG_BOOTP_SEND_HOSTNAME
+#define CONFIG_NET_RETRY_COUNT	10
+#define CONFIG_NET_MULTI
+#endif
+
+/*
  * U-Boot general configuration
  */
 #define CONFIG_BOOTFILE		"uImage" /* Boot file name */
-- 
1.7.0.4

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

* [U-Boot] [PATCH v5 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr
  2010-09-23 13:33               ` [U-Boot] [PATCH v5 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
@ 2010-09-23 13:49                 ` Nick Thompson
  2010-09-23 13:53                   ` Ben Gardiner
  0 siblings, 1 reply; 31+ messages in thread
From: Nick Thompson @ 2010-09-23 13:49 UTC (permalink / raw)
  To: u-boot

On 23/09/10 14:33, Ben Gardiner wrote:
> This patch proposes to migrate the davinci_emac driver to using the
> eth_device->write_hwaddr function pointer as suggested by Ben Warren.
> 
> All the davinci boards had the behaviour, prior to this patch, of
> sync'ing the environment variable enetaddr with the MAC address read
> from non-volatile storage on boot -- when the two locations disagreed,
> the environment variable value took precendence. This patch keeps the
> same behaviour but lets eth_initialize take care of it.
> 
> This patch refactors davinci_emac setup in the boards so that the MAC
> address is read from non-volatile storage into the environment variable
> and then the environment variable value is use in eth_intialize. The
> only exception is the direct call to davinci_eth_set_mac_addr made by
> the da830evm board init which was changed into an assignment of the
> enetaddr field.
> 
> Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
> CC: Ben Warren <biggerbadderben@gmail.com>
> CC: Nick Thompson <nick.thompson@ge.com>
> 
> --
> V5:
>   * don't check return code of write_hwaddr in da830 board setup
> V4:
>   * No change
> V3:
>   * rebased to u-boot/next, removed additional direct call of
>     davinci_eth_set_mac_addr added to board_init_r by Heiko's
>     relocation patches
> V2:
>   * introduced this patch
> ---

Shouldn't this version information go below the '---' line. As it is,
it appears in the log message after using 'git am' to apply. Sorry,
I should have noticed that earlier.

Patch works correctly on da830evm.

Tested-by: Nick Thompson <nick.thompson@ge.com>

Thanks,
Nick.

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

* [U-Boot] [PATCH v5 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr
  2010-09-23 13:49                 ` Nick Thompson
@ 2010-09-23 13:53                   ` Ben Gardiner
  0 siblings, 0 replies; 31+ messages in thread
From: Ben Gardiner @ 2010-09-23 13:53 UTC (permalink / raw)
  To: u-boot

On Thu, Sep 23, 2010 at 9:49 AM, Nick Thompson <nick.thompson@ge.com> wrote:
> Shouldn't this version information go below the '---' line. As it is,
> it appears in the log message after using 'git am' to apply. Sorry,
> I should have noticed that earlier.

Yeah, I'm missing a third '-' there.
No need to apologize -- I appreciate the thorough review.
One more update on the way.

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca

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

* [U-Boot] [PATCH v6 0/2][NEXT] da850evm basic MII EMAC support
  2010-09-23 13:33             ` [U-Boot] [PATCH v5 0/2][NEXT] da850evm " Ben Gardiner
  2010-09-23 13:33               ` [U-Boot] [PATCH v5 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
  2010-09-23 13:39               ` [U-Boot] [PATCH v5 2/2][NEXT] da850evm: basic MII EMAC support Ben Gardiner
@ 2010-09-23 13:58               ` Ben Gardiner
  2010-09-23 13:58                 ` [U-Boot] [PATCH v6 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
  2010-09-23 13:59                 ` [U-Boot] [PATCH v6 2/2][NEXT] da850evm: basic MII EMAC support Ben Gardiner
  2 siblings, 2 replies; 31+ messages in thread
From: Ben Gardiner @ 2010-09-23 13:58 UTC (permalink / raw)
  To: u-boot

This patch series proposes to add basic MII support to the da850evm; the first
patch in the series refactors davinci EMAC setup. The second patch in the
series enables MII support.

Ben Gardiner (2):
  [NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr
  [NEXT] da850evm: basic MII EMAC support

 arch/arm/include/asm/arch-davinci/emac_defs.h |    1 -
 arch/arm/lib/board.c                          |   19 ------
 board/davinci/common/misc.c                   |   41 +++----------
 board/davinci/common/misc.h                   |    2 +-
 board/davinci/da8xxevm/da830evm.c             |   12 +++-
 board/davinci/da8xxevm/da850evm.c             |   50 +++++++++++++++
 board/davinci/dm365evm/dm365evm.c             |    2 +-
 board/davinci/dvevm/dvevm.c                   |    2 +-
 board/davinci/sffsdr/sffsdr.c                 |    2 +-
 board/davinci/sonata/sonata.c                 |    2 +-
 drivers/net/davinci_emac.c                    |   80 ++++++++++++-------------
 include/configs/da850evm.h                    |   15 +++++
 12 files changed, 126 insertions(+), 102 deletions(-)

---

V6:
 * fix tear-line
V5:
 * don't check return code of write_hwaddr in da830 board setup
V4:
 * make the emac_pins static
V3:
 * rebased to u-boot/next
 * removed additional direct call of davinci_eth_set_mac_addr added to
   board_init_r by Heiko's relocation patches
V2:
 * added patch 1/2 to refactor davinci_emac setup
 * added SOB to 2/2

Tested on da850evm with MII PHY on baseboard.

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

* [U-Boot] [PATCH v6 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr
  2010-09-23 13:58               ` [U-Boot] [PATCH v6 0/2][NEXT] da850evm " Ben Gardiner
@ 2010-09-23 13:58                 ` Ben Gardiner
  2010-10-12  6:11                   ` Ben Warren
  2010-09-23 13:59                 ` [U-Boot] [PATCH v6 2/2][NEXT] da850evm: basic MII EMAC support Ben Gardiner
  1 sibling, 1 reply; 31+ messages in thread
From: Ben Gardiner @ 2010-09-23 13:58 UTC (permalink / raw)
  To: u-boot

This patch proposes to migrate the davinci_emac driver to using the
eth_device->write_hwaddr function pointer as suggested by Ben Warren.

All the davinci boards had the behaviour, prior to this patch, of
sync'ing the environment variable enetaddr with the MAC address read
from non-volatile storage on boot -- when the two locations disagreed,
the environment variable value took precendence. This patch keeps the
same behaviour but lets eth_initialize take care of it.

This patch refactors davinci_emac setup in the boards so that the MAC
address is read from non-volatile storage into the environment variable
and then the environment variable value is use in eth_intialize. The
only exception is the direct call to davinci_eth_set_mac_addr made by
the da830evm board init which was changed into an assignment of the
enetaddr field.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Tested-by: Nick Thompson <nick.thompson@ge.com>
CC: Ben Warren <biggerbadderben@gmail.com>

---

V6:
  * fix tear-line
V5:
  * don't check return code of write_hwaddr in da830 board setup
V4:
  * No change
V3:
  * rebased to u-boot/next, removed additional direct call of
    davinci_eth_set_mac_addr added to board_init_r by Heiko's
    relocation patches
V2:
  * introduced this patch
---
 arch/arm/include/asm/arch-davinci/emac_defs.h |    1 -
 arch/arm/lib/board.c                          |   19 ------
 board/davinci/common/misc.c                   |   41 +++----------
 board/davinci/common/misc.h                   |    2 +-
 board/davinci/da8xxevm/da830evm.c             |   12 +++-
 board/davinci/dm365evm/dm365evm.c             |    2 +-
 board/davinci/dvevm/dvevm.c                   |    2 +-
 board/davinci/sffsdr/sffsdr.c                 |    2 +-
 board/davinci/sonata/sonata.c                 |    2 +-
 drivers/net/davinci_emac.c                    |   80 ++++++++++++-------------
 10 files changed, 61 insertions(+), 102 deletions(-)

diff --git a/arch/arm/include/asm/arch-davinci/emac_defs.h b/arch/arm/include/asm/arch-davinci/emac_defs.h
index 35a1585..76493a1 100644
--- a/arch/arm/include/asm/arch-davinci/emac_defs.h
+++ b/arch/arm/include/asm/arch-davinci/emac_defs.h
@@ -367,7 +367,6 @@ typedef struct  {
 
 int davinci_eth_phy_read(u_int8_t phy_addr, u_int8_t reg_num, u_int16_t *data);
 int davinci_eth_phy_write(u_int8_t phy_addr, u_int8_t reg_num, u_int16_t data);
-void davinci_eth_set_mac_addr(const u_int8_t *addr);
 
 typedef struct
 {
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 5f2dfd0..22bd2c9 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -409,15 +409,6 @@ void start_armboot (void)
 	enable_interrupts ();
 
 	/* Perform network card initialisation if necessary */
-#ifdef CONFIG_DRIVER_TI_EMAC
-	/* XXX: this needs to be moved to board init */
-extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
-	if (getenv ("ethaddr")) {
-		uchar enetaddr[6];
-		eth_getenv_enetaddr("ethaddr", enetaddr);
-		davinci_eth_set_mac_addr(enetaddr);
-	}
-#endif
 
 #if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96)
 	/* XXX: this needs to be moved to board init */
@@ -821,16 +812,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	enable_interrupts ();
 
 	/* Perform network card initialisation if necessary */
-#ifdef CONFIG_DRIVER_TI_EMAC
-	/* XXX: this needs to be moved to board init */
-extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
-	if (getenv ("ethaddr")) {
-		uchar enetaddr[6];
-		eth_getenv_enetaddr("ethaddr", enetaddr);
-		davinci_eth_set_mac_addr(enetaddr);
-	}
-#endif
-
 #if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96)
 	/* XXX: this needs to be moved to board init */
 	if (getenv ("ethaddr")) {
diff --git a/board/davinci/common/misc.c b/board/davinci/common/misc.c
index 86a875e..b60a46e 100644
--- a/board/davinci/common/misc.c
+++ b/board/davinci/common/misc.c
@@ -85,45 +85,22 @@ err:
 	return 0;
 }
 
-/* If there is a MAC address in the environment, and if it is not identical to
- * the MAC address in the EEPROM, then a warning is printed and the MAC address
- * from the environment is used.
- *
+/*
  * If there is no MAC address in the environment, then it will be initialized
  * (silently) from the value in the EEPROM.
  */
-void dv_configure_mac_address(uint8_t *rom_enetaddr)
+void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr)
 {
-	int i;
-	u_int8_t env_enetaddr[6];
-	char *tmp = getenv("ethaddr");
-	char *end;
-
-	/* Read Ethernet MAC address from the U-Boot environment.
-	 * If it is not defined, env_enetaddr[] will be cleared. */
-	for (i = 0; i < 6; i++) {
-		env_enetaddr[i] = tmp ? simple_strtoul(tmp, &end, 16) : 0;
-		if (tmp)
-			tmp = (*end) ? end+1 : end;
-	}
-
-	/* Check if EEPROM and U-Boot environment MAC addresses match. */
-	if (memcmp(env_enetaddr, "\0\0\0\0\0\0", 6) != 0 &&
-	    memcmp(env_enetaddr, rom_enetaddr, 6) != 0) {
-		printf("Warning: MAC addresses don't match:\n");
-		printf("  EEPROM MAC address: %pM\n", rom_enetaddr);
-		printf("     \"ethaddr\" value: %pM\n", env_enetaddr) ;
-		debug("### Using MAC address from environment\n");
-	}
-	if (!tmp) {
-		char ethaddr[20];
+	uint8_t env_enetaddr[6];
 
+	eth_getenv_enetaddr_by_index(0, env_enetaddr);
+	if (!memcmp(env_enetaddr, "\0\0\0\0\0\0", 6)) {
 		/* There is no MAC address in the environment, so we initialize
 		 * it from the value in the EEPROM. */
-		sprintf(ethaddr, "%pM", rom_enetaddr) ;
-		debug("### Setting environment from EEPROM MAC address = \"%s\"\n",
-		      ethaddr);
-		setenv("ethaddr", ethaddr);
+		debug("### Setting environment from EEPROM MAC address = "
+			"\"%pM\"\n",
+			env_enetaddr);
+		eth_setenv_enetaddr("ethaddr", rom_enetaddr);
 	}
 }
 
diff --git a/board/davinci/common/misc.h b/board/davinci/common/misc.h
index 329c369..a6ac3b9 100644
--- a/board/davinci/common/misc.h
+++ b/board/davinci/common/misc.h
@@ -46,7 +46,7 @@ struct pinmux_resource {
 			  }
 
 int dvevm_read_mac_address(uint8_t *buf);
-void dv_configure_mac_address(uint8_t *rom_enetaddr);
+void davinci_sync_env_enetaddr(uint8_t *rom_enetaddr);
 int davinci_configure_pin_mux(const struct pinmux_config *pins, int n_pins);
 int davinci_configure_pin_mux_items(const struct pinmux_resource *item,
 				    int n_items);
diff --git a/board/davinci/da8xxevm/da830evm.c b/board/davinci/da8xxevm/da830evm.c
index 6baa860..8a9f988 100644
--- a/board/davinci/da8xxevm/da830evm.c
+++ b/board/davinci/da8xxevm/da830evm.c
@@ -196,19 +196,17 @@ int board_eth_init(bd_t *bis)
 {
 	u_int8_t mac_addr[6];
 	u_int8_t switch_start_cmd[2] = { 0x01, 0x23 };
+	struct eth_device *dev;
 
 	/* Read Ethernet MAC address from EEPROM */
 	if (dvevm_read_mac_address(mac_addr))
 		/* set address env if not already set */
-		dv_configure_mac_address(mac_addr);
+		davinci_sync_env_enetaddr(mac_addr);
 
 	/* read the address back from env */
 	if (!eth_getenv_enetaddr("ethaddr", mac_addr))
 		return -1;
 
-	/* provide the resulting addr to the driver */
-	davinci_eth_set_mac_addr(mac_addr);
-
 	/* enable the Ethernet switch in the 3 port PHY */
 	if (i2c_write(PHY_SW_I2C_ADDR, 0, 0,
 			switch_start_cmd, sizeof(switch_start_cmd))) {
@@ -222,6 +220,12 @@ int board_eth_init(bd_t *bis)
 		return -1;
 	}
 
+	dev = eth_get_dev();
+
+	/* provide the resulting addr to the driver */
+	memcpy(dev->enetaddr, mac_addr, 6);
+	dev->write_hwaddr(dev);
+
 	return 0;
 }
 #endif /* CONFIG_DRIVER_TI_EMAC */
diff --git a/board/davinci/dm365evm/dm365evm.c b/board/davinci/dm365evm/dm365evm.c
index 290eb99..85dbe2a 100644
--- a/board/davinci/dm365evm/dm365evm.c
+++ b/board/davinci/dm365evm/dm365evm.c
@@ -68,7 +68,7 @@ int board_eth_init(bd_t *bis)
 
 	/* Read Ethernet MAC address from EEPROM */
 	if (dvevm_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	davinci_emac_initialize();
 
diff --git a/board/davinci/dvevm/dvevm.c b/board/davinci/dvevm/dvevm.c
index 98937a9..073c21a 100644
--- a/board/davinci/dvevm/dvevm.c
+++ b/board/davinci/dvevm/dvevm.c
@@ -71,7 +71,7 @@ int misc_init_r(void)
 
 	/* Read Ethernet MAC address from EEPROM if available. */
 	if (dvevm_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	i2c_read(0x39, 0x00, 1, &video_mode, 1);
 
diff --git a/board/davinci/sffsdr/sffsdr.c b/board/davinci/sffsdr/sffsdr.c
index c24b9e1..657cf2b 100644
--- a/board/davinci/sffsdr/sffsdr.c
+++ b/board/davinci/sffsdr/sffsdr.c
@@ -141,7 +141,7 @@ int misc_init_r(void)
 
 	/* Read Ethernet MAC address from EEPROM if available. */
 	if (sffsdr_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	return(0);
 }
diff --git a/board/davinci/sonata/sonata.c b/board/davinci/sonata/sonata.c
index 817970a..1dc42c4 100644
--- a/board/davinci/sonata/sonata.c
+++ b/board/davinci/sonata/sonata.c
@@ -70,7 +70,7 @@ int misc_init_r(void)
 
 	/* Read Ethernet MAC address from EEPROM if available. */
 	if (dvevm_read_mac_address(eeprom_enetaddr))
-		dv_configure_mac_address(eeprom_enetaddr);
+		davinci_sync_env_enetaddr(eeprom_enetaddr);
 
 	return(0);
 }
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 41a9910..e06896f 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -65,21 +65,6 @@ void eth_mdio_enable(void)
 	davinci_eth_mdio_enable();
 }
 
-static u_int8_t davinci_eth_mac_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-
-/*
- * This function must be called before emac_open() if you want to override
- * the default mac address.
- */
-void davinci_eth_set_mac_addr(const u_int8_t *addr)
-{
-	int i;
-
-	for (i = 0; i < sizeof (davinci_eth_mac_addr); i++) {
-		davinci_eth_mac_addr[i] = addr[i];
-	}
-}
-
 /* EMAC Addresses */
 static volatile emac_regs	*adap_emac = (emac_regs *)EMAC_BASE_ADDR;
 static volatile ewrap_regs	*adap_ewrap = (ewrap_regs *)EMAC_WRAPPER_BASE_ADDR;
@@ -100,6 +85,43 @@ static volatile u_int8_t	active_phy_addr = 0xff;
 
 phy_t				phy;
 
+static int davinci_eth_set_mac_addr(struct eth_device *dev)
+{
+	unsigned long		mac_hi;
+	unsigned long		mac_lo;
+
+	/*
+	 * Set MAC Addresses & Init multicast Hash to 0 (disable any multicast
+	 * receive)
+	 *  Using channel 0 only - other channels are disabled
+	 *  */
+	writel(0, &adap_emac->MACINDEX);
+	mac_hi = (dev->enetaddr[3] << 24) |
+		 (dev->enetaddr[2] << 16) |
+		 (dev->enetaddr[1] << 8)  |
+		 (dev->enetaddr[0]);
+	mac_lo = (dev->enetaddr[5] << 8) |
+		 (dev->enetaddr[4]);
+
+	writel(mac_hi, &adap_emac->MACADDRHI);
+#if defined(DAVINCI_EMAC_VERSION2)
+	writel(mac_lo | EMAC_MAC_ADDR_IS_VALID | EMAC_MAC_ADDR_MATCH,
+	       &adap_emac->MACADDRLO);
+#else
+	writel(mac_lo, &adap_emac->MACADDRLO);
+#endif
+
+	writel(0, &adap_emac->MACHASH1);
+	writel(0, &adap_emac->MACHASH2);
+
+	/* Set source MAC address - REQUIRED */
+	writel(mac_hi, &adap_emac->MACSRCADDRHI);
+	writel(mac_lo, &adap_emac->MACSRCADDRLO);
+
+
+	return 0;
+}
+
 static void davinci_eth_mdio_enable(void)
 {
 	u_int32_t	clkdiv;
@@ -286,8 +308,6 @@ static int davinci_eth_open(struct eth_device *dev, bd_t *bis)
 	dv_reg_p		addr;
 	u_int32_t		clkdiv, cnt;
 	volatile emac_desc	*rx_desc;
-	unsigned long		mac_hi;
-	unsigned long		mac_lo;
 
 	debug_emac("+ emac_open\n");
 
@@ -311,30 +331,7 @@ static int davinci_eth_open(struct eth_device *dev, bd_t *bis)
 	writel(1, &adap_emac->TXCONTROL);
 	writel(1, &adap_emac->RXCONTROL);
 
-	/* Set MAC Addresses & Init multicast Hash to 0 (disable any multicast receive) */
-	/* Using channel 0 only - other channels are disabled */
-	writel(0, &adap_emac->MACINDEX);
-	mac_hi = (davinci_eth_mac_addr[3] << 24) |
-		 (davinci_eth_mac_addr[2] << 16) |
-		 (davinci_eth_mac_addr[1] << 8)  |
-		 (davinci_eth_mac_addr[0]);
-	mac_lo = (davinci_eth_mac_addr[5] << 8) |
-		 (davinci_eth_mac_addr[4]);
-
-	writel(mac_hi, &adap_emac->MACADDRHI);
-#if defined(DAVINCI_EMAC_VERSION2)
-	writel(mac_lo | EMAC_MAC_ADDR_IS_VALID | EMAC_MAC_ADDR_MATCH,
-	       &adap_emac->MACADDRLO);
-#else
-	writel(mac_lo, &adap_emac->MACADDRLO);
-#endif
-
-	writel(0, &adap_emac->MACHASH1);
-	writel(0, &adap_emac->MACHASH2);
-
-	/* Set source MAC address - REQUIRED */
-	writel(mac_hi, &adap_emac->MACSRCADDRHI);
-	writel(mac_lo, &adap_emac->MACSRCADDRLO);
+	davinci_eth_set_mac_addr(dev);
 
 	/* Set DMA 8 TX / 8 RX Head pointers to 0 */
 	addr = &adap_emac->TX0HDP;
@@ -636,6 +633,7 @@ int davinci_emac_initialize(void)
 	dev->halt = davinci_eth_close;
 	dev->send = davinci_eth_send_packet;
 	dev->recv = davinci_eth_rcv_packet;
+	dev->write_hwaddr = davinci_eth_set_mac_addr;
 
 	eth_register(dev);
 
-- 
1.7.0.4

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

* [U-Boot] [PATCH v6 2/2][NEXT] da850evm: basic MII EMAC support
  2010-09-23 13:58               ` [U-Boot] [PATCH v6 0/2][NEXT] da850evm " Ben Gardiner
  2010-09-23 13:58                 ` [U-Boot] [PATCH v6 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
@ 2010-09-23 13:59                 ` Ben Gardiner
  1 sibling, 0 replies; 31+ messages in thread
From: Ben Gardiner @ 2010-09-23 13:59 UTC (permalink / raw)
  To: u-boot

The current da850evm support in u-boot/master omits any use of
the davinci EMAC. This patch adds basic support for the EMAC using
the MII PHY found on the baseboard of the EVM. The MAC address is
read from the environment variable 'ethadd'. Note that this is
different from the da850evm support in the u-boot omapl1 tree
where the MAC address is read from SPI flash.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Sandeep Paulraj <s-paulraj@ti.com>
CC: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
CC: Ben Warren <biggerbadderben@gmail.com>
CC: Mike Frysinger <vapier@gentoo.org>

---

V6:
 * no change
V5:
 * no change
V4:
 * make the emac_pins static
V3:
 * rebased to u-boot/next
V2:
 * added SOB
 * renumbered this patch from 1/1 to 2/2
 * just initialize the driver and let eth_initialize() take care of
   setting the MAC address from the environment variable enetaddr
---
 board/davinci/da8xxevm/da850evm.c |   50 +++++++++++++++++++++++++++++++++++++
 include/configs/da850evm.h        |   15 +++++++++++
 2 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index eeb456c..c063bbe 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -23,7 +23,11 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <net.h>
+#include <netdev.h>
 #include <asm/arch/hardware.h>
+#include <asm/arch/emif_defs.h>
+#include <asm/arch/emac_defs.h>
 #include <asm/io.h>
 #include "../common/misc.h"
 #include "common.h"
@@ -48,6 +52,28 @@ static const struct pinmux_config uart_pins[] = {
 	{ pinmux(4), 2, 5 }
 };
 
+#ifdef CONFIG_DRIVER_TI_EMAC
+static const struct pinmux_config emac_pins[] = {
+	{ pinmux(2), 8, 1 },
+	{ pinmux(2), 8, 2 },
+	{ pinmux(2), 8, 3 },
+	{ pinmux(2), 8, 4 },
+	{ pinmux(2), 8, 5 },
+	{ pinmux(2), 8, 6 },
+	{ pinmux(2), 8, 7 },
+	{ pinmux(3), 8, 0 },
+	{ pinmux(3), 8, 1 },
+	{ pinmux(3), 8, 2 },
+	{ pinmux(3), 8, 3 },
+	{ pinmux(3), 8, 4 },
+	{ pinmux(3), 8, 5 },
+	{ pinmux(3), 8, 6 },
+	{ pinmux(3), 8, 7 },
+	{ pinmux(4), 8, 0 },
+	{ pinmux(4), 8, 1 }
+};
+#endif /* CONFIG_DRIVER_TI_EMAC */
+
 /* I2C pin muxer settings */
 static const struct pinmux_config i2c_pins[] = {
 	{ pinmux(4), 2, 2 },
@@ -102,6 +128,14 @@ int board_init(void)
 	if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes)))
 		return 1;
 
+#ifdef CONFIG_DRIVER_TI_EMAC
+	if (davinci_configure_pin_mux(emac_pins, ARRAY_SIZE(emac_pins)) != 0)
+		return 1;
+	/* set cfgchip3 to select MII */
+	writel(readl(&davinci_syscfg_regs->cfgchip3) & ~(1 << 8),
+			     &davinci_syscfg_regs->cfgchip3);
+#endif /* CONFIG_DRIVER_TI_EMAC */
+
 	/* enable the console UART */
 	writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
 		DAVINCI_UART_PWREMU_MGMT_UTRST),
@@ -109,3 +143,19 @@ int board_init(void)
 
 	return 0;
 }
+
+#ifdef CONFIG_DRIVER_TI_EMAC
+
+/*
+ * Initializes on-board ethernet controllers.
+ */
+int board_eth_init(bd_t *bis)
+{
+	if (!davinci_emac_initialize()) {
+		printf("Error: Ethernet init failed!\n");
+		return -1;
+	}
+
+	return 0;
+}
+#endif /* CONFIG_DRIVER_TI_EMAC */
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index d02b196..236aa06 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -26,6 +26,7 @@
 /*
  * Board
  */
+#define CONFIG_DRIVER_TI_EMAC
 
 /*
  * SoC Configuration
@@ -79,6 +80,20 @@
 #define CONFIG_SYS_I2C_SLAVE		10 /* Bogus, master-only in U-Boot */
 
 /*
+ * Network & Ethernet Configuration
+ */
+#ifdef CONFIG_DRIVER_TI_EMAC
+#define CONFIG_EMAC_MDIO_PHY_NUM	0
+#define CONFIG_MII
+#define CONFIG_BOOTP_DEFAULT
+#define CONFIG_BOOTP_DNS
+#define CONFIG_BOOTP_DNS2
+#define CONFIG_BOOTP_SEND_HOSTNAME
+#define CONFIG_NET_RETRY_COUNT	10
+#define CONFIG_NET_MULTI
+#endif
+
+/*
  * U-Boot general configuration
  */
 #define CONFIG_BOOTFILE		"uImage" /* Boot file name */
-- 
1.7.0.4

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

* [U-Boot] [PATCH v6 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr
  2010-09-23 13:58                 ` [U-Boot] [PATCH v6 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
@ 2010-10-12  6:11                   ` Ben Warren
  0 siblings, 0 replies; 31+ messages in thread
From: Ben Warren @ 2010-10-12  6:11 UTC (permalink / raw)
  To: u-boot

  Hi Ben,

On 9/23/2010 6:58 AM, Ben Gardiner wrote:
> This patch proposes to migrate the davinci_emac driver to using the
> eth_device->write_hwaddr function pointer as suggested by Ben Warren.
>
> All the davinci boards had the behaviour, prior to this patch, of
> sync'ing the environment variable enetaddr with the MAC address read
> from non-volatile storage on boot -- when the two locations disagreed,
> the environment variable value took precendence. This patch keeps the
> same behaviour but lets eth_initialize take care of it.
>
> This patch refactors davinci_emac setup in the boards so that the MAC
> address is read from non-volatile storage into the environment variable
> and then the environment variable value is use in eth_intialize. The
> only exception is the direct call to davinci_eth_set_mac_addr made by
> the da830evm board init which was changed into an assignment of the
> enetaddr field.
>
> Signed-off-by: Ben Gardiner<bengardiner@nanometrics.ca>
> Tested-by: Nick Thompson<nick.thompson@ge.com>
> CC: Ben Warren<biggerbadderben@gmail.com>
>
Added to net repo.

regards,
Ben

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

end of thread, other threads:[~2010-10-12  6:11 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-10 20:10 [U-Boot] [PATCH] da850evm: basic MII EMAC support Ben Gardiner
2010-09-11  4:01 ` Mike Frysinger
2010-09-13 12:55   ` Ben Gardiner
2010-09-14 13:00     ` Mike Frysinger
2010-09-14 13:07       ` Ben Gardiner
2010-09-13  3:45 ` Ben Warren
2010-09-13 13:07   ` Ben Gardiner
2010-09-13 13:16     ` Ben Warren
2010-09-13 21:04       ` [U-Boot] [PATCH v2 0/2] da850evm " Ben Gardiner
2010-09-13 21:04         ` [U-Boot] [PATCH v2 1/2] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
2010-09-14  8:37           ` Nick Thompson
2010-09-13 21:04         ` [U-Boot] [PATCH v2 2/2] da850evm: basic MII EMAC support Ben Gardiner
2010-09-22 17:16         ` [U-Boot] [PATCH v3 0/2][NEXT] da850evm " Ben Gardiner
2010-09-22 17:16           ` [U-Boot] [PATCH v3 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
2010-09-22 17:16           ` [U-Boot] [PATCH v3 2/2][NEXT] da850evm: basic MII EMAC support Ben Gardiner
2010-09-22 18:21             ` Mike Frysinger
2010-09-22 18:38               ` Ben Gardiner
2010-09-22 18:44           ` [U-Boot] [PATCH v4 0/2][NEXT] da850evm " Ben Gardiner
2010-09-22 18:44             ` [U-Boot] [PATCH v4 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
2010-09-23  9:03               ` Nick Thompson
2010-09-23 13:24                 ` Ben Gardiner
2010-09-22 18:44             ` [U-Boot] [PATCH v4 2/2][NEXT] da850evm: basic MII EMAC support Ben Gardiner
2010-09-23 13:33             ` [U-Boot] [PATCH v5 0/2][NEXT] da850evm " Ben Gardiner
2010-09-23 13:33               ` [U-Boot] [PATCH v5 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
2010-09-23 13:49                 ` Nick Thompson
2010-09-23 13:53                   ` Ben Gardiner
2010-09-23 13:39               ` [U-Boot] [PATCH v5 2/2][NEXT] da850evm: basic MII EMAC support Ben Gardiner
2010-09-23 13:58               ` [U-Boot] [PATCH v6 0/2][NEXT] da850evm " Ben Gardiner
2010-09-23 13:58                 ` [U-Boot] [PATCH v6 1/2][NEXT] davinci_emac: davinci_eth_set_mac_addr to ->write_hwaddr Ben Gardiner
2010-10-12  6:11                   ` Ben Warren
2010-09-23 13:59                 ` [U-Boot] [PATCH v6 2/2][NEXT] da850evm: basic MII EMAC support Ben Gardiner

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.