aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/controller/dwc
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2018-10-17 03:40:55 -0400
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>2018-10-17 04:38:55 -0400
commit00a2c4094f8edb07ef03a307c2a5b211e9065165 (patch)
treed07fc3e03907fd23f52367a232a9438c7245b69d /drivers/pci/controller/dwc
parent148e340c0696369fadbbddc8f4bef801ed247d71 (diff)
PCI: keystone: Use quirk to set MRRS for PCI host bridge
Reuse the already existing quirk to set MRRS for PCI host bridge instead of explicitly setting MRRS in ks_pcie_host_init(). Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Diffstat (limited to 'drivers/pci/controller/dwc')
-rw-r--r--drivers/pci/controller/dwc/pci-keystone.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c
index 7d43e10a03b0..5d9c5d199ada 100644
--- a/drivers/pci/controller/dwc/pci-keystone.c
+++ b/drivers/pci/controller/dwc/pci-keystone.c
@@ -43,7 +43,7 @@
43static void quirk_limit_mrrs(struct pci_dev *dev) 43static void quirk_limit_mrrs(struct pci_dev *dev)
44{ 44{
45 struct pci_bus *bus = dev->bus; 45 struct pci_bus *bus = dev->bus;
46 struct pci_dev *bridge = bus->self; 46 struct pci_dev *bridge;
47 static const struct pci_device_id rc_pci_devids[] = { 47 static const struct pci_device_id rc_pci_devids[] = {
48 { PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2HK), 48 { PCI_DEVICE(PCI_VENDOR_ID_TI, PCIE_RC_K2HK),
49 .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, }, 49 .class = PCI_CLASS_BRIDGE_PCI << 8, .class_mask = ~0, },
@@ -57,7 +57,7 @@ static void quirk_limit_mrrs(struct pci_dev *dev)
57 }; 57 };
58 58
59 if (pci_is_root_bus(bus)) 59 if (pci_is_root_bus(bus))
60 return; 60 bridge = dev;
61 61
62 /* look for the host bridge */ 62 /* look for the host bridge */
63 while (!pci_is_root_bus(bus)) { 63 while (!pci_is_root_bus(bus)) {
@@ -65,18 +65,19 @@ static void quirk_limit_mrrs(struct pci_dev *dev)
65 bus = bus->parent; 65 bus = bus->parent;
66 } 66 }
67 67
68 if (bridge) { 68 if (!bridge)
69 /* 69 return;
70 * Keystone PCI controller has a h/w limitation of 70
71 * 256 bytes maximum read request size. It can't handle 71 /*
72 * anything higher than this. So force this limit on 72 * Keystone PCI controller has a h/w limitation of
73 * all downstream devices. 73 * 256 bytes maximum read request size. It can't handle
74 */ 74 * anything higher than this. So force this limit on
75 if (pci_match_id(rc_pci_devids, bridge)) { 75 * all downstream devices.
76 if (pcie_get_readrq(dev) > 256) { 76 */
77 dev_info(&dev->dev, "limiting MRRS to 256\n"); 77 if (pci_match_id(rc_pci_devids, bridge)) {
78 pcie_set_readrq(dev, 256); 78 if (pcie_get_readrq(dev) > 256) {
79 } 79 dev_info(&dev->dev, "limiting MRRS to 256\n");
80 pcie_set_readrq(dev, 256);
80 } 81 }
81 } 82 }
82} 83}
@@ -264,7 +265,6 @@ static int __init ks_pcie_host_init(struct pcie_port *pp)
264{ 265{
265 struct dw_pcie *pci = to_dw_pcie_from_pp(pp); 266 struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
266 struct keystone_pcie *ks_pcie = to_keystone_pcie(pci); 267 struct keystone_pcie *ks_pcie = to_keystone_pcie(pci);
267 u32 val;
268 268
269 ks_pcie_establish_link(ks_pcie); 269 ks_pcie_establish_link(ks_pcie);
270 ks_dw_pcie_setup_rc_app_regs(ks_pcie); 270 ks_dw_pcie_setup_rc_app_regs(ks_pcie);
@@ -275,13 +275,6 @@ static int __init ks_pcie_host_init(struct pcie_port *pp)
275 /* update the Vendor ID */ 275 /* update the Vendor ID */
276 writew(ks_pcie->device_id, pci->dbi_base + PCI_DEVICE_ID); 276 writew(ks_pcie->device_id, pci->dbi_base + PCI_DEVICE_ID);
277 277
278 /* update the DEV_STAT_CTRL to publish right mrrs */
279 val = readl(pci->dbi_base + PCIE_CAP_BASE + PCI_EXP_DEVCTL);
280 val &= ~PCI_EXP_DEVCTL_READRQ;
281 /* set the mrrs to 256 bytes */
282 val |= BIT(12);
283 writel(val, pci->dbi_base + PCIE_CAP_BASE + PCI_EXP_DEVCTL);
284
285 /* 278 /*
286 * PCIe access errors that result into OCP errors are caught by ARM as 279 * PCIe access errors that result into OCP errors are caught by ARM as
287 * "External aborts" 280 * "External aborts"