Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (c) 2007-2016, Synaptics Incorporated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (C) 2016 Zodiac Inflight Innovations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #ifndef _RMI_F34_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #define _RMI_F34_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) /* F34 image file offsets. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #define F34_FW_IMAGE_OFFSET	0x100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) /* F34 register offsets. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #define F34_BLOCK_DATA_OFFSET	2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) /* F34 commands */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #define F34_WRITE_FW_BLOCK	0x2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #define F34_ERASE_ALL		0x3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define F34_READ_CONFIG_BLOCK	0x5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define F34_WRITE_CONFIG_BLOCK	0x6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #define F34_ERASE_CONFIG	0x7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define F34_ENABLE_FLASH_PROG	0xf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #define F34_STATUS_IN_PROGRESS	0xff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #define F34_STATUS_IDLE		0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #define F34_IDLE_WAIT_MS	500
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #define F34_ENABLE_WAIT_MS	300
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #define F34_ERASE_WAIT_MS	5000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #define F34_WRITE_WAIT_MS	3000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #define F34_BOOTLOADER_ID_LEN	2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) /* F34 V7 defines */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #define V7_FLASH_STATUS_OFFSET		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #define V7_PARTITION_ID_OFFSET		1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #define V7_BLOCK_NUMBER_OFFSET		2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #define V7_TRANSFER_LENGTH_OFFSET	3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #define V7_COMMAND_OFFSET		4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #define V7_PAYLOAD_OFFSET		5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #define V7_BOOTLOADER_ID_OFFSET		1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #define IMAGE_HEADER_VERSION_10		0x10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #define CONFIG_ID_SIZE			32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #define PRODUCT_ID_SIZE			10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #define HAS_BSR				BIT(5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #define HAS_CONFIG_ID			BIT(3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #define HAS_GUEST_CODE			BIT(6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #define HAS_DISP_CFG			BIT(5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) /* F34 V7 commands */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #define CMD_V7_IDLE			0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) #define CMD_V7_ENTER_BL			1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) #define CMD_V7_READ			2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) #define CMD_V7_WRITE			3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) #define CMD_V7_ERASE			4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) #define CMD_V7_ERASE_AP			5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) #define CMD_V7_SENSOR_ID		6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) #define v7_CMD_IDLE			0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) #define v7_CMD_WRITE_FW			1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) #define v7_CMD_WRITE_CONFIG		2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) #define v7_CMD_WRITE_LOCKDOWN		3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) #define v7_CMD_WRITE_GUEST_CODE		4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) #define v7_CMD_READ_CONFIG		5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) #define v7_CMD_ERASE_ALL		6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) #define v7_CMD_ERASE_UI_FIRMWARE	7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) #define v7_CMD_ERASE_UI_CONFIG		8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) #define v7_CMD_ERASE_BL_CONFIG		9
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) #define v7_CMD_ERASE_DISP_CONFIG	10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) #define v7_CMD_ERASE_FLASH_CONFIG	11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) #define v7_CMD_ERASE_GUEST_CODE		12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) #define v7_CMD_ENABLE_FLASH_PROG	13
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) #define v7_UI_CONFIG_AREA		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) #define v7_PM_CONFIG_AREA		1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) #define v7_BL_CONFIG_AREA		2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) #define v7_DP_CONFIG_AREA		3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) #define v7_FLASH_CONFIG_AREA		4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) /* F34 V7 partition IDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) #define BOOTLOADER_PARTITION		1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) #define DEVICE_CONFIG_PARTITION		2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) #define FLASH_CONFIG_PARTITION		3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) #define MANUFACTURING_BLOCK_PARTITION	4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) #define GUEST_SERIALIZATION_PARTITION	5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) #define GLOBAL_PARAMETERS_PARTITION	6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) #define CORE_CODE_PARTITION		7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) #define CORE_CONFIG_PARTITION		8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) #define GUEST_CODE_PARTITION		9
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) #define DISPLAY_CONFIG_PARTITION	10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) /* F34 V7 container IDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) #define TOP_LEVEL_CONTAINER			0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) #define UI_CONTAINER				1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) #define UI_CONFIG_CONTAINER			2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #define BL_CONTAINER				3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #define BL_IMAGE_CONTAINER			4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #define BL_CONFIG_CONTAINER			5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #define BL_LOCKDOWN_INFO_CONTAINER		6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) #define PERMANENT_CONFIG_CONTAINER		7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) #define GUEST_CODE_CONTAINER			8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) #define BL_PROTOCOL_DESCRIPTOR_CONTAINER	9
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) #define UI_PROTOCOL_DESCRIPTOR_CONTAINER	10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) #define RMI_SELF_DISCOVERY_CONTAINER		11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) #define RMI_PAGE_CONTENT_CONTAINER		12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) #define GENERAL_INFORMATION_CONTAINER		13
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) #define DEVICE_CONFIG_CONTAINER			14
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #define FLASH_CONFIG_CONTAINER			15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #define GUEST_SERIALIZATION_CONTAINER		16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) #define GLOBAL_PARAMETERS_CONTAINER		17
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) #define CORE_CODE_CONTAINER			18
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) #define CORE_CONFIG_CONTAINER			19
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) #define DISPLAY_CONFIG_CONTAINER		20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) struct f34v7_query_1_7 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	u8 bl_minor_revision;			/* query 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	u8 bl_major_revision;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	__le32 bl_fw_id;			/* query 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	u8 minimum_write_size;			/* query 3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	__le16 block_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	__le16 flash_page_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	__le16 adjustable_partition_area_size;	/* query 4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	__le16 flash_config_length;		/* query 5 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	__le16 payload_length;			/* query 6 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	u8 partition_support[4];		/* query 7 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) struct f34v7_data_1_5 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	u8 partition_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	__le16 block_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	__le16 transfer_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	u8 command;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	u8 payload[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) struct block_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	const void *data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) struct partition_table {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	u8 partition_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	u8 byte_1_reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	__le16 partition_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	__le16 start_physical_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	__le16 partition_properties;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) struct physical_address {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	u16 ui_firmware;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	u16 ui_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	u16 dp_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	u16 guest_code;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) struct container_descriptor {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	__le32 content_checksum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	__le16 container_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	u8 minor_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	u8 major_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	u8 reserved_08;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	u8 reserved_09;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	u8 reserved_0a;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	u8 reserved_0b;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	u8 container_option_flags[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	__le32 content_options_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	__le32 content_options_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	__le32 content_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	__le32 content_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) struct block_count {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	u16 ui_firmware;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	u16 ui_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	u16 dp_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	u16 fl_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	u16 pm_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	u16 bl_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	u16 lockdown;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	u16 guest_code;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) struct image_header_10 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	__le32 checksum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	u8 reserved_04;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	u8 reserved_05;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	u8 minor_header_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	u8 major_header_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	u8 reserved_08;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	u8 reserved_09;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	u8 reserved_0a;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	u8 reserved_0b;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	__le32 top_level_container_start_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) struct image_metadata {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	bool contains_firmware_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	bool contains_bootloader;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	bool contains_display_cfg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	bool contains_guest_code;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	bool contains_flash_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	unsigned int firmware_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	unsigned int checksum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	unsigned int bootloader_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	unsigned int display_cfg_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	unsigned char bl_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	unsigned char product_id[PRODUCT_ID_SIZE + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	unsigned char cstmr_product_id[PRODUCT_ID_SIZE + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	struct block_data bootloader;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	struct block_data ui_firmware;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	struct block_data ui_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	struct block_data dp_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	struct block_data fl_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	struct block_data bl_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	struct block_data guest_code;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	struct block_data lockdown;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	struct block_count blkcount;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	struct physical_address phyaddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) struct register_offset {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	u8 properties;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	u8 properties_2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	u8 block_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	u8 block_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	u8 gc_block_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	u8 flash_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	u8 partition_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	u8 block_number;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	u8 transfer_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	u8 flash_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	u8 payload;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) struct rmi_f34_firmware {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	__le32 checksum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	u8 pad1[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	u8 bootloader_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	__le32 image_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	__le32 config_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	u8 product_id[10];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	u8 product_info[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	u8 pad2[228];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	u8 data[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) struct f34v5_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	u16 block_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	u16 fw_blocks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	u16 config_blocks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	u16 ctrl_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	u8 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	struct completion cmd_done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	struct mutex flash_mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) struct f34v7_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	bool has_display_cfg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	bool has_guest_code;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	bool force_update;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	bool in_bl_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	u8 *read_config_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	size_t read_config_buf_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	u8 command;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	u8 flash_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	u16 block_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	u16 config_block_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 	u16 config_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	u16 config_area;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 	u16 flash_config_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	u16 payload_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	u8 partitions;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	u16 partition_table_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 	bool new_partition_table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	struct register_offset off;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	struct block_count blkcount;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	struct physical_address phyaddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	struct image_metadata img;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 	const void *config_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 	const void *image;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	struct completion cmd_done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) struct f34_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	struct rmi_function *fn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	u8 bl_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	unsigned char bootloader_id[5];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	unsigned char configuration_id[CONFIG_ID_SIZE*2 + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	int update_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 	int update_progress;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	int update_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 		struct f34v5_data v5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 		struct f34v7_data v7;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) int rmi_f34v7_start_reflash(struct f34_data *f34, const struct firmware *fw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) int rmi_f34v7_do_reflash(struct f34_data *f34, const struct firmware *fw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) int rmi_f34v7_probe(struct f34_data *f34);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) #endif /* _RMI_F34_H */