lib: Add helpers for adding 32-bit /chosen properties
diff --git a/common/lib/fdt.c b/common/lib/fdt.c
index c9ae0692..fb60cc0f 100644
--- a/common/lib/fdt.c
+++ b/common/lib/fdt.c
@@ -32,4 +32,13 @@ int fdt_set_chosen_uint64(void *fdt, const char *name, uint64_t value) {
return fdt_setprop_u64(fdt, chosen_offset, name, value);
}
+int fdt_set_chosen_uint32(void *fdt, const char *name, uint32_t value) {
+ int chosen_offset = fdt_get_or_add_chosen_node(fdt);
+ if (chosen_offset < 0) {
+ return chosen_offset;
+ }
+
+ return fdt_setprop_u32(fdt, chosen_offset, name, value);
+}
+
#endif
diff --git a/common/lib/fdt.h b/common/lib/fdt.h
index 3edcc841..ba7a9a32 100644
--- a/common/lib/fdt.h
+++ b/common/lib/fdt.h
@@ -8,6 +8,7 @@
int fdt_set_chosen_string(void *fdt, const char *name, const char *value);
int fdt_set_chosen_uint64(void *fdt, const char *name, uint64_t value);
+int fdt_set_chosen_uint32(void *fdt, const char *name, uint32_t value);
#endif
