* [PATCHv2] PCI: iproc: platform: use device functions instead of OF.
@ 2026-07-27 23:44 Rosen Penev
2026-07-30 0:32 ` Rob Herring
2026-08-13 6:36 ` Manivannan Sadhasivam
0 siblings, 2 replies; 5+ messages in thread
From: Rosen Penev @ 2026-07-27 23:44 UTC (permalink / raw)
To: linux-pci
Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Ray Jui,
Scott Branden, Broadcom internal kernel review list,
moderated list:BROADCOM IPROC ARM ARCHITECTURE, open list
Since this is supposed to be the higher layer file, use higher layer
than OF to handle this. Remove OF headers as a result.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
v2: fix platform_get_resource() parameters.
drivers/pci/controller/pcie-iproc-platform.c | 31 ++++++++------------
1 file changed, 12 insertions(+), 19 deletions(-)
diff --git a/drivers/pci/controller/pcie-iproc-platform.c b/drivers/pci/controller/pcie-iproc-platform.c
index 4c9a0c4bb923..488ff737ec52 100644
--- a/drivers/pci/controller/pcie-iproc-platform.c
+++ b/drivers/pci/controller/pcie-iproc-platform.c
@@ -10,12 +10,8 @@
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
-#include <linux/of_address.h>
-#include <linux/of_pci.h>
-#include <linux/of_platform.h>
#include <linux/phy/phy.h>
-#include "../pci.h"
#include "pcie-iproc.h"
static const struct of_device_id iproc_pcie_of_match_table[] = {
@@ -40,11 +36,14 @@ static int iproc_pltfm_pcie_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct iproc_pcie *pcie;
- struct device_node *np = dev->of_node;
- struct resource reg;
+ struct resource *reg;
struct pci_host_bridge *bridge;
int ret;
+ reg = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!reg)
+ return -ENODEV;
+
bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
if (!bridge)
return -ENOMEM;
@@ -52,26 +51,20 @@ static int iproc_pltfm_pcie_probe(struct platform_device *pdev)
pcie = pci_host_bridge_priv(bridge);
pcie->dev = dev;
- pcie->type = (uintptr_t)of_device_get_match_data(dev);
-
- ret = of_address_to_resource(np, 0, ®);
- if (ret < 0) {
- dev_err(dev, "unable to obtain controller resources\n");
- return ret;
- }
+ pcie->type = (uintptr_t)device_get_match_data(dev);
- pcie->base = devm_pci_remap_cfgspace(dev, reg.start,
- resource_size(®));
+ pcie->base = devm_pci_remap_cfgspace(dev, reg->start,
+ resource_size(reg));
if (!pcie->base) {
dev_err(dev, "unable to map controller registers\n");
return -ENOMEM;
}
- pcie->base_addr = reg.start;
+ pcie->base_addr = reg->start;
- if (of_property_read_bool(np, "brcm,pcie-ob")) {
+ if (device_property_present(dev, "brcm,pcie-ob")) {
u32 val;
- ret = of_property_read_u32(np, "brcm,pcie-ob-axi-offset",
+ ret = device_property_read_u32(dev, "brcm,pcie-ob-axi-offset",
&val);
if (ret) {
dev_err(dev,
@@ -87,7 +80,7 @@ static int iproc_pltfm_pcie_probe(struct platform_device *pdev)
* core driver. For platforms that require explicit inbound mapping
* configuration, "dma-ranges" would have been present in DT
*/
- pcie->need_ib_cfg = of_property_read_bool(np, "dma-ranges");
+ pcie->need_ib_cfg = device_property_present(dev, "dma-ranges");
/* PHY use is optional */
pcie->phy = devm_phy_optional_get(dev, "pcie-phy");
--
2.55.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCHv2] PCI: iproc: platform: use device functions instead of OF.
2026-07-27 23:44 [PATCHv2] PCI: iproc: platform: use device functions instead of OF Rosen Penev
@ 2026-07-30 0:32 ` Rob Herring
2026-07-30 0:55 ` Rosen Penev
2026-08-13 6:36 ` Manivannan Sadhasivam
1 sibling, 1 reply; 5+ messages in thread
From: Rob Herring @ 2026-07-30 0:32 UTC (permalink / raw)
To: Rosen Penev
Cc: linux-pci, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Bjorn Helgaas, Ray Jui, Scott Branden,
Broadcom internal kernel review list,
moderated list:BROADCOM IPROC ARM ARCHITECTURE, open list
On Mon, Jul 27, 2026 at 6:44 PM Rosen Penev <rosenp@gmail.com> wrote:
>
> Since this is supposed to be the higher layer file, use higher layer
> than OF to handle this. Remove OF headers as a result.
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> v2: fix platform_get_resource() parameters.
> drivers/pci/controller/pcie-iproc-platform.c | 31 ++++++++------------
> 1 file changed, 12 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-iproc-platform.c b/drivers/pci/controller/pcie-iproc-platform.c
> index 4c9a0c4bb923..488ff737ec52 100644
> --- a/drivers/pci/controller/pcie-iproc-platform.c
> +++ b/drivers/pci/controller/pcie-iproc-platform.c
> @@ -10,12 +10,8 @@
> #include <linux/slab.h>
> #include <linux/interrupt.h>
> #include <linux/platform_device.h>
> -#include <linux/of_address.h>
> -#include <linux/of_pci.h>
> -#include <linux/of_platform.h>
> #include <linux/phy/phy.h>
>
> -#include "../pci.h"
> #include "pcie-iproc.h"
>
> static const struct of_device_id iproc_pcie_of_match_table[] = {
> @@ -40,11 +36,14 @@ static int iproc_pltfm_pcie_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct iproc_pcie *pcie;
> - struct device_node *np = dev->of_node;
> - struct resource reg;
> + struct resource *reg;
> struct pci_host_bridge *bridge;
> int ret;
>
> + reg = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!reg)
> + return -ENODEV;
> +
> bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
> if (!bridge)
> return -ENOMEM;
> @@ -52,26 +51,20 @@ static int iproc_pltfm_pcie_probe(struct platform_device *pdev)
> pcie = pci_host_bridge_priv(bridge);
>
> pcie->dev = dev;
> - pcie->type = (uintptr_t)of_device_get_match_data(dev);
> -
> - ret = of_address_to_resource(np, 0, ®);
> - if (ret < 0) {
> - dev_err(dev, "unable to obtain controller resources\n");
> - return ret;
> - }
> + pcie->type = (uintptr_t)device_get_match_data(dev);
>
> - pcie->base = devm_pci_remap_cfgspace(dev, reg.start,
> - resource_size(®));
> + pcie->base = devm_pci_remap_cfgspace(dev, reg->start,
> + resource_size(reg));
> if (!pcie->base) {
> dev_err(dev, "unable to map controller registers\n");
> return -ENOMEM;
> }
> - pcie->base_addr = reg.start;
> + pcie->base_addr = reg->start;
>
> - if (of_property_read_bool(np, "brcm,pcie-ob")) {
> + if (device_property_present(dev, "brcm,pcie-ob")) {
If the property is boolean, it should use read_bool and vice-versa.
> u32 val;
>
> - ret = of_property_read_u32(np, "brcm,pcie-ob-axi-offset",
> + ret = device_property_read_u32(dev, "brcm,pcie-ob-axi-offset",
> &val);
> if (ret) {
> dev_err(dev,
> @@ -87,7 +80,7 @@ static int iproc_pltfm_pcie_probe(struct platform_device *pdev)
> * core driver. For platforms that require explicit inbound mapping
> * configuration, "dma-ranges" would have been present in DT
> */
> - pcie->need_ib_cfg = of_property_read_bool(np, "dma-ranges");
> + pcie->need_ib_cfg = device_property_present(dev, "dma-ranges");
This is correct as dma-ranges may not be bool.
Rob
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCHv2] PCI: iproc: platform: use device functions instead of OF.
2026-07-30 0:32 ` Rob Herring
@ 2026-07-30 0:55 ` Rosen Penev
2026-07-30 1:22 ` Rob Herring
0 siblings, 1 reply; 5+ messages in thread
From: Rosen Penev @ 2026-07-30 0:55 UTC (permalink / raw)
To: Rob Herring
Cc: linux-pci, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Bjorn Helgaas, Ray Jui, Scott Branden,
Broadcom internal kernel review list,
moderated list:BROADCOM IPROC ARM ARCHITECTURE, open list
On Wed, Jul 29, 2026 at 5:32 PM Rob Herring <robh@kernel.org> wrote:
>
> On Mon, Jul 27, 2026 at 6:44 PM Rosen Penev <rosenp@gmail.com> wrote:
> >
> > Since this is supposed to be the higher layer file, use higher layer
> > than OF to handle this. Remove OF headers as a result.
> >
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > ---
> > v2: fix platform_get_resource() parameters.
> > drivers/pci/controller/pcie-iproc-platform.c | 31 ++++++++------------
> > 1 file changed, 12 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/pci/controller/pcie-iproc-platform.c b/drivers/pci/controller/pcie-iproc-platform.c
> > index 4c9a0c4bb923..488ff737ec52 100644
> > --- a/drivers/pci/controller/pcie-iproc-platform.c
> > +++ b/drivers/pci/controller/pcie-iproc-platform.c
> > @@ -10,12 +10,8 @@
> > #include <linux/slab.h>
> > #include <linux/interrupt.h>
> > #include <linux/platform_device.h>
> > -#include <linux/of_address.h>
> > -#include <linux/of_pci.h>
> > -#include <linux/of_platform.h>
> > #include <linux/phy/phy.h>
> >
> > -#include "../pci.h"
> > #include "pcie-iproc.h"
> >
> > static const struct of_device_id iproc_pcie_of_match_table[] = {
> > @@ -40,11 +36,14 @@ static int iproc_pltfm_pcie_probe(struct platform_device *pdev)
> > {
> > struct device *dev = &pdev->dev;
> > struct iproc_pcie *pcie;
> > - struct device_node *np = dev->of_node;
> > - struct resource reg;
> > + struct resource *reg;
> > struct pci_host_bridge *bridge;
> > int ret;
> >
> > + reg = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + if (!reg)
> > + return -ENODEV;
> > +
> > bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
> > if (!bridge)
> > return -ENOMEM;
> > @@ -52,26 +51,20 @@ static int iproc_pltfm_pcie_probe(struct platform_device *pdev)
> > pcie = pci_host_bridge_priv(bridge);
> >
> > pcie->dev = dev;
> > - pcie->type = (uintptr_t)of_device_get_match_data(dev);
> > -
> > - ret = of_address_to_resource(np, 0, ®);
> > - if (ret < 0) {
> > - dev_err(dev, "unable to obtain controller resources\n");
> > - return ret;
> > - }
> > + pcie->type = (uintptr_t)device_get_match_data(dev);
> >
> > - pcie->base = devm_pci_remap_cfgspace(dev, reg.start,
> > - resource_size(®));
> > + pcie->base = devm_pci_remap_cfgspace(dev, reg->start,
> > + resource_size(reg));
> > if (!pcie->base) {
> > dev_err(dev, "unable to map controller registers\n");
> > return -ENOMEM;
> > }
> > - pcie->base_addr = reg.start;
> > + pcie->base_addr = reg->start;
> >
> > - if (of_property_read_bool(np, "brcm,pcie-ob")) {
> > + if (device_property_present(dev, "brcm,pcie-ob")) {
>
> If the property is boolean, it should use read_bool and vice-versa.
I don't see it as a boolean in dtsi.
>
> > u32 val;
> >
> > - ret = of_property_read_u32(np, "brcm,pcie-ob-axi-offset",
> > + ret = device_property_read_u32(dev, "brcm,pcie-ob-axi-offset",
> > &val);
> > if (ret) {
> > dev_err(dev,
> > @@ -87,7 +80,7 @@ static int iproc_pltfm_pcie_probe(struct platform_device *pdev)
> > * core driver. For platforms that require explicit inbound mapping
> > * configuration, "dma-ranges" would have been present in DT
> > */
> > - pcie->need_ib_cfg = of_property_read_bool(np, "dma-ranges");
> > + pcie->need_ib_cfg = device_property_present(dev, "dma-ranges");
>
> This is correct as dma-ranges may not be bool.
>
> Rob
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCHv2] PCI: iproc: platform: use device functions instead of OF.
2026-07-30 0:55 ` Rosen Penev
@ 2026-07-30 1:22 ` Rob Herring
0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2026-07-30 1:22 UTC (permalink / raw)
To: Rosen Penev
Cc: linux-pci, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Bjorn Helgaas, Ray Jui, Scott Branden,
Broadcom internal kernel review list,
moderated list:BROADCOM IPROC ARM ARCHITECTURE, open list
On Wed, Jul 29, 2026 at 7:55 PM Rosen Penev <rosenp@gmail.com> wrote:
>
> On Wed, Jul 29, 2026 at 5:32 PM Rob Herring <robh@kernel.org> wrote:
> >
> > On Mon, Jul 27, 2026 at 6:44 PM Rosen Penev <rosenp@gmail.com> wrote:
> > >
> > > Since this is supposed to be the higher layer file, use higher layer
> > > than OF to handle this. Remove OF headers as a result.
> > >
> > > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > > ---
> > > v2: fix platform_get_resource() parameters.
> > > drivers/pci/controller/pcie-iproc-platform.c | 31 ++++++++------------
> > > 1 file changed, 12 insertions(+), 19 deletions(-)
> > >
> > > diff --git a/drivers/pci/controller/pcie-iproc-platform.c b/drivers/pci/controller/pcie-iproc-platform.c
> > > index 4c9a0c4bb923..488ff737ec52 100644
> > > --- a/drivers/pci/controller/pcie-iproc-platform.c
> > > +++ b/drivers/pci/controller/pcie-iproc-platform.c
> > > @@ -10,12 +10,8 @@
> > > #include <linux/slab.h>
> > > #include <linux/interrupt.h>
> > > #include <linux/platform_device.h>
> > > -#include <linux/of_address.h>
> > > -#include <linux/of_pci.h>
> > > -#include <linux/of_platform.h>
> > > #include <linux/phy/phy.h>
> > >
> > > -#include "../pci.h"
> > > #include "pcie-iproc.h"
> > >
> > > static const struct of_device_id iproc_pcie_of_match_table[] = {
> > > @@ -40,11 +36,14 @@ static int iproc_pltfm_pcie_probe(struct platform_device *pdev)
> > > {
> > > struct device *dev = &pdev->dev;
> > > struct iproc_pcie *pcie;
> > > - struct device_node *np = dev->of_node;
> > > - struct resource reg;
> > > + struct resource *reg;
> > > struct pci_host_bridge *bridge;
> > > int ret;
> > >
> > > + reg = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > > + if (!reg)
> > > + return -ENODEV;
> > > +
> > > bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
> > > if (!bridge)
> > > return -ENOMEM;
> > > @@ -52,26 +51,20 @@ static int iproc_pltfm_pcie_probe(struct platform_device *pdev)
> > > pcie = pci_host_bridge_priv(bridge);
> > >
> > > pcie->dev = dev;
> > > - pcie->type = (uintptr_t)of_device_get_match_data(dev);
> > > -
> > > - ret = of_address_to_resource(np, 0, ®);
> > > - if (ret < 0) {
> > > - dev_err(dev, "unable to obtain controller resources\n");
> > > - return ret;
> > > - }
> > > + pcie->type = (uintptr_t)device_get_match_data(dev);
> > >
> > > - pcie->base = devm_pci_remap_cfgspace(dev, reg.start,
> > > - resource_size(®));
> > > + pcie->base = devm_pci_remap_cfgspace(dev, reg->start,
> > > + resource_size(reg));
> > > if (!pcie->base) {
> > > dev_err(dev, "unable to map controller registers\n");
> > > return -ENOMEM;
> > > }
> > > - pcie->base_addr = reg.start;
> > > + pcie->base_addr = reg->start;
> > >
> > > - if (of_property_read_bool(np, "brcm,pcie-ob")) {
> > > + if (device_property_present(dev, "brcm,pcie-ob")) {
> >
> > If the property is boolean, it should use read_bool and vice-versa.
> I don't see it as a boolean in dtsi.
Looks like boolean to me:
arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi:156: brcm,pcie-ob;
arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi:185: brcm,pcie-ob;
Rob
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCHv2] PCI: iproc: platform: use device functions instead of OF.
2026-07-27 23:44 [PATCHv2] PCI: iproc: platform: use device functions instead of OF Rosen Penev
2026-07-30 0:32 ` Rob Herring
@ 2026-08-13 6:36 ` Manivannan Sadhasivam
1 sibling, 0 replies; 5+ messages in thread
From: Manivannan Sadhasivam @ 2026-08-13 6:36 UTC (permalink / raw)
To: Rosen Penev
Cc: linux-pci, Lorenzo Pieralisi, Krzysztof Wilczyński,
Rob Herring, Bjorn Helgaas, Ray Jui, Scott Branden,
Broadcom internal kernel review list,
moderated list:BROADCOM IPROC ARM ARCHITECTURE, open list
On Mon, Jul 27, 2026 at 04:44:08PM -0700, Rosen Penev wrote:
> Since this is supposed to be the higher layer file, use higher layer
> than OF to handle this. Remove OF headers as a result.
>
What do you mean by 'higher layer'? This is a OF only driver. So what's the
point in switching to generic APIs? Please stop doing these not-so-useful
conversions.
- Mani
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-13 6:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-27 23:44 [PATCHv2] PCI: iproc: platform: use device functions instead of OF Rosen Penev
2026-07-30 0:32 ` Rob Herring
2026-07-30 0:55 ` Rosen Penev
2026-07-30 1:22 ` Rob Herring
2026-08-13 6:36 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®