Commit f5fa0d53 authored by Matthew Dharm's avatar Matthew Dharm Committed by Greg Kroah-Hartman

[PATCH] USB Storage: fix Genesys Logic based on info from vendor

In theory, this is the fix we need to make Genesys Logic devices work.
This patch started life as as343, which was created based on some
information which a user finally coaxed out of Genesys Logic.  Limited
end-user testing gives good results.

As we expected, it's a bug in their device.  This is really a workaround
for what is almost certainly a timing problem.  Apparently, the 'popular'
OSes don't push the device as hard as Linux does.

Although it is likely that this workaround is not needed for all Genesys
devices, Genesys was unable/unwilling to provide us with the explicit list
of VID/PIDs which required this -- thus we apply it to all Genesys devices.

We have lots of good reports with max_sectors set to 128 with these
devices, but the official recommendation is to set that to 64.  End-users
can experiment with higher values (for higher performance) via the runtime
sysfs interface to that parameter.

I would like to give special thanks to the users who hounded Genesys into
giving up this information, and to Alan Stern for not giving up on this
vendor long after I had.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarMatthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 4ad90992
......@@ -92,17 +92,15 @@ static int slave_configure(struct scsi_device *sdev)
* the end, scatter-gather buffers follow page boundaries. */
blk_queue_dma_alignment(sdev->request_queue, (512 - 1));
/* Devices using Genesys Logic chips cause a lot of trouble for
* high-speed transfers; they die unpredictably when given more
* than 64 KB of data at a time. If we detect such a device,
* reduce the maximum transfer size to 64 KB = 128 sectors. */
#define USB_VENDOR_ID_GENESYS 0x05e3 // Needs a standard location
/* 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; people can always use the sysfs interface to
* increase max_sectors. */
if (us->pusb_dev->descriptor.idVendor == USB_VENDOR_ID_GENESYS &&
us->pusb_dev->speed == USB_SPEED_HIGH &&
sdev->request_queue->max_sectors > 128)
blk_queue_max_sectors(sdev->request_queue, 128);
sdev->request_queue->max_sectors > 64)
blk_queue_max_sectors(sdev->request_queue, 64);
/* We can't put these settings in slave_alloc() because that gets
* called before the device type is known. Consequently these
......
......@@ -977,6 +977,12 @@ int usb_stor_Bulk_transport(Scsi_Cmnd *srb, struct us_data *us)
/* DATA STAGE */
/* send/receive data payload, if there is any */
/* Genesys Logic interface chips need a 100us delay between the
* command phase and the data phase */
if (us->pusb_dev->descriptor.idVendor == USB_VENDOR_ID_GENESYS)
udelay(100);
if (transfer_length) {
unsigned int pipe = srb->sc_data_direction == SCSI_DATA_READ ?
us->recv_bulk_pipe : us->send_bulk_pipe;
......
......@@ -180,4 +180,8 @@ extern void fill_inquiry_response(struct us_data *us,
#define scsi_unlock(host) spin_unlock_irq(host->host_lock)
#define scsi_lock(host) spin_lock_irq(host->host_lock)
/* Vendor ID list for devices that require special handling */
#define USB_VENDOR_ID_GENESYS 0x05e3 /* Genesys Logic */
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment