0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef REMOTEPROC_TI_SCI_PROC_H
0010 #define REMOTEPROC_TI_SCI_PROC_H
0011
0012 #include <linux/soc/ti/ti_sci_protocol.h>
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 struct ti_sci_proc {
0024 const struct ti_sci_handle *sci;
0025 const struct ti_sci_proc_ops *ops;
0026 struct device *dev;
0027 u8 proc_id;
0028 u8 host_id;
0029 };
0030
0031 static inline int ti_sci_proc_request(struct ti_sci_proc *tsp)
0032 {
0033 int ret;
0034
0035 ret = tsp->ops->request(tsp->sci, tsp->proc_id);
0036 if (ret)
0037 dev_err(tsp->dev, "ti-sci processor request failed: %d\n",
0038 ret);
0039 return ret;
0040 }
0041
0042 static inline int ti_sci_proc_release(struct ti_sci_proc *tsp)
0043 {
0044 int ret;
0045
0046 ret = tsp->ops->release(tsp->sci, tsp->proc_id);
0047 if (ret)
0048 dev_err(tsp->dev, "ti-sci processor release failed: %d\n",
0049 ret);
0050 return ret;
0051 }
0052
0053 static inline int ti_sci_proc_handover(struct ti_sci_proc *tsp)
0054 {
0055 int ret;
0056
0057 ret = tsp->ops->handover(tsp->sci, tsp->proc_id, tsp->host_id);
0058 if (ret)
0059 dev_err(tsp->dev, "ti-sci processor handover of %d to %d failed: %d\n",
0060 tsp->proc_id, tsp->host_id, ret);
0061 return ret;
0062 }
0063
0064 static inline int ti_sci_proc_set_config(struct ti_sci_proc *tsp,
0065 u64 boot_vector,
0066 u32 cfg_set, u32 cfg_clr)
0067 {
0068 int ret;
0069
0070 ret = tsp->ops->set_config(tsp->sci, tsp->proc_id, boot_vector,
0071 cfg_set, cfg_clr);
0072 if (ret)
0073 dev_err(tsp->dev, "ti-sci processor set_config failed: %d\n",
0074 ret);
0075 return ret;
0076 }
0077
0078 static inline int ti_sci_proc_set_control(struct ti_sci_proc *tsp,
0079 u32 ctrl_set, u32 ctrl_clr)
0080 {
0081 int ret;
0082
0083 ret = tsp->ops->set_control(tsp->sci, tsp->proc_id, ctrl_set, ctrl_clr);
0084 if (ret)
0085 dev_err(tsp->dev, "ti-sci processor set_control failed: %d\n",
0086 ret);
0087 return ret;
0088 }
0089
0090 static inline int ti_sci_proc_get_status(struct ti_sci_proc *tsp,
0091 u64 *boot_vector, u32 *cfg_flags,
0092 u32 *ctrl_flags, u32 *status_flags)
0093 {
0094 int ret;
0095
0096 ret = tsp->ops->get_status(tsp->sci, tsp->proc_id, boot_vector,
0097 cfg_flags, ctrl_flags, status_flags);
0098 if (ret)
0099 dev_err(tsp->dev, "ti-sci processor get_status failed: %d\n",
0100 ret);
0101 return ret;
0102 }
0103
0104 #endif