This page provides information about the ZynqMP QSPI driver which can be found on Xilinx Git as spi-zynqmp-gqspi.c
Drivers can be found at /drivers/spi/spi-zynqmp-gqspi.c
MTD layer handles all the flash devices used with QSPI. This layer handles flash devices of different makes (Micron/Numonyx, Winbond and Spansion being
the most common)
of different sizes from 128Mbit to 1Gbit. The features of all flash devices are not alike and hence handled through different flags indicating the support.
This layer was customized by xilinx to support parallel and stacked configurations. It can be found at drivers/mtd/devices/m25p80.c on Xilinx Git
HW IP Features
The GQSPI controller used in Zynqmp supports the following features.
Support Low level (Generic) Access
Support Future Commands
Supports 3,4,6…N byte addressing
Supports Command Queuing (Generic FIFO depth is 32)
Supports 4 or 8-bit interface
Supports 2 Chip Select Lines
Supports 4-Bit Bi-Directional I/O signals
Supports x1/x2/x4 Read/Write
Supports 44-bit address space on AXI in DMA mode
Supports byte stripe when two data buses are connected
Supports single interrupt for QSPI/DMA Interrupt status
The Zynqmp GQSPI supports the following features:
Supports DMA for receiving the aligned data from the tx fifo.
Supports PIO read for receiving the unaligned data from the rx fifo.
Supports PIO write from programing page to the flash.
Supports extended addressing.
Supports SIngle,Dual Parallel and Dual Stacked configurations.
Supports Normal and Quad read modes
Known issues and limitations
This driver supports GenericQSPI(GQSPI) not Linear QSPI(LQSPI)
Xilinx GQSPI Driver Kernel Configuration
The following config options need to be enabled
It depends on SPI_MASTER and HAS_DMA
If required, enable MTD block devices support - MTD_BLKDEVS
Refer to Documentation/devicetree/bindings/spi/spi-zynqmp-qspi.txt
for complete description.
These are some specific points to be noted about the qspi properties:
- is-dual - Set if parallel. Reset if single or stacked.
The following example shows adding a QSPI node to the devicetree in single mode.
This section details the common tests using jffs2 and flashcp.
In order to test different flash sizes and configurations (single, parallel, stacked), the above devicetree should be modified and relevant hardware and design should be used.
QSPI flash testing with flashcp
#List the MTD partitions present and select a partition cat /proc/mtd
#Erase a the whole partition with jffs2 markers flash_eraseall -j /dev/mtd3
Erasing 128 Kibyte @ 5c0000 - 97% complete. Cleanmarker written at 5c0000.
Erasing 128 Kibyte @ 5e0000 - 100% complete.
#create a directory mkdir qspi_flash0 #Mount the partition to spi_flash0 mount -t jffs2 /dev/mtdblock3 /qspi_flash0 #Create a file to be written to the flash dd if=/dev/urandom of=./sample.bin bs=1024 count=4096
4096+0 records in
4096+0 records out
4194304 bytes (4.0MB) copied, 3.227253 seconds, 1.2MB/s
#Write the file to the flash cp ./sample.bin /qspi_flash0/ #Check the presence of the file(s) in spi_flash0 ls /qspi_flash0
#Unmount umount spi_flash0 #Mount again - MTD 0 to spi_flash0 mount -t jffs2 /dev/mtdblock3 /qspi_flash0 #Compare the files - there should be no differences diff ./sample.bin /qspi_flash0/sample.bin #Unmount umount qspi_flash0
The data can be verified again after a power on reset if desired.