2015-01-15 09:01:51 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2014 - 2015 Xilinx, Inc.
|
|
|
|
* Michal Simek <michal.simek@xilinx.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <asm/arch/hardware.h>
|
|
|
|
#include <asm/arch/sys_proto.h>
|
2016-03-04 00:09:49 +00:00
|
|
|
#include <asm/armv8/mmu.h>
|
2015-01-15 09:01:51 +00:00
|
|
|
#include <asm/io.h>
|
|
|
|
|
|
|
|
#define ZYNQ_SILICON_VER_MASK 0xF000
|
|
|
|
#define ZYNQ_SILICON_VER_SHIFT 12
|
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2016-03-04 00:09:49 +00:00
|
|
|
static struct mm_region zynqmp_mem_map[] = {
|
|
|
|
{
|
2016-06-24 23:46:22 +00:00
|
|
|
.virt = 0x0UL,
|
|
|
|
.phys = 0x0UL,
|
2016-03-04 00:09:49 +00:00
|
|
|
.size = 0x80000000UL,
|
|
|
|
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
|
|
|
|
PTE_BLOCK_INNER_SHARE
|
|
|
|
}, {
|
2016-06-24 23:46:22 +00:00
|
|
|
.virt = 0x80000000UL,
|
|
|
|
.phys = 0x80000000UL,
|
2016-03-04 00:09:49 +00:00
|
|
|
.size = 0x70000000UL,
|
|
|
|
.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
|
|
|
|
PTE_BLOCK_NON_SHARE |
|
|
|
|
PTE_BLOCK_PXN | PTE_BLOCK_UXN
|
|
|
|
}, {
|
2016-06-24 23:46:22 +00:00
|
|
|
.virt = 0xf8000000UL,
|
|
|
|
.phys = 0xf8000000UL,
|
2016-03-04 00:09:49 +00:00
|
|
|
.size = 0x07e00000UL,
|
|
|
|
.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
|
|
|
|
PTE_BLOCK_NON_SHARE |
|
|
|
|
PTE_BLOCK_PXN | PTE_BLOCK_UXN
|
|
|
|
}, {
|
2016-06-24 23:46:22 +00:00
|
|
|
.virt = 0xffe00000UL,
|
|
|
|
.phys = 0xffe00000UL,
|
2016-03-04 00:09:49 +00:00
|
|
|
.size = 0x00200000UL,
|
|
|
|
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
|
|
|
|
PTE_BLOCK_INNER_SHARE
|
|
|
|
}, {
|
2016-06-24 23:46:22 +00:00
|
|
|
.virt = 0x400000000UL,
|
|
|
|
.phys = 0x400000000UL,
|
2016-03-04 00:09:49 +00:00
|
|
|
.size = 0x200000000UL,
|
|
|
|
.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
|
|
|
|
PTE_BLOCK_NON_SHARE |
|
|
|
|
PTE_BLOCK_PXN | PTE_BLOCK_UXN
|
|
|
|
}, {
|
2016-06-24 23:46:22 +00:00
|
|
|
.virt = 0x600000000UL,
|
|
|
|
.phys = 0x600000000UL,
|
2016-03-04 00:09:49 +00:00
|
|
|
.size = 0x800000000UL,
|
|
|
|
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
|
|
|
|
PTE_BLOCK_INNER_SHARE
|
|
|
|
}, {
|
2016-06-24 23:46:22 +00:00
|
|
|
.virt = 0xe00000000UL,
|
|
|
|
.phys = 0xe00000000UL,
|
2016-03-04 00:09:49 +00:00
|
|
|
.size = 0xf200000000UL,
|
|
|
|
.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
|
|
|
|
PTE_BLOCK_NON_SHARE |
|
|
|
|
PTE_BLOCK_PXN | PTE_BLOCK_UXN
|
|
|
|
}, {
|
|
|
|
/* List terminator */
|
|
|
|
0,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
struct mm_region *mem_map = zynqmp_mem_map;
|
|
|
|
|
2016-05-30 08:41:26 +00:00
|
|
|
u64 get_page_table_size(void)
|
|
|
|
{
|
|
|
|
return 0x14000;
|
|
|
|
}
|
|
|
|
|
2015-11-05 07:34:35 +00:00
|
|
|
static unsigned int zynqmp_get_silicon_version_secure(void)
|
|
|
|
{
|
|
|
|
u32 ver;
|
|
|
|
|
|
|
|
ver = readl(&csu_base->version);
|
|
|
|
ver &= ZYNQMP_SILICON_VER_MASK;
|
|
|
|
ver >>= ZYNQMP_SILICON_VER_SHIFT;
|
|
|
|
|
|
|
|
return ver;
|
|
|
|
}
|
|
|
|
|
2015-01-15 09:01:51 +00:00
|
|
|
unsigned int zynqmp_get_silicon_version(void)
|
|
|
|
{
|
2015-11-05 07:34:35 +00:00
|
|
|
if (current_el() == 3)
|
|
|
|
return zynqmp_get_silicon_version_secure();
|
|
|
|
|
2015-01-15 09:01:51 +00:00
|
|
|
gd->cpu_clk = get_tbclk();
|
|
|
|
|
|
|
|
switch (gd->cpu_clk) {
|
2015-04-15 12:59:19 +00:00
|
|
|
case 0 ... 1000000:
|
|
|
|
return ZYNQMP_CSU_VERSION_VELOCE;
|
2015-01-15 09:01:51 +00:00
|
|
|
case 50000000:
|
|
|
|
return ZYNQMP_CSU_VERSION_QEMU;
|
2015-08-20 12:01:39 +00:00
|
|
|
case 4000000:
|
|
|
|
return ZYNQMP_CSU_VERSION_EP108;
|
2015-01-15 09:01:51 +00:00
|
|
|
}
|
|
|
|
|
2015-08-20 12:01:39 +00:00
|
|
|
return ZYNQMP_CSU_VERSION_SILICON;
|
2015-01-15 09:01:51 +00:00
|
|
|
}
|