Skip to content

Commit bf933db

Browse files
committed
Merge branches 'pci/host-designware', 'pci/host-designware-common', 'pci/host-generic', 'pci/host-imx6', 'pci/host-iproc' and 'pci/host-xgene' into next
* pci/host-designware: PCI: designware: Use iATU0 for cfg and IO, iATU1 for MEM PCI: designware: Consolidate outbound iATU programming functions PCI: designware: Add support for x8 links * pci/host-designware-common: PCI: designware: Wait for link to come up with consistent style PCI: layerscape: Factor out ls_pcie_establish_link() PCI: layerscape: Use dw_pcie_link_up() consistently PCI: dra7xx: Use dw_pcie_link_up() consistently PCI: imx6: Rename imx6_pcie_start_link() to imx6_pcie_establish_link() * pci/host-generic: of/pci: Fix pci_address_to_pio() conversion of CPU address to I/O port * pci/host-imx6: PCI: imx6: Add #define PCIE_RC_LCSR PCI: imx6: Use "u32", not "uint32_t" PCI: imx6: Add speed change timeout message * pci/host-iproc: PCI: iproc: Free resource list after registration PCI: iproc: Directly add PCI resources PCI: iproc: Add BCMA PCIe driver PCI: iproc: Allow override of device tree IRQ mapping function * pci/host-xgene: arm64: dts: Add APM X-Gene PCIe MSI nodes PCI: xgene: Add APM X-Gene v1 PCIe MSI/MSIX termination driver
7 parents 0ff9b9b + 2d91b49 + 6cbb247 + 5dbb4c6 + 2393f79 + ef07991 + e1e6e5c commit bf933db

File tree

19 files changed

+1033
-192
lines changed

19 files changed

+1033
-192
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
* AppliedMicro X-Gene v1 PCIe MSI controller
2+
3+
Required properties:
4+
5+
- compatible: should be "apm,xgene1-msi" to identify
6+
X-Gene v1 PCIe MSI controller block.
7+
- msi-controller: indicates that this is X-Gene v1 PCIe MSI controller node
8+
- reg: physical base address (0x79000000) and length (0x900000) for controller
9+
registers. These registers include the MSI termination address and data
10+
registers as well as the MSI interrupt status registers.
11+
- reg-names: not required
12+
- interrupts: A list of 16 interrupt outputs of the controller, starting from
13+
interrupt number 0x10 to 0x1f.
14+
- interrupt-names: not required
15+
16+
Each PCIe node needs to have property msi-parent that points to msi controller node
17+
18+
Examples:
19+
20+
SoC DTSI:
21+
22+
+ MSI node:
23+
msi@79000000 {
24+
compatible = "apm,xgene1-msi";
25+
msi-controller;
26+
reg = <0x00 0x79000000 0x0 0x900000>;
27+
interrupts = <0x0 0x10 0x4>
28+
<0x0 0x11 0x4>
29+
<0x0 0x12 0x4>
30+
<0x0 0x13 0x4>
31+
<0x0 0x14 0x4>
32+
<0x0 0x15 0x4>
33+
<0x0 0x16 0x4>
34+
<0x0 0x17 0x4>
35+
<0x0 0x18 0x4>
36+
<0x0 0x19 0x4>
37+
<0x0 0x1a 0x4>
38+
<0x0 0x1b 0x4>
39+
<0x0 0x1c 0x4>
40+
<0x0 0x1d 0x4>
41+
<0x0 0x1e 0x4>
42+
<0x0 0x1f 0x4>;
43+
};
44+
45+
+ PCIe controller node with msi-parent property pointing to MSI node:
46+
pcie0: pcie@1f2b0000 {
47+
status = "disabled";
48+
device_type = "pci";
49+
compatible = "apm,xgene-storm-pcie", "apm,xgene-pcie";
50+
#interrupt-cells = <1>;
51+
#size-cells = <2>;
52+
#address-cells = <3>;
53+
reg = < 0x00 0x1f2b0000 0x0 0x00010000 /* Controller registers */
54+
0xe0 0xd0000000 0x0 0x00040000>; /* PCI config space */
55+
reg-names = "csr", "cfg";
56+
ranges = <0x01000000 0x00 0x00000000 0xe0 0x10000000 0x00 0x00010000 /* io */
57+
0x02000000 0x00 0x80000000 0xe1 0x80000000 0x00 0x80000000>; /* mem */
58+
dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000
59+
0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>;
60+
interrupt-map-mask = <0x0 0x0 0x0 0x7>;
61+
interrupt-map = <0x0 0x0 0x0 0x1 &gic 0x0 0xc2 0x1
62+
0x0 0x0 0x0 0x2 &gic 0x0 0xc3 0x1
63+
0x0 0x0 0x0 0x3 &gic 0x0 0xc4 0x1
64+
0x0 0x0 0x0 0x4 &gic 0x0 0xc5 0x1>;
65+
dma-coherent;
66+
clocks = <&pcie0clk 0>;
67+
msi-parent= <&msi>;
68+
};

MAINTAINERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7564,6 +7564,14 @@ L: [email protected]
75647564
S: Orphan
75657565
F: drivers/pci/host/*spear*
75667566

7567+
PCI MSI DRIVER FOR APPLIEDMICRO XGENE
7568+
M: Duc Dang <[email protected]>
7569+
7570+
7571+
S: Maintained
7572+
F: Documentation/devicetree/bindings/pci/xgene-pci-msi.txt
7573+
F: drivers/pci/host/pci-xgene-msi.c
7574+
75677575
PCMCIA SUBSYSTEM
75687576
P: Linux PCMCIA Team
75697577

arch/arm64/boot/dts/apm/apm-storm.dtsi

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,28 @@
374374
};
375375
};
376376

377+
msi: msi@79000000 {
378+
compatible = "apm,xgene1-msi";
379+
msi-controller;
380+
reg = <0x00 0x79000000 0x0 0x900000>;
381+
interrupts = < 0x0 0x10 0x4
382+
0x0 0x11 0x4
383+
0x0 0x12 0x4
384+
0x0 0x13 0x4
385+
0x0 0x14 0x4
386+
0x0 0x15 0x4
387+
0x0 0x16 0x4
388+
0x0 0x17 0x4
389+
0x0 0x18 0x4
390+
0x0 0x19 0x4
391+
0x0 0x1a 0x4
392+
0x0 0x1b 0x4
393+
0x0 0x1c 0x4
394+
0x0 0x1d 0x4
395+
0x0 0x1e 0x4
396+
0x0 0x1f 0x4>;
397+
};
398+
377399
pcie0: pcie@1f2b0000 {
378400
status = "disabled";
379401
device_type = "pci";
@@ -395,6 +417,7 @@
395417
0x0 0x0 0x0 0x4 &gic 0x0 0xc5 0x1>;
396418
dma-coherent;
397419
clocks = <&pcie0clk 0>;
420+
msi-parent = <&msi>;
398421
};
399422

400423
pcie1: pcie@1f2c0000 {
@@ -418,6 +441,7 @@
418441
0x0 0x0 0x0 0x4 &gic 0x0 0xcb 0x1>;
419442
dma-coherent;
420443
clocks = <&pcie1clk 0>;
444+
msi-parent = <&msi>;
421445
};
422446

423447
pcie2: pcie@1f2d0000 {
@@ -441,6 +465,7 @@
441465
0x0 0x0 0x0 0x4 &gic 0x0 0xd1 0x1>;
442466
dma-coherent;
443467
clocks = <&pcie2clk 0>;
468+
msi-parent = <&msi>;
444469
};
445470

446471
pcie3: pcie@1f500000 {
@@ -464,6 +489,7 @@
464489
0x0 0x0 0x0 0x4 &gic 0x0 0xd7 0x1>;
465490
dma-coherent;
466491
clocks = <&pcie3clk 0>;
492+
msi-parent = <&msi>;
467493
};
468494

469495
pcie4: pcie@1f510000 {
@@ -487,6 +513,7 @@
487513
0x0 0x0 0x0 0x4 &gic 0x0 0xdd 0x1>;
488514
dma-coherent;
489515
clocks = <&pcie4clk 0>;
516+
msi-parent = <&msi>;
490517
};
491518

492519
serial0: serial@1c020000 {

drivers/of/address.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ unsigned long __weak pci_address_to_pio(phys_addr_t address)
765765
spin_lock(&io_range_lock);
766766
list_for_each_entry(res, &io_range_list, list) {
767767
if (address >= res->start && address < res->start + res->size) {
768-
addr = res->start - address + offset;
768+
addr = address - res->start + offset;
769769
break;
770770
}
771771
offset += res->size;

drivers/pci/host/Kconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,20 @@ config PCI_XGENE
8989
depends on ARCH_XGENE
9090
depends on OF
9191
select PCIEPORTBUS
92+
select PCI_MSI_IRQ_DOMAIN if PCI_MSI
9293
help
9394
Say Y here if you want internal PCI support on APM X-Gene SoC.
9495
There are 5 internal PCIe ports available. Each port is GEN3 capable
9596
and have varied lanes from x1 to x8.
9697

98+
config PCI_XGENE_MSI
99+
bool "X-Gene v1 PCIe MSI feature"
100+
depends on PCI_XGENE && PCI_MSI
101+
default y
102+
help
103+
Say Y here if you want PCIe MSI support for the APM X-Gene v1 SoC.
104+
This MSI driver supports 5 PCIe ports on the APM X-Gene v1 SoC.
105+
97106
config PCI_LAYERSCAPE
98107
bool "Freescale Layerscape PCIe controller"
99108
depends on OF && ARM
@@ -125,4 +134,15 @@ config PCIE_IPROC_PLATFORM
125134
Say Y here if you want to use the Broadcom iProc PCIe controller
126135
through the generic platform bus interface
127136

137+
config PCIE_IPROC_BCMA
138+
bool "Broadcom iProc PCIe BCMA bus driver"
139+
depends on ARCH_BCM_IPROC || (ARM && COMPILE_TEST)
140+
select PCIE_IPROC
141+
select BCMA
142+
select PCI_DOMAINS
143+
default ARCH_BCM_5301X
144+
help
145+
Say Y here if you want to use the Broadcom iProc PCIe controller
146+
through the BCMA bus interface
147+
128148
endmenu

drivers/pci/host/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ obj-$(CONFIG_PCIE_SPEAR13XX) += pcie-spear13xx.o
1111
obj-$(CONFIG_PCI_KEYSTONE) += pci-keystone-dw.o pci-keystone.o
1212
obj-$(CONFIG_PCIE_XILINX) += pcie-xilinx.o
1313
obj-$(CONFIG_PCI_XGENE) += pci-xgene.o
14+
obj-$(CONFIG_PCI_XGENE_MSI) += pci-xgene-msi.o
1415
obj-$(CONFIG_PCI_LAYERSCAPE) += pci-layerscape.o
1516
obj-$(CONFIG_PCI_VERSATILE) += pci-versatile.o
1617
obj-$(CONFIG_PCIE_IPROC) += pcie-iproc.o
1718
obj-$(CONFIG_PCIE_IPROC_PLATFORM) += pcie-iproc-platform.o
19+
obj-$(CONFIG_PCIE_IPROC_BCMA) += pcie-iproc-bcma.o

drivers/pci/host/pci-dra7xx.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ static int dra7xx_pcie_link_up(struct pcie_port *pp)
9393

9494
static int dra7xx_pcie_establish_link(struct pcie_port *pp)
9595
{
96-
u32 reg;
97-
unsigned int retries = 1000;
9896
struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pp);
97+
u32 reg;
98+
unsigned int retries;
9999

100100
if (dw_pcie_link_up(pp)) {
101101
dev_err(pp->dev, "link is already up\n");
@@ -106,19 +106,14 @@ static int dra7xx_pcie_establish_link(struct pcie_port *pp)
106106
reg |= LTSSM_EN;
107107
dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_DEVICE_CMD, reg);
108108

109-
while (retries--) {
110-
reg = dra7xx_pcie_readl(dra7xx, PCIECTRL_DRA7XX_CONF_PHY_CS);
111-
if (reg & LINK_UP)
112-
break;
109+
for (retries = 0; retries < 1000; retries++) {
110+
if (dw_pcie_link_up(pp))
111+
return 0;
113112
usleep_range(10, 20);
114113
}
115114

116-
if (retries == 0) {
117-
dev_err(pp->dev, "link is not up\n");
118-
return -ETIMEDOUT;
119-
}
120-
121-
return 0;
115+
dev_err(pp->dev, "link is not up\n");
116+
return -EINVAL;
122117
}
123118

124119
static void dra7xx_pcie_enable_interrupts(struct pcie_port *pp)

drivers/pci/host/pci-exynos.c

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,9 @@ static void exynos_pcie_assert_reset(struct pcie_port *pp)
316316

317317
static int exynos_pcie_establish_link(struct pcie_port *pp)
318318
{
319-
u32 val;
320-
int count = 0;
321319
struct exynos_pcie *exynos_pcie = to_exynos_pcie(pp);
320+
u32 val;
321+
unsigned int retries;
322322

323323
if (dw_pcie_link_up(pp)) {
324324
dev_err(pp->dev, "Link already up\n");
@@ -357,27 +357,23 @@ static int exynos_pcie_establish_link(struct pcie_port *pp)
357357
PCIE_APP_LTSSM_ENABLE);
358358

359359
/* check if the link is up or not */
360-
while (!dw_pcie_link_up(pp)) {
361-
mdelay(100);
362-
count++;
363-
if (count == 10) {
364-
while (exynos_phy_readl(exynos_pcie,
365-
PCIE_PHY_PLL_LOCKED) == 0) {
366-
val = exynos_blk_readl(exynos_pcie,
367-
PCIE_PHY_PLL_LOCKED);
368-
dev_info(pp->dev, "PLL Locked: 0x%x\n", val);
369-
}
370-
/* power off phy */
371-
exynos_pcie_power_off_phy(pp);
372-
373-
dev_err(pp->dev, "PCIe Link Fail\n");
374-
return -EINVAL;
360+
for (retries = 0; retries < 10; retries++) {
361+
if (dw_pcie_link_up(pp)) {
362+
dev_info(pp->dev, "Link up\n");
363+
return 0;
375364
}
365+
mdelay(100);
376366
}
377367

378-
dev_info(pp->dev, "Link up\n");
368+
while (exynos_phy_readl(exynos_pcie, PCIE_PHY_PLL_LOCKED) == 0) {
369+
val = exynos_blk_readl(exynos_pcie, PCIE_PHY_PLL_LOCKED);
370+
dev_info(pp->dev, "PLL Locked: 0x%x\n", val);
371+
}
372+
/* power off phy */
373+
exynos_pcie_power_off_phy(pp);
379374

380-
return 0;
375+
dev_err(pp->dev, "PCIe Link Fail\n");
376+
return -EINVAL;
381377
}
382378

383379
static void exynos_pcie_clear_irq_pulse(struct pcie_port *pp)

0 commit comments

Comments
 (0)