Home > OS >  Drive phy_device structure members supported what meaning be? Phydev -> supported value is how to
Drive phy_device structure members supported what meaning be? Phydev -> supported value is how to

Time:11-12

Recently in do phy chip, which drive the phydev - & gt; Supported on behalf of the fiber of cooper is wrong, the bit for copper, we should be fiber,
No matter how changes are copper, I want to ask is:
1. Phydev - & gt; Supported on behalf of what?
2. Phydev - & gt; The value of supported is how get? The hardware information? Or where is the assignment?
3. If phydev - & gt; Suppoerted error mean? How to change?

CodePudding user response:

The building Lord, hello, bold reply!
1, phydev - & gt; Supported should be representative of phy equipment support ability, such as support for 10 m, 100 m, 1000 m of this;
2, its value is at the time of initialization, specific several the following code map;
3, can modify the word in the initialization function attempts to modify,

General phy
 
Int genphy_config_init (struct phy_device * phydev)
{
Int val.
U32 the features;

The features of=(SUPPORTED_TP | SUPPORTED_MII
| SUPPORTED_AUI | SUPPORTED_FIBRE |
SUPPORTED_BNC);

/* Do we support autonegotiation? */
Val=phy_read (phydev MII_BMSR);
If (val & lt; 0)
Return val.

If (val & amp; BMSR_ANEGCAPABLE)
The features |=SUPPORTED_Autoneg;

If (val & amp; BMSR_100FULL)
The features |=SUPPORTED_100baseT_Full;
If (val & amp; BMSR_100HALF)
The features |=SUPPORTED_100baseT_Half;
If (val & amp; BMSR_10FULL)
The features |=SUPPORTED_10baseT_Full;
If (val & amp; BMSR_10HALF)
The features |=SUPPORTED_10baseT_Half;

If (val & amp; BMSR_ESTATEN) {
Val=phy_read (phydev MII_ESTATUS);
If (val & lt; 0)
Return val.

If (val & amp; ESTATUS_1000_TFULL)
The features |=SUPPORTED_1000baseT_Full;
If (val & amp; ESTATUS_1000_THALF)
The features |=SUPPORTED_1000baseT_Half;
}

Phydev - & gt; Supported & amp;=the features;
Phydev - & gt; Advertising & amp;=the features;

return 0;
}



Ar8035 phy:
 
Static int at803x_config_init (struct phy_device * phydev)
{
Int val.
int ret;
U32 the features;

The features of=SUPPORTED_TP | SUPPORTED_MII | SUPPORTED_AUI |
SUPPORTED_FIBRE | SUPPORTED_BNC;

Val=phy_read (phydev MII_BMSR);
If (val & lt; 0)
Return val.

If (val & amp; BMSR_ANEGCAPABLE)
The features |=SUPPORTED_Autoneg;
If (val & amp; BMSR_100FULL)
The features |=SUPPORTED_100baseT_Full;
If (val & amp; BMSR_100HALF)
The features |=SUPPORTED_100baseT_Half;
If (val & amp; BMSR_10FULL)
The features |=SUPPORTED_10baseT_Full;
If (val & amp; BMSR_10HALF)
The features |=SUPPORTED_10baseT_Half;

If (val & amp; BMSR_ESTATEN) {
Val=phy_read (phydev MII_ESTATUS);
If (val & lt; 0)
Return val.

If (val & amp; ESTATUS_1000_TFULL)
The features |=SUPPORTED_1000baseT_Full;
If (val & amp; ESTATUS_1000_THALF)
The features |=SUPPORTED_1000baseT_Half;
}

Phydev - & gt; Supported=the features;
Phydev - & gt; Advertising=the features;

If (phydev - & gt; Interface=={PHY_INTERFACE_MODE_RGMII_TXID)
Ret=phy_write (phydev AT803X_DEBUG_ADDR,
AT803X_DEBUG_SYSTEM_MODE_CTRL);
If (ret)
Return ret.
Ret=phy_write (phydev AT803X_DEBUG_DATA,
AT803X_DEBUG_RGMII_TX_CLK_DLY);
If (ret)
Return ret.
}

return 0;
}


Other phy should also is in a similar function of phydev - & gt; Supported by the field initialized
  • Related