u-boot/board/kontron/sl28/spl_atf.c
Simon Glass 401d1c4f5d common: Drop asm/global_data.h from common header
Move this out of the common header and include it only where needed.  In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly.   Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2021-02-02 15:33:42 -05:00

55 lines
1.3 KiB
C

// SPDX-License-Identifier: GPL-2.0+
/*
* LS1028A TF-A calling support
*
* Copyright (c) 2020 Michael Walle <michael@walle.cc>
*/
#include <common.h>
#include <asm/global_data.h>
#include <asm/io.h>
#include <atf_common.h>
#include <spl.h>
DECLARE_GLOBAL_DATA_PTR;
struct region_info {
u64 addr;
u64 size;
};
struct dram_regions_info {
u64 num_dram_regions;
u64 total_dram_size;
struct region_info region[CONFIG_NR_DRAM_BANKS];
};
struct bl_params *bl2_plat_get_bl31_params_v2(uintptr_t bl32_entry,
uintptr_t bl33_entry,
uintptr_t fdt_addr)
{
static struct dram_regions_info dram_regions_info = { 0 };
struct bl_params *bl_params;
struct bl_params_node *node;
void *dcfg_ccsr = (void *)DCFG_BASE;
int i;
dram_regions_info.num_dram_regions = CONFIG_NR_DRAM_BANKS;
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
dram_regions_info.region[i].addr = gd->bd->bi_dram[i].start;
dram_regions_info.region[i].size = gd->bd->bi_dram[i].size;
dram_regions_info.total_dram_size += gd->bd->bi_dram[i].size;
}
bl_params = bl2_plat_get_bl31_params_v2_default(bl32_entry, bl33_entry,
fdt_addr);
for_each_bl_params_node(bl_params, node) {
if (node->image_id == ATF_BL31_IMAGE_ID) {
node->ep_info->args.arg3 = (uintptr_t)&dram_regions_info;
node->ep_info->args.arg4 = in_le32(dcfg_ccsr + DCFG_PORSR1);
}
}
return bl_params;
}