Showing results for 
Show  only  | Search instead for 
Did you mean: 
Registered: ‎04-23-2014

AXI Quad SPI driver can't set LSB first mode

I have instantiated an AXI Quad SPI in PL and I'm trying to set it to LSB first mode. According to the product guide this is supported. However, if I try to set LSB first mode through ioctl I get the error invalid argument. I have tried the following two ways to set the mode:


unsigned int lsb = 1;
ioctl(fd, SPI_IOC_WR_LSB_FIRST, &lsb);

int mode = SPI_LSB_FIRST;
ioctl(fd, SPI_IOC_WR_MODE32, &mode);

In both cases, I get the following printk on the console:

spidev spi2.0: setup: unsupported mode bits 8

Looking at the source code of the driver, this mode should be handled correctly. See line 409 here:


Is there any work around to make the driver accept this mode?


0 Kudos
2 Replies
Xilinx Employee
Xilinx Employee
Registered: ‎01-21-2008

Hi @cone83,

Yes, AXI Quad SPI IP does support the LSB First mode from h/w but only for "standard SPI mode" (SPIx1). The PG153.table2-5.page25 clearly mentioned the "In Dual/Quad SPI mode, only the MSB first mode of the core is allowed"

Also I can see from the Linux driver side as you pointed 

If you are using the SPIx1 interface to the AXI_QUAD_SPI_IP at the other end with SPIx1 (standard SPI mode), then does the attached device does it support the LSB mode or not? Could you please let us know what is used in other side of the AXI_QUAD_SPI_IP?

Our Linux SPI driver tests is provided at the wiki page -

Let me know if Linus Driver page help you to resolve your issue or not. If not then send us your DT to have a look and what is selected as a SPIx1 device from 3rd paty h/w & driver side to have a look why there is an error we are gettin it on Linux console ( send log for spesific -> "dmesg | grep -i spi" to have a look)

0 Kudos
Registered: ‎04-23-2014

@jadhavsthank you for the fast reply.

In Vivado the SPI mode is set to "standard" (see screenshot), which should match the table from the product guide:

Screenshot from 2020-02-21 09-12-45.png

The SPI interface is used for connecting to the configuration interface of an image sensor, which only supports LSB first. For now, I have implemented a bit reversal in software which serves as a work around.

The device tree only contains the auto-generated part for the SPI interface:

		image_sensors_spi_s0_spi: axi_quad_spi@a0050000 {
			bits-per-word = <8>;
			clock-names = "ext_spi_clk", "s_axi_aclk";
			clocks = <&zynqmp_clk 71>, <&zynqmp_clk 71>;
			compatible = "xlnx,axi-quad-spi-3.2", "xlnx,xps-spi-2.00.a";
			fifo-size = <16>;
			interrupt-names = "ip2intc_irpt";
			interrupt-parent = <&gic>;
			interrupts = <0 104 1>;
			num-cs = <0x1>;
			reg = <0x0 0xa0050000 0x0 0x10000>;
			xlnx,num-ss-bits = <0x1>;
			xlnx,spi-mode = <0>;

I tried setting xlnx,spi-mode to 11 (SPI_MODE_3 | SPI_LSB_FIRST), but that had no effect.

0 Kudos