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