This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to get the 5-bit PHY address/id in Linux?

Other Parts Discussed in Thread: AM3359

Here I have a custom board with an AM3359 and two PHYs. How can I view the 5-bit PHY address/PHY id of eth0/eth1 in Linux?

  • try ethtool.

    you should be able to tell the PHY addresses from schematics as well.

  • You can print some information from u-boot function davinci_emac_initialize() or davinci_eth_phy_detect(),  in u-boot/drivers/net/davincy_emac.c. (It is valid for DM816x EVM). And you need set valid EMAC_MDIO_PHY_MASK. For example:

    ....

    phy_id = (tmp << 16) & 0xffff0000;
    printf("PHYID1: 0x%x\n", phy_id);

    if (!davinci_eth_phy_read(active_phy_addr, PHY_PHYIDR2, &tmp)) {
       active_phy_addr = 0xff;
       return(0);
    }

    phy_id |= tmp & 0x0000ffff;

    printf("PHYID2: 0x%x\n", phy_id);

    ....

  • I edited the function cpsw_slave_open() in drivers/net/ethernet/ti/cpsw.c and changed

    dev_info(priv->dev, "CPSW phy found : id is : 0x%x\n",

    to

    dev_info(priv->dev, "CPSW phy found : id is : 0x%x, addr: %d\n", slave->phy->phy_id, slave->phy->addr);

    and now the driver shows me its address when the interface is going up (ifconfig eth1 up).