Skip to content

Commit bb78146

Browse files
committed
Merge branch 'pci/controller/xilinx'
- Fix off-by-one error in INTx IRQ handler that caused INTx interrupts to be lost or delivered as the wrong interrupt (Sean Anderson) - Rate-limit misc interrupt messages (Sean Anderson) - Turn off the clock on probe failure and device removal (Sean Anderson) - Add DT binding and driver support for enabling/disabling PHYs (Sean Anderson) - Add PCIe phy bindings for the ZCU102 (Sean Anderson) - Add support for Xilinx QDMA Soft IP PCIe Root Port Bridge to DT binding and xilinx-dma-pl driver (Thippeswamy Havalige) * pci/controller/xilinx: PCI: xilinx-xdma: Add Xilinx QDMA Root Port driver dt-bindings: PCI: xilinx-xdma: Add schemas for Xilinx QDMA PCIe Root Port Bridge arm64: zynqmp: Add PCIe phys property for ZCU102 PCI: xilinx-nwl: Add PHY support dt-bindings: pci: xilinx-nwl: Add phys property PCI: xilinx-nwl: Clean up clock on probe failure/removal PCI: xilinx-nwl: Rate-limit misc interrupt messages PCI: xilinx-nwl: Fix register misspelling PCI: xilinx-nwl: Fix off-by-one in INTx IRQ handler
2 parents 11e32bb + 6ac7217 commit bb78146

File tree

5 files changed

+210
-26
lines changed

5 files changed

+210
-26
lines changed

Documentation/devicetree/bindings/pci/xlnx,nwl-pcie.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ properties:
6161
interrupt-map:
6262
maxItems: 4
6363

64+
phys:
65+
minItems: 1
66+
maxItems: 4
67+
description: One phy per logical lane, in order
68+
6469
power-domains:
6570
maxItems: 1
6671

@@ -110,6 +115,7 @@ examples:
110115
- |
111116
#include <dt-bindings/interrupt-controller/arm-gic.h>
112117
#include <dt-bindings/interrupt-controller/irq.h>
118+
#include <dt-bindings/phy/phy.h>
113119
#include <dt-bindings/power/xlnx-zynqmp-power.h>
114120
soc {
115121
#address-cells = <2>;
@@ -138,6 +144,7 @@ examples:
138144
<0x0 0x0 0x0 0x3 &pcie_intc 0x3>,
139145
<0x0 0x0 0x0 0x4 &pcie_intc 0x4>;
140146
msi-parent = <&nwl_pcie>;
147+
phys = <&psgtr 0 PHY_TYPE_PCIE 0 0>;
141148
power-domains = <&zynqmp_firmware PD_PCIE>;
142149
iommus = <&smmu 0x4d0>;
143150
pcie_intc: legacy-interrupt-controller {

Documentation/devicetree/bindings/pci/xlnx,xdma-host.yaml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,21 @@ allOf:
1414

1515
properties:
1616
compatible:
17-
const: xlnx,xdma-host-3.00
17+
enum:
18+
- xlnx,xdma-host-3.00
19+
- xlnx,qdma-host-3.00
1820

1921
reg:
20-
maxItems: 1
22+
items:
23+
- description: configuration region and XDMA bridge register.
24+
- description: QDMA bridge register.
25+
minItems: 1
26+
27+
reg-names:
28+
items:
29+
- const: cfg
30+
- const: breg
31+
minItems: 1
2132

2233
ranges:
2334
maxItems: 2
@@ -76,6 +87,27 @@ required:
7687
- "#interrupt-cells"
7788
- interrupt-controller
7889

90+
if:
91+
properties:
92+
compatible:
93+
contains:
94+
enum:
95+
- xlnx,qdma-host-3.00
96+
then:
97+
properties:
98+
reg:
99+
minItems: 2
100+
reg-names:
101+
minItems: 2
102+
required:
103+
- reg-names
104+
else:
105+
properties:
106+
reg:
107+
maxItems: 1
108+
reg-names:
109+
maxItems: 1
110+
79111
unevaluatedProperties: false
80112

81113
examples:

arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revA.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,7 @@
941941

942942
&pcie {
943943
status = "okay";
944+
phys = <&psgtr 0 PHY_TYPE_PCIE 0 0>;
944945
};
945946

946947
&psgtr {

drivers/pci/controller/pcie-xilinx-dma-pl.c

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,24 @@
7171

7272
/* Phy Status/Control Register definitions */
7373
#define XILINX_PCIE_DMA_REG_PSCR_LNKUP BIT(11)
74+
#define QDMA_BRIDGE_BASE_OFF 0xcd8
7475

7576
/* Number of MSI IRQs */
7677
#define XILINX_NUM_MSI_IRQS 64
7778

79+
enum xilinx_pl_dma_version {
80+
XDMA,
81+
QDMA,
82+
};
83+
84+
/**
85+
* struct xilinx_pl_dma_variant - PL DMA PCIe variant information
86+
* @version: DMA version
87+
*/
88+
struct xilinx_pl_dma_variant {
89+
enum xilinx_pl_dma_version version;
90+
};
91+
7892
struct xilinx_msi {
7993
struct irq_domain *msi_domain;
8094
unsigned long *bitmap;
@@ -88,6 +102,7 @@ struct xilinx_msi {
88102
* struct pl_dma_pcie - PCIe port information
89103
* @dev: Device pointer
90104
* @reg_base: IO Mapped Register Base
105+
* @cfg_base: IO Mapped Configuration Base
91106
* @irq: Interrupt number
92107
* @cfg: Holds mappings of config space window
93108
* @phys_reg_base: Physical address of reg base
@@ -97,10 +112,12 @@ struct xilinx_msi {
97112
* @msi: MSI information
98113
* @intx_irq: INTx error interrupt number
99114
* @lock: Lock protecting shared register access
115+
* @variant: PL DMA PCIe version check pointer
100116
*/
101117
struct pl_dma_pcie {
102118
struct device *dev;
103119
void __iomem *reg_base;
120+
void __iomem *cfg_base;
104121
int irq;
105122
struct pci_config_window *cfg;
106123
phys_addr_t phys_reg_base;
@@ -110,16 +127,23 @@ struct pl_dma_pcie {
110127
struct xilinx_msi msi;
111128
int intx_irq;
112129
raw_spinlock_t lock;
130+
const struct xilinx_pl_dma_variant *variant;
113131
};
114132

115133
static inline u32 pcie_read(struct pl_dma_pcie *port, u32 reg)
116134
{
135+
if (port->variant->version == QDMA)
136+
return readl(port->reg_base + reg + QDMA_BRIDGE_BASE_OFF);
137+
117138
return readl(port->reg_base + reg);
118139
}
119140

120141
static inline void pcie_write(struct pl_dma_pcie *port, u32 val, u32 reg)
121142
{
122-
writel(val, port->reg_base + reg);
143+
if (port->variant->version == QDMA)
144+
writel(val, port->reg_base + reg + QDMA_BRIDGE_BASE_OFF);
145+
else
146+
writel(val, port->reg_base + reg);
123147
}
124148

125149
static inline bool xilinx_pl_dma_pcie_link_up(struct pl_dma_pcie *port)
@@ -173,6 +197,9 @@ static void __iomem *xilinx_pl_dma_pcie_map_bus(struct pci_bus *bus,
173197
if (!xilinx_pl_dma_pcie_valid_device(bus, devfn))
174198
return NULL;
175199

200+
if (port->variant->version == QDMA)
201+
return port->cfg_base + PCIE_ECAM_OFFSET(bus->number, devfn, where);
202+
176203
return port->reg_base + PCIE_ECAM_OFFSET(bus->number, devfn, where);
177204
}
178205

@@ -724,6 +751,15 @@ static int xilinx_pl_dma_pcie_parse_dt(struct pl_dma_pcie *port,
724751

725752
port->reg_base = port->cfg->win;
726753

754+
if (port->variant->version == QDMA) {
755+
port->cfg_base = port->cfg->win;
756+
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "breg");
757+
port->reg_base = devm_ioremap_resource(dev, res);
758+
if (IS_ERR(port->reg_base))
759+
return PTR_ERR(port->reg_base);
760+
port->phys_reg_base = res->start;
761+
}
762+
727763
err = xilinx_request_msi_irq(port);
728764
if (err) {
729765
pci_ecam_free(port->cfg);
@@ -753,6 +789,8 @@ static int xilinx_pl_dma_pcie_probe(struct platform_device *pdev)
753789
if (!bus)
754790
return -ENODEV;
755791

792+
port->variant = of_device_get_match_data(dev);
793+
756794
err = xilinx_pl_dma_pcie_parse_dt(port, bus->res);
757795
if (err) {
758796
dev_err(dev, "Parsing DT failed\n");
@@ -784,9 +822,22 @@ static int xilinx_pl_dma_pcie_probe(struct platform_device *pdev)
784822
return err;
785823
}
786824

825+
static const struct xilinx_pl_dma_variant xdma_host = {
826+
.version = XDMA,
827+
};
828+
829+
static const struct xilinx_pl_dma_variant qdma_host = {
830+
.version = QDMA,
831+
};
832+
787833
static const struct of_device_id xilinx_pl_dma_pcie_of_match[] = {
788834
{
789835
.compatible = "xlnx,xdma-host-3.00",
836+
.data = &xdma_host,
837+
},
838+
{
839+
.compatible = "xlnx,qdma-host-3.00",
840+
.data = &qdma_host,
790841
},
791842
{}
792843
};

0 commit comments

Comments
 (0)