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 access the phy data using the application in the user space?

Other Parts Discussed in Thread: AM3354

Hi,

We are usging the AM3354 with Marvell's 88ee1111 as  phy. Now the NIC can not link. I am reading the source code. I need helps as follows.

1. How can I use the tools to access the MDIO interface? I want to check the phy status by MDIO interface.

2. When I reading the source code (arch/arm/mach-omap2/devices.c), I find a  struct variable.

  static struct cpsw_slave_data am33xx_cpsw_slaves[] = {
    {
        .slave_reg_ofs  = 0x208,
        .sliver_reg_ofs = 0xd80,
        .phy_id        = "0:00",
        .dual_emac_reserved_vlan = CPSW_PORT_VLAN_SLAVE_0,
    },
    {
        .slave_reg_ofs  = 0x308,
        .sliver_reg_ofs = 0xdc0,
        .phy_id        = "0:01",
        .dual_emac_reserved_vlan = CPSW_PORT_VLAN_SLAVE_1,
    },
};

I am confused that what is the slave_reg_ofs ?  I can not find the address in the AM335x ARM Cortex-A8 Microprocessors (MPUs) Technical Reference Manual.pdf.

Many Thanks!

  • Hi Jack,

    While I can't help you with the definition of the structure member you are asking about, I can help you access the PHY(s) directly by using functionality built into the hardware. Please take a look at the MDIO User Access registers described in sections 14.5.10.11 and 14.5.10.13 of the TRM. By using these register sets, you can directly access (both read and write) all attached PHY's.

    I'm sure one of our SW experts will chime in with the definition you requested, but hopefully this will help you move forward until they do.

    -DK

  • Not familiar with the AM3354. If the CPSW driver supports it, you can access the MDIO bus from userspace via socket ioctl commands SIOCGMIIREG and SIOCSMIIREG. You may need to do a SIOCGMIIPHY to populate the struct ifreq. Also, there are some open source tools. I think their names are ethtool and mii-tool. They are quite complicated though.

  • Hi DK, thank you. I have tested it under the u-boot environment. I can capture the output of mdio,but it is not I expected. The phy addresss field in the output of mdio continues to change from 0 to 32. I guess that it is scanning phy device. So  I disabled the bit30 of MDIO Control Register and operate the MDIOUSERACCESS0 register,there are no any output. What is the differenc between the MDIOUSERACCESS0 and MDIOUSERACCESS1?  Thanks!