1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2022 Kontron Electronics GmbH
4 */
5
6#include <asm/types.h>
7#include <asm/arch/sys_proto.h>
8
9#include <sl-mx6ul-common.h>
10
11bool sl_mx6ul_is_spi_nor_boot(void)
12{
13	u32 bmode = imx6_src_get_boot_mode();
14
15	/*
16	 * Check if "EEPROM Recovery" enabled and ECSPI2_CONREG not 0x0.
17	 * If this is the case and U-Boot didn't initialize the SPI bus
18	 * yet, we can safely assume that we are booting from SPI NOR.
19	 */
20	if ((bmode & 0x40000000) && readl(0x0200c008))
21		return true;
22
23	return false;
24}
25