[PATCH v9 04/26] remoteproc: k3-{m4/dsp}: Align internal rproc data structure with R5

Beleswar Padhi posted 26 patches 9 months ago
There is a newer version of this series
[PATCH v9 04/26] remoteproc: k3-{m4/dsp}: Align internal rproc data structure with R5
Posted by Beleswar Padhi 9 months ago
Introduce a void pointer in the k3_{m4/dsp}_rproc internal data
structure which can be used to point to any private data needed by the
driver. Currently, the M4/DSP drivers do not have any private data, so
the pointer can be left pointing to NULL. Additionally, add a pointer to
the rproc struct within k3_m4_rproc internal struct. This is done to
align the data structures with R5 driver which can be factored out at a
later stage.

Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
---
 drivers/remoteproc/ti_k3_dsp_remoteproc.c | 2 ++
 drivers/remoteproc/ti_k3_m4_remoteproc.c  | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c b/drivers/remoteproc/ti_k3_dsp_remoteproc.c
index a695890254ff..31e43e49f1e4 100644
--- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c
+++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c
@@ -76,6 +76,7 @@ struct k3_dsp_dev_data {
  * @ti_sci_id: TI-SCI device identifier
  * @mbox: mailbox channel handle
  * @client: mailbox client to request the mailbox channel
+ * @priv: Remote processor private data
  */
 struct k3_dsp_rproc {
 	struct device *dev;
@@ -91,6 +92,7 @@ struct k3_dsp_rproc {
 	u32 ti_sci_id;
 	struct mbox_chan *mbox;
 	struct mbox_client client;
+	void *priv;
 };
 
 /**
diff --git a/drivers/remoteproc/ti_k3_m4_remoteproc.c b/drivers/remoteproc/ti_k3_m4_remoteproc.c
index a16fb165fced..d0ee7a8d460d 100644
--- a/drivers/remoteproc/ti_k3_m4_remoteproc.c
+++ b/drivers/remoteproc/ti_k3_m4_remoteproc.c
@@ -50,6 +50,7 @@ struct k3_m4_rproc_mem_data {
 /**
  * struct k3_m4_rproc - k3 remote processor driver structure
  * @dev: cached device pointer
+ * @rproc: remoteproc device handle
  * @mem: internal memory regions data
  * @num_mems: number of internal memory regions
  * @rmem: reserved memory regions data
@@ -60,9 +61,11 @@ struct k3_m4_rproc_mem_data {
  * @ti_sci_id: TI-SCI device identifier
  * @mbox: mailbox channel handle
  * @client: mailbox client to request the mailbox channel
+ * @priv: Remote processor private data
  */
 struct k3_m4_rproc {
 	struct device *dev;
+	struct rproc *rproc;
 	struct k3_m4_rproc_mem *mem;
 	int num_mems;
 	struct k3_m4_rproc_mem *rmem;
@@ -73,6 +76,7 @@ struct k3_m4_rproc {
 	u32 ti_sci_id;
 	struct mbox_chan *mbox;
 	struct mbox_client client;
+	void *priv;
 };
 
 /**
@@ -578,6 +582,7 @@ static int k3_m4_rproc_probe(struct platform_device *pdev)
 	rproc->recovery_disabled = true;
 	kproc = rproc->priv;
 	kproc->dev = dev;
+	kproc->rproc = rproc;
 	platform_set_drvdata(pdev, rproc);
 
 	kproc->ti_sci = devm_ti_sci_get_by_phandle(dev, "ti,sci");
-- 
2.34.1
Re: [PATCH v9 04/26] remoteproc: k3-{m4/dsp}: Align internal rproc data structure with R5
Posted by Andrew Davis 8 months, 2 weeks ago
On 3/17/25 7:06 AM, Beleswar Padhi wrote:
> Introduce a void pointer in the k3_{m4/dsp}_rproc internal data
> structure which can be used to point to any private data needed by the
> driver. Currently, the M4/DSP drivers do not have any private data, so
> the pointer can be left pointing to NULL. Additionally, add a pointer to
> the rproc struct within k3_m4_rproc internal struct. This is done to
> align the data structures with R5 driver which can be factored out at a
> later stage.
> 

This does two things, even if trivial things, just make this into two patches.

Andrew

> Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
> ---
>   drivers/remoteproc/ti_k3_dsp_remoteproc.c | 2 ++
>   drivers/remoteproc/ti_k3_m4_remoteproc.c  | 5 +++++
>   2 files changed, 7 insertions(+)
> 
> diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c b/drivers/remoteproc/ti_k3_dsp_remoteproc.c
> index a695890254ff..31e43e49f1e4 100644
> --- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c
> +++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c
> @@ -76,6 +76,7 @@ struct k3_dsp_dev_data {
>    * @ti_sci_id: TI-SCI device identifier
>    * @mbox: mailbox channel handle
>    * @client: mailbox client to request the mailbox channel
> + * @priv: Remote processor private data
>    */
>   struct k3_dsp_rproc {
>   	struct device *dev;
> @@ -91,6 +92,7 @@ struct k3_dsp_rproc {
>   	u32 ti_sci_id;
>   	struct mbox_chan *mbox;
>   	struct mbox_client client;
> +	void *priv;
>   };
>   
>   /**
> diff --git a/drivers/remoteproc/ti_k3_m4_remoteproc.c b/drivers/remoteproc/ti_k3_m4_remoteproc.c
> index a16fb165fced..d0ee7a8d460d 100644
> --- a/drivers/remoteproc/ti_k3_m4_remoteproc.c
> +++ b/drivers/remoteproc/ti_k3_m4_remoteproc.c
> @@ -50,6 +50,7 @@ struct k3_m4_rproc_mem_data {
>   /**
>    * struct k3_m4_rproc - k3 remote processor driver structure
>    * @dev: cached device pointer
> + * @rproc: remoteproc device handle
>    * @mem: internal memory regions data
>    * @num_mems: number of internal memory regions
>    * @rmem: reserved memory regions data
> @@ -60,9 +61,11 @@ struct k3_m4_rproc_mem_data {
>    * @ti_sci_id: TI-SCI device identifier
>    * @mbox: mailbox channel handle
>    * @client: mailbox client to request the mailbox channel
> + * @priv: Remote processor private data
>    */
>   struct k3_m4_rproc {
>   	struct device *dev;
> +	struct rproc *rproc;
>   	struct k3_m4_rproc_mem *mem;
>   	int num_mems;
>   	struct k3_m4_rproc_mem *rmem;
> @@ -73,6 +76,7 @@ struct k3_m4_rproc {
>   	u32 ti_sci_id;
>   	struct mbox_chan *mbox;
>   	struct mbox_client client;
> +	void *priv;
>   };
>   
>   /**
> @@ -578,6 +582,7 @@ static int k3_m4_rproc_probe(struct platform_device *pdev)
>   	rproc->recovery_disabled = true;
>   	kproc = rproc->priv;
>   	kproc->dev = dev;
> +	kproc->rproc = rproc;
>   	platform_set_drvdata(pdev, rproc);
>   
>   	kproc->ti_sci = devm_ti_sci_get_by_phandle(dev, "ti,sci");