public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@kernel.org>
To: Mikko Perttunen <mperttunen@nvidia.com>
Cc: "Bjorn Helgaas" <bhelgaas@google.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Jon Hunter" <jonathanh@nvidia.com>,
	linux-pci@vger.kernel.org, devicetree@vger.kernel.org,
	linux-tegra@vger.kernel.org
Subject: Re: [PATCH v2 2/5] firmware: tegra: bpmp: Add tegra_bpmp_get_with_id() function
Date: Thu, 26 Mar 2026 11:00:24 +0100	[thread overview]
Message-ID: <acUDq3bt7P2vL5tg@orome> (raw)
In-Reply-To: <24777801.6Emhk5qWAg@senjougahara>

[-- Attachment #1: Type: text/plain, Size: 2601 bytes --]

On Wed, Mar 25, 2026 at 11:28:41AM +0900, Mikko Perttunen wrote:
> On Saturday, March 21, 2026 7:54 AM Thierry Reding wrote:
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > Some device tree bindings need to specify a parameter along with a BPMP
> > phandle reference to designate the ID associated with a given controller
> > that needs to interoperate with BPMP. Typically this is specified as an
> > extra cell in the nvidia,bpmp property, so add a helper to parse this ID
> > while resolving the phandle reference.
> > 
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > ---
> >  drivers/firmware/tegra/bpmp.c | 34 ++++++++++++++++++++++++++++++++++
> >  include/soc/tegra/bpmp.h      |  1 +
> >  2 files changed, 35 insertions(+)
> > 
> > diff --git a/drivers/firmware/tegra/bpmp.c b/drivers/firmware/tegra/bpmp.c
> > index e74bba7ccc44..753472b53bd8 100644
> > --- a/drivers/firmware/tegra/bpmp.c
> > +++ b/drivers/firmware/tegra/bpmp.c
> > @@ -32,6 +32,40 @@ channel_to_ops(struct tegra_bpmp_channel *channel)
> >  	return bpmp->soc->ops;
> >  }
> >  
> > +struct tegra_bpmp *tegra_bpmp_get_with_id(struct device *dev, unsigned int 
> *id)
> > +{
> > +	struct platform_device *pdev;
> > +	struct of_phandle_args args;
> > +	struct tegra_bpmp *bpmp;
> > +	int err;
> > +
> > +	err = __of_parse_phandle_with_args(dev->of_node, "nvidia,bpmp", NULL,
> > +					   1, 0, &args);
> > +	if (err < 0)
> > +		return ERR_PTR(err);
> > +
> > +	pdev = of_find_device_by_node(args.np);
> > +	if (!pdev) {
> > +		bpmp = ERR_PTR(-ENODEV);
> > +		goto put;
> > +	}
> > +
> > +	bpmp = platform_get_drvdata(pdev);
> > +	if (!bpmp) {
> > +		bpmp = ERR_PTR(-EPROBE_DEFER);
> > +		put_device(&pdev->dev);
> > +		goto put;
> > +	}
> > +
> > +	if (id)
> > +		*id = args.args[0];
> > +
> > +put:
> > +	of_node_put(args.np);
> > +	return bpmp;
> > +}
> > +EXPORT_SYMBOL_GPL(tegra_bpmp_get_with_id);
> > +
> >  struct tegra_bpmp *tegra_bpmp_get(struct device *dev)
> >  {
> >  	struct platform_device *pdev;
> > diff --git a/include/soc/tegra/bpmp.h b/include/soc/tegra/bpmp.h
> > index f5e4ac5b8cce..424188c100d9 100644
> > --- a/include/soc/tegra/bpmp.h
> > +++ b/include/soc/tegra/bpmp.h
> > @@ -127,6 +127,7 @@ struct tegra_bpmp_message {
> >  
> >  #if IS_ENABLED(CONFIG_TEGRA_BPMP)
> >  struct tegra_bpmp *tegra_bpmp_get(struct device *dev);
> > +struct tegra_bpmp *tegra_bpmp_get_with_id(struct device *dev, unsigned int 
> *id);
> 
> Should add a stub function in the #else branch, as well.

Good point. Done.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-03-26 10:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-20 22:54 [PATCH v2 0/5] PCI: tegra: Add Tegra264 support Thierry Reding
2026-03-20 22:54 ` [PATCH v2 1/5] soc/tegra: Update BPMP ABI header Thierry Reding
2026-03-20 22:54 ` [PATCH v2 2/5] firmware: tegra: bpmp: Add tegra_bpmp_get_with_id() function Thierry Reding
2026-03-25  2:28   ` Mikko Perttunen
2026-03-26 10:00     ` Thierry Reding [this message]
2026-03-20 22:54 ` [PATCH v2 3/5] dt-bindings: pci: Document the NVIDIA Tegra264 PCIe controller Thierry Reding
2026-03-25  1:24   ` Rob Herring (Arm)
2026-03-20 22:54 ` [PATCH v2 4/5] PCI: tegra: Add Tegra264 support Thierry Reding
2026-03-24  8:22   ` kernel test robot
2026-03-25  3:48   ` Mikko Perttunen
2026-03-26 10:45     ` Thierry Reding
2026-03-20 22:54 ` [PATCH v2 5/5] arm64: tegra: Add PCI controllers on Tegra264 Thierry Reding

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=acUDq3bt7P2vL5tg@orome \
    --to=thierry.reding@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=krzk+dt@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=mperttunen@nvidia.com \
    --cc=robh@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