/*
 * @file fw_info.h
 * @brief firmware info defines.
 * @author m.hirobe@co-nss.co.jp
 * @date 2019-08-29
 */

#ifndef __MX6ULL_SOLAR_L8_FWINFO_HEADER__
#define __MX6ULL_SOLAR_L8_FWINFO_HEADER__

/* eeprom info */
#define EEPROM_MAGIC_JHRWL8	(0x09510108)

#define KERNEL_A_SIDE	(0x00300000)
#define KERNEL_B_SIDE	(0x00B00000)
#define KERNEL_C_SIDE	(0x01300000)
#define KERNEL_D_SIDE	(0x01B00000)

#define FW_DEFAULT_VERSION	"0000"
#define FW_DEFAULT_BUILD	"0000"

/* boot flags */
#define START_STS_MASK		(0x00FF)
#define START_FLAG_OK		(0x0000)	/* Normal */
#define START_FLAG_UPDATE	(0x0001)	/* update */
#define START_FLAG_FIRST	(0x0002)	/* initial boot after update */
#define START_FLAG_BACKUP	(0x0003)	/* backup */

#define START_SIDE_MASK		(0xFF00)
#define START_SIDE_A		(0x0A00)
#define START_SIDE_B		(0x0B00)

/* eeprom fw info structure */
struct boot_fw {
	u32 kernel_addr;	/* kernel store address */
	u8 version[4];		/* fw version */
	u8 build_ver[4];	/* build version */
};
#pragma pack(push, 1)
struct boot_fw_eeprom {
	u32 magic;		/* magic code */
	u8 ethaddr[6];	/* mac address */
	u8 wlanaddr[6];	/* wlan mac address */
	u16 bootflags;	/* bootflags */
	struct boot_fw	side_a;	/* side A fw info */
	struct boot_fw	side_b;	/* side B fw info */
	u8 serial_number[8];	/* serial number */
	u8 mon_id[11];			/* monitoring id */
	u8 reserved[63];		/* all 0xff */
	u32 crc;				/* CRC32 */
};
#pragma pack(pop)
enum {
	EEPROM_BANK_0 = 0,
	EEPROM_BANK_1,
	EEPROM_BANK_MAX,
};

#endif /* __MX6ULL_SOLAR_L8_FWINFO_HEADER__ */
