History

firmware: ti_sci: Allow for device shared and exclusive requests

Sysfw provides an option for requesting exclusive access for a device using the flags MSG_FLAG_DEVICE_EXCLUSIVE. If this flag is not used, the device is meant to be shared across hosts. Once a device is requested from a host with this flag set, any request to this device from a different host will be nacked by sysfw. Current tisci driver enables this flag for every device requests. But this may not be true for all the devices. So provide a separate commands in driver for exclusive and shared device requests.

Lokesh Vutla committed 7 years ago

Commit 45b659e1 parent 3b1261f2 files · +46 −2Browse files

Unified · Split

2 files
  1. drivers/firmware/ti_sci.c +43 −2
  2. include/linux/soc/ti/ti_sci_protocol.h +3 −0
drivers/firmware/ti_sci.c+43−2
@@ -635,6 +635,7 @@ fail: · 634 unmodified lines
635 635
636/**636/**
637 * ti_sci_cmd_get_device() - command to request for device managed by TISCI637 * ti_sci_cmd_get_device() - command to request for device managed by TISCI
638 * that can be shared with other hosts.
638 * @handle: Pointer to TISCI handle as retrieved by *ti_sci_get_handle639 * @handle: Pointer to TISCI handle as retrieved by *ti_sci_get_handle
639 * @id: Device Identifier640 * @id: Device Identifier
640 *641 *
@@ -642,11 +643,29 @@ fail: · 1 unmodified line
642 * usage count by balancing get_device with put_device. No refcounting is643 * usage count by balancing get_device with put_device. No refcounting is
643 * managed by driver for that purpose.644 * managed by driver for that purpose.
644 *645 *
645 * NOTE: The request is for exclusive access for the processor.
646 *
647 * Return: 0 if all went fine, else return appropriate error.646 * Return: 0 if all went fine, else return appropriate error.
648 */647 */
649static int ti_sci_cmd_get_device(const struct ti_sci_handle *handle, u32 id)648static int ti_sci_cmd_get_device(const struct ti_sci_handle *handle, u32 id)
649{
650 return ti_sci_set_device_state(handle, id, 0,
651 MSG_DEVICE_SW_STATE_ON);
652}
653
654/**
655 * ti_sci_cmd_get_device_exclusive() - command to request for device managed by
656 * TISCI that is exclusively owned by the
657 * requesting host.
658 * @handle: Pointer to TISCI handle as retrieved by *ti_sci_get_handle
659 * @id: Device Identifier
660 *
661 * Request for the device - NOTE: the client MUST maintain integrity of
662 * usage count by balancing get_device with put_device. No refcounting is
663 * managed by driver for that purpose.
664 *
665 * Return: 0 if all went fine, else return appropriate error.
666 */
667static int ti_sci_cmd_get_device_exclusive(const struct ti_sci_handle *handle,
668 u32 id)
650{669{
651 return ti_sci_set_device_state(handle, id,670 return ti_sci_set_device_state(handle, id,
652 MSG_FLAG_DEVICE_EXCLUSIVE,671 MSG_FLAG_DEVICE_EXCLUSIVE,
@@ -665,6 +684,26 @@ static int ti_sci_cmd_get_device(const struct ti_sci_handle *handle, u32 id) · 12 unmodified lines
665 * Return: 0 if all went fine, else return appropriate error.684 * Return: 0 if all went fine, else return appropriate error.
666 */685 */
667static int ti_sci_cmd_idle_device(const struct ti_sci_handle *handle, u32 id)686static int ti_sci_cmd_idle_device(const struct ti_sci_handle *handle, u32 id)
687{
688 return ti_sci_set_device_state(handle, id, 0,
689 MSG_DEVICE_SW_STATE_RETENTION);
690}
691
692/**
693 * ti_sci_cmd_idle_device_exclusive() - Command to idle a device managed by
694 * TISCI that is exclusively owned by
695 * requesting host.
696 * @handle: Pointer to TISCI handle as retrieved by *ti_sci_get_handle
697 * @id: Device Identifier
698 *
699 * Request for the device - NOTE: the client MUST maintain integrity of
700 * usage count by balancing get_device with put_device. No refcounting is
701 * managed by driver for that purpose.
702 *
703 * Return: 0 if all went fine, else return appropriate error.
704 */
705static int ti_sci_cmd_idle_device_exclusive(const struct ti_sci_handle *handle,
706 u32 id)
668{707{
669 return ti_sci_set_device_state(handle, id,708 return ti_sci_set_device_state(handle, id,
670 MSG_FLAG_DEVICE_EXCLUSIVE,709 MSG_FLAG_DEVICE_EXCLUSIVE,
@@ -2894,7 +2933,9 @@ static void ti_sci_setup_ops(struct ti_sci_info *info) · 2223 unmodified lines
2894 core_ops->reboot_device = ti_sci_cmd_core_reboot;2933 core_ops->reboot_device = ti_sci_cmd_core_reboot;
2895 2934
2896 dops->get_device = ti_sci_cmd_get_device;2935 dops->get_device = ti_sci_cmd_get_device;
2936 dops->get_device_exclusive = ti_sci_cmd_get_device_exclusive;
2897 dops->idle_device = ti_sci_cmd_idle_device;2937 dops->idle_device = ti_sci_cmd_idle_device;
2938 dops->idle_device_exclusive = ti_sci_cmd_idle_device_exclusive;
2898 dops->put_device = ti_sci_cmd_put_device;2939 dops->put_device = ti_sci_cmd_put_device;
2899 2940
2900 dops->is_valid = ti_sci_cmd_dev_is_valid;2941 dops->is_valid = ti_sci_cmd_dev_is_valid;
include/linux/soc/ti/ti_sci_protocol.h+3−0
@@ -97,7 +97,10 @@ struct ti_sci_core_ops { · 96 unmodified lines
97 */97 */
98struct ti_sci_dev_ops {98struct ti_sci_dev_ops {
99 int (*get_device)(const struct ti_sci_handle *handle, u32 id);99 int (*get_device)(const struct ti_sci_handle *handle, u32 id);
100 int (*get_device_exclusive)(const struct ti_sci_handle *handle, u32 id);
100 int (*idle_device)(const struct ti_sci_handle *handle, u32 id);101 int (*idle_device)(const struct ti_sci_handle *handle, u32 id);
102 int (*idle_device_exclusive)(const struct ti_sci_handle *handle,
103 u32 id);
101 int (*put_device)(const struct ti_sci_handle *handle, u32 id);104 int (*put_device)(const struct ti_sci_handle *handle, u32 id);
102 int (*is_valid)(const struct ti_sci_handle *handle, u32 id);105 int (*is_valid)(const struct ti_sci_handle *handle, u32 id);
103 int (*get_context_loss_count)(const struct ti_sci_handle *handle,106 int (*get_context_loss_count)(const struct ti_sci_handle *handle,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t