Go to the documentation of this file.
29 #define NSP_INITIATOR_ID 7
31 #define NSP_SELTIMEOUT 200
39 #define IRQCONTROL 0x00
40 # define IRQCONTROL_RESELECT_CLEAR BIT(0)
41 # define IRQCONTROL_PHASE_CHANGE_CLEAR BIT(1)
42 # define IRQCONTROL_TIMER_CLEAR BIT(2)
43 # define IRQCONTROL_FIFO_CLEAR BIT(3)
44 # define IRQCONTROL_ALLMASK 0xff
45 # define IRQCONTROL_ALLCLEAR (IRQCONTROL_RESELECT_CLEAR | \
46 IRQCONTROL_PHASE_CHANGE_CLEAR | \
47 IRQCONTROL_TIMER_CLEAR | \
48 IRQCONTROL_FIFO_CLEAR )
49 # define IRQCONTROL_IRQDISABLE 0xf0
51 #define IRQSTATUS 0x00
52 # define IRQSTATUS_SCSI BIT(0)
53 # define IRQSTATUS_TIMER BIT(2)
54 # define IRQSTATUS_FIFO BIT(3)
55 # define IRQSTATUS_MASK 0x0f
58 # define IF_IFSEL BIT(0)
59 # define IF_REGSEL BIT(2)
61 #define FIFOSTATUS 0x01
62 # define FIFOSTATUS_CHIP_REVISION_MASK 0x0f
63 # define FIFOSTATUS_CHIP_ID_MASK 0x70
64 # define FIFOSTATUS_FULL_EMPTY BIT(7)
69 #define FIFODATA1 0x05
70 #define FIFODATA2 0x06
71 #define FIFODATA3 0x07
76 #define EXTBUSCTRL 0x10
79 # define CLOCK_40M 0x02
80 # define CLOCK_20M 0x01
81 # define FAST_20 BIT(2)
83 #define TERMPWRCTRL 0x13
84 # define POWER_ON BIT(0)
86 #define SCSIIRQMODE 0x15
87 # define SCSI_PHASE_CHANGE_EI BIT(0)
88 # define RESELECT_EI BIT(4)
89 # define FIFO_IRQ_EI BIT(5)
90 # define SCSI_RESET_IRQ_EI BIT(6)
92 #define IRQPHASESENCE 0x16
93 # define LATCHED_MSG BIT(0)
94 # define LATCHED_IO BIT(1)
95 # define LATCHED_CD BIT(2)
96 # define LATCHED_BUS_FREE BIT(3)
97 # define PHASE_CHANGE_IRQ BIT(4)
98 # define RESELECT_IRQ BIT(5)
99 # define FIFO_IRQ BIT(6)
100 # define SCSI_RESET_IRQ BIT(7)
102 #define TIMERCOUNT 0x17
104 #define SCSIBUSCTRL 0x18
105 # define SCSI_SEL BIT(0)
106 # define SCSI_RST BIT(1)
107 # define SCSI_DATAOUT_ENB BIT(2)
108 # define SCSI_ATN BIT(3)
109 # define SCSI_ACK BIT(4)
110 # define SCSI_BSY BIT(5)
111 # define AUTODIRECTION BIT(6)
112 # define ACKENB BIT(7)
114 #define SCSIBUSMON 0x19
116 #define SETARBIT 0x1A
117 # define ARBIT_GO BIT(0)
118 # define ARBIT_FLAG_CLEAR BIT(1)
120 #define ARBITSTATUS 0x1A
122 # define ARBIT_WIN BIT(1)
123 # define ARBIT_FAIL BIT(2)
124 # define RESELECT_FLAG BIT(3)
126 #define PARITYCTRL 0x1B
127 #define PARITYSTATUS 0x1B
129 #define COMMANDCTRL 0x1C
130 # define CLEAR_COMMAND_POINTER BIT(0)
131 # define AUTO_COMMAND_GO BIT(1)
133 #define RESELECTID 0x1C
134 #define COMMANDDATA 0x1D
136 #define POINTERCLR 0x1E
137 # define POINTER_CLEAR BIT(0)
138 # define ACK_COUNTER_CLEAR BIT(1)
139 # define REQ_COUNTER_CLEAR BIT(2)
140 # define HOST_COUNTER_CLEAR BIT(3)
141 # define READ_SOURCE (BIT(4) | BIT(5))
142 # define ACK_COUNTER (0)
143 # define REQ_COUNTER (BIT(4))
144 # define HOST_COUNTER (BIT(5))
146 #define TRANSFERCOUNT 0x1E
148 #define TRANSFERMODE 0x20
149 # define MODE_MEM8 BIT(0)
150 # define MODE_MEM32 BIT(1)
151 # define MODE_ADR24 BIT(2)
152 # define MODE_ADR32 BIT(3)
153 # define MODE_IO8 BIT(4)
154 # define MODE_IO32 BIT(5)
155 # define TRANSFER_GO BIT(6)
156 # define BRAIND BIT(7)
159 # define SYNCREG_OFFSET_MASK 0x0f
160 # define SYNCREG_PERIOD_MASK 0xf0
161 # define SYNCREG_PERIOD_SHIFT 4
163 #define SCSIDATALATCH 0x22
164 #define SCSIDATAIN 0x22
165 #define SCSIDATAWITHACK 0x23
166 #define SCAMCONTROL 0x24
167 #define SCAMSTATUS 0x24
168 #define SCAMDATA 0x25
170 #define OTHERCONTROL 0x26
171 # define TPL_ROM_WRITE_EN BIT(0)
172 # define TPWR_OUT BIT(1)
173 # define TPWR_SENSE BIT(2)
174 # define RA8_CONTROL BIT(3)
176 #define ACKWIDTH 0x27
177 #define CLRTESTPNT 0x28
178 #define ACKCNTLD 0x29
179 #define REQCNTLD 0x2A
180 #define HSTCNTLD 0x2B
181 #define CHECKSUM 0x2C
186 #define S_MESSAGE BIT(0)
189 #define S_BUSY BIT(3)
191 #define S_REQUEST BIT(5)
192 #define S_SELECT BIT(6)
198 #define BUSMON_SEL S_SELECT
199 #define BUSMON_BSY S_BUSY
200 #define BUSMON_REQ S_REQUEST
201 #define BUSMON_IO S_IO
202 #define BUSMON_ACK S_ACK
203 #define BUSMON_BUS_FREE 0
204 #define BUSMON_COMMAND ( S_BUSY | S_CD | S_REQUEST )
205 #define BUSMON_MESSAGE_IN ( S_BUSY | S_CD | S_IO | S_MESSAGE | S_REQUEST )
206 #define BUSMON_MESSAGE_OUT ( S_BUSY | S_CD | S_MESSAGE | S_REQUEST )
207 #define BUSMON_DATA_IN ( S_BUSY | S_IO | S_REQUEST )
208 #define BUSMON_DATA_OUT ( S_BUSY | S_REQUEST )
209 #define BUSMON_STATUS ( S_BUSY | S_CD | S_IO | S_REQUEST )
210 #define BUSMON_SELECT ( S_IO | S_SELECT )
211 #define BUSMON_RESELECT ( S_IO | S_SELECT )
212 #define BUSMON_PHASE_MASK ( S_CD | S_IO | S_MESSAGE | S_SELECT )
214 #define BUSPHASE_SELECT ( BUSMON_SELECT & BUSMON_PHASE_MASK )
215 #define BUSPHASE_COMMAND ( BUSMON_COMMAND & BUSMON_PHASE_MASK )
216 #define BUSPHASE_MESSAGE_IN ( BUSMON_MESSAGE_IN & BUSMON_PHASE_MASK )
217 #define BUSPHASE_MESSAGE_OUT ( BUSMON_MESSAGE_OUT & BUSMON_PHASE_MASK )
218 #define BUSPHASE_DATA_IN ( BUSMON_DATA_IN & BUSMON_PHASE_MASK )
219 #define BUSPHASE_DATA_OUT ( BUSMON_DATA_OUT & BUSMON_PHASE_MASK )
220 #define BUSPHASE_STATUS ( BUSMON_STATUS & BUSMON_PHASE_MASK )
225 struct pcmcia_device *
p_dev;
234 #define SYNC_NOT_YET 0
250 #define NSP_MMIO_OFFSET 0x0800
264 #define MSGBUF_SIZE 20
288 static void nsp_cs_detach (
struct pcmcia_device *p_dev);
289 static void nsp_cs_release(
struct pcmcia_device *
link);
290 static int nsp_cs_config (
struct pcmcia_device *
link);
294 static const char *nsp_info (
struct Scsi_Host *shpnt);
295 static int nsp_proc_info (
307 static int nsp_eh_bus_reset (
struct scsi_cmnd *SCpnt);
308 static int nsp_eh_host_reset (
struct scsi_cmnd *SCpnt);
313 static int nsphw_start_selection(
struct scsi_cmnd *SCpnt);
314 static void nsp_start_timer (
struct scsi_cmnd *SCpnt,
int time);
315 static int nsp_fifo_count (
struct scsi_cmnd *SCpnt);
316 static void nsp_pio_read (
struct scsi_cmnd *SCpnt);
317 static void nsp_pio_write (
struct scsi_cmnd *SCpnt);
318 static int nsp_nexus (
struct scsi_cmnd *SCpnt);
319 static void nsp_scsi_done (
struct scsi_cmnd *SCpnt);
320 static int nsp_analyze_sdtr (
struct scsi_cmnd *SCpnt);
321 static int nsp_negate_signal (
struct scsi_cmnd *SCpnt,
322 unsigned char mask,
char *
str);
323 static int nsp_expect_signal (
struct scsi_cmnd *SCpnt,
324 unsigned char current_phase,
327 static int nsp_dataphase_bypass (
struct scsi_cmnd *SCpnt);
328 static int nsp_reselected (
struct scsi_cmnd *SCpnt);
335 static int __init nsp_cs_init(
void);
336 static void __exit nsp_cs_exit(
void);
345 # define show_command(ptr)
346 # define show_phase(SCpnt)
347 # define show_busphase(stat)
348 # define show_message(data)
385 #define MSG_COMMAND_COMPLETE 0x00
386 #define MSG_EXTENDED 0x01
387 #define MSG_ABORT 0x06
388 #define MSG_NO_OPERATION 0x08
389 #define MSG_BUS_DEVICE_RESET 0x0c
391 #define MSG_EXT_SDTR 0x01
394 # define BUFFER_ADDR ((char *)((sg_virt(SCpnt->SCp.buffer))))