arm64: versal: Add platform detection code to versal_virt

Detect which platform U-Boot is running at and based on that choose DTS
file which U-Boot uses for own configuration.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
This commit is contained in:
Michal Simek
2019-06-06 15:00:35 +02:00
parent 30f6180c99
commit c1cf1a3d98
3 changed files with 65 additions and 5 deletions

View File

@@ -7,6 +7,7 @@
#include <common.h>
#include <asm/armv8/mmu.h>
#include <asm/io.h>
#include <asm/sections.h>
#include <asm/arch/hardware.h>
#include <asm/arch/sys_proto.h>
@@ -113,11 +114,18 @@ void *board_fdt_blob_setup(void)
{
static void *fw_dtb = (void *)CONFIG_VERSAL_OF_BOARD_DTB_ADDR;
if (fdt_magic(fw_dtb) != FDT_MAGIC) {
printf("DTB is not passed via %llx\n", (u64)fw_dtb);
return NULL;
}
if (fdt_magic(fw_dtb) == FDT_MAGIC)
return fw_dtb;
return fw_dtb;
printf("DTB is not passed via 0x%llx\n", (u64)fw_dtb);
/* Try to look at FDT is at end of image */
fw_dtb = (ulong *)&_end;
if (fdt_magic(fw_dtb) == FDT_MAGIC)
return fw_dtb;
printf("DTB is also not passed via 0x%llx\n", (u64)fw_dtb);
return NULL;
}
#endif

View File

@@ -52,6 +52,15 @@ struct rpu_regs {
#define rpu_base ((struct rpu_regs *)VERSAL_RPU_BASEADDR)
#define VERSAL_PMC_TAP_BASEADDR 0xF11A0000
struct pmc_tap_regs {
u32 idcode; /* 0x0 */
u32 version; /* 0x4 */
};
#define pmc_base_base ((struct pmc_tap_regs *)VERSAL_PMC_TAP_BASEADDR)
#define VERSAL_CRP_BASEADDR 0xF1260000
struct crp_regs {

View File

@@ -201,3 +201,46 @@ int dram_init(void)
void reset_cpu(ulong addr)
{
}
#define PMC_TAP_VERSION_PLATFORM_MASK 0xF
#define PMC_TAP_VERSION_PLATFORM_SHIFT 24
/* pmc_tap_version platform */
#define PMC_TAP_VERSION_SILICON 0
#define PMC_TAP_VERSION_SPP 1
#define PMC_TAP_VERSION_EMU 2
#define PMC_TAP_VERSION_QEMU 3
int __maybe_unused board_fit_config_name_match(const char *name)
{
u32 version, platform;
char *platform_name = NULL;
version = readl(&pmc_base_base->version);
platform = (version >> PMC_TAP_VERSION_PLATFORM_SHIFT) &
PMC_TAP_VERSION_PLATFORM_MASK;
switch (platform) {
case PMC_TAP_VERSION_SILICON:
platform_name = "versal-tenzing"; /* For now */
debug("Running on Silicon\n");
break;
case PMC_TAP_VERSION_SPP:
platform_name = "versal-spp";
break;
case PMC_TAP_VERSION_EMU:
platform_name = "versal-emu";
break;
case PMC_TAP_VERSION_QEMU:
platform_name = "versal-qemu"; /* Internal QEMU */
debug("Running on QEMU which is suspicious\n");
break;
}
if (!strncmp(name, platform_name, sizeof(platform_name))) {
printf("Selecting DTB %s for board %s\n", name, platform_name);
return 0;
}
return -1;
}