Skip to content

Commit d90bf29

Browse files
dbalutaShawn Guo
authored andcommitted
firmware: imx: Add support to start/stop a CPU
This is done via RPC call to SCU. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
1 parent 9b0bb07 commit d90bf29

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

  • drivers/firmware/imx
  • include/linux/firmware/imx/svc

‎drivers/firmware/imx/misc.c‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ struct imx_sc_msg_req_misc_set_ctrl {
1818
u16 resource;
1919
} __packed;
2020

21+
struct imx_sc_msg_req_cpu_start {
22+
struct imx_sc_rpc_msg hdr;
23+
u32 address_hi;
24+
u32 address_lo;
25+
u16 resource;
26+
u8 enable;
27+
} __packed;
28+
2129
struct imx_sc_msg_req_misc_get_ctrl {
2230
struct imx_sc_rpc_msg hdr;
2331
u32 ctrl;
@@ -97,3 +105,33 @@ int imx_sc_misc_get_control(struct imx_sc_ipc *ipc, u32 resource,
97105
return 0;
98106
}
99107
EXPORT_SYMBOL(imx_sc_misc_get_control);
108+
109+
/*
110+
* This function starts/stops a CPU identified by @resource
111+
*
112+
* @param[in] ipc IPC handle
113+
* @param[in] resource resource the control is associated with
114+
* @param[in] enable true for start, false for stop
115+
* @param[in] phys_addr initial instruction address to be executed
116+
*
117+
* @return Returns 0 for success and < 0 for errors.
118+
*/
119+
int imx_sc_pm_cpu_start(struct imx_sc_ipc *ipc, u32 resource,
120+
bool enable, u64 phys_addr)
121+
{
122+
struct imx_sc_msg_req_cpu_start msg;
123+
struct imx_sc_rpc_msg *hdr = &msg.hdr;
124+
125+
hdr->ver = IMX_SC_RPC_VERSION;
126+
hdr->svc = IMX_SC_RPC_SVC_PM;
127+
hdr->func = IMX_SC_PM_FUNC_CPU_START;
128+
hdr->size = 4;
129+
130+
msg.address_hi = phys_addr >> 32;
131+
msg.address_lo = phys_addr;
132+
msg.resource = resource;
133+
msg.enable = enable;
134+
135+
return imx_scu_call_rpc(ipc, &msg, true);
136+
}
137+
EXPORT_SYMBOL(imx_sc_pm_cpu_start);

‎include/linux/firmware/imx/svc/misc.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,7 @@ int imx_sc_misc_set_control(struct imx_sc_ipc *ipc, u32 resource,
5252
int imx_sc_misc_get_control(struct imx_sc_ipc *ipc, u32 resource,
5353
u8 ctrl, u32 *val);
5454

55+
int imx_sc_pm_cpu_start(struct imx_sc_ipc *ipc, u32 resource,
56+
bool enable, u64 phys_addr);
57+
5558
#endif /* _SC_MISC_API_H */

0 commit comments

Comments
 (0)