Hi,
This series is the PCIe driver for Toshiba's ARM SoC, Visconti[0].
This provides DT binding documentation, device driver, MAINTAINER files.
Best regards,
Nobuhiro
[0]: https://toshiba.semicon-storage.com/ap-en/semiconductor/product/image-recognition-processors-visconti.html
dt-bindings: pci: Add DT binding for Toshiba Visconti PCIe controller
v2 -> v3:
- No update.
v1 -> v2:
- Remove white space.
- Drop num-viewport and bus-range from required.
- Drop status line from example.
- Drop bus-range from required.
- Removed lines defined in pci-bus.yaml from required.
PCI: Visconti: Add Toshiba Visconti PCIe host controller driver
v2 -> v3:
- Update subject.
- Wrap description in 75 columns.
- Change config name to PCIE_VISCONTI_HOST.
- Update Kconfig text.
- Drop empty lines.
- Adjusted to 80 columns.
- Drop inline from functions for register access.
- Changed function name from visconti_pcie_check_link_status to
visconti_pcie_link_up.
- Update to using dw_pcie_host_init().
- Reorder these in the order of use in visconti_pcie_establish_link().
- Rewrite visconti_pcie_host_init() without dw_pcie_setup_rc().
- Change function name from visconti_device_turnon() to
visconti_pcie_power_on().
- Unify formats such as dev_err().
- Drop error label in visconti_add_pcie_port().
v1 -> v2:
- Fix typo in commit message.
- Drop "depends on OF && HAS_IOMEM" from Kconfig.
- Stop using the pointer of struct dw_pcie.
- Use _relaxed variant.
- Drop dw_pcie_wait_for_link.
- Drop dbi resource processing.
- Drop MSI IRQ initialization processing.
MAINTAINERS: Add entries for Toshiba Visconti PCIe controller
v2 -> v3:
- No update.
v1 -> v2:
- No update.
Nobuhiro Iwamatsu (3):
dt-bindings: pci: Add DT binding for Toshiba Visconti PCIe controller
PCI: Visconti: Add Toshiba Visconti PCIe host controller driver
MAINTAINERS: Add entries for Toshiba Visconti PCIe controller
.../bindings/pci/toshiba,visconti-pcie.yaml | 110 ++++++
MAINTAINERS | 2 +
drivers/pci/controller/dwc/Kconfig | 9 +
drivers/pci/controller/dwc/Makefile | 1 +
drivers/pci/controller/dwc/pcie-visconti.c | 369 ++++++++++++++++++
5 files changed, 491 insertions(+)
create mode 100644 Documentation/devicetree/bindings/pci/toshiba,visconti-pcie.yaml
create mode 100644 drivers/pci/controller/dwc/pcie-visconti.c
--
2.31.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
This commit adds the Device Tree binding documentation that allows
to describe the PCIe controller found in Toshiba Visconti SoCs.
v1 -> v2:
- Remove white space.
- Drop num-viewport and bus-range from required.
- Drop status line from example.
- Drop bus-range from required.
- Removed lines defined in pci-bus.yaml from required.
Signed-off-by: Nobuhiro Iwamatsu <redacted>
---
.../bindings/pci/toshiba,visconti-pcie.yaml | 110 ++++++++++++++++++
1 file changed, 110 insertions(+)
create mode 100644 Documentation/devicetree/bindings/pci/toshiba,visconti-pcie.yaml
Add support to PCIe RC controller on Toshiba Visconti ARM SoCs. PCIe
controller is based of Synopsys DesignWare PCIe core.
This patch does not yet use the clock framework to control the clock.
This will be replaced in the future.
v2 -> v3:
- Update subject.
- Wrap description in 75 columns.
- Change config name to PCIE_VISCONTI_HOST.
- Update Kconfig text.
- Drop blank lines.
- Adjusted to 80 columns.
- Drop inline from functions for register access.
- Changed function name from visconti_pcie_check_link_status to
visconti_pcie_link_up.
- Update to using dw_pcie_host_init().
- Reorder these in the order of use in visconti_pcie_establish_link.
- Rewrite visconti_pcie_host_init() without dw_pcie_setup_rc().
- Change function name from visconti_device_turnon() to
visconti_pcie_power_on().
- Unify formats such as dev_err().
- Drop error label in visconti_add_pcie_port().
v1 -> v2:
- Fix typo in commit message.
- Drop "depends on OF && HAS_IOMEM" from Kconfig.
- Stop using the pointer of struct dw_pcie.
- Use _relaxed variant.
- Drop dw_pcie_wait_for_link.
- Drop dbi resource processing.
- Drop MSI IRQ initialization processing.
Signed-off-by: Yuji Ishikawa <redacted>
Signed-off-by: Nobuhiro Iwamatsu <redacted>
---
drivers/pci/controller/dwc/Kconfig | 9 +
drivers/pci/controller/dwc/Makefile | 1 +
drivers/pci/controller/dwc/pcie-visconti.c | 369 +++++++++++++++++++++
3 files changed, 379 insertions(+)
create mode 100644 drivers/pci/controller/dwc/pcie-visconti.c
@@ -20,6 +20,7 @@ obj-$(CONFIG_PCIE_HISI_STB) += pcie-histb.oobj-$(CONFIG_PCI_MESON)+=pci-meson.oobj-$(CONFIG_PCIE_UNIPHIER)+=pcie-uniphier.oobj-$(CONFIG_PCIE_UNIPHIER_EP)+=pcie-uniphier-ep.o+obj-$(CONFIG_PCIE_VISCONTI_HOST)+=pcie-visconti.o# The following drivers are for devices that use the generic ACPI# pci_root.c driver but don't support standard ECAM config access.
From: Krzysztof Wilczyński <hidden> Date: 2021-05-24 11:11:02
Hi Nobuhiro,
Thank you for working on this!
[...]
+static int visconti_get_resources(struct platform_device *pdev,
+ struct visconti_pcie *pcie)
+{
[...]
+ pcie->refclk = devm_clk_get(dev, "pcie_refclk");
+ if (IS_ERR(pcie->refclk)) {
+ dev_err(dev, "Failed to get refclk clock: %ld\n",
+ PTR_ERR(pcie->refclk));
+ return PTR_ERR(pcie->refclk);
+ }
+
+ pcie->sysclk = devm_clk_get(dev, "sysclk");
+ if (IS_ERR(pcie->sysclk)) {
+ dev_err(dev, "Failed to get sysclk clock: %ld\n",
+ PTR_ERR(pcie->sysclk));
+ return PTR_ERR(pcie->sysclk);
+ }
+
+ pcie->auxclk = devm_clk_get(dev, "auxclk");
+ if (IS_ERR(pcie->auxclk)) {
+ dev_err(dev, "Failed to get auxclk clock: %ld\n",
+ PTR_ERR(pcie->auxclk));
+ return PTR_ERR(pcie->auxclk);
+ }
Do you think you could use the dev_err_probe() to handle the
devm_clk_get() failed? Where applicable this is becoming a common
patter drivers apply, for example:
pcie->refclk = devm_clk_get(dev, "pcie_refclk");
if (IS_ERR(pcie->refclk))
return dev_err_probe(dev, PTR_ERR(pcie->refclk),
"failed to get refclk clock\n");
[...]
Question about the above debug messages.
Given that both are at the same level and the link speed will be printed
regardless of whether it was set to a default value or not, does it make
sense to still print the message about applying the default link speed?
Unless this is something that will be indeed useful during debugging and
troubleshooting (and in which case just ignore this question).
Krzysztof
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
[+cc Kishon for cpu_addr_fixup() question]
Please make the subject "PCI: visconti: Add ..." since the driver
names are usually lower-case. When referring to the hardware itself,
use "Visconti", of course.
On Mon, May 24, 2021 at 03:30:03PM +0900, Nobuhiro Iwamatsu wrote:
Add support to PCIe RC controller on Toshiba Visconti ARM SoCs. PCIe
controller is based of Synopsys DesignWare PCIe core.
This patch does not yet use the clock framework to control the clock.
This will be replaced in the future.
v2 -> v3:
- Update subject.
- Wrap description in 75 columns.
- Change config name to PCIE_VISCONTI_HOST.
- Update Kconfig text.
- Drop blank lines.
- Adjusted to 80 columns.
- Drop inline from functions for register access.
- Changed function name from visconti_pcie_check_link_status to
visconti_pcie_link_up.
- Update to using dw_pcie_host_init().
- Reorder these in the order of use in visconti_pcie_establish_link.
- Rewrite visconti_pcie_host_init() without dw_pcie_setup_rc().
- Change function name from visconti_device_turnon() to
visconti_pcie_power_on().
- Unify formats such as dev_err().
- Drop error label in visconti_add_pcie_port().
v1 -> v2:
- Fix typo in commit message.
- Drop "depends on OF && HAS_IOMEM" from Kconfig.
- Stop using the pointer of struct dw_pcie.
- Use _relaxed variant.
- Drop dw_pcie_wait_for_link.
- Drop dbi resource processing.
- Drop MSI IRQ initialization processing.
Thanks for the changelog. Please move it after the "---" line for
future versions. That way it won't appear in the commit log when this
is merged. The notes about v1->v2, v2->v3, etc are useful during
review, but not after this is merged.
@@ -20,6 +20,7 @@ obj-$(CONFIG_PCIE_HISI_STB) += pcie-histb.oobj-$(CONFIG_PCI_MESON)+=pci-meson.oobj-$(CONFIG_PCIE_UNIPHIER)+=pcie-uniphier.oobj-$(CONFIG_PCIE_UNIPHIER_EP)+=pcie-uniphier-ep.o+obj-$(CONFIG_PCIE_VISCONTI_HOST)+=pcie-visconti.o# The following drivers are for devices that use the generic ACPI# pci_root.c driver but don't support standard ECAM config access.
This is called from __dw_pcie_prog_outbound_atu() as:
cpu_addr = pci->ops->cpu_addr_fixup(pci, cpu_addr);
so I think the parameter here should be *cpu_addr*, not pci_addr.
dra7xx and artpec6 also call it "pci_addr", which is at best
confusing.
I'm also confused about exactly what .cpu_addr_fixup() does. Is it
applying an offset that cannot be deduced from the DT description? If
so, *should* this offset be described in DT?
This bears very little resemblance to the .host_init() functions of
other dwc-based drivers. It'd be nice if they were more consistent.
But if there are real hardware differences causing these driver
differences, that's ok. I see a couple (meson, kirin) that call a
*power_on() function from *_pcie_probe().
Somewhat unusual in PCIe controller drivers. Is there something
unusual about the Visconti hardware?
Also looks a little suspicious since the sequence is:
visconti_pcie_probe
dma_set_mask_and_coherent(DMA_BIT_MASK(36))
visconti_add_pcie_port
dw_pcie_host_init
if (pci_msi_enabled())
dma_set_mask(DMA_BIT_MASK(32))
so dw_pcie_host_init() will override part of what we're setting here.
Is this necessary? I can't tell that this driver even implements MSI
support. It looks like tegra194 is the only other driver that sets
num_vectors itself.
From: Rob Herring <robh+dt@kernel.org> Date: 2021-05-26 16:33:52
On Mon, May 24, 2021 at 1:30 AM Nobuhiro Iwamatsu
[off-list ref] wrote:
This commit adds the Device Tree binding documentation that allows
to describe the PCIe controller found in Toshiba Visconti SoCs.
v1 -> v2:
- Remove white space.
- Drop num-viewport and bus-range from required.
- Drop status line from example.
- Drop bus-range from required.
- Removed lines defined in pci-bus.yaml from required.
Signed-off-by: Nobuhiro Iwamatsu <redacted>
---
.../bindings/pci/toshiba,visconti-pcie.yaml | 110 ++++++++++++++++++
1 file changed, 110 insertions(+)
create mode 100644 Documentation/devicetree/bindings/pci/toshiba,visconti-pcie.yaml
Please resend to DT list. Otherwise, automated checks don't run
(though I'm sure you ran 'make dt_binding_check' already, right?).
@@ -0,0 +1,110 @@+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)+%YAML1.2+---+$id:http://devicetree.org/schemas/pci/toshiba,visconti-pcie.yaml#+$schema:http://devicetree.org/meta-schemas/core.yaml#++title:Toshiba Visconti5 SoC PCIe Host Controller Device Tree Bindings++maintainers:+-Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>++description:|++Toshiba Visconti5 SoC PCIe host controller is based on the Synopsys DesignWare PCIe IP.++allOf:+-$ref:/schemas/pci/pci-bus.yaml#++properties:+compatible:+const:toshiba,visconti-pcie++reg:+items:+-description:Data Bus Interface (DBI) registers.+-description:PCIe configuration space region.+-description:Visconti specific additional registers.+-description:Visconti specific SMU registers+-description:Visconti specific memory protection unit registers (MPU)++reg-names:+items:+-const:dbi+-const:config+-const:ulreg+-const:smu+-const:mpu++interrupts:+maxItems:1++clocks:+items:+-description:PCIe reference clock+-description:PCIe system clock+-description:Auxiliary clock++clock-names:+items:+-const:pcie_refclk
Just 'refclk'. Though 'clk' is redundant too. I'd go with 'ref',
'aux', and 'core'.
On Wed, May 26, 2021 at 11:33:35AM -0500, Rob Herring wrote:
On Mon, May 24, 2021 at 1:30 AM Nobuhiro Iwamatsu
[off-list ref] wrote:
quoted
This commit adds the Device Tree binding documentation that allows
to describe the PCIe controller found in Toshiba Visconti SoCs.
v1 -> v2:
- Remove white space.
- Drop num-viewport and bus-range from required.
- Drop status line from example.
- Drop bus-range from required.
- Removed lines defined in pci-bus.yaml from required.
Signed-off-by: Nobuhiro Iwamatsu <redacted>
---
.../bindings/pci/toshiba,visconti-pcie.yaml | 110 ++++++++++++++++++
1 file changed, 110 insertions(+)
create mode 100644 Documentation/devicetree/bindings/pci/toshiba,visconti-pcie.yaml
Please resend to DT list. Otherwise, automated checks don't run
OK, I will resent to DT list.
(though I'm sure you ran 'make dt_binding_check' already, right?).
@@ -0,0 +1,110 @@+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)+%YAML1.2+---+$id:http://devicetree.org/schemas/pci/toshiba,visconti-pcie.yaml#+$schema:http://devicetree.org/meta-schemas/core.yaml#++title:Toshiba Visconti5 SoC PCIe Host Controller Device Tree Bindings++maintainers:+-Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>++description:|++Toshiba Visconti5 SoC PCIe host controller is based on the Synopsys DesignWare PCIe IP.++allOf:+-$ref:/schemas/pci/pci-bus.yaml#++properties:+compatible:+const:toshiba,visconti-pcie++reg:+items:+-description:Data Bus Interface (DBI) registers.+-description:PCIe configuration space region.+-description:Visconti specific additional registers.+-description:Visconti specific SMU registers+-description:Visconti specific memory protection unit registers (MPU)++reg-names:+items:+-const:dbi+-const:config+-const:ulreg+-const:smu+-const:mpu++interrupts:+maxItems:1++clocks:+items:+-description:PCIe reference clock+-description:PCIe system clock+-description:Auxiliary clock++clock-names:+items:+-const:pcie_refclk
Just 'refclk'. Though 'clk' is redundant too. I'd go with 'ref',
'aux', and 'core'.
Hi,
Thanks for your review.
On Mon, May 24, 2021 at 01:10:51PM +0200, Krzysztof Wilczyński wrote:
Hi Nobuhiro,
Thank you for working on this!
[...]
quoted
+static int visconti_get_resources(struct platform_device *pdev,
+ struct visconti_pcie *pcie)
+{
[...]
quoted
+ pcie->refclk = devm_clk_get(dev, "pcie_refclk");
+ if (IS_ERR(pcie->refclk)) {
+ dev_err(dev, "Failed to get refclk clock: %ld\n",
+ PTR_ERR(pcie->refclk));
+ return PTR_ERR(pcie->refclk);
+ }
+
+ pcie->sysclk = devm_clk_get(dev, "sysclk");
+ if (IS_ERR(pcie->sysclk)) {
+ dev_err(dev, "Failed to get sysclk clock: %ld\n",
+ PTR_ERR(pcie->sysclk));
+ return PTR_ERR(pcie->sysclk);
+ }
+
+ pcie->auxclk = devm_clk_get(dev, "auxclk");
+ if (IS_ERR(pcie->auxclk)) {
+ dev_err(dev, "Failed to get auxclk clock: %ld\n",
+ PTR_ERR(pcie->auxclk));
+ return PTR_ERR(pcie->auxclk);
+ }
Do you think you could use the dev_err_probe() to handle the
devm_clk_get() failed? Where applicable this is becoming a common
patter drivers apply, for example:
pcie->refclk = devm_clk_get(dev, "pcie_refclk");
if (IS_ERR(pcie->refclk))
return dev_err_probe(dev, PTR_ERR(pcie->refclk),
"failed to get refclk clock\n");
[...]
Thanks for your suggestion. I will fix using dev_err_probe().
Question about the above debug messages.
Given that both are at the same level and the link speed will be printed
regardless of whether it was set to a default value or not, does it make
sense to still print the message about applying the default link speed?
Unless this is something that will be indeed useful during debugging and
troubleshooting (and in which case just ignore this question).
I guess so, the message about the default value is not important.
I will remove this, thank you.
Best regards,
Nobuhiro
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi,
Thanks for your reivew.
On Mon, May 24, 2021 at 01:58:39PM -0500, Bjorn Helgaas wrote:
[+cc Kishon for cpu_addr_fixup() question]
Please make the subject "PCI: visconti: Add ..." since the driver
names are usually lower-case. When referring to the hardware itself,
use "Visconti", of course.
OK, I will do so from next time.
On Mon, May 24, 2021 at 03:30:03PM +0900, Nobuhiro Iwamatsu wrote:
quoted
Add support to PCIe RC controller on Toshiba Visconti ARM SoCs. PCIe
controller is based of Synopsys DesignWare PCIe core.
This patch does not yet use the clock framework to control the clock.
This will be replaced in the future.
v2 -> v3:
- Update subject.
- Wrap description in 75 columns.
- Change config name to PCIE_VISCONTI_HOST.
- Update Kconfig text.
- Drop blank lines.
- Adjusted to 80 columns.
- Drop inline from functions for register access.
- Changed function name from visconti_pcie_check_link_status to
visconti_pcie_link_up.
- Update to using dw_pcie_host_init().
- Reorder these in the order of use in visconti_pcie_establish_link.
- Rewrite visconti_pcie_host_init() without dw_pcie_setup_rc().
- Change function name from visconti_device_turnon() to
visconti_pcie_power_on().
- Unify formats such as dev_err().
- Drop error label in visconti_add_pcie_port().
v1 -> v2:
- Fix typo in commit message.
- Drop "depends on OF && HAS_IOMEM" from Kconfig.
- Stop using the pointer of struct dw_pcie.
- Use _relaxed variant.
- Drop dw_pcie_wait_for_link.
- Drop dbi resource processing.
- Drop MSI IRQ initialization processing.
Thanks for the changelog. Please move it after the "---" line for
future versions. That way it won't appear in the commit log when this
is merged. The notes about v1->v2, v2->v3, etc are useful during
review, but not after this is merged.
Simliar to the above your comment, I will do so from next time.
This is called from __dw_pcie_prog_outbound_atu() as:
cpu_addr = pci->ops->cpu_addr_fixup(pci, cpu_addr);
so I think the parameter here should be *cpu_addr*, not pci_addr.
I see, I rename the variable to cpu_addr.
dra7xx and artpec6 also call it "pci_addr", which is at best
confusing.
I'm also confused about exactly what .cpu_addr_fixup() does. Is it
applying an offset that cannot be deduced from the DT description? If
so, *should* this offset be described in DT?
This depends on Visconti5's PCIe hardware implementation.
It depends on the specification that the CPU bus connected to PCIe outputs
with 0x40000000 added as an offset. This is fixed.
I will add this description as comment.
Looks like most drivers use "pp->irq = platform_get_irq(pdev, 0);"
Is there a reason for this to be different?
This driver has two interrupts, msi and usual interrupt.
MSI is handled by the dwc framework, but the rest is handled by the driver.
When When I get the IRQ using index, it may not be processed correctly
depending on how to write DT, so I use platform_get_irq_byname() to check by name.
Somewhat unusual in PCIe controller drivers. Is there something
unusual about the Visconti hardware?
Also looks a little suspicious since the sequence is:
visconti_pcie_probe
dma_set_mask_and_coherent(DMA_BIT_MASK(36))
visconti_add_pcie_port
dw_pcie_host_init
if (pci_msi_enabled())
dma_set_mask(DMA_BIT_MASK(32))
so dw_pcie_host_init() will override part of what we're setting here.
Is this necessary? I can't tell that this driver even implements MSI
support. It looks like tegra194 is the only other driver that sets
num_vectors itself.
This device uses MSI. And I double-checked about interrupts. This device
does not need to do this, as it has a maximum of 32 interrupt vectors.
I will delete it. Thank you for pointing out.
From: Rob Herring <robh+dt@kernel.org> Date: 2021-06-16 16:32:20
On Mon, May 24, 2021 at 12:58 PM Bjorn Helgaas [off-list ref] wrote:
[+cc Kishon for cpu_addr_fixup() question]
Please make the subject "PCI: visconti: Add ..." since the driver
names are usually lower-case. When referring to the hardware itself,
use "Visconti", of course.
On Mon, May 24, 2021 at 03:30:03PM +0900, Nobuhiro Iwamatsu wrote:
quoted
Add support to PCIe RC controller on Toshiba Visconti ARM SoCs. PCIe
controller is based of Synopsys DesignWare PCIe core.
This patch does not yet use the clock framework to control the clock.
This will be replaced in the future.
v2 -> v3:
- Update subject.
- Wrap description in 75 columns.
- Change config name to PCIE_VISCONTI_HOST.
- Update Kconfig text.
- Drop blank lines.
- Adjusted to 80 columns.
- Drop inline from functions for register access.
- Changed function name from visconti_pcie_check_link_status to
visconti_pcie_link_up.
- Update to using dw_pcie_host_init().
- Reorder these in the order of use in visconti_pcie_establish_link.
- Rewrite visconti_pcie_host_init() without dw_pcie_setup_rc().
- Change function name from visconti_device_turnon() to
visconti_pcie_power_on().
- Unify formats such as dev_err().
- Drop error label in visconti_add_pcie_port().
v1 -> v2:
- Fix typo in commit message.
- Drop "depends on OF && HAS_IOMEM" from Kconfig.
- Stop using the pointer of struct dw_pcie.
- Use _relaxed variant.
- Drop dw_pcie_wait_for_link.
- Drop dbi resource processing.
- Drop MSI IRQ initialization processing.
Thanks for the changelog. Please move it after the "---" line for
future versions. That way it won't appear in the commit log when this
is merged. The notes about v1->v2, v2->v3, etc are useful during
review, but not after this is merged.
This is called from __dw_pcie_prog_outbound_atu() as:
cpu_addr = pci->ops->cpu_addr_fixup(pci, cpu_addr);
so I think the parameter here should be *cpu_addr*, not pci_addr.
dra7xx and artpec6 also call it "pci_addr", which is at best
confusing.
I'm also confused about exactly what .cpu_addr_fixup() does. Is it
applying an offset that cannot be deduced from the DT description? If
so, *should* this offset be described in DT?
It could be perhaps, but it would be a custom property, not something
we can handle in 'ranges'. I'd rather it be implicit from the
compatible than a custom property.
AIUI, the issue is the cpu address gets masked (high bits discarded).
This can happen when the internal bus address decoding throws away
upper address bits.
For example:
0xa0000000 -> 0x20000000 -> 0x00000000
cpu addr -> DW local addr -> PCI bus addr
DT has the first and last addresses, but iATU needs the middle and last address.
This could be just a data value rather than an ops function. While a
subtract works here, that's fragile (the DT needs to match the
#define) and I think a mask would be more appropriate.
Rob
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi,
Thanks for your comment.
On Wed, Jun 16, 2021 at 10:32:05AM -0600, Rob Herring wrote:
On Mon, May 24, 2021 at 12:58 PM Bjorn Helgaas [off-list ref] wrote:
quoted
[+cc Kishon for cpu_addr_fixup() question]
Please make the subject "PCI: visconti: Add ..." since the driver
names are usually lower-case. When referring to the hardware itself,
use "Visconti", of course.
On Mon, May 24, 2021 at 03:30:03PM +0900, Nobuhiro Iwamatsu wrote:
quoted
Add support to PCIe RC controller on Toshiba Visconti ARM SoCs. PCIe
controller is based of Synopsys DesignWare PCIe core.
This patch does not yet use the clock framework to control the clock.
This will be replaced in the future.
v2 -> v3:
- Update subject.
- Wrap description in 75 columns.
- Change config name to PCIE_VISCONTI_HOST.
- Update Kconfig text.
- Drop blank lines.
- Adjusted to 80 columns.
- Drop inline from functions for register access.
- Changed function name from visconti_pcie_check_link_status to
visconti_pcie_link_up.
- Update to using dw_pcie_host_init().
- Reorder these in the order of use in visconti_pcie_establish_link.
- Rewrite visconti_pcie_host_init() without dw_pcie_setup_rc().
- Change function name from visconti_device_turnon() to
visconti_pcie_power_on().
- Unify formats such as dev_err().
- Drop error label in visconti_add_pcie_port().
v1 -> v2:
- Fix typo in commit message.
- Drop "depends on OF && HAS_IOMEM" from Kconfig.
- Stop using the pointer of struct dw_pcie.
- Use _relaxed variant.
- Drop dw_pcie_wait_for_link.
- Drop dbi resource processing.
- Drop MSI IRQ initialization processing.
Thanks for the changelog. Please move it after the "---" line for
future versions. That way it won't appear in the commit log when this
is merged. The notes about v1->v2, v2->v3, etc are useful during
review, but not after this is merged.
This is called from __dw_pcie_prog_outbound_atu() as:
cpu_addr = pci->ops->cpu_addr_fixup(pci, cpu_addr);
so I think the parameter here should be *cpu_addr*, not pci_addr.
dra7xx and artpec6 also call it "pci_addr", which is at best
confusing.
I'm also confused about exactly what .cpu_addr_fixup() does. Is it
applying an offset that cannot be deduced from the DT description? If
so, *should* this offset be described in DT?
It could be perhaps, but it would be a custom property, not something
we can handle in 'ranges'. I'd rather it be implicit from the
compatible than a custom property.
AIUI, the issue is the cpu address gets masked (high bits discarded).
This can happen when the internal bus address decoding throws away
upper address bits.
For example:
0xa0000000 -> 0x20000000 -> 0x00000000
cpu addr -> DW local addr -> PCI bus addr
DT has the first and last addresses, but iATU needs the middle and last address.
This could be just a data value rather than an ops function. While a
subtract works here, that's fragile (the DT needs to match the
#define) and I think a mask would be more appropriate.a
In this SoC specification, the CPU bus outputs the offset value from
0x40000000 to the PCIE bus, so 0x40000000 is subtracted from the CPU
bus address. This 0x40000000 is also based on io_base from DT.
Therefore, how about the following processing?
return cpu_addr - pp->io_base;
If I use a mask, it will be as follows.
return cpu_addr & ~pp->io_base;
Best regards,
Nobuhiro
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel