[PATCH v4 5/9] xtensa: Remove arch_setup_bdinfo()
Ovidiu Panait
ovidiu.panait at windriver.com
Thu Aug 13 09:57:09 CEST 2020
Hi Stefan,
On 13.08.2020 08:47, Stefan Roese wrote:
> arch_setup_bdinfo() only configures the deprecated bi_memstart &
> bi_memsize values, which should not be needed any more. Lets remove
> this file completely.
>
> Signed-off-by: Stefan Roese <sr at denx.de>
>
> ---
>
> Changes in v4:
> - New patch
>
> arch/xtensa/lib/Makefile | 2 +-
> arch/xtensa/lib/bdinfo.c | 22 ----------------------
> 2 files changed, 1 insertion(+), 23 deletions(-)
> delete mode 100644 arch/xtensa/lib/bdinfo.c
>
> diff --git a/arch/xtensa/lib/Makefile b/arch/xtensa/lib/Makefile
> index ceee59b9bd..c59df7d372 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 bdinfo.o
> +obj-y += cache.o misc.o relocate.o time.o
> diff --git a/arch/xtensa/lib/bdinfo.c b/arch/xtensa/lib/bdinfo.c
> deleted file mode 100644
> index 4ec8529521..0000000000
> --- a/arch/xtensa/lib/bdinfo.c
> +++ /dev/null
> @@ -1,22 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0+
> -/*
> - * XTENSA-specific information for the 'bd' command
> - *
> - * (C) Copyright 2003
> - * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
> - */
> -
> -#include <common.h>
> -#include <init.h>
> -
> -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;
> -
When I did the setup_bdinfo refactoring, I realized that xtensa was the
only arch handling bi_{memstart,memsize} in a special way:
bd->bi_memstart = PHYSADDR(CONFIG_SYS_SDRAM_BASE);
bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
Because xtensa uses PHYSADDR(CONFIG_SYS_SDRAM_BASE) for bi_memstart, I was not able to replace it with gd->ram_base, as for all the other arches.
Currently, gd->ram_base is defined in common/board_f.c, function setup_dest_addr as:
#ifdef CONFIG_SYS_SDRAM_BASE
>-------gd->ram_base = CONFIG_SYS_SDRAM_BASE;
#endif
So I think the PHYSADDR() logic needs to be preserved so that the
patchset would not change the memory start/end logic in
arch/xtensa/lib/bootm.c:
diff --git a/arch/xtensa/lib/bootm.c b/arch/xtensa/lib/bootm.c
index 458eaf95c0..6fcbfc4292 100644
--- a/arch/xtensa/lib/bootm.c
+++ b/arch/xtensa/lib/bootm.c
@@ -41,15 +41,14 @@ static struct bp_tag *setup_last_tag(struct bp_tag *params)
static struct bp_tag *setup_memory_tag(struct bp_tag *params)
{
- struct bd_info *bd = gd->bd;
struct meminfo *mem;
params->id = BP_TAG_MEMORY;
params->size = sizeof(struct meminfo);
mem = (struct meminfo *)params->data;
mem->type = MEMORY_TYPE_CONVENTIONAL;
- mem->start = bd->bi_memstart;
- mem->end = bd->bi_memstart + bd->bi_memsize;
+ mem->start = gd->ram_base;
+ mem->end = gd->ram_base + gd->ram_size;
printf(" MEMORY: tag:0x%04x, type:0X%lx, start:0X%lx, end:0X%lx\n",
BP_TAG_MEMORY, mem->type, mem->start, mem->end);
Also, the only xtensa board (board/cadence/xtfpga/xtfpga.c) has an empty
stub for dram_init_banksize, overwriting the weak definition in
common/board_f.c that should populate gd->bd->bi_dram[0].start/size. But
maybe keeping gd->bd->bi_dram[0].start/size undefined does not have
other implications.
Ovidiu
> - return 0;
> -}
More information about the U-Boot
mailing list