summaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-03-07 16:32:35 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-03-07 16:32:35 +0000
commitd32129c1105b5b26d0818c813f0a9520ba1a644e (patch)
tree49036f2e99b4de5a57349d63e04a58286825d453 /target
parent4a420c6fa29b4dc15e4ccc1bed050f33232569e4 (diff)
ar71xx: ag71xx: fix get_port_link callback
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30841 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-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 4866aac7e..8a497b0ca 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);