* [PATCH 01/15] PCI: cadence: Use struct pci_host_bridge.windows list directly
2020-05-22 23:48 [PATCH 00/15] PCI controller probe cleanups Rob Herring
@ 2020-05-22 23:48 ` Rob Herring
2020-05-22 23:48 ` [PATCH 02/15] PCI: mvebu: " Rob Herring
` (14 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Rob Herring @ 2020-05-22 23:48 UTC (permalink / raw)
To: Lorenzo Pieralisi; +Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel, Tom Joseph
There's no need to create a temporary resource list and then splice it to
struct pci_host_bridge.windows list. Just use pci_host_bridge.windows
directly. The necessary clean-up is already handled by the PCI core.
Cc: Tom Joseph <tjoseph@cadence.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
.../controller/cadence/pcie-cadence-host.c | 26 +++++--------------
1 file changed, 7 insertions(+), 19 deletions(-)
diff --git a/drivers/pci/controller/cadence/pcie-cadence-host.c b/drivers/pci/controller/cadence/pcie-cadence-host.c
index 8c2543f28ba0..9f77e47983c3 100644
--- a/drivers/pci/controller/cadence/pcie-cadence-host.c
+++ b/drivers/pci/controller/cadence/pcie-cadence-host.c
@@ -169,14 +169,15 @@ static int cdns_pcie_host_init_address_translation(struct cdns_pcie_rc *rc)
}
static int cdns_pcie_host_init(struct device *dev,
- struct list_head *resources,
struct cdns_pcie_rc *rc)
{
+ struct pci_host_bridge *bridge = pci_host_bridge_from_priv(rc);
struct resource *bus_range = NULL;
int err;
/* Parse our PCI ranges and request their resources */
- err = pci_parse_request_of_pci_ranges(dev, resources, NULL, &bus_range);
+ err = pci_parse_request_of_pci_ranges(dev, &bridge->windows, NULL,
+ &bus_range);
if (err)
return err;
@@ -185,17 +186,9 @@ static int cdns_pcie_host_init(struct device *dev,
err = cdns_pcie_host_init_root_port(rc);
if (err)
- goto err_out;
-
- err = cdns_pcie_host_init_address_translation(rc);
- if (err)
- goto err_out;
-
- return 0;
+ return err;
- err_out:
- pci_free_resource_list(resources);
- return err;
+ return cdns_pcie_host_init_address_translation(rc);
}
int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
@@ -204,7 +197,6 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
struct platform_device *pdev = to_platform_device(dev);
struct device_node *np = dev->of_node;
struct pci_host_bridge *bridge;
- struct list_head resources;
struct cdns_pcie *pcie;
struct resource *res;
int ret;
@@ -248,11 +240,10 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
pcie->mem_res = res;
- ret = cdns_pcie_host_init(dev, &resources, rc);
+ ret = cdns_pcie_host_init(dev, rc);
if (ret)
goto err_init;
- list_splice_init(&resources, &bridge->windows);
bridge->dev.parent = dev;
bridge->busnr = pcie->bus;
bridge->ops = &cdns_pcie_host_ops;
@@ -261,13 +252,10 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
ret = pci_host_probe(bridge);
if (ret < 0)
- goto err_host_probe;
+ goto err_init;
return 0;
- err_host_probe:
- pci_free_resource_list(&resources);
-
err_init:
pm_runtime_put_sync(dev);
--
2.25.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 02/15] PCI: mvebu: Use struct pci_host_bridge.windows list directly
2020-05-22 23:48 [PATCH 00/15] PCI controller probe cleanups Rob Herring
2020-05-22 23:48 ` [PATCH 01/15] PCI: cadence: Use struct pci_host_bridge.windows list directly Rob Herring
@ 2020-05-22 23:48 ` Rob Herring
2020-05-22 23:48 ` [PATCH 03/15] PCI: host-common: " Rob Herring
` (13 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Rob Herring @ 2020-05-22 23:48 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel, Thomas Petazzoni,
Jason Cooper
There's no need to create a temporary resource list and then splice it to
struct pci_host_bridge.windows list. Just use pci_host_bridge.windows
directly. The necessary clean-up is already handled by the PCI core.
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Rob Herring <robh@kernel.org>
---
drivers/pci/controller/pci-mvebu.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c
index 153a64676bc9..801044523a3d 100644
--- a/drivers/pci/controller/pci-mvebu.c
+++ b/drivers/pci/controller/pci-mvebu.c
@@ -71,7 +71,6 @@ struct mvebu_pcie {
struct platform_device *pdev;
struct mvebu_pcie_port *ports;
struct msi_controller *msi;
- struct list_head resources;
struct resource io;
struct resource realio;
struct resource mem;
@@ -961,17 +960,16 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
{
struct device *dev = &pcie->pdev->dev;
struct device_node *np = dev->of_node;
+ struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie);
int ret;
- INIT_LIST_HEAD(&pcie->resources);
-
/* Get the bus range */
ret = of_pci_parse_bus_range(np, &pcie->busn);
if (ret) {
dev_err(dev, "failed to parse bus-range property: %d\n", ret);
return ret;
}
- pci_add_resource(&pcie->resources, &pcie->busn);
+ pci_add_resource(&bridge->windows, &pcie->busn);
/* Get the PCIe memory aperture */
mvebu_mbus_get_pcie_mem_aperture(&pcie->mem);
@@ -981,7 +979,7 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
}
pcie->mem.name = "PCI MEM";
- pci_add_resource(&pcie->resources, &pcie->mem);
+ pci_add_resource(&bridge->windows, &pcie->mem);
/* Get the PCIe IO aperture */
mvebu_mbus_get_pcie_io_aperture(&pcie->io);
@@ -994,10 +992,10 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
resource_size(&pcie->io) - 1);
pcie->realio.name = "PCI I/O";
- pci_add_resource(&pcie->resources, &pcie->realio);
+ pci_add_resource(&bridge->windows, &pcie->realio);
}
- return devm_request_pci_bus_resources(dev, &pcie->resources);
+ return devm_request_pci_bus_resources(dev, &bridge->windows);
}
/*
@@ -1118,7 +1116,6 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
pcie->nports = i;
- list_splice_init(&pcie->resources, &bridge->windows);
bridge->dev.parent = dev;
bridge->sysdata = pcie;
bridge->busnr = 0;
--
2.25.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 03/15] PCI: host-common: Use struct pci_host_bridge.windows list directly
2020-05-22 23:48 [PATCH 00/15] PCI controller probe cleanups Rob Herring
2020-05-22 23:48 ` [PATCH 01/15] PCI: cadence: Use struct pci_host_bridge.windows list directly Rob Herring
2020-05-22 23:48 ` [PATCH 02/15] PCI: mvebu: " Rob Herring
@ 2020-05-22 23:48 ` Rob Herring
2020-05-22 23:48 ` [PATCH 04/15] PCI: brcmstb: Use pci_host_probe() to register host Rob Herring
` (12 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Rob Herring @ 2020-05-22 23:48 UTC (permalink / raw)
To: Lorenzo Pieralisi; +Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel, Will Deacon
There's no need to create a temporary resource list and then splice it to
struct pci_host_bridge.windows list. Just use pci_host_bridge.windows
directly. The necessary clean-up is already handled by the PCI core.
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
---
drivers/pci/controller/pci-host-common.c | 36 ++++++++----------------
1 file changed, 11 insertions(+), 25 deletions(-)
diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c
index 953de57f6c57..f8f71d99e427 100644
--- a/drivers/pci/controller/pci-host-common.c
+++ b/drivers/pci/controller/pci-host-common.c
@@ -21,7 +21,7 @@ static void gen_pci_unmap_cfg(void *ptr)
}
static struct pci_config_window *gen_pci_init(struct device *dev,
- struct list_head *resources, const struct pci_ecam_ops *ops)
+ struct pci_host_bridge *bridge, const struct pci_ecam_ops *ops)
{
int err;
struct resource cfgres;
@@ -29,31 +29,25 @@ static struct pci_config_window *gen_pci_init(struct device *dev,
struct pci_config_window *cfg;
/* Parse our PCI ranges and request their resources */
- err = pci_parse_request_of_pci_ranges(dev, resources, NULL, &bus_range);
+ err = pci_parse_request_of_pci_ranges(dev, &bridge->windows, NULL, &bus_range);
if (err)
return ERR_PTR(err);
err = of_address_to_resource(dev->of_node, 0, &cfgres);
if (err) {
dev_err(dev, "missing \"reg\" property\n");
- goto err_out;
+ return ERR_PTR(err);
}
cfg = pci_ecam_create(dev, &cfgres, bus_range, ops);
- if (IS_ERR(cfg)) {
- err = PTR_ERR(cfg);
- goto err_out;
- }
+ if (IS_ERR(cfg))
+ return cfg;
err = devm_add_action_or_reset(dev, gen_pci_unmap_cfg, cfg);
- if (err) {
- goto err_out;
- }
- return cfg;
+ if (err)
+ return ERR_PTR(err);
-err_out:
- pci_free_resource_list(resources);
- return ERR_PTR(err);
+ return cfg;
}
int pci_host_common_probe(struct platform_device *pdev)
@@ -61,9 +55,7 @@ int pci_host_common_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct pci_host_bridge *bridge;
struct pci_config_window *cfg;
- struct list_head resources;
const struct pci_ecam_ops *ops;
- int ret;
ops = of_device_get_match_data(&pdev->dev);
if (!ops)
@@ -76,7 +68,7 @@ int pci_host_common_probe(struct platform_device *pdev)
of_pci_check_probe_only();
/* Parse and map our Configuration Space windows */
- cfg = gen_pci_init(dev, &resources, ops);
+ cfg = gen_pci_init(dev, bridge, ops);
if (IS_ERR(cfg))
return PTR_ERR(cfg);
@@ -84,7 +76,6 @@ int pci_host_common_probe(struct platform_device *pdev)
if (!pci_has_flag(PCI_PROBE_ONLY))
pci_add_flags(PCI_REASSIGN_ALL_BUS);
- list_splice_init(&resources, &bridge->windows);
bridge->dev.parent = dev;
bridge->sysdata = cfg;
bridge->busnr = cfg->busr.start;
@@ -92,14 +83,9 @@ int pci_host_common_probe(struct platform_device *pdev)
bridge->map_irq = of_irq_parse_and_map_pci;
bridge->swizzle_irq = pci_common_swizzle;
- ret = pci_host_probe(bridge);
- if (ret < 0) {
- pci_free_resource_list(&resources);
- return ret;
- }
-
platform_set_drvdata(pdev, bridge->bus);
- return 0;
+
+ return pci_host_probe(bridge);
}
EXPORT_SYMBOL_GPL(pci_host_common_probe);
--
2.25.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 04/15] PCI: brcmstb: Use pci_host_probe() to register host
2020-05-22 23:48 [PATCH 00/15] PCI controller probe cleanups Rob Herring
` (2 preceding siblings ...)
2020-05-22 23:48 ` [PATCH 03/15] PCI: host-common: " Rob Herring
@ 2020-05-22 23:48 ` Rob Herring
2020-06-18 10:54 ` Nicolas Saenz Julienne
2020-05-22 23:48 ` [PATCH 05/15] PCI: mobiveil: " Rob Herring
` (11 subsequent siblings)
15 siblings, 1 reply; 24+ messages in thread
From: Rob Herring @ 2020-05-22 23:48 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel,
Nicolas Saenz Julienne, bcm-kernel-feedback-list,
linux-rpi-kernel
The brcmstb host driver does the same host registration and bus scanning
calls as pci_host_probe, so let's use it instead.
Cc: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: linux-rpi-kernel@lists.infradead.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
drivers/pci/controller/pcie-brcmstb.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index 7730ea845ff2..15c747c1390a 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -172,7 +172,6 @@ struct brcm_pcie {
struct device *dev;
void __iomem *base;
struct clk *clk;
- struct pci_bus *root_bus;
struct device_node *np;
bool ssc;
int gen;
@@ -919,9 +918,10 @@ static void __brcm_pcie_remove(struct brcm_pcie *pcie)
static int brcm_pcie_remove(struct platform_device *pdev)
{
struct brcm_pcie *pcie = platform_get_drvdata(pdev);
+ struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie);
- pci_stop_root_bus(pcie->root_bus);
- pci_remove_root_bus(pcie->root_bus);
+ pci_stop_root_bus(bridge->bus);
+ pci_remove_root_bus(bridge->bus);
__brcm_pcie_remove(pcie);
return 0;
@@ -933,7 +933,6 @@ static int brcm_pcie_probe(struct platform_device *pdev)
struct pci_host_bridge *bridge;
struct device_node *fw_np;
struct brcm_pcie *pcie;
- struct pci_bus *child;
struct resource *res;
int ret;
@@ -1004,20 +1003,9 @@ static int brcm_pcie_probe(struct platform_device *pdev)
bridge->map_irq = of_irq_parse_and_map_pci;
bridge->swizzle_irq = pci_common_swizzle;
- ret = pci_scan_root_bus_bridge(bridge);
- if (ret < 0) {
- dev_err(pcie->dev, "Scanning root bridge failed\n");
- goto fail;
- }
-
- pci_assign_unassigned_bus_resources(bridge->bus);
- list_for_each_entry(child, &bridge->bus->children, node)
- pcie_bus_configure_settings(child);
- pci_bus_add_devices(bridge->bus);
platform_set_drvdata(pdev, pcie);
- pcie->root_bus = bridge->bus;
- return 0;
+ return pci_host_probe(bridge);
fail:
__brcm_pcie_remove(pcie);
return ret;
--
2.25.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 04/15] PCI: brcmstb: Use pci_host_probe() to register host
2020-05-22 23:48 ` [PATCH 04/15] PCI: brcmstb: Use pci_host_probe() to register host Rob Herring
@ 2020-06-18 10:54 ` Nicolas Saenz Julienne
0 siblings, 0 replies; 24+ messages in thread
From: Nicolas Saenz Julienne @ 2020-06-18 10:54 UTC (permalink / raw)
To: Rob Herring, Lorenzo Pieralisi
Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel,
bcm-kernel-feedback-list, linux-rpi-kernel
[-- Attachment #1: Type: text/plain, Size: 587 bytes --]
On Fri, 2020-05-22 at 17:48 -0600, Rob Herring wrote:
> The brcmstb host driver does the same host registration and bus scanning
> calls as pci_host_probe, so let's use it instead.
>
> Cc: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> Cc: bcm-kernel-feedback-list@broadcom.com
> Cc: linux-rpi-kernel@lists.infradead.org
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
Don't know if I'm a little late for this series but:
Tested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Regards,
Nicolas
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 05/15] PCI: mobiveil: Use pci_host_probe() to register host
2020-05-22 23:48 [PATCH 00/15] PCI controller probe cleanups Rob Herring
` (3 preceding siblings ...)
2020-05-22 23:48 ` [PATCH 04/15] PCI: brcmstb: Use pci_host_probe() to register host Rob Herring
@ 2020-05-22 23:48 ` Rob Herring
2020-05-22 23:48 ` [PATCH 06/15] PCI: tegra: " Rob Herring
` (10 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Rob Herring @ 2020-05-22 23:48 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel, Karthikeyan Mitran,
Hou Zhiqiang
The mobiveil host driver does the same host registration and bus scanning
calls as pci_host_probe, so let's use it instead.
Cc: Karthikeyan Mitran <m.karthikeyan@mobiveil.co.in>
Cc: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
.../pci/controller/mobiveil/pcie-mobiveil-host.c | 16 +---------------
1 file changed, 1 insertion(+), 15 deletions(-)
diff --git a/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c b/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
index 5907baa9b1f2..5974619811ec 100644
--- a/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
+++ b/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
@@ -569,8 +569,6 @@ int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie)
struct mobiveil_root_port *rp = &pcie->rp;
struct pci_host_bridge *bridge = rp->bridge;
struct device *dev = &pcie->pdev->dev;
- struct pci_bus *bus;
- struct pci_bus *child;
int ret;
ret = mobiveil_pcie_parse_dt(pcie);
@@ -620,17 +618,5 @@ int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie)
return ret;
}
- /* setup the kernel resources for the newly added PCIe root bus */
- ret = pci_scan_root_bus_bridge(bridge);
- if (ret)
- return ret;
-
- bus = bridge->bus;
-
- pci_assign_unassigned_bus_resources(bus);
- list_for_each_entry(child, &bus->children, node)
- pcie_bus_configure_settings(child);
- pci_bus_add_devices(bus);
-
- return 0;
+ return pci_host_probe(bridge);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 06/15] PCI: tegra: Use pci_host_probe() to register host
2020-05-22 23:48 [PATCH 00/15] PCI controller probe cleanups Rob Herring
` (4 preceding siblings ...)
2020-05-22 23:48 ` [PATCH 05/15] PCI: mobiveil: " Rob Herring
@ 2020-05-22 23:48 ` Rob Herring
2020-05-22 23:48 ` [PATCH 07/15] PCI: v3: " Rob Herring
` (9 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Rob Herring @ 2020-05-22 23:48 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel, Thierry Reding,
Jonathan Hunter, linux-tegra
The tegra host driver does the same host registration and bus scanning
calls as pci_host_probe, so let's use it instead.
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>
Cc: linux-tegra@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
drivers/pci/controller/pci-tegra.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
index e3e917243e10..3cae96dfe75d 100644
--- a/drivers/pci/controller/pci-tegra.c
+++ b/drivers/pci/controller/pci-tegra.c
@@ -2670,7 +2670,6 @@ static int tegra_pcie_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct pci_host_bridge *host;
struct tegra_pcie *pcie;
- struct pci_bus *child;
struct resource *bus;
int err;
@@ -2721,20 +2720,12 @@ static int tegra_pcie_probe(struct platform_device *pdev)
host->map_irq = tegra_pcie_map_irq;
host->swizzle_irq = pci_common_swizzle;
- err = pci_scan_root_bus_bridge(host);
+ err = pci_host_probe(host);
if (err < 0) {
dev_err(dev, "failed to register host: %d\n", err);
goto pm_runtime_put;
}
- pci_bus_size_bridges(host->bus);
- pci_bus_assign_resources(host->bus);
-
- list_for_each_entry(child, &host->bus->children, node)
- pcie_bus_configure_settings(child);
-
- pci_bus_add_devices(host->bus);
-
if (IS_ENABLED(CONFIG_DEBUG_FS)) {
err = tegra_pcie_debugfs_init(pcie);
if (err < 0)
--
2.25.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 07/15] PCI: v3: Use pci_host_probe() to register host
2020-05-22 23:48 [PATCH 00/15] PCI controller probe cleanups Rob Herring
` (5 preceding siblings ...)
2020-05-22 23:48 ` [PATCH 06/15] PCI: tegra: " Rob Herring
@ 2020-05-22 23:48 ` Rob Herring
2020-05-25 11:38 ` Linus Walleij
2020-05-22 23:48 ` [PATCH 08/15] PCI: versatile: " Rob Herring
` (8 subsequent siblings)
15 siblings, 1 reply; 24+ messages in thread
From: Rob Herring @ 2020-05-22 23:48 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel, Linus Walleij
The v3 host driver does the same host registration and bus scanning
calls as pci_host_probe, so let's use it instead.
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
---
drivers/pci/controller/pci-v3-semi.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/drivers/pci/controller/pci-v3-semi.c b/drivers/pci/controller/pci-v3-semi.c
index 3681e5af3878..198cf2c6ed92 100644
--- a/drivers/pci/controller/pci-v3-semi.c
+++ b/drivers/pci/controller/pci-v3-semi.c
@@ -239,7 +239,6 @@ struct v3_pci {
struct device *dev;
void __iomem *base;
void __iomem *config_base;
- struct pci_bus *bus;
u32 config_mem;
u32 non_pre_mem;
u32 pre_mem;
@@ -904,17 +903,7 @@ static int v3_pci_probe(struct platform_device *pdev)
val |= V3_SYSTEM_M_LOCK;
writew(val, v3->base + V3_SYSTEM);
- ret = pci_scan_root_bus_bridge(host);
- if (ret) {
- dev_err(dev, "failed to register host: %d\n", ret);
- return ret;
- }
- v3->bus = host->bus;
-
- pci_bus_assign_resources(v3->bus);
- pci_bus_add_devices(v3->bus);
-
- return 0;
+ return pci_host_probe(host);
}
static const struct of_device_id v3_pci_of_match[] = {
--
2.25.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 07/15] PCI: v3: Use pci_host_probe() to register host
2020-05-22 23:48 ` [PATCH 07/15] PCI: v3: " Rob Herring
@ 2020-05-25 11:38 ` Linus Walleij
0 siblings, 0 replies; 24+ messages in thread
From: Linus Walleij @ 2020-05-25 11:38 UTC (permalink / raw)
To: Rob Herring; +Cc: Lorenzo Pieralisi, Bjorn Helgaas, linux-pci, Linux ARM
On Sat, May 23, 2020 at 1:48 AM Rob Herring <robh@kernel.org> wrote:
> The v3 host driver does the same host registration and bus scanning
> calls as pci_host_probe, so let's use it instead.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Rob Herring <robh@kernel.org>
Sweet!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 08/15] PCI: versatile: Use pci_host_probe() to register host
2020-05-22 23:48 [PATCH 00/15] PCI controller probe cleanups Rob Herring
` (6 preceding siblings ...)
2020-05-22 23:48 ` [PATCH 07/15] PCI: v3: " Rob Herring
@ 2020-05-22 23:48 ` Rob Herring
2020-05-22 23:48 ` [PATCH 09/15] PCI: xgene: " Rob Herring
` (7 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Rob Herring @ 2020-05-22 23:48 UTC (permalink / raw)
To: Lorenzo Pieralisi; +Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel
The versatile host driver does the same host registration and bus scanning
calls as pci_host_probe, so let's use it instead.
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
drivers/pci/controller/pci-versatile.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/drivers/pci/controller/pci-versatile.c b/drivers/pci/controller/pci-versatile.c
index b911359b6d81..e90f0cc65c73 100644
--- a/drivers/pci/controller/pci-versatile.c
+++ b/drivers/pci/controller/pci-versatile.c
@@ -70,7 +70,6 @@ static int versatile_pci_probe(struct platform_device *pdev)
int ret, i, myslot = -1, mem = 1;
u32 val;
void __iomem *local_pci_cfg_base;
- struct pci_bus *bus, *child;
struct pci_host_bridge *bridge;
bridge = devm_pci_alloc_host_bridge(dev, 0);
@@ -164,18 +163,7 @@ static int versatile_pci_probe(struct platform_device *pdev)
bridge->map_irq = of_irq_parse_and_map_pci;
bridge->swizzle_irq = pci_common_swizzle;
- ret = pci_scan_root_bus_bridge(bridge);
- if (ret < 0)
- return ret;
-
- bus = bridge->bus;
-
- pci_assign_unassigned_bus_resources(bus);
- list_for_each_entry(child, &bus->children, node)
- pcie_bus_configure_settings(child);
- pci_bus_add_devices(bus);
-
- return 0;
+ return pci_host_probe(bridge);
}
static const struct of_device_id versatile_pci_of_match[] = {
--
2.25.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 09/15] PCI: xgene: Use pci_host_probe() to register host
2020-05-22 23:48 [PATCH 00/15] PCI controller probe cleanups Rob Herring
` (7 preceding siblings ...)
2020-05-22 23:48 ` [PATCH 08/15] PCI: versatile: " Rob Herring
@ 2020-05-22 23:48 ` Rob Herring
2020-05-22 23:48 ` [PATCH 10/15] PCI: altera: " Rob Herring
` (6 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Rob Herring @ 2020-05-22 23:48 UTC (permalink / raw)
To: Lorenzo Pieralisi; +Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel, Toan Le
The xgene host driver does the same host registration and bus scanning
calls as pci_host_probe, so let's use it instead.
Cc: Toan Le <toan@os.amperecomputing.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
drivers/pci/controller/pci-xgene.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c
index d1efa8ffbae1..5aee802946cb 100644
--- a/drivers/pci/controller/pci-xgene.c
+++ b/drivers/pci/controller/pci-xgene.c
@@ -591,7 +591,6 @@ static int xgene_pcie_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct device_node *dn = dev->of_node;
struct xgene_pcie_port *port;
- struct pci_bus *bus, *child;
struct pci_host_bridge *bridge;
int ret;
@@ -632,17 +631,7 @@ static int xgene_pcie_probe(struct platform_device *pdev)
bridge->map_irq = of_irq_parse_and_map_pci;
bridge->swizzle_irq = pci_common_swizzle;
- ret = pci_scan_root_bus_bridge(bridge);
- if (ret < 0)
- return ret;
-
- bus = bridge->bus;
-
- pci_assign_unassigned_bus_resources(bus);
- list_for_each_entry(child, &bus->children, node)
- pcie_bus_configure_settings(child);
- pci_bus_add_devices(bus);
- return 0;
+ return pci_host_probe(bridge);
}
static const struct of_device_id xgene_pcie_match_table[] = {
--
2.25.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 10/15] PCI: altera: Use pci_host_probe() to register host
2020-05-22 23:48 [PATCH 00/15] PCI controller probe cleanups Rob Herring
` (8 preceding siblings ...)
2020-05-22 23:48 ` [PATCH 09/15] PCI: xgene: " Rob Herring
@ 2020-05-22 23:48 ` Rob Herring
2020-06-02 1:02 ` Tan, Ley Foon
2020-05-22 23:48 ` [PATCH 11/15] PCI: iproc: " Rob Herring
` (5 subsequent siblings)
15 siblings, 1 reply; 24+ messages in thread
From: Rob Herring @ 2020-05-22 23:48 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel, Ley Foon Tan, rfi
The altera host driver does the same host registration and bus scanning
calls as pci_host_probe, so let's use it instead.
The only difference is pci_assign_unassigned_bus_resources() was called
instead of pci_bus_size_bridges() and pci_bus_assign_resources(). This
should be the same.
Cc: Ley Foon Tan <ley.foon.tan@intel.com>
Cc: rfi@lists.rocketboards.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
drivers/pci/controller/pcie-altera.c | 17 +----------------
1 file changed, 1 insertion(+), 16 deletions(-)
diff --git a/drivers/pci/controller/pcie-altera.c b/drivers/pci/controller/pcie-altera.c
index 24cb1c331058..26ac3ad81de0 100644
--- a/drivers/pci/controller/pcie-altera.c
+++ b/drivers/pci/controller/pcie-altera.c
@@ -773,8 +773,6 @@ static int altera_pcie_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct altera_pcie *pcie;
- struct pci_bus *bus;
- struct pci_bus *child;
struct pci_host_bridge *bridge;
int ret;
const struct of_device_id *match;
@@ -825,20 +823,7 @@ static int altera_pcie_probe(struct platform_device *pdev)
bridge->map_irq = of_irq_parse_and_map_pci;
bridge->swizzle_irq = pci_common_swizzle;
- ret = pci_scan_root_bus_bridge(bridge);
- if (ret < 0)
- return ret;
-
- bus = bridge->bus;
-
- pci_assign_unassigned_bus_resources(bus);
-
- /* Configure PCI Express setting. */
- list_for_each_entry(child, &bus->children, node)
- pcie_bus_configure_settings(child);
-
- pci_bus_add_devices(bus);
- return ret;
+ return pci_host_probe(bridge);
}
static int altera_pcie_remove(struct platform_device *pdev)
--
2.25.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* RE: [PATCH 10/15] PCI: altera: Use pci_host_probe() to register host
2020-05-22 23:48 ` [PATCH 10/15] PCI: altera: " Rob Herring
@ 2020-06-02 1:02 ` Tan, Ley Foon
0 siblings, 0 replies; 24+ messages in thread
From: Tan, Ley Foon @ 2020-06-02 1:02 UTC (permalink / raw)
To: Rob Herring, Lorenzo Pieralisi
Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel, rfi
> -----Original Message-----
> From: Rob Herring <robh@kernel.org>
> Sent: Saturday, May 23, 2020 7:48 AM
> To: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>; linux-pci@vger.kernel.org;
> linux-arm-kernel@lists.infradead.org; Tan, Ley Foon
> <ley.foon.tan@intel.com>; rfi@lists.rocketboards.org
> Subject: [PATCH 10/15] PCI: altera: Use pci_host_probe() to register host
>
> The altera host driver does the same host registration and bus scanning calls
> as pci_host_probe, so let's use it instead.
>
> The only difference is pci_assign_unassigned_bus_resources() was called
> instead of pci_bus_size_bridges() and pci_bus_assign_resources(). This
> should be the same.
>
> Cc: Ley Foon Tan <ley.foon.tan@intel.com>
> Cc: rfi@lists.rocketboards.org
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> drivers/pci/controller/pcie-altera.c | 17 +----------------
> 1 file changed, 1 insertion(+), 16 deletions(-)
>
Reviewed-by: Ley Foon Tan <ley.foon.tan@intel.com>
Regards
Ley Foon
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 11/15] PCI: iproc: Use pci_host_probe() to register host
2020-05-22 23:48 [PATCH 00/15] PCI controller probe cleanups Rob Herring
` (9 preceding siblings ...)
2020-05-22 23:48 ` [PATCH 10/15] PCI: altera: " Rob Herring
@ 2020-05-22 23:48 ` Rob Herring
2020-05-28 17:53 ` Scott Branden
2020-05-22 23:48 ` [PATCH 12/15] PCI: rcar: " Rob Herring
` (4 subsequent siblings)
15 siblings, 1 reply; 24+ messages in thread
From: Rob Herring @ 2020-05-22 23:48 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel, Ray Jui,
Scott Branden, bcm-kernel-feedback-list
The iproc host driver does the same host registration and bus scanning
calls as pci_host_probe, so let's use it instead.
The only difference is pci_assign_unassigned_bus_resources() was called
instead of pci_bus_size_bridges() and pci_bus_assign_resources(). This
should be the same.
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: bcm-kernel-feedback-list@broadcom.com
Signed-off-by: Rob Herring <robh@kernel.org>
---
drivers/pci/controller/pcie-iproc.c | 18 +++++-------------
drivers/pci/controller/pcie-iproc.h | 2 --
2 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c
index 8c7f875acf7f..232fca0754e1 100644
--- a/drivers/pci/controller/pcie-iproc.c
+++ b/drivers/pci/controller/pcie-iproc.c
@@ -1470,7 +1470,6 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
{
struct device *dev;
int ret;
- struct pci_bus *child;
struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie);
dev = pcie->dev;
@@ -1531,21 +1530,12 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
host->map_irq = pcie->map_irq;
host->swizzle_irq = pci_common_swizzle;
- ret = pci_scan_root_bus_bridge(host);
+ ret = pci_host_probe(host);
if (ret < 0) {
dev_err(dev, "failed to scan host: %d\n", ret);
goto err_power_off_phy;
}
- pci_assign_unassigned_bus_resources(host->bus);
-
- pcie->root_bus = host->bus;
-
- list_for_each_entry(child, &host->bus->children, node)
- pcie_bus_configure_settings(child);
-
- pci_bus_add_devices(host->bus);
-
return 0;
err_power_off_phy:
@@ -1558,8 +1548,10 @@ EXPORT_SYMBOL(iproc_pcie_setup);
int iproc_pcie_remove(struct iproc_pcie *pcie)
{
- pci_stop_root_bus(pcie->root_bus);
- pci_remove_root_bus(pcie->root_bus);
+ struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie);
+
+ pci_stop_root_bus(host->bus);
+ pci_remove_root_bus(host->bus);
iproc_pcie_msi_disable(pcie);
diff --git a/drivers/pci/controller/pcie-iproc.h b/drivers/pci/controller/pcie-iproc.h
index 4f03ea539805..c2676e442f55 100644
--- a/drivers/pci/controller/pcie-iproc.h
+++ b/drivers/pci/controller/pcie-iproc.h
@@ -54,7 +54,6 @@ struct iproc_msi;
* @reg_offsets: register offsets
* @base: PCIe host controller I/O register base
* @base_addr: PCIe host controller register base physical address
- * @root_bus: pointer to root bus
* @phy: optional PHY device that controls the Serdes
* @map_irq: function callback to map interrupts
* @ep_is_internal: indicates an internal emulated endpoint device is connected
@@ -85,7 +84,6 @@ struct iproc_pcie {
void __iomem *base;
phys_addr_t base_addr;
struct resource mem;
- struct pci_bus *root_bus;
struct phy *phy;
int (*map_irq)(const struct pci_dev *, u8, u8);
bool ep_is_internal;
--
2.25.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 11/15] PCI: iproc: Use pci_host_probe() to register host
2020-05-22 23:48 ` [PATCH 11/15] PCI: iproc: " Rob Herring
@ 2020-05-28 17:53 ` Scott Branden
0 siblings, 0 replies; 24+ messages in thread
From: Scott Branden @ 2020-05-28 17:53 UTC (permalink / raw)
To: Rob Herring, Lorenzo Pieralisi
Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel, Ray Jui,
Scott Branden, bcm-kernel-feedback-list
On 2020-05-22 4:48 p.m., Rob Herring wrote:
> The iproc host driver does the same host registration and bus scanning
> calls as pci_host_probe, so let's use it instead.
>
> The only difference is pci_assign_unassigned_bus_resources() was called
> instead of pci_bus_size_bridges() and pci_bus_assign_resources(). This
> should be the same.
>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Ray Jui <rjui@broadcom.com>
> Cc: Scott Branden <sbranden@broadcom.com>
> Cc: bcm-kernel-feedback-list@broadcom.com
> Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Scott Branden <scott.branden@broadcom.com>
> ---
> drivers/pci/controller/pcie-iproc.c | 18 +++++-------------
> drivers/pci/controller/pcie-iproc.h | 2 --
> 2 files changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c
> index 8c7f875acf7f..232fca0754e1 100644
> --- a/drivers/pci/controller/pcie-iproc.c
> +++ b/drivers/pci/controller/pcie-iproc.c
> @@ -1470,7 +1470,6 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
> {
> struct device *dev;
> int ret;
> - struct pci_bus *child;
> struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie);
>
> dev = pcie->dev;
> @@ -1531,21 +1530,12 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
> host->map_irq = pcie->map_irq;
> host->swizzle_irq = pci_common_swizzle;
>
> - ret = pci_scan_root_bus_bridge(host);
> + ret = pci_host_probe(host);
> if (ret < 0) {
> dev_err(dev, "failed to scan host: %d\n", ret);
> goto err_power_off_phy;
> }
>
> - pci_assign_unassigned_bus_resources(host->bus);
> -
> - pcie->root_bus = host->bus;
> -
> - list_for_each_entry(child, &host->bus->children, node)
> - pcie_bus_configure_settings(child);
> -
> - pci_bus_add_devices(host->bus);
> -
> return 0;
>
> err_power_off_phy:
> @@ -1558,8 +1548,10 @@ EXPORT_SYMBOL(iproc_pcie_setup);
>
> int iproc_pcie_remove(struct iproc_pcie *pcie)
> {
> - pci_stop_root_bus(pcie->root_bus);
> - pci_remove_root_bus(pcie->root_bus);
> + struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie);
> +
> + pci_stop_root_bus(host->bus);
> + pci_remove_root_bus(host->bus);
>
> iproc_pcie_msi_disable(pcie);
>
> diff --git a/drivers/pci/controller/pcie-iproc.h b/drivers/pci/controller/pcie-iproc.h
> index 4f03ea539805..c2676e442f55 100644
> --- a/drivers/pci/controller/pcie-iproc.h
> +++ b/drivers/pci/controller/pcie-iproc.h
> @@ -54,7 +54,6 @@ struct iproc_msi;
> * @reg_offsets: register offsets
> * @base: PCIe host controller I/O register base
> * @base_addr: PCIe host controller register base physical address
> - * @root_bus: pointer to root bus
> * @phy: optional PHY device that controls the Serdes
> * @map_irq: function callback to map interrupts
> * @ep_is_internal: indicates an internal emulated endpoint device is connected
> @@ -85,7 +84,6 @@ struct iproc_pcie {
> void __iomem *base;
> phys_addr_t base_addr;
> struct resource mem;
> - struct pci_bus *root_bus;
> struct phy *phy;
> int (*map_irq)(const struct pci_dev *, u8, u8);
> bool ep_is_internal;
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 12/15] PCI: rcar: Use pci_host_probe() to register host
2020-05-22 23:48 [PATCH 00/15] PCI controller probe cleanups Rob Herring
` (10 preceding siblings ...)
2020-05-22 23:48 ` [PATCH 11/15] PCI: iproc: " Rob Herring
@ 2020-05-22 23:48 ` Rob Herring
2020-05-25 8:31 ` Geert Uytterhoeven
2020-05-22 23:48 ` [PATCH 13/15] PCI: rockchip: " Rob Herring
` (3 subsequent siblings)
15 siblings, 1 reply; 24+ messages in thread
From: Rob Herring @ 2020-05-22 23:48 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel, Marek Vasut,
Yoshihiro Shimoda, linux-renesas-soc
The rcar host driver does the same host registration and bus scanning
calls as pci_host_probe, so let's use it instead.
Cc: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: linux-renesas-soc@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
drivers/pci/controller/pcie-rcar-host.c | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c
index d210a36561be..9069ad96fe95 100644
--- a/drivers/pci/controller/pcie-rcar-host.c
+++ b/drivers/pci/controller/pcie-rcar-host.c
@@ -330,8 +330,6 @@ static int rcar_pcie_enable(struct rcar_pcie_host *host)
struct pci_host_bridge *bridge = pci_host_bridge_from_priv(host);
struct rcar_pcie *pcie = &host->pcie;
struct device *dev = pcie->dev;
- struct pci_bus *bus, *child;
- int ret;
/* Try setting 5 GT/s link speed */
rcar_pcie_force_speedup(pcie);
@@ -349,21 +347,7 @@ static int rcar_pcie_enable(struct rcar_pcie_host *host)
if (IS_ENABLED(CONFIG_PCI_MSI))
bridge->msi = &host->msi.chip;
- ret = pci_scan_root_bus_bridge(bridge);
- if (ret < 0)
- return ret;
-
- bus = bridge->bus;
-
- pci_bus_size_bridges(bus);
- pci_bus_assign_resources(bus);
-
- list_for_each_entry(child, &bus->children, node)
- pcie_bus_configure_settings(child);
-
- pci_bus_add_devices(bus);
-
- return 0;
+ return pci_host_probe(bridge);
}
static int phy_wait_for_ack(struct rcar_pcie *pcie)
--
2.25.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 12/15] PCI: rcar: Use pci_host_probe() to register host
2020-05-22 23:48 ` [PATCH 12/15] PCI: rcar: " Rob Herring
@ 2020-05-25 8:31 ` Geert Uytterhoeven
0 siblings, 0 replies; 24+ messages in thread
From: Geert Uytterhoeven @ 2020-05-25 8:31 UTC (permalink / raw)
To: Rob Herring
Cc: Lorenzo Pieralisi, Bjorn Helgaas, linux-pci, Linux ARM,
Marek Vasut, Yoshihiro Shimoda, Linux-Renesas
Hi Rob,
On Sat, May 23, 2020 at 1:50 AM Rob Herring <robh@kernel.org> wrote:
> The rcar host driver does the same host registration and bus scanning
> calls as pci_host_probe, so let's use it instead.
>
> Cc: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Cc: linux-renesas-soc@vger.kernel.org
> Signed-off-by: Rob Herring <robh@kernel.org>
Thanks for your patch!
Note that this does have 2 side effects: the "linux,pci-probe-only" DT
property and the "pcie_scan_all" kernel command line option are now taken
into account.
Regardless:
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 13/15] PCI: rockchip: Use pci_host_probe() to register host
2020-05-22 23:48 [PATCH 00/15] PCI controller probe cleanups Rob Herring
` (11 preceding siblings ...)
2020-05-22 23:48 ` [PATCH 12/15] PCI: rcar: " Rob Herring
@ 2020-05-22 23:48 ` Rob Herring
2020-05-22 23:48 ` [PATCH 14/15] PCI: xilinx-nwl: " Rob Herring
` (2 subsequent siblings)
15 siblings, 0 replies; 24+ messages in thread
From: Rob Herring @ 2020-05-22 23:48 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel, Shawn Lin,
Heiko Stuebner, linux-rockchip
The rockchip host driver does the same host registration and bus scanning
calls as pci_host_probe, so let's use it instead.
Cc: Shawn Lin <shawn.lin@rock-chips.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: linux-rockchip@lists.infradead.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
drivers/pci/controller/pcie-rockchip-host.c | 18 ++++--------------
drivers/pci/controller/pcie-rockchip.h | 1 -
2 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c
index 94af6f5828a3..6a3c8442258b 100644
--- a/drivers/pci/controller/pcie-rockchip-host.c
+++ b/drivers/pci/controller/pcie-rockchip-host.c
@@ -949,7 +949,6 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
{
struct rockchip_pcie *rockchip;
struct device *dev = &pdev->dev;
- struct pci_bus *bus, *child;
struct pci_host_bridge *bridge;
struct resource *bus_res;
int err;
@@ -1015,20 +1014,10 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
bridge->map_irq = of_irq_parse_and_map_pci;
bridge->swizzle_irq = pci_common_swizzle;
- err = pci_scan_root_bus_bridge(bridge);
+ err = pci_host_probe(bridge);
if (err < 0)
goto err_remove_irq_domain;
- bus = bridge->bus;
-
- rockchip->root_bus = bus;
-
- pci_bus_size_bridges(bus);
- pci_bus_assign_resources(bus);
- list_for_each_entry(child, &bus->children, node)
- pcie_bus_configure_settings(child);
-
- pci_bus_add_devices(bus);
return 0;
err_remove_irq_domain:
@@ -1051,9 +1040,10 @@ static int rockchip_pcie_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct rockchip_pcie *rockchip = dev_get_drvdata(dev);
+ struct pci_host_bridge *bridge = pci_host_bridge_from_priv(rockchip);
- pci_stop_root_bus(rockchip->root_bus);
- pci_remove_root_bus(rockchip->root_bus);
+ pci_stop_root_bus(bridge->bus);
+ pci_remove_root_bus(bridge->bus);
irq_domain_remove(rockchip->irq_domain);
rockchip_pcie_deinit_phys(rockchip);
diff --git a/drivers/pci/controller/pcie-rockchip.h b/drivers/pci/controller/pcie-rockchip.h
index d90dfb354573..4012543bafbe 100644
--- a/drivers/pci/controller/pcie-rockchip.h
+++ b/drivers/pci/controller/pcie-rockchip.h
@@ -303,7 +303,6 @@ struct rockchip_pcie {
struct device *dev;
struct irq_domain *irq_domain;
int offset;
- struct pci_bus *root_bus;
void __iomem *msg_region;
phys_addr_t msg_bus_addr;
bool is_rc;
--
2.25.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 14/15] PCI: xilinx-nwl: Use pci_host_probe() to register host
2020-05-22 23:48 [PATCH 00/15] PCI controller probe cleanups Rob Herring
` (12 preceding siblings ...)
2020-05-22 23:48 ` [PATCH 13/15] PCI: rockchip: " Rob Herring
@ 2020-05-22 23:48 ` Rob Herring
2020-05-25 6:44 ` Michal Simek
2020-05-22 23:48 ` [PATCH 15/15] PCI: xilinx: " Rob Herring
2020-07-06 9:04 ` [PATCH 00/15] PCI controller probe cleanups Lorenzo Pieralisi
15 siblings, 1 reply; 24+ messages in thread
From: Rob Herring @ 2020-05-22 23:48 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel, Michal Simek
The xilinx-nwl host driver does the same host registration and bus scanning
calls as pci_host_probe, so let's use it instead.
The only difference is pci_assign_unassigned_bus_resources() was called
instead of pci_bus_size_bridges() and pci_bus_assign_resources(). This
should be the same.
Cc: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
drivers/pci/controller/pcie-xilinx-nwl.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c b/drivers/pci/controller/pcie-xilinx-nwl.c
index 9bd1427f2fd6..32a0b08d6da5 100644
--- a/drivers/pci/controller/pcie-xilinx-nwl.c
+++ b/drivers/pci/controller/pcie-xilinx-nwl.c
@@ -817,8 +817,6 @@ static int nwl_pcie_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct nwl_pcie *pcie;
- struct pci_bus *bus;
- struct pci_bus *child;
struct pci_host_bridge *bridge;
int err;
@@ -871,17 +869,7 @@ static int nwl_pcie_probe(struct platform_device *pdev)
}
}
- err = pci_scan_root_bus_bridge(bridge);
- if (err)
- return err;
-
- bus = bridge->bus;
-
- pci_assign_unassigned_bus_resources(bus);
- list_for_each_entry(child, &bus->children, node)
- pcie_bus_configure_settings(child);
- pci_bus_add_devices(bus);
- return 0;
+ return pci_host_probe(bridge);
}
static struct platform_driver nwl_pcie_driver = {
--
2.25.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 14/15] PCI: xilinx-nwl: Use pci_host_probe() to register host
2020-05-22 23:48 ` [PATCH 14/15] PCI: xilinx-nwl: " Rob Herring
@ 2020-05-25 6:44 ` Michal Simek
0 siblings, 0 replies; 24+ messages in thread
From: Michal Simek @ 2020-05-25 6:44 UTC (permalink / raw)
To: Rob Herring, Lorenzo Pieralisi
Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel, Michal Simek,
Bharat Kumar Gogada
On 23. 05. 20 1:48, Rob Herring wrote:
> The xilinx-nwl host driver does the same host registration and bus scanning
> calls as pci_host_probe, so let's use it instead.
>
> The only difference is pci_assign_unassigned_bus_resources() was called
> instead of pci_bus_size_bridges() and pci_bus_assign_resources(). This
> should be the same.
>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> drivers/pci/controller/pcie-xilinx-nwl.c | 14 +-------------
> 1 file changed, 1 insertion(+), 13 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c b/drivers/pci/controller/pcie-xilinx-nwl.c
> index 9bd1427f2fd6..32a0b08d6da5 100644
> --- a/drivers/pci/controller/pcie-xilinx-nwl.c
> +++ b/drivers/pci/controller/pcie-xilinx-nwl.c
> @@ -817,8 +817,6 @@ static int nwl_pcie_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct nwl_pcie *pcie;
> - struct pci_bus *bus;
> - struct pci_bus *child;
> struct pci_host_bridge *bridge;
> int err;
>
> @@ -871,17 +869,7 @@ static int nwl_pcie_probe(struct platform_device *pdev)
> }
> }
>
> - err = pci_scan_root_bus_bridge(bridge);
> - if (err)
> - return err;
> -
> - bus = bridge->bus;
> -
> - pci_assign_unassigned_bus_resources(bus);
> - list_for_each_entry(child, &bus->children, node)
> - pcie_bus_configure_settings(child);
> - pci_bus_add_devices(bus);
> - return 0;
> + return pci_host_probe(bridge);
> }
>
> static struct platform_driver nwl_pcie_driver = {
>
Bharat: Please review.
Thanks,
Michal
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 15/15] PCI: xilinx: Use pci_host_probe() to register host
2020-05-22 23:48 [PATCH 00/15] PCI controller probe cleanups Rob Herring
` (13 preceding siblings ...)
2020-05-22 23:48 ` [PATCH 14/15] PCI: xilinx-nwl: " Rob Herring
@ 2020-05-22 23:48 ` Rob Herring
2020-05-25 6:44 ` Michal Simek
2020-07-06 9:04 ` [PATCH 00/15] PCI controller probe cleanups Lorenzo Pieralisi
15 siblings, 1 reply; 24+ messages in thread
From: Rob Herring @ 2020-05-22 23:48 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel, Michal Simek
The xilinx host driver does the same host registration and bus scanning
calls as pci_host_probe, so let's use it instead.
The only difference is pci_assign_unassigned_bus_resources() was called
instead of pci_bus_size_bridges() and pci_bus_assign_resources(). This
should be the same.
Cc: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
drivers/pci/controller/pcie-xilinx.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/drivers/pci/controller/pcie-xilinx.c b/drivers/pci/controller/pcie-xilinx.c
index 98e55297815b..05547497f391 100644
--- a/drivers/pci/controller/pcie-xilinx.c
+++ b/drivers/pci/controller/pcie-xilinx.c
@@ -616,7 +616,6 @@ static int xilinx_pcie_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct xilinx_pcie_port *port;
- struct pci_bus *bus, *child;
struct pci_host_bridge *bridge;
int err;
@@ -663,17 +662,7 @@ static int xilinx_pcie_probe(struct platform_device *pdev)
xilinx_pcie_msi_chip.dev = dev;
bridge->msi = &xilinx_pcie_msi_chip;
#endif
- err = pci_scan_root_bus_bridge(bridge);
- if (err < 0)
- return err;
-
- bus = bridge->bus;
-
- pci_assign_unassigned_bus_resources(bus);
- list_for_each_entry(child, &bus->children, node)
- pcie_bus_configure_settings(child);
- pci_bus_add_devices(bus);
- return 0;
+ return pci_host_probe(bridge);
}
static const struct of_device_id xilinx_pcie_of_match[] = {
--
2.25.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 15/15] PCI: xilinx: Use pci_host_probe() to register host
2020-05-22 23:48 ` [PATCH 15/15] PCI: xilinx: " Rob Herring
@ 2020-05-25 6:44 ` Michal Simek
0 siblings, 0 replies; 24+ messages in thread
From: Michal Simek @ 2020-05-25 6:44 UTC (permalink / raw)
To: Rob Herring, Lorenzo Pieralisi
Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel, Michal Simek,
Bharat Kumar Gogada
On 23. 05. 20 1:48, Rob Herring wrote:
> The xilinx host driver does the same host registration and bus scanning
> calls as pci_host_probe, so let's use it instead.
>
> The only difference is pci_assign_unassigned_bus_resources() was called
> instead of pci_bus_size_bridges() and pci_bus_assign_resources(). This
> should be the same.
>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> drivers/pci/controller/pcie-xilinx.c | 13 +------------
> 1 file changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-xilinx.c b/drivers/pci/controller/pcie-xilinx.c
> index 98e55297815b..05547497f391 100644
> --- a/drivers/pci/controller/pcie-xilinx.c
> +++ b/drivers/pci/controller/pcie-xilinx.c
> @@ -616,7 +616,6 @@ static int xilinx_pcie_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct xilinx_pcie_port *port;
> - struct pci_bus *bus, *child;
> struct pci_host_bridge *bridge;
> int err;
>
> @@ -663,17 +662,7 @@ static int xilinx_pcie_probe(struct platform_device *pdev)
> xilinx_pcie_msi_chip.dev = dev;
> bridge->msi = &xilinx_pcie_msi_chip;
> #endif
> - err = pci_scan_root_bus_bridge(bridge);
> - if (err < 0)
> - return err;
> -
> - bus = bridge->bus;
> -
> - pci_assign_unassigned_bus_resources(bus);
> - list_for_each_entry(child, &bus->children, node)
> - pcie_bus_configure_settings(child);
> - pci_bus_add_devices(bus);
> - return 0;
> + return pci_host_probe(bridge);
> }
>
> static const struct of_device_id xilinx_pcie_of_match[] = {
>
Bharat: Please review.
Thanks,
Michal
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 00/15] PCI controller probe cleanups
2020-05-22 23:48 [PATCH 00/15] PCI controller probe cleanups Rob Herring
` (14 preceding siblings ...)
2020-05-22 23:48 ` [PATCH 15/15] PCI: xilinx: " Rob Herring
@ 2020-07-06 9:04 ` Lorenzo Pieralisi
15 siblings, 0 replies; 24+ messages in thread
From: Lorenzo Pieralisi @ 2020-07-06 9:04 UTC (permalink / raw)
To: Rob Herring; +Cc: Bjorn Helgaas, linux-pci, linux-arm-kernel
On Fri, May 22, 2020 at 05:48:17PM -0600, Rob Herring wrote:
> I started this on my last series of dma-ranges rework and am just
> getting back to finishing it. This series simplifies the resource list
> handling in a couple of drivers and converts almost all the remaining
> drivers to use pci_host_probe().
>
> The one holdout is Designware. This is due to the .scan_bus() hook
> which is only used by TI Keystone. I think it could be a fixup instead
> matching on the root bus id. I'm not sure though. See
> ks_pcie_v3_65_scan_bus().
>
> Rob
>
>
> Rob Herring (15):
> PCI: cadence: Use struct pci_host_bridge.windows list directly
> PCI: mvebu: Use struct pci_host_bridge.windows list directly
> PCI: host-common: Use struct pci_host_bridge.windows list directly
> PCI: brcmstb: Use pci_host_probe() to register host
> PCI: mobiveil: Use pci_host_probe() to register host
> PCI: tegra: Use pci_host_probe() to register host
> PCI: v3: Use pci_host_probe() to register host
> PCI: versatile: Use pci_host_probe() to register host
> PCI: xgene: Use pci_host_probe() to register host
> PCI: altera: Use pci_host_probe() to register host
> PCI: iproc: Use pci_host_probe() to register host
> PCI: rcar: Use pci_host_probe() to register host
> PCI: rockchip: Use pci_host_probe() to register host
> PCI: xilinx-nwl: Use pci_host_probe() to register host
> PCI: xilinx: Use pci_host_probe() to register host
>
> .../controller/cadence/pcie-cadence-host.c | 26 ++++----------
> .../controller/mobiveil/pcie-mobiveil-host.c | 16 +--------
> drivers/pci/controller/pci-host-common.c | 36 ++++++-------------
> drivers/pci/controller/pci-mvebu.c | 13 +++----
> drivers/pci/controller/pci-tegra.c | 11 +-----
> drivers/pci/controller/pci-v3-semi.c | 13 +------
> drivers/pci/controller/pci-versatile.c | 14 +-------
> drivers/pci/controller/pci-xgene.c | 13 +------
> drivers/pci/controller/pcie-altera.c | 17 +--------
> drivers/pci/controller/pcie-brcmstb.c | 20 +++--------
> drivers/pci/controller/pcie-iproc.c | 18 +++-------
> drivers/pci/controller/pcie-iproc.h | 2 --
> drivers/pci/controller/pcie-rcar-host.c | 18 +---------
> drivers/pci/controller/pcie-rockchip-host.c | 18 +++-------
> drivers/pci/controller/pcie-rockchip.h | 1 -
> drivers/pci/controller/pcie-xilinx-nwl.c | 14 +-------
> drivers/pci/controller/pcie-xilinx.c | 13 +------
> 17 files changed, 45 insertions(+), 218 deletions(-)
Applied to pci/misc for v5.9, thanks !
Lorenzo
^ permalink raw reply [flat|nested] 24+ messages in thread