[U-Boot] [PATCH 18/18] Make the at91sam9263ek compile again.

Remy Bohmer linux at bohmer.net
Mon Feb 21 12:00:15 CET 2011


Hi,

2011/2/21 Uli Raich <Uli.Raich at cern.ch>:
> This version has been tested on an
> armputer-vmax board, which is similar to the at91sam9263ek
> but not on the at91sam9263ek board itself.
> A new configuration "armputer-vmax_config" has been added. This configuration
> has been tested on the hardware and is known to work. Further hardware tests
> for individual options are needed. The LCD screen was not tested.
>
> ---
>  Makefile                                          |    1 -
>  arch/arm/cpu/arm926ejs/at91/at91sam9263_devices.c |    3 +-
>  arch/arm/cpu/arm926ejs/at91/clock.c               |    2 +-
>  arch/arm/cpu/arm926ejs/at91/cpu.c                 |    2 +-
>  arch/arm/cpu/arm926ejs/at91/reset.c               |    2 +-
>  arch/arm/cpu/arm926ejs/at91/timer.c               |   10 +-
>  arch/arm/include/asm/arch-at91/at91_pio.h         |    6 +-
>  arch/arm/include/asm/arch-at91/at91sam9263.h      |  170 +++++++++++----------
>  arch/arm/lib/board.c                              |    1 +
>  board/atmel/at91sam9263ek/at91sam9263ek.c         |   13 +-
>  board/atmel/at91sam9263ek/led.c                   |   19 +--
>  boards.cfg                                        |    2 +
>  drivers/gpio/at91_gpio.c                          |   44 +++---
>  drivers/serial/atmel_usart.c                      |   12 +-
>  drivers/spi/atmel_dataflash_spi.c                 |   78 ++++------
>  drivers/usb/host/ohci-at91.c                      |    6 +-
>  include/configs/at91sam9263ek.h                   |  122 ++++++++-------
>  17 files changed, 251 insertions(+), 242 deletions(-)

I already make some remarks that Reinhard is also likely going to make...

Patch 18/18? Where are the first 17 patches?

You should not revert changes that where made within the rework110218
branch of the atmel tree.
I noticed that you replaced some ATMEL_ defines by the older AT91_
style defines.

You should use the 9260ek board as example, which is in the
rework110202 branch of Reinhards tree.
This patch touches too many files and can be done which much less
changes on less files.

> diff --git a/Makefile b/Makefile
> index 6133160..0c653fa 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -827,7 +827,6 @@ at91sam9263ek_norflash_config \
>  at91sam9263ek_norflash_boot_config \
>  at91sam9263ek_nandflash_config \
>  at91sam9263ek_dataflash_config \
> -at91sam9263ek_dataflash_cs0_config \
>  at91sam9263ek_config   :       unconfig

I would expect you would remove all sam9263ek stuff from the Makefile.

> --- a/arch/arm/cpu/arm926ejs/at91/clock.c
> +++ b/arch/arm/cpu/arm926ejs/at91/clock.c
> @@ -145,7 +145,7 @@ static u32 at91_pll_rate(u32 freq, u32 reg)
>  int at91_clock_init(unsigned long main_clock)
>  {
>        unsigned freq, mckr;
> -       at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
> +       at91_pmc_t *pmc = (at91_pmc_t *) AT91_PMC_BASE;

ATMEL_BASE type defines are right, AT91_ type defines are wrong.
Please fix globally

> --- a/arch/arm/include/asm/arch-at91/at91sam9263.h
> +++ b/arch/arm/include/asm/arch-at91/at91sam9263.h
> @@ -20,118 +20,124 @@
>  /*
>  * defines to be used in other places
>  */
> -#define CONFIG_ARM926EJS       /* ARM926EJS Core */
> +//#define CONFIG_ARM926EJS     /* ARM926EJS Core */

No C++ style comments and no dead code please.

> diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
> index c620d2c..ea81378 100644
> --- a/arch/arm/lib/board.c
> +++ b/arch/arm/lib/board.c
> @@ -232,6 +232,7 @@ void __dram_init_banksize(void)
>  {
>        gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
>        gd->bd->bi_dram[0].size =  gd->ram_size;
> +

Why adding an empty line here?

>  }
>  void dram_init_banksize(void)
>        __attribute__((weak, alias("__dram_init_banksize")));
> diff --git a/board/atmel/at91sam9263ek/at91sam9263ek.c b/board/atmel/at91sam9263ek/at91sam9263ek.c
> index 91efc07..7216022 100644
> --- a/board/atmel/at91sam9263ek/at91sam9263ek.c
> +++ b/board/atmel/at91sam9263ek/at91sam9263ek.c
> @@ -276,8 +280,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->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
> +       gd->bd->bi_dram[0].size =  CONFIG_SYS_SDRAM_SIZE;
> +       gd->ram_size = CONFIG_SYS_SDRAM_SIZE;    // U.R is this the way to do it?

Filling gd->bd->bi_dram[0].start and size are not required here.
It is likely enough to make dram_init() like this (Including
auto-detection of available RAM size)

 int dram_init(void)
 {
	/* dram_init must store complete ramsize in gd->ram_size */
	gd->ram_size = get_ram_size((volatile long *)CONFIG_SYS_SDRAM_BASE,
			CONFIG_SYS_SDRAM_SIZE);
 	return 0;
}

> diff --git a/board/atmel/at91sam9263ek/led.c b/board/atmel/at91sam9263ek/led.c
> index fa1f05b..b3adc51 100644
> --- a/board/atmel/at91sam9263ek/led.c
> +++ b/board/atmel/at91sam9263ek/led.c
> @@ -23,25 +23,22 @@
>  */
>
>  #include <common.h>
> -#include <asm/arch/hardware.h>
> -#include <asm/arch/at91_pmc.h>
> -#include <asm/arch/at91_pio.h>
>  #include <asm/arch/gpio.h>
> -#include <asm/arch/io.h>
> +#include <asm/arch/at91_pmc.h>
>
>  void coloured_LED_init(void)
>  {
>        /* Enable clock */
>        at91_pmc_t      *pmc    = (at91_pmc_t *) AT91_PMC_BASE;
>
> -       writel(1 << AT91SAM9263_ID_PIOB | 1 << AT91SAM9263_ID_PIOCDE,
> +       writel(1 << AT91_ID_PIOB | 1 << AT91_ID_PIOCDE,
>                &pmc->pcer);

Enable all the GPIO peripheral clocks in a board_early_init_f() routine.
Not here.

> -       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_pio_output(CONFIG_RED_LED, 1);

No C++ style comments please and NO dead code. Fix globally

> diff --git a/boards.cfg b/boards.cfg
> index 45c3102..a9a8751 100644
> --- a/boards.cfg
> +++ b/boards.cfg
> @@ -106,6 +106,8 @@ magnesium                    arm         arm926ejs   imx27lite           logicpd
>  omap5912osk                  arm         arm926ejs   -                   ti             omap
>  edminiv2                     arm         arm926ejs   -                   LaCie          orion5x
>  dkb                         arm         arm926ejs   -                   Marvell        pantheon
> +at91sam9263ek_dataflash_cs0  arm        arm926ejs   at91sam9263ek       atmel          at91         at91sam9263ek:AT91SAM9263,SYS_USE_DATAFLASH_CS0
> +armputer-vmax               arm         arm926ejs   armputer-vmax       atmel          at91         armputer-vmax:AT91SAM9263,SYS_USE_DATAFLASH_CS0

I would expect more entries here.

> diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
> index 9532dd9..e1a3394 100644
> --- a/drivers/usb/host/ohci-at91.c
> +++ b/drivers/usb/host/ohci-at91.c

Please, provide a separate patch for changes in the OHCI drivers.
They need to go to the u-boot-usb tree.

> @@ -32,7 +32,7 @@
>
>  int usb_cpu_init(void)
>  {
> -       at91_pmc_t *pmc = (at91_pmc_t *)ATMEL_BASE_PMC;
> +       at91_pmc_t *pmc = (at91_pmc_t *)AT91_PMC_BASE;

You revert a change from Reinhard here.

>  #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
>     defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20) || \
> @@ -55,7 +55,7 @@ int usb_cpu_init(void)
>        /* Enable USB host clock. */
>        writel(1 << ATMEL_ID_UHP, &pmc->pcer);
>  #ifdef CONFIG_AT91SAM9261
> -       writel(ATMEL_PMC_UHP | AT91_PMC_HCK0, &pmc->scer);
> +       writel(ATMEl_PMC_UHP | AT91_PMC_HCK0, &pmc->scer);

Why are you breaking the AT91SAM9261 SoC here? You should be touching
9263 stuff only.

>  #else
>        writel(ATMEL_PMC_UHP, &pmc->scer);
>  #endif
> @@ -65,7 +65,7 @@ int usb_cpu_init(void)
>
>  int usb_cpu_stop(void)
>  {
> -       at91_pmc_t *pmc = (at91_pmc_t *)ATMEL_BASE_PMC;
> +       at91_pmc_t *pmc = (at91_pmc_t *)AT91_PMC_BASE;

Another change that is not needed. Please drop all changes to the
ohci-at91.c files.
They do not need to be changed to fix your board.

Kind regards,

Remy


More information about the U-Boot mailing list