[PATCH 07/15] board: ti: j721e: evm: Use IS_ENABLED with CONFIG_PHYS_64BIT

Nishanth Menon nm at ti.com
Fri Nov 3 01:37:57 CET 2023


Use IS_ENABLED to replace the #ifdeffery.

Signed-off-by: Nishanth Menon <nm at ti.com>
---
 board/ti/j721e/evm.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index d49993fffe39..0fc141776818 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -39,22 +39,19 @@ int board_init(void)
 
 int dram_init(void)
 {
-#ifdef CONFIG_PHYS_64BIT
-	gd->ram_size = 0x100000000;
-#else
-	gd->ram_size = 0x80000000;
-#endif
+	if (IS_ENABLED(CONFIG_PHYS_64BIT))
+		gd->ram_size = 0x100000000;
+	else
+		gd->ram_size = 0x80000000;
 
 	return 0;
 }
 
 phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
 {
-#ifdef CONFIG_PHYS_64BIT
 	/* Limit RAM used by U-Boot to the DDR low region */
-	if (gd->ram_top > 0x100000000)
+	if (IS_ENABLED(CONFIG_PHYS_64BIT) && gd->ram_top > 0x100000000)
 		return 0x100000000;
-#endif
 
 	return gd->ram_top;
 }
@@ -66,12 +63,12 @@ int dram_init_banksize(void)
 	gd->bd->bi_dram[0].size = 0x80000000;
 	gd->ram_size = 0x80000000;
 
-#ifdef CONFIG_PHYS_64BIT
-	/* Bank 1 declares the memory available in the DDR high region */
-	gd->bd->bi_dram[1].start = CFG_SYS_SDRAM_BASE1;
-	gd->bd->bi_dram[1].size = 0x80000000;
-	gd->ram_size = 0x100000000;
-#endif
+	if (IS_ENABLED(CONFIG_PHYS_64BIT)) {
+		/* Bank 1 declares the memory available in the DDR high region */
+		gd->bd->bi_dram[1].start = CFG_SYS_SDRAM_BASE1;
+		gd->bd->bi_dram[1].size = 0x80000000;
+		gd->ram_size = 0x100000000;
+	}
 
 	return 0;
 }
-- 
2.40.0



More information about the U-Boot mailing list