Need help with booting from SPI Flash

Quentin Schulz quentin.schulz at cherry.de
Mon Feb 24 16:09:31 CET 2025


Hi Matwey,

On 2/24/25 3:37 PM, Matwey V. Kornilov wrote:
> пн, 24 февр. 2025 г. в 13:54, Quentin Schulz <quentin.schulz at cherry.de>:
>>
>> Hi Matwey,
>>
>> On 2/24/25 10:57 AM, Matwey V. Kornilov wrote:
>>> Hi,
>>>
>>> I have an Allwinner based board with manually soldered 16MB SPI Flash.
>>> I am trying to place u-boot into the flash and need some help so far.
>>> I have already updated the board DTS file and checked that the Linux
>>> kernel provides me with a /dev/mtd0 device which is writable and
>>> readable.
>>>
>>> I enable the following config options additionally to the board configuration:
>>> CONFIG_SPL_SPI_FLASH_SUPPORT,
>>> CONFIG_SPL_SPI,
>>> CONFIG_SPL_MTD_SUPPORT,
>>> CONFIG_SPL_SPI_FLASH_MTD,
>>> CONFIG_SPL_SPI_LOAD.
>>
>> Make sure the driver for the SPI controller on your SoC also is enabled
>> in SPL.
>>
>>> I am not sure that I chose every relevant option.
>>>
>>> However, I see the following message from the bootloader:
>>>
>>> U-Boot SPL 2024.01-rc1-45362-g94a35b52f78-dirty (Feb 24 2025 - 12:43:35 +0300)
>>> mxstatus=0xc0408000 mhcr=0x0000010b mcor=0x00000003 mhint=0x00004000
>>> Trying to boot from SPI
>>> Invalid bus 0 (err=-19)
>>> SPI probe failed.
>>> SPL: failed to boot from all boot devices
>>> ### ERROR ### Please RESET the board ###
>>>
>>> Are there any obvious things I missed? How could I debug this?
>>>
>>
>> Can you check your SPL DTB has the SPI bus and flash node?
>>
>> dtc -I dtb -O dts spl/u-boot-spl.dtb
>>
>> If not, you're missing a <your-board>-u-boot.dtsi in arch/arm/dts/ where
>> the SPI bus (and most of what it is needed to enable the controller,
>> power, clock, pinmux, ...) and the flash node has the appropriate
>> bootph- property. I believe it should be bootph-pre-ram for SPL,
>> according to scripts/Makefile.lib (fdtgrep_props).
> 
> Thanks. This indeed helped me, while no success yet:
> 
> U-Boot SPL 2024.01-rc1-45362-g94a35b52f78-dirty (Feb 24 2025 - 17:31:47 +0300)
> mxstatus=0xc0408000 mhcr=0x0000010b mcor=0x00000003 mhint=0x00004000
> Trying to boot from SPI
> fdt_fixup_memory_banks: FDT_ERR_BADMAGIC

The code seems to be wanting to load the DTB to fix it up. I do not know 
if it's U-Boot proper's or U-Boot SPL's it's after. A memory address 
might be misconfigured in the config or include file somewhere (not in 
the environment likely as I would assume no environemtn in SPL just 
yet), maybe the "wrong" U-Boot proper was flashed (e.g. one missing the 
device tree) or at an unexpected offset.

Cheers,
Quentin


More information about the U-Boot mailing list