OSPI/QSPI is a serial peripheral interface like SPI the major difference being the support for Octal/Quad read, uses 8/4 data lines for read compared to 2 lines used by the traditional SPI. This section documents how to write files to the QSPI device and use it to load and then boot the Linux Kernel using a root filesystem also found on QSPI. At this time, no special builds of U-Boot are required to perform these operations on the supported hardware. For simplicity we assume the files are being loaded from an SD card. Using the network interface (if applicable) is documented in U-boot SPI section.


Not all OSPI flashes can be supported. Users are recommended to check whether or not the OSPI flash part chosen for custom board designs meets all the criteria listed at https://e2e.ti.com/support/processors/f/791/t/946418


The sf command is used to access SPI NOR flash, supporting read/write/erase and a few other functions. For more information on sf command in U-boot please refer to the u-boot documentation: here. And for accessing SPI NAND flash, the mtd command is used, supporting read/write/erase and bad block management.

J784S4 is similar to J721S2, only difference being that OSPI0 is muxed externally between a NOR and a NAND flash through a physical switch. OSPI NOR and OSPI NAND can’t be used at the same time, they need to be selected by changing a physical configuration switch on the EVM board before driver probes them. CONFIG SW3.1 should be in OFF state to use OSPI NOR, and in ON STATE for OSPI NAND.

Flashing images to OSPI NOR flash

Following commands can be used to download tiboot3.bin, tispl.bin and u-boot.img over tftp and then flash it to OSPI NOR/NAND at respective addresses.


    => sf probe
    => tftp ${loadaddr} tiboot3.bin
    => sf update $loadaddr 0x0 $filesize
    => tftp ${loadaddr} tispl.bin
    => sf update $loadaddr 0x80000 $filesize
    => tftp ${loadaddr} u-boot.img
    => sf update $loadaddr 0x280000 $filesize

    => mtd list
    => mtd erase spi-nand0
    => tftp $loadaddr tiboot3.bin
    => mtd write spi-nand0 $loadaddr 0x0 $filesize
    => tftp $loadaddr tispl.bin
    => mtd write spi-nand0 $loadaddr 0x80000 $filesize
    => tftp $loadaddr u-boot.img
    => mtd write spi-nand0 $loadaddr 0x280000 $filesize

PHY calibration

PHY calibration allows for higher read performance. To enable PHY, the PHY calibration pattern must be flashed to ospi at the start of the last erase sector. For the cypress s28hs512t flash, this lies at the address 0x3fc0000. Note, PHY calibration is currently supported only for OSPI NOR flash.

download the binary file containing the phy pattern from here. below commands can be used to flash the phy pattern, with the location of the pattern depending on which flash is being used:

=> sf probe
=> tftp ${loadaddr} ospi_phy_pattern
=> sf update $loadaddr 0x3fc0000 $filesize

Flash layout for OSPI NOR

      0x0 +----------------------------+
          |     ospi.tiboot3(1m)       |
          |                            |
  0x80000 +----------------------------+
          |     ospi.tispl(2m)         |
          |                            |
 0x280000 +----------------------------+
          |     ospi.u-boot(4m)        |
          |                            |
 0x680000 +----------------------------+
          |     ospi.env(128k)         |
          |                            |
 0x6A0000 +----------------------------+
          |   ospi.env.backup(128k)    |
          |                            |
 0x6C0000 +----------------------------+
          |      padding (1280k)       |
 0x800000 +----------------------------+
          |     ospi.rootfs(ubifs)     |
          |                            |
0x3fc0000 +----------------------------+
          |   ospi.phypattern (256k)   |
          |                            |

Flash layout for OSPI NAND

      0x0 +---------------------------------+
          |      ospi_nand.tiboot3(1m)      |
          |                                 |
  0x80000 +---------------------------------+
          |        ospi_nand.tispl(2m)      |
          |                                 |
 0x280000 +---------------------------------+
          |       ospi_nand.u-boot(4m)      |
          |                                 |
 0x680000 +---------------------------------+
          |       ospi_nand.env(128k)       |
          |                                 |
 0x6A0000 +---------------------------------+
          |    ospi_nand.env.backup(128k)   |
          |                                 |
 0x6C0000 +---------------------------------+
          |        padding (98048K)         |
0x2000000 +---------------------------------+
          |     ospi_nand.rootfs(ubifs)     |
          |                                 |
0x7fc0000 +---------------------------------+
          |   ospi_nand.phypattern (256k)   |
          |                                 |

Writing to OSPI using DFU

Setup: Connect the Type C port (USB0 port) of EVM to ubuntu host PC. Make sure dfu-util tool is installed and USB0 port is in UFP/DRP mode: SW3[3:4] = 01 or 1x.

#sudo apt-get install dfu-util

From u-boot(for OSPI flash):

U-Boot # env default -a
U-Boot # setenv dfu_alt_info ${dfu_alt_info_ospi}; dfu 0 sf "0:0:25000000:0"

From ubuntu PC: Using dfu-util utilities to flash the binares to OSPI/QSPI flash.

# sudo dfu-util -l
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY

Found DFU: [0451:6168] ver=0224, devnum=44, cfg=1, intf=0, path="1-3", alt=5, name="rootfs", serial="UNKNOWN"
Found DFU: [0451:6168] ver=0224, devnum=44, cfg=1, intf=0, path="1-3", alt=4, name="sysfw.itb", serial="UNKNOWN"
Found DFU: [0451:6168] ver=0224, devnum=44, cfg=1, intf=0, path="1-3", alt=3, name="u-boot-env", serial="UNKNOWN"
Found DFU: [0451:6168] ver=0224, devnum=44, cfg=1, intf=0, path="1-3", alt=2, name="u-boot.img", serial="UNKNOWN"
Found DFU: [0451:6168] ver=0224, devnum=44, cfg=1, intf=0, path="1-3", alt=1, name="tispl.bin", serial="UNKNOWN"
Found DFU: [0451:6168] ver=0224, devnum=44, cfg=1, intf=0, path="1-3", alt=0, name="tiboot3.bin", serial="UNKNOWN"

Flash the binaries to the respective regions using alternate interface number (alt=<x>).

# sudo dfu-util -c 1 -i 0 -a 0 -D tiboot3.bin
# sudo dfu-util -c 1 -i 0 -a 1 -D tispl.bin
# sudo dfu-util -c 1 -i 0 -a 2 -D u-boot.img