firmware: imx: Add support to start/stop a CPU
PATCH v3 1/1 firmware: imx: Add support to start/stop a CPU
This is done via RPC call to SCU.
---
Changes since v2: (as per Aisheng's review)
- rename address with phys_address
- remove unnecessary uint8_t cast
- use 'true' as last parameter of imx_scu_call_rpc to actually wait for a response from SCU.
drivers/firmware/imx/misc.c | 38 +++++++++++++++++++++++++++ include/linux/firmware/imx/svc/misc.h | 3 +++ 2 files changed, 41 insertions(+)
drivers/firmware/imx/misc.c +38 -0
@@ -18,6 +18,14 @@ struct imx_sc_msg_req_misc_set_ctrl {u16 resource; } __packed; +struct imx_sc_msg_req_cpu_start { +struct imx_sc_rpc_msg hdr; +u32 address_hi; +u32 address_lo; +u16 resource; +u8 enable; +} __packed; +struct imx_sc_msg_req_misc_get_ctrl {struct imx_sc_rpc_msg hdr;u32 ctrl;
@@ -97,3 +105,33 @@ int imx_sc_misc_get_control(struct imx_sc_ipc *ipc, u32 resource,return 0 ; }EXPORT_SYMBOL (imx_sc_misc_get_control); + +/* +* This function starts/stops a CPU identified by @resource +* +* @param[in] ipc IPC handle +* @param[in] resource resource the control is associated with +* @param[in] enable true for start, false for stop +* @param[in] phys_addr initial instruction address to be executed +* +* @return Returns 0 for success and < 0 for errors. +*/ +int imx_sc_pm_cpu_start (struct imx_sc_ipc *ipc,u32 resource, +bool enable,u64 phys_addr) +{ +struct imx_sc_msg_req_cpu_start msg; +struct imx_sc_rpc_msg *hdr = &msg.hdr; + + hdr->ver =IMX_SC_RPC_VERSION ; + hdr->svc =IMX_SC_RPC_SVC_PM ; + hdr->func =IMX_SC_PM_FUNC_CPU_START ; + hdr->size =4 ; + + msg.address_hi = phys_addr >>32 ; + msg.address_lo = phys_addr; + msg.resource = resource; + msg.enable = enable; + +return imx_scu_call_rpc (ipc, &msg, true); +} +EXPORT_SYMBOL (imx_sc_pm_cpu_start);
include/linux/firmware/imx/svc/misc.h +3 -0
@@ -52,4 +52,7 @@ int imx_sc_misc_set_control(struct imx_sc_ipc *ipc, u32 resource,int imx_sc_misc_get_control (struct imx_sc_ipc *ipc,u32 resource,u8 ctrl,u32 *val); +int imx_sc_pm_cpu_start (struct imx_sc_ipc *ipc,u32 resource, +bool enable,u64 phys_addr); +#endif /* _SC_MISC_API_H */
Signature · 1 line
2.17.1
Quoted 11 lines
-----Original Message-----
From: Daniel Baluta
Sent: Wednesday, January 30, 2019 9:30 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>; [email protected]; Aisheng Dong <[email protected]>; [email protected]; [email protected]; S.j. Wang <[email protected]>; Daniel Baluta <[email protected]>
Subject: [PATCH v3] firmware: imx: Add support to start/stop a CPU
Quoted 3 lines
This is done via RPC call to SCU.
Signed-off-by Daniel Baluta <[email protected]>
Regards
Dong Aisheng
Quoted 80 lines
---
Changes since v2: (as per Aisheng's review)
- rename address withphys_address
- remove unnecessaryuint8_tcast
- use 'true' as last parameter ofimx_scu_call_rpcto actually wait for a response from SCU.drivers/firmware/imx/misc.c | 38 +++++++++++++++++++++++++++ include/linux/firmware/imx/svc/misc.h | 3 +++ 2 files changed, 41 insertions(+)drivers/firmware/imx/misc.c index renamed from drivers/firmware/imx/misc.c +0
-0
97f5424dbac9..4b56a587dacd100644drivers/firmware/imx/misc.c +37
-0@@ -18,6 +18,14 @@ struct imx_sc_msg_req_misc_set_ctrl {u16 resource; } __packed; +struct imx_sc_msg_req_cpu_start { +struct imx_sc_rpc_msg hdr; +u32 address_hi; +u32 address_lo; +u16 resource; +u8 enable; +} __packed; +struct imx_sc_msg_req_misc_get_ctrl {struct imx_sc_rpc_msg hdr;u32 ctrl;@@ -97,3 +105,33 @@ int imx_sc_misc_get_control(struct imx_sc_ipc *ipc,u32 resource, return 0; }EXPORT_SYMBOL (imx_sc_misc_get_control); + +/* +* This function starts/stops a CPU identified by @resource +* +* @param[in] ipc IPC handle +* @param[in] resource resource the control is associated with +* @param[in] enable true for start, false for stop +* @param[in] phys_addr initial instruction address to be executed +* +* @return Returns 0 for success and < 0 for errors. +*/ +int imx_sc_pm_cpu_start (struct imx_sc_ipc *ipc,u32 resource, +bool enable,u64 phys_addr) +{ +struct imx_sc_msg_req_cpu_start msg; +struct imx_sc_rpc_msg *hdr = &msg.hdr; + + hdr->ver =IMX_SC_RPC_VERSION ; + hdr->svc =IMX_SC_RPC_SVC_PM ; + hdr->func =IMX_SC_PM_FUNC_CPU_START ; + hdr->size =4 ; + + msg.address_hi = phys_addr >>32 ; + msg.address_lo = phys_addr; + msg.resource = resource; + msg.enable = enable; + +return imx_scu_call_rpc (ipc, &msg, true); } +EXPORT_SYMBOL (imx_sc_pm_cpu_start);include/linux/firmware/imx/svc/misc.h +3
-1@@ -52,4 +52,7 @@ int imx_sc_misc_set_control(struct imx_sc_ipc *ipc, u32 resource, int imx_sc_misc_get_control(struct imx_sc_ipc *ipc, u32 resource, u8 ctrl, u32 *val); +int imx_sc_pm_cpu_start (struct imx_sc_ipc *ipc,u32 resource, +bool enable,u64 phys_addr); +#endif /* _SC_MISC_API_H */ --2.17.1
Hi Shawn,
Care to have a look?
Daniel.
Quoted 102 lines · Aisheng Dong
Quoted 12 lines
-----Original Message-----
From: Daniel Baluta
Sent: Wednesday, January 30, 2019 9:30 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>; [email protected]; Aisheng Dong <[email protected]>; [email protected]; [email protected]; S.j. Wang <[email protected]>; Daniel Baluta <[email protected]>
Subject: [PATCH v3] firmware: imx: Add support to start/stop a CPUQuoted 3 lines
This is done via RPC call to SCU.
Signed-off-by Daniel Baluta <[email protected]>Reviewed-by Dong Aisheng <[email protected]>Regards
Dong AishengQuoted 80 lines
---
Changes since v2: (as per Aisheng's review)
- rename address withphys_address
- remove unnecessaryuint8_tcast
- use 'true' as last parameter ofimx_scu_call_rpcto actually wait for a response from SCU.drivers/firmware/imx/misc.c | 38 +++++++++++++++++++++++++++ include/linux/firmware/imx/svc/misc.h | 3 +++ 2 files changed, 41 insertions(+)drivers/firmware/imx/misc.c index renamed from drivers/firmware/imx/misc.c +0
-0
97f5424dbac9..4b56a587dacd100644drivers/firmware/imx/misc.c +37
-0@@ -18,6 +18,14 @@ struct imx_sc_msg_req_misc_set_ctrl {u16 resource; } __packed; +struct imx_sc_msg_req_cpu_start { +struct imx_sc_rpc_msg hdr; +u32 address_hi; +u32 address_lo; +u16 resource; +u8 enable; +} __packed; +struct imx_sc_msg_req_misc_get_ctrl {struct imx_sc_rpc_msg hdr;u32 ctrl;@@ -97,3 +105,33 @@ int imx_sc_misc_get_control(struct imx_sc_ipc *ipc,u32 resource, return 0; }EXPORT_SYMBOL (imx_sc_misc_get_control); + +/* +* This function starts/stops a CPU identified by @resource +* +* @param[in] ipc IPC handle +* @param[in] resource resource the control is associated with +* @param[in] enable true for start, false for stop +* @param[in] phys_addr initial instruction address to be executed +* +* @return Returns 0 for success and < 0 for errors. +*/ +int imx_sc_pm_cpu_start (struct imx_sc_ipc *ipc,u32 resource, +bool enable,u64 phys_addr) +{ +struct imx_sc_msg_req_cpu_start msg; +struct imx_sc_rpc_msg *hdr = &msg.hdr; + + hdr->ver =IMX_SC_RPC_VERSION ; + hdr->svc =IMX_SC_RPC_SVC_PM ; + hdr->func =IMX_SC_PM_FUNC_CPU_START ; + hdr->size =4 ; + + msg.address_hi = phys_addr >>32 ; + msg.address_lo = phys_addr; + msg.resource = resource; + msg.enable = enable; + +return imx_scu_call_rpc (ipc, &msg, true); } +EXPORT_SYMBOL (imx_sc_pm_cpu_start);include/linux/firmware/imx/svc/misc.h +3
-1@@ -52,4 +52,7 @@ int imx_sc_misc_set_control(struct imx_sc_ipc *ipc, u32 resource, int imx_sc_misc_get_control(struct imx_sc_ipc *ipc, u32 resource, u8 ctrl, u32 *val); +int imx_sc_pm_cpu_start (struct imx_sc_ipc *ipc,u32 resource, +bool enable,u64 phys_addr); +#endif /* _SC_MISC_API_H */ --2.17.1
Shawn Guo
AppliedQuoted 3 lines · Daniel Baluta
This is done via RPC call to SCU.
Signed-off-by Daniel Baluta <[email protected]>
Applied, thanks.