Message ID | 1599814203-14441-3-git-send-email-hayashi.kunihiko@socionext.com |
---|---|
State | Superseded |
Headers | show |
Series | PCI: dwc: Move iATU register mapping to common framework | expand |
On Fri, Sep 11, 2020 at 05:50:02PM +0900, Kunihiko Hayashi wrote: > This gets iATU register area from reg property that has reg-names "atu". > In Synopsys DWC version 4.80 or later, since iATU register area is > separated from core register area, this area is necessary to get from > DT independently. > > Cc: Murali Karicheri <m-karicheri2@ti.com> > Cc: Jingoo Han <jingoohan1@gmail.com> > Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com> > Suggested-by: Rob Herring <robh@kernel.org> > Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> > --- > drivers/pci/controller/dwc/pcie-designware.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c > index 4d105ef..4a360bc 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.c > +++ b/drivers/pci/controller/dwc/pcie-designware.c > @@ -10,6 +10,7 @@ > > #include <linux/delay.h> > #include <linux/of.h> > +#include <linux/of_platform.h> > #include <linux/types.h> > > #include "../../pci.h" > @@ -526,11 +527,16 @@ void dw_pcie_setup(struct dw_pcie *pci) > u32 val; > struct device *dev = pci->dev; > struct device_node *np = dev->of_node; > + struct platform_device *pdev; > > if (pci->version >= 0x480A || (!pci->version && > dw_pcie_iatu_unroll_enabled(pci))) { > pci->iatu_unroll_enabled = true; > - if (!pci->atu_base) > + pdev = of_find_device_by_node(np); Use to_platform_device(dev) instead. Put that at the beginning as I'm going to move 'dbi' in here too. > + if (!pci->atu_base && pdev) > + pci->atu_base = > + devm_platform_ioremap_resource_byname(pdev, "atu"); > + if (IS_ERR_OR_NULL(pci->atu_base)) > pci->atu_base = pci->dbi_base + DEFAULT_DBI_ATU_OFFSET; > } > dev_dbg(pci->dev, "iATU unroll: %s\n", pci->iatu_unroll_enabled ? > -- > 2.7.4 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi Rob, On 2020/09/24 0:57, Rob Herring wrote: > On Fri, Sep 11, 2020 at 05:50:02PM +0900, Kunihiko Hayashi wrote: >> This gets iATU register area from reg property that has reg-names "atu". >> In Synopsys DWC version 4.80 or later, since iATU register area is >> separated from core register area, this area is necessary to get from >> DT independently. >> >> Cc: Murali Karicheri <m-karicheri2@ti.com> >> Cc: Jingoo Han <jingoohan1@gmail.com> >> Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com> >> Suggested-by: Rob Herring <robh@kernel.org> >> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> >> --- >> drivers/pci/controller/dwc/pcie-designware.c | 8 +++++++- >> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c >> index 4d105ef..4a360bc 100644 >> --- a/drivers/pci/controller/dwc/pcie-designware.c >> +++ b/drivers/pci/controller/dwc/pcie-designware.c >> @@ -10,6 +10,7 @@ >> >> #include <linux/delay.h> >> #include <linux/of.h> >> +#include <linux/of_platform.h> >> #include <linux/types.h> >> >> #include "../../pci.h" >> @@ -526,11 +527,16 @@ void dw_pcie_setup(struct dw_pcie *pci) >> u32 val; >> struct device *dev = pci->dev; >> struct device_node *np = dev->of_node; >> + struct platform_device *pdev; >> >> if (pci->version >= 0x480A || (!pci->version && >> dw_pcie_iatu_unroll_enabled(pci))) { >> pci->iatu_unroll_enabled = true; >> - if (!pci->atu_base) >> + pdev = of_find_device_by_node(np); > > Use to_platform_device(dev) instead. Put that at the beginning as I'm > going to move 'dbi' in here too. Okay, I'll rewrite it with to_platform_device(dev). Should I refer somewhere to rebase to your change? Thank you, --- Best Regards Kunihiko Hayashi
On 2020/09/25 18:10, Kunihiko Hayashi wrote: > Hi Rob, > > On 2020/09/24 0:57, Rob Herring wrote: >> On Fri, Sep 11, 2020 at 05:50:02PM +0900, Kunihiko Hayashi wrote: >>> This gets iATU register area from reg property that has reg-names "atu". >>> In Synopsys DWC version 4.80 or later, since iATU register area is >>> separated from core register area, this area is necessary to get from >>> DT independently. >>> >>> Cc: Murali Karicheri <m-karicheri2@ti.com> >>> Cc: Jingoo Han <jingoohan1@gmail.com> >>> Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com> >>> Suggested-by: Rob Herring <robh@kernel.org> >>> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> >>> --- >>> drivers/pci/controller/dwc/pcie-designware.c | 8 +++++++- >>> 1 file changed, 7 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c >>> index 4d105ef..4a360bc 100644 >>> --- a/drivers/pci/controller/dwc/pcie-designware.c >>> +++ b/drivers/pci/controller/dwc/pcie-designware.c >>> @@ -10,6 +10,7 @@ >>> #include <linux/delay.h> >>> #include <linux/of.h> >>> +#include <linux/of_platform.h> >>> #include <linux/types.h> >>> #include "../../pci.h" >>> @@ -526,11 +527,16 @@ void dw_pcie_setup(struct dw_pcie *pci) >>> u32 val; >>> struct device *dev = pci->dev; >>> struct device_node *np = dev->of_node; >>> + struct platform_device *pdev; >>> if (pci->version >= 0x480A || (!pci->version && >>> dw_pcie_iatu_unroll_enabled(pci))) { >>> pci->iatu_unroll_enabled = true; >>> - if (!pci->atu_base) >>> + pdev = of_find_device_by_node(np); >> >> Use to_platform_device(dev) instead. Put that at the beginning as I'm >> going to move 'dbi' in here too. > > Okay, I'll rewrite it with to_platform_device(dev). > Should I refer somewhere to rebase to your change? It seems there is no dbi patch yet, so I'm going to send v2 in advance for now. I can rebase it if necessary. Thank you, --- Best Regards Kunihiko Hayashi
diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index 4d105ef..4a360bc 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -10,6 +10,7 @@ #include <linux/delay.h> #include <linux/of.h> +#include <linux/of_platform.h> #include <linux/types.h> #include "../../pci.h" @@ -526,11 +527,16 @@ void dw_pcie_setup(struct dw_pcie *pci) u32 val; struct device *dev = pci->dev; struct device_node *np = dev->of_node; + struct platform_device *pdev; if (pci->version >= 0x480A || (!pci->version && dw_pcie_iatu_unroll_enabled(pci))) { pci->iatu_unroll_enabled = true; - if (!pci->atu_base) + pdev = of_find_device_by_node(np); + if (!pci->atu_base && pdev) + pci->atu_base = + devm_platform_ioremap_resource_byname(pdev, "atu"); + if (IS_ERR_OR_NULL(pci->atu_base)) pci->atu_base = pci->dbi_base + DEFAULT_DBI_ATU_OFFSET; } dev_dbg(pci->dev, "iATU unroll: %s\n", pci->iatu_unroll_enabled ?
This gets iATU register area from reg property that has reg-names "atu". In Synopsys DWC version 4.80 or later, since iATU register area is separated from core register area, this area is necessary to get from DT independently. Cc: Murali Karicheri <m-karicheri2@ti.com> Cc: Jingoo Han <jingoohan1@gmail.com> Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com> Suggested-by: Rob Herring <robh@kernel.org> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> --- drivers/pci/controller/dwc/pcie-designware.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 2.7.4