aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Gerlach2015-11-24 11:57:44 -0600
committerTero Kristo2015-11-25 03:36:30 -0600
commit89559f97339a2a6b1aeb4ceb74693aacdca442db (patch)
treea1413e0513a7ac07f5796ed348149dc5cda23914 /drivers/firmware/ti_sci.c
parent3f484525d49fe6120db1b4b2bfa4bdc1bf0b2356 (diff)
downloadti-linux-kernel-89559f97339a2a6b1aeb4ceb74693aacdca442db.tar.gz
ti-linux-kernel-89559f97339a2a6b1aeb4ceb74693aacdca442db.tar.xz
ti-linux-kernel-89559f97339a2a6b1aeb4ceb74693aacdca442db.zip
firmware: ti_sci: Add device_resets calls to the device ops
Add set_device_resets to the device ops of ti_sci to handle new TI_SCI_MSG_SET_DEVICE_RESETS message introduced with ABI 2.3 that will control the resets of a device without touching any of the other state associated with that device. Previously resets control was handled by the TI_SCI_MSG_SET_DEVICE message which also controls device state. This would lead to the reset framework being responsible for controlling resets but also requiring knowledge about the state of the device or making assumptions and causing undefined behavior. With this new split ti_sci_pm_domains can control the state exclusively while also setting the reset value when turning the device on and the reset framework will be able to control resets independently of device state. Also add get_device_resets to return the state of the resets of a device. Acked-by: Nishanth Menon <nm@ti.com> Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Diffstat (limited to 'drivers/firmware/ti_sci.c')
-rw-r--r--drivers/firmware/ti_sci.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index a48a703c61dc..ca6021cf4969 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -833,6 +833,77 @@ static int ti_sci_cmd_dev_is_trans(const struct ti_sci_handle *handle, u32 id,
833} 833}
834 834
835/** 835/**
836 * ti_sci_cmd_set_device_resets() - command to set resets for device managed
837 * by TISCI
838 * @handle: Pointer to TISCI handle as retrieved by *ti_sci_get_handle
839 * @id: Device Identifier
840 * @reset_state: Device specific reset bit field
841 *
842 * Return: 0 if all went fine, else return appropriate error.
843 */
844static int ti_sci_cmd_set_device_resets(const struct ti_sci_handle *handle,
845 u32 id, u32 reset_state)
846{
847 struct ti_sci_info *info;
848 struct ti_sci_msg_req_set_device_resets *req;
849 struct ti_sci_msg_hdr *resp;
850 struct ti_sci_xfer *xfer;
851 struct device *dev;
852 int ret = 0;
853
854 if (IS_ERR(handle))
855 return PTR_ERR(handle);
856 if (!handle)
857 return -EINVAL;
858
859 info = handle_to_ti_sci_info(handle);
860 dev = info->dev;
861
862 xfer = ti_sci_get_one_xfer(info, TI_SCI_MSG_SET_DEVICE_RESETS,
863 TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
864 sizeof(*req), sizeof(*resp));
865 if (IS_ERR(xfer)) {
866 ret = PTR_ERR(xfer);
867 dev_err(dev, "Message alloc failed(%d)\n", ret);
868 return ret;
869 }
870 req = (struct ti_sci_msg_req_set_device_resets *)xfer->xfer_buf;
871 req->id = id;
872 req->resets = reset_state;
873
874 ret = ti_sci_do_xfer(info, xfer);
875 if (ret) {
876 dev_err(dev, "Mbox send fail %d\n", ret);
877 goto fail;
878 }
879
880 resp = (struct ti_sci_msg_hdr *)xfer->xfer_buf;
881
882 ret = tis_sci_is_response_ack(resp) ? 0 : -ENODEV;
883
884fail:
885 ti_sci_put_one_xfer(&info->minfo, xfer);
886
887 return ret;
888}
889
890/**
891 * ti_sci_cmd_get_device_resets() - Get reset state for device managed
892 * by TISCI
893 * @handle: Pointer to TISCI handle
894 * @id: Device Identifier
895 * @reset_state: Pointer to reset state to populate
896 *
897 * Return: 0 if all went fine, else return appropriate error.
898 */
899static int ti_sci_cmd_get_device_resets(const struct ti_sci_handle *handle,
900 u32 id, u32 *reset_state)
901{
902 return ti_sci_get_device_state(handle, id, NULL, reset_state, NULL,
903 NULL);
904}
905
906/**
836 * ti_sci_set_clock_state() - Set clock state helper 907 * ti_sci_set_clock_state() - Set clock state helper
837 * @handle: pointer to TI SCI handle 908 * @handle: pointer to TI SCI handle
838 * @dev_id: Device identifier this request is for 909 * @dev_id: Device identifier this request is for
@@ -1521,6 +1592,8 @@ static void ti_sci_setup_ops(struct ti_sci_info *info)
1521 dops->is_stop = ti_sci_cmd_dev_is_stop; 1592 dops->is_stop = ti_sci_cmd_dev_is_stop;
1522 dops->is_on = ti_sci_cmd_dev_is_on; 1593 dops->is_on = ti_sci_cmd_dev_is_on;
1523 dops->is_transitioning = ti_sci_cmd_dev_is_trans; 1594 dops->is_transitioning = ti_sci_cmd_dev_is_trans;
1595 dops->set_device_resets = ti_sci_cmd_set_device_resets;
1596 dops->get_device_resets = ti_sci_cmd_get_device_resets;
1524 1597
1525 cops->get_clock = ti_sci_cmd_get_clock; 1598 cops->get_clock = ti_sci_cmd_get_clock;
1526 cops->idle_clock = ti_sci_cmd_idle_clock; 1599 cops->idle_clock = ti_sci_cmd_idle_clock;