OSPI Linux driver
Introduction
The Octal-SPI Flash Controller can be used to provide access to Serial Flash devices. Standard Serial Peripheral Interface (SPI) is supported along with high performance Octal SPI variants. The Octal-SPI Flash Controller transfer the data either in a memory mapped direct fashion or in an indirect fashion where the controller is set up via configuration registers to silently perform some requested operation, signalling its completion via interrupts or status registers. For indirect operations, data is transferred between system memory and external FLASH memory via an internal SRAM. OSPI has it’s own internal DMA which is used to read the data from the flash, SRAM is accessible only in case of DMA mode of operation (indirect mode).
In INDAC (Indirect Access Controller) mode DMA writes are not supported, Non-DMA, DAC or STIG modes are used for flash writes. In INDAC(DMA) mode only flash reads are supported.
Features Supported in HW
Direct mode of memory mapped operation.
Software triggered IO mode (STIG) up to 8-bytes of data transfers.
Indirect DMA reads.
NON-DMA read and write support
Local SRAM to reduce AHB overhead.
Supports SDR and DDR protocols.
Programmable master mode clock frequencies.
Serial clock with programmable polarity.
Programmable peripheral selects (chip select).
Support for Single and Octal instructions.
Interrupts and polled based operations.
Features supported in driver
Software triggered IO mode (STIG) up to 8-bytes of data transfers.
INDAC DMA reads.
SDR and DDR mode support.
Support for Octal mode.
Interrupt based transfers.
RX Tuning support for PHY modes.
NON-DMA read and write support.
Driver Missing features, Known Issues and Limitations
STIG Memory Bank.
When Micron OSPI flash devices such as MT35XU02G and MT35XU01G, which feature multi-die architecture, are configured to operate in SDR mode, the following warning message—accompanied by a call trace—is observed during Linux boot. This warning does not affect the functionality of the OSPI driver
[ 2.281990] ------------[ cut here ]------------
[ 2.286602] enabling reset hack; may not recover from unexpected reboots
[ 2.293307] WARNING: CPU: 7 PID: 100 at drivers/mtd/spi-nor/core.c:3819 spi_nor_set_4byte_addr_mode+0xac/0xb4Important AR links
2023.1 Versal: OSPI flash probe fails with BSP images on VCK190 in Linux AR Link
Supported Flash parts
Micron
ISSI
Gigadevice
Macronix (works only up to 150MHz)
Testing
Flashcp
mtd utilities.
mtd_speedtest
mtd_stresstest
File System testing - UBIFS and JFFS2
Kernel Configuration
CONFIG_SPI_CADENCE_QUADSPI=yDevice-tree
Sample Device-tree node for OSPI
spi@f1010000 {
compatible = "xlnx,versal-ospi-1.0", "cadence,qspi", "cdns,qspi-nor";
status = "okay";
reg = <0x0 0xf1010000 0x0 0x10000 0x0 0xc0000000 0x0 0x20000000>;
interrupts = <0x0 0x7c 0x4 0x0 0x7c 0x4>;
clock-names = "ref_clk", "pclk";
cdns,fifo-depth = <0x100>;
cdns,fifo-width = <0x4>;
cdns,is-dma = <0x1>;
cdns,is-stig-pgm = <0x1>;
cdns,trigger-address = <0xc0000000>;
#stream-id-cells = <0x1>;
#address-cells = <0x1>;
#size-cells = <0x0>;
clocks = <0x3 0x3a 0x3 0x52>;
power-domains = <0x7 0x1822402a>;
bus-num = <0x2>;
num-cs = <0x1>;
reset-gpios = <0x28 0xc 0x0>;
phandle = <0x33>;
flash@0 {
compatible = "mt35xu02g", "micron,m25p80", "spi-flash";
reg = <0x0>;
#address-cells = <0x1>;
#size-cells = <0x1>;
cdns,read-delay = <0x0>;
cdns,tshsl-ns = <0x0>;
cdns,tsd2d-ns = <0x0>;
cdns,tchsh-ns = <0x1>;
cdns,tslch-ns = <0x1>;
spi-tx-bus-width = <0x1>;
spi-rx-bus-width = <0x8>;
spi-max-frequency = <0x1312d00>;
partition@0 {
label = "spi0-flash0";
reg = <0x0 0x10000000>;
};
};
};NOTE:
If broken-flash-reset is defined in the flash node and spi-max-frequency is less than 50 MHz then the OSPI will operate in SDR-NON-PHY mode.
From 2025.2 release kernel if broken-flash-reset is defined in the flash node and spi-max-frequency is greater than equal than 50 MHz then the OSPI will operate in SDR-PHY mode.
If broken-flash-reset is NOT defined in the flash node then the OSPI will operate in DDR-PHY mode and irrespective of spi-max-frequency value the OSPI bus frequency will be equal to the OSPI Ref_Clk.
Performance Details
At frequency 200 MHz
DDR mode:
Read Speed: 282560 KiB/s
Write Speed: 1661 KiB/s
Mainline Status
Features added to mainline
SDR NON-PHY mode
DMA support
Flash Device Reset
Not in Mainline
DDR mode support
Rx tuning
Stacked mode support
Support for ISSI, Gigadevice and Macronix.
Change Log
2025.2
9e279cd - mtd: spi-nor: Add SDR-PHY support for OSPI flashes
8abcd4c - spi: spi-cadence: Enable SDR-PHY mode when spi-max-frequency is greater than 50 MHz
9e279cd - mtd: spi-nor: Add SDR-PHY support for OSPI flashes
6e3ea32 - mtd: spi-nor: Add die erase support for Micron multi-die OSPI flash
2025.1
4e46a91 - Fix block protection failure on Macronix OSPI flash
a1ad524 - Add support for MX66UW2G345GXRI00 OSPI flash
652bcc0 - Fix incorrect die count reported by Gigadevice OSPI flashes
cae9073 - Retrieve all chip-select values from the flash node
526f906 - Align Broken STIG quirk implementation with upstream
2024.2
5c46c46 - Add quirk to skip STIG mode for data xfers
2024.1
1c82238 - Store GPIO info for resetting device during resume
42f7d1c - Add support for MX66UM2G45G Macronix flash part
4cce023 - Fix RX tuning failure for OSPI flashes connected in stacked mode
1c6af10 - Disable 16bit SR operation for gd25lx256e flash
016ecd9 - Fix call trace during suspend/resume
0182633 - Remove dependency on SRAM Fill Register during indirect non-dma read
2023.2
None
2023.1
ae655c5 - Replace all spi->chip_select and spi->cs_gpiod references with function call
8880c61 - Ads stacked memories support as per the new DT bindings
adc1e5f - Fix race condition while scheduling periodic tuning
2022.2
c59a288 - Add module param to configure read timeout
2022.1
2021.2
2021.1
b832b6b - Added support for OSPI Macronix(mx25um51345g) part .
7216a02 - Added support for reading from unaligned address.
5ca8ce8 - Rx periodic tuning updates for Master DLL mode.
2020.2
6ab15b2 - Added support for stacked mode.
3ff8d4e, 46fe093 - Added support for ISSI and GIGADEVICE parts.
56e44ec - Fix the issues in Rx periodic tuning.
2020.1
508f0df, e0d688d - Added support for UBIFS and JFFS2 file system support.
40ede36 - Added support for NON-DMA read and write support.
f73c158 - Added support for RX periodic tuning (periodicity of 5 minutes).
2019.2
New driver
© 2025 Advanced Micro Devices, Inc. Privacy Policy