Post Go back to editing

Integrating adi,axi-spi-engine, adi,axi-dmac, and adi,ad7380

Category: Software

I have two PetaLinx/Yocto projects for two separate boards.  One is PetaLinux 2020.1/Yocto Zeus 3.0, and PetaLinux 2020.2/Yocto Zeus 3.0.  These target different linux-xlnx 5.4 kernels.

I am trying to develop a custom layer with support for the AD7380, including the adi,axi-spi-engine, adi,axi-dmac, and a modified version of adi,ad7380 to take advantage of the DMA.  This is because I have a data acquisition board that connects to either of the two base boards.

The PetaLinux kernel provides the IIO subsystem, and the custom layer provides packages  libiio, libiio-tests, and libiio-iiod via IMAGE_FEATURES and FEATURE_PACKAGES in the filesystem, for each base board.

I now need to integrate the adi,axi-spi-engine, adi,axi-dmac, and adi,ad738x drivers into the system.  Are these to be installed as loadable kernel modules?  I assume the device tree will inform the kernel which modules to load at startup?

It looks like the spi-engine is a parent of the ADC driver, so those are connected by the device tree.  And there is a handle to a DMA controller in the AD7380 device tree node to inform it of the DMA to use.

I also notice that the axi-spi-engine has been mainlined, but that I'll probably have to modify the driver to provide offloading support according to https://wiki.analog.com/resources/tools-software/linux-drivers/spi/spi_engine

I have HDL in the FPGA that is modeled after the zedboard AD7380 FMC project.

When I attempt to boot the system, I am getting a kernel panic with no useful messages at what stage there is a problem. I suspect I am not building and installing these drivers correctly.  Is there an example of how these drivers get compiled and installed in Yocto/PetaLinux?  Are there any other things I'm not thinking of that are needed to complete the integration of these drivers?

Top Replies

  • Hi

    I now need to integrate the adi,axi-spi-engine, adi,axi-dmac, and adi,ad738x drivers into the system.  Are these to be installed as loadable kernel modules?  I assume the device tree…
Parents
  • Hi

    I now need to integrate the adi,axi-spi-engine, adi,axi-dmac, and adi,ad738x drivers into the system.  Are these to be installed as loadable kernel modules?  I assume the device tree will inform the kernel which modules to load at startup?

    Nope, that has nothing to do with the devicetree. You need to change your kernel config so that your driver is compiled as module or built in. After that, you need to properly install all the modules in your file system  in /lib/modules/... (can be done in the petalinux build and probably is already being done). To automatically load the modules you might have to setup some udev rules (not sure from the top of my head if petalinux used udev but it surely supports some alternative if not udev).

    When I attempt to boot the system, I am getting a kernel panic with no useful messages at what stage there is a problem. I suspect I am not building and installing these drivers correctly.  Is there an example of how these drivers get compiled and installed in Yocto/PetaLinux?  Are there any other things I'm not thinking of that are needed to complete the integration of these drivers?

    Can you share your devicetree and the kernel panic? IIRC, for the spi offload engine we typically need at least a PWM signal to trigger the spi reads. Our AXI_PWM core is typically used for that which means the driver will also be needed.

    Also, is there any reason for nor using ADI kernel (at least for starters)? It will have already all the drivers compiled builted in the kernel... There's also meta-adi (we do not support the petalinux versions you want to use though) which facilitates with build ADI projects in petalinux.

    - Nuno Sá

  • Thanks. My ad738x driver is built out-of-tree, so is compiled as custom driver--because I'm modifying it.  I have it installed and loading now, without a panic.  Getting the interrupts connected was tricky, since the ZynqMP interrupt numbers are offset from the device tree interrupt numbers by 32.  The AD738x device tree node is a child of the spi-engine, and it has a reference to the axi-dmac node as well.  So I think I have all of that working now.

    The main reason for not using the ADI kernel or meta-adi is that I have custom boards that have BSPs only for kernel 5.4, under PetaLinux 2020.1 and 2020.2, which also restricts meta-adi to Zeus, which isn't supported.

    Thanks for the response, but I'm moving again.

Reply
  • Thanks. My ad738x driver is built out-of-tree, so is compiled as custom driver--because I'm modifying it.  I have it installed and loading now, without a panic.  Getting the interrupts connected was tricky, since the ZynqMP interrupt numbers are offset from the device tree interrupt numbers by 32.  The AD738x device tree node is a child of the spi-engine, and it has a reference to the axi-dmac node as well.  So I think I have all of that working now.

    The main reason for not using the ADI kernel or meta-adi is that I have custom boards that have BSPs only for kernel 5.4, under PetaLinux 2020.1 and 2020.2, which also restricts meta-adi to Zeus, which isn't supported.

    Thanks for the response, but I'm moving again.

Children
No Data