Skip to contentSkip to conversation

tny_a9260/tny_a9g20: update board to the new AT91 organization

PATCH New Thomas Petazzoni 2 participants 3 messages Aug 4, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tny_a9260/tny_a9g20: update board to the new AT91 organization

Cc Albin Tonnerre <[email protected]>
CC Gregory Hermant <[email protected]>
---
 board/calao/tny_a9260/tny_a9260.c |   55 ++++++++++++------------
 boards.cfg                        |    4 ++
 include/configs/tny_a9260.h       |   85 ++++++++++++++++++-------------------
 3 files changed, 73 insertions(+), 71 deletions(-)
board/calao/tny_a9260/tny_a9260.c +27 -28
index d51ca15..ab51a33 100644
@@ -26,14 +26,12 @@
  */
 
 #include <common.h>
-#include <asm/arch/at91sam9260.h>
 #include <asm/arch/at91sam9_matrix.h>
 #include <asm/arch/at91sam9_smc.h>
 #include <asm/arch/at91_common.h>
 #include <asm/arch/at91_pmc.h>
 #include <asm/arch/at91_rstc.h>
 #include <asm/arch/gpio.h>
-#include <asm/arch/io.h>
 #include <asm/arch/hardware.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -45,33 +43,36 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static void tny_a9260_nand_hw_init(void)
 {
+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
+	struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC;
+	struct at91_matrix *matrix = (struct at91_matrix *)ATMEL_BASE_MATRIX;
 	unsigned long csa;
 
-	/* Enable CS3 */
-	csa = at91_sys_read(AT91_MATRIX_EBICSA);
-	at91_sys_write(AT91_MATRIX_EBICSA,
-		       csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
+	/* Assign CS3 to NAND/SmartMedia Interface */
+	csa = readl(&matrix->ebicsa);
+	csa |= AT91_MATRIX_CS3A_SMC_SMARTMEDIA;
+	writel(csa, &matrix->ebicsa);
 
 	/* Configure SMC CS3 for NAND/SmartMedia */
-	at91_sys_write(AT91_SMC_SETUP(3),
-		       AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0) |
-		       AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
-	at91_sys_write(AT91_SMC_PULSE(3),
-		       AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) |
-		       AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
-	at91_sys_write(AT91_SMC_CYCLE(3),
-		       AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
-	at91_sys_write(AT91_SMC_MODE(3),
-		       AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
-		       AT91_SMC_EXNWMODE_DISABLE |
+	writel(AT91_SMC_SETUP_NWE(1) | AT91_SMC_SETUP_NCS_WR(0) |
+		AT91_SMC_SETUP_NRD(1) | AT91_SMC_SETUP_NCS_RD(0),
+		&smc->cs[3].setup);
+	writel(AT91_SMC_PULSE_NWE(3) | AT91_SMC_PULSE_NCS_WR(3) |
+		AT91_SMC_PULSE_NRD(3) | AT91_SMC_PULSE_NCS_RD(3),
+		&smc->cs[3].pulse);
+	writel(AT91_SMC_CYCLE_NWE(5) | AT91_SMC_CYCLE_NRD(5),
+		&smc->cs[3].cycle);
+	writel(AT91_SMC_MODE_RM_NRD | AT91_SMC_MODE_WM_NWE |
+		AT91_SMC_MODE_EXNW_DISABLE |
 #ifdef CONFIG_SYS_NAND_DBW_16
-		       AT91_SMC_DBW_16 |
+		AT91_SMC_MODE_DBW_16 |
 #else /* CONFIG_SYS_NAND_DBW_8 */
-		       AT91_SMC_DBW_8 |
+		AT91_SMC_MODE_DBW_8 |
 #endif
-		       AT91_SMC_TDF_(2));
+		AT91_SMC_MODE_TDF_CYCLE(2),
+		&smc->cs[3].mode);
 
-	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_PIOC);
+	writel(1 << ATMEL_ID_PIOC, &pmc->pcer);
 
 	/* Configure RDY/BSY */
 	at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
@@ -91,9 +92,9 @@ int board_init(void)
 	gd->bd->bi_arch_number = MACH_TYPE_TNY_A9G20;
 #endif
 	/* adress of boot parameters */
-	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 
-	at91_serial_hw_init();
+	at91_seriald_hw_init();
 	tny_a9260_nand_hw_init();
 	at91_spi0_hw_init(1 << 5);
 	return 0;
@@ -101,10 +102,8 @@ int board_init(void)
 
 int dram_init(void)
 {
-	gd->bd->bi_dram[0].start = PHYS_SDRAM;
-	if(get_ram_size((long *) PHYS_SDRAM, PHYS_SDRAM_SIZE) != PHYS_SDRAM_SIZE)
-		return -1;
-
-	gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
+	gd->ram_size = get_ram_size(
+		(void *)CONFIG_SYS_SDRAM_BASE,
+		CONFIG_SYS_SDRAM_SIZE);
 	return 0;
 }
boards.cfg +4 -0
index 38ccb8c..8d4f9e0 100644
@@ -98,6 +98,10 @@ at91sam9xeek_dataflash_cs0   arm         arm926ejs   at91sam9260ek       atmel
 at91sam9xeek_dataflash_cs1   arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS1
 snapper9260                  arm         arm926ejs   -                   bluewater      at91        snapper9260:AT91SAM9260
 snapper9g20                  arm         arm926ejs   snapper9260         bluewater      at91        snapper9260:AT91SAM9G20
+tny_a9g20_nandflash          arm         arm926ejs   tny_a9260           calao          at91        tny_a9260:AT91SAM9G20,SYS_USE_NANDFLASH
+tny_a9g20_eeprom             arm         arm926ejs   tny_a9260           calao          at91        tny_a9260:AT91SAM9G20,SYS_USE_EEPROM
+tny_a9260_nandflash          arm         arm926ejs   tny_a9260           calao          at91        tny_a9260:AT91SAM9260,SYS_USE_NANDFLASH
+tny_a9260_eeprom             arm         arm926ejs   tny_a9260           calao          at91        tny_a9260:AT91SAM9260,SYS_USE_EEPROM
 cpu9260                      arm         arm926ejs   cpu9260             eukrea         at91        cpu9260:CPU9260
 cpu9260_nand                 arm         arm926ejs   cpu9260             eukrea         at91        cpu9260:CPU9260,NANDBOOT
 cpu9260_128M                 arm         arm926ejs   cpu9260             eukrea         at91        cpu9260:CPU9260,CPU9260_128M
include/configs/tny_a9260.h +42 -43

153 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/1 tny_a9260/tny_a9g20: update board to the new AT91 organization

Dear Thomas Petazzoni,

Quoted 8 lines
Cc Albin Tonnerre <[email protected]>
CC Gregory Hermant <[email protected]>
---
 board/calao/tny_a9260/tny_a9260.c |   55 ++++++++++++------------
 boards.cfg                        |    4 ++
 include/configs/tny_a9260.h       |   85 ++++++++++++++++++-------------------
 3 files changed, 73 insertions(+), 71 deletions(-)

I had to manually add the removal of those board(s) from Makefile and MAKEALL. Please be more careful next time :)

Configuring for tny_a9260_nandflash - Board: tny_a9260, Options:
AT91SAM9260,SYS_USE_NANDFLASH
text data bss dec hex filename
133752 5624 204592 343968 53fa0 ./u-boot
Configuring for tny_a9260_eeprom - Board: tny_a9260, Options:
AT91SAM9260,SYS_USE_EEPROM
text data bss dec hex filename
133752 5624 204592 343968 53fa0 ./u-boot
Configuring for tny_a9g20_nandflash - Board: tny_a9260, Options:
AT91SAM9G20,SYS_USE_NANDFLASH
text data bss dec hex filename
133776 5624 204592 343992 53fb8 ./u-boot
Configuring for tny_a9g20_eeprom - Board: tny_a9260, Options:
AT91SAM9G20,SYS_USE_EEPROM
text data bss dec hex filename
133776 5624 204592 343992 53fb8 ./u-boot

--------------------- SUMMARY ---------------------------- Boards compiled: 4
----------------------------------------------------------

Removal patch for those boards set to "Not Applicable".

Best Regards,
Reinhard

#2 lore raw

PATCH 1/1 tny_a9260/tny_a9g20: update board to the new AT91 organization

Le Thu, 04 Aug 2011 17:36:29 +0000, Reinhard Meyer <[email protected]> a ?crit :

Quoted 2 lines

I had to manually add the removal of those board(s) from Makefile and MAKEALL. Please be more careful next time :)

Ah, yes, sorry.

Quoted 1 line

Removal patch for those boards set to "Not Applicable".

Thanks!

Thomas

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