aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/files
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-03-07 16:32:35 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-03-07 16:32:35 +0000
commitc455a0f7be2479d8eaa959be3452a8d887591e3b (patch)
treebd106a0b849372312aa74dc65468991df3bf76f2 /target/linux/ar71xx/files
parent5a83b3a5c7a14a1ae52c4958698676b0f7c75f31 (diff)
downloadupstream-c455a0f7be2479d8eaa959be3452a8d887591e3b.tar.gz
upstream-c455a0f7be2479d8eaa959be3452a8d887591e3b.tar.bz2
upstream-c455a0f7be2479d8eaa959be3452a8d887591e3b.zip
ar71xx: ag71xx: fix get_port_link callback
SVN-Revision: 30841
Diffstat (limited to 'target/linux/ar71xx/files')
-rw-r--r--target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c
index 4866aac7ea..8a497b0cab 100644
--- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c
+++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c
@@ -888,9 +888,15 @@ ar7240_get_port_link(struct switch_dev *dev, int port,
return -EINVAL;
status = ar7240sw_reg_read(mii, AR7240_REG_PORT_STATUS(port));
-
- link->link = !!(status & AR7240_PORT_STATUS_LINK_UP);
link->aneg = !!(status & AR7240_PORT_STATUS_LINK_AUTO);
+ if (link->aneg) {
+ link->link = !!(status & AR7240_PORT_STATUS_LINK_UP);
+ if (!link->link)
+ return 0;
+ } else {
+ link->link = true;
+ }
+
link->duplex = !!(status & AR7240_PORT_STATUS_DUPLEX);
link->tx_flow = !!(status & AR7240_PORT_STATUS_TXFLOW);
link->rx_flow = !!(status & AR7240_PORT_STATUS_RXFLOW);