Wiki

This version (21 Oct 2021 12:42) was approved by Alexandru Tachici.The Previously approved version (21 Oct 2021 12:40) is available.Diff

ADIN1100 10BASE-T1L PHY Linux Driver

Supported Devices

Supported Boards

Description

The ADIN1100 is a low power single port 10BASE-T1L transceiver designed for industrial Ethernet applications and is compliant with the IEEE 802.3cg Ethernet standard for long reach 10 Mb/s Single Pair Ethernet. It integrates an Ethernet PHY core with all the associated analog circuitry, input and output clock buffering, the management interface control register and subsystem registers, as well as the MAC interface and control logic to manage the reset and clock control and pin configuration.

The PHY core supports the 1.0 V pk-pk operating mode and the 2.4 V pk-pk operating mode defined in the standard and can operate from a single power supply rail of 1.8V or 3.3V, with the lower voltage option supporting the 1.0 V pk-pk transmit voltage level.

The 1.0 V pk-pk operating mode, external termination resistors and independent Rx/Tx pins make the ADIN1100 suited to intrinsic safety applications.

The ADIN1100 has an integrated voltage supply monitoring circuit and power on reset circuitry to improve system level robustness.

The MDIO interface is a two-wire serial interface for communication between a host processor or MAC and the ADIN1100, thereby allowing access to control and status information in the PHY core management registers. This interface is compatible with both the IEEE 802.3 Standard Clause 22 and Clause 45 management frame structures.

The ADIN1100 is available in a 6 mm × 6 mm 40-ld package.

Source Code

Status

Files

Function File
driver drivers/net/phy/adin1100.c

Example platform device initialization

The ADIN 10BASE-T1L 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, RMII), a device-tree entry for the PHY may or may-not be needed. The PHY can be configured via HW pins (see datasheet).

Optional properties (for MAC):

  • phy-mode: this is a standard Linux property for ethernet devices to select an operating mode for the PHY, it is typically configured in the MAC configuration, and the MAC uses it to configure the mode of the PHY. For the ADIN PHY, accepted values are: mii, rmii
Example:


    ethernet-mac0 {
        #address-cells = <1>;
        #size-cells = <0>;

        phy-mode = "mii";

        ethernet-phy@0 {
            reg = <0>;
        };
    };

    ethernet-mac1 {
        #address-cells = <1>;
        #size-cells = <0>;

        phy-mode = "rmii";

        ethernet-phy@1 {
            reg = <1>;
        };
    };

Enabling Linux driver support

Configure kernel with “make menuconfig” (alternatively use “make xconfig” or “make qconfig”)

  1. Hit the search button (typically the slash “/” key)
  2. Type ADIN1100, then hit Enter; if nothing shows up, the driver is not available in your kernel tree, please use the ADI linux tree
  3. Press 1 (the key), then hit Enter
  4. You should see the location + dependencies for enabling the driver
Linux Kernel Configuration
Symbol: ADIN1100_PHY [=y]
Type  : tristate                                                                                                                                                                      
Prompt: Analog Devices Industrial Ethernet 10BASE-T1L 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]

Driver testing

This requires that another 10BASE-T1L PHY be connected to the other end of the network cable, or that a media converter be used to convert to normal twisted-pair ethernet that standard ethernet cables use.

Depending on the userspace image that is being used, the network cards may [or may not get a DHCP address]. This is because there is a NetworkManager instance that handles this automatically.

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 10BASE-T1L PHY].

ifconfig

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)

ethtool

This tool queries the MAC & PHY via the MAC driver. The MAC driver should also allows access to the PHY registers.

If ethtool does not work, it should be resolved in the MAC driver. The MAC driver is not in the direct scope of Analog Devices support, since MACs are typically manufactured & supported by other companies

ethtool can be used to show & override link settings and other parameters for the MAC & PHY.

Links for the tool:

Some features of ethtool described here are available in newer versions of ethtool. If some of them don't work, consider upgrading or getting a newer version

Example: Seeing MAC & PHY info

root@analog:~# ethtool eth0
Settings for eth0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Full 
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Full 
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Link partner advertised link modes:  10baseT/Full 
        Link partner advertised pause frame use: Symmetric
        Link partner advertised auto-negotiation: Yes
        Link partner advertised FEC modes: Not reported
        Speed: 10Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        Link detected: yes

Since the PHY can only do 10 Mbps full-duplex, the only operation possible here is to disable auto-negotiation and set preferred/forced master/slave

ethtool -s eth0 speed 10 duplex full master-slave forced-master
ethtool -s eth0 speed 10 duplex full master-slave forced-slave
ethtool -s eth0 autoneg on
ethtool -s eth0 autoneg on master-slave preferred-master
ethtool -s eth0 autoneg on master-slave preferred-slave
ethtool -s eth0 autoneg on master-slave forced-master
ethtool -s eth0 autoneg on master-slave forced-slave

ADIN1100 cable test tool

ADIN1100 supports multiple cable diagnostics options. Some of them could not be added in the driver as ethtool ops.

If you want control over those features from C code, add those files to your project:

Function File
Header adin10spe_phy.h
Code adin10spe_phy.c

Or you can compile the tool:

root@analog:~/adin1100# cmake CMakeLists.txt 
-- The C compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /root/adin1100
root@analog:~/adin1100# make
Scanning dependencies of target adin10spe_phy_tool
[ 33%] Building C object CMakeFiles/adin10spe_phy_tool.dir/adin10spe_phy.c.o
[ 66%] Building C object CMakeFiles/adin10spe_phy_tool.dir/adin10spe_phy_tool.c.o
[100%] Linking C executable adin10spe_phy_tool
[100%] Built target adin10spe_phy_tool
root@analog:~/adin1100# ls
CMakeCache.txt	CMakeFiles  CMakeLists.txt  Makefile  adin10spe_phy.c  adin10spe_phy.h	adin10spe_phy_tool  adin10spe_phy_tool.c  cmake_install.cmake
root@analog:~/adin1100# 

Check command line formatting via:

root@analog:~/adin1100# ./adin10spe_phy_tool help
ADIN10SPE_PHY cable diagnostics control tool:

Usage: adin10spe_phy_tool [interface name] [phy ID] [start-fg | stop-fg | start-test | stop-test | start-lb | stop-lb] ...
Example: adin10spe_phy_tool eth1 0 start-loopback pcs-loopback
Features:
    Frame Generator:
        Usage: adin10spe_phy_tool [interface name] [phy ID] [start-fg | stop-fg] [frame-control] [frame-output-mode] [frame-length] [inter-frame-gap] [frames-number]
            frame-control:  random-payload zeros-payload ones-payload alternating-ones-payload decrementing-bytes-payload
            frame-output-mode:  continous-mode burst-mode

        Example 1: adin10spe_phy_tool eth1 0 start-fg ones-payload burst-mode 100 50 10
        Example 2: adin10spe_phy_tool eth1 0 stop-fg

    Test mode:
        Usage: adin10spe_phy_tool [interface name] [phy ID] [start-test | stop-test] [test-mode]
            test-mode: 
                test1: repeatedly transmits the data symbol sequence (+1, –1)
                test2: transmits ten “+1” symbols followed by ten “-1” symbols
                test3: transmits as in non-test operation and in the master data mode

        Example 1: adin10spe_phy_tool eth1 0 start-test test2
        Example 2: adin10spe_phy_tool eth1 0 stop-test

    Loopback:
        Usage: adin10spe_phy_tool [interface name] [phy ID] [start-lb | stop-lb] [lb-mode]
            lb-mode:  pma-loopback pcs-loopback mac-loopback

        Example 1: adin10spe_phy_tool eth1 0 start-lb pcs-loopback
        Example 2: adin10spe_phy_tool eth1 0 stop-lb

    Software power-down:
        Usage: adin10spe_phy_tool [interface name] [phy ID] software-power-down [True | False]

        Example : adin10spe_phy_tool eth1 0 software-power-down True
root@analog:~/adin1100# 

Throughput testing - iperf

This is a more system-general test but it also validates the PHY.

More tools are available for this sort of testing (iperf3, netperf, etc), but iperf is one of the more basic/simple ones to do this validation. If this one achieves expected results, others should too

On one of the endpoints with the ADIN1100, run:

iperf -s

and on another system

iperf -c <ip-addr-of-the-other-system>

Then reverse the commands on the hosts. iperf only works in one direction.

Data integrity testing

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
<SHA256-hash-of-data>

Then transfer the data to the other side with scp,ftp,etc:

scp test.data root@<ip-addr-of-the-other-host>

On the other host check the hash

sha256sum test.data
<SHA256-hash-of-data> == should be identical with the first hash

Ethernet pointers

resources/tools-software/linux-drivers/net-phy/adin1100.txt · Last modified: 21 Oct 2021 12:41 by Alexandru Tachici