[U-Boot] [PATCH 13/39] x86: Use the standard dram_init() function

Bin Meng bmeng.cn at gmail.com
Fri Nov 7 10:42:07 CET 2014


On Fri, Nov 7, 2014 at 4:20 AM, Simon Glass <sjg at chromium.org> wrote:
> Instead of having an x86-specific DRAM init function, adjust things so we
> can use the normal one.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
>  arch/x86/cpu/coreboot/sdram.c     | 11 ++++-------
>  arch/x86/include/asm/u-boot-x86.h |  4 ++--
>  common/board_f.c                  |  6 +-----
>  3 files changed, 7 insertions(+), 14 deletions(-)
>
> diff --git a/arch/x86/cpu/coreboot/sdram.c b/arch/x86/cpu/coreboot/sdram.c
> index 959feaa..ca651c7 100644
> --- a/arch/x86/cpu/coreboot/sdram.c
> +++ b/arch/x86/cpu/coreboot/sdram.c
> @@ -11,6 +11,7 @@
>  #include <asm/e820.h>
>  #include <asm/u-boot-x86.h>
>  #include <asm/global_data.h>
> +#include <asm/init_helpers.h>
>  #include <asm/processor.h>
>  #include <asm/sections.h>
>  #include <asm/arch/sysinfo.h>
> @@ -79,7 +80,7 @@ ulong board_get_usable_ram_top(ulong total_size)
>         return (ulong)dest_addr;
>  }
>
> -int dram_init_f(void)
> +int dram_init(void)
>  {
>         int i;
>         phys_size_t ram_size = 0;
> @@ -94,7 +95,8 @@ int dram_init_f(void)
>         gd->ram_size = ram_size;
>         if (ram_size == 0)
>                 return -1;
> -       return 0;
> +
> +       return calculate_relocation_address();
>  }
>
>  int dram_init_banksize(void)
> @@ -116,8 +118,3 @@ int dram_init_banksize(void)
>         }
>         return 0;
>  }
> -
> -int dram_init(void)
> -{
> -       return dram_init_banksize();
> -}
> diff --git a/arch/x86/include/asm/u-boot-x86.h b/arch/x86/include/asm/u-boot-x86.h
> index 9e525dd..89618c7 100644
> --- a/arch/x86/include/asm/u-boot-x86.h
> +++ b/arch/x86/include/asm/u-boot-x86.h
> @@ -27,8 +27,8 @@ unsigned long get_tbclk_mhz(void);
>  void timer_set_base(uint64_t base);
>  int pcat_timer_init(void);
>
> -/* Architecture specific - can be in arch/x86/cpu/, arch/x86/lib/, or $(BOARD)/ */
> -int dram_init_f(void);
> +/* Architecture specific DRAM init */
> +int dram_init(void);
>
>  /* cpu/.../interrupts.c */
>  int cpu_init_interrupts(void);
> diff --git a/common/board_f.c b/common/board_f.c
> index 31f1d5c..df02ca5 100644
> --- a/common/board_f.c
> +++ b/common/board_f.c
> @@ -903,13 +903,9 @@ static init_fnc_t init_sequence_f[] = {
>  #if defined(CONFIG_HARD_SPI)
>         init_func_spi,
>  #endif
> -#ifdef CONFIG_X86
> -       dram_init_f,            /* configure available RAM banks */
> -       calculate_relocation_address,
> -#endif
>         announce_dram_init,
>         /* TODO: unify all these dram functions? */
> -#ifdef CONFIG_ARM
> +#if defined(CONFIG_ARM) || defined(CONFIG_X86)
>         dram_init,              /* configure available RAM banks */
>  #endif
>  #if defined(CONFIG_MIPS) || defined(CONFIG_PPC)
> --

Reviewed-by: Bin Meng <bmeng.cn at gmail.com>


More information about the U-Boot mailing list