[PATCH] USB: Workarounds for Genesys Logics

Linux Kernel Mailing List <[email protected]>
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
ChangeSet 1.1577, 2005/01/27 07:28:56-02:00, [email protected]

	[PATCH] USB: Workarounds for Genesys Logics
	
	Disk enclosures with Genesys Logics chipset require additional delays, or
	commands are not processed. Also, their maximum transfer size is limited.
	
	Patch by Martin Strigl.



 transport.c |    7 +++++++
 usb.c       |    9 +++++++++
 usb.h       |    3 +++
 3 files changed, 19 insertions(+)


diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c	2005-01-30 15:36:37 -08:00
+++ b/drivers/usb/storage/transport.c	2005-01-30 15:36:37 -08:00
@@ -1181,6 +1181,13 @@
 
 	/* if the command transfered well, then we go to the data stage */
 	if (result == 0) {
+
+		/* Genesys Logic interface chips need a 100us delay between
+		 * the command phase and the data phase.  Some systems need
+		 * even more, probably because of clock rate inaccuracies. */
+		if (us->pusb_dev->descriptor.idVendor == USB_VENDOR_ID_GENESYS)
+			udelay(110);
+
 		/* send/receive data payload, if there is any */
 		if (bcb->DataTransferLength) {
 			usb_stor_transfer(srb, us);
diff -Nru a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
--- a/drivers/usb/storage/usb.c	2005-01-30 15:36:37 -08:00
+++ b/drivers/usb/storage/usb.c	2005-01-30 15:36:37 -08:00
@@ -996,6 +996,15 @@
 		 */
 		ss->htmplt.proc_dir = (void *)ss; 
 
+		/* According to the technical support people at Genesys Logic,
+		 * devices using their chips have problems transferring more
+		 * than 32 KB at a time.  In practice people have found that
+		 * 64 KB works okay and that's what Windows does.  But we'll
+		 * be conservative.
+		 */
+		if (ss->pusb_dev->descriptor.idVendor == USB_VENDOR_ID_GENESYS)
+			ss->htmplt.max_sectors = 64;
+
 		/* Just before we start our control thread, initialize
 		 * the device if it needs initialization */
 		if (unusual_dev && unusual_dev->initFunction)
diff -Nru a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
--- a/drivers/usb/storage/usb.h	2005-01-30 15:36:37 -08:00
+++ b/drivers/usb/storage/usb.h	2005-01-30 15:36:37 -08:00
@@ -193,4 +193,7 @@
 /* Function to fill an inquiry response. See usb.c for details */
 extern void fill_inquiry_response(struct us_data *us,
 	unsigned char *data, unsigned int data_len);
+
+/* Vendor ID list for devices that require special handling */
+#define USB_VENDOR_ID_GENESYS		0x05e3	/* Genesys Logic */
 #endif
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.