[PATCH 2/6] remoteproc: imx_rproc: Move imx_rproc_dcfg closer to imx_rproc_of_match

Peng Fan posted 6 patches 1 day, 12 hours ago
[PATCH 2/6] remoteproc: imx_rproc: Move imx_rproc_dcfg closer to imx_rproc_of_match
Posted by Peng Fan 1 day, 12 hours ago
Move the imx_rproc_dcfg structure definitions closer to imx_rproc_of_match
to prepare for adding start/stop/detect_mode ops for each i.MX variant.

This relocation avoids the need to declare function prototypes such as
'static int imx_rproc_xtr_mbox_init(struct rproc *rproc, bool tx_block)'
at the beginning of the file, improving code organization and readability.

No functional changes.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/remoteproc/imx_rproc.c | 158 ++++++++++++++++++++---------------------
 1 file changed, 79 insertions(+), 79 deletions(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 5cdc5045e57566e817170ed3c708dad6108d2e46..af7b69d750deed734668cb413b29378e5ca7c64e 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -285,85 +285,6 @@ static const struct imx_rproc_att imx_rproc_att_imx6sx[] = {
 	{ 0x80000000, 0x80000000, 0x60000000, 0 },
 };
 
-static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn_mmio = {
-	.src_reg	= IMX7D_SRC_SCR,
-	.src_mask	= IMX7D_M4_RST_MASK,
-	.src_start	= IMX7D_M4_START,
-	.src_stop	= IMX8M_M7_STOP,
-	.gpr_reg	= IMX8M_GPR22,
-	.gpr_wait	= IMX8M_GPR22_CM7_CPUWAIT,
-	.att		= imx_rproc_att_imx8mn,
-	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mn),
-	.method		= IMX_RPROC_MMIO,
-};
-
-static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn = {
-	.att		= imx_rproc_att_imx8mn,
-	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mn),
-	.method		= IMX_RPROC_SMC,
-};
-
-static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = {
-	.src_reg	= IMX7D_SRC_SCR,
-	.src_mask	= IMX7D_M4_RST_MASK,
-	.src_start	= IMX7D_M4_START,
-	.src_stop	= IMX7D_M4_STOP,
-	.att		= imx_rproc_att_imx8mq,
-	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mq),
-	.method		= IMX_RPROC_MMIO,
-};
-
-static const struct imx_rproc_dcfg imx_rproc_cfg_imx8qm = {
-	.att            = imx_rproc_att_imx8qm,
-	.att_size       = ARRAY_SIZE(imx_rproc_att_imx8qm),
-	.method         = IMX_RPROC_SCU_API,
-};
-
-static const struct imx_rproc_dcfg imx_rproc_cfg_imx8qxp = {
-	.att		= imx_rproc_att_imx8qxp,
-	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8qxp),
-	.method		= IMX_RPROC_SCU_API,
-};
-
-static const struct imx_rproc_dcfg imx_rproc_cfg_imx8ulp = {
-	.att		= imx_rproc_att_imx8ulp,
-	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8ulp),
-	.method		= IMX_RPROC_NONE,
-};
-
-static const struct imx_rproc_dcfg imx_rproc_cfg_imx7ulp = {
-	.att		= imx_rproc_att_imx7ulp,
-	.att_size	= ARRAY_SIZE(imx_rproc_att_imx7ulp),
-	.method		= IMX_RPROC_NONE,
-	.flags		= IMX_RPROC_NEED_SYSTEM_OFF,
-};
-
-static const struct imx_rproc_dcfg imx_rproc_cfg_imx7d = {
-	.src_reg	= IMX7D_SRC_SCR,
-	.src_mask	= IMX7D_M4_RST_MASK,
-	.src_start	= IMX7D_M4_START,
-	.src_stop	= IMX7D_M4_STOP,
-	.att		= imx_rproc_att_imx7d,
-	.att_size	= ARRAY_SIZE(imx_rproc_att_imx7d),
-	.method		= IMX_RPROC_MMIO,
-};
-
-static const struct imx_rproc_dcfg imx_rproc_cfg_imx6sx = {
-	.src_reg	= IMX6SX_SRC_SCR,
-	.src_mask	= IMX6SX_M4_RST_MASK,
-	.src_start	= IMX6SX_M4_START,
-	.src_stop	= IMX6SX_M4_STOP,
-	.att		= imx_rproc_att_imx6sx,
-	.att_size	= ARRAY_SIZE(imx_rproc_att_imx6sx),
-	.method		= IMX_RPROC_MMIO,
-};
-
-static const struct imx_rproc_dcfg imx_rproc_cfg_imx93 = {
-	.att		= imx_rproc_att_imx93,
-	.att_size	= ARRAY_SIZE(imx_rproc_att_imx93),
-	.method		= IMX_RPROC_SMC,
-};
-
 static int imx_rproc_start(struct rproc *rproc)
 {
 	struct imx_rproc *priv = rproc->priv;
@@ -1222,6 +1143,85 @@ static void imx_rproc_remove(struct platform_device *pdev)
 	destroy_workqueue(priv->workqueue);
 }
 
+static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn_mmio = {
+	.src_reg	= IMX7D_SRC_SCR,
+	.src_mask	= IMX7D_M4_RST_MASK,
+	.src_start	= IMX7D_M4_START,
+	.src_stop	= IMX8M_M7_STOP,
+	.gpr_reg	= IMX8M_GPR22,
+	.gpr_wait	= IMX8M_GPR22_CM7_CPUWAIT,
+	.att		= imx_rproc_att_imx8mn,
+	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mn),
+	.method		= IMX_RPROC_MMIO,
+};
+
+static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn = {
+	.att		= imx_rproc_att_imx8mn,
+	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mn),
+	.method		= IMX_RPROC_SMC,
+};
+
+static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = {
+	.src_reg	= IMX7D_SRC_SCR,
+	.src_mask	= IMX7D_M4_RST_MASK,
+	.src_start	= IMX7D_M4_START,
+	.src_stop	= IMX7D_M4_STOP,
+	.att		= imx_rproc_att_imx8mq,
+	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mq),
+	.method		= IMX_RPROC_MMIO,
+};
+
+static const struct imx_rproc_dcfg imx_rproc_cfg_imx8qm = {
+	.att            = imx_rproc_att_imx8qm,
+	.att_size       = ARRAY_SIZE(imx_rproc_att_imx8qm),
+	.method         = IMX_RPROC_SCU_API,
+};
+
+static const struct imx_rproc_dcfg imx_rproc_cfg_imx8qxp = {
+	.att		= imx_rproc_att_imx8qxp,
+	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8qxp),
+	.method		= IMX_RPROC_SCU_API,
+};
+
+static const struct imx_rproc_dcfg imx_rproc_cfg_imx8ulp = {
+	.att		= imx_rproc_att_imx8ulp,
+	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8ulp),
+	.method		= IMX_RPROC_NONE,
+};
+
+static const struct imx_rproc_dcfg imx_rproc_cfg_imx7ulp = {
+	.att		= imx_rproc_att_imx7ulp,
+	.att_size	= ARRAY_SIZE(imx_rproc_att_imx7ulp),
+	.method		= IMX_RPROC_NONE,
+	.flags		= IMX_RPROC_NEED_SYSTEM_OFF,
+};
+
+static const struct imx_rproc_dcfg imx_rproc_cfg_imx7d = {
+	.src_reg	= IMX7D_SRC_SCR,
+	.src_mask	= IMX7D_M4_RST_MASK,
+	.src_start	= IMX7D_M4_START,
+	.src_stop	= IMX7D_M4_STOP,
+	.att		= imx_rproc_att_imx7d,
+	.att_size	= ARRAY_SIZE(imx_rproc_att_imx7d),
+	.method		= IMX_RPROC_MMIO,
+};
+
+static const struct imx_rproc_dcfg imx_rproc_cfg_imx6sx = {
+	.src_reg	= IMX6SX_SRC_SCR,
+	.src_mask	= IMX6SX_M4_RST_MASK,
+	.src_start	= IMX6SX_M4_START,
+	.src_stop	= IMX6SX_M4_STOP,
+	.att		= imx_rproc_att_imx6sx,
+	.att_size	= ARRAY_SIZE(imx_rproc_att_imx6sx),
+	.method		= IMX_RPROC_MMIO,
+};
+
+static const struct imx_rproc_dcfg imx_rproc_cfg_imx93 = {
+	.att		= imx_rproc_att_imx93,
+	.att_size	= ARRAY_SIZE(imx_rproc_att_imx93),
+	.method		= IMX_RPROC_SMC,
+};
+
 static const struct of_device_id imx_rproc_of_match[] = {
 	{ .compatible = "fsl,imx7ulp-cm4", .data = &imx_rproc_cfg_imx7ulp },
 	{ .compatible = "fsl,imx7d-cm4", .data = &imx_rproc_cfg_imx7d },

-- 
2.37.1
Re: [PATCH 2/6] remoteproc: imx_rproc: Move imx_rproc_dcfg closer to imx_rproc_of_match
Posted by Frank Li 1 day, 10 hours ago
On Mon, Sep 08, 2025 at 09:07:35PM +0800, Peng Fan wrote:
> Move the imx_rproc_dcfg structure definitions closer to imx_rproc_of_match
> to prepare for adding start/stop/detect_mode ops for each i.MX variant.
>
> This relocation avoids the need to declare function prototypes such as
> 'static int imx_rproc_xtr_mbox_init(struct rproc *rproc, bool tx_block)'
> at the beginning of the file, improving code organization and readability.
>
> No functional changes.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> ---
>  drivers/remoteproc/imx_rproc.c | 158 ++++++++++++++++++++---------------------
>  1 file changed, 79 insertions(+), 79 deletions(-)
>
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index 5cdc5045e57566e817170ed3c708dad6108d2e46..af7b69d750deed734668cb413b29378e5ca7c64e 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -285,85 +285,6 @@ static const struct imx_rproc_att imx_rproc_att_imx6sx[] = {
>  	{ 0x80000000, 0x80000000, 0x60000000, 0 },
>  };
>
> -static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn_mmio = {
> -	.src_reg	= IMX7D_SRC_SCR,
> -	.src_mask	= IMX7D_M4_RST_MASK,
> -	.src_start	= IMX7D_M4_START,
> -	.src_stop	= IMX8M_M7_STOP,
> -	.gpr_reg	= IMX8M_GPR22,
> -	.gpr_wait	= IMX8M_GPR22_CM7_CPUWAIT,
> -	.att		= imx_rproc_att_imx8mn,
> -	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mn),
> -	.method		= IMX_RPROC_MMIO,
> -};
> -
> -static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn = {
> -	.att		= imx_rproc_att_imx8mn,
> -	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mn),
> -	.method		= IMX_RPROC_SMC,
> -};
> -
> -static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = {
> -	.src_reg	= IMX7D_SRC_SCR,
> -	.src_mask	= IMX7D_M4_RST_MASK,
> -	.src_start	= IMX7D_M4_START,
> -	.src_stop	= IMX7D_M4_STOP,
> -	.att		= imx_rproc_att_imx8mq,
> -	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mq),
> -	.method		= IMX_RPROC_MMIO,
> -};
> -
> -static const struct imx_rproc_dcfg imx_rproc_cfg_imx8qm = {
> -	.att            = imx_rproc_att_imx8qm,
> -	.att_size       = ARRAY_SIZE(imx_rproc_att_imx8qm),
> -	.method         = IMX_RPROC_SCU_API,
> -};
> -
> -static const struct imx_rproc_dcfg imx_rproc_cfg_imx8qxp = {
> -	.att		= imx_rproc_att_imx8qxp,
> -	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8qxp),
> -	.method		= IMX_RPROC_SCU_API,
> -};
> -
> -static const struct imx_rproc_dcfg imx_rproc_cfg_imx8ulp = {
> -	.att		= imx_rproc_att_imx8ulp,
> -	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8ulp),
> -	.method		= IMX_RPROC_NONE,
> -};
> -
> -static const struct imx_rproc_dcfg imx_rproc_cfg_imx7ulp = {
> -	.att		= imx_rproc_att_imx7ulp,
> -	.att_size	= ARRAY_SIZE(imx_rproc_att_imx7ulp),
> -	.method		= IMX_RPROC_NONE,
> -	.flags		= IMX_RPROC_NEED_SYSTEM_OFF,
> -};
> -
> -static const struct imx_rproc_dcfg imx_rproc_cfg_imx7d = {
> -	.src_reg	= IMX7D_SRC_SCR,
> -	.src_mask	= IMX7D_M4_RST_MASK,
> -	.src_start	= IMX7D_M4_START,
> -	.src_stop	= IMX7D_M4_STOP,
> -	.att		= imx_rproc_att_imx7d,
> -	.att_size	= ARRAY_SIZE(imx_rproc_att_imx7d),
> -	.method		= IMX_RPROC_MMIO,
> -};
> -
> -static const struct imx_rproc_dcfg imx_rproc_cfg_imx6sx = {
> -	.src_reg	= IMX6SX_SRC_SCR,
> -	.src_mask	= IMX6SX_M4_RST_MASK,
> -	.src_start	= IMX6SX_M4_START,
> -	.src_stop	= IMX6SX_M4_STOP,
> -	.att		= imx_rproc_att_imx6sx,
> -	.att_size	= ARRAY_SIZE(imx_rproc_att_imx6sx),
> -	.method		= IMX_RPROC_MMIO,
> -};
> -
> -static const struct imx_rproc_dcfg imx_rproc_cfg_imx93 = {
> -	.att		= imx_rproc_att_imx93,
> -	.att_size	= ARRAY_SIZE(imx_rproc_att_imx93),
> -	.method		= IMX_RPROC_SMC,
> -};
> -
>  static int imx_rproc_start(struct rproc *rproc)
>  {
>  	struct imx_rproc *priv = rproc->priv;
> @@ -1222,6 +1143,85 @@ static void imx_rproc_remove(struct platform_device *pdev)
>  	destroy_workqueue(priv->workqueue);
>  }
>
> +static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn_mmio = {
> +	.src_reg	= IMX7D_SRC_SCR,
> +	.src_mask	= IMX7D_M4_RST_MASK,
> +	.src_start	= IMX7D_M4_START,
> +	.src_stop	= IMX8M_M7_STOP,
> +	.gpr_reg	= IMX8M_GPR22,
> +	.gpr_wait	= IMX8M_GPR22_CM7_CPUWAIT,
> +	.att		= imx_rproc_att_imx8mn,
> +	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mn),
> +	.method		= IMX_RPROC_MMIO,
> +};
> +
> +static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mn = {
> +	.att		= imx_rproc_att_imx8mn,
> +	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mn),
> +	.method		= IMX_RPROC_SMC,
> +};
> +
> +static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = {
> +	.src_reg	= IMX7D_SRC_SCR,
> +	.src_mask	= IMX7D_M4_RST_MASK,
> +	.src_start	= IMX7D_M4_START,
> +	.src_stop	= IMX7D_M4_STOP,
> +	.att		= imx_rproc_att_imx8mq,
> +	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8mq),
> +	.method		= IMX_RPROC_MMIO,
> +};
> +
> +static const struct imx_rproc_dcfg imx_rproc_cfg_imx8qm = {
> +	.att            = imx_rproc_att_imx8qm,
> +	.att_size       = ARRAY_SIZE(imx_rproc_att_imx8qm),
> +	.method         = IMX_RPROC_SCU_API,
> +};
> +
> +static const struct imx_rproc_dcfg imx_rproc_cfg_imx8qxp = {
> +	.att		= imx_rproc_att_imx8qxp,
> +	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8qxp),
> +	.method		= IMX_RPROC_SCU_API,
> +};
> +
> +static const struct imx_rproc_dcfg imx_rproc_cfg_imx8ulp = {
> +	.att		= imx_rproc_att_imx8ulp,
> +	.att_size	= ARRAY_SIZE(imx_rproc_att_imx8ulp),
> +	.method		= IMX_RPROC_NONE,
> +};
> +
> +static const struct imx_rproc_dcfg imx_rproc_cfg_imx7ulp = {
> +	.att		= imx_rproc_att_imx7ulp,
> +	.att_size	= ARRAY_SIZE(imx_rproc_att_imx7ulp),
> +	.method		= IMX_RPROC_NONE,
> +	.flags		= IMX_RPROC_NEED_SYSTEM_OFF,
> +};
> +
> +static const struct imx_rproc_dcfg imx_rproc_cfg_imx7d = {
> +	.src_reg	= IMX7D_SRC_SCR,
> +	.src_mask	= IMX7D_M4_RST_MASK,
> +	.src_start	= IMX7D_M4_START,
> +	.src_stop	= IMX7D_M4_STOP,
> +	.att		= imx_rproc_att_imx7d,
> +	.att_size	= ARRAY_SIZE(imx_rproc_att_imx7d),
> +	.method		= IMX_RPROC_MMIO,
> +};
> +
> +static const struct imx_rproc_dcfg imx_rproc_cfg_imx6sx = {
> +	.src_reg	= IMX6SX_SRC_SCR,
> +	.src_mask	= IMX6SX_M4_RST_MASK,
> +	.src_start	= IMX6SX_M4_START,
> +	.src_stop	= IMX6SX_M4_STOP,
> +	.att		= imx_rproc_att_imx6sx,
> +	.att_size	= ARRAY_SIZE(imx_rproc_att_imx6sx),
> +	.method		= IMX_RPROC_MMIO,
> +};
> +
> +static const struct imx_rproc_dcfg imx_rproc_cfg_imx93 = {
> +	.att		= imx_rproc_att_imx93,
> +	.att_size	= ARRAY_SIZE(imx_rproc_att_imx93),
> +	.method		= IMX_RPROC_SMC,
> +};
> +
>  static const struct of_device_id imx_rproc_of_match[] = {
>  	{ .compatible = "fsl,imx7ulp-cm4", .data = &imx_rproc_cfg_imx7ulp },
>  	{ .compatible = "fsl,imx7d-cm4", .data = &imx_rproc_cfg_imx7d },
>
> --
> 2.37.1
>