aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-03-07 16:32:43 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-03-07 16:32:43 +0000
commit2370828599ea3b5d990082d8b439c1fdba97cc9a (patch)
tree73d5f06c5e24ca0f8e122571871b2befe2c10b5e /target/linux/generic/files
parentd8a8df51ca3f88ce9110e621be256865c70f8502 (diff)
downloadupstream-2370828599ea3b5d990082d8b439c1fdba97cc9a.tar.gz
upstream-2370828599ea3b5d990082d8b439c1fdba97cc9a.tar.bz2
upstream-2370828599ea3b5d990082d8b439c1fdba97cc9a.zip
generic: ar8216: use ar8216_read_port_link to get the CPU port link parameters
SVN-Revision: 30846
Diffstat (limited to 'target/linux/generic/files')
-rw-r--r--target/linux/generic/files/drivers/net/phy/ar8216.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c
index 38ccaa36a7..2e3a8426b0 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8216.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8216.c
@@ -929,14 +929,31 @@ static int
ar8216_read_status(struct phy_device *phydev)
{
struct ar8216_priv *priv = phydev->priv;
+ struct switch_port_link link;
int ret;
if (phydev->addr != 0) {
return genphy_read_status(phydev);
}
- phydev->speed = priv->chip == AR8316 ? SPEED_1000 : SPEED_100;
- phydev->duplex = DUPLEX_FULL;
- phydev->link = 1;
+ ar8216_read_port_link(priv, phydev->addr, &link);
+ phydev->link = !!link.link;
+ if (!phydev->link)
+ return 0;
+
+ switch (link.speed) {
+ case SWITCH_PORT_SPEED_10:
+ phydev->speed = SPEED_10;
+ break;
+ case SWITCH_PORT_SPEED_100:
+ phydev->speed = SPEED_100;
+ break;
+ case SWITCH_PORT_SPEED_1000:
+ phydev->speed = SPEED_1000;
+ break;
+ default:
+ phydev->speed = 0;
+ }
+ phydev->duplex = link.duplex ? DUPLEX_FULL : DUPLEX_HALF;
/* flush the address translation unit */
mutex_lock(&priv->reg_mutex);