From: Greg KH To: torvalds@transmeta.com Cc: linux-usb-devel@lists.sourceforge.net Subject: [PATCH 6 of 8] USB storage driver update Hi, Here's a patch against 2.5.2-pre7 that updates the USB storage driver to the latest version. The patch was written by Matt Dharm.. thanks, greg k-h diff -Nru a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c --- a/drivers/usb/storage/datafab.c Thu Jan 3 16:45:34 2002 +++ b/drivers/usb/storage/datafab.c Thu Jan 3 16:45:34 2002 @@ -208,7 +208,7 @@ if (use_sg) { sg = (struct scatterlist *) dest; - buffer = kmalloc(len, GFP_KERNEL); + buffer = kmalloc(len, GFP_NOIO); if (buffer == NULL) return USB_STOR_TRANSPORT_ERROR; ptr = buffer; @@ -333,7 +333,7 @@ if (use_sg) { sg = (struct scatterlist *) src; - buffer = kmalloc(len, GFP_KERNEL); + buffer = kmalloc(len, GFP_NOIO); if (buffer == NULL) return USB_STOR_TRANSPORT_ERROR; ptr = buffer; @@ -665,7 +665,7 @@ }; if (!us->extra) { - us->extra = kmalloc(sizeof(struct datafab_info), GFP_KERNEL); + us->extra = kmalloc(sizeof(struct datafab_info), GFP_NOIO); if (!us->extra) { US_DEBUGP("datafab_transport: Gah! Can't allocate storage for Datafab info struct!\n"); return USB_STOR_TRANSPORT_ERROR; diff -Nru a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c --- a/drivers/usb/storage/freecom.c Thu Jan 3 16:45:35 2002 +++ b/drivers/usb/storage/freecom.c Thu Jan 3 16:45:35 2002 @@ -1,6 +1,6 @@ /* Driver for Freecom USB/IDE adaptor * - * $Id: freecom.c,v 1.19 2001/11/11 05:42:34 mdharm Exp $ + * $Id: freecom.c,v 1.21 2001/12/29 03:47:33 mdharm Exp $ * * Freecom v0.1: * @@ -206,9 +206,7 @@ return USB_STOR_TRANSPORT_GOOD; } -#endif -#if 0 /* Unused at this time */ /* Read a value from an ide register. */ static int freecom_ide_read (struct us_data *us, int reg, int *value) @@ -435,7 +433,7 @@ /* Get the status again */ fcb->Type = FCM_PACKET_STATUS; fcb->Timeout = 0; - memset (fcb->Atapi, 0, sizeof(fcb->Filler)); + memset (fcb->Atapi, 0, sizeof(fcb->Atapi)); memset (fcb->Filler, 0, sizeof (fcb->Filler)); /* Send it out. */ @@ -487,10 +485,19 @@ * and such will hang. */ US_DEBUGP("Device indicates that it has %d bytes available\n", le16_to_cpu (fst->Count)); + US_DEBUGP("SCSI requested %d\n", usb_stor_transfer_length(srb)); /* Find the length we desire to read. */ - length = usb_stor_transfer_length (srb); - US_DEBUGP("SCSI requested %d\n", length); + switch (srb->cmnd[0]) { + case INQUIRY: + case REQUEST_SENSE: /* 16 or 18 bytes? spec says 18, lots of devices only have 16 */ + case MODE_SENSE: + case MODE_SENSE_10: + length = fst->Count; + break; + default: + length = usb_stor_transfer_length (srb); + } /* verify that this amount is legal */ if (length > srb->request_bufflen) { diff -Nru a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c --- a/drivers/usb/storage/jumpshot.c Thu Jan 3 16:45:35 2002 +++ b/drivers/usb/storage/jumpshot.c Thu Jan 3 16:45:35 2002 @@ -284,7 +284,7 @@ if (use_sg) { sg = (struct scatterlist *) dest; - buffer = kmalloc(len, GFP_KERNEL); + buffer = kmalloc(len, GFP_NOIO); if (buffer == NULL) return USB_STOR_TRANSPORT_ERROR; ptr = buffer; @@ -399,7 +399,7 @@ if (use_sg) { sg = (struct scatterlist *) src; - buffer = kmalloc(len, GFP_KERNEL); + buffer = kmalloc(len, GFP_NOIO); if (buffer == NULL) return USB_STOR_TRANSPORT_ERROR; ptr = buffer; @@ -665,7 +665,7 @@ if (!us->extra) { - us->extra = kmalloc(sizeof(struct jumpshot_info), GFP_KERNEL); + us->extra = kmalloc(sizeof(struct jumpshot_info), GFP_NOIO); if (!us->extra) { US_DEBUGP("jumpshot_transport: Gah! Can't allocate storage for jumpshot info struct!\n"); return USB_STOR_TRANSPORT_ERROR; diff -Nru a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c --- a/drivers/usb/storage/sddr09.c Thu Jan 3 16:45:34 2002 +++ b/drivers/usb/storage/sddr09.c Thu Jan 3 16:45:34 2002 @@ -1,6 +1,6 @@ /* Driver for SanDisk SDDR-09 SmartMedia reader * - * $Id: sddr09.c,v 1.21 2001/11/06 03:18:36 mdharm Exp $ + * $Id: sddr09.c,v 1.22 2001/12/08 23:32:48 mdharm Exp $ * * SDDR09 driver v0.1: * @@ -79,7 +79,7 @@ // copy the data into the buffer. /* if (xfer_len > 0) { - buffer = kmalloc(xfer_len, GFP_KERNEL); + buffer = kmalloc(xfer_len, GFP_NOIO); if (!(command[0] & USB_DIR_IN)) memcpy(buffer, xfer_data, xfer_len); } @@ -303,7 +303,7 @@ if (use_sg) { sg = (struct scatterlist *)content; - buffer = kmalloc(len, GFP_KERNEL); + buffer = kmalloc(len, GFP_NOIO); if (buffer == NULL) return USB_STOR_TRANSPORT_ERROR; ptr = buffer; @@ -630,17 +630,17 @@ alloc_blocks = (alloc_len + (1<<17) - 1) >> 17; sg = kmalloc(alloc_blocks*sizeof(struct scatterlist), - GFP_KERNEL); + GFP_NOIO); if (sg == NULL) return 0; for (i=0; ilba_to_pba); if (info->pba_to_lba) kfree(info->pba_to_lba); - info->lba_to_pba = kmalloc(numblocks*sizeof(int), GFP_KERNEL); - info->pba_to_lba = kmalloc(numblocks*sizeof(int), GFP_KERNEL); + info->lba_to_pba = kmalloc(numblocks*sizeof(int), GFP_NOIO); + info->pba_to_lba = kmalloc(numblocks*sizeof(int), GFP_NOIO); if (info->lba_to_pba == NULL || info->pba_to_lba == NULL) { if (info->lba_to_pba != NULL) @@ -842,7 +842,7 @@ if (!us->extra) { us->extra = kmalloc( - sizeof(struct sddr09_card_info), GFP_KERNEL); + sizeof(struct sddr09_card_info), GFP_NOIO); if (!us->extra) return USB_STOR_TRANSPORT_ERROR; memset(us->extra, 0, sizeof(struct sddr09_card_info)); diff -Nru a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c --- a/drivers/usb/storage/shuttle_usbat.c Thu Jan 3 16:45:35 2002 +++ b/drivers/usb/storage/shuttle_usbat.c Thu Jan 3 16:45:35 2002 @@ -1,6 +1,6 @@ /* Driver for SCM Microsystems USB-ATAPI cable * - * $Id: shuttle_usbat.c,v 1.14 2001/03/28 01:02:06 groovyjava Exp $ + * $Id: shuttle_usbat.c,v 1.15 2001/12/08 23:32:48 mdharm Exp $ * * Current development and maintenance by: * (c) 2000, 2001 Robert Baruch (autophile@starband.net) @@ -681,7 +681,7 @@ len = (65535/srb->transfersize) * srb->transfersize; US_DEBUGP("Max read is %d bytes\n", len); - buffer = kmalloc(len, GFP_KERNEL); + buffer = kmalloc(len, GFP_NOIO); if (buffer == NULL) // bloody hell! return USB_STOR_TRANSPORT_FAILED; sector = short_pack(data[7+3], data[7+2]); diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c --- a/drivers/usb/storage/transport.c Thu Jan 3 16:45:34 2002 +++ b/drivers/usb/storage/transport.c Thu Jan 3 16:45:34 2002 @@ -1,6 +1,6 @@ /* Driver for USB Mass Storage compliant devices * - * $Id: transport.c,v 1.41 2001/10/15 07:02:32 mdharm Exp $ + * $Id: transport.c,v 1.42 2001/12/08 23:32:48 mdharm Exp $ * * Current development and maintenance by: * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) @@ -388,7 +388,7 @@ devrequest *dr; /* allocate the device request structure */ - dr = kmalloc(sizeof(devrequest), GFP_KERNEL); + dr = kmalloc(sizeof(devrequest), GFP_NOIO); if (!dr) return -ENOMEM; diff -Nru a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h --- a/drivers/usb/storage/unusual_devs.h Thu Jan 3 16:45:35 2002 +++ b/drivers/usb/storage/unusual_devs.h Thu Jan 3 16:45:35 2002 @@ -1,7 +1,7 @@ /* Driver for USB Mass Storage compliant devices * Ununsual Devices File * - * $Id: unusual_devs.h,v 1.20 2001/09/02 05:12:57 mdharm Exp $ + * $Id: unusual_devs.h,v 1.24 2001/12/29 03:12:45 mdharm Exp $ * * Current development and maintenance by: * (c) 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) @@ -58,6 +58,11 @@ "HP", "CD-Writer+ 8200e", US_SC_8070, US_PR_SCM_ATAPI, init_8200e, 0), + +UNUSUAL_DEV( 0x03f0, 0x0307, 0x0001, 0x0001, + "HP", + "CD-Writer+ CD-4e", + US_SC_8070, US_PR_SCM_ATAPI, init_8200e, 0), #endif #ifdef CONFIG_USB_STORAGE_DPCM @@ -86,6 +91,25 @@ "FinePix 1400Zoom", US_SC_8070, US_PR_CBI, NULL, US_FL_FIX_INQUIRY), +/* Reported by Peter Wächtler + * The device needs the flags only. + */ +UNUSUAL_DEV( 0x04ce, 0x0002, 0x0074, 0x0074, + "ScanLogic", + "SL11R-IDE", + US_SC_SCSI, US_PR_BULK, NULL, + US_FL_FIX_INQUIRY), + +/* Reported by Kriston Fincher + * Patch submitted by Sean Millichamp + * This is to support the Panasonic PalmCam PV-SD4090 + * This entry is needed because the device reports Sub=ff + */ +UNUSUAL_DEV( 0x04da, 0x0901, 0x0100, 0x0200, + "Panasonic", + "LS-120 Camera", + US_SC_UFI, US_PR_CBI, NULL, 0), + /* Most of the following entries were developed with the help of * Shuttle/SCM directly. */ @@ -161,14 +185,24 @@ US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, US_FL_SCM_MULT_TARG ), +/* Iomega Clik! Drive + * Reported by David Chatenay + * The reason this is needed is not fully known. + */ +UNUSUAL_DEV( 0x0525, 0xa140, 0x0100, 0x0100, + "Iomega", + "USB Clik! 40", + US_SC_8070, US_PR_BULK, NULL, + US_FL_FIX_INQUIRY | US_FL_START_STOP ), + /* This entry is needed because the device reports Sub=ff */ -UNUSUAL_DEV( 0x054c, 0x0010, 0x0106, 0x0322, +UNUSUAL_DEV( 0x054c, 0x0010, 0x0106, 0x0422, "Sony", "DSC-S30/S70/S75/505V/F505", US_SC_SCSI, US_PR_CB, NULL, US_FL_SINGLE_LUN | US_FL_START_STOP | US_FL_MODE_XLATE ), -/* Reported by win@geeks.nl */ +/* Reported by wim@geeks.nl */ UNUSUAL_DEV( 0x054c, 0x0025, 0x0100, 0x0100, "Sony", "Memorystick NW-MS7", @@ -194,6 +228,13 @@ US_SC_UFI, US_PR_CB, NULL, US_FL_SINGLE_LUN | US_FL_START_STOP ), +/* Submitted by Nathan Babb */ +UNUSUAL_DEV( 0x054c, 0x006d, 0x0000, 0x9999, + "Sony", + "PEG Mass Storage", + US_SC_8070, US_PR_CBI, NULL, + US_FL_FIX_INQUIRY ), + UNUSUAL_DEV( 0x057b, 0x0000, 0x0000, 0x0299, "Y-E Data", "Flashbuster-U", @@ -264,6 +305,14 @@ US_FL_SINGLE_LUN | US_FL_START_STOP ), #endif +/* Submitted by f.brugmans@hccnet.nl + * Needed for START_STOP flag */ +UNUSUAL_DEV( 0x0686, 0x4007, 0x0001, 0x0001, + "Minolta", + "Dimage S304", + US_SC_SCSI, US_PR_BULK, NULL, + US_FL_START_STOP ), + UNUSUAL_DEV( 0x0693, 0x0002, 0x0100, 0x0100, "Hagiwara", "FlashGate SmartMedia", @@ -307,7 +356,7 @@ US_SC_QIC, US_PR_FREECOM, freecom_init, 0), #endif -UNUSUAL_DEV( 0x07af, 0x0004, 0x0100, 0x0100, +UNUSUAL_DEV( 0x07af, 0x0004, 0x0100, 0x0133, "Microtech", "USB-SCSI-DB25", US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init, @@ -374,16 +423,23 @@ "Simple Tech/Datafab CF+SM Reader", US_SC_SCSI, US_PR_DATAFAB, NULL, US_FL_MODE_XLATE | US_FL_START_STOP ), + +/* Submitted by Olaf Hering */ +UNUSUAL_DEV( 0x07c4, 0xa109, 0x0000, 0xffff, + "Datafab Systems, Inc.", + "USB to CF + SM Combo (LC1)", + US_SC_SCSI, US_PR_DATAFAB, NULL, + US_FL_MODE_XLATE | US_FL_START_STOP ), #endif -/* Casio QV 2x00/3x00/8000 digital still cameras are not conformant +/* Casio QV 2x00/3x00/4000/8000 digital still cameras are not conformant * to the USB storage specification in two ways: * - They tell us they are using transport protocol CBI. In reality they * are using transport protocol CB. * - They don't like the INQUIRY command. So we must handle this command * of the SCSI layer ourselves. */ -UNUSUAL_DEV( 0x07cf, 0x1001, 0x9009, 0x9009, +UNUSUAL_DEV( 0x07cf, 0x1001, 0x1000, 0x9009, "Casio", "QV DigitalCamera", US_SC_8070, US_PR_CB, NULL, @@ -402,3 +458,12 @@ US_SC_ISD200, US_PR_BULK, isd200_Initialization, 0 ), #endif + +/* Reported by Dan Pilone + * The device needs the flags only. + */ +UNUSUAL_DEV( 0x1065, 0x2136, 0x0000, 0x9999, + "CCYU TECHNOLOGY", + "EasyDisk Portable Device", + US_SC_SCSI, US_PR_BULK, NULL, + US_FL_MODE_XLATE | US_FL_START_STOP),