imm.h 5.0 KB

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