ipq806x: fix wireless regression
[openwrt/openwrt.git] / target / linux / ipq806x / patches-4.9 / 0071-4-PCIE-designware-Fixed-PCI-host-init.patch
1 From e833cdb5c792912d459773cc23153e5d78875d34 Mon Sep 17 00:00:00 2001
2 From: Sham Muthayyan <smuthayy@codeaurora.org>
3 Date: Tue, 19 Jul 2016 20:05:25 +0530
4 Subject: PCIE: designware: Fixed PCI host init
5
6 Change-Id: I949b302d77199fc09342acf26b7bb45a7ec467ee
7 Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
8 ---
9 drivers/pci/host/pcie-designware.c | 9 +++++++--
10 drivers/pci/host/pcie-designware.h | 2 +-
11 drivers/pci/host/pcie-qcom.c | 5 +++--
12 3 files changed, 11 insertions(+), 5 deletions(-)
13
14 --- a/drivers/pci/host/pcie-designware.c
15 +++ b/drivers/pci/host/pcie-designware.c
16 @@ -637,8 +637,13 @@ int dw_pcie_host_init(struct pcie_port *
17 }
18 }
19
20 - if (pp->ops->host_init)
21 - pp->ops->host_init(pp);
22 + if (pp->ops->host_init) {
23 + ret = pp->ops->host_init(pp);
24 + if (ret) {
25 + dev_err(pp->dev, "hostinit failed\n");
26 + return 0;
27 + }
28 + }
29
30 pp->root_bus_nr = pp->busn->start;
31 if (IS_ENABLED(CONFIG_PCI_MSI)) {
32 --- a/drivers/pci/host/pcie-designware.h
33 +++ b/drivers/pci/host/pcie-designware.h
34 @@ -63,7 +63,7 @@ struct pcie_host_ops {
35 int (*wr_other_conf)(struct pcie_port *pp, struct pci_bus *bus,
36 unsigned int devfn, int where, int size, u32 val);
37 int (*link_up)(struct pcie_port *pp);
38 - void (*host_init)(struct pcie_port *pp);
39 + int (*host_init)(struct pcie_port *pp);
40 void (*msi_set_irq)(struct pcie_port *pp, int irq);
41 void (*msi_clear_irq)(struct pcie_port *pp, int irq);
42 phys_addr_t (*get_msi_addr)(struct pcie_port *pp);
43 --- a/drivers/pci/host/pcie-qcom.c
44 +++ b/drivers/pci/host/pcie-qcom.c
45 @@ -515,7 +515,7 @@ static int qcom_pcie_link_up(struct pcie
46 return !!(val & PCI_EXP_LNKSTA_DLLLA);
47 }
48
49 -static void qcom_pcie_host_init(struct pcie_port *pp)
50 +static int qcom_pcie_host_init(struct pcie_port *pp)
51 {
52 struct qcom_pcie *pcie = to_qcom_pcie(pp);
53 int ret;
54 @@ -541,12 +541,13 @@ static void qcom_pcie_host_init(struct p
55 if (ret)
56 goto err;
57
58 - return;
59 + return 0;
60 err:
61 qcom_ep_reset_assert(pcie);
62 phy_power_off(pcie->phy);
63 err_deinit:
64 pcie->ops->deinit(pcie);
65 + return ret;
66 }
67
68 static int qcom_pcie_rd_own_conf(struct pcie_port *pp, int where, int size,