ADIN1320

ADIN1320 PHY Linux Quick Start Guide.

In this guide, we’ll provide the steps you need to follow in order to connect the ADIN1320EBZ-U1 to a development board running Linux, and use the ADIN1320 as a PHY for one of the network interfaces.

Hardware requirements

For this setup you will need the following boards or hardware accessories:

  • ADIN1320EBZ-U1

  • Zedboard - Zynq7000 development board

  • LPC FMC to GPIO converter.

  • 5V USB C or 5-24V power supply

  • Cat5+ ethernet cable or a 100BASE-FX capable SFP module.

  • Jumper wires for the connecting the MII and MDIO to the FMC converter.

  • SD card

Eval board setup

The following jumpers and switches will need to be configured on the ADIN1320EBZ-U1 board:

Jumper

Position

P21

On

P18

On

This will power off the MAX32670 microcontroller on the board, and keep the ADIN1300 in the reset state.

S11 switch

Position

MAC_IF_SEL0

On

MAC_IF_SEL1

On

MAC_IF_SEL2

On

This will configure the ADIN1320 in the RMII or MII to Copper or Fiber mode.

Rotary switch

Position

S3

3

S10

1

S5

4

S7

2

S2

4

S9

1

S4

3

S6

1

This will result in the host interface being configured as MII and the advertised speed as 100BASE-TX/FX full duplex. Check out tables 15-18 in the ADIN1320 datasheet for a complete list of configuration options.

Important

If you want to use an SFP module (inserted into M1) instead of the RJ45 connector, you will need to bridge the P9 header

S8

Position

PHY_AD0

On

PHY_AD1

Off

PHY_AD2

Off

PHY_AD3

Off

The S8 switch is used to configure the PHY address of the ADIN1320. For this setup we are assigning the address 1. It is arbitrary and you can change it in case you have multiple PHYs on the same MDIO interface. Please note that ADIN1300 has the address 0 assigned to it, so if you’re getting it out of reset (P18 - Off), the ADIN1320 should have a PHY_ADDR other than 0.

There are some other headers which should be left in the default state. You can cross check their position with the following setup:

https://wiki.analog.com/_media/resources/tools-software/linux-drivers/net-phy/image_3_.jpg

SD card setup

The next step is to flash a Linux distribution image to an SD card. For this, you can use Kuiper Linux, as it contains everything (kernel and HDL images, devicetree, rootfs) you need to get started.

You will have to extract the Kuiper Linux archive and then flash the .iso image to the SD card. If you’re unsure how to do that, you can use a tool such as Balena etcher.

After this is done:

If you’re using a Linux host PC, this can be done as following:

unzip adin1320.zip -d adin1320_dt
cp adin1320_dt/BOOT.BIN /media/$USER/BOOT/
cp adin1320_dt/devicetree.dtb /media/$USER/BOOT/
cp /media/$USER/BOOT/zynq-common/uImage /media/$USER/BOOT/

You can now insert the SD card in the Zedboard and try to boot. The board has a UART to USB converter (J14), through which we can see the boot log and interact with the userspace terminal.

The steps are the following:

  • Insert the SD card.

  • Connect your PC to the Zedboard (J14) using a micro USB cable.

  • Connect the power adapter.

  • Power on the board using the SW8 switch.

  • Connect using a serial terminal emulator (e.g tio for Linux or Putty for Windows). The UART settings are 115200/8N1. You may need to manually set the CR after every LF option.

  • You should see a boot log or terminal window through the emulator. If not, press enter, since the board may have already booted.

You may now switch off the board.

Testing the ADIN1320EBZ-U1

At this point we can connect the ADIN1320EBZ-U1 to the development board and start testing. The pinout between the ADIN1320 board and the FMC extender should be the following:

ADIN1320EBZ pin(P4, P19)

FMC pin

MDIO

LA11_P

MDC

LA11_N

RXCLK

LA00_CC_P

RXER

LA01_CC_N

RXCTL

LA07_N

RXD0

LA02_P

RXD1

LA02_N

RXD2

LA03_P

RXD3

LA03_N

TXCLK

LA04_N

TXCTL

LA07_P

TXD0

LA09_P

TXD1

LA09_N

TXD2

LA06_P

TXD3

LA06_N

GND

GND

In order to work around an issue with the ADIN1320, you will have to use the following steps when testing the setup:

  • Connect the FMC extender to the Zedboard.

  • Only connect the MDIO and MDC (and GND) signals to the FMC extender.

https://wiki.analog.com/_media/resources/tools-software/linux-drivers/net-phy/image_4_.jpg
  • Power cycle the ADIN1320EBZ-U1 board.

  • Boot Linux on the Zedboard.

  • Connect the other MII signals.

https://wiki.analog.com/_media/resources/tools-software/linux-drivers/net-phy/image_5_.jpg
  • Connect an Ethernet cable to P11 (or a SFP module to M1).

  • Check if the link is up by running ip a in Zedboard terminal.

$ ip a

17: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether cc:96:e5:c7:d8:64 brd ff:ff:ff:ff:ff:ff
    inet 10.48.65.151/24 brd 10.48.65.255 scope global dynamic noprefixroute eth0
       valid_lft 15504sec preferred_lft 15504sec
    inet6 fe80::e79f:ad8:ff14:4f5/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
18: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 00:e0:4c:68:04:5c brd ff:ff:ff:ff:ff:ff
  • You may now pass Ethernet traffic through the network interface.

At this point, we’re only using the generic Ethernet PHY driver for Linux. And unless you want to use some of the ADIN13xx particular features (such as frame checker counters, MDI/MDIX settings with ethtool), you don’t need the ADIN1320 Linux driver. For more details on various ways to test the driver you can check out the Driver testing section in ADIN1300/ADIN1200.

Compiling the Linux driver for ADIN1320

For this step you will need a PC running a Linux distribution. We’ll use the ADI Linux kernel fork.

Before compiling the custom kernel, you’ll need to install the following dependencies:

sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison openssl device-tree-compiler gcc-arm-linux-gnueabihf u-boot-tools

Clone the ADI Linux repository:

git clone :git-linux.git
cd linux
git checkout dev:`adin1320+`

Compile the kernel for the Zedboard:

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
make zynq_xcomm_adv7511_defconfig -j4
make -j4 UIMAGE_LOADADDR=0x8000 uImage
sudo make modules_install INSTALL_MOD_PATH=/media/$USER/rootfs

After the build is done, insert the SD card in your PC and copy the kernel image to the BOOT partition:

cp arch/arm/boot/uImage /media/$USER/BOOT/
sync

Insert the SD card back in the Zedboard and follow the same process described in the Testing the ADIN1320EBZ-U1 section.