]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
AT91: Makes AT91SAM9263-EK build correctly against u-boot-atmel/master
authorXu, Hong <Hong.Xu@atmel.com>
Fri, 10 Jun 2011 21:31:26 +0000 (21:31 +0000)
committerU-Boot <uboot@aari01-12.(none)>
Wed, 3 Aug 2011 11:00:56 +0000 (13:00 +0200)
Rework for AT91SAM9263-EK, makes it build again.
Based on the work for AT91SAM9260-EK.

Signed-off-by: Hong Xu <hong.xu@atmel.com>
Signed-off-by: Reinhard Meyer <uboot@emk-elektronik.de>
Makefile
board/atmel/at91sam9263ek/at91sam9263ek.c
board/atmel/at91sam9263ek/config.mk [deleted file]
board/atmel/at91sam9263ek/led.c
boards.cfg
include/configs/at91sam9263ek.h

index 28398a39d49c0d61fbedd4c0020706fe65e93b84..aa788513d77e15d825ea43567df1592bb629ee10 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -802,25 +802,6 @@ M5485HFE_config :  unconfig
 ## ARM926EJ-S Systems
 #########################################################################
 
-at91sam9263ek_norflash_config \
-at91sam9263ek_norflash_boot_config \
-at91sam9263ek_nandflash_config \
-at91sam9263ek_dataflash_config \
-at91sam9263ek_dataflash_cs0_config \
-at91sam9263ek_config   :       unconfig
-       @mkdir -p $(obj)include
-       @if [ "$(findstring _nandflash,$@)" ] ; then \
-               echo "#define CONFIG_SYS_USE_NANDFLASH 1"       >>$(obj)include/config.h ; \
-       elif [ "$(findstring norflash,$@)" ] ; then \
-               echo "#define CONFIG_SYS_USE_NORFLASH 1"        >>$(obj)include/config.h ; \
-       else \
-               echo "#define CONFIG_SYS_USE_DATAFLASH 1"       >>$(obj)include/config.h ; \
-       fi;
-       @if [ "$(findstring norflash_boot,$@)" ] ; then \
-               echo "#define CONFIG_SYS_USE_BOOT_NORFLASH 1"   >>$(obj)include/config.h ; \
-       fi;
-       @$(MKCONFIG) -n $@ -a at91sam9263ek arm arm926ejs at91sam9263ek atmel at91
-
 at91sam9m10g45ek_nandflash_config \
 at91sam9m10g45ek_dataflash_config \
 at91sam9m10g45ek_dataflash_cs0_config \
index 91efc07ffd142c5693aa42a3b5cf09768c485c6e..4d2937d2dbbb2ce0beaa69b8aab13a475922ed21 100644 (file)
@@ -32,7 +32,8 @@
 #include <asm/arch/at91_matrix.h>
 #include <asm/arch/at91_pio.h>
 #include <asm/arch/clk.h>
-#include <asm/arch/io.h>
+#include <asm/io.h>
+#include <asm/arch/gpio.h>
 #include <asm/arch/hardware.h>
 #include <lcd.h>
 #include <atmel_lcdc.h>
@@ -52,9 +53,9 @@ DECLARE_GLOBAL_DATA_PTR;
 static void at91sam9263ek_nand_hw_init(void)
 {
        unsigned long csa;
-       at91_smc_t      *smc    = (at91_smc_t *) AT91_SMC0_BASE;
-       at91_matrix_t   *matrix = (at91_matrix_t *) AT91_MATRIX_BASE;
-       at91_pmc_t      *pmc    = (at91_pmc_t *) AT91_PMC_BASE;
+       at91_smc_t    *smc    = (at91_smc_t *) ATMEL_BASE_SMC0;
+       at91_matrix_t *matrix = (at91_matrix_t *) ATMEL_BASE_MATRIX;
+       at91_pmc_t    *pmc    = (at91_pmc_t *) ATMEL_BASE_PMC;
 
        /* Enable CS3 */
        csa = readl(&matrix->csa[0]) | AT91_MATRIX_CSA_EBI_CS3A;
@@ -83,14 +84,14 @@ static void at91sam9263ek_nand_hw_init(void)
                       AT91_SMC_MODE_TDF_CYCLE(2),
                &smc->cs[3].mode);
 
-       writel(1 << AT91SAM9263_ID_PIOA | 1 << AT91SAM9263_ID_PIOCDE,
+       writel(1 << ATMEL_ID_PIOA | 1 << ATMEL_ID_PIOCDE,
                &pmc->pcer);
 
        /* Configure RDY/BSY */
-       at91_set_pio_input(CONFIG_SYS_NAND_READY_PIN, 1);
+       at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
 
        /* Enable NandFlash */
-       at91_set_pio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
+       at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
 }
 #endif
 
@@ -98,11 +99,11 @@ static void at91sam9263ek_nand_hw_init(void)
 static void at91sam9263ek_macb_hw_init(void)
 {
        unsigned long   erstl;
-       at91_pmc_t      *pmc    = (at91_pmc_t *) AT91_PMC_BASE;
-       at91_pio_t      *pio    = (at91_pio_t *) AT91_PIO_BASE;
-       at91_rstc_t     *rstc   = (at91_rstc_t *) AT91_RSTC_BASE;
+       at91_pmc_t      *pmc    = (at91_pmc_t *) ATMEL_BASE_PMC;
+       at91_pio_t      *pio    = (at91_pio_t *) ATMEL_BASE_PIO;
+       at91_rstc_t     *rstc   = (at91_rstc_t *) ATMEL_BASE_RSTC;
        /* Enable clock */
-       writel(1 << AT91SAM9263_ID_EMAC, &pmc->pcer);
+       writel(1 << ATMEL_ID_EMAC, &pmc->pcer);
 
        /*
         * Disable pull-up on:
@@ -153,7 +154,7 @@ vidinfo_t panel_info = {
        vl_vsync_len:   1,
        vl_upper_margin:1,
        vl_lower_margin:0,
-       mmio:           AT91SAM9263_LCDC_BASE,
+       mmio:           ATMEL_BASE_LCDC,
 };
 
 void lcd_enable(void)
@@ -168,7 +169,7 @@ void lcd_disable(void)
 
 static void at91sam9263ek_lcd_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, 1, 0);        /* LCDHSYNC */
        at91_set_a_periph(AT91_PIO_PORTC, 2, 0);        /* LCDDOTCK */
@@ -193,8 +194,8 @@ static void at91sam9263ek_lcd_hw_init(void)
        at91_set_a_periph(AT91_PIO_PORTC, 26, 0);       /* LCDD22 */
        at91_set_a_periph(AT91_PIO_PORTC, 27, 0);       /* LCDD23 */
 
-       writel(1 << AT91SAM9263_ID_LCDC, &pmc->pcer);
-       gd->fb_base = AT91SAM9263_SRAM0_BASE;
+       writel(1 << ATMEL_ID_LCDC, &pmc->pcer);
+       gd->fb_base = ATMEL_BASE_SRAM0;
 }
 
 #ifdef CONFIG_LCD_INFO
@@ -218,7 +219,7 @@ void lcd_show_board_info(void)
        lcd_printf ("(C) 2008 ATMEL Corp\n");
        lcd_printf ("at91support@atmel.com\n");
        lcd_printf ("%s CPU at %s MHz\n",
-               CONFIG_SYS_AT91_CPU_NAME,
+               ATMEL_CPU_NAME,
                strmhz(temp, get_cpu_clk_rate()));
 
        dram_size = 0;
@@ -244,6 +245,18 @@ void lcd_show_board_info(void)
 #endif /* CONFIG_LCD_INFO */
 #endif
 
+int board_early_init_f(void)
+{
+       struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
+
+       /* Enable clocks for all PIOs */
+       writel((1 << ATMEL_ID_PIOA) | (1 << ATMEL_ID_PIOB) |
+               (1 << ATMEL_ID_PIOCDE),
+               &pmc->pcer);
+
+       return 0;
+}
+
 int board_init(void)
 {
        /* Enable Ctrlc */
@@ -252,9 +265,9 @@ int board_init(void)
        /* arch number of AT91SAM9263EK-Board */
        gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9263EK;
        /* 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();
 #ifdef CONFIG_CMD_NAND
        at91sam9263ek_nand_hw_init();
 #endif
@@ -276,8 +289,9 @@ int board_init(void)
 
 int dram_init(void)
 {
-       gd->bd->bi_dram[0].start = PHYS_SDRAM;
-       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;
 }
 
@@ -291,7 +305,7 @@ int board_eth_init(bd_t *bis)
 {
        int rc = 0;
 #ifdef CONFIG_MACB
-       rc = macb_eth_initialize(0, (void *) AT91_EMAC_BASE, 0x00);
+       rc = macb_eth_initialize(0, (void *) ATMEL_BASE_EMAC, 0x00);
 #endif
        return rc;
 }
diff --git a/board/atmel/at91sam9263ek/config.mk b/board/atmel/at91sam9263ek/config.mk
deleted file mode 100644 (file)
index e554a45..0000000
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_SYS_TEXT_BASE = 0x23f00000
index fa1f05b0de14379643d8580cc5300dedcad1f274..c44455e66413a83d1e15225de64ca2bd01a4f036 100644 (file)
  */
 
 #include <common.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/at91_pmc.h>
-#include <asm/arch/at91_pio.h>
+#include <asm/io.h>
 #include <asm/arch/gpio.h>
-#include <asm/arch/io.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91sam9263.h>
 
 void coloured_LED_init(void)
 {
        /* Enable clock */
-       at91_pmc_t      *pmc    = (at91_pmc_t *) AT91_PMC_BASE;
+       at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
 
-       writel(1 << AT91SAM9263_ID_PIOB | 1 << AT91SAM9263_ID_PIOCDE,
+       writel(1 << ATMEL_ID_PIOB | 1 << ATMEL_ID_PIOCDE,
                &pmc->pcer);
 
-       at91_set_pio_output(CONFIG_RED_LED, 1);
-       at91_set_pio_output(CONFIG_GREEN_LED, 1);
-       at91_set_pio_output(CONFIG_YELLOW_LED, 1);
+       at91_set_gpio_output(CONFIG_RED_LED, 1);
+       at91_set_gpio_output(CONFIG_GREEN_LED, 1);
+       at91_set_gpio_output(CONFIG_YELLOW_LED, 1);
 
-       at91_set_pio_value(CONFIG_RED_LED, 0);
-       at91_set_pio_value(CONFIG_GREEN_LED, 1);
-       at91_set_pio_value(CONFIG_YELLOW_LED, 1);
+       at91_set_gpio_value(CONFIG_RED_LED, 0);
+       at91_set_gpio_value(CONFIG_GREEN_LED, 1);
+       at91_set_gpio_value(CONFIG_YELLOW_LED, 1);
 }
index f77ecfcd304c2d465030357f514f869674a7c7fc..e5018908d5dbcac780ee3a5c326591154075a5f0 100644 (file)
@@ -80,6 +80,11 @@ at91sam9260ek_dataflash_cs1  arm         arm926ejs   at91sam9260ek       atmel
 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
+at91sam9263ek_nandflash      arm         arm926ejs   at91sam9263ek       atmel          at91        at91sam9263ek:AT91SAM9263,SYS_USE_NANDFLASH
+at91sam9263ek_dataflash_cs0  arm         arm926ejs   at91sam9263ek       atmel          at91        at91sam9263ek:AT91SAM9263,SYS_USE_DATAFLASH
+at91sam9263ek_dataflash      arm         arm926ejs   at91sam9263ek       atmel          at91        at91sam9263ek:AT91SAM9263,SYS_USE_DATAFLASH
+at91sam9263ek_norflash       arm         arm926ejs   at91sam9263ek       atmel          at91        at91sam9263ek:AT91SAM9263,SYS_USE_NORFLASH
+at91sam9263ek_norflash_boot  arm         arm926ejs   at91sam9263ek       atmel          at91        at91sam9263ek:AT91SAM9263,SYS_USE_BOOT_NORFLASH
 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
index f6cb40684fdbea5f4d10d19ffef119c793a12cd0..d817423a7ed3ee8ce98a3b8c3bb729dbf44dd7a9 100644 (file)
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+/*
+ * SoC must be defined first, before hardware.h is included.
+ * In this case SoC is defined in boards.cfg.
+ */
+#include <asm/hardware.h>
+
+#define CONFIG_SYS_TEXT_BASE           0x21F00000
+
 /* ARM asynchronous clock */
-#define CONFIG_SYS_AT91_MAIN_CLOCK     16367660        /* 16.367 MHz crystal */
-#define CONFIG_SYS_HZ          1000
+#define CONFIG_SYS_AT91_MAIN_CLOCK     16367660 /* 16.367 MHz crystal */
+#define CONFIG_SYS_AT91_SLOW_CLOCK     32768
+#define CONFIG_SYS_HZ                  1000
+
+#define CONFIG_AT91SAM9263EK   1       /* It's an AT91SAM9263EK Board */
 
-#define CONFIG_ARM926EJS       1       /* This is an ARM926EJS Core    */
-#define CONFIG_AT91SAM9263     1       /* It's an Atmel AT91SAM9263 SoC*/
-#define CONFIG_AT91SAM9263EK   1       /* on an AT91SAM9263EK Board    */
 #define CONFIG_ARCH_CPU_INIT
 #undef CONFIG_USE_IRQ                  /* we don't need IRQ/FIQ stuff  */
 
 
 #ifndef CONFIG_SYS_USE_BOOT_NORFLASH
 #define CONFIG_SKIP_LOWLEVEL_INIT
+#else
+#define CONFIG_SYS_USE_NORFLASH
 #endif
 
+#define CONFIG_BOARD_EARLY_INIT_F
+
+#define CONFIG_DISPLAY_CPUINFO
+
 /*
  * Hardware drivers
  */
-#define CONFIG_AT91_GPIO       1
-#define CONFIG_ATMEL_USART     1
-#undef CONFIG_USART0
-#undef CONFIG_USART1
-#undef CONFIG_USART2
-#define CONFIG_USART3          1       /* USART 3 is DBGU */
+#define CONFIG_ATMEL_LEGACY
+#define CONFIG_AT91_GPIO               1
+#define CONFIG_AT91_GPIO_PULLUP                1
+
+/* serial console */
+#define CONFIG_ATMEL_USART
+#define CONFIG_USART_BASE              ATMEL_BASE_DBGU
+#define CONFIG_USART_ID                        ATMEL_ID_SYS
+#define CONFIG_BAUDRATE                        115200
+#define CONFIG_SYS_BAUDRATE_TABLE      {115200, 19200, 38400, 57600, 9600}
 
 /* LCD */
 #define CONFIG_LCD                     1
 #undef LCD_TEST_PATTERN
 #define CONFIG_LCD_INFO                        1
 #define CONFIG_LCD_INFO_BELOW_LOGO     1
-#define CONFIG_SYS_WHITE_ON_BLACK              1
+#define CONFIG_SYS_WHITE_ON_BLACK      1
 #define CONFIG_ATMEL_LCD               1
 #define CONFIG_ATMEL_LCD_BGR555                1
-#define CONFIG_SYS_CONSOLE_IS_IN_ENV           1
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV   1
 
 /* LED */
 #define CONFIG_AT91_LED
-#define        CONFIG_RED_LED          AT91_PIO_PORTB, 7       /* the power led */
-#define        CONFIG_GREEN_LED        AT91_PIO_PORTB, 8       /* the user1 led */
-#define        CONFIG_YELLOW_LED       AT91_PIO_PORTC, 29      /* the user2 led */
+#define        CONFIG_RED_LED          AT91_PIN_PB7    /* the power led */
+#define        CONFIG_GREEN_LED        AT91_PIN_PB8    /* the user1 led */
+#define        CONFIG_YELLOW_LED       AT91_PIN_PC29   /* the user2 led */
 
 #define CONFIG_BOOTDELAY       3
 
 
 /* SDRAM */
 #define CONFIG_NR_DRAM_BANKS           1
-#define PHYS_SDRAM                     0x20000000
-#define PHYS_SDRAM_SIZE                        0x04000000      /* 64 megs */
+#define CONFIG_SYS_SDRAM_BASE          ATMEL_BASE_CS1
+#define CONFIG_SYS_SDRAM_SIZE          0x04000000
+
+#define CONFIG_SYS_INIT_SP_ADDR \
+       (ATMEL_BASE_SRAM1 + 0x1000 - GENERATED_GBL_DATA_SIZE)
 
 /* DataFlash */
 #define CONFIG_ATMEL_DATAFLASH_SPI
 #ifdef CONFIG_CMD_NAND
 #define CONFIG_NAND_ATMEL
 #define CONFIG_SYS_MAX_NAND_DEVICE             1
-#define CONFIG_SYS_NAND_BASE                   0x40000000
+#define CONFIG_SYS_NAND_BASE                   ATMEL_BASE_CS3
 #define CONFIG_SYS_NAND_DBW_8                  1
 /* our ALE is AD21 */
 #define CONFIG_SYS_NAND_MASK_ALE               (1 << 21)
 /* our CLE is AD22 */
 #define CONFIG_SYS_NAND_MASK_CLE               (1 << 22)
-#define CONFIG_SYS_NAND_ENABLE_PIN     AT91_PIO_PORTD, 15
-#define CONFIG_SYS_NAND_READY_PIN      AT91_PIO_PORTA, 22
-/*
-#define CONFIG_SYS_NAND_ENABLE_PIN  AT91_PIN_PD15
-#define CONFIG_SYS_NAND_READY_PIN  AT91_PIN_PA22
-*/
-
+#define CONFIG_SYS_NAND_ENABLE_PIN             AT91_PIN_PD15
+#define CONFIG_SYS_NAND_READY_PIN              AT91_PIN_PA22
 
 #define CONFIG_SYS_64BIT_VSPRINTF              /* needed for nand_util.c */
 #endif
 
 #define CONFIG_SYS_LOAD_ADDR                   0x22000000      /* load address */
 
-#define CONFIG_SYS_MEMTEST_START               PHYS_SDRAM
+#define CONFIG_SYS_MEMTEST_START               CONFIG_SYS_SDRAM_BASE
 #define CONFIG_SYS_MEMTEST_END                 0x23e00000
 
 #ifdef CONFIG_SYS_USE_DATAFLASH
 #elif CONFIG_SYS_USE_NANDFLASH
 
 /* bootstrap + u-boot + env + linux in nandflash */
-#define CONFIG_ENV_IS_IN_NAND  1
+#define CONFIG_ENV_IS_IN_NAND          1
 #define CONFIG_ENV_OFFSET              0x60000
 #define CONFIG_ENV_OFFSET_REDUND       0x80000
 #define CONFIG_ENV_SIZE                0x20000         /* 1 sector = 128 kB */
 
 #endif
 
-#define CONFIG_BAUDRATE                115200
-#define CONFIG_SYS_BAUDRATE_TABLE      {115200 , 19200, 38400, 57600, 9600 }
-
 #define CONFIG_SYS_PROMPT              "U-Boot> "
 #define CONFIG_SYS_CBSIZE              256
 #define CONFIG_SYS_MAXARGS             16
 #define CONFIG_SYS_PBSIZE              (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
 #define CONFIG_SYS_LONGHELP            1
-#define CONFIG_CMDLINE_EDITING 1
+#define CONFIG_CMDLINE_EDITING         1
 #define CONFIG_AUTO_COMPLETE
 #define CONFIG_SYS_HUSH_PARSER
 #define CONFIG_SYS_PROMPT_HUSH_PS2     "> "
 /*
  * Size of malloc() pool
  */
-#define CONFIG_SYS_MALLOC_LEN          ROUND(3 * CONFIG_ENV_SIZE + 128*1024, 0x1000)
+#define CONFIG_SYS_MALLOC_LEN  ROUND(3 * CONFIG_ENV_SIZE + 128*1024, 0x1000)
 
 #define CONFIG_STACKSIZE       (32*1024)       /* regular stack */
 
-#ifdef CONFIG_USE_IRQ
-#error CONFIG_USE_IRQ not supported
-#endif
+#undef CONFIG_USE_IRQ
 
 #endif