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.

am335x evm use MDIO to access the phy register from userspace

Other Parts Discussed in Thread: TLK110

Hi,

I use am335x evm, I want to access the phy register from userspace.

The am335xevm is use platform device for phy.

How to access the phy register?? Or

Should I write a character driver to access the phy register??

BR,

PC

  • Maybe use the socket ioctl() SIOCGMIIREG and SIOCSMIIREG messages.

  • Hi, I try to use SIOCGMIIREG / SIOCSMIIREG to access thephy register.

    But I hget an error message "SIOCGMIIREG on eth1 failed: Operation not supported".

    Do I need to modify some settings for the two ioctl ???

    BR,

    PC.

  • I don't know for sure. A couple guesses. The phy_id in the mii_ioctl_data structure usually has to match the actual phy id. Maybe your kernel is compiled without PHY MDIO support. From the am335x_evm_defconfig, I would guess that CONFIG_TI_DAVINCI_MDIO is the kernel config that needs double checking.

  • Hi,

    I have check that .config of kernel.

    # CONFIG_STMMAC_ETH is not set
    CONFIG_NET_VENDOR_TI=y
    # CONFIG_TI_DAVINCI_EMAC is not set
    CONFIG_TI_DAVINCI_MDIO=y
    CONFIG_TI_DAVINCI_CPDMA=y
    CONFIG_TI_CPSW=y
    CONFIG_TLK110_WORKAROUND=y
    CONFIG_PHYLIB=y

    The CONFIG_TI_DAVINCI_MDIO is enable.

    And I find that "SIOCGMIIPHY on eth1 failed: Operation not supported"

    Hoe to check this issue??

    BR,

    PC.

  • Looks like your platform has more than one interface? Maybe the wrong interface? Not sure how to force the socket layer to open specific interface. You could try looking at the utilities ethtools or miitools to see how they do this sort of thing. Sorry. That's all I got.

  • Hi,

    I use ethtool. & ifconfig -a to check the interface, just one eth1 interface.

    And the use ifconfig eth1 up, I can get CPSW phy_id.

    root@am335x-evm:/var/volatile/tmp# ifconfig -a
    eth1      Link encap:Ethernet  HWaddr D4:94:A1:91:DC:1D  
              inet addr:172.17.235.199  Bcast:172.17.235.255  Mask:255.255.255.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:4636 errors:0 dropped:387 overruns:0 frame:0
              TX packets:1277 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:984014 (960.9 KiB)  TX bytes:79425 (77.5 KiB)
              Interrupt:40

    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:140 errors:0 dropped:0 overruns:0 frame:0
              TX packets:140 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:247489 (241.6 KiB)  TX bytes:247489 (241.6 KiB)

    root@am335x-evm:/var/volatile/tmp# ifconfig eth1 up
    [  677.850769]
    [  677.850769] CPSW phy found : id is : 0x4dd074
    [  677.858123] PHY 0:01 not found


    root@am335x-evm:/var/volatile/tmp# ./ethtool eth1
    Settings for eth1:
            Current message level: 0x00000000 (0)
                                   
            Link detected: yes

    BR,

    PC.