aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/fpga/fpga-mgr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/fpga/fpga-mgr.c')
-rw-r--r--drivers/fpga/fpga-mgr.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c
index 151ac364be80..5fffeeffed5f 100644
--- a/drivers/fpga/fpga-mgr.c
+++ b/drivers/fpga/fpga-mgr.c
@@ -21,6 +21,12 @@
21static DEFINE_IDA(fpga_mgr_ida); 21static DEFINE_IDA(fpga_mgr_ida);
22static struct class *fpga_mgr_class; 22static struct class *fpga_mgr_class;
23 23
24/**
25 * fpga_image_info_alloc - Allocate a FPGA image info struct
26 * @dev: owning device
27 *
28 * Return: struct fpga_image_info or NULL
29 */
24struct fpga_image_info *fpga_image_info_alloc(struct device *dev) 30struct fpga_image_info *fpga_image_info_alloc(struct device *dev)
25{ 31{
26 struct fpga_image_info *info; 32 struct fpga_image_info *info;
@@ -39,6 +45,10 @@ struct fpga_image_info *fpga_image_info_alloc(struct device *dev)
39} 45}
40EXPORT_SYMBOL_GPL(fpga_image_info_alloc); 46EXPORT_SYMBOL_GPL(fpga_image_info_alloc);
41 47
48/**
49 * fpga_image_info_free - Free a FPGA image info struct
50 * @info: FPGA image info struct to free
51 */
42void fpga_image_info_free(struct fpga_image_info *info) 52void fpga_image_info_free(struct fpga_image_info *info)
43{ 53{
44 struct device *dev; 54 struct device *dev;
@@ -223,7 +233,7 @@ static int fpga_mgr_buf_load_mapped(struct fpga_manager *mgr,
223/** 233/**
224 * fpga_mgr_buf_load - load fpga from image in buffer 234 * fpga_mgr_buf_load - load fpga from image in buffer
225 * @mgr: fpga manager 235 * @mgr: fpga manager
226 * @flags: flags setting fpga confuration modes 236 * @info: fpga image info
227 * @buf: buffer contain fpga image 237 * @buf: buffer contain fpga image
228 * @count: byte count of buf 238 * @count: byte count of buf
229 * 239 *
@@ -332,6 +342,16 @@ static int fpga_mgr_firmware_load(struct fpga_manager *mgr,
332 return ret; 342 return ret;
333} 343}
334 344
345/**
346 * fpga_mgr_load - load FPGA from scatter/gather table, buffer, or firmware
347 * @mgr: fpga manager
348 * @info: fpga image information.
349 *
350 * Load the FPGA from an image which is indicated in @info. If successful, the
351 * FPGA ends up in operating mode.
352 *
353 * Return: 0 on success, negative error code otherwise.
354 */
335int fpga_mgr_load(struct fpga_manager *mgr, struct fpga_image_info *info) 355int fpga_mgr_load(struct fpga_manager *mgr, struct fpga_image_info *info)
336{ 356{
337 if (info->sgt) 357 if (info->sgt)
@@ -418,11 +438,9 @@ static int fpga_mgr_dev_match(struct device *dev, const void *data)
418} 438}
419 439
420/** 440/**
421 * fpga_mgr_get - get a reference to a fpga mgr 441 * fpga_mgr_get - Given a device, get a reference to a fpga mgr.
422 * @dev: parent device that fpga mgr was registered with 442 * @dev: parent device that fpga mgr was registered with
423 * 443 *
424 * Given a device, get a reference to a fpga mgr.
425 *
426 * Return: fpga manager struct or IS_ERR() condition containing error code. 444 * Return: fpga manager struct or IS_ERR() condition containing error code.
427 */ 445 */
428struct fpga_manager *fpga_mgr_get(struct device *dev) 446struct fpga_manager *fpga_mgr_get(struct device *dev)
@@ -442,10 +460,9 @@ static int fpga_mgr_of_node_match(struct device *dev, const void *data)
442} 460}
443 461
444/** 462/**
445 * of_fpga_mgr_get - get a reference to a fpga mgr 463 * of_fpga_mgr_get - Given a device node, get a reference to a fpga mgr.
446 * @node: device node
447 * 464 *
448 * Given a device node, get a reference to a fpga mgr. 465 * @node: device node
449 * 466 *
450 * Return: fpga manager struct or IS_ERR() condition containing error code. 467 * Return: fpga manager struct or IS_ERR() condition containing error code.
451 */ 468 */
@@ -478,7 +495,10 @@ EXPORT_SYMBOL_GPL(fpga_mgr_put);
478 * @mgr: fpga manager 495 * @mgr: fpga manager
479 * 496 *
480 * Given a pointer to FPGA Manager (from fpga_mgr_get() or 497 * Given a pointer to FPGA Manager (from fpga_mgr_get() or
481 * of_fpga_mgr_put()) attempt to get the mutex. 498 * of_fpga_mgr_put()) attempt to get the mutex. The user should call
499 * fpga_mgr_lock() and verify that it returns 0 before attempting to
500 * program the FPGA. Likewise, the user should call fpga_mgr_unlock
501 * when done programming the FPGA.
482 * 502 *
483 * Return: 0 for success or -EBUSY 503 * Return: 0 for success or -EBUSY
484 */ 504 */
@@ -494,7 +514,7 @@ int fpga_mgr_lock(struct fpga_manager *mgr)
494EXPORT_SYMBOL_GPL(fpga_mgr_lock); 514EXPORT_SYMBOL_GPL(fpga_mgr_lock);
495 515
496/** 516/**
497 * fpga_mgr_unlock - Unlock FPGA manager 517 * fpga_mgr_unlock - Unlock FPGA manager after done programming
498 * @mgr: fpga manager 518 * @mgr: fpga manager
499 */ 519 */
500void fpga_mgr_unlock(struct fpga_manager *mgr) 520void fpga_mgr_unlock(struct fpga_manager *mgr)