]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
pcie: host: tegra: add power_down test
authorVidya Sagar <vidyas@nvidia.com>
Mon, 15 Dec 2014 08:49:56 +0000 (14:19 +0530)
committerLaxman Dewangan <ldewangan@nvidia.com>
Mon, 23 Feb 2015 09:34:51 +0000 (01:34 -0800)
adds a debugfs entry to test power_down

Bug 200064591

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

index 7597a0d713d156c5cd236676f39472d2fb851d09..cc9cd635c5db6661d4cb63851f9f1d5214145613 100644 (file)
@@ -3231,6 +3231,38 @@ end:
        return 0;
 }
 
+static int power_down(struct seq_file *s, void *data)
+{
+       struct tegra_pcie_port *port = NULL;
+       struct tegra_pcie *pcie = (struct tegra_pcie *)(s->private);
+       u16 val;
+       bool pass = false;
+
+       val = afi_readl(pcie, AFI_PCIE_PME);
+       val |= AFI_PCIE_PME_TURN_OFF;
+       afi_writel(pcie, val, AFI_PCIE_PME);
+       do {
+               val = afi_readl(pcie, AFI_PCIE_PME);
+       } while(!(val & AFI_PCIE_PME_ACK));
+
+       mdelay(1);
+       list_for_each_entry(port, &pcie->ports, list) {
+               val = rp_readl(port, NV_PCIE2_RP_LTSSM_DBGREG);
+               if (val & PCIE2_RP_LTSSM_DBGREG_LINKFSM16) {
+                       pass = true;
+                       goto out;
+               }
+       }
+
+out:
+       if (pass)
+               seq_printf(s, "[pass: pcie_power_down]\n");
+       else
+               seq_printf(s, "[fail: pcie_power_down]\n");
+       pr_info("PCIE power_down test END..\n");
+       return 0;
+}
+
 static int apply_lane_width(struct seq_file *s, void *data)
 {
        unsigned int new;
@@ -3543,6 +3575,7 @@ DEFINE_ENTRY(config_read)
 DEFINE_ENTRY(config_write)
 DEFINE_ENTRY(aspm_l11)
 DEFINE_ENTRY(aspm_l1ss)
+DEFINE_ENTRY(power_down)
 
 /* Port specific */
 DEFINE_ENTRY(apply_lane_width)
@@ -3742,6 +3775,12 @@ static int tegra_pcie_debugfs_init(struct tegra_pcie *pcie)
        if (!d)
                goto remove;
 
+       d = create_tegra_pcie_debufs_file("power_down",
+                                       &power_down_fops, pcie->debugfs,
+                                       (void *)pcie);
+       if (!d)
+               goto remove;
+
        d = create_tegra_pcie_debufs_file("dump_config_space",
                                        &dump_config_space_fops, pcie->debugfs,
                                        (void *)pcie);