Skip to contentSkip to conversation

(no subject)

U-Boot New Thomas Petazzoni 3 participants 10 messages Aug 4, 2011 – Aug 5, 2011

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

Subject: [v2] Update at91sam9m10g45 SoC and AT91SAM9M10G45-EK board to new style

Hello,

These two patches update the support of the AT91SAM9M10G45 SoC and the corresponding AT91SAM9M10G45-EK evaluation platform to the next AT91 organization.

For the moment, only the nandflash configuration is supported, the dataflash configuration will come later on.

Note however that the AT91 Ethernet driver doesn't work in the current master, due to the D-cache being enabled by c2dd0d45540397704de9b13287417d21049d34c6. The call to dcache_enable(); in arch/arm/lib/board.c must be removed.

Changes since v1:
- Fixed multiple style issues
- Fixed the DBGU support
- Support pull-ups as done for at91sam9260

Best regards,

Thomas Petazzoni

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#1 lore raw

PATCH 1/2 atmel: update at91sam9m10g45 SoC support to new style

Based on earlier work by Alex Waterman <[email protected]>.

---
 .../cpu/arm926ejs/at91/at91sam9m10g45_devices.c    |  114 ++++++------
 arch/arm/include/asm/arch-at91/at91sam9g45.h       |   12 ++
 .../arm/include/asm/arch-at91/at91sam9g45_matrix.h |  194 +++++++-------------
 3 files changed, 135 insertions(+), 185 deletions(-)
arch/arm/cpu/arm926ejs/at91/at91sam9m10g45_devices.c +55 -59
index 4ad9b1f..5ff32e3 100644
@@ -26,135 +26,131 @@
 #include <asm/arch/at91_common.h>
 #include <asm/arch/at91_pmc.h>
 #include <asm/arch/gpio.h>
-#include <asm/arch/io.h>
+#include <asm/io.h>
+
+/*
+ * if CONFIG_AT91_GPIO_PULLUP ist set, keep pullups on on all
+ * peripheral pins. Good to have if hardware is soldered optionally
+ * or in case of SPI no slave is selected. Avoid lines to float
+ * needlessly. Use a short local PUP define.
+ *
+ * Due to errata "TXD floats when CTS is inactive" pullups are always
+ * on for TXD pins.
+ */
+#ifdef CONFIG_AT91_GPIO_PULLUP
+# define PUP CONFIG_AT91_GPIO_PULLUP
+#else
+# define PUP 0
+#endif
 
 void at91_serial0_hw_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTB, 19, 1);	/* TXD0 */
-	at91_set_a_periph(AT91_PIO_PORTB, 18, 0);	/* RXD0 */
-	writel(1 << AT91SAM9G45_ID_US0, &pmc->pcer);
+	at91_set_a_periph(AT91_PIO_PORTB, 18, PUP);	/* RXD0 */
+	writel(1 << ATMEL_ID_USART0, &pmc->pcer);
 }
 
 void at91_serial1_hw_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTB, 4, 1);		/* TXD1 */
-	at91_set_a_periph(AT91_PIO_PORTB, 5, 0);		/* RXD1 */
-	writel(1 << AT91SAM9G45_ID_US1, &pmc->pcer);
+	at91_set_a_periph(AT91_PIO_PORTB, 5, PUP);		/* RXD1 */
+	writel(1 << ATMEL_ID_USART1, &pmc->pcer);
 }
 
 void at91_serial2_hw_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTD, 6, 1);		/* TXD2 */
-	at91_set_a_periph(AT91_PIO_PORTD, 7, 0);		/* RXD2 */
-	writel(1 << AT91SAM9G45_ID_US2, &pmc->pcer);
+	at91_set_a_periph(AT91_PIO_PORTD, 7, PUP);		/* RXD2 */
+	writel(1 << ATMEL_ID_USART2, &pmc->pcer);
 }
 
-void at91_serial3_hw_init(void)
+void at91_seriald_hw_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTB, 12, 0);	/* DRXD */
 	at91_set_a_periph(AT91_PIO_PORTB, 13, 1);	/* DTXD */
-	writel(1 << AT91_ID_SYS, &pmc->pcer);
-}
-
-void at91_serial_hw_init(void)
-{
-#ifdef CONFIG_USART0
-	at91_serial0_hw_init();
-#endif
-
-#ifdef CONFIG_USART1
-	at91_serial1_hw_init();
-#endif
-
-#ifdef CONFIG_USART2
-	at91_serial2_hw_init();
-#endif
-
-#ifdef CONFIG_USART3	/* DBGU */
-	at91_serial3_hw_init();
-#endif
+	writel(1 << ATMEL_ID_SYS, &pmc->pcer);
 }
 
-#ifdef CONFIG_ATMEL_SPI
+#if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI)
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
-	at91_set_a_periph(AT91_PIO_PORTB, 0, 0);	/* SPI0_MISO */
-	at91_set_a_periph(AT91_PIO_PORTB, 1, 0);	/* SPI0_MOSI */
-	at91_set_a_periph(AT91_PIO_PORTB, 2, 0);	/* SPI0_SPCK */
+	at91_set_a_periph(AT91_PIO_PORTB, 0, PUP);	/* SPI0_MISO */
+	at91_set_a_periph(AT91_PIO_PORTB, 1, PUP);	/* SPI0_MOSI */
+	at91_set_a_periph(AT91_PIO_PORTB, 2, PUP);	/* SPI0_SPCK */
 
 	/* Enable clock */
-	writel(1 << AT91SAM9G45_ID_SPI0, &pmc->pcer);
+	writel(1 << ATMEL_ID_SPI0, &pmc->pcer);
 
 	if (cs_mask & (1 << 0)) {
-		at91_set_a_periph(AT91_PIO_PORTB, 3, 0);
+		at91_set_a_periph(AT91_PIO_PORTB, 3, 1);
 	}
 	if (cs_mask & (1 << 1)) {
-		at91_set_b_periph(AT91_PIO_PORTB, 18, 0);
+		at91_set_b_periph(AT91_PIO_PORTB, 18, 1);
 	}
 	if (cs_mask & (1 << 2)) {
-		at91_set_b_periph(AT91_PIO_PORTB, 19, 0);
+		at91_set_b_periph(AT91_PIO_PORTB, 19, 1);
 	}
 	if (cs_mask & (1 << 3)) {
-		at91_set_b_periph(AT91_PIO_PORTD, 27, 0);
+		at91_set_b_periph(AT91_PIO_PORTD, 27, 1);
 	}
 	if (cs_mask & (1 << 4)) {
-		at91_set_pio_output(AT91_PIO_PORTB, 3, 0);
+		at91_set_pio_output(AT91_PIO_PORTB, 3, 1);
 	}
 	if (cs_mask & (1 << 5)) {
-		at91_set_pio_output(AT91_PIO_PORTB, 18, 0);
+		at91_set_pio_output(AT91_PIO_PORTB, 18, 1);
 	}
 	if (cs_mask & (1 << 6)) {
-		at91_set_pio_output(AT91_PIO_PORTB, 19, 0);
+		at91_set_pio_output(AT91_PIO_PORTB, 19, 1);
 	}
 	if (cs_mask & (1 << 7)) {
-		at91_set_pio_output(AT91_PIO_PORTD, 27, 0);
+		at91_set_pio_output(AT91_PIO_PORTD, 27, 1);
 	}
 }
 
 void at91_spi1_hw_init(unsigned long cs_mask)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
-	at91_set_a_periph(AT91_PIO_PORTB, 14, 0);	/* SPI1_MISO */
-	at91_set_a_periph(AT91_PIO_PORTB, 15, 0);	/* SPI1_MOSI */
-	at91_set_a_periph(AT91_PIO_PORTB, 16, 0);	/* SPI1_SPCK */
+	at91_set_a_periph(AT91_PIO_PORTB, 14, PUP);	/* SPI1_MISO */
+	at91_set_a_periph(AT91_PIO_PORTB, 15, PUP);	/* SPI1_MOSI */
+	at91_set_a_periph(AT91_PIO_PORTB, 16, PUP);	/* SPI1_SPCK */
 
 	/* Enable clock */
-	writel(1 << AT91SAM9G45_ID_SPI1, &pmc->pcer);
+	writel(1 << ATMEL_ID_SPI1, &pmc->pcer);
 
 	if (cs_mask & (1 << 0)) {
-		at91_set_a_periph(AT91_PIO_PORTB, 17, 0);
+		at91_set_a_periph(AT91_PIO_PORTB, 17, 1);
 	}
 	if (cs_mask & (1 << 1)) {
-		at91_set_b_periph(AT91_PIO_PORTD, 28, 0);
+		at91_set_b_periph(AT91_PIO_PORTD, 28, 1);
 	}
 	if (cs_mask & (1 << 2)) {
-		at91_set_a_periph(AT91_PIO_PORTD, 18, 0);
+		at91_set_a_periph(AT91_PIO_PORTD, 18, 1);
 	}
 	if (cs_mask & (1 << 3)) {
-		at91_set_a_periph(AT91_PIO_PORTD, 19, 0);
+		at91_set_a_periph(AT91_PIO_PORTD, 19, 1);
 	}
 	if (cs_mask & (1 << 4)) {
-		at91_set_pio_output(AT91_PIO_PORTB, 17, 0);
+		at91_set_pio_output(AT91_PIO_PORTB, 17, 1);
 	}
 	if (cs_mask & (1 << 5)) {
-		at91_set_pio_output(AT91_PIO_PORTD, 28, 0);
+		at91_set_pio_output(AT91_PIO_PORTD, 28, 1);
 	}
 	if (cs_mask & (1 << 6)) {
-		at91_set_pio_output(AT91_PIO_PORTD, 18, 0);
+		at91_set_pio_output(AT91_PIO_PORTD, 18, 1);
 	}
 	if (cs_mask & (1 << 7)) {
-		at91_set_pio_output(AT91_PIO_PORTD, 19, 0);
+		at91_set_pio_output(AT91_PIO_PORTD, 19, 1);
 	}
 
 }
arch/arm/include/asm/arch-at91/at91sam9g45.h +12 -0
index 364b86c..4df6b09 100644
@@ -129,6 +129,18 @@
 #define ATMEL_BASE_VDEC		0x00900000	/* Video Decoder Controller */
 
 /*
+ * External memory
+ */
+#define ATMEL_BASE_CS0		0x10000000
+#define ATMEL_BASE_CS1		0x20000000
+#define ATMEL_BASE_CS2		0x30000000
+#define ATMEL_BASE_CS3		0x40000000
+#define ATMEL_BASE_CS4		0x50000000
+#define ATMEL_BASE_CS5		0x60000000
+#define ATMEL_BASE_CS6		0x70000000
+#define ATMEL_BASE_CS7		0x80000000
+
+/*
  * Other misc defines
  */
 #define ATMEL_PIO_PORTS		5		/* this SoCs has 5 PIO */
arch/arm/include/asm/arch-at91/at91sam9g45_matrix.h +68 -126

207 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 1/2 atmel: update at91sam9m10g45 SoC support to new style

Dear Thomas Petazzoni,

Quoted 9 lines

Based on earlier work by Alex Waterman <[email protected]>.

---
 .../cpu/arm926ejs/at91/at91sam9m10g45_devices.c    |  114 ++++++------
 arch/arm/include/asm/arch-at91/at91sam9g45.h       |   12 ++
 .../arm/include/asm/arch-at91/at91sam9g45_matrix.h |  194 +++++++-------------
 3 files changed, 135 insertions(+), 185 deletions(-)

Applied to u-boot-atmel/master,
Thanks,
Reinhard

#3 lore raw

PATCH 2/2 atmel: Update support of board AT91SAM9M10G45-EK to new style

In reply to Thomas Petazzoni

Based on earlier work by Alex Waterman <[email protected]>.

---
 Makefile                                        |   21 ---
 board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c |  114 +++++++------
 board/atmel/at91sam9m10g45ek/led.c              |    6 +-
 boards.cfg                                      |    1 +
 include/configs/at91sam9m10g45ek.h              |  193 ++++++++++-------------
 5 files changed, 154 insertions(+), 181 deletions(-)
Makefile +0 -21
index 156b21b..7ff3bda 100644
@@ -802,27 +802,6 @@ M5485HFE_config :	unconfig
 ## ARM926EJ-S Systems
 #########################################################################
 
-at91sam9m10g45ek_nandflash_config \
-at91sam9m10g45ek_dataflash_config \
-at91sam9m10g45ek_dataflash_cs0_config \
-at91sam9m10g45ek_config \
-at91sam9g45ekes_nandflash_config \
-at91sam9g45ekes_dataflash_config \
-at91sam9g45ekes_dataflash_cs0_config \
-at91sam9g45ekes_config	:	unconfig
-	@mkdir -p $(obj)include
-		@if [ "$(findstring 9m10,$@)" ] ; then \
-		echo "#define CONFIG_AT91SAM9M10G45EK 1"	>>$(obj)include/config.h ; \
-	else \
-		echo "#define CONFIG_AT91SAM9G45EKES 1"	>>$(obj)include/config.h ; \
-	fi;
-	@if [ "$(findstring _nandflash,$@)" ] ; then \
-		echo "#define CONFIG_SYS_USE_NANDFLASH 1"	>>$(obj)include/config.h ; \
-	else \
-		echo "#define CONFIG_ATMEL_SPI 1"	>>$(obj)include/config.h ; \
-	fi;
-	@$(MKCONFIG) -n $@ -a at91sam9m10g45ek arm arm926ejs at91sam9m10g45ek atmel at91
-
 pm9g45_config	:	unconfig
 	@mkdir -p $(obj)include
 	@$(MKCONFIG) -a pm9g45 arm arm926ejs pm9g45 ronetix at91
board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c +62 -52

237 lines not on this page · raw message

board/atmel/at91sam9m10g45ek/led.c +4 -2
index ff59a2d..dadbd6a 100644
@@ -23,15 +23,17 @@
  */
 
 #include <common.h>
+#include <asm/io.h>
 #include <asm/arch/at91sam9g45.h>
 #include <asm/arch/at91_pmc.h>
 #include <asm/arch/gpio.h>
-#include <asm/arch/io.h>
 
 void coloured_LED_init(void)
 {
+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
+
 	/* Enable clock */
-	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9G45_ID_PIODE);
+	writel(1 << ATMEL_ID_PIODE, &pmc->pcer);
 
 	at91_set_gpio_output(CONFIG_RED_LED, 1);
 	at91_set_gpio_output(CONFIG_GREEN_LED, 1);
boards.cfg +1 -0
index 38ccb8c..90ec1bc 100644
@@ -91,6 +91,7 @@ at91sam9g10ek_dataflash_cs3  arm         arm926ejs   at91sam9261ek       atmel
 at91sam9g20ek_nandflash      arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9G20,SYS_USE_NANDFLASH
 at91sam9g20ek_dataflash_cs0  arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9G20,SYS_USE_DATAFLASH_CS0
 at91sam9g20ek_dataflash_cs1  arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9G20,SYS_USE_DATAFLASH_CS1
+at91sam9m10g45ek_nandflash   arm         arm926ejs   at91sam9m10g45ek    atmel          at91        at91sam9m10g45ek:AT91SAM9M10G45,SYS_USE_NANDFLASH
 at91sam9rlek_nandflash       arm         arm926ejs   at91sam9rlek        atmel          at91        at91sam9rlek:AT91SAM9RL,SYS_USE_NANDFLASH
 at91sam9rlek_dataflash       arm         arm926ejs   at91sam9rlek        atmel          at91        at91sam9rlek:AT91SAM9RL,SYS_USE_DATAFLASH
 at91sam9xeek_nandflash       arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9XE,SYS_USE_NANDFLASH
include/configs/at91sam9m10g45ek.h +87 -106

257 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#4 lore raw

PATCH 2/2 atmel: Update support of board AT91SAM9M10G45-EK to new style

Dear Thomas Petazzoni,

Quoted 10 lines

Based on earlier work by Alex Waterman <[email protected]>.

---
 Makefile                                        |   21 ---
 board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c |  114 +++++++------
 board/atmel/at91sam9m10g45ek/led.c              |    6 +-
 boards.cfg                                      |    1 +
 include/configs/at91sam9m10g45ek.h              |  193 ++++++++++-------------
 5 files changed, 154 insertions(+), 181 deletions(-)

Removal of board from MAKEALL missing...

Configuring for at91sam9m10g45ek_nandflash - Board: at91sam9m10g45ek,
Options: AT91SAM9M10G45,SYS_USE_NANDFLASH at91sam9m10g45ek.c: In function ?board_early_init_f?:
at91sam9m10g45ek.c:256:1: warning: control reaches end of non-void function
text data bss dec hex filename
201534 32116 71760 305410 4a902 ./u-boot

AND this board's early_init_f is quite different from the other atmel boards, also the place of calling at91_seriald_hw_init() is different from them.
Please verify that this is OK.

Thanks,
Reinhard

#5 lore raw

PATCH 2/2 atmel: Update support of board AT91SAM9M10G45-EK to new style

Le Thu, 04 Aug 2011 20:21:58 +0000, Reinhard Meyer <[email protected]> a ?crit :

Quoted 3 lines

AND this board's early_init_f is quite different from the other atmel boards, also the place of calling at91_seriald_hw_init() is different from them.

If at91_seriald_hw_init() isn't called in early_init_f, then the "U-Boot 2011.06-.... (Aug 04 2011 ...)" message isn't displayed on the debug serial port.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#6 lore raw

PATCH 2/2 atmel: Update support of board AT91SAM9M10G45-EK to new style

Dear Thomas Petazzoni,

Quoted 10 lines

Le Thu, 04 Aug 2011 20:21:58 +0000, Reinhard Meyer <[email protected]> a ?crit :

Quoted 3 lines

AND this board's early_init_f is quite different from the other atmel boards, also the place of calling at91_seriald_hw_init() is different from them.

If at91_seriald_hw_init() isn't called in early_init_f, then the "U-Boot 2011.06-.... (Aug 04 2011 ...)" message isn't displayed on the debug serial port.

That would mean, that the other boards would not display the message either..!? I cannot verify this, I can only verify seamless build..

So please fix the two issues I mentioned: board removal from MAKEALL and missing return value of board_early_init_f().

Thank you,
Reinhard

#7 lore raw

PATCH 2/2 atmel: Update support of board AT91SAM9M10G45-EK to new style

Le Thu, 04 Aug 2011 21:14:01 +0000, Reinhard Meyer <[email protected]> a ?crit :

Quoted 2 lines

That would mean, that the other boards would not display the message either..!? I cannot verify this, I can only verify seamless build..

I guess so.

However, I have just taken an AT91SAM9261-EK and it seems that U-Boot from atmel/master does not work at all.

First, the AT91Bootstrap binary provided by Atmel only loads 0x33900 bytes from the Dataflash, but current U-Boot binaries are larger than that. This might surprise people trying to mix a recent version of U-Boot with the normal AT91Bootstrap configuration on this platform.

Unfortunately, even with this fix in place, U-Boot still doesn't show any sign of life on this platform...

Regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#8 lore raw

PATCH 2/2 atmel: Update support of board AT91SAM9M10G45-EK to new style

Quoted 7 lines · Thomas Petazzoni

However, I have just taken an AT91SAM9261-EK and it seems that U-Boot from atmel/master does not work at all.

First, the AT91Bootstrap binary provided by Atmel only loads 0x33900 bytes from the Dataflash, but current U-Boot binaries are larger than that. This might surprise people trying to mix a recent version of U-Boot with the normal AT91Bootstrap configuration on this platform.

The (maximum) size of the image to load is hardcoded into at91bootstrap. For most boards (including at91sam9m10g45-ek) this is 0x33900 if loading from DataFlash and 0x40000 if loading from NAND.

So if you didn't modify your at91bootstrap, you should get the same problem on AT91SAM9M10G45-EK if booting from DataFlash.

Detlef

#9 lore raw

PATCH 2/2 atmel: Update support of board AT91SAM9M10G45-EK to new style

Le Fri, 05 Aug 2011 11:37:05 +0200,
Detlef Vollmann <[email protected]> a ?crit :

Quoted 6 lines

The (maximum) size of the image to load is hardcoded into at91bootstrap. For most boards (including at91sam9m10g45-ek) this is 0x33900 if loading from DataFlash and 0x40000 if loading from NAND.

So if you didn't modify your at91bootstrap, you should get the same problem on AT91SAM9M10G45-EK if booting from DataFlash.

Correct. The thing is that I only tested the AT91SAM9M10G45-EK support on Nandflash, as I haven't had the time to get the Dataflash support to work again in the current U-Boot.

I have a custom board similar to AT91SAM9M10G45-EK here which boots from Dataflash, but it uses an old 1.3.4 U-Boot (which I'd like to upgrade), for which the binary is only 152K, which is less than 0x33900. I'll try to get a modern U-Boot working with Dataflash support on AT91SAM9M10G45-EK, and this will require a small modification in AT91Bootstrap.

It is a bit amazing to see that the size of U-Boot has increased from 154912 bytes in version 1.3.4 to 233252 bytes in the current Git (and the latter has no support for Dataflash, while the former does).

Regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com