From dfaf6a57974f5b4bcdc2a2a347b192573ffb5135 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Wed, 12 Aug 2020 11:55:46 +0200 Subject: CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since commit 86cf1c82850f ("configs: Migrate CONFIG_NR_DRAM_BANKS") & commit 999a772d9f24 ("Kconfig: Migrate CONFIG_NR_DRAM_BANKS"), CONFIG_NR_DRAM_BANKS is always defined with a value (4 is default). It makes no sense to still carry code that is guarded with "#ifndef CONFIG_NR_DRAM_BANKS" (and similar). This patch removes all these unreferenced code paths. Signed-off-by: Stefan Roese Reviewed-by: Pali Rohár Reviewed-by: Andy Shevchenko Reviewed-by: Bin Meng --- common/board_f.c | 7 +------ common/image.c | 3 +-- common/init/handoff.c | 33 +++++++++++++-------------------- 3 files changed, 15 insertions(+), 28 deletions(-) (limited to 'common') diff --git a/common/board_f.c b/common/board_f.c index d3444c7..ed37e3a 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -215,8 +215,6 @@ static int announce_dram_init(void) static int show_dram_config(void) { unsigned long long size; - -#ifdef CONFIG_NR_DRAM_BANKS int i; debug("\nRAM Configuration:\n"); @@ -229,9 +227,6 @@ static int show_dram_config(void) #endif } debug("\nDRAM: "); -#else - size = gd->ram_size; -#endif print_size(size, ""); board_add_ram_info(0); @@ -242,7 +237,7 @@ static int show_dram_config(void) __weak int dram_init_banksize(void) { -#if defined(CONFIG_NR_DRAM_BANKS) && defined(CONFIG_SYS_SDRAM_BASE) +#if defined(CONFIG_SYS_SDRAM_BASE) gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; gd->bd->bi_dram[0].size = get_effective_memsize(); #endif diff --git a/common/image.c b/common/image.c index 9d7d5c1..2ed46f7 100644 --- a/common/image.c +++ b/common/image.c @@ -685,8 +685,7 @@ phys_size_t env_get_bootm_size(void) return tmp; } -#if (defined(CONFIG_ARM) || defined(CONFIG_MICROBLAZE)) && \ - defined(CONFIG_NR_DRAM_BANKS) +#if defined(CONFIG_ARM) || defined(CONFIG_MICROBLAZE) start = gd->bd->bi_dram[0].start; size = gd->bd->bi_dram[0].size; #else diff --git a/common/init/handoff.c b/common/init/handoff.c index e00b43e..62071bd 100644 --- a/common/init/handoff.c +++ b/common/init/handoff.c @@ -12,18 +12,15 @@ DECLARE_GLOBAL_DATA_PTR; void handoff_save_dram(struct spl_handoff *ho) { + struct bd_info *bd = gd->bd; + int i; + ho->ram_size = gd->ram_size; -#ifdef CONFIG_NR_DRAM_BANKS - { - struct bd_info *bd = gd->bd; - int i; - - for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { - ho->ram_bank[i].start = bd->bi_dram[i].start; - ho->ram_bank[i].size = bd->bi_dram[i].size; - } + + for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { + ho->ram_bank[i].start = bd->bi_dram[i].start; + ho->ram_bank[i].size = bd->bi_dram[i].size; } -#endif } void handoff_load_dram_size(struct spl_handoff *ho) @@ -33,15 +30,11 @@ void handoff_load_dram_size(struct spl_handoff *ho) void handoff_load_dram_banks(struct spl_handoff *ho) { -#ifdef CONFIG_NR_DRAM_BANKS - { - struct bd_info *bd = gd->bd; - int i; - - for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { - bd->bi_dram[i].start = ho->ram_bank[i].start; - bd->bi_dram[i].size = ho->ram_bank[i].size; - } + struct bd_info *bd = gd->bd; + int i; + + for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { + bd->bi_dram[i].start = ho->ram_bank[i].start; + bd->bi_dram[i].size = ho->ram_bank[i].size; } -#endif } -- cgit v1.1 From 4963f63fe61f15329d77472a762b1d8bf754d24b Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Wed, 12 Aug 2020 12:57:18 +0200 Subject: image: Use gd->ram_base/_size in env_get_bootm_size() Use only gd->ram_base/_size in env_get_bootm_size() instead of bi_dram[] in some cases and bi_memstart in others. Signed-off-by: Stefan Roese Reviewed-by: Simon Glass --- common/image.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'common') diff --git a/common/image.c b/common/image.c index 2ed46f7..6f68b13 100644 --- a/common/image.c +++ b/common/image.c @@ -685,13 +685,8 @@ phys_size_t env_get_bootm_size(void) return tmp; } -#if defined(CONFIG_ARM) || defined(CONFIG_MICROBLAZE) - start = gd->bd->bi_dram[0].start; - size = gd->bd->bi_dram[0].size; -#else - start = gd->bd->bi_memstart; - size = gd->bd->bi_memsize; -#endif + start = gd->ram_base; + size = gd->ram_size; s = env_get("bootm_low"); if (s) -- cgit v1.1 From f120aa7522fafa7606ae28693cc6f29be12e4887 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Wed, 12 Aug 2020 13:02:39 +0200 Subject: board_f: Add default values for bi_dram[] in dram_init_banksize() Remove the bi_memstart / bi_memsize assignment in setup_bdinfo() and make sure, that bd_dram[] is always configured in the weak default implementation of dram_init_banksize(), when CONFIG_SYS_SDRAM_BASE is not set. Signed-off-by: Stefan Roese Reviewed-by: Ovidiu Panait --- common/board_f.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'common') diff --git a/common/board_f.c b/common/board_f.c index ed37e3a..62473ab 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -237,10 +237,8 @@ static int show_dram_config(void) __weak int dram_init_banksize(void) { -#if defined(CONFIG_SYS_SDRAM_BASE) - gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; + gd->bd->bi_dram[0].start = gd->ram_base; gd->bd->bi_dram[0].size = get_effective_memsize(); -#endif return 0; } @@ -598,9 +596,6 @@ 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 */ - if (IS_ENABLED(CONFIG_SYS_HAS_SRAM)) { bd->bi_sramstart = CONFIG_SYS_SRAM_BASE; /* start of SRAM */ bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE; /* size of SRAM */ -- cgit v1.1