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