162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci%YAML 1.2
362306a36Sopenharmony_ci---
462306a36Sopenharmony_ci$id: http://devicetree.org/schemas/pci/snps,dw-pcie-ep.yaml#
562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
662306a36Sopenharmony_ci
762306a36Sopenharmony_cititle: Synopsys DesignWare PCIe endpoint interface
862306a36Sopenharmony_ci
962306a36Sopenharmony_cimaintainers:
1062306a36Sopenharmony_ci  - Jingoo Han <jingoohan1@gmail.com>
1162306a36Sopenharmony_ci  - Gustavo Pimentel <gustavo.pimentel@synopsys.com>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_cidescription: |
1462306a36Sopenharmony_ci  Synopsys DesignWare PCIe host controller endpoint
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci# Please create a separate DT-schema for your DWC PCIe Endpoint controller
1762306a36Sopenharmony_ci# and make sure it's assigned with the vendor-specific compatible string.
1862306a36Sopenharmony_ciselect:
1962306a36Sopenharmony_ci  properties:
2062306a36Sopenharmony_ci    compatible:
2162306a36Sopenharmony_ci      const: snps,dw-pcie-ep
2262306a36Sopenharmony_ci  required:
2362306a36Sopenharmony_ci    - compatible
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ciallOf:
2662306a36Sopenharmony_ci  - $ref: /schemas/pci/pci-ep.yaml#
2762306a36Sopenharmony_ci  - $ref: /schemas/pci/snps,dw-pcie-common.yaml#
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ciproperties:
3062306a36Sopenharmony_ci  reg:
3162306a36Sopenharmony_ci    description:
3262306a36Sopenharmony_ci      DBI, DBI2 reg-spaces and outbound memory window are required for the
3362306a36Sopenharmony_ci      normal controller functioning. iATU memory IO region is also required
3462306a36Sopenharmony_ci      if the space is unrolled (IP-core version >= 4.80a).
3562306a36Sopenharmony_ci    minItems: 2
3662306a36Sopenharmony_ci    maxItems: 5
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci  reg-names:
3962306a36Sopenharmony_ci    minItems: 2
4062306a36Sopenharmony_ci    maxItems: 5
4162306a36Sopenharmony_ci    items:
4262306a36Sopenharmony_ci      oneOf:
4362306a36Sopenharmony_ci        - description:
4462306a36Sopenharmony_ci            Basic DWC PCIe controller configuration-space accessible over
4562306a36Sopenharmony_ci            the DBI interface. This memory space is either activated with
4662306a36Sopenharmony_ci            CDM/ELBI = 0 and CS2 = 0 or is a contiguous memory region
4762306a36Sopenharmony_ci            with all spaces. Note iATU/eDMA CSRs are indirectly accessible
4862306a36Sopenharmony_ci            via the PL viewports on the DWC PCIe controllers older than
4962306a36Sopenharmony_ci            v4.80a.
5062306a36Sopenharmony_ci          const: dbi
5162306a36Sopenharmony_ci        - description:
5262306a36Sopenharmony_ci            Shadow DWC PCIe config-space registers. This space is selected
5362306a36Sopenharmony_ci            by setting CDM/ELBI = 0 and CS2 = 1. This is an intermix of
5462306a36Sopenharmony_ci            the PCI-SIG PCIe CFG-space with the shadow registers for some
5562306a36Sopenharmony_ci            PCI Header space, PCI Standard and Extended Structures. It's
5662306a36Sopenharmony_ci            mainly relevant for the end-point controller configuration,
5762306a36Sopenharmony_ci            but still there are some shadow registers available for the
5862306a36Sopenharmony_ci            Root Port mode too.
5962306a36Sopenharmony_ci          const: dbi2
6062306a36Sopenharmony_ci        - description:
6162306a36Sopenharmony_ci            External Local Bus registers. It's an application-dependent
6262306a36Sopenharmony_ci            registers normally defined by the platform engineers. The space
6362306a36Sopenharmony_ci            can be selected by setting CDM/ELBI = 1 and CS2 = 0 wires or can
6462306a36Sopenharmony_ci            be accessed over some platform-specific means (for instance
6562306a36Sopenharmony_ci            as a part of a system controller).
6662306a36Sopenharmony_ci          enum: [ elbi, app ]
6762306a36Sopenharmony_ci        - description:
6862306a36Sopenharmony_ci            iATU/eDMA registers common for all device functions. It's an
6962306a36Sopenharmony_ci            unrolled memory space with the internal Address Translation
7062306a36Sopenharmony_ci            Unit and Enhanced DMA, which is selected by setting CDM/ELBI = 1
7162306a36Sopenharmony_ci            and CS2 = 1. For IP-core releases prior v4.80a, these registers
7262306a36Sopenharmony_ci            have been programmed via an indirect addressing scheme using a
7362306a36Sopenharmony_ci            set of viewport CSRs mapped into the PL space. Note iATU is
7462306a36Sopenharmony_ci            normally mapped to the 0x0 address of this region, while eDMA
7562306a36Sopenharmony_ci            is available at 0x80000 base address.
7662306a36Sopenharmony_ci          const: atu
7762306a36Sopenharmony_ci        - description:
7862306a36Sopenharmony_ci            Platform-specific eDMA registers. Some platforms may have eDMA
7962306a36Sopenharmony_ci            CSRs mapped in a non-standard base address. The registers offset
8062306a36Sopenharmony_ci            can be changed or the MS/LS-bits of the address can be attached
8162306a36Sopenharmony_ci            in an additional RTL block before the MEM-IO transactions reach
8262306a36Sopenharmony_ci            the DW PCIe slave interface.
8362306a36Sopenharmony_ci          const: dma
8462306a36Sopenharmony_ci        - description:
8562306a36Sopenharmony_ci            PHY/PCS configuration registers. Some platforms can have the
8662306a36Sopenharmony_ci            PCS and PHY CSRs accessible over a dedicated memory mapped
8762306a36Sopenharmony_ci            region, but mainly these registers are indirectly accessible
8862306a36Sopenharmony_ci            either by means of the embedded PHY viewport schema or by some
8962306a36Sopenharmony_ci            platform-specific method.
9062306a36Sopenharmony_ci          const: phy
9162306a36Sopenharmony_ci        - description:
9262306a36Sopenharmony_ci            Outbound iATU-capable memory-region which will be used to
9362306a36Sopenharmony_ci            generate various application-specific traffic on the PCIe bus
9462306a36Sopenharmony_ci            hierarchy. It's usage scenario depends on the endpoint
9562306a36Sopenharmony_ci            functionality, for instance it can be used to create MSI(X)
9662306a36Sopenharmony_ci            messages.
9762306a36Sopenharmony_ci          const: addr_space
9862306a36Sopenharmony_ci        - description:
9962306a36Sopenharmony_ci            Vendor-specific CSR names. Consider using the generic names above
10062306a36Sopenharmony_ci            for new bindings.
10162306a36Sopenharmony_ci          oneOf:
10262306a36Sopenharmony_ci            - description: See native 'elbi/app' CSR region for details.
10362306a36Sopenharmony_ci              enum: [ link, appl ]
10462306a36Sopenharmony_ci            - description: See native 'atu' CSR region for details.
10562306a36Sopenharmony_ci              enum: [ atu_dma ]
10662306a36Sopenharmony_ci    allOf:
10762306a36Sopenharmony_ci      - contains:
10862306a36Sopenharmony_ci          const: dbi
10962306a36Sopenharmony_ci      - contains:
11062306a36Sopenharmony_ci          const: addr_space
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci  interrupts:
11362306a36Sopenharmony_ci    description:
11462306a36Sopenharmony_ci      There is no mandatory IRQ signals for the normal controller functioning,
11562306a36Sopenharmony_ci      but in addition to the native set the platforms may have a link- or
11662306a36Sopenharmony_ci      PM-related IRQs specified.
11762306a36Sopenharmony_ci    minItems: 1
11862306a36Sopenharmony_ci    maxItems: 20
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci  interrupt-names:
12162306a36Sopenharmony_ci    minItems: 1
12262306a36Sopenharmony_ci    maxItems: 20
12362306a36Sopenharmony_ci    items:
12462306a36Sopenharmony_ci      oneOf:
12562306a36Sopenharmony_ci        - description:
12662306a36Sopenharmony_ci            Controller request to read or write virtual product data
12762306a36Sopenharmony_ci            from/to the VPD capability registers.
12862306a36Sopenharmony_ci          const: vpd
12962306a36Sopenharmony_ci        - description:
13062306a36Sopenharmony_ci            Link Equalization Request flag is set in the Link Status 2
13162306a36Sopenharmony_ci            register (applicable if the corresponding IRQ is enabled in
13262306a36Sopenharmony_ci            the Link Control 3 register).
13362306a36Sopenharmony_ci          const: l_eq
13462306a36Sopenharmony_ci        - description:
13562306a36Sopenharmony_ci            Indicates that the eDMA Tx/Rx transfer is complete or that an
13662306a36Sopenharmony_ci            error has occurred on the corresponding channel. eDMA can have
13762306a36Sopenharmony_ci            eight Tx (Write) and Rx (Read) eDMA channels thus supporting up
13862306a36Sopenharmony_ci            to 16 IRQ signals all together. Write eDMA channels shall go
13962306a36Sopenharmony_ci            first in the ordered row as per default edma_int[*] bus setup.
14062306a36Sopenharmony_ci          pattern: '^dma([0-9]|1[0-5])?$'
14162306a36Sopenharmony_ci        - description:
14262306a36Sopenharmony_ci            PCIe protocol correctable error or a Data Path protection
14362306a36Sopenharmony_ci            correctable error is detected by the automotive/safety
14462306a36Sopenharmony_ci            feature.
14562306a36Sopenharmony_ci          const: sft_ce
14662306a36Sopenharmony_ci        - description:
14762306a36Sopenharmony_ci            Indicates that the internal safety mechanism has detected an
14862306a36Sopenharmony_ci            uncorrectable error.
14962306a36Sopenharmony_ci          const: sft_ue
15062306a36Sopenharmony_ci        - description:
15162306a36Sopenharmony_ci            Application-specific IRQ raised depending on the vendor-specific
15262306a36Sopenharmony_ci            events basis.
15362306a36Sopenharmony_ci          const: app
15462306a36Sopenharmony_ci        - description:
15562306a36Sopenharmony_ci            Vendor-specific IRQ names. Consider using the generic names above
15662306a36Sopenharmony_ci            for new bindings.
15762306a36Sopenharmony_ci          oneOf:
15862306a36Sopenharmony_ci            - description: See native "app" IRQ for details
15962306a36Sopenharmony_ci              enum: [ intr ]
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci  max-functions:
16262306a36Sopenharmony_ci    maximum: 32
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_cirequired:
16562306a36Sopenharmony_ci  - compatible
16662306a36Sopenharmony_ci  - reg
16762306a36Sopenharmony_ci  - reg-names
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ciadditionalProperties: true
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ciexamples:
17262306a36Sopenharmony_ci  - |
17362306a36Sopenharmony_ci    pcie-ep@dfd00000 {
17462306a36Sopenharmony_ci      compatible = "snps,dw-pcie-ep";
17562306a36Sopenharmony_ci      reg = <0xdfc00000 0x0001000>, /* IP registers 1 */
17662306a36Sopenharmony_ci            <0xdfc01000 0x0001000>, /* IP registers 2 */
17762306a36Sopenharmony_ci            <0xd0000000 0x2000000>; /* Configuration space */
17862306a36Sopenharmony_ci      reg-names = "dbi", "dbi2", "addr_space";
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci      interrupts = <23>, <24>;
18162306a36Sopenharmony_ci      interrupt-names = "dma0", "dma1";
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ci      clocks = <&sys_clk 12>, <&sys_clk 24>;
18462306a36Sopenharmony_ci      clock-names = "dbi", "ref";
18562306a36Sopenharmony_ci
18662306a36Sopenharmony_ci      resets = <&sys_rst 12>, <&sys_rst 24>;
18762306a36Sopenharmony_ci      reset-names = "dbi", "phy";
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ci      phys = <&pcie_phy0>, <&pcie_phy1>, <&pcie_phy2>, <&pcie_phy3>;
19062306a36Sopenharmony_ci      phy-names = "pcie0", "pcie1", "pcie2", "pcie3";
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ci      max-link-speed = <3>;
19362306a36Sopenharmony_ci      max-functions = /bits/ 8 <4>;
19462306a36Sopenharmony_ci    };
195