]> err.no Git - linux-2.6/commitdiff
rt2x00: Support for large vendor requests
authorIwo Mergler <iwo@call-direct.com.au>
Sat, 19 Jul 2008 14:16:54 +0000 (16:16 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 29 Jul 2008 20:55:04 +0000 (16:55 -0400)
Adds an extra rt2x00 vendor request function to support register
transfers beyond the CSR_CACHE_SIZE / USB packet size limit. This
is useful for firmware uploads, beacon templates and keys, all
of which are to large to do with a single USB request.

Signed-off-by: Iwo Mergler <Iwo@call-direct.com.au>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2x00usb.c
drivers/net/wireless/rt2x00/rt2x00usb.h

index 83862e7f7aec1f03b4de6ea221f1d90491e30277..933e6cc9359db871aafc87a0eec318c5326cbd6f 100644 (file)
@@ -122,6 +122,38 @@ int rt2x00usb_vendor_request_buff(struct rt2x00_dev *rt2x00dev,
 }
 EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_buff);
 
+int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev,
+                                       const u8 request, const u8 requesttype,
+                                       const u16 offset, void *buffer,
+                                       const u16 buffer_length,
+                                       const int timeout)
+{
+       int status = 0;
+       unsigned char *tb;
+       u16 off, len, bsize;
+
+       mutex_lock(&rt2x00dev->usb_cache_mutex);
+
+       tb  = buffer;
+       off = offset;
+       len = buffer_length;
+       while (len && !status) {
+               bsize = min_t(u16, CSR_CACHE_SIZE, len);
+               status = rt2x00usb_vendor_req_buff_lock(rt2x00dev, request,
+                                                       requesttype, off, tb,
+                                                       bsize, timeout);
+
+               tb  += bsize;
+               len -= bsize;
+               off += bsize;
+       }
+
+       mutex_unlock(&rt2x00dev->usb_cache_mutex);
+
+       return status;
+}
+EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_large_buff);
+
 /*
  * TX data handlers.
  */
index aad794adf52cc87632df22fe3c011f89391d6da8..8d5d4272e88f8f7528b8101c9bd4614496d2544c 100644 (file)
@@ -70,7 +70,7 @@
 /*
  * Cache size
  */
-#define CSR_CACHE_SIZE                 8
+#define CSR_CACHE_SIZE                 64
 #define CSR_CACHE_SIZE_FIRMWARE                64
 
 /*
@@ -171,6 +171,25 @@ int rt2x00usb_vendor_req_buff_lock(struct rt2x00_dev *rt2x00dev,
                                   const u16 offset, void *buffer,
                                   const u16 buffer_length, const int timeout);
 
+/**
+ * rt2x00usb_vendor_request_large_buff - Send register command to device (buffered)
+ * @rt2x00dev: Pointer to &struct rt2x00_dev
+ * @request: USB vendor command (See &enum rt2x00usb_vendor_request)
+ * @requesttype: Request type &USB_VENDOR_REQUEST_*
+ * @offset: Register start offset to perform action on
+ * @buffer: Buffer where information will be read/written to by device
+ * @buffer_length: Size of &buffer
+ * @timeout: Operation timeout
+ *
+ * This function is used to transfer register data in blocks larger
+ * then CSR_CACHE_SIZE. Use for firmware upload, keys and beacons.
+ */
+int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev,
+                                       const u8 request, const u8 requesttype,
+                                       const u16 offset, void *buffer,
+                                       const u16 buffer_length,
+                                       const int timeout);
+
 /**
  * rt2x00usb_vendor_request_sw - Send single register command to device
  * @rt2x00dev: Pointer to &struct rt2x00_dev