@@ -97,6 +97,19 @@ int reset_get_by_name(struct udevice *dev, const char *name,
return reset_get_by_index(dev, index, reset_ctl);
}
+int reset_count(struct udevice *dev)
+{
+ int count;
+ struct ofnode_phandle_args args;
+
+ for (count = 0; ; count++) {
+ if (dev_read_phandle_with_args(dev,
+ "resets", "#reset-cells", 0,
+ count, &args))
+ return count;
+ }
+}
+
int reset_request(struct reset_ctl *reset_ctl)
{
struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
@@ -100,6 +100,17 @@ int reset_get_by_name(struct udevice *dev, const char *name,
struct reset_ctl *reset_ctl);
/**
+ * reset_count - Get reset count contained in the "resets" property.
+ *
+ * This returns the count of reset found into the "resets" property. This
+ * allows to allocate the right amount of memory to keep reset reference.
+ *
+ * @dev: The client device.
+ * @return number of resets found.
+ */
+int reset_count(struct udevice *dev);
+
+/**
* reset_request - Request a reset signal.
*
* @reset_ctl: A reset control struct.