xref: /openbmc/linux/drivers/usb/storage/jumpshot.c (revision 5fd54ace4721fc5ce2bb5aef6318fcf17f421460)
1*5fd54aceSGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0+
2f0183a33SFelipe Balbi /*
3f0183a33SFelipe Balbi  * Driver for Lexar "Jumpshot" Compact Flash reader
41da177e4SLinus Torvalds  *
51da177e4SLinus Torvalds  * jumpshot driver v0.1:
61da177e4SLinus Torvalds  *
71da177e4SLinus Torvalds  * First release
81da177e4SLinus Torvalds  *
91da177e4SLinus Torvalds  * Current development and maintenance by:
101da177e4SLinus Torvalds  *   (c) 2000 Jimmie Mayfield (mayfield+usb@sackheads.org)
111da177e4SLinus Torvalds  *
121da177e4SLinus Torvalds  *   Many thanks to Robert Baruch for the SanDisk SmartMedia reader driver
131da177e4SLinus Torvalds  *   which I used as a template for this driver.
141da177e4SLinus Torvalds  *
151da177e4SLinus Torvalds  *   Some bugfixes and scatter-gather code by Gregory P. Smith
161da177e4SLinus Torvalds  *   (greg-usb@electricrain.com)
171da177e4SLinus Torvalds  *
181da177e4SLinus Torvalds  *   Fix for media change by Joerg Schneider (js@joergschneider.com)
191da177e4SLinus Torvalds  *
201da177e4SLinus Torvalds  * Developed with the assistance of:
211da177e4SLinus Torvalds  *
221da177e4SLinus Torvalds  *   (C) 2002 Alan Stern <stern@rowland.org>
231da177e4SLinus Torvalds  *
241da177e4SLinus Torvalds  * This program is free software; you can redistribute it and/or modify it
251da177e4SLinus Torvalds  * under the terms of the GNU General Public License as published by the
261da177e4SLinus Torvalds  * Free Software Foundation; either version 2, or (at your option) any
271da177e4SLinus Torvalds  * later version.
281da177e4SLinus Torvalds  *
291da177e4SLinus Torvalds  * This program is distributed in the hope that it will be useful, but
301da177e4SLinus Torvalds  * WITHOUT ANY WARRANTY; without even the implied warranty of
311da177e4SLinus Torvalds  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
321da177e4SLinus Torvalds  * General Public License for more details.
331da177e4SLinus Torvalds  *
341da177e4SLinus Torvalds  * You should have received a copy of the GNU General Public License along
351da177e4SLinus Torvalds  * with this program; if not, write to the Free Software Foundation, Inc.,
361da177e4SLinus Torvalds  * 675 Mass Ave, Cambridge, MA 02139, USA.
371da177e4SLinus Torvalds  */
381da177e4SLinus Torvalds 
391da177e4SLinus Torvalds  /*
401da177e4SLinus Torvalds   * This driver attempts to support the Lexar Jumpshot USB CompactFlash
411da177e4SLinus Torvalds   * reader.  Like many other USB CompactFlash readers, the Jumpshot contains
421da177e4SLinus Torvalds   * a USB-to-ATA chip.
431da177e4SLinus Torvalds   *
441da177e4SLinus Torvalds   * This driver supports reading and writing.  If you're truly paranoid,
451da177e4SLinus Torvalds   * however, you can force the driver into a write-protected state by setting
461da177e4SLinus Torvalds   * the WP enable bits in jumpshot_handle_mode_sense.  See the comments
471da177e4SLinus Torvalds   * in that routine.
481da177e4SLinus Torvalds   */
491da177e4SLinus Torvalds 
501da177e4SLinus Torvalds #include <linux/errno.h>
51a9fb6d05SAlan Stern #include <linux/module.h>
521da177e4SLinus Torvalds #include <linux/slab.h>
531da177e4SLinus Torvalds 
541da177e4SLinus Torvalds #include <scsi/scsi.h>
551da177e4SLinus Torvalds #include <scsi/scsi_cmnd.h>
561da177e4SLinus Torvalds 
571da177e4SLinus Torvalds #include "usb.h"
581da177e4SLinus Torvalds #include "transport.h"
591da177e4SLinus Torvalds #include "protocol.h"
601da177e4SLinus Torvalds #include "debug.h"
61aa519be3SAkinobu Mita #include "scsiglue.h"
621da177e4SLinus Torvalds 
63aa519be3SAkinobu Mita #define DRV_NAME "ums-jumpshot"
641da177e4SLinus Torvalds 
654246b06aSMaciej Grela MODULE_DESCRIPTION("Driver for Lexar \"Jumpshot\" Compact Flash reader");
664246b06aSMaciej Grela MODULE_AUTHOR("Jimmie Mayfield <mayfield+usb@sackheads.org>");
674246b06aSMaciej Grela MODULE_LICENSE("GPL");
684246b06aSMaciej Grela 
69a9fb6d05SAlan Stern /*
70a9fb6d05SAlan Stern  * The table of devices
71a9fb6d05SAlan Stern  */
72a9fb6d05SAlan Stern #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
73a9fb6d05SAlan Stern 		    vendorName, productName, useProtocol, useTransport, \
74a9fb6d05SAlan Stern 		    initFunction, flags) \
75a9fb6d05SAlan Stern { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
76f61870eeSSebastian Andrzej Siewior   .driver_info = (flags) }
77a9fb6d05SAlan Stern 
789d35214bSFelipe Balbi static struct usb_device_id jumpshot_usb_ids[] = {
79a9fb6d05SAlan Stern #	include "unusual_jumpshot.h"
80a9fb6d05SAlan Stern 	{ }		/* Terminating entry */
81a9fb6d05SAlan Stern };
82a9fb6d05SAlan Stern MODULE_DEVICE_TABLE(usb, jumpshot_usb_ids);
83a9fb6d05SAlan Stern 
84a9fb6d05SAlan Stern #undef UNUSUAL_DEV
85a9fb6d05SAlan Stern 
86a9fb6d05SAlan Stern /*
87a9fb6d05SAlan Stern  * The flags table
88a9fb6d05SAlan Stern  */
89a9fb6d05SAlan Stern #define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
90a9fb6d05SAlan Stern 		    vendor_name, product_name, use_protocol, use_transport, \
91a9fb6d05SAlan Stern 		    init_function, Flags) \
92a9fb6d05SAlan Stern { \
93a9fb6d05SAlan Stern 	.vendorName = vendor_name,	\
94a9fb6d05SAlan Stern 	.productName = product_name,	\
95a9fb6d05SAlan Stern 	.useProtocol = use_protocol,	\
96a9fb6d05SAlan Stern 	.useTransport = use_transport,	\
97a9fb6d05SAlan Stern 	.initFunction = init_function,	\
98a9fb6d05SAlan Stern }
99a9fb6d05SAlan Stern 
100a9fb6d05SAlan Stern static struct us_unusual_dev jumpshot_unusual_dev_list[] = {
101a9fb6d05SAlan Stern #	include "unusual_jumpshot.h"
102a9fb6d05SAlan Stern 	{ }		/* Terminating entry */
103a9fb6d05SAlan Stern };
104a9fb6d05SAlan Stern 
105a9fb6d05SAlan Stern #undef UNUSUAL_DEV
106a9fb6d05SAlan Stern 
107a9fb6d05SAlan Stern 
108a9fb6d05SAlan Stern struct jumpshot_info {
109a9fb6d05SAlan Stern    unsigned long   sectors;     /* total sector count */
110a9fb6d05SAlan Stern    unsigned long   ssize;       /* sector size in bytes */
111a9fb6d05SAlan Stern 
112a9fb6d05SAlan Stern    /* the following aren't used yet */
113a9fb6d05SAlan Stern    unsigned char   sense_key;
114a9fb6d05SAlan Stern    unsigned long   sense_asc;   /* additional sense code */
115a9fb6d05SAlan Stern    unsigned long   sense_ascq;  /* additional sense code qualifier */
116a9fb6d05SAlan Stern };
117a9fb6d05SAlan Stern 
1181da177e4SLinus Torvalds static inline int jumpshot_bulk_read(struct us_data *us,
1191da177e4SLinus Torvalds 				     unsigned char *data,
1201da177e4SLinus Torvalds 				     unsigned int len)
1211da177e4SLinus Torvalds {
1221da177e4SLinus Torvalds 	if (len == 0)
1231da177e4SLinus Torvalds 		return USB_STOR_XFER_GOOD;
1241da177e4SLinus Torvalds 
125191648d0SJoe Perches 	usb_stor_dbg(us, "len = %d\n", len);
1261da177e4SLinus Torvalds 	return usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe,
1271da177e4SLinus Torvalds 			data, len, NULL);
1281da177e4SLinus Torvalds }
1291da177e4SLinus Torvalds 
1301da177e4SLinus Torvalds 
1311da177e4SLinus Torvalds static inline int jumpshot_bulk_write(struct us_data *us,
1321da177e4SLinus Torvalds 				      unsigned char *data,
1331da177e4SLinus Torvalds 				      unsigned int len)
1341da177e4SLinus Torvalds {
1351da177e4SLinus Torvalds 	if (len == 0)
1361da177e4SLinus Torvalds 		return USB_STOR_XFER_GOOD;
1371da177e4SLinus Torvalds 
138191648d0SJoe Perches 	usb_stor_dbg(us, "len = %d\n", len);
1391da177e4SLinus Torvalds 	return usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe,
1401da177e4SLinus Torvalds 			data, len, NULL);
1411da177e4SLinus Torvalds }
1421da177e4SLinus Torvalds 
1431da177e4SLinus Torvalds 
1441da177e4SLinus Torvalds static int jumpshot_get_status(struct us_data  *us)
1451da177e4SLinus Torvalds {
1461da177e4SLinus Torvalds 	int rc;
1471da177e4SLinus Torvalds 
1481da177e4SLinus Torvalds 	if (!us)
1491da177e4SLinus Torvalds 		return USB_STOR_TRANSPORT_ERROR;
1501da177e4SLinus Torvalds 
1511da177e4SLinus Torvalds 	// send the setup
1521da177e4SLinus Torvalds 	rc = usb_stor_ctrl_transfer(us, us->recv_ctrl_pipe,
1531da177e4SLinus Torvalds 				   0, 0xA0, 0, 7, us->iobuf, 1);
1541da177e4SLinus Torvalds 
1551da177e4SLinus Torvalds 	if (rc != USB_STOR_XFER_GOOD)
1561da177e4SLinus Torvalds 		return USB_STOR_TRANSPORT_ERROR;
1571da177e4SLinus Torvalds 
1581da177e4SLinus Torvalds 	if (us->iobuf[0] != 0x50) {
159191648d0SJoe Perches 		usb_stor_dbg(us, "0x%2x\n", us->iobuf[0]);
1601da177e4SLinus Torvalds 		return USB_STOR_TRANSPORT_ERROR;
1611da177e4SLinus Torvalds 	}
1621da177e4SLinus Torvalds 
1631da177e4SLinus Torvalds 	return USB_STOR_TRANSPORT_GOOD;
1641da177e4SLinus Torvalds }
1651da177e4SLinus Torvalds 
1661da177e4SLinus Torvalds static int jumpshot_read_data(struct us_data *us,
1671da177e4SLinus Torvalds 			      struct jumpshot_info *info,
1681da177e4SLinus Torvalds 			      u32 sector,
1691da177e4SLinus Torvalds 			      u32 sectors)
1701da177e4SLinus Torvalds {
1711da177e4SLinus Torvalds 	unsigned char *command = us->iobuf;
1721da177e4SLinus Torvalds 	unsigned char *buffer;
1731da177e4SLinus Torvalds 	unsigned char  thistime;
1741da177e4SLinus Torvalds 	unsigned int totallen, alloclen;
1751da177e4SLinus Torvalds 	int len, result;
1761f6f31a0SJens Axboe 	unsigned int sg_offset = 0;
1771f6f31a0SJens Axboe 	struct scatterlist *sg = NULL;
1781da177e4SLinus Torvalds 
1791da177e4SLinus Torvalds 	// we're working in LBA mode.  according to the ATA spec,
1801da177e4SLinus Torvalds 	// we can support up to 28-bit addressing.  I don't know if Jumpshot
1811da177e4SLinus Torvalds 	// supports beyond 24-bit addressing.  It's kind of hard to test
1821da177e4SLinus Torvalds 	// since it requires > 8GB CF card.
1831da177e4SLinus Torvalds 
1841da177e4SLinus Torvalds 	if (sector > 0x0FFFFFFF)
1851da177e4SLinus Torvalds 		return USB_STOR_TRANSPORT_ERROR;
1861da177e4SLinus Torvalds 
1871da177e4SLinus Torvalds 	totallen = sectors * info->ssize;
1881da177e4SLinus Torvalds 
1891da177e4SLinus Torvalds 	// Since we don't read more than 64 KB at a time, we have to create
1901da177e4SLinus Torvalds 	// a bounce buffer and move the data a piece at a time between the
1911da177e4SLinus Torvalds 	// bounce buffer and the actual transfer buffer.
1921da177e4SLinus Torvalds 
1931da177e4SLinus Torvalds 	alloclen = min(totallen, 65536u);
1941da177e4SLinus Torvalds 	buffer = kmalloc(alloclen, GFP_NOIO);
1951da177e4SLinus Torvalds 	if (buffer == NULL)
1961da177e4SLinus Torvalds 		return USB_STOR_TRANSPORT_ERROR;
1971da177e4SLinus Torvalds 
1981da177e4SLinus Torvalds 	do {
1991da177e4SLinus Torvalds 		// loop, never allocate or transfer more than 64k at once
2001da177e4SLinus Torvalds 		// (min(128k, 255*info->ssize) is the real limit)
2011da177e4SLinus Torvalds 		len = min(totallen, alloclen);
2021da177e4SLinus Torvalds 		thistime = (len / info->ssize) & 0xff;
2031da177e4SLinus Torvalds 
2041da177e4SLinus Torvalds 		command[0] = 0;
2051da177e4SLinus Torvalds 		command[1] = thistime;
2061da177e4SLinus Torvalds 		command[2] = sector & 0xFF;
2071da177e4SLinus Torvalds 		command[3] = (sector >>  8) & 0xFF;
2081da177e4SLinus Torvalds 		command[4] = (sector >> 16) & 0xFF;
2091da177e4SLinus Torvalds 
2101da177e4SLinus Torvalds 		command[5] = 0xE0 | ((sector >> 24) & 0x0F);
2111da177e4SLinus Torvalds 		command[6] = 0x20;
2121da177e4SLinus Torvalds 
2131da177e4SLinus Torvalds 		// send the setup + command
2141da177e4SLinus Torvalds 		result = usb_stor_ctrl_transfer(us, us->send_ctrl_pipe,
2151da177e4SLinus Torvalds 					       0, 0x20, 0, 1, command, 7);
2161da177e4SLinus Torvalds 		if (result != USB_STOR_XFER_GOOD)
2171da177e4SLinus Torvalds 			goto leave;
2181da177e4SLinus Torvalds 
2191da177e4SLinus Torvalds 		// read the result
2201da177e4SLinus Torvalds 		result = jumpshot_bulk_read(us, buffer, len);
2211da177e4SLinus Torvalds 		if (result != USB_STOR_XFER_GOOD)
2221da177e4SLinus Torvalds 			goto leave;
2231da177e4SLinus Torvalds 
224191648d0SJoe Perches 		usb_stor_dbg(us, "%d bytes\n", len);
2251da177e4SLinus Torvalds 
2261da177e4SLinus Torvalds 		// Store the data in the transfer buffer
2271da177e4SLinus Torvalds 		usb_stor_access_xfer_buf(buffer, len, us->srb,
2281f6f31a0SJens Axboe 				 &sg, &sg_offset, TO_XFER_BUF);
2291da177e4SLinus Torvalds 
2301da177e4SLinus Torvalds 		sector += thistime;
2311da177e4SLinus Torvalds 		totallen -= len;
2321da177e4SLinus Torvalds 	} while (totallen > 0);
2331da177e4SLinus Torvalds 
2341da177e4SLinus Torvalds 	kfree(buffer);
2351da177e4SLinus Torvalds 	return USB_STOR_TRANSPORT_GOOD;
2361da177e4SLinus Torvalds 
2371da177e4SLinus Torvalds  leave:
2381da177e4SLinus Torvalds 	kfree(buffer);
2391da177e4SLinus Torvalds 	return USB_STOR_TRANSPORT_ERROR;
2401da177e4SLinus Torvalds }
2411da177e4SLinus Torvalds 
2421da177e4SLinus Torvalds 
2431da177e4SLinus Torvalds static int jumpshot_write_data(struct us_data *us,
2441da177e4SLinus Torvalds 			       struct jumpshot_info *info,
2451da177e4SLinus Torvalds 			       u32 sector,
2461da177e4SLinus Torvalds 			       u32 sectors)
2471da177e4SLinus Torvalds {
2481da177e4SLinus Torvalds 	unsigned char *command = us->iobuf;
2491da177e4SLinus Torvalds 	unsigned char *buffer;
2501da177e4SLinus Torvalds 	unsigned char  thistime;
2511da177e4SLinus Torvalds 	unsigned int totallen, alloclen;
2521da177e4SLinus Torvalds 	int len, result, waitcount;
2531f6f31a0SJens Axboe 	unsigned int sg_offset = 0;
2541f6f31a0SJens Axboe 	struct scatterlist *sg = NULL;
2551da177e4SLinus Torvalds 
2561da177e4SLinus Torvalds 	// we're working in LBA mode.  according to the ATA spec,
2571da177e4SLinus Torvalds 	// we can support up to 28-bit addressing.  I don't know if Jumpshot
2581da177e4SLinus Torvalds 	// supports beyond 24-bit addressing.  It's kind of hard to test
2591da177e4SLinus Torvalds 	// since it requires > 8GB CF card.
2601da177e4SLinus Torvalds 	//
2611da177e4SLinus Torvalds 	if (sector > 0x0FFFFFFF)
2621da177e4SLinus Torvalds 		return USB_STOR_TRANSPORT_ERROR;
2631da177e4SLinus Torvalds 
2641da177e4SLinus Torvalds 	totallen = sectors * info->ssize;
2651da177e4SLinus Torvalds 
2661da177e4SLinus Torvalds 	// Since we don't write more than 64 KB at a time, we have to create
2671da177e4SLinus Torvalds 	// a bounce buffer and move the data a piece at a time between the
2681da177e4SLinus Torvalds 	// bounce buffer and the actual transfer buffer.
2691da177e4SLinus Torvalds 
2701da177e4SLinus Torvalds 	alloclen = min(totallen, 65536u);
2711da177e4SLinus Torvalds 	buffer = kmalloc(alloclen, GFP_NOIO);
2721da177e4SLinus Torvalds 	if (buffer == NULL)
2731da177e4SLinus Torvalds 		return USB_STOR_TRANSPORT_ERROR;
2741da177e4SLinus Torvalds 
2751da177e4SLinus Torvalds 	do {
2761da177e4SLinus Torvalds 		// loop, never allocate or transfer more than 64k at once
2771da177e4SLinus Torvalds 		// (min(128k, 255*info->ssize) is the real limit)
2781da177e4SLinus Torvalds 
2791da177e4SLinus Torvalds 		len = min(totallen, alloclen);
2801da177e4SLinus Torvalds 		thistime = (len / info->ssize) & 0xff;
2811da177e4SLinus Torvalds 
2821da177e4SLinus Torvalds 		// Get the data from the transfer buffer
2831da177e4SLinus Torvalds 		usb_stor_access_xfer_buf(buffer, len, us->srb,
2841f6f31a0SJens Axboe 				&sg, &sg_offset, FROM_XFER_BUF);
2851da177e4SLinus Torvalds 
2861da177e4SLinus Torvalds 		command[0] = 0;
2871da177e4SLinus Torvalds 		command[1] = thistime;
2881da177e4SLinus Torvalds 		command[2] = sector & 0xFF;
2891da177e4SLinus Torvalds 		command[3] = (sector >>  8) & 0xFF;
2901da177e4SLinus Torvalds 		command[4] = (sector >> 16) & 0xFF;
2911da177e4SLinus Torvalds 
2921da177e4SLinus Torvalds 		command[5] = 0xE0 | ((sector >> 24) & 0x0F);
2931da177e4SLinus Torvalds 		command[6] = 0x30;
2941da177e4SLinus Torvalds 
2951da177e4SLinus Torvalds 		// send the setup + command
2961da177e4SLinus Torvalds 		result = usb_stor_ctrl_transfer(us, us->send_ctrl_pipe,
2971da177e4SLinus Torvalds 			0, 0x20, 0, 1, command, 7);
2981da177e4SLinus Torvalds 		if (result != USB_STOR_XFER_GOOD)
2991da177e4SLinus Torvalds 			goto leave;
3001da177e4SLinus Torvalds 
3011da177e4SLinus Torvalds 		// send the data
3021da177e4SLinus Torvalds 		result = jumpshot_bulk_write(us, buffer, len);
3031da177e4SLinus Torvalds 		if (result != USB_STOR_XFER_GOOD)
3041da177e4SLinus Torvalds 			goto leave;
3051da177e4SLinus Torvalds 
3061da177e4SLinus Torvalds 		// read the result.  apparently the bulk write can complete
3071da177e4SLinus Torvalds 		// before the jumpshot drive is finished writing.  so we loop
3081da177e4SLinus Torvalds 		// here until we get a good return code
3091da177e4SLinus Torvalds 		waitcount = 0;
3101da177e4SLinus Torvalds 		do {
3111da177e4SLinus Torvalds 			result = jumpshot_get_status(us);
3121da177e4SLinus Torvalds 			if (result != USB_STOR_TRANSPORT_GOOD) {
3131da177e4SLinus Torvalds 				// I have not experimented to find the smallest value.
3141da177e4SLinus Torvalds 				//
3151da177e4SLinus Torvalds 				msleep(50);
3161da177e4SLinus Torvalds 			}
3171da177e4SLinus Torvalds 		} while ((result != USB_STOR_TRANSPORT_GOOD) && (waitcount < 10));
3181da177e4SLinus Torvalds 
3191da177e4SLinus Torvalds 		if (result != USB_STOR_TRANSPORT_GOOD)
320191648d0SJoe Perches 			usb_stor_dbg(us, "Gah!  Waitcount = 10.  Bad write!?\n");
3211da177e4SLinus Torvalds 
3221da177e4SLinus Torvalds 		sector += thistime;
3231da177e4SLinus Torvalds 		totallen -= len;
3241da177e4SLinus Torvalds 	} while (totallen > 0);
3251da177e4SLinus Torvalds 
3261da177e4SLinus Torvalds 	kfree(buffer);
3271da177e4SLinus Torvalds 	return result;
3281da177e4SLinus Torvalds 
3291da177e4SLinus Torvalds  leave:
3301da177e4SLinus Torvalds 	kfree(buffer);
3311da177e4SLinus Torvalds 	return USB_STOR_TRANSPORT_ERROR;
3321da177e4SLinus Torvalds }
3331da177e4SLinus Torvalds 
3341da177e4SLinus Torvalds static int jumpshot_id_device(struct us_data *us,
3351da177e4SLinus Torvalds 			      struct jumpshot_info *info)
3361da177e4SLinus Torvalds {
3371da177e4SLinus Torvalds 	unsigned char *command = us->iobuf;
3381da177e4SLinus Torvalds 	unsigned char *reply;
3391da177e4SLinus Torvalds 	int 	 rc;
3401da177e4SLinus Torvalds 
34164aebe73SJulia Lawall 	if (!info)
3421da177e4SLinus Torvalds 		return USB_STOR_TRANSPORT_ERROR;
3431da177e4SLinus Torvalds 
3441da177e4SLinus Torvalds 	command[0] = 0xE0;
3451da177e4SLinus Torvalds 	command[1] = 0xEC;
3461da177e4SLinus Torvalds 	reply = kmalloc(512, GFP_NOIO);
3471da177e4SLinus Torvalds 	if (!reply)
3481da177e4SLinus Torvalds 		return USB_STOR_TRANSPORT_ERROR;
3491da177e4SLinus Torvalds 
3501da177e4SLinus Torvalds 	// send the setup
3511da177e4SLinus Torvalds 	rc = usb_stor_ctrl_transfer(us, us->send_ctrl_pipe,
3521da177e4SLinus Torvalds 				   0, 0x20, 0, 6, command, 2);
3531da177e4SLinus Torvalds 
3541da177e4SLinus Torvalds 	if (rc != USB_STOR_XFER_GOOD) {
355191648d0SJoe Perches 		usb_stor_dbg(us, "Gah! send_control for read_capacity failed\n");
3561da177e4SLinus Torvalds 		rc = USB_STOR_TRANSPORT_ERROR;
3571da177e4SLinus Torvalds 		goto leave;
3581da177e4SLinus Torvalds 	}
3591da177e4SLinus Torvalds 
3601da177e4SLinus Torvalds 	// read the reply
3611da177e4SLinus Torvalds 	rc = jumpshot_bulk_read(us, reply, 512);
3621da177e4SLinus Torvalds 	if (rc != USB_STOR_XFER_GOOD) {
3631da177e4SLinus Torvalds 		rc = USB_STOR_TRANSPORT_ERROR;
3641da177e4SLinus Torvalds 		goto leave;
3651da177e4SLinus Torvalds 	}
3661da177e4SLinus Torvalds 
3671da177e4SLinus Torvalds 	info->sectors = ((u32)(reply[117]) << 24) |
3681da177e4SLinus Torvalds 			((u32)(reply[116]) << 16) |
3691da177e4SLinus Torvalds 			((u32)(reply[115]) <<  8) |
3701da177e4SLinus Torvalds 			((u32)(reply[114])      );
3711da177e4SLinus Torvalds 
3721da177e4SLinus Torvalds 	rc = USB_STOR_TRANSPORT_GOOD;
3731da177e4SLinus Torvalds 
3741da177e4SLinus Torvalds  leave:
3751da177e4SLinus Torvalds 	kfree(reply);
3761da177e4SLinus Torvalds 	return rc;
3771da177e4SLinus Torvalds }
3781da177e4SLinus Torvalds 
3791da177e4SLinus Torvalds static int jumpshot_handle_mode_sense(struct us_data *us,
3801da177e4SLinus Torvalds 				      struct scsi_cmnd * srb,
3811da177e4SLinus Torvalds 				      int sense_6)
3821da177e4SLinus Torvalds {
3831da177e4SLinus Torvalds 	static unsigned char rw_err_page[12] = {
3841da177e4SLinus Torvalds 		0x1, 0xA, 0x21, 1, 0, 0, 0, 0, 1, 0, 0, 0
3851da177e4SLinus Torvalds 	};
3861da177e4SLinus Torvalds 	static unsigned char cache_page[12] = {
3871da177e4SLinus Torvalds 		0x8, 0xA, 0x1, 0, 0, 0, 0, 0, 0, 0, 0, 0
3881da177e4SLinus Torvalds 	};
3891da177e4SLinus Torvalds 	static unsigned char rbac_page[12] = {
3901da177e4SLinus Torvalds 		0x1B, 0xA, 0, 0x81, 0, 0, 0, 0, 0, 0, 0, 0
3911da177e4SLinus Torvalds 	};
3921da177e4SLinus Torvalds 	static unsigned char timer_page[8] = {
3931da177e4SLinus Torvalds 		0x1C, 0x6, 0, 0, 0, 0
3941da177e4SLinus Torvalds 	};
3951da177e4SLinus Torvalds 	unsigned char pc, page_code;
3961da177e4SLinus Torvalds 	unsigned int i = 0;
3971da177e4SLinus Torvalds 	struct jumpshot_info *info = (struct jumpshot_info *) (us->extra);
3981da177e4SLinus Torvalds 	unsigned char *ptr = us->iobuf;
3991da177e4SLinus Torvalds 
4001da177e4SLinus Torvalds 	pc = srb->cmnd[2] >> 6;
4011da177e4SLinus Torvalds 	page_code = srb->cmnd[2] & 0x3F;
4021da177e4SLinus Torvalds 
4031da177e4SLinus Torvalds 	switch (pc) {
4041da177e4SLinus Torvalds 	   case 0x0:
405191648d0SJoe Perches 		   usb_stor_dbg(us, "Current values\n");
4061da177e4SLinus Torvalds 		   break;
4071da177e4SLinus Torvalds 	   case 0x1:
408191648d0SJoe Perches 		   usb_stor_dbg(us, "Changeable values\n");
4091da177e4SLinus Torvalds 		   break;
4101da177e4SLinus Torvalds 	   case 0x2:
411191648d0SJoe Perches 		   usb_stor_dbg(us, "Default values\n");
4121da177e4SLinus Torvalds 		   break;
4131da177e4SLinus Torvalds 	   case 0x3:
414191648d0SJoe Perches 		   usb_stor_dbg(us, "Saves values\n");
4151da177e4SLinus Torvalds 		   break;
4161da177e4SLinus Torvalds 	}
4171da177e4SLinus Torvalds 
4181da177e4SLinus Torvalds 	memset(ptr, 0, 8);
4191da177e4SLinus Torvalds 	if (sense_6) {
4201da177e4SLinus Torvalds 		ptr[2] = 0x00;		// WP enable: 0x80
4211da177e4SLinus Torvalds 		i = 4;
4221da177e4SLinus Torvalds 	} else {
4231da177e4SLinus Torvalds 		ptr[3] = 0x00;		// WP enable: 0x80
4241da177e4SLinus Torvalds 		i = 8;
4251da177e4SLinus Torvalds 	}
4261da177e4SLinus Torvalds 
4271da177e4SLinus Torvalds 	switch (page_code) {
4281da177e4SLinus Torvalds 	   case 0x0:
4291da177e4SLinus Torvalds 		// vendor-specific mode
4301da177e4SLinus Torvalds 		info->sense_key = 0x05;
4311da177e4SLinus Torvalds 		info->sense_asc = 0x24;
4321da177e4SLinus Torvalds 		info->sense_ascq = 0x00;
4331da177e4SLinus Torvalds 		return USB_STOR_TRANSPORT_FAILED;
4341da177e4SLinus Torvalds 
4351da177e4SLinus Torvalds 	   case 0x1:
4361da177e4SLinus Torvalds 		memcpy(ptr + i, rw_err_page, sizeof(rw_err_page));
4371da177e4SLinus Torvalds 		i += sizeof(rw_err_page);
4381da177e4SLinus Torvalds 		break;
4391da177e4SLinus Torvalds 
4401da177e4SLinus Torvalds 	   case 0x8:
4411da177e4SLinus Torvalds 		memcpy(ptr + i, cache_page, sizeof(cache_page));
4421da177e4SLinus Torvalds 		i += sizeof(cache_page);
4431da177e4SLinus Torvalds 		break;
4441da177e4SLinus Torvalds 
4451da177e4SLinus Torvalds 	   case 0x1B:
4461da177e4SLinus Torvalds 		memcpy(ptr + i, rbac_page, sizeof(rbac_page));
4471da177e4SLinus Torvalds 		i += sizeof(rbac_page);
4481da177e4SLinus Torvalds 		break;
4491da177e4SLinus Torvalds 
4501da177e4SLinus Torvalds 	   case 0x1C:
4511da177e4SLinus Torvalds 		memcpy(ptr + i, timer_page, sizeof(timer_page));
4521da177e4SLinus Torvalds 		i += sizeof(timer_page);
4531da177e4SLinus Torvalds 		break;
4541da177e4SLinus Torvalds 
4551da177e4SLinus Torvalds 	   case 0x3F:
4561da177e4SLinus Torvalds 		memcpy(ptr + i, timer_page, sizeof(timer_page));
4571da177e4SLinus Torvalds 		i += sizeof(timer_page);
4581da177e4SLinus Torvalds 		memcpy(ptr + i, rbac_page, sizeof(rbac_page));
4591da177e4SLinus Torvalds 		i += sizeof(rbac_page);
4601da177e4SLinus Torvalds 		memcpy(ptr + i, cache_page, sizeof(cache_page));
4611da177e4SLinus Torvalds 		i += sizeof(cache_page);
4621da177e4SLinus Torvalds 		memcpy(ptr + i, rw_err_page, sizeof(rw_err_page));
4631da177e4SLinus Torvalds 		i += sizeof(rw_err_page);
4641da177e4SLinus Torvalds 		break;
4651da177e4SLinus Torvalds 	}
4661da177e4SLinus Torvalds 
4671da177e4SLinus Torvalds 	if (sense_6)
4681da177e4SLinus Torvalds 		ptr[0] = i - 1;
4691da177e4SLinus Torvalds 	else
4701da177e4SLinus Torvalds 		((__be16 *) ptr)[0] = cpu_to_be16(i - 2);
4711da177e4SLinus Torvalds 	usb_stor_set_xfer_buf(ptr, i, srb);
4721da177e4SLinus Torvalds 
4731da177e4SLinus Torvalds 	return USB_STOR_TRANSPORT_GOOD;
4741da177e4SLinus Torvalds }
4751da177e4SLinus Torvalds 
4761da177e4SLinus Torvalds 
4771da177e4SLinus Torvalds static void jumpshot_info_destructor(void *extra)
4781da177e4SLinus Torvalds {
4791da177e4SLinus Torvalds 	// this routine is a placeholder...
4801da177e4SLinus Torvalds 	// currently, we don't allocate any extra blocks so we're okay
4811da177e4SLinus Torvalds }
4821da177e4SLinus Torvalds 
4831da177e4SLinus Torvalds 
4841da177e4SLinus Torvalds 
4851da177e4SLinus Torvalds // Transport for the Lexar 'Jumpshot'
4861da177e4SLinus Torvalds //
487a9fb6d05SAlan Stern static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
4881da177e4SLinus Torvalds {
4891da177e4SLinus Torvalds 	struct jumpshot_info *info;
4901da177e4SLinus Torvalds 	int rc;
4911da177e4SLinus Torvalds 	unsigned long block, blocks;
4921da177e4SLinus Torvalds 	unsigned char *ptr = us->iobuf;
4931da177e4SLinus Torvalds 	static unsigned char inquiry_response[8] = {
4941da177e4SLinus Torvalds 		0x00, 0x80, 0x00, 0x01, 0x1F, 0x00, 0x00, 0x00
4951da177e4SLinus Torvalds 	};
4961da177e4SLinus Torvalds 
4971da177e4SLinus Torvalds 	if (!us->extra) {
498887c2560SOliver Neukum 		us->extra = kzalloc(sizeof(struct jumpshot_info), GFP_NOIO);
499191648d0SJoe Perches 		if (!us->extra)
5001da177e4SLinus Torvalds 			return USB_STOR_TRANSPORT_ERROR;
501191648d0SJoe Perches 
5021da177e4SLinus Torvalds 		us->extra_destructor = jumpshot_info_destructor;
5031da177e4SLinus Torvalds 	}
5041da177e4SLinus Torvalds 
5051da177e4SLinus Torvalds 	info = (struct jumpshot_info *) (us->extra);
5061da177e4SLinus Torvalds 
5071da177e4SLinus Torvalds 	if (srb->cmnd[0] == INQUIRY) {
508191648d0SJoe Perches 		usb_stor_dbg(us, "INQUIRY - Returning bogus response\n");
5091da177e4SLinus Torvalds 		memcpy(ptr, inquiry_response, sizeof(inquiry_response));
5101da177e4SLinus Torvalds 		fill_inquiry_response(us, ptr, 36);
5111da177e4SLinus Torvalds 		return USB_STOR_TRANSPORT_GOOD;
5121da177e4SLinus Torvalds 	}
5131da177e4SLinus Torvalds 
5141da177e4SLinus Torvalds 	if (srb->cmnd[0] == READ_CAPACITY) {
5151da177e4SLinus Torvalds 		info->ssize = 0x200;  // hard coded 512 byte sectors as per ATA spec
5161da177e4SLinus Torvalds 
5171da177e4SLinus Torvalds 		rc = jumpshot_get_status(us);
5181da177e4SLinus Torvalds 		if (rc != USB_STOR_TRANSPORT_GOOD)
5191da177e4SLinus Torvalds 			return rc;
5201da177e4SLinus Torvalds 
5211da177e4SLinus Torvalds 		rc = jumpshot_id_device(us, info);
5221da177e4SLinus Torvalds 		if (rc != USB_STOR_TRANSPORT_GOOD)
5231da177e4SLinus Torvalds 			return rc;
5241da177e4SLinus Torvalds 
525191648d0SJoe Perches 		usb_stor_dbg(us, "READ_CAPACITY:  %ld sectors, %ld bytes per sector\n",
5261da177e4SLinus Torvalds 			     info->sectors, info->ssize);
5271da177e4SLinus Torvalds 
5281da177e4SLinus Torvalds 		// build the reply
5291da177e4SLinus Torvalds 		//
5301da177e4SLinus Torvalds 		((__be32 *) ptr)[0] = cpu_to_be32(info->sectors - 1);
5311da177e4SLinus Torvalds 		((__be32 *) ptr)[1] = cpu_to_be32(info->ssize);
5321da177e4SLinus Torvalds 		usb_stor_set_xfer_buf(ptr, 8, srb);
5331da177e4SLinus Torvalds 
5341da177e4SLinus Torvalds 		return USB_STOR_TRANSPORT_GOOD;
5351da177e4SLinus Torvalds 	}
5361da177e4SLinus Torvalds 
5371da177e4SLinus Torvalds 	if (srb->cmnd[0] == MODE_SELECT_10) {
538191648d0SJoe Perches 		usb_stor_dbg(us, "Gah! MODE_SELECT_10\n");
5391da177e4SLinus Torvalds 		return USB_STOR_TRANSPORT_ERROR;
5401da177e4SLinus Torvalds 	}
5411da177e4SLinus Torvalds 
5421da177e4SLinus Torvalds 	if (srb->cmnd[0] == READ_10) {
5431da177e4SLinus Torvalds 		block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) |
5441da177e4SLinus Torvalds 			((u32)(srb->cmnd[4]) <<  8) | ((u32)(srb->cmnd[5]));
5451da177e4SLinus Torvalds 
5461da177e4SLinus Torvalds 		blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8]));
5471da177e4SLinus Torvalds 
548191648d0SJoe Perches 		usb_stor_dbg(us, "READ_10: read block 0x%04lx  count %ld\n",
549191648d0SJoe Perches 			     block, blocks);
5501da177e4SLinus Torvalds 		return jumpshot_read_data(us, info, block, blocks);
5511da177e4SLinus Torvalds 	}
5521da177e4SLinus Torvalds 
5531da177e4SLinus Torvalds 	if (srb->cmnd[0] == READ_12) {
5541da177e4SLinus Torvalds 		// I don't think we'll ever see a READ_12 but support it anyway...
5551da177e4SLinus Torvalds 		//
5561da177e4SLinus Torvalds 		block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) |
5571da177e4SLinus Torvalds 			((u32)(srb->cmnd[4]) <<  8) | ((u32)(srb->cmnd[5]));
5581da177e4SLinus Torvalds 
5591da177e4SLinus Torvalds 		blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) |
5601da177e4SLinus Torvalds 			 ((u32)(srb->cmnd[8]) <<  8) | ((u32)(srb->cmnd[9]));
5611da177e4SLinus Torvalds 
562191648d0SJoe Perches 		usb_stor_dbg(us, "READ_12: read block 0x%04lx  count %ld\n",
563191648d0SJoe Perches 			     block, blocks);
5641da177e4SLinus Torvalds 		return jumpshot_read_data(us, info, block, blocks);
5651da177e4SLinus Torvalds 	}
5661da177e4SLinus Torvalds 
5671da177e4SLinus Torvalds 	if (srb->cmnd[0] == WRITE_10) {
5681da177e4SLinus Torvalds 		block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) |
5691da177e4SLinus Torvalds 			((u32)(srb->cmnd[4]) <<  8) | ((u32)(srb->cmnd[5]));
5701da177e4SLinus Torvalds 
5711da177e4SLinus Torvalds 		blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8]));
5721da177e4SLinus Torvalds 
573191648d0SJoe Perches 		usb_stor_dbg(us, "WRITE_10: write block 0x%04lx  count %ld\n",
574191648d0SJoe Perches 			     block, blocks);
5751da177e4SLinus Torvalds 		return jumpshot_write_data(us, info, block, blocks);
5761da177e4SLinus Torvalds 	}
5771da177e4SLinus Torvalds 
5781da177e4SLinus Torvalds 	if (srb->cmnd[0] == WRITE_12) {
5791da177e4SLinus Torvalds 		// I don't think we'll ever see a WRITE_12 but support it anyway...
5801da177e4SLinus Torvalds 		//
5811da177e4SLinus Torvalds 		block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) |
5821da177e4SLinus Torvalds 			((u32)(srb->cmnd[4]) <<  8) | ((u32)(srb->cmnd[5]));
5831da177e4SLinus Torvalds 
5841da177e4SLinus Torvalds 		blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) |
5851da177e4SLinus Torvalds 			 ((u32)(srb->cmnd[8]) <<  8) | ((u32)(srb->cmnd[9]));
5861da177e4SLinus Torvalds 
587191648d0SJoe Perches 		usb_stor_dbg(us, "WRITE_12: write block 0x%04lx  count %ld\n",
588191648d0SJoe Perches 			     block, blocks);
5891da177e4SLinus Torvalds 		return jumpshot_write_data(us, info, block, blocks);
5901da177e4SLinus Torvalds 	}
5911da177e4SLinus Torvalds 
5921da177e4SLinus Torvalds 
5931da177e4SLinus Torvalds 	if (srb->cmnd[0] == TEST_UNIT_READY) {
594191648d0SJoe Perches 		usb_stor_dbg(us, "TEST_UNIT_READY\n");
5951da177e4SLinus Torvalds 		return jumpshot_get_status(us);
5961da177e4SLinus Torvalds 	}
5971da177e4SLinus Torvalds 
5981da177e4SLinus Torvalds 	if (srb->cmnd[0] == REQUEST_SENSE) {
599191648d0SJoe Perches 		usb_stor_dbg(us, "REQUEST_SENSE\n");
6001da177e4SLinus Torvalds 
6011da177e4SLinus Torvalds 		memset(ptr, 0, 18);
6021da177e4SLinus Torvalds 		ptr[0] = 0xF0;
6031da177e4SLinus Torvalds 		ptr[2] = info->sense_key;
6041da177e4SLinus Torvalds 		ptr[7] = 11;
6051da177e4SLinus Torvalds 		ptr[12] = info->sense_asc;
6061da177e4SLinus Torvalds 		ptr[13] = info->sense_ascq;
6071da177e4SLinus Torvalds 		usb_stor_set_xfer_buf(ptr, 18, srb);
6081da177e4SLinus Torvalds 
6091da177e4SLinus Torvalds 		return USB_STOR_TRANSPORT_GOOD;
6101da177e4SLinus Torvalds 	}
6111da177e4SLinus Torvalds 
6121da177e4SLinus Torvalds 	if (srb->cmnd[0] == MODE_SENSE) {
613191648d0SJoe Perches 		usb_stor_dbg(us, "MODE_SENSE_6 detected\n");
6141da177e4SLinus Torvalds 		return jumpshot_handle_mode_sense(us, srb, 1);
6151da177e4SLinus Torvalds 	}
6161da177e4SLinus Torvalds 
6171da177e4SLinus Torvalds 	if (srb->cmnd[0] == MODE_SENSE_10) {
618191648d0SJoe Perches 		usb_stor_dbg(us, "MODE_SENSE_10 detected\n");
6191da177e4SLinus Torvalds 		return jumpshot_handle_mode_sense(us, srb, 0);
6201da177e4SLinus Torvalds 	}
6211da177e4SLinus Torvalds 
6221da177e4SLinus Torvalds 	if (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) {
623f0183a33SFelipe Balbi 		/*
624f0183a33SFelipe Balbi 		 * sure.  whatever.  not like we can stop the user from popping
625f0183a33SFelipe Balbi 		 * the media out of the device (no locking doors, etc)
626f0183a33SFelipe Balbi 		 */
6271da177e4SLinus Torvalds 		return USB_STOR_TRANSPORT_GOOD;
6281da177e4SLinus Torvalds 	}
6291da177e4SLinus Torvalds 
6301da177e4SLinus Torvalds 	if (srb->cmnd[0] == START_STOP) {
631f0183a33SFelipe Balbi 		/*
632f0183a33SFelipe Balbi 		 * this is used by sd.c'check_scsidisk_media_change to detect
633f0183a33SFelipe Balbi 		 * media change
634f0183a33SFelipe Balbi 		 */
635191648d0SJoe Perches 		usb_stor_dbg(us, "START_STOP\n");
636f0183a33SFelipe Balbi 		/*
637f0183a33SFelipe Balbi 		 * the first jumpshot_id_device after a media change returns
638f0183a33SFelipe Balbi 		 * an error (determined experimentally)
639f0183a33SFelipe Balbi 		 */
6401da177e4SLinus Torvalds 		rc = jumpshot_id_device(us, info);
6411da177e4SLinus Torvalds 		if (rc == USB_STOR_TRANSPORT_GOOD) {
6421da177e4SLinus Torvalds 			info->sense_key = NO_SENSE;
6431da177e4SLinus Torvalds 			srb->result = SUCCESS;
6441da177e4SLinus Torvalds 		} else {
6451da177e4SLinus Torvalds 			info->sense_key = UNIT_ATTENTION;
6461da177e4SLinus Torvalds 			srb->result = SAM_STAT_CHECK_CONDITION;
6471da177e4SLinus Torvalds 		}
6481da177e4SLinus Torvalds 		return rc;
6491da177e4SLinus Torvalds 	}
6501da177e4SLinus Torvalds 
651191648d0SJoe Perches 	usb_stor_dbg(us, "Gah! Unknown command: %d (0x%x)\n",
6521da177e4SLinus Torvalds 		     srb->cmnd[0], srb->cmnd[0]);
6531da177e4SLinus Torvalds 	info->sense_key = 0x05;
6541da177e4SLinus Torvalds 	info->sense_asc = 0x20;
6551da177e4SLinus Torvalds 	info->sense_ascq = 0x00;
6561da177e4SLinus Torvalds 	return USB_STOR_TRANSPORT_FAILED;
6571da177e4SLinus Torvalds }
658a9fb6d05SAlan Stern 
659aa519be3SAkinobu Mita static struct scsi_host_template jumpshot_host_template;
660aa519be3SAkinobu Mita 
661a9fb6d05SAlan Stern static int jumpshot_probe(struct usb_interface *intf,
662a9fb6d05SAlan Stern 			 const struct usb_device_id *id)
663a9fb6d05SAlan Stern {
664a9fb6d05SAlan Stern 	struct us_data *us;
665a9fb6d05SAlan Stern 	int result;
666a9fb6d05SAlan Stern 
667a9fb6d05SAlan Stern 	result = usb_stor_probe1(&us, intf, id,
668aa519be3SAkinobu Mita 			(id - jumpshot_usb_ids) + jumpshot_unusual_dev_list,
669aa519be3SAkinobu Mita 			&jumpshot_host_template);
670a9fb6d05SAlan Stern 	if (result)
671a9fb6d05SAlan Stern 		return result;
672a9fb6d05SAlan Stern 
673a9fb6d05SAlan Stern 	us->transport_name  = "Lexar Jumpshot Control/Bulk";
674a9fb6d05SAlan Stern 	us->transport = jumpshot_transport;
675a9fb6d05SAlan Stern 	us->transport_reset = usb_stor_Bulk_reset;
676a9fb6d05SAlan Stern 	us->max_lun = 1;
677a9fb6d05SAlan Stern 
678a9fb6d05SAlan Stern 	result = usb_stor_probe2(us);
679a9fb6d05SAlan Stern 	return result;
680a9fb6d05SAlan Stern }
681a9fb6d05SAlan Stern 
682a9fb6d05SAlan Stern static struct usb_driver jumpshot_driver = {
683aa519be3SAkinobu Mita 	.name =		DRV_NAME,
684a9fb6d05SAlan Stern 	.probe =	jumpshot_probe,
685a9fb6d05SAlan Stern 	.disconnect =	usb_stor_disconnect,
686a9fb6d05SAlan Stern 	.suspend =	usb_stor_suspend,
687a9fb6d05SAlan Stern 	.resume =	usb_stor_resume,
688a9fb6d05SAlan Stern 	.reset_resume =	usb_stor_reset_resume,
689a9fb6d05SAlan Stern 	.pre_reset =	usb_stor_pre_reset,
690a9fb6d05SAlan Stern 	.post_reset =	usb_stor_post_reset,
691a9fb6d05SAlan Stern 	.id_table =	jumpshot_usb_ids,
692a9fb6d05SAlan Stern 	.soft_unbind =	1,
693e73b2db6SHuajun Li 	.no_dynamic_id = 1,
694a9fb6d05SAlan Stern };
695a9fb6d05SAlan Stern 
696aa519be3SAkinobu Mita module_usb_stor_driver(jumpshot_driver, jumpshot_host_template, DRV_NAME);
697