freecom.c (7a9787e1eba95a166265e6a260cf30af04ef0a99) | freecom.c (0d62939fab3cf28a23ac6934cec599793d3a1d9d) |
---|---|
1/* Driver for Freecom USB/IDE adaptor 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> --- 12 unchanged lines hidden (view full) --- 21 * with this program; if not, write to the Free Software Foundation, Inc., 22 * 675 Mass Ave, Cambridge, MA 02139, USA. 23 * 24 * This driver was developed with information provided in FREECOM's USB 25 * Programmers Reference Guide. For further information contact Freecom 26 * (http://www.freecom.de/) 27 */ 28 | 1/* Driver for Freecom USB/IDE adaptor 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> --- 12 unchanged lines hidden (view full) --- 21 * with this program; if not, write to the Free Software Foundation, Inc., 22 * 675 Mass Ave, Cambridge, MA 02139, USA. 23 * 24 * This driver was developed with information provided in FREECOM's USB 25 * Programmers Reference Guide. For further information contact Freecom 26 * (http://www.freecom.de/) 27 */ 28 |
29#include <linux/module.h> |
|
29#include <scsi/scsi.h> 30#include <scsi/scsi_cmnd.h> 31 32#include "usb.h" 33#include "transport.h" 34#include "protocol.h" 35#include "debug.h" | 30#include <scsi/scsi.h> 31#include <scsi/scsi_cmnd.h> 32 33#include "usb.h" 34#include "transport.h" 35#include "protocol.h" 36#include "debug.h" |
36#include "freecom.h" | |
37 38#ifdef CONFIG_USB_STORAGE_DEBUG 39static void pdump (void *, int); 40#endif 41 42/* Bits of HD_STATUS */ 43#define ERR_STAT 0x01 44#define DRQ_STAT 0x08 --- 53 unchanged lines hidden (view full) --- 98 * munging the address a bit. */ 99#define FCM_PACKET_IDE_WRITE 0x40 100#define FCM_PACKET_IDE_READ 0xC0 101 102/* All packets (except for status) are 64 bytes long. */ 103#define FCM_PACKET_LENGTH 64 104#define FCM_STATUS_PACKET_LENGTH 4 105 | 37 38#ifdef CONFIG_USB_STORAGE_DEBUG 39static void pdump (void *, int); 40#endif 41 42/* Bits of HD_STATUS */ 43#define ERR_STAT 0x01 44#define DRQ_STAT 0x08 --- 53 unchanged lines hidden (view full) --- 98 * munging the address a bit. */ 99#define FCM_PACKET_IDE_WRITE 0x40 100#define FCM_PACKET_IDE_READ 0xC0 101 102/* All packets (except for status) are 64 bytes long. */ 103#define FCM_PACKET_LENGTH 64 104#define FCM_STATUS_PACKET_LENGTH 4 105 |
106static int init_freecom(struct us_data *us); 107 108 109/* 110 * The table of devices 111 */ 112#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ 113 vendorName, productName, useProtocol, useTransport, \ 114 initFunction, flags) \ 115{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ 116 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } 117 118struct usb_device_id freecom_usb_ids[] = { 119# include "unusual_freecom.h" 120 { } /* Terminating entry */ 121}; 122MODULE_DEVICE_TABLE(usb, freecom_usb_ids); 123 124#undef UNUSUAL_DEV 125 126/* 127 * The flags table 128 */ 129#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \ 130 vendor_name, product_name, use_protocol, use_transport, \ 131 init_function, Flags) \ 132{ \ 133 .vendorName = vendor_name, \ 134 .productName = product_name, \ 135 .useProtocol = use_protocol, \ 136 .useTransport = use_transport, \ 137 .initFunction = init_function, \ 138} 139 140static struct us_unusual_dev freecom_unusual_dev_list[] = { 141# include "unusual_freecom.h" 142 { } /* Terminating entry */ 143}; 144 145#undef UNUSUAL_DEV 146 |
|
106static int 107freecom_readdata (struct scsi_cmnd *srb, struct us_data *us, 108 unsigned int ipipe, unsigned int opipe, int count) 109{ 110 struct freecom_xfer_wrap *fxfr = 111 (struct freecom_xfer_wrap *) us->iobuf; 112 int result; 113 --- 54 unchanged lines hidden (view full) --- 168 return USB_STOR_TRANSPORT_ERROR; 169 return USB_STOR_TRANSPORT_GOOD; 170} 171 172/* 173 * Transport for the Freecom USB/IDE adaptor. 174 * 175 */ | 147static int 148freecom_readdata (struct scsi_cmnd *srb, struct us_data *us, 149 unsigned int ipipe, unsigned int opipe, int count) 150{ 151 struct freecom_xfer_wrap *fxfr = 152 (struct freecom_xfer_wrap *) us->iobuf; 153 int result; 154 --- 54 unchanged lines hidden (view full) --- 209 return USB_STOR_TRANSPORT_ERROR; 210 return USB_STOR_TRANSPORT_GOOD; 211} 212 213/* 214 * Transport for the Freecom USB/IDE adaptor. 215 * 216 */ |
176int freecom_transport(struct scsi_cmnd *srb, struct us_data *us) | 217static int freecom_transport(struct scsi_cmnd *srb, struct us_data *us) |
177{ 178 struct freecom_cb_wrap *fcb; 179 struct freecom_status *fst; 180 unsigned int ipipe, opipe; /* We need both pipes. */ 181 int result; 182 unsigned int partial; 183 int length; 184 --- 187 unchanged lines hidden (view full) --- 372 // Return fail, SCSI seems to handle this better. 373 return USB_STOR_TRANSPORT_FAILED; 374 break; 375 } 376 377 return USB_STOR_TRANSPORT_GOOD; 378} 379 | 218{ 219 struct freecom_cb_wrap *fcb; 220 struct freecom_status *fst; 221 unsigned int ipipe, opipe; /* We need both pipes. */ 222 int result; 223 unsigned int partial; 224 int length; 225 --- 187 unchanged lines hidden (view full) --- 413 // Return fail, SCSI seems to handle this better. 414 return USB_STOR_TRANSPORT_FAILED; 415 break; 416 } 417 418 return USB_STOR_TRANSPORT_GOOD; 419} 420 |
380int 381freecom_init (struct us_data *us) | 421static int init_freecom(struct us_data *us) |
382{ 383 int result; 384 char *buffer = us->iobuf; 385 386 /* The DMA-mapped I/O buffer is 64 bytes long, just right for 387 * all our packets. No need to allocate any extra buffer space. 388 */ 389 --- 22 unchanged lines hidden (view full) --- 412 US_DEBUGP("result from clear reset is %d\n", result); 413 414 /* wait 3 seconds */ 415 mdelay(3 * 1000); 416 417 return USB_STOR_TRANSPORT_GOOD; 418} 419 | 422{ 423 int result; 424 char *buffer = us->iobuf; 425 426 /* The DMA-mapped I/O buffer is 64 bytes long, just right for 427 * all our packets. No need to allocate any extra buffer space. 428 */ 429 --- 22 unchanged lines hidden (view full) --- 452 US_DEBUGP("result from clear reset is %d\n", result); 453 454 /* wait 3 seconds */ 455 mdelay(3 * 1000); 456 457 return USB_STOR_TRANSPORT_GOOD; 458} 459 |
420int usb_stor_freecom_reset(struct us_data *us) | 460static int usb_stor_freecom_reset(struct us_data *us) |
421{ 422 printk (KERN_CRIT "freecom reset called\n"); 423 424 /* We don't really have this feature. */ 425 return FAILED; 426} 427 428#ifdef CONFIG_USB_STORAGE_DEBUG --- 45 unchanged lines hidden (view full) --- 474 line[offset++] = '.'; 475 } 476 line[offset] = 0; 477 US_DEBUGP("%s\n", line); 478 offset = 0; 479} 480#endif 481 | 461{ 462 printk (KERN_CRIT "freecom reset called\n"); 463 464 /* We don't really have this feature. */ 465 return FAILED; 466} 467 468#ifdef CONFIG_USB_STORAGE_DEBUG --- 45 unchanged lines hidden (view full) --- 514 line[offset++] = '.'; 515 } 516 line[offset] = 0; 517 US_DEBUGP("%s\n", line); 518 offset = 0; 519} 520#endif 521 |
522static int freecom_probe(struct usb_interface *intf, 523 const struct usb_device_id *id) 524{ 525 struct us_data *us; 526 int result; 527 528 result = usb_stor_probe1(&us, intf, id, 529 (id - freecom_usb_ids) + freecom_unusual_dev_list); 530 if (result) 531 return result; 532 533 us->transport_name = "Freecom"; 534 us->transport = freecom_transport; 535 us->transport_reset = usb_stor_freecom_reset; 536 us->max_lun = 0; 537 538 result = usb_stor_probe2(us); 539 return result; 540} 541 542static struct usb_driver freecom_driver = { 543 .name = "ums-freecom", 544 .probe = freecom_probe, 545 .disconnect = usb_stor_disconnect, 546 .suspend = usb_stor_suspend, 547 .resume = usb_stor_resume, 548 .reset_resume = usb_stor_reset_resume, 549 .pre_reset = usb_stor_pre_reset, 550 .post_reset = usb_stor_post_reset, 551 .id_table = freecom_usb_ids, 552 .soft_unbind = 1, 553}; 554 555static int __init freecom_init(void) 556{ 557 return usb_register(&freecom_driver); 558} 559 560static void __exit freecom_exit(void) 561{ 562 usb_deregister(&freecom_driver); 563} 564 565module_init(freecom_init); 566module_exit(freecom_exit); |
|