Skip to content

Commit a5a89f3

Browse files
committed
Merge branch 'bits/140-pci' into asahi-wip
2 parents 6acf7d0 + 9170a25 commit a5a89f3

5 files changed

Lines changed: 370 additions & 106 deletions

File tree

Documentation/devicetree/bindings/pci/apple,pcie.yaml

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ description: |
1717
implements its root ports. But the ATU found on most DesignWare
1818
PCIe host bridges is absent.
1919
20+
On systems derived from T602x, the PHY registers are in a region
21+
separate from the port registers. In that case, there is one PHY
22+
register range per port register range.
23+
2024
All root ports share a single ECAM space, but separate GPIOs are
2125
used to take the PCI devices on those ports out of reset. Therefore
2226
the standard "reset-gpios" and "max-link-speed" properties appear on
@@ -35,11 +39,12 @@ properties:
3539
- apple,t8103-pcie
3640
- apple,t8112-pcie
3741
- apple,t6000-pcie
42+
- apple,t6020-pcie
3843
- const: apple,pcie
3944

4045
reg:
4146
minItems: 3
42-
maxItems: 6
47+
maxItems: 10
4348

4449
reg-names:
4550
minItems: 3
@@ -50,6 +55,10 @@ properties:
5055
- const: port1
5156
- const: port2
5257
- const: port3
58+
- const: phy0
59+
- const: phy1
60+
- const: phy2
61+
- const: phy3
5362

5463
ranges:
5564
minItems: 2
@@ -72,6 +81,27 @@ properties:
7281
power-domains:
7382
maxItems: 1
7483

84+
patternProperties:
85+
"^pci@":
86+
$ref: /schemas/pci/pci-bus.yaml#
87+
type: object
88+
description: A single PCI root port
89+
90+
properties:
91+
reg:
92+
maxItems: 1
93+
94+
pwren-gpios:
95+
description: Optional GPIO to power on the device
96+
maxItems: 1
97+
98+
required:
99+
- reset-gpios
100+
- interrupt-controller
101+
- "#interrupt-cells"
102+
- interrupt-map-mask
103+
- interrupt-map
104+
75105
required:
76106
- compatible
77107
- reg
@@ -142,34 +172,58 @@ examples:
142172
pinctrl-0 = <&pcie_pins>;
143173
pinctrl-names = "default";
144174
145-
pci@0,0 {
175+
port00: pci@0,0 {
146176
device_type = "pci";
147177
reg = <0x0 0x0 0x0 0x0 0x0>;
148178
reset-gpios = <&pinctrl_ap 152 0>;
149179
150180
#address-cells = <3>;
151181
#size-cells = <2>;
152182
ranges;
183+
184+
interrupt-controller;
185+
#interrupt-cells = <1>;
186+
interrupt-map-mask = <0 0 0 7>;
187+
interrupt-map = <0 0 0 1 &port00 0 0 0 0>,
188+
<0 0 0 2 &port00 0 0 0 1>,
189+
<0 0 0 3 &port00 0 0 0 2>,
190+
<0 0 0 4 &port00 0 0 0 3>;
153191
};
154192
155-
pci@1,0 {
193+
port01: pci@1,0 {
156194
device_type = "pci";
157195
reg = <0x800 0x0 0x0 0x0 0x0>;
158196
reset-gpios = <&pinctrl_ap 153 0>;
159197
160198
#address-cells = <3>;
161199
#size-cells = <2>;
162200
ranges;
201+
202+
interrupt-controller;
203+
#interrupt-cells = <1>;
204+
interrupt-map-mask = <0 0 0 7>;
205+
interrupt-map = <0 0 0 1 &port01 0 0 0 0>,
206+
<0 0 0 2 &port01 0 0 0 1>,
207+
<0 0 0 3 &port01 0 0 0 2>,
208+
<0 0 0 4 &port01 0 0 0 3>;
163209
};
164210
165-
pci@2,0 {
211+
port02: pci@2,0 {
166212
device_type = "pci";
167213
reg = <0x1000 0x0 0x0 0x0 0x0>;
168214
reset-gpios = <&pinctrl_ap 33 0>;
169215
170216
#address-cells = <3>;
171217
#size-cells = <2>;
172218
ranges;
219+
220+
interrupt-controller;
221+
#interrupt-cells = <1>;
222+
interrupt-map-mask = <0 0 0 7>;
223+
interrupt-map = <0 0 0 1 &port02 0 0 0 0>,
224+
<0 0 0 2 &port02 0 0 0 1>,
225+
<0 0 0 3 &port02 0 0 0 2>,
226+
<0 0 0 4 &port02 0 0 0 3>;
173227
};
174228
};
175229
};

drivers/pci/controller/pci-host-common.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,30 +49,26 @@ static struct pci_config_window *gen_pci_init(struct device *dev,
4949
return cfg;
5050
}
5151

52-
int pci_host_common_probe(struct platform_device *pdev)
52+
int pci_host_common_init(struct platform_device *pdev,
53+
const struct pci_ecam_ops *ops)
5354
{
5455
struct device *dev = &pdev->dev;
5556
struct pci_host_bridge *bridge;
5657
struct pci_config_window *cfg;
57-
const struct pci_ecam_ops *ops;
58-
59-
ops = of_device_get_match_data(&pdev->dev);
60-
if (!ops)
61-
return -ENODEV;
6258

6359
bridge = devm_pci_alloc_host_bridge(dev, 0);
6460
if (!bridge)
6561
return -ENOMEM;
6662

67-
platform_set_drvdata(pdev, bridge);
68-
6963
of_pci_check_probe_only();
7064

7165
/* Parse and map our Configuration Space windows */
7266
cfg = gen_pci_init(dev, bridge, ops);
7367
if (IS_ERR(cfg))
7468
return PTR_ERR(cfg);
7569

70+
platform_set_drvdata(pdev, bridge);
71+
7672
bridge->sysdata = cfg;
7773
bridge->ops = (struct pci_ops *)&ops->pci_ops;
7874
bridge->enable_device = ops->enable_device;
@@ -81,6 +77,18 @@ int pci_host_common_probe(struct platform_device *pdev)
8177

8278
return pci_host_probe(bridge);
8379
}
80+
EXPORT_SYMBOL_GPL(pci_host_common_init);
81+
82+
int pci_host_common_probe(struct platform_device *pdev)
83+
{
84+
const struct pci_ecam_ops *ops;
85+
86+
ops = of_device_get_match_data(&pdev->dev);
87+
if (!ops)
88+
return -ENODEV;
89+
90+
return pci_host_common_init(pdev, ops);
91+
}
8492
EXPORT_SYMBOL_GPL(pci_host_common_probe);
8593

8694
void pci_host_common_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)