aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fpga/fpga-mgr.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/fpga/fpga-mgr.h')
-rw-r--r--include/linux/fpga/fpga-mgr.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/fpga/fpga-mgr.h b/include/linux/fpga/fpga-mgr.h
index eec7c2478b0d..8942e61f0028 100644
--- a/include/linux/fpga/fpga-mgr.h
+++ b/include/linux/fpga/fpga-mgr.h
@@ -77,6 +77,7 @@ enum fpga_mgr_states {
77 * @sgt: scatter/gather table containing FPGA image 77 * @sgt: scatter/gather table containing FPGA image
78 * @buf: contiguous buffer containing FPGA image 78 * @buf: contiguous buffer containing FPGA image
79 * @count: size of buf 79 * @count: size of buf
80 * @region_id: id of target region
80 * @dev: device that owns this 81 * @dev: device that owns this
81 * @overlay: Device Tree overlay 82 * @overlay: Device Tree overlay
82 */ 83 */
@@ -89,6 +90,7 @@ struct fpga_image_info {
89 struct sg_table *sgt; 90 struct sg_table *sgt;
90 const char *buf; 91 const char *buf;
91 size_t count; 92 size_t count;
93 int region_id;
92 struct device *dev; 94 struct device *dev;
93#ifdef CONFIG_OF 95#ifdef CONFIG_OF
94 struct device_node *overlay; 96 struct device_node *overlay;
@@ -99,6 +101,7 @@ struct fpga_image_info {
99 * struct fpga_manager_ops - ops for low level fpga manager drivers 101 * struct fpga_manager_ops - ops for low level fpga manager drivers
100 * @initial_header_size: Maximum number of bytes that should be passed into write_init 102 * @initial_header_size: Maximum number of bytes that should be passed into write_init
101 * @state: returns an enum value of the FPGA's state 103 * @state: returns an enum value of the FPGA's state
104 * @status: returns status of the FPGA, including reconfiguration error code
102 * @write_init: prepare the FPGA to receive confuration data 105 * @write_init: prepare the FPGA to receive confuration data
103 * @write: write count bytes of configuration data to the FPGA 106 * @write: write count bytes of configuration data to the FPGA
104 * @write_sg: write the scatter list of configuration data to the FPGA 107 * @write_sg: write the scatter list of configuration data to the FPGA
@@ -113,6 +116,7 @@ struct fpga_image_info {
113struct fpga_manager_ops { 116struct fpga_manager_ops {
114 size_t initial_header_size; 117 size_t initial_header_size;
115 enum fpga_mgr_states (*state)(struct fpga_manager *mgr); 118 enum fpga_mgr_states (*state)(struct fpga_manager *mgr);
119 u64 (*status)(struct fpga_manager *mgr);
116 int (*write_init)(struct fpga_manager *mgr, 120 int (*write_init)(struct fpga_manager *mgr,
117 struct fpga_image_info *info, 121 struct fpga_image_info *info,
118 const char *buf, size_t count); 122 const char *buf, size_t count);
@@ -124,12 +128,31 @@ struct fpga_manager_ops {
124 const struct attribute_group **groups; 128 const struct attribute_group **groups;
125}; 129};
126 130
131/* FPGA manager status: Partial/Full Reconfiguration errors */
132#define FPGA_MGR_STATUS_OPERATION_ERR BIT(0)
133#define FPGA_MGR_STATUS_CRC_ERR BIT(1)
134#define FPGA_MGR_STATUS_INCOMPATIBLE_IMAGE_ERR BIT(2)
135#define FPGA_MGR_STATUS_IP_PROTOCOL_ERR BIT(3)
136#define FPGA_MGR_STATUS_FIFO_OVERFLOW_ERR BIT(4)
137
138/**
139 * struct fpga_compat_id - id for compatibility check
140 *
141 * @id_h: high 64bit of the compat_id
142 * @id_l: low 64bit of the compat_id
143 */
144struct fpga_compat_id {
145 u64 id_h;
146 u64 id_l;
147};
148
127/** 149/**
128 * struct fpga_manager - fpga manager structure 150 * struct fpga_manager - fpga manager structure
129 * @name: name of low level fpga manager 151 * @name: name of low level fpga manager
130 * @dev: fpga manager device 152 * @dev: fpga manager device
131 * @ref_mutex: only allows one reference to fpga manager 153 * @ref_mutex: only allows one reference to fpga manager
132 * @state: state of fpga manager 154 * @state: state of fpga manager
155 * @compat_id: FPGA manager id for compatibility check.
133 * @mops: pointer to struct of fpga manager ops 156 * @mops: pointer to struct of fpga manager ops
134 * @priv: low level driver private date 157 * @priv: low level driver private date
135 */ 158 */
@@ -138,6 +161,7 @@ struct fpga_manager {
138 struct device dev; 161 struct device dev;
139 struct mutex ref_mutex; 162 struct mutex ref_mutex;
140 enum fpga_mgr_states state; 163 enum fpga_mgr_states state;
164 struct fpga_compat_id *compat_id;
141 const struct fpga_manager_ops *mops; 165 const struct fpga_manager_ops *mops;
142 void *priv; 166 void *priv;
143}; 167};