ar71xx: ag71xx: fix get_port_link callback

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30841 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Gabor Juhos 2012-03-07 16:32:35 +00:00
parent 8040107a9c
commit b079387bc5
1 changed files with 8 additions and 2 deletions

View File

@ -888,9 +888,15 @@ ar7240_get_port_link(struct switch_dev *dev, int port,
return -EINVAL; return -EINVAL;
status = ar7240sw_reg_read(mii, AR7240_REG_PORT_STATUS(port)); 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); 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->duplex = !!(status & AR7240_PORT_STATUS_DUPLEX);
link->tx_flow = !!(status & AR7240_PORT_STATUS_TXFLOW); link->tx_flow = !!(status & AR7240_PORT_STATUS_TXFLOW);
link->rx_flow = !!(status & AR7240_PORT_STATUS_RXFLOW); link->rx_flow = !!(status & AR7240_PORT_STATUS_RXFLOW);