xref: /freebsd-src/sys/contrib/device-tree/Bindings/pci/host-generic-pci.yaml (revision b2d2a78ad80ec68d4a17f5aef97d21686cb1e29b)
1c66ec88fSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2c66ec88fSEmmanuel Vadot%YAML 1.2
3c66ec88fSEmmanuel Vadot---
4c66ec88fSEmmanuel Vadot$id: http://devicetree.org/schemas/pci/host-generic-pci.yaml#
5c66ec88fSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6c66ec88fSEmmanuel Vadot
7c66ec88fSEmmanuel Vadottitle: Generic PCI host controller
8c66ec88fSEmmanuel Vadot
9c66ec88fSEmmanuel Vadotmaintainers:
10c66ec88fSEmmanuel Vadot  - Will Deacon <will@kernel.org>
11c66ec88fSEmmanuel Vadot
12c66ec88fSEmmanuel Vadotdescription: |
13c66ec88fSEmmanuel Vadot  Firmware-initialised PCI host controllers and PCI emulations, such as the
14c66ec88fSEmmanuel Vadot  virtio-pci implementations found in kvmtool and other para-virtualised
15c66ec88fSEmmanuel Vadot  systems, do not require driver support for complexities such as regulator
16c66ec88fSEmmanuel Vadot  and clock management. In fact, the controller may not even require the
17c66ec88fSEmmanuel Vadot  configuration of a control interface by the operating system, instead
18c66ec88fSEmmanuel Vadot  presenting a set of fixed windows describing a subset of IO, Memory and
19c66ec88fSEmmanuel Vadot  Configuration Spaces.
20c66ec88fSEmmanuel Vadot
21c66ec88fSEmmanuel Vadot  Configuration Space is assumed to be memory-mapped (as opposed to being
22c66ec88fSEmmanuel Vadot  accessed via an ioport) and laid out with a direct correspondence to the
23c66ec88fSEmmanuel Vadot  geography of a PCI bus address by concatenating the various components to
24c66ec88fSEmmanuel Vadot  form an offset.
25c66ec88fSEmmanuel Vadot
26c66ec88fSEmmanuel Vadot  For CAM, this 24-bit offset is:
27c66ec88fSEmmanuel Vadot
28c66ec88fSEmmanuel Vadot          cfg_offset(bus, device, function, register) =
29c66ec88fSEmmanuel Vadot                     bus << 16 | device << 11 | function << 8 | register
30c66ec88fSEmmanuel Vadot
31c66ec88fSEmmanuel Vadot  While ECAM extends this by 4 bits to accommodate 4k of function space:
32c66ec88fSEmmanuel Vadot
33c66ec88fSEmmanuel Vadot          cfg_offset(bus, device, function, register) =
34c66ec88fSEmmanuel Vadot                     bus << 20 | device << 15 | function << 12 | register
35c66ec88fSEmmanuel Vadot
36c66ec88fSEmmanuel Vadotproperties:
37c66ec88fSEmmanuel Vadot  compatible:
38c66ec88fSEmmanuel Vadot    description: Depends on the layout of configuration space (CAM vs ECAM
39c66ec88fSEmmanuel Vadot      respectively). May also have more specific compatibles.
40c66ec88fSEmmanuel Vadot    oneOf:
41c66ec88fSEmmanuel Vadot      - description:
42c66ec88fSEmmanuel Vadot          PCIe host controller in Arm Juno based on PLDA XpressRICH3-AXI IP
43c66ec88fSEmmanuel Vadot        items:
44c66ec88fSEmmanuel Vadot          - const: arm,juno-r1-pcie
45c66ec88fSEmmanuel Vadot          - const: plda,xpressrich3-axi
46c66ec88fSEmmanuel Vadot          - const: pci-host-ecam-generic
47c66ec88fSEmmanuel Vadot      - description: |
48c66ec88fSEmmanuel Vadot          ThunderX PCI host controller for pass-1.x silicon
49c66ec88fSEmmanuel Vadot
50c66ec88fSEmmanuel Vadot          Firmware-initialized PCI host controller to on-chip devices found on
51c66ec88fSEmmanuel Vadot          some Cavium ThunderX processors.  These devices have ECAM-based config
52c66ec88fSEmmanuel Vadot          access, but the BARs are all at fixed addresses.  We handle the fixed
53c66ec88fSEmmanuel Vadot          addresses by synthesizing Enhanced Allocation (EA) capabilities for
54c66ec88fSEmmanuel Vadot          these devices.
55c66ec88fSEmmanuel Vadot        const: cavium,pci-host-thunder-ecam
56c66ec88fSEmmanuel Vadot      - description:
57c66ec88fSEmmanuel Vadot          Cavium ThunderX PEM firmware-initialized PCIe host controller
58c66ec88fSEmmanuel Vadot        const: cavium,pci-host-thunder-pem
59c66ec88fSEmmanuel Vadot      - description:
60c66ec88fSEmmanuel Vadot          HiSilicon Hip06/Hip07 PCIe host bridge in almost-ECAM mode. Some
61c66ec88fSEmmanuel Vadot          firmware places the host controller in a mode where it is ECAM
62c66ec88fSEmmanuel Vadot          compliant for all devices other than the root complex.
63c66ec88fSEmmanuel Vadot        enum:
64c66ec88fSEmmanuel Vadot          - hisilicon,hip06-pcie-ecam
65c66ec88fSEmmanuel Vadot          - hisilicon,hip07-pcie-ecam
66c66ec88fSEmmanuel Vadot      - description: |
67c66ec88fSEmmanuel Vadot          In some cases, firmware may already have configured the Synopsys
68c66ec88fSEmmanuel Vadot          DesignWare PCIe controller in RC mode with static ATU window mappings
69c66ec88fSEmmanuel Vadot          that cover all config, MMIO and I/O spaces in a [mostly] ECAM
70c66ec88fSEmmanuel Vadot          compatible fashion. In this case, there is no need for the OS to
71c66ec88fSEmmanuel Vadot          perform any low level setup of clocks, PHYs or device registers, nor
72c66ec88fSEmmanuel Vadot          is there any reason for the driver to reconfigure ATU windows for
73c66ec88fSEmmanuel Vadot          config and/or IO space accesses at runtime.
74c66ec88fSEmmanuel Vadot
75c66ec88fSEmmanuel Vadot          In cases where the IP was synthesized with a minimum ATU window size
76c66ec88fSEmmanuel Vadot          of 64 KB, it cannot be supported by the generic ECAM driver, because
77c66ec88fSEmmanuel Vadot          it requires special config space accessors that filter accesses to
78c66ec88fSEmmanuel Vadot          device #1 and beyond on the first bus.
79c66ec88fSEmmanuel Vadot        items:
80c66ec88fSEmmanuel Vadot          - enum:
81c66ec88fSEmmanuel Vadot              - marvell,armada8k-pcie-ecam
82c66ec88fSEmmanuel Vadot              - socionext,synquacer-pcie-ecam
83c66ec88fSEmmanuel Vadot          - const: snps,dw-pcie-ecam
84c66ec88fSEmmanuel Vadot      - description:
85c66ec88fSEmmanuel Vadot          CAM or ECAM compliant PCI host controllers without any quirks
86c66ec88fSEmmanuel Vadot        enum:
87c66ec88fSEmmanuel Vadot          - pci-host-cam-generic
88c66ec88fSEmmanuel Vadot          - pci-host-ecam-generic
89c66ec88fSEmmanuel Vadot
90c66ec88fSEmmanuel Vadot  reg:
91c66ec88fSEmmanuel Vadot    description:
92c66ec88fSEmmanuel Vadot      The Configuration Space base address and size, as accessed from the parent
93c66ec88fSEmmanuel Vadot      bus. The base address corresponds to the first bus in the "bus-range"
94c66ec88fSEmmanuel Vadot      property. If no "bus-range" is specified, this will be bus 0 (the
95c66ec88fSEmmanuel Vadot      default). Some host controllers have a 2nd non-compliant address range,
96c66ec88fSEmmanuel Vadot      so 2 entries are allowed.
97c66ec88fSEmmanuel Vadot    minItems: 1
98c66ec88fSEmmanuel Vadot    maxItems: 2
99c66ec88fSEmmanuel Vadot
100c66ec88fSEmmanuel Vadot  ranges:
101c66ec88fSEmmanuel Vadot    description:
102c66ec88fSEmmanuel Vadot      As described in IEEE Std 1275-1994, but must provide at least a
103c66ec88fSEmmanuel Vadot      definition of non-prefetchable memory. One or both of prefetchable Memory
104c66ec88fSEmmanuel Vadot      and IO Space may also be provided.
105c66ec88fSEmmanuel Vadot
106c66ec88fSEmmanuel Vadot  dma-coherent: true
107b97ee269SEmmanuel Vadot  iommu-map: true
108b97ee269SEmmanuel Vadot  iommu-map-mask: true
109b97ee269SEmmanuel Vadot  msi-parent: true
110c66ec88fSEmmanuel Vadot
111*0e8011faSEmmanuel Vadot  ats-supported:
112*0e8011faSEmmanuel Vadot    description:
113*0e8011faSEmmanuel Vadot      Indicates that a PCIe host controller supports ATS, and can handle Memory
114*0e8011faSEmmanuel Vadot      Requests with Address Type (AT).
115*0e8011faSEmmanuel Vadot    type: boolean
116*0e8011faSEmmanuel Vadot
117c66ec88fSEmmanuel Vadotrequired:
118c66ec88fSEmmanuel Vadot  - compatible
119c66ec88fSEmmanuel Vadot  - reg
120c66ec88fSEmmanuel Vadot  - ranges
121c66ec88fSEmmanuel Vadot
122c66ec88fSEmmanuel VadotallOf:
1237d0873ebSEmmanuel Vadot  - $ref: /schemas/pci/pci-host-bridge.yaml#
124c66ec88fSEmmanuel Vadot  - if:
125c66ec88fSEmmanuel Vadot      properties:
126c66ec88fSEmmanuel Vadot        compatible:
127c66ec88fSEmmanuel Vadot          contains:
128c66ec88fSEmmanuel Vadot            const: arm,juno-r1-pcie
129c66ec88fSEmmanuel Vadot    then:
130c66ec88fSEmmanuel Vadot      required:
131c66ec88fSEmmanuel Vadot        - dma-coherent
132c66ec88fSEmmanuel Vadot
133c66ec88fSEmmanuel Vadot  - if:
134c66ec88fSEmmanuel Vadot      properties:
135c66ec88fSEmmanuel Vadot        compatible:
136c66ec88fSEmmanuel Vadot          not:
137c66ec88fSEmmanuel Vadot            contains:
138c66ec88fSEmmanuel Vadot              enum:
139c66ec88fSEmmanuel Vadot                - cavium,pci-host-thunder-pem
140c66ec88fSEmmanuel Vadot                - hisilicon,hip06-pcie-ecam
141c66ec88fSEmmanuel Vadot                - hisilicon,hip07-pcie-ecam
142c66ec88fSEmmanuel Vadot    then:
143c66ec88fSEmmanuel Vadot      properties:
144c66ec88fSEmmanuel Vadot        reg:
145c66ec88fSEmmanuel Vadot          maxItems: 1
146c66ec88fSEmmanuel Vadot
1476be33864SEmmanuel VadotunevaluatedProperties: false
1486be33864SEmmanuel Vadot
149c66ec88fSEmmanuel Vadotexamples:
150c66ec88fSEmmanuel Vadot  - |
151c66ec88fSEmmanuel Vadot
152c66ec88fSEmmanuel Vadot    bus {
153c66ec88fSEmmanuel Vadot        #address-cells = <2>;
154c66ec88fSEmmanuel Vadot        #size-cells = <2>;
155c66ec88fSEmmanuel Vadot        pcie@40000000 {
156c66ec88fSEmmanuel Vadot            compatible = "pci-host-cam-generic";
157c66ec88fSEmmanuel Vadot            device_type = "pci";
158c66ec88fSEmmanuel Vadot            #address-cells = <3>;
159c66ec88fSEmmanuel Vadot            #size-cells = <2>;
160c66ec88fSEmmanuel Vadot            bus-range = <0x0 0x1>;
161c66ec88fSEmmanuel Vadot
162c66ec88fSEmmanuel Vadot            // CPU_PHYSICAL(2)  SIZE(2)
163c66ec88fSEmmanuel Vadot            reg = <0x0 0x40000000  0x0 0x1000000>;
164c66ec88fSEmmanuel Vadot
165c66ec88fSEmmanuel Vadot            // BUS_ADDRESS(3)  CPU_PHYSICAL(2)  SIZE(2)
166c66ec88fSEmmanuel Vadot            ranges = <0x01000000 0x0 0x01000000  0x0 0x01000000  0x0 0x00010000>,
167c66ec88fSEmmanuel Vadot                     <0x02000000 0x0 0x41000000  0x0 0x41000000  0x0 0x3f000000>;
168c66ec88fSEmmanuel Vadot
169c66ec88fSEmmanuel Vadot            #interrupt-cells = <0x1>;
170c66ec88fSEmmanuel Vadot
171c66ec88fSEmmanuel Vadot            // PCI_DEVICE(3)  INT#(1)  CONTROLLER(PHANDLE)  CONTROLLER_DATA(3)
172c66ec88fSEmmanuel Vadot            interrupt-map = <   0x0 0x0 0x0  0x1  &gic  0x0 0x4 0x1>,
173c66ec88fSEmmanuel Vadot                            < 0x800 0x0 0x0  0x1  &gic  0x0 0x5 0x1>,
174c66ec88fSEmmanuel Vadot                            <0x1000 0x0 0x0  0x1  &gic  0x0 0x6 0x1>,
175c66ec88fSEmmanuel Vadot                            <0x1800 0x0 0x0  0x1  &gic  0x0 0x7 0x1>;
176c66ec88fSEmmanuel Vadot
177c66ec88fSEmmanuel Vadot            // PCI_DEVICE(3)  INT#(1)
178c66ec88fSEmmanuel Vadot            interrupt-map-mask = <0xf800 0x0 0x0  0x7>;
179c66ec88fSEmmanuel Vadot        };
180c66ec88fSEmmanuel Vadot    };
181c66ec88fSEmmanuel Vadot...
182