LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Shengjiu Wang <shengjiu.wang@gmail.com>
To: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Shengjiu Wang <shengjiu.wang@nxp.com>,
	Ohad Ben Cohen <ohad@wizery.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Rob Herring <robh+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Sascha Hauer <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	"open list:REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM" 
	<linux-remoteproc@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>,
	"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" 
	<linux-arm-kernel@lists.infradead.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 3/4] remoteproc: imx_dsp_rproc: Add remoteproc driver for DSP on i.MX
Date: Fri, 8 Oct 2021 09:53:18 +0800	[thread overview]
Message-ID: <CAA+D8AOmnZ6wWBzJe5imMcyoVE0fSiOyLpWb83bYPwadJ5O-Mg@mail.gmail.com> (raw)
In-Reply-To: <20211006162511.GA3370862@p14s>

Hi Mathieu

On Thu, Oct 7, 2021 at 12:25 AM Mathieu Poirier
<mathieu.poirier@linaro.org> wrote:
>
> Hi Shengjiu,
>
> This pachset doesn't apply to rproc-next, which is now located here[1].  The
> change is in linux-next but not in mainline yet.
>
> https://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux.git/log/?h=rproc-next

Ok, I will double check it and fix it.

>
> On Sun, Sep 26, 2021 at 11:07:09AM +0800, Shengjiu Wang wrote:
> > Provide a basic driver to control DSP processor found on NXP i.MX8QM,
> > i.MX8QXP, i.MX8MP and i.MX8ULP.
> >
> > Currently it is able to resolve addresses between DSP and main CPU,
> > start and stop the processor, suspend and resume.
> >
> > The communication between DSP and main CPU is based on mailbox, there
> > are three mailbox channels (tx, rx, rxdb).
> >
> > This driver was tested on NXP i.MX8QM, i.MX8QXP, i.MX8MP and i.MX8ULP.
> >
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > ---
> >  drivers/remoteproc/Kconfig         |   11 +
> >  drivers/remoteproc/Makefile        |    1 +
> >  drivers/remoteproc/imx_dsp_rproc.c | 1206 ++++++++++++++++++++++++++++
> >  3 files changed, 1218 insertions(+)
> >  create mode 100644 drivers/remoteproc/imx_dsp_rproc.c
> >
>
> [...]
>
> > +
> > +/**
> > + * imx_dsp_attach_pm_domains() - attach the power domains
> > + * @priv: private data pointer
> > + *
> > + * On i.MX8QM and i.MX8QXP there is multiple power domains
> > + * required, so need to link them.
> > + */
> > +static int imx_dsp_attach_pm_domains(struct imx_dsp_rproc *priv)
> > +{
> > +     struct device *dev = priv->rproc->dev.parent;
> > +     int ret, i;
> > +
> > +     priv->num_domains = of_count_phandle_with_args(dev->of_node,
> > +                                                    "power-domains",
> > +                                                    "#power-domain-cells");
> > +
> > +     /* If only one domain, then no need to link the device */
> > +     if (priv->num_domains <= 1)
> > +             return 0;
> > +
> > +     priv->pd_dev = devm_kmalloc_array(dev, priv->num_domains,
> > +                                       sizeof(*priv->pd_dev),
> > +                                       GFP_KERNEL);
> > +     if (!priv->pd_dev)
> > +             return -ENOMEM;
> > +
> > +     priv->pd_dev_link = devm_kmalloc_array(dev, priv->num_domains,
> > +                                            sizeof(*priv->pd_dev_link),
> > +                                            GFP_KERNEL);
> > +     if (!priv->pd_dev_link)
> > +             return -ENOMEM;
> > +
> > +     for (i = 0; i < priv->num_domains; i++) {
> > +             priv->pd_dev[i] = dev_pm_domain_attach_by_id(dev, i);
> > +             if (IS_ERR(priv->pd_dev[i])) {
> > +                     ret = PTR_ERR(priv->pd_dev[i]);
> > +                     goto detach_pm;
> > +             }
>
> I have pointed a problem with the error handling in the above during the
> previous review and it was not addressed.

I have considered your comments.  Actually when
dev_pm_domain_attach_by_id() return NULL, the device_link_add()
will break, I have added comments below, so above error handling
for dev_pm_domain_attach_by_id() is enough.

Best regards
Wang Shengjiu
>
> > +
> > +             /*
> > +              * device_link_add will check priv->pd_dev[i], if it is
> > +              * NULL, then will break.
> > +              */
> > +             priv->pd_dev_link[i] = device_link_add(dev,
> > +                                                    priv->pd_dev[i],
> > +                                                    DL_FLAG_STATELESS |
> > +                                                    DL_FLAG_PM_RUNTIME);
> > +             if (!priv->pd_dev_link[i]) {
> > +                     dev_pm_domain_detach(priv->pd_dev[i], false);
> > +                     ret = -EINVAL;
> > +                     goto detach_pm;
> > +             }
> > +     }
> > +
> > +     return 0;
> > +
> > +detach_pm:
> > +     while (--i >= 0) {
> > +             device_link_del(priv->pd_dev_link[i]);
> > +             dev_pm_domain_detach(priv->pd_dev[i], false);
> > +     }
> > +
> > +     return ret;
> > +}
> > +

  reply	other threads:[~2021-10-08  1:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-26  3:07 [PATCH v5 0/4] " Shengjiu Wang
2021-09-26  3:07 ` [PATCH v5 1/4] remoteproc: imx_rproc: Move common structure to header file Shengjiu Wang
2021-09-26  3:07 ` [PATCH v5 2/4] remoteproc: imx_rproc: Add IMX_RPROC_SCU_API method Shengjiu Wang
2021-09-26  3:07 ` [PATCH v5 3/4] remoteproc: imx_dsp_rproc: Add remoteproc driver for DSP on i.MX Shengjiu Wang
2021-10-06 16:25   ` Mathieu Poirier
2021-10-08  1:53     ` Shengjiu Wang [this message]
2021-10-08 15:42       ` Mathieu Poirier
2021-09-26  3:07 ` [PATCH v5 4/4] dt-bindings: dsp: fsl: update binding document for remote proc driver Shengjiu Wang
2021-09-29 22:40   ` Rob Herring
2021-09-30  2:34     ` Shengjiu Wang
2021-10-01 16:40       ` Rob Herring
2021-10-08  4:12         ` Shengjiu Wang
2021-10-08  7:19           ` Shengjiu Wang
2021-10-08 19:26             ` Rob Herring

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=CAA+D8AOmnZ6wWBzJe5imMcyoVE0fSiOyLpWb83bYPwadJ5O-Mg@mail.gmail.com \
    --to=shengjiu.wang@gmail.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=ohad@wizery.com \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=shengjiu.wang@nxp.com \
    --subject='Re: [PATCH v5 3/4] remoteproc: imx_dsp_rproc: Add remoteproc driver for DSP on i.MX' \
    /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

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).