diff options
-rw-r--r-- | drivers/usb/storage/Kconfig | 4 | ||||
-rw-r--r-- | drivers/usb/storage/Makefile | 3 | ||||
-rw-r--r-- | drivers/usb/storage/freecom.c | 95 | ||||
-rw-r--r-- | drivers/usb/storage/unusual_devs.h | 7 | ||||
-rw-r--r-- | drivers/usb/storage/unusual_freecom.h (renamed from drivers/usb/storage/freecom.h) | 24 | ||||
-rw-r--r-- | drivers/usb/storage/usb.c | 12 | ||||
-rw-r--r-- | drivers/usb/storage/usual-tables.c | 1 |
7 files changed, 104 insertions, 42 deletions
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig index 44c6b1940f77..14508b8a55fb 100644 --- a/drivers/usb/storage/Kconfig +++ b/drivers/usb/storage/Kconfig @@ -39,12 +39,14 @@ config USB_STORAGE_DATAFAB Datafab has a web page at <http://www.datafabusa.com/>. config USB_STORAGE_FREECOM - bool "Freecom USB/ATAPI Bridge support" + tristate "Freecom USB/ATAPI Bridge support" depends on USB_STORAGE help Support for the Freecom USB to IDE/ATAPI adaptor. Freecom has a web page at <http://www.freecom.de/>. + If this driver is compiled as a module, it will be named ums-freecom. + config USB_STORAGE_ISD200 tristate "ISD-200 USB/ATA Bridge support" depends on USB_STORAGE diff --git a/drivers/usb/storage/Makefile b/drivers/usb/storage/Makefile index 2387368cb7ae..93e91ec3a2d2 100644 --- a/drivers/usb/storage/Makefile +++ b/drivers/usb/storage/Makefile @@ -10,7 +10,6 @@ EXTRA_CFLAGS := -Idrivers/scsi obj-$(CONFIG_USB_STORAGE) += usb-storage.o usb-storage-obj-$(CONFIG_USB_STORAGE_DEBUG) += debug.o -usb-storage-obj-$(CONFIG_USB_STORAGE_FREECOM) += freecom.o usb-storage-obj-$(CONFIG_USB_STORAGE_DATAFAB) += datafab.o usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += jumpshot.o usb-storage-obj-$(CONFIG_USB_STORAGE_ALAUDA) += alauda.o @@ -27,12 +26,14 @@ else endif obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += ums-cypress.o +obj-$(CONFIG_USB_STORAGE_FREECOM) += ums-freecom.o obj-$(CONFIG_USB_STORAGE_ISD200) += ums-isd200.o obj-$(CONFIG_USB_STORAGE_SDDR09) += ums-sddr09.o obj-$(CONFIG_USB_STORAGE_SDDR55) += ums-sddr55.o obj-$(CONFIG_USB_STORAGE_USBAT) += ums-usbat.o ums-cypress-objs := cypress_atacb.o +ums-freecom-objs := freecom.o ums-isd200-objs := isd200.o ums-sddr09-objs := sddr09.o ums-sddr55-objs := sddr55.o diff --git a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c index 73ac7262239e..393047b3890d 100644 --- a/drivers/usb/storage/freecom.c +++ b/drivers/usb/storage/freecom.c @@ -26,6 +26,7 @@ * (http://www.freecom.de/) */ +#include <linux/module.h> #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> @@ -33,7 +34,6 @@ #include "transport.h" #include "protocol.h" #include "debug.h" -#include "freecom.h" #ifdef CONFIG_USB_STORAGE_DEBUG static void pdump (void *, int); @@ -103,6 +103,47 @@ struct freecom_status { #define FCM_PACKET_LENGTH 64 #define FCM_STATUS_PACKET_LENGTH 4 +static int init_freecom(struct us_data *us); + + +/* + * The table of devices + */ +#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ + vendorName, productName, useProtocol, useTransport, \ + initFunction, flags) \ +{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ + .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } + +struct usb_device_id freecom_usb_ids[] = { +# include "unusual_freecom.h" + { } /* Terminating entry */ +}; +MODULE_DEVICE_TABLE(usb, freecom_usb_ids); + +#undef UNUSUAL_DEV + +/* + * The flags table + */ +#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \ + vendor_name, product_name, use_protocol, use_transport, \ + init_function, Flags) \ +{ \ + .vendorName = vendor_name, \ + .productName = product_name, \ + .useProtocol = use_protocol, \ + .useTransport = use_transport, \ + .initFunction = init_function, \ +} + +static struct us_unusual_dev freecom_unusual_dev_list[] = { +# include "unusual_freecom.h" + { } /* Terminating entry */ +}; + +#undef UNUSUAL_DEV + static int freecom_readdata (struct scsi_cmnd *srb, struct us_data *us, unsigned int ipipe, unsigned int opipe, int count) @@ -173,7 +214,7 @@ freecom_writedata (struct scsi_cmnd *srb, struct us_data *us, * Transport for the Freecom USB/IDE adaptor. * */ -int freecom_transport(struct scsi_cmnd *srb, struct us_data *us) +static int freecom_transport(struct scsi_cmnd *srb, struct us_data *us) { struct freecom_cb_wrap *fcb; struct freecom_status *fst; @@ -377,8 +418,7 @@ int freecom_transport(struct scsi_cmnd *srb, struct us_data *us) return USB_STOR_TRANSPORT_GOOD; } -int -freecom_init (struct us_data *us) +static int init_freecom(struct us_data *us) { int result; char *buffer = us->iobuf; @@ -417,7 +457,7 @@ freecom_init (struct us_data *us) return USB_STOR_TRANSPORT_GOOD; } -int usb_stor_freecom_reset(struct us_data *us) +static int usb_stor_freecom_reset(struct us_data *us) { printk (KERN_CRIT "freecom reset called\n"); @@ -479,3 +519,48 @@ static void pdump (void *ibuffer, int length) } #endif +static int freecom_probe(struct usb_interface *intf, + const struct usb_device_id *id) +{ + struct us_data *us; + int result; + + result = usb_stor_probe1(&us, intf, id, + (id - freecom_usb_ids) + freecom_unusual_dev_list); + if (result) + return result; + + us->transport_name = "Freecom"; + us->transport = freecom_transport; + us->transport_reset = usb_stor_freecom_reset; + us->max_lun = 0; + + result = usb_stor_probe2(us); + return result; +} + +static struct usb_driver freecom_driver = { + .name = "ums-freecom", + .probe = freecom_probe, + .disconnect = usb_stor_disconnect, + .suspend = usb_stor_suspend, + .resume = usb_stor_resume, + .reset_resume = usb_stor_reset_resume, + .pre_reset = usb_stor_pre_reset, + .post_reset = usb_stor_post_reset, + .id_table = freecom_usb_ids, + .soft_unbind = 1, +}; + +static int __init freecom_init(void) +{ + return usb_register(&freecom_driver); +} + +static void __exit freecom_exit(void) +{ + usb_deregister(&freecom_driver); +} + +module_init(freecom_init); +module_exit(freecom_exit); diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 6462c4c54dc0..eef2075cf2eb 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h @@ -958,13 +958,6 @@ UNUSUAL_DEV( 0x0781, 0x0100, 0x0100, 0x0100, US_SC_SCSI, US_PR_CB, NULL, US_FL_SINGLE_LUN ), -#ifdef CONFIG_USB_STORAGE_FREECOM -UNUSUAL_DEV( 0x07ab, 0xfc01, 0x0000, 0x9999, - "Freecom", - "USB-IDE", - US_SC_QIC, US_PR_FREECOM, freecom_init, 0), -#endif - /* Reported by Eero Volotinen <eero@ping-viini.org> */ UNUSUAL_DEV( 0x07ab, 0xfccd, 0x0000, 0x9999, "Freecom Technologies", diff --git a/drivers/usb/storage/freecom.h b/drivers/usb/storage/unusual_freecom.h index 20d0fe6ba0c8..375867942391 100644 --- a/drivers/usb/storage/freecom.h +++ b/drivers/usb/storage/unusual_freecom.h @@ -1,13 +1,4 @@ -/* Driver for Freecom USB/IDE adaptor - * - * Freecom v0.1: - * - * First release - * - * Current development and maintenance by: - * (c) 2000 David Brown <usb-storage@davidb.org> - * - * See freecom.c for more explanation +/* Unusual Devices File for the Freecom USB/IDE adaptor * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -24,11 +15,12 @@ * 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef _FREECOM_USB_H -#define _FREECOM_USB_H +#if defined(CONFIG_USB_STORAGE_FREECOM) || \ + defined(CONFIG_USB_STORAGE_FREECOM_MODULE) -extern int freecom_transport(struct scsi_cmnd *srb, struct us_data *us); -extern int usb_stor_freecom_reset(struct us_data *us); -extern int freecom_init (struct us_data *us); +UNUSUAL_DEV( 0x07ab, 0xfc01, 0x0000, 0x9999, + "Freecom", + "USB-IDE", + US_SC_QIC, US_PR_FREECOM, init_freecom, 0), -#endif +#endif /* defined(CONFIG_USB_STORAGE_FREECOM) || ... */ diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 3ad22a8142cc..985275d5d4c5 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -66,9 +66,6 @@ #include "debug.h" #include "initializers.h" -#ifdef CONFIG_USB_STORAGE_FREECOM -#include "freecom.h" -#endif #ifdef CONFIG_USB_STORAGE_DATAFAB #include "datafab.h" #endif @@ -607,15 +604,6 @@ static void get_transport(struct us_data *us) us->transport_reset = usb_stor_Bulk_reset; break; -#ifdef CONFIG_USB_STORAGE_FREECOM - case US_PR_FREECOM: - us->transport_name = "Freecom"; - us->transport = freecom_transport; - us->transport_reset = usb_stor_freecom_reset; - us->max_lun = 0; - break; -#endif - #ifdef CONFIG_USB_STORAGE_DATAFAB case US_PR_DATAFAB: us->transport_name = "Datafab Bulk-Only"; diff --git a/drivers/usb/storage/usual-tables.c b/drivers/usb/storage/usual-tables.c index 899a8c8da712..a50f0eefb739 100644 --- a/drivers/usb/storage/usual-tables.c +++ b/drivers/usb/storage/usual-tables.c @@ -78,6 +78,7 @@ struct ignore_entry { static struct ignore_entry ignore_ids[] = { # include "unusual_cypress.h" +# include "unusual_freecom.h" # include "unusual_isd200.h" # include "unusual_sddr09.h" # include "unusual_sddr55.h" |