aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/files
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2010-01-04 14:28:25 +0000
committerGabor Juhos <juhosg@openwrt.org>2010-01-04 14:28:25 +0000
commit63a320c8f7491fe5cf23618579a48f68083497ce (patch)
treed000732b2804324fcdfe4b356a438e40235bff70 /target/linux/ar71xx/files
parent8113f1ae11e5e049c9e54b4c68e700cf8d501723 (diff)
downloadupstream-63a320c8f7491fe5cf23618579a48f68083497ce.tar.gz
upstream-63a320c8f7491fe5cf23618579a48f68083497ce.tar.bz2
upstream-63a320c8f7491fe5cf23618579a48f68083497ce.zip
ar71xx: add dummy debugfs support for the ag71xx driver
SVN-Revision: 19031
Diffstat (limited to 'target/linux/ar71xx/files')
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig8
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/Makefile9
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h22
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c2
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_debugfs.c55
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ethtool.c2
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c18
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_mdio.c2
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c2
9 files changed, 109 insertions, 11 deletions
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig b/target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig
index 801fcaf9d7..15983f4ea4 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig
@@ -13,6 +13,14 @@ config AG71XX_DEBUG
help
Atheros AR71xx built-in ethernet driver debugging messages.
+config AG71XX_DEBUG_FS
+ bool "Atheros AR71xx built-in ethernet driver debugfs support"
+ depends on AG71XX && DEBUG_FS
+ default n
+ help
+ Say Y, if you need access to various statistics provided by
+ the ag71xx driver.
+
config AG71XX_AR8216_SUPPORT
bool "special support for the Atheros AR8216 switch"
depends on AG71XX
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/Makefile b/target/linux/ar71xx/files/drivers/net/ag71xx/Makefile
index aa1798d195..3485ab385d 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/Makefile
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/Makefile
@@ -2,12 +2,13 @@
# Makefile for the Atheros AR71xx built-in ethernet macs
#
-ag71xx-y += ag71xx_main.o
-ag71xx-y += ag71xx_ethtool.o
-ag71xx-y += ag71xx_phy.o
+ag71xx-y += ag71xx_main.o
+ag71xx-y += ag71xx_ethtool.o
+ag71xx-y += ag71xx_phy.o
ag71xx-y += ag71xx_mdio.o
-ag71xx-$(CONFIG_AG71XX_AR8216_SUPPORT) += ag71xx_ar8216.o
+ag71xx-$(CONFIG_AG71XX_DEBUG_FS) += ag71xx_debugfs.o
+ag71xx-$(CONFIG_AG71XX_AR8216_SUPPORT) += ag71xx_ar8216.o
obj-$(CONFIG_AG71XX) += ag71xx.o
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
index ac52896ab2..b2f710edec 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
@@ -1,7 +1,7 @@
/*
* Atheros AR71xx built-in ethernet mac driver
*
- * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
* Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
*
* Based on Atheros' AG7100 driver
@@ -109,6 +109,10 @@ struct ag71xx_mdio {
struct ag71xx_mdio_platform_data *pdata;
};
+struct ag71xx_debug {
+ struct dentry *debugfs_dir;
+};
+
struct ag71xx {
void __iomem *mac_base;
void __iomem *mii_ctrl;
@@ -131,6 +135,10 @@ struct ag71xx {
struct work_struct restart_work;
struct timer_list oom_timer;
+
+#ifdef CONFIG_AG71XX_DEBUG_FS
+ struct ag71xx_debug debug;
+#endif
};
extern struct ethtool_ops ag71xx_ethtool_ops;
@@ -450,4 +458,16 @@ static inline int ag71xx_remove_ar8216_header(struct ag71xx *ag,
}
#endif
+#ifdef CONFIG_AG71XX_DEBUG_FS
+int ag71xx_debugfs_root_init(void);
+void ag71xx_debugfs_root_exit(void);
+int ag71xx_debugfs_init(struct ag71xx *ag);
+void ag71xx_debugfs_exit(struct ag71xx *ag);
+#else
+static inline int ag71xx_debugfs_root_init(void) { return 0; }
+static inline void ag71xx_debugfs_root_exit(void) {}
+static inline int ag71xx_debugfs_init(struct ag71xx *ag) { return 0; }
+static inline void ag71xx_debugfs_exit(struct ag71xx *ag) {}
+#endif /* CONFIG_AG71XX_DEBUG_FS */
+
#endif /* _AG71XX_H */
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c
index 39221ad62c..5b3722651f 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c
@@ -2,7 +2,7 @@
* Atheros AR71xx built-in ethernet mac driver
* Special support for the Atheros ar8216 switch chip
*
- * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org>
*
* Based on Atheros' AG7100 driver
*
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_debugfs.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_debugfs.c
new file mode 100644
index 0000000000..88101e47d5
--- /dev/null
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_debugfs.c
@@ -0,0 +1,55 @@
+/*
+ * Atheros AR71xx built-in ethernet mac driver
+ *
+ * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
+ *
+ * Based on Atheros' AG7100 driver
+ *
+ * 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 "ag71xx.h"
+
+static struct dentry *ag71xx_debugfs_root;
+
+int ag71xx_debugfs_root_init(void)
+{
+ if (ag71xx_debugfs_root)
+ return -EBUSY;
+
+ ag71xx_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
+ if (!ag71xx_debugfs_root)
+ return -ENOENT;
+
+ return 0;
+}
+
+void ag71xx_debugfs_root_exit(void)
+{
+ debugfs_remove(ag71xx_debugfs_root);
+ ag71xx_debugfs_root = NULL;
+}
+
+void ag71xx_debugfs_exit(struct ag71xx *ag)
+{
+ debugfs_remove(ag->debug.debugfs_dir);
+}
+
+int ag71xx_debugfs_init(struct ag71xx *ag)
+{
+ ag->debug.debugfs_dir = debugfs_create_dir(ag->dev->name,
+ ag71xx_debugfs_root);
+ if (!ag->debug.debugfs_dir)
+ goto err;
+
+ return 0;
+
+ err:
+ ag71xx_debugfs_exit(ag);
+ return -ENOMEM;
+}
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 3ac347f6b0..1f1c6aa776 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ethtool.c
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ethtool.c
@@ -1,7 +1,7 @@
/*
* Atheros AR71xx built-in ethernet mac driver
*
- * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
* Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
*
* Based on Atheros' AG7100 driver
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 c8c61dead6..869373aaf1 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
@@ -1,7 +1,7 @@
/*
* Atheros AR71xx built-in ethernet mac driver
*
- * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
* Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
*
* Based on Atheros' AG7100 driver
@@ -922,10 +922,16 @@ static int __init ag71xx_probe(struct platform_device *pdev)
if (err)
goto err_unregister_netdev;
+ err = ag71xx_debugfs_init(ag);
+ if (err)
+ goto err_phy_disconnect;
+
platform_set_drvdata(pdev, dev);
return 0;
+ err_phy_disconnect:
+ ag71xx_phy_disconnect(ag);
err_unregister_netdev:
unregister_netdev(dev);
err_free_irq:
@@ -948,6 +954,7 @@ static int __exit ag71xx_remove(struct platform_device *pdev)
if (dev) {
struct ag71xx *ag = netdev_priv(dev);
+ ag71xx_debugfs_exit(ag);
ag71xx_phy_disconnect(ag);
unregister_netdev(dev);
free_irq(dev->irq, dev);
@@ -972,10 +979,14 @@ static int __init ag71xx_module_init(void)
{
int ret;
- ret = ag71xx_mdio_driver_init();
+ ret = ag71xx_debugfs_root_init();
if (ret)
goto err_out;
+ ret = ag71xx_mdio_driver_init();
+ if (ret)
+ goto err_debugfs_exit;
+
ret = platform_driver_register(&ag71xx_driver);
if (ret)
goto err_mdio_exit;
@@ -984,6 +995,8 @@ static int __init ag71xx_module_init(void)
err_mdio_exit:
ag71xx_mdio_driver_exit();
+ err_debugfs_exit:
+ ag71xx_debugfs_root_exit();
err_out:
return ret;
}
@@ -992,6 +1005,7 @@ static void __exit ag71xx_module_exit(void)
{
platform_driver_unregister(&ag71xx_driver);
ag71xx_mdio_driver_exit();
+ ag71xx_debugfs_root_exit();
}
module_init(ag71xx_module_init);
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_mdio.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_mdio.c
index 6bc858cf8d..3984840e03 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_mdio.c
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_mdio.c
@@ -1,7 +1,7 @@
/*
* Atheros AR71xx built-in ethernet mac driver
*
- * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
* Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
*
* Based on Atheros' AG7100 driver
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 4233152aec..3e3d383265 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c
@@ -1,7 +1,7 @@
/*
* Atheros AR71xx built-in ethernet mac driver
*
- * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
* Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
*
* Based on Atheros' AG7100 driver