Changeset 30846


Ignore:
Timestamp:
2012-03-07T17:32:43+01:00 (6 years ago)
Author:
juhosg
Message:

generic: ar8216: use ar8216_read_port_link to get the CPU port link parameters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/generic/files/drivers/net/phy/ar8216.c

    r30845 r30846  
    930930{ 
    931931        struct ar8216_priv *priv = phydev->priv; 
     932        struct switch_port_link link; 
    932933        int ret; 
    933934        if (phydev->addr != 0) { 
     
    935936        } 
    936937 
    937         phydev->speed = priv->chip == AR8316 ? SPEED_1000 : SPEED_100; 
    938         phydev->duplex = DUPLEX_FULL; 
    939         phydev->link = 1; 
     938        ar8216_read_port_link(priv, phydev->addr, &link); 
     939        phydev->link = !!link.link; 
     940        if (!phydev->link) 
     941                return 0; 
     942 
     943        switch (link.speed) { 
     944        case SWITCH_PORT_SPEED_10: 
     945                phydev->speed = SPEED_10; 
     946                break; 
     947        case SWITCH_PORT_SPEED_100: 
     948                phydev->speed = SPEED_100; 
     949                break; 
     950        case SWITCH_PORT_SPEED_1000: 
     951                phydev->speed = SPEED_1000; 
     952                break; 
     953        default: 
     954                phydev->speed = 0; 
     955        } 
     956        phydev->duplex = link.duplex ? DUPLEX_FULL : DUPLEX_HALF; 
    940957 
    941958        /* flush the address translation unit */ 
Note: See TracChangeset for help on using the changeset viewer.