PCI: tegra: Disable AFI dynamic clock gating [Linux 5.3]

This Linux kernel change "PCI: tegra: Disable AFI dynamic clock gating" is included in the Linux 5.3 release. This change is authored by Manikanta Maddireddy <mmaddireddy [at] nvidia.com> on Tue Jun 18 23:31:49 2019 +0530. The commit for this change in Linux stable tree is 92bd94f (patch).

PCI: tegra: Disable AFI dynamic clock gating

Outstanding write counter in AFI is used to generate idle signal to
dynamically gate the AFI clock. When there are 32 outstanding writes
from AFI to memory, the outstanding write counter overflows and
indicates that there are "0" outstanding write transactions.

When memory controller is under heavy load, write completions to AFI
gets delayed and AFI write counter overflows. This causes AFI clock gating
even when there are outstanding transactions towards memory controller
resulting in a system hang.

Disable dynamic clock gating of AFI clock to avoid system hang.

CLKEN_OVERRIDE bit is not defined in Tegra20 and Tegra30, however
programming this bit doesn't cause any side effects. Program this
bit for all Tegra SoCs to avoid conditional check.

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 6 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

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

diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
index cd69c43..3238db2 100644
--- a/drivers/pci/controller/pci-tegra.c
+++ b/drivers/pci/controller/pci-tegra.c
@@ -95,7 +95,8 @@
 #define AFI_MSI_EN_VEC7        0xa8

 #define AFI_CONFIGURATION      0xac
-#define  AFI_CONFIGURATION_EN_FPCI (1 << 0)
+#define  AFI_CONFIGURATION_EN_FPCI     (1 << 0)

 #define AFI_FPCI_ERROR_MASKS   0xb0

@@ -1065,9 +1066,10 @@ static void tegra_pcie_enable_controller(struct tegra_pcie *pcie)
        afi_writel(pcie, value, AFI_FUSE);

-   /* finally enable PCIe */
+   /* Disable AFI dynamic clock gating and enable PCIe */
    value = afi_readl(pcie, AFI_CONFIGURATION);
    afi_writel(pcie, value, AFI_CONFIGURATION);


Leave a Reply

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