ChangeSet 1.1608.24.31, 2004/03/01 15:58:31-08:00, stern@rowland.harvard.edu [PATCH] USB Storage: Revision of as202, Genesys quirk patch In the slave_configure routine it's already too late for the host's max_sector value to affect the scsi_device. It's necessary to set the queue value directly. This revised patch takes care of that. drivers/usb/storage/scsiglue.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletion(-) diff -Nru a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c --- a/drivers/usb/storage/scsiglue.c Tue Mar 16 15:04:59 2004 +++ b/drivers/usb/storage/scsiglue.c Tue Mar 16 15:04:59 2004 @@ -64,8 +64,10 @@ return "SCSI emulation for USB Mass Storage devices"; } -static int slave_configure (struct scsi_device *sdev) +static int slave_configure(struct scsi_device *sdev) { + struct us_data *us = (struct us_data *) sdev->host->hostdata[0]; + /* Scatter-gather buffers (all but the last) must have a length * divisible by the bulk maxpacket size. Otherwise a data packet * would end up being short, causing a premature end to the data @@ -75,6 +77,16 @@ * have the desired effect because, except at the beginning and * 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 + if (us->pusb_dev->descriptor.idVendor == USB_VENDOR_ID_GENESYS && + us->pusb_dev->speed == USB_SPEED_HIGH) + blk_queue_max_sectors(sdev->request_queue, 128); /* this is to satisify the compiler, tho I don't think the * return code is ever checked anywhere. */