Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Daniel Baluta and committed by
Shawn Guo
d90bf296 9b0bb073

+41
+38
drivers/firmware/imx/misc.c
··· 18 18 u16 resource; 19 19 } __packed; 20 20 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 + 21 29 struct imx_sc_msg_req_misc_get_ctrl { 22 30 struct imx_sc_rpc_msg hdr; 23 31 u32 ctrl; ··· 105 97 return 0; 106 98 } 107 99 EXPORT_SYMBOL(imx_sc_misc_get_control); 100 + 101 + /* 102 + * This function starts/stops a CPU identified by @resource 103 + * 104 + * @param[in] ipc IPC handle 105 + * @param[in] resource resource the control is associated with 106 + * @param[in] enable true for start, false for stop 107 + * @param[in] phys_addr initial instruction address to be executed 108 + * 109 + * @return Returns 0 for success and < 0 for errors. 110 + */ 111 + int imx_sc_pm_cpu_start(struct imx_sc_ipc *ipc, u32 resource, 112 + bool enable, u64 phys_addr) 113 + { 114 + struct imx_sc_msg_req_cpu_start msg; 115 + struct imx_sc_rpc_msg *hdr = &msg.hdr; 116 + 117 + hdr->ver = IMX_SC_RPC_VERSION; 118 + hdr->svc = IMX_SC_RPC_SVC_PM; 119 + hdr->func = IMX_SC_PM_FUNC_CPU_START; 120 + hdr->size = 4; 121 + 122 + msg.address_hi = phys_addr >> 32; 123 + msg.address_lo = phys_addr; 124 + msg.resource = resource; 125 + msg.enable = enable; 126 + 127 + return imx_scu_call_rpc(ipc, &msg, true); 128 + } 129 + EXPORT_SYMBOL(imx_sc_pm_cpu_start);
+3
include/linux/firmware/imx/svc/misc.h
··· 52 52 int imx_sc_misc_get_control(struct imx_sc_ipc *ipc, u32 resource, 53 53 u8 ctrl, u32 *val); 54 54 55 + int imx_sc_pm_cpu_start(struct imx_sc_ipc *ipc, u32 resource, 56 + bool enable, u64 phys_addr); 57 + 55 58 #endif /* _SC_MISC_API_H */