diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2009-02-12 14:48:04 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-24 19:20:34 -0400 |
commit | fcdb51401f7f695b7fb782721b2e33372c5a06ce (patch) | |
tree | 8072a6b8a09a52f106bddd29bc9a41069009d966 /drivers | |
parent | 70fcc0050733a7cd1b452cfa3de3a9b376412565 (diff) |
usb-storage: make cypress_atacb a separate module
This patch (as1210) converts usb-storage's cypress_atacb subdriver
into a separate module.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/storage/Kconfig | 4 | ||||
-rw-r--r-- | drivers/usb/storage/Makefile | 3 | ||||
-rw-r--r-- | drivers/usb/storage/cypress_atacb.c | 88 | ||||
-rw-r--r-- | drivers/usb/storage/unusual_cypress.h (renamed from drivers/usb/storage/cypress_atacb.h) | 27 | ||||
-rw-r--r-- | drivers/usb/storage/unusual_devs.h | 16 | ||||
-rw-r--r-- | drivers/usb/storage/usb.c | 11 | ||||
-rw-r--r-- | drivers/usb/storage/usual-tables.c | 1 |
7 files changed, 111 insertions, 39 deletions
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig index e6cc245257f8..2c73fa97d94d 100644 --- a/drivers/usb/storage/Kconfig +++ b/drivers/usb/storage/Kconfig | |||
@@ -146,7 +146,7 @@ config USB_STORAGE_KARMA | |||
146 | operation. | 146 | operation. |
147 | 147 | ||
148 | config USB_STORAGE_CYPRESS_ATACB | 148 | config USB_STORAGE_CYPRESS_ATACB |
149 | bool "SAT emulation on Cypress USB/ATA Bridge with ATACB" | 149 | tristate "SAT emulation on Cypress USB/ATA Bridge with ATACB" |
150 | depends on USB_STORAGE | 150 | depends on USB_STORAGE |
151 | ---help--- | 151 | ---help--- |
152 | Say Y here if you want to use SAT (ata pass through) on devices based | 152 | Say Y here if you want to use SAT (ata pass through) on devices based |
@@ -156,6 +156,8 @@ config USB_STORAGE_CYPRESS_ATACB | |||
156 | If you say no here your device will still work with the standard usb | 156 | If you say no here your device will still work with the standard usb |
157 | mass storage class. | 157 | mass storage class. |
158 | 158 | ||
159 | If this driver is compiled as a module, it will be named ums-cypress. | ||
160 | |||
159 | config USB_LIBUSUAL | 161 | config USB_LIBUSUAL |
160 | bool "The shared table of common (or usual) storage devices" | 162 | bool "The shared table of common (or usual) storage devices" |
161 | depends on USB | 163 | depends on USB |
diff --git a/drivers/usb/storage/Makefile b/drivers/usb/storage/Makefile index 5fb7847e41a4..0650f022e561 100644 --- a/drivers/usb/storage/Makefile +++ b/drivers/usb/storage/Makefile | |||
@@ -17,7 +17,6 @@ usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += jumpshot.o | |||
17 | usb-storage-obj-$(CONFIG_USB_STORAGE_ALAUDA) += alauda.o | 17 | usb-storage-obj-$(CONFIG_USB_STORAGE_ALAUDA) += alauda.o |
18 | usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o | 18 | usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o |
19 | usb-storage-obj-$(CONFIG_USB_STORAGE_KARMA) += karma.o | 19 | usb-storage-obj-$(CONFIG_USB_STORAGE_KARMA) += karma.o |
20 | usb-storage-obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += cypress_atacb.o | ||
21 | 20 | ||
22 | usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \ | 21 | usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \ |
23 | initializers.o sierra_ms.o option_ms.o $(usb-storage-obj-y) | 22 | initializers.o sierra_ms.o option_ms.o $(usb-storage-obj-y) |
@@ -28,10 +27,12 @@ else | |||
28 | obj-$(CONFIG_USB) += libusual.o usual-tables.o | 27 | obj-$(CONFIG_USB) += libusual.o usual-tables.o |
29 | endif | 28 | endif |
30 | 29 | ||
30 | obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += ums-cypress.o | ||
31 | obj-$(CONFIG_USB_STORAGE_ISD200) += ums-isd200.o | 31 | obj-$(CONFIG_USB_STORAGE_ISD200) += ums-isd200.o |
32 | obj-$(CONFIG_USB_STORAGE_SDDR09) += ums-sddr09.o | 32 | obj-$(CONFIG_USB_STORAGE_SDDR09) += ums-sddr09.o |
33 | obj-$(CONFIG_USB_STORAGE_SDDR55) += ums-sddr55.o | 33 | obj-$(CONFIG_USB_STORAGE_SDDR55) += ums-sddr55.o |
34 | 34 | ||
35 | ums-cypress-objs := cypress_atacb.o | ||
35 | ums-isd200-objs := isd200.o | 36 | ums-isd200-objs := isd200.o |
36 | ums-sddr09-objs := sddr09.o | 37 | ums-sddr09-objs := sddr09.o |
37 | ums-sddr55-objs := sddr55.o | 38 | ums-sddr55-objs := sddr55.o |
diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c index 9466a99baab6..19306f7b1dae 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,46 @@ | |||
29 | #include "scsiglue.h" | 30 | #include "scsiglue.h" |
30 | #include "debug.h" | 31 | #include "debug.h" |
31 | 32 | ||
33 | |||
34 | /* | ||
35 | * The table of devices | ||
36 | */ | ||
37 | #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ | ||
38 | vendorName, productName, useProtocol, useTransport, \ | ||
39 | initFunction, flags) \ | ||
40 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ | ||
41 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } | ||
42 | |||
43 | struct usb_device_id cypress_usb_ids[] = { | ||
44 | # include "unusual_cypress.h" | ||
45 | { } /* Terminating entry */ | ||
46 | }; | ||
47 | MODULE_DEVICE_TABLE(usb, cypress_usb_ids); | ||
48 | |||
49 | #undef UNUSUAL_DEV | ||
50 | |||
51 | /* | ||
52 | * The flags table | ||
53 | */ | ||
54 | #define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \ | ||
55 | vendor_name, product_name, use_protocol, use_transport, \ | ||
56 | init_function, Flags) \ | ||
57 | { \ | ||
58 | .vendorName = vendor_name, \ | ||
59 | .productName = product_name, \ | ||
60 | .useProtocol = use_protocol, \ | ||
61 | .useTransport = use_transport, \ | ||
62 | .initFunction = init_function, \ | ||
63 | } | ||
64 | |||
65 | static struct us_unusual_dev cypress_unusual_dev_list[] = { | ||
66 | # include "unusual_cypress.h" | ||
67 | { } /* Terminating entry */ | ||
68 | }; | ||
69 | |||
70 | #undef UNUSUAL_DEV | ||
71 | |||
72 | |||
32 | /* | 73 | /* |
33 | * ATACB is a protocol used on cypress usb<->ata bridge to | 74 | * ATACB is a protocol used on cypress usb<->ata bridge to |
34 | * send raw ATA command over mass storage | 75 | * send raw ATA command over mass storage |
@@ -36,7 +77,7 @@ | |||
36 | * More info that be found on cy7c68310_8.pdf and cy7c68300c_8.pdf | 77 | * More info that be found on cy7c68310_8.pdf and cy7c68300c_8.pdf |
37 | * datasheet from cypress.com. | 78 | * datasheet from cypress.com. |
38 | */ | 79 | */ |
39 | void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us) | 80 | static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us) |
40 | { | 81 | { |
41 | unsigned char save_cmnd[MAX_COMMAND_SIZE]; | 82 | unsigned char save_cmnd[MAX_COMMAND_SIZE]; |
42 | 83 | ||
@@ -197,3 +238,48 @@ end: | |||
197 | if (srb->cmnd[0] == ATA_12) | 238 | if (srb->cmnd[0] == ATA_12) |
198 | srb->cmd_len = 12; | 239 | srb->cmd_len = 12; |
199 | } | 240 | } |
241 | |||
242 | |||
243 | static int cypress_probe(struct usb_interface *intf, | ||
244 | const struct usb_device_id *id) | ||
245 | { | ||
246 | struct us_data *us; | ||
247 | int result; | ||
248 | |||
249 | result = usb_stor_probe1(&us, intf, id, | ||
250 | (id - cypress_usb_ids) + cypress_unusual_dev_list); | ||
251 | if (result) | ||
252 | return result; | ||
253 | |||
254 | us->protocol_name = "Transparent SCSI with Cypress ATACB"; | ||
255 | us->proto_handler = cypress_atacb_passthrough; | ||
256 | |||
257 | result = usb_stor_probe2(us); | ||
258 | return result; | ||
259 | } | ||
260 | |||
261 | static struct usb_driver cypress_driver = { | ||
262 | .name = "ums-cypress", | ||
263 | .probe = cypress_probe, | ||
264 | .disconnect = usb_stor_disconnect, | ||
265 | .suspend = usb_stor_suspend, | ||
266 | .resume = usb_stor_resume, | ||
267 | .reset_resume = usb_stor_reset_resume, | ||
268 | .pre_reset = usb_stor_pre_reset, | ||
269 | .post_reset = usb_stor_post_reset, | ||
270 | .id_table = cypress_usb_ids, | ||
271 | .soft_unbind = 1, | ||
272 | }; | ||
273 | |||
274 | static int __init cypress_init(void) | ||
275 | { | ||
276 | return usb_register(&cypress_driver); | ||
277 | } | ||
278 | |||
279 | static void __exit cypress_exit(void) | ||
280 | { | ||
281 | usb_deregister(&cypress_driver); | ||
282 | } | ||
283 | |||
284 | module_init(cypress_init); | ||
285 | module_exit(cypress_exit); | ||
diff --git a/drivers/usb/storage/cypress_atacb.h b/drivers/usb/storage/unusual_cypress.h index fbada898d56b..44be6d75dab6 100644 --- a/drivers/usb/storage/cypress_atacb.h +++ b/drivers/usb/storage/unusual_cypress.h | |||
@@ -1,8 +1,5 @@ | |||
1 | /* | 1 | /* Unusual Devices File for devices based on the Cypress USB/ATA bridge |
2 | * Support for emulating SAT (ata pass through) on devices based | 2 | * with support for ATACB |
3 | * on the Cypress USB/ATA bridge supporting ATACB. | ||
4 | * | ||
5 | * Copyright (c) 2008 Matthieu Castet (castet.matthieu@free.fr) | ||
6 | * | 3 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 4 | * 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 | 5 | * under the terms of the GNU General Public License as published by the |
@@ -19,7 +16,19 @@ | |||
19 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 16 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | */ | 17 | */ |
21 | 18 | ||
22 | #ifndef _CYPRESS_ATACB_H_ | 19 | #if defined(CONFIG_USB_STORAGE_CYPRESS_ATACB) || \ |
23 | #define _CYPRESS_ATACB_H_ | 20 | defined(CONFIG_USB_STORAGE_CYPRESS_ATACB_MODULE) |
24 | extern void cypress_atacb_passthrough(struct scsi_cmnd*, struct us_data*); | 21 | |
25 | #endif | 22 | /* CY7C68300 : support atacb */ |
23 | UNUSUAL_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 */ | ||
29 | UNUSUAL_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_devs.h b/drivers/usb/storage/unusual_devs.h index 50034e141f94..eff97aed7bfe 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -375,22 +375,6 @@ UNUSUAL_DEV( 0x04b3, 0x4001, 0x0110, 0x0110, | |||
375 | US_SC_DEVICE, US_PR_CB, NULL, | 375 | US_SC_DEVICE, US_PR_CB, NULL, |
376 | US_FL_MAX_SECTORS_MIN), | 376 | US_FL_MAX_SECTORS_MIN), |
377 | 377 | ||
378 | #ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB | ||
379 | /* CY7C68300 : support atacb */ | ||
380 | UNUSUAL_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 */ | ||
387 | UNUSUAL_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> | 378 | /* Reported by Simon Levitt <simon@whattf.com> |
395 | * This entry needs Sub and Proto fields */ | 379 | * This entry needs Sub and Proto fields */ |
396 | UNUSUAL_DEV( 0x04b8, 0x0601, 0x0100, 0x0100, | 380 | UNUSUAL_DEV( 0x04b8, 0x0601, 0x0100, 0x0100, |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 238f271d8171..241e1944cf10 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -87,9 +87,6 @@ | |||
87 | #ifdef CONFIG_USB_STORAGE_KARMA | 87 | #ifdef CONFIG_USB_STORAGE_KARMA |
88 | #include "karma.h" | 88 | #include "karma.h" |
89 | #endif | 89 | #endif |
90 | #ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB | ||
91 | #include "cypress_atacb.h" | ||
92 | #endif | ||
93 | #include "sierra_ms.h" | 90 | #include "sierra_ms.h" |
94 | #include "option_ms.h" | 91 | #include "option_ms.h" |
95 | 92 | ||
@@ -705,14 +702,6 @@ static void get_protocol(struct us_data *us) | |||
705 | us->protocol_name = "Uniform Floppy Interface (UFI)"; | 702 | us->protocol_name = "Uniform Floppy Interface (UFI)"; |
706 | us->proto_handler = usb_stor_ufi_command; | 703 | us->proto_handler = usb_stor_ufi_command; |
707 | break; | 704 | break; |
708 | |||
709 | #ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB | ||
710 | case US_SC_CYP_ATACB: | ||
711 | us->protocol_name = "Transparent SCSI with Cypress ATACB"; | ||
712 | us->proto_handler = cypress_atacb_passthrough; | ||
713 | break; | ||
714 | #endif | ||
715 | |||
716 | } | 705 | } |
717 | } | 706 | } |
718 | 707 | ||
diff --git a/drivers/usb/storage/usual-tables.c b/drivers/usb/storage/usual-tables.c index 5f2703fa48e6..be461ee9f005 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 | ||
79 | static struct ignore_entry ignore_ids[] = { | 79 | static struct ignore_entry ignore_ids[] = { |
80 | # include "unusual_cypress.h" | ||
80 | # include "unusual_isd200.h" | 81 | # include "unusual_isd200.h" |
81 | # include "unusual_sddr09.h" | 82 | # include "unusual_sddr09.h" |
82 | # include "unusual_sddr55.h" | 83 | # include "unusual_sddr55.h" |