aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files/drivers/net/phy/ar8327.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-01-18 00:53:59 +0000
committerFelix Fietkau <nbd@openwrt.org>2015-01-18 00:53:59 +0000
commitcdebbb98d120f54ea4cdcfda4936a5c5a37cb495 (patch)
tree46b1083334266143d5420b63926e86dee18e0cc4 /target/linux/generic/files/drivers/net/phy/ar8327.c
parentf128531b2af4f0f4c1b57d1c9661400379908714 (diff)
downloadmaster-187ad058-cdebbb98d120f54ea4cdcfda4936a5c5a37cb495.tar.gz
master-187ad058-cdebbb98d120f54ea4cdcfda4936a5c5a37cb495.tar.bz2
master-187ad058-cdebbb98d120f54ea4cdcfda4936a5c5a37cb495.zip
ar8216: add 802.3az EEE info to swconfig get_link attribute
AR8327/AR8337 allow to read the result of EEE autonegotiation. If EEE is autonegotiated between the link partners, display this as part of the swconfig get_link attribute. eee100: 100MBit EEE supported by both link partners eee1000: 1GBit EEE supported by both link partners Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@44022 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic/files/drivers/net/phy/ar8327.c')
-rw-r--r--target/linux/generic/files/drivers/net/phy/ar8327.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/ar8327.c b/target/linux/generic/files/drivers/net/phy/ar8327.c
index 0971f80d50..c0262d7145 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8327.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8327.c
@@ -25,6 +25,7 @@
#include <linux/workqueue.h>
#include <linux/of_device.h>
#include <linux/leds.h>
+#include <linux/mdio.h>
#include "ar8216.h"
#include "ar8327.h"
@@ -712,6 +713,27 @@ ar8327_read_port_status(struct ar8xxx_priv *priv, int port)
return ar8xxx_read(priv, AR8327_REG_PORT_STATUS(port));
}
+static u32
+ar8327_read_port_eee_status(struct ar8xxx_priv *priv, int port)
+{
+ int phy;
+ u16 t;
+
+ if (port >= priv->dev.ports)
+ return 0;
+
+ if (port == 0 || port == 6)
+ return 0;
+
+ phy = port - 1;
+
+ /* EEE Ability Auto-negotiation Result */
+ ar8xxx_phy_mmd_write(priv, phy, 0x7, 0x8000);
+ t = ar8xxx_phy_mmd_read(priv, phy, 0x4007);
+
+ return mmd_eee_adv_to_ethtool_adv_t(t);
+}
+
static int
ar8327_atu_flush(struct ar8xxx_priv *priv)
{
@@ -1069,6 +1091,7 @@ const struct ar8xxx_chip ar8327_chip = {
.init_port = ar8327_init_port,
.setup_port = ar8327_setup_port,
.read_port_status = ar8327_read_port_status,
+ .read_port_eee_status = ar8327_read_port_eee_status,
.atu_flush = ar8327_atu_flush,
.vtu_flush = ar8327_vtu_flush,
.vtu_load_vlan = ar8327_vtu_load_vlan,
@@ -1100,6 +1123,7 @@ const struct ar8xxx_chip ar8337_chip = {
.init_port = ar8327_init_port,
.setup_port = ar8327_setup_port,
.read_port_status = ar8327_read_port_status,
+ .read_port_eee_status = ar8327_read_port_eee_status,
.atu_flush = ar8327_atu_flush,
.vtu_flush = ar8327_vtu_flush,
.vtu_load_vlan = ar8327_vtu_load_vlan,