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.
Unified · Split
| @@ -635,6 +635,7 @@ fail: · 634 unmodified lines | ||
| 635 | 635 | |
| 636 | 636 | /** |
| 637 | 637 | * ti_sci_cmd_get_device() - command to request for device managed by TISCI |
| 638 | + * that can be shared with other hosts. | |
| 638 | 639 | * @handle: Pointer to TISCI handle as retrieved by *ti_sci_get_handle |
| 639 | 640 | * @id: Device Identifier |
| 640 | 641 | * |
| @@ -642,11 +643,29 @@ fail: · 1 unmodified line | ||
| 642 | 643 | * usage count by balancing get_device with put_device. No refcounting is |
| 643 | 644 | * managed by driver for that purpose. |
| 644 | 645 | * |
| 645 | − * NOTE: The request is for exclusive access for the processor. | |
| 646 | − * | |
| 647 | 646 | * Return: 0 if all went fine, else return appropriate error. |
| 648 | 647 | */ |
| 649 | 648 | 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) | |
| 650 | 669 | { |
| 651 | 670 | return ti_sci_set_device_state(handle, id, |
| 652 | 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 | 684 | * Return: 0 if all went fine, else return appropriate error. |
| 666 | 685 | */ |
| 667 | 686 | 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) | |
| 668 | 707 | { |
| 669 | 708 | return ti_sci_set_device_state(handle, id, |
| 670 | 709 | MSG_FLAG_DEVICE_EXCLUSIVE, |
| @@ -2894,7 +2933,9 @@ static void ti_sci_setup_ops(struct ti_sci_info *info) · 2223 unmodified lines | ||
| 2894 | 2933 | core_ops->reboot_device = ti_sci_cmd_core_reboot; |
| 2895 | 2934 | |
| 2896 | 2935 | dops->get_device = ti_sci_cmd_get_device; |
| 2936 | + dops->get_device_exclusive = ti_sci_cmd_get_device_exclusive; | |
| 2897 | 2937 | dops->idle_device = ti_sci_cmd_idle_device; |
| 2938 | + dops->idle_device_exclusive = ti_sci_cmd_idle_device_exclusive; | |
| 2898 | 2939 | dops->put_device = ti_sci_cmd_put_device; |
| 2899 | 2940 | |
| 2900 | 2941 | dops->is_valid = ti_sci_cmd_dev_is_valid; |
| @@ -97,7 +97,10 @@ struct ti_sci_core_ops { · 96 unmodified lines | ||
| 97 | 97 | */ |
| 98 | 98 | struct ti_sci_dev_ops { |
| 99 | 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 | 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 | 104 | int (*put_device)(const struct ti_sci_handle *handle, u32 id); |
| 102 | 105 | int (*is_valid)(const struct ti_sci_handle *handle, u32 id); |
| 103 | 106 | int (*get_context_loss_count)(const struct ti_sci_handle *handle, |