summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorShengzhou Liu <Shengzhou.Liu@freescale.com>2011-10-14 16:26:05 +0800
committerKumar Gala <galak@kernel.crashing.org>2011-10-18 00:36:55 -0500
commit2a523f524090d7fc5600ece9f12d7c955db567d7 (patch)
tree5c7e51b81be51bae4f7ef571861dab675652bb4d /include
parent4d28db8a1e8b90e1e3ffd95d7f949b849e33fa2f (diff)
downloadu-boot-imx-2a523f524090d7fc5600ece9f12d7c955db567d7.zip
u-boot-imx-2a523f524090d7fc5600ece9f12d7c955db567d7.tar.gz
u-boot-imx-2a523f524090d7fc5600ece9f12d7c955db567d7.tar.bz2
fdt: Add new fdt_set_node_status & fdt_set_status_by_alias helpers
Add common function fdt_set_node_status() to assist in various locations that we set a nodes status. This function utilizes the status values that are part of the EPAPR spec (on power.org). fdt_set_status_by_alias() is based on fdt_set_node_status() but uses an alias string to identify the node to update. We also add some shortcut functions to help the common cases of setting "okay" and "disabled": fdt_status_okay() fdt_status_disabled() fdt_status_okay_by_alias() fdt_status_disabled_by_alias() Finally, we fixup the corenet_ds ethernet code which previously had a function by the same name that can be replaced with the new helpers. Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
Diffstat (limited to 'include')
-rw-r--r--include/fdt_support.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 4826eee..c7b4605 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -104,5 +104,33 @@ int fdt_verify_alias_address(void *fdt, int anode, const char *alias,
u64 addr);
u64 fdt_get_base_address(void *fdt, int node);
+enum fdt_status {
+ FDT_STATUS_OKAY,
+ FDT_STATUS_DISABLED,
+ FDT_STATUS_FAIL,
+ FDT_STATUS_FAIL_ERROR_CODE,
+};
+int fdt_set_node_status(void *fdt, int nodeoffset,
+ enum fdt_status status, unsigned int error_code);
+static inline int fdt_status_okay(void *fdt, int nodeoffset)
+{
+ return fdt_set_node_status(fdt, nodeoffset, FDT_STATUS_OKAY, 0);
+}
+static inline int fdt_status_disabled(void *fdt, int nodeoffset)
+{
+ return fdt_set_node_status(fdt, nodeoffset, FDT_STATUS_DISABLED, 0);
+}
+
+int fdt_set_status_by_alias(void *fdt, const char* alias,
+ enum fdt_status status, unsigned int error_code);
+static inline int fdt_status_okay_by_alias(void *fdt, const char* alias)
+{
+ return fdt_set_status_by_alias(fdt, alias, FDT_STATUS_OKAY, 0);
+}
+static inline int fdt_status_disabled_by_alias(void *fdt, const char* alias)
+{
+ return fdt_set_status_by_alias(fdt, alias, FDT_STATUS_DISABLED, 0);
+}
+
#endif /* ifdef CONFIG_OF_LIBFDT */
#endif /* ifndef __FDT_SUPPORT_H */