From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 6/9] sunxi: add gmac Ethernet support
Date: Sat, 26 Apr 2014 20:41:09 +0200 [thread overview]
Message-ID: <201404262041.09859.marex@denx.de> (raw)
In-Reply-To: <1397844350-7341-6-git-send-email-ijc@hellion.org.uk>
On Friday, April 18, 2014 at 08:05:47 PM, Ian Campbell wrote:
> Add support for the GMAC Ethernet controller on Allwinner A20 (sun7i)
> processors. Enable for the Cubietruck.
>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> Signed-off-by: Jens Kuske <jenskuske@gmail.com>
> Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
> ---
> v3: Based on c89867dca2e9 "sunxi: clocks: clock_get_pll5
> prototype and coding style".
>
> v2: Based on u-boot-sunxi.git#sunxi d9aa5dd3d15c "sunxi: mmc:
> checkpatch whitespace fixes" with v2014.04-rc2 merged in:
> - drop accidentally doubled hunk
> - use gpio setup functions
> - moved before mmc patches
>
> v1: Based on u-boot-sunxi.git#sunxi commit d854c4de2f57 "arm: Handle
> .gnu.hash section in ldscripts" vs v2014.01.
> ---
> arch/arm/cpu/armv7/sunxi/board.c | 15 +++++++++++++++
> boards.cfg | 2 +-
> drivers/net/Makefile | 1 +
> drivers/net/sunxi_gmac.c | 34 ++++++++++++++++++++++++++++++++++
> include/configs/sunxi-common.h | 26 ++++++++++++++++++++++++++
> include/netdev.h | 1 +
> 6 files changed, 78 insertions(+), 1 deletion(-)
> create mode 100644 drivers/net/sunxi_gmac.c
>
> diff --git a/arch/arm/cpu/armv7/sunxi/board.c
> b/arch/arm/cpu/armv7/sunxi/board.c index b5c0cb7..9755320 100644
> --- a/arch/arm/cpu/armv7/sunxi/board.c
> +++ b/arch/arm/cpu/armv7/sunxi/board.c
> @@ -11,6 +11,8 @@
> */
>
> #include <common.h>
> +#include <netdev.h>
> +#include <miiphy.h>
> #include <serial.h>
> #ifdef CONFIG_SPL_BUILD
> #include <spl.h>
> @@ -86,3 +88,16 @@ void enable_caches(void)
> dcache_enable();
> }
> #endif
> +
> +#if defined(CONFIG_SUNXI_GMAC)
This is something line ifdef CONFIG_CMD_NET
> +/*
> + * Initializes on-chip ethernet controllers.
> + * to override, implement board_eth_init()
> + */
> +int cpu_eth_init(bd_t *bis)
> +{
> + sunxi_gmac_initialize(bis);
And this is CONFIG_SUNXI_GMAC ... what if I wanted to enable USB ethernet or
such ?
> +
> + return 0;
Handle possible failures of sunxi_gmac_initialize() and propagate the return
value please.
[...]
> +int sunxi_gmac_initialize(bd_t *bis)
Stick this into arch/arm/sunxi/... , there's no need to keep it in drivers/net/
as it's no real driver, but just a glue.
> +{
> + int pin;
> + struct sunxi_ccm_reg *const ccm =
> + (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
> +
> + /* Set up clock gating */
> + setbits_le32(&ccm->ahb_gate1, 0x1 << AHB_GATE_OFFSET_GMAC);
> +
> + /* Set MII clock */
> + setbits_le32(&ccm->gmac_clk_cfg, CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII |
> + CCM_GMAC_CTRL_GPIT_RGMII);
> +
> + /* Configure pin mux settings for GMAC */
> + for (pin = SUNXI_GPA(0); pin <= SUNXI_GPA(16); pin++) {
> + /* skip unused pins in RGMII mode */
> + if (pin == SUNXI_GPA(9) || pin == SUNXI_GPA(14))
> + continue;
> + sunxi_gpio_set_cfgpin(pin, SUN7I_GPA0_GMAC);
> + sunxi_gpio_set_drv(pin, 3);
> + }
> +
> + designware_initialize(SUNXI_GMAC_BASE, PHY_INTERFACE_MODE_RGMII);
> +
> + return 0;
DTTO here, designware_initialize() might fail ...
> +}
> diff --git a/include/configs/sunxi-common.h
> b/include/configs/sunxi-common.h index 3f7e314..b76c3b0 100644
> --- a/include/configs/sunxi-common.h
> +++ b/include/configs/sunxi-common.h
> @@ -127,6 +127,32 @@
>
> #define CONFIG_CONS_INDEX 1 /* UART0 */
>
> +#ifdef CONFIG_SUNXI_GMAC
> +#define CONFIG_DESIGNWARE_ETH /* GMAC can use designware driver
*/
> +#define CONFIG_DW_AUTONEG
> +#define CONFIG_PHY_GIGE /* GMAC can use gigabit PHY */
> +#define CONFIG_PHY_ADDR 1
> +#define CONFIG_MII /* MII PHY management */
> +#define CONFIG_PHYLIB
> +#endif
> +
> +#ifdef CONFIG_CMD_NET
> +#define CONFIG_CMD_NFS
> +#define CONFIG_CMD_SNTP
Do you really need this ?
> +#define CONFIG_TIMESTAMP /* Needed by SNTP */
> +#define CONFIG_CMD_DNS
> +#define CONFIG_NETCONSOLE
> +#define CONFIG_BOOTP_NISDOMAIN
> +#define CONFIG_BOOTP_BOOTFILESIZE
> +#define CONFIG_BOOTP_DNS2
> +#define CONFIG_BOOTP_SEND_HOSTNAME
> +#define CONFIG_BOOTP_NTPSERVER
> +#define CONFIG_BOOTP_TIMEOFFSET
> +#define CONFIG_BOOTP_MAY_FAIL
> +#define CONFIG_BOOTP_SERVERIP
> +#define CONFIG_BOOTP_DHCP_REQUEST_DELAY 50000
Just delete this BOOTP nonsense.
next prev parent reply other threads:[~2014-04-26 18:41 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-18 18:05 [U-Boot] [PATCH v3 0/9] sunxi: initial upstreamining effort Ian Campbell
2014-04-18 18:05 ` [U-Boot] [PATCH v3 1/9] sunxi: add sun7i clocks and timer support Ian Campbell
2014-04-26 18:31 ` Marek Vasut
2014-04-18 18:05 ` [U-Boot] [PATCH v3 2/9] sunxi: add sun7i pinmux and gpio support Ian Campbell
2014-04-26 18:33 ` Marek Vasut
2014-04-18 18:05 ` [U-Boot] [PATCH v3 3/9] sunxi: add sun7i dram setup support Ian Campbell
2014-04-26 18:35 ` Marek Vasut
2014-04-18 18:05 ` [U-Boot] [PATCH v3 4/9] sunxi: add sun7i cpu, board and start of day support Ian Campbell
2014-04-18 18:05 ` [U-Boot] [PATCH v3 5/9] sunxi: add support for Cubietruck booting in FEL mode Ian Campbell
2014-04-26 18:38 ` Marek Vasut
2014-04-18 18:05 ` [U-Boot] [PATCH v3 6/9] sunxi: add gmac Ethernet support Ian Campbell
2014-04-26 18:41 ` Marek Vasut [this message]
2014-04-27 16:33 ` Ian Campbell
2014-04-27 18:10 ` Marek Vasut
2014-04-27 18:35 ` Ian Campbell
2014-04-27 19:15 ` Marek Vasut
2014-04-18 18:05 ` [U-Boot] [PATCH v3 7/9] sunxi: mmc support Ian Campbell
2014-04-26 18:43 ` Marek Vasut
2014-04-18 18:05 ` [U-Boot] [PATCH v3 8/9] sunxi: non-FEL SPL boot support for sun7i Ian Campbell
2014-04-26 18:46 ` Marek Vasut
2014-04-27 17:00 ` Ian Campbell
2014-04-27 18:07 ` Marek Vasut
2014-04-27 18:38 ` Ian Campbell
2014-04-27 19:15 ` Marek Vasut
2014-04-27 19:29 ` Ian Campbell
2014-04-27 23:58 ` Marek Vasut
2014-04-28 9:06 ` Ian Campbell
2014-04-18 18:05 ` [U-Boot] [PATCH v3 9/9] net/designware: Reduce DMA burst length Ian Campbell
2014-04-26 18:28 ` Marek Vasut
2014-04-27 15:25 ` Ian Campbell
2014-04-27 15:29 ` Chen-Yu Tsai
2014-04-27 18:08 ` Marek Vasut
2014-04-28 5:51 ` Chen-Yu Tsai
2014-04-28 5:55 ` Marek Vasut
2014-04-28 20:18 ` Alexey Brodkin
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=201404262041.09859.marex@denx.de \
--to=marex@denx.de \
--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