lkml.org 
[lkml]   [2007]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH] usb bulk transfer: 1024 byte packets
Date
On Friday April 13 2007 12:56, I wrote:
[snip]
> I found this patch useful and un-obtrusive, so I figured that I would
> post it here to see if anyone else thinks it interesting enough to
> patch in.
>

Sorry about this, but there was a small error in my patch...

-Jeremy

--
-----------------------
Jeremy C. Andrus
http://www.jeremya.com/
-----------------------
diff -Naur linux-2.6.20.6/Documentation/usb/bulk_tx_hacks.txt linux-2.6.20.6_jca/Documentation/usb/bulk_tx_hacks.txt
--- linux-2.6.20.6/Documentation/usb/bulk_tx_hacks.txt 1969-12-31 19:00:00.000000000 -0500
+++ linux-2.6.20.6_jca/Documentation/usb/bulk_tx_hacks.txt 2007-04-13 09:59:19.000000000 -0400
@@ -0,0 +1,28 @@
+bulk_tx_hacks.txt
+Copyright (C) 2007 Jeremy C. Andrus <jeremy@jeremya.com>
+Started: 2007-April-13
+
+
+How to use a 1024-byte bulk transfer packet
+
+There are some devices/companies which have decided to use
+a bulk transfer packet size which is larger than the maximum
+specified in the USB spec. Because I was interested in using
+such a device, I found it necessary to devise a way to allow
+this functionality in the linux kernel.
+
+It is reasonably simple to create a 1024-byte bulk transfer
+URB. Simply OR the 'URB_1024_BYTE_PKT' value into the URB's
+transfer_flags field before submitting it to the system:
+
+ urb = usb_alloc_urb(0, GFP_KERNEL);
+
+ usb_fill_bulk_urb( urb, ... );
+
+ /* this allows the URB's buffer to be 1024 bytes */
+ urb->transfer_flags |= URB_1024_BYTE_PKT;
+
+ retval = usb_submit_urb( urb, GFP_KERNEL );
+
+ usb_free_urb( urb );
+
diff -Naur linux-2.6.20.6/drivers/usb/host/Kconfig linux-2.6.20.6_jca/drivers/usb/host/Kconfig
--- linux-2.6.20.6/drivers/usb/host/Kconfig 2007-04-06 16:02:48.000000000 -0400
+++ linux-2.6.20.6_jca/drivers/usb/host/Kconfig 2007-04-13 10:00:36.000000000 -0400
@@ -67,6 +67,20 @@

If unsure, say N.

+config USB_EHCI_1024BYTE_BULK_PKTS
+ bool "Allow 1024-byte packets in Bulk Transfer mode"
+ depends on USB_EHCI_HCD && EXPERIMENTAL
+ ---help---
+ The USB specification allows a maximum bulk transfer packet size
+ of 512 bytes. There are a few devices which have decided to break
+ this specification and use 1024 byte packets. This option allows
+ the use of the larger packet size with a very specific flag set
+ in the URB.
+
+ See the Documentation/usb/bulk_tx_hacks.txt file for details.
+
+ If unsure, say N.
+
config USB_ISP116X_HCD
tristate "ISP116X HCD support"
depends on USB
diff -Naur linux-2.6.20.6/drivers/usb/host/ehci-q.c linux-2.6.20.6_jca/drivers/usb/host/ehci-q.c
--- linux-2.6.20.6/drivers/usb/host/ehci-q.c 2007-04-06 16:02:48.000000000 -0400
+++ linux-2.6.20.6_jca/drivers/usb/host/ehci-q.c 2007-04-13 09:47:09.000000000 -0400
@@ -751,7 +751,12 @@
info2 |= (EHCI_TUNE_MULT_HS << 30);
} else if (type == PIPE_BULK) {
info1 |= (EHCI_TUNE_RL_HS << 28);
- info1 |= 512 << 16; /* usb2 fixed maxpacket */
+#ifdef CONFIG_USB_EHCI_1024BYTE_BULK_PKTS
+ if ( urb->transfer_flags & URB_1024_BYTE_PKT )
+ info1 |= 1024 << 16; /* HACK for Micron Dev Kits requiring 1024 byte packets... */
+ else
+#endif
+ info1 |= 512 << 16; /* usb2 fixed maxpacket */
info2 |= (EHCI_TUNE_MULT_HS << 30);
} else { /* PIPE_INTERRUPT */
info1 |= max_packet (maxp) << 16;
diff -Naur linux-2.6.20.6/include/linux/usb.h linux-2.6.20.6_jca/include/linux/usb.h
--- linux-2.6.20.6/include/linux/usb.h 2007-04-06 16:02:48.000000000 -0400
+++ linux-2.6.20.6_jca/include/linux/usb.h 2007-04-13 09:47:09.000000000 -0400
@@ -904,6 +904,9 @@
#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */
#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt
* needed */
+#ifdef CONFIG_USB_EHCI_1024BYTE_BULK_PKTS
+#define URB_1024_BYTE_PKT 0x8000 /* Use a max packet length of 1024 bytes instead of 512 */
+#endif

struct usb_iso_packet_descriptor {
unsigned int offset;
\
 
 \ /
  Last update: 2007-04-14 00:29    [W:0.110 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site