The ADIN1200 is a low power single port 10/100 Mb Ethernet transceiver with low latency specifications primarily designed for industrial Ethernet applications.
The ADIN1300 is a low power single port Gigabit Ethernet transceiver with industry leading latency specifications primarily designed for industrial Ethernet applications.
This design integrates an Energy Efficient Ethernet PHY core plus all the associated common analog circuitry, input and output clock buffering, the management interface and subsystem registers as well as the MAC interface and control logic to manage the reset and clock control and pin configuration.
The 2 PHYs are similar from an interfacing perspective, meaning that the HW & SW interfaces are identical. The main difference is that the ADIN1300 supports gigabit speeds.
The PHY can be interfaced with the following: MII, RGMII, RGMII with internal delays (on RX, TX or both), RMII.
Source | Mainlined? |
---|---|
drivers/net/phy/adin.c | Yes |
Function | File |
---|---|
driver | drivers/net/phy/adin.c |
compatibility layer for ADI kernel | drivers/net/phy/adin-compat.h |
Documentation | adi,adin.yaml |
The ADIN PHY driver instantiates via Linux's phylib framework, which is typically enabled on most systems.
Depending on the MAC driver that is used and the operating mode (MII, RGMII, RMII), a device-tree entry for the PHY may or may-not be needed. The PHY can be configured via HW pins (see datasheet), or via SW.
Optional properties (for MAC):
Optional properties (for PHY):
Example: ethernet-mac0 { #address-cells = <1>; #size-cells = <0>; phy-mode = "rgmii-id"; ethernet-phy@0 { reg = <0>; adi,rx-internal-delay-ps = <1800>; adi,tx-internal-delay-ps = <2200>; }; }; ethernet-mac1 { #address-cells = <1>; #size-cells = <0>; phy-mode = "rmii"; ethernet-phy@1 { reg = <1>; adi,fifo-depth-bits = <16>; }; };
Configure kernel with “make menuconfig” (alternatively use “make xconfig” or “make qconfig”)
Linux Kernel Configuration Symbol: ADIN_PHY [=y] Type : tristate Prompt: Analog Devices Industrial Ethernet PHYs Location: -> Device Drivers -> Network device support (NETDEVICES [=y])│ (1) -> PHY Device support and infrastructure (PHYLIB [=y]) Defined at drivers/net/phy/Kconfig:208 Depends on: NETDEVICES [=y] && PHYLIB [=y]
Short version is: a cable is plugged into the ethernet port (to which the PHY is associated) and traffic starts to happen, as in a normal Linux OS environment.
But on the slightly more advanced side, see the sections below.
If NetworkManager isn't running, it sometimes works to obtain a DHCP lease via dhclient eth0 [or eth1 or eth2, depending which MAC is attached to the ADIN PHY].
This tool will display the general status of the available network interfaces. If they’ve obtained an IP address, RX packets/errors/dropped/etc, TX packets/errors/dropped/etc, MAC address, etc.
Typically, if both TX & RX values are incremented, it means that it is working. Also note that there are error counters; if only the TX/RX counters increment, something may be wrong in the configuration between MAC & PHY, or sometimes at the physical configuration (i.e. clocks not working, pins not connected properly, etc).
root@analog:~# ifconfig eth0 Link encap:Ethernet HWaddr d6:41:50:ed:3b:65 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:609895 errors:5 dropped:0 overruns:0 frame:0 TX packets:286926 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (647.6 MB) TX bytes:0 (38.7 MB) Interrupt:23 eth1 Link encap:Ethernet HWaddr 00:0a:35:03:73:d9 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) Interrupt:24 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:8 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:480 (480.0 B) TX bytes:480 (480.0 B)
This tool queries the MAC & PHY via the MAC driver. The MAC driver should also allows access to the PHY registers.
ethtool can be used to show & override link settings and other parameters for the MAC & PHY.
Links for the tool:
root@analog:~# ethtool eth0 Settings for eth0: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full ==== Example: Seeing MAC & PHY info ==== 1000baseT/Half 1000baseT/Full Supported pause frame use: No Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full Advertised pause frame use: No Advertised auto-negotiation: Yes Advertised FEC modes: Not reported Link partner advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Link partner advertised pause frame use: Symmetric Link partner advertised auto-negotiation: Yes Link partner advertised FEC modes: Not reported Speed: 100Mb/s Duplex: Full Port: MII PHYAD: 0 Transceiver: internal Auto-negotiation: on Link detected: yes
ethtool -s eth0 speed 10 duplex full autoneg off ethtool -s eth0 speed 100 duplex full autoneg off ethtool -s eth0 autoneg on
The PHY supports configuration of the MDI/MDI-X auto-switch for twisted pairs. This can also be configured via ethtool.
ethtool -s eth0 mdix auto # auto-mdix (there is no way to set preference; # default MDI is preferred) ethtool -s eth0 mdix off # MDI mode manual ethtool -s eth0 mdix on # MDIX mode manual
root@analog:~# ethtool --phy-statistics eth0 PHY statistics: total_frames_checked_count: 1870 length_error_frames_count: 342 alignment_error_frames_count: 0 symbol_error_count: 0 oversized_frames_count: 0 undersized_frames_count: 0 odd_nibble_frames_count: 0 odd_preamble_packet_count: 0 dribble_bits_frames_count: 0 false_carrier_events_count: 0
This tool is not very official, but it is very powerful for PHYs. It’s currently hosted here: https://github.com/wkz/phytool
Format of the command is:
phytool read eth0/0/phytool write eth0/0/ <16-bit-hex-value>
Example for reading the PHY ID:
root@analog:~# phytool read eth0/0/0x2 0x0283 root@analog:~# phytool read eth0/0/0x3 0xbc30
All registers from 0x00 to 0x1f (which are defined by the IEEE standard) can be accessed with just
phytool read eth0/0/phytool write eth0/0/
Since only Clause 22 is available accessing MMD regs needs to be done via registers 0x10 & 0x11.
All registers above register address 0x1f are MMD registers.
Example reading FcFrmCntL reg (lower half of the total_frames_checked_count value):
root@analog:~# phytool write eth0/0/0x10 0x940B root@analog:~# phytool read eth0/0/0x11 0x01c5
Example resetting the PHY:
root@analog:~# phytool write eth0/0/0x10 0xFF0C root@analog:~# phytool write eth0/0/0x11 0x1
Link: https://github.com/analogdevicesinc/wiki-scripts/blob/master/linux/adintool.sh
When downloading, make sure the script is made executable.
Usage: adintool.sh[args] setup - setup phytool and ethtool required for demo WARNING: will override system tools dump_regs - show all reg values WARNING: some registers will be cleared on read phy_read_mmd - read value from a MMD register phy_write_mmd - write value to MMD register cable_diagnostics - run cable diagnostics on cable WARNING: puts device into special mode. device won't send data during this mode
Needs be run the first time. Make sure that there is internet connectivity and then install basic things:
./adintool.sh setup
The most useful command is to dump registers. This will read all registers that are specified in the datasheet and show their current value.
Should be used with caution as some registers get cleared on read, and can interfere with some internal operation of the Linux driver (for EEE for example).
Example:
./adintool.sh dump_regs eth0 [could be eth1]
This runs a sequence of register changes to put the PHY into diagnostics mode, which interrupts normal operation.
Then a diagnostics will be run on the cable and the results of the registers will be read back.
./adintool.sh cable_diagnostics eth0
This is a more system-general test but it also validates the PHY.
On one of the endpoints with the ADIN1300, run:
iperf -s
and on another system
iperf -c
Then reverse the commands on the hosts. iperf only works in one direction.
One one side, generate a file with random data (say 1GB)
dd if=/dev/urandom of=test.data bs=1M count=1000 sha256sum test.data
Then transfer the data to the other side with scp,ftp,etc:
scp test.data root@
On the other host check the hash
sha256sum test.data== should be identical with the first hash
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
全部0条评论
快来发表一下你的评论吧 !