aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/storage/Kconfig4
-rw-r--r--drivers/usb/storage/Makefile3
-rw-r--r--drivers/usb/storage/alauda.c163
-rw-r--r--drivers/usb/storage/alauda.h100
-rw-r--r--drivers/usb/storage/unusual_alauda.h31
-rw-r--r--drivers/usb/storage/unusual_devs.h14
-rw-r--r--drivers/usb/storage/usb.c12
-rw-r--r--drivers/usb/storage/usual-tables.c1
8 files changed, 197 insertions, 131 deletions
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
index 43e1afeb7f8c..c56c2c6d37b7 100644
--- a/drivers/usb/storage/Kconfig
+++ b/drivers/usb/storage/Kconfig
@@ -119,7 +119,7 @@ config USB_STORAGE_JUMPSHOT
119 If this driver is compiled as a module, it will be named ums-jumpshot. 119 If this driver is compiled as a module, it will be named ums-jumpshot.
120 120
121config USB_STORAGE_ALAUDA 121config USB_STORAGE_ALAUDA
122 bool "Olympus MAUSB-10/Fuji DPC-R1 support" 122 tristate "Olympus MAUSB-10/Fuji DPC-R1 support"
123 depends on USB_STORAGE 123 depends on USB_STORAGE
124 help 124 help
125 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
@@ -128,6 +128,8 @@ config USB_STORAGE_ALAUDA
128 These devices are based on the Alauda chip and support both 128 These devices are based on the Alauda chip and support both
129 XD and SmartMedia cards. 129 XD and SmartMedia cards.
130 130
131 If this driver is compiled as a module, it will be named ums-alauda.
132
131config USB_STORAGE_ONETOUCH 133config USB_STORAGE_ONETOUCH
132 bool "Support OneTouch Button on Maxtor Hard Drives" 134 bool "Support OneTouch Button on Maxtor Hard Drives"
133 depends on USB_STORAGE 135 depends on USB_STORAGE
diff --git a/drivers/usb/storage/Makefile b/drivers/usb/storage/Makefile
index 7b9d53563d34..fea05c0b6765 100644
--- a/drivers/usb/storage/Makefile
+++ b/drivers/usb/storage/Makefile
@@ -10,7 +10,6 @@ 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_ALAUDA) += alauda.o
14usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o 13usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o
15usb-storage-obj-$(CONFIG_USB_STORAGE_KARMA) += karma.o 14usb-storage-obj-$(CONFIG_USB_STORAGE_KARMA) += karma.o
16 15
@@ -23,6 +22,7 @@ else
23 obj-$(CONFIG_USB) += libusual.o usual-tables.o 22 obj-$(CONFIG_USB) += libusual.o usual-tables.o
24endif 23endif
25 24
25obj-$(CONFIG_USB_STORAGE_ALAUDA) += ums-alauda.o
26obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += ums-cypress.o 26obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += ums-cypress.o
27obj-$(CONFIG_USB_STORAGE_DATAFAB) += ums-datafab.o 27obj-$(CONFIG_USB_STORAGE_DATAFAB) += ums-datafab.o
28obj-$(CONFIG_USB_STORAGE_FREECOM) += ums-freecom.o 28obj-$(CONFIG_USB_STORAGE_FREECOM) += ums-freecom.o
@@ -32,6 +32,7 @@ obj-$(CONFIG_USB_STORAGE_SDDR09) += ums-sddr09.o
32obj-$(CONFIG_USB_STORAGE_SDDR55) += ums-sddr55.o 32obj-$(CONFIG_USB_STORAGE_SDDR55) += ums-sddr55.o
33obj-$(CONFIG_USB_STORAGE_USBAT) += ums-usbat.o 33obj-$(CONFIG_USB_STORAGE_USBAT) += ums-usbat.o
34 34
35ums-alauda-objs := alauda.o
35ums-cypress-objs := cypress_atacb.o 36ums-cypress-objs := cypress_atacb.o
36ums-datafab-objs := datafab.o 37ums-datafab-objs := datafab.o
37ums-freecom-objs := freecom.o 38ums-freecom-objs := freecom.o
diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c
index 5407411e30e0..d3a88ebe690b 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,75 @@
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
45/*
46 * Status bytes
47 */
48#define ALAUDA_STATUS_ERROR 0x01
49#define ALAUDA_STATUS_READY 0x40
50
51/*
52 * Control opcodes (for request field)
53 */
54#define ALAUDA_GET_XD_MEDIA_STATUS 0x08
55#define ALAUDA_GET_SM_MEDIA_STATUS 0x98
56#define ALAUDA_ACK_XD_MEDIA_CHANGE 0x0a
57#define ALAUDA_ACK_SM_MEDIA_CHANGE 0x9a
58#define ALAUDA_GET_XD_MEDIA_SIG 0x86
59#define ALAUDA_GET_SM_MEDIA_SIG 0x96
60
61/*
62 * Bulk command identity (byte 0)
63 */
64#define ALAUDA_BULK_CMD 0x40
65
66/*
67 * Bulk opcodes (byte 1)
68 */
69#define ALAUDA_BULK_GET_REDU_DATA 0x85
70#define ALAUDA_BULK_READ_BLOCK 0x94
71#define ALAUDA_BULK_ERASE_BLOCK 0xa3
72#define ALAUDA_BULK_WRITE_BLOCK 0xb4
73#define ALAUDA_BULK_GET_STATUS2 0xb7
74#define ALAUDA_BULK_RESET_MEDIA 0xe0
75
76/*
77 * Port to operate on (byte 8)
78 */
79#define ALAUDA_PORT_XD 0x00
80#define ALAUDA_PORT_SM 0x01
81
82/*
83 * LBA and PBA are unsigned ints. Special values.
84 */
85#define UNDEF 0xffff
86#define SPARE 0xfffe
87#define UNUSABLE 0xfffd
88
89struct alauda_media_info {
90 unsigned long capacity; /* total media size in bytes */
91 unsigned int pagesize; /* page size in bytes */
92 unsigned int blocksize; /* number of pages per block */
93 unsigned int uzonesize; /* number of usable blocks per zone */
94 unsigned int zonesize; /* number of blocks per zone */
95 unsigned int blockmask; /* mask to get page from address */
96
97 unsigned char pageshift;
98 unsigned char blockshift;
99 unsigned char zoneshift;
100
101 u16 **lba_to_pba; /* logical to physical block map */
102 u16 **pba_to_lba; /* physical to logical block map */
103};
104
105struct alauda_info {
106 struct alauda_media_info port[2];
107 int wr_ep; /* endpoint to write data out of */
108
109 unsigned char sense_key;
110 unsigned long sense_asc; /* additional sense code */
111 unsigned long sense_ascq; /* additional sense code qualifier */
112};
43 113
44#define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) ) 114#define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) )
45#define LSB_of(s) ((s)&0xFF) 115#define LSB_of(s) ((s)&0xFF)
@@ -52,6 +122,48 @@
52#define PBA_HI(pba) (pba >> 3) 122#define PBA_HI(pba) (pba >> 3)
53#define PBA_ZONE(pba) (pba >> 11) 123#define PBA_ZONE(pba) (pba >> 11)
54 124
125static int init_alauda(struct us_data *us);
126
127
128/*
129 * The table of devices
130 */
131#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
132 vendorName, productName, useProtocol, useTransport, \
133 initFunction, flags) \
134{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
135 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
136
137struct usb_device_id alauda_usb_ids[] = {
138# include "unusual_alauda.h"
139 { } /* Terminating entry */
140};
141MODULE_DEVICE_TABLE(usb, alauda_usb_ids);
142
143#undef UNUSUAL_DEV
144
145/*
146 * The flags table
147 */
148#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
149 vendor_name, product_name, use_protocol, use_transport, \
150 init_function, Flags) \
151{ \
152 .vendorName = vendor_name, \
153 .productName = product_name, \
154 .useProtocol = use_protocol, \
155 .useTransport = use_transport, \
156 .initFunction = init_function, \
157}
158
159static struct us_unusual_dev alauda_unusual_dev_list[] = {
160# include "unusual_alauda.h"
161 { } /* Terminating entry */
162};
163
164#undef UNUSUAL_DEV
165
166
55/* 167/*
56 * Media handling 168 * Media handling
57 */ 169 */
@@ -998,7 +1110,7 @@ static void alauda_info_destructor(void *extra)
998/* 1110/*
999 * Initialize alauda_info struct and find the data-write endpoint 1111 * Initialize alauda_info struct and find the data-write endpoint
1000 */ 1112 */
1001int init_alauda(struct us_data *us) 1113static int init_alauda(struct us_data *us)
1002{ 1114{
1003 struct alauda_info *info; 1115 struct alauda_info *info;
1004 struct usb_host_interface *altsetting = us->pusb_intf->cur_altsetting; 1116 struct usb_host_interface *altsetting = us->pusb_intf->cur_altsetting;
@@ -1020,7 +1132,7 @@ int init_alauda(struct us_data *us)
1020 return USB_STOR_TRANSPORT_GOOD; 1132 return USB_STOR_TRANSPORT_GOOD;
1021} 1133}
1022 1134
1023int alauda_transport(struct scsi_cmnd *srb, struct us_data *us) 1135static int alauda_transport(struct scsi_cmnd *srb, struct us_data *us)
1024{ 1136{
1025 int rc; 1137 int rc;
1026 struct alauda_info *info = (struct alauda_info *) us->extra; 1138 struct alauda_info *info = (struct alauda_info *) us->extra;
@@ -1128,3 +1240,48 @@ int alauda_transport(struct scsi_cmnd *srb, struct us_data *us)
1128 return USB_STOR_TRANSPORT_FAILED; 1240 return USB_STOR_TRANSPORT_FAILED;
1129} 1241}
1130 1242
1243static int alauda_probe(struct usb_interface *intf,
1244 const struct usb_device_id *id)
1245{
1246 struct us_data *us;
1247 int result;
1248
1249 result = usb_stor_probe1(&us, intf, id,
1250 (id - alauda_usb_ids) + alauda_unusual_dev_list);
1251 if (result)
1252 return result;
1253
1254 us->transport_name = "Alauda Control/Bulk";
1255 us->transport = alauda_transport;
1256 us->transport_reset = usb_stor_Bulk_reset;
1257 us->max_lun = 1;
1258
1259 result = usb_stor_probe2(us);
1260 return result;
1261}
1262
1263static struct usb_driver alauda_driver = {
1264 .name = "ums-alauda",
1265 .probe = alauda_probe,
1266 .disconnect = usb_stor_disconnect,
1267 .suspend = usb_stor_suspend,
1268 .resume = usb_stor_resume,
1269 .reset_resume = usb_stor_reset_resume,
1270 .pre_reset = usb_stor_pre_reset,
1271 .post_reset = usb_stor_post_reset,
1272 .id_table = alauda_usb_ids,
1273 .soft_unbind = 1,
1274};
1275
1276static int __init alauda_init(void)
1277{
1278 return usb_register(&alauda_driver);
1279}
1280
1281static void __exit alauda_exit(void)
1282{
1283 usb_deregister(&alauda_driver);
1284}
1285
1286module_init(alauda_init);
1287module_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/unusual_alauda.h b/drivers/usb/storage/unusual_alauda.h
new file mode 100644
index 000000000000..8c412f885dd2
--- /dev/null
+++ b/drivers/usb/storage/unusual_alauda.h
@@ -0,0 +1,31 @@
1/* Unusual Devices File for the Alauda-based card readers
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_ALAUDA) || \
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),
25
26UNUSUAL_DEV( 0x07b4, 0x010a, 0x0102, 0x0102,
27 "Olympus",
28 "MAUSB-10 (Alauda)",
29 US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0),
30
31#endif /* defined(CONFIG_USB_STORAGE_ALAUDA) || ... */
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 24e23c29d292..bcdb74dfa3db 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -692,13 +692,6 @@ UNUSUAL_DEV( 0x057b, 0x0022, 0x0000, 0x9999,
692 "Silicon Media R/W", 692 "Silicon Media R/W",
693 US_SC_DEVICE, US_PR_DEVICE, NULL, 0), 693 US_SC_DEVICE, US_PR_DEVICE, NULL, 0),
694 694
695#ifdef CONFIG_USB_STORAGE_ALAUDA
696UNUSUAL_DEV( 0x0584, 0x0008, 0x0102, 0x0102,
697 "Fujifilm",
698 "DPC-R1 (Alauda)",
699 US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0 ),
700#endif
701
702/* Reported by RTE <raszilki@yandex.ru> */ 695/* Reported by RTE <raszilki@yandex.ru> */
703UNUSUAL_DEV( 0x058f, 0x6387, 0x0141, 0x0141, 696UNUSUAL_DEV( 0x058f, 0x6387, 0x0141, 0x0141,
704 "JetFlash", 697 "JetFlash",
@@ -977,13 +970,6 @@ UNUSUAL_DEV( 0x07af, 0x0006, 0x0100, 0x0100,
977 US_FL_SINGLE_LUN ), 970 US_FL_SINGLE_LUN ),
978#endif 971#endif
979 972
980#ifdef CONFIG_USB_STORAGE_ALAUDA
981UNUSUAL_DEV( 0x07b4, 0x010a, 0x0102, 0x0102,
982 "Olympus",
983 "MAUSB-10 (Alauda)",
984 US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0 ),
985#endif
986
987/* Datafab KECF-USB / Sagatek DCS-CF / Simpletech Flashlink UCF-100 973/* Datafab KECF-USB / Sagatek DCS-CF / Simpletech Flashlink UCF-100
988 * Only revision 1.13 tested (same for all of the above devices, 974 * Only revision 1.13 tested (same for all of the above devices,
989 * based on the Datafab DF-UG-07 chip). Needed for US_FL_FIX_INQUIRY. 975 * based on the Datafab DF-UG-07 chip). Needed for US_FL_FIX_INQUIRY.
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 2ea57691a7ba..cd039c008462 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -69,9 +69,6 @@
69#ifdef CONFIG_USB_STORAGE_ONETOUCH 69#ifdef CONFIG_USB_STORAGE_ONETOUCH
70#include "onetouch.h" 70#include "onetouch.h"
71#endif 71#endif
72#ifdef CONFIG_USB_STORAGE_ALAUDA
73#include "alauda.h"
74#endif
75#ifdef CONFIG_USB_STORAGE_KARMA 72#ifdef CONFIG_USB_STORAGE_KARMA
76#include "karma.h" 73#include "karma.h"
77#endif 74#endif
@@ -598,15 +595,6 @@ static void get_transport(struct us_data *us)
598 us->transport_reset = usb_stor_Bulk_reset; 595 us->transport_reset = usb_stor_Bulk_reset;
599 break; 596 break;
600 597
601#ifdef CONFIG_USB_STORAGE_ALAUDA
602 case US_PR_ALAUDA:
603 us->transport_name = "Alauda Control/Bulk";
604 us->transport = alauda_transport;
605 us->transport_reset = usb_stor_Bulk_reset;
606 us->max_lun = 1;
607 break;
608#endif
609
610#ifdef CONFIG_USB_STORAGE_KARMA 598#ifdef CONFIG_USB_STORAGE_KARMA
611 case US_PR_KARMA: 599 case US_PR_KARMA:
612 us->transport_name = "Rio Karma/Bulk"; 600 us->transport_name = "Rio Karma/Bulk";
diff --git a/drivers/usb/storage/usual-tables.c b/drivers/usb/storage/usual-tables.c
index 182a097e0767..ad102e8e191b 100644
--- a/drivers/usb/storage/usual-tables.c
+++ b/drivers/usb/storage/usual-tables.c
@@ -77,6 +77,7 @@ struct ignore_entry {
77} 77}
78 78
79static struct ignore_entry ignore_ids[] = { 79static struct ignore_entry ignore_ids[] = {
80# include "unusual_alauda.h"
80# include "unusual_cypress.h" 81# include "unusual_cypress.h"
81# include "unusual_datafab.h" 82# include "unusual_datafab.h"
82# include "unusual_freecom.h" 83# include "unusual_freecom.h"