PCI: dwc: Move dw_pcie_setup_rc() to DWC common code
[linux-2.6-microblaze.git] / drivers / pci / controller / dwc / pcie-histb.c
index afc1abb..86f9d16 100644 (file)
@@ -169,40 +169,32 @@ static int histb_pcie_link_up(struct dw_pcie *pci)
        return 0;
 }
 
-static int histb_pcie_establish_link(struct pcie_port *pp)
+static int histb_pcie_start_link(struct dw_pcie *pci)
 {
-       struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
        struct histb_pcie *hipcie = to_histb_pcie(pci);
        u32 regval;
 
-       if (dw_pcie_link_up(pci)) {
-               dev_info(pci->dev, "Link already up\n");
-               return 0;
-       }
-
-       /* PCIe RC work mode */
-       regval = histb_pcie_readl(hipcie, PCIE_SYS_CTRL0);
-       regval &= ~PCIE_DEVICE_TYPE_MASK;
-       regval |= PCIE_WM_RC;
-       histb_pcie_writel(hipcie, PCIE_SYS_CTRL0, regval);
-
-       /* setup root complex */
-       dw_pcie_setup_rc(pp);
-
        /* assert LTSSM enable */
        regval = histb_pcie_readl(hipcie, PCIE_SYS_CTRL7);
        regval |= PCIE_APP_LTSSM_ENABLE;
        histb_pcie_writel(hipcie, PCIE_SYS_CTRL7, regval);
 
-       return dw_pcie_wait_for_link(pci);
+       return 0;
 }
 
 static int histb_pcie_host_init(struct pcie_port *pp)
 {
+       struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+       struct histb_pcie *hipcie = to_histb_pcie(pci);
+       u32 regval;
+
        pp->bridge->ops = &histb_pci_ops;
 
-       histb_pcie_establish_link(pp);
-       dw_pcie_msi_init(pp);
+       /* PCIe RC work mode */
+       regval = histb_pcie_readl(hipcie, PCIE_SYS_CTRL0);
+       regval &= ~PCIE_DEVICE_TYPE_MASK;
+       regval |= PCIE_WM_RC;
+       histb_pcie_writel(hipcie, PCIE_SYS_CTRL0, regval);
 
        return 0;
 }
@@ -300,6 +292,7 @@ static const struct dw_pcie_ops dw_pcie_ops = {
        .read_dbi = histb_pcie_read_dbi,
        .write_dbi = histb_pcie_write_dbi,
        .link_up = histb_pcie_link_up,
+       .start_link = histb_pcie_start_link,
 };
 
 static int histb_pcie_probe(struct platform_device *pdev)
@@ -400,12 +393,6 @@ static int histb_pcie_probe(struct platform_device *pdev)
                return PTR_ERR(hipcie->bus_reset);
        }
 
-       if (IS_ENABLED(CONFIG_PCI_MSI)) {
-               pp->msi_irq = platform_get_irq_byname(pdev, "msi");
-               if (pp->msi_irq < 0)
-                       return pp->msi_irq;
-       }
-
        hipcie->phy = devm_phy_get(dev, "phy");
        if (IS_ERR(hipcie->phy)) {
                dev_info(dev, "no pcie-phy found\n");