pcie: power on pcie in the probe.
authorYue Wang <yue.wang@amlogic.com>
Tue, 13 Jun 2017 03:05:06 +0000 (11:05 +0800)
committerVictor Wan <victor.wan@amlogic.com>
Thu, 15 Jun 2017 10:16:57 +0000 (03:16 -0700)
PD#146002: pcie: power on pcie in the probe.

Change-Id: I36ec41c19a7d6bfbe364ddefeaa2c48f181d5d3b
Signed-off-by: Yue Wang <yue.wang@amlogic.com>
drivers/amlogic/pci/pcie-amlogic.c

index 0d5601b..9137752 100644 (file)
@@ -678,6 +678,23 @@ static int __init amlogic_pcie_probe(struct platform_device *pdev)
        if (amlogic_pcie->pcie_num == 1)
                g_amlogic_pcie = amlogic_pcie;
 
+       if (amlogic_pcie->pcie_num == 1) {
+               phy_base = platform_get_resource_byname(
+                       pdev, IORESOURCE_MEM, "phy");
+               amlogic_pcie->phy_base = devm_ioremap_resource(dev, phy_base);
+               if (IS_ERR(amlogic_pcie->phy_base)) {
+                       ret = PTR_ERR(amlogic_pcie->phy_base);
+                       return ret;
+               }
+               for (j = 0; j < 7; j++)
+                       pcie_aml_regs.pcie_phy_r[j] = (void __iomem *)
+                               ((unsigned long)amlogic_pcie->phy_base + 4*j);
+               writel(0x1c, pcie_aml_regs.pcie_phy_r[0]);
+       } else {
+               amlogic_pcie->phy_base = g_amlogic_pcie->phy_base;
+       }
+
+
        ret = of_property_read_u32(np, "board-type", &board_type);
        amlogic_pcie->board_type = board_type;
 
@@ -722,21 +739,6 @@ static int __init amlogic_pcie_probe(struct platform_device *pdev)
                goto fail_bus_clk;
        }
 
-       if (amlogic_pcie->pcie_num == 1) {
-               phy_base = platform_get_resource_byname(
-                       pdev, IORESOURCE_MEM, "phy");
-               amlogic_pcie->phy_base = devm_ioremap_resource(dev, phy_base);
-               if (IS_ERR(amlogic_pcie->phy_base)) {
-                       ret = PTR_ERR(amlogic_pcie->phy_base);
-                       goto fail_bus_clk;
-               }
-               for (j = 0; j < 7; j++)
-                       pcie_aml_regs.pcie_phy_r[j] = (void __iomem *)
-                               ((unsigned long)amlogic_pcie->phy_base + 4*j);
-       } else {
-               amlogic_pcie->phy_base = g_amlogic_pcie->phy_base;
-       }
-
        cfg_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg");
        amlogic_pcie->cfg_base = devm_ioremap_resource(dev, cfg_base);
        if (IS_ERR(amlogic_pcie->cfg_base)) {