Skip to content

Commit a2351ef

Browse files
committed
Merge branches 'pci/misc', 'pci/pm', 'pci/host-designware', 'pci/host-imx6', 'pci/host-keystone', 'pci/host-tegra' and 'pci/host-xilinx' into next
* pci/misc: PCI/AER: Make <linux/aer.h> standalone includable PCI: Remove unnecessary variable in pci_add_dynid() * pci/pm: PCI/PM: Allow PCI devices to be put into D3cold during system suspend PCI/PM: Drop unused runtime PM support code for PCIe ports * pci/host-designware: PCI: designware: Check private_data validity in single place PCI: designware: Remove pci_assign_unassigned_resources() from dw_pcie_host_init() PCI: designware: Use pci_create_root_bus() instead of pci_scan_root_bus() PCI: designware: Parse bus-range property from devicetree PCI: designware: Add support for v3.65 hardware * pci/host-imx6: PCI: imx6: Probe in module_init(), not fs_initcall() PCI: designware: Remove pci_assign_unassigned_resources() from dw_pcie_host_init() PCI: designware: Use pci_create_root_bus() instead of pci_scan_root_bus() PCI: designware: Parse bus-range property from devicetree PCI: imx6: Put LTSSM in "Detect" state before disabling it MAINTAINERS: Add Lucas Stach as co-maintainer for i.MX6 PCI driver PCI: designware: Add support for v3.65 hardware * pci/host-keystone: PCI: keystone: Add TI Keystone PCIe driver PCI: designware: Add support for v3.65 hardware * pci/host-tegra: PCI: tegra: Implement a proper resource hierarchy PCI: tegra: Add missing cleanup in error path and tegra_msi_teardown_irq() resources: Add device-managed request/release_resource() * pci/host-xilinx: PCI: xilinx: Add Xilinx AXI PCIe Host Bridge IP driver Conflicts: drivers/pci/host/Kconfig drivers/pci/host/Makefile
8 parents 52addcf + efd01a7 + 385321e + 84a263f + 61da50d + 0c4ffcf + 41534e5 + 8961def commit a2351ef

21 files changed

Lines changed: 2303 additions & 143 deletions

‎Documentation/devicetree/bindings/pci/designware-pcie.txt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ Required properties:
2323

2424
Optional properties:
2525
- reset-gpio: gpio pin number of power good signal
26+
- bus-range: PCI bus numbers covered (it is recommended for new devicetrees to
27+
specify this property, to keep backwards compatibility a range of 0x00-0xff
28+
is assumed if not present)
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
TI Keystone PCIe interface
2+
3+
Keystone PCI host Controller is based on Designware PCI h/w version 3.65.
4+
It shares common functions with PCIe Designware core driver and inherit
5+
common properties defined in
6+
Documentation/devicetree/bindings/pci/designware-pci.txt
7+
8+
Please refer to Documentation/devicetree/bindings/pci/designware-pci.txt
9+
for the details of Designware DT bindings. Additional properties are
10+
described here as well as properties that are not applicable.
11+
12+
Required Properties:-
13+
14+
compatibility: "ti,keystone-pcie"
15+
reg: index 1 is the base address and length of DW application registers.
16+
index 2 is the base address and length of PCI mode configuration
17+
register.
18+
index 3 is the base address and length of PCI device ID register.
19+
20+
pcie_msi_intc : Interrupt controller device node for MSI IRQ chip
21+
interrupt-cells: should be set to 1
22+
interrupt-parent: Parent interrupt controller phandle
23+
interrupts: GIC interrupt lines connected to PCI MSI interrupt lines
24+
25+
Example:
26+
pcie_msi_intc: msi-interrupt-controller {
27+
interrupt-controller;
28+
#interrupt-cells = <1>;
29+
interrupt-parent = <&gic>;
30+
interrupts = <GIC_SPI 30 IRQ_TYPE_EDGE_RISING>,
31+
<GIC_SPI 31 IRQ_TYPE_EDGE_RISING>,
32+
<GIC_SPI 32 IRQ_TYPE_EDGE_RISING>,
33+
<GIC_SPI 33 IRQ_TYPE_EDGE_RISING>,
34+
<GIC_SPI 34 IRQ_TYPE_EDGE_RISING>,
35+
<GIC_SPI 35 IRQ_TYPE_EDGE_RISING>,
36+
<GIC_SPI 36 IRQ_TYPE_EDGE_RISING>,
37+
<GIC_SPI 37 IRQ_TYPE_EDGE_RISING>;
38+
};
39+
40+
pcie_intc: Interrupt controller device node for Legacy IRQ chip
41+
interrupt-cells: should be set to 1
42+
interrupt-parent: Parent interrupt controller phandle
43+
interrupts: GIC interrupt lines connected to PCI Legacy interrupt lines
44+
45+
Example:
46+
pcie_intc: legacy-interrupt-controller {
47+
interrupt-controller;
48+
#interrupt-cells = <1>;
49+
interrupt-parent = <&gic>;
50+
interrupts = <GIC_SPI 26 IRQ_TYPE_EDGE_RISING>,
51+
<GIC_SPI 27 IRQ_TYPE_EDGE_RISING>,
52+
<GIC_SPI 28 IRQ_TYPE_EDGE_RISING>,
53+
<GIC_SPI 29 IRQ_TYPE_EDGE_RISING>;
54+
};
55+
56+
Optional properties:-
57+
phys: phandle to Generic Keystone SerDes phy for PCI
58+
phy-names: name of the Generic Keystine SerDes phy for PCI
59+
- If boot loader already does PCI link establishment, then phys and
60+
phy-names shouldn't be present.
61+
62+
Designware DT Properties not applicable for Keystone PCI
63+
64+
1. pcie_bus clock-names not used. Instead, a phandle to phys is used.
65+
66+
Note for PCI driver usage
67+
=========================
68+
Driver requires pci=pcie_bus_perf in the bootargs for proper functioning.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
* Xilinx AXI PCIe Root Port Bridge DT description
2+
3+
Required properties:
4+
- #address-cells: Address representation for root ports, set to <3>
5+
- #size-cells: Size representation for root ports, set to <2>
6+
- #interrupt-cells: specifies the number of cells needed to encode an
7+
interrupt source. The value must be 1.
8+
- compatible: Should contain "xlnx,axi-pcie-host-1.00.a"
9+
- reg: Should contain AXI PCIe registers location and length
10+
- device_type: must be "pci"
11+
- interrupts: Should contain AXI PCIe interrupt
12+
- interrupt-map-mask,
13+
interrupt-map: standard PCI properties to define the mapping of the
14+
PCI interface to interrupt numbers.
15+
- ranges: ranges for the PCI memory regions (I/O space region is not
16+
supported by hardware)
17+
Please refer to the standard PCI bus binding document for a more
18+
detailed explanation
19+
20+
Optional properties:
21+
- bus-range: PCI bus numbers covered
22+
23+
Interrupt controller child node
24+
+++++++++++++++++++++++++++++++
25+
Required properties:
26+
- interrupt-controller: identifies the node as an interrupt controller
27+
- #address-cells: specifies the number of cells needed to encode an
28+
address. The value must be 0.
29+
- #interrupt-cells: specifies the number of cells needed to encode an
30+
interrupt source. The value must be 1.
31+
32+
NOTE:
33+
The core provides a single interrupt for both INTx/MSI messages. So,
34+
created a interrupt controller node to support 'interrupt-map' DT
35+
functionality. The driver will create an IRQ domain for this map, decode
36+
the four INTx interrupts in ISR and route them to this domain.
37+
38+
39+
Example:
40+
++++++++
41+
42+
pci_express: axi-pcie@50000000 {
43+
#address-cells = <3>;
44+
#size-cells = <2>;
45+
#interrupt-cells = <1>;
46+
compatible = "xlnx,axi-pcie-host-1.00.a";
47+
reg = < 0x50000000 0x10000000 >;
48+
device_type = "pci";
49+
interrupts = < 0 52 4 >;
50+
interrupt-map-mask = <0 0 0 7>;
51+
interrupt-map = <0 0 0 1 &pcie_intc 1>,
52+
<0 0 0 2 &pcie_intc 2>,
53+
<0 0 0 3 &pcie_intc 3>,
54+
<0 0 0 4 &pcie_intc 4>;
55+
ranges = < 0x02000000 0 0x60000000 0x60000000 0 0x10000000 >;
56+
57+
pcie_intc: interrupt-controller {
58+
interrupt-controller;
59+
#address-cells = <0>;
60+
#interrupt-cells = <1>;
61+
}
62+
};

‎Documentation/driver-model/devres.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,10 @@ IIO
264264
IO region
265265
devm_release_mem_region()
266266
devm_release_region()
267+
devm_release_resource()
267268
devm_request_mem_region()
268269
devm_request_region()
270+
devm_request_resource()
269271

270272
IOMAP
271273
devm_ioport_map()

‎MAINTAINERS‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6870,12 +6870,19 @@ F: arch/x86/kernel/quirks.c
68706870

68716871
PCI DRIVER FOR IMX6
68726872
M: Richard Zhu <r65037@freescale.com>
6873-
M: Shawn Guo <shawn.guo@freescale.com>
6873+
M: Lucas Stach <l.stach@pengutronix.de>
68746874
L: linux-pci@vger.kernel.org
68756875
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
68766876
S: Maintained
68776877
F: drivers/pci/host/*imx6*
68786878

6879+
PCI DRIVER FOR TI KEYSTONE
6880+
M: Murali Karicheri <m-karicheri2@ti.com>
6881+
L: linux-pci@vger.kernel.org
6882+
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
6883+
S: Maintained
6884+
F: drivers/pci/host/*keystone*
6885+
68796886
PCI DRIVER FOR MVEBU (Marvell Armada 370 and Armada XP SOC support)
68806887
M: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
68816888
M: Jason Cooper <jason@lakedaemon.net>

‎drivers/pci/host/Kconfig‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,23 @@ config PCIE_SPEAR13XX
6363
help
6464
Say Y here if you want PCIe support on SPEAr13XX SoCs.
6565

66+
67+
config PCI_KEYSTONE
68+
bool "TI Keystone PCIe controller"
69+
depends on ARCH_KEYSTONE
70+
select PCIE_DW
71+
select PCIEPORTBUS
72+
help
73+
Say Y here if you want to enable PCI controller support on Keystone
74+
SoCs. The PCI controller on Keystone is based on Designware hardware
75+
and therefore the driver re-uses the Designware core functions to
76+
implement the driver.
77+
78+
config PCIE_XILINX
79+
bool "Xilinx AXI PCIe host bridge support"
80+
depends on ARCH_ZYNQ
81+
help
82+
Say 'Y' here if you want kernel to support the Xilinx AXI PCIe
83+
Host Bridge driver.
84+
6685
endmenu

‎drivers/pci/host/Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ obj-$(CONFIG_PCI_RCAR_GEN2) += pci-rcar-gen2.o
88
obj-$(CONFIG_PCI_RCAR_GEN2_PCIE) += pcie-rcar.o
99
obj-$(CONFIG_PCI_HOST_GENERIC) += pci-host-generic.o
1010
obj-$(CONFIG_PCIE_SPEAR13XX) += pcie-spear13xx.o
11+
obj-$(CONFIG_PCI_KEYSTONE) += pci-keystone-dw.o pci-keystone.o
12+
obj-$(CONFIG_PCIE_XILINX) += pcie-xilinx.o

‎drivers/pci/host/pci-imx6.c‎

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ struct imx6_pcie {
4949

5050
/* PCIe Port Logic registers (memory-mapped) */
5151
#define PL_OFFSET 0x700
52+
#define PCIE_PL_PFLR (PL_OFFSET + 0x08)
53+
#define PCIE_PL_PFLR_LINK_STATE_MASK (0x3f << 16)
54+
#define PCIE_PL_PFLR_FORCE_LINK (1 << 15)
5255
#define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28)
5356
#define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c)
5457
#define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29)
@@ -214,6 +217,32 @@ static int imx6q_pcie_abort_handler(unsigned long addr,
214217
static int imx6_pcie_assert_core_reset(struct pcie_port *pp)
215218
{
216219
struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
220+
u32 val, gpr1, gpr12;
221+
222+
/*
223+
* If the bootloader already enabled the link we need some special
224+
* handling to get the core back into a state where it is safe to
225+
* touch it for configuration. As there is no dedicated reset signal
226+
* wired up for MX6QDL, we need to manually force LTSSM into "detect"
227+
* state before completely disabling LTSSM, which is a prerequisite
228+
* for core configuration.
229+
*
230+
* If both LTSSM_ENABLE and REF_SSP_ENABLE are active we have a strong
231+
* indication that the bootloader activated the link.
232+
*/
233+
regmap_read(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, &gpr1);
234+
regmap_read(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, &gpr12);
235+
236+
if ((gpr1 & IMX6Q_GPR1_PCIE_REF_CLK_EN) &&
237+
(gpr12 & IMX6Q_GPR12_PCIE_CTL_2)) {
238+
val = readl(pp->dbi_base + PCIE_PL_PFLR);
239+
val &= ~PCIE_PL_PFLR_LINK_STATE_MASK;
240+
val |= PCIE_PL_PFLR_FORCE_LINK;
241+
writel(val, pp->dbi_base + PCIE_PL_PFLR);
242+
243+
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
244+
IMX6Q_GPR12_PCIE_CTL_2, 0 << 10);
245+
}
217246

218247
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
219248
IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18);
@@ -589,6 +618,14 @@ static int __init imx6_pcie_probe(struct platform_device *pdev)
589618
return 0;
590619
}
591620

621+
static void imx6_pcie_shutdown(struct platform_device *pdev)
622+
{
623+
struct imx6_pcie *imx6_pcie = platform_get_drvdata(pdev);
624+
625+
/* bring down link, so bootloader gets clean state in case of reboot */
626+
imx6_pcie_assert_core_reset(&imx6_pcie->pp);
627+
}
628+
592629
static const struct of_device_id imx6_pcie_of_match[] = {
593630
{ .compatible = "fsl,imx6q-pcie", },
594631
{},
@@ -601,6 +638,7 @@ static struct platform_driver imx6_pcie_driver = {
601638
.owner = THIS_MODULE,
602639
.of_match_table = imx6_pcie_of_match,
603640
},
641+
.shutdown = imx6_pcie_shutdown,
604642
};
605643

606644
/* Freescale PCIe driver does not allow module unload */
@@ -609,7 +647,7 @@ static int __init imx6_pcie_init(void)
609647
{
610648
return platform_driver_probe(&imx6_pcie_driver, imx6_pcie_probe);
611649
}
612-
fs_initcall(imx6_pcie_init);
650+
module_init(imx6_pcie_init);
613651

614652
MODULE_AUTHOR("Sean Cross <xobs@kosagi.com>");
615653
MODULE_DESCRIPTION("Freescale i.MX6 PCIe host controller driver");

0 commit comments

Comments
 (0)