1/* SPDX-License-Identifier:     GPL-2.0+ */
2/*
3 * Struct for boot image source description for placing in last
4 * two SPI NOR flash sectors on legcom.
5 */
6
7struct boot_img_src {
8	u8 magic;	/* Must be 'B' = 0x42 */
9	u8 flags;	/* flags to specify mmcblk[0|1] boot[0|1] */
10	u8 crc8;	/* CRC-8 over above two bytes */
11} __packed;
12
13/*
14 * Bit definition in boot_img_src.flags:
15 *  Bit 0: mmcblk device 0 or 1 (1 - if this bit set)
16 *  Bit 1: mmcblk boot partition 0 or 1.
17 *         for eMMC: boot0 if this bit is cleared, boot1 - if set
18 *         for SD-card the boot partition value will always be 0
19 *         (independent of the value of this bit)
20 *
21 */
22#define BOOT_SRC_MMC1	BIT(0)
23#define BOOT_SRC_PART1	BIT(1)
24
25/* Offset of the first boot image source descriptor in SPI NOR */
26#define SPI_FLASH_BOOT_SRC_OFFS	0xFE0000
27#define SPI_FLASH_SECTOR_SIZE	0x10000
28