162306a36Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
262306a36Sopenharmony_ci%YAML 1.2
362306a36Sopenharmony_ci---
462306a36Sopenharmony_ci$id: http://devicetree.org/schemas/pci/host-generic-pci.yaml#
562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
662306a36Sopenharmony_ci
762306a36Sopenharmony_cititle: Generic PCI host controller
862306a36Sopenharmony_ci
962306a36Sopenharmony_cimaintainers:
1062306a36Sopenharmony_ci  - Will Deacon <will@kernel.org>
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_cidescription: |
1362306a36Sopenharmony_ci  Firmware-initialised PCI host controllers and PCI emulations, such as the
1462306a36Sopenharmony_ci  virtio-pci implementations found in kvmtool and other para-virtualised
1562306a36Sopenharmony_ci  systems, do not require driver support for complexities such as regulator
1662306a36Sopenharmony_ci  and clock management. In fact, the controller may not even require the
1762306a36Sopenharmony_ci  configuration of a control interface by the operating system, instead
1862306a36Sopenharmony_ci  presenting a set of fixed windows describing a subset of IO, Memory and
1962306a36Sopenharmony_ci  Configuration Spaces.
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci  Configuration Space is assumed to be memory-mapped (as opposed to being
2262306a36Sopenharmony_ci  accessed via an ioport) and laid out with a direct correspondence to the
2362306a36Sopenharmony_ci  geography of a PCI bus address by concatenating the various components to
2462306a36Sopenharmony_ci  form an offset.
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci  For CAM, this 24-bit offset is:
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci          cfg_offset(bus, device, function, register) =
2962306a36Sopenharmony_ci                     bus << 16 | device << 11 | function << 8 | register
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci  While ECAM extends this by 4 bits to accommodate 4k of function space:
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci          cfg_offset(bus, device, function, register) =
3462306a36Sopenharmony_ci                     bus << 20 | device << 15 | function << 12 | register
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ciproperties:
3762306a36Sopenharmony_ci  compatible:
3862306a36Sopenharmony_ci    description: Depends on the layout of configuration space (CAM vs ECAM
3962306a36Sopenharmony_ci      respectively). May also have more specific compatibles.
4062306a36Sopenharmony_ci    oneOf:
4162306a36Sopenharmony_ci      - description:
4262306a36Sopenharmony_ci          PCIe host controller in Arm Juno based on PLDA XpressRICH3-AXI IP
4362306a36Sopenharmony_ci        items:
4462306a36Sopenharmony_ci          - const: arm,juno-r1-pcie
4562306a36Sopenharmony_ci          - const: plda,xpressrich3-axi
4662306a36Sopenharmony_ci          - const: pci-host-ecam-generic
4762306a36Sopenharmony_ci      - description: |
4862306a36Sopenharmony_ci          ThunderX PCI host controller for pass-1.x silicon
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci          Firmware-initialized PCI host controller to on-chip devices found on
5162306a36Sopenharmony_ci          some Cavium ThunderX processors.  These devices have ECAM-based config
5262306a36Sopenharmony_ci          access, but the BARs are all at fixed addresses.  We handle the fixed
5362306a36Sopenharmony_ci          addresses by synthesizing Enhanced Allocation (EA) capabilities for
5462306a36Sopenharmony_ci          these devices.
5562306a36Sopenharmony_ci        const: cavium,pci-host-thunder-ecam
5662306a36Sopenharmony_ci      - description:
5762306a36Sopenharmony_ci          Cavium ThunderX PEM firmware-initialized PCIe host controller
5862306a36Sopenharmony_ci        const: cavium,pci-host-thunder-pem
5962306a36Sopenharmony_ci      - description:
6062306a36Sopenharmony_ci          HiSilicon Hip06/Hip07 PCIe host bridge in almost-ECAM mode. Some
6162306a36Sopenharmony_ci          firmware places the host controller in a mode where it is ECAM
6262306a36Sopenharmony_ci          compliant for all devices other than the root complex.
6362306a36Sopenharmony_ci        enum:
6462306a36Sopenharmony_ci          - hisilicon,hip06-pcie-ecam
6562306a36Sopenharmony_ci          - hisilicon,hip07-pcie-ecam
6662306a36Sopenharmony_ci      - description: |
6762306a36Sopenharmony_ci          In some cases, firmware may already have configured the Synopsys
6862306a36Sopenharmony_ci          DesignWare PCIe controller in RC mode with static ATU window mappings
6962306a36Sopenharmony_ci          that cover all config, MMIO and I/O spaces in a [mostly] ECAM
7062306a36Sopenharmony_ci          compatible fashion. In this case, there is no need for the OS to
7162306a36Sopenharmony_ci          perform any low level setup of clocks, PHYs or device registers, nor
7262306a36Sopenharmony_ci          is there any reason for the driver to reconfigure ATU windows for
7362306a36Sopenharmony_ci          config and/or IO space accesses at runtime.
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci          In cases where the IP was synthesized with a minimum ATU window size
7662306a36Sopenharmony_ci          of 64 KB, it cannot be supported by the generic ECAM driver, because
7762306a36Sopenharmony_ci          it requires special config space accessors that filter accesses to
7862306a36Sopenharmony_ci          device #1 and beyond on the first bus.
7962306a36Sopenharmony_ci        items:
8062306a36Sopenharmony_ci          - enum:
8162306a36Sopenharmony_ci              - marvell,armada8k-pcie-ecam
8262306a36Sopenharmony_ci              - socionext,synquacer-pcie-ecam
8362306a36Sopenharmony_ci          - const: snps,dw-pcie-ecam
8462306a36Sopenharmony_ci      - description:
8562306a36Sopenharmony_ci          CAM or ECAM compliant PCI host controllers without any quirks
8662306a36Sopenharmony_ci        enum:
8762306a36Sopenharmony_ci          - pci-host-cam-generic
8862306a36Sopenharmony_ci          - pci-host-ecam-generic
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci  reg:
9162306a36Sopenharmony_ci    description:
9262306a36Sopenharmony_ci      The Configuration Space base address and size, as accessed from the parent
9362306a36Sopenharmony_ci      bus. The base address corresponds to the first bus in the "bus-range"
9462306a36Sopenharmony_ci      property. If no "bus-range" is specified, this will be bus 0 (the
9562306a36Sopenharmony_ci      default). Some host controllers have a 2nd non-compliant address range,
9662306a36Sopenharmony_ci      so 2 entries are allowed.
9762306a36Sopenharmony_ci    minItems: 1
9862306a36Sopenharmony_ci    maxItems: 2
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci  ranges:
10162306a36Sopenharmony_ci    description:
10262306a36Sopenharmony_ci      As described in IEEE Std 1275-1994, but must provide at least a
10362306a36Sopenharmony_ci      definition of non-prefetchable memory. One or both of prefetchable Memory
10462306a36Sopenharmony_ci      and IO Space may also be provided.
10562306a36Sopenharmony_ci    minItems: 1
10662306a36Sopenharmony_ci    maxItems: 3
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci  dma-coherent: true
10962306a36Sopenharmony_ci  iommu-map: true
11062306a36Sopenharmony_ci  iommu-map-mask: true
11162306a36Sopenharmony_ci  msi-parent: true
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_cirequired:
11462306a36Sopenharmony_ci  - compatible
11562306a36Sopenharmony_ci  - reg
11662306a36Sopenharmony_ci  - ranges
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ciallOf:
11962306a36Sopenharmony_ci  - $ref: /schemas/pci/pci-bus.yaml#
12062306a36Sopenharmony_ci  - if:
12162306a36Sopenharmony_ci      properties:
12262306a36Sopenharmony_ci        compatible:
12362306a36Sopenharmony_ci          contains:
12462306a36Sopenharmony_ci            const: arm,juno-r1-pcie
12562306a36Sopenharmony_ci    then:
12662306a36Sopenharmony_ci      required:
12762306a36Sopenharmony_ci        - dma-coherent
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci  - if:
13062306a36Sopenharmony_ci      properties:
13162306a36Sopenharmony_ci        compatible:
13262306a36Sopenharmony_ci          not:
13362306a36Sopenharmony_ci            contains:
13462306a36Sopenharmony_ci              enum:
13562306a36Sopenharmony_ci                - cavium,pci-host-thunder-pem
13662306a36Sopenharmony_ci                - hisilicon,hip06-pcie-ecam
13762306a36Sopenharmony_ci                - hisilicon,hip07-pcie-ecam
13862306a36Sopenharmony_ci    then:
13962306a36Sopenharmony_ci      properties:
14062306a36Sopenharmony_ci        reg:
14162306a36Sopenharmony_ci          maxItems: 1
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ciunevaluatedProperties: false
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ciexamples:
14662306a36Sopenharmony_ci  - |
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci    bus {
14962306a36Sopenharmony_ci        #address-cells = <2>;
15062306a36Sopenharmony_ci        #size-cells = <2>;
15162306a36Sopenharmony_ci        pcie@40000000 {
15262306a36Sopenharmony_ci            compatible = "pci-host-cam-generic";
15362306a36Sopenharmony_ci            device_type = "pci";
15462306a36Sopenharmony_ci            #address-cells = <3>;
15562306a36Sopenharmony_ci            #size-cells = <2>;
15662306a36Sopenharmony_ci            bus-range = <0x0 0x1>;
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci            // CPU_PHYSICAL(2)  SIZE(2)
15962306a36Sopenharmony_ci            reg = <0x0 0x40000000  0x0 0x1000000>;
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci            // BUS_ADDRESS(3)  CPU_PHYSICAL(2)  SIZE(2)
16262306a36Sopenharmony_ci            ranges = <0x01000000 0x0 0x01000000  0x0 0x01000000  0x0 0x00010000>,
16362306a36Sopenharmony_ci                     <0x02000000 0x0 0x41000000  0x0 0x41000000  0x0 0x3f000000>;
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ci            #interrupt-cells = <0x1>;
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci            // PCI_DEVICE(3)  INT#(1)  CONTROLLER(PHANDLE)  CONTROLLER_DATA(3)
16862306a36Sopenharmony_ci            interrupt-map = <   0x0 0x0 0x0  0x1  &gic  0x0 0x4 0x1>,
16962306a36Sopenharmony_ci                            < 0x800 0x0 0x0  0x1  &gic  0x0 0x5 0x1>,
17062306a36Sopenharmony_ci                            <0x1000 0x0 0x0  0x1  &gic  0x0 0x6 0x1>,
17162306a36Sopenharmony_ci                            <0x1800 0x0 0x0  0x1  &gic  0x0 0x7 0x1>;
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ci            // PCI_DEVICE(3)  INT#(1)
17462306a36Sopenharmony_ci            interrupt-map-mask = <0xf800 0x0 0x0  0x7>;
17562306a36Sopenharmony_ci        };
17662306a36Sopenharmony_ci    };
17762306a36Sopenharmony_ci...
178