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

tien.fong.chee at intel.com tien.fong.chee at intel.com
Tue Aug 8 09:12:46 UTC 2017


From: Tien Fong Chee <tien.fong.chee at 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 at intel.com>
---
 arch/arm/mach-socfpga/include/mach/misc.h |  1 +
 arch/arm/mach-socfpga/misc_arria10.c      | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/arch/arm/mach-socfpga/include/mach/misc.h b/arch/arm/mach-socfpga/include/mach/misc.h
index 0b65783..e003f8a 100644
--- a/arch/arm/mach-socfpga/include/mach/misc.h
+++ b/arch/arm/mach-socfpga/include/mach/misc.h
@@ -26,6 +26,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);
 #endif
 
 #endif /* _MISC_H_ */
diff --git a/arch/arm/mach-socfpga/misc_arria10.c b/arch/arm/mach-socfpga/misc_arria10.c
index 9d751f6..2d6e977 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);
+}
+
 /*
  * Print CPU information
  */
-- 
2.2.0



More information about the U-Boot mailing list