PCI: dwc: Remove hardcoded PCI_CAP_ID_EXP offset
[linux-2.6-microblaze.git] / drivers / pci / controller / dwc / pcie-spear13xx.c
index 6284656..056c945 100644 (file)
@@ -65,8 +65,6 @@ struct pcie_app_reg {
 /* CR6 */
 #define MSI_CTRL_INT                           (1 << 26)
 
-#define EXP_CAP_ID_OFFSET                      0x70
-
 #define to_spear13xx_pcie(x)   dev_get_drvdata((x)->dev)
 
 static int spear13xx_pcie_establish_link(struct spear13xx_pcie *spear13xx_pcie)
@@ -75,7 +73,7 @@ static int spear13xx_pcie_establish_link(struct spear13xx_pcie *spear13xx_pcie)
        struct pcie_port *pp = &pci->pp;
        struct pcie_app_reg *app_reg = spear13xx_pcie->app_base;
        u32 val;
-       u32 exp_cap_off = EXP_CAP_ID_OFFSET;
+       u32 exp_cap_off = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);
 
        if (dw_pcie_link_up(pci)) {
                dev_err(pci->dev, "link already up\n");