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.

Linux/PROCESSOR-SDK-AM437X: PHY internal loopback

Part Number: PROCESSOR-SDK-AM437X
Other Parts Discussed in Thread: DP83620

Tool/software: Linux

Hi all,

I am working on latest SDK ti-processor-sdk-linux-am437x-evm-04.02.00.09-Linux-x86-Install. I have a custom board like am437x-gp-evm. we are using DP83620 ethernet PHY in RMII mode.

I want to test the internal loopback of phy as from data sheet we can able to see :

The DP83620 includes a Loopback Test mode for facilitating system diagnostics. The Loopback mode is
selected through bit 14 (Loopback) of the Basic Mode Control Register (BMCR). Writing 1 to this bit
enables MII transmit data to be routed to the MII receive outputs.

But  I am not able to access the BMCR register, Can anyone help me regarding how i should configure the phy in internal loopback mode.

I am using the dp83848.c driver for this PHY, But there are not doing  any BMCR register configuration in the driver. I am able to detect the PHY in kernel. If you need any other input let me know.

Here is the output of dmeg:

root@am437x-gc150:~# dmesg | grep mdio
[ 1.319494] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
[ 1.325633] davinci_mdio 4a101000.mdio: detected phy mask fffffff9
[ 1.333310] libphy: 4a101000.mdio: probed
[ 1.337361] davinci_mdio 4a101000.mdio: phy[1]: device 4a101000.mdio:01, driver TI DP83620 10/100 Mbps PHY
[ 1.347159] davinci_mdio 4a101000.mdio: phy[2]: device 4a101000.mdio:02, driver TI DP83620 10/100 Mbps PHY
[ 9.560753] TI DP83620 10/100 Mbps PHY 4a101000.mdio:02: attached PHY driver [TI DP83620 10/100 Mbps PHY] (mii_bus:phy_addr=4a101000.mdio:0)
[ 10.599989] TI DP83620 10/100 Mbps PHY 4a101000.mdio:01: attached PHY driver [TI DP83620 10/100 Mbps PHY] (mii_bus:phy_addr=4a101000.mdio:0)
root@am437x-gc150:~#
root@am437x-gc150:~# [ 41.050748] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
[ 41.058742] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

root@am437x-gc150:~# ifconfig
eth0 Link encap:Ethernet HWaddr C4:BE:84:CB:5F:58
inet addr:192.168.15.173 Bcast:192.168.15.255 Mask:255.255.255.0
inet6 addr: fe80::c6be:84ff:fecb:5f58%763860/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:49 errors:0 dropped:0 overruns:0 frame:0
TX packets:50 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6770 (6.6 KiB) TX bytes:9366 (9.1 KiB)
Interrupt:238

eth1 Link encap:Ethernet HWaddr C4:BE:84:CB:5F:5A
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1%763860/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:267 errors:0 dropped:0 overruns:0 frame:0
TX packets:267 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:187162 (182.7 KiB) TX bytes:187162 (182.7 KiB)

usb0 Link encap:Ethernet HWaddr 02:DC:C8:F8:75:35
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Thanks

  • Hi,

    We don't have any code examples at the moment to set the PHY into loopback. There looks some application examples on the web on how that can be done by reading the MII registers from a Linux application when using the ioctl SIOCSMIIREG. Perhaps use that as a starting point to see if you can modify one of the examples to write to the PHY to set the loopback mode. I have not tried it and I am not sure it would work, I can only suggest this as a starting point.

    Best Regards,
    Schuyler
  • Hi Schuyler,

    Thanks for your time.

    I went through the examples for  ioctl SIOCSMIIREG and I am able to access the PHY registers and modify it.

    Warm regards,

    Vimal