[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210226140305.26356-6-nsaenzjulienne@suse.de>
Date: Fri, 26 Feb 2021 15:02:57 +0100
From: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
To: linux-arm-kernel@...ts.infradead.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: f.fainelli@...il.com, robh+dt@...nel.org, robin.murphy@....com,
ardb@...nel.org, hch@...radead.org, narmstrong@...libre.com,
dwmw2@...radead.org, linux@...linux.org.uk,
catalin.marinas@....com, arnd@...db.de, will@...nel.org,
Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
Subject: [RFC 05/13] pci: Introduce pci_mmio_configure()
The function will traverse the pci device's bus hierarchy and set
the relevant MMIO access flags.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
---
drivers/pci/pci-driver.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index ec44a79e951a..554d91e7ec52 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -1596,6 +1596,31 @@ static int pci_dma_configure(struct device *dev)
return ret;
}
+/**
+ * pci_mmio_configure - Setup MMIO configuration
+ * @dev: ptr to dev structure
+ *
+ * Function to update PCI devices's MMIO configuration using the same
+ * info from the OF node of host bridge's parent (if any).
+ */
+static int pci_mmio_configure(struct device *dev)
+{
+ struct device *bridge;
+ int ret = 0;
+
+ bridge = pci_get_host_bridge_device(to_pci_dev(dev));
+
+ dev_info(dev, "MMIO CONFIGURATION\n");
+ if (IS_ENABLED(CONFIG_OF) && bridge->parent &&
+ bridge->parent->of_node) {
+ dev_info(dev, "MMIO CONFIGURATION, %pOF\n", bridge->parent->of_node);
+ ret = of_mmio_configure(dev, bridge->parent->of_node);
+ }
+
+ pci_put_host_bridge_device(bridge);
+ return ret;
+}
+
struct bus_type pci_bus_type = {
.name = "pci",
.match = pci_bus_match,
@@ -1609,6 +1634,7 @@ struct bus_type pci_bus_type = {
.pm = PCI_PM_OPS_PTR,
.num_vf = pci_bus_num_vf,
.dma_configure = pci_dma_configure,
+ .mmio_configure = pci_mmio_configure,
};
EXPORT_SYMBOL(pci_bus_type);
--
2.30.1
Powered by blists - more mailing lists