Skip to contentSkip to conversation

at91: Support for the at91sam9g20 : Atmel 400Mhz ARM 926ej-s SOC.

PATCH New Nicolas Ferre 4 participants 7 messages Mar 9, 2009 – Mar 20, 2009

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

PATCH 1/1 at91: Support for the at91sam9g20 : Atmel 400Mhz ARM 926ej-s SOC.

AT91sam9g20 is an evolution of the at91sam9260
with a faster clock speed.

Here is the chip page on Atmel website:
http://www.atmel.com/dyn/products/product_card.asp?part_id=4337

---
 Makefile                                  |   17 ++
 board/atmel/at91sam9g20ek/Makefile        |   57 +++++++
 board/atmel/at91sam9g20ek/at91sam9g20ek.c |  261 +++++++++++++++++++++++++++++
 board/atmel/at91sam9g20ek/config.mk       |    1 +
 board/atmel/at91sam9g20ek/led.c           |   64 +++++++
 board/atmel/at91sam9g20ek/nand.c          |   78 +++++++++
 board/atmel/at91sam9g20ek/partition.c     |   40 +++++
 cpu/arm926ejs/at91/usb.c                  |    4 +-
 doc/README.at91                           |    2 +-
 drivers/net/macb.c                        |    4 +-
 include/asm-arm/arch-at91/hardware.h      |    2 +-
 include/configs/at91sam9g20ek.h           |  201 ++++++++++++++++++++++
 12 files changed, 725 insertions(+), 6 deletions(-)
Makefile +17 -0
index c24115d..0cd8a93 100644
@@ -2679,6 +2679,23 @@ at91sam9xeek_config	:	unconfig
 	fi;
 	@$(MKCONFIG) -n at91sam9xeek -a at91sam9260ek arm arm926ejs at91sam9260ek atmel at91
 
+at91sam9g20ek_nandflash_config \
+at91sam9g20ek_dataflash_cs0_config \
+at91sam9g20ek_dataflash_cs1_config \
+at91sam9g20ek_config	:	unconfig
+	@mkdir -p $(obj)include
+	@if [ "$(findstring _nandflash,$@)" ] ; then \
+		echo "#define CONFIG_SYS_USE_NANDFLASH 1"	>>$(obj)include/config.h ; \
+		$(XECHO) "... with environment variable in NAND FLASH" ; \
+	elif [ "$(findstring dataflash_cs0,$@)" ] ; then \
+		echo "#define CONFIG_SYS_USE_DATAFLASH_CS0 1"	>>$(obj)include/config.h ; \
+		$(XECHO) "... with environment variable in SPI DATAFLASH CS0" ; \
+	else \
+		echo "#define CONFIG_SYS_USE_DATAFLASH_CS1 1"	>>$(obj)include/config.h ; \
+		$(XECHO) "... with environment variable in SPI DATAFLASH CS1" ; \
+	fi;
+	@$(MKCONFIG) -a at91sam9g20ek arm arm926ejs at91sam9g20ek atmel at91
+
 at91sam9261ek_nandflash_config \
 at91sam9261ek_dataflash_cs0_config \
 at91sam9261ek_dataflash_cs3_config \
board/atmel/at91sam9g20ek/Makefile new file +57 -0

57 lines not on this page · raw message

board/atmel/at91sam9g20ek/at91sam9g20ek.c new file +261 -0

261 lines not on this page · raw message

board/atmel/at91sam9g20ek/config.mk new file +1 -0
new file mode 100644
index 0000000..ff2cfd1
@@ -0,0 +1 @@
+TEXT_BASE = 0x23f00000
board/atmel/at91sam9g20ek/led.c new file +64 -0

64 lines not on this page · raw message

board/atmel/at91sam9g20ek/nand.c new file +78 -0

78 lines not on this page · raw message

board/atmel/at91sam9g20ek/partition.c new file +40 -0
new file mode 100644
index 0000000..2629c67
@@ -0,0 +1,40 @@
+/*
+ * (C) Copyright 2008
+ * Ulf Samuelsson <[email protected]>
+ *
+ * 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 <config.h>
+#include <asm/hardware.h>
+#include <dataflash.h>
+
+AT91S_DATAFLASH_INFO dataflash_info[CONFIG_SYS_MAX_DATAFLASH_BANKS];
+
+struct dataflash_addr cs[CONFIG_SYS_MAX_DATAFLASH_BANKS] = {
+	{CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0, 0},	/* Logical adress, CS */
+	{CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1, 1}
+};
+
+/*define the area offsets*/
+dataflash_protect_t area_list[NB_DATAFLASH_AREA] = {
+	{0x00000000, 0x000041FF, FLAG_PROTECT_SET,   0, "Bootstrap"},
+	{0x00004200, 0x000083FF, FLAG_PROTECT_CLEAR, 0, "Environment"},
+	{0x00008400, 0x00041FFF, FLAG_PROTECT_SET,   0, "U-Boot"},
+	{0x00042000, 0x00251FFF, FLAG_PROTECT_CLEAR, 0,	"Kernel"},
+	{0x00252000, 0xFFFFFFFF, FLAG_PROTECT_CLEAR, 0,	"FS"},
+};
cpu/arm926ejs/at91/usb.c +2 -2
index a15ab16..7c44ad0 100644
@@ -33,7 +33,7 @@ int usb_cpu_init(void)
 {
 
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
 	/* Enable PLLB */
 	at91_sys_write(AT91_CKGR_PLLBR, CONFIG_SYS_AT91_PLLB);
 	while ((at91_sys_read(AT91_PMC_SR) & AT91_PMC_LOCKB) != AT91_PMC_LOCKB)
@@ -62,7 +62,7 @@ int usb_cpu_stop(void)
 #endif
 
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
 	/* Disable PLLB */
 	at91_sys_write(AT91_CKGR_PLLBR, 0);
 	while ((at91_sys_read(AT91_PMC_SR) & AT91_PMC_LOCKB) != 0)
doc/README.at91 +1 -1
index c666d82..f1ea8f3 100644
@@ -4,7 +4,7 @@ http://atmel.com/dyn/products/tools.asp?family_id=605#1443
 
 I. Board mapping & boot media
 ------------------------------------------------------------------------------
-AT91SAM9260EK & AT91SAM9XEEK
+AT91SAM9260EK, AT91SAM9G20EK & AT91SAM9XEEK
 ------------------------------------------------------------------------------
 
 Memory map
drivers/net/macb.c +2 -2
index af0409b..6de0a04 100644
@@ -447,14 +447,14 @@ static int macb_init(struct eth_device *netdev, bd_t *bd)
 	/* choose RMII or MII mode. This depends on the board */
 #ifdef CONFIG_RMII
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
 	macb_writel(macb, USRIO, MACB_BIT(RMII) | MACB_BIT(CLKEN));
 #else
 	macb_writel(macb, USRIO, 0);
 #endif
 #else
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
 	macb_writel(macb, USRIO, MACB_BIT(CLKEN));
 #else
 	macb_writel(macb, USRIO, MACB_BIT(MII));
include/asm-arm/arch-at91/hardware.h +1 -1
index b881e4e..4f0e1a7 100644
@@ -18,7 +18,7 @@
 
 #if defined(CONFIG_AT91RM9200)
 #include <asm/arch/at91rm9200.h>
-#elif defined(CONFIG_AT91SAM9260)
+#elif defined(CONFIG_AT91SAM9260) || defined(CONFIG_AT91SAM9G20)
 #include <asm/arch/at91sam9260.h>
 #define AT91_BASE_SPI	AT91SAM9260_BASE_SPI0
 #define AT91_ID_UHP	AT91SAM9260_ID_UHP
include/configs/at91sam9g20ek.h new file +201 -0

201 lines not on this page · raw message

Signature · 1 line
1.5.3.7
#1 lore raw

PATCH 1/1 at91: Support for the at91sam9g20 : Atmel 400Mhz ARM 926ej-s SOC.

Dear Nicolas Ferre,

Quoted 7 lines · In message <[email protected]> you wrote:

AT91sam9g20 is an evolution of the at91sam9260
with a faster clock speed.

Here is the chip page on Atmel website:
http://www.atmel.com/dyn/products/product_card.asp?part_id=4337

Quoted 14 lines
---
 Makefile                                  |   17 ++
 board/atmel/at91sam9g20ek/Makefile        |   57 +++++++
 board/atmel/at91sam9g20ek/at91sam9g20ek.c |  261 +++++++++++++++++++++++++++++
 board/atmel/at91sam9g20ek/config.mk       |    1 +
 board/atmel/at91sam9g20ek/led.c           |   64 +++++++
 board/atmel/at91sam9g20ek/nand.c          |   78 +++++++++
 board/atmel/at91sam9g20ek/partition.c     |   40 +++++
 cpu/arm926ejs/at91/usb.c                  |    4 +-
 doc/README.at91                           |    2 +-
 drivers/net/macb.c                        |    4 +-
 include/asm-arm/arch-at91/hardware.h      |    2 +-
 include/configs/at91sam9g20ek.h           |  201 ++++++++++++++++++++++
 12 files changed, 725 insertions(+), 6 deletions(-)

Hm.... to me it seems that the new files added are, with the exception of "at91sam9260ek" into "at91sam9260ek" renames, more or less identical copies of the board/atmel/at91sam9260ek code ?

Please use common code and avoid such code duplication.

NAK.

Best regards,

Wolfgang Denk

Signature · 4 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
"Wish not to seem, but to be, the best."                  - Aeschylus
#2 lore raw

PATCH 1/1 at91: Support for the at91sam9g20 : Atmel 400Mhz ARM 926ej-s SOC.

Wolfgang Denk :

Quoted 25 lines

Dear Nicolas Ferre,

Quoted 7 lines · In message <[email protected]> you wrote:

AT91sam9g20 is an evolution of the at91sam9260
with a faster clock speed.

Here is the chip page on Atmel website:
http://www.atmel.com/dyn/products/product_card.asp?part_id=4337

Quoted 14 lines
---
 Makefile                                  |   17 ++
 board/atmel/at91sam9g20ek/Makefile        |   57 +++++++
 board/atmel/at91sam9g20ek/at91sam9g20ek.c |  261 +++++++++++++++++++++++++++++
 board/atmel/at91sam9g20ek/config.mk       |    1 +
 board/atmel/at91sam9g20ek/led.c           |   64 +++++++
 board/atmel/at91sam9g20ek/nand.c          |   78 +++++++++
 board/atmel/at91sam9g20ek/partition.c     |   40 +++++
 cpu/arm926ejs/at91/usb.c                  |    4 +-
 doc/README.at91                           |    2 +-
 drivers/net/macb.c                        |    4 +-
 include/asm-arm/arch-at91/hardware.h      |    2 +-
 include/configs/at91sam9g20ek.h           |  201 ++++++++++++++++++++++
 12 files changed, 725 insertions(+), 6 deletions(-)
Quoted 6 lines

Hm.... to me it seems that the new files added are, with the exception of "at91sam9260ek" into "at91sam9260ek" renames, more or less identical copies of the board/atmel/at91sam9260ek code ?

Please use common code and avoid such code duplication.

Wolfgang,

Ok, so a new patch follows with much clever adding of at91sam9g20 (Comes from Justin Waters).

Thanks for your comments, regards,

Signature · 1 line
Nicolas Ferre
#3 lore raw

PATCH 1/1 at91: Support for the at91sam9g20 : Atmel 400Mhz ARM 926ej-s SOC.

In reply to Nicolas Ferre

Hi Nicolas,

Nicolas Ferre wrote:
<snip>

Quoted 12 lines
drivers/net/macb.c +1 -1
index af0409b..6de0a04 100644
@@ -447,14 +447,14 @@ static int macb_init(struct eth_device *netdev, bd_t *bd)
 	/* choose RMII or MII mode. This depends on the board */
 #ifdef CONFIG_RMII
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
 	macb_writel(macb, USRIO, MACB_BIT(RMII) | MACB_BIT(CLKEN));

drivers/net/macb.c static int macb_init(struct eth_device *netdev, bd_t *bd) · line 460

Quoted 10 lines
drivers/net/macb.c +1 -1
 #else
 	macb_writel(macb, USRIO, 0);
 #endif
 #else
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
 	macb_writel(macb, USRIO, MACB_BIT(CLKEN));
 #else
 	macb_writel(macb, USRIO, MACB_BIT(MII));

Please find a more generic way of doing this. There should be no board/cpu specific #ifdefs in common drivers. While you're at it, fix up the existing ones.

regards,
Ben

#4 lore raw

PATCH 1/1 at91: Support for the at91sam9g20 : Atmel 400Mhz ARM 926ej-s SOC.

Ben Warren :

Quoted 22 lines

Hi Nicolas,

Nicolas Ferre wrote:
<snip>

Quoted 18 lines
drivers/net/macb.c +1 -2
index af0409b..6de0a04 100644
@@ -447,14 +447,14 @@ static int macb_init(struct eth_device *netdev, 
 bd_t *bd)
     /* choose RMII or MII mode. This depends on the board */
 #ifdef CONFIG_RMII
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
     macb_writel(macb, USRIO, MACB_BIT(RMII) | MACB_BIT(CLKEN));
 #else
     macb_writel(macb, USRIO, 0);
 #endif
 #else
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
Quoted 8 lines
Quoted 5 lines
drivers/net/macb.c +1 -0
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
     macb_writel(macb, USRIO, MACB_BIT(CLKEN));
 #else
     macb_writel(macb, USRIO, MACB_BIT(MII));

Please find a more generic way of doing this. There should be no board/cpu specific #ifdefs in common drivers. While you're at it, fix up the existing ones.

Ben,

Maybe we can separate the two topics in two separate actions. I propose that we go on with this patch for at91sam9g20 adding and, after this, we can concentrate on chasing #ifdefs in drivers.

Best regards,

Signature · 1 line
Nicolas Ferre
#5 lore raw

PATCH 1/1 at91: Support for the at91sam9g20 : Atmel 400Mhz ARM 926ej-s SOC.

Quoted 32 lines · Nicolas Ferre

Ben Warren :

Quoted 22 lines

Hi Nicolas,

Nicolas Ferre wrote:
<snip>

Quoted 18 lines
drivers/net/macb.c +1 -2
index af0409b..6de0a04 100644
@@ -447,14 +447,14 @@ static int macb_init(struct eth_device *netdev, 
 bd_t *bd)
     /* choose RMII or MII mode. This depends on the board */
 #ifdef CONFIG_RMII
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
     macb_writel(macb, USRIO, MACB_BIT(RMII) | MACB_BIT(CLKEN));
 #else
     macb_writel(macb, USRIO, 0);
 #endif
 #else
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
Quoted 8 lines
Quoted 5 lines
drivers/net/macb.c +1 -0
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
     macb_writel(macb, USRIO, MACB_BIT(CLKEN));
 #else
     macb_writel(macb, USRIO, MACB_BIT(MII));

Please find a more generic way of doing this. There should be no board/cpu specific #ifdefs in common drivers. While you're at it, fix up the existing ones.

Quoted 5 lines

Ben,

Maybe we can separate the two topics in two separate actions. I propose that we go on with this patch for at91sam9g20 adding and, after this, we can concentrate on chasing #ifdefs in drivers.

Agreed

Best Regards,
J.

#6 lore raw

PATCH 1/1 at91: Support for the at91sam9g20 : Atmel 400Mhz ARM 926ej-s SOC.

In reply to Ben Warren

Ben,

Ben Warren :

Quoted 22 lines

Hi Nicolas,

Nicolas Ferre wrote:
<snip>

Quoted 18 lines
drivers/net/macb.c +1 -2
index af0409b..6de0a04 100644
@@ -447,14 +447,14 @@ static int macb_init(struct eth_device *netdev, 
 bd_t *bd)
     /* choose RMII or MII mode. This depends on the board */
 #ifdef CONFIG_RMII
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
     macb_writel(macb, USRIO, MACB_BIT(RMII) | MACB_BIT(CLKEN));
 #else
     macb_writel(macb, USRIO, 0);
 #endif
 #else
 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263)
Quoted 8 lines
Quoted 5 lines
drivers/net/macb.c +1 -0
+    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
     macb_writel(macb, USRIO, MACB_BIT(CLKEN));
 #else
     macb_writel(macb, USRIO, MACB_BIT(MII));

Please find a more generic way of doing this. There should be no board/cpu specific #ifdefs in common drivers. While you're at it, fix up the existing ones.

Tell me if a configuration variable that I setup in the macb.h file depending on CPU is acceptable ?
Here is the snippet :
in drivers/net/macb.h

+/* MACB IP used by AVR32 & AT91 have two
+ * different layout for USRIO register. */
+#if !defined(CONFIG_AVR32)
+/* Use AT91 USRIO layout */
+#define CONFIG_MACB_USRIO_CFG1 1
+#endif

And then I use CONFIG_MACB_USRIO_CFG1 in macb.c

This will prevent me from setting this variable in every CPU config file...

Bye,

Signature · 1 line
Nicolas Ferre