aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-01-18 00:54:06 +0000
committerFelix Fietkau <nbd@openwrt.org>2015-01-18 00:54:06 +0000
commit9c995cf6d4126ce8031ca0804097c7d1f9c5fbb6 (patch)
tree534f963c51647d9f1a22abb2c69f6a587430e25a /target/linux/generic/files
parentcdebbb98d120f54ea4cdcfda4936a5c5a37cb495 (diff)
downloadmaster-187ad058-9c995cf6d4126ce8031ca0804097c7d1f9c5fbb6.tar.gz
master-187ad058-9c995cf6d4126ce8031ca0804097c7d1f9c5fbb6.tar.bz2
master-187ad058-9c995cf6d4126ce8031ca0804097c7d1f9c5fbb6.zip
ar8216: display flow control info in swconfig get_link in case of autonegatiation too
The swconfig get_link attribute (at least) on AR8327/AR8337 doesn't consider the autonegotiated flow control. AR8327/AR8337 provide the info about autonegotiated rx/tx flow control in bits 10 and 11 of the port status register. Use these values to display info about autonegotiated rx/tx flow control as part of the get_link attribute. Successfully tested on TL-WDR4900 (AR8327 rev.4) and TL-WDR4300 (AR8327 rev.2). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@44023 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic/files')
-rw-r--r--target/linux/generic/files/drivers/net/phy/ar8327.c18
-rw-r--r--target/linux/generic/files/drivers/net/phy/ar8327.h2
2 files changed, 19 insertions, 1 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/ar8327.c b/target/linux/generic/files/drivers/net/phy/ar8327.c
index c0262d7145..ea880bc927 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8327.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8327.c
@@ -710,7 +710,23 @@ ar8327_init_port(struct ar8xxx_priv *priv, int port)
static u32
ar8327_read_port_status(struct ar8xxx_priv *priv, int port)
{
- return ar8xxx_read(priv, AR8327_REG_PORT_STATUS(port));
+ u32 t;
+
+ t = ar8xxx_read(priv, AR8327_REG_PORT_STATUS(port));
+ /* map the flow control autoneg result bits to the flow control bits
+ * used in forced mode to allow ar8216_read_port_link detect
+ * flow control properly if autoneg is used
+ */
+ if (t & AR8216_PORT_STATUS_LINK_UP &&
+ t & AR8216_PORT_STATUS_LINK_AUTO) {
+ t &= ~(AR8216_PORT_STATUS_TXFLOW | AR8216_PORT_STATUS_RXFLOW);
+ if (t & AR8327_PORT_STATUS_TXFLOW_AUTO)
+ t |= AR8216_PORT_STATUS_TXFLOW;
+ if (t & AR8327_PORT_STATUS_RXFLOW_AUTO)
+ t |= AR8216_PORT_STATUS_RXFLOW;
+ }
+
+ return t;
}
static u32
diff --git a/target/linux/generic/files/drivers/net/phy/ar8327.h b/target/linux/generic/files/drivers/net/phy/ar8327.h
index 1877f00c97..f0ef013cb6 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8327.h
+++ b/target/linux/generic/files/drivers/net/phy/ar8327.h
@@ -84,6 +84,8 @@
#define AR8327_MAX_FRAME_SIZE_MTU BITS(0, 14)
#define AR8327_REG_PORT_STATUS(_i) (0x07c + (_i) * 4)
+#define AR8327_PORT_STATUS_TXFLOW_AUTO BIT(10)
+#define AR8327_PORT_STATUS_RXFLOW_AUTO BIT(11)
#define AR8327_REG_HEADER_CTRL 0x098
#define AR8327_REG_PORT_HEADER(_i) (0x09c + (_i) * 4)