PCI: dwc: Add generic resources and Baikal-T1 support
Subsystems (8)
v6 cover PCI: dwc: Add generic resources and Baikal-T1 support
This patchset is a third one in the series created in the framework of my Baikal-T1 PCIe/eDMA-related work:
[1: Done v5] PCI: dwc: Various fixes and cleanups
Merged: kernel 6.0-rc1
[2: Done v4] PCI: dwc: Add hw version and dma-ranges support
Merged: kernel 6.0-rc1
[3: In-review v5] PCI: dwc: Add generic resources and Baikal-T1 support
Link: ---you are looking at it---
[4: Done v4] dmaengine: dw-edma: Add RP/EP local DMA support
Note it is very recommended to merge the patchsets in the same order as they are listed in the set above in order to have them applied smoothly. Nothing prevents them from being reviewed synchronously though.
Originally the patches submitted in this patchset were a part of the series:
but due to the reviewers requests the series was expanded to about 30 patches which made it too bulky for a comfortable review. So I decided to split it up into two patchsets: 2. and 3. in the table above.
Regarding the series content. This patchset is mainly about adding new DW PCIe platform support - Baikal-T1 PCIe of DW PCIe v4.60a IP-core. But a set of feature-reach preparations are done first. It starts from converting the currently available DT-schema into a more flexible schemas hierarchy with separately defined regs, clocks, resets and interrupts properties. As a result the common schema can be easily re-used by all the currently available platforms while the named properties above can be either re-defined or used as is if the platforms support they. In the framework of that modification we also suggest to add a set of generic regs, clocks, resets and interrupts resource names in accordance with what the DW PCIe hardware reference manual describes and what the DW PCIe core driver already expects to be specified. Thus the new platform driver will be able to re-use the common resources infrastructure.
Changelog v2:
- Rename 'syscon' property to 'baikal,bt1-syscon'. (@Rob)
- Move the iATU region selection procedure into a helper function (@Rob).
- Rebase from kernel v5.17 onto v5.18-rc3 since the later kernel has already DT bindings converted. (@Rob)
- Use 'definitions' property instead of the '$defs' one. It fixes the dt-validate error: 'X is not of type array.'
- Drop 'interrupts' and 'interrupt-names' property from being required for the native DW PCIe host.
- Evaluate the 'snps,dw-pcie-common.yaml' schema in the 'socionext,uniphier-pcie-ep.yaml' DT-bindings since the later has platform-specific names defined.
Changelog v3:
- Split up the patch "dt-bindings: PCI: dwc: Define common and native DT bindings" into a series of modifications. (@Rob)
- Detach this series of the patches into a dedicated patchset.
- Add a new feature patch: "PCI: dwc: Introduce generic controller capabilities interface".
- Add a new feature patch: "PCI: dwc: Introduce generic resources getter".
- Add a new cleanup patch: "PCI: dwc: Combine iATU detection procedures".
- Add a method to at least request the generic clocks and resets. (@Rob)
- Add GPIO-based PERST# signal support to the core module.
- Redefine Baikal-T1 PCIe host bridge config space accessors with the pci_generic_config_read32() and pci_generic_config_write32() methods. (@Rob)
- Drop synonymous from the names list in the common DT-schema since the device sub-schemas create their own enumerations anyway.
- Rebase onto kernel v5.18.
Changelog v4:
- Drop PCIBIOS_* macros usage. (@Rob)
- Add "static const" to the dw_pcie_ops and dw_pcie_host_ops structure instances. (@Bjorn)
- Rename bt1_pcie_dw_ops to bt1_pcie_ops. (@Bjorn)
- Rename bt1_pcie_ops to bt1_pci_ops. (@Bjorn)
- Use start_link/stop_link suffixes in the Baikal-T1 PCIe start/stop link callbacks. (@Bjorn)
- Change the get_res() method suffix to being get_resources(). (@Bjorn)
- Change *_{add,del}_dw_port() method to *_{add,del}_port(). (@Bjorn)
- Drop dma_coerce_mask_and_coherent() applied to the PCI host bridge kernel device instance. (@Bjorn)
- Add the comment above the dma_set_mask_and_coherent() method usage regarding the controller eDMA feature. (@Bjorn)
- Fix the comment above the core reset controls assertion. (@Bjorn)
- Replace delays and timeout numeric literals with macros. (@Bjorn)
- Convert the method name from dw_pcie_get_res() to dw_pcie_get_resources(). (@Bjorn)
- Rebase onto the kernel v5.19-rcX.
Changelog v5:
- Add a note about having line-based PHY phandles order. (@Rob)
- Prefer 'pcie[0-9]+' PHY-names over the rest of the cases. (@Rob)
- Drop generic fallback names from the Baikal-T1 compatible property constraints. (@Rob)
- Define ordered {reg,interrupt,clock,reset}-names Baikal-T1 PCIe properties. (@Rob)
- Drop minItems from the Baikal-T1 PCIe clocks and reset properties, since it equals to the maxItems for them.
- Drop num-ob-windows and num-ib-windows properties constraint from Baikal-T1 PCIe bindings. (@Rob)
- Add a note about having line-based PHY phandles order. (@Rob)
- Prefer 'pcie[0-9]+' PHY-names over the rest of the cases. (@Rob)
- Add platform-specific reg/interrupt/clock/reset names to the generic schema, but mark them as deprecated.
- Add new patches:
dt-bindings: visconti-pcie: Fix interrupts array max constraints
dt-bindings: imx6q-pcie: Fix clock names for imx6sx and imx8mq
- Move the patch:
PCI: dwc: Introduce dma-ranges property support for RC-host from the previous patchset in here. (@Bjorn)
- Rebase onto the kernel v6.0-rc2.
Changelog v6:
- Add the Nvidia Tegra194-specific "p2u-[0-7]" phy-names too. (@DT-tbot)
- Drop 'deprecated' keywords from the vendor-specific names. (@Rob)
- Move the common *-names definitions to the RP/EP schemas. Thus drop the 'definitions' property usage from the DT-schemas. (@Rob)
- Move the DMA-mask setup to the eDMA driver. (@Robin)
- Rebase onto the kernel v6.1-rc3.
Serge Semin (20):
dt-bindings: imx6q-pcie: Fix clock names for imx6sx and imx8mq
dt-bindings: visconti-pcie: Fix interrupts array max constraints
dt-bindings: PCI: dwc: Detach common RP/EP DT bindings
dt-bindings: PCI: dwc: Remove bus node from the examples
dt-bindings: PCI: dwc: Add phys/phy-names common properties
dt-bindings: PCI: dwc: Add max-link-speed common property
dt-bindings: PCI: dwc: Apply generic schema for generic device only
dt-bindings: PCI: dwc: Add max-functions EP property
dt-bindings: PCI: dwc: Add interrupts/interrupt-names common
properties
dt-bindings: PCI: dwc: Add reg/reg-names common properties
dt-bindings: PCI: dwc: Add clocks/resets common properties
dt-bindings: PCI: dwc: Add dma-coherent property
dt-bindings: PCI: dwc: Apply common schema to Rockchip DW PCIe nodes
dt-bindings: PCI: dwc: Add Baikal-T1 PCIe Root Port bindings
PCI: dwc: Introduce dma-ranges property support for RC-host
PCI: dwc: Introduce generic controller capabilities interface
PCI: dwc: Introduce generic resources getter
PCI: dwc: Combine iATU detection procedures
PCI: dwc: Introduce generic platform clocks and resets
PCI: dwc: Add Baikal-T1 PCIe controller support
.../bindings/pci/baikal,bt1-pcie.yaml | 168 +++++ .../bindings/pci/fsl,imx6q-pcie.yaml | 47 +- .../bindings/pci/rockchip-dw-pcie.yaml | 4 +- .../bindings/pci/snps,dw-pcie-common.yaml | 266 ++++++++ .../bindings/pci/snps,dw-pcie-ep.yaml | 212 ++++-- .../devicetree/bindings/pci/snps,dw-pcie.yaml | 260 +++++-- .../bindings/pci/toshiba,visconti-pcie.yaml | 7 +- drivers/pci/controller/dwc/Kconfig | 9 + drivers/pci/controller/dwc/Makefile | 1 + drivers/pci/controller/dwc/pcie-bt1.c | 645 ++++++++++++++++++ .../pci/controller/dwc/pcie-designware-ep.c | 30 +- .../pci/controller/dwc/pcie-designware-host.c | 47 +- drivers/pci/controller/dwc/pcie-designware.c | 262 +++++-- drivers/pci/controller/dwc/pcie-designware.h | 63 +- 14 files changed, 1798 insertions(+), 223 deletions(-) create mode 100644 Documentation/devicetree/bindings/pci/baikal,bt1-pcie.yaml create mode 100644 Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml create mode 100644 drivers/pci/controller/dwc/pcie-bt1.c
Signature · 1 line
2.38.0
PATCH v6 1/20 dt-bindings: imx6q-pcie: Fix clock names for imx6sx and imx8mq
Originally as it was defined the legacy bindings the pcie_inbound_axi and pcie_aux clock names were supposed to be used in the fsl,imx6sx-pcie and fsl,imx8mq-pcie devices respectively. But the bindings conversion has been incorrectly so now the fourth clock name is defined as "pcie_inbound_axi for imx6sx-pcie, pcie_aux for imx8mq-pcie", which is completely wrong. Let's fix that by conditionally apply the clock-names constraints based on the compatible string content.
---
Changelog v5:
- This is a new patch added on the v5 release of the patchset.
--- .../bindings/pci/fsl,imx6q-pcie.yaml | 47 +++++++++++++++++-- 1 file changed, 42 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml +42 -5
@@ -16,6 +16,47 @@ description: |+ allOf: - $ref: /schemas/pci/snps,dw-pcie.yaml# + - if: + properties: + compatible: + contains: + const: fsl,imx6sx-pcie + then: + properties: + clock-names: + items: + - const: pcie + - const: pcie_bus + - const: pcie_phy + - const: pcie_inbound_axi + - if: + properties: + compatible: + contains: + const: fsl,imx8mq-pcie + then: + properties: + clock-names: + items: + - const: pcie + - const: pcie_bus + - const: pcie_phy + - const: pcie_aux + - if: + properties: + compatible: + not: + contains: + enum: + - fsl,imx6sx-pcie + - fsl,imx8mq-pcie + then: + properties: + clock-names: + items: + - const: pcie + - const: pcie_bus + - const: pcie_phy properties: compatible:
@@ -57,11 +98,7 @@ properties: clock-names: minItems: 3 - items: - - const: pcie - - const: pcie_bus - - const: pcie_phy - - const: pcie_inbound_axi for imx6sx-pcie, pcie_aux for imx8mq-pcie + maxItems: 4 num-lanes: const: 1
Signature · 8 lines
2.38.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Rob Herring
maintainerRe: [PATCH v6 01/20] dt-bindings: imx6q-pcie: Fix clock names for imx6sx and imx8mq
Quoted 73 lines · Serge Semin
Originally as it was defined the legacy bindings the
pcie_inbound_axiandpcie_auxclock names were supposed to be used in the fsl,imx6sx-pcie and fsl,imx8mq-pcie devices respectively. But the bindings conversion has been incorrectly so now the fourth clock name is defined as "pcie_inbound_axifor imx6sx-pcie,pcie_auxfor imx8mq-pcie", which is completely wrong. Let's fix that by conditionally apply the clock-names constraints based on the compatible string content.Fixes 751ca492f131 ("dt-bindings: PCI: imx6: convert the imx pcie controller to dtschema")Signed-off-by Serge Semin <[email protected]>Acked-by Alexander Stein <[email protected]>---
Changelog v5:
- This is a new patch added on the v5 release of the patchset.--- .../bindings/pci/fsl,imx6q-pcie.yaml | 47 +++++++++++++++++-- 1 file changed, 42 insertions(+), 5 deletions(-)Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml +41
-0@@ -16,6 +16,47 @@ description: |+ allOf: - $ref: /schemas/pci/snps,dw-pcie.yaml# + - if: + properties: + compatible: + contains: + const: fsl,imx6sx-pcie + then: + properties: + clock-names: + items: + - const: pcie + - const: pcie_bus + - const: pcie_phy + - const: pcie_inbound_axi + - if: + properties: + compatible: + contains: + const: fsl,imx8mq-pcie + then: + properties: + clock-names: + items: + - const: pcie + - const: pcie_bus + - const: pcie_phy + - const: pcie_aux + - if: + properties: + compatible: + not: + contains: + enum: + - fsl,imx6sx-pcie + - fsl,imx8mq-pcie + then: + properties: + clock-names: + items: + - const: pcie + - const: pcie_bus + - const: pcie_phy properties: compatible:
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml properties: · line 64
Quoted 8 lines
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml +0
-5@@ -57,11 +98,7 @@ properties: clock-names: minItems: 3 - items: - - const: pcie - - const: pcie_bus - - const: pcie_phy - - const: pcie_inbound_axi for imx6sx-pcie, pcie_aux for imx8mq-pcie
This should have been just 'enum: [ pcie_inbound_axi, pcie_aux ]'
And then do:
- if:
properties:
compatible:
contains:
const: fsl,imx8mq-pcie
then:
properties:
clock-names:
items:
- {}
- {}
- {}
- const: pcie_aux
And then another if/then with 'maxItems: 3'
Re: [PATCH v6 01/20] dt-bindings: imx6q-pcie: Fix clock names for imx6sx and imx8mq
Quoted 103 lines · Rob Herring
Quoted 73 lines · Serge Semin
Originally as it was defined the legacy bindings the
pcie_inbound_axiandpcie_auxclock names were supposed to be used in the fsl,imx6sx-pcie and fsl,imx8mq-pcie devices respectively. But the bindings conversion has been incorrectly so now the fourth clock name is defined as "pcie_inbound_axifor imx6sx-pcie,pcie_auxfor imx8mq-pcie", which is completely wrong. Let's fix that by conditionally apply the clock-names constraints based on the compatible string content.Fixes 751ca492f131 ("dt-bindings: PCI: imx6: convert the imx pcie controller to dtschema")Signed-off-by Serge Semin <[email protected]>Acked-by Alexander Stein <[email protected]>---
Changelog v5:
- This is a new patch added on the v5 release of the patchset.--- .../bindings/pci/fsl,imx6q-pcie.yaml | 47 +++++++++++++++++-- 1 file changed, 42 insertions(+), 5 deletions(-)Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml +41
-0@@ -16,6 +16,47 @@ description: |+ allOf: - $ref: /schemas/pci/snps,dw-pcie.yaml# + - if: + properties: + compatible: + contains: + const: fsl,imx6sx-pcie + then: + properties: + clock-names: + items: + - const: pcie + - const: pcie_bus + - const: pcie_phy + - const: pcie_inbound_axi + - if: + properties: + compatible: + contains: + const: fsl,imx8mq-pcie + then: + properties: + clock-names: + items: + - const: pcie + - const: pcie_bus + - const: pcie_phy + - const: pcie_aux + - if: + properties: + compatible: + not: + contains: + enum: + - fsl,imx6sx-pcie + - fsl,imx8mq-pcie + then: + properties: + clock-names: + items: + - const: pcie + - const: pcie_bus + - const: pcie_phy properties: compatible:Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml properties: · line 64
Quoted 8 lines
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.yaml +0
-5@@ -57,11 +98,7 @@ properties: clock-names: minItems: 3 - items: - - const: pcie - - const: pcie_bus - - const: pcie_phy - - const: pcie_inbound_axi for imx6sx-pcie, pcie_aux for imx8mq-pcieThis should have been just 'enum: [
pcie_inbound_axi,pcie_aux]'And then do:
- if:
properties:
compatible:
contains:
const: fsl,imx8mq-pcie
then:
properties:
clock-names:
items:
- {}
- {}
- {}
- const:pcie_aux
Quoted 1 line
And then another if/then with 'maxItems: 3'
Ok. Will fix it in v7. But IMO it looks a bit less descriptive especially with the '{}' pattern and a need to look in two different places to comprehend the whole constraint. I understand though what is an intention of such construction. It's to place as much info into the schema body and isolate the platform-specific constraints in the allOf clause. Pretty neat anyway.
-Sergey
PATCH v6 2/20 dt-bindings: visconti-pcie: Fix interrupts array max constraints
In reply to Serge SeminIn accordance with the way the device DT-node is actually defined in arch/arm64/boot/dts/toshiba/tmpv7708.dtsi and the way the device is probed by the DW PCIe driver there are two IRQs it actually has. It's MSI IRQ the DT-bindings lack. Let's extend the interrupts property constraints then and fix the schema example so one would be acceptable by the actual device DT-bindings.
---
Changelog v5:
- This is a new patch added on the v5 release of the patchset.
--- .../devicetree/bindings/pci/toshiba,visconti-pcie.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/pci/toshiba,visconti-pcie.yaml +4 -3
@@ -36,7 +36,7 @@ properties: - const: mpu interrupts: - maxItems: 1 + maxItems: 2 clocks: items:
@@ -94,8 +94,9 @@ examples: #interrupt-cells = <1>; ranges = <0x81000000 0 0x40000000 0 0x40000000 0 0x00010000>, <0x82000000 0 0x50000000 0 0x50000000 0 0x20000000>; - interrupts = <GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>; - interrupt-names = "intr"; + interrupts = <GIC_SPI 211 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "msi", "intr"; interrupt-map-mask = <0 0 0 7>; interrupt-map = <0 0 0 1 &gic GIC_SPI 215 IRQ_TYPE_LEVEL_HIGH
Signature · 8 lines
2.38.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v6 3/20 dt-bindings: PCI: dwc: Detach common RP/EP DT bindings
In reply to Serge SeminCurrently both DW PCIe Root Port and End-point DT bindings are defined as separate schemas. Carefully looking at them, at the hardware reference manuals and seeing there is a generic part of the driver used by the both RP and EP drivers we can greatly simplify the DW PCIe controller bindings by moving some of the properties into the common DT schema. It concerns the PERST GPIO control, number of lanes, number of iATU windows and CDM check properties. They will be defined in the snps,dw-pcie-common.yaml schema which will be referenced in the DW PCIe Root Port and End-point DT bindings in order to evaluate the common for both of these controllers properties. The rest of properties like reg{,-names}, clock{s,-names}, reset{s,-names}, etc will be consolidate there in one of the next commits.
---
Changelog v3:
- This is a new patch unpinned from the next one:
https://lore.kernel.org/linux-pci/[email protected]/
by the Rob' request. (@Rob)
--- .../bindings/pci/snps,dw-pcie-common.yaml | 76 +++++++++++++++++++ .../bindings/pci/snps,dw-pcie-ep.yaml | 31 +------- .../devicetree/bindings/pci/snps,dw-pcie.yaml | 33 +------- 3 files changed, 78 insertions(+), 62 deletions(-) create mode 100644 Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml
Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml new file +76 -0
@@ -0,0 +1,76 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/snps,dw-pcie-common.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Synopsys DWC PCIe RP/EP controller + +maintainers: + - Jingoo Han <[email protected]> + - Gustavo Pimentel <[email protected]> + +description: + Generic Synopsys DesignWare PCIe Root Port and Endpoint controller + properties. + +select: false + +properties: + reset-gpio: + deprecated: true + description: + Reference to the GPIO-controlled PERST# signal. It is used to reset all + the peripheral devices available on the PCIe bus. + maxItems: 1 + + reset-gpios: + description: + Reference to the GPIO-controlled PERST# signal. It is used to reset all + the peripheral devices available on the PCIe bus. + maxItems: 1 + + num-lanes: + description: + Number of PCIe link lanes to use. Can be omitted if the already brought + up link is supposed to be preserved. + maximum: 16 + + num-ob-windows: + $ref: /schemas/types.yaml#/definitions/uint32 + deprecated: true + description: + Number of outbound address translation windows. This parameter can be + auto-detected based on the iATU memory writability. So there is no + point in having a dedicated DT-property for it. + maximum: 256 + + num-ib-windows: + $ref: /schemas/types.yaml#/definitions/uint32 + deprecated: true + description: + Number of inbound address translation windows. In the same way as + for the outbound AT windows, this parameter can be auto-detected based + on the iATU memory writability. There is no point having a dedicated + DT-property for it either. + maximum: 256 + + num-viewport: + $ref: /schemas/types.yaml#/definitions/uint32 + deprecated: true + description: + Number of outbound view ports configured in hardware. It's the same as + the number of outbound AT windows. + maximum: 256 + + snps,enable-cdm-check: + $ref: /schemas/types.yaml#/definitions/flag + description: + Enable automatic checking of CDM (Configuration Dependent Module) + registers for data corruption. CDM registers include standard PCIe + configuration space registers, Port Logic registers, DMA and iATU + registers. This feature has been available since DWC PCIe v4.80a. + +additionalProperties: true + +...
Documentation/devicetree/bindings/pci/snps,dw-pcie-ep.yaml +1 -30
@@ -15,6 +15,7 @@ description: | allOf: - $ref: /schemas/pci/pci-ep.yaml# + - $ref: /schemas/pci/snps,dw-pcie-common.yaml# properties: compatible:
@@ -36,36 +37,6 @@ properties: items: enum: [dbi, dbi2, config, atu, addr_space, link, atu_dma, appl] - reset-gpio: - description: GPIO pin number of PERST# signal - maxItems: 1 - deprecated: true - - reset-gpios: - description: GPIO controlled connection to PERST# signal - maxItems: 1 - - snps,enable-cdm-check: - type: boolean - description: | - This is a boolean property and if present enables - automatic checking of CDM (Configuration Dependent Module) registers - for data corruption. CDM registers include standard PCIe configuration - space registers, Port Logic registers, DMA and iATU (internal Address - Translation Unit) registers. - - num-ib-windows: - $ref: /schemas/types.yaml#/definitions/uint32 - maximum: 256 - description: number of inbound address translation windows - deprecated: true - - num-ob-windows: - $ref: /schemas/types.yaml#/definitions/uint32 - maximum: 256 - description: number of outbound address translation windows - deprecated: true - required: - reg - reg-names
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +1 -32
@@ -15,6 +15,7 @@ description: | allOf: - $ref: /schemas/pci/pci-bus.yaml# + - $ref: /schemas/pci/snps,dw-pcie-common.yaml# properties: compatible:
@@ -37,44 +38,12 @@ properties: enum: [ dbi, dbi2, config, atu, atu_dma, app, appl, elbi, mgmt, ctrl, parf, cfg, link, ulreg, smu, mpu, apb, phy ] - num-lanes: - description: | - number of lanes to use (this property should be specified unless - the link is brought already up in firmware) - maximum: 16 - - reset-gpio: - description: GPIO pin number of PERST# signal - maxItems: 1 - deprecated: true - - reset-gpios: - description: GPIO controlled connection to PERST# signal - maxItems: 1 - interrupts: true interrupt-names: true clocks: true - snps,enable-cdm-check: - type: boolean - description: | - This is a boolean property and if present enables - automatic checking of CDM (Configuration Dependent Module) registers - for data corruption. CDM registers include standard PCIe configuration - space registers, Port Logic registers, DMA and iATU (internal Address - Translation Unit) registers. - - num-viewport: - $ref: /schemas/types.yaml#/definitions/uint32 - maximum: 256 - description: | - number of view ports configured in hardware. If a platform - does not specify it, the driver autodetects it. - deprecated: true - additionalProperties: true required:
Signature · 1 line
2.38.0
PATCH v6 4/20 dt-bindings: PCI: dwc: Remove bus node from the examples
In reply to Serge SeminIt's absolutely redundant seeing by default each node is embedded into its own example-X node with address and size cells set to 1.
---
Changelog v3:
- This is a new patch unpinned from the next one:
https://lore.kernel.org/linux-pci/[email protected]/
by the Rob' request. (@Rob)
--- .../bindings/pci/snps,dw-pcie-ep.yaml | 16 ++++----- .../devicetree/bindings/pci/snps,dw-pcie.yaml | 35 ++++++++++--------- 2 files changed, 24 insertions(+), 27 deletions(-)
Documentation/devicetree/bindings/pci/snps,dw-pcie-ep.yaml +6 -10
@@ -46,14 +46,10 @@ additionalProperties: true examples: - | - bus { - #address-cells = <1>; - #size-cells = <1>; - pcie-ep@dfd00000 { - compatible = "snps,dw-pcie-ep"; - reg = <0xdfc00000 0x0001000>, /* IP registers 1 */ - <0xdfc01000 0x0001000>, /* IP registers 2 */ - <0xd0000000 0x2000000>; /* Configuration space */ - reg-names = "dbi", "dbi2", "addr_space"; - }; + pcie-ep@dfd00000 { + compatible = "snps,dw-pcie-ep"; + reg = <0xdfc00000 0x0001000>, /* IP registers 1 */ + <0xdfc01000 0x0001000>, /* IP registers 2 */ + <0xd0000000 0x2000000>; /* Configuration space */ + reg-names = "dbi", "dbi2", "addr_space"; };
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +18 -17
@@ -53,21 +53,22 @@ required: examples: - | - bus { - #address-cells = <1>; - #size-cells = <1>; - pcie@dfc00000 { - device_type = "pci"; - compatible = "snps,dw-pcie"; - reg = <0xdfc00000 0x0001000>, /* IP registers */ - <0xd0000000 0x0002000>; /* Configuration space */ - reg-names = "dbi", "config"; - #address-cells = <3>; - #size-cells = <2>; - ranges = <0x81000000 0 0x00000000 0xde000000 0 0x00010000>, - <0x82000000 0 0xd0400000 0xd0400000 0 0x0d000000>; - interrupts = <25>, <24>; - #interrupt-cells = <1>; - num-lanes = <1>; - }; + pcie@dfc00000 { + compatible = "snps,dw-pcie"; + device_type = "pci"; + reg = <0xdfc00000 0x0001000>, /* IP registers */ + <0xd0000000 0x0002000>; /* Configuration space */ + reg-names = "dbi", "config"; + #address-cells = <3>; + #size-cells = <2>; + ranges = <0x81000000 0 0x00000000 0xde000000 0 0x00010000>, + <0x82000000 0 0xd0400000 0xd0400000 0 0x0d000000>; + bus-range = <0x0 0xff>; + + interrupts = <25>, <24>; + #interrupt-cells = <1>; + + reset-gpios = <&port0 0 1>; + + num-lanes = <1>; };
Signature · 1 line
2.38.0
PATCH v6 5/20 dt-bindings: PCI: dwc: Add phys/phy-names common properties
In reply to Serge SeminIt's normal to have the DW PCIe RP/EP DT-nodes equipped with the explicit PHY phandle references. There can be up to 16 PHYs attach in accordance with the maximum number of supported PCIe lanes. Let's extend the common DW PCIe controller schema with the 'phys' and 'phy-names' properties definition. There two types PHY names are defined: preferred generic names '^pcie[0-9]+$' and non-preferred vendor-specific names '^pcie([0-9]+|-?phy[0-9]*)?$' so to match the names currently supported by the DW PCIe platform drivers ("pcie": meson; "pciephy": qcom, imx6; "pcie-phy": uniphier, rockchip, spear13xx; "pcie": intel-gw; "pcie-phy%d":
keystone, dra7xx; "pcie": histb, etc).
---
Changelog v3:
- This is a new patch unpinned from the next one:
https://lore.kernel.org/linux-pci/[email protected]/
by the Rob' request. (@Rob)
Changelog v5:
- Add a note about having line-based PHY phandles order. (@Rob)
- Prefer 'pcie[0-9]+' PHY-names over the rest of the cases. (@Rob)
Changelog v6:
- Add the Nvidia Tegra194-specific "p2u-[0-7]" phy-names too. (@DT-tbot)
- Drop 'deprecated' keywords from the vendor-specific names. (@Rob)
--- .../bindings/pci/snps,dw-pcie-common.yaml | 24 +++++++++++++++++++ .../bindings/pci/snps,dw-pcie-ep.yaml | 3 +++ .../devicetree/bindings/pci/snps,dw-pcie.yaml | 3 +++ 3 files changed, 30 insertions(+)
Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml +24 -0
@@ -17,6 +17,30 @@ description: select: false properties: + phys: + description: + There can be up to the number of possible lanes PHYs specified placed in + the phandle array in the line-based order. Obviously each the specified + PHYs are supposed to be able to work in the PCIe mode with a speed + implied by the DWC PCIe controller they are attached to. + minItems: 1 + maxItems: 16 + + phy-names: + minItems: 1 + maxItems: 16 + oneOf: + - description: Generic PHY names + items: + pattern: '^pcie[0-9]+$' + - description: + Vendor-specific PHY names. Consider using the generic + names above for new bindings. + items: + oneOf: + - pattern: '^pcie(-?phy[0-9]*)?$' + - pattern: '^p2u-[0-7]$' + reset-gpio: deprecated: true description:
Documentation/devicetree/bindings/pci/snps,dw-pcie-ep.yaml +3 -0
@@ -52,4 +52,7 @@ examples: <0xdfc01000 0x0001000>, /* IP registers 2 */ <0xd0000000 0x2000000>; /* Configuration space */ reg-names = "dbi", "dbi2", "addr_space"; + + phys = <&pcie_phy0>, <&pcie_phy1>, <&pcie_phy2>, <&pcie_phy3>; + phy-names = "pcie0", "pcie1", "pcie2", "pcie3"; };
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +3 -0
@@ -70,5 +70,8 @@ examples: reset-gpios = <&port0 0 1>; + phys = <&pcie_phy>; + phy-names = "pcie"; + num-lanes = <1>; };
Signature · 1 line
2.38.0
Re: [PATCH v6 05/20] dt-bindings: PCI: dwc: Add phys/phy-names common properties
Quoted 24 lines · Serge Semin
It's normal to have the DW PCIe RP/EP DT-nodes equipped with the explicit PHY phandle references. There can be up to 16 PHYs attach in accordance with the maximum number of supported PCIe lanes. Let's extend the common DW PCIe controller schema with the 'phys' and 'phy-names' properties definition. There two types PHY names are defined: preferred generic names '^pcie[0-9]+$' and non-preferred vendor-specific names '^pcie([0-9]+|-?phy[0-9]*)?$' so to match the names currently supported by the DW PCIe platform drivers ("pcie": meson; "pciephy": qcom, imx6; "pcie-phy": uniphier, rockchip, spear13xx; "pcie": intel-gw; "pcie-phy%d":
keystone, dra7xx; "pcie": histb, etc).Signed-off-by Serge Semin <[email protected]>---
Changelog v3:
- This is a new patch unpinned from the next one:
https://lore.kernel.org/linux-pci/[email protected]/
by the Rob' request. (@Rob)Changelog v5:
- Add a note about having line-based PHY phandles order. (@Rob)
- Prefer 'pcie[0-9]+' PHY-names over the rest of the cases. (@Rob)
Quoted 9 lines
Changelog v6:
- Add the Nvidia Tegra194-specific "p2u-[0-7]" phy-names too. (@DT-tbot)
- Drop 'deprecated' keywords from the vendor-specific names. (@Rob)--- .../bindings/pci/snps,dw-pcie-common.yaml | 24 +++++++++++++++++++ .../bindings/pci/snps,dw-pcie-ep.yaml | 3 +++ .../devicetree/bindings/pci/snps,dw-pcie.yaml | 3 +++ 3 files changed, 30 insertions(+)
PATCH v6 6/20 dt-bindings: PCI: dwc: Add max-link-speed common property
In reply to Serge SeminIn accordance with [1] DW PCIe controllers support up to Gen5 link speed. Let's add the max-link-speed property upper bound to 5 then. The DT bindings of the particular devices are expected to setup more strict constraint on that parameter.
[1] Synopsys DesignWare Cores PCI Express Controller Databook, Version 5.40a, March 2019, p. 27
---
Changelog v3:
- This is a new patch unpinned from the next one:
https://lore.kernel.org/linux-pci/[email protected]/
by the Rob' request. (@Rob)
--- Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml | 3 +++ Documentation/devicetree/bindings/pci/snps,dw-pcie-ep.yaml | 2 ++ Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml | 1 + 3 files changed, 6 insertions(+)
Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml +3 -0
@@ -54,6 +54,9 @@ properties: the peripheral devices available on the PCIe bus. maxItems: 1 + max-link-speed: + maximum: 5 + num-lanes: description: Number of PCIe link lanes to use. Can be omitted if the already brought
Documentation/devicetree/bindings/pci/snps,dw-pcie-ep.yaml +2 -0
@@ -55,4 +55,6 @@ examples: phys = <&pcie_phy0>, <&pcie_phy1>, <&pcie_phy2>, <&pcie_phy3>; phy-names = "pcie0", "pcie1", "pcie2", "pcie3"; + + max-link-speed = <3>; };
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +1 -0
@@ -74,4 +74,5 @@ examples: phy-names = "pcie"; num-lanes = <1>; + max-link-speed = <3>; };
Signature · 1 line
2.38.0
PATCH v6 7/20 dt-bindings: PCI: dwc: Apply generic schema for generic device only
In reply to Serge SeminHaving the generic compatible strings constraints with the 'any'+'generic string' semantic implicitly encourages either to add new DW PCIe-based DT-bindings with the generic compatible string attached or just forget about adding new DT-bindings since the corresponding DT-node will be evaluated anyway. Moreover having that semantic implemented in the generic DT-schema causes the DT-validation tool to apply the schema twice:
first by implicit compatible-string-based selection and second by means of the 'allOf: [ $ref ]' statement. Let's fix all of that by dropping the compatible property constraints and selecting the generic DT-schema only for the purely generic DW PCIe DT-nodes. The later is required since there is a driver for such devices. (Though there are no such DT-nodes currently defined in the kernel DT sources.)
---
Changelog v3:
- This is a new patch unpinned from the next one:
https://lore.kernel.org/linux-pci/[email protected]/
by the Rob' request. (@Rob)
- Fix compatible property schema so one would work as expected: string must contain either generic DW PCIe IP-core name or both generic and equipped with IP-core version names.
Changelog v5:
- Switch the patch from not-selecting the generic schemas to applying them to the generic DW PCIe device nodes only.
- Drop the generic compatible string used as fallback. (@Rob)
--- .../devicetree/bindings/pci/snps,dw-pcie-ep.yaml | 16 ++++++++++------ .../devicetree/bindings/pci/snps,dw-pcie.yaml | 16 ++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/pci/snps,dw-pcie-ep.yaml +10 -6
@@ -13,16 +13,20 @@ maintainers: description: | Synopsys DesignWare PCIe host controller endpoint +# Please create a separate DT-schema for your DWC PCIe Endpoint controller +# and make sure it's assigned with the vendor-specific compatible string. +select: + properties: + compatible: + const: snps,dw-pcie-ep + required: + - compatible + allOf: - $ref: /schemas/pci/pci-ep.yaml# - $ref: /schemas/pci/snps,dw-pcie-common.yaml# properties: - compatible: - anyOf: - - {} - - const: snps,dw-pcie-ep - reg: description: | It should contain Data Bus Interface (dbi) and config registers for all
@@ -38,9 +42,9 @@ properties: enum: [dbi, dbi2, config, atu, addr_space, link, atu_dma, appl] required: + - compatible - reg - reg-names - - compatible additionalProperties: true
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +10 -6
@@ -13,16 +13,20 @@ maintainers: description: | Synopsys DesignWare PCIe host controller +# Please create a separate DT-schema for your DWC PCIe Root Port controller +# and make sure it's assigned with the vendor-specific compatible string. +select: + properties: + compatible: + const: snps,dw-pcie + required: + - compatible + allOf: - $ref: /schemas/pci/pci-bus.yaml# - $ref: /schemas/pci/snps,dw-pcie-common.yaml# properties: - compatible: - anyOf: - - {} - - const: snps,dw-pcie - reg: description: | It should contain Data Bus Interface (dbi) and config registers for all
@@ -47,9 +51,9 @@ properties: additionalProperties: true required: + - compatible - reg - reg-names - - compatible examples: - |
Signature · 1 line
2.38.0
PATCH v6 8/20 dt-bindings: PCI: dwc: Add max-functions EP property
In reply to Serge SeminIn accordance with [1] the CX_NFUNC IP-core synthesize parameter is responsible for the number of physical functions to support in the EP mode. Its upper limit is 32. Let's use it to constrain the number of PCIe functions the DW PCIe EP DT-nodes can advertise.
[1] Synopsys DesignWare Cores PCI Express Controller Databook - DWC PCIe Endpoint, Version 5.40a, March 2019, p. 887.
---
Changelog v3:
- This is a new patch unpinned from the next one:
https://lore.kernel.org/linux-pci/[email protected]/
by the Rob' request. (@Rob)
--- Documentation/devicetree/bindings/pci/snps,dw-pcie-ep.yaml | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/pci/snps,dw-pcie-ep.yaml +4 -0
@@ -41,6 +41,9 @@ properties: items: enum: [dbi, dbi2, config, atu, addr_space, link, atu_dma, appl] + max-functions: + maximum: 32 + required: - compatible - reg
@@ -61,4 +64,5 @@ examples: phy-names = "pcie0", "pcie1", "pcie2", "pcie3"; max-link-speed = <3>; + max-functions = /bits/ 8 <4>; };
Signature · 1 line
2.38.0
PATCH v6 9/20 dt-bindings: PCI: dwc: Add interrupts/interrupt-names common properties
In reply to Serge SeminCurrently the 'interrupts' and 'interrupt-names' properties are defined being too generic to really describe any actual IRQ interface. Moreover the DW PCIe End-point devices are left with no IRQ signals. All of that can be fixed by adding the IRQ-related properties to the common DW PCIe DT-schemas in accordance with the hardware reference manual. The DW PCIe common DT-schema will contain the generic properties definitions with just a number of entries per property, while the DW PCIe RP/EP-specific schemas will have the particular number of items and the generic resource names listed.
Note since there are DW PCI-based vendor-specific DT-bindings with the custom names assigned to the same IRQ resources we have no much choice but to add them to the generic DT-schemas in order to have the schemas being applicable for such devices. These names are marked as vendor-specific and should be avoided being used in new bindings in favor of the generic names.
---
Note without the next dtschema tool fix
lib.py 2022-09-29 15:19:54.886172794 +0300 renamed from lib.py 2022-09-29 15:17:13.100033810 +0300 +3 -3
@@ -1307,7 +1307,7 @@ def format_error(filename, error, prefix="", nodename=None, verbose=False): src = prefix + os.path.abspath(filename) + ':' - if error.linecol[0] >= 0: + if hasattr(error, 'linecol') and error.linecol[0] >= 0: src = src + '%i:%i: ' % (error.linecol[0]+1, error.linecol[1]+1) else: src += ' '
@@ -1342,10 +1342,10 @@ else: msg = error.message - if error.note: + if hasattr(error, 'note') and error.note: msg += '\n\t' + prefix + 'hint: ' + error.note - if error.schema_file: + if hasattr(error, 'schema_file') and error.schema_file: msg += '\n\t' + prefix + 'from schema $id: ' + error.schema_file return src + msg
any DT-bindings error will cause the dt-schema script crash:
Traceback (most recent call last):
File "/home/fancer/.local/bin/dt-validate", line 175, in <module>
sg.check_trees(filename, testtree)
File "/home/fancer/.local/bin/dt-validate", line 122, in check_trees
self.check_subtree(dt, subtree, False, "/", "/", filename)
File "/home/fancer/.local/bin/dt-validate", line 111, in check_subtree
self.check_subtree(tree, value, disabled, name, fullname + name, filename)
File "/home/fancer/.local/bin/dt-validate", line 111, in check_subtree
self.check_subtree(tree, value, disabled, name, fullname + name, filename)
File "/home/fancer/.local/bin/dt-validate", line 106, in check_subtree
self.check_node(tree, subtree, disabled, nodename, fullname, filename)
File "/home/fancer/.local/bin/dt-validate", line 84, in check_node
print(dtschema.format_error(filename, error, nodename=nodename, verbose=verbose) +
File "/home/fancer/.local/lib/python3.8/site-packages/dtschema/lib.py", line 1332, in format_error
msg += '\n' + format_error(filename, suberror, prefix=prefix+"\t", nodename=nodename, verbose=verbose)
File "/home/fancer/.local/lib/python3.8/site-packages/dtschema/lib.py", line 1310, in format_error
if error.linecol[0] >= 0:AttributeError: 'ValidationError' object has no attribute 'linecol'
Changelog v3:
- This is a new patch unpinned from the next one:
https://lore.kernel.org/linux-pci/[email protected]/
by the Rob' request. (@Rob)
Changelog v5:
- Add platform-specific interrupt names, but mark them as deprecated.
Changelog v6:
- Move the common interrupt-names definitions to the RP/EP schemas. Thus drop the 'definitions' property. (@Rob)
- Drop the 'deprecated' keywords from the vendor-specific names. (@Rob)
--- .../bindings/pci/snps,dw-pcie-common.yaml | 19 ++++ .../bindings/pci/snps,dw-pcie-ep.yaml | 52 +++++++++++ .../devicetree/bindings/pci/snps,dw-pcie.yaml | 90 ++++++++++++++++++- 3 files changed, 158 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml +19 -0
@@ -17,6 +17,25 @@ description: select: false properties: + interrupts: + description: + There are two main sub-blocks which are normally capable of + generating interrupts. It's System Information Interface and MSI + interface. While the former one has some common for the Host and + Endpoint controllers IRQ-signals, the later interface is obviously + Root Complex specific since it's responsible for the incoming MSI + messages signalling. The System Information IRQ signals are mainly + responsible for reporting the generic PCIe hierarchy and Root + Complex events like VPD IO request, general AER, PME, Hot-plug, link + bandwidth change, link equalization request, INTx asserted/deasserted + Message detection, embedded DMA Tx/Rx/Error. + minItems: 1 + maxItems: 26 + + interrupt-names: + minItems: 1 + maxItems: 26 + phys: description: There can be up to the number of possible lanes PHYs specified placed in
Documentation/devicetree/bindings/pci/snps,dw-pcie-ep.yaml +52 -0
64 lines not on this page · raw message
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +87 -3
102 lines not on this page · raw message
Signature · 1 line
2.38.0
RE: [PATCH v6 09/20] dt-bindings: PCI: dwc: Add interrupts/interrupt-names common properties
Hi Serge,
lib.py 2022-09-29 15:19:54.886172794 +0300
Quoted 27 lines
From: Serge Semin, Sent: Tuesday, November 8, 2022 5:49 AM
Currently the 'interrupts' and 'interrupt-names' properties are defined being too generic to really describe any actual IRQ interface. Moreover the DW PCIe End-point devices are left with no IRQ signals. All of that can be fixed by adding the IRQ-related properties to the common DW PCIe DT-schemas in accordance with the hardware reference manual. The DW PCIe common DT-schema will contain the generic properties definitions with just a number of entries per property, while the DW PCIe RP/EP-specific schemas will have the particular number of items and the generic resource names listed.
Note since there are DW PCI-based vendor-specific DT-bindings with the custom names assigned to the same IRQ resources we have no much choice but to add them to the generic DT-schemas in order to have the schemas being applicable for such devices. These names are marked as vendor-specific and should be avoided being used in new bindings in favor of the generic names.
Signed-off-by Serge Semin <[email protected]>---
Note without the next dtschema tool fix
lib.py 2022-09-29 15:19:54.886172794 +0300 renamed from lib.py 2022-09-29 15:17:13.100033810 +0300 +0
-0
JFYI.
git am command could not work correctly by this lib.py file:
---
Applying: dt-bindings: PCI: dwc: Add interrupts/interrupt-names common properties
error: lib.py: does not exist in index
Patch failed at 0001 dt-bindings: PCI: dwc: Add interrupts/interrupt-names common properties
---
If I used patch command and skipped the lib.py, it could apply this patch correctly.
Best regards,
Yoshihiro Shimoda
Re: [PATCH v6 09/20] dt-bindings: PCI: dwc: Add interrupts/interrupt-names common properties
Hi Yoshihiro
Quoted 33 lines · Yoshihiro Shimoda
Hi Serge,
lib.py 2022-09-29 15:19:54.886172794 +0300
Quoted 27 lines
From: Serge Semin, Sent: Tuesday, November 8, 2022 5:49 AM
Currently the 'interrupts' and 'interrupt-names' properties are defined being too generic to really describe any actual IRQ interface. Moreover the DW PCIe End-point devices are left with no IRQ signals. All of that can be fixed by adding the IRQ-related properties to the common DW PCIe DT-schemas in accordance with the hardware reference manual. The DW PCIe common DT-schema will contain the generic properties definitions with just a number of entries per property, while the DW PCIe RP/EP-specific schemas will have the particular number of items and the generic resource names listed.
Note since there are DW PCI-based vendor-specific DT-bindings with the custom names assigned to the same IRQ resources we have no much choice but to add them to the generic DT-schemas in order to have the schemas being applicable for such devices. These names are marked as vendor-specific and should be avoided being used in new bindings in favor of the generic names.
Signed-off-by Serge Semin <[email protected]>---
Note without the next dtschema tool fix
lib.py 2022-09-29 15:19:54.886172794 +0300 renamed from lib.py 2022-09-29 15:17:13.100033810 +0300 +0
-0JFYI.
Quoted 8 lines
git am command could not work correctly by this
lib.pyfile:
---
Applying: dt-bindings: PCI: dwc: Add interrupts/interrupt-names common properties
error:lib.py: does not exist in index
Patch failed at 0001 dt-bindings: PCI: dwc: Add interrupts/interrupt-names common properties
---If I used patch command and skipped the
lib.py, it could apply this patch correctly.
Got it. Thanks for the note. I'll either drop this part on the next patchset revision (hopefully Rob will do something about that by then) or make it less looking like a patch so git am wouldn't be confused.
-Sergey
Quoted 4 lines
Best regards,
Yoshihiro Shimoda
Re: [PATCH v6 09/20] dt-bindings: PCI: dwc: Add interrupts/interrupt-names common properties
Quoted 44 lines · Serge Semin
Hi Yoshihiro
Quoted 40 lines · Yoshihiro Shimoda
Hi Serge,
lib.py 2022-09-29 15:19:54.886172794 +0300
Quoted 27 lines
From: Serge Semin, Sent: Tuesday, November 8, 2022 5:49 AM
Currently the 'interrupts' and 'interrupt-names' properties are defined being too generic to really describe any actual IRQ interface. Moreover the DW PCIe End-point devices are left with no IRQ signals. All of that can be fixed by adding the IRQ-related properties to the common DW PCIe DT-schemas in accordance with the hardware reference manual. The DW PCIe common DT-schema will contain the generic properties definitions with just a number of entries per property, while the DW PCIe RP/EP-specific schemas will have the particular number of items and the generic resource names listed.
Note since there are DW PCI-based vendor-specific DT-bindings with the custom names assigned to the same IRQ resources we have no much choice but to add them to the generic DT-schemas in order to have the schemas being applicable for such devices. These names are marked as vendor-specific and should be avoided being used in new bindings in favor of the generic names.
Signed-off-by Serge Semin <[email protected]>---
Note without the next dtschema tool fix
lib.py 2022-09-29 15:19:54.886172794 +0300 renamed from lib.py 2022-09-29 15:17:13.100033810 +0300 +0
-0JFYI.
git am command could not work correctly by this
lib.pyfile:
---
Applying: dt-bindings: PCI: dwc: Add interrupts/interrupt-names common properties
error:lib.py: does not exist in index
Patch failed at 0001 dt-bindings: PCI: dwc: Add interrupts/interrupt-names common properties
---
Quoted 5 lines
Quoted 1 line
If I used patch command and skipped the
lib.py, it could apply this patch correctly.Got it. Thanks for the note. I'll either drop this part on the next patchset revision (hopefully Rob will do something about that by then) or make it less looking like a patch so git am wouldn't be confused.
Now fixed in main branch. Thanks for the report.
Rob
Re: [PATCH v6 09/20] dt-bindings: PCI: dwc: Add interrupts/interrupt-names common properties
Quoted 45 lines · Rob Herring
Quoted 44 lines · Serge Semin
Hi Yoshihiro
Quoted 40 lines · Yoshihiro Shimoda
Hi Serge,
lib.py 2022-09-29 15:19:54.886172794 +0300
Quoted 27 lines
From: Serge Semin, Sent: Tuesday, November 8, 2022 5:49 AM
Currently the 'interrupts' and 'interrupt-names' properties are defined being too generic to really describe any actual IRQ interface. Moreover the DW PCIe End-point devices are left with no IRQ signals. All of that can be fixed by adding the IRQ-related properties to the common DW PCIe DT-schemas in accordance with the hardware reference manual. The DW PCIe common DT-schema will contain the generic properties definitions with just a number of entries per property, while the DW PCIe RP/EP-specific schemas will have the particular number of items and the generic resource names listed.
Note since there are DW PCI-based vendor-specific DT-bindings with the custom names assigned to the same IRQ resources we have no much choice but to add them to the generic DT-schemas in order to have the schemas being applicable for such devices. These names are marked as vendor-specific and should be avoided being used in new bindings in favor of the generic names.
Signed-off-by Serge Semin <[email protected]>---
Note without the next dtschema tool fix
lib.py 2022-09-29 15:19:54.886172794 +0300 renamed from lib.py 2022-09-29 15:17:13.100033810 +0300 +0
-0JFYI.
git am command could not work correctly by this
lib.pyfile:
---
Applying: dt-bindings: PCI: dwc: Add interrupts/interrupt-names common properties
error:lib.py: does not exist in index
Patch failed at 0001 dt-bindings: PCI: dwc: Add interrupts/interrupt-names common properties
---
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
If I used patch command and skipped the
lib.py, it could apply this patch correctly.Got it. Thanks for the note. I'll either drop this part on the next patchset revision (hopefully Rob will do something about that by then) or make it less looking like a patch so git am wouldn't be confused.
Now fixed in main branch. Thanks for the report.
Ok. I'll drop that chunk from v7 then.
-Sergey
Quoted 2 lines
Rob
Re: [PATCH v6 09/20] dt-bindings: PCI: dwc: Add interrupts/interrupt-names common properties
In reply to Serge SeminQuoted 81 lines · Serge Semin
Currently the 'interrupts' and 'interrupt-names' properties are defined being too generic to really describe any actual IRQ interface. Moreover the DW PCIe End-point devices are left with no IRQ signals. All of that can be fixed by adding the IRQ-related properties to the common DW PCIe DT-schemas in accordance with the hardware reference manual. The DW PCIe common DT-schema will contain the generic properties definitions with just a number of entries per property, while the DW PCIe RP/EP-specific schemas will have the particular number of items and the generic resource names listed.
Note since there are DW PCI-based vendor-specific DT-bindings with the custom names assigned to the same IRQ resources we have no much choice but to add them to the generic DT-schemas in order to have the schemas being applicable for such devices. These names are marked as vendor-specific and should be avoided being used in new bindings in favor of the generic names.
Signed-off-by Serge Semin <[email protected]>---
Note without the next dtschema tool fix
lib.py 2022-09-29 15:19:54.886172794 +0300 renamed from lib.py 2022-09-29 15:17:13.100033810 +0300 +3
-3@@ -1307,7 +1307,7 @@ def format_error(filename, error, prefix="", nodename=None, verbose=False): src = prefix + os.path.abspath(filename) + ':' - if error.linecol[0] >= 0: + if hasattr(error, 'linecol') and error.linecol[0] >= 0: src = src + '%i:%i: ' % (error.linecol[0]+1, error.linecol[1]+1) else: src += ' '@@ -1342,10 +1342,10 @@ else: msg = error.message - if error.note: + if hasattr(error, 'note') and error.note: msg += '\n\t' + prefix + 'hint: ' + error.note - if error.schema_file: + if hasattr(error, 'schema_file') and error.schema_file: msg += '\n\t' + prefix + 'from schema $id: ' + error.schema_file return src + msgany DT-bindings error will cause the dt-schema script crash:
Traceback (most recent call last):
File "/home/fancer/.local/bin/dt-validate", line 175, in <module>
sg.check_trees(filename, testtree)
File "/home/fancer/.local/bin/dt-validate", line 122, incheck_treesself.check_subtree(dt, subtree, False, "/", "/", filename) File "/home/fancer/.local/bin/dt-validate", line 111, in check_subtree self.check_subtree(tree, value, disabled, name, fullname + name, filename) File "/home/fancer/.local/bin/dt-validate", line 111, in check_subtree self.check_subtree(tree, value, disabled, name, fullname + name, filename) File "/home/fancer/.local/bin/dt-validate", line 106, in check_subtree self.check_node(tree, subtree, disabled, nodename, fullname, filename) File "/home/fancer/.local/bin/dt-validate", line 84, in check_node print(dtschema.format_error(filename, error, nodename=nodename, verbose=verbose) + File "/home/fancer/.local/lib/python3.8/site-packages/dtschema/lib.py", line 1332, in format_error msg += '\n' + format_error(filename, suberror, prefix=prefix+"\t", nodename=nodename, verbose=verbose) File "/home/fancer/.local/lib/python3.8/site-packages/dtschema/lib.py", line 1310, in format_error if error.linecol[0] >= 0:AttributeError: 'ValidationError' object has no attribute 'linecol'
Changelog v3:
- This is a new patch unpinned from the next one:
https://lore.kernel.org/linux-pci/[email protected]/
by the Rob' request. (@Rob)Changelog v5:
- Add platform-specific interrupt names, but mark them as deprecated.Changelog v6:
- Move the common interrupt-names definitions to the RP/EP schemas. Thus drop the 'definitions' property. (@Rob)
- Drop the 'deprecated' keywords from the vendor-specific names. (@Rob)
Quoted 6 lines
--- .../bindings/pci/snps,dw-pcie-common.yaml | 19 ++++ .../bindings/pci/snps,dw-pcie-ep.yaml | 52 +++++++++++ .../devicetree/bindings/pci/snps,dw-pcie.yaml | 90 ++++++++++++++++++- 3 files changed, 158 insertions(+), 3 deletions(-)
PATCH v6 10/20 dt-bindings: PCI: dwc: Add reg/reg-names common properties
In reply to Serge SeminEven though there is a more-or-less limited set of the CSR spaces can be defined for each DW PCIe controller the generic DT-schema currently doesn't specify much limitations on the reg-space names used for one or another range. In order to prevent the vendor-specific controller schemas further deviation from the generic interface let's fix that by introducing the reg-names definition in the common DW PCIe DT-schemas and preserving the generic "reg" and "reg-names" properties in there. New DW PCIe device DT-bindings are encouraged to use the generic set of the CSR spaces defined in the generic DW PCIe RP/EP DT-bindings, while the already available vendor-specific DT-bindings can still apple the common DT-schemas.
Note the number of reg/reg-names items need to be changed in the DW PCIe EP DT-schema since aside with the "dbi" CSRs space these arrays can have "dbi2", "addr_space", "atu", etc ranges.
Also note since there are DW PCIe-based vendor-specific DT-bindings with the custom names assigned to the same CSR resources we have no much choice but to add them to the generic DT-schemas in order to have the schemas being applicable for such devices. These names are marked as vendor-specific and should be avoided being used in new bindings in favor of the generic names.
---
Changelog v3:
- This is a new patch unpinned from the next one:
https://lore.kernel.org/linux-pci/[email protected]/
by the Rob' request. (@Rob)
- Split up reg-names in the same way as the interrupt-names: common, Root Port and Endpoint specific names. (@Rob)
- Drop synonymous from the names list since the device schemas create their own enumerations anyway.
Changelog v5:
- Add platform-specific reg names, but mark them as deprecated.
Changelog v6:
- Move the common reg-names definitions to the RP/EP schemas. Thus drop the 'definitions' property. (@Rob)
- Drop the 'deprecated' keywords from the vendor-specific names. (@Rob)
--- .../bindings/pci/snps,dw-pcie-common.yaml | 22 +++++ .../bindings/pci/snps,dw-pcie-ep.yaml | 82 +++++++++++++++++-- .../devicetree/bindings/pci/snps,dw-pcie.yaml | 78 ++++++++++++++++-- 3 files changed, 169 insertions(+), 13 deletions(-)
Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml +22 -0
@@ -17,6 +17,28 @@ description: select: false properties: + reg: + description: + DWC PCIe CSR space is normally accessed over the dedicated Data Bus + Interface - DBI. In accordance with the reference manual the register + configuration space belongs to the Configuration-Dependent Module (CDM) + and is split up into several sub-parts Standard PCIe configuration + space, Port Logic Registers (PL), Shadow Config-space Registers, + iATU/eDMA registers. The particular sub-space is selected by the + CDM/ELBI (dbi_cs) and CS2 (dbi_cs2) signals (selector bits). Such + configuration provides a flexible interface for the system engineers to + either map the particular space at a desired MMIO address or just leave + them in a contiguous memory space if pure Native or AXI Bridge DBI access + is selected. Note the PCIe CFG-space, PL and Shadow registers are + specific for each activated function, while the rest of the sub-spaces + are common for all of them (if there are more than one). + minItems: 2 + maxItems: 6 + + reg-names: + minItems: 2 + maxItems: 6 + interrupts: description: There are two main sub-blocks which are normally capable of
Documentation/devicetree/bindings/pci/snps,dw-pcie-ep.yaml +75 -7
93 lines not on this page · raw message
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +72 -6
90 lines not on this page · raw message
Signature · 1 line
2.38.0
Re: [PATCH v6 10/20] dt-bindings: PCI: dwc: Add reg/reg-names common properties
Quoted 43 lines · Serge Semin
Even though there is a more-or-less limited set of the CSR spaces can be defined for each DW PCIe controller the generic DT-schema currently doesn't specify much limitations on the reg-space names used for one or another range. In order to prevent the vendor-specific controller schemas further deviation from the generic interface let's fix that by introducing the reg-names definition in the common DW PCIe DT-schemas and preserving the generic "reg" and "reg-names" properties in there. New DW PCIe device DT-bindings are encouraged to use the generic set of the CSR spaces defined in the generic DW PCIe RP/EP DT-bindings, while the already available vendor-specific DT-bindings can still apple the common DT-schemas.
Note the number of reg/reg-names items need to be changed in the DW PCIe EP DT-schema since aside with the "dbi" CSRs space these arrays can have "dbi2", "
addr_space", "atu", etc ranges.Also note since there are DW PCIe-based vendor-specific DT-bindings with the custom names assigned to the same CSR resources we have no much choice but to add them to the generic DT-schemas in order to have the schemas being applicable for such devices. These names are marked as vendor-specific and should be avoided being used in new bindings in favor of the generic names.
Signed-off-by Serge Semin <[email protected]>---
Changelog v3:
- This is a new patch unpinned from the next one:
https://lore.kernel.org/linux-pci/[email protected]/
by the Rob' request. (@Rob)
- Split up reg-names in the same way as the interrupt-names: common, Root Port and Endpoint specific names. (@Rob)
- Drop synonymous from the names list since the device schemas create their own enumerations anyway.Changelog v5:
- Add platform-specific reg names, but mark them as deprecated.Changelog v6:
- Move the common reg-names definitions to the RP/EP schemas. Thus drop the 'definitions' property. (@Rob)
- Drop the 'deprecated' keywords from the vendor-specific names. (@Rob)
Quoted 6 lines
--- .../bindings/pci/snps,dw-pcie-common.yaml | 22 +++++ .../bindings/pci/snps,dw-pcie-ep.yaml | 82 +++++++++++++++++-- .../devicetree/bindings/pci/snps,dw-pcie.yaml | 78 ++++++++++++++++-- 3 files changed, 169 insertions(+), 13 deletions(-)
PATCH v6 11/20 dt-bindings: PCI: dwc: Add clocks/resets common properties
In reply to Serge SeminDW PCIe RP/EP reference manuals explicit define all the clocks and reset requirements in [1] and [2]. Seeing the DW PCIe vendor-specific DT-bindings have already started assigning random names to the same set of the clocks and resets lines, let's define a generic names sets and add them to the DW PCIe common DT-schema.
Note since there are DW PCI-based vendor-specific DT-bindings with the custom names assigned to the same clocks and resets resources we have no much choice but to add them to the generic DT-schemas in order to have the schemas being applicable for such devices. These names are marked as vendor-specific and should be avoided being used in new bindings in favor of the generic names.
[1] Synopsys DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port, Version 5.40a, March 2019, p.55 - 78.
[2] Synopsys DesignWare Cores PCI Express Controller Databook - DWC PCIe Endpoint, Version 5.40a, March 2019, p.58 - 81.
---
Changelog v3:
- This is a new patch unpinned from the next one:
https://lore.kernel.org/linux-pci/[email protected]/
by the Rob' request. (@Rob)
- Drop synonymous from the names list since the device schemas create their own enumerations anyway.
Changelog v5:
- Add platform-specific clock/reset names, but mark them as deprecated.
Changelog v6:
- Move the common *-names definitions to the RP/EP schemas. Thus drop the 'definitions' property. (@Rob)
- Drop the 'deprecated' keywords from the vendor-specific names. (@Rob)
--- .../bindings/pci/snps,dw-pcie-common.yaml | 120 ++++++++++++++++++ .../bindings/pci/snps,dw-pcie-ep.yaml | 6 + .../devicetree/bindings/pci/snps,dw-pcie.yaml | 2 - 3 files changed, 126 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml +120 -0
@@ -58,6 +58,126 @@ properties: minItems: 1 maxItems: 26 + clocks: + description: + DWC PCIe reference manual explicitly defines a set of the clocks required + to get the controller working correctly. In general all of them can + be divided into two groups':' application and core clocks. Note the + platforms may have some of the clock sources unspecified in case if the + corresponding domains are fed up from a common clock source. + minItems: 1 + maxItems: 7 + + clock-names: + minItems: 1 + maxItems: 7 + items: + oneOf: + - description: + Data Bus Interface (DBI) clock. Clock signal for the AXI-bus + interface of the Configuration-Dependent Module, which is + basically the set of the controller CSRs. + const: dbi + - description: + Application AXI-bus Master interface clock. Basically this is + a clock for the controller DMA interface (PCI-to-CPU). + const: mstr + - description: + Application AXI-bus Slave interface clock. This is a clock for + the CPU-to-PCI memory IO interface. + const: slv + - description: + Controller Core-PCS PIPE interface clock. It's normally + supplied by an external PCS-PHY. + const: pipe + - description: + Controller Primary clock. It's assumed that all controller input + signals (except resets) are synchronous to this clock. + const: core + - description: + Auxiliary clock for the controller PMC domain. The controller + partitioning implies having some parts to operate with this + clock in some power management states. + const: aux + - description: + Generic reference clock. In case if there are several + interfaces fed up with a common clock source it's advisable to + define it with this name (for instance pipe, core and aux can + be connected to a single source of the periodic signal). + const: ref + - description: + Clock for the PHY registers interface. Originally this is + a PHY-viewport-based interface, but some platform may have + specifically designed one. + const: phy_reg + - description: + Vendor-specific clock names. Consider using the generic names + above for new bindings. + oneOf: + - description: See native 'dbi' clock for details + enum: [ pcie, pcie_apb_sys, aclk_dbi ] + - description: See native 'mstr/slv' clock for details + enum: [ pcie_bus, pcie_inbound_axi, pcie_aclk, aclk_mst, aclk_slv ] + - description: See native 'pipe' clock for details + enum: [ pcie_phy, pcie_phy_ref, link ] + - description: See native 'aux' clock for details + enum: [ pcie_aux ] + - description: See native 'ref' clock for details. + enum: [ gio ] + - description: See nativs 'phy_reg' clock for details + enum: [ pcie_apb_phy, pclk ] + + resets: + description: + DWC PCIe reference manual explicitly defines a set of the reset + signals required to be de-asserted to properly activate the controller + sub-parts. All of these signals can be divided into two sub-groups':' + application and core resets with respect to the main sub-domains they + are supposed to reset. Note the platforms may have some of these signals + unspecified in case if they are automatically handled or aggregated into + a comprehensive control module. + minItems: 1 + maxItems: 10 + + reset-names: + minItems: 1 + maxItems: 10 + items: + oneOf: + - description: Data Bus Interface (DBI) domain reset + const: dbi + - description: AXI-bus Master interface reset + const: mstr + - description: AXI-bus Slave interface reset + const: slv + - description: Application-dependent interface reset + const: app + - description: Controller Non-sticky CSR flags reset + const: non-sticky + - description: Controller sticky CSR flags reset + const: sticky + - description: PIPE-interface (Core-PCS) logic reset + const: pipe + - description: + Controller primary reset (resets everything except PMC module) + const: core + - description: PCS/PHY block reset + const: phy + - description: PMC hot reset signal + const: hot + - description: Cold reset signal + const: pwr + - description: + Vendor-specific reset names. Consider using the generic names + above for new bindings. + oneOf: + - description: See native 'app' reset for details + enum: [ apps, gio, apb ] + - description: See native 'phy' reset for details + enum: [ pciephy, link ] + - description: See native 'pwr' reset for details + enum: [ turnoff ] + phys: description: There can be up to the number of possible lanes PHYs specified placed in
Documentation/devicetree/bindings/pci/snps,dw-pcie-ep.yaml +6 -0
@@ -180,6 +180,12 @@ examples: interrupts = <23>, <24>; interrupt-names = "dma0", "dma1"; + clocks = <&sys_clk 12>, <&sys_clk 24>; + clock-names = "dbi", "ref"; + + resets = <&sys_rst 12>, <&sys_rst 24>; + reset-names = "dbi", "phy"; + phys = <&pcie_phy0>, <&pcie_phy1>, <&pcie_phy2>, <&pcie_phy3>; phy-names = "pcie0", "pcie1", "pcie2", "pcie3";
Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +0 -2
@@ -195,8 +195,6 @@ properties: - contains: const: msi - clocks: true - additionalProperties: true required:
Signature · 1 line
2.38.0
Re: [PATCH v6 11/20] dt-bindings: PCI: dwc: Add clocks/resets common properties
Quoted 36 lines · Serge Semin
DW PCIe RP/EP reference manuals explicit define all the clocks and reset requirements in [1] and [2]. Seeing the DW PCIe vendor-specific DT-bindings have already started assigning random names to the same set of the clocks and resets lines, let's define a generic names sets and add them to the DW PCIe common DT-schema.
Note since there are DW PCI-based vendor-specific DT-bindings with the custom names assigned to the same clocks and resets resources we have no much choice but to add them to the generic DT-schemas in order to have the schemas being applicable for such devices. These names are marked as vendor-specific and should be avoided being used in new bindings in favor of the generic names.
[1] Synopsys DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port, Version 5.40a, March 2019, p.55 - 78.
[2] Synopsys DesignWare Cores PCI Express Controller Databook - DWC PCIe Endpoint, Version 5.40a, March 2019, p.58 - 81.Signed-off-by Serge Semin <[email protected]>---
Changelog v3:
- This is a new patch unpinned from the next one:
https://lore.kernel.org/linux-pci/[email protected]/
by the Rob' request. (@Rob)
- Drop synonymous from the names list since the device schemas create their own enumerations anyway.Changelog v5:
- Add platform-specific clock/reset names, but mark them as deprecated.Changelog v6:
- Move the common *-names definitions to the RP/EP schemas. Thus drop the 'definitions' property. (@Rob)
- Drop the 'deprecated' keywords from the vendor-specific names. (@Rob)
Quoted 6 lines
--- .../bindings/pci/snps,dw-pcie-common.yaml | 120 ++++++++++++++++++ .../bindings/pci/snps,dw-pcie-ep.yaml | 6 + .../devicetree/bindings/pci/snps,dw-pcie.yaml | 2 - 3 files changed, 126 insertions(+), 2 deletions(-)
Re: [PATCH v6 11/20] dt-bindings: PCI: dwc: Add clocks/resets common properties
Quoted 45 lines · Rob Herring
Quoted 36 lines · Serge Semin
DW PCIe RP/EP reference manuals explicit define all the clocks and reset requirements in [1] and [2]. Seeing the DW PCIe vendor-specific DT-bindings have already started assigning random names to the same set of the clocks and resets lines, let's define a generic names sets and add them to the DW PCIe common DT-schema.
Note since there are DW PCI-based vendor-specific DT-bindings with the custom names assigned to the same clocks and resets resources we have no much choice but to add them to the generic DT-schemas in order to have the schemas being applicable for such devices. These names are marked as vendor-specific and should be avoided being used in new bindings in favor of the generic names.
[1] Synopsys DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port, Version 5.40a, March 2019, p.55 - 78.
[2] Synopsys DesignWare Cores PCI Express Controller Databook - DWC PCIe Endpoint, Version 5.40a, March 2019, p.58 - 81.Signed-off-by Serge Semin <[email protected]>---
Changelog v3:
- This is a new patch unpinned from the next one:
https://lore.kernel.org/linux-pci/[email protected]/
by the Rob' request. (@Rob)
- Drop synonymous from the names list since the device schemas create their own enumerations anyway.Changelog v5:
- Add platform-specific clock/reset names, but mark them as deprecated.Changelog v6:
- Move the common *-names definitions to the RP/EP schemas. Thus drop the 'definitions' property. (@Rob)
- Drop the 'deprecated' keywords from the vendor-specific names. (@Rob)Quoted 6 lines
--- .../bindings/pci/snps,dw-pcie-common.yaml | 120 ++++++++++++++++++ .../bindings/pci/snps,dw-pcie-ep.yaml | 6 + .../devicetree/bindings/pci/snps,dw-pcie.yaml | 2 - 3 files changed, 126 insertions(+), 2 deletions(-)
Quoted 1 line
Reviewed-by Rob Herring <[email protected]>
Yahoo! We've finally done this) Thanks.
-Sergey
PATCH v6 12/20 dt-bindings: PCI: dwc: Add dma-coherent property
In reply to Serge SeminDW PCIe EP/RP AXI- and TRGT1-master interfaces are responsible for the application memory access. They are used by the RP/EP PCIe buses (MWr/MWr TLPs emitted by the peripheral PCIe devices) and the eDMA block. Since all of them mainly involve the system memory and basically mean DMA we can expect the corresponding platforms can be designed in a way to make sure the transactions are cache-coherent. As such the DW PCIe DT-nodes can have the 'dma-coherent' property specified. Let's permit it in the DT-bindings then.
---
Changelog v3:
- This is a new patch created on v3 lap of the series.
--- Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/pci/snps,dw-pcie-common.yaml +2 -0
@@ -259,6 +259,8 @@ properties: configuration space registers, Port Logic registers, DMA and iATU registers. This feature has been available since DWC PCIe v4.80a. + dma-coherent: true + additionalProperties: true ...
Signature · 1 line
2.38.0
PATCH v6 13/20 dt-bindings: PCI: dwc: Apply common schema to Rockchip DW PCIe nodes
In reply to Serge SeminAs the DT-bindings description states the Rockchip PCIe controller is based on the DW PCIe RP IP-core thus its DT-nodes are supposed to be compatible with the common DW PCIe controller schema. Let's make sure they are evaluated against it by referring to the snps,dw-pcie.yaml schema in the allOf sub-schemas composition.
---
Changelog v3:
- This is a new patch created on v3 lap of the series.
Changelog v5:
- Apply snps,dw-pcie.yaml instead of the snps,dw-pcie-common.yaml schema.
--- Documentation/devicetree/bindings/pci/rockchip-dw-pcie.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/pci/rockchip-dw-pcie.yaml +2 -2
@@ -14,10 +14,10 @@ maintainers: description: |+ RK3568 SoC PCIe host controller is based on the Synopsys DesignWare PCIe IP and thus inherits all the common properties defined in - designware-pcie.txt. + snps,dw-pcie.yaml. allOf: - - $ref: /schemas/pci/pci-bus.yaml# + - $ref: /schemas/pci/snps,dw-pcie.yaml# properties: compatible:
Signature · 8 lines
2.38.0 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH v6 14/20 dt-bindings: PCI: dwc: Add Baikal-T1 PCIe Root Port bindings
In reply to Serge SeminBaikal-T1 SoC is equipped with DWC PCIe v4.60a Root Port controller, which link can be trained to work on up to Gen.3 speed over up to x4 lanes. The controller is supposed to be fed up with four clock sources: DBI peripheral clock, AXI application Tx/Rx clocks and external PHY/core reference clock generating the 100MHz signal. In addition to that the platform provide a way to reset each part of the controller:
sticky/non-sticky bits, host controller core, PIPE interface, PCS/PHY and Hot/Power reset signal. The Root Port controller is equipped with multiple IRQ lines like MSI, system AER, PME, HP, Bandwidth change, Link equalization request and eDMA ones. The registers space is accessed over the DBI interface. There can be no more than four inbound or outbound iATU windows configured.
---
Changelog v2:
- Rename 'syscon' property to 'baikal,bt1-syscon'.
- Fix the 'compatible' property definition to being more specific about what strings are supposed to be used. Due to that we had to add the select property to evaluate the schema against the Baikal-T1 PCIe DT nodes only.
Changelog v5:
- Drop generic fallback names from the compatible property constraints. (@Rob)
- Define ordered {reg,interrupt,clock,reset}-names properties. (@Rob)
- Drop minItems from the clocks and reset properties, since it equals to the maxItems for them.
- Drop num-ob-windows and num-ib-windows properties constraint. (@Rob)
--- .../bindings/pci/baikal,bt1-pcie.yaml | 168 ++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/baikal,bt1-pcie.yaml
Documentation/devicetree/bindings/pci/baikal,bt1-pcie.yaml new file +168 -0
@@ -0,0 +1,168 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/baikal,bt1-pcie.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Baikal-T1 PCIe Root Port Controller + +maintainers: + - Serge Semin <[email protected]> + +description: + Embedded into Baikal-T1 SoC Root Complex controller with a single port + activated. It's based on the DWC RC PCIe v4.60a IP-core, which is configured + to have just a single Root Port function and is capable of establishing the + link up to Gen.3 speed on x4 lanes. It doesn't have embedded clock and reset + control module, so the proper interface initialization is supposed to be + performed by software. There four in- and four outbound iATU regions + which can be used to emit all required TLP types on the PCIe bus. + +allOf: + - $ref: /schemas/pci/snps,dw-pcie.yaml# + +properties: + compatible: + const: baikal,bt1-pcie + + reg: + description: + DBI, DBI2 and at least 4KB outbound iATU-capable region for the + peripheral devices CFG-space access. + maxItems: 3 + + reg-names: + items: + - const: dbi + - const: dbi2 + - const: config + + interrupts: + description: + MSI, AER, PME, Hot-plug, Link Bandwidth Management, Link Equalization + request and eight Read/Write eDMA IRQ lines are available. + maxItems: 14 + + interrupt-names: + items: + - const: dma0 + - const: dma1 + - const: dma2 + - const: dma3 + - const: dma4 + - const: dma5 + - const: dma6 + - const: dma7 + - const: msi + - const: aer + - const: pme + - const: hp + - const: bw_mg + - const: l_eq + + clocks: + description: + DBI (attached to the APB bus), AXI-bus master and slave interfaces + are fed up by the dedicated application clocks. A common reference + clock signal is supposed to be attached to the corresponding Ref-pad + of the SoC. It will be redistributed amongst the controller core + sub-modules (pipe, core, aux, etc). + maxItems: 4 + + clock-names: + items: + - const: dbi + - const: mstr + - const: slv + - const: ref + + resets: + description: + A comprehensive controller reset logic is supposed to be implemented + by software, so almost all the possible application and core reset + signals are exposed via the system CCU module. + maxItems: 9 + + reset-names: + items: + - const: mstr + - const: slv + - const: pwr + - const: hot + - const: phy + - const: core + - const: pipe + - const: sticky + - const: non-sticky + + baikal,bt1-syscon: + $ref: /schemas/types.yaml#/definitions/phandle + description: + Phandle to the Baikal-T1 System Controller DT node. It's required to + access some additional PM, Reset-related and LTSSM signals. + + num-lanes: + maximum: 4 + + max-link-speed: + maximum: 3 + +required: + - compatible + - reg + - reg-names + - interrupts + - interrupt-names + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/mips-gic.h> + #include <dt-bindings/gpio/gpio.h> + + pcie@1f052000 { + compatible = "baikal,bt1-pcie"; + device_type = "pci"; + reg = <0x1f052000 0x1000>, <0x1f053000 0x1000>, <0x1bdbf000 0x1000>; + reg-names = "dbi", "dbi2", "config"; + #address-cells = <3>; + #size-cells = <2>; + ranges = <0x81000000 0 0x00000000 0x1bdb0000 0 0x00008000>, + <0x82000000 0 0x20000000 0x08000000 0 0x13db0000>; + bus-range = <0x0 0xff>; + + interrupts = <GIC_SHARED 80 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SHARED 81 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SHARED 82 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SHARED 83 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SHARED 84 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SHARED 85 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SHARED 86 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SHARED 87 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SHARED 88 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SHARED 89 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SHARED 90 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SHARED 91 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SHARED 92 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SHARED 93 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "dma0", "dma1", "dma2", "dma3", + "dma4", "dma5", "dma6", "dma7", + "msi", "aer", "pme", "hp", "bw_mg", + "l_eq"; + + clocks = <&ccu_sys 1>, <&ccu_axi 6>, <&ccu_axi 7>, <&clk_pcie>; + clock-names = "dbi", "mstr", "slv", "ref"; + + resets = <&ccu_axi 6>, <&ccu_axi 7>, <&ccu_sys 7>, <&ccu_sys 10>, + <&ccu_sys 4>, <&ccu_sys 6>, <&ccu_sys 5>, <&ccu_sys 8>, + <&ccu_sys 9>; + reset-names = "mstr", "slv", "pwr", "hot", "phy", "core", "pipe", + "sticky", "non-sticky"; + + reset-gpios = <&port0 0 GPIO_ACTIVE_LOW>; + + num-lanes = <4>; + max-link-speed = <3>; + }; +...
Signature · 1 line
2.38.0
PATCH v6 15/20 PCI: dwc: Introduce dma-ranges property support for RC-host
In reply to Serge SeminIn accordance with the generic PCIe Root Port DT-bindings the "dma-ranges" property has the same format as the "ranges" property. The only difference is in their semantics. The "dma-ranges" property describes the PCIe-to-CPU memory mapping in opposite to the CPU-to-PCIe mapping of the "ranges" property. Even though the DW PCIe controllers are normally equipped with the internal Address Translation Unit which inbound and outbound tables can be used to implement both properties semantics, it was surprising for me to discover that the host-related part of the DW PCIe driver currently supports the "ranges" property only while the "dma-ranges" windows are just ignored. Having the "dma-ranges" supported in the driver would be very handy for the platforms, that don't tolerate the 1:1 CPU-PCIe memory mapping and require a customized PCIe memory layout. So let's fix that by introducing the "dma-ranges" property support.
First of all we suggest to rename the dw_pcie_prog_inbound_atu() method to dw_pcie_prog_ep_inbound_atu() and create a new version of the dw_pcie_prog_inbound_atu() function. Thus we'll have two methods for the RC and EP controllers respectively in the same way as it has been developed for the outbound ATU setup methods.
Secondly aside with the memory window index and type the new dw_pcie_prog_inbound_atu() function will accept CPU address, PCIe address and size as its arguments. These parameters define the PCIe and CPU memory ranges which will be used to setup the respective inbound ATU mapping. The passed parameters need to be verified against the ATU ranges constraints in the same way as it is done for the outbound ranges.
Finally the DMA-ranges detected for the PCIe controller need to be converted to the inbound ATU entries during the host controller initialization procedure. It will be done in the framework of the dw_pcie_iatu_setup() method. Note before setting the inbound ranges up we need to disable all the inbound ATU entries in order to prevent unexpected PCIe TLPs translations defined by some third party software like bootloaders.
---
Changelog v3:
- Drop inbound iATU window size alignment constraint. (@Manivannan)
--- .../pci/controller/dwc/pcie-designware-ep.c | 4 +- .../pci/controller/dwc/pcie-designware-host.c | 32 ++++++++++- drivers/pci/controller/dwc/pcie-designware.c | 56 ++++++++++++++++++- drivers/pci/controller/dwc/pcie-designware.h | 6 +- 4 files changed, 89 insertions(+), 9 deletions(-)
drivers/pci/controller/dwc/pcie-designware-ep.c +2 -2
@@ -171,8 +171,8 @@ static int dw_pcie_ep_inbound_atu(struct dw_pcie_ep *ep, u8 func_no, int type,return -EINVAL ; } - ret =dw_pcie_prog_inbound_atu (pci, func_no, free_win, type, - cpu_addr, bar); + ret =dw_pcie_prog_ep_inbound_atu (pci, func_no, free_win, type, + cpu_addr, bar);if (ret <0 ) {dev_err (pci->dev,"Failed to program IB window\n" );return ret;
drivers/pci/controller/dwc/pcie-designware-host.c +29 -3
@@ -643,12 +643,15 @@ static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp) }/* -* Ensure all outbound windows are disabled before proceeding with -* the MEM/IO ranges setups. +* Ensure all out/inbound windows are disabled before proceeding with +* the MEM/IO (dma-)ranges setups. */ for (i =0 ; i < pci->num_ob_windows; i++)dw_pcie_disable_atu (pci,PCIE_ATU_REGION_DIR_OB , i); +for (i =0 ; i < pci->num_ib_windows; i++) +dw_pcie_disable_atu (pci,PCIE_ATU_REGION_DIR_IB , i); + i =0 ;resource_list_for_each_entry (entry, &pp->bridge->windows) {if (resource_type (entry->res) !=IORESOURCE_MEM )
@@ -685,9 +688,32 @@ static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp) }if (pci->num_ob_windows <= i) -dev_warn (pci->dev,"Resources exceed number of ATU entries (%d)\n" , +dev_warn (pci->dev,"Ranges exceed outbound iATU size (%d)\n" , pci->num_ob_windows); + i =0 ; +resource_list_for_each_entry (entry, &pp->bridge->dma_ranges) { +if (resource_type (entry->res) !=IORESOURCE_MEM ) +continue ; + +if (pci->num_ib_windows <= i) +break ; + + ret =dw_pcie_prog_inbound_atu (pci, i++,PCIE_ATU_TYPE_MEM , + entry->res->start, + entry->res->start - entry->offset, +resource_size (entry->res)); +if (ret) { +dev_err (pci->dev,"Failed to set DMA range %pr\n" , + entry->res); +return ret; + } + } + +if (pci->num_ib_windows <= i) +dev_warn (pci->dev,"Dma-ranges exceed inbound iATU size (%u)\n" , + pci->num_ib_windows); +return 0 ; }
drivers/pci/controller/dwc/pcie-designware.c +54 -2
62 lines not on this page · raw message
drivers/pci/controller/dwc/pcie-designware.h +4 -2
@@ -346,8 +346,10 @@ int dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type, u64 cpu_addr, u64 pci_addr, u64 size);int dw_pcie_prog_ep_outbound_atu (struct dw_pcie *pci,u8 func_no,int index,int type,u64 cpu_addr,u64 pci_addr,u64 size); -int dw_pcie_prog_inbound_atu (struct dw_pcie *pci,u8 func_no,int index, -int type,u64 cpu_addr,u8 bar); +int dw_pcie_prog_inbound_atu (struct dw_pcie *pci,int index,int type, +u64 cpu_addr,u64 pci_addr,u64 size); +int dw_pcie_prog_ep_inbound_atu (struct dw_pcie *pci,u8 func_no,int index, +int type,u64 cpu_addr,u8 bar);void dw_pcie_disable_atu (struct dw_pcie *pci,u32 dir,int index);void dw_pcie_setup (struct dw_pcie *pci);void dw_pcie_iatu_detect (struct dw_pcie *pci);
Signature · 1 line
2.38.0
PATCH v6 16/20 PCI: dwc: Introduce generic controller capabilities interface
In reply to Serge SeminSince in addition to the already available iATU unrolled mapping we are about to add a few more DW PCIe platform-specific capabilities (CDM-check and generic clocks/resets resources) let's add a generic interface to set and get the flags indicating their availability. The new interface shall improve maintainability of the platform-specific code.
---
Note the DW_PCIE_CAP_IATU_UNROLL macro is intentionally set to 1 since being added afterwards capability will be more suitable to be identified with position 0.
Changelog v3:
- This is a new patch created on v3 lap of the series.
--- drivers/pci/controller/dwc/pcie-designware.c | 11 ++++++----- drivers/pci/controller/dwc/pcie-designware.h | 12 +++++++++++- 2 files changed, 17 insertions(+), 6 deletions(-)
drivers/pci/controller/dwc/pcie-designware.c +6 -5
@@ -211,7 +211,7 @@ void dw_pcie_write_dbi2(struct dw_pcie *pci, u32 reg, size_t size, u32 val)static inline void __iomem *dw_pcie_select_atu (struct dw_pcie *pci,u32 dir,u32 index) { -if (pci->iatu_unroll_enabled) +if (dw_pcie_cap_is (pci,IATU_UNROLL ))return pci->atu_base +PCIE_ATU_UNROLL_BASE (dir, index);dw_pcie_writel_dbi (pci,PCIE_ATU_VIEWPORT , dir | index);
@@ -591,7 +591,7 @@ static void dw_pcie_iatu_detect_regions(struct dw_pcie *pci)u32 val, min, dir;u64 max; -if (pci->iatu_unroll_enabled) { +if (dw_pcie_cap_is (pci,IATU_UNROLL )) { max_region =min ((int )pci->atu_size /512 ,256 ); }else {dw_pcie_writel_dbi (pci,PCIE_ATU_VIEWPORT ,0xFF );
@@ -641,8 +641,9 @@ void dw_pcie_iatu_detect(struct dw_pcie *pci) {struct platform_device *pdev =to_platform_device (pci->dev); - pci->iatu_unroll_enabled =dw_pcie_iatu_unroll_enabled (pci); -if (pci->iatu_unroll_enabled) { +if (dw_pcie_iatu_unroll_enabled (pci)) { +dw_pcie_cap_set (pci,IATU_UNROLL ); +if (!pci->atu_base) {struct resource *res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"atu" );
@@ -664,7 +665,7 @@ void dw_pcie_iatu_detect(struct dw_pcie *pci)dw_pcie_iatu_detect_regions (pci); -dev_info (pci->dev,"iATU unroll: %s\n" , pci->iatu_unroll_enabled ? +dev_info (pci->dev,"iATU unroll: %s\n" ,dw_pcie_cap_is (pci,IATU_UNROLL ) ?"enabled" :"disabled" ); dev_info(pci->dev, "iATU regions: %u ob, %u ib, align %uK, limit %lluG\n",
drivers/pci/controller/dwc/pcie-designware.h +11 -1
@@ -12,6 +12,7 @@#define _PCIE_DESIGNWARE_H#include <linux/bitfield.h> +#include <linux/bitops.h> #include <linux/dma-mapping.h> #include <linux/irq.h> #include <linux/msi.h>
@@ -43,6 +44,15 @@ (__dw_pcie_ver_cmp(_pci, _ver, ==) && \ __dw_pcie_ver_cmp(_pci, TYPE_ ## _type, >=)) +/* DWC PCIe controller capabilities */ +#define DW_PCIE_CAP_IATU_UNROLL 1 + +#define dw_pcie_cap_is (_pci, _cap) \ + test_bit(DW_PCIE_CAP_ ## _cap, &(_pci)->caps) + +#define dw_pcie_cap_set (_pci, _cap) \ + set_bit(DW_PCIE_CAP_ ## _cap, &(_pci)->caps) +/* Parameters for the waiting for link up routine */ #define LINK_WAIT_MAX_RETRIES 10#define LINK_WAIT_USLEEP_MIN 90000
@@ -317,10 +327,10 @@ struct dw_pcie {const struct dw_pcie_ops *ops;u32 version;u32 type; +unsigned long caps;int num_lanes;int link_gen;u8 n_fts[2 ]; - bool iatu_unroll_enabled: 1; };#define to_dw_pcie_from_pp (port) container_of((port), struct dw_pcie, pp)
Signature · 1 line
2.38.0
PATCH v6 17/20 PCI: dwc: Introduce generic resources getter
In reply to Serge SeminCurrently the DW PCIe Root Port and Endpoint CSR spaces are retrieved in the separate parts of the DW PCIe core driver. It doesn't really make sense since the both controller types have identical set of the core CSR
regions: DBI, DBI CS2 and iATU/eDMA. Thus we can simplify the DW PCIe Host and EP initialization methods by moving the platform-specific registers space getting and mapping into a common method. It gets to be even more justified seeing the CSRs base address pointers are preserved in the common DW PCIe descriptor. Note all the OF-based common DW PCIe settings initialization will be moved to the new method too in order to have a single function for all the generic platform properties handling in single place.
A nice side-effect of this change is that the pcie-designware-host.c and pcie-designware-ep.c drivers are cleaned up from all the direct dw_pcie storage modification, which makes the DW PCIe core, Root Port and Endpoint modules more coherent.
---
Changelog v3:
- This is a new patch created on v3 lap of the series.
Changelog v4:
- Convert the method name from dw_pcie_get_res() to dw_pcie_get_resources(). (@Bjorn)
--- .../pci/controller/dwc/pcie-designware-ep.c | 26 +------ .../pci/controller/dwc/pcie-designware-host.c | 15 +--- drivers/pci/controller/dwc/pcie-designware.c | 75 ++++++++++++++----- drivers/pci/controller/dwc/pcie-designware.h | 3 + 4 files changed, 65 insertions(+), 54 deletions(-)
drivers/pci/controller/dwc/pcie-designware-ep.c +3 -23
@@ -13,8 +13,6 @@#include <linux/pci-epc.h> #include <linux/pci-epf.h> -#include "../../pci.h" -void dw_pcie_ep_linkup (struct dw_pcie_ep *ep) {struct pci_epc *epc = ep->epc;
@@ -688,29 +686,14 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep)struct dw_pcie *pci =to_dw_pcie_from_ep (ep);struct device *dev = pci->dev;struct platform_device *pdev =to_platform_device (dev); -struct device_node *np = dev->of_node;const struct pci_epc_features *epc_features;struct dw_pcie_ep_func *ep_func;INIT_LIST_HEAD (&ep->func_list); -if (!pci->dbi_base) { - res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"dbi" ); - pci->dbi_base =devm_pci_remap_cfg_resource (dev, res); -if (IS_ERR (pci->dbi_base)) -return PTR_ERR (pci->dbi_base); - } - -if (!pci->dbi_base2) { - res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"dbi2" ); -if (!res) { - pci->dbi_base2 = pci->dbi_base +SZ_4K ; - }else { - pci->dbi_base2 =devm_pci_remap_cfg_resource (dev, res); -if (IS_ERR (pci->dbi_base2)) -return PTR_ERR (pci->dbi_base2); - } - } + ret =dw_pcie_get_resources (pci); +if (ret) +return ret; res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"addr_space" );if (!res)
@@ -739,9 +722,6 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep)return -ENOMEM ; ep->outbound_addr = addr; -if (pci->link_gen <1 ) - pci->link_gen =of_pci_get_max_link_speed (np); - epc =devm_pci_epc_create (dev, &epc_ops);if (IS_ERR (epc)) {dev_err (dev,"Failed to create epc device\n" );
drivers/pci/controller/dwc/pcie-designware-host.c +4 -11
@@ -16,7 +16,6 @@#include <linux/pci_regs.h> #include <linux/platform_device.h> -#include "../../pci.h" #include "pcie-designware.h" static struct pci_ops dw_pcie_ops;
@@ -395,6 +394,10 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)raw_spin_lock_init (&pp->lock); + ret =dw_pcie_get_resources (pci); +if (ret) +return ret; + res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"config" );if (res) { pp->cfg0_size =resource_size (res);
@@ -408,13 +411,6 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)return -ENODEV ; } -if (!pci->dbi_base) { - res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"dbi" ); - pci->dbi_base =devm_pci_remap_cfg_resource (dev, res); -if (IS_ERR (pci->dbi_base)) -return PTR_ERR (pci->dbi_base); - } - bridge =devm_pci_alloc_host_bridge (dev,0 );if (!bridge)return -ENOMEM ;
@@ -429,9 +425,6 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) pp->io_base =pci_pio_to_address (win->res->start); } -if (pci->link_gen <1 ) - pci->link_gen =of_pci_get_max_link_speed (np); -/* Set default bus ops */ bridge->ops = &dw_pcie_ops; bridge->child_ops = &dw_child_pcie_ops;
drivers/pci/controller/dwc/pcie-designware.c +55 -20
113 lines not on this page · raw message
drivers/pci/controller/dwc/pcie-designware.h +3 -0
@@ -46,6 +46,7 @@/* DWC PCIe controller capabilities */ #define DW_PCIE_CAP_IATU_UNROLL 1 +#define DW_PCIE_CAP_CDM_CHECK 2#define dw_pcie_cap_is (_pci, _cap) \ test_bit(DW_PCIE_CAP_ ## _cap, &(_pci)->caps)
@@ -338,6 +339,8 @@ struct dw_pcie {#define to_dw_pcie_from_ep (endpoint) \ container_of((endpoint), struct dw_pcie, ep) +int dw_pcie_get_resources (struct dw_pcie *pci); +void dw_pcie_version_detect (struct dw_pcie *pci);u8 dw_pcie_find_capability (struct dw_pcie *pci,u8 cap);
Signature · 1 line
2.38.0
RE: [PATCH v6 17/20] PCI: dwc: Introduce generic resources getter
Hi Serge,
Quoted 51 lines
From: Serge Semin, Sent: Tuesday, November 8, 2022 5:50 AM
Currently the DW PCIe Root Port and Endpoint CSR spaces are retrieved in the separate parts of the DW PCIe core driver. It doesn't really make sense since the both controller types have identical set of the core CSR
regions: DBI, DBI CS2 and iATU/eDMA. Thus we can simplify the DW PCIe Host and EP initialization methods by moving the platform-specific registers space getting and mapping into a common method. It gets to be even more justified seeing the CSRs base address pointers are preserved in the common DW PCIe descriptor. Note all the OF-based common DW PCIe settings initialization will be moved to the new method too in order to have a single function for all the generic platform properties handling in single place.A nice side-effect of this change is that the
pcie-designware-host.candpcie-designware-ep.cdrivers are cleaned up from all the directdw_pciestorage modification, which makes the DW PCIe core, Root Port and Endpoint modules more coherent.Signed-off-by Serge Semin <[email protected]>Reviewed-by Rob Herring <[email protected]>---
Changelog v3:
- This is a new patch created on v3 lap of the series.Changelog v4:
- Convert the method name fromdw_pcie_get_res()todw_pcie_get_resources(). (@Bjorn)--- .../pci/controller/dwc/pcie-designware-ep.c | 26 +------ .../pci/controller/dwc/pcie-designware-host.c | 15 +--- drivers/pci/controller/dwc/pcie-designware.c | 75 ++++++++++++++----- drivers/pci/controller/dwc/pcie-designware.h | 3 + 4 files changed, 65 insertions(+), 54 deletions(-)drivers/pci/controller/dwc/pcie-designware-ep.c +0
-2@@ -13,8 +13,6 @@#include <linux/pci-epc.h> #include <linux/pci-epf.h> -#include "../../pci.h" -void dw_pcie_ep_linkup (struct dw_pcie_ep *ep) {struct pci_epc *epc = ep->epc;
drivers/pci/controller/dwc/pcie-designware-ep.c int dw_pcie_ep_init(struct dw_pcie_ep *ep) · line 691
Quoted 4 lines
drivers/pci/controller/dwc/pcie-designware-ep.c +0
-1@@ -688,29 +686,14 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep)struct dw_pcie *pci =to_dw_pcie_from_ep (ep);struct device *dev = pci->dev;struct platform_device *pdev =to_platform_device (dev); -struct device_node *np = dev->of_node;
Removing this np causes the following build error if CONFIG_PCIE_DW_EP is enabled:
---
CC drivers/pci/controller/dwc/pcie-designware-ep.odrivers/pci/controller/dwc/pcie-designware-ep.c: In function 'dw_pcie_ep_init':drivers/pci/controller/dwc/pcie-designware-ep.c:751:35: error: 'np' undeclared (first use in this function); did you mean 'ep'?
751 | ret = of_property_read_u8(np, "max-functions", &epc->max_functions);
| ^~
| epdrivers/pci/controller/dwc/pcie-designware-ep.c:751:35: note: each undeclared identifier is reported only once for each function it appears in
---
So, we should keep the np or use "dev->of_node" to the of_property_read_u8().
Best regards,
Yoshihiro Shimoda
Re: [PATCH v6 17/20] PCI: dwc: Introduce generic resources getter
Hi Yoshihiro
Quoted 63 lines · Yoshihiro Shimoda
Hi Serge,
Quoted 51 lines
From: Serge Semin, Sent: Tuesday, November 8, 2022 5:50 AM
Currently the DW PCIe Root Port and Endpoint CSR spaces are retrieved in the separate parts of the DW PCIe core driver. It doesn't really make sense since the both controller types have identical set of the core CSR
regions: DBI, DBI CS2 and iATU/eDMA. Thus we can simplify the DW PCIe Host and EP initialization methods by moving the platform-specific registers space getting and mapping into a common method. It gets to be even more justified seeing the CSRs base address pointers are preserved in the common DW PCIe descriptor. Note all the OF-based common DW PCIe settings initialization will be moved to the new method too in order to have a single function for all the generic platform properties handling in single place.A nice side-effect of this change is that the
pcie-designware-host.candpcie-designware-ep.cdrivers are cleaned up from all the directdw_pciestorage modification, which makes the DW PCIe core, Root Port and Endpoint modules more coherent.Signed-off-by Serge Semin <[email protected]>Reviewed-by Rob Herring <[email protected]>---
Changelog v3:
- This is a new patch created on v3 lap of the series.Changelog v4:
- Convert the method name fromdw_pcie_get_res()todw_pcie_get_resources(). (@Bjorn)--- .../pci/controller/dwc/pcie-designware-ep.c | 26 +------ .../pci/controller/dwc/pcie-designware-host.c | 15 +--- drivers/pci/controller/dwc/pcie-designware.c | 75 ++++++++++++++----- drivers/pci/controller/dwc/pcie-designware.h | 3 + 4 files changed, 65 insertions(+), 54 deletions(-)drivers/pci/controller/dwc/pcie-designware-ep.c +0
-2@@ -13,8 +13,6 @@#include <linux/pci-epc.h> #include <linux/pci-epf.h> -#include "../../pci.h" -void dw_pcie_ep_linkup (struct dw_pcie_ep *ep) {struct pci_epc *epc = ep->epc;drivers/pci/controller/dwc/pcie-designware-ep.c int dw_pcie_ep_init(struct dw_pcie_ep *ep) · line 691
Quoted 4 lines
drivers/pci/controller/dwc/pcie-designware-ep.c +0
-1@@ -688,29 +686,14 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep)struct dw_pcie *pci =to_dw_pcie_from_ep (ep);struct device *dev = pci->dev;struct platform_device *pdev =to_platform_device (dev); -struct device_node *np = dev->of_node;Removing this np causes the following build error if
CONFIG_PCIE_DW_EPis enabled:
---
CCdrivers/pci/controller/dwc/pcie-designware-ep.odrivers/pci/controller/dwc/pcie-designware-ep.c: In function 'dw_pcie_ep_init':drivers/pci/controller/dwc/pcie-designware-ep.c:751:35: error: 'np' undeclared (first use in this function); did you mean 'ep'?
Quoted 7 lines
751 | ret = of_property_read_u8(np, "max-functions", &epc->max_functions); | ^~ | ep
drivers/pci/controller/dwc/pcie-designware-ep.c:751:35: note: each undeclared identifier is reported only once for each function it appears in
---So, we should keep the np or use "
dev->of_node" to theof_property_read_u8().
Indeed. Thanks for noticing that. I'll fix it in v7.
-Sergey
Quoted 4 lines
Best regards,
Yoshihiro Shimoda
PATCH v6 18/20 PCI: dwc: Combine iATU detection procedures
In reply to Serge SeminSince the iATU CSR region is now retrieved in the DW PCIe resources getter there is no much benefits in the iATU detection procedures splitting up. Therefore let's join the iATU unroll/viewport detection procedure with the rest of the iATU parameters detection code. The resultant method will be as coherent as before, while the redundant functions will be eliminated thus producing more readable code.
---
Changelog v3:
- This is a new patch created on v3 lap of the series.
--- drivers/pci/controller/dwc/pcie-designware.c | 39 +++++--------------- 1 file changed, 10 insertions(+), 29 deletions(-)
drivers/pci/controller/dwc/pcie-designware.c +10 -29
@@ -628,26 +628,21 @@ static void dw_pcie_link_set_max_speed(struct dw_pcie *pci, u32 link_gen) } -static bool dw_pcie_iatu_unroll_enabled (struct dw_pcie *pci) -{ -u32 val; - - val =dw_pcie_readl_dbi (pci,PCIE_ATU_VIEWPORT ); -if (val ==0xffffffff ) -return true; - -return false; -} - -static void dw_pcie_iatu_detect_regions (struct dw_pcie *pci) +void dw_pcie_iatu_detect (struct dw_pcie *pci) {int max_region, ob, ib;u32 val, min, dir;u64 max; -if (dw_pcie_cap_is (pci,IATU_UNROLL )) { + val =dw_pcie_readl_dbi (pci,PCIE_ATU_VIEWPORT ); +if (val ==0xFFFFFFFF ) { +dw_pcie_cap_set (pci,IATU_UNROLL ); + max_region =min ((int )pci->atu_size /512 ,256 ); }else { + pci->atu_base = pci->dbi_base +PCIE_ATU_VIEWPORT_BASE ; + pci->atu_size =PCIE_ATU_VIEWPORT_SIZE ; +dw_pcie_writel_dbi (pci,PCIE_ATU_VIEWPORT ,0xFF ); max_region =dw_pcie_readl_dbi (pci,PCIE_ATU_VIEWPORT ) +1 ; }
@@ -689,23 +684,9 @@ static void dw_pcie_iatu_detect_regions(struct dw_pcie *pci) pci->num_ib_windows = ib; pci->region_align =1 <<fls (min); pci->region_limit = (max <<32 ) | (SZ_4G -1 ); -} - -void dw_pcie_iatu_detect (struct dw_pcie *pci) -{ -if (dw_pcie_iatu_unroll_enabled (pci)) { -dw_pcie_cap_set (pci,IATU_UNROLL ); - }else { - pci->atu_base = pci->dbi_base +PCIE_ATU_VIEWPORT_BASE ; - pci->atu_size =PCIE_ATU_VIEWPORT_SIZE ; - } - -dw_pcie_iatu_detect_regions (pci); - -dev_info (pci->dev,"iATU unroll: %s\n" ,dw_pcie_cap_is (pci,IATU_UNROLL ) ? -"enabled" :"disabled" ); -dev_info (pci->dev,"iATU regions: %u ob, %u ib, align %uK, limit %lluG\n" , +dev_info (pci->dev,"iATU: unroll %s, %u ob, %u ib, align %uK, limit %lluG\n" , +dw_pcie_cap_is (pci,IATU_UNROLL ) ?"T" :"F" , pci->num_ob_windows, pci->num_ib_windows, pci->region_align /SZ_1K , (pci->region_limit +1 ) /SZ_1G ); }
Signature · 1 line
2.38.0
PATCH v6 19/20 PCI: dwc: Introduce generic platform clocks and resets
In reply to Serge SeminCurrently almost each platform driver uses its own resets and clocks naming in order to get the corresponding descriptors. It makes the code harder to maintain and comprehend especially seeing the DWC PCIe core main resets and clocks signals set hasn't changed much for about at least one major IP-core release. So in order to organize things around these signals we suggest to create a generic interface for them in accordance with the naming introduced in the DWC PCIe IP-core reference manual:
Application clocks:
- "dbi" - data bus interface clock (on some DWC PCIe platforms it's
referred as "pclk", "pcie", "sys", "ahb", "cfg", "iface",
"gio", "reg", "pcie_apb_sys");- "mstr" - AXI-bus master interface clock (some DWC PCIe glue drivers refer to this clock as "port", "bus", "pcie_bus", "bus_master/master_bus/axi_m", "pcie_aclk");
- "slv" - AXI-bus slave interface clock (also called as "port", "bus",
"pcie_bus", "bus_slave/slave_bus/axi_s", "pcie_aclk",
"pcie_inbound_axi").Core clocks:
- "pipe" - core-PCS PIPE interface clock coming from external PHY (it's
normally named by the platform drivers as just "pipe");
- "core" - primary clock of the controller (none of the platform drivers declare such a clock but in accordance with the ref. manual the devices may have it separately specified);
- "aux" - auxiliary PMC domain clock (it is named by some platforms as
"pcie_aux" and just "aux");
- "ref" - Generic reference clock (it is a generic clock source, which can be used as a signal source for multiple interfaces, some platforms call it as "ref", "general", "pcie_phy", "pcie_phy_ref").
Application resets:
- "dbi" - Data-bus interface reset (it's CSR interface clock and is normally called as "apb" though technically it's not APB but DWC PCIe-specific interface);
- "mstr" - AXI-bus master reset (some platforms call it as "port", "apps",
"bus", "axi_m");
- "slv" - ABI-bus slave reset (some platforms call it as "port", "apps",
"bus", "axi_s").Core resets:
- "non-sticky" - non-sticky CSR flags reset;
- "sticky" - sticky CSR flags reset;
- "pipe" - PIPE-interface (Core-PCS) logic reset (some platforms
call it just "pipe");
- "core" - controller primary reset (resets everything except PMC
module, some platforms refer to this signal as "soft", "pci");
- "phy" - PCS/PHY block reset (strictly speaking it is normally
connected to the input of an external block, but the reference manual says it must be available for the PMC working correctly, some existing platforms call it "pciephy", "phy", "link");
- "hot" - PMC hot reset signal (also called as "sleep");
- "pwr" - cold reset signal (can be referred as "pwr", "turnoff").
Bus reset:
- "perst" - PCIe standard signal used to reset the PCIe peripheral devices.
As you can see each platform uses it's own naming for basically the same set of the signals. In the framework of this commit we suggest to add a set of the clocks and reset signals resources, corresponding names and identifiers for each denoted entity. At current stage the platforms will be able to use the provided infrastructure to automatically request all these resources and manipulate with them in the Host/EP init callbacks. Alas it isn't that easy to create a common cold/hot reset procedure due to too many platform-specifics in the procedure, like the external flags exposure and the delays requirement.
---
Changelog v3:
- Add a method to at least request the generic clocks and resets. (@Rob)
- Add GPIO-based PERST# signal support.
--- drivers/pci/controller/dwc/pcie-designware.c | 91 ++++++++++++++++++++ drivers/pci/controller/dwc/pcie-designware.h | 42 +++++++++ 2 files changed, 133 insertions(+)
drivers/pci/controller/dwc/pcie-designware.c +91 -0
@@ -10,7 +10,9 @@#include <linux/align.h> #include <linux/bitops.h> +#include <linux/clk.h> #include <linux/delay.h> +#include <linux/gpio/consumer.h> #include <linux/ioport.h> #include <linux/of.h> #include <linux/of_platform.h>
@@ -20,11 +22,89 @@#include "../../pci.h" #include "pcie-designware.h" +static const char *const dw_pcie_app_clks[DW_PCIE_NUM_APP_CLKS ] = { + [DW_PCIE_DBI_CLK ] ="dbi" , + [DW_PCIE_MSTR_CLK ] ="mstr" , + [DW_PCIE_SLV_CLK ] ="slv" , +}; + +static const char *const dw_pcie_core_clks[DW_PCIE_NUM_CORE_CLKS ] = { + [DW_PCIE_PIPE_CLK ] ="pipe" , + [DW_PCIE_CORE_CLK ] ="core" , + [DW_PCIE_AUX_CLK ] ="aux" , + [DW_PCIE_REF_CLK ] ="ref" , +}; + +static const char *const dw_pcie_app_rsts[DW_PCIE_NUM_APP_RSTS ] = { + [DW_PCIE_DBI_RST ] ="dbi" , + [DW_PCIE_MSTR_RST ] ="mstr" , + [DW_PCIE_SLV_RST ] ="slv" , +}; + +static const char *const dw_pcie_core_rsts[DW_PCIE_NUM_CORE_RSTS ] = { + [DW_PCIE_NON_STICKY_RST ] ="non-sticky" , + [DW_PCIE_STICKY_RST ] ="sticky" , + [DW_PCIE_CORE_RST ] ="core" , + [DW_PCIE_PIPE_RST ] ="pipe" , + [DW_PCIE_PHY_RST ] ="phy" , + [DW_PCIE_HOT_RST ] ="hot" , + [DW_PCIE_PWR_RST ] ="pwr" , +}; + +static int dw_pcie_get_clocks (struct dw_pcie *pci) +{ +int i, ret; + +for (i =0 ; i <DW_PCIE_NUM_APP_CLKS ; i++) + pci->app_clks[i].id = dw_pcie_app_clks[i]; + +for (i =0 ; i <DW_PCIE_NUM_CORE_CLKS ; i++) + pci->core_clks[i].id = dw_pcie_core_clks[i]; + + ret =devm_clk_bulk_get_optional (pci->dev,DW_PCIE_NUM_APP_CLKS , + pci->app_clks); +if (ret) +return ret; + +return devm_clk_bulk_get_optional (pci->dev,DW_PCIE_NUM_CORE_CLKS , + pci->core_clks); +} + +static int dw_pcie_get_resets (struct dw_pcie *pci) +{ +int i, ret; + +for (i =0 ; i <DW_PCIE_NUM_APP_RSTS ; i++) + pci->app_rsts[i].id = dw_pcie_app_rsts[i]; + +for (i =0 ; i <DW_PCIE_NUM_CORE_RSTS ; i++) + pci->core_rsts[i].id = dw_pcie_core_rsts[i]; + + ret =devm_reset_control_bulk_get_optional_shared (pci->dev, +DW_PCIE_NUM_APP_RSTS , + pci->app_rsts); +if (ret) +return ret; + + ret =devm_reset_control_bulk_get_optional_exclusive (pci->dev, +DW_PCIE_NUM_CORE_RSTS , + pci->core_rsts); +if (ret) +return ret; + + pci->pe_rst =devm_gpiod_get_optional (pci->dev,"reset" ,GPIOD_OUT_HIGH ); +if (IS_ERR (pci->pe_rst)) +return PTR_ERR (pci->pe_rst); + +return 0 ; +} +int dw_pcie_get_resources (struct dw_pcie *pci) {struct platform_device *pdev =to_platform_device (pci->dev);struct device_node *np =dev_of_node (pci->dev);struct resource *res; +int ret;if (!pci->dbi_base) { res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"dbi" );
@@ -62,6 +142,17 @@ int dw_pcie_get_resources(struct dw_pcie *pci)if (!pci->atu_size) pci->atu_size =SZ_4K ; +/* LLDD is supposed to manually switch the clocks and resets state */ +if (dw_pcie_cap_is (pci,REQ_RES )) { + ret =dw_pcie_get_clocks (pci); +if (ret) +return ret; + + ret =dw_pcie_get_resets (pci); +if (ret) +return ret; + } +if (pci->link_gen <1 ) pci->link_gen =of_pci_get_max_link_speed (np);
drivers/pci/controller/dwc/pcie-designware.h +42 -0
70 lines not on this page · raw message
Signature · 1 line
2.38.0
PATCH v6 20/20 PCI: dwc: Add Baikal-T1 PCIe controller support
In reply to Serge SeminBaikal-T1 SoC is equipped with DWC PCIe v4.60a host controller. It can be trained to work up to Gen.3 speed over up to x4 lanes. The host controller is attached to the DW PCIe 3.0 PCS via the PIPE-4 interface, which in its turn is connected to the DWC 10G PHY. The whole system is supposed to be fed up with four clock sources: DBI peripheral clock, AXI application clocks and external PHY/core reference clock generating the 100MHz signal. In addition to that the platform provide a way to reset each part of the
controller: sticky/non-sticky bits, host controller core, PIPE interface, PCS/PHY and Hot/Power reset signal. The driver also provides a way to handle the GPIO-based PERST# signal.
Note due to the Baikal-T1 MMIO peculiarity we have to implement the DBI interface accessors which make sure the IO operations are dword-aligned.
---
Changelog v2:
- Rename 'syscon' property to 'baikal,bt1-syscon'.
Changelog v3:
- Use the clocks/resets handlers defined in the DW PCIe core descriptor. (@Rob)
- Redefine PCI host bridge config space accessors with the generic pci_generic_config_read32() and pci_generic_config_write32() methods. (@Rob)
Changelog v4:
- Drop PCIBIOS_* macros usage. (@Rob)
- Add "static const" to the dw_pcie_ops and dw_pcie_host_ops structure instances. (@Bjorn)
- Rename bt1_pcie_dw_ops to bt1_pcie_ops. (@Bjorn)
- Rename bt1_pcie_ops to bt1_pci_ops. (@Bjorn)
- Use start_link/stop_link suffixes in the corresponding callbacks. (@Bjorn)
- Change the get_res() method suffix to being get_resources(). (@Bjorn)
- Change *_{add,del}_dw_port() method to *_{add,del}_port(). (@Bjorn)
- Drop dma_coerce_mask_and_coherent() applied to the PCI host bridge kernel device instance. (@Bjorn)
- Add the comment above the dma_set_mask_and_coherent() method usage regarding the controller eDMA feature. (@Bjorn)
- Fix the comment above the core reset controls assertion. (@Bjorn)
- Replace delays and timeout numeric literals with macros. (@Bjorn)
Changelog v6:
- Move the DMA-mask setup to the eDMA driver. (@Robin)
--- drivers/pci/controller/dwc/Kconfig | 9 + drivers/pci/controller/dwc/Makefile | 1 + drivers/pci/controller/dwc/pcie-bt1.c | 645 ++++++++++++++++++++++++++ 3 files changed, 655 insertions(+) create mode 100644 drivers/pci/controller/dwc/pcie-bt1.c
drivers/pci/controller/dwc/Kconfig +9 -0
@@ -222,6 +222,15 @@ config PCIE_ARTPEC6_EP Enables support for the PCIe controller in the ARTPEC-6 SoC to work in endpoint mode. This uses the DesignWare core. +config PCIE_BT1 + tristate "Baikal-T1 PCIe controller" + depends on MIPS_BAIKAL_T1 || COMPILE_TEST + depends on PCI_MSI_IRQ_DOMAIN + select PCIE_DW_HOST + help + Enables support for the PCIe controller in the Baikal-T1 SoC to work + in host mode. It's based on the Synopsys DWC PCIe v4.60a IP-core. + config PCIE_ROCKCHIP_DW_HOST bool "Rockchip DesignWare PCIe controller" select PCIE_DW
drivers/pci/controller/dwc/Makefile +1 -0
@@ -3,6 +3,7 @@ obj-$(CONFIG_PCIE_DW) += pcie-designware.o obj-$(CONFIG_PCIE_DW_HOST) += pcie-designware-host.o obj-$(CONFIG_PCIE_DW_EP) += pcie-designware-ep.o obj-$(CONFIG_PCIE_DW_PLAT) += pcie-designware-plat.o +obj-$(CONFIG_PCIE_BT1) += pcie-bt1.o obj-$(CONFIG_PCI_DRA7XX) += pci-dra7xx.o obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o obj-$(CONFIG_PCIE_FU740) += pcie-fu740.o
drivers/pci/controller/dwc/pcie-bt1.c new file +645 -0
645 lines not on this page · raw message
Signature · 1 line
2.38.0