]> git.sur5r.net Git - u-boot/blobdiff - drivers/pci/pci_tegra.c
Merge branch 'master' of git://git.denx.de/u-boot-spi
[u-boot] / drivers / pci / pci_tegra.c
index b5bd25ec563a0e36425ec5fba70bbc702f715423..56c08585e6da54ae841af86b743f1e127cb80bd0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2010, CompuLab, Ltd.
  * Author: Mike Rapoport <mike@compulab.co.il>
@@ -6,8 +7,6 @@
  * Copyright (c) 2008-2009, NVIDIA Corporation.
  *
  * Copyright (c) 2013-2014, NVIDIA Corporation.
- *
- * SPDX-License-Identifier:    GPL-2.0
  */
 
 #define pr_fmt(fmt) "tegra-pcie: " fmt
@@ -18,6 +17,7 @@
 #include <errno.h>
 #include <malloc.h>
 #include <pci.h>
+#include <pci_tegra.h>
 #include <power-domain.h>
 #include <reset.h>
 
@@ -43,8 +43,6 @@
  * use the new standard APIs, with no ifdefs.
  */
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #define AFI_AXI_BAR0_SZ        0x00
 #define AFI_AXI_BAR1_SZ        0x04
 #define AFI_AXI_BAR2_SZ        0x08
@@ -891,7 +889,7 @@ static unsigned long tegra_pcie_port_get_pex_ctrl(struct tegra_pcie_port *port)
        return ret;
 }
 
-static void tegra_pcie_port_reset(struct tegra_pcie_port *port)
+void tegra_pcie_port_reset(struct tegra_pcie_port *port)
 {
        unsigned long ctrl = tegra_pcie_port_get_pex_ctrl(port);
        unsigned long value;
@@ -908,6 +906,16 @@ static void tegra_pcie_port_reset(struct tegra_pcie_port *port)
        afi_writel(port->pcie, value, ctrl);
 }
 
+int tegra_pcie_port_index_of_port(struct tegra_pcie_port *port)
+{
+       return port->index;
+}
+
+void __weak tegra_pcie_board_port_reset(struct tegra_pcie_port *port)
+{
+       tegra_pcie_port_reset(port);
+}
+
 static void tegra_pcie_port_enable(struct tegra_pcie_port *port)
 {
        struct tegra_pcie *pcie = port->pcie;
@@ -926,7 +934,7 @@ static void tegra_pcie_port_enable(struct tegra_pcie_port *port)
 
        afi_writel(pcie, value, ctrl);
 
-       tegra_pcie_port_reset(port);
+       tegra_pcie_board_port_reset(port);
 
        if (soc->force_pca_enable) {
                value = rp_readl(port, RP_VEND_CTL2);
@@ -977,7 +985,7 @@ static bool tegra_pcie_port_check_link(struct tegra_pcie_port *port)
                } while (--timeout);
 
 retry:
-               tegra_pcie_port_reset(port);
+               tegra_pcie_board_port_reset(port);
        } while (--retries);
 
        return false;