diff mbox series

[2/8] board: ti: am64x: Use fdt functions for ram and bank init

Message ID 20220317170346.31162-3-d-gerlach@ti.com
State Accepted
Commit dffdb1f8eb2a88290896dd31f9e8d33789ba3757
Delegated to: Tom Rini
Headers show
Series ram: k3-ddrss: Enable DDRSS ECC for full DDR Space | expand

Commit Message

Dave Gerlach March 17, 2022, 5:03 p.m. UTC
Use the appropriate fdtdec_setup_mem_size_base and
fdtdec_setup_bank_size calls in dram_init and dram_bank_init to pull
these values from DT, where they are already available, instead of
hardcoding them.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
---
 board/ti/am64x/evm.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

Comments

Tom Rini April 5, 2022, 6:01 p.m. UTC | #1
On Thu, Mar 17, 2022 at 12:03:40PM -0500, Dave Gerlach wrote:

> Use the appropriate fdtdec_setup_mem_size_base and
> fdtdec_setup_bank_size calls in dram_init and dram_bank_init to pull
> these values from DT, where they are already available, instead of
> hardcoding them.
> 
> Signed-off-by: Dave Gerlach <d-gerlach@ti.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/board/ti/am64x/evm.c b/board/ti/am64x/evm.c
index 8373c768f189..7ea80b82bec5 100644
--- a/board/ti/am64x/evm.c
+++ b/board/ti/am64x/evm.c
@@ -29,19 +29,24 @@  int board_init(void)
 
 int dram_init(void)
 {
-	gd->ram_size = 0x80000000;
+	s32 ret;
 
-	return 0;
+	ret = fdtdec_setup_mem_size_base();
+	if (ret)
+		printf("Error setting up mem size and base. %d\n", ret);
+
+	return ret;
 }
 
 int dram_init_banksize(void)
 {
-	/* Bank 0 declares the memory available in the DDR low region */
-	gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
-	gd->bd->bi_dram[0].size = 0x80000000;
-	gd->ram_size = 0x80000000;
+	s32 ret;
 
-	return 0;
+	ret = fdtdec_setup_memory_banksize();
+	if (ret)
+		printf("Error setting up memory banksize. %d\n", ret);
+
+	return ret;
 }
 
 #if defined(CONFIG_SPL_LOAD_FIT)