avionic design with actual uboot and tooling
submodule of avionic design uboot bootloader and with included tools to get you started , read readme.md and readme-tk1-loader.md
This commit is contained in:
23
u-boot/arch/arm/cpu/armv8/zynqmp/Kconfig
Normal file
23
u-boot/arch/arm/cpu/armv8/zynqmp/Kconfig
Normal file
@@ -0,0 +1,23 @@
|
||||
if ARCH_ZYNQMP
|
||||
|
||||
config SYS_BOARD
|
||||
default "zynqmp"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "xilinx"
|
||||
|
||||
config SYS_SOC
|
||||
default "zynqmp"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
string "Board configuration name"
|
||||
default "xilinx_zynqmp"
|
||||
help
|
||||
This option contains information about board configuration name.
|
||||
Based on this option include/configs/<CONFIG_SYS_CONFIG_NAME>.h header
|
||||
will be used for board configuration.
|
||||
|
||||
config ZYNQMP_USB
|
||||
bool "Configure ZynqMP USB"
|
||||
|
||||
endif
|
||||
12
u-boot/arch/arm/cpu/armv8/zynqmp/Makefile
Normal file
12
u-boot/arch/arm/cpu/armv8/zynqmp/Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# (C) Copyright 2014 - 2015 Xilinx, Inc.
|
||||
# Michal Simek <michal.simek@xilinx.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
obj-y += clk.o
|
||||
obj-y += cpu.o
|
||||
obj-$(CONFIG_MP) += mp.o
|
||||
obj-y += slcr.o
|
||||
obj-$(CONFIG_SPL_BUILD) += spl.o
|
||||
70
u-boot/arch/arm/cpu/armv8/zynqmp/clk.c
Normal file
70
u-boot/arch/arm/cpu/armv8/zynqmp/clk.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* (C) Copyright 2014 - 2015 Xilinx, Inc.
|
||||
* Michal Simek <michal.simek@xilinx.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/arch/clk.h>
|
||||
#include <asm/arch/hardware.h>
|
||||
#include <asm/arch/sys_proto.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
unsigned long get_uart_clk(int dev_id)
|
||||
{
|
||||
u32 ver = zynqmp_get_silicon_version();
|
||||
|
||||
switch (ver) {
|
||||
case ZYNQMP_CSU_VERSION_VELOCE:
|
||||
return 48000;
|
||||
case ZYNQMP_CSU_VERSION_EP108:
|
||||
return 25000000;
|
||||
case ZYNQMP_CSU_VERSION_QEMU:
|
||||
return 133000000;
|
||||
}
|
||||
|
||||
return 100000000;
|
||||
}
|
||||
|
||||
unsigned long zynqmp_get_system_timer_freq(void)
|
||||
{
|
||||
u32 ver = zynqmp_get_silicon_version();
|
||||
|
||||
switch (ver) {
|
||||
case ZYNQMP_CSU_VERSION_VELOCE:
|
||||
return 10000;
|
||||
case ZYNQMP_CSU_VERSION_EP108:
|
||||
return 4000000;
|
||||
case ZYNQMP_CSU_VERSION_QEMU:
|
||||
return 50000000;
|
||||
}
|
||||
|
||||
return 100000000;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CLOCKS
|
||||
/**
|
||||
* set_cpu_clk_info() - Initialize clock framework
|
||||
* Always returns zero.
|
||||
*
|
||||
* This function is called from common code after relocation and sets up the
|
||||
* clock framework. The framework must not be used before this function had been
|
||||
* called.
|
||||
*/
|
||||
int set_cpu_clk_info(void)
|
||||
{
|
||||
gd->cpu_clk = get_tbclk();
|
||||
|
||||
/* Support Veloce to show at least 1MHz via bdi */
|
||||
if (gd->cpu_clk > 1000000)
|
||||
gd->bd->bi_arm_freq = gd->cpu_clk / 1000000;
|
||||
else
|
||||
gd->bd->bi_arm_freq = 1;
|
||||
|
||||
gd->bd->bi_dsp_freq = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
99
u-boot/arch/arm/cpu/armv8/zynqmp/cpu.c
Normal file
99
u-boot/arch/arm/cpu/armv8/zynqmp/cpu.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* (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>
|
||||
#include <asm/armv8/mmu.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#define ZYNQ_SILICON_VER_MASK 0xF000
|
||||
#define ZYNQ_SILICON_VER_SHIFT 12
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
static struct mm_region zynqmp_mem_map[] = {
|
||||
{
|
||||
.base = 0x0UL,
|
||||
.size = 0x80000000UL,
|
||||
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
|
||||
PTE_BLOCK_INNER_SHARE
|
||||
}, {
|
||||
.base = 0x80000000UL,
|
||||
.size = 0x70000000UL,
|
||||
.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
|
||||
PTE_BLOCK_NON_SHARE |
|
||||
PTE_BLOCK_PXN | PTE_BLOCK_UXN
|
||||
}, {
|
||||
.base = 0xf8000000UL,
|
||||
.size = 0x07e00000UL,
|
||||
.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
|
||||
PTE_BLOCK_NON_SHARE |
|
||||
PTE_BLOCK_PXN | PTE_BLOCK_UXN
|
||||
}, {
|
||||
.base = 0xffe00000UL,
|
||||
.size = 0x00200000UL,
|
||||
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
|
||||
PTE_BLOCK_INNER_SHARE
|
||||
}, {
|
||||
.base = 0x400000000UL,
|
||||
.size = 0x200000000UL,
|
||||
.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
|
||||
PTE_BLOCK_NON_SHARE |
|
||||
PTE_BLOCK_PXN | PTE_BLOCK_UXN
|
||||
}, {
|
||||
.base = 0x600000000UL,
|
||||
.size = 0x800000000UL,
|
||||
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
|
||||
PTE_BLOCK_INNER_SHARE
|
||||
}, {
|
||||
.base = 0xe00000000UL,
|
||||
.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;
|
||||
|
||||
u64 get_page_table_size(void)
|
||||
{
|
||||
return 0x14000;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
unsigned int zynqmp_get_silicon_version(void)
|
||||
{
|
||||
if (current_el() == 3)
|
||||
return zynqmp_get_silicon_version_secure();
|
||||
|
||||
gd->cpu_clk = get_tbclk();
|
||||
|
||||
switch (gd->cpu_clk) {
|
||||
case 0 ... 1000000:
|
||||
return ZYNQMP_CSU_VERSION_VELOCE;
|
||||
case 50000000:
|
||||
return ZYNQMP_CSU_VERSION_QEMU;
|
||||
case 4000000:
|
||||
return ZYNQMP_CSU_VERSION_EP108;
|
||||
}
|
||||
|
||||
return ZYNQMP_CSU_VERSION_SILICON;
|
||||
}
|
||||
269
u-boot/arch/arm/cpu/armv8/zynqmp/mp.c
Normal file
269
u-boot/arch/arm/cpu/armv8/zynqmp/mp.c
Normal file
@@ -0,0 +1,269 @@
|
||||
/*
|
||||
* (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>
|
||||
#include <asm/io.h>
|
||||
|
||||
#define LOCK 0
|
||||
#define SPLIT 1
|
||||
|
||||
#define HALT 0
|
||||
#define RELEASE 1
|
||||
|
||||
#define ZYNQMP_BOOTADDR_HIGH_MASK 0xFFFFFFFF
|
||||
#define ZYNQMP_R5_HIVEC_ADDR 0xFFFF0000
|
||||
#define ZYNQMP_R5_LOVEC_ADDR 0x0
|
||||
#define ZYNQMP_RPU_CFG_CPU_HALT_MASK 0x01
|
||||
#define ZYNQMP_RPU_CFG_HIVEC_MASK 0x04
|
||||
#define ZYNQMP_RPU_GLBL_CTRL_SPLIT_LOCK_MASK 0x08
|
||||
#define ZYNQMP_RPU_GLBL_CTRL_TCM_COMB_MASK 0x40
|
||||
#define ZYNQMP_RPU_GLBL_CTRL_SLCLAMP_MASK 0x10
|
||||
|
||||
#define ZYNQMP_CRLAPB_RST_LPD_AMBA_RST_MASK 0x04
|
||||
#define ZYNQMP_CRLAPB_RST_LPD_R50_RST_MASK 0x01
|
||||
#define ZYNQMP_CRLAPB_RST_LPD_R51_RST_MASK 0x02
|
||||
#define ZYNQMP_CRLAPB_CPU_R5_CTRL_CLKACT_MASK 0x1000000
|
||||
|
||||
#define ZYNQMP_TCM_START_ADDRESS 0xFFE00000
|
||||
#define ZYNQMP_TCM_BOTH_SIZE 0x40000
|
||||
|
||||
#define ZYNQMP_CORE_APU0 0
|
||||
#define ZYNQMP_CORE_APU3 3
|
||||
|
||||
#define ZYNQMP_MAX_CORES 6
|
||||
|
||||
int is_core_valid(unsigned int core)
|
||||
{
|
||||
if (core < ZYNQMP_MAX_CORES)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cpu_reset(int nr)
|
||||
{
|
||||
puts("Feature is not implemented.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void set_r5_halt_mode(u8 halt, u8 mode)
|
||||
{
|
||||
u32 tmp;
|
||||
|
||||
tmp = readl(&rpu_base->rpu0_cfg);
|
||||
if (halt == HALT)
|
||||
tmp &= ~ZYNQMP_RPU_CFG_CPU_HALT_MASK;
|
||||
else
|
||||
tmp |= ZYNQMP_RPU_CFG_CPU_HALT_MASK;
|
||||
writel(tmp, &rpu_base->rpu0_cfg);
|
||||
|
||||
if (mode == LOCK) {
|
||||
tmp = readl(&rpu_base->rpu1_cfg);
|
||||
if (halt == HALT)
|
||||
tmp &= ~ZYNQMP_RPU_CFG_CPU_HALT_MASK;
|
||||
else
|
||||
tmp |= ZYNQMP_RPU_CFG_CPU_HALT_MASK;
|
||||
writel(tmp, &rpu_base->rpu1_cfg);
|
||||
}
|
||||
}
|
||||
|
||||
static void set_r5_tcm_mode(u8 mode)
|
||||
{
|
||||
u32 tmp;
|
||||
|
||||
tmp = readl(&rpu_base->rpu_glbl_ctrl);
|
||||
if (mode == LOCK) {
|
||||
tmp &= ~ZYNQMP_RPU_GLBL_CTRL_SPLIT_LOCK_MASK;
|
||||
tmp |= ZYNQMP_RPU_GLBL_CTRL_TCM_COMB_MASK |
|
||||
ZYNQMP_RPU_GLBL_CTRL_SLCLAMP_MASK;
|
||||
} else {
|
||||
tmp |= ZYNQMP_RPU_GLBL_CTRL_SPLIT_LOCK_MASK;
|
||||
tmp &= ~(ZYNQMP_RPU_GLBL_CTRL_TCM_COMB_MASK |
|
||||
ZYNQMP_RPU_GLBL_CTRL_SLCLAMP_MASK);
|
||||
}
|
||||
|
||||
writel(tmp, &rpu_base->rpu_glbl_ctrl);
|
||||
}
|
||||
|
||||
static void set_r5_reset(u8 mode)
|
||||
{
|
||||
u32 tmp;
|
||||
|
||||
tmp = readl(&crlapb_base->rst_lpd_top);
|
||||
tmp |= (ZYNQMP_CRLAPB_RST_LPD_AMBA_RST_MASK |
|
||||
ZYNQMP_CRLAPB_RST_LPD_R50_RST_MASK);
|
||||
|
||||
if (mode == LOCK)
|
||||
tmp |= ZYNQMP_CRLAPB_RST_LPD_R51_RST_MASK;
|
||||
|
||||
writel(tmp, &crlapb_base->rst_lpd_top);
|
||||
}
|
||||
|
||||
static void release_r5_reset(u8 mode)
|
||||
{
|
||||
u32 tmp;
|
||||
|
||||
tmp = readl(&crlapb_base->rst_lpd_top);
|
||||
tmp &= ~(ZYNQMP_CRLAPB_RST_LPD_AMBA_RST_MASK |
|
||||
ZYNQMP_CRLAPB_RST_LPD_R50_RST_MASK);
|
||||
|
||||
if (mode == LOCK)
|
||||
tmp &= ~ZYNQMP_CRLAPB_RST_LPD_R51_RST_MASK;
|
||||
|
||||
writel(tmp, &crlapb_base->rst_lpd_top);
|
||||
}
|
||||
|
||||
static void enable_clock_r5(void)
|
||||
{
|
||||
u32 tmp;
|
||||
|
||||
tmp = readl(&crlapb_base->cpu_r5_ctrl);
|
||||
tmp |= ZYNQMP_CRLAPB_CPU_R5_CTRL_CLKACT_MASK;
|
||||
writel(tmp, &crlapb_base->cpu_r5_ctrl);
|
||||
|
||||
/* Give some delay for clock
|
||||
* to propogate */
|
||||
udelay(0x500);
|
||||
}
|
||||
|
||||
int cpu_disable(int nr)
|
||||
{
|
||||
if (nr >= ZYNQMP_CORE_APU0 && nr <= ZYNQMP_CORE_APU3) {
|
||||
u32 val = readl(&crfapb_base->rst_fpd_apu);
|
||||
val |= 1 << nr;
|
||||
writel(val, &crfapb_base->rst_fpd_apu);
|
||||
} else {
|
||||
set_r5_reset(LOCK);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cpu_status(int nr)
|
||||
{
|
||||
if (nr >= ZYNQMP_CORE_APU0 && nr <= ZYNQMP_CORE_APU3) {
|
||||
u32 addr_low = readl(((u8 *)&apu_base->rvbar_addr0_l) + nr * 8);
|
||||
u32 addr_high = readl(((u8 *)&apu_base->rvbar_addr0_h) +
|
||||
nr * 8);
|
||||
u32 val = readl(&crfapb_base->rst_fpd_apu);
|
||||
val &= 1 << nr;
|
||||
printf("APU CPU%d %s - starting address HI: %x, LOW: %x\n",
|
||||
nr, val ? "OFF" : "ON" , addr_high, addr_low);
|
||||
} else {
|
||||
u32 val = readl(&crlapb_base->rst_lpd_top);
|
||||
val &= 1 << (nr - 4);
|
||||
printf("RPU CPU%d %s\n", nr - 4, val ? "OFF" : "ON");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void set_r5_start(u8 high)
|
||||
{
|
||||
u32 tmp;
|
||||
|
||||
tmp = readl(&rpu_base->rpu0_cfg);
|
||||
if (high)
|
||||
tmp |= ZYNQMP_RPU_CFG_HIVEC_MASK;
|
||||
else
|
||||
tmp &= ~ZYNQMP_RPU_CFG_HIVEC_MASK;
|
||||
writel(tmp, &rpu_base->rpu0_cfg);
|
||||
|
||||
tmp = readl(&rpu_base->rpu1_cfg);
|
||||
if (high)
|
||||
tmp |= ZYNQMP_RPU_CFG_HIVEC_MASK;
|
||||
else
|
||||
tmp &= ~ZYNQMP_RPU_CFG_HIVEC_MASK;
|
||||
writel(tmp, &rpu_base->rpu1_cfg);
|
||||
}
|
||||
|
||||
static void write_tcm_boot_trampoline(u32 boot_addr)
|
||||
{
|
||||
if (boot_addr) {
|
||||
/*
|
||||
* Boot trampoline is simple ASM code below.
|
||||
*
|
||||
* b over;
|
||||
* label:
|
||||
* .word 0
|
||||
* over: ldr r0, =label
|
||||
* ldr r1, [r0]
|
||||
* bx r1
|
||||
*/
|
||||
debug("Write boot trampoline for %x\n", boot_addr);
|
||||
writel(0xea000000, ZYNQMP_TCM_START_ADDRESS);
|
||||
writel(boot_addr, ZYNQMP_TCM_START_ADDRESS + 0x4);
|
||||
writel(0xe59f0004, ZYNQMP_TCM_START_ADDRESS + 0x8);
|
||||
writel(0xe5901000, ZYNQMP_TCM_START_ADDRESS + 0xc);
|
||||
writel(0xe12fff11, ZYNQMP_TCM_START_ADDRESS + 0x10);
|
||||
writel(0x00000004, ZYNQMP_TCM_START_ADDRESS + 0x14); // address for
|
||||
}
|
||||
}
|
||||
|
||||
int cpu_release(int nr, int argc, char * const argv[])
|
||||
{
|
||||
if (nr >= ZYNQMP_CORE_APU0 && nr <= ZYNQMP_CORE_APU3) {
|
||||
u64 boot_addr = simple_strtoull(argv[0], NULL, 16);
|
||||
/* HIGH */
|
||||
writel((u32)(boot_addr >> 32),
|
||||
((u8 *)&apu_base->rvbar_addr0_h) + nr * 8);
|
||||
/* LOW */
|
||||
writel((u32)(boot_addr & ZYNQMP_BOOTADDR_HIGH_MASK),
|
||||
((u8 *)&apu_base->rvbar_addr0_l) + nr * 8);
|
||||
|
||||
u32 val = readl(&crfapb_base->rst_fpd_apu);
|
||||
val &= ~(1 << nr);
|
||||
writel(val, &crfapb_base->rst_fpd_apu);
|
||||
} else {
|
||||
if (argc != 2) {
|
||||
printf("Invalid number of arguments to release.\n");
|
||||
printf("<addr> <mode>-Start addr lockstep or split\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
u32 boot_addr = simple_strtoul(argv[0], NULL, 16);
|
||||
u32 boot_addr_uniq = 0;
|
||||
if (!(boot_addr == ZYNQMP_R5_LOVEC_ADDR ||
|
||||
boot_addr == ZYNQMP_R5_HIVEC_ADDR)) {
|
||||
printf("Using TCM jump trampoline for address 0x%x\n",
|
||||
boot_addr);
|
||||
/* Save boot address for later usage */
|
||||
boot_addr_uniq = boot_addr;
|
||||
/*
|
||||
* R5 needs to start from LOVEC at TCM
|
||||
* OCM will be probably occupied by ATF
|
||||
*/
|
||||
boot_addr = ZYNQMP_R5_LOVEC_ADDR;
|
||||
}
|
||||
|
||||
if (!strncmp(argv[1], "lockstep", 8)) {
|
||||
printf("R5 lockstep mode\n");
|
||||
set_r5_tcm_mode(LOCK);
|
||||
set_r5_halt_mode(HALT, LOCK);
|
||||
set_r5_start(boot_addr);
|
||||
enable_clock_r5();
|
||||
release_r5_reset(LOCK);
|
||||
write_tcm_boot_trampoline(boot_addr_uniq);
|
||||
set_r5_halt_mode(RELEASE, LOCK);
|
||||
} else if (!strncmp(argv[1], "split", 5)) {
|
||||
printf("R5 split mode\n");
|
||||
set_r5_tcm_mode(SPLIT);
|
||||
set_r5_halt_mode(HALT, SPLIT);
|
||||
enable_clock_r5();
|
||||
release_r5_reset(SPLIT);
|
||||
write_tcm_boot_trampoline(boot_addr_uniq);
|
||||
set_r5_halt_mode(RELEASE, SPLIT);
|
||||
} else {
|
||||
printf("Unsupported mode\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
63
u-boot/arch/arm/cpu/armv8/zynqmp/slcr.c
Normal file
63
u-boot/arch/arm/cpu/armv8/zynqmp/slcr.c
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* (C) Copyright 2014 - 2015 Xilinx, Inc.
|
||||
* Michal Simek <michal.simek@xilinx.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/io.h>
|
||||
#include <malloc.h>
|
||||
#include <asm/arch/hardware.h>
|
||||
#include <asm/arch/sys_proto.h>
|
||||
#include <asm/arch/clk.h>
|
||||
|
||||
/*
|
||||
* zynq_slcr_mio_get_status - Get the status of MIO peripheral.
|
||||
*
|
||||
* @peri_name: Name of the peripheral for checking MIO status
|
||||
* @get_pins: Pointer to array of get pin for this peripheral
|
||||
* @num_pins: Number of pins for this peripheral
|
||||
* @mask: Mask value
|
||||
* @check_val: Required check value to get the status of periph
|
||||
*/
|
||||
struct zynq_slcr_mio_get_status {
|
||||
const char *peri_name;
|
||||
const int *get_pins;
|
||||
int num_pins;
|
||||
u32 mask;
|
||||
u32 check_val;
|
||||
};
|
||||
|
||||
static const struct zynq_slcr_mio_get_status mio_periphs[] = {
|
||||
};
|
||||
|
||||
/*
|
||||
* zynq_slcr_get_mio_pin_status - Get the MIO pin status of peripheral.
|
||||
*
|
||||
* @periph: Name of the peripheral
|
||||
*
|
||||
* Returns count to indicate the number of pins configured for the
|
||||
* given @periph.
|
||||
*/
|
||||
int zynq_slcr_get_mio_pin_status(const char *periph)
|
||||
{
|
||||
const struct zynq_slcr_mio_get_status *mio_ptr;
|
||||
int val, i, j;
|
||||
int mio = 0;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(mio_periphs); i++) {
|
||||
if (strcmp(periph, mio_periphs[i].peri_name) == 0) {
|
||||
mio_ptr = &mio_periphs[i];
|
||||
for (j = 0; j < mio_ptr->num_pins; j++) {
|
||||
val = readl(&slcr_base->mio_pin
|
||||
[mio_ptr->get_pins[j]]);
|
||||
if ((val & mio_ptr->mask) == mio_ptr->check_val)
|
||||
mio++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return mio;
|
||||
}
|
||||
107
u-boot/arch/arm/cpu/armv8/zynqmp/spl.c
Normal file
107
u-boot/arch/arm/cpu/armv8/zynqmp/spl.c
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright 2015 - 2016 Xilinx, Inc.
|
||||
*
|
||||
* Michal Simek <michal.simek@xilinx.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <debug_uart.h>
|
||||
#include <spl.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/spl.h>
|
||||
#include <asm/arch/hardware.h>
|
||||
#include <asm/arch/sys_proto.h>
|
||||
|
||||
void board_init_f(ulong dummy)
|
||||
{
|
||||
psu_init();
|
||||
board_early_init_r();
|
||||
|
||||
#ifdef CONFIG_DEBUG_UART
|
||||
/* Uart debug for sure */
|
||||
debug_uart_init();
|
||||
puts("Debug uart enabled\n"); /* or printch() */
|
||||
#endif
|
||||
/* Delay is required for clocks to be propagated */
|
||||
udelay(1000000);
|
||||
|
||||
/* Clear the BSS */
|
||||
memset(__bss_start, 0, __bss_end - __bss_start);
|
||||
|
||||
/* No need to call timer init - it is empty for ZynqMP */
|
||||
board_init_r(NULL, 0);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPL_BOARD_INIT
|
||||
void spl_board_init(void)
|
||||
{
|
||||
preloader_console_init();
|
||||
board_init();
|
||||
}
|
||||
#endif
|
||||
|
||||
u32 spl_boot_device(void)
|
||||
{
|
||||
u32 reg = 0;
|
||||
u8 bootmode;
|
||||
|
||||
reg = readl(&crlapb_base->boot_mode);
|
||||
bootmode = reg & BOOT_MODES_MASK;
|
||||
|
||||
switch (bootmode) {
|
||||
case JTAG_MODE:
|
||||
return BOOT_DEVICE_RAM;
|
||||
#ifdef CONFIG_SPL_MMC_SUPPORT
|
||||
case EMMC_MODE:
|
||||
case SD_MODE:
|
||||
case SD_MODE1:
|
||||
return BOOT_DEVICE_MMC1;
|
||||
#endif
|
||||
default:
|
||||
printf("Invalid Boot Mode:0x%x\n", bootmode);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 spl_boot_mode(const u32 boot_device)
|
||||
{
|
||||
switch (spl_boot_device()) {
|
||||
case BOOT_DEVICE_RAM:
|
||||
return 0;
|
||||
case BOOT_DEVICE_MMC1:
|
||||
return MMCSD_MODE_FS;
|
||||
default:
|
||||
puts("spl: error: unsupported device\n");
|
||||
hang();
|
||||
}
|
||||
}
|
||||
|
||||
__weak void psu_init(void)
|
||||
{
|
||||
/*
|
||||
* This function is overridden by the one in
|
||||
* board/xilinx/zynqmp/(platform)/psu_init_gpl.c, if it exists.
|
||||
*/
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPL_OS_BOOT
|
||||
int spl_start_uboot(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SPL_LOAD_FIT
|
||||
int board_fit_config_name_match(const char *name)
|
||||
{
|
||||
/* Just empty function now - can't decide what to choose */
|
||||
debug("%s: %s\n", __func__, name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user