From phil@ipom.com Sat Jun 24 17:27:17 2006 Message-ID: <449DD85E.7080503@ipom.com> Date: Sat, 24 Jun 2006 17:27:10 -0700 From: Phil Dibowitz To: Greg KH Subject: USB Storage: US_FL_MAX_SECTORS_64 flag This patch adds a US_FL_MAX_SECTORS_64 and removes the Genesys special-cases for this that were in scsiglue.c. It also adds the flag to other devices reported to need it. Signed-off-by: Phil Dibowitz Signed-off-by: Matthew Dharm Signed-off-by: Greg Kroah-Hartman --- drivers/usb/storage/scsiglue.c | 12 +++++------- drivers/usb/storage/unusual_devs.h | 16 ++++++++++++++-- drivers/usb/storage/usb.h | 4 ---- include/linux/usb_usual.h | 2 ++ 4 files changed, 21 insertions(+), 13 deletions(-) --- gregkh-2.6.orig/drivers/usb/storage/scsiglue.c +++ gregkh-2.6/drivers/usb/storage/scsiglue.c @@ -112,13 +112,11 @@ static int slave_configure(struct scsi_d if (sdev->scsi_level < SCSI_2) sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2; - /* 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 (le16_to_cpu(us->pusb_dev->descriptor.idVendor) == USB_VENDOR_ID_GENESYS && + /* Many devices have trouble transfering more than 32KB at a time, + * while others have trouble with more than 64K. At this time we + * are limiting both to 32K (64 sectores). + */ + if ((us->flags & US_FL_MAX_SECTORS_64) && sdev->request_queue->max_sectors > 64) blk_queue_max_sectors(sdev->request_queue, 64); --- gregkh-2.6.orig/drivers/usb/storage/unusual_devs.h +++ gregkh-2.6/drivers/usb/storage/unusual_devs.h @@ -715,18 +715,22 @@ UNUSUAL_DEV( 0x05dc, 0xb002, 0x0000, 0x * They were originally reported by Alexander Oltu * and Peter Marks * respectively. + * + * US_FL_GO_SLOW and US_FL_MAX_SECTORS_64 added by Phil Dibowitz + * as these flags were made and hard-coded + * special-cases were pulled from scsiglue.c. */ UNUSUAL_DEV( 0x05e3, 0x0701, 0x0000, 0xffff, "Genesys Logic", "USB to IDE Optical", US_SC_DEVICE, US_PR_DEVICE, NULL, - US_FL_GO_SLOW ), + US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ), UNUSUAL_DEV( 0x05e3, 0x0702, 0x0000, 0xffff, "Genesys Logic", "USB to IDE Disk", US_SC_DEVICE, US_PR_DEVICE, NULL, - US_FL_GO_SLOW ), + US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ), /* Reported by Hanno Boeck * Taken from the Lycoris Kernel */ @@ -1203,6 +1207,14 @@ UNUSUAL_DEV( 0x0ea0, 0x6828, 0x0110, 0x US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_IGNORE_RESIDUE ), +/* Reported by Benjamin Schiller + * It is also sold by Easylite as DJ 20 */ +UNUSUAL_DEV( 0x0ed1, 0x7636, 0x0103, 0x0103, + "Typhoon", + "My DJ 1820", + US_SC_DEVICE, US_PR_DEVICE, NULL, + US_FL_IGNORE_RESIDUE | US_FL_GO_SLOW | US_FL_MAX_SECTORS_64), + /* Reported by Michael Stattmann */ UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, "Sony Ericsson", --- gregkh-2.6.orig/drivers/usb/storage/usb.h +++ gregkh-2.6/drivers/usb/storage/usb.h @@ -176,8 +176,4 @@ extern void fill_inquiry_response(struct #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 --- gregkh-2.6.orig/include/linux/usb_usual.h +++ gregkh-2.6/include/linux/usb_usual.h @@ -43,6 +43,8 @@ /* Need delay after Command phase */ \ US_FLAG(NO_WP_DETECT, 0x00000200) \ /* Don't check for write-protect */ \ + US_FLAG(MAX_SECTORS_64, 0x00000400) \ + /* Sets max_sectors to 64 */ #define US_FLAG(name, value) US_FL_##name = value , enum { US_DO_ALL_FLAGS };