]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfo
authorOvidiu Panait <ovidiu.panait@windriver.com>
Fri, 24 Jul 2020 11:12:16 +0000 (14:12 +0300)
committerTom Rini <trini@konsulko.com>
Thu, 6 Aug 2020 18:26:35 +0000 (14:26 -0400)
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 <ovidiu.panait@windriver.com>
Acked-by: Alexey Brodkin <abrokdin@synopsys.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/Kconfig
arch/arc/lib/cpu.c
arch/xtensa/lib/Makefile
arch/xtensa/lib/bdinfo.c [new file with mode: 0644]
board/cadence/xtfpga/xtfpga.c
common/board_f.c

index 2174336fa00c6368b2d171f8803396e08beaffd8..e4a0a0230c1f932c6c1c7e7514383e241c00db95 100644 (file)
@@ -10,7 +10,6 @@ choice
 
 config ARC
        bool "ARC architecture"
-       select ARCH_EARLY_INIT_R
        select ARC_TIMER
        select CLK
        select HAVE_PRIVATE_LIBGCC
index 27b5832a0c9652adab69cabf97d57c034e9e5869..d66a8c867acdf722469077ad18983e76798da3e5 100644 (file)
@@ -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)
 {
index c59df7d37215c83cf81624396e6a5caf61ae930f..ceee59b9bd77fc3c6d3fe5eadfab0482e40eebb9 100644 (file)
@@ -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 (file)
index 0000000..4ec8529
--- /dev/null
@@ -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, wd@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;
+
+       return 0;
+}
index 2869e5cf68836f91e2d08959e9558462ee0496e5..4b49b6e5c863a0302b7181526f8d0e7ce61589a0 100644 (file)
@@ -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;
 }
 
index 43564314886b77f34e273ee02740609f9abc24c7..3b11f08725d9de6d6998a981b6e858b854b9401b 100644 (file)
@@ -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 */