PCI: tegra: Add AFI_PEX2_CTRL reg offset as part of SoC struct [Linux 5.3]

This Linux kernel change "PCI: tegra: Add AFI_PEX2_CTRL reg offset as part of SoC struct" is included in the Linux 5.3 release. This change is authored by Manikanta Maddireddy <mmaddireddy [at] nvidia.com> on Tue Jun 18 23:32:00 2019 +0530. The commit for this change in Linux stable tree is adb2653 (patch).

PCI: tegra: Add AFI_PEX2_CTRL reg offset as part of SoC struct

Tegra186 and Tegra30 have three PCIe root ports. AFI_PEX2_CTRL register
is defined for third root port. Offset of this register in Tegra186 is
different from Tegra30, so add the offset as part of SoC data structure.

Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Thierry Reding <treding@nvidia.com>

There are 7 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/pci/controller/pci-tegra.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
index adc50da..6be4ea7 100644
--- a/drivers/pci/controller/pci-tegra.c
+++ b/drivers/pci/controller/pci-tegra.c
@@ -168,7 +168,6 @@

 #define AFI_PEX0_CTRL          0x110
 #define AFI_PEX1_CTRL          0x118
-#define AFI_PEX2_CTRL          0x128
 #define  AFI_PEX_CTRL_RST      (1 << 0)
 #define  AFI_PEX_CTRL_CLKREQ_EN        (1 << 1)
 #define  AFI_PEX_CTRL_REFCLK_EN        (1 << 3)
@@ -307,6 +306,7 @@ struct tegra_pcie_soc {
    unsigned int num_ports;
    const struct tegra_pcie_port_soc *ports;
    unsigned int msi_base_shift;
+   unsigned long afi_pex2_ctrl;
    u32 pads_pll_ctl;
    u32 tx_ref_sel;
    u32 pads_refclk_cfg0;
@@ -517,6 +517,7 @@ static int tegra_pcie_config_write(struct pci_bus *bus, unsigned int devfn,

 static unsigned long tegra_pcie_port_get_pex_ctrl(struct tegra_pcie_port *port)
 {
+   const struct tegra_pcie_soc *soc = port->pcie->soc;
    unsigned long ret = 0;

    switch (port->index) {
@@ -529,7 +530,7 @@ static unsigned long tegra_pcie_port_get_pex_ctrl(struct tegra_pcie_port *port)
        break;

    case 2:
-       ret = AFI_PEX2_CTRL;
+       ret = soc->afi_pex2_ctrl;
        break;
    }

@@ -2449,6 +2450,7 @@ static void tegra_pcie_disable_ports(struct tegra_pcie *pcie)
    .num_ports = 2,
    .ports = tegra20_pcie_ports,
    .msi_base_shift = 0,
+   .afi_pex2_ctrl = 0x128,
    .pads_pll_ctl = PADS_PLL_CTL_TEGRA20,
    .tx_ref_sel = PADS_PLL_CTL_TXCLKREF_DIV10,
    .pads_refclk_cfg0 = 0xfa5cfa5c,
@@ -2566,6 +2568,7 @@ static void tegra_pcie_disable_ports(struct tegra_pcie *pcie)
    .num_ports = 3,
    .ports = tegra186_pcie_ports,
    .msi_base_shift = 8,
+   .afi_pex2_ctrl = 0x19c,
    .pads_pll_ctl = PADS_PLL_CTL_TEGRA30,
    .tx_ref_sel = PADS_PLL_CTL_TXCLKREF_BUF_EN,
    .pads_refclk_cfg0 = 0x80b880b8,

Leave a Reply

Your email address will not be published. Required fields are marked *