mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Peng Fan <peng.fan@nxp.com>,
	"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 07:47:20 +0100	[thread overview]
Message-ID: <e2ba35db-d9dc-83c1-0261-867a706dd285@pengutronix.de> (raw)
In-Reply-To: <AM0PR04MB4481BD4CC61A8E30B8ECB68488E40@AM0PR04MB4481.eurprd04.prod.outlook.com>



On 03.03.20 07:27, Peng Fan wrote:
> 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.

yes

> I just need to assign init = imx_mu_init_generic; And use priv->dcfg->init(priv),
> right?

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&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 |

Kind regards,
Oleksij Rempel

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2020-03-03  6:47 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
2020-03-03  6:47       ` Oleksij Rempel [this message]
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=e2ba35db-d9dc-83c1-0261-867a706dd285@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --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=peng.fan@nxp.com \
    --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

all inboxes | Powered by JetHome®