[U-Boot] [PATCH 2/5] arm: socfpga: Add checking function on FPGA setting in FDT

tien.fong.chee at intel.com
2017-07-31T10:50:19Z

From: Tien Fong Chee <tien.fong.chee@intel.com>

Function for checking FPGA early release setting which is defined
by user in FDT chosen section. This function would be used by
later driver in decision applying appropriate FPGA configuration in
early release or full FPGA booting mode.

Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
---
arch/arm/mach-socfpga/include/mach/misc.h | 1 +
arch/arm/mach-socfpga/misc_arria10.c | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-socfpga/include/mach/misc.h b/arch/arm/mach-socfpga/include/mach/misc.h
index b219aac..a8167eb 100644
--- a/arch/arm/mach-socfpga/include/mach/misc.h
+++ b/arch/arm/mach-socfpga/include/mach/misc.h
@@ -44,6 +44,7 @@ static inline void socfpga_fpga_add(void) {}
unsigned int dedicated_uart_com_port(const void *blob);
unsigned int shared_uart_com_port(const void *blob);
unsigned int uart_com_port(const void *blob);
+int is_early_release_fpga_config(const void *blob);
u32 boot_device(void);
#endif

diff --git a/arch/arm/mach-socfpga/misc_arria10.c b/arch/arm/mach-socfpga/misc_arria10.c
index 069a0a6..b9a8693 100644
--- a/arch/arm/mach-socfpga/misc_arria10.c
+++ b/arch/arm/mach-socfpga/misc_arria10.c
@@ -235,6 +235,26 @@ unsigned int uart_com_port(const void *blob)
return shared_uart_com_port(blob);
}

+int is_chosen_boolean_true(const void *blob, const char *name)
+{
+ int node;
+ int rval = 0;
+
+ node = fdt_subnode_offset(blob, 0, "chosen");
+
+ if (node >= 0)
+ rval = fdtdec_get_bool(blob, node, name);
+
+ return rval;
+}
+
+int is_early_release_fpga_config(const void *blob)
+{
+ static const char *name = "early-release-fpga-config";
+
+ return is_chosen_boolean_true(blob, name);
+}
+
u32 boot_device(void)
{
const u32 bsel = readl(&sysmgr_regs->bootinfo);
--
1.7.7.4