diff options
Diffstat (limited to 'include/linux/fpga/fpga-mgr.h')
-rw-r--r-- | include/linux/fpga/fpga-mgr.h | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/include/linux/fpga/fpga-mgr.h b/include/linux/fpga/fpga-mgr.h index bfa14bc023fb..3c6de23aabdf 100644 --- a/include/linux/fpga/fpga-mgr.h +++ b/include/linux/fpga/fpga-mgr.h | |||
@@ -1,7 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * FPGA Framework | 2 | * FPGA Framework |
3 | * | 3 | * |
4 | * Copyright (C) 2013-2015 Altera Corporation | 4 | * Copyright (C) 2013-2016 Altera Corporation |
5 | * Copyright (C) 2017 Intel Corporation | ||
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 8 | * under the terms and conditions of the GNU General Public License, |
@@ -15,12 +16,12 @@ | |||
15 | * You should have received a copy of the GNU General Public License along with | 16 | * You should have received a copy of the GNU General Public License along with |
16 | * this program. If not, see <http://www.gnu.org/licenses/>. | 17 | * this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 18 | */ |
18 | #include <linux/mutex.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | |||
21 | #ifndef _LINUX_FPGA_MGR_H | 19 | #ifndef _LINUX_FPGA_MGR_H |
22 | #define _LINUX_FPGA_MGR_H | 20 | #define _LINUX_FPGA_MGR_H |
23 | 21 | ||
22 | #include <linux/mutex.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | |||
24 | struct fpga_manager; | 25 | struct fpga_manager; |
25 | struct sg_table; | 26 | struct sg_table; |
26 | 27 | ||
@@ -83,12 +84,26 @@ enum fpga_mgr_states { | |||
83 | * @disable_timeout_us: maximum time to disable traffic through bridge (uSec) | 84 | * @disable_timeout_us: maximum time to disable traffic through bridge (uSec) |
84 | * @config_complete_timeout_us: maximum time for FPGA to switch to operating | 85 | * @config_complete_timeout_us: maximum time for FPGA to switch to operating |
85 | * status in the write_complete op. | 86 | * status in the write_complete op. |
87 | * @firmware_name: name of FPGA image firmware file | ||
88 | * @sgt: scatter/gather table containing FPGA image | ||
89 | * @buf: contiguous buffer containing FPGA image | ||
90 | * @count: size of buf | ||
91 | * @dev: device that owns this | ||
92 | * @overlay: Device Tree overlay | ||
86 | */ | 93 | */ |
87 | struct fpga_image_info { | 94 | struct fpga_image_info { |
88 | u32 flags; | 95 | u32 flags; |
89 | u32 enable_timeout_us; | 96 | u32 enable_timeout_us; |
90 | u32 disable_timeout_us; | 97 | u32 disable_timeout_us; |
91 | u32 config_complete_timeout_us; | 98 | u32 config_complete_timeout_us; |
99 | char *firmware_name; | ||
100 | struct sg_table *sgt; | ||
101 | const char *buf; | ||
102 | size_t count; | ||
103 | struct device *dev; | ||
104 | #ifdef CONFIG_OF | ||
105 | struct device_node *overlay; | ||
106 | #endif | ||
92 | }; | 107 | }; |
93 | 108 | ||
94 | /** | 109 | /** |
@@ -100,6 +115,7 @@ struct fpga_image_info { | |||
100 | * @write_sg: write the scatter list of configuration data to the FPGA | 115 | * @write_sg: write the scatter list of configuration data to the FPGA |
101 | * @write_complete: set FPGA to operating state after writing is done | 116 | * @write_complete: set FPGA to operating state after writing is done |
102 | * @fpga_remove: optional: Set FPGA into a specific state during driver remove | 117 | * @fpga_remove: optional: Set FPGA into a specific state during driver remove |
118 | * @groups: optional attribute groups. | ||
103 | * | 119 | * |
104 | * fpga_manager_ops are the low level functions implemented by a specific | 120 | * fpga_manager_ops are the low level functions implemented by a specific |
105 | * fpga manager driver. The optional ones are tested for NULL before being | 121 | * fpga manager driver. The optional ones are tested for NULL before being |
@@ -116,6 +132,7 @@ struct fpga_manager_ops { | |||
116 | int (*write_complete)(struct fpga_manager *mgr, | 132 | int (*write_complete)(struct fpga_manager *mgr, |
117 | struct fpga_image_info *info); | 133 | struct fpga_image_info *info); |
118 | void (*fpga_remove)(struct fpga_manager *mgr); | 134 | void (*fpga_remove)(struct fpga_manager *mgr); |
135 | const struct attribute_group **groups; | ||
119 | }; | 136 | }; |
120 | 137 | ||
121 | /** | 138 | /** |
@@ -138,14 +155,14 @@ struct fpga_manager { | |||
138 | 155 | ||
139 | #define to_fpga_manager(d) container_of(d, struct fpga_manager, dev) | 156 | #define to_fpga_manager(d) container_of(d, struct fpga_manager, dev) |
140 | 157 | ||
141 | int fpga_mgr_buf_load(struct fpga_manager *mgr, struct fpga_image_info *info, | 158 | struct fpga_image_info *fpga_image_info_alloc(struct device *dev); |
142 | const char *buf, size_t count); | 159 | |
143 | int fpga_mgr_buf_load_sg(struct fpga_manager *mgr, struct fpga_image_info *info, | 160 | void fpga_image_info_free(struct fpga_image_info *info); |
144 | struct sg_table *sgt); | 161 | |
162 | int fpga_mgr_load(struct fpga_manager *mgr, struct fpga_image_info *info); | ||
145 | 163 | ||
146 | int fpga_mgr_firmware_load(struct fpga_manager *mgr, | 164 | int fpga_mgr_lock(struct fpga_manager *mgr); |
147 | struct fpga_image_info *info, | 165 | void fpga_mgr_unlock(struct fpga_manager *mgr); |
148 | const char *image_name); | ||
149 | 166 | ||
150 | struct fpga_manager *of_fpga_mgr_get(struct device_node *node); | 167 | struct fpga_manager *of_fpga_mgr_get(struct device_node *node); |
151 | 168 | ||