* [PATCH Part1 v11 1/5] PCI: mvebu: Use pci_common_init_dev() to simplify code
2015-04-28 7:01 [PATCH Part1 v11 0/5] Some cleanup for pcie host drivers Yijing Wang
@ 2015-04-28 7:01 ` Yijing Wang
2015-05-27 0:11 ` Bjorn Helgaas
2015-04-28 7:01 ` [PATCH Part1 v11 2/5] PCI: tegra: Remove redundant tegra_pcie_scan_bus() Yijing Wang
` (5 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Yijing Wang @ 2015-04-28 7:01 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, dja, Arnd Bergmann, linux-arm-kernel, Yijing Wang,
Thomas Petazzoni, Jason Cooper
Mvebu_pcie_scan_bus() is not necessary, we could use
pci_common_init_dev() instead of pci_common_init(),
and pass the device pointer as the parent. Then
pci_scan_root_bus() will be called to scan the pci busses.
Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
CC: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
CC: Jason Cooper <jason@lakedaemon.net>
---
drivers/pci/host/pci-mvebu.c | 18 +-----------------
1 files changed, 1 insertions(+), 17 deletions(-)
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 1ab8635..70aa095 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -751,21 +751,6 @@ static int mvebu_pcie_setup(int nr, struct pci_sys_data *sys)
return 1;
}
-static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys)
-{
- struct mvebu_pcie *pcie = sys_to_pcie(sys);
- struct pci_bus *bus;
-
- bus = pci_create_root_bus(&pcie->pdev->dev, sys->busnr,
- &mvebu_pcie_ops, sys, &sys->resources);
- if (!bus)
- return NULL;
-
- pci_scan_child_bus(bus);
-
- return bus;
-}
-
static resource_size_t mvebu_pcie_align_resource(struct pci_dev *dev,
const struct resource *res,
resource_size_t start,
@@ -809,12 +794,11 @@ static void mvebu_pcie_enable(struct mvebu_pcie *pcie)
hw.nr_controllers = 1;
hw.private_data = (void **)&pcie;
hw.setup = mvebu_pcie_setup;
- hw.scan = mvebu_pcie_scan_bus;
hw.map_irq = of_irq_parse_and_map_pci;
hw.ops = &mvebu_pcie_ops;
hw.align_resource = mvebu_pcie_align_resource;
- pci_common_init(&hw);
+ pci_common_init_dev(&pcie->pdev->dev, &hw);
}
/*
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH Part1 v11 1/5] PCI: mvebu: Use pci_common_init_dev() to simplify code
2015-04-28 7:01 ` [PATCH Part1 v11 1/5] PCI: mvebu: Use pci_common_init_dev() to simplify code Yijing Wang
@ 2015-05-27 0:11 ` Bjorn Helgaas
0 siblings, 0 replies; 17+ messages in thread
From: Bjorn Helgaas @ 2015-05-27 0:11 UTC (permalink / raw)
To: Yijing Wang
Cc: linux-pci, dja, Arnd Bergmann, linux-arm-kernel,
Thomas Petazzoni, Jason Cooper
On Tue, Apr 28, 2015 at 03:01:35PM +0800, Yijing Wang wrote:
> Mvebu_pcie_scan_bus() is not necessary, we could use
> pci_common_init_dev() instead of pci_common_init(),
> and pass the device pointer as the parent. Then
> pci_scan_root_bus() will be called to scan the pci busses.
>
> Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> CC: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> CC: Jason Cooper <jason@lakedaemon.net>
Thomas, Jason, any input?
> ---
> drivers/pci/host/pci-mvebu.c | 18 +-----------------
> 1 files changed, 1 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
> index 1ab8635..70aa095 100644
> --- a/drivers/pci/host/pci-mvebu.c
> +++ b/drivers/pci/host/pci-mvebu.c
> @@ -751,21 +751,6 @@ static int mvebu_pcie_setup(int nr, struct pci_sys_data *sys)
> return 1;
> }
>
> -static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys)
> -{
> - struct mvebu_pcie *pcie = sys_to_pcie(sys);
> - struct pci_bus *bus;
> -
> - bus = pci_create_root_bus(&pcie->pdev->dev, sys->busnr,
> - &mvebu_pcie_ops, sys, &sys->resources);
> - if (!bus)
> - return NULL;
> -
> - pci_scan_child_bus(bus);
> -
> - return bus;
> -}
> -
> static resource_size_t mvebu_pcie_align_resource(struct pci_dev *dev,
> const struct resource *res,
> resource_size_t start,
> @@ -809,12 +794,11 @@ static void mvebu_pcie_enable(struct mvebu_pcie *pcie)
> hw.nr_controllers = 1;
> hw.private_data = (void **)&pcie;
> hw.setup = mvebu_pcie_setup;
> - hw.scan = mvebu_pcie_scan_bus;
> hw.map_irq = of_irq_parse_and_map_pci;
> hw.ops = &mvebu_pcie_ops;
> hw.align_resource = mvebu_pcie_align_resource;
>
> - pci_common_init(&hw);
> + pci_common_init_dev(&pcie->pdev->dev, &hw);
> }
>
> /*
> --
> 1.7.1
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH Part1 v11 2/5] PCI: tegra: Remove redundant tegra_pcie_scan_bus()
2015-04-28 7:01 [PATCH Part1 v11 0/5] Some cleanup for pcie host drivers Yijing Wang
2015-04-28 7:01 ` [PATCH Part1 v11 1/5] PCI: mvebu: Use pci_common_init_dev() to simplify code Yijing Wang
@ 2015-04-28 7:01 ` Yijing Wang
2015-04-28 7:01 ` [PATCH Part1 v11 3/5] PCI: designware: Use pci_scan_root_bus() for simplicity Yijing Wang
` (4 subsequent siblings)
6 siblings, 0 replies; 17+ messages in thread
From: Yijing Wang @ 2015-04-28 7:01 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, dja, Arnd Bergmann, linux-arm-kernel, Yijing Wang,
Thierry Reding, linux-tegra
Now pci_scan_root_bus() is almost similar to
pci_create_root_bus() + pci_scan_child_bus().
So we could use common pci_scan_root_bus() in
pci_common_init_dev() to scan pci busses.
tegra_pcie_scan_bus() is redundant, remove it.
Tested-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Acked-by: Thierry Reding <treding@nvidia.com>
CC: Thierry Reding <thierry.reding@gmail.com>
CC: linux-tegra@vger.kernel.org
---
drivers/pci/host/pci-tegra.c | 16 ----------------
1 files changed, 0 insertions(+), 16 deletions(-)
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 00e9272..10c0571 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -630,21 +630,6 @@ static int tegra_pcie_map_irq(const struct pci_dev *pdev, u8 slot, u8 pin)
return irq;
}
-static struct pci_bus *tegra_pcie_scan_bus(int nr, struct pci_sys_data *sys)
-{
- struct tegra_pcie *pcie = sys_to_pcie(sys);
- struct pci_bus *bus;
-
- bus = pci_create_root_bus(pcie->dev, sys->busnr, &tegra_pcie_ops, sys,
- &sys->resources);
- if (!bus)
- return NULL;
-
- pci_scan_child_bus(bus);
-
- return bus;
-}
-
static irqreturn_t tegra_pcie_isr(int irq, void *arg)
{
const char *err_msg[] = {
@@ -1831,7 +1816,6 @@ static int tegra_pcie_enable(struct tegra_pcie *pcie)
hw.private_data = (void **)&pcie;
hw.setup = tegra_pcie_setup;
hw.map_irq = tegra_pcie_map_irq;
- hw.scan = tegra_pcie_scan_bus;
hw.ops = &tegra_pcie_ops;
pci_common_init_dev(pcie->dev, &hw);
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH Part1 v11 3/5] PCI: designware: Use pci_scan_root_bus() for simplicity
2015-04-28 7:01 [PATCH Part1 v11 0/5] Some cleanup for pcie host drivers Yijing Wang
2015-04-28 7:01 ` [PATCH Part1 v11 1/5] PCI: mvebu: Use pci_common_init_dev() to simplify code Yijing Wang
2015-04-28 7:01 ` [PATCH Part1 v11 2/5] PCI: tegra: Remove redundant tegra_pcie_scan_bus() Yijing Wang
@ 2015-04-28 7:01 ` Yijing Wang
2015-04-28 8:15 ` Lucas Stach
2015-05-27 0:12 ` Bjorn Helgaas
2015-04-28 7:01 ` [PATCH Part1 v11 4/5] PCI: xgene: Use pci_scan_root_bus() instead of pci_create_root_bus() Yijing Wang
` (3 subsequent siblings)
6 siblings, 2 replies; 17+ messages in thread
From: Yijing Wang @ 2015-04-28 7:01 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, dja, Arnd Bergmann, linux-arm-kernel, Yijing Wang,
Mohit Kumar, Jingoo Han
Pci_bus_add_devices() was ripped out of pci_scan_root_bus().
Now pci_scan_root_bus() == pci_create_root_bus() +
pci_scan_child_bus() if busn resource is supplied.
Designware added the busn resource to resources list
in dw_pcie_setup(). So it should be safe to use
pci_scan_root_bus() instead.
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: Mohit Kumar <mohit.kumar@st.com>
CC: Jingoo Han <jg1.han@samsung.com>
---
drivers/pci/host/pcie-designware.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
index 2e9f84f..8c80f38 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -728,13 +728,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
struct pcie_port *pp = sys_to_pcie(sys);
pp->root_bus_nr = sys->busnr;
- bus = pci_create_root_bus(pp->dev, sys->busnr,
+ bus = pci_scan_root_bus(pp->dev, sys->busnr,
&dw_pcie_ops, sys, &sys->resources);
if (!bus)
return NULL;
- pci_scan_child_bus(bus);
-
if (bus && pp->ops->scan_bus)
pp->ops->scan_bus(pp);
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH Part1 v11 3/5] PCI: designware: Use pci_scan_root_bus() for simplicity
2015-04-28 7:01 ` [PATCH Part1 v11 3/5] PCI: designware: Use pci_scan_root_bus() for simplicity Yijing Wang
@ 2015-04-28 8:15 ` Lucas Stach
2015-05-27 0:12 ` Bjorn Helgaas
1 sibling, 0 replies; 17+ messages in thread
From: Lucas Stach @ 2015-04-28 8:15 UTC (permalink / raw)
To: Yijing Wang
Cc: Bjorn Helgaas, Arnd Bergmann, linux-pci, Jingoo Han, Mohit Kumar,
linux-arm-kernel, dja
Am Dienstag, den 28.04.2015, 15:01 +0800 schrieb Yijing Wang:
> Pci_bus_add_devices() was ripped out of pci_scan_root_bus().
> Now pci_scan_root_bus() == pci_create_root_bus() +
> pci_scan_child_bus() if busn resource is supplied.
> Designware added the busn resource to resources list
> in dw_pcie_setup(). So it should be safe to use
> pci_scan_root_bus() instead.
>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> CC: Mohit Kumar <mohit.kumar@st.com>
> CC: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> drivers/pci/host/pcie-designware.c | 4 +---
> 1 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
> index 2e9f84f..8c80f38 100644
> --- a/drivers/pci/host/pcie-designware.c
> +++ b/drivers/pci/host/pcie-designware.c
> @@ -728,13 +728,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
> struct pcie_port *pp = sys_to_pcie(sys);
>
> pp->root_bus_nr = sys->busnr;
> - bus = pci_create_root_bus(pp->dev, sys->busnr,
> + bus = pci_scan_root_bus(pp->dev, sys->busnr,
> &dw_pcie_ops, sys, &sys->resources);
> if (!bus)
> return NULL;
>
> - pci_scan_child_bus(bus);
> -
> if (bus && pp->ops->scan_bus)
> pp->ops->scan_bus(pp);
>
--
Pengutronix e.K. | Lucas Stach |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH Part1 v11 3/5] PCI: designware: Use pci_scan_root_bus() for simplicity
2015-04-28 7:01 ` [PATCH Part1 v11 3/5] PCI: designware: Use pci_scan_root_bus() for simplicity Yijing Wang
2015-04-28 8:15 ` Lucas Stach
@ 2015-05-27 0:12 ` Bjorn Helgaas
1 sibling, 0 replies; 17+ messages in thread
From: Bjorn Helgaas @ 2015-05-27 0:12 UTC (permalink / raw)
To: Yijing Wang
Cc: linux-pci, dja, Arnd Bergmann, linux-arm-kernel, Mohit Kumar,
Jingoo Han, Pratyush Anand
[+cc Pratyush]
On Tue, Apr 28, 2015 at 03:01:37PM +0800, Yijing Wang wrote:
> Pci_bus_add_devices() was ripped out of pci_scan_root_bus().
> Now pci_scan_root_bus() == pci_create_root_bus() +
> pci_scan_child_bus() if busn resource is supplied.
> Designware added the busn resource to resources list
> in dw_pcie_setup(). So it should be safe to use
> pci_scan_root_bus() instead.
>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> CC: Mohit Kumar <mohit.kumar@st.com>
> CC: Jingoo Han <jg1.han@samsung.com>
Jingoo, Pratyush?
> ---
> drivers/pci/host/pcie-designware.c | 4 +---
> 1 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
> index 2e9f84f..8c80f38 100644
> --- a/drivers/pci/host/pcie-designware.c
> +++ b/drivers/pci/host/pcie-designware.c
> @@ -728,13 +728,11 @@ static struct pci_bus *dw_pcie_scan_bus(int nr, struct pci_sys_data *sys)
> struct pcie_port *pp = sys_to_pcie(sys);
>
> pp->root_bus_nr = sys->busnr;
> - bus = pci_create_root_bus(pp->dev, sys->busnr,
> + bus = pci_scan_root_bus(pp->dev, sys->busnr,
> &dw_pcie_ops, sys, &sys->resources);
> if (!bus)
> return NULL;
>
> - pci_scan_child_bus(bus);
> -
> if (bus && pp->ops->scan_bus)
> pp->ops->scan_bus(pp);
>
> --
> 1.7.1
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH Part1 v11 4/5] PCI: xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
2015-04-28 7:01 [PATCH Part1 v11 0/5] Some cleanup for pcie host drivers Yijing Wang
` (2 preceding siblings ...)
2015-04-28 7:01 ` [PATCH Part1 v11 3/5] PCI: designware: Use pci_scan_root_bus() for simplicity Yijing Wang
@ 2015-04-28 7:01 ` Yijing Wang
2015-05-27 15:47 ` Bjorn Helgaas
2015-04-28 7:01 ` [PATCH Part1 v11 5/5] PCI: iproc: " Yijing Wang
` (2 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Yijing Wang @ 2015-04-28 7:01 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, dja, Arnd Bergmann, linux-arm-kernel, Yijing Wang,
Tanmay Inamdar
Pci_bus_add_devices() was ripped out of pci_scan_root_bus().
Now pci_scan_root_bus() == pci_create_root_bus() +
pci_scan_child_bus() if busn resource is supplied.
Xgene added the busn resource to resources list
in of_pci_get_host_bridge_resources(). So it should be safe
to use pci_scan_root_bus() instead.
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: Tanmay Inamdar <tinamdar@apm.com>
---
drivers/pci/host/pci-xgene.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index ee082c0..87e3962 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -499,12 +499,11 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev)
if (ret)
return ret;
- bus = pci_create_root_bus(&pdev->dev, 0,
+ bus = pci_scan_root_bus(&pdev->dev, 0,
&xgene_pcie_ops, port, &res);
if (!bus)
return -ENOMEM;
- pci_scan_child_bus(bus);
pci_assign_unassigned_bus_resources(bus);
pci_bus_add_devices(bus);
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH Part1 v11 4/5] PCI: xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
2015-04-28 7:01 ` [PATCH Part1 v11 4/5] PCI: xgene: Use pci_scan_root_bus() instead of pci_create_root_bus() Yijing Wang
@ 2015-05-27 15:47 ` Bjorn Helgaas
2015-05-27 17:21 ` Tanmay Inamdar
0 siblings, 1 reply; 17+ messages in thread
From: Bjorn Helgaas @ 2015-05-27 15:47 UTC (permalink / raw)
To: Yijing Wang
Cc: linux-pci, dja, Arnd Bergmann, linux-arm-kernel, Tanmay Inamdar
On Tue, Apr 28, 2015 at 03:01:38PM +0800, Yijing Wang wrote:
> Pci_bus_add_devices() was ripped out of pci_scan_root_bus().
> Now pci_scan_root_bus() == pci_create_root_bus() +
> pci_scan_child_bus() if busn resource is supplied.
> Xgene added the busn resource to resources list
> in of_pci_get_host_bridge_resources(). So it should be safe
> to use pci_scan_root_bus() instead.
>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> CC: Tanmay Inamdar <tinamdar@apm.com>
Tanmay, any comments on this?
> ---
> drivers/pci/host/pci-xgene.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
> index ee082c0..87e3962 100644
> --- a/drivers/pci/host/pci-xgene.c
> +++ b/drivers/pci/host/pci-xgene.c
> @@ -499,12 +499,11 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev)
> if (ret)
> return ret;
>
> - bus = pci_create_root_bus(&pdev->dev, 0,
> + bus = pci_scan_root_bus(&pdev->dev, 0,
> &xgene_pcie_ops, port, &res);
> if (!bus)
> return -ENOMEM;
>
> - pci_scan_child_bus(bus);
> pci_assign_unassigned_bus_resources(bus);
> pci_bus_add_devices(bus);
>
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH Part1 v11 4/5] PCI: xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
2015-05-27 15:47 ` Bjorn Helgaas
@ 2015-05-27 17:21 ` Tanmay Inamdar
2015-06-16 18:49 ` Bjorn Helgaas
0 siblings, 1 reply; 17+ messages in thread
From: Tanmay Inamdar @ 2015-05-27 17:21 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Yijing Wang, linux-pci, dja, Arnd Bergmann, linux-arm-kernel
On Wed, May 27, 2015 at 8:47 AM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> On Tue, Apr 28, 2015 at 03:01:38PM +0800, Yijing Wang wrote:
>> Pci_bus_add_devices() was ripped out of pci_scan_root_bus().
>> Now pci_scan_root_bus() == pci_create_root_bus() +
>> pci_scan_child_bus() if busn resource is supplied.
>> Xgene added the busn resource to resources list
>> in of_pci_get_host_bridge_resources(). So it should be safe
>> to use pci_scan_root_bus() instead.
>>
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>> CC: Tanmay Inamdar <tinamdar@apm.com>
>
> Tanmay, any comments on this?
>
Looks good to me.
Acked-by: Tanmay Inamdar <tinamdar@apm.com>
>> ---
>> drivers/pci/host/pci-xgene.c | 3 +--
>> 1 files changed, 1 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
>> index ee082c0..87e3962 100644
>> --- a/drivers/pci/host/pci-xgene.c
>> +++ b/drivers/pci/host/pci-xgene.c
>> @@ -499,12 +499,11 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev)
>> if (ret)
>> return ret;
>>
>> - bus = pci_create_root_bus(&pdev->dev, 0,
>> + bus = pci_scan_root_bus(&pdev->dev, 0,
>> &xgene_pcie_ops, port, &res);
>> if (!bus)
>> return -ENOMEM;
>>
>> - pci_scan_child_bus(bus);
>> pci_assign_unassigned_bus_resources(bus);
>> pci_bus_add_devices(bus);
>>
>> --
>> 1.7.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH Part1 v11 4/5] PCI: xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
2015-05-27 17:21 ` Tanmay Inamdar
@ 2015-06-16 18:49 ` Bjorn Helgaas
0 siblings, 0 replies; 17+ messages in thread
From: Bjorn Helgaas @ 2015-06-16 18:49 UTC (permalink / raw)
To: Tanmay Inamdar
Cc: Yijing Wang, linux-pci, dja, Arnd Bergmann, linux-arm-kernel,
Duc Dang, Loc Ho
[+cc Duc, Loc]
On Wed, May 27, 2015 at 10:21:40AM -0700, Tanmay Inamdar wrote:
> On Wed, May 27, 2015 at 8:47 AM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> > On Tue, Apr 28, 2015 at 03:01:38PM +0800, Yijing Wang wrote:
> >> Pci_bus_add_devices() was ripped out of pci_scan_root_bus().
> >> Now pci_scan_root_bus() == pci_create_root_bus() +
> >> pci_scan_child_bus() if busn resource is supplied.
> >> Xgene added the busn resource to resources list
> >> in of_pci_get_host_bridge_resources(). So it should be safe
> >> to use pci_scan_root_bus() instead.
> >>
> >> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> >> CC: Tanmay Inamdar <tinamdar@apm.com>
> >
> > Tanmay, any comments on this?
> >
>
> Looks good to me.
>
> Acked-by: Tanmay Inamdar <tinamdar@apm.com>
I had applied this, but dropped it because it conflicted with Duc's
MSI patch, which adds a call to xgene_pcie_msi_enable() between
pci_create_root_bus() and pci_scan_child_bus().
We should figure out a better way to do this, e.g., with
pci_host_bridge_ops, so we can use pci_scan_root_bus() on X-Gene. But we
don't have that yet.
> >> ---
> >> drivers/pci/host/pci-xgene.c | 3 +--
> >> 1 files changed, 1 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
> >> index ee082c0..87e3962 100644
> >> --- a/drivers/pci/host/pci-xgene.c
> >> +++ b/drivers/pci/host/pci-xgene.c
> >> @@ -499,12 +499,11 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev)
> >> if (ret)
> >> return ret;
> >>
> >> - bus = pci_create_root_bus(&pdev->dev, 0,
> >> + bus = pci_scan_root_bus(&pdev->dev, 0,
> >> &xgene_pcie_ops, port, &res);
> >> if (!bus)
> >> return -ENOMEM;
> >>
> >> - pci_scan_child_bus(bus);
> >> pci_assign_unassigned_bus_resources(bus);
> >> pci_bus_add_devices(bus);
> >>
> >> --
> >> 1.7.1
> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH Part1 v11 5/5] PCI: iproc: Use pci_scan_root_bus() instead of pci_create_root_bus()
2015-04-28 7:01 [PATCH Part1 v11 0/5] Some cleanup for pcie host drivers Yijing Wang
` (3 preceding siblings ...)
2015-04-28 7:01 ` [PATCH Part1 v11 4/5] PCI: xgene: Use pci_scan_root_bus() instead of pci_create_root_bus() Yijing Wang
@ 2015-04-28 7:01 ` Yijing Wang
2015-04-28 16:38 ` Ray Jui
2015-04-29 1:12 ` Yijing Wang
2015-05-14 8:32 ` [PATCH Part1 v11 0/5] Some cleanup for pcie host drivers Yijing Wang
2015-05-27 16:45 ` Bjorn Helgaas
6 siblings, 2 replies; 17+ messages in thread
From: Yijing Wang @ 2015-04-28 7:01 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, dja, Arnd Bergmann, linux-arm-kernel, Yijing Wang, Ray Jui
Pci_bus_add_devices() was ripped out of pci_scan_root_bus().
Now pci_scan_root_bus() == pci_create_root_bus() +
pci_scan_child_bus() if busn resource is supplied.
iproc added the busn resource to resources list
in of_pci_get_host_bridge_resources(). So it should be safe
to use pci_scan_root_bus() instead.
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
CC: Ray Jui <rjui@broadcom.com>
---
drivers/pci/host/pcie-iproc.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
index 329e1b5..9622ebf 100644
--- a/drivers/pci/host/pcie-iproc.c
+++ b/drivers/pci/host/pcie-iproc.c
@@ -210,10 +210,10 @@ int iproc_pcie_setup(struct iproc_pcie *pcie)
pcie->sysdata.private_data = pcie;
- bus = pci_create_root_bus(pcie->dev, 0, &iproc_pcie_ops,
+ bus = pci_scan_root_bus(pcie->dev, 0, &iproc_pcie_ops,
&pcie->sysdata, pcie->resources);
if (!bus) {
- dev_err(pcie->dev, "unable to create PCI root bus\n");
+ dev_err(pcie->dev, "unable to scan PCI root bus\n");
ret = -ENOMEM;
goto err_power_off_phy;
}
@@ -227,7 +227,6 @@ int iproc_pcie_setup(struct iproc_pcie *pcie)
iproc_pcie_enable(pcie);
- pci_scan_child_bus(bus);
pci_assign_unassigned_bus_resources(bus);
pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci);
pci_bus_add_devices(bus);
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH Part1 v11 5/5] PCI: iproc: Use pci_scan_root_bus() instead of pci_create_root_bus()
2015-04-28 7:01 ` [PATCH Part1 v11 5/5] PCI: iproc: " Yijing Wang
@ 2015-04-28 16:38 ` Ray Jui
2015-04-29 1:08 ` Yijing Wang
2015-04-29 1:12 ` Yijing Wang
1 sibling, 1 reply; 17+ messages in thread
From: Ray Jui @ 2015-04-28 16:38 UTC (permalink / raw)
To: Yijing Wang, Bjorn Helgaas
Cc: linux-pci, dja, Arnd Bergmann, linux-arm-kernel
Hi Yijing,
On 4/28/2015 12:01 AM, Yijing Wang wrote:
> Pci_bus_add_devices() was ripped out of pci_scan_root_bus().
> Now pci_scan_root_bus() == pci_create_root_bus() +
> pci_scan_child_bus() if busn resource is supplied.
> iproc added the busn resource to resources list
> in of_pci_get_host_bridge_resources(). So it should be safe
> to use pci_scan_root_bus() instead.
>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> CC: Ray Jui <rjui@broadcom.com>
> ---
> drivers/pci/host/pcie-iproc.c | 5 ++---
> 1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
> index 329e1b5..9622ebf 100644
> --- a/drivers/pci/host/pcie-iproc.c
> +++ b/drivers/pci/host/pcie-iproc.c
> @@ -210,10 +210,10 @@ int iproc_pcie_setup(struct iproc_pcie *pcie)
>
> pcie->sysdata.private_data = pcie;
>
> - bus = pci_create_root_bus(pcie->dev, 0, &iproc_pcie_ops,
> + bus = pci_scan_root_bus(pcie->dev, 0, &iproc_pcie_ops,
> &pcie->sysdata, pcie->resources);
> if (!bus) {
> - dev_err(pcie->dev, "unable to create PCI root bus\n");
> + dev_err(pcie->dev, "unable to scan PCI root bus\n");
> ret = -ENOMEM;
> goto err_power_off_phy;
> }
iproc_pcie_check_link is called here by using the 'bus' structure
returned from pci_create_root_bus. In iproc_pcie_check_link, we
configure root bus class to PCI_CLASS_BRIDGE_PCI and validate to ensure
a stable link between RC and EP can be detected.
> @@ -227,7 +227,6 @@ int iproc_pcie_setup(struct iproc_pcie *pcie)
>
> iproc_pcie_enable(pcie);
Here we enable INTx support for our RC controller.
>
> - pci_scan_child_bus(bus);
Here, if pci_scan_child_bus is moved to before iproc_pcie_check_link, I
don't think it would work (although I have not tested this).
An alternative is to use a dummy bus structure to feed into
iproc_pcie_check_link, and call iproc_pcie_check_link and
iproc_pcie_enable before pci_scan_root_bus. But the reason I put the
link check code in between pci_create_root_bus and pci_scan_child_bus
was to avoid using a dummy bus structure, :)
> pci_assign_unassigned_bus_resources(bus);
> pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci);
> pci_bus_add_devices(bus);
>
Thanks,
Ray
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH Part1 v11 5/5] PCI: iproc: Use pci_scan_root_bus() instead of pci_create_root_bus()
2015-04-28 16:38 ` Ray Jui
@ 2015-04-29 1:08 ` Yijing Wang
0 siblings, 0 replies; 17+ messages in thread
From: Yijing Wang @ 2015-04-29 1:08 UTC (permalink / raw)
To: Ray Jui, Bjorn Helgaas; +Cc: linux-pci, dja, Arnd Bergmann, linux-arm-kernel
>> @@ -210,10 +210,10 @@ int iproc_pcie_setup(struct iproc_pcie *pcie)
>>
>> pcie->sysdata.private_data = pcie;
>>
>> - bus = pci_create_root_bus(pcie->dev, 0, &iproc_pcie_ops,
>> + bus = pci_scan_root_bus(pcie->dev, 0, &iproc_pcie_ops,
>> &pcie->sysdata, pcie->resources);
>> if (!bus) {
>> - dev_err(pcie->dev, "unable to create PCI root bus\n");
>> + dev_err(pcie->dev, "unable to scan PCI root bus\n");
>> ret = -ENOMEM;
>> goto err_power_off_phy;
>> }
>
> iproc_pcie_check_link is called here by using the 'bus' structure
> returned from pci_create_root_bus. In iproc_pcie_check_link, we
> configure root bus class to PCI_CLASS_BRIDGE_PCI and validate to ensure
> a stable link between RC and EP can be detected.
Oh, I got it. Thanks for your explanation.
>
>> @@ -227,7 +227,6 @@ int iproc_pcie_setup(struct iproc_pcie *pcie)
>>
>> iproc_pcie_enable(pcie);
>
> Here we enable INTx support for our RC controller.
>
>>
>> - pci_scan_child_bus(bus);
>
> Here, if pci_scan_child_bus is moved to before iproc_pcie_check_link, I
> don't think it would work (although I have not tested this).
>
> An alternative is to use a dummy bus structure to feed into
> iproc_pcie_check_link, and call iproc_pcie_check_link and
> iproc_pcie_enable before pci_scan_root_bus. But the reason I put the
> link check code in between pci_create_root_bus and pci_scan_child_bus
> was to avoid using a dummy bus structure, :)
Maybe we could refactor this by add a new pci_host_bridge_ops in the later patch.
>
>> pci_assign_unassigned_bus_resources(bus);
>> pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci);
>> pci_bus_add_devices(bus);
>>
>
> Thanks,
>
> Ray
>
> .
>
--
Thanks!
Yijing
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH Part1 v11 5/5] PCI: iproc: Use pci_scan_root_bus() instead of pci_create_root_bus()
2015-04-28 7:01 ` [PATCH Part1 v11 5/5] PCI: iproc: " Yijing Wang
2015-04-28 16:38 ` Ray Jui
@ 2015-04-29 1:12 ` Yijing Wang
1 sibling, 0 replies; 17+ messages in thread
From: Yijing Wang @ 2015-04-29 1:12 UTC (permalink / raw)
To: Yijing Wang, Bjorn Helgaas
Cc: linux-pci, dja, Arnd Bergmann, linux-arm-kernel, Ray Jui
Hi Bjorn, please ignore this patch, it's not correct. I prefer to refactor it by add a new pci_host_bridge_ops in later patch.
What do you think about the prior four patches ? I hope they could be merged first, they are independent.
Thanks!
Yijing.
On 2015/4/28 15:01, Yijing Wang wrote:
> Pci_bus_add_devices() was ripped out of pci_scan_root_bus().
> Now pci_scan_root_bus() == pci_create_root_bus() +
> pci_scan_child_bus() if busn resource is supplied.
> iproc added the busn resource to resources list
> in of_pci_get_host_bridge_resources(). So it should be safe
> to use pci_scan_root_bus() instead.
>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> CC: Ray Jui <rjui@broadcom.com>
> ---
> drivers/pci/host/pcie-iproc.c | 5 ++---
> 1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
> index 329e1b5..9622ebf 100644
> --- a/drivers/pci/host/pcie-iproc.c
> +++ b/drivers/pci/host/pcie-iproc.c
> @@ -210,10 +210,10 @@ int iproc_pcie_setup(struct iproc_pcie *pcie)
>
> pcie->sysdata.private_data = pcie;
>
> - bus = pci_create_root_bus(pcie->dev, 0, &iproc_pcie_ops,
> + bus = pci_scan_root_bus(pcie->dev, 0, &iproc_pcie_ops,
> &pcie->sysdata, pcie->resources);
> if (!bus) {
> - dev_err(pcie->dev, "unable to create PCI root bus\n");
> + dev_err(pcie->dev, "unable to scan PCI root bus\n");
> ret = -ENOMEM;
> goto err_power_off_phy;
> }
> @@ -227,7 +227,6 @@ int iproc_pcie_setup(struct iproc_pcie *pcie)
>
> iproc_pcie_enable(pcie);
>
> - pci_scan_child_bus(bus);
> pci_assign_unassigned_bus_resources(bus);
> pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci);
> pci_bus_add_devices(bus);
>
--
Thanks!
Yijing
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH Part1 v11 0/5] Some cleanup for pcie host drivers
2015-04-28 7:01 [PATCH Part1 v11 0/5] Some cleanup for pcie host drivers Yijing Wang
` (4 preceding siblings ...)
2015-04-28 7:01 ` [PATCH Part1 v11 5/5] PCI: iproc: " Yijing Wang
@ 2015-05-14 8:32 ` Yijing Wang
2015-05-27 16:45 ` Bjorn Helgaas
6 siblings, 0 replies; 17+ messages in thread
From: Yijing Wang @ 2015-05-14 8:32 UTC (permalink / raw)
To: Yijing Wang, Bjorn Helgaas
Cc: linux-pci, dja, Arnd Bergmann, linux-arm-kernel
Hi Bjorn, sorry to bother you, do you have time to look at these patches ?
On 2015/4/28 15:01, Yijing Wang wrote:
> These patches are split out from patchset(patch 5 is new)
> "Refine PCI scan interfaces and make generic pci host bridge".
> They are independent of the series, pci_bus_add_devices()
> has been ripped out from pci_scan_root_bus(), so we could
> use pci_scan_root_bus() instead of pci_create_root_bus() +
> pci_scan_child_bus() for simplicity. Also this is the preparation
> for the series.
>
> Yijing Wang (5):
> PCI: mvebu: Use pci_common_init_dev() to simplify code
> PCI: tegra: Remove redundant tegra_pcie_scan_bus()
> PCI: designware: Use pci_scan_root_bus() for simplicity
> PCI: xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
> PCI: iproc: Use pci_scan_root_bus() instead of pci_create_root_bus()
>
> drivers/pci/host/pci-mvebu.c | 18 +-----------------
> drivers/pci/host/pci-tegra.c | 16 ----------------
> drivers/pci/host/pci-xgene.c | 3 +--
> drivers/pci/host/pcie-designware.c | 4 +---
> drivers/pci/host/pcie-iproc.c | 5 ++---
> 5 files changed, 5 insertions(+), 41 deletions(-)
>
>
> .
>
--
Thanks!
Yijing
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH Part1 v11 0/5] Some cleanup for pcie host drivers
2015-04-28 7:01 [PATCH Part1 v11 0/5] Some cleanup for pcie host drivers Yijing Wang
` (5 preceding siblings ...)
2015-05-14 8:32 ` [PATCH Part1 v11 0/5] Some cleanup for pcie host drivers Yijing Wang
@ 2015-05-27 16:45 ` Bjorn Helgaas
6 siblings, 0 replies; 17+ messages in thread
From: Bjorn Helgaas @ 2015-05-27 16:45 UTC (permalink / raw)
To: Yijing Wang; +Cc: linux-pci, dja, Arnd Bergmann, linux-arm-kernel
On Tue, Apr 28, 2015 at 03:01:34PM +0800, Yijing Wang wrote:
> These patches are split out from patchset(patch 5 is new)
> "Refine PCI scan interfaces and make generic pci host bridge".
> They are independent of the series, pci_bus_add_devices()
> has been ripped out from pci_scan_root_bus(), so we could
> use pci_scan_root_bus() instead of pci_create_root_bus() +
> pci_scan_child_bus() for simplicity. Also this is the preparation
> for the series.
>
> Yijing Wang (5):
> PCI: mvebu: Use pci_common_init_dev() to simplify code
> PCI: tegra: Remove redundant tegra_pcie_scan_bus()
> PCI: designware: Use pci_scan_root_bus() for simplicity
> PCI: xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
I applied the four patches above to pci/enumeration for v4.2, thanks.
> PCI: iproc: Use pci_scan_root_bus() instead of pci_create_root_bus()
>
> drivers/pci/host/pci-mvebu.c | 18 +-----------------
> drivers/pci/host/pci-tegra.c | 16 ----------------
> drivers/pci/host/pci-xgene.c | 3 +--
> drivers/pci/host/pcie-designware.c | 4 +---
> drivers/pci/host/pcie-iproc.c | 5 ++---
> 5 files changed, 5 insertions(+), 41 deletions(-)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread