1a87bf293SHannes Reinecke /* esp_scsi.h: Defines and structures for the ESP driver. 2cd9ad58dSDavid S. Miller * 3cd9ad58dSDavid S. Miller * Copyright (C) 2007 David S. Miller (davem@davemloft.net) 4cd9ad58dSDavid S. Miller */ 5cd9ad58dSDavid S. Miller 6cd9ad58dSDavid S. Miller #ifndef _ESP_SCSI_H 7cd9ad58dSDavid S. Miller #define _ESP_SCSI_H 8cd9ad58dSDavid S. Miller 9cd9ad58dSDavid S. Miller /* Access Description Offset */ 10cd9ad58dSDavid S. Miller #define ESP_TCLOW 0x00UL /* rw Low bits transfer count 0x00 */ 11cd9ad58dSDavid S. Miller #define ESP_TCMED 0x01UL /* rw Mid bits transfer count 0x04 */ 12cd9ad58dSDavid S. Miller #define ESP_FDATA 0x02UL /* rw FIFO data bits 0x08 */ 13cd9ad58dSDavid S. Miller #define ESP_CMD 0x03UL /* rw SCSI command bits 0x0c */ 14cd9ad58dSDavid S. Miller #define ESP_STATUS 0x04UL /* ro ESP status register 0x10 */ 15cd9ad58dSDavid S. Miller #define ESP_BUSID ESP_STATUS /* wo BusID for sel/resel 0x10 */ 16cd9ad58dSDavid S. Miller #define ESP_INTRPT 0x05UL /* ro Kind of interrupt 0x14 */ 17cd9ad58dSDavid S. Miller #define ESP_TIMEO ESP_INTRPT /* wo Timeout for sel/resel 0x14 */ 18cd9ad58dSDavid S. Miller #define ESP_SSTEP 0x06UL /* ro Sequence step register 0x18 */ 19cd9ad58dSDavid S. Miller #define ESP_STP ESP_SSTEP /* wo Transfer period/sync 0x18 */ 20cd9ad58dSDavid S. Miller #define ESP_FFLAGS 0x07UL /* ro Bits current FIFO info 0x1c */ 21cd9ad58dSDavid S. Miller #define ESP_SOFF ESP_FFLAGS /* wo Sync offset 0x1c */ 22cd9ad58dSDavid S. Miller #define ESP_CFG1 0x08UL /* rw First cfg register 0x20 */ 23cd9ad58dSDavid S. Miller #define ESP_CFACT 0x09UL /* wo Clock conv factor 0x24 */ 24cd9ad58dSDavid S. Miller #define ESP_STATUS2 ESP_CFACT /* ro HME status2 register 0x24 */ 25cd9ad58dSDavid S. Miller #define ESP_CTEST 0x0aUL /* wo Chip test register 0x28 */ 26cd9ad58dSDavid S. Miller #define ESP_CFG2 0x0bUL /* rw Second cfg register 0x2c */ 27cd9ad58dSDavid S. Miller #define ESP_CFG3 0x0cUL /* rw Third cfg register 0x30 */ 28*eeea2f9cSHannes Reinecke #define ESP_CFG4 0x0dUL /* rw Fourth cfg register 0x34 */ 29cd9ad58dSDavid S. Miller #define ESP_TCHI 0x0eUL /* rw High bits transf count 0x38 */ 30cd9ad58dSDavid S. Miller #define ESP_UID ESP_TCHI /* ro Unique ID code 0x38 */ 31cd9ad58dSDavid S. Miller #define FAS_RLO ESP_TCHI /* rw HME extended counter 0x38 */ 32cd9ad58dSDavid S. Miller #define ESP_FGRND 0x0fUL /* rw Data base for fifo 0x3c */ 33cd9ad58dSDavid S. Miller #define FAS_RHI ESP_FGRND /* rw HME extended counter 0x3c */ 34cd9ad58dSDavid S. Miller 35cd9ad58dSDavid S. Miller #define SBUS_ESP_REG_SIZE 0x40UL 36cd9ad58dSDavid S. Miller 37cd9ad58dSDavid S. Miller /* Bitfield meanings for the above registers. */ 38cd9ad58dSDavid S. Miller 39cd9ad58dSDavid S. Miller /* ESP config reg 1, read-write, found on all ESP chips */ 40cd9ad58dSDavid S. Miller #define ESP_CONFIG1_ID 0x07 /* My BUS ID bits */ 41cd9ad58dSDavid S. Miller #define ESP_CONFIG1_CHTEST 0x08 /* Enable ESP chip tests */ 42cd9ad58dSDavid S. Miller #define ESP_CONFIG1_PENABLE 0x10 /* Enable parity checks */ 43cd9ad58dSDavid S. Miller #define ESP_CONFIG1_PARTEST 0x20 /* Parity test mode enabled? */ 44cd9ad58dSDavid S. Miller #define ESP_CONFIG1_SRRDISAB 0x40 /* Disable SCSI reset reports */ 45cd9ad58dSDavid S. Miller #define ESP_CONFIG1_SLCABLE 0x80 /* Enable slow cable mode */ 46cd9ad58dSDavid S. Miller 47cd9ad58dSDavid S. Miller /* ESP config reg 2, read-write, found only on esp100a+esp200+esp236 chips */ 48cd9ad58dSDavid S. Miller #define ESP_CONFIG2_DMAPARITY 0x01 /* enable DMA Parity (200,236) */ 49cd9ad58dSDavid S. Miller #define ESP_CONFIG2_REGPARITY 0x02 /* enable reg Parity (200,236) */ 50cd9ad58dSDavid S. Miller #define ESP_CONFIG2_BADPARITY 0x04 /* Bad parity target abort */ 51cd9ad58dSDavid S. Miller #define ESP_CONFIG2_SCSI2ENAB 0x08 /* Enable SCSI-2 features (tgtmode) */ 52cd9ad58dSDavid S. Miller #define ESP_CONFIG2_HI 0x10 /* High Impedance DREQ ??? */ 53cd9ad58dSDavid S. Miller #define ESP_CONFIG2_HMEFENAB 0x10 /* HME features enable */ 54cd9ad58dSDavid S. Miller #define ESP_CONFIG2_BCM 0x20 /* Enable byte-ctrl (236) */ 55cd9ad58dSDavid S. Miller #define ESP_CONFIG2_DISPINT 0x20 /* Disable pause irq (hme) */ 56cd9ad58dSDavid S. Miller #define ESP_CONFIG2_FENAB 0x40 /* Enable features (fas100,216) */ 57cd9ad58dSDavid S. Miller #define ESP_CONFIG2_SPL 0x40 /* Enable status-phase latch (236) */ 58cd9ad58dSDavid S. Miller #define ESP_CONFIG2_MKDONE 0x40 /* HME magic feature */ 59cd9ad58dSDavid S. Miller #define ESP_CONFIG2_HME32 0x80 /* HME 32 extended */ 60cd9ad58dSDavid S. Miller #define ESP_CONFIG2_MAGIC 0xe0 /* Invalid bits... */ 61cd9ad58dSDavid S. Miller 62cd9ad58dSDavid S. Miller /* ESP config register 3 read-write, found only esp236+fas236+fas100a+hme chips */ 63cd9ad58dSDavid S. Miller #define ESP_CONFIG3_FCLOCK 0x01 /* FAST SCSI clock rate (esp100a/hme) */ 64cd9ad58dSDavid S. Miller #define ESP_CONFIG3_TEM 0x01 /* Enable thresh-8 mode (esp/fas236) */ 65cd9ad58dSDavid S. Miller #define ESP_CONFIG3_FAST 0x02 /* Enable FAST SCSI (esp100a/hme) */ 66cd9ad58dSDavid S. Miller #define ESP_CONFIG3_ADMA 0x02 /* Enable alternate-dma (esp/fas236) */ 67cd9ad58dSDavid S. Miller #define ESP_CONFIG3_TENB 0x04 /* group2 SCSI2 support (esp100a/hme) */ 68cd9ad58dSDavid S. Miller #define ESP_CONFIG3_SRB 0x04 /* Save residual byte (esp/fas236) */ 69cd9ad58dSDavid S. Miller #define ESP_CONFIG3_TMS 0x08 /* Three-byte msg's ok (esp100a/hme) */ 70cd9ad58dSDavid S. Miller #define ESP_CONFIG3_FCLK 0x08 /* Fast SCSI clock rate (esp/fas236) */ 71cd9ad58dSDavid S. Miller #define ESP_CONFIG3_IDMSG 0x10 /* ID message checking (esp100a/hme) */ 72cd9ad58dSDavid S. Miller #define ESP_CONFIG3_FSCSI 0x10 /* Enable FAST SCSI (esp/fas236) */ 73cd9ad58dSDavid S. Miller #define ESP_CONFIG3_GTM 0x20 /* group2 SCSI2 support (esp/fas236) */ 74cd9ad58dSDavid S. Miller #define ESP_CONFIG3_IDBIT3 0x20 /* Bit 3 of HME SCSI-ID (hme) */ 75cd9ad58dSDavid S. Miller #define ESP_CONFIG3_TBMS 0x40 /* Three-byte msg's ok (esp/fas236) */ 76cd9ad58dSDavid S. Miller #define ESP_CONFIG3_EWIDE 0x40 /* Enable Wide-SCSI (hme) */ 77cd9ad58dSDavid S. Miller #define ESP_CONFIG3_IMS 0x80 /* ID msg chk'ng (esp/fas236) */ 78cd9ad58dSDavid S. Miller #define ESP_CONFIG3_OBPUSH 0x80 /* Push odd-byte to dma (hme) */ 79cd9ad58dSDavid S. Miller 80*eeea2f9cSHannes Reinecke /* ESP config register 4 read-write, found only on am53c974 chips */ 81*eeea2f9cSHannes Reinecke #define ESP_CONFIG4_RADE 0x04 /* Active negation */ 82*eeea2f9cSHannes Reinecke #define ESP_CONFIG4_RAE 0x08 /* Active negation on REQ and ACK */ 83*eeea2f9cSHannes Reinecke #define ESP_CONFIG4_PWD 0x20 /* Reduced power feature */ 84*eeea2f9cSHannes Reinecke #define ESP_CONFIG4_GE0 0x40 /* Glitch eater bit 0 */ 85*eeea2f9cSHannes Reinecke #define ESP_CONFIG4_GE1 0x80 /* Glitch eater bit 1 */ 86*eeea2f9cSHannes Reinecke 87*eeea2f9cSHannes Reinecke #define ESP_CONFIG_GE_12NS (0) 88*eeea2f9cSHannes Reinecke #define ESP_CONFIG_GE_25NS (ESP_CONFIG_GE1) 89*eeea2f9cSHannes Reinecke #define ESP_CONFIG_GE_35NS (ESP_CONFIG_GE0) 90*eeea2f9cSHannes Reinecke #define ESP_CONFIG_GE_0NS (ESP_CONFIG_GE0 | ESP_CONFIG_GE1) 91*eeea2f9cSHannes Reinecke 92cd9ad58dSDavid S. Miller /* ESP command register read-write */ 93cd9ad58dSDavid S. Miller /* Group 1 commands: These may be sent at any point in time to the ESP 94cd9ad58dSDavid S. Miller * chip. None of them can generate interrupts 'cept 95cd9ad58dSDavid S. Miller * the "SCSI bus reset" command if you have not disabled 96cd9ad58dSDavid S. Miller * SCSI reset interrupts in the config1 ESP register. 97cd9ad58dSDavid S. Miller */ 98cd9ad58dSDavid S. Miller #define ESP_CMD_NULL 0x00 /* Null command, ie. a nop */ 99cd9ad58dSDavid S. Miller #define ESP_CMD_FLUSH 0x01 /* FIFO Flush */ 100cd9ad58dSDavid S. Miller #define ESP_CMD_RC 0x02 /* Chip reset */ 101cd9ad58dSDavid S. Miller #define ESP_CMD_RS 0x03 /* SCSI bus reset */ 102cd9ad58dSDavid S. Miller 103cd9ad58dSDavid S. Miller /* Group 2 commands: ESP must be an initiator and connected to a target 104cd9ad58dSDavid S. Miller * for these commands to work. 105cd9ad58dSDavid S. Miller */ 106cd9ad58dSDavid S. Miller #define ESP_CMD_TI 0x10 /* Transfer Information */ 107cd9ad58dSDavid S. Miller #define ESP_CMD_ICCSEQ 0x11 /* Initiator cmd complete sequence */ 108cd9ad58dSDavid S. Miller #define ESP_CMD_MOK 0x12 /* Message okie-dokie */ 109cd9ad58dSDavid S. Miller #define ESP_CMD_TPAD 0x18 /* Transfer Pad */ 110cd9ad58dSDavid S. Miller #define ESP_CMD_SATN 0x1a /* Set ATN */ 111cd9ad58dSDavid S. Miller #define ESP_CMD_RATN 0x1b /* De-assert ATN */ 112cd9ad58dSDavid S. Miller 113cd9ad58dSDavid S. Miller /* Group 3 commands: ESP must be in the MSGOUT or MSGIN state and be connected 114cd9ad58dSDavid S. Miller * to a target as the initiator for these commands to work. 115cd9ad58dSDavid S. Miller */ 116cd9ad58dSDavid S. Miller #define ESP_CMD_SMSG 0x20 /* Send message */ 117cd9ad58dSDavid S. Miller #define ESP_CMD_SSTAT 0x21 /* Send status */ 118cd9ad58dSDavid S. Miller #define ESP_CMD_SDATA 0x22 /* Send data */ 119cd9ad58dSDavid S. Miller #define ESP_CMD_DSEQ 0x23 /* Discontinue Sequence */ 120cd9ad58dSDavid S. Miller #define ESP_CMD_TSEQ 0x24 /* Terminate Sequence */ 121cd9ad58dSDavid S. Miller #define ESP_CMD_TCCSEQ 0x25 /* Target cmd cmplt sequence */ 122cd9ad58dSDavid S. Miller #define ESP_CMD_DCNCT 0x27 /* Disconnect */ 123cd9ad58dSDavid S. Miller #define ESP_CMD_RMSG 0x28 /* Receive Message */ 124cd9ad58dSDavid S. Miller #define ESP_CMD_RCMD 0x29 /* Receive Command */ 125cd9ad58dSDavid S. Miller #define ESP_CMD_RDATA 0x2a /* Receive Data */ 126cd9ad58dSDavid S. Miller #define ESP_CMD_RCSEQ 0x2b /* Receive cmd sequence */ 127cd9ad58dSDavid S. Miller 128cd9ad58dSDavid S. Miller /* Group 4 commands: The ESP must be in the disconnected state and must 129cd9ad58dSDavid S. Miller * not be connected to any targets as initiator for 130cd9ad58dSDavid S. Miller * these commands to work. 131cd9ad58dSDavid S. Miller */ 132cd9ad58dSDavid S. Miller #define ESP_CMD_RSEL 0x40 /* Reselect */ 133cd9ad58dSDavid S. Miller #define ESP_CMD_SEL 0x41 /* Select w/o ATN */ 134cd9ad58dSDavid S. Miller #define ESP_CMD_SELA 0x42 /* Select w/ATN */ 135cd9ad58dSDavid S. Miller #define ESP_CMD_SELAS 0x43 /* Select w/ATN & STOP */ 136cd9ad58dSDavid S. Miller #define ESP_CMD_ESEL 0x44 /* Enable selection */ 137cd9ad58dSDavid S. Miller #define ESP_CMD_DSEL 0x45 /* Disable selections */ 138cd9ad58dSDavid S. Miller #define ESP_CMD_SA3 0x46 /* Select w/ATN3 */ 139cd9ad58dSDavid S. Miller #define ESP_CMD_RSEL3 0x47 /* Reselect3 */ 140cd9ad58dSDavid S. Miller 141cd9ad58dSDavid S. Miller /* This bit enables the ESP's DMA on the SBus */ 142cd9ad58dSDavid S. Miller #define ESP_CMD_DMA 0x80 /* Do DMA? */ 143cd9ad58dSDavid S. Miller 144cd9ad58dSDavid S. Miller /* ESP status register read-only */ 145cd9ad58dSDavid S. Miller #define ESP_STAT_PIO 0x01 /* IO phase bit */ 146cd9ad58dSDavid S. Miller #define ESP_STAT_PCD 0x02 /* CD phase bit */ 147cd9ad58dSDavid S. Miller #define ESP_STAT_PMSG 0x04 /* MSG phase bit */ 148cd9ad58dSDavid S. Miller #define ESP_STAT_PMASK 0x07 /* Mask of phase bits */ 149cd9ad58dSDavid S. Miller #define ESP_STAT_TDONE 0x08 /* Transfer Completed */ 150cd9ad58dSDavid S. Miller #define ESP_STAT_TCNT 0x10 /* Transfer Counter Is Zero */ 151cd9ad58dSDavid S. Miller #define ESP_STAT_PERR 0x20 /* Parity error */ 152cd9ad58dSDavid S. Miller #define ESP_STAT_SPAM 0x40 /* Real bad error */ 153cd9ad58dSDavid S. Miller /* This indicates the 'interrupt pending' condition on esp236, it is a reserved 154cd9ad58dSDavid S. Miller * bit on other revs of the ESP. 155cd9ad58dSDavid S. Miller */ 156cd9ad58dSDavid S. Miller #define ESP_STAT_INTR 0x80 /* Interrupt */ 157cd9ad58dSDavid S. Miller 158cd9ad58dSDavid S. Miller /* The status register can be masked with ESP_STAT_PMASK and compared 159cd9ad58dSDavid S. Miller * with the following values to determine the current phase the ESP 160cd9ad58dSDavid S. Miller * (at least thinks it) is in. For our purposes we also add our own 161cd9ad58dSDavid S. Miller * software 'done' bit for our phase management engine. 162cd9ad58dSDavid S. Miller */ 163cd9ad58dSDavid S. Miller #define ESP_DOP (0) /* Data Out */ 164cd9ad58dSDavid S. Miller #define ESP_DIP (ESP_STAT_PIO) /* Data In */ 165cd9ad58dSDavid S. Miller #define ESP_CMDP (ESP_STAT_PCD) /* Command */ 166cd9ad58dSDavid S. Miller #define ESP_STATP (ESP_STAT_PCD|ESP_STAT_PIO) /* Status */ 167cd9ad58dSDavid S. Miller #define ESP_MOP (ESP_STAT_PMSG|ESP_STAT_PCD) /* Message Out */ 168cd9ad58dSDavid S. Miller #define ESP_MIP (ESP_STAT_PMSG|ESP_STAT_PCD|ESP_STAT_PIO) /* Message In */ 169cd9ad58dSDavid S. Miller 170cd9ad58dSDavid S. Miller /* HME only: status 2 register */ 171cd9ad58dSDavid S. Miller #define ESP_STAT2_SCHBIT 0x01 /* Upper bits 3-7 of sstep enabled */ 172cd9ad58dSDavid S. Miller #define ESP_STAT2_FFLAGS 0x02 /* The fifo flags are now latched */ 173cd9ad58dSDavid S. Miller #define ESP_STAT2_XCNT 0x04 /* The transfer counter is latched */ 174cd9ad58dSDavid S. Miller #define ESP_STAT2_CREGA 0x08 /* The command reg is active now */ 175cd9ad58dSDavid S. Miller #define ESP_STAT2_WIDE 0x10 /* Interface on this adapter is wide */ 176cd9ad58dSDavid S. Miller #define ESP_STAT2_F1BYTE 0x20 /* There is one byte at top of fifo */ 177cd9ad58dSDavid S. Miller #define ESP_STAT2_FMSB 0x40 /* Next byte in fifo is most significant */ 178cd9ad58dSDavid S. Miller #define ESP_STAT2_FEMPTY 0x80 /* FIFO is empty */ 179cd9ad58dSDavid S. Miller 180cd9ad58dSDavid S. Miller /* ESP interrupt register read-only */ 181cd9ad58dSDavid S. Miller #define ESP_INTR_S 0x01 /* Select w/o ATN */ 182cd9ad58dSDavid S. Miller #define ESP_INTR_SATN 0x02 /* Select w/ATN */ 183cd9ad58dSDavid S. Miller #define ESP_INTR_RSEL 0x04 /* Reselected */ 184cd9ad58dSDavid S. Miller #define ESP_INTR_FDONE 0x08 /* Function done */ 185cd9ad58dSDavid S. Miller #define ESP_INTR_BSERV 0x10 /* Bus service */ 186cd9ad58dSDavid S. Miller #define ESP_INTR_DC 0x20 /* Disconnect */ 187cd9ad58dSDavid S. Miller #define ESP_INTR_IC 0x40 /* Illegal command given */ 188cd9ad58dSDavid S. Miller #define ESP_INTR_SR 0x80 /* SCSI bus reset detected */ 189cd9ad58dSDavid S. Miller 190cd9ad58dSDavid S. Miller /* ESP sequence step register read-only */ 191cd9ad58dSDavid S. Miller #define ESP_STEP_VBITS 0x07 /* Valid bits */ 192cd9ad58dSDavid S. Miller #define ESP_STEP_ASEL 0x00 /* Selection&Arbitrate cmplt */ 193cd9ad58dSDavid S. Miller #define ESP_STEP_SID 0x01 /* One msg byte sent */ 194cd9ad58dSDavid S. Miller #define ESP_STEP_NCMD 0x02 /* Was not in command phase */ 195cd9ad58dSDavid S. Miller #define ESP_STEP_PPC 0x03 /* Early phase chg caused cmnd 196cd9ad58dSDavid S. Miller * bytes to be lost 197cd9ad58dSDavid S. Miller */ 198cd9ad58dSDavid S. Miller #define ESP_STEP_FINI4 0x04 /* Command was sent ok */ 199cd9ad58dSDavid S. Miller 200cd9ad58dSDavid S. Miller /* Ho hum, some ESP's set the step register to this as well... */ 201cd9ad58dSDavid S. Miller #define ESP_STEP_FINI5 0x05 202cd9ad58dSDavid S. Miller #define ESP_STEP_FINI6 0x06 203cd9ad58dSDavid S. Miller #define ESP_STEP_FINI7 0x07 204cd9ad58dSDavid S. Miller 205cd9ad58dSDavid S. Miller /* ESP chip-test register read-write */ 206cd9ad58dSDavid S. Miller #define ESP_TEST_TARG 0x01 /* Target test mode */ 207cd9ad58dSDavid S. Miller #define ESP_TEST_INI 0x02 /* Initiator test mode */ 208cd9ad58dSDavid S. Miller #define ESP_TEST_TS 0x04 /* Tristate test mode */ 209cd9ad58dSDavid S. Miller 210cd9ad58dSDavid S. Miller /* ESP unique ID register read-only, found on fas236+fas100a only */ 211cd9ad58dSDavid S. Miller #define ESP_UID_F100A 0x00 /* ESP FAS100A */ 212cd9ad58dSDavid S. Miller #define ESP_UID_F236 0x02 /* ESP FAS236 */ 213cd9ad58dSDavid S. Miller #define ESP_UID_REV 0x07 /* ESP revision */ 214cd9ad58dSDavid S. Miller #define ESP_UID_FAM 0xf8 /* ESP family */ 215cd9ad58dSDavid S. Miller 216cd9ad58dSDavid S. Miller /* ESP fifo flags register read-only */ 217cd9ad58dSDavid S. Miller /* Note that the following implies a 16 byte FIFO on the ESP. */ 218cd9ad58dSDavid S. Miller #define ESP_FF_FBYTES 0x1f /* Num bytes in FIFO */ 219cd9ad58dSDavid S. Miller #define ESP_FF_ONOTZERO 0x20 /* offset ctr not zero (esp100) */ 220cd9ad58dSDavid S. Miller #define ESP_FF_SSTEP 0xe0 /* Sequence step */ 221cd9ad58dSDavid S. Miller 222cd9ad58dSDavid S. Miller /* ESP clock conversion factor register write-only */ 223cd9ad58dSDavid S. Miller #define ESP_CCF_F0 0x00 /* 35.01MHz - 40MHz */ 224cd9ad58dSDavid S. Miller #define ESP_CCF_NEVER 0x01 /* Set it to this and die */ 225cd9ad58dSDavid S. Miller #define ESP_CCF_F2 0x02 /* 10MHz */ 226cd9ad58dSDavid S. Miller #define ESP_CCF_F3 0x03 /* 10.01MHz - 15MHz */ 227cd9ad58dSDavid S. Miller #define ESP_CCF_F4 0x04 /* 15.01MHz - 20MHz */ 228cd9ad58dSDavid S. Miller #define ESP_CCF_F5 0x05 /* 20.01MHz - 25MHz */ 229cd9ad58dSDavid S. Miller #define ESP_CCF_F6 0x06 /* 25.01MHz - 30MHz */ 230cd9ad58dSDavid S. Miller #define ESP_CCF_F7 0x07 /* 30.01MHz - 35MHz */ 231cd9ad58dSDavid S. Miller 232cd9ad58dSDavid S. Miller /* HME only... */ 233cd9ad58dSDavid S. Miller #define ESP_BUSID_RESELID 0x10 234cd9ad58dSDavid S. Miller #define ESP_BUSID_CTR32BIT 0x40 235cd9ad58dSDavid S. Miller 23696d32215SDavid Miller #define ESP_BUS_TIMEOUT 250 /* In milli-seconds */ 237cd9ad58dSDavid S. Miller #define ESP_TIMEO_CONST 8192 238cd9ad58dSDavid S. Miller #define ESP_NEG_DEFP(mhz, cfact) \ 239cd9ad58dSDavid S. Miller ((ESP_BUS_TIMEOUT * ((mhz) / 1000)) / (8192 * (cfact))) 2406fe07aafSFinn Thain #define ESP_HZ_TO_CYCLE(hertz) ((1000000000) / ((hertz) / 1000)) 241cd9ad58dSDavid S. Miller #define ESP_TICK(ccf, cycle) ((7682 * (ccf) * (cycle) / 1000)) 242cd9ad58dSDavid S. Miller 243cd9ad58dSDavid S. Miller /* For slow to medium speed input clock rates we shoot for 5mb/s, but for high 244cd9ad58dSDavid S. Miller * input clock rates we try to do 10mb/s although I don't think a transfer can 245cd9ad58dSDavid S. Miller * even run that fast with an ESP even with DMA2 scatter gather pipelining. 246cd9ad58dSDavid S. Miller */ 247cd9ad58dSDavid S. Miller #define SYNC_DEFP_SLOW 0x32 /* 5mb/s */ 248cd9ad58dSDavid S. Miller #define SYNC_DEFP_FAST 0x19 /* 10mb/s */ 249cd9ad58dSDavid S. Miller 250cd9ad58dSDavid S. Miller struct esp_cmd_priv { 251cd9ad58dSDavid S. Miller union { 252cd9ad58dSDavid S. Miller dma_addr_t dma_addr; 253cd9ad58dSDavid S. Miller int num_sg; 254cd9ad58dSDavid S. Miller } u; 255cd9ad58dSDavid S. Miller 256582fb6c0SDavid S. Miller int cur_residue; 257cd9ad58dSDavid S. Miller struct scatterlist *cur_sg; 258582fb6c0SDavid S. Miller int tot_residue; 259cd9ad58dSDavid S. Miller }; 260cd9ad58dSDavid S. Miller #define ESP_CMD_PRIV(CMD) ((struct esp_cmd_priv *)(&(CMD)->SCp)) 261cd9ad58dSDavid S. Miller 262cd9ad58dSDavid S. Miller enum esp_rev { 263cd9ad58dSDavid S. Miller ESP100 = 0x00, /* NCR53C90 - very broken */ 264cd9ad58dSDavid S. Miller ESP100A = 0x01, /* NCR53C90A */ 265cd9ad58dSDavid S. Miller ESP236 = 0x02, 266cd9ad58dSDavid S. Miller FAS236 = 0x03, 267cd9ad58dSDavid S. Miller FAS100A = 0x04, 268cd9ad58dSDavid S. Miller FAST = 0x05, 269cd9ad58dSDavid S. Miller FASHME = 0x06, 270*eeea2f9cSHannes Reinecke PCSCSI = 0x07, /* AM53c974 */ 271cd9ad58dSDavid S. Miller }; 272cd9ad58dSDavid S. Miller 273cd9ad58dSDavid S. Miller struct esp_cmd_entry { 274cd9ad58dSDavid S. Miller struct list_head list; 275cd9ad58dSDavid S. Miller 276cd9ad58dSDavid S. Miller struct scsi_cmnd *cmd; 277cd9ad58dSDavid S. Miller 278cd9ad58dSDavid S. Miller unsigned int saved_cur_residue; 279cd9ad58dSDavid S. Miller struct scatterlist *saved_cur_sg; 280cd9ad58dSDavid S. Miller unsigned int saved_tot_residue; 281cd9ad58dSDavid S. Miller 282cd9ad58dSDavid S. Miller u8 flags; 283cd9ad58dSDavid S. Miller #define ESP_CMD_FLAG_WRITE 0x01 /* DMA is a write */ 284cd9ad58dSDavid S. Miller #define ESP_CMD_FLAG_ABORT 0x02 /* being aborted */ 285cd9ad58dSDavid S. Miller #define ESP_CMD_FLAG_AUTOSENSE 0x04 /* Doing automatic REQUEST_SENSE */ 2866df388f2SHannes Reinecke #define ESP_CMD_FLAG_RESIDUAL 0x08 /* AM53c974 BLAST residual */ 287cd9ad58dSDavid S. Miller 288cd9ad58dSDavid S. Miller u8 tag[2]; 28921af8107SDavid S. Miller u8 orig_tag[2]; 290cd9ad58dSDavid S. Miller 291cd9ad58dSDavid S. Miller u8 status; 292cd9ad58dSDavid S. Miller u8 message; 293cd9ad58dSDavid S. Miller 294cd9ad58dSDavid S. Miller unsigned char *sense_ptr; 295cd9ad58dSDavid S. Miller unsigned char *saved_sense_ptr; 296cd9ad58dSDavid S. Miller dma_addr_t sense_dma; 297cd9ad58dSDavid S. Miller 298cd9ad58dSDavid S. Miller struct completion *eh_done; 299cd9ad58dSDavid S. Miller }; 300cd9ad58dSDavid S. Miller 301cd9ad58dSDavid S. Miller #define ESP_DEFAULT_TAGS 16 302cd9ad58dSDavid S. Miller 303cd9ad58dSDavid S. Miller #define ESP_MAX_TARGET 16 304cd9ad58dSDavid S. Miller #define ESP_MAX_LUN 8 305cd9ad58dSDavid S. Miller #define ESP_MAX_TAG 256 306cd9ad58dSDavid S. Miller 307cd9ad58dSDavid S. Miller struct esp_lun_data { 308cd9ad58dSDavid S. Miller struct esp_cmd_entry *non_tagged_cmd; 309cd9ad58dSDavid S. Miller int num_tagged; 310cd9ad58dSDavid S. Miller int hold; 311cd9ad58dSDavid S. Miller struct esp_cmd_entry *tagged_cmds[ESP_MAX_TAG]; 312cd9ad58dSDavid S. Miller }; 313cd9ad58dSDavid S. Miller 314cd9ad58dSDavid S. Miller struct esp_target_data { 315cd9ad58dSDavid S. Miller /* These are the ESP_STP, ESP_SOFF, and ESP_CFG3 register values which 316cd9ad58dSDavid S. Miller * match the currently negotiated settings for this target. The SCSI 317cd9ad58dSDavid S. Miller * protocol values are maintained in spi_{offset,period,wide}(starget). 318cd9ad58dSDavid S. Miller */ 319cd9ad58dSDavid S. Miller u8 esp_period; 320cd9ad58dSDavid S. Miller u8 esp_offset; 321cd9ad58dSDavid S. Miller u8 esp_config3; 322cd9ad58dSDavid S. Miller 323cd9ad58dSDavid S. Miller u8 flags; 324cd9ad58dSDavid S. Miller #define ESP_TGT_WIDE 0x01 325cd9ad58dSDavid S. Miller #define ESP_TGT_DISCONNECT 0x02 326cd9ad58dSDavid S. Miller #define ESP_TGT_NEGO_WIDE 0x04 327cd9ad58dSDavid S. Miller #define ESP_TGT_NEGO_SYNC 0x08 328cd9ad58dSDavid S. Miller #define ESP_TGT_CHECK_NEGO 0x40 329cd9ad58dSDavid S. Miller #define ESP_TGT_BROKEN 0x80 330cd9ad58dSDavid S. Miller 331cd9ad58dSDavid S. Miller /* When ESP_TGT_CHECK_NEGO is set, on the next scsi command to this 332cd9ad58dSDavid S. Miller * device we will try to negotiate the following parameters. 333cd9ad58dSDavid S. Miller */ 334cd9ad58dSDavid S. Miller u8 nego_goal_period; 335cd9ad58dSDavid S. Miller u8 nego_goal_offset; 336cd9ad58dSDavid S. Miller u8 nego_goal_width; 337cd9ad58dSDavid S. Miller u8 nego_goal_tags; 338cd9ad58dSDavid S. Miller 339cd9ad58dSDavid S. Miller struct scsi_target *starget; 340cd9ad58dSDavid S. Miller }; 341cd9ad58dSDavid S. Miller 342cd9ad58dSDavid S. Miller struct esp_event_ent { 343cd9ad58dSDavid S. Miller u8 type; 344cd9ad58dSDavid S. Miller #define ESP_EVENT_TYPE_EVENT 0x01 345cd9ad58dSDavid S. Miller #define ESP_EVENT_TYPE_CMD 0x02 346cd9ad58dSDavid S. Miller u8 val; 347cd9ad58dSDavid S. Miller 348cd9ad58dSDavid S. Miller u8 sreg; 349cd9ad58dSDavid S. Miller u8 seqreg; 350cd9ad58dSDavid S. Miller u8 sreg2; 351cd9ad58dSDavid S. Miller u8 ireg; 352cd9ad58dSDavid S. Miller u8 select_state; 353cd9ad58dSDavid S. Miller u8 event; 354cd9ad58dSDavid S. Miller u8 __pad; 355cd9ad58dSDavid S. Miller }; 356cd9ad58dSDavid S. Miller 357cd9ad58dSDavid S. Miller struct esp; 358cd9ad58dSDavid S. Miller struct esp_driver_ops { 359cd9ad58dSDavid S. Miller /* Read and write the ESP 8-bit registers. On some 360cd9ad58dSDavid S. Miller * applications of the ESP chip the registers are at 4-byte 361cd9ad58dSDavid S. Miller * instead of 1-byte intervals. 362cd9ad58dSDavid S. Miller */ 363cd9ad58dSDavid S. Miller void (*esp_write8)(struct esp *esp, u8 val, unsigned long reg); 364cd9ad58dSDavid S. Miller u8 (*esp_read8)(struct esp *esp, unsigned long reg); 365cd9ad58dSDavid S. Miller 366cd9ad58dSDavid S. Miller /* Map and unmap DMA memory. Eventually the driver will be 367cd9ad58dSDavid S. Miller * converted to the generic DMA API as soon as SBUS is able to 368cd9ad58dSDavid S. Miller * cope with that. At such time we can remove this. 369cd9ad58dSDavid S. Miller */ 370cd9ad58dSDavid S. Miller dma_addr_t (*map_single)(struct esp *esp, void *buf, 371cd9ad58dSDavid S. Miller size_t sz, int dir); 372cd9ad58dSDavid S. Miller int (*map_sg)(struct esp *esp, struct scatterlist *sg, 373cd9ad58dSDavid S. Miller int num_sg, int dir); 374cd9ad58dSDavid S. Miller void (*unmap_single)(struct esp *esp, dma_addr_t addr, 375cd9ad58dSDavid S. Miller size_t sz, int dir); 376cd9ad58dSDavid S. Miller void (*unmap_sg)(struct esp *esp, struct scatterlist *sg, 377cd9ad58dSDavid S. Miller int num_sg, int dir); 378cd9ad58dSDavid S. Miller 379cd9ad58dSDavid S. Miller /* Return non-zero if there is an IRQ pending. Usually this 380cd9ad58dSDavid S. Miller * status bit lives in the DMA controller sitting in front of 381cd9ad58dSDavid S. Miller * the ESP. This has to be accurate or else the ESP interrupt 382cd9ad58dSDavid S. Miller * handler will not run. 383cd9ad58dSDavid S. Miller */ 384cd9ad58dSDavid S. Miller int (*irq_pending)(struct esp *esp); 385cd9ad58dSDavid S. Miller 3866fe07aafSFinn Thain /* Return the maximum allowable size of a DMA transfer for a 3876fe07aafSFinn Thain * given buffer. 3886fe07aafSFinn Thain */ 3896fe07aafSFinn Thain u32 (*dma_length_limit)(struct esp *esp, u32 dma_addr, 3906fe07aafSFinn Thain u32 dma_len); 3916fe07aafSFinn Thain 392cd9ad58dSDavid S. Miller /* Reset the DMA engine entirely. On return, ESP interrupts 393cd9ad58dSDavid S. Miller * should be enabled. Often the interrupt enabling is 394cd9ad58dSDavid S. Miller * controlled in the DMA engine. 395cd9ad58dSDavid S. Miller */ 396cd9ad58dSDavid S. Miller void (*reset_dma)(struct esp *esp); 397cd9ad58dSDavid S. Miller 398cd9ad58dSDavid S. Miller /* Drain any pending DMA in the DMA engine after a transfer. 399cd9ad58dSDavid S. Miller * This is for writes to memory. 400cd9ad58dSDavid S. Miller */ 401cd9ad58dSDavid S. Miller void (*dma_drain)(struct esp *esp); 402cd9ad58dSDavid S. Miller 403cd9ad58dSDavid S. Miller /* Invalidate the DMA engine after a DMA transfer. */ 404cd9ad58dSDavid S. Miller void (*dma_invalidate)(struct esp *esp); 405cd9ad58dSDavid S. Miller 406cd9ad58dSDavid S. Miller /* Setup an ESP command that will use a DMA transfer. 407cd9ad58dSDavid S. Miller * The 'esp_count' specifies what transfer length should be 408cd9ad58dSDavid S. Miller * programmed into the ESP transfer counter registers, whereas 409cd9ad58dSDavid S. Miller * the 'dma_count' is the length that should be programmed into 410cd9ad58dSDavid S. Miller * the DMA controller. Usually they are the same. If 'write' 411cd9ad58dSDavid S. Miller * is non-zero, this transfer is a write into memory. 'cmd' 412cd9ad58dSDavid S. Miller * holds the ESP command that should be issued by calling 413cd9ad58dSDavid S. Miller * scsi_esp_cmd() at the appropriate time while programming 414cd9ad58dSDavid S. Miller * the DMA hardware. 415cd9ad58dSDavid S. Miller */ 416cd9ad58dSDavid S. Miller void (*send_dma_cmd)(struct esp *esp, u32 dma_addr, u32 esp_count, 417cd9ad58dSDavid S. Miller u32 dma_count, int write, u8 cmd); 418cd9ad58dSDavid S. Miller 419cd9ad58dSDavid S. Miller /* Return non-zero if the DMA engine is reporting an error 420cd9ad58dSDavid S. Miller * currently. 421cd9ad58dSDavid S. Miller */ 422cd9ad58dSDavid S. Miller int (*dma_error)(struct esp *esp); 423cd9ad58dSDavid S. Miller }; 424cd9ad58dSDavid S. Miller 425cd9ad58dSDavid S. Miller #define ESP_MAX_MSG_SZ 8 426cd9ad58dSDavid S. Miller #define ESP_EVENT_LOG_SZ 32 427cd9ad58dSDavid S. Miller 428cd9ad58dSDavid S. Miller #define ESP_QUICKIRQ_LIMIT 100 429cd9ad58dSDavid S. Miller #define ESP_RESELECT_TAG_LIMIT 2500 430cd9ad58dSDavid S. Miller 431cd9ad58dSDavid S. Miller struct esp { 432cd9ad58dSDavid S. Miller void __iomem *regs; 433cd9ad58dSDavid S. Miller void __iomem *dma_regs; 434cd9ad58dSDavid S. Miller 435cd9ad58dSDavid S. Miller const struct esp_driver_ops *ops; 436cd9ad58dSDavid S. Miller 437cd9ad58dSDavid S. Miller struct Scsi_Host *host; 438cd9ad58dSDavid S. Miller void *dev; 439cd9ad58dSDavid S. Miller 440cd9ad58dSDavid S. Miller struct esp_cmd_entry *active_cmd; 441cd9ad58dSDavid S. Miller 442cd9ad58dSDavid S. Miller struct list_head queued_cmds; 443cd9ad58dSDavid S. Miller struct list_head active_cmds; 444cd9ad58dSDavid S. Miller 445cd9ad58dSDavid S. Miller u8 *command_block; 446cd9ad58dSDavid S. Miller dma_addr_t command_block_dma; 447cd9ad58dSDavid S. Miller 448cd9ad58dSDavid S. Miller unsigned int data_dma_len; 449cd9ad58dSDavid S. Miller 450cd9ad58dSDavid S. Miller /* The following are used to determine the cause of an IRQ. Upon every 451cd9ad58dSDavid S. Miller * IRQ entry we synchronize these with the hardware registers. 452cd9ad58dSDavid S. Miller */ 453cd9ad58dSDavid S. Miller u8 sreg; 454cd9ad58dSDavid S. Miller u8 seqreg; 455cd9ad58dSDavid S. Miller u8 sreg2; 456cd9ad58dSDavid S. Miller u8 ireg; 457cd9ad58dSDavid S. Miller 458cd9ad58dSDavid S. Miller u32 prev_hme_dmacsr; 459cd9ad58dSDavid S. Miller u8 prev_soff; 460cd9ad58dSDavid S. Miller u8 prev_stp; 461cd9ad58dSDavid S. Miller u8 prev_cfg3; 4623707a186SHannes Reinecke u8 num_tags; 463cd9ad58dSDavid S. Miller 464cd9ad58dSDavid S. Miller struct list_head esp_cmd_pool; 465cd9ad58dSDavid S. Miller 466cd9ad58dSDavid S. Miller struct esp_target_data target[ESP_MAX_TARGET]; 467cd9ad58dSDavid S. Miller 468cd9ad58dSDavid S. Miller int fifo_cnt; 469cd9ad58dSDavid S. Miller u8 fifo[16]; 470cd9ad58dSDavid S. Miller 471cd9ad58dSDavid S. Miller struct esp_event_ent esp_event_log[ESP_EVENT_LOG_SZ]; 472cd9ad58dSDavid S. Miller int esp_event_cur; 473cd9ad58dSDavid S. Miller 474cd9ad58dSDavid S. Miller u8 msg_out[ESP_MAX_MSG_SZ]; 475cd9ad58dSDavid S. Miller int msg_out_len; 476cd9ad58dSDavid S. Miller 477cd9ad58dSDavid S. Miller u8 msg_in[ESP_MAX_MSG_SZ]; 478cd9ad58dSDavid S. Miller int msg_in_len; 479cd9ad58dSDavid S. Miller 480cd9ad58dSDavid S. Miller u8 bursts; 481cd9ad58dSDavid S. Miller u8 config1; 482cd9ad58dSDavid S. Miller u8 config2; 483*eeea2f9cSHannes Reinecke u8 config4; 484cd9ad58dSDavid S. Miller 485cd9ad58dSDavid S. Miller u8 scsi_id; 486cd9ad58dSDavid S. Miller u32 scsi_id_mask; 487cd9ad58dSDavid S. Miller 488cd9ad58dSDavid S. Miller enum esp_rev rev; 489cd9ad58dSDavid S. Miller 490cd9ad58dSDavid S. Miller u32 flags; 491cd9ad58dSDavid S. Miller #define ESP_FLAG_DIFFERENTIAL 0x00000001 492cd9ad58dSDavid S. Miller #define ESP_FLAG_RESETTING 0x00000002 493cd9ad58dSDavid S. Miller #define ESP_FLAG_DOING_SLOWCMD 0x00000004 494cd9ad58dSDavid S. Miller #define ESP_FLAG_WIDE_CAPABLE 0x00000008 495cd9ad58dSDavid S. Miller #define ESP_FLAG_QUICKIRQ_CHECK 0x00000010 4966fe07aafSFinn Thain #define ESP_FLAG_DISABLE_SYNC 0x00000020 4973170866fSHannes Reinecke #define ESP_FLAG_USE_FIFO 0x00000040 498cd9ad58dSDavid S. Miller 499cd9ad58dSDavid S. Miller u8 select_state; 500cd9ad58dSDavid S. Miller #define ESP_SELECT_NONE 0x00 /* Not selecting */ 501cd9ad58dSDavid S. Miller #define ESP_SELECT_BASIC 0x01 /* Select w/o MSGOUT phase */ 502cd9ad58dSDavid S. Miller #define ESP_SELECT_MSGOUT 0x02 /* Select with MSGOUT */ 503cd9ad58dSDavid S. Miller 504cd9ad58dSDavid S. Miller /* When we are not selecting, we are expecting an event. */ 505cd9ad58dSDavid S. Miller u8 event; 506cd9ad58dSDavid S. Miller #define ESP_EVENT_NONE 0x00 507cd9ad58dSDavid S. Miller #define ESP_EVENT_CMD_START 0x01 508cd9ad58dSDavid S. Miller #define ESP_EVENT_CMD_DONE 0x02 509cd9ad58dSDavid S. Miller #define ESP_EVENT_DATA_IN 0x03 510cd9ad58dSDavid S. Miller #define ESP_EVENT_DATA_OUT 0x04 511cd9ad58dSDavid S. Miller #define ESP_EVENT_DATA_DONE 0x05 512cd9ad58dSDavid S. Miller #define ESP_EVENT_MSGIN 0x06 513cd9ad58dSDavid S. Miller #define ESP_EVENT_MSGIN_MORE 0x07 514cd9ad58dSDavid S. Miller #define ESP_EVENT_MSGIN_DONE 0x08 515cd9ad58dSDavid S. Miller #define ESP_EVENT_MSGOUT 0x09 516cd9ad58dSDavid S. Miller #define ESP_EVENT_MSGOUT_DONE 0x0a 517cd9ad58dSDavid S. Miller #define ESP_EVENT_STATUS 0x0b 518cd9ad58dSDavid S. Miller #define ESP_EVENT_FREE_BUS 0x0c 519cd9ad58dSDavid S. Miller #define ESP_EVENT_CHECK_PHASE 0x0d 520cd9ad58dSDavid S. Miller #define ESP_EVENT_RESET 0x10 521cd9ad58dSDavid S. Miller 522cd9ad58dSDavid S. Miller /* Probed in esp_get_clock_params() */ 523cd9ad58dSDavid S. Miller u32 cfact; 524cd9ad58dSDavid S. Miller u32 cfreq; 525cd9ad58dSDavid S. Miller u32 ccycle; 526cd9ad58dSDavid S. Miller u32 ctick; 527cd9ad58dSDavid S. Miller u32 neg_defp; 528cd9ad58dSDavid S. Miller u32 sync_defp; 529cd9ad58dSDavid S. Miller 530cd9ad58dSDavid S. Miller /* Computed in esp_reset_esp() */ 531cd9ad58dSDavid S. Miller u32 max_period; 532cd9ad58dSDavid S. Miller u32 min_period; 533cd9ad58dSDavid S. Miller u32 radelay; 534cd9ad58dSDavid S. Miller 535cd9ad58dSDavid S. Miller /* Slow command state. */ 536cd9ad58dSDavid S. Miller u8 *cmd_bytes_ptr; 537cd9ad58dSDavid S. Miller int cmd_bytes_left; 538cd9ad58dSDavid S. Miller 539cd9ad58dSDavid S. Miller struct completion *eh_reset; 540cd9ad58dSDavid S. Miller 541334ae614SDavid S. Miller void *dma; 542334ae614SDavid S. Miller int dmarev; 543cd9ad58dSDavid S. Miller }; 544cd9ad58dSDavid S. Miller 545cd9ad58dSDavid S. Miller /* A front-end driver for the ESP chip should do the following in 546cd9ad58dSDavid S. Miller * it's device probe routine: 547cd9ad58dSDavid S. Miller * 1) Allocate the host and private area using scsi_host_alloc() 548cd9ad58dSDavid S. Miller * with size 'sizeof(struct esp)'. The first argument to 549cd9ad58dSDavid S. Miller * scsi_host_alloc() should be &scsi_esp_template. 550cd9ad58dSDavid S. Miller * 2) Set host->max_id as appropriate. 551cd9ad58dSDavid S. Miller * 3) Set esp->host to the scsi_host itself, and esp->dev 552cd9ad58dSDavid S. Miller * to the device object pointer. 553cd9ad58dSDavid S. Miller * 4) Hook up esp->ops to the front-end implementation. 554cd9ad58dSDavid S. Miller * 5) If the ESP chip supports wide transfers, set ESP_FLAG_WIDE_CAPABLE 555cd9ad58dSDavid S. Miller * in esp->flags. 556cd9ad58dSDavid S. Miller * 6) Map the DMA and ESP chip registers. 557cd9ad58dSDavid S. Miller * 7) DMA map the ESP command block, store the DMA address 558cd9ad58dSDavid S. Miller * in esp->command_block_dma. 559cd9ad58dSDavid S. Miller * 8) Register the scsi_esp_intr() interrupt handler. 560cd9ad58dSDavid S. Miller * 9) Probe for and provide the following chip properties: 561cd9ad58dSDavid S. Miller * esp->scsi_id (assign to esp->host->this_id too) 562cd9ad58dSDavid S. Miller * esp->scsi_id_mask 563cd9ad58dSDavid S. Miller * If ESP bus is differential, set ESP_FLAG_DIFFERENTIAL 564cd9ad58dSDavid S. Miller * esp->cfreq 565cd9ad58dSDavid S. Miller * DMA burst bit mask in esp->bursts, if necessary 566cd9ad58dSDavid S. Miller * 10) Perform any actions necessary before the ESP device can 567cd9ad58dSDavid S. Miller * be programmed for the first time. On some configs, for 568cd9ad58dSDavid S. Miller * example, the DMA engine has to be reset before ESP can 569cd9ad58dSDavid S. Miller * be programmed. 570cd9ad58dSDavid S. Miller * 11) If necessary, call dev_set_drvdata() as needed. 571cd9ad58dSDavid S. Miller * 12) Call scsi_esp_register() with prepared 'esp' structure 572cd9ad58dSDavid S. Miller * and a device pointer if possible. 573cd9ad58dSDavid S. Miller * 13) Check scsi_esp_register() return value, release all resources 574cd9ad58dSDavid S. Miller * if an error was returned. 575cd9ad58dSDavid S. Miller */ 576cd9ad58dSDavid S. Miller extern struct scsi_host_template scsi_esp_template; 577cd9ad58dSDavid S. Miller extern int scsi_esp_register(struct esp *, struct device *); 578cd9ad58dSDavid S. Miller 579cd9ad58dSDavid S. Miller extern void scsi_esp_unregister(struct esp *); 580cd9ad58dSDavid S. Miller extern irqreturn_t scsi_esp_intr(int, void *); 581cd9ad58dSDavid S. Miller extern void scsi_esp_cmd(struct esp *, u8); 582cd9ad58dSDavid S. Miller 583cd9ad58dSDavid S. Miller #endif /* !(_ESP_SCSI_H) */ 584