xref: /linux/drivers/dpll/zl3073x/fw.h (revision ec2e0fb07d789976c601bec19ecced7a501c3705)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef _ZL3073X_FW_H
4 #define _ZL3073X_FW_H
5 
6 /*
7  * enum zl3073x_fw_component_id - Identifiers for possible flash components
8  */
9 enum zl3073x_fw_component_id {
10 	ZL_FW_COMPONENT_INVALID = -1,
11 	ZL_FW_COMPONENT_UTIL = 0,
12 	ZL_FW_COMPONENT_FW1,
13 	ZL_FW_COMPONENT_FW2,
14 	ZL_FW_COMPONENT_FW3,
15 	ZL_FW_COMPONENT_CFG0,
16 	ZL_FW_COMPONENT_CFG1,
17 	ZL_FW_COMPONENT_CFG2,
18 	ZL_FW_COMPONENT_CFG3,
19 	ZL_FW_COMPONENT_CFG4,
20 	ZL_FW_COMPONENT_CFG5,
21 	ZL_FW_COMPONENT_CFG6,
22 	ZL_FW_NUM_COMPONENTS
23 };
24 
25 /**
26  * struct zl3073x_fw_component - Firmware component
27  * @id: Flash component ID
28  * @size: Size of the buffer
29  * @data: Pointer to buffer with component data
30  */
31 struct zl3073x_fw_component {
32 	enum zl3073x_fw_component_id	id;
33 	size_t				size;
34 	void				*data;
35 };
36 
37 /**
38  * struct zl3073x_fw - Firmware bundle
39  * @component: firmware components array
40  */
41 struct zl3073x_fw {
42 	struct zl3073x_fw_component	*component[ZL_FW_NUM_COMPONENTS];
43 };
44 
45 struct zl3073x_fw *zl3073x_fw_load(struct zl3073x_dev *zldev, const char *data,
46 				   size_t size, struct netlink_ext_ack *extack);
47 void zl3073x_fw_free(struct zl3073x_fw *fw);
48 
49 int zl3073x_fw_flash(struct zl3073x_dev *zldev, struct zl3073x_fw *zlfw,
50 		     struct netlink_ext_ack *extack);
51 
52 #endif /* _ZL3073X_FW_H */
53