Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* Driver for Microtech DPCM-USB CompactFlash/SmartMedia reader |
| 2 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * DPCM driver v0.1: |
| 4 | * |
| 5 | * First release |
| 6 | * |
| 7 | * Current development and maintenance by: |
| 8 | * (c) 2000 Brian Webb (webbb@earthlink.net) |
| 9 | * |
| 10 | * This device contains both a CompactFlash card reader, which |
| 11 | * uses the Control/Bulk w/o Interrupt protocol and |
| 12 | * a SmartMedia card reader that uses the same protocol |
| 13 | * as the SDDR09. |
| 14 | * |
| 15 | * This program is free software; you can redistribute it and/or modify it |
| 16 | * under the terms of the GNU General Public License as published by the |
| 17 | * Free Software Foundation; either version 2, or (at your option) any |
| 18 | * later version. |
| 19 | * |
| 20 | * This program is distributed in the hope that it will be useful, but |
| 21 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 23 | * General Public License for more details. |
| 24 | * |
| 25 | * You should have received a copy of the GNU General Public License along |
| 26 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 27 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
| 28 | */ |
| 29 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | #include <scsi/scsi.h> |
| 31 | #include <scsi/scsi_cmnd.h> |
| 32 | #include <scsi/scsi_device.h> |
| 33 | |
| 34 | #include "usb.h" |
| 35 | #include "transport.h" |
| 36 | #include "protocol.h" |
| 37 | #include "debug.h" |
| 38 | #include "dpcm.h" |
| 39 | #include "sddr09.h" |
| 40 | |
| 41 | /* |
| 42 | * Transport for the Microtech DPCM-USB |
| 43 | * |
| 44 | */ |
| 45 | int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us) |
| 46 | { |
S.Caglar Onur | d20da3c | 2007-07-16 13:41:45 +0300 | [diff] [blame] | 47 | int ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | |
S.Caglar Onur | d20da3c | 2007-07-16 13:41:45 +0300 | [diff] [blame] | 49 | if (srb == NULL) |
| 50 | return USB_STOR_TRANSPORT_ERROR; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
S.Caglar Onur | d20da3c | 2007-07-16 13:41:45 +0300 | [diff] [blame] | 52 | US_DEBUGP("dpcm_transport: LUN=%d\n", srb->device->lun); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | |
S.Caglar Onur | d20da3c | 2007-07-16 13:41:45 +0300 | [diff] [blame] | 54 | switch (srb->device->lun) { |
| 55 | case 0: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | |
S.Caglar Onur | d20da3c | 2007-07-16 13:41:45 +0300 | [diff] [blame] | 57 | /* |
| 58 | * LUN 0 corresponds to the CompactFlash card reader. |
| 59 | */ |
| 60 | ret = usb_stor_CB_transport(srb, us); |
| 61 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | |
| 63 | #ifdef CONFIG_USB_STORAGE_SDDR09 |
S.Caglar Onur | d20da3c | 2007-07-16 13:41:45 +0300 | [diff] [blame] | 64 | case 1: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | |
S.Caglar Onur | d20da3c | 2007-07-16 13:41:45 +0300 | [diff] [blame] | 66 | /* |
| 67 | * LUN 1 corresponds to the SmartMedia card reader. |
| 68 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | |
S.Caglar Onur | d20da3c | 2007-07-16 13:41:45 +0300 | [diff] [blame] | 70 | /* |
| 71 | * Set the LUN to 0 (just in case). |
| 72 | */ |
| 73 | srb->device->lun = 0; us->srb->device->lun = 0; |
| 74 | ret = sddr09_transport(srb, us); |
| 75 | srb->device->lun = 1; us->srb->device->lun = 1; |
| 76 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | |
| 78 | #endif |
| 79 | |
S.Caglar Onur | d20da3c | 2007-07-16 13:41:45 +0300 | [diff] [blame] | 80 | default: |
| 81 | US_DEBUGP("dpcm_transport: Invalid LUN %d\n", srb->device->lun); |
| 82 | ret = USB_STOR_TRANSPORT_ERROR; |
| 83 | break; |
| 84 | } |
| 85 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | } |