summaryrefslogtreecommitdiff
path: root/plat/ti
diff options
context:
space:
mode:
authorAndrew F. Davis <afd@ti.com>2019-02-11 12:58:32 -0600
committerAndrew F. Davis <afd@ti.com>2019-02-11 16:13:30 -0600
commitb3ca8aabbd585f668cc187ba2001b42dd606b272 (patch)
tree7ae9c4f9869c53c10312ffa452ea0c88d999861b /plat/ti
parent33baa1e33c9e31cce3965ca13289b282eb22178d (diff)
ti: k3: drivers: ti_sci: Add exclusive device accessors
When a device is requested with TI-SCI its control can be made exclusive to the requesting host. This was currently the default but is not what is needed most of the time. Add _exclusive versions of the request functions and remove the exclusive flag from the default version. Signed-off-by: Andrew F. Davis <afd@ti.com>
Diffstat (limited to 'plat/ti')
-rw-r--r--plat/ti/k3/common/drivers/ti_sci/ti_sci.c44
-rw-r--r--plat/ti/k3/common/drivers/ti_sci/ti_sci.h4
2 files changed, 46 insertions, 2 deletions
diff --git a/plat/ti/k3/common/drivers/ti_sci/ti_sci.c b/plat/ti/k3/common/drivers/ti_sci/ti_sci.c
index 00382f02..a4e28d1d 100644
--- a/plat/ti/k3/common/drivers/ti_sci/ti_sci.c
+++ b/plat/ti/k3/common/drivers/ti_sci/ti_sci.c
@@ -334,12 +334,31 @@ static int ti_sci_device_get_state(uint32_t id, uint32_t *clcnt,
* usage count by balancing get_device with put_device. No refcounting is
* managed by driver for that purpose.
*
- * NOTE: The request is for exclusive access for the processor.
- *
* Return: 0 if all goes well, else appropriate error message
*/
int ti_sci_device_get(uint32_t id)
{
+ return ti_sci_device_set_state(id, 0, MSG_DEVICE_SW_STATE_ON);
+}
+
+/**
+ * ti_sci_device_get_exclusive() - Exclusive request for device managed by TISCI
+ *
+ * @id: Device Identifier
+ *
+ * Request for the device - NOTE: the client MUST maintain integrity of
+ * usage count by balancing get_device with put_device. No refcounting is
+ * managed by driver for that purpose.
+ *
+ * NOTE: This _exclusive version of the get API is for exclusive access to the
+ * device. Any other host in the system will fail to get this device after this
+ * call until exclusive access is released with device_put or a non-exclusive
+ * set call.
+ *
+ * Return: 0 if all goes well, else appropriate error message
+ */
+int ti_sci_device_get_exclusive(uint32_t id)
+{
return ti_sci_device_set_state(id,
MSG_FLAG_DEVICE_EXCLUSIVE,
MSG_DEVICE_SW_STATE_ON);
@@ -358,6 +377,27 @@ int ti_sci_device_get(uint32_t id)
*/
int ti_sci_device_idle(uint32_t id)
{
+ return ti_sci_device_set_state(id, 0, MSG_DEVICE_SW_STATE_RETENTION);
+}
+
+/**
+ * ti_sci_device_idle_exclusive() - Exclusive idle a device managed by TISCI
+ *
+ * @id: Device Identifier
+ *
+ * Request for the device - NOTE: the client MUST maintain integrity of
+ * usage count by balancing get_device with put_device. No refcounting is
+ * managed by driver for that purpose.
+ *
+ * NOTE: This _exclusive version of the idle API is for exclusive access to
+ * the device. Any other host in the system will fail to get this device after
+ * this call until exclusive access is released with device_put or a
+ * non-exclusive set call.
+ *
+ * Return: 0 if all goes well, else appropriate error message
+ */
+int ti_sci_device_idle_exclusive(uint32_t id)
+{
return ti_sci_device_set_state(id,
MSG_FLAG_DEVICE_EXCLUSIVE,
MSG_DEVICE_SW_STATE_RETENTION);
diff --git a/plat/ti/k3/common/drivers/ti_sci/ti_sci.h b/plat/ti/k3/common/drivers/ti_sci/ti_sci.h
index 1288a665..7eb9f6de 100644
--- a/plat/ti/k3/common/drivers/ti_sci/ti_sci.h
+++ b/plat/ti/k3/common/drivers/ti_sci/ti_sci.h
@@ -17,7 +17,9 @@
* Device control operations
*
* - ti_sci_device_get - command to request for device managed by TISCI
+ * - ti_sci_device_get_exclusive - exclusively request a device
* - ti_sci_device_idle - Command to idle a device managed by TISCI
+ * - ti_sci_device_idle_exclusive - exclusively idle a device
* - ti_sci_device_put - command to release a device managed by TISCI
* - ti_sci_device_is_valid - Is the device valid
* - ti_sci_device_get_clcnt - Get context loss counter
@@ -47,7 +49,9 @@
* managed by driver for that purpose.
*/
int ti_sci_device_get(uint32_t id);
+int ti_sci_device_get_exclusive(uint32_t id);
int ti_sci_device_idle(uint32_t id);
+int ti_sci_device_idle_exclusive(uint32_t id);
int ti_sci_device_put(uint32_t id);
int ti_sci_device_is_valid(uint32_t id);
int ti_sci_device_get_clcnt(uint32_t id, uint32_t *count);