From: Ben Warren <biggerbadderben@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] da850evm: basic MII EMAC support
Date: Sun, 12 Sep 2010 20:45:41 -0700 [thread overview]
Message-ID: <4C8D9E65.3040002@gmail.com> (raw)
In-Reply-To: <1284149416-941-1-git-send-email-bengardiner@nanometrics.ca>
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.
next prev parent reply other threads:[~2010-09-13 3:45 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C8D9E65.3040002@gmail.com \
--to=biggerbadderben@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox