Re: [PATCH v4 08/17] board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

2020-08-06 Thread Tom Rini
On Fri, Jul 24, 2020 at 02:12:16PM +0300, Ovidiu Panait wrote:

> Move all assignments to gd->bd->bi_mem{start,size} to generic code in
> setup_bdinfo.
> 
> Xtensa architecture is special in this regard as it defines its own
> handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
> a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.
> 
> For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
> not needed anymore.
> 
> Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.
> 
> Signed-off-by: Ovidiu Panait 
> Acked-by: Alexey Brodkin 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v4 08/17] board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

2020-08-03 Thread Simon Glass
On Fri, 24 Jul 2020 at 05:17, Ovidiu Panait  wrote:
>
> Move all assignments to gd->bd->bi_mem{start,size} to generic code in
> setup_bdinfo.
>
> Xtensa architecture is special in this regard as it defines its own
> handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
> a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.
>
> For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
> not needed anymore.
>
> Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.
>
> Signed-off-by: Ovidiu Panait 
> ---
>
>  arch/Kconfig  |  1 -
>  arch/arc/lib/cpu.c|  7 ---
>  arch/xtensa/lib/Makefile  |  2 +-
>  arch/xtensa/lib/bdinfo.c  | 22 ++
>  board/cadence/xtfpga/xtfpga.c |  3 ---
>  common/board_f.c  | 11 +--
>  6 files changed, 28 insertions(+), 18 deletions(-)
>  create mode 100644 arch/xtensa/lib/bdinfo.c

Reviewed-by: Simon Glass 




>
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 9be02d1319..4d9557959c 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -10,7 +10,6 @@ choice
>
>  config ARC
> bool "ARC architecture"
> -   select ARCH_EARLY_INIT_R
> select ARC_TIMER
> select CLK
> select HAVE_PRIVATE_LIBGCC
> diff --git a/arch/arc/lib/cpu.c b/arch/arc/lib/cpu.c
> index 27b5832a0c..d66a8c867a 100644
> --- a/arch/arc/lib/cpu.c
> +++ b/arch/arc/lib/cpu.c
> @@ -25,13 +25,6 @@ int arch_cpu_init(void)
> return 0;
>  }
>
> -int arch_early_init_r(void)
> -{
> -   gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
> -   gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
> -   return 0;
> -}
> -
>  /* This is a dummy function on arc */
>  int dram_init(void)
>  {
> diff --git a/arch/xtensa/lib/Makefile b/arch/xtensa/lib/Makefile
> index c59df7d372..ceee59b9bd 100644
> --- a/arch/xtensa/lib/Makefile
> +++ b/arch/xtensa/lib/Makefile
> @@ -5,4 +5,4 @@
>
>  obj-$(CONFIG_CMD_BOOTM) += bootm.o
>
> -obj-y  += cache.o misc.o relocate.o time.o
> +obj-y  += cache.o misc.o relocate.o time.o bdinfo.o
> diff --git a/arch/xtensa/lib/bdinfo.c b/arch/xtensa/lib/bdinfo.c
> new file mode 100644
> index 00..4ec8529521
> --- /dev/null
> +++ b/arch/xtensa/lib/bdinfo.c
> @@ -0,0 +1,22 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * XTENSA-specific information for the 'bd' command
> + *
> + * (C) Copyright 2003
> + * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
> + */
> +
> +#include 
> +#include 
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +int arch_setup_bdinfo(void)
> +{
> +   struct bd_info *bd = gd->bd;
> +
> +   bd->bi_memstart = PHYSADDR(CONFIG_SYS_SDRAM_BASE);
> +   bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
> +
> +   return 0;
> +}
> diff --git a/board/cadence/xtfpga/xtfpga.c b/board/cadence/xtfpga/xtfpga.c
> index 2869e5cf68..4b49b6e5c8 100644
> --- a/board/cadence/xtfpga/xtfpga.c
> +++ b/board/cadence/xtfpga/xtfpga.c
> @@ -51,9 +51,6 @@ int checkboard(void)
>
>  int dram_init_banksize(void)
>  {
> -   gd->bd->bi_memstart = PHYSADDR(CONFIG_SYS_SDRAM_BASE);
> -   gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
> -
> return 0;
>  }
>
> diff --git a/common/board_f.c b/common/board_f.c
> index 4356431488..3b11f08725 100644
> --- a/common/board_f.c
> +++ b/common/board_f.c
> @@ -605,6 +605,11 @@ __weak int arch_setup_bdinfo(void)
>
>  int setup_bdinfo(void)
>  {
> +   struct bd_info *bd = gd->bd;
> +
> +   bd->bi_memstart = gd->ram_base;  /* start of memory */
> +   bd->bi_memsize = gd->ram_size;   /* size in bytes */
> +
> return arch_setup_bdinfo();
>  }
>
> @@ -614,12 +619,6 @@ static int setup_board_part1(void)
>  {
> struct bd_info *bd = gd->bd;
>
> -   /*
> -* Save local variables to board info struct
> -*/
> -   bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;/* start of memory */
> -   bd->bi_memsize = gd->ram_size;  /* size in bytes */
> -
>  #ifdef CONFIG_SYS_SRAM_BASE
> bd->bi_sramstart = CONFIG_SYS_SRAM_BASE;/* start of SRAM */
> bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE; /* size  of SRAM */
> --
> 2.17.1
>


Re: [PATCH v4 08/17] board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo

2020-07-24 Thread Alexey Brodkin
Hi Ovidiu,

> Move all assignments to gd->bd->bi_mem{start,size} to generic code in
> setup_bdinfo.
> 
> Xtensa architecture is special in this regard as it defines its own
> handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining
> a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags.
> 
> For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is
> not needed anymore.
> 
> Also, use gd->ram_base to populate bi_memstart to avoid an ifdef.
> 
> Signed-off-by: Ovidiu Panait 
> ---
> 
>  arch/Kconfig  |  1 -
>  arch/arc/lib/cpu.c|  7 ---
>  arch/xtensa/lib/Makefile  |  2 +-
>  arch/xtensa/lib/bdinfo.c  | 22 ++
>  board/cadence/xtfpga/xtfpga.c |  3 ---
>  common/board_f.c  | 11 +--
>  6 files changed, 28 insertions(+), 18 deletions(-)
>  create mode 100644 arch/xtensa/lib/bdinfo.c
> 
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 9be02d1319..4d9557959c 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -10,7 +10,6 @@ choice
>  
>  config ARC
>  bool "ARC architecture"
> -   select ARCH_EARLY_INIT_R
>  select ARC_TIMER
>  select CLK
>  select HAVE_PRIVATE_LIBGCC
> diff --git a/arch/arc/lib/cpu.c b/arch/arc/lib/cpu.c
> index 27b5832a0c..d66a8c867a 100644
> --- a/arch/arc/lib/cpu.c
> +++ b/arch/arc/lib/cpu.c
> @@ -25,13 +25,6 @@ int arch_cpu_init(void)
>  return 0;
>  }
>  
> -int arch_early_init_r(void)
> -{
> -   gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
> -   gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
> -   return 0;
> -}
> -
>  /* This is a dummy function on arc */
>  int dram_init(void)
>  {

For ARC part...

Acked-by: Alexey Brodkin