mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-08-22 01:12:26 +03:00
ramips: raeth: add debugfs support
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30680 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
487e30dc6b
commit
fe2aef1465
@ -10,4 +10,8 @@ if NET_RAMIPS
|
|||||||
config NET_RAMIPS_DEBUG
|
config NET_RAMIPS_DEBUG
|
||||||
bool "Enable debug messages in the Ralink ethernet driver"
|
bool "Enable debug messages in the Ralink ethernet driver"
|
||||||
|
|
||||||
|
config NET_RAMIPS_DEBUG_FS
|
||||||
|
bool "Enable debugfs support for the Ralink ethernet driver"
|
||||||
|
depends on DEBUG_FS
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
@ -4,4 +4,6 @@
|
|||||||
|
|
||||||
ramips-y += ramips_main.o
|
ramips-y += ramips_main.o
|
||||||
|
|
||||||
|
ramips-$(CONFIG_NET_RAMIPS_DEBUG_FS) += ramips_debugfs.o
|
||||||
|
|
||||||
obj-$(CONFIG_NET_RAMIPS) += ramips.o
|
obj-$(CONFIG_NET_RAMIPS) += ramips.o
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Ralink SoC ethernet driver debugfs code
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 as published
|
||||||
|
* by the Free Software Foundation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/debugfs.h>
|
||||||
|
#include <linux/phy.h>
|
||||||
|
|
||||||
|
#include "ramips_eth.h"
|
||||||
|
|
||||||
|
static struct dentry *raeth_debugfs_root;
|
||||||
|
|
||||||
|
void raeth_debugfs_exit(struct raeth_priv *re)
|
||||||
|
{
|
||||||
|
debugfs_remove_recursive(re->debug.debugfs_dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
int raeth_debugfs_init(struct raeth_priv *re)
|
||||||
|
{
|
||||||
|
re->debug.debugfs_dir = debugfs_create_dir(re->netdev->name,
|
||||||
|
raeth_debugfs_root);
|
||||||
|
if (!re->debug.debugfs_dir)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int raeth_debugfs_root_init(void)
|
||||||
|
{
|
||||||
|
if (raeth_debugfs_root)
|
||||||
|
return -EBUSY;
|
||||||
|
|
||||||
|
raeth_debugfs_root = debugfs_create_dir("raeth", NULL);
|
||||||
|
if (!raeth_debugfs_root)
|
||||||
|
return -ENOENT;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void raeth_debugfs_root_exit(void)
|
||||||
|
{
|
||||||
|
debugfs_remove(raeth_debugfs_root);
|
||||||
|
raeth_debugfs_root = NULL;
|
||||||
|
}
|
@ -213,6 +213,10 @@ struct ramips_tx_dma {
|
|||||||
unsigned int txd4;
|
unsigned int txd4;
|
||||||
} __packed __aligned(4);
|
} __packed __aligned(4);
|
||||||
|
|
||||||
|
struct raeth_debug {
|
||||||
|
struct dentry *debugfs_dir;
|
||||||
|
};
|
||||||
|
|
||||||
struct raeth_priv
|
struct raeth_priv
|
||||||
{
|
{
|
||||||
dma_addr_t rx_desc_dma;
|
dma_addr_t rx_desc_dma;
|
||||||
@ -243,6 +247,22 @@ struct raeth_priv
|
|||||||
int mii_irq[PHY_MAX_ADDR];
|
int mii_irq[PHY_MAX_ADDR];
|
||||||
struct phy_device *phy_dev;
|
struct phy_device *phy_dev;
|
||||||
spinlock_t phy_lock;
|
spinlock_t phy_lock;
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_RAMIPS_DEBUG_FS
|
||||||
|
struct raeth_debug debug;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_RAMIPS_DEBUG_FS
|
||||||
|
int raeth_debugfs_root_init(void);
|
||||||
|
void raeth_debugfs_root_exit(void);
|
||||||
|
int raeth_debugfs_init(struct raeth_priv *re);
|
||||||
|
void raeth_debugfs_exit(struct raeth_priv *re);
|
||||||
|
#else
|
||||||
|
static inline int raeth_debugfs_root_init(void) { return 0; }
|
||||||
|
static inline void raeth_debugfs_root_exit(void) {}
|
||||||
|
static inline int raeth_debugfs_init(struct raeth_priv *re) { return 0; }
|
||||||
|
static inline void raeth_debugfs_exit(struct raeth_priv *re) {}
|
||||||
|
#endif /* CONFIG_NET_RAMIPS_DEBUG_FS */
|
||||||
|
|
||||||
#endif /* RAMIPS_ETH_H */
|
#endif /* RAMIPS_ETH_H */
|
||||||
|
@ -874,8 +874,14 @@ ramips_eth_probe(struct net_device *dev)
|
|||||||
if (err)
|
if (err)
|
||||||
goto err_mdio_cleanup;
|
goto err_mdio_cleanup;
|
||||||
|
|
||||||
|
err = raeth_debugfs_init(re);
|
||||||
|
if (err)
|
||||||
|
goto err_phy_disconnect;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_phy_disconnect:
|
||||||
|
ramips_phy_disconnect(re);
|
||||||
err_mdio_cleanup:
|
err_mdio_cleanup:
|
||||||
ramips_mdio_cleanup(re);
|
ramips_mdio_cleanup(re);
|
||||||
return err;
|
return err;
|
||||||
@ -886,6 +892,7 @@ ramips_eth_uninit(struct net_device *dev)
|
|||||||
{
|
{
|
||||||
struct raeth_priv *re = netdev_priv(dev);
|
struct raeth_priv *re = netdev_priv(dev);
|
||||||
|
|
||||||
|
raeth_debugfs_exit(re);
|
||||||
ramips_phy_disconnect(re);
|
ramips_phy_disconnect(re);
|
||||||
ramips_mdio_cleanup(re);
|
ramips_mdio_cleanup(re);
|
||||||
}
|
}
|
||||||
@ -992,9 +999,13 @@ ramips_eth_init(void)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
ret = raeth_debugfs_root_init();
|
||||||
|
if (ret)
|
||||||
|
goto err_out;
|
||||||
|
|
||||||
ret = rt305x_esw_init();
|
ret = rt305x_esw_init();
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
goto err_debugfs_exit;
|
||||||
|
|
||||||
ret = platform_driver_register(&ramips_eth_driver);
|
ret = platform_driver_register(&ramips_eth_driver);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@ -1007,6 +1018,9 @@ ramips_eth_init(void)
|
|||||||
|
|
||||||
esw_cleanup:
|
esw_cleanup:
|
||||||
rt305x_esw_exit();
|
rt305x_esw_exit();
|
||||||
|
err_debugfs_exit:
|
||||||
|
raeth_debugfs_root_exit();
|
||||||
|
err_out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1015,6 +1029,7 @@ ramips_eth_cleanup(void)
|
|||||||
{
|
{
|
||||||
platform_driver_unregister(&ramips_eth_driver);
|
platform_driver_unregister(&ramips_eth_driver);
|
||||||
rt305x_esw_exit();
|
rt305x_esw_exit();
|
||||||
|
raeth_debugfs_root_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(ramips_eth_init);
|
module_init(ramips_eth_init);
|
||||||
|
@ -82,6 +82,7 @@ CONFIG_NEED_DMA_MAP_STATE=y
|
|||||||
CONFIG_NEED_PER_CPU_KM=y
|
CONFIG_NEED_PER_CPU_KM=y
|
||||||
CONFIG_NET_RAMIPS=y
|
CONFIG_NET_RAMIPS=y
|
||||||
# CONFIG_NET_RAMIPS_DEBUG is not set
|
# CONFIG_NET_RAMIPS_DEBUG is not set
|
||||||
|
# CONFIG_NET_RAMIPS_DEBUG_FS is not set
|
||||||
CONFIG_PAGEFLAGS_EXTENDED=y
|
CONFIG_PAGEFLAGS_EXTENDED=y
|
||||||
CONFIG_PCI=y
|
CONFIG_PCI=y
|
||||||
CONFIG_PCI_DOMAINS=y
|
CONFIG_PCI_DOMAINS=y
|
||||||
|
@ -81,6 +81,7 @@ CONFIG_NEED_DMA_MAP_STATE=y
|
|||||||
CONFIG_NEED_PER_CPU_KM=y
|
CONFIG_NEED_PER_CPU_KM=y
|
||||||
CONFIG_NET_RAMIPS=y
|
CONFIG_NET_RAMIPS=y
|
||||||
# CONFIG_NET_RAMIPS_DEBUG is not set
|
# CONFIG_NET_RAMIPS_DEBUG is not set
|
||||||
|
# CONFIG_NET_RAMIPS_DEBUG_FS is not set
|
||||||
CONFIG_PAGEFLAGS_EXTENDED=y
|
CONFIG_PAGEFLAGS_EXTENDED=y
|
||||||
CONFIG_PERF_USE_VMALLOC=y
|
CONFIG_PERF_USE_VMALLOC=y
|
||||||
CONFIG_PHYLIB=y
|
CONFIG_PHYLIB=y
|
||||||
|
@ -80,6 +80,7 @@ CONFIG_NEED_DMA_MAP_STATE=y
|
|||||||
CONFIG_NEED_PER_CPU_KM=y
|
CONFIG_NEED_PER_CPU_KM=y
|
||||||
CONFIG_NET_RAMIPS=y
|
CONFIG_NET_RAMIPS=y
|
||||||
# CONFIG_NET_RAMIPS_DEBUG is not set
|
# CONFIG_NET_RAMIPS_DEBUG is not set
|
||||||
|
# CONFIG_NET_RAMIPS_DEBUG_FS is not set
|
||||||
CONFIG_PAGEFLAGS_EXTENDED=y
|
CONFIG_PAGEFLAGS_EXTENDED=y
|
||||||
CONFIG_PCI=y
|
CONFIG_PCI=y
|
||||||
CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
|
CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
|
||||||
|
Loading…
Reference in New Issue
Block a user