Skip to contentSkip to conversation

AT91: Makes AT91SAM9261(9G10) SoC build correctly against u-boot-atmel/master

PATCH Superseded Hong Xu 2 participants 4 messages Jun 11, 2011 – Jun 14, 2011

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Hong Xu

author
#0 lore raw

PATCH v2 1/2 AT91: Makes AT91SAM9261(9G10) SoC build correctly against u-boot-atmel/master

Rework for AT91SAM9261(9G10) SoC, makes it build again. Based on the work for AT91SAM9260-EK.

---
 arch/arm/cpu/arm926ejs/at91/at91sam9261_devices.c  |   45 +++++-------
 arch/arm/include/asm/arch-at91/at91_spi.h          |    2 +-
 arch/arm/include/asm/arch-at91/at91sam9261.h       |    1 +
 .../arm/include/asm/arch-at91/at91sam9261_matrix.h |   77 +++++++++-----------
 4 files changed, 56 insertions(+), 69 deletions(-)
arch/arm/cpu/arm926ejs/at91/at91sam9261_devices.c +18 -27
index b4353ef..3db2b20 100644
@@ -26,74 +26,65 @@
 #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>
 
 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_PORTC, 8, 1);		/* TXD0 */
 	at91_set_a_periph(AT91_PIO_PORTC, 9, 0);		/* RXD0 */
-	writel(1 << AT91SAM9261_ID_US0, &pmc->pcer);
+	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_PORTC, 12, 1);		/* TXD1 */
 	at91_set_a_periph(AT91_PIO_PORTC, 13, 0);		/* RXD1 */
-	writel(1 << AT91SAM9261_ID_US1, &pmc->pcer);
+	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_PORTC, 14, 1);		/* TXD2 */
 	at91_set_a_periph(AT91_PIO_PORTC, 15, 0);		/* RXD2 */
-	writel(1 << AT91SAM9261_ID_US2, &pmc->pcer);
+	writel(1 << ATMEL_ID_USART2, &pmc->pcer);
 }
 
 void at91_serial3_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_PORTA, 9, 0);		/* DRXD */
 	at91_set_a_periph(AT91_PIO_PORTA, 10, 1);		/* DTXD */
-	writel(1 << AT91_ID_SYS, &pmc->pcer);
+	writel(1 << ATMEL_ID_SYS, &pmc->pcer);
 }
 
-void at91_serial_hw_init(void)
+void at91_seriald_hw_init(void)
 {
-#ifdef CONFIG_USART0
-	at91_serial0_hw_init();
-#endif
+	at91_pmc_t *pmc = (at91_pmc_t *)ATMEL_BASE_PMC;
 
-#ifdef CONFIG_USART1
-	at91_serial1_hw_init();
-#endif
+	at91_set_a_periph(AT91_PIO_PORTB, 14, 0);	/* DRXD */
+	at91_set_a_periph(AT91_PIO_PORTB, 15, 1);	/* DTXD */
 
-#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_HAS_DATAFLASH
 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_PORTA, 0, 0);	/* SPI0_MISO */
 	at91_set_a_periph(AT91_PIO_PORTA, 1, 0);	/* SPI0_MOSI */
 	at91_set_a_periph(AT91_PIO_PORTA, 2, 0);	/* SPI0_SPCK */
 
 	/* Enable clock */
-	writel(1 << AT91SAM9261_ID_SPI0, &pmc->pcer);
+	writel(1 << ATMEL_ID_SPI0, &pmc->pcer);
 
 	if (cs_mask & (1 << 0)) {
 		at91_set_a_periph(AT91_PIO_PORTA, 3, 1);
@@ -123,14 +114,14 @@ void at91_spi0_hw_init(unsigned long cs_mask)
 
 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, 30, 0);	/* SPI1_MISO */
 	at91_set_a_periph(AT91_PIO_PORTB, 31, 0);	/* SPI1_MOSI */
 	at91_set_a_periph(AT91_PIO_PORTB, 29, 0);	/* SPI1_SPCK */
 
 	/* Enable clock */
-	writel(1 << AT91SAM9261_ID_SPI1, &pmc->pcer);
+	writel(1 << ATMEL_ID_SPI1, &pmc->pcer);
 
 	if (cs_mask & (1 << 0)) {
 		at91_set_a_periph(AT91_PIO_PORTB, 28, 1);
arch/arm/include/asm/arch-at91/at91_spi.h +1 -1
index c520e89..afe724d 100644
@@ -33,7 +33,7 @@ typedef struct at91_spi {
 	at91_pdc_t	pdc;
 } at91_spi_t;
 
-#ifdef CONFIG_AT91_LEGACY
+#ifdef CONFIG_ATMEL_LEGACY
 
 #define AT91_SPI_CR			0x00		/* Control Register */
 #define		AT91_SPI_SPIEN		(1 <<  0)		/* SPI Enable */
arch/arm/include/asm/arch-at91/at91sam9261.h +1 -0
index c85fd29..afd7bd9 100644
@@ -126,6 +126,7 @@
  */
 #define ATMEL_PIO_PORTS		3		/* theese SoCs have 3 PIO */
 #define ATMEL_BASE_PIO		ATMEL_BASE_PIOA
+#define ATMEL_PMC_UHP           AT91SAM926x_PMC_UHP
 
 /*
  * SoC specific defines
arch/arm/include/asm/arch-at91/at91sam9261_matrix.h +36 -41

86 lines not on this page · raw message

Signature · 1 line
1.7.3.3
author
#1 lore raw

PATCH v2 2/2 AT91: Makes AT91SAM9261(9G10)-EK build correctly against u-boot-atmel/master

Rework for AT91SAM9261(9G10)-EK, makes it build again. Based on the work for AT91SAM9260-EK.

---
 Makefile                                  |   23 -----
 board/atmel/at91sam9261ek/at91sam9261ek.c |  136 +++++++++++++++--------------
 board/atmel/at91sam9261ek/config.mk       |    1 -
 board/atmel/at91sam9261ek/led.c           |    7 +-
 boards.cfg                                |    6 ++
 include/configs/at91sam9261ek.h           |   81 ++++++++++--------
 6 files changed, 128 insertions(+), 126 deletions(-)
 delete mode 100644 board/atmel/at91sam9261ek/config.mk
Makefile +0 -23
index 1619c47..cd328b3 100644
@@ -766,29 +766,6 @@ M5485HFE_config :	unconfig
 ## ARM926EJ-S Systems
 #########################################################################
 
-at91sam9261ek_nandflash_config \
-at91sam9261ek_dataflash_cs0_config \
-at91sam9261ek_dataflash_cs3_config \
-at91sam9261ek_config \
-at91sam9g10ek_nandflash_config \
-at91sam9g10ek_dataflash_cs0_config \
-at91sam9g10ek_dataflash_cs3_config \
-at91sam9g10ek_config	:	unconfig
-	@mkdir -p $(obj)include
-	@if [ "$(findstring 9g10,$@)" ] ; then \
-		echo "#define CONFIG_AT91SAM9G10EK 1"	>>$(obj)include/config.h ; \
-	else \
-		echo "#define CONFIG_AT91SAM9261EK 1"	>>$(obj)include/config.h ; \
-	fi;
-	@if [ "$(findstring _nandflash,$@)" ] ; then \
-		echo "#define CONFIG_SYS_USE_NANDFLASH 1"	>>$(obj)include/config.h ; \
-	elif [ "$(findstring dataflash_cs0,$@)" ] ; then \
-		echo "#define CONFIG_SYS_USE_DATAFLASH_CS3 1"	>>$(obj)include/config.h ; \
-	else \
-		echo "#define CONFIG_SYS_USE_DATAFLASH_CS0 1"	>>$(obj)include/config.h ; \
-	fi;
-	@$(MKCONFIG) -n $@ -a at91sam9261ek arm arm926ejs at91sam9261ek atmel at91
-
 at91sam9263ek_norflash_config \
 at91sam9263ek_norflash_boot_config \
 at91sam9263ek_nandflash_config \
board/atmel/at91sam9261ek/at91sam9261ek.c +72 -64

213 lines not on this page · raw message

board/atmel/at91sam9261ek/config.mk deleted +0 -1
deleted file mode 100644
index e554a45..0000000
@@ -1 +0,0 @@
-CONFIG_SYS_TEXT_BASE = 0x23f00000
board/atmel/at91sam9261ek/led.c +5 -2
index 5d1c5f2..0c2f522 100644
@@ -26,12 +26,15 @@
 #include <asm/arch/at91sam9261.h>
 #include <asm/arch/at91_pmc.h>
 #include <asm/arch/gpio.h>
-#include <asm/arch/io.h>
+#include <asm/arch/at91_pio.h>
+#include <asm/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 << AT91SAM9261_ID_PIOA);
+	writel(ATMEL_ID_PIOA, &pmc->pcer);
 
 	at91_set_gpio_output(CONFIG_RED_LED, 1);
 	at91_set_gpio_output(CONFIG_GREEN_LED, 1);
boards.cfg +6 -0
index ac20c81..c91d6f5 100644
@@ -83,6 +83,12 @@ at91sam9g20ek_dataflash_cs1  arm         arm926ejs   at91sam9260ek       atmel
 at91sam9xeek_nandflash       arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9XE,SYS_USE_NANDFLASH
 at91sam9xeek_dataflash_cs0   arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS0
 at91sam9xeek_dataflash_cs1   arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS1
+at91sam9261ek_nandflash      arm         arm926ejs   at91sam9261ek       atmel          at91        at91sam9261ek:AT91SAM9261,SYS_USE_NANDFLASH
+at91sam9261ek_dataflash_cs0  arm         arm926ejs   at91sam9261ek       atmel          at91        at91sam9261ek:AT91SAM9261,SYS_USE_DATAFLASH_CS0
+at91sam9261ek_dataflash_cs3  arm         arm926ejs   at91sam9261ek       atmel          at91        at91sam9261ek:AT91SAM9261,SYS_USE_DATAFLASH_CS3
+at91sam9g10ek_nandflash      arm         arm926ejs   at91sam9261ek       atmel          at91        at91sam9261ek:AT91SAM9G10,SYS_USE_NANDFLASH
+at91sam9g10ek_dataflash_cs0  arm         arm926ejs   at91sam9261ek       atmel          at91        at91sam9261ek:AT91SAM9G10,SYS_USE_DATAFLASH_CS0
+at91sam9g10ek_dataflash_cs3  arm         arm926ejs   at91sam9261ek       atmel          at91        at91sam9261ek:AT91SAM9G10,SYS_USE_DATAFLASH_CS3
 snapper9260                  arm         arm926ejs   -                   bluewater      at91        snapper9260:AT91SAM9260
 snapper9g20                  arm         arm926ejs   snapper9260         bluewater      at91        snapper9260:AT91SAM9G20
 cpu9260                      arm         arm926ejs   cpu9260             eukrea         at91        cpu9260:CPU9260
include/configs/at91sam9261ek.h +45 -36

161 lines not on this page · raw message

Signature · 1 line
1.7.3.3
#2 lore raw

PATCH v2 2/2 AT91: Makes AT91SAM9261(9G10)-EK build correctly against u-boot-atmel/master

Dear Hong Xu,

Quoted 5 lines

Rework for AT91SAM9261(9G10)-EK, makes it build again. Based on the work for AT91SAM9260-EK.

Quoted 10 lines
---
 Makefile                                  |   23 -----
 board/atmel/at91sam9261ek/at91sam9261ek.c |  136 +++++++++++++++--------------
 board/atmel/at91sam9261ek/config.mk       |    1 -
 board/atmel/at91sam9261ek/led.c           |    7 +-
 boards.cfg                                |    6 ++
 include/configs/at91sam9261ek.h           |   81 ++++++++++--------
 6 files changed, 128 insertions(+), 126 deletions(-)
 delete mode 100644 board/atmel/at91sam9261ek/config.mk

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

#3 lore raw

PATCH v2 1/2 AT91: Makes AT91SAM9261(9G10) SoC build correctly against u-boot-atmel/master

In reply to Hong Xu

Dear Hong Xu,

Quoted 16 lines

Rework for AT91SAM9261(9G10) SoC, makes it build again. Based on the work for AT91SAM9260-EK.

---
 arch/arm/cpu/arm926ejs/at91/at91sam9261_devices.c  |   45 +++++-------
 arch/arm/include/asm/arch-at91/at91_spi.h          |    2 +-
 arch/arm/include/asm/arch-at91/at91sam9261.h       |    1 +
 .../arm/include/asm/arch-at91/at91sam9261_matrix.h |   77 +++++++++-----------
 4 files changed, 56 insertions(+), 69 deletions(-)
arch/arm/include/asm/arch-at91/at91_spi.h +0 -0
index c520e89..afe724d 100644

arch/arm/include/asm/arch-at91/at91_spi.h typedef struct at91_spi { · line 36

Quoted 5 lines
arch/arm/include/asm/arch-at91/at91_spi.h +1 -1
@@ -33,7 +33,7 @@ typedef struct at91_spi {
 	at91_pdc_t	pdc;
 } at91_spi_t;
 
-#ifdef CONFIG_AT91_LEGACY
+#ifdef CONFIG_ATMEL_LEGACY

This was already fixed by another patch. But the endif statement was not...

arch/arm/include/asm/arch-at91/at91_spi.h typedef struct at91_spi { · line 39

Quoted 3 lines
arch/arm/include/asm/arch-at91/at91_spi.h +0 -0
 #define AT91_SPI_CR			0x00		/* Control Register */
 #define		AT91_SPI_SPIEN		(1 <<  0)		/* SPI Enable */

After fixing at91_spi.h applied to u-boot-atmel/master

Best Regards,
Reinhard