ar71xx: add dummy debugfs support for the ag71xx driver

SVN-Revision: 19031
master
Gabor Juhos 15 years ago
parent 8113f1ae11
commit 63a320c8f7
  1. 1
      target/linux/ar71xx/config-2.6.30
  2. 1
      target/linux/ar71xx/config-2.6.31
  3. 1
      target/linux/ar71xx/config-2.6.32
  4. 8
      target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig
  5. 9
      target/linux/ar71xx/files/drivers/net/ag71xx/Makefile
  6. 22
      target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
  7. 2
      target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c
  8. 55
      target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_debugfs.c
  9. 2
      target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ethtool.c
  10. 18
      target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
  11. 2
      target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_mdio.c
  12. 2
      target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c

@ -3,6 +3,7 @@ CONFIG_32BIT=y
CONFIG_AG71XX=y
CONFIG_AG71XX_AR8216_SUPPORT=y
# CONFIG_AG71XX_DEBUG is not set
# CONFIG_AG71XX_DEBUG_FS is not set
CONFIG_AR71XX_DEV_AP91_PCI=y
CONFIG_AR71XX_DEV_AP94_PCI=y
CONFIG_AR71XX_DEV_AR913X_WMAC=y

@ -3,6 +3,7 @@ CONFIG_32BIT=y
CONFIG_AG71XX=y
CONFIG_AG71XX_AR8216_SUPPORT=y
# CONFIG_AG71XX_DEBUG is not set
# CONFIG_AG71XX_DEBUG_FS is not set
# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
# CONFIG_AR7 is not set
CONFIG_AR71XX_DEV_AP91_PCI=y

@ -3,6 +3,7 @@ CONFIG_32BIT=y
CONFIG_AG71XX=y
CONFIG_AG71XX_AR8216_SUPPORT=y
# CONFIG_AG71XX_DEBUG is not set
# CONFIG_AG71XX_DEBUG_FS is not set
# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
# CONFIG_AR7 is not set
CONFIG_AR71XX_DEV_AP91_PCI=y

@ -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

@ -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

@ -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 */

@ -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
*

@ -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;
}

@ -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

@ -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);

@ -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

@ -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

Loading…
Cancel
Save