]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
pcie: host: tegra: enable refclk during boot
authorVidya Sagar <vidyas@nvidia.com>
Wed, 17 Dec 2014 13:28:40 +0000 (18:58 +0530)
committerLaxman Dewangan <ldewangan@nvidia.com>
Wed, 24 Dec 2014 13:14:39 +0000 (05:14 -0800)
override refclk control and enable it always
(irrespective of the state of CLKREQ#) during boot,
and remove override after enumeration is done

Bug 200066253

Change-Id: I430135fb2bb52196a9a9d65329213a5103185c45
Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
Reviewed-on: http://git-master/r/665054
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
drivers/pci/host/pci-tegra.c

index 3c7d11a456c79994ada47b4224bd2fd3668f4863..109b8e4e27ceeaa1115ed7ee095cb8ce6454cca2 100644 (file)
@@ -1614,9 +1614,11 @@ static void tegra_pcie_port_enable(struct tegra_pcie_port *port)
 
        PR_FUNC_LINE;
 
-       /* enable reference clock */
+       /* enable reference clock. Enable SW override so as to allow device
+          to get enumerated. SW override will be removed after enumeration
+       */
        value = afi_readl(port->pcie, ctrl);
-       value |= AFI_PEX_CTRL_REFCLK_EN;
+       value |= (AFI_PEX_CTRL_REFCLK_EN | AFI_PEX_CTRL_OVERRIDE_EN);
        /* t124 doesn't support pll power down due to RTL bug and some */
        /* platforms don't support clkreq, both needs to disable clkreq and */
        /* enable refclk override to have refclk always ON independent of EP */
@@ -1747,6 +1749,7 @@ fail:
 static void tegra_pcie_apply_sw_war(struct tegra_pcie_port *port,
                                bool enum_done)
 {
+       unsigned long ctrl;
        unsigned int data;
 #if defined(CONFIG_ARCH_TEGRA_21x_SOC)
        struct tegra_pcie *pcie = port->pcie;
@@ -1763,6 +1766,12 @@ static void tegra_pcie_apply_sw_war(struct tegra_pcie_port *port,
                t210_war = 1;
 #endif
        if (enum_done) {
+               /* Remove SW override for REFCLK */
+               ctrl = tegra_pcie_port_get_pex_ctrl(port);
+               data = afi_readl(port->pcie, ctrl);
+               data &= ~(AFI_PEX_CTRL_OVERRIDE_EN);
+               afi_writel(port->pcie, data, ctrl);
+
                /* disable msi for port driver to avoid panic */
                for_each_pci_dev(pdev)
                        if (pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT)