summaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorLiu Gang <Gang.Liu@nxp.com>2016-08-11 10:59:37 (GMT)
committerXie Xiaobo <xiaobo.xie@nxp.com>2017-09-25 07:25:40 (GMT)
commita37b267cd02de858f1edfdf5fc6e665b68e58c47 (patch)
treedc0e56b9bd4e02ebc9bb1a19d392dfc134270188 /drivers/pci
parent48377e57ba57a30c6956508acbf304a902fdf217 (diff)
downloadlinux-a37b267cd02de858f1edfdf5fc6e665b68e58c47.tar.xz
pci-ep/ls1046a: Add new interface to show the transfer data
Add a "dump" interface to show the PCI transfer data. Signed-off-by: Liu Gang <Gang.Liu@nxp.com> Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/host/pci-layerscape-ep-debugfs.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/drivers/pci/host/pci-layerscape-ep-debugfs.c b/drivers/pci/host/pci-layerscape-ep-debugfs.c
index c117690..f5f01cd 100644
--- a/drivers/pci/host/pci-layerscape-ep-debugfs.c
+++ b/drivers/pci/host/pci-layerscape-ep-debugfs.c
@@ -664,6 +664,45 @@ static const struct file_operations ls_pcie_ep_dbg_test_fops = {
.write = ls_pcie_ep_dbg_test_write,
};
+static ssize_t ls_pcie_ep_dbg_dump_read(struct file *filp,
+ char __user *buffer,
+ size_t count, loff_t *ppos)
+{
+ struct ls_ep_dev *ep = filp->private_data;
+ struct ls_ep_test *test = ep->driver_data;
+ char *buf;
+ int desc = 0, i, len;
+
+ buf = kmalloc(4 * 1024, GFP_KERNEL);
+ if (!buf)
+ return -ENOMEM;
+
+ if (!test) {
+ dev_info(&ep->dev, " there is NO test\n");
+ return 0;
+ }
+
+ desc += sprintf(buf + desc, "%s", "dump info:");
+ for (i = 0; i < 256; i += 4) {
+ if (i % 16 == 0)
+ desc += sprintf(buf + desc, "\n%08x:", i);
+ desc += sprintf(buf + desc, " %08x", readl(test->buf + i));
+ }
+
+ desc += sprintf(buf + desc, "\n");
+ len = simple_read_from_buffer(buffer, count, ppos, buf, desc);
+
+ kfree(buf);
+
+ return len;
+}
+
+static const struct file_operations ls_pcie_ep_dbg_dump_fops = {
+ .owner = THIS_MODULE,
+ .open = simple_open,
+ .read = ls_pcie_ep_dbg_dump_read,
+};
+
static int ls_pcie_ep_dev_dbgfs_init(struct ls_ep_dev *ep)
{
struct ls_pcie *pcie = ep->pcie;
@@ -685,6 +724,11 @@ static int ls_pcie_ep_dev_dbgfs_init(struct ls_ep_dev *ep)
if (!pfile)
dev_info(&ep->dev, "debugfs test for failed\n");
+ pfile = debugfs_create_file("dump", 0600, ep->dir, ep,
+ &ls_pcie_ep_dbg_dump_fops);
+ if (!pfile)
+ dev_info(&ep->dev, "debugfs dump for failed\n");
+
return 0;
}