LAN9662 PCIe NIC / LAN9696 with Raspberry PI 4 CM as external CPU

This describes how to use the combination of a Raspberry PI 4 Compute Module with the Raspberry PI Compute Module IO Board and a EVB-LAN9662-NIC or EVB-LAN9696-24port board.

The EVB-LAN9662-NIC and EVB-LAN9696-24port boards are pre-configured for PCIe boot mode.

Resources

This configuration uses the Raspberry PI 4 as the host CPU and therefor the device tree used for this setup is the one for the Raspberry PI, so you will need to consult the Raspberry PI documentation for details about this SoC.

Kernel Configuration

The configuration used is a very slim version of the standard Raspberry PI 4 configuration. Only the bare minimum needed for a network setup has been added, so you will not be able to use e.g. display, mouse and keyboard combo with this configuration. Instead you will have to use a serial/USB console to a workstation to monitor and interact with the system.

Devicetree Configuration

The system uses the Raspberry PI 4’s device tree with a addition of a PCIe device node that hosts all the device tree nodes for the PCIe NICs onboard devices.

These childnodes are mapped into the PCIe Controllers Bus Window to allow the PCIe NIC SwitchDev driver to access all the needed hardware registers via the PCIe Bus.

In order to switch between the EVB-LAN9662-NIC and EVB-LAN9696-24port boards, set the pcb variable in the u-boot environment:

EVB-LAN9662-NIC:

setenv pcb rpi
saveenv

EVB-LAN9696-24port:

setenv pcb rpi-lan969x
saveenv

Using the BSP Raspberry PI 4 CM image

This assumes that you have a Raspberry PI 4 Compute Module with the accompanying Raspberry PI 4 CM IO Board and a LAN9662- or LAN9696 PCIe NIC mounted in the PCIe slot on the IO Board.

The BSP release file mscc-brsdk-arm64-<version>.tar.gz contains the image file rpi4cm.img that is needed to boot the system and get the PCIe NIC enabled.

When unpacking the release file mentioned above you will find the image file here:

mscc-brsdk-arm64-<version>/arm64-armv8_a-linux-gnu/standalone_rpi/release/rpi4cm.img

You will also find a readme file that explains the image content and the boot process:

mscc-brsdk-arm64-<version>/arm64-armv8_a-linux-gnu/standalone_rpi/release/README.adoc

The next step depends on the type of Raspberry PI 4 CM that you have:

  • If your CM4 has onboard eMMC you need to write the rpi4cm.img image found in the BSP release to the eMMC.

  • If your CM4 has no onboard eMMC you need to write the image to and SDCard and use that to boot your RPI System.

Writing the Raspberry PI 4 CM eMMC

First mount the CM4 module on the IO board and put a strap on the J2 pinheaders first position to disable eMMC boot.

Clone the RPI usbboot repo and build the tool:

git clone --depth=1 https://github.com/raspberrypi/usbboot
cd usbboot
make

Attach the RPI4 IO board (with the mounted CM) via a nanoUSB cable (to the USB slave port on the IO Board) and start the USB driver:

sudo ./rpiboot

Find the new usb device (e.g. /dev/sdX) using lsblk

lsblk --output NAME,FSTYPE,LABEL,UUID,PARTUUID,MOUNTPOINT

Write the rpi4cm.img image to the USB device:

sudo dd if=rpicm4.img of=/dev/sdX bs=8M status=progress oflag=direct

When done you should have two partitions on the device:

lsblk --output NAME,FSTYPE,LABEL,UUID,PARTUUID,MOUNTPOINT

sdX
├─sdX1 vfat   bootfs  37CA-39EC                            e088fd39-01
└─sdX2 ext4   rootfs  a4af13c6-d165-4cbd-a9f6-c961fef8255d e088fd39-02

Mount the boot device in ~/mnt/boot and edit the config.txt file and create an empty ssh file (to enable the ssh server):

mkdir -p ~/mnt/boot
sudo mount /dev/sdX1 ~/mnt/boot/
sudo touch ~/mnt/boot/ssh
sudo nvim  ~/mnt/boot/config.txt

In the config.txt file you should add an overlay to enable the USB ports (not the slave USB port) and a uart setting to enable the serial console via the PIN header, and enable uart support for the second stage bootloader (to get the logging out):

dtoverlay=dwc2,dr_mode=host
enable_uart=1
uart_2ndstage=1

Serial Console

To use the serial console to the Linux Kernel running on the Raspberry Pi you can attach a serial/USB converted to the J8 connector on the RPI 4 IO Board.

Pin Function

J8-6

Ground

J8-8

RPI TX

J8-10

RPI RX

You should then be able to get to the Linux console and login as root (no password).

Normal Boot

Remove the strap on the pinheader and powercycle the Raspberry PI board to start the system.

Using the serial console you should be able to login as root and see that you now have a number of available network interfaces: 1 on the Raspberry PI IO Board and 4 or 29, depending on the EVB.

Writing the Raspberry PI 4 CM SDCard

Insert the SDCard into a card reader slot and locate the new device using e.g. dmesg or lsblk and then write the image to the new device using dd:

sudo dd if=rpicm4.img of=/dev/sdX bs=8M status=progress oflag=direct

When done you should have two partitions on the device:

lsblk --output NAME,FSTYPE,LABEL,UUID,PARTUUID,MOUNTPOINT

sdX
├─sdX1 vfat   bootfs  37CA-39EC                            e088fd39-01
└─sdX2 ext4   rootfs  a4af13c6-d165-4cbd-a9f6-c961fef8255d e088fd39-02

You can now boot the system. You may want to use a serial/USB console as described in the previous section.