aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/cypress_atacb.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2009-02-12 14:48:04 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-03-24 19:20:34 -0400
commitfcdb51401f7f695b7fb782721b2e33372c5a06ce (patch)
tree8072a6b8a09a52f106bddd29bc9a41069009d966 /drivers/usb/storage/cypress_atacb.c
parent70fcc0050733a7cd1b452cfa3de3a9b376412565 (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/usb/storage/cypress_atacb.c')
-rw-r--r--drivers/usb/storage/cypress_atacb.c88
1 files changed, 87 insertions, 1 deletions
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
43struct usb_device_id cypress_usb_ids[] = {
44# include "unusual_cypress.h"
45 { } /* Terminating entry */
46};
47MODULE_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
65static 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 */
39void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us) 80static 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
243static 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
261static 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
274static int __init cypress_init(void)
275{
276 return usb_register(&cypress_driver);
277}
278
279static void __exit cypress_exit(void)
280{
281 usb_deregister(&cypress_driver);
282}
283
284module_init(cypress_init);
285module_exit(cypress_exit);