AD9361 No-OS driver under Linux userspace

Someone asked me by email:


Hello,

My apologies if the answer to this is readily available on the web, but I couldn't manage to find anything.

Would you be able to point me at a device tree entry that i could use for using the no-os ad9361 driver code under linux? I'm specifically looking for the device tree entry that will create the "/dev/spidev32766.0" device. I have put something together myself based on tidbits i gathered around the web, but i'm getting a "failed to transfer one message from queue" error with 'my' spidev device. The no-os driver works fine on my zedboard+fmcomms2 setup when running bare metal, so it appears that i have something messed up in my linux-based spi driver or its configuration.

For bonus points, is there a uio device tree entry to support the uio device the no-os linux driver is attempting to open for the adc and dac dma's?

Regards,

Joe

  • 0
    •  Analog Employees 
    on Jun 13, 2014 12:45 PM

    Joe,

    Add the following entries to the ADV7511 devicetree (linux/arch/arm/boot/dts/zynq-zed-adv7511.dts at xcomm_zynq · analogdevicesinc/linux · GitHub):

        fmc_spi: spi@e0006000 {

            bus-num = <1>;

            compatible = "cdns,spi-r1p6", "xlnx,zynq-spi-1.00.a", "xlnx,ps7-spi-1.00.a";

            interrupt-parent = <&gic>;

            interrupts = < 0 26 4 >;

            clock-names = "ref_clk", "aper_clk", "pclk";

            clocks = <&clkc 25>, <&clkc 34>, <&clkc 34>;

            num-chip-select = <4>;

            reg = < 0xe0006000 0x1000 >;

            speed-hz = <100000000>;

            xlnx,has-ss0 = <0x1>;

            xlnx,has-ss1 = <0x1>;

            xlnx,has-ss2 = <0x1>;

            xlnx,spi-clk-freq-hz = <100000000>;

            #address-cells = <1>;

            #size-cells = <0>;

            spi@0 {

                compatible = "spidev";

                spi-cpha;

                reg = <0>;

                spi-max-frequency = <1000000>;

            };

        };

        ad9361: ad9361@79020000 {

            compatible = "generic-uio";

            reg = <0x79020000 0x6000>;

        };

    We will also add this information on our wiki soon.

    Thanks,

    Dragos

  • 0
    •  Analog Employees 
    on Jun 13, 2014 3:58 PM

    Hi Joe,

    I'm glad that it works.

    Regards,

    Dragos

  • Dragos,

    I've confirmed this works. I did have problems on an older version of the kernel on which i first tried it, not sure why. But updating to the following and all works as i hoped:

    commit df77180ff6c897c6869498097158e9edf16cf838 (HEAD, xcomm_zynq)

    Author: Lars-Peter Clausen <lars@metafoo.de>

    Date:   Wed Jun 11 14:38:20 2014 +0200

        iio: ad9361: Remove unnecessary spi_set_drvdata(NULL)

        The core takes already care of setting drvdata to NULL, no need to do this

        manually.

        Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>

    Thanks!

    Joe

  • 0
    •  Analog Employees 
    on Feb 8, 2018 4:50 PM

    Hi Narendra,

    Why do you not use the kernel drivers if you want to use Linux? You can download a full SD card Linux image from our wiki: Zynq & Altera SoC Quick Start Guide [Analog Devices Wiki] 

    Thanks,

    Dragos

  • Hello Engineers,

       can you please explain more about how to compile no-os driver on linux. i have tried but no-os driver required bsp's files which is not found in linux application project. i.e xparameters.h, xcache.h etc. 

    -Narendra 

  • 0
    •  Analog Employees 
    on Feb 9, 2018 4:22 AM

    You need a special devicetree - take zynq-zc706-adv7511-ad9361-4-fmcomms2-3-4-userspace.dts as an example - update it according to your setup. This solution will use spidev for controlling the AD9361 and uio for accessing the PL cores.

    For building the no-OS software, an example Makefile is also provided (Makefile.linux).

    Keep in mind that libiio is not compatible with the no-OS drivers.

    Dragos

  • Hello Dragos,

       we have already downloaded kernel driver, but we want to use our own application in user space. somewhere it is mention that its is possible with libiio and uio. that we  know,

        can you please provide us direction to use our own application in the user space, we have our own DMA to transfer the data to FPGA from ARM, only we want to control AD9361 through SPI and IP core in  FPGA so, how to access SPI and IP Core function in linux driver and integrate with our own application.

    -Narendra 

  • 0
    •  Analog Employees 
    on Feb 23, 2018 8:47 AM

    Did you enable the UIO support in kernel (CONFIG_UIO_DMEM_GENIRQ)?

    Dragos

  • Hello Dragos,

       as you told we have updated the device tree. we have found spi but still we did not get ad9361-uio entry. because of that ad9361 init get failed.

    - Narendra  

  • 0
    •  Analog Employees 
    on Feb 26, 2018 10:53 AM

    Narendra,

    ad9361-iiostream example requires the standard kernel drivers, not the no-OS userspace ones. If you want to run this example, use the unmodified SD card image.

    Thanks,

    Dragos