]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
AVR32: Enable networking
authorHaavard Skinnemoen <hskinnemoen@atmel.com>
Sun, 17 Dec 2006 16:14:30 +0000 (17:14 +0100)
committerHaavard Skinnemoen <hskinnemoen@atmel.com>
Sat, 14 Apr 2007 14:14:06 +0000 (16:14 +0200)
Implement MACB initialization for AVR32 and ATSTK1000, and turn
everything on, including the MACB driver.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
board/atmel/atstk1000/Makefile
board/atmel/atstk1000/atstk1000.c
board/atmel/atstk1000/eth.c [new file with mode: 0644]
include/configs/atstk1002.h
lib_avr32/board.c
net/eth.c

index 155d46ac979d6989d75524f67544adb35bc95f4d..8a15713cc42c8f3dee0559e2fbda0350b2083060 100644 (file)
@@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk
 
 LIB    := $(obj)lib$(BOARD).a
 
-COBJS  := $(BOARD).o flash.o
+COBJS  := $(BOARD).o flash.o eth.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
index 9f735da0897d31345025caa8245ae1324dfe6a64..407752cb43605e831aec3520ef72a7ac375bf725 100644 (file)
@@ -49,6 +49,10 @@ int board_early_init_f(void)
 
        gpio_enable_ebi();
        gpio_enable_usart1();
+#if defined(CONFIG_MACB)
+       gpio_enable_macb0();
+       gpio_enable_macb1();
+#endif
 
        return 0;
 }
diff --git a/board/atmel/atstk1000/eth.c b/board/atmel/atstk1000/eth.c
new file mode 100644 (file)
index 0000000..3a7916e
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2005-2006 Atmel Corporation
+ *
+ * Ethernet initialization for the ATSTK1000 starterkit
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#include <common.h>
+
+#include <asm/arch/memory-map.h>
+
+extern int macb_eth_initialize(int id, void *regs, unsigned int phy_addr);
+
+#if defined(CONFIG_MACB) && (CONFIG_COMMANDS & CFG_CMD_NET)
+void atstk1000_eth_initialize(bd_t *bi)
+{
+       int id = 0;
+
+       macb_eth_initialize(id++, (void *)MACB0_BASE, bi->bi_phy_id[0]);
+       macb_eth_initialize(id++, (void *)MACB1_BASE, bi->bi_phy_id[1]);
+}
+#endif
index 807d4a4a8b16af5c8f31fb08fa8637a18fa295d8..5e63ef89154527e04ab5758a86cb2bf46a106822 100644 (file)
 #define CONFIG_AUTOBOOT_DELAY_STR      "d"
 #define CONFIG_AUTOBOOT_STOP_STR       " "
 
+/*
+ * These are "locally administered ethernet addresses" generated by
+ * ./tools/gen_eth_addr
+ *
+ * After booting the board for the first time, new addresses should be
+ * generated and assigned to the environment variables "ethaddr" and
+ * "eth1addr".
+ */
+#define CONFIG_ETHADDR                 "6a:87:71:14:cd:cb"
+#define CONFIG_ETH1ADDR                        "ca:f8:15:e6:3e:e6"
+#define CONFIG_OVERWRITE_ETHADDR_ONCE  1
+#define CONFIG_NET_MULTI               1
+
+#define CONFIG_BOOTP_MASK              (CONFIG_BOOTP_SUBNETMASK        \
+                                        | CONFIG_BOOTP_GATEWAY)
+
 #define CONFIG_COMMANDS                        (CFG_CMD_BDI                    \
                                         | CFG_CMD_LOADS                \
                                         | CFG_CMD_LOADB                \
                                         /* | CFG_CMD_CACHE */          \
                                         | CFG_CMD_FLASH                \
                                         | CFG_CMD_MEMORY               \
-                                        /* | CFG_CMD_NET */            \
+                                        | CFG_CMD_NET                  \
                                         | CFG_CMD_ENV                  \
                                         /* | CFG_CMD_IRQ */            \
                                         | CFG_CMD_BOOTD                \
                                         /* | CFG_CMD_I2C */            \
                                         | CFG_CMD_REGINFO              \
                                         /* | CFG_CMD_DATE */           \
-                                        /* | CFG_CMD_DHCP */           \
+                                        | CFG_CMD_DHCP                 \
                                         /* | CFG_CMD_AUTOSCRIPT */     \
                                         /* | CFG_CMD_MII */            \
                                         | CFG_CMD_MISC                 \
 #include <cmd_confdefs.h>
 
 #define CONFIG_ATMEL_USART             1
+#define CONFIG_MACB                    1
 #define CONFIG_PIO2                    1
 #define CFG_NR_PIOS                    5
 #define CFG_HSDRAMC                    1
index 2f16386c76835b5bc1c349fcfcfaa2c4c53f4f30..265328aa487696a11862aa12ae6e491fd60e64cb 100644 (file)
@@ -328,6 +328,13 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
        jumptable_init();
        console_init_r();
 
+#if (CONFIG_COMMANDS & CFG_CMD_NET)
+#if defined(CONFIG_NET_MULTI)
+       puts("Net:   ");
+#endif
+       eth_initialize(gd->bd);
+#endif
+
        for (;;) {
                main_loop();
        }
index cca93920594b521b634c8315462b1518d4208350..6a344256e755938ba2c22e3b9579f6a4b3b0ce07 100644 (file)
--- a/net/eth.c
+++ b/net/eth.c
@@ -55,6 +55,7 @@ extern int skge_initialize(bd_t*);
 extern int tsec_initialize(bd_t*, int, char *);
 extern int npe_initialize(bd_t *);
 extern int uec_initialize(int);
+extern int atstk1000_eth_initialize(bd_t *);
 
 static struct eth_device *eth_devices, *eth_current;
 
@@ -255,6 +256,9 @@ int eth_initialize(bd_t *bis)
 #if defined(CONFIG_RTL8169)
        rtl8169_initialize(bis);
 #endif
+#if defined(CONFIG_ATSTK1000)
+       atstk1000_eth_initialize(bis);
+#endif
 
        if (!eth_devices) {
                puts ("No ethernet found.\n");