Skip to content

Commit ef39ab7

Browse files
committed
Merge branches 'pci/host-designware', 'pci/host-imx6', 'pci/host-keystone', 'pci/host-tegra' and 'pci/host-xilinx' into next
* pci/host-designware: PCI: designware: Fold struct pcie_port_info into struct pcie_port * pci/host-imx6: PCI: imx6: Delay enabling reference clock for SS until it stabilizes * pci/host-keystone: PCI: keystone: Set device ID based on SoC to support multiple ports PCI: keystone: Assume controller is already in RC mode PCI: keystone: Limit MRSS for all downstream devices * pci/host-tegra: PCI: tegra: Add Tegra124 support PCI: tegra: Make sure the PCIe PLL is really reset PCI: tegra: Fix extended configuration space mapping PCI: tegra: Clear CLKREQ# enable on port disable * pci/host-xilinx: PCI: xilinx: Fix xilinx_pcie_assign_msi() return value test
6 parents 134cd00 + adf70fc + 3fce0e8 + 8665a48 + 7f1f054 + f9dd0ce commit ef39ab7

9 files changed

Lines changed: 313 additions & 109 deletions

File tree

‎Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
NVIDIA Tegra PCIe controller
22

33
Required properties:
4-
- compatible: "nvidia,tegra20-pcie" or "nvidia,tegra30-pcie"
4+
- compatible: Must be one of:
5+
- "nvidia,tegra20-pcie"
6+
- "nvidia,tegra30-pcie"
7+
- "nvidia,tegra124-pcie"
58
- device_type: Must be "pci"
69
- reg: A list of physical base address and length for each set of controller
710
registers. Must contain an entry for each entry in the reg-names property.
@@ -57,6 +60,11 @@ Required properties:
5760
- afi
5861
- pcie_x
5962

63+
Required properties on Tegra124 and later:
64+
- phys: Must contain an entry for each entry in phy-names.
65+
- phy-names: Must include the following entries:
66+
- pcie
67+
6068
Power supplies for Tegra20:
6169
- avdd-pex-supply: Power supply for analog PCIe logic. Must supply 1.05 V.
6270
- vdd-pex-supply: Power supply for digital PCIe I/O. Must supply 1.05 V.
@@ -84,6 +92,21 @@ Power supplies for Tegra30:
8492
- avdd-pexb-supply: Power supply for analog PCIe logic. Must supply 1.05 V.
8593
- vdd-pexb-supply: Power supply for digital PCIe I/O. Must supply 1.05 V.
8694

95+
Power supplies for Tegra124:
96+
- Required:
97+
- avddio-pex-supply: Power supply for analog PCIe logic. Must supply 1.05 V.
98+
- dvddio-pex-supply: Power supply for digital PCIe I/O. Must supply 1.05 V.
99+
- avdd-pex-pll-supply: Power supply for dedicated (internal) PCIe PLL. Must
100+
supply 1.05 V.
101+
- hvdd-pex-supply: High-voltage supply for PCIe I/O and PCIe output clocks.
102+
Must supply 3.3 V.
103+
- hvdd-pex-pll-e-supply: High-voltage supply for PLLE (shared with USB3).
104+
Must supply 3.3 V.
105+
- vddio-pex-ctl-supply: Power supply for PCIe control I/O partition. Must
106+
supply 2.8-3.3 V.
107+
- avdd-pll-erefe-supply: Power supply for PLLE (shared with USB3). Must
108+
supply 1.05 V.
109+
87110
Root ports are defined as subnodes of the PCIe controller node.
88111

89112
Required properties:

‎Documentation/devicetree/bindings/pci/pci-keystone.txt‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ Required Properties:-
1313

1414
compatibility: "ti,keystone-pcie"
1515
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.
16+
index 2 is the base address and length of PCI device ID register.
1917

2018
pcie_msi_intc : Interrupt controller device node for MSI IRQ chip
2119
interrupt-cells: should be set to 1
@@ -63,6 +61,3 @@ Designware DT Properties not applicable for Keystone PCI
6361

6462
1. pcie_bus clock-names not used. Instead, a phandle to phys is used.
6563

66-
Note for PCI driver usage
67-
=========================
68-
Driver requires pci=pcie_bus_perf in the bootargs for proper functioning.

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,6 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
257257
struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
258258
int ret;
259259

260-
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
261-
IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
262-
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
263-
IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
264-
265260
ret = clk_prepare_enable(imx6_pcie->pcie_phy);
266261
if (ret) {
267262
dev_err(pp->dev, "unable to enable pcie_phy clock\n");
@@ -283,6 +278,12 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
283278
/* allow the clocks to stabilize */
284279
usleep_range(200, 500);
285280

281+
/* power up core phy and enable ref clock */
282+
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
283+
IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18);
284+
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
285+
IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16);
286+
286287
/* Some boards don't have PCIe reset GPIO. */
287288
if (gpio_is_valid(imx6_pcie->reset_gpio)) {
288289
gpio_set_value(imx6_pcie->reset_gpio, 0);

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

Lines changed: 52 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,56 @@
3535
#define MAX_MSI_HOST_IRQS 8
3636
#define MAX_LEGACY_HOST_IRQS 4
3737

38-
/* RC mode settings masks */
39-
#define PCIE_RC_MODE BIT(2)
40-
#define PCIE_MODE_MASK (BIT(1) | BIT(2))
41-
4238
/* DEV_STAT_CTRL */
4339
#define PCIE_CAP_BASE 0x70
4440

41+
/* PCIE controller device IDs */
42+
#define PCIE_RC_K2HK 0xb008
43+
#define PCIE_RC_K2E 0xb009
44+
#define PCIE_RC_K2L 0xb00a
45+
4546
#define to_keystone_pcie(x) container_of(x, struct keystone_pcie, pp)
4647

48+
static void quirk_limit_mrrs(struct pci_dev *dev)
49+
{
50+
struct pci_bus *bus = dev->bus;
51+
struct pci_dev *bridge = bus->self;
52+
static const struct pci_device_id rc_pci_devids[] = {
53+
{ PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2HK),
54+
.class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, },
55+
{ PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2E),
56+
.class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, },
57+
{ PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2L),
58+
.class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, },
59+
{ 0, },
60+
};
61+
62+
if (pci_is_root_bus(bus))
63+
return;
64+
65+
/* look for the host bridge */
66+
while (!pci_is_root_bus(bus)) {
67+
bridge = bus->self;
68+
bus = bus->parent;
69+
}
70+
71+
if (bridge) {
72+
/*
73+
* Keystone PCI controller has a h/w limitation of
74+
* 256 bytes maximum read request size. It can't handle
75+
* anything higher than this. So force this limit on
76+
* all downstream devices.
77+
*/
78+
if (pci_match_id(rc_pci_devids, bridge)) {
79+
if (pcie_get_readrq(dev) > 256) {
80+
dev_info(&dev->dev, "limiting MRRS to 256\n");
81+
pcie_set_readrq(dev, 256);
82+
}
83+
}
84+
}
85+
}
86+
DECLARE_PCI_FIXUP_ENABLE(PCI_ANY_ID, PCI_ANY_ID, quirk_limit_mrrs);
87+
4788
static int ks_pcie_establish_link(struct keystone_pcie *ks_pcie)
4889
{
4990
struct pcie_port *pp = &ks_pcie->pp;
@@ -212,8 +253,8 @@ static int keystone_pcie_fault(unsigned long addr, unsigned int fsr,
212253

213254
static void __init ks_pcie_host_init(struct pcie_port *pp)
214255
{
215-
u32 vendor_device_id, val;
216256
struct keystone_pcie *ks_pcie = to_keystone_pcie(pp);
257+
u32 val;
217258

218259
ks_pcie_establish_link(ks_pcie);
219260
ks_dw_pcie_setup_rc_app_regs(ks_pcie);
@@ -222,8 +263,7 @@ static void __init ks_pcie_host_init(struct pcie_port *pp)
222263
pp->dbi_base + PCI_IO_BASE);
223264

224265
/* update the Vendor ID */
225-
vendor_device_id = readl(ks_pcie->va_reg_pciid);
226-
writew((vendor_device_id >> 16), pp->dbi_base + PCI_DEVICE_ID);
266+
writew(ks_pcie->device_id, pp->dbi_base + PCI_DEVICE_ID);
227267

228268
/* update the DEV_STAT_CTRL to publish right mrrs */
229269
val = readl(pp->dbi_base + PCIE_CAP_BASE + PCI_EXP_DEVCTL);
@@ -310,7 +350,6 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
310350
void __iomem *reg_p;
311351
struct phy *phy;
312352
int ret = 0;
313-
u32 val;
314353

315354
ks_pcie = devm_kzalloc(&pdev->dev, sizeof(*ks_pcie),
316355
GFP_KERNEL);
@@ -320,18 +359,6 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
320359
}
321360
pp = &ks_pcie->pp;
322361

323-
/* index 2 is the devcfg register for RC mode settings */
324-
res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
325-
reg_p = devm_ioremap_resource(dev, res);
326-
if (IS_ERR(reg_p))
327-
return PTR_ERR(reg_p);
328-
329-
/* enable RC mode in devcfg */
330-
val = readl(reg_p);
331-
val &= ~PCIE_MODE_MASK;
332-
val |= PCIE_RC_MODE;
333-
writel(val, reg_p);
334-
335362
/* initialize SerDes Phy if present */
336363
phy = devm_phy_get(dev, "pcie-phy");
337364
if (!IS_ERR_OR_NULL(phy)) {
@@ -340,12 +367,14 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
340367
return ret;
341368
}
342369

343-
/* index 3 is to read PCI DEVICE_ID */
344-
res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
370+
/* index 2 is to read PCI DEVICE_ID */
371+
res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
345372
reg_p = devm_ioremap_resource(dev, res);
346373
if (IS_ERR(reg_p))
347374
return PTR_ERR(reg_p);
348-
ks_pcie->va_reg_pciid = reg_p;
375+
ks_pcie->device_id = readl(reg_p) >> 16;
376+
devm_iounmap(dev, reg_p);
377+
devm_release_mem_region(dev, res->start, resource_size(res));
349378

350379
pp->dev = dev;
351380
platform_set_drvdata(pdev, ks_pcie);

‎drivers/pci/host/pci-keystone.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
struct keystone_pcie {
2020
struct clk *clk;
2121
struct pcie_port pp;
22-
void __iomem *va_reg_pciid;
23-
22+
/* PCI Device ID */
23+
u32 device_id;
2424
int num_legacy_host_irqs;
2525
int legacy_host_irqs[MAX_LEGACY_HOST_IRQS];
2626
struct device_node *legacy_intc_np;

0 commit comments

Comments
 (0)