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>
This commit is contained in:
Andrew F. Davis 2019-02-11 12:58:32 -06:00
parent 33baa1e33c
commit b3ca8aabbd
2 changed files with 46 additions and 2 deletions

View File

@ -334,11 +334,30 @@ 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,
@ -357,6 +376,27 @@ int ti_sci_device_get(uint32_t id)
* Return: 0 if all goes well, else appropriate error message
*/
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,

View File

@ -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);