How to add the AD9361 Linux driver on Petalinux

Hello,

I need to add the AD9361 Linux driver on Petalinux 2016.4 for a project with Xilinx Zynq Ultrascale.

I can't change our kernel with the Analog Devices one, so if I understood well (from the other forum posts), I must build a kernel module of the mentioned driver. Is it correct?

I'm new on Linux, and probably my question is dummy: what are the involved files to build the kernel module of the AD9361?

Further, the ".dtsi" file is the initial configuration of the device with the Linux driver. Can I use the same method to initialize the AD9361 also if I will implement a kernel module?

Thanks and Regards

  • Hi,

    May I know why changing the kernel source is not an option?

    Not sure if a kernel module will help you in your situation.

    Modules are generally build from the same kernel, which they are loaded in.

    Regarding the device trees question. Linux kernel modules and open firmware device tress are two separate things, they are not related and don't influence each other. So yes they work equally well.

    -Michael

  • Hi,

    thanks for your reply. Some colleagues are working on a custom kernel, so Petalinux is only a mean to work on other task.

    Ramon

  • Hello Michael,

    I added successfully a kernel module in Petalinux 2016.4with the files (ad9361.c, ad9361.h, cf_axi_adc.h, ad9361_conv.c), below my console output

    root@plnx_arm:~# insmod /lib/modules/4.6.0-xilinx/extra/ad9361-drv.ko
    ad9361 spi32766.0: ad9361_probe : enter (ad9361)

    root@plnx_arm:~# find / -name "*ad9361*"
    /sys/bus/spi/drivers/ad9361
    /sys/bus/platform/devices/79020000.axi_ad9361
    /sys/devices/soc0/amba_pl/79020000.axi_ad9361
    /sys/firmware/devicetree/base/amba/spi@e0006000/ad9361-phy@0
    /sys/firmware/devicetree/base/amba_pl/axi_ad9361@79020000
    /sys/module/ad9361_drv
    /sys/module/ad9361_drv/drivers/spi:ad9361
    /lib/modules/4.6.0-xilinx/extra/ad9361-drv.ko

    I would like to test the driver directly with sysfs. What must I enable to perform it?

    In AD9361 high performance, highly integrated RF Agile Transceiver Linux device driver [Analog Devices Wiki] 

    are mentioned the related driver files: cf_axi_adc_core.c cf_axi_adc_ring_stream.c. Do I have to add kernel module with these files? Or the AD98361 driver can work well without them?

    Thanks and Regards

  • Yes - there is a problem with your device tree.

    Looks like your reset-gpios is somehow using the phandle from a your clocks.

    -Michael

  • Hi,

    I have built a kernel module for AD9361 using only the files for the SPI, but i got this message during the loading of the ko file

    root@plnx_arm:~# insmod /lib/modules/4.6.0-xilinx/extra/ad9361-drv.ko
    ad9361 spi32766.0: ad9361_probe : enter (ad9361)
    /amba/spi@e0006000/ad9361-phy@0: could not get #gpio-cells for /clocks/clock@0
    /amba/spi@e0006000/ad9361-phy@0: could not get #gpio-cells for /clocks/clock@0
    ad9361 spi32766.0: ad9361_reset: by SPI, this may cause unpredicted behavior!

    and sometime the SW hangs on.

    Is this issue related to the device tree? How can I solve it?

    Thanks and Regards