Rockchip · AI & Linux Hub

Hardware interfaces

Rockchip FLEXBUS FSPI Guide: SPI NOR Flash, Kernel and DTS

Rockchip FLEXBUS FSPI Guide: SPI NOR Flash, Kernel and DTS with complete technical sections, code, parameters and source caveats.

· ArmSoM Editorial · Rockchip source documentation · 3 min read

This complete source-based technical article is an ArmSoM platform reference. Source scope: SoCs supporting FLEXBUS according to the source; board support remains to be verified, Linux kernel 6.1. Verify the actual board, SoC, SDK/BSP branch, pins and peripherals before use. No board-level hardware validation has been performed, and support on all ArmSoM boards is not implied. Outputs and measurements are source examples, not ArmSoM test results.

Chinese follows the Chinese source; English follows the English source; Russian fully translates the English technical body. Code, comments and command output retain their source language. The source technical body contains no independent technical figures or tables; none have been invented.

Both source versions are V1.0.0.

Operational caution: reserved memory, DMA, pin multiplexing and device writes affect hardware. Commands are provided for reading; no hardware operations were executed. Verify the schematic, power, timing and actual device. Any xxx or ellipsis in DTS is a source placeholder, not a complete usable configuration.

Sources and repairs: EDITORIAL-NOTES。Official references: ArmSoM, Rockchip Linux.

Source product-version table (PDF p.2; source scope, not board-level validation):

Chipset Kernel Version
All SOC support FLEXBUS 6.1

1. FLEXBUS FSPI Mode

1.1 Overview

FLEXBUS FSPI mode refers to the implementation of the corresponding functions by simulating RK FSPI (Flexible Serial Peripheral Interface) through FLEXBUS, such as:

Single line output/quad line input, meeting the typical configuration for Linux MTD Quad SPI Flash driver

The key feature:

A clock frequency up to 100MHz

1.2 Configuration

1.2.1 Kernel Configuration

FLEXBUS FSPI mode is implemented by the standard SPI framework driver and only implements the spi-mem structure, supporting external SPI Flash or peripherals that support the spi-mem protocol:

CONFIG_SPI=y
CONFIG_SPI_ROCKCHIP_FLEXBUS_FSPI=y

1.2.2 DTS Configuration

Taking the external SPI Nor flash sub-device as an example:

&flexbus {
    rockchip,flexbus0-opmode = <ROCKCHIP_FLEXBUS0_OPMODE_SPI>;
    rockchip,flexbus1-opmode = <ROCKCHIP_FLEXBUS1_OPMODE_NULL>;
    status = "okay";
};
&flexbus_fspi {
    pinctrl-names = "default";
    pinctrl-0 = <&flexbus0m1_pins &flexbus0_clk_pins
                 &flexbus0_d0_pins &flexbus0_d1_pins
                 &flexbus0_d2_pins &flexbus0_d3_pins>;
    status = "okay";
    flash@0 {
        compatible = "jedec,spi-nor";
        reg = <0>;
        spi-max-frequency = <100000000>;
        spi-rx-bus-width = <4>;
        spi-tx-bus-width = <1>;
    };
};

Explanation:

mode_bits is SPI_RX_QUAD:

It supports configuring spi-rx-bus-width to 4

The default configuration is SPI mode 0, MSB mode, the relevant parameters of dts are not adjustable, please refer to the controller manual for further development

1.2.3 Driver File

The driver file is drivers/spi/spi-rockchip-flexbus-fspi.c .

Explore this topic → · Learning paths →