mvebu: remove redundant patch for Linksys LED trigger
[openwrt/openwrt.git] / target / linux / mvebu / patches-5.4 / 401-pci-mvebu-time-out-reset-on-link-up.patch
1 From 287b9df160b6159f8d385424904f8bac501280c1 Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk+kernel@armlinux.org.uk>
3 Date: Sat, 9 Jul 2016 10:58:16 +0100
4 Subject: pci: mvebu: time out reset on link up
5
6 If the port reports that the link is up while we are resetting, there's
7 little point in waiting for the full duration.
8
9 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
10 ---
11 drivers/pci/controller/pci-mvebu.c | 20 ++++++++++++++------
12 1 file changed, 14 insertions(+), 6 deletions(-)
13
14 --- a/drivers/pci/controller/pci-mvebu.c
15 +++ b/drivers/pci/controller/pci-mvebu.c
16 @@ -928,6 +928,7 @@ static int mvebu_pcie_powerup(struct mve
17
18 if (port->reset_gpio) {
19 u32 reset_udelay = PCI_PM_D3COLD_WAIT * 1000;
20 + unsigned int i;
21
22 of_property_read_u32(port->dn, "reset-delay-us",
23 &reset_udelay);
24 @@ -935,7 +936,13 @@ static int mvebu_pcie_powerup(struct mve
25 udelay(100);
26
27 gpiod_set_value_cansleep(port->reset_gpio, 0);
28 - msleep(reset_udelay / 1000);
29 + for (i = 0; i < reset_udelay; i += 1000) {
30 + if (mvebu_pcie_link_up(port))
31 + break;
32 + msleep(1);
33 + }
34 +
35 + printk("%s: reset completed in %dus\n", port->name, i);
36 }
37
38 return 0;
39 @@ -1099,15 +1106,16 @@ static int mvebu_pcie_probe(struct platf
40 if (!child)
41 continue;
42
43 - ret = mvebu_pcie_powerup(port);
44 - if (ret < 0)
45 - continue;
46 -
47 port->base = mvebu_pcie_map_registers(pdev, child, port);
48 if (IS_ERR(port->base)) {
49 dev_err(dev, "%s: cannot map registers\n", port->name);
50 port->base = NULL;
51 - mvebu_pcie_powerdown(port);
52 + continue;
53 + }
54 +
55 + ret = mvebu_pcie_powerup(port);
56 + if (ret < 0) {
57 + port->base = NULL;
58 continue;
59 }
60