Skip to contentSkip to conversation

AVR32 patches for next merge window

PATCH New Haavard Skinnemoen 4 participants 10 messages Jan 10, 2008 – Jan 11, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover AVR32 patches for next merge window

Hi all,

I'm planning to merge the next two patches before the merge window closes. This includes support for the ATNGW100 board (long overdue; it's been waiting for the CFI flash changes that were merged recently) and a bug fix that somehow got left out in the previous merge request.

Please review. If nothing comes up, I'll send a merge request early next week.

Also, please let me know if I've missed any patches.

Haavard Skinnemoen (2):
AVR32: Initialize ipaddr, loadaddr and bootfile at startup
AVR32: ATNGW100 board support

 MAINTAINERS                     |   11 ++-
 MAKEALL                         |    1 +
 Makefile                        |    3 +
 board/atmel/atngw100/Makefile   |   40 +++++++++
 board/atmel/atngw100/atngw100.c |   73 ++++++++++++++++
 board/atmel/atngw100/config.mk  |    3 +
 board/atmel/atngw100/eth.c      |   36 ++++++++
 board/atmel/atngw100/u-boot.lds |   80 +++++++++++++++++
 include/configs/atngw100.h      |  182 +++++++++++++++++++++++++++++++++++++++
 lib_avr32/board.c               |   10 ++
 net/eth.c                       |    4 +
 11 files changed, 438 insertions(+), 5 deletions(-)
 create mode 100644 board/atmel/atngw100/Makefile
 create mode 100644 board/atmel/atngw100/atngw100.c
 create mode 100644 board/atmel/atngw100/config.mk
 create mode 100644 board/atmel/atngw100/eth.c
 create mode 100644 board/atmel/atngw100/u-boot.lds
 create mode 100644 include/configs/atngw100.h
#1 lore raw

PATCH 1/2 AVR32: Initialize ipaddr, loadaddr and bootfile at startup

I don't know why the relevant layers can't do this by itself, but this is what ppc does.

---
 lib_avr32/board.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
lib_avr32/board.c +10 -0
index 809ee3b..d6423d4 100644
@@ -264,6 +264,7 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
 #ifndef CFG_ENV_IS_NOWHERE
 	extern char * env_name_spec;
 #endif
+	char *s;
 	cmd_tbl_t *cmdtp;
 	bd_t *bd;
 
@@ -336,11 +337,20 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
 	/* initialize environment */
 	env_relocate();
 
+	bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
+
 	devices_init();
 	jumptable_init();
 	console_init_r();
 
+	s = getenv("loadaddr");
+	if (s)
+		load_addr = simple_strtoul(s, NULL, 16);
+
 #if defined(CONFIG_CMD_NET)
+	s = getenv("bootfile");
+	if (s)
+		copy_filename(BootFile, s, sizeof(BootFile));
 #if defined(CONFIG_NET_MULTI)
 	puts("Net:   ");
 #endif
Signature · 1 line
1.5.3.6
#2 lore raw

PATCH 2/2 AVR32: ATNGW100 board support

Add support for the ATNGW100 Network Gateway reference design, including flash, ethernet and MMC support.

---
 MAINTAINERS                     |   11 ++-
 MAKEALL                         |    1 +
 Makefile                        |    3 +
 board/atmel/atngw100/Makefile   |   40 +++++++++
 board/atmel/atngw100/atngw100.c |   73 ++++++++++++++++
 board/atmel/atngw100/config.mk  |    3 +
 board/atmel/atngw100/eth.c      |   36 ++++++++
 board/atmel/atngw100/u-boot.lds |   80 +++++++++++++++++
 include/configs/atngw100.h      |  182 +++++++++++++++++++++++++++++++++++++++
 net/eth.c                       |    4 +
 10 files changed, 428 insertions(+), 5 deletions(-)
 create mode 100644 board/atmel/atngw100/Makefile
 create mode 100644 board/atmel/atngw100/atngw100.c
 create mode 100644 board/atmel/atngw100/config.mk
 create mode 100644 board/atmel/atngw100/eth.c
 create mode 100644 board/atmel/atngw100/u-boot.lds
 create mode 100644 include/configs/atngw100.h
MAINTAINERS +6 -5
index 2ef2f5c..d435e57 100644
@@ -58,7 +58,7 @@ Conn Clark <[email protected]>
 
 	ESTEEM192E		MPC8xx
 
-K?ri Dav??sson <[email protected]>
+K???ri Dav??????sson <[email protected]>
 
 	FLAGADM			MPC823
 
@@ -446,7 +446,7 @@ Peter Figuli <[email protected]>
 
 	wepep250		xscale
 
-Marius Gr?ger <[email protected]>
+Marius Gr???ger <[email protected]>
 
 	impa7			ARM720T (EP7211)
 	ep7312			ARM720T (EP7312)
@@ -484,7 +484,7 @@ Prakash Kumar <[email protected]>
 
 	cerf250			xscale
 
-David M?ller <[email protected]>
+David M???ller <[email protected]>
 
 	smdk2410		ARM920T
 	VCMA9			ARM920T
@@ -531,7 +531,7 @@ Richard Woodruff <[email protected]>
 
 	omap2420h4		ARM1136EJS
 
-Alex Z?pke <[email protected]>
+Alex Z???pke <[email protected]>
 
 	lart			SA1100
 	dnp1110			SA1110
@@ -543,7 +543,7 @@ Alex Z?pke <[email protected]>
 #	Board			CPU					#
 #########################################################################
 
-Daniel Engstr?m <[email protected]>
+Daniel Engstr???m <[email protected]>
 
 	sc520_cdp		x86
 
@@ -648,6 +648,7 @@ Haavard Skinnemoen <[email protected]>
 	ATSTK1002		AT32AP7000
 	ATSTK1003		AT32AP7001
 	ATSTK1004		AT32AP7002
+	ATNGW100		AT32AP7000
 
 #########################################################################
 # SuperH Systems:							#
MAKEALL +1 -0
index ebc5a22..6acdaf4 100755
@@ -655,6 +655,7 @@ LIST_avr32="		\
 	atstk1002	\
 	atstk1003	\
 	atstk1004	\
+	atngw100	\
 "
 
 #########################################################################
Makefile +3 -0
index 1983ca0..01f92ad 100644
@@ -2716,6 +2716,9 @@ atstk1003_config	:	unconfig
 atstk1004_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) avr32 at32ap atstk1000 atmel at32ap700x
 
+atngw100_config	:	unconfig
+	@$(MKCONFIG) $(@:_config=) avr32 at32ap atngw100 atmel at32ap700x
+
 #########################################################################
 #########################################################################
 #########################################################################
board/atmel/atngw100/Makefile new file +40 -0
new file mode 100644
index 0000000..1b5c635
@@ -0,0 +1,40 @@
+#
+# Copyright (C) 2005-2006 Atmel Corporation
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB	:= $(obj)lib$(BOARD).a
+
+COBJS	:= $(BOARD).o eth.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
+
+$(LIB): $(obj).depend $(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
board/atmel/atngw100/atngw100.c new file +73 -0

73 lines not on this page · raw message

board/atmel/atngw100/config.mk new file +3 -0
new file mode 100644
index 0000000..9a794e5
@@ -0,0 +1,3 @@
+TEXT_BASE		= 0x00000000
+PLATFORM_RELFLAGS	+= -ffunction-sections -fdata-sections
+PLATFORM_LDFLAGS	+= --gc-sections
board/atmel/atngw100/eth.c new file +36 -0
new file mode 100644
index 0000000..d1d57bb
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2006 Atmel Corporation
+ *
+ * Ethernet initialization for the AVR32 Network Gateway
+ *
+ * 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);
+
+#ifdef CONFIG_CMD_NET
+void atngw100_eth_initialize(bd_t *bi)
+{
+	macb_eth_initialize(0, (void *)MACB0_BASE, bi->bi_phy_id[0]);
+	macb_eth_initialize(1, (void *)MACB1_BASE, bi->bi_phy_id[1]);
+}
+#endif
board/atmel/atngw100/u-boot.lds new file +80 -0

80 lines not on this page · raw message

include/configs/atngw100.h new file +182 -0

182 lines not on this page · raw message

net/eth.c +4 -0
index 5d9e9c1..f707971 100644
@@ -60,6 +60,7 @@ extern int npe_initialize(bd_t *);
 extern int uec_initialize(int);
 extern int bfin_EMAC_initialize(bd_t *);
 extern int atstk1000_eth_initialize(bd_t *);
+extern int atngw100_eth_initialize(bd_t *);
 extern int mcffec_initialize(bd_t*);
 
 #ifdef CONFIG_API
@@ -269,6 +270,9 @@ int eth_initialize(bd_t *bis)
 #if defined(CONFIG_ATSTK1000)
 	atstk1000_eth_initialize(bis);
 #endif
+#if defined(CONFIG_ATNGW100)
+	atngw100_eth_initialize(bis);
+#endif
 #if defined(CONFIG_MCFFEC)
 	mcffec_initialize(bis);
 #endif
Signature · 1 line
1.5.3.6
#3 lore raw

PATCH 2/2 AVR32: ATNGW100 board support

MAINTAINERS Conn Clark <[email protected]> · line 61

Quoted 2 lines · On Thu, 10 Jan 2008 09:24:57 +0100 Haavard Skinnemoen <[email protected]>…
MAINTAINERS +1 -1
-K?ri Dav??sson <[email protected]>
+K???ri Dav??????sson <[email protected]>

Doh! WTF happened here?

I'll kill those hunks from my tree...and I should probably double-check before I send the merge request.

If the final diffstat for MAINTAINERS says more than one line changed, please feel free to flame me ;-)

Haavard

#4 lore raw

PATCH 2/2 AVR32: ATNGW100 board support

In reply to Haavard Skinnemoen
Quoted 24 lines · Haavard Skinnemoen

Add support for the ATNGW100 Network Gateway reference design, including flash, ethernet and MMC support.

---
 MAINTAINERS                     |   11 ++-
 MAKEALL                         |    1 +
 Makefile                        |    3 +
 board/atmel/atngw100/Makefile   |   40 +++++++++
 board/atmel/atngw100/atngw100.c |   73 ++++++++++++++++
 board/atmel/atngw100/config.mk  |    3 +
 board/atmel/atngw100/eth.c      |   36 ++++++++
 board/atmel/atngw100/u-boot.lds |   80 +++++++++++++++++
 include/configs/atngw100.h      |  182 +++++++++++++++++++++++++++++++++++++++
 net/eth.c                       |    4 +
 10 files changed, 428 insertions(+), 5 deletions(-)
 create mode 100644 board/atmel/atngw100/Makefile
 create mode 100644 board/atmel/atngw100/atngw100.c
 create mode 100644 board/atmel/atngw100/config.mk
 create mode 100644 board/atmel/atngw100/eth.c
 create mode 100644 board/atmel/atngw100/u-boot.lds
 create mode 100644 include/configs/atngw100.h

<snip>

Quoted 15 lines
net/eth.c +1 -0
index 5d9e9c1..f707971 100644
@@ -60,6 +60,7 @@ extern int npe_initialize(bd_t *);
 extern int uec_initialize(int);
 extern int bfin_EMAC_initialize(bd_t *);
 extern int atstk1000_eth_initialize(bd_t *);
+extern int atngw100_eth_initialize(bd_t *);
 extern int mcffec_initialize(bd_t*);
 
 #ifdef CONFIG_API

net/eth.c int eth_initialize(bd_t *bis) · line 278

Quoted 9 lines
net/eth.c +3 -0
@@ -269,6 +270,9 @@ int eth_initialize(bd_t *bis)
 #if defined(CONFIG_ATSTK1000)
 	atstk1000_eth_initialize(bis);
 #endif
+#if defined(CONFIG_ATNGW100)
+	atngw100_eth_initialize(bis);
+#endif
 #if defined(CONFIG_MCFFEC)
 	mcffec_initialize(bis);
 #endif

I'm not crazy about /net/eth.c calling board-specific ethernet initialization routines - it should be calling the driver initialization. This file is enough of a mess as it is, and adding a new entry for each board only makes it worse. Since there's precedent, though, consider this

In the next release (not the one finishing in a week), what do you think about this:

#if defined(CONFIG_BOARD_ETH_INIT)
board_eth_initialize(bis)
#endif

Moving Ethernet initialization in general to the board (not just Atmel boards) would go a long way towards cleaning up the current mess and would provide more scalability and flexibility.

Thoughts?

regards,
Ben

#5 lore raw

PATCH 2/2 AVR32: ATNGW100 board support

Quoted 9 lines · Ben Warren

I'm not crazy about /net/eth.c calling board-specific ethernet initialization routines - it should be calling the driver initialization. This file is enough of a mess as it is, and adding a new entry for each board only makes it worse. Since there's precedent, though, consider this

Quoted 6 lines

In the next release (not the one finishing in a week), what do you think about this:

#if defined(CONFIG_BOARD_ETH_INIT)
board_eth_initialize(bis)
#endif

Or even better, using an empty baord_eth_initialize() function with the weak attribute. We get rid of this #ifdef this way.

Quoted 5 lines

Moving Ethernet initialization in general to the board (not just Atmel boards) would go a long way towards cleaning up the current mess and would provide more scalability and flexibility.

Thoughts?

How about if the board/platform code could add eth_init functions to a function-list. eth.c could then just call all functions in the list.

Comments?

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#6 lore raw

PATCH 2/2 AVR32: ATNGW100 board support

Quoted 27 lines · Stefan Roese
Quoted 9 lines · Ben Warren

I'm not crazy about /net/eth.c calling board-specific ethernet initialization routines - it should be calling the driver initialization. This file is enough of a mess as it is, and adding a new entry for each board only makes it worse. Since there's precedent, though, consider this

Quoted 7 lines

In the next release (not the one finishing in a week), what do you think about this:

#if defined(CONFIG_BOARD_ETH_INIT)
board_eth_initialize(bis)
#endif

Or even better, using an empty baord_eth_initialize() function with the weak attribute. We get rid of this #ifdef this way.

Quoted 4 lines

Moving Ethernet initialization in general to the board (not just Atmel boards) would go a long way towards cleaning up the current mess and would provide more scalability and flexibility.

Quoted 6 lines
Quoted 2 lines

Thoughts?

How about if the board/platform code could add eth_init functions to a function-list. eth.c could then just call all functions in the list.

I was initially thinking about each board defining an array of Ethernet device structures, including device indices, PHY addresses, PHY info etc. that init code would step through. Something like this (made-up pseudo-code):

eth_devices eth_dev[] = {
	{

        	.type = TSEC;
		.index = 0;
		.phy = {
			.type = PHY_AUTO_DETECT;
			.address = 0x2
		}
	},
	{
		.type = TSEC;
		.index = 1;
		.phy = {
			.type = PHY_FIXED_1000_FULL;
		}
	},
	{
		.type = ULI526x; /* PCI device */
	},
	NULL_DEVICE
};

but a function list might be better. Something to think about for the next release.

regards,
Ben

#7 lore raw

PATCH 2/2 AVR32: ATNGW100 board support

In reply to Ben Warren
Quoted 5 lines · On Thu, 10 Jan 2008 11:53:26 -0500 Ben Warren <[email protected]> wrote:

I'm not crazy about /net/eth.c calling board-specific ethernet initialization routines - it should be calling the driver initialization. This file is enough of a mess as it is, and adding a new entry for each board only makes it worse. Since there's precedent, though, consider this

Yeah...the problem is that there are two ethernet controllers on the AP7000 and only the board knows which one(s) to initialize. I don't want the driver to know about such things.

Quoted 1 line

Thanks.

Quoted 6 lines

In the next release (not the one finishing in a week), what do you think about this:

#if defined(CONFIG_BOARD_ETH_INIT)
board_eth_initialize(bis)
#endif

I like it, but Stefan's suggestion about providing an empty, weak function would be even better.

Quoted 3 lines

Moving Ethernet initialization in general to the board (not just Atmel boards) would go a long way towards cleaning up the current mess and would provide more scalability and flexibility.

Yes, I think moving the "top-level" ethernet initialization function to the board code would be the right thing to do. The board could then register all the controllers, apply PHY quirks, etc. before handing things over to the networking layer.

Haavard

#8 lore raw

PATCH 2/2 AVR32: ATNGW100 board support

In reply to Haavard Skinnemoen
Quoted 41 lines · In message <[email protected]> you wrote:

--===============0956556399==

Add support for the ATNGW100 Network Gateway reference design, including flash, ethernet and MMC support.

...

MAINTAINERS +1 -1
@@ -58,7 +58,7 @@ Conn Clark <[email protected]>
 
 	ESTEEM192E		MPC8xx
 
-K?ri Dav??sson <[email protected]>
+K???ri Dav??????sson <[email protected]>

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

MAINTAINERS +1 -1
 	FLAGADM			MPC823
@@ -446,7 +446,7 @@ Peter Figuli <[email protected]>
 
 	wepep250		xscale
 
-Marius Gr?ger <[email protected]>
+Marius Gr???ger <[email protected]>

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Looks as if there were encoding issues here...

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The evolution of the human race will not be accomplished in  the  ten
thousand  years  of  tame  animals,  but in the million years of wild
animals, because man is and will always be a wild animal.
                                              - Charles Galton Darwin
#9 lore raw

PATCH 2/2 AVR32: ATNGW100 board support

Quoted 5 lines · On Thu, 10 Jan 2008 23:41:31 +0100 Wolfgang Denk <[email protected]> wrote:
Quoted 5 lines
MAINTAINERS +1 -1
-Marius Gr?ger <[email protected]>
+Marius Gr???ger <[email protected]>

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Looks as if there were encoding issues here...

Yes...the patch isn't supposed to touch those entries at all. I've fixed it in my tree. You can verify the final merge by looking at the diffstat; there should be only a single line added to MAINTAINERS:

 MAINTAINERS                     |    1 +

Haavard