1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 21da177e4SLinus Torvalds /* to be used by qlogicfas and qlogic_cs */ 31da177e4SLinus Torvalds #ifndef __QLOGICFAS408_H 41da177e4SLinus Torvalds #define __QLOGICFAS408_H 51da177e4SLinus Torvalds 61da177e4SLinus Torvalds /*----------------------------------------------------------------*/ 71da177e4SLinus Torvalds /* Configuration */ 81da177e4SLinus Torvalds 91da177e4SLinus Torvalds /* Set the following to max out the speed of the PIO PseudoDMA transfers, 101da177e4SLinus Torvalds again, 0 tends to be slower, but more stable. */ 111da177e4SLinus Torvalds 121da177e4SLinus Torvalds #define QL_TURBO_PDMA 1 131da177e4SLinus Torvalds 141da177e4SLinus Torvalds /* This should be 1 to enable parity detection */ 151da177e4SLinus Torvalds 161da177e4SLinus Torvalds #define QL_ENABLE_PARITY 1 171da177e4SLinus Torvalds 181da177e4SLinus Torvalds /* This will reset all devices when the driver is initialized (during bootup). 191da177e4SLinus Torvalds The other linux drivers don't do this, but the DOS drivers do, and after 201da177e4SLinus Torvalds using DOS or some kind of crash or lockup this will bring things back 211da177e4SLinus Torvalds without requiring a cold boot. It does take some time to recover from a 221da177e4SLinus Torvalds reset, so it is slower, and I have seen timeouts so that devices weren't 231da177e4SLinus Torvalds recognized when this was set. */ 241da177e4SLinus Torvalds 251da177e4SLinus Torvalds #define QL_RESET_AT_START 0 261da177e4SLinus Torvalds 271da177e4SLinus Torvalds /* crystal frequency in megahertz (for offset 5 and 9) 281da177e4SLinus Torvalds Please set this for your card. Most Qlogic cards are 40 Mhz. The 291da177e4SLinus Torvalds Control Concepts ISA (not VLB) is 24 Mhz */ 301da177e4SLinus Torvalds 311da177e4SLinus Torvalds #define XTALFREQ 40 321da177e4SLinus Torvalds 331da177e4SLinus Torvalds /**********/ 341da177e4SLinus Torvalds /* DANGER! modify these at your own risk */ 351da177e4SLinus Torvalds /* SLOWCABLE can usually be reset to zero if you have a clean setup and 361da177e4SLinus Torvalds proper termination. The rest are for synchronous transfers and other 371da177e4SLinus Torvalds advanced features if your device can transfer faster than 5Mb/sec. 381da177e4SLinus Torvalds If you are really curious, email me for a quick howto until I have 391da177e4SLinus Torvalds something official */ 401da177e4SLinus Torvalds /**********/ 411da177e4SLinus Torvalds 421da177e4SLinus Torvalds /*****/ 431da177e4SLinus Torvalds /* config register 1 (offset 8) options */ 441da177e4SLinus Torvalds /* This needs to be set to 1 if your cabling is long or noisy */ 451da177e4SLinus Torvalds #define SLOWCABLE 1 461da177e4SLinus Torvalds 471da177e4SLinus Torvalds /*****/ 481da177e4SLinus Torvalds /* offset 0xc */ 491da177e4SLinus Torvalds /* This will set fast (10Mhz) synchronous timing when set to 1 501da177e4SLinus Torvalds For this to have an effect, FASTCLK must also be 1 */ 511da177e4SLinus Torvalds #define FASTSCSI 0 521da177e4SLinus Torvalds 531da177e4SLinus Torvalds /* This when set to 1 will set a faster sync transfer rate */ 541da177e4SLinus Torvalds #define FASTCLK 0 /*(XTALFREQ>25?1:0)*/ 551da177e4SLinus Torvalds 561da177e4SLinus Torvalds /*****/ 571da177e4SLinus Torvalds /* offset 6 */ 581da177e4SLinus Torvalds /* This is the sync transfer divisor, XTALFREQ/X will be the maximum 591da177e4SLinus Torvalds achievable data rate (assuming the rest of the system is capable 601da177e4SLinus Torvalds and set properly) */ 611da177e4SLinus Torvalds #define SYNCXFRPD 5 /*(XTALFREQ/5)*/ 621da177e4SLinus Torvalds 631da177e4SLinus Torvalds /*****/ 641da177e4SLinus Torvalds /* offset 7 */ 651da177e4SLinus Torvalds /* This is the count of how many synchronous transfers can take place 661da177e4SLinus Torvalds i.e. how many reqs can occur before an ack is given. 671da177e4SLinus Torvalds The maximum value for this is 15, the upper bits can modify 681da177e4SLinus Torvalds REQ/ACK assertion and deassertion during synchronous transfers 691da177e4SLinus Torvalds If this is 0, the bus will only transfer asynchronously */ 701da177e4SLinus Torvalds #define SYNCOFFST 0 711da177e4SLinus Torvalds /* for the curious, bits 7&6 control the deassertion delay in 1/2 cycles 721da177e4SLinus Torvalds of the 40Mhz clock. If FASTCLK is 1, specifying 01 (1/2) will 731da177e4SLinus Torvalds cause the deassertion to be early by 1/2 clock. Bits 5&4 control 741da177e4SLinus Torvalds the assertion delay, also in 1/2 clocks (FASTCLK is ignored here). */ 751da177e4SLinus Torvalds 761da177e4SLinus Torvalds /*----------------------------------------------------------------*/ 771da177e4SLinus Torvalds 781da177e4SLinus Torvalds struct qlogicfas408_priv { 791da177e4SLinus Torvalds int qbase; /* Port */ 801da177e4SLinus Torvalds int qinitid; /* initiator ID */ 811da177e4SLinus Torvalds int qabort; /* Flag to cause an abort */ 821da177e4SLinus Torvalds int qlirq; /* IRQ being used */ 831da177e4SLinus Torvalds int int_type; /* type of irq, 2 for ISA board, 0 for PCMCIA */ 841da177e4SLinus Torvalds char qinfo[80]; /* description */ 85a24342b9SHenne struct scsi_cmnd *qlcmd; /* current command being processed */ 861da177e4SLinus Torvalds struct Scsi_Host *shost; /* pointer back to host */ 871da177e4SLinus Torvalds struct qlogicfas408_priv *next; /* next private struct */ 881da177e4SLinus Torvalds }; 891da177e4SLinus Torvalds 901da177e4SLinus Torvalds /* The qlogic card uses two register maps - These macros select which one */ 911da177e4SLinus Torvalds #define REG0 ( outb( inb( qbase + 0xd ) & 0x7f , qbase + 0xd ), outb( 4 , qbase + 0xd )) 921da177e4SLinus Torvalds #define REG1 ( outb( inb( qbase + 0xd ) | 0x80 , qbase + 0xd ), outb( 0xb4 | int_type, qbase + 0xd )) 931da177e4SLinus Torvalds 941da177e4SLinus Torvalds /* following is watchdog timeout in microseconds */ 951da177e4SLinus Torvalds #define WATCHDOG 5000000 961da177e4SLinus Torvalds 971da177e4SLinus Torvalds /*----------------------------------------------------------------*/ 981da177e4SLinus Torvalds /* the following will set the monitor border color (useful to find 991da177e4SLinus Torvalds where something crashed or gets stuck at and as a simple profiler) */ 1001da177e4SLinus Torvalds 1011da177e4SLinus Torvalds #define rtrc(i) {} 1021da177e4SLinus Torvalds 1031da177e4SLinus Torvalds #define get_priv_by_cmd(x) (struct qlogicfas408_priv *)&((x)->device->host->hostdata[0]) 1041da177e4SLinus Torvalds #define get_priv_by_host(x) (struct qlogicfas408_priv *)&((x)->hostdata[0]) 1051da177e4SLinus Torvalds 1067d12e780SDavid Howells irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id); 107f281233dSJeff Garzik int qlogicfas408_queuecommand(struct Scsi_Host *h, struct scsi_cmnd * cmd); 1081da177e4SLinus Torvalds int qlogicfas408_biosparam(struct scsi_device * disk, 1091da177e4SLinus Torvalds struct block_device *dev, 1101da177e4SLinus Torvalds sector_t capacity, int ip[]); 111a24342b9SHenne int qlogicfas408_abort(struct scsi_cmnd * cmd); 1124a56c1c1SHannes Reinecke extern int qlogicfas408_host_reset(struct scsi_cmnd *cmd); 1131da177e4SLinus Torvalds const char *qlogicfas408_info(struct Scsi_Host *host); 1141da177e4SLinus Torvalds int qlogicfas408_get_chip_type(int qbase, int int_type); 1151da177e4SLinus Torvalds void qlogicfas408_setup(int qbase, int id, int int_type); 1161da177e4SLinus Torvalds int qlogicfas408_detect(int qbase, int int_type); 1171da177e4SLinus Torvalds void qlogicfas408_disable_ints(struct qlogicfas408_priv *priv); 1181da177e4SLinus Torvalds #endif /* __QLOGICFAS408_H */ 1191da177e4SLinus Torvalds 120