diff mbox series

[4/5,v2] mips: octeon: bootoctlinux: Use gd->ram_size instead of ram_get_info()

Message ID 20201028141003.3062021-4-sr@denx.de
State Under Review
Delegated to: Daniel Schwierzeck
Headers show
Series [1/5,v2] mips: start.S: Add Octeon boot header compatibility | expand

Commit Message

Stefan Roese Oct. 28, 2020, 2:10 p.m. UTC
Using ram_get_info() is complicated and does not work after relocation.
Now that gd->ram_size holds the full RAM size, let's use it instead and
remove the ram_get_size logic completely.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Aaron Williams <awilliams@marvell.com>
Cc: Chandrakala Chavva <cchavva@marvell.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
---
v2:
- No change

 arch/mips/mach-octeon/bootoctlinux.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

Comments

Daniel Schwierzeck Nov. 27, 2020, 2:55 p.m. UTC | #1
Am Mittwoch, den 28.10.2020, 15:10 +0100 schrieb Stefan Roese:
> Using ram_get_info() is complicated and does not work after relocation.
> Now that gd->ram_size holds the full RAM size, let's use it instead and
> remove the ram_get_size logic completely.
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Aaron Williams <awilliams@marvell.com>
> Cc: Chandrakala Chavva <cchavva@marvell.com>
> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> ---
> v2:
> - No change
> 
>  arch/mips/mach-octeon/bootoctlinux.c | 21 +++------------------
>  1 file changed, 3 insertions(+), 18 deletions(-)
> 
> 

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
diff mbox series

Patch

diff --git a/arch/mips/mach-octeon/bootoctlinux.c b/arch/mips/mach-octeon/bootoctlinux.c
index 75d7e83bd7..26136902f3 100644
--- a/arch/mips/mach-octeon/bootoctlinux.c
+++ b/arch/mips/mach-octeon/bootoctlinux.c
@@ -9,7 +9,6 @@ 
 #include <dm.h>
 #include <elf.h>
 #include <env.h>
-#include <ram.h>
 
 #include <asm/io.h>
 #include <linux/compat.h>
@@ -370,8 +369,6 @@  int do_bootoctlinux(struct cmd_tbl *cmdtp, int flag, int argc,
 	struct cvmx_coremask avail_coremask;
 	int first_core;
 	int core;
-	struct ram_info ram;
-	struct udevice *dev;
 	const u64 *nmi_code;
 	int num_dwords;
 	u8 node_mask = 0x01;
@@ -470,19 +467,6 @@  int do_bootoctlinux(struct cmd_tbl *cmdtp, int flag, int argc,
 	 */
 	cvmx_coremask_or(&coremask_to_run, &coremask_to_run, &core_mask);
 
-	/* Get RAM size */
-	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
-	if (ret) {
-		debug("DRAM init failed: %d\n", ret);
-		return ret;
-	}
-
-	ret = ram_get_info(dev, &ram);
-	if (ret) {
-		debug("Cannot get DRAM size: %d\n", ret);
-		return ret;
-	}
-
 	/*
 	 * Load kernel ELF image, or try binary if ELF is not detected.
 	 * This way the much smaller vmlinux.bin can also be started but
@@ -498,7 +482,7 @@  int do_bootoctlinux(struct cmd_tbl *cmdtp, int flag, int argc,
 
 	/* Init bootmem list for Linux kernel booting */
 	if (!cvmx_bootmem_phy_mem_list_init(
-		    ram.size, OCTEON_RESERVED_LOW_MEM_SIZE,
+		    gd->ram_size, OCTEON_RESERVED_LOW_MEM_SIZE,
 		    (void *)CKSEG0ADDR(BOOTLOADER_BOOTMEM_DESC_SPACE))) {
 		printf("FATAL: Error initializing free memory list\n");
 		return 0;
@@ -517,7 +501,8 @@  int do_bootoctlinux(struct cmd_tbl *cmdtp, int flag, int argc,
 		if (core == first_core)
 			cvmx_bootinfo_array[core].flags |= BOOT_FLAG_INIT_CORE;
 
-		cvmx_bootinfo_array[core].dram_size = ram.size / (1024 * 1024);
+		cvmx_bootinfo_array[core].dram_size = gd->ram_size /
+			(1024 * 1024);
 
 		cvmx_bootinfo_array[core].dclock_hz = gd->mem_clk * 1000000;
 		cvmx_bootinfo_array[core].eclock_hz = gd->cpu_clk;