summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2008-08-10 09:18:42 +0000
committerGabor Juhos <juhosg@openwrt.org>2008-08-10 09:18:42 +0000
commit6ce62982dd482d17e8b7044ffc0058026b5007e9 (patch)
tree8b59a037f74370d5710bbd79a080442b82416ca2 /target
parent91a01e41067edb1d08727e7170b2fe76c4859f9c (diff)
downloadmtk-20170518-6ce62982dd482d17e8b7044ffc0058026b5007e9.zip
mtk-20170518-6ce62982dd482d17e8b7044ffc0058026b5007e9.tar.gz
mtk-20170518-6ce62982dd482d17e8b7044ffc0058026b5007e9.tar.bz2
ag71xx: add initial message level support
SVN-Revision: 12262
Diffstat (limited to 'target')
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h3
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ethtool.c16
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c22
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c12
4 files changed, 45 insertions, 8 deletions
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
index 230e481..d2d055d 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
@@ -37,7 +37,7 @@
#define ETH_FCS_LEN 4
#define AG71XX_DRV_NAME "ag71xx"
-#define AG71XX_DRV_VERSION "0.4.0"
+#define AG71XX_DRV_VERSION "0.4.1"
#define AG71XX_NAPI_TX 1
@@ -120,6 +120,7 @@ struct ag71xx {
struct platform_device *pdev;
struct net_device *dev;
struct napi_struct napi;
+ u32 msg_enable;
struct ag71xx_ring rx_ring;
struct ag71xx_ring tx_ring;
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ethtool.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ethtool.c
index 9aa7b3a..f6a282c 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ethtool.c
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ethtool.c
@@ -47,9 +47,25 @@ static void ag71xx_ethtool_get_drvinfo(struct net_device *dev,
strcpy(info->bus_info, ag->pdev->dev.bus_id);
}
+static u32 ag71xx_ethtool_get_msglevel(struct net_device *dev)
+{
+ struct ag71xx *ag = netdev_priv(dev);
+
+ return ag->msg_enable;
+}
+
+static void ag71xx_ethtool_set_msglevel(struct net_device *dev, u32 msg_level)
+{
+ struct ag71xx *ag = netdev_priv(dev);
+
+ ag->msg_enable = msg_level;
+}
+
struct ethtool_ops ag71xx_ethtool_ops = {
.set_settings = ag71xx_ethtool_set_settings,
.get_settings = ag71xx_ethtool_get_settings,
.get_drvinfo = ag71xx_ethtool_get_drvinfo,
+ .get_msglevel = ag71xx_ethtool_get_msglevel,
+ .set_msglevel = ag71xx_ethtool_set_msglevel,
.get_link = ethtool_op_get_link,
};
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
index 88ed22a..6b10791 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
@@ -13,6 +13,21 @@
#include "ag71xx.h"
+#define AG71XX_DEFAULT_MSG_ENABLE \
+ ( NETIF_MSG_DRV \
+ | NETIF_MSG_PROBE \
+ | NETIF_MSG_LINK \
+ | NETIF_MSG_TIMER \
+ | NETIF_MSG_IFDOWN \
+ | NETIF_MSG_IFUP \
+ | NETIF_MSG_RX_ERR \
+ | NETIF_MSG_TX_ERR )
+
+static int ag71xx_debug = -1;
+
+module_param(ag71xx_debug, int, 0);
+MODULE_PARM_DESC(ag71xx_debug, "Debug level (-1=defaults,0=none,...,16=all)");
+
static void ag71xx_dump_regs(struct ag71xx *ag)
{
DBG("%s: mac_cfg1=%08x, mac_cfg2=%08x, ipg=%08x, hdx=%08x, mfl=%08x\n",
@@ -601,8 +616,9 @@ static int ag71xx_poll(struct napi_struct *napi, int limit)
}
if (status & AG71XX_INT_RX_OF) {
- printk(KERN_ALERT "%s: rx owerflow, restarting dma\n",
- dev->name);
+ if (netif_msg_rx_err(ag))
+ printk(KERN_ALERT "%s: rx owerflow, restarting dma\n",
+ dev->name);
/* ack interrupt */
ag71xx_wr(ag, AG71XX_REG_RX_STATUS, RX_STATUS_OF);
@@ -692,6 +708,8 @@ static int __init ag71xx_probe(struct platform_device *pdev)
ag->pdev = pdev;
ag->dev = dev;
ag->mii_bus = &ag71xx_mdio_bus->mii_bus;
+ ag->msg_enable = netif_msg_init(ag71xx_debug,
+ AG71XX_DEFAULT_MSG_ENABLE);
spin_lock_init(&ag->lock);
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mac_base");
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c
index b1838d5..086de22 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c
@@ -87,7 +87,8 @@ static void ag71xx_phy_link_update(struct ag71xx *ag)
if (!ag->link) {
netif_carrier_off(ag->dev);
- printk(KERN_INFO "%s: link down\n", ag->dev->name);
+ if (netif_msg_link(ag))
+ printk(KERN_INFO "%s: link down\n", ag->dev->name);
return;
}
@@ -133,10 +134,11 @@ static void ag71xx_phy_link_update(struct ag71xx *ag)
ag71xx_wr(ag, AG71XX_REG_MAC_IFCTL, ifctl);
netif_carrier_on(ag->dev);
- printk(KERN_INFO "%s: link up (%sMbps/%s duplex)\n",
- ag->dev->name,
- ag71xx_speed_str(ag),
- (DUPLEX_FULL == ag->duplex) ? "Full" : "Half");
+ if (netif_msg_link(ag))
+ printk(KERN_INFO "%s: link up (%sMbps/%s duplex)\n",
+ ag->dev->name,
+ ag71xx_speed_str(ag),
+ (DUPLEX_FULL == ag->duplex) ? "Full" : "Half");
DBG("%s: fifo1=%#x, fifo2=%#x, fifo3=%#x, fifo4=%#x, fifo5=%#x\n",
ag->dev->name,