imm.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /* Driver for the Iomega MatchMaker parallel port SCSI HBA embedded in
  2. * the Iomega ZIP Plus drive
  3. *
  4. * (c) 1998 David Campbell
  5. *
  6. * Please note that I live in Perth, Western Australia. GMT+0800
  7. */
  8. #ifndef _IMM_H
  9. #define _IMM_H
  10. #define IMM_VERSION "2.05 (for Linux 2.4.0)"
  11. /*
  12. * 10 Apr 1998 (Good Friday) - Received EN144302 by email from Iomega.
  13. * Scarry thing is the level of support from one of their managers.
  14. * The onus is now on us (the developers) to shut up and start coding.
  15. * 11Apr98 [ 0.10 ]
  16. *
  17. * --- SNIP ---
  18. *
  19. * It manages to find the drive which is a good start. Writing data during
  20. * data phase is known to be broken (due to requirements of two byte writes).
  21. * Removing "Phase" debug messages.
  22. *
  23. * PS: Took four hours of coding after I bought a drive.
  24. * ANZAC Day (Aus "War Veterans Holiday") 25Apr98 [ 0.14 ]
  25. *
  26. * Ten minutes later after a few fixes.... (LITERALLY!!!)
  27. * Have mounted disk, copied file, dismounted disk, remount disk, diff file
  28. * ----- It actually works!!! -----
  29. * 25Apr98 [ 0.15 ]
  30. *
  31. * Twenty minutes of mucking around, rearanged the IEEE negotiate mechanism.
  32. * Now have byte mode working (only EPP and ECP to go now... :=)
  33. * 26Apr98 [ 0.16 ]
  34. *
  35. * Thirty minutes of further coding results in EPP working on my machine.
  36. * 27Apr98 [ 0.17 ]
  37. *
  38. * Due to work commitments and inability to get a "true" ECP mode functioning
  39. * I have decided to code the parport support into imm.
  40. * 09Jun98 [ 0.18 ]
  41. *
  42. * Driver is now out of beta testing.
  43. * Support for parport has been added.
  44. * Now distributed with the ppa driver.
  45. * 12Jun98 [ 2.00 ]
  46. *
  47. * Err.. It appears that imm-2.00 was broken....
  48. * 18Jun98 [ 2.01 ]
  49. *
  50. * Patch applied to sync this against the Linux 2.1.x kernel code
  51. * Included qboot_zip.sh
  52. * 21Jun98 [ 2.02 ]
  53. *
  54. * Other clean ups include the follow changes:
  55. * CONFIG_SCSI_PPA_HAVE_PEDANTIC => CONFIG_SCSI_IZIP_EPP16
  56. * added CONFIG_SCSI_IZIP_SLOW_CTR option
  57. * [2.03]
  58. * Fix kernel panic on scsi timeout. 20Aug00 [2.04]
  59. *
  60. * Avoid io_request_lock problems.
  61. * John Cavan <johncavan@home.com> 16Nov00 [2.05]
  62. */
  63. /* ------ END OF USER CONFIGURABLE PARAMETERS ----- */
  64. #include <linux/stddef.h>
  65. #include <linux/module.h>
  66. #include <linux/kernel.h>
  67. #include <linux/ioport.h>
  68. #include <linux/delay.h>
  69. #include <linux/proc_fs.h>
  70. #include <linux/stat.h>
  71. #include <linux/blkdev.h>
  72. #include <linux/sched.h>
  73. #include <linux/interrupt.h>
  74. #include <asm/io.h>
  75. #include <scsi/scsi_host.h>
  76. /* batteries not included :-) */
  77. /*
  78. * modes in which the driver can operate
  79. */
  80. #define IMM_AUTODETECT 0 /* Autodetect mode */
  81. #define IMM_NIBBLE 1 /* work in standard 4 bit mode */
  82. #define IMM_PS2 2 /* PS/2 byte mode */
  83. #define IMM_EPP_8 3 /* EPP mode, 8 bit */
  84. #define IMM_EPP_16 4 /* EPP mode, 16 bit */
  85. #define IMM_EPP_32 5 /* EPP mode, 32 bit */
  86. #define IMM_UNKNOWN 6 /* Just in case... */
  87. static char *IMM_MODE_STRING[] =
  88. {
  89. [IMM_AUTODETECT] = "Autodetect",
  90. [IMM_NIBBLE] = "SPP",
  91. [IMM_PS2] = "PS/2",
  92. [IMM_EPP_8] = "EPP 8 bit",
  93. [IMM_EPP_16] = "EPP 16 bit",
  94. #ifdef CONFIG_SCSI_IZIP_EPP16
  95. [IMM_EPP_32] = "EPP 16 bit",
  96. #else
  97. [IMM_EPP_32] = "EPP 32 bit",
  98. #endif
  99. [IMM_UNKNOWN] = "Unknown",
  100. };
  101. /* other options */
  102. #define IMM_BURST_SIZE 512 /* data burst size */
  103. #define IMM_SELECT_TMO 500 /* 500 how long to wait for target ? */
  104. #define IMM_SPIN_TMO 5000 /* 50000 imm_wait loop limiter */
  105. #define IMM_DEBUG 0 /* debugging option */
  106. #define IN_EPP_MODE(x) (x == IMM_EPP_8 || x == IMM_EPP_16 || x == IMM_EPP_32)
  107. /* args to imm_connect */
  108. #define CONNECT_EPP_MAYBE 1
  109. #define CONNECT_NORMAL 0
  110. #define r_dtr(x) (unsigned char)inb((x))
  111. #define r_str(x) (unsigned char)inb((x)+1)
  112. #define r_ctr(x) (unsigned char)inb((x)+2)
  113. #define r_epp(x) (unsigned char)inb((x)+4)
  114. #define r_fifo(x) (unsigned char)inb((x)) /* x must be base_hi */
  115. /* On PCI is: base+0x400 != base_hi */
  116. #define r_ecr(x) (unsigned char)inb((x)+2) /* x must be base_hi */
  117. #define w_dtr(x,y) outb(y, (x))
  118. #define w_str(x,y) outb(y, (x)+1)
  119. #define w_epp(x,y) outb(y, (x)+4)
  120. #define w_fifo(x,y) outb(y, (x)) /* x must be base_hi */
  121. #define w_ecr(x,y) outb(y, (x)+0x2) /* x must be base_hi */
  122. #ifdef CONFIG_SCSI_IZIP_SLOW_CTR
  123. #define w_ctr(x,y) outb_p(y, (x)+2)
  124. #else
  125. #define w_ctr(x,y) outb(y, (x)+2)
  126. #endif
  127. static int imm_engine(imm_struct *, struct scsi_cmnd *);
  128. #endif /* _IMM_H */