Commit cf854be2 authored by Rob Herring's avatar Rob Herring Committed by Lorenzo Pieralisi

PCI: dwc/intel-gw: Move getting PCI_CAP_ID_EXP offset to intel_pcie_link_setup()

The PCI_CAP_ID_EXP offset is only needed by intel_pcie_link_setup(), so
let's retrieve it there and avoid storing the offset.

Link: https://lore.kernel.org/r/20200821035420.380495-38-robh@kernel.orgSigned-off-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Dilip Kota <eswara.kota@linux.intel.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
parent b02b06a7
...@@ -72,7 +72,6 @@ struct intel_pcie_port { ...@@ -72,7 +72,6 @@ struct intel_pcie_port {
struct clk *core_clk; struct clk *core_clk;
struct reset_control *core_rst; struct reset_control *core_rst;
struct phy *phy; struct phy *phy;
u8 pcie_cap_ofst;
}; };
static void pcie_update_bits(void __iomem *base, u32 ofs, u32 mask, u32 val) static void pcie_update_bits(void __iomem *base, u32 ofs, u32 mask, u32 val)
...@@ -132,7 +131,7 @@ static void intel_pcie_ltssm_disable(struct intel_pcie_port *lpp) ...@@ -132,7 +131,7 @@ static void intel_pcie_ltssm_disable(struct intel_pcie_port *lpp)
static void intel_pcie_link_setup(struct intel_pcie_port *lpp) static void intel_pcie_link_setup(struct intel_pcie_port *lpp)
{ {
u32 val; u32 val;
u8 offset = lpp->pcie_cap_ofst; u8 offset = dw_pcie_find_capability(&lpp->pci, PCI_CAP_ID_EXP);
val = pcie_rc_cfg_rd(lpp, offset + PCI_EXP_LNKCAP); val = pcie_rc_cfg_rd(lpp, offset + PCI_EXP_LNKCAP);
lpp->max_width = FIELD_GET(PCI_EXP_LNKCAP_MLW, val); lpp->max_width = FIELD_GET(PCI_EXP_LNKCAP_MLW, val);
...@@ -328,7 +327,6 @@ static void intel_pcie_turn_off(struct intel_pcie_port *lpp) ...@@ -328,7 +327,6 @@ static void intel_pcie_turn_off(struct intel_pcie_port *lpp)
static int intel_pcie_host_setup(struct intel_pcie_port *lpp) static int intel_pcie_host_setup(struct intel_pcie_port *lpp)
{ {
struct device *dev = lpp->pci.dev;
int ret; int ret;
intel_pcie_core_rst_assert(lpp); intel_pcie_core_rst_assert(lpp);
...@@ -346,17 +344,6 @@ static int intel_pcie_host_setup(struct intel_pcie_port *lpp) ...@@ -346,17 +344,6 @@ static int intel_pcie_host_setup(struct intel_pcie_port *lpp)
goto clk_err; goto clk_err;
} }
if (!lpp->pcie_cap_ofst) {
ret = dw_pcie_find_capability(&lpp->pci, PCI_CAP_ID_EXP);
if (!ret) {
ret = -ENXIO;
dev_err(dev, "Invalid PCIe capability offset\n");
goto app_init_err;
}
lpp->pcie_cap_ofst = ret;
}
intel_pcie_rc_setup(lpp); intel_pcie_rc_setup(lpp);
ret = intel_pcie_app_logic_setup(lpp); ret = intel_pcie_app_logic_setup(lpp);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment