Thread (10 messages) 10 messages, 2 authors, 2020-03-03

RE: [PATCH V4 2/4] mailbox: imx: restructure code to make easy for new MU

From: Peng Fan <peng.fan@nxp.com>
Date: 2020-03-03 06:27:36
Also in: lkml

Hi Oleksij,
Subject: Re: [PATCH V4 2/4] mailbox: imx: restructure code to make easy for
new MU



On 03.03.20 02:52, peng.fan@nxp.com wrote:
quoted
From: Peng Fan <peng.fan@nxp.com>

Add imx_mu_generic_tx for data send and imx_mu_generic_rx for
interrupt data receive.

Pack original mu chans related code into imx_mu_init_generic

With these, it will be a bit easy to introduce i.MX8/8X SCU type MU
dedicated to communicate with SCU.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
V4:
  Pack MU chans init to imx_mu_init_generic
V3:
  New patch, restructure code.

  drivers/mailbox/imx-mailbox.c | 127
++++++++++++++++++++++++++----------------
quoted
  1 file changed, 78 insertions(+), 49 deletions(-)
diff --git a/drivers/mailbox/imx-mailbox.c
b/drivers/mailbox/imx-mailbox.c index 2cdcdc5f1119..e98f3550f995
100644
--- a/drivers/mailbox/imx-mailbox.c
+++ b/drivers/mailbox/imx-mailbox.c
@@ -36,7 +36,12 @@ enum imx_mu_chan_type {
  	IMX_MU_TYPE_RXDB,	/* Rx doorbell */
  };

+struct imx_mu_priv;
+struct imx_mu_con_priv;
Please move imx_mu_dcfg below struct imx_mu_priv. It was my mistaked, i
missed this point.
That's fine.
quoted
  struct imx_mu_dcfg {
+	int (*tx)(struct imx_mu_priv *priv, struct imx_mu_con_priv *cp, void
*data);
quoted
+	int (*rx)(struct imx_mu_priv *priv, struct imx_mu_con_priv *cp);
please add init function here as well.
ok. I'll add as below:

int (*init)(struct imx_mu_priv *priv);
quoted
  	u32	xTR[4];		/* Transmit Registers */
  	u32	xRR[4];		/* Receive Registers */
  	u32	xSR;		/* Status Register */
[....]
quoted
-
  	priv->side_b = of_property_read_bool(np, "fsl,mu-side-b");

+	imx_mu_init_generic(priv);
please use priv->dcfg->init(priv);
I assume you agree the code I packed in imx_mu_init_generic.
I just need to assign init = imx_mu_init_generic; And use priv->dcfg->init(priv),
right?

Thanks,
Peng.
quoted
+
  	spin_lock_init(&priv->xcr_lock);

  	priv->mbox.dev = dev;
  	priv->mbox.ops = &imx_mu_ops;
  	priv->mbox.chans = priv->mbox_chans;
-	priv->mbox.num_chans = IMX_MU_CHANS;
-	priv->mbox.of_xlate = imx_mu_xlate;
  	priv->mbox.txdone_irq = true;

  	platform_set_drvdata(pdev, priv);

-	imx_mu_init_generic(priv);
-
  	return devm_mbox_controller_register(dev, &priv->mbox);
  }
@@ -367,6 +378,24 @@ static int imx_mu_remove(struct platform_device
*pdev)
quoted
  	return 0;
  }

+static const struct imx_mu_dcfg imx_mu_cfg_imx6sx = {
+	.tx	= imx_mu_generic_tx,
+	.rx	= imx_mu_generic_rx,
+	.xTR	= {0x0, 0x4, 0x8, 0xc},
+	.xRR	= {0x10, 0x14, 0x18, 0x1c},
+	.xSR	= 0x20,
+	.xCR	= 0x24,
+};
+
+static const struct imx_mu_dcfg imx_mu_cfg_imx7ulp = {
+	.tx	= imx_mu_generic_tx,
+	.rx	= imx_mu_generic_rx,
+	.xTR	= {0x20, 0x24, 0x28, 0x2c},
+	.xRR	= {0x40, 0x44, 0x48, 0x4c},
+	.xSR	= 0x60,
+	.xCR	= 0x64,
+};
+
  static const struct of_device_id imx_mu_dt_ids[] = {
  	{ .compatible = "fsl,imx7ulp-mu", .data = &imx_mu_cfg_imx7ulp },
  	{ .compatible = "fsl,imx6sx-mu", .data = &imx_mu_cfg_imx6sx },
Kind regards,
Oleksij Rempel

--
Pengutronix e.K.                           |
|
Industrial Linux Solutions                 |
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.p
engutronix.de%2F&amp;data=02%7C01%7Cpeng.fan%40nxp.com%7Ce59c2b
ea2efd47dc8fb408d7bf39f68c%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C
0%7C0%7C637188127988825530&amp;sdata=d%2FN82zkoGy7m3yXf6Q8h9
OWYs0ldZlozDzPwAnOMDkI%3D&amp;reserved=0  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0
|
Amtsgericht Hildesheim, HRA 2686           | Fax:
+49-5121-206917-5555 |
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help