return 0;
}
-int power_domain_get(struct udevice *dev, struct power_domain *power_domain)
+int power_domain_get_by_index(struct udevice *dev,
+ struct power_domain *power_domain, int index)
{
struct ofnode_phandle_args args;
int ret;
debug("%s(dev=%p, power_domain=%p)\n", __func__, dev, power_domain);
ret = dev_read_phandle_with_args(dev, "power-domains",
- "#power-domain-cells", 0, 0, &args);
+ "#power-domain-cells", 0, index,
+ &args);
if (ret) {
debug("%s: dev_read_phandle_with_args failed: %d\n",
__func__, ret);
return 0;
}
+int power_domain_get(struct udevice *dev, struct power_domain *power_domain)
+{
+ return power_domain_get_by_index(dev, power_domain, 0);
+}
+
int power_domain_free(struct power_domain *power_domain)
{
struct power_domain_ops *ops = power_domain_dev_ops(power_domain->dev);
}
#endif
+/**
+ * power_domain_get_by_index - Get the indexed power domain for a device.
+ *
+ * @dev: The client device.
+ * @power_domain: A pointer to a power domain struct to initialize.
+ * @index: Power domain index to be powered on.
+ *
+ * @return 0 if OK, or a negative error code.
+ */
+#if CONFIG_IS_ENABLED(POWER_DOMAIN)
+int power_domain_get_by_index(struct udevice *dev,
+ struct power_domain *power_domain, int index);
+#else
+static inline
+int power_domain_get_by_index(struct udevice *dev,
+ struct power_domain *power_domain, int index)
+{
+ return -ENOSYS;
+}
+#endif
+
/**
* power_domain_free - Free a previously requested power domain.
*