Introduction & Overview
The following are the notes of getting U-Boot with SPL to boot from QSPI Flash on i.MX6ULL platform.
SPL is a stripped-down version of the full U-Boot, typically being loaded into on-chip SRAM. It is responsible for initializing the system (power, SDRAM, storage, etc.), loading the full U-Boot into SDRAM, and then jumping to the full U-Boot. (There is also a falcon mode, where SPL directly loads the kernel and jumps to the kernel.) Typically one doesn't need to use SPL on i.MX6 platform. The boot ROM is quite capable and extensible, to a point you may not even need the U-Boot at all.
In my case, I am using a board that requires the PMIC to be initialized before initializing DRAM. This could be implemented by using the plugin binary on the i.MX6 platform (essentially a small piece of code that would run before loading the full image), however in that case I would be completely on my own to figure out IO multiplexing, I2C controller programming, etc. An easier way is to use the SPL to set that up: it's designed to do that, after all. On top of that, I want the whole thing to run from SPI Flash.
Overall, I want the following features:
- U-Boot + SPL boots from QSPI Flash (W25Q32JV in my case)
- SPL should initialize the PMIC over I2C
- I start with a board that doesn't have anything:
- eFUSE not programmed
- Empty flash
I need the U-Boot + SPL to boot from the flash, but I also need to figure out how to set up the eFuse to let the processor try to boot from QSPI also write the U-Boot image into the empty flash. The plan would then be:
- Load SPL into the processor's internal SRAM via USB and run the SPL to initialize the PMIC and DDR
- Load the U-Boot into the DDR using SPL over USB and run the U-Boot
- In the U-Boot, program the eFUSE
- In the U-Boot, receive the U-Boot image over USB and write it into the flash.
The flash layout would look like this:
---- 0x00000 / Start ---- Empty (reserved for partition table) ---- 0x00400 / 1KB ---- QuadSPI Configuration Parameters Table, to be loaded by BROM ---- 0x01000 / 4KB ---- U-Boot SPL in imx image format, to be loaded by BROM ---- 0x12000 / 72KB ---- U-Boot in leagcy uImage format, to be loaded by SPL ---- 0xA0000 / 640KB ---- U-Boot environment variables ---- 0xA2000 / 648KB ----
Let's go over these steps.