aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/isd200.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/storage/isd200.c')
-rw-r--r--drivers/usb/storage/isd200.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index 0db488624ab1..2ae1e8673b19 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -48,7 +48,6 @@
48#include <linux/errno.h> 48#include <linux/errno.h>
49#include <linux/slab.h> 49#include <linux/slab.h>
50#include <linux/hdreg.h> 50#include <linux/hdreg.h>
51#include <linux/ide.h>
52#include <linux/scatterlist.h> 51#include <linux/scatterlist.h>
53 52
54#include <scsi/scsi.h> 53#include <scsi/scsi.h>
@@ -110,6 +109,12 @@
110#define REG_STATUS 0x80 109#define REG_STATUS 0x80
111#define REG_COMMAND 0x80 110#define REG_COMMAND 0x80
112 111
112/* ATA registers offset definitions */
113#define ATA_REG_ERROR_OFFSET 1
114#define ATA_REG_LCYL_OFFSET 4
115#define ATA_REG_HCYL_OFFSET 5
116#define ATA_REG_STATUS_OFFSET 7
117
113/* ATA error definitions not in <linux/hdreg.h> */ 118/* ATA error definitions not in <linux/hdreg.h> */
114#define ATA_ERROR_MEDIA_CHANGE 0x20 119#define ATA_ERROR_MEDIA_CHANGE 0x20
115 120
@@ -360,7 +365,7 @@ static void isd200_build_sense(struct us_data *us, struct scsi_cmnd *srb)
360{ 365{
361 struct isd200_info *info = (struct isd200_info *)us->extra; 366 struct isd200_info *info = (struct isd200_info *)us->extra;
362 struct sense_data *buf = (struct sense_data *) &srb->sense_buffer[0]; 367 struct sense_data *buf = (struct sense_data *) &srb->sense_buffer[0];
363 unsigned char error = info->ATARegs[IDE_ERROR_OFFSET]; 368 unsigned char error = info->ATARegs[ATA_REG_ERROR_OFFSET];
364 369
365 if(error & ATA_ERROR_MEDIA_CHANGE) { 370 if(error & ATA_ERROR_MEDIA_CHANGE) {
366 buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID; 371 buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID;
@@ -549,8 +554,8 @@ static int isd200_read_regs( struct us_data *us )
549 retStatus = ISD200_ERROR; 554 retStatus = ISD200_ERROR;
550 } else { 555 } else {
551 memcpy(info->ATARegs, info->RegsBuf, sizeof(info->ATARegs)); 556 memcpy(info->ATARegs, info->RegsBuf, sizeof(info->ATARegs));
552 US_DEBUGP(" Got ATA Register[IDE_ERROR_OFFSET] = 0x%x\n", 557 US_DEBUGP(" Got ATA Register[ATA_REG_ERROR_OFFSET] = 0x%x\n",
553 info->ATARegs[IDE_ERROR_OFFSET]); 558 info->ATARegs[ATA_REG_ERROR_OFFSET]);
554 } 559 }
555 560
556 return retStatus; 561 return retStatus;
@@ -892,7 +897,7 @@ static int isd200_try_enum(struct us_data *us, unsigned char master_slave,
892 break; 897 break;
893 898
894 if (!detect) { 899 if (!detect) {
895 if (regs[IDE_STATUS_OFFSET] & BUSY_STAT ) { 900 if (regs[ATA_REG_STATUS_OFFSET] & BUSY_STAT) {
896 US_DEBUGP(" %s status is still BSY, try again...\n",mstr); 901 US_DEBUGP(" %s status is still BSY, try again...\n",mstr);
897 } else { 902 } else {
898 US_DEBUGP(" %s status !BSY, continue with next operation\n",mstr); 903 US_DEBUGP(" %s status !BSY, continue with next operation\n",mstr);
@@ -902,12 +907,12 @@ static int isd200_try_enum(struct us_data *us, unsigned char master_slave,
902 /* check for BUSY_STAT and */ 907 /* check for BUSY_STAT and */
903 /* WRERR_STAT (workaround ATA Zip drive) and */ 908 /* WRERR_STAT (workaround ATA Zip drive) and */
904 /* ERR_STAT (workaround for Archos CD-ROM) */ 909 /* ERR_STAT (workaround for Archos CD-ROM) */
905 else if (regs[IDE_STATUS_OFFSET] & 910 else if (regs[ATA_REG_STATUS_OFFSET] &
906 (BUSY_STAT | WRERR_STAT | ERR_STAT )) { 911 (BUSY_STAT | WRERR_STAT | ERR_STAT )) {
907 US_DEBUGP(" Status indicates it is not ready, try again...\n"); 912 US_DEBUGP(" Status indicates it is not ready, try again...\n");
908 } 913 }
909 /* check for DRDY, ATA devices set DRDY after SRST */ 914 /* check for DRDY, ATA devices set DRDY after SRST */
910 else if (regs[IDE_STATUS_OFFSET] & READY_STAT) { 915 else if (regs[ATA_REG_STATUS_OFFSET] & READY_STAT) {
911 US_DEBUGP(" Identified ATA device\n"); 916 US_DEBUGP(" Identified ATA device\n");
912 info->DeviceFlags |= DF_ATA_DEVICE; 917 info->DeviceFlags |= DF_ATA_DEVICE;
913 info->DeviceHead = master_slave; 918 info->DeviceHead = master_slave;
@@ -916,8 +921,8 @@ static int isd200_try_enum(struct us_data *us, unsigned char master_slave,
916 /* check Cylinder High/Low to 921 /* check Cylinder High/Low to
917 determine if it is an ATAPI device 922 determine if it is an ATAPI device
918 */ 923 */
919 else if ((regs[IDE_HCYL_OFFSET] == 0xEB) && 924 else if (regs[ATA_REG_HCYL_OFFSET] == 0xEB &&
920 (regs[IDE_LCYL_OFFSET] == 0x14)) { 925 regs[ATA_REG_LCYL_OFFSET] == 0x14) {
921 /* It seems that the RICOH 926 /* It seems that the RICOH
922 MP6200A CD/RW drive will 927 MP6200A CD/RW drive will
923 report itself okay as a 928 report itself okay as a
@@ -1001,12 +1006,6 @@ static int isd200_manual_enum(struct us_data *us)
1001 return(retStatus); 1006 return(retStatus);
1002} 1007}
1003 1008
1004/*
1005 * We are the last non IDE user of the legacy IDE ident structures
1006 * and we thus want to keep a private copy of this function so the
1007 * driver can be used without the obsolete drivers/ide layer
1008 */
1009
1010static void isd200_fix_driveid (struct hd_driveid *id) 1009static void isd200_fix_driveid (struct hd_driveid *id)
1011{ 1010{
1012#ifndef __LITTLE_ENDIAN 1011#ifndef __LITTLE_ENDIAN