pci: tegra: introduce weak tegra_pcie_board_port_reset() function

Introduce a weak tegra_pcie_board_port_reset() function by default
calling the existing tegra_pcie_port_reset() function. Additionally add
a tegra_pcie_port_index_of_port() function to retrieve the specific PCIe
port index if required. This allows overriding the PCIe port reset
functionality from board specific code as e.g. required for Apalis T30
and Apalis TK1.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
lime2-spi
Marcel Ziswiler 6 years ago committed by Tom Warren
parent 4616e33b6a
commit 355560d588
  1. 17
      drivers/pci/pci_tegra.c
  2. 10
      include/pci_tegra.h

@ -17,6 +17,7 @@
#include <errno.h>
#include <malloc.h>
#include <pci.h>
#include <pci_tegra.h>
#include <power-domain.h>
#include <reset.h>
@ -888,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;
@ -905,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;
@ -923,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);
@ -974,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;

@ -0,0 +1,10 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (c) 2018 Toradex, Inc.
*/
struct tegra_pcie_port;
int tegra_pcie_port_index_of_port(struct tegra_pcie_port *port);
void tegra_pcie_port_reset(struct tegra_pcie_port *port);
Loading…
Cancel
Save