Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* Driver for SCM Microsystems USB-ATAPI cable |
| 2 | * Header File |
| 3 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * Current development and maintenance by: |
| 5 | * (c) 2000 Robert Baruch (autophile@dol.net) |
| 6 | * (c) 2004, 2005 Daniel Drake <dsd@gentoo.org> |
| 7 | * |
| 8 | * See shuttle_usbat.c for more explanation |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify it |
| 11 | * under the terms of the GNU General Public License as published by the |
| 12 | * Free Software Foundation; either version 2, or (at your option) any |
| 13 | * later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, but |
| 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 | * General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License along |
| 21 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 22 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
| 23 | */ |
| 24 | |
| 25 | #ifndef _USB_SHUTTLE_USBAT_H |
| 26 | #define _USB_SHUTTLE_USBAT_H |
| 27 | |
| 28 | /* Supported device types */ |
| 29 | #define USBAT_DEV_HP8200 0x01 |
| 30 | #define USBAT_DEV_FLASH 0x02 |
| 31 | |
| 32 | #define USBAT_EPP_PORT 0x10 |
| 33 | #define USBAT_EPP_REGISTER 0x30 |
| 34 | #define USBAT_ATA 0x40 |
| 35 | #define USBAT_ISA 0x50 |
| 36 | |
| 37 | /* Commands (need to be logically OR'd with an access type */ |
| 38 | #define USBAT_CMD_READ_REG 0x00 |
| 39 | #define USBAT_CMD_WRITE_REG 0x01 |
| 40 | #define USBAT_CMD_READ_BLOCK 0x02 |
| 41 | #define USBAT_CMD_WRITE_BLOCK 0x03 |
| 42 | #define USBAT_CMD_COND_READ_BLOCK 0x04 |
| 43 | #define USBAT_CMD_COND_WRITE_BLOCK 0x05 |
| 44 | #define USBAT_CMD_WRITE_REGS 0x07 |
| 45 | |
| 46 | /* Commands (these don't need an access type) */ |
| 47 | #define USBAT_CMD_EXEC_CMD 0x80 |
| 48 | #define USBAT_CMD_SET_FEAT 0x81 |
| 49 | #define USBAT_CMD_UIO 0x82 |
| 50 | |
| 51 | /* Methods of accessing UIO register */ |
| 52 | #define USBAT_UIO_READ 1 |
| 53 | #define USBAT_UIO_WRITE 0 |
| 54 | |
| 55 | /* Qualifier bits */ |
Daniel Drake | b7b1e65 | 2005-09-30 12:49:36 +0100 | [diff] [blame] | 56 | #define USBAT_QUAL_FCQ 0x20 /* full compare */ |
| 57 | #define USBAT_QUAL_ALQ 0x10 /* auto load subcount */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
| 59 | /* USBAT Flash Media status types */ |
| 60 | #define USBAT_FLASH_MEDIA_NONE 0 |
| 61 | #define USBAT_FLASH_MEDIA_CF 1 |
| 62 | |
| 63 | /* USBAT Flash Media change types */ |
| 64 | #define USBAT_FLASH_MEDIA_SAME 0 |
| 65 | #define USBAT_FLASH_MEDIA_CHANGED 1 |
| 66 | |
| 67 | /* USBAT ATA registers */ |
Daniel Drake | b7b1e65 | 2005-09-30 12:49:36 +0100 | [diff] [blame] | 68 | #define USBAT_ATA_DATA 0x10 /* read/write data (R/W) */ |
| 69 | #define USBAT_ATA_FEATURES 0x11 /* set features (W) */ |
| 70 | #define USBAT_ATA_ERROR 0x11 /* error (R) */ |
| 71 | #define USBAT_ATA_SECCNT 0x12 /* sector count (R/W) */ |
| 72 | #define USBAT_ATA_SECNUM 0x13 /* sector number (R/W) */ |
| 73 | #define USBAT_ATA_LBA_ME 0x14 /* cylinder low (R/W) */ |
| 74 | #define USBAT_ATA_LBA_HI 0x15 /* cylinder high (R/W) */ |
| 75 | #define USBAT_ATA_DEVICE 0x16 /* head/device selection (R/W) */ |
| 76 | #define USBAT_ATA_STATUS 0x17 /* device status (R) */ |
| 77 | #define USBAT_ATA_CMD 0x17 /* device command (W) */ |
| 78 | #define USBAT_ATA_ALTSTATUS 0x0E /* status (no clear IRQ) (R) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | |
| 80 | /* USBAT User I/O Data registers */ |
Daniel Drake | b7b1e65 | 2005-09-30 12:49:36 +0100 | [diff] [blame] | 81 | #define USBAT_UIO_EPAD 0x80 /* Enable Peripheral Control Signals */ |
| 82 | #define USBAT_UIO_CDT 0x40 /* Card Detect (Read Only) */ |
| 83 | /* CDT = ACKD & !UI1 & !UI0 */ |
| 84 | #define USBAT_UIO_1 0x20 /* I/O 1 */ |
| 85 | #define USBAT_UIO_0 0x10 /* I/O 0 */ |
| 86 | #define USBAT_UIO_EPP_ATA 0x08 /* 1=EPP mode, 0=ATA mode */ |
| 87 | #define USBAT_UIO_UI1 0x04 /* Input 1 */ |
| 88 | #define USBAT_UIO_UI0 0x02 /* Input 0 */ |
| 89 | #define USBAT_UIO_INTR_ACK 0x01 /* Interrupt (ATA/ISA)/Acknowledge (EPP) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | |
| 91 | /* USBAT User I/O Enable registers */ |
Daniel Drake | b7b1e65 | 2005-09-30 12:49:36 +0100 | [diff] [blame] | 92 | #define USBAT_UIO_DRVRST 0x80 /* Reset Peripheral */ |
| 93 | #define USBAT_UIO_ACKD 0x40 /* Enable Card Detect */ |
| 94 | #define USBAT_UIO_OE1 0x20 /* I/O 1 set=output/clr=input */ |
| 95 | /* If ACKD=1, set OE1 to 1 also. */ |
| 96 | #define USBAT_UIO_OE0 0x10 /* I/O 0 set=output/clr=input */ |
| 97 | #define USBAT_UIO_ADPRST 0x01 /* Reset SCM chip */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | |
| 99 | /* USBAT Features */ |
Daniel Drake | b7b1e65 | 2005-09-30 12:49:36 +0100 | [diff] [blame] | 100 | #define USBAT_FEAT_ETEN 0x80 /* External trigger enable */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | #define USBAT_FEAT_U1 0x08 |
| 102 | #define USBAT_FEAT_U0 0x04 |
| 103 | #define USBAT_FEAT_ET1 0x02 |
| 104 | #define USBAT_FEAT_ET2 0x01 |
| 105 | |
| 106 | extern int usbat_transport(struct scsi_cmnd *srb, struct us_data *us); |
Peter Chubb | bdcfd9e | 2006-05-02 18:29:34 +0100 | [diff] [blame] | 107 | extern int init_usbat_cd(struct us_data *us); |
| 108 | extern int init_usbat_flash(struct us_data *us); |
| 109 | extern int init_usbat_probe(struct us_data *us); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | |
| 111 | struct usbat_info { |
| 112 | int devicetype; |
| 113 | |
| 114 | /* Used for Flash readers only */ |
Daniel Drake | b7b1e65 | 2005-09-30 12:49:36 +0100 | [diff] [blame] | 115 | unsigned long sectors; /* total sector count */ |
| 116 | unsigned long ssize; /* sector size in bytes */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | |
| 118 | unsigned char sense_key; |
Daniel Drake | b7b1e65 | 2005-09-30 12:49:36 +0100 | [diff] [blame] | 119 | unsigned long sense_asc; /* additional sense code */ |
| 120 | unsigned long sense_ascq; /* additional sense code qualifier */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | }; |
| 122 | |
| 123 | #endif |