linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] firmware: imx: Add support to start/stop a CPU
@ 2019-01-30 13:30 Daniel Baluta
  2019-01-31  8:16 ` Aisheng Dong
  2019-02-11  2:01 ` Shawn Guo
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel Baluta @ 2019-01-30 13:30 UTC (permalink / raw)
  To: shawnguo
  Cc: s.hauer, kernel, festevam, dl-linux-imx, daniel.baluta,
	Aisheng Dong, linux-arm-kernel, linux-kernel, S.j. Wang,
	Daniel Baluta

This is done via RPC call to SCU.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
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(+)

diff --git a/drivers/firmware/imx/misc.c b/drivers/firmware/imx/misc.c
index 97f5424dbac9..4b56a587dacd 100644
--- a/drivers/firmware/imx/misc.c
+++ b/drivers/firmware/imx/misc.c
@@ -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);
diff --git a/include/linux/firmware/imx/svc/misc.h b/include/linux/firmware/imx/svc/misc.h
index e21c49aba92f..031dd4d3c766 100644
--- a/include/linux/firmware/imx/svc/misc.h
+++ b/include/linux/firmware/imx/svc/misc.h
@@ -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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH v3] firmware: imx: Add support to start/stop a CPU
  2019-01-30 13:30 [PATCH v3] firmware: imx: Add support to start/stop a CPU Daniel Baluta
@ 2019-01-31  8:16 ` Aisheng Dong
  2019-02-04 19:18   ` Daniel Baluta
  2019-02-11  2:01 ` Shawn Guo
  1 sibling, 1 reply; 4+ messages in thread
From: Aisheng Dong @ 2019-01-31  8:16 UTC (permalink / raw)
  To: Daniel Baluta, shawnguo
  Cc: s.hauer, kernel, festevam, dl-linux-imx, daniel.baluta,
	linux-arm-kernel, linux-kernel, S.j. Wang

> -----Original Message-----
> From: Daniel Baluta
> Sent: Wednesday, January 30, 2019 9:30 PM
> To: shawnguo@kernel.org
> Cc: s.hauer@pengutronix.de; kernel@pengutronix.de; festevam@gmail.com;
> dl-linux-imx <linux-imx@nxp.com>; daniel.baluta@gmail.com; Aisheng Dong
> <aisheng.dong@nxp.com>; linux-arm-kernel@lists.infradead.org;
> linux-kernel@vger.kernel.org; S.j. Wang <shengjiu.wang@nxp.com>; Daniel
> Baluta <daniel.baluta@nxp.com>
> Subject: [PATCH v3] 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>

Regards
Dong Aisheng

> ---
> 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(+)
> 
> diff --git a/drivers/firmware/imx/misc.c b/drivers/firmware/imx/misc.c index
> 97f5424dbac9..4b56a587dacd 100644
> --- a/drivers/firmware/imx/misc.c
> +++ b/drivers/firmware/imx/misc.c
> @@ -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);
> diff --git a/include/linux/firmware/imx/svc/misc.h
> b/include/linux/firmware/imx/svc/misc.h
> index e21c49aba92f..031dd4d3c766 100644
> --- a/include/linux/firmware/imx/svc/misc.h
> +++ b/include/linux/firmware/imx/svc/misc.h
> @@ -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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] firmware: imx: Add support to start/stop a CPU
  2019-01-31  8:16 ` Aisheng Dong
@ 2019-02-04 19:18   ` Daniel Baluta
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Baluta @ 2019-02-04 19:18 UTC (permalink / raw)
  To: Aisheng Dong, shawnguo
  Cc: Daniel Baluta, s.hauer, kernel, festevam, dl-linux-imx,
	linux-arm-kernel, linux-kernel, S.j. Wang

Hi Shawn,

Care to have a look?

Daniel.

On Thu, Jan 31, 2019 at 10:16 AM Aisheng Dong <aisheng.dong@nxp.com> wrote:
>
> > -----Original Message-----
> > From: Daniel Baluta
> > Sent: Wednesday, January 30, 2019 9:30 PM
> > To: shawnguo@kernel.org
> > Cc: s.hauer@pengutronix.de; kernel@pengutronix.de; festevam@gmail.com;
> > dl-linux-imx <linux-imx@nxp.com>; daniel.baluta@gmail.com; Aisheng Dong
> > <aisheng.dong@nxp.com>; linux-arm-kernel@lists.infradead.org;
> > linux-kernel@vger.kernel.org; S.j. Wang <shengjiu.wang@nxp.com>; Daniel
> > Baluta <daniel.baluta@nxp.com>
> > Subject: [PATCH v3] 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>
>
> Regards
> Dong Aisheng
>
> > ---
> > 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(+)
> >
> > diff --git a/drivers/firmware/imx/misc.c b/drivers/firmware/imx/misc.c index
> > 97f5424dbac9..4b56a587dacd 100644
> > --- a/drivers/firmware/imx/misc.c
> > +++ b/drivers/firmware/imx/misc.c
> > @@ -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);
> > diff --git a/include/linux/firmware/imx/svc/misc.h
> > b/include/linux/firmware/imx/svc/misc.h
> > index e21c49aba92f..031dd4d3c766 100644
> > --- a/include/linux/firmware/imx/svc/misc.h
> > +++ b/include/linux/firmware/imx/svc/misc.h
> > @@ -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
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] firmware: imx: Add support to start/stop a CPU
  2019-01-30 13:30 [PATCH v3] firmware: imx: Add support to start/stop a CPU Daniel Baluta
  2019-01-31  8:16 ` Aisheng Dong
@ 2019-02-11  2:01 ` Shawn Guo
  1 sibling, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2019-02-11  2:01 UTC (permalink / raw)
  To: Daniel Baluta
  Cc: Aisheng Dong, daniel.baluta, s.hauer, linux-kernel, dl-linux-imx,
	kernel, festevam, S.j. Wang, linux-arm-kernel

On Wed, Jan 30, 2019 at 01:30:22PM +0000, Daniel Baluta wrote:
> This is done via RPC call to SCU.
> 
> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-11  2:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-30 13:30 [PATCH v3] firmware: imx: Add support to start/stop a CPU Daniel Baluta
2019-01-31  8:16 ` Aisheng Dong
2019-02-04 19:18   ` Daniel Baluta
2019-02-11  2:01 ` Shawn Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).