From 2cb5bac9849b596eed0107be1c07dc4316ce6ee6 Mon Sep 17 00:00:00 2001 From: Soren Brinkmann <soren.brinkmann@xilinx.com> Date: Mon, 18 Apr 2016 11:49:42 -0700 Subject: [PATCH] zynqmp: Introduce zynqmp_get_bootmode Provide a function to retrieve the bootmode. Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Acked-by: Michal Simek <michal.simek@xilinx.com> --- plat/xilinx/zynqmp/aarch64/zynqmp_common.c | 7 +++++++ plat/xilinx/zynqmp/zynqmp_def.h | 4 ++++ plat/xilinx/zynqmp/zynqmp_private.h | 1 + 3 files changed, 12 insertions(+) diff --git a/plat/xilinx/zynqmp/aarch64/zynqmp_common.c b/plat/xilinx/zynqmp/aarch64/zynqmp_common.c index 87e47a5f9..21d62570f 100644 --- a/plat/xilinx/zynqmp/aarch64/zynqmp_common.c +++ b/plat/xilinx/zynqmp/aarch64/zynqmp_common.c @@ -271,6 +271,13 @@ int zynqmp_is_pmu_up(void) return zynqmp_pmufw_present; } +unsigned int zynqmp_get_bootmode(void) +{ + uint32_t r = mmio_read_32(CRL_APB_BOOT_MODE_USER); + + return r & CRL_APB_BOOT_MODE_MASK; +} + void zynqmp_config_setup(void) { zynqmp_discover_pmufw(); diff --git a/plat/xilinx/zynqmp/zynqmp_def.h b/plat/xilinx/zynqmp/zynqmp_def.h index 504517dbf..9496ec499 100644 --- a/plat/xilinx/zynqmp/zynqmp_def.h +++ b/plat/xilinx/zynqmp/zynqmp_def.h @@ -63,6 +63,7 @@ #define CRL_APB_BASE 0xFF5E0000 #define CRL_APB_RPLL_CTRL (CRL_APB_BASE + 0x30) #define CRL_APB_TIMESTAMP_REF_CTRL (CRL_APB_BASE + 0x128) +#define CRL_APB_BOOT_MODE_USER (CRL_APB_BASE + 0x200) #define CRL_APB_RESET_CTRL (CRL_APB_BASE + 0x218) #define CRL_APB_TIMESTAMP_REF_CTRL_CLKACT_BIT (1 << 24) @@ -71,6 +72,9 @@ #define CRL_APB_RESET_CTRL_SOFT_RESET (1 << 4) +#define CRL_APB_BOOT_MODE_MASK (0xf << 0) +#define ZYNQMP_BOOTMODE_JTAG 0 + /* system counter registers and bitfields */ #define IOU_SCNTRS_BASE 0xFF260000 #define IOU_SCNTRS_CONTROL (IOU_SCNTRS_BASE + 0) diff --git a/plat/xilinx/zynqmp/zynqmp_private.h b/plat/xilinx/zynqmp/zynqmp_private.h index 1f5be39ba..228d8dce4 100644 --- a/plat/xilinx/zynqmp/zynqmp_private.h +++ b/plat/xilinx/zynqmp/zynqmp_private.h @@ -38,5 +38,6 @@ void zynqmp_config_setup(void); /* ZynqMP specific functions */ unsigned int zynqmp_get_uart_clk(void); int zynqmp_is_pmu_up(void); +unsigned int zynqmp_get_bootmode(void); #endif /* __ZYNQMP_PRIVATE_H__ */ -- GitLab