mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-23 01:31:30 +03:00
nvethernet: dump all registers
Dump all valid ethernet IP registers Bug 200563382 Change-Id: I34ce3c1dc5c2c4e12040d2d349e2ad63ec8bca8b Signed-off-by: rakesh goyal <rgoyal@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2338198 Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: Bhadram Varka <vbhadram@nvidia.com> Reviewed-by: Bitan Biswas <bbiswas@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
Revanth Kumar Uppala
parent
192561087a
commit
c6b2d05d26
@@ -380,6 +380,8 @@ struct ether_priv_data {
|
||||
struct dentry *dbgfs_hw_feat;
|
||||
/** Descriptor dump debug fs pointer */
|
||||
struct dentry *dbgfs_desc_dump;
|
||||
/** Register dump debug fs pointer */
|
||||
struct dentry *dbgfs_reg_dump;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -16,6 +16,11 @@
|
||||
|
||||
#include "ether_linux.h"
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
/* As per IAS Docs */
|
||||
#define EOQS_MAX_REGISTER_ADDRESS 0x12FC
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Shows the current setting of MAC loopback
|
||||
*
|
||||
@@ -590,6 +595,49 @@ static const struct file_operations ether_desc_dump_fops = {
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static int ether_register_dump_read(struct seq_file *seq, void *v)
|
||||
{
|
||||
struct net_device *ndev = seq->private;
|
||||
struct ether_priv_data *pdata = netdev_priv(ndev);
|
||||
struct osi_core_priv_data *osi_core = pdata->osi_core;
|
||||
int max_address = 0x0;
|
||||
int start_addr = 0x0;
|
||||
|
||||
max_address = EOQS_MAX_REGISTER_ADDRESS;
|
||||
|
||||
/* Interface is not up so register dump not allowed */
|
||||
if (!netif_running(ndev)) {
|
||||
dev_err(pdata->dev, "Not Allowed. Ether interface is not up\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
seq_printf(seq,
|
||||
"\t Register offset 0x%x value 0x%x\n",
|
||||
start_addr,
|
||||
ioread32((void *)osi_core->base + start_addr));
|
||||
start_addr += 4;
|
||||
|
||||
if (start_addr > max_address)
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ether_register_dump_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, ether_register_dump_read, inode->i_private);
|
||||
}
|
||||
|
||||
static const struct file_operations ether_register_dump_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = ether_register_dump_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static int ether_create_debugfs(struct ether_priv_data *pdata)
|
||||
{
|
||||
char *buf;
|
||||
@@ -632,6 +680,18 @@ static int ether_create_debugfs(struct ether_priv_data *pdata)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pdata->dbgfs_reg_dump = debugfs_create_file("register_dump", S_IRUGO,
|
||||
pdata->dbgfs_dir,
|
||||
pdata->ndev,
|
||||
ðer_register_dump_fops);
|
||||
if (!pdata->dbgfs_reg_dump) {
|
||||
netdev_err(pdata->ndev,
|
||||
"failed to create rgister dump debugfs\n");
|
||||
debugfs_remove_recursive(pdata->dbgfs_dir);
|
||||
ret = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
exit:
|
||||
kfree(buf);
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user