aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaavard Skinnemoen2006-12-17 17:14:30 +0100
committerHaavard Skinnemoen2007-04-14 16:14:06 +0200
commit9a24f477a1ed5bb0f74377c985d754ebbfa44872 (patch)
tree99eb535c6f23f5d362c839cebb35f60c09168f62
parent5c1fe1ffffd1750a7e47e5a2e2cd600c00e4f009 (diff)
AVR32: Enable networking
Implement MACB initialization for AVR32 and ATSTK1000, and turn everything on, including the MACB driver. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
-rw-r--r--board/atmel/atstk1000/Makefile2
-rw-r--r--board/atmel/atstk1000/atstk1000.c4
-rw-r--r--board/atmel/atstk1000/eth.c38
-rw-r--r--include/configs/atstk1002.h21
-rw-r--r--lib_avr32/board.c7
-rw-r--r--net/eth.c4
6 files changed, 73 insertions, 3 deletions
diff --git a/board/atmel/atstk1000/Makefile b/board/atmel/atstk1000/Makefile
index 155d46ac979..8a15713cc42 100644
--- a/board/atmel/atstk1000/Makefile
+++ b/board/atmel/atstk1000/Makefile
@@ -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))
diff --git a/board/atmel/atstk1000/atstk1000.c b/board/atmel/atstk1000/atstk1000.c
index 9f735da0897..407752cb436 100644
--- a/board/atmel/atstk1000/atstk1000.c
+++ b/board/atmel/atstk1000/atstk1000.c
@@ -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
index 00000000000..3a7916efed2
--- /dev/null
+++ b/board/atmel/atstk1000/eth.c
@@ -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
diff --git a/include/configs/atstk1002.h b/include/configs/atstk1002.h
index 807d4a4a8b1..5e63ef89154 100644
--- a/include/configs/atstk1002.h
+++ b/include/configs/atstk1002.h
@@ -93,6 +93,22 @@
#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 \
@@ -100,7 +116,7 @@
/* | CFG_CMD_CACHE */ \
| CFG_CMD_FLASH \
| CFG_CMD_MEMORY \
- /* | CFG_CMD_NET */ \
+ | CFG_CMD_NET \
| CFG_CMD_ENV \
/* | CFG_CMD_IRQ */ \
| CFG_CMD_BOOTD \
@@ -112,7 +128,7 @@
/* | CFG_CMD_I2C */ \
| CFG_CMD_REGINFO \
/* | CFG_CMD_DATE */ \
- /* | CFG_CMD_DHCP */ \
+ | CFG_CMD_DHCP \
/* | CFG_CMD_AUTOSCRIPT */ \
/* | CFG_CMD_MII */ \
| CFG_CMD_MISC \
@@ -133,6 +149,7 @@
#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
diff --git a/lib_avr32/board.c b/lib_avr32/board.c
index 2f16386c768..265328aa487 100644
--- a/lib_avr32/board.c
+++ b/lib_avr32/board.c
@@ -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();
}
diff --git a/net/eth.c b/net/eth.c
index cca93920594..6a344256e75 100644
--- 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");