Skip to content

Latest commit

 

History

History

cifx_m2

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Overview

The cifX/M.2 card is a netX90 based multi function PCIe device. It provides a SPI interface for accessing the netX90 as well as multiple GPIOs. GPIO at offset 7 can optionally be used as an interrrupt source (DIRQ) for the cifX driver.

The driver consists of the kernel modules ax99100-pci-spi and the optional ax99100-pci-gpio.

ax99100-pci-spi.ko:

The module abstracts the PCIe to SPI transfers via the Linux spidev interface. The module supports interrupt and DMA based tranfers. Accesses less than 8 byte are executed via fifo mode and may be slower than DMA.

ax99100-pci-gpio.ko (optional):

NOTE: Currently the build is disabled by default, since the current version is not compatible with the latest linux version.

The module delivers interrupts generated by the changes, by the netX, of the DPMs handshake cells (DIRQ pin) via a GPIO pin. If not loaded the cifX driver will poll the DPMs handshake cells.


Build the driver modules:

To build the kernel mode driver just enter this folder and run make.

make

Copy the driver modules into the desired kernel library folder which they are compiled for.

sudo make modules_install

Update the module dependencies in the modules.dep file.

sudo depmod

Loading ax99100-pci-spi:

By default the module will create the SPI device to access the netX90 on the cifX/M.2 card with SPI mode set to 3 and the maximum speed of 40Mhz. In this case the SPI interface will be /dev/spidev[x].0.

NOTE: Speed and mode can be easily configured by the user space application via the cifX driver SPI plugin or the drivers interface. For a detailed explanaition of the SPI plugin configuration refer to the Linux cifX Driver Documentation.

In case the SPI driver need to be changed or the maximum speed should be limited the module provides parameter arrays for configuration purposes. It is possible to register up to 3 SPI slave devices. The module parameter 0-2 will configure the SPI interfaces of the SPI slaves at chip select 0-2. Module parameter 0 will setup and grant access to the netX90 on the cifX/M.2 card.

Module parameters are:

  • modalias[0..2]= Optional, if not specified spidev is selected. In common Linux environment choose "spidev" as the driver which handles the SPI acccess. The device will appear than as /dev/spidev[x].0

    NOTE: Starting with kernel 5.x "spidev" was removed. You will need to use one of the following list https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/spi/spidev.c?h=v5.15.90#n687 (e.g. spi-petra)

  • mode[0..2]=[0..3] Optional, if not specified mode 3 is choosen.

  • max_speed_hz[0..2]= Optional, if not specified the maximum 40Mhz is configured. Speed configuration during runtime via the cifX SPI plugin or the drivers interface (e.g. spidev driver via SPI_IOC_[RD/WR]_MAX_SPEED_HZ) can not exceed the configured value.

Example: Configure the SPI interface (at chip-select 0) for accessing the netX90 based cifX/M.2 card with mode 3 and a maximum speed of 25Mhz.

modprobe ax99100-pci-spi modalias0=spidev mode0=3 max_speed_hz0=25000000

To enable the auto creation of spidev device at boot time, a configuration file must be created as follow.

echo "options ax99100-pci-spi modalias0=spidev" > /etc/modprobe.d/cifx-m2.conf

Loading ax99100-pci-gpio (optional):

NOTE: The current implementation may not be compatible with the latest kernel version and is therefore disabled by default.

To enable interrupt support for the DPMs handshake cells:

modprobe ax99100-pci-gpio

Loading the module will create a gpio chip module in the sysfs directory (/sys/class/gpio/). After the exporting the GPIO (offset 7) the following GPIO sysfs configuration is required:

direction  = "in"
edge       = "rising"
active_low = "1"

Add the path to the "value" file in the SPI plugin configuration (e.g. /opt/cifx/plugins/netx-spm/config0):

Irq=/sys/class/gpio/gpio[xxx]/value

Enable irq for the device (e.g. /opt/cifx/FW/device.conf):

irq=yes