u-boot/board/renesas/common/common.c
Marek Vasut c7d2d7f90a ARM: renesas: Simplify board Makefiles
Introduce board/renesas/common/Makefile and remove the multiple
duplicate copies of obj := ../common/*.o from board Makefiles.
Let the build system include the common Makefile using the
HAVE_VENDOR_COMMON_LIB and build the common objects that are
shared by all the boards that way. No functional change intended.

Some of the remaining board files which include board specific
settings have been updated to use obj-y += to avoid rewriting
the board obj-y target and avoid dropping object files from the
build.

The board/renesas/common/Makefile is now also used when building
RZG2L targets which also set CONFIG_RCAR_64 symbol and 32bit R-Car
Gen2 targets, however, this common code is specific to 64bit R-Car
only. Inhibit the build of this common code for RZG2L using extra
ifndef CONFIG_RZG2L and do not include any code for R-Car Gen2 so
far.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2025-01-29 22:52:35 +01:00

67 lines
1.3 KiB
C

// SPDX-License-Identifier: GPL-2.0
/*
* board/renesas/common/common.c
*
* Copyright (C) 2013 Renesas Electronics Corporation
* Copyright (C) 2013 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
* Copyright (C) 2015 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
*/
#include <dm.h>
#include <fdt_support.h>
#include <hang.h>
#include <init.h>
#include <asm/global_data.h>
#include <asm/io.h>
#include <dm/uclass-internal.h>
#include <asm/arch/renesas.h>
#include <asm/system.h>
#include <linux/libfdt.h>
DECLARE_GLOBAL_DATA_PTR;
int dram_init(void)
{
int ret = fdtdec_setup_mem_size_base();
if (current_el() == 3 && gd->ram_base == 0x48000000) {
/*
* If this U-Boot runs in EL3, make the bottom 128 MiB
* available for loading of follow up firmware blobs.
*/
gd->ram_base -= 0x8000000;
gd->ram_size += 0x8000000;
}
return ret;
}
int dram_init_banksize(void)
{
int bank;
fdtdec_setup_memory_banksize();
if (current_el() != 3)
return 0;
for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
if (gd->bd->bi_dram[bank].start != 0x48000000)
continue;
/*
* If this U-Boot runs in EL3, make the bottom 128 MiB
* available for loading of follow up firmware blobs.
*/
gd->bd->bi_dram[bank].start -= 0x8000000;
gd->bd->bi_dram[bank].size += 0x8000000;
break;
}
return 0;
}
int __weak board_init(void)
{
return 0;
}