CONFIG_NR_DRAM_BANKS: Remove unreferenced code as its always defined

Since commit 86cf1c8285 ("configs: Migrate CONFIG_NR_DRAM_BANKS") &
commit 999a772d9f ("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 <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Stefan Roese 2020-08-12 11:55:46 +02:00
parent 9f9ecd3e4d
commit dfaf6a5797
11 changed files with 18 additions and 50 deletions

View File

@ -53,14 +53,12 @@ void board_debug_uart_init(void)
int dram_init_banksize(void) int dram_init_banksize(void)
{ {
#ifdef CONFIG_NR_DRAM_BANKS
struct spl_handoff *ho; struct spl_handoff *ho;
ho = bloblist_find(BLOBLISTT_SPL_HANDOFF, sizeof(*ho)); ho = bloblist_find(BLOBLISTT_SPL_HANDOFF, sizeof(*ho));
if (!ho) if (!ho)
return log_msg_ret("Missing SPL hand-off info", -ENOENT); return log_msg_ret("Missing SPL hand-off info", -ENOENT);
handoff_load_dram_banks(ho); handoff_load_dram_banks(ho);
#endif
return 0; return 0;
} }

View File

@ -423,10 +423,8 @@ int dram_init(void)
#else #else
int dram_init_banksize(void) int dram_init_banksize(void)
{ {
#if defined(CONFIG_NR_DRAM_BANKS)
gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
gd->bd->bi_dram[0].size = get_effective_memsize(); gd->bd->bi_dram[0].size = get_effective_memsize();
#endif
mem_map_fill(); mem_map_fill();

View File

@ -49,7 +49,6 @@ void bdinfo_print_mhz(const char *name, unsigned long hz)
static void print_bi_dram(const struct bd_info *bd) static void print_bi_dram(const struct bd_info *bd)
{ {
#ifdef CONFIG_NR_DRAM_BANKS
int i; int i;
for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) { for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
@ -59,7 +58,6 @@ static void print_bi_dram(const struct bd_info *bd)
bdinfo_print_num("-> size", bd->bi_dram[i].size); bdinfo_print_num("-> size", bd->bi_dram[i].size);
} }
} }
#endif
} }
__weak void arch_print_bdinfo(void) __weak void arch_print_bdinfo(void)

View File

@ -215,8 +215,6 @@ static int announce_dram_init(void)
static int show_dram_config(void) static int show_dram_config(void)
{ {
unsigned long long size; unsigned long long size;
#ifdef CONFIG_NR_DRAM_BANKS
int i; int i;
debug("\nRAM Configuration:\n"); debug("\nRAM Configuration:\n");
@ -229,9 +227,6 @@ static int show_dram_config(void)
#endif #endif
} }
debug("\nDRAM: "); debug("\nDRAM: ");
#else
size = gd->ram_size;
#endif
print_size(size, ""); print_size(size, "");
board_add_ram_info(0); board_add_ram_info(0);
@ -242,7 +237,7 @@ static int show_dram_config(void)
__weak int dram_init_banksize(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].start = CONFIG_SYS_SDRAM_BASE;
gd->bd->bi_dram[0].size = get_effective_memsize(); gd->bd->bi_dram[0].size = get_effective_memsize();
#endif #endif

View File

@ -685,8 +685,7 @@ phys_size_t env_get_bootm_size(void)
return tmp; return tmp;
} }
#if (defined(CONFIG_ARM) || defined(CONFIG_MICROBLAZE)) && \ #if defined(CONFIG_ARM) || defined(CONFIG_MICROBLAZE)
defined(CONFIG_NR_DRAM_BANKS)
start = gd->bd->bi_dram[0].start; start = gd->bd->bi_dram[0].start;
size = gd->bd->bi_dram[0].size; size = gd->bd->bi_dram[0].size;
#else #else

View File

@ -12,18 +12,15 @@ DECLARE_GLOBAL_DATA_PTR;
void handoff_save_dram(struct spl_handoff *ho) void handoff_save_dram(struct spl_handoff *ho)
{ {
ho->ram_size = gd->ram_size; struct bd_info *bd = gd->bd;
#ifdef CONFIG_NR_DRAM_BANKS int i;
{
struct bd_info *bd = gd->bd;
int i;
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { ho->ram_size = gd->ram_size;
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) 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) void handoff_load_dram_banks(struct spl_handoff *ho)
{ {
#ifdef CONFIG_NR_DRAM_BANKS struct bd_info *bd = gd->bd;
{ int i;
struct bd_info *bd = gd->bd;
int i;
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
bd->bi_dram[i].start = ho->ram_bank[i].start; bd->bi_dram[i].start = ho->ram_bank[i].start;
bd->bi_dram[i].size = ho->ram_bank[i].size; bd->bi_dram[i].size = ho->ram_bank[i].size;
}
} }
#endif
} }

View File

@ -911,8 +911,8 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
ofnode node) ofnode node)
{ {
int pci_addr_cells, addr_cells, size_cells; int pci_addr_cells, addr_cells, size_cells;
struct bd_info *bd = gd->bd;
int cells_per_record; int cells_per_record;
struct bd_info *bd;
const u32 *prop; const u32 *prop;
int max_regions; int max_regions;
int len; int len;
@ -989,6 +989,7 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
} }
/* Add a region for our local memory */ /* Add a region for our local memory */
bd = gd->bd;
if (!bd) if (!bd)
return; return;

View File

@ -70,12 +70,10 @@ struct bd_info {
#endif #endif
ulong bi_arch_number; /* unique id for this board */ ulong bi_arch_number; /* unique id for this board */
ulong bi_boot_params; /* where this board expects params */ ulong bi_boot_params; /* where this board expects params */
#ifdef CONFIG_NR_DRAM_BANKS
struct { /* RAM configuration */ struct { /* RAM configuration */
phys_addr_t start; phys_addr_t start;
phys_size_t size; phys_size_t size;
} bi_dram[CONFIG_NR_DRAM_BANKS]; } bi_dram[CONFIG_NR_DRAM_BANKS];
#endif /* CONFIG_NR_DRAM_BANKS */
}; };
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */

View File

@ -20,12 +20,10 @@
struct spl_handoff { struct spl_handoff {
struct arch_spl_handoff arch; struct arch_spl_handoff arch;
u64 ram_size; u64 ram_size;
#ifdef CONFIG_NR_DRAM_BANKS
struct { struct {
u64 start; u64 start;
u64 size; u64 size;
} ram_bank[CONFIG_NR_DRAM_BANKS]; } ram_bank[CONFIG_NR_DRAM_BANKS];
#endif
}; };
void handoff_save_dram(struct spl_handoff *ho); void handoff_save_dram(struct spl_handoff *ho);

View File

@ -1073,8 +1073,6 @@ int fdtdec_setup_mem_size_base(void)
return 0; return 0;
} }
#if defined(CONFIG_NR_DRAM_BANKS)
ofnode get_next_memory_node(ofnode mem) ofnode get_next_memory_node(ofnode mem)
{ {
do { do {
@ -1170,7 +1168,6 @@ int fdtdec_setup_mem_size_base_lowest(void)
return 0; return 0;
} }
#endif
#if CONFIG_IS_ENABLED(MULTI_DTB_FIT) #if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
# if CONFIG_IS_ENABLED(MULTI_DTB_FIT_GZIP) ||\ # if CONFIG_IS_ENABLED(MULTI_DTB_FIT_GZIP) ||\
@ -1633,7 +1630,6 @@ int fdtdec_resetup(int *rescan)
} }
#endif #endif
#ifdef CONFIG_NR_DRAM_BANKS
int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id, int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id,
phys_addr_t *basep, phys_size_t *sizep, phys_addr_t *basep, phys_size_t *sizep,
struct bd_info *bd) struct bd_info *bd)
@ -1739,6 +1735,5 @@ int fdtdec_decode_ram_size(const void *blob, const char *area, int board_id,
return 0; return 0;
} }
#endif /* CONFIG_NR_DRAM_BANKS */
#endif /* !USE_HOSTCC */ #endif /* !USE_HOSTCC */

View File

@ -117,22 +117,17 @@ static void lmb_reserve_common(struct lmb *lmb, void *fdt_blob)
/* Initialize the struct, add memory and call arch/board reserve functions */ /* Initialize the struct, add memory and call arch/board reserve functions */
void lmb_init_and_reserve(struct lmb *lmb, struct bd_info *bd, void *fdt_blob) void lmb_init_and_reserve(struct lmb *lmb, struct bd_info *bd, void *fdt_blob)
{ {
#ifdef CONFIG_NR_DRAM_BANKS
int i; int i;
#endif
lmb_init(lmb); lmb_init(lmb);
#ifdef CONFIG_NR_DRAM_BANKS
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
if (bd->bi_dram[i].size) { if (bd->bi_dram[i].size) {
lmb_add(lmb, bd->bi_dram[i].start, lmb_add(lmb, bd->bi_dram[i].start,
bd->bi_dram[i].size); bd->bi_dram[i].size);
} }
} }
#else
if (bd->bi_memsize)
lmb_add(lmb, bd->bi_memstart, bd->bi_memsize);
#endif
lmb_reserve_common(lmb, fdt_blob); lmb_reserve_common(lmb, fdt_blob);
} }