From: Peng Fan <peng.fan@nxp.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>,
"shawnguo@kernel.org" <shawnguo@kernel.org>,
"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
"jassisinghbrar@gmail.com" <jassisinghbrar@gmail.com>
Cc: Aisheng Dong <aisheng.dong@nxp.com>,
Anson Huang <anson.huang@nxp.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
dl-linux-imx <linux-imx@nxp.com>,
"kernel@pengutronix.de" <kernel@pengutronix.de>,
Leonard Crestez <leonard.crestez@nxp.com>,
"festevam@gmail.com" <festevam@gmail.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: RE: [PATCH V4 2/4] mailbox: imx: restructure code to make easy for new MU
Date: Tue, 3 Mar 2020 06:27:29 +0000 [thread overview]
Message-ID: <AM0PR04MB4481BD4CC61A8E30B8ECB68488E40@AM0PR04MB4481.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <f4b3384d-ee24-e254-2799-69e57625995b@pengutronix.de>
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:
> > 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
> ++++++++++++++++++++++++++----------------
> > 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.
>
> > struct imx_mu_dcfg {
> > + int (*tx)(struct imx_mu_priv *priv, struct imx_mu_con_priv *cp, void
> *data);
> > + 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);
>
> > u32 xTR[4]; /* Transmit Registers */
> > u32 xRR[4]; /* Receive Registers */
> > u32 xSR; /* Status Register */
[....]
> > -
> > 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.
>
> > +
> > 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)
> > 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&data=02%7C01%7Cpeng.fan%40nxp.com%7Ce59c2b
> ea2efd47dc8fb408d7bf39f68c%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C
> 0%7C0%7C637188127988825530&sdata=d%2FN82zkoGy7m3yXf6Q8h9
> OWYs0ldZlozDzPwAnOMDkI%3D&reserved=0 |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0
> |
> Amtsgericht Hildesheim, HRA 2686 | Fax:
> +49-5121-206917-5555 |
next prev parent reply other threads:[~2020-03-03 6:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-03 1:52 [PATCH V4 0/4] mailbox/firmware: imx: support SCU channel type peng.fan
2020-03-03 1:52 ` [PATCH V4 1/4] dt-bindings: mailbox: imx-mu: add SCU MU support peng.fan
2020-03-03 1:52 ` [PATCH V4 2/4] mailbox: imx: restructure code to make easy for new MU peng.fan
2020-03-03 6:13 ` Oleksij Rempel
2020-03-03 6:27 ` Peng Fan [this message]
2020-03-03 6:47 ` Oleksij Rempel
2020-03-03 1:52 ` [PATCH V4 3/4] mailbox: imx: add SCU MU support peng.fan
2020-03-03 6:46 ` Oleksij Rempel
2020-03-03 6:53 ` Peng Fan
2020-03-03 1:53 ` [PATCH V4 4/4] firmware: imx-scu: Support one TX and one RX peng.fan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AM0PR04MB4481BD4CC61A8E30B8ECB68488E40@AM0PR04MB4481.eurprd04.prod.outlook.com \
--to=peng.fan@nxp.com \
--cc=aisheng.dong@nxp.com \
--cc=anson.huang@nxp.com \
--cc=festevam@gmail.com \
--cc=jassisinghbrar@gmail.com \
--cc=kernel@pengutronix.de \
--cc=leonard.crestez@nxp.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).