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
635635
636636 /**
637637 * ti_sci_cmd_get_device() - command to request for device managed by TISCI
638+ * that can be shared with other hosts.
638639 * @handle: Pointer to TISCI handle as retrieved by *ti_sci_get_handle
639640 * @id: Device Identifier
640641 *
@@ -642,11 +643,29 @@ fail: · 1 unmodified line
642643 * usage count by balancing get_device with put_device. No refcounting is
643644 * managed by driver for that purpose.
644645 *
645− * NOTE: The request is for exclusive access for the processor.
646− *
647646 * Return: 0 if all went fine, else return appropriate error.
648647 */
649648 static 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+ */
667+static int ti_sci_cmd_get_device_exclusive(const struct ti_sci_handle *handle,
668+ u32 id)
650669 {
651670 return ti_sci_set_device_state(handle, id,
652671 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
665684 * Return: 0 if all went fine, else return appropriate error.
666685 */
667686 static 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+ */
705+static int ti_sci_cmd_idle_device_exclusive(const struct ti_sci_handle *handle,
706+ u32 id)
668707 {
669708 return ti_sci_set_device_state(handle, id,
670709 MSG_FLAG_DEVICE_EXCLUSIVE,
@@ -2894,7 +2933,9 @@ static void ti_sci_setup_ops(struct ti_sci_info *info) · 2223 unmodified lines
28942933 core_ops->reboot_device = ti_sci_cmd_core_reboot;
28952934
28962935 dops->get_device = ti_sci_cmd_get_device;
2936+ dops->get_device_exclusive = ti_sci_cmd_get_device_exclusive;
28972937 dops->idle_device = ti_sci_cmd_idle_device;
2938+ dops->idle_device_exclusive = ti_sci_cmd_idle_device_exclusive;
28982939 dops->put_device = ti_sci_cmd_put_device;
28992940
29002941 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
9797 */
9898 struct ti_sci_dev_ops {
9999 int (*get_device)(const struct ti_sci_handle *handle, u32 id);
100+ int (*get_device_exclusive)(const struct ti_sci_handle *handle, u32 id);
100101 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);
101104 int (*put_device)(const struct ti_sci_handle *handle, u32 id);
102105 int (*is_valid)(const struct ti_sci_handle *handle, u32 id);
103106 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