* [U-Boot] [PATCH v2] da830evm: Add support for TI EMAC
@ 2010-02-09 16:34 Nick Thompson
2010-02-09 16:47 ` Paulraj, Sandeep
0 siblings, 1 reply; 3+ messages in thread
From: Nick Thompson @ 2010-02-09 16:34 UTC (permalink / raw)
To: u-boot
Adds support for ethernet networking on the da830evm platform.
This platform uses an SoC EMAC interface and a 3 port ethernet
switch as a PHY with an RMII interface. The PHY also has a i2c
interface for configuring the switch functions.
Signed-off-by: Nick Thompson <nick.thompson@ge.com>
---
board/davinci/da830evm/da830evm.c | 65 +++++++++++++++++++++++++++++-
include/asm-arm/arch-davinci/emac_defs.h | 1 +
include/configs/da830evm.h | 1 +
3 files changed, 65 insertions(+), 2 deletions(-)
diff --git a/board/davinci/da830evm/da830evm.c b/board/davinci/da830evm/da830evm.c
index aac5c5c..ed668af 100644
--- a/board/davinci/da830evm/da830evm.c
+++ b/board/davinci/da830evm/da830evm.c
@@ -34,8 +34,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"
@@ -69,6 +72,20 @@ static const struct pinmux_config emifa_nand_pins[] = {
{ pinmux[18], 1, 5 },
};
+/* EMAC PHY interface pins */
+static const struct pinmux_config emac_pins[] = {
+ { pinmux[9], 0, 5 },
+ { pinmux[10], 2, 1 },
+ { pinmux[10], 2, 2 },
+ { pinmux[10], 2, 3 },
+ { pinmux[10], 2, 4 },
+ { pinmux[10], 2, 5 },
+ { pinmux[10], 2, 6 },
+ { pinmux[10], 2, 7 },
+ { pinmux[11], 2, 0 },
+ { pinmux[11], 2, 1 },
+};
+
/* UART pin muxer settings */
static const struct pinmux_config uart_pins[] = {
{ pinmux[8], 2, 7 },
@@ -77,8 +94,8 @@ static const struct pinmux_config uart_pins[] = {
/* I2C pin muxer settings */
static const struct pinmux_config i2c_pins[] = {
- { pinmux[9], 2, 3 },
- { pinmux[9], 2, 4 }
+ { pinmux[8], 2, 3 },
+ { pinmux[8], 2, 4 }
};
/* USB0_DRVVBUS pin muxer settings */
@@ -98,6 +115,9 @@ static const struct pinmux_resource pinmuxes[] = {
#ifdef CONFIG_USE_NAND
PINMUX_ITEM(emifa_nand_pins),
#endif
+#if defined(CONFIG_DRIVER_TI_EMAC)
+ PINMUX_ITEM(emac_pins),
+#endif
};
int board_init(void)
@@ -169,3 +189,44 @@ int board_init(void)
return(0);
}
+
+#if defined(CONFIG_DRIVER_TI_EMAC)
+
+#define PHY_SW_I2C_ADDR 0x5f /* Address of PHY on i2c bus */
+
+/*
+ * Initializes on-board ethernet controllers.
+ */
+int board_eth_init(bd_t *bis)
+{
+ u_int8_t mac_addr[6];
+ u_int8_t switch_start_cmd[2] = { 0x01, 0x23 };
+
+ /* 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);
+
+ /* 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))) {
+ printf("Ethernet switch start failed!\n");
+ return -1;
+ }
+
+ /* 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/asm-arm/arch-davinci/emac_defs.h b/include/asm-arm/arch-davinci/emac_defs.h
index 96bc80e..75b8bf6 100644
--- a/include/asm-arm/arch-davinci/emac_defs.h
+++ b/include/asm-arm/arch-davinci/emac_defs.h
@@ -316,6 +316,7 @@ 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/include/configs/da830evm.h b/include/configs/da830evm.h
index 65747fb..0f58e11 100644
--- a/include/configs/da830evm.h
+++ b/include/configs/da830evm.h
@@ -27,6 +27,7 @@
/*
* Board
*/
+#define CONFIG_DRIVER_TI_EMAC
/*
* SoC Configuration
--
1.6.3.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v2] da830evm: Add support for TI EMAC
2010-02-09 16:34 [U-Boot] [PATCH v2] da830evm: Add support for TI EMAC Nick Thompson
@ 2010-02-09 16:47 ` Paulraj, Sandeep
2010-02-09 17:15 ` Nick Thompson
0 siblings, 1 reply; 3+ messages in thread
From: Paulraj, Sandeep @ 2010-02-09 16:47 UTC (permalink / raw)
To: u-boot
>
> Adds support for ethernet networking on the da830evm platform.
>
> This platform uses an SoC EMAC interface and a 3 port ethernet
> switch as a PHY with an RMII interface. The PHY also has a i2c
> interface for configuring the switch functions.
>
> Signed-off-by: Nick Thompson <nick.thompson@ge.com>
> ---
> board/davinci/da830evm/da830evm.c | 65
> +++++++++++++++++++++++++++++-
> include/asm-arm/arch-davinci/emac_defs.h | 1 +
> include/configs/da830evm.h | 1 +
> 3 files changed, 65 insertions(+), 2 deletions(-)
Did you test this after integrating the EMAC driver patch in your tree?
That patch ack'ed by Ben is not yet in my tree.
I've not yet done a rebase with wd's tree as most of the TI patches are only in the ARM tree.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v2] da830evm: Add support for TI EMAC
2010-02-09 16:47 ` Paulraj, Sandeep
@ 2010-02-09 17:15 ` Nick Thompson
0 siblings, 0 replies; 3+ messages in thread
From: Nick Thompson @ 2010-02-09 17:15 UTC (permalink / raw)
To: u-boot
On 09/02/10 16:47, Paulraj, Sandeep wrote:
>> Adds support for ethernet networking on the da830evm platform.
>>
>> This platform uses an SoC EMAC interface and a 3 port ethernet
>> switch as a PHY with an RMII interface. The PHY also has a i2c
>> interface for configuring the switch functions.
>>
>> Signed-off-by: Nick Thompson <nick.thompson@ge.com>
>> ---
>> board/davinci/da830evm/da830evm.c | 65
>> +++++++++++++++++++++++++++++-
>> include/asm-arm/arch-davinci/emac_defs.h | 1 +
>> include/configs/da830evm.h | 1 +
>> 3 files changed, 65 insertions(+), 2 deletions(-)
>
>
> Did you test this after integrating the EMAC driver patch in your tree?
> That patch ack'ed by Ben is not yet in my tree.
>
> I've not yet done a rebase with wd's tree as most of the TI patches are only in the ARM tree.
Hmm, yes. Maybe it's too early to put this in yet. I have the EMAC
patch here as Ben added to his tree, so it is tested correctly, but
there is no way it will work for anybody else :(
Since I only just submitted, its too early to add this to your tree
anyway, but feel free to wait until you tree is updated with the
EMAC patch, or else just NAK it and I'll resubmit later.
Its a minor point really: the da830 build is not broken by this
patch, but its presence implies functionality that doesn't
yet work and it might cause undefined behaviour.
Nick.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-02-09 17:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-09 16:34 [U-Boot] [PATCH v2] da830evm: Add support for TI EMAC Nick Thompson
2010-02-09 16:47 ` Paulraj, Sandeep
2010-02-09 17:15 ` Nick Thompson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox