From: Bjorn Helgaas <helgaas@kernel.org>
To: Herve Codina <herve.codina@bootlin.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Rob Herring <robh@kernel.org>,
Saravana Kannan <saravanak@google.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Lizhi Hou <lizhi.hou@amd.com>,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-pci@vger.kernel.org,
Allan Nielsen <allan.nielsen@microchip.com>,
Horatiu Vultur <horatiu.vultur@microchip.com>,
Steen Hegelund <steen.hegelund@microchip.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH v4 6/6] PCI: of: Create device-tree PCI host bridge node
Date: Wed, 4 Dec 2024 15:48:52 -0600 [thread overview]
Message-ID: <20241204214852.GA3017210@bhelgaas> (raw)
In-Reply-To: <20241202131522.142268-7-herve.codina@bootlin.com>
On Mon, Dec 02, 2024 at 02:15:18PM +0100, Herve Codina wrote:
> PCI devices device-tree nodes can be already created. This was
> introduced by commit 407d1a51921e ("PCI: Create device tree node for
> bridge").
>
> In order to have device-tree nodes related to PCI devices attached on
> their PCI root bus (the PCI bus handled by the PCI host bridge), a PCI
> root bus device-tree node is needed. This root bus node will be used as
> the parent node of the first level devices scanned on the bus. On
> device-tree based systems, this PCI root bus device tree node is set to
> the node of the related PCI host bridge. The PCI host bridge node is
> available in the device-tree used to describe the hardware passed at
> boot.
>
> On non device-tree based system (such as ACPI), a device-tree node for
> the PCI host bridge or for the root bus do not exist. Indeed, the PCI
> host bridge is not described in a device-tree used at boot simply
> because no device-tree are passed at boot.
s/do not exist/does not exist/
> +void of_pci_make_host_bridge_node(struct pci_host_bridge *bridge)
> +{
> + struct device_node *np = NULL;
> + struct of_changeset *cset;
> + const char *name;
> + int ret;
> +
> + /*
> + * If there is already a device-tree node linked to the PCI bus handled
> + * by this bridge (i.e. the PCI root bus), nothing to do.
> + */
> + if (pci_bus_to_OF_node(bridge->bus))
> + return;
> +
> + /* The root bus has no node. Check that the host bridge has no node too */
> + if (bridge->dev.of_node) {
> + pr_err("PCI host bridge of_node already set");
Can we use dev_err() here?
Bjorn
next prev parent reply other threads:[~2024-12-04 21:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-02 13:15 [PATCH v4 0/6] Add support for the PCI host bridge device-tree node creation Herve Codina
2024-12-02 13:15 ` [PATCH v4 1/6] driver core: Introduce device_{add,remove}_of_node() Herve Codina
2024-12-04 21:38 ` Bjorn Helgaas
2024-12-05 7:00 ` Greg Kroah-Hartman
2024-12-05 7:33 ` Herve Codina
2024-12-02 13:15 ` [PATCH v4 2/6] PCI: of: Use device_{add,remove}_of_node() to attach of_node to existing device Herve Codina
2024-12-02 13:15 ` [PATCH v4 3/6] PCI: of_property: Add support for NULL pdev in of_pci_set_address() Herve Codina
2024-12-02 13:15 ` [PATCH v4 4/6] PCI: of_property: Constify parameter in of_pci_get_addr_flags() Herve Codina
2024-12-02 13:15 ` [PATCH v4 5/6] of: Add #address-cells/#size-cells in the device-tree root empty node Herve Codina
2024-12-02 15:48 ` Rob Herring
2024-12-02 13:15 ` [PATCH v4 6/6] PCI: of: Create device-tree PCI host bridge node Herve Codina
2024-12-04 21:48 ` Bjorn Helgaas [this message]
2024-12-05 7:37 ` Herve Codina
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=20241204214852.GA3017210@bhelgaas \
--to=helgaas@kernel.org \
--cc=allan.nielsen@microchip.com \
--cc=bhelgaas@google.com \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=herve.codina@bootlin.com \
--cc=horatiu.vultur@microchip.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lizhi.hou@amd.com \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=saravanak@google.com \
--cc=steen.hegelund@microchip.com \
--cc=thomas.petazzoni@bootlin.com \
/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