Skip to content

Commit cf854be

Browse files
robherringLorenzo Pieralisi
authored andcommitted
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.org Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Lorenzo 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>
1 parent b02b06a commit cf854be

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

‎drivers/pci/controller/dwc/pcie-intel-gw.c‎

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ struct intel_pcie_port {
7272
struct clk *core_clk;
7373
struct reset_control *core_rst;
7474
struct phy *phy;
75-
u8 pcie_cap_ofst;
7675
};
7776

7877
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)
132131
static void intel_pcie_link_setup(struct intel_pcie_port *lpp)
133132
{
134133
u32 val;
135-
u8 offset = lpp->pcie_cap_ofst;
134+
u8 offset = dw_pcie_find_capability(&lpp->pci, PCI_CAP_ID_EXP);
136135

137136
val = pcie_rc_cfg_rd(lpp, offset + PCI_EXP_LNKCAP);
138137
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)
328327

329328
static int intel_pcie_host_setup(struct intel_pcie_port *lpp)
330329
{
331-
struct device *dev = lpp->pci.dev;
332330
int ret;
333331

334332
intel_pcie_core_rst_assert(lpp);
@@ -346,17 +344,6 @@ static int intel_pcie_host_setup(struct intel_pcie_port *lpp)
346344
goto clk_err;
347345
}
348346

349-
if (!lpp->pcie_cap_ofst) {
350-
ret = dw_pcie_find_capability(&lpp->pci, PCI_CAP_ID_EXP);
351-
if (!ret) {
352-
ret = -ENXIO;
353-
dev_err(dev, "Invalid PCIe capability offset\n");
354-
goto app_init_err;
355-
}
356-
357-
lpp->pcie_cap_ofst = ret;
358-
}
359-
360347
intel_pcie_rc_setup(lpp);
361348
ret = intel_pcie_app_logic_setup(lpp);
362349
if (ret)

0 commit comments

Comments
 (0)