@@ -160,14 +160,21 @@ const void *dt_get_property(const struct dt_device_node *np,
bool_t dt_property_read_u32(const struct dt_device_node *np,
const char *name, u32 *out_value)
{
- u32 len;
+ return dt_property_read_u32_array(np, name, out_value, 1);
+}
+
+bool_t dt_property_read_u32_array(const struct dt_device_node *np,
+ const char *name, u32 *out_value, u16 out_len)
+{
+ u32 len, i;
const __be32 *val;
val = dt_get_property(np, name, &len);
- if ( !val || len < sizeof(*out_value) )
+ if ( !val || len < sizeof(*out_value) * out_len )
return 0;
- *out_value = be32_to_cpup(val);
+ for ( i = 0; i < out_len; i++, val++ )
+ out_value[i] = be32_to_cpup(val);
return 1;
}
@@ -346,6 +346,17 @@ const struct dt_property *dt_find_property(const struct dt_device_node *np,
bool_t dt_property_read_u32(const struct dt_device_node *np,
const char *name, u32 *out_value);
/**
+ * dt_property_read_u32_array - Helper to read a u32 array property.
+ * @np: node to get the value
+ * @name: name of the property
+ * @out_value: pointer to return value
+ * @out_len: length of the array
+ *
+ * Return true if get the desired value.
+ */
+bool_t dt_property_read_u32_array(const struct dt_device_node *np,
+ const char *name, u32 *out_value, u16 out_len);
+/**
* dt_property_read_u64 - Helper to read a u64 property.
* @np: node to get the value
* @name: name of the property