aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/if_usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas/if_usb.c')
-rw-r--r--drivers/net/wireless/libertas/if_usb.c113
1 files changed, 61 insertions, 52 deletions
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 6524c70363d9..e1e2128f4113 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -1,6 +1,6 @@
1/** 1/*
2 * This file contains functions used in USB interface module. 2 * This file contains functions used in USB interface module.
3 */ 3 */
4#include <linux/delay.h> 4#include <linux/delay.h>
5#include <linux/moduleparam.h> 5#include <linux/moduleparam.h>
6#include <linux/firmware.h> 6#include <linux/firmware.h>
@@ -66,7 +66,7 @@ static int if_usb_reset_device(struct if_usb_card *cardp);
66 66
67/* sysfs hooks */ 67/* sysfs hooks */
68 68
69/** 69/*
70 * Set function to write firmware to device's persistent memory 70 * Set function to write firmware to device's persistent memory
71 */ 71 */
72static ssize_t if_usb_firmware_set(struct device *dev, 72static ssize_t if_usb_firmware_set(struct device *dev,
@@ -85,7 +85,7 @@ static ssize_t if_usb_firmware_set(struct device *dev,
85 return ret; 85 return ret;
86} 86}
87 87
88/** 88/*
89 * lbs_flash_fw attribute to be exported per ethX interface through sysfs 89 * lbs_flash_fw attribute to be exported per ethX interface through sysfs
90 * (/sys/class/net/ethX/lbs_flash_fw). Use this like so to write firmware to 90 * (/sys/class/net/ethX/lbs_flash_fw). Use this like so to write firmware to
91 * the device's persistent memory: 91 * the device's persistent memory:
@@ -94,7 +94,14 @@ static ssize_t if_usb_firmware_set(struct device *dev,
94static DEVICE_ATTR(lbs_flash_fw, 0200, NULL, if_usb_firmware_set); 94static DEVICE_ATTR(lbs_flash_fw, 0200, NULL, if_usb_firmware_set);
95 95
96/** 96/**
97 * Set function to write firmware to device's persistent memory 97 * if_usb_boot2_set - write firmware to device's persistent memory
98 *
99 * @dev: target device
100 * @attr: device attributes
101 * @buf: firmware buffer to write
102 * @count: number of bytes to write
103 *
104 * returns: number of bytes written or negative error code
98 */ 105 */
99static ssize_t if_usb_boot2_set(struct device *dev, 106static ssize_t if_usb_boot2_set(struct device *dev,
100 struct device_attribute *attr, const char *buf, size_t count) 107 struct device_attribute *attr, const char *buf, size_t count)
@@ -112,7 +119,7 @@ static ssize_t if_usb_boot2_set(struct device *dev,
112 return ret; 119 return ret;
113} 120}
114 121
115/** 122/*
116 * lbs_flash_boot2 attribute to be exported per ethX interface through sysfs 123 * lbs_flash_boot2 attribute to be exported per ethX interface through sysfs
117 * (/sys/class/net/ethX/lbs_flash_boot2). Use this like so to write firmware 124 * (/sys/class/net/ethX/lbs_flash_boot2). Use this like so to write firmware
118 * to the device's persistent memory: 125 * to the device's persistent memory:
@@ -121,9 +128,10 @@ static ssize_t if_usb_boot2_set(struct device *dev,
121static DEVICE_ATTR(lbs_flash_boot2, 0200, NULL, if_usb_boot2_set); 128static DEVICE_ATTR(lbs_flash_boot2, 0200, NULL, if_usb_boot2_set);
122 129
123/** 130/**
124 * @brief call back function to handle the status of the URB 131 * if_usb_write_bulk_callback - callback function to handle the status
125 * @param urb pointer to urb structure 132 * of the URB
126 * @return N/A 133 * @urb: pointer to &urb structure
134 * returns: N/A
127 */ 135 */
128static void if_usb_write_bulk_callback(struct urb *urb) 136static void if_usb_write_bulk_callback(struct urb *urb)
129{ 137{
@@ -150,9 +158,9 @@ static void if_usb_write_bulk_callback(struct urb *urb)
150} 158}
151 159
152/** 160/**
153 * @brief free tx/rx urb, skb and rx buffer 161 * if_usb_free - free tx/rx urb, skb and rx buffer
154 * @param cardp pointer if_usb_card 162 * @cardp: pointer to &if_usb_card
155 * @return N/A 163 * returns: N/A
156 */ 164 */
157static void if_usb_free(struct if_usb_card *cardp) 165static void if_usb_free(struct if_usb_card *cardp)
158{ 166{
@@ -231,10 +239,10 @@ static void if_usb_reset_olpc_card(struct lbs_private *priv)
231#endif 239#endif
232 240
233/** 241/**
234 * @brief sets the configuration values 242 * if_usb_probe - sets the configuration values
235 * @param ifnum interface number 243 * @intf: &usb_interface pointer
236 * @param id pointer to usb_device_id 244 * @id: pointer to usb_device_id
237 * @return 0 on success, error code on failure 245 * returns: 0 on success, error code on failure
238 */ 246 */
239static int if_usb_probe(struct usb_interface *intf, 247static int if_usb_probe(struct usb_interface *intf,
240 const struct usb_device_id *id) 248 const struct usb_device_id *id)
@@ -366,9 +374,9 @@ error:
366} 374}
367 375
368/** 376/**
369 * @brief free resource and cleanup 377 * if_usb_disconnect - free resource and cleanup
370 * @param intf USB interface structure 378 * @intf: USB interface structure
371 * @return N/A 379 * returns: N/A
372 */ 380 */
373static void if_usb_disconnect(struct usb_interface *intf) 381static void if_usb_disconnect(struct usb_interface *intf)
374{ 382{
@@ -398,9 +406,9 @@ static void if_usb_disconnect(struct usb_interface *intf)
398} 406}
399 407
400/** 408/**
401 * @brief This function download FW 409 * if_usb_send_fw_pkt - download FW
402 * @param priv pointer to struct lbs_private 410 * @cardp: pointer to &struct if_usb_card
403 * @return 0 411 * returns: 0
404 */ 412 */
405static int if_usb_send_fw_pkt(struct if_usb_card *cardp) 413static int if_usb_send_fw_pkt(struct if_usb_card *cardp)
406{ 414{
@@ -486,11 +494,11 @@ static int if_usb_reset_device(struct if_usb_card *cardp)
486} 494}
487 495
488/** 496/**
489 * @brief This function transfer the data to the device. 497 * usb_tx_block - transfer the data to the device
490 * @param priv pointer to struct lbs_private 498 * @cardp: pointer to &struct if_usb_card
491 * @param payload pointer to payload data 499 * @payload: pointer to payload data
492 * @param nb data length 500 * @nb: data length
493 * @return 0 or -1 501 * returns: 0 for success or negative error code
494 */ 502 */
495static int usb_tx_block(struct if_usb_card *cardp, uint8_t *payload, uint16_t nb) 503static int usb_tx_block(struct if_usb_card *cardp, uint8_t *payload, uint16_t nb)
496{ 504{
@@ -727,11 +735,11 @@ static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff,
727} 735}
728 736
729/** 737/**
730 * @brief This function reads of the packet into the upload buff, 738 * if_usb_receive - read the packet into the upload buffer,
731 * wake up the main thread and initialise the Rx callack. 739 * wake up the main thread and initialise the Rx callack
732 * 740 *
733 * @param urb pointer to struct urb 741 * @urb: pointer to &struct urb
734 * @return N/A 742 * returns: N/A
735 */ 743 */
736static void if_usb_receive(struct urb *urb) 744static void if_usb_receive(struct urb *urb)
737{ 745{
@@ -802,12 +810,12 @@ rx_exit:
802} 810}
803 811
804/** 812/**
805 * @brief This function downloads data to FW 813 * if_usb_host_to_card - downloads data to FW
806 * @param priv pointer to struct lbs_private structure 814 * @priv: pointer to &struct lbs_private structure
807 * @param type type of data 815 * @type: type of data
808 * @param buf pointer to data buffer 816 * @payload: pointer to data buffer
809 * @param len number of bytes 817 * @nb: number of bytes
810 * @return 0 or -1 818 * returns: 0 for success or negative error code
811 */ 819 */
812static int if_usb_host_to_card(struct lbs_private *priv, uint8_t type, 820static int if_usb_host_to_card(struct lbs_private *priv, uint8_t type,
813 uint8_t *payload, uint16_t nb) 821 uint8_t *payload, uint16_t nb)
@@ -831,10 +839,11 @@ static int if_usb_host_to_card(struct lbs_private *priv, uint8_t type,
831} 839}
832 840
833/** 841/**
834 * @brief This function issues Boot command to the Boot2 code 842 * if_usb_issue_boot_command - issues Boot command to the Boot2 code
835 * @param ivalue 1:Boot from FW by USB-Download 843 * @cardp: pointer to &if_usb_card
836 * 2:Boot from FW in EEPROM 844 * @ivalue: 1:Boot from FW by USB-Download
837 * @return 0 845 * 2:Boot from FW in EEPROM
846 * returns: 0 for success or negative error code
838 */ 847 */
839static int if_usb_issue_boot_command(struct if_usb_card *cardp, int ivalue) 848static int if_usb_issue_boot_command(struct if_usb_card *cardp, int ivalue)
840{ 849{
@@ -853,11 +862,11 @@ static int if_usb_issue_boot_command(struct if_usb_card *cardp, int ivalue)
853 862
854 863
855/** 864/**
856 * @brief This function checks the validity of Boot2/FW image. 865 * check_fwfile_format - check the validity of Boot2/FW image
857 * 866 *
858 * @param data pointer to image 867 * @data: pointer to image
859 * len image length 868 * @totlen: image length
860 * @return 0 or -1 869 * returns: 0 (good) or 1 (failure)
861 */ 870 */
862static int check_fwfile_format(const uint8_t *data, uint32_t totlen) 871static int check_fwfile_format(const uint8_t *data, uint32_t totlen)
863{ 872{
@@ -901,13 +910,13 @@ static int check_fwfile_format(const uint8_t *data, uint32_t totlen)
901 910
902 911
903/** 912/**
904* @brief This function programs the firmware subject to cmd 913* if_usb_prog_firmware - programs the firmware subject to cmd
905* 914*
906* @param cardp the if_usb_card descriptor 915* @cardp: the if_usb_card descriptor
907* fwname firmware or boot2 image file name 916* @fwname: firmware or boot2 image file name
908* cmd either BOOT_CMD_FW_BY_USB, BOOT_CMD_UPDATE_FW, 917* @cmd: either BOOT_CMD_FW_BY_USB, BOOT_CMD_UPDATE_FW,
909* or BOOT_CMD_UPDATE_BOOT2. 918* or BOOT_CMD_UPDATE_BOOT2.
910* @return 0 or error code 919* returns: 0 or error code
911*/ 920*/
912static int if_usb_prog_firmware(struct if_usb_card *cardp, 921static int if_usb_prog_firmware(struct if_usb_card *cardp,
913 const char *fwname, int cmd) 922 const char *fwname, int cmd)