aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r--drivers/usb/storage/Kconfig48
-rw-r--r--drivers/usb/storage/Makefile41
-rw-r--r--drivers/usb/storage/alauda.c192
-rw-r--r--drivers/usb/storage/alauda.h100
-rw-r--r--drivers/usb/storage/cypress_atacb.c106
-rw-r--r--drivers/usb/storage/datafab.c104
-rw-r--r--drivers/usb/storage/datafab.h40
-rw-r--r--drivers/usb/storage/freecom.c99
-rw-r--r--drivers/usb/storage/isd200.c97
-rw-r--r--drivers/usb/storage/jumpshot.c103
-rw-r--r--drivers/usb/storage/jumpshot.h39
-rw-r--r--drivers/usb/storage/karma.c100
-rw-r--r--drivers/usb/storage/karma.h7
-rw-r--r--drivers/usb/storage/libusual.c33
-rw-r--r--drivers/usb/storage/onetouch.c94
-rw-r--r--drivers/usb/storage/onetouch.h9
-rw-r--r--drivers/usb/storage/protocol.c3
-rw-r--r--drivers/usb/storage/scsiglue.c8
-rw-r--r--drivers/usb/storage/sddr09.c147
-rw-r--r--drivers/usb/storage/sddr09.h38
-rw-r--r--drivers/usb/storage/sddr55.c99
-rw-r--r--drivers/usb/storage/shuttle_usbat.c202
-rw-r--r--drivers/usb/storage/shuttle_usbat.h123
-rw-r--r--drivers/usb/storage/transport.c10
-rw-r--r--drivers/usb/storage/unusual_alauda.h (renamed from drivers/usb/storage/freecom.h)29
-rw-r--r--drivers/usb/storage/unusual_cypress.h34
-rw-r--r--drivers/usb/storage/unusual_datafab.h98
-rw-r--r--drivers/usb/storage/unusual_devs.h323
-rw-r--r--drivers/usb/storage/unusual_freecom.h (renamed from drivers/usb/storage/cypress_atacb.h)19
-rw-r--r--drivers/usb/storage/unusual_isd200.h57
-rw-r--r--drivers/usb/storage/unusual_jumpshot.h (renamed from drivers/usb/storage/sddr55.h)23
-rw-r--r--drivers/usb/storage/unusual_karma.h (renamed from drivers/usb/storage/isd200.h)21
-rw-r--r--drivers/usb/storage/unusual_onetouch.h36
-rw-r--r--drivers/usb/storage/unusual_sddr09.h56
-rw-r--r--drivers/usb/storage/unusual_sddr55.h44
-rw-r--r--drivers/usb/storage/unusual_usbat.h43
-rw-r--r--drivers/usb/storage/usb.c344
-rw-r--r--drivers/usb/storage/usb.h21
-rw-r--r--drivers/usb/storage/usual-tables.c116
39 files changed, 2023 insertions, 1083 deletions
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
index 9df6887b91f6..8a372bac0e43 100644
--- a/drivers/usb/storage/Kconfig
+++ b/drivers/usb/storage/Kconfig
@@ -2,8 +2,8 @@
2# USB Storage driver configuration 2# USB Storage driver configuration
3# 3#
4 4
5comment "NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;" 5comment "NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may"
6comment "see USB_STORAGE Help for more information" 6comment "also be needed; see USB_STORAGE Help for more info"
7 depends on USB 7 depends on USB
8 8
9config USB_STORAGE 9config USB_STORAGE
@@ -32,21 +32,25 @@ config USB_STORAGE_DEBUG
32 verbose debugging messages. 32 verbose debugging messages.
33 33
34config USB_STORAGE_DATAFAB 34config USB_STORAGE_DATAFAB
35 bool "Datafab Compact Flash Reader support" 35 tristate "Datafab Compact Flash Reader support"
36 depends on USB_STORAGE 36 depends on USB_STORAGE
37 help 37 help
38 Support for certain Datafab CompactFlash readers. 38 Support for certain Datafab CompactFlash readers.
39 Datafab has a web page at <http://www.datafabusa.com/>. 39 Datafab has a web page at <http://www.datafabusa.com/>.
40 40
41 If this driver is compiled as a module, it will be named ums-datafab.
42
41config USB_STORAGE_FREECOM 43config USB_STORAGE_FREECOM
42 bool "Freecom USB/ATAPI Bridge support" 44 tristate "Freecom USB/ATAPI Bridge support"
43 depends on USB_STORAGE 45 depends on USB_STORAGE
44 help 46 help
45 Support for the Freecom USB to IDE/ATAPI adaptor. 47 Support for the Freecom USB to IDE/ATAPI adaptor.
46 Freecom has a web page at <http://www.freecom.de/>. 48 Freecom has a web page at <http://www.freecom.de/>.
47 49
50 If this driver is compiled as a module, it will be named ums-freecom.
51
48config USB_STORAGE_ISD200 52config USB_STORAGE_ISD200
49 bool "ISD-200 USB/ATA Bridge support" 53 tristate "ISD-200 USB/ATA Bridge support"
50 depends on USB_STORAGE 54 depends on USB_STORAGE
51 ---help--- 55 ---help---
52 Say Y here if you want to use USB Mass Store devices based 56 Say Y here if you want to use USB Mass Store devices based
@@ -61,8 +65,10 @@ config USB_STORAGE_ISD200
61 - CyQ've CQ8060A CDRW drive 65 - CyQ've CQ8060A CDRW drive
62 - Planex eXtreme Drive RX-25HU USB-IDE cable (not model RX-25U) 66 - Planex eXtreme Drive RX-25HU USB-IDE cable (not model RX-25U)
63 67
68 If this driver is compiled as a module, it will be named ums-isd200.
69
64config USB_STORAGE_USBAT 70config USB_STORAGE_USBAT
65 bool "USBAT/USBAT02-based storage support" 71 tristate "USBAT/USBAT02-based storage support"
66 depends on USB_STORAGE 72 depends on USB_STORAGE
67 help 73 help
68 Say Y here to include additional code to support storage devices 74 Say Y here to include additional code to support storage devices
@@ -82,30 +88,38 @@ config USB_STORAGE_USBAT
82 - RCA LYRA MP3 portable 88 - RCA LYRA MP3 portable
83 - Sandisk ImageMate SDDR-05b 89 - Sandisk ImageMate SDDR-05b
84 90
91 If this driver is compiled as a module, it will be named ums-usbat.
92
85config USB_STORAGE_SDDR09 93config USB_STORAGE_SDDR09
86 bool "SanDisk SDDR-09 (and other SmartMedia, including DPCM) support" 94 tristate "SanDisk SDDR-09 (and other SmartMedia, including DPCM) support"
87 depends on USB_STORAGE 95 depends on USB_STORAGE
88 help 96 help
89 Say Y here to include additional code to support the Sandisk SDDR-09 97 Say Y here to include additional code to support the Sandisk SDDR-09
90 SmartMedia reader in the USB Mass Storage driver. 98 SmartMedia reader in the USB Mass Storage driver.
91 Also works for the Microtech Zio! CompactFlash/SmartMedia reader. 99 Also works for the Microtech Zio! CompactFlash/SmartMedia reader.
92 100
101 If this driver is compiled as a module, it will be named ums-sddr09.
102
93config USB_STORAGE_SDDR55 103config USB_STORAGE_SDDR55
94 bool "SanDisk SDDR-55 SmartMedia support" 104 tristate "SanDisk SDDR-55 SmartMedia support"
95 depends on USB_STORAGE 105 depends on USB_STORAGE
96 help 106 help
97 Say Y here to include additional code to support the Sandisk SDDR-55 107 Say Y here to include additional code to support the Sandisk SDDR-55
98 SmartMedia reader in the USB Mass Storage driver. 108 SmartMedia reader in the USB Mass Storage driver.
99 109
110 If this driver is compiled as a module, it will be named ums-sddr55.
111
100config USB_STORAGE_JUMPSHOT 112config USB_STORAGE_JUMPSHOT
101 bool "Lexar Jumpshot Compact Flash Reader" 113 tristate "Lexar Jumpshot Compact Flash Reader"
102 depends on USB_STORAGE 114 depends on USB_STORAGE
103 help 115 help
104 Say Y here to include additional code to support the Lexar Jumpshot 116 Say Y here to include additional code to support the Lexar Jumpshot
105 USB CompactFlash reader. 117 USB CompactFlash reader.
106 118
119 If this driver is compiled as a module, it will be named ums-jumpshot.
120
107config USB_STORAGE_ALAUDA 121config USB_STORAGE_ALAUDA
108 bool "Olympus MAUSB-10/Fuji DPC-R1 support" 122 tristate "Olympus MAUSB-10/Fuji DPC-R1 support"
109 depends on USB_STORAGE 123 depends on USB_STORAGE
110 help 124 help
111 Say Y here to include additional code to support the Olympus MAUSB-10 125 Say Y here to include additional code to support the Olympus MAUSB-10
@@ -114,8 +128,10 @@ config USB_STORAGE_ALAUDA
114 These devices are based on the Alauda chip and support both 128 These devices are based on the Alauda chip and support both
115 XD and SmartMedia cards. 129 XD and SmartMedia cards.
116 130
131 If this driver is compiled as a module, it will be named ums-alauda.
132
117config USB_STORAGE_ONETOUCH 133config USB_STORAGE_ONETOUCH
118 bool "Support OneTouch Button on Maxtor Hard Drives" 134 tristate "Support OneTouch Button on Maxtor Hard Drives"
119 depends on USB_STORAGE 135 depends on USB_STORAGE
120 depends on INPUT=y || INPUT=USB_STORAGE 136 depends on INPUT=y || INPUT=USB_STORAGE
121 help 137 help
@@ -127,8 +143,10 @@ config USB_STORAGE_ONETOUCH
127 this input in any keybinding software. (e.g. gnome's keyboard short- 143 this input in any keybinding software. (e.g. gnome's keyboard short-
128 cuts) 144 cuts)
129 145
146 If this driver is compiled as a module, it will be named ums-onetouch.
147
130config USB_STORAGE_KARMA 148config USB_STORAGE_KARMA
131 bool "Support for Rio Karma music player" 149 tristate "Support for Rio Karma music player"
132 depends on USB_STORAGE 150 depends on USB_STORAGE
133 help 151 help
134 Say Y here to include additional code to support the Rio Karma 152 Say Y here to include additional code to support the Rio Karma
@@ -139,8 +157,10 @@ config USB_STORAGE_KARMA
139 on the resulting scsi device node returns the Karma to normal 157 on the resulting scsi device node returns the Karma to normal
140 operation. 158 operation.
141 159
160 If this driver is compiled as a module, it will be named ums-karma.
161
142config USB_STORAGE_CYPRESS_ATACB 162config USB_STORAGE_CYPRESS_ATACB
143 bool "SAT emulation on Cypress USB/ATA Bridge with ATACB" 163 tristate "SAT emulation on Cypress USB/ATA Bridge with ATACB"
144 depends on USB_STORAGE 164 depends on USB_STORAGE
145 ---help--- 165 ---help---
146 Say Y here if you want to use SAT (ata pass through) on devices based 166 Say Y here if you want to use SAT (ata pass through) on devices based
@@ -150,6 +170,8 @@ config USB_STORAGE_CYPRESS_ATACB
150 If you say no here your device will still work with the standard usb 170 If you say no here your device will still work with the standard usb
151 mass storage class. 171 mass storage class.
152 172
173 If this driver is compiled as a module, it will be named ums-cypress.
174
153config USB_LIBUSUAL 175config USB_LIBUSUAL
154 bool "The shared table of common (or usual) storage devices" 176 bool "The shared table of common (or usual) storage devices"
155 depends on USB 177 depends on USB
diff --git a/drivers/usb/storage/Makefile b/drivers/usb/storage/Makefile
index b32069313390..5be54c019662 100644
--- a/drivers/usb/storage/Makefile
+++ b/drivers/usb/storage/Makefile
@@ -10,21 +10,36 @@ EXTRA_CFLAGS := -Idrivers/scsi
10obj-$(CONFIG_USB_STORAGE) += usb-storage.o 10obj-$(CONFIG_USB_STORAGE) += usb-storage.o
11 11
12usb-storage-obj-$(CONFIG_USB_STORAGE_DEBUG) += debug.o 12usb-storage-obj-$(CONFIG_USB_STORAGE_DEBUG) += debug.o
13usb-storage-obj-$(CONFIG_USB_STORAGE_USBAT) += shuttle_usbat.o
14usb-storage-obj-$(CONFIG_USB_STORAGE_SDDR09) += sddr09.o
15usb-storage-obj-$(CONFIG_USB_STORAGE_SDDR55) += sddr55.o
16usb-storage-obj-$(CONFIG_USB_STORAGE_FREECOM) += freecom.o
17usb-storage-obj-$(CONFIG_USB_STORAGE_ISD200) += isd200.o
18usb-storage-obj-$(CONFIG_USB_STORAGE_DATAFAB) += datafab.o
19usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += jumpshot.o
20usb-storage-obj-$(CONFIG_USB_STORAGE_ALAUDA) += alauda.o
21usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o
22usb-storage-obj-$(CONFIG_USB_STORAGE_KARMA) += karma.o
23usb-storage-obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += cypress_atacb.o
24 13
25usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \ 14usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \
26 initializers.o sierra_ms.o option_ms.o $(usb-storage-obj-y) 15 initializers.o sierra_ms.o option_ms.o $(usb-storage-obj-y)
27 16
28ifneq ($(CONFIG_USB_LIBUSUAL),) 17ifeq ($(CONFIG_USB_LIBUSUAL),)
29 obj-$(CONFIG_USB) += libusual.o 18 usb-storage-objs += usual-tables.o
19else
20 obj-$(CONFIG_USB) += libusual.o usual-tables.o
30endif 21endif
22
23obj-$(CONFIG_USB_STORAGE_ALAUDA) += ums-alauda.o
24obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += ums-cypress.o
25obj-$(CONFIG_USB_STORAGE_DATAFAB) += ums-datafab.o
26obj-$(CONFIG_USB_STORAGE_FREECOM) += ums-freecom.o
27obj-$(CONFIG_USB_STORAGE_ISD200) += ums-isd200.o
28obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += ums-jumpshot.o
29obj-$(CONFIG_USB_STORAGE_KARMA) += ums-karma.o
30obj-$(CONFIG_USB_STORAGE_ONETOUCH) += ums-onetouch.o
31obj-$(CONFIG_USB_STORAGE_SDDR09) += ums-sddr09.o
32obj-$(CONFIG_USB_STORAGE_SDDR55) += ums-sddr55.o
33obj-$(CONFIG_USB_STORAGE_USBAT) += ums-usbat.o
34
35ums-alauda-objs := alauda.o
36ums-cypress-objs := cypress_atacb.o
37ums-datafab-objs := datafab.o
38ums-freecom-objs := freecom.o
39ums-isd200-objs := isd200.o
40ums-jumpshot-objs := jumpshot.o
41ums-karma-objs := karma.o
42ums-onetouch-objs := onetouch.o
43ums-sddr09-objs := sddr09.o
44ums-sddr55-objs := sddr55.o
45ums-usbat-objs := shuttle_usbat.o
diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c
index 8d3711a7ff06..67edc65acb8e 100644
--- a/drivers/usb/storage/alauda.c
+++ b/drivers/usb/storage/alauda.c
@@ -31,6 +31,8 @@
31 * 675 Mass Ave, Cambridge, MA 02139, USA. 31 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 */ 32 */
33 33
34#include <linux/module.h>
35
34#include <scsi/scsi.h> 36#include <scsi/scsi.h>
35#include <scsi/scsi_cmnd.h> 37#include <scsi/scsi_cmnd.h>
36#include <scsi/scsi_device.h> 38#include <scsi/scsi_device.h>
@@ -39,7 +41,79 @@
39#include "transport.h" 41#include "transport.h"
40#include "protocol.h" 42#include "protocol.h"
41#include "debug.h" 43#include "debug.h"
42#include "alauda.h" 44
45MODULE_DESCRIPTION("Driver for Alauda-based card readers");
46MODULE_AUTHOR("Daniel Drake <dsd@gentoo.org>");
47MODULE_LICENSE("GPL");
48
49/*
50 * Status bytes
51 */
52#define ALAUDA_STATUS_ERROR 0x01
53#define ALAUDA_STATUS_READY 0x40
54
55/*
56 * Control opcodes (for request field)
57 */
58#define ALAUDA_GET_XD_MEDIA_STATUS 0x08
59#define ALAUDA_GET_SM_MEDIA_STATUS 0x98
60#define ALAUDA_ACK_XD_MEDIA_CHANGE 0x0a
61#define ALAUDA_ACK_SM_MEDIA_CHANGE 0x9a
62#define ALAUDA_GET_XD_MEDIA_SIG 0x86
63#define ALAUDA_GET_SM_MEDIA_SIG 0x96
64
65/*
66 * Bulk command identity (byte 0)
67 */
68#define ALAUDA_BULK_CMD 0x40
69
70/*
71 * Bulk opcodes (byte 1)
72 */
73#define ALAUDA_BULK_GET_REDU_DATA 0x85
74#define ALAUDA_BULK_READ_BLOCK 0x94
75#define ALAUDA_BULK_ERASE_BLOCK 0xa3
76#define ALAUDA_BULK_WRITE_BLOCK 0xb4
77#define ALAUDA_BULK_GET_STATUS2 0xb7
78#define ALAUDA_BULK_RESET_MEDIA 0xe0
79
80/*
81 * Port to operate on (byte 8)
82 */
83#define ALAUDA_PORT_XD 0x00
84#define ALAUDA_PORT_SM 0x01
85
86/*
87 * LBA and PBA are unsigned ints. Special values.
88 */
89#define UNDEF 0xffff
90#define SPARE 0xfffe
91#define UNUSABLE 0xfffd
92
93struct alauda_media_info {
94 unsigned long capacity; /* total media size in bytes */
95 unsigned int pagesize; /* page size in bytes */
96 unsigned int blocksize; /* number of pages per block */
97 unsigned int uzonesize; /* number of usable blocks per zone */
98 unsigned int zonesize; /* number of blocks per zone */
99 unsigned int blockmask; /* mask to get page from address */
100
101 unsigned char pageshift;
102 unsigned char blockshift;
103 unsigned char zoneshift;
104
105 u16 **lba_to_pba; /* logical to physical block map */
106 u16 **pba_to_lba; /* physical to logical block map */
107};
108
109struct alauda_info {
110 struct alauda_media_info port[2];
111 int wr_ep; /* endpoint to write data out of */
112
113 unsigned char sense_key;
114 unsigned long sense_asc; /* additional sense code */
115 unsigned long sense_ascq; /* additional sense code qualifier */
116};
43 117
44#define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) ) 118#define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) )
45#define LSB_of(s) ((s)&0xFF) 119#define LSB_of(s) ((s)&0xFF)
@@ -52,6 +126,48 @@
52#define PBA_HI(pba) (pba >> 3) 126#define PBA_HI(pba) (pba >> 3)
53#define PBA_ZONE(pba) (pba >> 11) 127#define PBA_ZONE(pba) (pba >> 11)
54 128
129static int init_alauda(struct us_data *us);
130
131
132/*
133 * The table of devices
134 */
135#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
136 vendorName, productName, useProtocol, useTransport, \
137 initFunction, flags) \
138{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
139 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
140
141struct usb_device_id alauda_usb_ids[] = {
142# include "unusual_alauda.h"
143 { } /* Terminating entry */
144};
145MODULE_DEVICE_TABLE(usb, alauda_usb_ids);
146
147#undef UNUSUAL_DEV
148
149/*
150 * The flags table
151 */
152#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
153 vendor_name, product_name, use_protocol, use_transport, \
154 init_function, Flags) \
155{ \
156 .vendorName = vendor_name, \
157 .productName = product_name, \
158 .useProtocol = use_protocol, \
159 .useTransport = use_transport, \
160 .initFunction = init_function, \
161}
162
163static struct us_unusual_dev alauda_unusual_dev_list[] = {
164# include "unusual_alauda.h"
165 { } /* Terminating entry */
166};
167
168#undef UNUSUAL_DEV
169
170
55/* 171/*
56 * Media handling 172 * Media handling
57 */ 173 */
@@ -307,7 +423,8 @@ static int alauda_init_media(struct us_data *us)
307 data[0], data[1], data[2], data[3]); 423 data[0], data[1], data[2], data[3]);
308 media_info = alauda_card_find_id(data[1]); 424 media_info = alauda_card_find_id(data[1]);
309 if (media_info == NULL) { 425 if (media_info == NULL) {
310 printk("alauda_init_media: Unrecognised media signature: " 426 printk(KERN_WARNING
427 "alauda_init_media: Unrecognised media signature: "
311 "%02X %02X %02X %02X\n", 428 "%02X %02X %02X %02X\n",
312 data[0], data[1], data[2], data[3]); 429 data[0], data[1], data[2], data[3]);
313 return USB_STOR_TRANSPORT_ERROR; 430 return USB_STOR_TRANSPORT_ERROR;
@@ -518,7 +635,8 @@ static int alauda_read_map(struct us_data *us, unsigned int zone)
518 635
519 /* check even parity */ 636 /* check even parity */
520 if (parity[data[6] ^ data[7]]) { 637 if (parity[data[6] ^ data[7]]) {
521 printk("alauda_read_map: Bad parity in LBA for block %d" 638 printk(KERN_WARNING
639 "alauda_read_map: Bad parity in LBA for block %d"
522 " (%02X %02X)\n", i, data[6], data[7]); 640 " (%02X %02X)\n", i, data[6], data[7]);
523 pba_to_lba[i] = UNUSABLE; 641 pba_to_lba[i] = UNUSABLE;
524 continue; 642 continue;
@@ -538,13 +656,16 @@ static int alauda_read_map(struct us_data *us, unsigned int zone)
538 */ 656 */
539 657
540 if (lba_offset >= uzonesize) { 658 if (lba_offset >= uzonesize) {
541 printk("alauda_read_map: Bad low LBA %d for block %d\n", 659 printk(KERN_WARNING
660 "alauda_read_map: Bad low LBA %d for block %d\n",
542 lba_real, blocknum); 661 lba_real, blocknum);
543 continue; 662 continue;
544 } 663 }
545 664
546 if (lba_to_pba[lba_offset] != UNDEF) { 665 if (lba_to_pba[lba_offset] != UNDEF) {
547 printk("alauda_read_map: LBA %d seen for PBA %d and %d\n", 666 printk(KERN_WARNING
667 "alauda_read_map: "
668 "LBA %d seen for PBA %d and %d\n",
548 lba_real, lba_to_pba[lba_offset], blocknum); 669 lba_real, lba_to_pba[lba_offset], blocknum);
549 continue; 670 continue;
550 } 671 }
@@ -712,13 +833,15 @@ static int alauda_write_lba(struct us_data *us, u16 lba,
712 if (pba == 1) { 833 if (pba == 1) {
713 /* Maybe it is impossible to write to PBA 1. 834 /* Maybe it is impossible to write to PBA 1.
714 Fake success, but don't do anything. */ 835 Fake success, but don't do anything. */
715 printk("alauda_write_lba: avoid writing to pba 1\n"); 836 printk(KERN_WARNING
837 "alauda_write_lba: avoid writing to pba 1\n");
716 return USB_STOR_TRANSPORT_GOOD; 838 return USB_STOR_TRANSPORT_GOOD;
717 } 839 }
718 840
719 new_pba = alauda_find_unused_pba(&MEDIA_INFO(us), zone); 841 new_pba = alauda_find_unused_pba(&MEDIA_INFO(us), zone);
720 if (!new_pba) { 842 if (!new_pba) {
721 printk("alauda_write_lba: Out of unused blocks\n"); 843 printk(KERN_WARNING
844 "alauda_write_lba: Out of unused blocks\n");
722 return USB_STOR_TRANSPORT_ERROR; 845 return USB_STOR_TRANSPORT_ERROR;
723 } 846 }
724 847
@@ -818,7 +941,7 @@ static int alauda_read_data(struct us_data *us, unsigned long address,
818 len = min(sectors, blocksize) * (pagesize + 64); 941 len = min(sectors, blocksize) * (pagesize + 64);
819 buffer = kmalloc(len, GFP_NOIO); 942 buffer = kmalloc(len, GFP_NOIO);
820 if (buffer == NULL) { 943 if (buffer == NULL) {
821 printk("alauda_read_data: Out of memory\n"); 944 printk(KERN_WARNING "alauda_read_data: Out of memory\n");
822 return USB_STOR_TRANSPORT_ERROR; 945 return USB_STOR_TRANSPORT_ERROR;
823 } 946 }
824 947
@@ -911,7 +1034,7 @@ static int alauda_write_data(struct us_data *us, unsigned long address,
911 len = min(sectors, blocksize) * pagesize; 1034 len = min(sectors, blocksize) * pagesize;
912 buffer = kmalloc(len, GFP_NOIO); 1035 buffer = kmalloc(len, GFP_NOIO);
913 if (buffer == NULL) { 1036 if (buffer == NULL) {
914 printk("alauda_write_data: Out of memory\n"); 1037 printk(KERN_WARNING "alauda_write_data: Out of memory\n");
915 return USB_STOR_TRANSPORT_ERROR; 1038 return USB_STOR_TRANSPORT_ERROR;
916 } 1039 }
917 1040
@@ -921,7 +1044,7 @@ static int alauda_write_data(struct us_data *us, unsigned long address,
921 */ 1044 */
922 blockbuffer = kmalloc((pagesize + 64) * blocksize, GFP_NOIO); 1045 blockbuffer = kmalloc((pagesize + 64) * blocksize, GFP_NOIO);
923 if (blockbuffer == NULL) { 1046 if (blockbuffer == NULL) {
924 printk("alauda_write_data: Out of memory\n"); 1047 printk(KERN_WARNING "alauda_write_data: Out of memory\n");
925 kfree(buffer); 1048 kfree(buffer);
926 return USB_STOR_TRANSPORT_ERROR; 1049 return USB_STOR_TRANSPORT_ERROR;
927 } 1050 }
@@ -991,7 +1114,7 @@ static void alauda_info_destructor(void *extra)
991/* 1114/*
992 * Initialize alauda_info struct and find the data-write endpoint 1115 * Initialize alauda_info struct and find the data-write endpoint
993 */ 1116 */
994int init_alauda(struct us_data *us) 1117static int init_alauda(struct us_data *us)
995{ 1118{
996 struct alauda_info *info; 1119 struct alauda_info *info;
997 struct usb_host_interface *altsetting = us->pusb_intf->cur_altsetting; 1120 struct usb_host_interface *altsetting = us->pusb_intf->cur_altsetting;
@@ -1013,7 +1136,7 @@ int init_alauda(struct us_data *us)
1013 return USB_STOR_TRANSPORT_GOOD; 1136 return USB_STOR_TRANSPORT_GOOD;
1014} 1137}
1015 1138
1016int alauda_transport(struct scsi_cmnd *srb, struct us_data *us) 1139static int alauda_transport(struct scsi_cmnd *srb, struct us_data *us)
1017{ 1140{
1018 int rc; 1141 int rc;
1019 struct alauda_info *info = (struct alauda_info *) us->extra; 1142 struct alauda_info *info = (struct alauda_info *) us->extra;
@@ -1121,3 +1244,48 @@ int alauda_transport(struct scsi_cmnd *srb, struct us_data *us)
1121 return USB_STOR_TRANSPORT_FAILED; 1244 return USB_STOR_TRANSPORT_FAILED;
1122} 1245}
1123 1246
1247static int alauda_probe(struct usb_interface *intf,
1248 const struct usb_device_id *id)
1249{
1250 struct us_data *us;
1251 int result;
1252
1253 result = usb_stor_probe1(&us, intf, id,
1254 (id - alauda_usb_ids) + alauda_unusual_dev_list);
1255 if (result)
1256 return result;
1257
1258 us->transport_name = "Alauda Control/Bulk";
1259 us->transport = alauda_transport;
1260 us->transport_reset = usb_stor_Bulk_reset;
1261 us->max_lun = 1;
1262
1263 result = usb_stor_probe2(us);
1264 return result;
1265}
1266
1267static struct usb_driver alauda_driver = {
1268 .name = "ums-alauda",
1269 .probe = alauda_probe,
1270 .disconnect = usb_stor_disconnect,
1271 .suspend = usb_stor_suspend,
1272 .resume = usb_stor_resume,
1273 .reset_resume = usb_stor_reset_resume,
1274 .pre_reset = usb_stor_pre_reset,
1275 .post_reset = usb_stor_post_reset,
1276 .id_table = alauda_usb_ids,
1277 .soft_unbind = 1,
1278};
1279
1280static int __init alauda_init(void)
1281{
1282 return usb_register(&alauda_driver);
1283}
1284
1285static void __exit alauda_exit(void)
1286{
1287 usb_deregister(&alauda_driver);
1288}
1289
1290module_init(alauda_init);
1291module_exit(alauda_exit);
diff --git a/drivers/usb/storage/alauda.h b/drivers/usb/storage/alauda.h
deleted file mode 100644
index a700f87d0803..000000000000
--- a/drivers/usb/storage/alauda.h
+++ /dev/null
@@ -1,100 +0,0 @@
1/*
2 * Driver for Alauda-based card readers
3 *
4 * Current development and maintenance by:
5 * (c) 2005 Daniel Drake <dsd@gentoo.org>
6 *
7 * See alauda.c for more explanation.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2, or (at your option) any
12 * later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#ifndef _USB_ALAUDA_H
25#define _USB_ALAUDA_H
26
27/*
28 * Status bytes
29 */
30#define ALAUDA_STATUS_ERROR 0x01
31#define ALAUDA_STATUS_READY 0x40
32
33/*
34 * Control opcodes (for request field)
35 */
36#define ALAUDA_GET_XD_MEDIA_STATUS 0x08
37#define ALAUDA_GET_SM_MEDIA_STATUS 0x98
38#define ALAUDA_ACK_XD_MEDIA_CHANGE 0x0a
39#define ALAUDA_ACK_SM_MEDIA_CHANGE 0x9a
40#define ALAUDA_GET_XD_MEDIA_SIG 0x86
41#define ALAUDA_GET_SM_MEDIA_SIG 0x96
42
43/*
44 * Bulk command identity (byte 0)
45 */
46#define ALAUDA_BULK_CMD 0x40
47
48/*
49 * Bulk opcodes (byte 1)
50 */
51#define ALAUDA_BULK_GET_REDU_DATA 0x85
52#define ALAUDA_BULK_READ_BLOCK 0x94
53#define ALAUDA_BULK_ERASE_BLOCK 0xa3
54#define ALAUDA_BULK_WRITE_BLOCK 0xb4
55#define ALAUDA_BULK_GET_STATUS2 0xb7
56#define ALAUDA_BULK_RESET_MEDIA 0xe0
57
58/*
59 * Port to operate on (byte 8)
60 */
61#define ALAUDA_PORT_XD 0x00
62#define ALAUDA_PORT_SM 0x01
63
64/*
65 * LBA and PBA are unsigned ints. Special values.
66 */
67#define UNDEF 0xffff
68#define SPARE 0xfffe
69#define UNUSABLE 0xfffd
70
71int init_alauda(struct us_data *us);
72int alauda_transport(struct scsi_cmnd *srb, struct us_data *us);
73
74struct alauda_media_info {
75 unsigned long capacity; /* total media size in bytes */
76 unsigned int pagesize; /* page size in bytes */
77 unsigned int blocksize; /* number of pages per block */
78 unsigned int uzonesize; /* number of usable blocks per zone */
79 unsigned int zonesize; /* number of blocks per zone */
80 unsigned int blockmask; /* mask to get page from address */
81
82 unsigned char pageshift;
83 unsigned char blockshift;
84 unsigned char zoneshift;
85
86 u16 **lba_to_pba; /* logical to physical block map */
87 u16 **pba_to_lba; /* physical to logical block map */
88};
89
90struct alauda_info {
91 struct alauda_media_info port[2];
92 int wr_ep; /* endpoint to write data out of */
93
94 unsigned char sense_key;
95 unsigned long sense_asc; /* additional sense code */
96 unsigned long sense_ascq; /* additional sense code qualifier */
97};
98
99#endif
100
diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c
index 898e67d30e56..c84471821183 100644
--- a/drivers/usb/storage/cypress_atacb.c
+++ b/drivers/usb/storage/cypress_atacb.c
@@ -19,6 +19,7 @@
19 * 675 Mass Ave, Cambridge, MA 02139, USA. 19 * 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 20 */
21 21
22#include <linux/module.h>
22#include <scsi/scsi.h> 23#include <scsi/scsi.h>
23#include <scsi/scsi_cmnd.h> 24#include <scsi/scsi_cmnd.h>
24#include <scsi/scsi_eh.h> 25#include <scsi/scsi_eh.h>
@@ -29,6 +30,49 @@
29#include "scsiglue.h" 30#include "scsiglue.h"
30#include "debug.h" 31#include "debug.h"
31 32
33MODULE_DESCRIPTION("SAT support for Cypress USB/ATA bridges with ATACB");
34MODULE_AUTHOR("Matthieu Castet <castet.matthieu@free.fr>");
35MODULE_LICENSE("GPL");
36
37/*
38 * The table of devices
39 */
40#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
41 vendorName, productName, useProtocol, useTransport, \
42 initFunction, flags) \
43{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
44 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
45
46struct usb_device_id cypress_usb_ids[] = {
47# include "unusual_cypress.h"
48 { } /* Terminating entry */
49};
50MODULE_DEVICE_TABLE(usb, cypress_usb_ids);
51
52#undef UNUSUAL_DEV
53
54/*
55 * The flags table
56 */
57#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
58 vendor_name, product_name, use_protocol, use_transport, \
59 init_function, Flags) \
60{ \
61 .vendorName = vendor_name, \
62 .productName = product_name, \
63 .useProtocol = use_protocol, \
64 .useTransport = use_transport, \
65 .initFunction = init_function, \
66}
67
68static struct us_unusual_dev cypress_unusual_dev_list[] = {
69# include "unusual_cypress.h"
70 { } /* Terminating entry */
71};
72
73#undef UNUSUAL_DEV
74
75
32/* 76/*
33 * ATACB is a protocol used on cypress usb<->ata bridge to 77 * ATACB is a protocol used on cypress usb<->ata bridge to
34 * send raw ATA command over mass storage 78 * send raw ATA command over mass storage
@@ -36,7 +80,7 @@
36 * More info that be found on cy7c68310_8.pdf and cy7c68300c_8.pdf 80 * More info that be found on cy7c68310_8.pdf and cy7c68300c_8.pdf
37 * datasheet from cypress.com. 81 * datasheet from cypress.com.
38 */ 82 */
39void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us) 83static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)
40{ 84{
41 unsigned char save_cmnd[MAX_COMMAND_SIZE]; 85 unsigned char save_cmnd[MAX_COMMAND_SIZE];
42 86
@@ -133,19 +177,18 @@ void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)
133 177
134 /* build the command for 178 /* build the command for
135 * reading the ATA registers */ 179 * reading the ATA registers */
136 scsi_eh_prep_cmnd(srb, &ses, NULL, 0, 0); 180 scsi_eh_prep_cmnd(srb, &ses, NULL, 0, sizeof(regs));
137 srb->sdb.length = sizeof(regs); 181
138 sg_init_one(&ses.sense_sgl, regs, srb->sdb.length);
139 srb->sdb.table.sgl = &ses.sense_sgl;
140 srb->sc_data_direction = DMA_FROM_DEVICE;
141 srb->sdb.table.nents = 1;
142 /* we use the same command as before, but we set 182 /* we use the same command as before, but we set
143 * the read taskfile bit, for not executing atacb command, 183 * the read taskfile bit, for not executing atacb command,
144 * but reading register selected in srb->cmnd[4] 184 * but reading register selected in srb->cmnd[4]
145 */ 185 */
186 srb->cmd_len = 16;
187 srb->cmnd = ses.cmnd;
146 srb->cmnd[2] = 1; 188 srb->cmnd[2] = 1;
147 189
148 usb_stor_transparent_scsi_command(srb, us); 190 usb_stor_transparent_scsi_command(srb, us);
191 memcpy(regs, srb->sense_buffer, sizeof(regs));
149 tmp_result = srb->result; 192 tmp_result = srb->result;
150 scsi_eh_restore_cmnd(srb, &ses); 193 scsi_eh_restore_cmnd(srb, &ses);
151 /* we fail to get registers, report invalid command */ 194 /* we fail to get registers, report invalid command */
@@ -162,8 +205,8 @@ void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us)
162 205
163 /* XXX we should generate sk, asc, ascq from status and error 206 /* XXX we should generate sk, asc, ascq from status and error
164 * regs 207 * regs
165 * (see 11.1 Error translation ­ ATA device error to SCSI error map) 208 * (see 11.1 Error translation ATA device error to SCSI error
166 * and ata_to_sense_error from libata. 209 * map, and ata_to_sense_error from libata.)
167 */ 210 */
168 211
169 /* Sense data is current and format is descriptor. */ 212 /* Sense data is current and format is descriptor. */
@@ -198,3 +241,48 @@ end:
198 if (srb->cmnd[0] == ATA_12) 241 if (srb->cmnd[0] == ATA_12)
199 srb->cmd_len = 12; 242 srb->cmd_len = 12;
200} 243}
244
245
246static int cypress_probe(struct usb_interface *intf,
247 const struct usb_device_id *id)
248{
249 struct us_data *us;
250 int result;
251
252 result = usb_stor_probe1(&us, intf, id,
253 (id - cypress_usb_ids) + cypress_unusual_dev_list);
254 if (result)
255 return result;
256
257 us->protocol_name = "Transparent SCSI with Cypress ATACB";
258 us->proto_handler = cypress_atacb_passthrough;
259
260 result = usb_stor_probe2(us);
261 return result;
262}
263
264static struct usb_driver cypress_driver = {
265 .name = "ums-cypress",
266 .probe = cypress_probe,
267 .disconnect = usb_stor_disconnect,
268 .suspend = usb_stor_suspend,
269 .resume = usb_stor_resume,
270 .reset_resume = usb_stor_reset_resume,
271 .pre_reset = usb_stor_pre_reset,
272 .post_reset = usb_stor_post_reset,
273 .id_table = cypress_usb_ids,
274 .soft_unbind = 1,
275};
276
277static int __init cypress_init(void)
278{
279 return usb_register(&cypress_driver);
280}
281
282static void __exit cypress_exit(void)
283{
284 usb_deregister(&cypress_driver);
285}
286
287module_init(cypress_init);
288module_exit(cypress_exit);
diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c
index 17f1ae232919..2b6e565262c2 100644
--- a/drivers/usb/storage/datafab.c
+++ b/drivers/usb/storage/datafab.c
@@ -49,6 +49,7 @@
49 */ 49 */
50 50
51#include <linux/errno.h> 51#include <linux/errno.h>
52#include <linux/module.h>
52#include <linux/slab.h> 53#include <linux/slab.h>
53 54
54#include <scsi/scsi.h> 55#include <scsi/scsi.h>
@@ -58,12 +59,65 @@
58#include "transport.h" 59#include "transport.h"
59#include "protocol.h" 60#include "protocol.h"
60#include "debug.h" 61#include "debug.h"
61#include "datafab.h" 62
63MODULE_DESCRIPTION("Driver for Datafab USB Compact Flash reader");
64MODULE_AUTHOR("Jimmie Mayfield <mayfield+datafab@sackheads.org>");
65MODULE_LICENSE("GPL");
66
67struct datafab_info {
68 unsigned long sectors; /* total sector count */
69 unsigned long ssize; /* sector size in bytes */
70 signed char lun; /* used for dual-slot readers */
71
72 /* the following aren't used yet */
73 unsigned char sense_key;
74 unsigned long sense_asc; /* additional sense code */
75 unsigned long sense_ascq; /* additional sense code qualifier */
76};
62 77
63static int datafab_determine_lun(struct us_data *us, 78static int datafab_determine_lun(struct us_data *us,
64 struct datafab_info *info); 79 struct datafab_info *info);
65 80
66 81
82/*
83 * The table of devices
84 */
85#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
86 vendorName, productName, useProtocol, useTransport, \
87 initFunction, flags) \
88{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
89 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
90
91struct usb_device_id datafab_usb_ids[] = {
92# include "unusual_datafab.h"
93 { } /* Terminating entry */
94};
95MODULE_DEVICE_TABLE(usb, datafab_usb_ids);
96
97#undef UNUSUAL_DEV
98
99/*
100 * The flags table
101 */
102#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
103 vendor_name, product_name, use_protocol, use_transport, \
104 init_function, Flags) \
105{ \
106 .vendorName = vendor_name, \
107 .productName = product_name, \
108 .useProtocol = use_protocol, \
109 .useTransport = use_transport, \
110 .initFunction = init_function, \
111}
112
113static struct us_unusual_dev datafab_unusual_dev_list[] = {
114# include "unusual_datafab.h"
115 { } /* Terminating entry */
116};
117
118#undef UNUSUAL_DEV
119
120
67static inline int 121static inline int
68datafab_bulk_read(struct us_data *us, unsigned char *data, unsigned int len) { 122datafab_bulk_read(struct us_data *us, unsigned char *data, unsigned int len) {
69 if (len == 0) 123 if (len == 0)
@@ -500,7 +554,7 @@ static void datafab_info_destructor(void *extra)
500 554
501// Transport for the Datafab MDCFE-B 555// Transport for the Datafab MDCFE-B
502// 556//
503int datafab_transport(struct scsi_cmnd * srb, struct us_data *us) 557static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us)
504{ 558{
505 struct datafab_info *info; 559 struct datafab_info *info;
506 int rc; 560 int rc;
@@ -665,3 +719,49 @@ int datafab_transport(struct scsi_cmnd * srb, struct us_data *us)
665 info->sense_ascq = 0x00; 719 info->sense_ascq = 0x00;
666 return USB_STOR_TRANSPORT_FAILED; 720 return USB_STOR_TRANSPORT_FAILED;
667} 721}
722
723static int datafab_probe(struct usb_interface *intf,
724 const struct usb_device_id *id)
725{
726 struct us_data *us;
727 int result;
728
729 result = usb_stor_probe1(&us, intf, id,
730 (id - datafab_usb_ids) + datafab_unusual_dev_list);
731 if (result)
732 return result;
733
734 us->transport_name = "Datafab Bulk-Only";
735 us->transport = datafab_transport;
736 us->transport_reset = usb_stor_Bulk_reset;
737 us->max_lun = 1;
738
739 result = usb_stor_probe2(us);
740 return result;
741}
742
743static struct usb_driver datafab_driver = {
744 .name = "ums-datafab",
745 .probe = datafab_probe,
746 .disconnect = usb_stor_disconnect,
747 .suspend = usb_stor_suspend,
748 .resume = usb_stor_resume,
749 .reset_resume = usb_stor_reset_resume,
750 .pre_reset = usb_stor_pre_reset,
751 .post_reset = usb_stor_post_reset,
752 .id_table = datafab_usb_ids,
753 .soft_unbind = 1,
754};
755
756static int __init datafab_init(void)
757{
758 return usb_register(&datafab_driver);
759}
760
761static void __exit datafab_exit(void)
762{
763 usb_deregister(&datafab_driver);
764}
765
766module_init(datafab_init);
767module_exit(datafab_exit);
diff --git a/drivers/usb/storage/datafab.h b/drivers/usb/storage/datafab.h
deleted file mode 100644
index 32e3f271e582..000000000000
--- a/drivers/usb/storage/datafab.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/* Driver for Datafab MDCFE-B USB Compact Flash reader
2 * Header File
3 *
4 * Current development and maintenance by:
5 * (c) 2000 Jimmie Mayfield (mayfield+datafab@sackheads.org)
6 *
7 * See datafab.c for more explanation
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2, or (at your option) any
12 * later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#ifndef _USB_DATAFAB_MDCFE_B_H
25#define _USB_DATAFAB_MDCFE_B_H
26
27extern int datafab_transport(struct scsi_cmnd *srb, struct us_data *us);
28
29struct datafab_info {
30 unsigned long sectors; // total sector count
31 unsigned long ssize; // sector size in bytes
32 signed char lun; // used for dual-slot readers
33
34 // the following aren't used yet
35 unsigned char sense_key;
36 unsigned long sense_asc; // additional sense code
37 unsigned long sense_ascq; // additional sense code qualifier
38};
39
40#endif
diff --git a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c
index 73ac7262239e..54cc94277acb 100644
--- a/drivers/usb/storage/freecom.c
+++ b/drivers/usb/storage/freecom.c
@@ -26,6 +26,7 @@
26 * (http://www.freecom.de/) 26 * (http://www.freecom.de/)
27 */ 27 */
28 28
29#include <linux/module.h>
29#include <scsi/scsi.h> 30#include <scsi/scsi.h>
30#include <scsi/scsi_cmnd.h> 31#include <scsi/scsi_cmnd.h>
31 32
@@ -33,7 +34,10 @@
33#include "transport.h" 34#include "transport.h"
34#include "protocol.h" 35#include "protocol.h"
35#include "debug.h" 36#include "debug.h"
36#include "freecom.h" 37
38MODULE_DESCRIPTION("Driver for Freecom USB/IDE adaptor");
39MODULE_AUTHOR("David Brown <usb-storage@davidb.org>");
40MODULE_LICENSE("GPL");
37 41
38#ifdef CONFIG_USB_STORAGE_DEBUG 42#ifdef CONFIG_USB_STORAGE_DEBUG
39static void pdump (void *, int); 43static void pdump (void *, int);
@@ -103,6 +107,47 @@ struct freecom_status {
103#define FCM_PACKET_LENGTH 64 107#define FCM_PACKET_LENGTH 64
104#define FCM_STATUS_PACKET_LENGTH 4 108#define FCM_STATUS_PACKET_LENGTH 4
105 109
110static int init_freecom(struct us_data *us);
111
112
113/*
114 * The table of devices
115 */
116#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
117 vendorName, productName, useProtocol, useTransport, \
118 initFunction, flags) \
119{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
120 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
121
122struct usb_device_id freecom_usb_ids[] = {
123# include "unusual_freecom.h"
124 { } /* Terminating entry */
125};
126MODULE_DEVICE_TABLE(usb, freecom_usb_ids);
127
128#undef UNUSUAL_DEV
129
130/*
131 * The flags table
132 */
133#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
134 vendor_name, product_name, use_protocol, use_transport, \
135 init_function, Flags) \
136{ \
137 .vendorName = vendor_name, \
138 .productName = product_name, \
139 .useProtocol = use_protocol, \
140 .useTransport = use_transport, \
141 .initFunction = init_function, \
142}
143
144static struct us_unusual_dev freecom_unusual_dev_list[] = {
145# include "unusual_freecom.h"
146 { } /* Terminating entry */
147};
148
149#undef UNUSUAL_DEV
150
106static int 151static int
107freecom_readdata (struct scsi_cmnd *srb, struct us_data *us, 152freecom_readdata (struct scsi_cmnd *srb, struct us_data *us,
108 unsigned int ipipe, unsigned int opipe, int count) 153 unsigned int ipipe, unsigned int opipe, int count)
@@ -173,7 +218,7 @@ freecom_writedata (struct scsi_cmnd *srb, struct us_data *us,
173 * Transport for the Freecom USB/IDE adaptor. 218 * Transport for the Freecom USB/IDE adaptor.
174 * 219 *
175 */ 220 */
176int freecom_transport(struct scsi_cmnd *srb, struct us_data *us) 221static int freecom_transport(struct scsi_cmnd *srb, struct us_data *us)
177{ 222{
178 struct freecom_cb_wrap *fcb; 223 struct freecom_cb_wrap *fcb;
179 struct freecom_status *fst; 224 struct freecom_status *fst;
@@ -377,8 +422,7 @@ int freecom_transport(struct scsi_cmnd *srb, struct us_data *us)
377 return USB_STOR_TRANSPORT_GOOD; 422 return USB_STOR_TRANSPORT_GOOD;
378} 423}
379 424
380int 425static int init_freecom(struct us_data *us)
381freecom_init (struct us_data *us)
382{ 426{
383 int result; 427 int result;
384 char *buffer = us->iobuf; 428 char *buffer = us->iobuf;
@@ -417,7 +461,7 @@ freecom_init (struct us_data *us)
417 return USB_STOR_TRANSPORT_GOOD; 461 return USB_STOR_TRANSPORT_GOOD;
418} 462}
419 463
420int usb_stor_freecom_reset(struct us_data *us) 464static int usb_stor_freecom_reset(struct us_data *us)
421{ 465{
422 printk (KERN_CRIT "freecom reset called\n"); 466 printk (KERN_CRIT "freecom reset called\n");
423 467
@@ -479,3 +523,48 @@ static void pdump (void *ibuffer, int length)
479} 523}
480#endif 524#endif
481 525
526static int freecom_probe(struct usb_interface *intf,
527 const struct usb_device_id *id)
528{
529 struct us_data *us;
530 int result;
531
532 result = usb_stor_probe1(&us, intf, id,
533 (id - freecom_usb_ids) + freecom_unusual_dev_list);
534 if (result)
535 return result;
536
537 us->transport_name = "Freecom";
538 us->transport = freecom_transport;
539 us->transport_reset = usb_stor_freecom_reset;
540 us->max_lun = 0;
541
542 result = usb_stor_probe2(us);
543 return result;
544}
545
546static struct usb_driver freecom_driver = {
547 .name = "ums-freecom",
548 .probe = freecom_probe,
549 .disconnect = usb_stor_disconnect,
550 .suspend = usb_stor_suspend,
551 .resume = usb_stor_resume,
552 .reset_resume = usb_stor_reset_resume,
553 .pre_reset = usb_stor_pre_reset,
554 .post_reset = usb_stor_post_reset,
555 .id_table = freecom_usb_ids,
556 .soft_unbind = 1,
557};
558
559static int __init freecom_init(void)
560{
561 return usb_register(&freecom_driver);
562}
563
564static void __exit freecom_exit(void)
565{
566 usb_deregister(&freecom_driver);
567}
568
569module_init(freecom_init);
570module_exit(freecom_exit);
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index 383abf2516a5..882c57b399f7 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -44,6 +44,7 @@
44 44
45#include <linux/jiffies.h> 45#include <linux/jiffies.h>
46#include <linux/errno.h> 46#include <linux/errno.h>
47#include <linux/module.h>
47#include <linux/slab.h> 48#include <linux/slab.h>
48#include <linux/hdreg.h> 49#include <linux/hdreg.h>
49#include <linux/scatterlist.h> 50#include <linux/scatterlist.h>
@@ -57,7 +58,53 @@
57#include "protocol.h" 58#include "protocol.h"
58#include "debug.h" 59#include "debug.h"
59#include "scsiglue.h" 60#include "scsiglue.h"
60#include "isd200.h" 61
62MODULE_DESCRIPTION("Driver for In-System Design, Inc. ISD200 ASIC");
63MODULE_AUTHOR("Björn Stenberg <bjorn@haxx.se>");
64MODULE_LICENSE("GPL");
65
66static int isd200_Initialization(struct us_data *us);
67
68
69/*
70 * The table of devices
71 */
72#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
73 vendorName, productName, useProtocol, useTransport, \
74 initFunction, flags) \
75{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
76 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
77
78struct usb_device_id isd200_usb_ids[] = {
79# include "unusual_isd200.h"
80 { } /* Terminating entry */
81};
82MODULE_DEVICE_TABLE(usb, isd200_usb_ids);
83
84#undef UNUSUAL_DEV
85#undef USUAL_DEV
86
87/*
88 * The flags table
89 */
90#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
91 vendor_name, product_name, use_protocol, use_transport, \
92 init_function, Flags) \
93{ \
94 .vendorName = vendor_name, \
95 .productName = product_name, \
96 .useProtocol = use_protocol, \
97 .useTransport = use_transport, \
98 .initFunction = init_function, \
99}
100
101static struct us_unusual_dev isd200_unusual_dev_list[] = {
102# include "unusual_isd200.h"
103 { } /* Terminating entry */
104};
105
106#undef UNUSUAL_DEV
107#undef USUAL_DEV
61 108
62 109
63/* Timeout defines (in Seconds) */ 110/* Timeout defines (in Seconds) */
@@ -1518,7 +1565,7 @@ static int isd200_init_info(struct us_data *us)
1518 * Initialization for the ISD200 1565 * Initialization for the ISD200
1519 */ 1566 */
1520 1567
1521int isd200_Initialization(struct us_data *us) 1568static int isd200_Initialization(struct us_data *us)
1522{ 1569{
1523 US_DEBUGP("ISD200 Initialization...\n"); 1570 US_DEBUGP("ISD200 Initialization...\n");
1524 1571
@@ -1549,7 +1596,7 @@ int isd200_Initialization(struct us_data *us)
1549 * 1596 *
1550 */ 1597 */
1551 1598
1552void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us) 1599static void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us)
1553{ 1600{
1554 int sendToTransport = 1, orig_bufflen; 1601 int sendToTransport = 1, orig_bufflen;
1555 union ata_cdb ataCdb; 1602 union ata_cdb ataCdb;
@@ -1570,3 +1617,47 @@ void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us)
1570 1617
1571 isd200_srb_set_bufflen(srb, orig_bufflen); 1618 isd200_srb_set_bufflen(srb, orig_bufflen);
1572} 1619}
1620
1621static int isd200_probe(struct usb_interface *intf,
1622 const struct usb_device_id *id)
1623{
1624 struct us_data *us;
1625 int result;
1626
1627 result = usb_stor_probe1(&us, intf, id,
1628 (id - isd200_usb_ids) + isd200_unusual_dev_list);
1629 if (result)
1630 return result;
1631
1632 us->protocol_name = "ISD200 ATA/ATAPI";
1633 us->proto_handler = isd200_ata_command;
1634
1635 result = usb_stor_probe2(us);
1636 return result;
1637}
1638
1639static struct usb_driver isd200_driver = {
1640 .name = "ums-isd200",
1641 .probe = isd200_probe,
1642 .disconnect = usb_stor_disconnect,
1643 .suspend = usb_stor_suspend,
1644 .resume = usb_stor_resume,
1645 .reset_resume = usb_stor_reset_resume,
1646 .pre_reset = usb_stor_pre_reset,
1647 .post_reset = usb_stor_post_reset,
1648 .id_table = isd200_usb_ids,
1649 .soft_unbind = 1,
1650};
1651
1652static int __init isd200_init(void)
1653{
1654 return usb_register(&isd200_driver);
1655}
1656
1657static void __exit isd200_exit(void)
1658{
1659 usb_deregister(&isd200_driver);
1660}
1661
1662module_init(isd200_init);
1663module_exit(isd200_exit);
diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c
index df67f13c9e73..1c69420e3acf 100644
--- a/drivers/usb/storage/jumpshot.c
+++ b/drivers/usb/storage/jumpshot.c
@@ -46,6 +46,7 @@
46 */ 46 */
47 47
48#include <linux/errno.h> 48#include <linux/errno.h>
49#include <linux/module.h>
49#include <linux/slab.h> 50#include <linux/slab.h>
50 51
51#include <scsi/scsi.h> 52#include <scsi/scsi.h>
@@ -55,9 +56,61 @@
55#include "transport.h" 56#include "transport.h"
56#include "protocol.h" 57#include "protocol.h"
57#include "debug.h" 58#include "debug.h"
58#include "jumpshot.h"
59 59
60 60
61MODULE_DESCRIPTION("Driver for Lexar \"Jumpshot\" Compact Flash reader");
62MODULE_AUTHOR("Jimmie Mayfield <mayfield+usb@sackheads.org>");
63MODULE_LICENSE("GPL");
64
65/*
66 * The table of devices
67 */
68#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
69 vendorName, productName, useProtocol, useTransport, \
70 initFunction, flags) \
71{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
72 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
73
74struct usb_device_id jumpshot_usb_ids[] = {
75# include "unusual_jumpshot.h"
76 { } /* Terminating entry */
77};
78MODULE_DEVICE_TABLE(usb, jumpshot_usb_ids);
79
80#undef UNUSUAL_DEV
81
82/*
83 * The flags table
84 */
85#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
86 vendor_name, product_name, use_protocol, use_transport, \
87 init_function, Flags) \
88{ \
89 .vendorName = vendor_name, \
90 .productName = product_name, \
91 .useProtocol = use_protocol, \
92 .useTransport = use_transport, \
93 .initFunction = init_function, \
94}
95
96static struct us_unusual_dev jumpshot_unusual_dev_list[] = {
97# include "unusual_jumpshot.h"
98 { } /* Terminating entry */
99};
100
101#undef UNUSUAL_DEV
102
103
104struct jumpshot_info {
105 unsigned long sectors; /* total sector count */
106 unsigned long ssize; /* sector size in bytes */
107
108 /* the following aren't used yet */
109 unsigned char sense_key;
110 unsigned long sense_asc; /* additional sense code */
111 unsigned long sense_ascq; /* additional sense code qualifier */
112};
113
61static inline int jumpshot_bulk_read(struct us_data *us, 114static inline int jumpshot_bulk_read(struct us_data *us,
62 unsigned char *data, 115 unsigned char *data,
63 unsigned int len) 116 unsigned int len)
@@ -429,7 +482,7 @@ static void jumpshot_info_destructor(void *extra)
429 482
430// Transport for the Lexar 'Jumpshot' 483// Transport for the Lexar 'Jumpshot'
431// 484//
432int jumpshot_transport(struct scsi_cmnd * srb, struct us_data *us) 485static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
433{ 486{
434 struct jumpshot_info *info; 487 struct jumpshot_info *info;
435 int rc; 488 int rc;
@@ -592,3 +645,49 @@ int jumpshot_transport(struct scsi_cmnd * srb, struct us_data *us)
592 info->sense_ascq = 0x00; 645 info->sense_ascq = 0x00;
593 return USB_STOR_TRANSPORT_FAILED; 646 return USB_STOR_TRANSPORT_FAILED;
594} 647}
648
649static int jumpshot_probe(struct usb_interface *intf,
650 const struct usb_device_id *id)
651{
652 struct us_data *us;
653 int result;
654
655 result = usb_stor_probe1(&us, intf, id,
656 (id - jumpshot_usb_ids) + jumpshot_unusual_dev_list);
657 if (result)
658 return result;
659
660 us->transport_name = "Lexar Jumpshot Control/Bulk";
661 us->transport = jumpshot_transport;
662 us->transport_reset = usb_stor_Bulk_reset;
663 us->max_lun = 1;
664
665 result = usb_stor_probe2(us);
666 return result;
667}
668
669static struct usb_driver jumpshot_driver = {
670 .name = "ums-jumpshot",
671 .probe = jumpshot_probe,
672 .disconnect = usb_stor_disconnect,
673 .suspend = usb_stor_suspend,
674 .resume = usb_stor_resume,
675 .reset_resume = usb_stor_reset_resume,
676 .pre_reset = usb_stor_pre_reset,
677 .post_reset = usb_stor_post_reset,
678 .id_table = jumpshot_usb_ids,
679 .soft_unbind = 1,
680};
681
682static int __init jumpshot_init(void)
683{
684 return usb_register(&jumpshot_driver);
685}
686
687static void __exit jumpshot_exit(void)
688{
689 usb_deregister(&jumpshot_driver);
690}
691
692module_init(jumpshot_init);
693module_exit(jumpshot_exit);
diff --git a/drivers/usb/storage/jumpshot.h b/drivers/usb/storage/jumpshot.h
deleted file mode 100644
index 19bac9d1558f..000000000000
--- a/drivers/usb/storage/jumpshot.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/* Driver for Lexar "Jumpshot" USB Compact Flash reader
2 * Header File
3 *
4 * Current development and maintenance by:
5 * (c) 2000 Jimmie Mayfield (mayfield+usb@sackheads.org)
6 *
7 * See jumpshot.c for more explanation
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2, or (at your option) any
12 * later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#ifndef _USB_JUMPSHOT_H
25#define _USB_JUMPSHOT_H
26
27extern int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us);
28
29struct jumpshot_info {
30 unsigned long sectors; // total sector count
31 unsigned long ssize; // sector size in bytes
32
33 // the following aren't used yet
34 unsigned char sense_key;
35 unsigned long sense_asc; // additional sense code
36 unsigned long sense_ascq; // additional sense code qualifier
37};
38
39#endif
diff --git a/drivers/usb/storage/karma.c b/drivers/usb/storage/karma.c
index 0d79ae5683f7..7953d93a7739 100644
--- a/drivers/usb/storage/karma.c
+++ b/drivers/usb/storage/karma.c
@@ -18,6 +18,8 @@
18 * 675 Mass Ave, Cambridge, MA 02139, USA. 18 * 675 Mass Ave, Cambridge, MA 02139, USA.
19 */ 19 */
20 20
21#include <linux/module.h>
22
21#include <scsi/scsi.h> 23#include <scsi/scsi.h>
22#include <scsi/scsi_cmnd.h> 24#include <scsi/scsi_cmnd.h>
23#include <scsi/scsi_device.h> 25#include <scsi/scsi_device.h>
@@ -25,7 +27,10 @@
25#include "usb.h" 27#include "usb.h"
26#include "transport.h" 28#include "transport.h"
27#include "debug.h" 29#include "debug.h"
28#include "karma.h" 30
31MODULE_DESCRIPTION("Driver for Rio Karma");
32MODULE_AUTHOR("Bob Copeland <me@bobcopeland.com>, Keith Bennett <keith@mcs.st-and.ac.uk>");
33MODULE_LICENSE("GPL");
29 34
30#define RIO_PREFIX "RIOP\x00" 35#define RIO_PREFIX "RIOP\x00"
31#define RIO_PREFIX_LEN 5 36#define RIO_PREFIX_LEN 5
@@ -36,13 +41,53 @@
36#define RIO_LEAVE_STORAGE 0x2 41#define RIO_LEAVE_STORAGE 0x2
37#define RIO_RESET 0xC 42#define RIO_RESET 0xC
38 43
39extern int usb_stor_Bulk_transport(struct scsi_cmnd *, struct us_data *);
40
41struct karma_data { 44struct karma_data {
42 int in_storage; 45 int in_storage;
43 char *recv; 46 char *recv;
44}; 47};
45 48
49static int rio_karma_init(struct us_data *us);
50
51
52/*
53 * The table of devices
54 */
55#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
56 vendorName, productName, useProtocol, useTransport, \
57 initFunction, flags) \
58{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
59 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
60
61struct usb_device_id karma_usb_ids[] = {
62# include "unusual_karma.h"
63 { } /* Terminating entry */
64};
65MODULE_DEVICE_TABLE(usb, karma_usb_ids);
66
67#undef UNUSUAL_DEV
68
69/*
70 * The flags table
71 */
72#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
73 vendor_name, product_name, use_protocol, use_transport, \
74 init_function, Flags) \
75{ \
76 .vendorName = vendor_name, \
77 .productName = product_name, \
78 .useProtocol = use_protocol, \
79 .useTransport = use_transport, \
80 .initFunction = init_function, \
81}
82
83static struct us_unusual_dev karma_unusual_dev_list[] = {
84# include "unusual_karma.h"
85 { } /* Terminating entry */
86};
87
88#undef UNUSUAL_DEV
89
90
46/* 91/*
47 * Send commands to Rio Karma. 92 * Send commands to Rio Karma.
48 * 93 *
@@ -104,7 +149,7 @@ err:
104 * Trap START_STOP and READ_10 to leave/re-enter storage mode. 149 * Trap START_STOP and READ_10 to leave/re-enter storage mode.
105 * Everything else is propagated to the normal bulk layer. 150 * Everything else is propagated to the normal bulk layer.
106 */ 151 */
107int rio_karma_transport(struct scsi_cmnd *srb, struct us_data *us) 152static int rio_karma_transport(struct scsi_cmnd *srb, struct us_data *us)
108{ 153{
109 int ret; 154 int ret;
110 struct karma_data *data = (struct karma_data *) us->extra; 155 struct karma_data *data = (struct karma_data *) us->extra;
@@ -133,7 +178,7 @@ static void rio_karma_destructor(void *extra)
133 kfree(data->recv); 178 kfree(data->recv);
134} 179}
135 180
136int rio_karma_init(struct us_data *us) 181static int rio_karma_init(struct us_data *us)
137{ 182{
138 int ret = 0; 183 int ret = 0;
139 struct karma_data *data = kzalloc(sizeof(struct karma_data), GFP_NOIO); 184 struct karma_data *data = kzalloc(sizeof(struct karma_data), GFP_NOIO);
@@ -153,3 +198,48 @@ int rio_karma_init(struct us_data *us)
153out: 198out:
154 return ret; 199 return ret;
155} 200}
201
202static int karma_probe(struct usb_interface *intf,
203 const struct usb_device_id *id)
204{
205 struct us_data *us;
206 int result;
207
208 result = usb_stor_probe1(&us, intf, id,
209 (id - karma_usb_ids) + karma_unusual_dev_list);
210 if (result)
211 return result;
212
213 us->transport_name = "Rio Karma/Bulk";
214 us->transport = rio_karma_transport;
215 us->transport_reset = usb_stor_Bulk_reset;
216
217 result = usb_stor_probe2(us);
218 return result;
219}
220
221static struct usb_driver karma_driver = {
222 .name = "ums-karma",
223 .probe = karma_probe,
224 .disconnect = usb_stor_disconnect,
225 .suspend = usb_stor_suspend,
226 .resume = usb_stor_resume,
227 .reset_resume = usb_stor_reset_resume,
228 .pre_reset = usb_stor_pre_reset,
229 .post_reset = usb_stor_post_reset,
230 .id_table = karma_usb_ids,
231 .soft_unbind = 1,
232};
233
234static int __init karma_init(void)
235{
236 return usb_register(&karma_driver);
237}
238
239static void __exit karma_exit(void)
240{
241 usb_deregister(&karma_driver);
242}
243
244module_init(karma_init);
245module_exit(karma_exit);
diff --git a/drivers/usb/storage/karma.h b/drivers/usb/storage/karma.h
deleted file mode 100644
index 8a60972af8c5..000000000000
--- a/drivers/usb/storage/karma.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _KARMA_USB_H
2#define _KARMA_USB_H
3
4extern int rio_karma_init(struct us_data *us);
5extern int rio_karma_transport(struct scsi_cmnd *srb, struct us_data *us);
6
7#endif
diff --git a/drivers/usb/storage/libusual.c b/drivers/usb/storage/libusual.c
index f970b27ba308..fe3ffe1459b2 100644
--- a/drivers/usb/storage/libusual.c
+++ b/drivers/usb/storage/libusual.c
@@ -38,37 +38,6 @@ static atomic_t total_threads = ATOMIC_INIT(0);
38static int usu_probe_thread(void *arg); 38static int usu_probe_thread(void *arg);
39 39
40/* 40/*
41 * The table.
42 */
43#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
44 vendorName, productName,useProtocol, useTransport, \
45 initFunction, flags) \
46{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin,bcdDeviceMax), \
47 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
48
49#define COMPLIANT_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
50 vendorName, productName, useProtocol, useTransport, \
51 initFunction, flags) \
52{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
53 .driver_info = (flags) }
54
55#define USUAL_DEV(useProto, useTrans, useType) \
56{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans), \
57 .driver_info = ((useType)<<24) }
58
59struct usb_device_id storage_usb_ids [] = {
60# include "unusual_devs.h"
61 { } /* Terminating entry */
62};
63
64#undef USUAL_DEV
65#undef UNUSUAL_DEV
66#undef COMPLIANT_DEV
67
68MODULE_DEVICE_TABLE(usb, storage_usb_ids);
69EXPORT_SYMBOL_GPL(storage_usb_ids);
70
71/*
72 * @type: the module type as an integer 41 * @type: the module type as an integer
73 */ 42 */
74void usb_usual_set_present(int type) 43void usb_usual_set_present(int type)
@@ -167,7 +136,7 @@ static struct usb_driver usu_driver = {
167 .name = "libusual", 136 .name = "libusual",
168 .probe = usu_probe, 137 .probe = usu_probe,
169 .disconnect = usu_disconnect, 138 .disconnect = usu_disconnect,
170 .id_table = storage_usb_ids, 139 .id_table = usb_storage_usb_ids,
171}; 140};
172 141
173/* 142/*
diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c
index c7bf8954b4e4..380233bd6a39 100644
--- a/drivers/usb/storage/onetouch.c
+++ b/drivers/usb/storage/onetouch.c
@@ -35,9 +35,16 @@
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/usb/input.h> 36#include <linux/usb/input.h>
37#include "usb.h" 37#include "usb.h"
38#include "onetouch.h"
39#include "debug.h" 38#include "debug.h"
40 39
40MODULE_DESCRIPTION("Maxtor USB OneTouch hard drive button driver");
41MODULE_AUTHOR("Nick Sillik <n.sillik@temple.edu>");
42MODULE_LICENSE("GPL");
43
44#define ONETOUCH_PKT_LEN 0x02
45#define ONETOUCH_BUTTON KEY_PROG1
46
47static int onetouch_connect_input(struct us_data *ss);
41static void onetouch_release_input(void *onetouch_); 48static void onetouch_release_input(void *onetouch_);
42 49
43struct usb_onetouch { 50struct usb_onetouch {
@@ -52,6 +59,46 @@ struct usb_onetouch {
52 unsigned int is_open:1; 59 unsigned int is_open:1;
53}; 60};
54 61
62
63/*
64 * The table of devices
65 */
66#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
67 vendorName, productName, useProtocol, useTransport, \
68 initFunction, flags) \
69{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
70 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
71
72struct usb_device_id onetouch_usb_ids[] = {
73# include "unusual_onetouch.h"
74 { } /* Terminating entry */
75};
76MODULE_DEVICE_TABLE(usb, onetouch_usb_ids);
77
78#undef UNUSUAL_DEV
79
80/*
81 * The flags table
82 */
83#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
84 vendor_name, product_name, use_protocol, use_transport, \
85 init_function, Flags) \
86{ \
87 .vendorName = vendor_name, \
88 .productName = product_name, \
89 .useProtocol = use_protocol, \
90 .useTransport = use_transport, \
91 .initFunction = init_function, \
92}
93
94static struct us_unusual_dev onetouch_unusual_dev_list[] = {
95# include "unusual_onetouch.h"
96 { } /* Terminating entry */
97};
98
99#undef UNUSUAL_DEV
100
101
55static void usb_onetouch_irq(struct urb *urb) 102static void usb_onetouch_irq(struct urb *urb)
56{ 103{
57 struct usb_onetouch *onetouch = urb->context; 104 struct usb_onetouch *onetouch = urb->context;
@@ -127,7 +174,7 @@ static void usb_onetouch_pm_hook(struct us_data *us, int action)
127} 174}
128#endif /* CONFIG_PM */ 175#endif /* CONFIG_PM */
129 176
130int onetouch_connect_input(struct us_data *ss) 177static int onetouch_connect_input(struct us_data *ss)
131{ 178{
132 struct usb_device *udev = ss->pusb_dev; 179 struct usb_device *udev = ss->pusb_dev;
133 struct usb_host_interface *interface; 180 struct usb_host_interface *interface;
@@ -236,3 +283,46 @@ static void onetouch_release_input(void *onetouch_)
236 onetouch->data, onetouch->data_dma); 283 onetouch->data, onetouch->data_dma);
237 } 284 }
238} 285}
286
287static int onetouch_probe(struct usb_interface *intf,
288 const struct usb_device_id *id)
289{
290 struct us_data *us;
291 int result;
292
293 result = usb_stor_probe1(&us, intf, id,
294 (id - onetouch_usb_ids) + onetouch_unusual_dev_list);
295 if (result)
296 return result;
297
298 /* Use default transport and protocol */
299
300 result = usb_stor_probe2(us);
301 return result;
302}
303
304static struct usb_driver onetouch_driver = {
305 .name = "ums-onetouch",
306 .probe = onetouch_probe,
307 .disconnect = usb_stor_disconnect,
308 .suspend = usb_stor_suspend,
309 .resume = usb_stor_resume,
310 .reset_resume = usb_stor_reset_resume,
311 .pre_reset = usb_stor_pre_reset,
312 .post_reset = usb_stor_post_reset,
313 .id_table = onetouch_usb_ids,
314 .soft_unbind = 1,
315};
316
317static int __init onetouch_init(void)
318{
319 return usb_register(&onetouch_driver);
320}
321
322static void __exit onetouch_exit(void)
323{
324 usb_deregister(&onetouch_driver);
325}
326
327module_init(onetouch_init);
328module_exit(onetouch_exit);
diff --git a/drivers/usb/storage/onetouch.h b/drivers/usb/storage/onetouch.h
deleted file mode 100644
index 41c7aa8f0446..000000000000
--- a/drivers/usb/storage/onetouch.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _ONETOUCH_H_
2#define _ONETOUCH_H_
3
4#define ONETOUCH_PKT_LEN 0x02
5#define ONETOUCH_BUTTON KEY_PROG1
6
7int onetouch_connect_input(struct us_data *ss);
8
9#endif
diff --git a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c
index be441d84bc64..fc310f75eada 100644
--- a/drivers/usb/storage/protocol.c
+++ b/drivers/usb/storage/protocol.c
@@ -121,6 +121,7 @@ void usb_stor_transparent_scsi_command(struct scsi_cmnd *srb,
121 /* send the command to the transport layer */ 121 /* send the command to the transport layer */
122 usb_stor_invoke_transport(srb, us); 122 usb_stor_invoke_transport(srb, us);
123} 123}
124EXPORT_SYMBOL_GPL(usb_stor_transparent_scsi_command);
124 125
125/*********************************************************************** 126/***********************************************************************
126 * Scatter-gather transfer buffer access routines 127 * Scatter-gather transfer buffer access routines
@@ -199,6 +200,7 @@ unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
199 /* Return the amount actually transferred */ 200 /* Return the amount actually transferred */
200 return cnt; 201 return cnt;
201} 202}
203EXPORT_SYMBOL_GPL(usb_stor_access_xfer_buf);
202 204
203/* Store the contents of buffer into srb's transfer buffer and set the 205/* Store the contents of buffer into srb's transfer buffer and set the
204 * SCSI residue. 206 * SCSI residue.
@@ -215,3 +217,4 @@ void usb_stor_set_xfer_buf(unsigned char *buffer,
215 if (buflen < scsi_bufflen(srb)) 217 if (buflen < scsi_bufflen(srb))
216 scsi_set_resid(srb, scsi_bufflen(srb) - buflen); 218 scsi_set_resid(srb, scsi_bufflen(srb) - buflen);
217} 219}
220EXPORT_SYMBOL_GPL(usb_stor_set_xfer_buf);
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 727c506417cc..4ca3b5860643 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -135,6 +135,12 @@ static int slave_configure(struct scsi_device *sdev)
135 if (sdev->request_queue->max_sectors > max_sectors) 135 if (sdev->request_queue->max_sectors > max_sectors)
136 blk_queue_max_sectors(sdev->request_queue, 136 blk_queue_max_sectors(sdev->request_queue,
137 max_sectors); 137 max_sectors);
138 } else if (sdev->type == TYPE_TAPE) {
139 /* Tapes need much higher max_sector limits, so just
140 * raise it to the maximum possible (4 GB / 512) and
141 * let the queue segment size sort out the real limit.
142 */
143 blk_queue_max_sectors(sdev->request_queue, 0x7FFFFF);
138 } 144 }
139 145
140 /* Some USB host controllers can't do DMA; they have to use PIO. 146 /* Some USB host controllers can't do DMA; they have to use PIO.
@@ -563,4 +569,4 @@ unsigned char usb_stor_sense_invalidCDB[18] = {
563 [7] = 0x0a, /* additional length */ 569 [7] = 0x0a, /* additional length */
564 [12] = 0x24 /* Invalid Field in CDB */ 570 [12] = 0x24 /* Invalid Field in CDB */
565}; 571};
566 572EXPORT_SYMBOL_GPL(usb_stor_sense_invalidCDB);
diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c
index 531ae5c5abf3..ab5f9f37575a 100644
--- a/drivers/usb/storage/sddr09.c
+++ b/drivers/usb/storage/sddr09.c
@@ -41,6 +41,7 @@
41 */ 41 */
42 42
43#include <linux/errno.h> 43#include <linux/errno.h>
44#include <linux/module.h>
44#include <linux/slab.h> 45#include <linux/slab.h>
45 46
46#include <scsi/scsi.h> 47#include <scsi/scsi.h>
@@ -51,7 +52,53 @@
51#include "transport.h" 52#include "transport.h"
52#include "protocol.h" 53#include "protocol.h"
53#include "debug.h" 54#include "debug.h"
54#include "sddr09.h" 55
56MODULE_DESCRIPTION("Driver for SanDisk SDDR-09 SmartMedia reader");
57MODULE_AUTHOR("Andries Brouwer <aeb@cwi.nl>, Robert Baruch <autophile@starband.net>");
58MODULE_LICENSE("GPL");
59
60static int usb_stor_sddr09_dpcm_init(struct us_data *us);
61static int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us);
62static int usb_stor_sddr09_init(struct us_data *us);
63
64
65/*
66 * The table of devices
67 */
68#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
69 vendorName, productName, useProtocol, useTransport, \
70 initFunction, flags) \
71{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
72 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
73
74struct usb_device_id sddr09_usb_ids[] = {
75# include "unusual_sddr09.h"
76 { } /* Terminating entry */
77};
78MODULE_DEVICE_TABLE(usb, sddr09_usb_ids);
79
80#undef UNUSUAL_DEV
81
82/*
83 * The flags table
84 */
85#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
86 vendor_name, product_name, use_protocol, use_transport, \
87 init_function, Flags) \
88{ \
89 .vendorName = vendor_name, \
90 .productName = product_name, \
91 .useProtocol = use_protocol, \
92 .useTransport = use_transport, \
93 .initFunction = init_function, \
94}
95
96static struct us_unusual_dev sddr09_unusual_dev_list[] = {
97# include "unusual_sddr09.h"
98 { } /* Terminating entry */
99};
100
101#undef UNUSUAL_DEV
55 102
56 103
57#define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) ) 104#define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) )
@@ -723,7 +770,7 @@ sddr09_read_data(struct us_data *us,
723 len = min(sectors, (unsigned int) info->blocksize) * info->pagesize; 770 len = min(sectors, (unsigned int) info->blocksize) * info->pagesize;
724 buffer = kmalloc(len, GFP_NOIO); 771 buffer = kmalloc(len, GFP_NOIO);
725 if (buffer == NULL) { 772 if (buffer == NULL) {
726 printk("sddr09_read_data: Out of memory\n"); 773 printk(KERN_WARNING "sddr09_read_data: Out of memory\n");
727 return -ENOMEM; 774 return -ENOMEM;
728 } 775 }
729 776
@@ -838,7 +885,8 @@ sddr09_write_lba(struct us_data *us, unsigned int lba,
838 if (pba == UNDEF) { 885 if (pba == UNDEF) {
839 pba = sddr09_find_unused_pba(info, lba); 886 pba = sddr09_find_unused_pba(info, lba);
840 if (!pba) { 887 if (!pba) {
841 printk("sddr09_write_lba: Out of unused blocks\n"); 888 printk(KERN_WARNING
889 "sddr09_write_lba: Out of unused blocks\n");
842 return -ENOSPC; 890 return -ENOSPC;
843 } 891 }
844 info->pba_to_lba[pba] = lba; 892 info->pba_to_lba[pba] = lba;
@@ -849,7 +897,7 @@ sddr09_write_lba(struct us_data *us, unsigned int lba,
849 if (pba == 1) { 897 if (pba == 1) {
850 /* Maybe it is impossible to write to PBA 1. 898 /* Maybe it is impossible to write to PBA 1.
851 Fake success, but don't do anything. */ 899 Fake success, but don't do anything. */
852 printk("sddr09: avoid writing to pba 1\n"); 900 printk(KERN_WARNING "sddr09: avoid writing to pba 1\n");
853 return 0; 901 return 0;
854 } 902 }
855 903
@@ -954,7 +1002,7 @@ sddr09_write_data(struct us_data *us,
954 blocklen = (pagelen << info->blockshift); 1002 blocklen = (pagelen << info->blockshift);
955 blockbuffer = kmalloc(blocklen, GFP_NOIO); 1003 blockbuffer = kmalloc(blocklen, GFP_NOIO);
956 if (!blockbuffer) { 1004 if (!blockbuffer) {
957 printk("sddr09_write_data: Out of memory\n"); 1005 printk(KERN_WARNING "sddr09_write_data: Out of memory\n");
958 return -ENOMEM; 1006 return -ENOMEM;
959 } 1007 }
960 1008
@@ -965,7 +1013,7 @@ sddr09_write_data(struct us_data *us,
965 len = min(sectors, (unsigned int) info->blocksize) * info->pagesize; 1013 len = min(sectors, (unsigned int) info->blocksize) * info->pagesize;
966 buffer = kmalloc(len, GFP_NOIO); 1014 buffer = kmalloc(len, GFP_NOIO);
967 if (buffer == NULL) { 1015 if (buffer == NULL) {
968 printk("sddr09_write_data: Out of memory\n"); 1016 printk(KERN_WARNING "sddr09_write_data: Out of memory\n");
969 kfree(blockbuffer); 1017 kfree(blockbuffer);
970 return -ENOMEM; 1018 return -ENOMEM;
971 } 1019 }
@@ -1112,7 +1160,7 @@ sddr09_get_cardinfo(struct us_data *us, unsigned char flags) {
1112 1160
1113 if (result) { 1161 if (result) {
1114 US_DEBUGP("Result of read_deviceID is %d\n", result); 1162 US_DEBUGP("Result of read_deviceID is %d\n", result);
1115 printk("sddr09: could not read card info\n"); 1163 printk(KERN_WARNING "sddr09: could not read card info\n");
1116 return NULL; 1164 return NULL;
1117 } 1165 }
1118 1166
@@ -1153,7 +1201,7 @@ sddr09_get_cardinfo(struct us_data *us, unsigned char flags) {
1153 sprintf(blurbtxt + strlen(blurbtxt), 1201 sprintf(blurbtxt + strlen(blurbtxt),
1154 ", WP"); 1202 ", WP");
1155 1203
1156 printk("%s\n", blurbtxt); 1204 printk(KERN_WARNING "%s\n", blurbtxt);
1157 1205
1158 return cardinfo; 1206 return cardinfo;
1159} 1207}
@@ -1184,7 +1232,7 @@ sddr09_read_map(struct us_data *us) {
1184 alloc_len = (alloc_blocks << CONTROL_SHIFT); 1232 alloc_len = (alloc_blocks << CONTROL_SHIFT);
1185 buffer = kmalloc(alloc_len, GFP_NOIO); 1233 buffer = kmalloc(alloc_len, GFP_NOIO);
1186 if (buffer == NULL) { 1234 if (buffer == NULL) {
1187 printk("sddr09_read_map: out of memory\n"); 1235 printk(KERN_WARNING "sddr09_read_map: out of memory\n");
1188 result = -1; 1236 result = -1;
1189 goto done; 1237 goto done;
1190 } 1238 }
@@ -1198,7 +1246,7 @@ sddr09_read_map(struct us_data *us) {
1198 info->pba_to_lba = kmalloc(numblocks*sizeof(int), GFP_NOIO); 1246 info->pba_to_lba = kmalloc(numblocks*sizeof(int), GFP_NOIO);
1199 1247
1200 if (info->lba_to_pba == NULL || info->pba_to_lba == NULL) { 1248 if (info->lba_to_pba == NULL || info->pba_to_lba == NULL) {
1201 printk("sddr09_read_map: out of memory\n"); 1249 printk(KERN_WARNING "sddr09_read_map: out of memory\n");
1202 result = -1; 1250 result = -1;
1203 goto done; 1251 goto done;
1204 } 1252 }
@@ -1238,7 +1286,8 @@ sddr09_read_map(struct us_data *us) {
1238 if (ptr[j] != 0) 1286 if (ptr[j] != 0)
1239 goto nonz; 1287 goto nonz;
1240 info->pba_to_lba[i] = UNUSABLE; 1288 info->pba_to_lba[i] = UNUSABLE;
1241 printk("sddr09: PBA %d has no logical mapping\n", i); 1289 printk(KERN_WARNING "sddr09: PBA %d has no logical mapping\n",
1290 i);
1242 continue; 1291 continue;
1243 1292
1244 nonz: 1293 nonz:
@@ -1251,7 +1300,8 @@ sddr09_read_map(struct us_data *us) {
1251 nonff: 1300 nonff:
1252 /* normal PBAs start with six FFs */ 1301 /* normal PBAs start with six FFs */
1253 if (j < 6) { 1302 if (j < 6) {
1254 printk("sddr09: PBA %d has no logical mapping: " 1303 printk(KERN_WARNING
1304 "sddr09: PBA %d has no logical mapping: "
1255 "reserved area = %02X%02X%02X%02X " 1305 "reserved area = %02X%02X%02X%02X "
1256 "data status %02X block status %02X\n", 1306 "data status %02X block status %02X\n",
1257 i, ptr[0], ptr[1], ptr[2], ptr[3], 1307 i, ptr[0], ptr[1], ptr[2], ptr[3],
@@ -1261,7 +1311,8 @@ sddr09_read_map(struct us_data *us) {
1261 } 1311 }
1262 1312
1263 if ((ptr[6] >> 4) != 0x01) { 1313 if ((ptr[6] >> 4) != 0x01) {
1264 printk("sddr09: PBA %d has invalid address field " 1314 printk(KERN_WARNING
1315 "sddr09: PBA %d has invalid address field "
1265 "%02X%02X/%02X%02X\n", 1316 "%02X%02X/%02X%02X\n",
1266 i, ptr[6], ptr[7], ptr[11], ptr[12]); 1317 i, ptr[6], ptr[7], ptr[11], ptr[12]);
1267 info->pba_to_lba[i] = UNUSABLE; 1318 info->pba_to_lba[i] = UNUSABLE;
@@ -1270,7 +1321,8 @@ sddr09_read_map(struct us_data *us) {
1270 1321
1271 /* check even parity */ 1322 /* check even parity */
1272 if (parity[ptr[6] ^ ptr[7]]) { 1323 if (parity[ptr[6] ^ ptr[7]]) {
1273 printk("sddr09: Bad parity in LBA for block %d" 1324 printk(KERN_WARNING
1325 "sddr09: Bad parity in LBA for block %d"
1274 " (%02X %02X)\n", i, ptr[6], ptr[7]); 1326 " (%02X %02X)\n", i, ptr[6], ptr[7]);
1275 info->pba_to_lba[i] = UNUSABLE; 1327 info->pba_to_lba[i] = UNUSABLE;
1276 continue; 1328 continue;
@@ -1289,7 +1341,8 @@ sddr09_read_map(struct us_data *us) {
1289 */ 1341 */
1290 1342
1291 if (lba >= 1000) { 1343 if (lba >= 1000) {
1292 printk("sddr09: Bad low LBA %d for block %d\n", 1344 printk(KERN_WARNING
1345 "sddr09: Bad low LBA %d for block %d\n",
1293 lba, i); 1346 lba, i);
1294 goto possibly_erase; 1347 goto possibly_erase;
1295 } 1348 }
@@ -1297,7 +1350,8 @@ sddr09_read_map(struct us_data *us) {
1297 lba += 1000*(i/0x400); 1350 lba += 1000*(i/0x400);
1298 1351
1299 if (info->lba_to_pba[lba] != UNDEF) { 1352 if (info->lba_to_pba[lba] != UNDEF) {
1300 printk("sddr09: LBA %d seen for PBA %d and %d\n", 1353 printk(KERN_WARNING
1354 "sddr09: LBA %d seen for PBA %d and %d\n",
1301 lba, info->lba_to_pba[lba], i); 1355 lba, info->lba_to_pba[lba], i);
1302 goto possibly_erase; 1356 goto possibly_erase;
1303 } 1357 }
@@ -1399,7 +1453,7 @@ sddr09_common_init(struct us_data *us) {
1399 * unusual devices list but called from here then LUN 0 of the combo reader 1453 * unusual devices list but called from here then LUN 0 of the combo reader
1400 * is not recognized. But I do not know what precisely these calls do. 1454 * is not recognized. But I do not know what precisely these calls do.
1401 */ 1455 */
1402int 1456static int
1403usb_stor_sddr09_dpcm_init(struct us_data *us) { 1457usb_stor_sddr09_dpcm_init(struct us_data *us) {
1404 int result; 1458 int result;
1405 unsigned char *data = us->iobuf; 1459 unsigned char *data = us->iobuf;
@@ -1449,7 +1503,7 @@ usb_stor_sddr09_dpcm_init(struct us_data *us) {
1449/* 1503/*
1450 * Transport for the Microtech DPCM-USB 1504 * Transport for the Microtech DPCM-USB
1451 */ 1505 */
1452int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us) 1506static int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us)
1453{ 1507{
1454 int ret; 1508 int ret;
1455 1509
@@ -1491,7 +1545,7 @@ int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us)
1491/* 1545/*
1492 * Transport for the Sandisk SDDR-09 1546 * Transport for the Sandisk SDDR-09
1493 */ 1547 */
1494int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us) 1548static int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us)
1495{ 1549{
1496 static unsigned char sensekey = 0, sensecode = 0; 1550 static unsigned char sensekey = 0, sensecode = 0;
1497 static unsigned char havefakesense = 0; 1551 static unsigned char havefakesense = 0;
@@ -1690,7 +1744,60 @@ int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us)
1690/* 1744/*
1691 * Initialization routine for the sddr09 subdriver 1745 * Initialization routine for the sddr09 subdriver
1692 */ 1746 */
1693int 1747static int
1694usb_stor_sddr09_init(struct us_data *us) { 1748usb_stor_sddr09_init(struct us_data *us) {
1695 return sddr09_common_init(us); 1749 return sddr09_common_init(us);
1696} 1750}
1751
1752static int sddr09_probe(struct usb_interface *intf,
1753 const struct usb_device_id *id)
1754{
1755 struct us_data *us;
1756 int result;
1757
1758 result = usb_stor_probe1(&us, intf, id,
1759 (id - sddr09_usb_ids) + sddr09_unusual_dev_list);
1760 if (result)
1761 return result;
1762
1763 if (us->protocol == US_PR_DPCM_USB) {
1764 us->transport_name = "Control/Bulk-EUSB/SDDR09";
1765 us->transport = dpcm_transport;
1766 us->transport_reset = usb_stor_CB_reset;
1767 us->max_lun = 1;
1768 } else {
1769 us->transport_name = "EUSB/SDDR09";
1770 us->transport = sddr09_transport;
1771 us->transport_reset = usb_stor_CB_reset;
1772 us->max_lun = 0;
1773 }
1774
1775 result = usb_stor_probe2(us);
1776 return result;
1777}
1778
1779static struct usb_driver sddr09_driver = {
1780 .name = "ums-sddr09",
1781 .probe = sddr09_probe,
1782 .disconnect = usb_stor_disconnect,
1783 .suspend = usb_stor_suspend,
1784 .resume = usb_stor_resume,
1785 .reset_resume = usb_stor_reset_resume,
1786 .pre_reset = usb_stor_pre_reset,
1787 .post_reset = usb_stor_post_reset,
1788 .id_table = sddr09_usb_ids,
1789 .soft_unbind = 1,
1790};
1791
1792static int __init sddr09_init(void)
1793{
1794 return usb_register(&sddr09_driver);
1795}
1796
1797static void __exit sddr09_exit(void)
1798{
1799 usb_deregister(&sddr09_driver);
1800}
1801
1802module_init(sddr09_init);
1803module_exit(sddr09_exit);
diff --git a/drivers/usb/storage/sddr09.h b/drivers/usb/storage/sddr09.h
deleted file mode 100644
index b701172e12e3..000000000000
--- a/drivers/usb/storage/sddr09.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/* Driver for SanDisk SDDR-09 SmartMedia reader
2 * Header File
3 *
4 * Current development and maintenance by:
5 * (c) 2000 Robert Baruch (autophile@dol.net)
6 * (c) 2002 Andries Brouwer (aeb@cwi.nl)
7 *
8 * See sddr09.c for more explanation
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2, or (at your option) any
13 * later version.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
25#ifndef _USB_SHUTTLE_EUSB_SDDR09_H
26#define _USB_SHUTTLE_EUSB_SDDR09_H
27
28/* Sandisk SDDR-09 stuff */
29
30extern int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us);
31extern int usb_stor_sddr09_init(struct us_data *us);
32
33/* Microtech DPCM-USB stuff */
34
35extern int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us);
36extern int usb_stor_sddr09_dpcm_init(struct us_data *us);
37
38#endif
diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c
index 0d8df7577899..44dfed7754ed 100644
--- a/drivers/usb/storage/sddr55.c
+++ b/drivers/usb/storage/sddr55.c
@@ -24,6 +24,7 @@
24 24
25#include <linux/jiffies.h> 25#include <linux/jiffies.h>
26#include <linux/errno.h> 26#include <linux/errno.h>
27#include <linux/module.h>
27#include <linux/slab.h> 28#include <linux/slab.h>
28 29
29#include <scsi/scsi.h> 30#include <scsi/scsi.h>
@@ -33,7 +34,48 @@
33#include "transport.h" 34#include "transport.h"
34#include "protocol.h" 35#include "protocol.h"
35#include "debug.h" 36#include "debug.h"
36#include "sddr55.h" 37
38MODULE_DESCRIPTION("Driver for SanDisk SDDR-55 SmartMedia reader");
39MODULE_AUTHOR("Simon Munton");
40MODULE_LICENSE("GPL");
41
42/*
43 * The table of devices
44 */
45#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
46 vendorName, productName, useProtocol, useTransport, \
47 initFunction, flags) \
48{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
49 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
50
51struct usb_device_id sddr55_usb_ids[] = {
52# include "unusual_sddr55.h"
53 { } /* Terminating entry */
54};
55MODULE_DEVICE_TABLE(usb, sddr55_usb_ids);
56
57#undef UNUSUAL_DEV
58
59/*
60 * The flags table
61 */
62#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
63 vendor_name, product_name, use_protocol, use_transport, \
64 init_function, Flags) \
65{ \
66 .vendorName = vendor_name, \
67 .productName = product_name, \
68 .useProtocol = use_protocol, \
69 .useTransport = use_transport, \
70 .initFunction = init_function, \
71}
72
73static struct us_unusual_dev sddr55_unusual_dev_list[] = {
74# include "unusual_sddr55.h"
75 { } /* Terminating entry */
76};
77
78#undef UNUSUAL_DEV
37 79
38 80
39#define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) ) 81#define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) )
@@ -513,7 +555,8 @@ static int sddr55_read_deviceID(struct us_data *us,
513} 555}
514 556
515 557
516int sddr55_reset(struct us_data *us) { 558static int sddr55_reset(struct us_data *us)
559{
517 return 0; 560 return 0;
518} 561}
519 562
@@ -703,7 +746,9 @@ static int sddr55_read_map(struct us_data *us) {
703 746
704 if (info->lba_to_pba[lba + zone * 1000] != NOT_ALLOCATED && 747 if (info->lba_to_pba[lba + zone * 1000] != NOT_ALLOCATED &&
705 !info->force_read_only) { 748 !info->force_read_only) {
706 printk("sddr55: map inconsistency at LBA %04X\n", lba + zone * 1000); 749 printk(KERN_WARNING
750 "sddr55: map inconsistency at LBA %04X\n",
751 lba + zone * 1000);
707 info->force_read_only = 1; 752 info->force_read_only = 1;
708 } 753 }
709 754
@@ -732,7 +777,7 @@ static void sddr55_card_info_destructor(void *extra) {
732/* 777/*
733 * Transport for the Sandisk SDDR-55 778 * Transport for the Sandisk SDDR-55
734 */ 779 */
735int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us) 780static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
736{ 781{
737 int result; 782 int result;
738 static unsigned char inquiry_response[8] = { 783 static unsigned char inquiry_response[8] = {
@@ -929,3 +974,49 @@ int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
929 return USB_STOR_TRANSPORT_FAILED; // FIXME: sense buffer? 974 return USB_STOR_TRANSPORT_FAILED; // FIXME: sense buffer?
930} 975}
931 976
977
978static int sddr55_probe(struct usb_interface *intf,
979 const struct usb_device_id *id)
980{
981 struct us_data *us;
982 int result;
983
984 result = usb_stor_probe1(&us, intf, id,
985 (id - sddr55_usb_ids) + sddr55_unusual_dev_list);
986 if (result)
987 return result;
988
989 us->transport_name = "SDDR55";
990 us->transport = sddr55_transport;
991 us->transport_reset = sddr55_reset;
992 us->max_lun = 0;
993
994 result = usb_stor_probe2(us);
995 return result;
996}
997
998static struct usb_driver sddr55_driver = {
999 .name = "ums-sddr55",
1000 .probe = sddr55_probe,
1001 .disconnect = usb_stor_disconnect,
1002 .suspend = usb_stor_suspend,
1003 .resume = usb_stor_resume,
1004 .reset_resume = usb_stor_reset_resume,
1005 .pre_reset = usb_stor_pre_reset,
1006 .post_reset = usb_stor_post_reset,
1007 .id_table = sddr55_usb_ids,
1008 .soft_unbind = 1,
1009};
1010
1011static int __init sddr55_init(void)
1012{
1013 return usb_register(&sddr55_driver);
1014}
1015
1016static void __exit sddr55_exit(void)
1017{
1018 usb_deregister(&sddr55_driver);
1019}
1020
1021module_init(sddr55_init);
1022module_exit(sddr55_exit);
diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c
index ae6d64810d2a..b62a28814ebe 100644
--- a/drivers/usb/storage/shuttle_usbat.c
+++ b/drivers/usb/storage/shuttle_usbat.c
@@ -42,6 +42,7 @@
42 */ 42 */
43 43
44#include <linux/errno.h> 44#include <linux/errno.h>
45#include <linux/module.h>
45#include <linux/slab.h> 46#include <linux/slab.h>
46#include <linux/cdrom.h> 47#include <linux/cdrom.h>
47 48
@@ -52,7 +53,100 @@
52#include "transport.h" 53#include "transport.h"
53#include "protocol.h" 54#include "protocol.h"
54#include "debug.h" 55#include "debug.h"
55#include "shuttle_usbat.h" 56
57MODULE_DESCRIPTION("Driver for SCM Microsystems (a.k.a. Shuttle) USB-ATAPI cable");
58MODULE_AUTHOR("Daniel Drake <dsd@gentoo.org>, Robert Baruch <autophile@starband.net>");
59MODULE_LICENSE("GPL");
60
61/* Supported device types */
62#define USBAT_DEV_HP8200 0x01
63#define USBAT_DEV_FLASH 0x02
64
65#define USBAT_EPP_PORT 0x10
66#define USBAT_EPP_REGISTER 0x30
67#define USBAT_ATA 0x40
68#define USBAT_ISA 0x50
69
70/* Commands (need to be logically OR'd with an access type */
71#define USBAT_CMD_READ_REG 0x00
72#define USBAT_CMD_WRITE_REG 0x01
73#define USBAT_CMD_READ_BLOCK 0x02
74#define USBAT_CMD_WRITE_BLOCK 0x03
75#define USBAT_CMD_COND_READ_BLOCK 0x04
76#define USBAT_CMD_COND_WRITE_BLOCK 0x05
77#define USBAT_CMD_WRITE_REGS 0x07
78
79/* Commands (these don't need an access type) */
80#define USBAT_CMD_EXEC_CMD 0x80
81#define USBAT_CMD_SET_FEAT 0x81
82#define USBAT_CMD_UIO 0x82
83
84/* Methods of accessing UIO register */
85#define USBAT_UIO_READ 1
86#define USBAT_UIO_WRITE 0
87
88/* Qualifier bits */
89#define USBAT_QUAL_FCQ 0x20 /* full compare */
90#define USBAT_QUAL_ALQ 0x10 /* auto load subcount */
91
92/* USBAT Flash Media status types */
93#define USBAT_FLASH_MEDIA_NONE 0
94#define USBAT_FLASH_MEDIA_CF 1
95
96/* USBAT Flash Media change types */
97#define USBAT_FLASH_MEDIA_SAME 0
98#define USBAT_FLASH_MEDIA_CHANGED 1
99
100/* USBAT ATA registers */
101#define USBAT_ATA_DATA 0x10 /* read/write data (R/W) */
102#define USBAT_ATA_FEATURES 0x11 /* set features (W) */
103#define USBAT_ATA_ERROR 0x11 /* error (R) */
104#define USBAT_ATA_SECCNT 0x12 /* sector count (R/W) */
105#define USBAT_ATA_SECNUM 0x13 /* sector number (R/W) */
106#define USBAT_ATA_LBA_ME 0x14 /* cylinder low (R/W) */
107#define USBAT_ATA_LBA_HI 0x15 /* cylinder high (R/W) */
108#define USBAT_ATA_DEVICE 0x16 /* head/device selection (R/W) */
109#define USBAT_ATA_STATUS 0x17 /* device status (R) */
110#define USBAT_ATA_CMD 0x17 /* device command (W) */
111#define USBAT_ATA_ALTSTATUS 0x0E /* status (no clear IRQ) (R) */
112
113/* USBAT User I/O Data registers */
114#define USBAT_UIO_EPAD 0x80 /* Enable Peripheral Control Signals */
115#define USBAT_UIO_CDT 0x40 /* Card Detect (Read Only) */
116 /* CDT = ACKD & !UI1 & !UI0 */
117#define USBAT_UIO_1 0x20 /* I/O 1 */
118#define USBAT_UIO_0 0x10 /* I/O 0 */
119#define USBAT_UIO_EPP_ATA 0x08 /* 1=EPP mode, 0=ATA mode */
120#define USBAT_UIO_UI1 0x04 /* Input 1 */
121#define USBAT_UIO_UI0 0x02 /* Input 0 */
122#define USBAT_UIO_INTR_ACK 0x01 /* Interrupt (ATA/ISA)/Acknowledge (EPP) */
123
124/* USBAT User I/O Enable registers */
125#define USBAT_UIO_DRVRST 0x80 /* Reset Peripheral */
126#define USBAT_UIO_ACKD 0x40 /* Enable Card Detect */
127#define USBAT_UIO_OE1 0x20 /* I/O 1 set=output/clr=input */
128 /* If ACKD=1, set OE1 to 1 also. */
129#define USBAT_UIO_OE0 0x10 /* I/O 0 set=output/clr=input */
130#define USBAT_UIO_ADPRST 0x01 /* Reset SCM chip */
131
132/* USBAT Features */
133#define USBAT_FEAT_ETEN 0x80 /* External trigger enable */
134#define USBAT_FEAT_U1 0x08
135#define USBAT_FEAT_U0 0x04
136#define USBAT_FEAT_ET1 0x02
137#define USBAT_FEAT_ET2 0x01
138
139struct usbat_info {
140 int devicetype;
141
142 /* Used for Flash readers only */
143 unsigned long sectors; /* total sector count */
144 unsigned long ssize; /* sector size in bytes */
145
146 unsigned char sense_key;
147 unsigned long sense_asc; /* additional sense code */
148 unsigned long sense_ascq; /* additional sense code qualifier */
149};
56 150
57#define short_pack(LSB,MSB) ( ((u16)(LSB)) | ( ((u16)(MSB))<<8 ) ) 151#define short_pack(LSB,MSB) ( ((u16)(LSB)) | ( ((u16)(MSB))<<8 ) )
58#define LSB_of(s) ((s)&0xFF) 152#define LSB_of(s) ((s)&0xFF)
@@ -63,6 +157,48 @@ static int transferred = 0;
63static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us); 157static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us);
64static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us); 158static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us);
65 159
160static int init_usbat_cd(struct us_data *us);
161static int init_usbat_flash(struct us_data *us);
162
163
164/*
165 * The table of devices
166 */
167#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
168 vendorName, productName, useProtocol, useTransport, \
169 initFunction, flags) \
170{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
171 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
172
173struct usb_device_id usbat_usb_ids[] = {
174# include "unusual_usbat.h"
175 { } /* Terminating entry */
176};
177MODULE_DEVICE_TABLE(usb, usbat_usb_ids);
178
179#undef UNUSUAL_DEV
180
181/*
182 * The flags table
183 */
184#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
185 vendor_name, product_name, use_protocol, use_transport, \
186 init_function, Flags) \
187{ \
188 .vendorName = vendor_name, \
189 .productName = product_name, \
190 .useProtocol = use_protocol, \
191 .useTransport = use_transport, \
192 .initFunction = init_function, \
193}
194
195static struct us_unusual_dev usbat_unusual_dev_list[] = {
196# include "unusual_usbat.h"
197 { } /* Terminating entry */
198};
199
200#undef UNUSUAL_DEV
201
66/* 202/*
67 * Convenience function to produce an ATA read/write sectors command 203 * Convenience function to produce an ATA read/write sectors command
68 * Use cmd=0x20 for read, cmd=0x30 for write 204 * Use cmd=0x20 for read, cmd=0x30 for write
@@ -1684,37 +1820,61 @@ static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us)
1684 return USB_STOR_TRANSPORT_FAILED; 1820 return USB_STOR_TRANSPORT_FAILED;
1685} 1821}
1686 1822
1687int init_usbat_cd(struct us_data *us) 1823static int init_usbat_cd(struct us_data *us)
1688{ 1824{
1689 return init_usbat(us, USBAT_DEV_HP8200); 1825 return init_usbat(us, USBAT_DEV_HP8200);
1690} 1826}
1691 1827
1692 1828static int init_usbat_flash(struct us_data *us)
1693int init_usbat_flash(struct us_data *us)
1694{ 1829{
1695 return init_usbat(us, USBAT_DEV_FLASH); 1830 return init_usbat(us, USBAT_DEV_FLASH);
1696} 1831}
1697 1832
1698int init_usbat_probe(struct us_data *us) 1833static int usbat_probe(struct usb_interface *intf,
1834 const struct usb_device_id *id)
1699{ 1835{
1700 return init_usbat(us, 0); 1836 struct us_data *us;
1837 int result;
1838
1839 result = usb_stor_probe1(&us, intf, id,
1840 (id - usbat_usb_ids) + usbat_unusual_dev_list);
1841 if (result)
1842 return result;
1843
1844 /* The actual transport will be determined later by the
1845 * initialization routine; this is just a placeholder.
1846 */
1847 us->transport_name = "Shuttle USBAT";
1848 us->transport = usbat_flash_transport;
1849 us->transport_reset = usb_stor_CB_reset;
1850 us->max_lun = 1;
1851
1852 result = usb_stor_probe2(us);
1853 return result;
1701} 1854}
1702 1855
1703/* 1856static struct usb_driver usbat_driver = {
1704 * Default transport function. Attempts to detect which transport function 1857 .name = "ums-usbat",
1705 * should be called, makes it the new default, and calls it. 1858 .probe = usbat_probe,
1706 * 1859 .disconnect = usb_stor_disconnect,
1707 * This function should never be called. Our usbat_init() function detects the 1860 .suspend = usb_stor_suspend,
1708 * device type and changes the us->transport ptr to the transport function 1861 .resume = usb_stor_resume,
1709 * relevant to the device. 1862 .reset_resume = usb_stor_reset_resume,
1710 * However, we'll support this impossible(?) case anyway. 1863 .pre_reset = usb_stor_pre_reset,
1711 */ 1864 .post_reset = usb_stor_post_reset,
1712int usbat_transport(struct scsi_cmnd *srb, struct us_data *us) 1865 .id_table = usbat_usb_ids,
1866 .soft_unbind = 1,
1867};
1868
1869static int __init usbat_init(void)
1713{ 1870{
1714 struct usbat_info *info = (struct usbat_info*) (us->extra); 1871 return usb_register(&usbat_driver);
1715 1872}
1716 if (usbat_set_transport(us, info, 0))
1717 return USB_STOR_TRANSPORT_ERROR;
1718 1873
1719 return us->transport(srb, us); 1874static void __exit usbat_exit(void)
1875{
1876 usb_deregister(&usbat_driver);
1720} 1877}
1878
1879module_init(usbat_init);
1880module_exit(usbat_exit);
diff --git a/drivers/usb/storage/shuttle_usbat.h b/drivers/usb/storage/shuttle_usbat.h
deleted file mode 100644
index d8bfc43e9044..000000000000
--- a/drivers/usb/storage/shuttle_usbat.h
+++ /dev/null
@@ -1,123 +0,0 @@
1/* Driver for SCM Microsystems USB-ATAPI cable
2 * Header File
3 *
4 * Current development and maintenance by:
5 * (c) 2000 Robert Baruch (autophile@dol.net)
6 * (c) 2004, 2005 Daniel Drake <dsd@gentoo.org>
7 *
8 * See shuttle_usbat.c for more explanation
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2, or (at your option) any
13 * later version.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
25#ifndef _USB_SHUTTLE_USBAT_H
26#define _USB_SHUTTLE_USBAT_H
27
28/* Supported device types */
29#define USBAT_DEV_HP8200 0x01
30#define USBAT_DEV_FLASH 0x02
31
32#define USBAT_EPP_PORT 0x10
33#define USBAT_EPP_REGISTER 0x30
34#define USBAT_ATA 0x40
35#define USBAT_ISA 0x50
36
37/* Commands (need to be logically OR'd with an access type */
38#define USBAT_CMD_READ_REG 0x00
39#define USBAT_CMD_WRITE_REG 0x01
40#define USBAT_CMD_READ_BLOCK 0x02
41#define USBAT_CMD_WRITE_BLOCK 0x03
42#define USBAT_CMD_COND_READ_BLOCK 0x04
43#define USBAT_CMD_COND_WRITE_BLOCK 0x05
44#define USBAT_CMD_WRITE_REGS 0x07
45
46/* Commands (these don't need an access type) */
47#define USBAT_CMD_EXEC_CMD 0x80
48#define USBAT_CMD_SET_FEAT 0x81
49#define USBAT_CMD_UIO 0x82
50
51/* Methods of accessing UIO register */
52#define USBAT_UIO_READ 1
53#define USBAT_UIO_WRITE 0
54
55/* Qualifier bits */
56#define USBAT_QUAL_FCQ 0x20 /* full compare */
57#define USBAT_QUAL_ALQ 0x10 /* auto load subcount */
58
59/* USBAT Flash Media status types */
60#define USBAT_FLASH_MEDIA_NONE 0
61#define USBAT_FLASH_MEDIA_CF 1
62
63/* USBAT Flash Media change types */
64#define USBAT_FLASH_MEDIA_SAME 0
65#define USBAT_FLASH_MEDIA_CHANGED 1
66
67/* USBAT ATA registers */
68#define USBAT_ATA_DATA 0x10 /* read/write data (R/W) */
69#define USBAT_ATA_FEATURES 0x11 /* set features (W) */
70#define USBAT_ATA_ERROR 0x11 /* error (R) */
71#define USBAT_ATA_SECCNT 0x12 /* sector count (R/W) */
72#define USBAT_ATA_SECNUM 0x13 /* sector number (R/W) */
73#define USBAT_ATA_LBA_ME 0x14 /* cylinder low (R/W) */
74#define USBAT_ATA_LBA_HI 0x15 /* cylinder high (R/W) */
75#define USBAT_ATA_DEVICE 0x16 /* head/device selection (R/W) */
76#define USBAT_ATA_STATUS 0x17 /* device status (R) */
77#define USBAT_ATA_CMD 0x17 /* device command (W) */
78#define USBAT_ATA_ALTSTATUS 0x0E /* status (no clear IRQ) (R) */
79
80/* USBAT User I/O Data registers */
81#define USBAT_UIO_EPAD 0x80 /* Enable Peripheral Control Signals */
82#define USBAT_UIO_CDT 0x40 /* Card Detect (Read Only) */
83 /* CDT = ACKD & !UI1 & !UI0 */
84#define USBAT_UIO_1 0x20 /* I/O 1 */
85#define USBAT_UIO_0 0x10 /* I/O 0 */
86#define USBAT_UIO_EPP_ATA 0x08 /* 1=EPP mode, 0=ATA mode */
87#define USBAT_UIO_UI1 0x04 /* Input 1 */
88#define USBAT_UIO_UI0 0x02 /* Input 0 */
89#define USBAT_UIO_INTR_ACK 0x01 /* Interrupt (ATA/ISA)/Acknowledge (EPP) */
90
91/* USBAT User I/O Enable registers */
92#define USBAT_UIO_DRVRST 0x80 /* Reset Peripheral */
93#define USBAT_UIO_ACKD 0x40 /* Enable Card Detect */
94#define USBAT_UIO_OE1 0x20 /* I/O 1 set=output/clr=input */
95 /* If ACKD=1, set OE1 to 1 also. */
96#define USBAT_UIO_OE0 0x10 /* I/O 0 set=output/clr=input */
97#define USBAT_UIO_ADPRST 0x01 /* Reset SCM chip */
98
99/* USBAT Features */
100#define USBAT_FEAT_ETEN 0x80 /* External trigger enable */
101#define USBAT_FEAT_U1 0x08
102#define USBAT_FEAT_U0 0x04
103#define USBAT_FEAT_ET1 0x02
104#define USBAT_FEAT_ET2 0x01
105
106extern int usbat_transport(struct scsi_cmnd *srb, struct us_data *us);
107extern int init_usbat_cd(struct us_data *us);
108extern int init_usbat_flash(struct us_data *us);
109extern int init_usbat_probe(struct us_data *us);
110
111struct usbat_info {
112 int devicetype;
113
114 /* Used for Flash readers only */
115 unsigned long sectors; /* total sector count */
116 unsigned long ssize; /* sector size in bytes */
117
118 unsigned char sense_key;
119 unsigned long sense_asc; /* additional sense code */
120 unsigned long sense_ascq; /* additional sense code qualifier */
121};
122
123#endif
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index fb65d221cedf..d48c8553539d 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -220,6 +220,7 @@ int usb_stor_control_msg(struct us_data *us, unsigned int pipe,
220 status = us->current_urb->actual_length; 220 status = us->current_urb->actual_length;
221 return status; 221 return status;
222} 222}
223EXPORT_SYMBOL_GPL(usb_stor_control_msg);
223 224
224/* This is a version of usb_clear_halt() that allows early termination and 225/* This is a version of usb_clear_halt() that allows early termination and
225 * doesn't read the status from the device -- this is because some devices 226 * doesn't read the status from the device -- this is because some devices
@@ -254,6 +255,7 @@ int usb_stor_clear_halt(struct us_data *us, unsigned int pipe)
254 US_DEBUGP("%s: result = %d\n", __func__, result); 255 US_DEBUGP("%s: result = %d\n", __func__, result);
255 return result; 256 return result;
256} 257}
258EXPORT_SYMBOL_GPL(usb_stor_clear_halt);
257 259
258 260
259/* 261/*
@@ -352,6 +354,7 @@ int usb_stor_ctrl_transfer(struct us_data *us, unsigned int pipe,
352 return interpret_urb_result(us, pipe, size, result, 354 return interpret_urb_result(us, pipe, size, result,
353 us->current_urb->actual_length); 355 us->current_urb->actual_length);
354} 356}
357EXPORT_SYMBOL_GPL(usb_stor_ctrl_transfer);
355 358
356/* 359/*
357 * Receive one interrupt buffer, without timeouts, but allowing early 360 * Receive one interrupt buffer, without timeouts, but allowing early
@@ -407,6 +410,7 @@ int usb_stor_bulk_transfer_buf(struct us_data *us, unsigned int pipe,
407 return interpret_urb_result(us, pipe, length, result, 410 return interpret_urb_result(us, pipe, length, result,
408 us->current_urb->actual_length); 411 us->current_urb->actual_length);
409} 412}
413EXPORT_SYMBOL_GPL(usb_stor_bulk_transfer_buf);
410 414
411/* 415/*
412 * Transfer a scatter-gather list via bulk transfer 416 * Transfer a scatter-gather list via bulk transfer
@@ -474,6 +478,7 @@ int usb_stor_bulk_srb(struct us_data* us, unsigned int pipe,
474 scsi_set_resid(srb, scsi_bufflen(srb) - partial); 478 scsi_set_resid(srb, scsi_bufflen(srb) - partial);
475 return result; 479 return result;
476} 480}
481EXPORT_SYMBOL_GPL(usb_stor_bulk_srb);
477 482
478/* 483/*
479 * Transfer an entire SCSI command's worth of data payload over the bulk 484 * Transfer an entire SCSI command's worth of data payload over the bulk
@@ -509,6 +514,7 @@ int usb_stor_bulk_transfer_sg(struct us_data* us, unsigned int pipe,
509 *residual = length_left; 514 *residual = length_left;
510 return result; 515 return result;
511} 516}
517EXPORT_SYMBOL_GPL(usb_stor_bulk_transfer_sg);
512 518
513/*********************************************************************** 519/***********************************************************************
514 * Transport routines 520 * Transport routines
@@ -940,6 +946,7 @@ int usb_stor_CB_transport(struct scsi_cmnd *srb, struct us_data *us)
940 usb_stor_clear_halt(us, pipe); 946 usb_stor_clear_halt(us, pipe);
941 return USB_STOR_TRANSPORT_FAILED; 947 return USB_STOR_TRANSPORT_FAILED;
942} 948}
949EXPORT_SYMBOL_GPL(usb_stor_CB_transport);
943 950
944/* 951/*
945 * Bulk only transport 952 * Bulk only transport
@@ -1156,6 +1163,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us)
1156 /* we should never get here, but if we do, we're in trouble */ 1163 /* we should never get here, but if we do, we're in trouble */
1157 return USB_STOR_TRANSPORT_ERROR; 1164 return USB_STOR_TRANSPORT_ERROR;
1158} 1165}
1166EXPORT_SYMBOL_GPL(usb_stor_Bulk_transport);
1159 1167
1160/*********************************************************************** 1168/***********************************************************************
1161 * Reset routines 1169 * Reset routines
@@ -1230,6 +1238,7 @@ int usb_stor_CB_reset(struct us_data *us)
1230 USB_TYPE_CLASS | USB_RECIP_INTERFACE, 1238 USB_TYPE_CLASS | USB_RECIP_INTERFACE,
1231 0, us->ifnum, us->iobuf, CB_RESET_CMD_SIZE); 1239 0, us->ifnum, us->iobuf, CB_RESET_CMD_SIZE);
1232} 1240}
1241EXPORT_SYMBOL_GPL(usb_stor_CB_reset);
1233 1242
1234/* This issues a Bulk-only Reset to the device in question, including 1243/* This issues a Bulk-only Reset to the device in question, including
1235 * clearing the subsequent endpoint halts that may occur. 1244 * clearing the subsequent endpoint halts that may occur.
@@ -1242,6 +1251,7 @@ int usb_stor_Bulk_reset(struct us_data *us)
1242 USB_TYPE_CLASS | USB_RECIP_INTERFACE, 1251 USB_TYPE_CLASS | USB_RECIP_INTERFACE,
1243 0, us->ifnum, NULL, 0); 1252 0, us->ifnum, NULL, 0);
1244} 1253}
1254EXPORT_SYMBOL_GPL(usb_stor_Bulk_reset);
1245 1255
1246/* Issue a USB port reset to the device. The caller must not hold 1256/* Issue a USB port reset to the device. The caller must not hold
1247 * us->dev_mutex. 1257 * us->dev_mutex.
diff --git a/drivers/usb/storage/freecom.h b/drivers/usb/storage/unusual_alauda.h
index 20d0fe6ba0c8..8c412f885dd2 100644
--- a/drivers/usb/storage/freecom.h
+++ b/drivers/usb/storage/unusual_alauda.h
@@ -1,13 +1,4 @@
1/* Driver for Freecom USB/IDE adaptor 1/* Unusual Devices File for the Alauda-based card readers
2 *
3 * Freecom v0.1:
4 *
5 * First release
6 *
7 * Current development and maintenance by:
8 * (c) 2000 David Brown <usb-storage@davidb.org>
9 *
10 * See freecom.c for more explanation
11 * 2 *
12 * This program is free software; you can redistribute it and/or modify it 3 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the 4 * under the terms of the GNU General Public License as published by the
@@ -24,11 +15,17 @@
24 * 675 Mass Ave, Cambridge, MA 02139, USA. 15 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 */ 16 */
26 17
27#ifndef _FREECOM_USB_H 18#if defined(CONFIG_USB_STORAGE_ALAUDA) || \
28#define _FREECOM_USB_H 19 defined(CONFIG_USB_STORAGE_ALAUDA_MODULE)
20
21UNUSUAL_DEV( 0x0584, 0x0008, 0x0102, 0x0102,
22 "Fujifilm",
23 "DPC-R1 (Alauda)",
24 US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0),
29 25
30extern int freecom_transport(struct scsi_cmnd *srb, struct us_data *us); 26UNUSUAL_DEV( 0x07b4, 0x010a, 0x0102, 0x0102,
31extern int usb_stor_freecom_reset(struct us_data *us); 27 "Olympus",
32extern int freecom_init (struct us_data *us); 28 "MAUSB-10 (Alauda)",
29 US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0),
33 30
34#endif 31#endif /* defined(CONFIG_USB_STORAGE_ALAUDA) || ... */
diff --git a/drivers/usb/storage/unusual_cypress.h b/drivers/usb/storage/unusual_cypress.h
new file mode 100644
index 000000000000..44be6d75dab6
--- /dev/null
+++ b/drivers/usb/storage/unusual_cypress.h
@@ -0,0 +1,34 @@
1/* Unusual Devices File for devices based on the Cypress USB/ATA bridge
2 * with support for ATACB
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2, or (at your option) any
7 * later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#if defined(CONFIG_USB_STORAGE_CYPRESS_ATACB) || \
20 defined(CONFIG_USB_STORAGE_CYPRESS_ATACB_MODULE)
21
22/* CY7C68300 : support atacb */
23UNUSUAL_DEV( 0x04b4, 0x6830, 0x0000, 0x9999,
24 "Cypress",
25 "Cypress AT2LP",
26 US_SC_CYP_ATACB, US_PR_DEVICE, NULL, 0),
27
28/* CY7C68310 : support atacb and atacb2 */
29UNUSUAL_DEV( 0x04b4, 0x6831, 0x0000, 0x9999,
30 "Cypress",
31 "Cypress ISD-300LP",
32 US_SC_CYP_ATACB, US_PR_DEVICE, NULL, 0),
33
34#endif /* defined(CONFIG_USB_STORAGE_CYPRESS_ATACB) || ... */
diff --git a/drivers/usb/storage/unusual_datafab.h b/drivers/usb/storage/unusual_datafab.h
new file mode 100644
index 000000000000..c9298ce9f223
--- /dev/null
+++ b/drivers/usb/storage/unusual_datafab.h
@@ -0,0 +1,98 @@
1/* Unusual Devices File for the Datafab USB Compact Flash reader
2 *
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the
5 * Free Software Foundation; either version 2, or (at your option) any
6 * later version.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 675 Mass Ave, Cambridge, MA 02139, USA.
16 */
17
18#if defined(CONFIG_USB_STORAGE_DATAFAB) || \
19 defined(CONFIG_USB_STORAGE_DATAFAB_MODULE)
20
21UNUSUAL_DEV( 0x07c4, 0xa000, 0x0000, 0x0015,
22 "Datafab",
23 "MDCFE-B USB CF Reader",
24 US_SC_SCSI, US_PR_DATAFAB, NULL,
25 0),
26
27/*
28 * The following Datafab-based devices may or may not work
29 * using the current driver...the 0xffff is arbitrary since I
30 * don't know what device versions exist for these guys.
31 *
32 * The 0xa003 and 0xa004 devices in particular I'm curious about.
33 * I'm told they exist but so far nobody has come forward to say that
34 * they work with this driver. Given the success we've had getting
35 * other Datafab-based cards operational with this driver, I've decided
36 * to leave these two devices in the list.
37 */
38UNUSUAL_DEV( 0x07c4, 0xa001, 0x0000, 0xffff,
39 "SIIG/Datafab",
40 "SIIG/Datafab Memory Stick+CF Reader/Writer",
41 US_SC_SCSI, US_PR_DATAFAB, NULL,
42 0),
43
44/* Reported by Josef Reisinger <josef.reisinger@netcologne.de> */
45UNUSUAL_DEV( 0x07c4, 0xa002, 0x0000, 0xffff,
46 "Datafab/Unknown",
47 "MD2/MD3 Disk enclosure",
48 US_SC_SCSI, US_PR_DATAFAB, NULL,
49 US_FL_SINGLE_LUN),
50
51UNUSUAL_DEV( 0x07c4, 0xa003, 0x0000, 0xffff,
52 "Datafab/Unknown",
53 "Datafab-based Reader",
54 US_SC_SCSI, US_PR_DATAFAB, NULL,
55 0),
56
57UNUSUAL_DEV( 0x07c4, 0xa004, 0x0000, 0xffff,
58 "Datafab/Unknown",
59 "Datafab-based Reader",
60 US_SC_SCSI, US_PR_DATAFAB, NULL,
61 0),
62
63UNUSUAL_DEV( 0x07c4, 0xa005, 0x0000, 0xffff,
64 "PNY/Datafab",
65 "PNY/Datafab CF+SM Reader",
66 US_SC_SCSI, US_PR_DATAFAB, NULL,
67 0),
68
69UNUSUAL_DEV( 0x07c4, 0xa006, 0x0000, 0xffff,
70 "Simple Tech/Datafab",
71 "Simple Tech/Datafab CF+SM Reader",
72 US_SC_SCSI, US_PR_DATAFAB, NULL,
73 0),
74
75/* Submitted by Olaf Hering <olh@suse.de> */
76UNUSUAL_DEV( 0x07c4, 0xa109, 0x0000, 0xffff,
77 "Datafab Systems, Inc.",
78 "USB to CF + SM Combo (LC1)",
79 US_SC_SCSI, US_PR_DATAFAB, NULL,
80 0),
81
82/* Reported by Felix Moeller <felix@derklecks.de>
83 * in Germany this is sold by Hama with the productnumber 46952
84 * as "DualSlot CompactFlash(TM) & MStick Drive USB"
85 */
86UNUSUAL_DEV( 0x07c4, 0xa10b, 0x0000, 0xffff,
87 "DataFab Systems Inc.",
88 "USB CF+MS",
89 US_SC_SCSI, US_PR_DATAFAB, NULL,
90 0),
91
92UNUSUAL_DEV( 0x0c0b, 0xa109, 0x0000, 0xffff,
93 "Acomdata",
94 "CF",
95 US_SC_SCSI, US_PR_DATAFAB, NULL,
96 US_FL_SINGLE_LUN),
97
98#endif /* defined(CONFIG_USB_STORAGE_DATAFAB) || ... */
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 6f59c8e510ea..1c1f643e8a78 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -53,6 +53,11 @@
53 * as opposed to devices that do something strangely or wrongly. 53 * as opposed to devices that do something strangely or wrongly.
54 */ 54 */
55 55
56#if !defined(CONFIG_USB_STORAGE_SDDR09) && \
57 !defined(CONFIG_USB_STORAGE_SDDR09_MODULE)
58#define NO_SDDR09
59#endif
60
56/* patch submitted by Vivian Bregier <Vivian.Bregier@imag.fr> 61/* patch submitted by Vivian Bregier <Vivian.Bregier@imag.fr>
57 */ 62 */
58UNUSUAL_DEV( 0x03eb, 0x2002, 0x0100, 0x0100, 63UNUSUAL_DEV( 0x03eb, 0x2002, 0x0100, 0x0100,
@@ -80,18 +85,6 @@ UNUSUAL_DEV( 0x03f0, 0x0107, 0x0200, 0x0200,
80 "CD-Writer+", 85 "CD-Writer+",
81 US_SC_8070, US_PR_CB, NULL, 0), 86 US_SC_8070, US_PR_CB, NULL, 0),
82 87
83#ifdef CONFIG_USB_STORAGE_USBAT
84UNUSUAL_DEV( 0x03f0, 0x0207, 0x0001, 0x0001,
85 "HP",
86 "CD-Writer+ 8200e",
87 US_SC_8070, US_PR_USBAT, init_usbat_cd, 0),
88
89UNUSUAL_DEV( 0x03f0, 0x0307, 0x0001, 0x0001,
90 "HP",
91 "CD-Writer+ CD-4e",
92 US_SC_8070, US_PR_USBAT, init_usbat_cd, 0),
93#endif
94
95/* Reported by Ben Efros <ben@pc-doctor.com> */ 88/* Reported by Ben Efros <ben@pc-doctor.com> */
96UNUSUAL_DEV( 0x03f0, 0x070c, 0x0000, 0x0000, 89UNUSUAL_DEV( 0x03f0, 0x070c, 0x0000, 0x0000,
97 "HP", 90 "HP",
@@ -226,7 +219,7 @@ UNUSUAL_DEV( 0x0421, 0x047c, 0x0370, 0x0610,
226 US_FL_MAX_SECTORS_64 ), 219 US_FL_MAX_SECTORS_64 ),
227 220
228/* Reported by Manuel Osdoba <manuel.osdoba@tu-ilmenau.de> */ 221/* Reported by Manuel Osdoba <manuel.osdoba@tu-ilmenau.de> */
229UNUSUAL_DEV( 0x0421, 0x0492, 0x0452, 0x0452, 222UNUSUAL_DEV( 0x0421, 0x0492, 0x0452, 0x9999,
230 "Nokia", 223 "Nokia",
231 "Nokia 6233", 224 "Nokia 6233",
232 US_SC_DEVICE, US_PR_DEVICE, NULL, 225 US_SC_DEVICE, US_PR_DEVICE, NULL,
@@ -246,12 +239,7 @@ UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210,
246 US_SC_DEVICE, US_PR_DEVICE, NULL, 239 US_SC_DEVICE, US_PR_DEVICE, NULL,
247 US_FL_SINGLE_LUN ), 240 US_FL_SINGLE_LUN ),
248 241
249#ifdef CONFIG_USB_STORAGE_SDDR09 242#ifdef NO_SDDR09
250UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100,
251 "Microtech",
252 "CameraMate (DPCM_USB)",
253 US_SC_SCSI, US_PR_DPCM_USB, NULL, 0 ),
254#else
255UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100, 243UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100,
256 "Microtech", 244 "Microtech",
257 "CameraMate", 245 "CameraMate",
@@ -288,13 +276,6 @@ UNUSUAL_DEV( 0x0457, 0x0151, 0x0100, 0x0100,
288 US_SC_DEVICE, US_PR_DEVICE, NULL, 276 US_SC_DEVICE, US_PR_DEVICE, NULL,
289 US_FL_NOT_LOCKABLE ), 277 US_FL_NOT_LOCKABLE ),
290 278
291#ifdef CONFIG_USB_STORAGE_KARMA
292UNUSUAL_DEV( 0x045a, 0x5210, 0x0101, 0x0101,
293 "Rio",
294 "Rio Karma",
295 US_SC_SCSI, US_PR_KARMA, rio_karma_init, 0),
296#endif
297
298/* Reported by Tamas Kerecsen <kerecsen@bigfoot.com> 279/* Reported by Tamas Kerecsen <kerecsen@bigfoot.com>
299 * Obviously the PROM has not been customized by the VAR; 280 * Obviously the PROM has not been customized by the VAR;
300 * the Vendor and Product string descriptors are: 281 * the Vendor and Product string descriptors are:
@@ -375,22 +356,6 @@ UNUSUAL_DEV( 0x04b3, 0x4001, 0x0110, 0x0110,
375 US_SC_DEVICE, US_PR_CB, NULL, 356 US_SC_DEVICE, US_PR_CB, NULL,
376 US_FL_MAX_SECTORS_MIN), 357 US_FL_MAX_SECTORS_MIN),
377 358
378#ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB
379/* CY7C68300 : support atacb */
380UNUSUAL_DEV( 0x04b4, 0x6830, 0x0000, 0x9999,
381 "Cypress",
382 "Cypress AT2LP",
383 US_SC_CYP_ATACB, US_PR_DEVICE, NULL,
384 0),
385
386/* CY7C68310 : support atacb and atacb2 */
387UNUSUAL_DEV( 0x04b4, 0x6831, 0x0000, 0x9999,
388 "Cypress",
389 "Cypress ISD-300LP",
390 US_SC_CYP_ATACB, US_PR_DEVICE, NULL,
391 0),
392#endif
393
394/* Reported by Simon Levitt <simon@whattf.com> 359/* Reported by Simon Levitt <simon@whattf.com>
395 * This entry needs Sub and Proto fields */ 360 * This entry needs Sub and Proto fields */
396UNUSUAL_DEV( 0x04b8, 0x0601, 0x0100, 0x0100, 361UNUSUAL_DEV( 0x04b8, 0x0601, 0x0100, 0x0100,
@@ -467,20 +432,7 @@ UNUSUAL_DEV( 0x04e6, 0x0002, 0x0100, 0x0100,
467 US_SC_DEVICE, US_PR_DEVICE, usb_stor_euscsi_init, 432 US_SC_DEVICE, US_PR_DEVICE, usb_stor_euscsi_init,
468 US_FL_SCM_MULT_TARG ), 433 US_FL_SCM_MULT_TARG ),
469 434
470#ifdef CONFIG_USB_STORAGE_SDDR09 435#ifdef NO_SDDR09
471UNUSUAL_DEV( 0x04e6, 0x0003, 0x0000, 0x9999,
472 "Sandisk",
473 "ImageMate SDDR09",
474 US_SC_SCSI, US_PR_EUSB_SDDR09, usb_stor_sddr09_init,
475 0),
476
477/* This entry is from Andries.Brouwer@cwi.nl */
478UNUSUAL_DEV( 0x04e6, 0x0005, 0x0100, 0x0208,
479 "SCM Microsystems",
480 "eUSB SmartMedia / CompactFlash Adapter",
481 US_SC_SCSI, US_PR_DPCM_USB, usb_stor_sddr09_dpcm_init,
482 0),
483#else
484UNUSUAL_DEV( 0x04e6, 0x0005, 0x0100, 0x0208, 436UNUSUAL_DEV( 0x04e6, 0x0005, 0x0100, 0x0208,
485 "SCM Microsystems", 437 "SCM Microsystems",
486 "eUSB CompactFlash Adapter", 438 "eUSB CompactFlash Adapter",
@@ -535,14 +487,6 @@ UNUSUAL_DEV( 0x04e6, 0x0101, 0x0200, 0x0200,
535 "CD-RW Device", 487 "CD-RW Device",
536 US_SC_8020, US_PR_CB, NULL, 0), 488 US_SC_8020, US_PR_CB, NULL, 0),
537 489
538#ifdef CONFIG_USB_STORAGE_USBAT
539UNUSUAL_DEV( 0x04e6, 0x1010, 0x0000, 0x9999,
540 "Shuttle/SCM",
541 "USBAT-02",
542 US_SC_SCSI, US_PR_USBAT, init_usbat_flash,
543 US_FL_SINGLE_LUN),
544#endif
545
546/* Reported by Dmitry Khlystov <adminimus@gmail.com> */ 490/* Reported by Dmitry Khlystov <adminimus@gmail.com> */
547UNUSUAL_DEV( 0x04e8, 0x507c, 0x0220, 0x0220, 491UNUSUAL_DEV( 0x04e8, 0x507c, 0x0220, 0x0220,
548 "Samsung", 492 "Samsung",
@@ -645,14 +589,6 @@ UNUSUAL_DEV( 0x054c, 0x0025, 0x0100, 0x0100,
645 US_SC_DEVICE, US_PR_DEVICE, NULL, 589 US_SC_DEVICE, US_PR_DEVICE, NULL,
646 US_FL_SINGLE_LUN ), 590 US_FL_SINGLE_LUN ),
647 591
648#ifdef CONFIG_USB_STORAGE_ISD200
649UNUSUAL_DEV( 0x054c, 0x002b, 0x0100, 0x0110,
650 "Sony",
651 "Portable USB Harddrive V2",
652 US_SC_ISD200, US_PR_BULK, isd200_Initialization,
653 0 ),
654#endif
655
656/* Submitted by Olaf Hering, <olh@suse.de> SuSE Bugzilla #49049 */ 592/* Submitted by Olaf Hering, <olh@suse.de> SuSE Bugzilla #49049 */
657UNUSUAL_DEV( 0x054c, 0x002c, 0x0501, 0x2000, 593UNUSUAL_DEV( 0x054c, 0x002c, 0x0501, 0x2000,
658 "Sony", 594 "Sony",
@@ -749,13 +685,6 @@ UNUSUAL_DEV( 0x057b, 0x0022, 0x0000, 0x9999,
749 "Silicon Media R/W", 685 "Silicon Media R/W",
750 US_SC_DEVICE, US_PR_DEVICE, NULL, 0), 686 US_SC_DEVICE, US_PR_DEVICE, NULL, 0),
751 687
752#ifdef CONFIG_USB_STORAGE_ALAUDA
753UNUSUAL_DEV( 0x0584, 0x0008, 0x0102, 0x0102,
754 "Fujifilm",
755 "DPC-R1 (Alauda)",
756 US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0 ),
757#endif
758
759/* Reported by RTE <raszilki@yandex.ru> */ 688/* Reported by RTE <raszilki@yandex.ru> */
760UNUSUAL_DEV( 0x058f, 0x6387, 0x0141, 0x0141, 689UNUSUAL_DEV( 0x058f, 0x6387, 0x0141, 0x0141,
761 "JetFlash", 690 "JetFlash",
@@ -798,32 +727,6 @@ UNUSUAL_DEV( 0x05ab, 0x0060, 0x1104, 0x1110,
798 US_SC_SCSI, US_PR_BULK, NULL, 727 US_SC_SCSI, US_PR_BULK, NULL,
799 US_FL_NEED_OVERRIDE ), 728 US_FL_NEED_OVERRIDE ),
800 729
801#ifdef CONFIG_USB_STORAGE_ISD200
802UNUSUAL_DEV( 0x05ab, 0x0031, 0x0100, 0x0110,
803 "In-System",
804 "USB/IDE Bridge (ATA/ATAPI)",
805 US_SC_ISD200, US_PR_BULK, isd200_Initialization,
806 0 ),
807
808UNUSUAL_DEV( 0x05ab, 0x0301, 0x0100, 0x0110,
809 "In-System",
810 "Portable USB Harddrive V2",
811 US_SC_ISD200, US_PR_BULK, isd200_Initialization,
812 0 ),
813
814UNUSUAL_DEV( 0x05ab, 0x0351, 0x0100, 0x0110,
815 "In-System",
816 "Portable USB Harddrive V2",
817 US_SC_ISD200, US_PR_BULK, isd200_Initialization,
818 0 ),
819
820UNUSUAL_DEV( 0x05ab, 0x5701, 0x0100, 0x0110,
821 "In-System",
822 "USB Storage Adapter V2",
823 US_SC_ISD200, US_PR_BULK, isd200_Initialization,
824 0 ),
825#endif
826
827/* Submitted by Sven Anderson <sven-linux@anderson.de> 730/* Submitted by Sven Anderson <sven-linux@anderson.de>
828 * There are at least four ProductIDs used for iPods, so I added 0x1202 and 731 * There are at least four ProductIDs used for iPods, so I added 0x1202 and
829 * 0x1204. They just need the US_FL_FIX_CAPACITY. As the bcdDevice appears 732 * 0x1204. They just need the US_FL_FIX_CAPACITY. As the bcdDevice appears
@@ -877,14 +780,6 @@ UNUSUAL_DEV( 0x05c6, 0x1000, 0x0000, 0x9999,
877 US_SC_DEVICE, US_PR_DEVICE, option_ms_init, 780 US_SC_DEVICE, US_PR_DEVICE, option_ms_init,
878 0), 781 0),
879 782
880#ifdef CONFIG_USB_STORAGE_JUMPSHOT
881UNUSUAL_DEV( 0x05dc, 0x0001, 0x0000, 0x0001,
882 "Lexar",
883 "Jumpshot USB CF Reader",
884 US_SC_SCSI, US_PR_JUMPSHOT, NULL,
885 US_FL_NEED_OVERRIDE ),
886#endif
887
888/* Reported by Blake Matheny <bmatheny@purdue.edu> */ 783/* Reported by Blake Matheny <bmatheny@purdue.edu> */
889UNUSUAL_DEV( 0x05dc, 0xb002, 0x0000, 0x0113, 784UNUSUAL_DEV( 0x05dc, 0xb002, 0x0000, 0x0113,
890 "Lexar", 785 "Lexar",
@@ -935,14 +830,6 @@ UNUSUAL_DEV( 0x0644, 0x0000, 0x0100, 0x0100,
935 "Floppy Drive", 830 "Floppy Drive",
936 US_SC_UFI, US_PR_CB, NULL, 0 ), 831 US_SC_UFI, US_PR_CB, NULL, 0 ),
937 832
938#ifdef CONFIG_USB_STORAGE_SDDR09
939UNUSUAL_DEV( 0x066b, 0x0105, 0x0100, 0x0100,
940 "Olympus",
941 "Camedia MAUSB-2",
942 US_SC_SCSI, US_PR_EUSB_SDDR09, usb_stor_sddr09_init,
943 0),
944#endif
945
946/* Reported by Darsen Lu <darsen@micro.ee.nthu.edu.tw> */ 833/* Reported by Darsen Lu <darsen@micro.ee.nthu.edu.tw> */
947UNUSUAL_DEV( 0x066f, 0x8000, 0x0001, 0x0001, 834UNUSUAL_DEV( 0x066f, 0x8000, 0x0001, 0x0001,
948 "SigmaTel", 835 "SigmaTel",
@@ -951,7 +838,9 @@ UNUSUAL_DEV( 0x066f, 0x8000, 0x0001, 0x0001,
951 US_FL_FIX_CAPACITY ), 838 US_FL_FIX_CAPACITY ),
952 839
953/* Reported by Richard -=[]=- <micro_flyer@hotmail.com> */ 840/* Reported by Richard -=[]=- <micro_flyer@hotmail.com> */
954UNUSUAL_DEV( 0x067b, 0x2507, 0x0100, 0x0100, 841/* Change to bcdDeviceMin (0x0100 to 0x0001) reported by
842 * Thomas Bartosik <tbartdev@gmx-topmail.de> */
843UNUSUAL_DEV( 0x067b, 0x2507, 0x0001, 0x0100,
955 "Prolific Technology Inc.", 844 "Prolific Technology Inc.",
956 "Mass Storage Device", 845 "Mass Storage Device",
957 US_SC_DEVICE, US_PR_DEVICE, NULL, 846 US_SC_DEVICE, US_PR_DEVICE, NULL,
@@ -1041,35 +930,12 @@ UNUSUAL_DEV( 0x0781, 0x0002, 0x0009, 0x0009,
1041 US_SC_DEVICE, US_PR_DEVICE, NULL, 930 US_SC_DEVICE, US_PR_DEVICE, NULL,
1042 US_FL_FIX_CAPACITY ), 931 US_FL_FIX_CAPACITY ),
1043 932
1044#ifdef CONFIG_USB_STORAGE_USBAT
1045UNUSUAL_DEV( 0x0781, 0x0005, 0x0005, 0x0005,
1046 "Sandisk",
1047 "ImageMate SDDR-05b",
1048 US_SC_SCSI, US_PR_USBAT, init_usbat_flash,
1049 US_FL_SINGLE_LUN ),
1050#endif
1051
1052UNUSUAL_DEV( 0x0781, 0x0100, 0x0100, 0x0100, 933UNUSUAL_DEV( 0x0781, 0x0100, 0x0100, 0x0100,
1053 "Sandisk", 934 "Sandisk",
1054 "ImageMate SDDR-12", 935 "ImageMate SDDR-12",
1055 US_SC_SCSI, US_PR_CB, NULL, 936 US_SC_SCSI, US_PR_CB, NULL,
1056 US_FL_SINGLE_LUN ), 937 US_FL_SINGLE_LUN ),
1057 938
1058#ifdef CONFIG_USB_STORAGE_SDDR09
1059UNUSUAL_DEV( 0x0781, 0x0200, 0x0000, 0x9999,
1060 "Sandisk",
1061 "ImageMate SDDR-09",
1062 US_SC_SCSI, US_PR_EUSB_SDDR09, usb_stor_sddr09_init,
1063 0),
1064#endif
1065
1066#ifdef CONFIG_USB_STORAGE_FREECOM
1067UNUSUAL_DEV( 0x07ab, 0xfc01, 0x0000, 0x9999,
1068 "Freecom",
1069 "USB-IDE",
1070 US_SC_QIC, US_PR_FREECOM, freecom_init, 0),
1071#endif
1072
1073/* Reported by Eero Volotinen <eero@ping-viini.org> */ 939/* Reported by Eero Volotinen <eero@ping-viini.org> */
1074UNUSUAL_DEV( 0x07ab, 0xfccd, 0x0000, 0x9999, 940UNUSUAL_DEV( 0x07ab, 0xfccd, 0x0000, 0x9999,
1075 "Freecom Technologies", 941 "Freecom Technologies",
@@ -1089,12 +955,7 @@ UNUSUAL_DEV( 0x07af, 0x0005, 0x0100, 0x0100,
1089 US_SC_DEVICE, US_PR_DEVICE, usb_stor_euscsi_init, 955 US_SC_DEVICE, US_PR_DEVICE, usb_stor_euscsi_init,
1090 US_FL_SCM_MULT_TARG ), 956 US_FL_SCM_MULT_TARG ),
1091 957
1092#ifdef CONFIG_USB_STORAGE_SDDR09 958#ifdef NO_SDDR09
1093UNUSUAL_DEV( 0x07af, 0x0006, 0x0100, 0x0100,
1094 "Microtech",
1095 "CameraMate (DPCM_USB)",
1096 US_SC_SCSI, US_PR_DPCM_USB, NULL, 0 ),
1097#else
1098UNUSUAL_DEV( 0x07af, 0x0006, 0x0100, 0x0100, 959UNUSUAL_DEV( 0x07af, 0x0006, 0x0100, 0x0100,
1099 "Microtech", 960 "Microtech",
1100 "CameraMate", 961 "CameraMate",
@@ -1102,108 +963,6 @@ UNUSUAL_DEV( 0x07af, 0x0006, 0x0100, 0x0100,
1102 US_FL_SINGLE_LUN ), 963 US_FL_SINGLE_LUN ),
1103#endif 964#endif
1104 965
1105#ifdef CONFIG_USB_STORAGE_ALAUDA
1106UNUSUAL_DEV( 0x07b4, 0x010a, 0x0102, 0x0102,
1107 "Olympus",
1108 "MAUSB-10 (Alauda)",
1109 US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0 ),
1110#endif
1111
1112#ifdef CONFIG_USB_STORAGE_DATAFAB
1113UNUSUAL_DEV( 0x07c4, 0xa000, 0x0000, 0x0015,
1114 "Datafab",
1115 "MDCFE-B USB CF Reader",
1116 US_SC_SCSI, US_PR_DATAFAB, NULL,
1117 0 ),
1118
1119/*
1120 * The following Datafab-based devices may or may not work
1121 * using the current driver...the 0xffff is arbitrary since I
1122 * don't know what device versions exist for these guys.
1123 *
1124 * The 0xa003 and 0xa004 devices in particular I'm curious about.
1125 * I'm told they exist but so far nobody has come forward to say that
1126 * they work with this driver. Given the success we've had getting
1127 * other Datafab-based cards operational with this driver, I've decided
1128 * to leave these two devices in the list.
1129 */
1130UNUSUAL_DEV( 0x07c4, 0xa001, 0x0000, 0xffff,
1131 "SIIG/Datafab",
1132 "SIIG/Datafab Memory Stick+CF Reader/Writer",
1133 US_SC_SCSI, US_PR_DATAFAB, NULL,
1134 0 ),
1135
1136/* Reported by Josef Reisinger <josef.reisinger@netcologne.de> */
1137UNUSUAL_DEV( 0x07c4, 0xa002, 0x0000, 0xffff,
1138 "Datafab/Unknown",
1139 "MD2/MD3 Disk enclosure",
1140 US_SC_SCSI, US_PR_DATAFAB, NULL,
1141 US_FL_SINGLE_LUN ),
1142
1143UNUSUAL_DEV( 0x07c4, 0xa003, 0x0000, 0xffff,
1144 "Datafab/Unknown",
1145 "Datafab-based Reader",
1146 US_SC_SCSI, US_PR_DATAFAB, NULL,
1147 0 ),
1148
1149UNUSUAL_DEV( 0x07c4, 0xa004, 0x0000, 0xffff,
1150 "Datafab/Unknown",
1151 "Datafab-based Reader",
1152 US_SC_SCSI, US_PR_DATAFAB, NULL,
1153 0 ),
1154
1155UNUSUAL_DEV( 0x07c4, 0xa005, 0x0000, 0xffff,
1156 "PNY/Datafab",
1157 "PNY/Datafab CF+SM Reader",
1158 US_SC_SCSI, US_PR_DATAFAB, NULL,
1159 0 ),
1160
1161UNUSUAL_DEV( 0x07c4, 0xa006, 0x0000, 0xffff,
1162 "Simple Tech/Datafab",
1163 "Simple Tech/Datafab CF+SM Reader",
1164 US_SC_SCSI, US_PR_DATAFAB, NULL,
1165 0 ),
1166#endif
1167
1168#ifdef CONFIG_USB_STORAGE_SDDR55
1169/* Contributed by Peter Waechtler */
1170UNUSUAL_DEV( 0x07c4, 0xa103, 0x0000, 0x9999,
1171 "Datafab",
1172 "MDSM-B reader",
1173 US_SC_SCSI, US_PR_SDDR55, NULL,
1174 US_FL_FIX_INQUIRY ),
1175#endif
1176
1177#ifdef CONFIG_USB_STORAGE_DATAFAB
1178/* Submitted by Olaf Hering <olh@suse.de> */
1179UNUSUAL_DEV( 0x07c4, 0xa109, 0x0000, 0xffff,
1180 "Datafab Systems, Inc.",
1181 "USB to CF + SM Combo (LC1)",
1182 US_SC_SCSI, US_PR_DATAFAB, NULL,
1183 0 ),
1184#endif
1185#ifdef CONFIG_USB_STORAGE_SDDR55
1186/* SM part - aeb <Andries.Brouwer@cwi.nl> */
1187UNUSUAL_DEV( 0x07c4, 0xa109, 0x0000, 0xffff,
1188 "Datafab Systems, Inc.",
1189 "USB to CF + SM Combo (LC1)",
1190 US_SC_SCSI, US_PR_SDDR55, NULL,
1191 US_FL_SINGLE_LUN ),
1192#endif
1193
1194#ifdef CONFIG_USB_STORAGE_DATAFAB
1195/* Reported by Felix Moeller <felix@derklecks.de>
1196 * in Germany this is sold by Hama with the productnumber 46952
1197 * as "DualSlot CompactFlash(TM) & MStick Drive USB"
1198 */
1199UNUSUAL_DEV( 0x07c4, 0xa10b, 0x0000, 0xffff,
1200 "DataFab Systems Inc.",
1201 "USB CF+MS",
1202 US_SC_SCSI, US_PR_DATAFAB, NULL,
1203 0 ),
1204
1205#endif
1206
1207/* Datafab KECF-USB / Sagatek DCS-CF / Simpletech Flashlink UCF-100 966/* Datafab KECF-USB / Sagatek DCS-CF / Simpletech Flashlink UCF-100
1208 * Only revision 1.13 tested (same for all of the above devices, 967 * Only revision 1.13 tested (same for all of the above devices,
1209 * based on the Datafab DF-UG-07 chip). Needed for US_FL_FIX_INQUIRY. 968 * based on the Datafab DF-UG-07 chip). Needed for US_FL_FIX_INQUIRY.
@@ -1390,6 +1149,16 @@ UNUSUAL_DEV( 0x0af0, 0x7401, 0x0000, 0x0000,
1390 US_SC_DEVICE, US_PR_DEVICE, NULL, 1149 US_SC_DEVICE, US_PR_DEVICE, NULL,
1391 0 ), 1150 0 ),
1392 1151
1152/* Reported by Jan Dumon <j.dumon@option.com>
1153 * This device (wrongly) has a vendor-specific device descriptor.
1154 * The entry is needed so usb-storage can bind to it's mass-storage
1155 * interface as an interface driver */
1156UNUSUAL_DEV( 0x0af0, 0x7501, 0x0000, 0x0000,
1157 "Option",
1158 "GI 0431 SD-Card",
1159 US_SC_DEVICE, US_PR_DEVICE, NULL,
1160 0 ),
1161
1393/* Reported by Ben Efros <ben@pc-doctor.com> */ 1162/* Reported by Ben Efros <ben@pc-doctor.com> */
1394UNUSUAL_DEV( 0x0bc2, 0x3010, 0x0000, 0x0000, 1163UNUSUAL_DEV( 0x0bc2, 0x3010, 0x0000, 0x0000,
1395 "Seagate", 1164 "Seagate",
@@ -1397,29 +1166,6 @@ UNUSUAL_DEV( 0x0bc2, 0x3010, 0x0000, 0x0000,
1397 US_SC_DEVICE, US_PR_DEVICE, NULL, 1166 US_SC_DEVICE, US_PR_DEVICE, NULL,
1398 US_FL_SANE_SENSE ), 1167 US_FL_SANE_SENSE ),
1399 1168
1400#ifdef CONFIG_USB_STORAGE_ISD200
1401UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110,
1402 "ATI",
1403 "USB Cable 205",
1404 US_SC_ISD200, US_PR_BULK, isd200_Initialization,
1405 0 ),
1406#endif
1407
1408#ifdef CONFIG_USB_STORAGE_DATAFAB
1409UNUSUAL_DEV( 0x0c0b, 0xa109, 0x0000, 0xffff,
1410 "Acomdata",
1411 "CF",
1412 US_SC_SCSI, US_PR_DATAFAB, NULL,
1413 US_FL_SINGLE_LUN ),
1414#endif
1415#ifdef CONFIG_USB_STORAGE_SDDR55
1416UNUSUAL_DEV( 0x0c0b, 0xa109, 0x0000, 0xffff,
1417 "Acomdata",
1418 "SM",
1419 US_SC_SCSI, US_PR_SDDR55, NULL,
1420 US_FL_SINGLE_LUN ),
1421#endif
1422
1423UNUSUAL_DEV( 0x0d49, 0x7310, 0x0000, 0x9999, 1169UNUSUAL_DEV( 0x0d49, 0x7310, 0x0000, 0x9999,
1424 "Maxtor", 1170 "Maxtor",
1425 "USB to SATA", 1171 "USB to SATA",
@@ -1436,23 +1182,6 @@ UNUSUAL_DEV( 0x0c45, 0x1060, 0x0100, 0x0100,
1436 US_SC_DEVICE, US_PR_DEVICE, NULL, 1182 US_SC_DEVICE, US_PR_DEVICE, NULL,
1437 US_FL_SINGLE_LUN ), 1183 US_FL_SINGLE_LUN ),
1438 1184
1439/* Submitted by: Nick Sillik <n.sillik@temple.edu>
1440 * Needed for OneTouch extension to usb-storage
1441 *
1442 */
1443#ifdef CONFIG_USB_STORAGE_ONETOUCH
1444 UNUSUAL_DEV( 0x0d49, 0x7000, 0x0000, 0x9999,
1445 "Maxtor",
1446 "OneTouch External Harddrive",
1447 US_SC_DEVICE, US_PR_DEVICE, onetouch_connect_input,
1448 0),
1449 UNUSUAL_DEV( 0x0d49, 0x7010, 0x0000, 0x9999,
1450 "Maxtor",
1451 "OneTouch External Harddrive",
1452 US_SC_DEVICE, US_PR_DEVICE, onetouch_connect_input,
1453 0),
1454#endif
1455
1456/* Submitted by Joris Struyve <joris@struyve.be> */ 1185/* Submitted by Joris Struyve <joris@struyve.be> */
1457UNUSUAL_DEV( 0x0d96, 0x410a, 0x0001, 0xffff, 1186UNUSUAL_DEV( 0x0d96, 0x410a, 0x0001, 0xffff,
1458 "Medion", 1187 "Medion",
@@ -2105,14 +1834,6 @@ UNUSUAL_DEV( 0x4146, 0xba01, 0x0100, 0x0100,
2105 "Micro Mini 1GB", 1834 "Micro Mini 1GB",
2106 US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ), 1835 US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ),
2107 1836
2108#ifdef CONFIG_USB_STORAGE_SDDR55
2109UNUSUAL_DEV( 0x55aa, 0xa103, 0x0000, 0x9999,
2110 "Sandisk",
2111 "ImageMate SDDR55",
2112 US_SC_SCSI, US_PR_SDDR55, NULL,
2113 US_FL_SINGLE_LUN),
2114#endif
2115
2116/* Reported by Andrew Simmons <andrew.simmons@gmail.com> */ 1837/* Reported by Andrew Simmons <andrew.simmons@gmail.com> */
2117UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x0001, 1838UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x0001,
2118 "DataStor", 1839 "DataStor",
diff --git a/drivers/usb/storage/cypress_atacb.h b/drivers/usb/storage/unusual_freecom.h
index fbada898d56b..375867942391 100644
--- a/drivers/usb/storage/cypress_atacb.h
+++ b/drivers/usb/storage/unusual_freecom.h
@@ -1,8 +1,4 @@
1/* 1/* Unusual Devices File for the Freecom USB/IDE adaptor
2 * Support for emulating SAT (ata pass through) on devices based
3 * on the Cypress USB/ATA bridge supporting ATACB.
4 *
5 * Copyright (c) 2008 Matthieu Castet (castet.matthieu@free.fr)
6 * 2 *
7 * This program is free software; you can redistribute it and/or modify it 3 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the 4 * under the terms of the GNU General Public License as published by the
@@ -19,7 +15,12 @@
19 * 675 Mass Ave, Cambridge, MA 02139, USA. 15 * 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 16 */
21 17
22#ifndef _CYPRESS_ATACB_H_ 18#if defined(CONFIG_USB_STORAGE_FREECOM) || \
23#define _CYPRESS_ATACB_H_ 19 defined(CONFIG_USB_STORAGE_FREECOM_MODULE)
24extern void cypress_atacb_passthrough(struct scsi_cmnd*, struct us_data*); 20
25#endif 21UNUSUAL_DEV( 0x07ab, 0xfc01, 0x0000, 0x9999,
22 "Freecom",
23 "USB-IDE",
24 US_SC_QIC, US_PR_FREECOM, init_freecom, 0),
25
26#endif /* defined(CONFIG_USB_STORAGE_FREECOM) || ... */
diff --git a/drivers/usb/storage/unusual_isd200.h b/drivers/usb/storage/unusual_isd200.h
new file mode 100644
index 000000000000..0d99dde3382a
--- /dev/null
+++ b/drivers/usb/storage/unusual_isd200.h
@@ -0,0 +1,57 @@
1/* Unusual Devices File for In-System Design, Inc. ISD200 ASIC
2 *
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the
5 * Free Software Foundation; either version 2, or (at your option) any
6 * later version.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 675 Mass Ave, Cambridge, MA 02139, USA.
16 */
17
18#if defined(CONFIG_USB_STORAGE_ISD200) || \
19 defined(CONFIG_USB_STORAGE_ISD200_MODULE)
20
21UNUSUAL_DEV( 0x054c, 0x002b, 0x0100, 0x0110,
22 "Sony",
23 "Portable USB Harddrive V2",
24 US_SC_ISD200, US_PR_BULK, isd200_Initialization,
25 0),
26
27UNUSUAL_DEV( 0x05ab, 0x0031, 0x0100, 0x0110,
28 "In-System",
29 "USB/IDE Bridge (ATA/ATAPI)",
30 US_SC_ISD200, US_PR_BULK, isd200_Initialization,
31 0),
32
33UNUSUAL_DEV( 0x05ab, 0x0301, 0x0100, 0x0110,
34 "In-System",
35 "Portable USB Harddrive V2",
36 US_SC_ISD200, US_PR_BULK, isd200_Initialization,
37 0),
38
39UNUSUAL_DEV( 0x05ab, 0x0351, 0x0100, 0x0110,
40 "In-System",
41 "Portable USB Harddrive V2",
42 US_SC_ISD200, US_PR_BULK, isd200_Initialization,
43 0),
44
45UNUSUAL_DEV( 0x05ab, 0x5701, 0x0100, 0x0110,
46 "In-System",
47 "USB Storage Adapter V2",
48 US_SC_ISD200, US_PR_BULK, isd200_Initialization,
49 0),
50
51UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110,
52 "ATI",
53 "USB Cable 205",
54 US_SC_ISD200, US_PR_BULK, isd200_Initialization,
55 0),
56
57#endif /* defined(CONFIG_USB_STORAGE_ISD200) || ... */
diff --git a/drivers/usb/storage/sddr55.h b/drivers/usb/storage/unusual_jumpshot.h
index a815a0470c84..2e549b1c2c62 100644
--- a/drivers/usb/storage/sddr55.h
+++ b/drivers/usb/storage/unusual_jumpshot.h
@@ -1,10 +1,4 @@
1/* Driver for SanDisk SDDR-55 SmartMedia reader 1/* Unusual Devices File for the Lexar "Jumpshot" Compact Flash reader
2 * Header File
3 *
4 * Current development and maintenance by:
5 * (c) 2002 Simon Munton
6 *
7 * See sddr55.c for more explanation
8 * 2 *
9 * This program is free software; you can redistribute it and/or modify it 3 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 4 * under the terms of the GNU General Public License as published by the
@@ -21,12 +15,13 @@
21 * 675 Mass Ave, Cambridge, MA 02139, USA. 15 * 675 Mass Ave, Cambridge, MA 02139, USA.
22 */ 16 */
23 17
24#ifndef _USB_SHUTTLE_EUSB_SDDR55_H 18#if defined(CONFIG_USB_STORAGE_JUMPSHOT) || \
25#define _USB_SHUTTLE_EUSB_SDDR55_H 19 defined(CONFIG_USB_STORAGE_JUMPSHOT_MODULE)
26
27/* Sandisk SDDR-55 stuff */
28 20
29extern int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us); 21UNUSUAL_DEV( 0x05dc, 0x0001, 0x0000, 0x0001,
30extern int sddr55_reset(struct us_data *us); 22 "Lexar",
23 "Jumpshot USB CF Reader",
24 US_SC_SCSI, US_PR_JUMPSHOT, NULL,
25 US_FL_NEED_OVERRIDE),
31 26
32#endif 27#endif /* defined(CONFIG_USB_STORAGE_JUMPSHOT) || ... */
diff --git a/drivers/usb/storage/isd200.h b/drivers/usb/storage/unusual_karma.h
index 0a35f4fa78f8..12ae3a03e802 100644
--- a/drivers/usb/storage/isd200.h
+++ b/drivers/usb/storage/unusual_karma.h
@@ -1,11 +1,4 @@
1/* Header File for In-System Design, Inc. ISD200 ASIC 1/* Unusual Devices File for the Rio Karma
2 *
3 * First release
4 *
5 * Current development and maintenance by:
6 * (c) 2000 In-System Design, Inc. (support@in-system.com)
7 *
8 * See isd200.c for more information.
9 * 2 *
10 * This program is free software; you can redistribute it and/or modify it 3 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 4 * under the terms of the GNU General Public License as published by the
@@ -22,10 +15,12 @@
22 * 675 Mass Ave, Cambridge, MA 02139, USA. 15 * 675 Mass Ave, Cambridge, MA 02139, USA.
23 */ 16 */
24 17
25#ifndef _USB_ISD200_H 18#if defined(CONFIG_USB_STORAGE_KARMA) || \
26#define _USB_ISD200_H 19 defined(CONFIG_USB_STORAGE_KARMA_MODULE)
27 20
28extern void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us); 21UNUSUAL_DEV( 0x045a, 0x5210, 0x0101, 0x0101,
29extern int isd200_Initialization(struct us_data *us); 22 "Rio",
23 "Rio Karma",
24 US_SC_SCSI, US_PR_KARMA, rio_karma_init, 0),
30 25
31#endif 26#endif /* defined(CONFIG_USB_STORAGE_KARMA) || ... */
diff --git a/drivers/usb/storage/unusual_onetouch.h b/drivers/usb/storage/unusual_onetouch.h
new file mode 100644
index 000000000000..bd9306b637df
--- /dev/null
+++ b/drivers/usb/storage/unusual_onetouch.h
@@ -0,0 +1,36 @@
1/* Unusual Devices File for the Maxtor OneTouch USB hard drive's button
2 *
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the
5 * Free Software Foundation; either version 2, or (at your option) any
6 * later version.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 675 Mass Ave, Cambridge, MA 02139, USA.
16 */
17
18#if defined(CONFIG_USB_STORAGE_ONETOUCH) || \
19 defined(CONFIG_USB_STORAGE_ONETOUCH_MODULE)
20
21/* Submitted by: Nick Sillik <n.sillik@temple.edu>
22 * Needed for OneTouch extension to usb-storage
23 */
24UNUSUAL_DEV( 0x0d49, 0x7000, 0x0000, 0x9999,
25 "Maxtor",
26 "OneTouch External Harddrive",
27 US_SC_DEVICE, US_PR_DEVICE, onetouch_connect_input,
28 0),
29
30UNUSUAL_DEV( 0x0d49, 0x7010, 0x0000, 0x9999,
31 "Maxtor",
32 "OneTouch External Harddrive",
33 US_SC_DEVICE, US_PR_DEVICE, onetouch_connect_input,
34 0),
35
36#endif /* defined(CONFIG_USB_STORAGE_ONETOUCH) || ... */
diff --git a/drivers/usb/storage/unusual_sddr09.h b/drivers/usb/storage/unusual_sddr09.h
new file mode 100644
index 000000000000..50cab511a4d7
--- /dev/null
+++ b/drivers/usb/storage/unusual_sddr09.h
@@ -0,0 +1,56 @@
1/* Unusual Devices File for SanDisk SDDR-09 SmartMedia reader
2 *
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the
5 * Free Software Foundation; either version 2, or (at your option) any
6 * later version.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 675 Mass Ave, Cambridge, MA 02139, USA.
16 */
17
18#if defined(CONFIG_USB_STORAGE_SDDR09) || \
19 defined(CONFIG_USB_STORAGE_SDDR09_MODULE)
20
21UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100,
22 "Microtech",
23 "CameraMate (DPCM_USB)",
24 US_SC_SCSI, US_PR_DPCM_USB, NULL, 0),
25
26UNUSUAL_DEV( 0x04e6, 0x0003, 0x0000, 0x9999,
27 "Sandisk",
28 "ImageMate SDDR09",
29 US_SC_SCSI, US_PR_EUSB_SDDR09, usb_stor_sddr09_init,
30 0),
31
32/* This entry is from Andries.Brouwer@cwi.nl */
33UNUSUAL_DEV( 0x04e6, 0x0005, 0x0100, 0x0208,
34 "SCM Microsystems",
35 "eUSB SmartMedia / CompactFlash Adapter",
36 US_SC_SCSI, US_PR_DPCM_USB, usb_stor_sddr09_dpcm_init,
37 0),
38
39UNUSUAL_DEV( 0x066b, 0x0105, 0x0100, 0x0100,
40 "Olympus",
41 "Camedia MAUSB-2",
42 US_SC_SCSI, US_PR_EUSB_SDDR09, usb_stor_sddr09_init,
43 0),
44
45UNUSUAL_DEV( 0x0781, 0x0200, 0x0000, 0x9999,
46 "Sandisk",
47 "ImageMate SDDR-09",
48 US_SC_SCSI, US_PR_EUSB_SDDR09, usb_stor_sddr09_init,
49 0),
50
51UNUSUAL_DEV( 0x07af, 0x0006, 0x0100, 0x0100,
52 "Microtech",
53 "CameraMate (DPCM_USB)",
54 US_SC_SCSI, US_PR_DPCM_USB, NULL, 0),
55
56#endif /* defined(CONFIG_USB_STORAGE_SDDR09) || ... */
diff --git a/drivers/usb/storage/unusual_sddr55.h b/drivers/usb/storage/unusual_sddr55.h
new file mode 100644
index 000000000000..ae81ef7a1cfd
--- /dev/null
+++ b/drivers/usb/storage/unusual_sddr55.h
@@ -0,0 +1,44 @@
1/* Unusual Devices File for SanDisk SDDR-55 SmartMedia reader
2 *
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the
5 * Free Software Foundation; either version 2, or (at your option) any
6 * later version.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 675 Mass Ave, Cambridge, MA 02139, USA.
16 */
17
18#if defined(CONFIG_USB_STORAGE_SDDR55) || \
19 defined(CONFIG_USB_STORAGE_SDDR55_MODULE)
20
21/* Contributed by Peter Waechtler */
22UNUSUAL_DEV( 0x07c4, 0xa103, 0x0000, 0x9999,
23 "Datafab",
24 "MDSM-B reader",
25 US_SC_SCSI, US_PR_SDDR55, NULL,
26 US_FL_FIX_INQUIRY),
27
28/* SM part - aeb <Andries.Brouwer@cwi.nl> */
29UNUSUAL_DEV( 0x07c4, 0xa109, 0x0000, 0xffff,
30 "Datafab Systems, Inc.",
31 "USB to CF + SM Combo (LC1)",
32 US_SC_SCSI, US_PR_SDDR55, NULL, 0),
33
34UNUSUAL_DEV( 0x0c0b, 0xa109, 0x0000, 0xffff,
35 "Acomdata",
36 "SM",
37 US_SC_SCSI, US_PR_SDDR55, NULL, 0),
38
39UNUSUAL_DEV( 0x55aa, 0xa103, 0x0000, 0x9999,
40 "Sandisk",
41 "ImageMate SDDR55",
42 US_SC_SCSI, US_PR_SDDR55, NULL, 0),
43
44#endif /* defined(CONFIG_USB_STORAGE_SDDR55) || ... */
diff --git a/drivers/usb/storage/unusual_usbat.h b/drivers/usb/storage/unusual_usbat.h
new file mode 100644
index 000000000000..80e869f10180
--- /dev/null
+++ b/drivers/usb/storage/unusual_usbat.h
@@ -0,0 +1,43 @@
1/* Unusual Devices File for SCM Microsystems (a.k.a. Shuttle) USB-ATAPI cable
2 *
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the
5 * Free Software Foundation; either version 2, or (at your option) any
6 * later version.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 675 Mass Ave, Cambridge, MA 02139, USA.
16 */
17
18#if defined(CONFIG_USB_STORAGE_USBAT) || \
19 defined(CONFIG_USB_STORAGE_USBAT_MODULE)
20
21UNUSUAL_DEV( 0x03f0, 0x0207, 0x0001, 0x0001,
22 "HP",
23 "CD-Writer+ 8200e",
24 US_SC_8070, US_PR_USBAT, init_usbat_cd, 0),
25
26UNUSUAL_DEV( 0x03f0, 0x0307, 0x0001, 0x0001,
27 "HP",
28 "CD-Writer+ CD-4e",
29 US_SC_8070, US_PR_USBAT, init_usbat_cd, 0),
30
31UNUSUAL_DEV( 0x04e6, 0x1010, 0x0000, 0x9999,
32 "Shuttle/SCM",
33 "USBAT-02",
34 US_SC_SCSI, US_PR_USBAT, init_usbat_flash,
35 US_FL_SINGLE_LUN),
36
37UNUSUAL_DEV( 0x0781, 0x0005, 0x0005, 0x0005,
38 "Sandisk",
39 "ImageMate SDDR-05b",
40 US_SC_SCSI, US_PR_USBAT, init_usbat_flash,
41 US_FL_SINGLE_LUN),
42
43#endif /* defined(CONFIG_USB_STORAGE_USBAT) || ... */
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 4becf495ca2d..8060b85fe1a3 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Developed with the assistance of: 6 * Developed with the assistance of:
7 * (c) 2000 David L. Brown, Jr. (usb-storage@davidb.org) 7 * (c) 2000 David L. Brown, Jr. (usb-storage@davidb.org)
8 * (c) 2003 Alan Stern (stern@rowland.harvard.edu) 8 * (c) 2003-2009 Alan Stern (stern@rowland.harvard.edu)
9 * 9 *
10 * Initial work by: 10 * Initial work by:
11 * (c) 1999 Michael Gee (michael@linuxspecific.com) 11 * (c) 1999 Michael Gee (michael@linuxspecific.com)
@@ -66,39 +66,6 @@
66#include "debug.h" 66#include "debug.h"
67#include "initializers.h" 67#include "initializers.h"
68 68
69#ifdef CONFIG_USB_STORAGE_USBAT
70#include "shuttle_usbat.h"
71#endif
72#ifdef CONFIG_USB_STORAGE_SDDR09
73#include "sddr09.h"
74#endif
75#ifdef CONFIG_USB_STORAGE_SDDR55
76#include "sddr55.h"
77#endif
78#ifdef CONFIG_USB_STORAGE_FREECOM
79#include "freecom.h"
80#endif
81#ifdef CONFIG_USB_STORAGE_ISD200
82#include "isd200.h"
83#endif
84#ifdef CONFIG_USB_STORAGE_DATAFAB
85#include "datafab.h"
86#endif
87#ifdef CONFIG_USB_STORAGE_JUMPSHOT
88#include "jumpshot.h"
89#endif
90#ifdef CONFIG_USB_STORAGE_ONETOUCH
91#include "onetouch.h"
92#endif
93#ifdef CONFIG_USB_STORAGE_ALAUDA
94#include "alauda.h"
95#endif
96#ifdef CONFIG_USB_STORAGE_KARMA
97#include "karma.h"
98#endif
99#ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB
100#include "cypress_atacb.h"
101#endif
102#include "sierra_ms.h" 69#include "sierra_ms.h"
103#include "option_ms.h" 70#include "option_ms.h"
104 71
@@ -118,36 +85,8 @@ MODULE_PARM_DESC(quirks, "supplemental list of device IDs and their quirks");
118 85
119/* 86/*
120 * The entries in this table correspond, line for line, 87 * The entries in this table correspond, line for line,
121 * with the entries of us_unusual_dev_list[]. 88 * with the entries in usb_storage_usb_ids[], defined in usual-tables.c.
122 */ 89 */
123#ifndef CONFIG_USB_LIBUSUAL
124
125#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
126 vendorName, productName,useProtocol, useTransport, \
127 initFunction, flags) \
128{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin,bcdDeviceMax), \
129 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
130
131#define COMPLIANT_DEV UNUSUAL_DEV
132
133#define USUAL_DEV(useProto, useTrans, useType) \
134{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans), \
135 .driver_info = (USB_US_TYPE_STOR<<24) }
136
137static struct usb_device_id storage_usb_ids [] = {
138
139# include "unusual_devs.h"
140#undef UNUSUAL_DEV
141#undef COMPLIANT_DEV
142#undef USUAL_DEV
143 /* Terminating entry */
144 { }
145};
146
147MODULE_DEVICE_TABLE (usb, storage_usb_ids);
148#endif /* CONFIG_USB_LIBUSUAL */
149
150/* This is the list of devices we recognize, along with their flag data */
151 90
152/* The vendor name should be kept at eight characters or less, and 91/* The vendor name should be kept at eight characters or less, and
153 * the product name should be kept at 16 characters or less. If a device 92 * the product name should be kept at 16 characters or less. If a device
@@ -179,18 +118,17 @@ MODULE_DEVICE_TABLE (usb, storage_usb_ids);
179 118
180static struct us_unusual_dev us_unusual_dev_list[] = { 119static struct us_unusual_dev us_unusual_dev_list[] = {
181# include "unusual_devs.h" 120# include "unusual_devs.h"
182# undef UNUSUAL_DEV 121 { } /* Terminating entry */
183# undef COMPLIANT_DEV
184# undef USUAL_DEV
185
186 /* Terminating entry */
187 { NULL }
188}; 122};
189 123
124#undef UNUSUAL_DEV
125#undef COMPLIANT_DEV
126#undef USUAL_DEV
127
190 128
191#ifdef CONFIG_PM /* Minimal support for suspend and resume */ 129#ifdef CONFIG_PM /* Minimal support for suspend and resume */
192 130
193static int storage_suspend(struct usb_interface *iface, pm_message_t message) 131int usb_stor_suspend(struct usb_interface *iface, pm_message_t message)
194{ 132{
195 struct us_data *us = usb_get_intfdata(iface); 133 struct us_data *us = usb_get_intfdata(iface);
196 134
@@ -207,8 +145,9 @@ static int storage_suspend(struct usb_interface *iface, pm_message_t message)
207 mutex_unlock(&us->dev_mutex); 145 mutex_unlock(&us->dev_mutex);
208 return 0; 146 return 0;
209} 147}
148EXPORT_SYMBOL_GPL(usb_stor_suspend);
210 149
211static int storage_resume(struct usb_interface *iface) 150int usb_stor_resume(struct usb_interface *iface)
212{ 151{
213 struct us_data *us = usb_get_intfdata(iface); 152 struct us_data *us = usb_get_intfdata(iface);
214 153
@@ -221,8 +160,9 @@ static int storage_resume(struct usb_interface *iface)
221 mutex_unlock(&us->dev_mutex); 160 mutex_unlock(&us->dev_mutex);
222 return 0; 161 return 0;
223} 162}
163EXPORT_SYMBOL_GPL(usb_stor_resume);
224 164
225static int storage_reset_resume(struct usb_interface *iface) 165int usb_stor_reset_resume(struct usb_interface *iface)
226{ 166{
227 struct us_data *us = usb_get_intfdata(iface); 167 struct us_data *us = usb_get_intfdata(iface);
228 168
@@ -235,6 +175,7 @@ static int storage_reset_resume(struct usb_interface *iface)
235 * the device */ 175 * the device */
236 return 0; 176 return 0;
237} 177}
178EXPORT_SYMBOL_GPL(usb_stor_reset_resume);
238 179
239#endif /* CONFIG_PM */ 180#endif /* CONFIG_PM */
240 181
@@ -243,7 +184,7 @@ static int storage_reset_resume(struct usb_interface *iface)
243 * a USB port reset, whether from this driver or a different one. 184 * a USB port reset, whether from this driver or a different one.
244 */ 185 */
245 186
246static int storage_pre_reset(struct usb_interface *iface) 187int usb_stor_pre_reset(struct usb_interface *iface)
247{ 188{
248 struct us_data *us = usb_get_intfdata(iface); 189 struct us_data *us = usb_get_intfdata(iface);
249 190
@@ -253,8 +194,9 @@ static int storage_pre_reset(struct usb_interface *iface)
253 mutex_lock(&us->dev_mutex); 194 mutex_lock(&us->dev_mutex);
254 return 0; 195 return 0;
255} 196}
197EXPORT_SYMBOL_GPL(usb_stor_pre_reset);
256 198
257static int storage_post_reset(struct usb_interface *iface) 199int usb_stor_post_reset(struct usb_interface *iface)
258{ 200{
259 struct us_data *us = usb_get_intfdata(iface); 201 struct us_data *us = usb_get_intfdata(iface);
260 202
@@ -269,6 +211,7 @@ static int storage_post_reset(struct usb_interface *iface)
269 mutex_unlock(&us->dev_mutex); 211 mutex_unlock(&us->dev_mutex);
270 return 0; 212 return 0;
271} 213}
214EXPORT_SYMBOL_GPL(usb_stor_post_reset);
272 215
273/* 216/*
274 * fill_inquiry_response takes an unsigned char array (which must 217 * fill_inquiry_response takes an unsigned char array (which must
@@ -311,6 +254,7 @@ void fill_inquiry_response(struct us_data *us, unsigned char *data,
311 254
312 usb_stor_set_xfer_buf(data, data_len, us->srb); 255 usb_stor_set_xfer_buf(data, data_len, us->srb);
313} 256}
257EXPORT_SYMBOL_GPL(fill_inquiry_response);
314 258
315static int usb_stor_control_thread(void * __us) 259static int usb_stor_control_thread(void * __us)
316{ 260{
@@ -551,20 +495,13 @@ static void adjust_quirks(struct us_data *us)
551 vid, pid, f); 495 vid, pid, f);
552} 496}
553 497
554/* Find an unusual_dev descriptor (always succeeds in the current code) */
555static struct us_unusual_dev *find_unusual(const struct usb_device_id *id)
556{
557 const int id_index = id - storage_usb_ids;
558 return &us_unusual_dev_list[id_index];
559}
560
561/* Get the unusual_devs entries and the string descriptors */ 498/* Get the unusual_devs entries and the string descriptors */
562static int get_device_info(struct us_data *us, const struct usb_device_id *id) 499static int get_device_info(struct us_data *us, const struct usb_device_id *id,
500 struct us_unusual_dev *unusual_dev)
563{ 501{
564 struct usb_device *dev = us->pusb_dev; 502 struct usb_device *dev = us->pusb_dev;
565 struct usb_interface_descriptor *idesc = 503 struct usb_interface_descriptor *idesc =
566 &us->pusb_intf->cur_altsetting->desc; 504 &us->pusb_intf->cur_altsetting->desc;
567 struct us_unusual_dev *unusual_dev = find_unusual(id);
568 505
569 /* Store the entries */ 506 /* Store the entries */
570 us->unusual_dev = unusual_dev; 507 us->unusual_dev = unusual_dev;
@@ -629,7 +566,7 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id)
629} 566}
630 567
631/* Get the transport settings */ 568/* Get the transport settings */
632static int get_transport(struct us_data *us) 569static void get_transport(struct us_data *us)
633{ 570{
634 switch (us->protocol) { 571 switch (us->protocol) {
635 case US_PR_CB: 572 case US_PR_CB:
@@ -651,100 +588,11 @@ static int get_transport(struct us_data *us)
651 us->transport = usb_stor_Bulk_transport; 588 us->transport = usb_stor_Bulk_transport;
652 us->transport_reset = usb_stor_Bulk_reset; 589 us->transport_reset = usb_stor_Bulk_reset;
653 break; 590 break;
654
655#ifdef CONFIG_USB_STORAGE_USBAT
656 case US_PR_USBAT:
657 us->transport_name = "Shuttle USBAT";
658 us->transport = usbat_transport;
659 us->transport_reset = usb_stor_CB_reset;
660 us->max_lun = 1;
661 break;
662#endif
663
664#ifdef CONFIG_USB_STORAGE_SDDR09
665 case US_PR_EUSB_SDDR09:
666 us->transport_name = "EUSB/SDDR09";
667 us->transport = sddr09_transport;
668 us->transport_reset = usb_stor_CB_reset;
669 us->max_lun = 0;
670 break;
671#endif
672
673#ifdef CONFIG_USB_STORAGE_SDDR55
674 case US_PR_SDDR55:
675 us->transport_name = "SDDR55";
676 us->transport = sddr55_transport;
677 us->transport_reset = sddr55_reset;
678 us->max_lun = 0;
679 break;
680#endif
681
682#ifdef CONFIG_USB_STORAGE_DPCM
683 case US_PR_DPCM_USB:
684 us->transport_name = "Control/Bulk-EUSB/SDDR09";
685 us->transport = dpcm_transport;
686 us->transport_reset = usb_stor_CB_reset;
687 us->max_lun = 1;
688 break;
689#endif
690
691#ifdef CONFIG_USB_STORAGE_FREECOM
692 case US_PR_FREECOM:
693 us->transport_name = "Freecom";
694 us->transport = freecom_transport;
695 us->transport_reset = usb_stor_freecom_reset;
696 us->max_lun = 0;
697 break;
698#endif
699
700#ifdef CONFIG_USB_STORAGE_DATAFAB
701 case US_PR_DATAFAB:
702 us->transport_name = "Datafab Bulk-Only";
703 us->transport = datafab_transport;
704 us->transport_reset = usb_stor_Bulk_reset;
705 us->max_lun = 1;
706 break;
707#endif
708
709#ifdef CONFIG_USB_STORAGE_JUMPSHOT
710 case US_PR_JUMPSHOT:
711 us->transport_name = "Lexar Jumpshot Control/Bulk";
712 us->transport = jumpshot_transport;
713 us->transport_reset = usb_stor_Bulk_reset;
714 us->max_lun = 1;
715 break;
716#endif
717
718#ifdef CONFIG_USB_STORAGE_ALAUDA
719 case US_PR_ALAUDA:
720 us->transport_name = "Alauda Control/Bulk";
721 us->transport = alauda_transport;
722 us->transport_reset = usb_stor_Bulk_reset;
723 us->max_lun = 1;
724 break;
725#endif
726
727#ifdef CONFIG_USB_STORAGE_KARMA
728 case US_PR_KARMA:
729 us->transport_name = "Rio Karma/Bulk";
730 us->transport = rio_karma_transport;
731 us->transport_reset = usb_stor_Bulk_reset;
732 break;
733#endif
734
735 default:
736 return -EIO;
737 } 591 }
738 US_DEBUGP("Transport: %s\n", us->transport_name);
739
740 /* fix for single-lun devices */
741 if (us->fflags & US_FL_SINGLE_LUN)
742 us->max_lun = 0;
743 return 0;
744} 592}
745 593
746/* Get the protocol settings */ 594/* Get the protocol settings */
747static int get_protocol(struct us_data *us) 595static void get_protocol(struct us_data *us)
748{ 596{
749 switch (us->subclass) { 597 switch (us->subclass) {
750 case US_SC_RBC: 598 case US_SC_RBC:
@@ -779,26 +627,7 @@ static int get_protocol(struct us_data *us)
779 us->protocol_name = "Uniform Floppy Interface (UFI)"; 627 us->protocol_name = "Uniform Floppy Interface (UFI)";
780 us->proto_handler = usb_stor_ufi_command; 628 us->proto_handler = usb_stor_ufi_command;
781 break; 629 break;
782
783#ifdef CONFIG_USB_STORAGE_ISD200
784 case US_SC_ISD200:
785 us->protocol_name = "ISD200 ATA/ATAPI";
786 us->proto_handler = isd200_ata_command;
787 break;
788#endif
789
790#ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB
791 case US_SC_CYP_ATACB:
792 us->protocol_name = "Transparent SCSI with Cypress ATACB";
793 us->proto_handler = cypress_atacb_passthrough;
794 break;
795#endif
796
797 default:
798 return -EIO;
799 } 630 }
800 US_DEBUGP("Protocol: %s\n", us->protocol_name);
801 return 0;
802} 631}
803 632
804/* Get the pipe settings */ 633/* Get the pipe settings */
@@ -846,12 +675,12 @@ static int get_pipes(struct us_data *us)
846 us->send_ctrl_pipe = usb_sndctrlpipe(us->pusb_dev, 0); 675 us->send_ctrl_pipe = usb_sndctrlpipe(us->pusb_dev, 0);
847 us->recv_ctrl_pipe = usb_rcvctrlpipe(us->pusb_dev, 0); 676 us->recv_ctrl_pipe = usb_rcvctrlpipe(us->pusb_dev, 0);
848 us->send_bulk_pipe = usb_sndbulkpipe(us->pusb_dev, 677 us->send_bulk_pipe = usb_sndbulkpipe(us->pusb_dev,
849 ep_out->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); 678 usb_endpoint_num(ep_out));
850 us->recv_bulk_pipe = usb_rcvbulkpipe(us->pusb_dev, 679 us->recv_bulk_pipe = usb_rcvbulkpipe(us->pusb_dev,
851 ep_in->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); 680 usb_endpoint_num(ep_in));
852 if (ep_int) { 681 if (ep_int) {
853 us->recv_intr_pipe = usb_rcvintpipe(us->pusb_dev, 682 us->recv_intr_pipe = usb_rcvintpipe(us->pusb_dev,
854 ep_int->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); 683 usb_endpoint_num(ep_int));
855 us->ep_bInterval = ep_int->bInterval; 684 us->ep_bInterval = ep_int->bInterval;
856 } 685 }
857 return 0; 686 return 0;
@@ -1012,17 +841,15 @@ static int usb_stor_scan_thread(void * __us)
1012} 841}
1013 842
1014 843
1015/* Probe to see if we can drive a newly-connected USB device */ 844/* First part of general USB mass-storage probing */
1016static int storage_probe(struct usb_interface *intf, 845int usb_stor_probe1(struct us_data **pus,
1017 const struct usb_device_id *id) 846 struct usb_interface *intf,
847 const struct usb_device_id *id,
848 struct us_unusual_dev *unusual_dev)
1018{ 849{
1019 struct Scsi_Host *host; 850 struct Scsi_Host *host;
1020 struct us_data *us; 851 struct us_data *us;
1021 int result; 852 int result;
1022 struct task_struct *th;
1023
1024 if (usb_usual_check_type(id, USB_US_TYPE_STOR))
1025 return -ENXIO;
1026 853
1027 US_DEBUGP("USB Mass Storage device detected\n"); 854 US_DEBUGP("USB Mass Storage device detected\n");
1028 855
@@ -1041,7 +868,7 @@ static int storage_probe(struct usb_interface *intf,
1041 * Allow 16-byte CDBs and thus > 2TB 868 * Allow 16-byte CDBs and thus > 2TB
1042 */ 869 */
1043 host->max_cmd_len = 16; 870 host->max_cmd_len = 16;
1044 us = host_to_us(host); 871 *pus = us = host_to_us(host);
1045 memset(us, 0, sizeof(struct us_data)); 872 memset(us, 0, sizeof(struct us_data));
1046 mutex_init(&(us->dev_mutex)); 873 mutex_init(&(us->dev_mutex));
1047 init_completion(&us->cmnd_ready); 874 init_completion(&us->cmnd_ready);
@@ -1054,24 +881,46 @@ static int storage_probe(struct usb_interface *intf,
1054 if (result) 881 if (result)
1055 goto BadDevice; 882 goto BadDevice;
1056 883
1057 /* 884 /* Get the unusual_devs entries and the descriptors */
1058 * Get the unusual_devs entries and the descriptors 885 result = get_device_info(us, id, unusual_dev);
1059 *
1060 * id_index is calculated in the declaration to be the index number
1061 * of the match from the usb_device_id table, so we can find the
1062 * corresponding entry in the private table.
1063 */
1064 result = get_device_info(us, id);
1065 if (result) 886 if (result)
1066 goto BadDevice; 887 goto BadDevice;
1067 888
1068 /* Get the transport, protocol, and pipe settings */ 889 /* Get standard transport and protocol settings */
1069 result = get_transport(us); 890 get_transport(us);
1070 if (result) 891 get_protocol(us);
1071 goto BadDevice; 892
1072 result = get_protocol(us); 893 /* Give the caller a chance to fill in specialized transport
1073 if (result) 894 * or protocol settings.
895 */
896 return 0;
897
898BadDevice:
899 US_DEBUGP("storage_probe() failed\n");
900 release_everything(us);
901 return result;
902}
903EXPORT_SYMBOL_GPL(usb_stor_probe1);
904
905/* Second part of general USB mass-storage probing */
906int usb_stor_probe2(struct us_data *us)
907{
908 struct task_struct *th;
909 int result;
910
911 /* Make sure the transport and protocol have both been set */
912 if (!us->transport || !us->proto_handler) {
913 result = -ENXIO;
1074 goto BadDevice; 914 goto BadDevice;
915 }
916 US_DEBUGP("Transport: %s\n", us->transport_name);
917 US_DEBUGP("Protocol: %s\n", us->protocol_name);
918
919 /* fix for single-lun devices */
920 if (us->fflags & US_FL_SINGLE_LUN)
921 us->max_lun = 0;
922
923 /* Find the endpoints and calculate pipe values */
1075 result = get_pipes(us); 924 result = get_pipes(us);
1076 if (result) 925 if (result)
1077 goto BadDevice; 926 goto BadDevice;
@@ -1080,7 +929,7 @@ static int storage_probe(struct usb_interface *intf,
1080 result = usb_stor_acquire_resources(us); 929 result = usb_stor_acquire_resources(us);
1081 if (result) 930 if (result)
1082 goto BadDevice; 931 goto BadDevice;
1083 result = scsi_add_host(host, &intf->dev); 932 result = scsi_add_host(us_to_host(us), &us->pusb_intf->dev);
1084 if (result) { 933 if (result) {
1085 printk(KERN_WARNING USB_STORAGE 934 printk(KERN_WARNING USB_STORAGE
1086 "Unable to add the scsi host\n"); 935 "Unable to add the scsi host\n");
@@ -1108,9 +957,10 @@ BadDevice:
1108 release_everything(us); 957 release_everything(us);
1109 return result; 958 return result;
1110} 959}
960EXPORT_SYMBOL_GPL(usb_stor_probe2);
1111 961
1112/* Handle a disconnect event from the USB core */ 962/* Handle a USB mass-storage disconnect */
1113static void storage_disconnect(struct usb_interface *intf) 963void usb_stor_disconnect(struct usb_interface *intf)
1114{ 964{
1115 struct us_data *us = usb_get_intfdata(intf); 965 struct us_data *us = usb_get_intfdata(intf);
1116 966
@@ -1118,6 +968,42 @@ static void storage_disconnect(struct usb_interface *intf)
1118 quiesce_and_remove_host(us); 968 quiesce_and_remove_host(us);
1119 release_everything(us); 969 release_everything(us);
1120} 970}
971EXPORT_SYMBOL_GPL(usb_stor_disconnect);
972
973/* The main probe routine for standard devices */
974static int storage_probe(struct usb_interface *intf,
975 const struct usb_device_id *id)
976{
977 struct us_data *us;
978 int result;
979
980 /*
981 * If libusual is configured, let it decide whether a standard
982 * device should be handled by usb-storage or by ub.
983 * If the device isn't standard (is handled by a subdriver
984 * module) then don't accept it.
985 */
986 if (usb_usual_check_type(id, USB_US_TYPE_STOR) ||
987 usb_usual_ignore_device(intf))
988 return -ENXIO;
989
990 /*
991 * Call the general probe procedures.
992 *
993 * The unusual_dev_list array is parallel to the usb_storage_usb_ids
994 * table, so we use the index of the id entry to find the
995 * corresponding unusual_devs entry.
996 */
997 result = usb_stor_probe1(&us, intf, id,
998 (id - usb_storage_usb_ids) + us_unusual_dev_list);
999 if (result)
1000 return result;
1001
1002 /* No special transport or protocol settings in the main module */
1003
1004 result = usb_stor_probe2(us);
1005 return result;
1006}
1121 1007
1122/*********************************************************************** 1008/***********************************************************************
1123 * Initialization and registration 1009 * Initialization and registration
@@ -1126,15 +1012,13 @@ static void storage_disconnect(struct usb_interface *intf)
1126static struct usb_driver usb_storage_driver = { 1012static struct usb_driver usb_storage_driver = {
1127 .name = "usb-storage", 1013 .name = "usb-storage",
1128 .probe = storage_probe, 1014 .probe = storage_probe,
1129 .disconnect = storage_disconnect, 1015 .disconnect = usb_stor_disconnect,
1130#ifdef CONFIG_PM 1016 .suspend = usb_stor_suspend,
1131 .suspend = storage_suspend, 1017 .resume = usb_stor_resume,
1132 .resume = storage_resume, 1018 .reset_resume = usb_stor_reset_resume,
1133 .reset_resume = storage_reset_resume, 1019 .pre_reset = usb_stor_pre_reset,
1134#endif 1020 .post_reset = usb_stor_post_reset,
1135 .pre_reset = storage_pre_reset, 1021 .id_table = usb_storage_usb_ids,
1136 .post_reset = storage_post_reset,
1137 .id_table = storage_usb_ids,
1138 .soft_unbind = 1, 1022 .soft_unbind = 1,
1139}; 1023};
1140 1024
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
index 65e674e4be99..2609efb2bd7e 100644
--- a/drivers/usb/storage/usb.h
+++ b/drivers/usb/storage/usb.h
@@ -177,4 +177,25 @@ extern void fill_inquiry_response(struct us_data *us,
177#define scsi_unlock(host) spin_unlock_irq(host->host_lock) 177#define scsi_unlock(host) spin_unlock_irq(host->host_lock)
178#define scsi_lock(host) spin_lock_irq(host->host_lock) 178#define scsi_lock(host) spin_lock_irq(host->host_lock)
179 179
180/* General routines provided by the usb-storage standard core */
181#ifdef CONFIG_PM
182extern int usb_stor_suspend(struct usb_interface *iface, pm_message_t message);
183extern int usb_stor_resume(struct usb_interface *iface);
184extern int usb_stor_reset_resume(struct usb_interface *iface);
185#else
186#define usb_stor_suspend NULL
187#define usb_stor_resume NULL
188#define usb_stor_reset_resume NULL
189#endif
190
191extern int usb_stor_pre_reset(struct usb_interface *iface);
192extern int usb_stor_post_reset(struct usb_interface *iface);
193
194extern int usb_stor_probe1(struct us_data **pus,
195 struct usb_interface *intf,
196 const struct usb_device_id *id,
197 struct us_unusual_dev *unusual_dev);
198extern int usb_stor_probe2(struct us_data *us);
199extern void usb_stor_disconnect(struct usb_interface *intf);
200
180#endif 201#endif
diff --git a/drivers/usb/storage/usual-tables.c b/drivers/usb/storage/usual-tables.c
new file mode 100644
index 000000000000..468bde7d1971
--- /dev/null
+++ b/drivers/usb/storage/usual-tables.c
@@ -0,0 +1,116 @@
1/* Driver for USB Mass Storage devices
2 * Usual Tables File for usb-storage and libusual
3 *
4 * Copyright (C) 2009 Alan Stern (stern@rowland.harvard.edu)
5 *
6 * Please see http://www.one-eyed-alien.net/~mdharm/linux-usb for more
7 * information about this driver.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2, or (at your option) any
12 * later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#include <linux/kernel.h>
25#include <linux/module.h>
26#include <linux/usb.h>
27#include <linux/usb_usual.h>
28
29
30/*
31 * The table of devices
32 */
33#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
34 vendorName, productName, useProtocol, useTransport, \
35 initFunction, flags) \
36{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
37 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
38
39#define COMPLIANT_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
40 vendorName, productName, useProtocol, useTransport, \
41 initFunction, flags) \
42{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
43 .driver_info = (flags) }
44
45#define USUAL_DEV(useProto, useTrans, useType) \
46{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans), \
47 .driver_info = ((useType)<<24) }
48
49struct usb_device_id usb_storage_usb_ids[] = {
50# include "unusual_devs.h"
51 { } /* Terminating entry */
52};
53EXPORT_SYMBOL_GPL(usb_storage_usb_ids);
54
55MODULE_DEVICE_TABLE(usb, usb_storage_usb_ids);
56
57#undef UNUSUAL_DEV
58#undef COMPLIANT_DEV
59#undef USUAL_DEV
60
61
62/*
63 * The table of devices to ignore
64 */
65struct ignore_entry {
66 u16 vid, pid, bcdmin, bcdmax;
67};
68
69#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
70 vendorName, productName, useProtocol, useTransport, \
71 initFunction, flags) \
72{ \
73 .vid = id_vendor, \
74 .pid = id_product, \
75 .bcdmin = bcdDeviceMin, \
76 .bcdmax = bcdDeviceMax, \
77}
78
79static struct ignore_entry ignore_ids[] = {
80# include "unusual_alauda.h"
81# include "unusual_cypress.h"
82# include "unusual_datafab.h"
83# include "unusual_freecom.h"
84# include "unusual_isd200.h"
85# include "unusual_jumpshot.h"
86# include "unusual_karma.h"
87# include "unusual_onetouch.h"
88# include "unusual_sddr09.h"
89# include "unusual_sddr55.h"
90# include "unusual_usbat.h"
91 { } /* Terminating entry */
92};
93
94#undef UNUSUAL_DEV
95
96
97/* Return an error if a device is in the ignore_ids list */
98int usb_usual_ignore_device(struct usb_interface *intf)
99{
100 struct usb_device *udev;
101 unsigned vid, pid, bcd;
102 struct ignore_entry *p;
103
104 udev = interface_to_usbdev(intf);
105 vid = le16_to_cpu(udev->descriptor.idVendor);
106 pid = le16_to_cpu(udev->descriptor.idProduct);
107 bcd = le16_to_cpu(udev->descriptor.bcdDevice);
108
109 for (p = ignore_ids; p->vid; ++p) {
110 if (p->vid == vid && p->pid == pid &&
111 p->bcdmin <= bcd && p->bcdmax >= bcd)
112 return -ENXIO;
113 }
114 return 0;
115}
116EXPORT_SYMBOL_GPL(usb_usual_ignore_device);