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.

diff -urpN -X dontdiff linux-2.4.29/drivers/usb/storage/transport.c 
linux-2.4.29-usb/drivers/usb/storage/transport.c
--- linux-2.4.29/drivers/usb/storage/transport.c        2004-11-22 
23:04:19.000000000 -0800
+++ linux-2.4.29-usb/drivers/usb/storage/transport.c    2005-01-26 
12:45:30.000000000 -0800
@@ -1181,6 +1181,13 @@ int usb_stor_Bulk_transport(Scsi_Cmnd *s
 
        /* 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 -urpN -X dontdiff linux-2.4.29/drivers/usb/storage/usb.c 
linux-2.4.29-usb/drivers/usb/storage/usb.c
--- linux-2.4.29/drivers/usb/storage/usb.c      2004-11-22 23:04:19.000000000 
-0800
+++ linux-2.4.29-usb/drivers/usb/storage/usb.c  2005-01-26 12:45:30.000000000 
-0800
@@ -996,6 +996,15 @@ static void * storage_probe(struct usb_d
                 */
                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 -urpN -X dontdiff linux-2.4.29/drivers/usb/storage/usb.h 
linux-2.4.29-usb/drivers/usb/storage/usb.h
--- linux-2.4.29/drivers/usb/storage/usb.h      2005-01-05 00:59:27.000000000 
-0800
+++ linux-2.4.29-usb/drivers/usb/storage/usb.h  2005-01-26 13:04:40.000000000 
-0800
@@ -193,4 +193,7 @@ extern struct usb_driver usb_storage_dri
 /* 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


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to