diff mbox series

[U-Boot,v2,07/26] remoteproc: tisci_proc: Add helper api for controlling core power domain

Message ID 20190904103151.20121-8-lokeshvutla@ti.com
State Accepted
Commit f7954828b8d0defeb6a10371f070ecd29ed192dd
Delegated to: Tom Rini
Headers show
Series remoteproc: Add support for R5F and DSP processors | expand

Commit Message

Lokesh Vutla Sept. 4, 2019, 10:31 a.m. UTC
Power domain for the remote cores needs to be handled in a right
sequence as mandated by the spec. Introduce tisci helper apis
that can control power-domains of remote cores. TISCI clients
can use this api and control the remote cores power domain instead
of hooking it to power-domain layer.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 drivers/remoteproc/ti_sci_proc.h | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Comments

Tom Rini Oct. 12, 2019, 8:24 p.m. UTC | #1
On Wed, Sep 04, 2019 at 04:01:32PM +0530, Lokesh Vutla wrote:

> Power domain for the remote cores needs to be handled in a right
> sequence as mandated by the spec. Introduce tisci helper apis
> that can control power-domains of remote cores. TISCI clients
> can use this api and control the remote cores power domain instead
> of hooking it to power-domain layer.
> 
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/remoteproc/ti_sci_proc.h b/drivers/remoteproc/ti_sci_proc.h
index ccfc39ec88..f8299d1aff 100644
--- a/drivers/remoteproc/ti_sci_proc.h
+++ b/drivers/remoteproc/ti_sci_proc.h
@@ -19,12 +19,14 @@ 
  * @proc_id: processor id for the consumer remoteproc device
  * @host_id: host id to pass the control over for this consumer remoteproc
  *	     device
+ * @dev_id: Device ID as identified by system controller.
  */
 struct ti_sci_proc {
 	const struct ti_sci_handle *sci;
 	const struct ti_sci_proc_ops *ops;
 	u8 proc_id;
 	u8 host_id;
+	u16 dev_id;
 };
 
 static inline int ti_sci_proc_request(struct ti_sci_proc *tsp)
@@ -118,4 +120,29 @@  static inline int ti_sci_proc_set_control(struct ti_sci_proc *tsp,
 	return ret;
 }
 
+static inline int ti_sci_proc_power_domain_on(struct ti_sci_proc *tsp)
+{
+	int ret;
+
+	debug("%s: dev_id = %d\n", __func__, tsp->dev_id);
+
+	ret = tsp->sci->ops.dev_ops.get_device_exclusive(tsp->sci, tsp->dev_id);
+	if (ret)
+		pr_err("Power-domain on failed for dev = %d\n", tsp->dev_id);
+
+	return ret;
+}
+
+static inline int ti_sci_proc_power_domain_off(struct ti_sci_proc *tsp)
+{
+	int ret;
+
+	debug("%s: dev_id = %d\n", __func__, tsp->dev_id);
+
+	ret = tsp->sci->ops.dev_ops.put_device(tsp->sci, tsp->dev_id);
+	if (ret)
+		pr_err("Power-domain off failed for dev = %d\n", tsp->dev_id);
+
+	return ret;
+}
 #endif /* REMOTEPROC_TI_SCI_PROC_H */