1*1da177e4SLinus Torvalds /* to be used by qlogicfas and qlogic_cs */ 2*1da177e4SLinus Torvalds #ifndef __QLOGICFAS408_H 3*1da177e4SLinus Torvalds #define __QLOGICFAS408_H 4*1da177e4SLinus Torvalds 5*1da177e4SLinus Torvalds /*----------------------------------------------------------------*/ 6*1da177e4SLinus Torvalds /* Configuration */ 7*1da177e4SLinus Torvalds 8*1da177e4SLinus Torvalds /* Set the following to max out the speed of the PIO PseudoDMA transfers, 9*1da177e4SLinus Torvalds again, 0 tends to be slower, but more stable. */ 10*1da177e4SLinus Torvalds 11*1da177e4SLinus Torvalds #define QL_TURBO_PDMA 1 12*1da177e4SLinus Torvalds 13*1da177e4SLinus Torvalds /* This should be 1 to enable parity detection */ 14*1da177e4SLinus Torvalds 15*1da177e4SLinus Torvalds #define QL_ENABLE_PARITY 1 16*1da177e4SLinus Torvalds 17*1da177e4SLinus Torvalds /* This will reset all devices when the driver is initialized (during bootup). 18*1da177e4SLinus Torvalds The other linux drivers don't do this, but the DOS drivers do, and after 19*1da177e4SLinus Torvalds using DOS or some kind of crash or lockup this will bring things back 20*1da177e4SLinus Torvalds without requiring a cold boot. It does take some time to recover from a 21*1da177e4SLinus Torvalds reset, so it is slower, and I have seen timeouts so that devices weren't 22*1da177e4SLinus Torvalds recognized when this was set. */ 23*1da177e4SLinus Torvalds 24*1da177e4SLinus Torvalds #define QL_RESET_AT_START 0 25*1da177e4SLinus Torvalds 26*1da177e4SLinus Torvalds /* crystal frequency in megahertz (for offset 5 and 9) 27*1da177e4SLinus Torvalds Please set this for your card. Most Qlogic cards are 40 Mhz. The 28*1da177e4SLinus Torvalds Control Concepts ISA (not VLB) is 24 Mhz */ 29*1da177e4SLinus Torvalds 30*1da177e4SLinus Torvalds #define XTALFREQ 40 31*1da177e4SLinus Torvalds 32*1da177e4SLinus Torvalds /**********/ 33*1da177e4SLinus Torvalds /* DANGER! modify these at your own risk */ 34*1da177e4SLinus Torvalds /* SLOWCABLE can usually be reset to zero if you have a clean setup and 35*1da177e4SLinus Torvalds proper termination. The rest are for synchronous transfers and other 36*1da177e4SLinus Torvalds advanced features if your device can transfer faster than 5Mb/sec. 37*1da177e4SLinus Torvalds If you are really curious, email me for a quick howto until I have 38*1da177e4SLinus Torvalds something official */ 39*1da177e4SLinus Torvalds /**********/ 40*1da177e4SLinus Torvalds 41*1da177e4SLinus Torvalds /*****/ 42*1da177e4SLinus Torvalds /* config register 1 (offset 8) options */ 43*1da177e4SLinus Torvalds /* This needs to be set to 1 if your cabling is long or noisy */ 44*1da177e4SLinus Torvalds #define SLOWCABLE 1 45*1da177e4SLinus Torvalds 46*1da177e4SLinus Torvalds /*****/ 47*1da177e4SLinus Torvalds /* offset 0xc */ 48*1da177e4SLinus Torvalds /* This will set fast (10Mhz) synchronous timing when set to 1 49*1da177e4SLinus Torvalds For this to have an effect, FASTCLK must also be 1 */ 50*1da177e4SLinus Torvalds #define FASTSCSI 0 51*1da177e4SLinus Torvalds 52*1da177e4SLinus Torvalds /* This when set to 1 will set a faster sync transfer rate */ 53*1da177e4SLinus Torvalds #define FASTCLK 0 /*(XTALFREQ>25?1:0)*/ 54*1da177e4SLinus Torvalds 55*1da177e4SLinus Torvalds /*****/ 56*1da177e4SLinus Torvalds /* offset 6 */ 57*1da177e4SLinus Torvalds /* This is the sync transfer divisor, XTALFREQ/X will be the maximum 58*1da177e4SLinus Torvalds achievable data rate (assuming the rest of the system is capable 59*1da177e4SLinus Torvalds and set properly) */ 60*1da177e4SLinus Torvalds #define SYNCXFRPD 5 /*(XTALFREQ/5)*/ 61*1da177e4SLinus Torvalds 62*1da177e4SLinus Torvalds /*****/ 63*1da177e4SLinus Torvalds /* offset 7 */ 64*1da177e4SLinus Torvalds /* This is the count of how many synchronous transfers can take place 65*1da177e4SLinus Torvalds i.e. how many reqs can occur before an ack is given. 66*1da177e4SLinus Torvalds The maximum value for this is 15, the upper bits can modify 67*1da177e4SLinus Torvalds REQ/ACK assertion and deassertion during synchronous transfers 68*1da177e4SLinus Torvalds If this is 0, the bus will only transfer asynchronously */ 69*1da177e4SLinus Torvalds #define SYNCOFFST 0 70*1da177e4SLinus Torvalds /* for the curious, bits 7&6 control the deassertion delay in 1/2 cycles 71*1da177e4SLinus Torvalds of the 40Mhz clock. If FASTCLK is 1, specifying 01 (1/2) will 72*1da177e4SLinus Torvalds cause the deassertion to be early by 1/2 clock. Bits 5&4 control 73*1da177e4SLinus Torvalds the assertion delay, also in 1/2 clocks (FASTCLK is ignored here). */ 74*1da177e4SLinus Torvalds 75*1da177e4SLinus Torvalds /*----------------------------------------------------------------*/ 76*1da177e4SLinus Torvalds 77*1da177e4SLinus Torvalds struct qlogicfas408_priv { 78*1da177e4SLinus Torvalds int qbase; /* Port */ 79*1da177e4SLinus Torvalds int qinitid; /* initiator ID */ 80*1da177e4SLinus Torvalds int qabort; /* Flag to cause an abort */ 81*1da177e4SLinus Torvalds int qlirq; /* IRQ being used */ 82*1da177e4SLinus Torvalds int int_type; /* type of irq, 2 for ISA board, 0 for PCMCIA */ 83*1da177e4SLinus Torvalds char qinfo[80]; /* description */ 84*1da177e4SLinus Torvalds Scsi_Cmnd *qlcmd; /* current command being processed */ 85*1da177e4SLinus Torvalds struct Scsi_Host *shost; /* pointer back to host */ 86*1da177e4SLinus Torvalds struct qlogicfas408_priv *next; /* next private struct */ 87*1da177e4SLinus Torvalds }; 88*1da177e4SLinus Torvalds 89*1da177e4SLinus Torvalds /* The qlogic card uses two register maps - These macros select which one */ 90*1da177e4SLinus Torvalds #define REG0 ( outb( inb( qbase + 0xd ) & 0x7f , qbase + 0xd ), outb( 4 , qbase + 0xd )) 91*1da177e4SLinus Torvalds #define REG1 ( outb( inb( qbase + 0xd ) | 0x80 , qbase + 0xd ), outb( 0xb4 | int_type, qbase + 0xd )) 92*1da177e4SLinus Torvalds 93*1da177e4SLinus Torvalds /* following is watchdog timeout in microseconds */ 94*1da177e4SLinus Torvalds #define WATCHDOG 5000000 95*1da177e4SLinus Torvalds 96*1da177e4SLinus Torvalds /*----------------------------------------------------------------*/ 97*1da177e4SLinus Torvalds /* the following will set the monitor border color (useful to find 98*1da177e4SLinus Torvalds where something crashed or gets stuck at and as a simple profiler) */ 99*1da177e4SLinus Torvalds 100*1da177e4SLinus Torvalds #define rtrc(i) {} 101*1da177e4SLinus Torvalds 102*1da177e4SLinus Torvalds #define get_priv_by_cmd(x) (struct qlogicfas408_priv *)&((x)->device->host->hostdata[0]) 103*1da177e4SLinus Torvalds #define get_priv_by_host(x) (struct qlogicfas408_priv *)&((x)->hostdata[0]) 104*1da177e4SLinus Torvalds 105*1da177e4SLinus Torvalds irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id, struct pt_regs *regs); 106*1da177e4SLinus Torvalds int qlogicfas408_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)); 107*1da177e4SLinus Torvalds int qlogicfas408_biosparam(struct scsi_device * disk, 108*1da177e4SLinus Torvalds struct block_device *dev, 109*1da177e4SLinus Torvalds sector_t capacity, int ip[]); 110*1da177e4SLinus Torvalds int qlogicfas408_abort(Scsi_Cmnd * cmd); 111*1da177e4SLinus Torvalds int qlogicfas408_bus_reset(Scsi_Cmnd * cmd); 112*1da177e4SLinus Torvalds int qlogicfas408_host_reset(Scsi_Cmnd * cmd); 113*1da177e4SLinus Torvalds int qlogicfas408_device_reset(Scsi_Cmnd * cmd); 114*1da177e4SLinus Torvalds const char *qlogicfas408_info(struct Scsi_Host *host); 115*1da177e4SLinus Torvalds int qlogicfas408_get_chip_type(int qbase, int int_type); 116*1da177e4SLinus Torvalds void qlogicfas408_setup(int qbase, int id, int int_type); 117*1da177e4SLinus Torvalds int qlogicfas408_detect(int qbase, int int_type); 118*1da177e4SLinus Torvalds void qlogicfas408_disable_ints(struct qlogicfas408_priv *priv); 119*1da177e4SLinus Torvalds #endif /* __QLOGICFAS408_H */ 120*1da177e4SLinus Torvalds 121