ncr5380: Remove duplicate comments
[cascardo/linux.git] / drivers / scsi / sun3_scsi.h
1 /*
2  * Sun3 SCSI stuff by Erik Verbruggen (erik@bigmama.xtdnet.nl)
3  *
4  * Sun3 DMA additions by Sam Creasey (sammy@sammy.net)
5  *
6  * Adapted from mac_scsinew.h:
7  */
8 /*
9  * Cumana Generic NCR5380 driver defines
10  *
11  * Copyright 1993, Drew Eckhardt
12  *      Visionary Computing
13  *      (Unix and Linux consulting and custom programming)
14  *      drew@colorado.edu
15  *      +1 (303) 440-4894
16  *
17  * ALPHA RELEASE 1.
18  */
19
20 #ifndef SUN3_SCSI_H
21 #define SUN3_SCSI_H
22
23 #define SUN3SCSI_PUBLIC_RELEASE 1
24
25 /*
26  * Int: level 2 autovector
27  * IO: type 1, base 0x00140000, 5 bits phys space: A<4..0>
28  */
29 #define IRQ_SUN3_SCSI 2
30 #define IOBASE_SUN3_SCSI 0x00140000
31
32 #define IOBASE_SUN3_VMESCSI 0xff200000
33
34 #ifndef CMD_PER_LUN
35 #define CMD_PER_LUN 2
36 #endif
37
38 #ifndef CAN_QUEUE
39 #define CAN_QUEUE 16
40 #endif
41
42 #ifndef SG_TABLESIZE
43 #define SG_TABLESIZE SG_NONE
44 #endif
45
46 #ifndef MAX_TAGS
47 #define MAX_TAGS 32
48 #endif
49
50 #ifndef USE_TAGGED_QUEUING
51 #define USE_TAGGED_QUEUING 1
52 #endif
53
54 #include <scsi/scsicam.h>
55
56 #ifdef SUN3_SCSI_VME
57 #define SUN3_SCSI_NAME "Sun3 NCR5380 VME SCSI"
58 #else
59 #define SUN3_SCSI_NAME "Sun3 NCR5380 SCSI"
60 #endif
61
62 #define NCR5380_implementation_fields /* none */
63
64 #define NCR5380_local_declare() \
65         struct Scsi_Host *_instance
66
67 #define NCR5380_setup(instance) \
68         _instance = instance
69
70 #define NCR5380_read(reg) sun3scsi_read(reg)
71 #define NCR5380_write(reg, value) sun3scsi_write(reg, value)
72
73 #define NCR5380_queue_command sun3scsi_queue_command
74 #define NCR5380_bus_reset sun3scsi_bus_reset
75 #define NCR5380_abort sun3scsi_abort
76 #define NCR5380_show_info sun3scsi_show_info
77 #define NCR5380_dma_xfer_len(i, cmd, phase) \
78         sun3scsi_dma_xfer_len(cmd->SCp.this_residual,cmd,((phase) & SR_IO) ? 0 : 1)
79
80 #define NCR5380_dma_write_setup(instance, data, count) sun3scsi_dma_setup(data, count, 1)
81 #define NCR5380_dma_read_setup(instance, data, count) sun3scsi_dma_setup(data, count, 0)
82 #define NCR5380_dma_residual sun3scsi_dma_residual
83
84 /* additional registers - mainly DMA control regs */
85 /* these start at regbase + 8 -- directly after the NCR regs */
86 struct sun3_dma_regs {
87         unsigned short dma_addr_hi; /* vme only */
88         unsigned short dma_addr_lo; /* vme only */
89         unsigned short dma_count_hi; /* vme only */
90         unsigned short dma_count_lo; /* vme only */
91         unsigned short udc_data; /* udc dma data reg (obio only) */
92         unsigned short udc_addr; /* uda dma addr reg (obio only) */
93         unsigned short fifo_data; /* fifo data reg, holds extra byte on
94                                      odd dma reads */
95         unsigned short fifo_count; 
96         unsigned short csr; /* control/status reg */
97         unsigned short bpack_hi; /* vme only */
98         unsigned short bpack_lo; /* vme only */
99         unsigned short ivect; /* vme only */
100         unsigned short fifo_count_hi; /* vme only */
101 };
102
103 /* ucd chip specific regs - live in dvma space */
104 struct sun3_udc_regs {
105      unsigned short rsel; /* select regs to load */
106      unsigned short addr_hi; /* high word of addr */
107      unsigned short addr_lo; /* low word */
108      unsigned short count; /* words to be xfer'd */
109      unsigned short mode_hi; /* high word of channel mode */
110      unsigned short mode_lo; /* low word of channel mode */
111 };
112
113 /* addresses of the udc registers */
114 #define UDC_MODE 0x38 
115 #define UDC_CSR 0x2e /* command/status */
116 #define UDC_CHN_HI 0x26 /* chain high word */
117 #define UDC_CHN_LO 0x22 /* chain lo word */
118 #define UDC_CURA_HI 0x1a /* cur reg A high */
119 #define UDC_CURA_LO 0x0a /* cur reg A low */
120 #define UDC_CURB_HI 0x12 /* cur reg B high */
121 #define UDC_CURB_LO 0x02 /* cur reg B low */
122 #define UDC_MODE_HI 0x56 /* mode reg high */
123 #define UDC_MODE_LO 0x52 /* mode reg low */
124 #define UDC_COUNT 0x32 /* words to xfer */
125
126 /* some udc commands */
127 #define UDC_RESET 0
128 #define UDC_CHN_START 0xa0 /* start chain */
129 #define UDC_INT_ENABLE 0x32 /* channel 1 int on */
130
131 /* udc mode words */
132 #define UDC_MODE_HIWORD 0x40
133 #define UDC_MODE_LSEND 0xc2
134 #define UDC_MODE_LRECV 0xd2
135
136 /* udc reg selections */
137 #define UDC_RSEL_SEND 0x282
138 #define UDC_RSEL_RECV 0x182
139
140 /* bits in csr reg */
141 #define CSR_DMA_ACTIVE 0x8000
142 #define CSR_DMA_CONFLICT 0x4000
143 #define CSR_DMA_BUSERR 0x2000
144
145 #define CSR_FIFO_EMPTY 0x400 /* fifo flushed? */
146 #define CSR_SDB_INT 0x200 /* sbc interrupt pending */
147 #define CSR_DMA_INT 0x100 /* dma interrupt pending */
148
149 #define CSR_LEFT 0xc0
150 #define CSR_LEFT_3 0xc0
151 #define CSR_LEFT_2 0x80
152 #define CSR_LEFT_1 0x40
153 #define CSR_PACK_ENABLE 0x20
154
155 #define CSR_DMA_ENABLE 0x10
156
157 #define CSR_SEND 0x8 /* 1 = send  0 = recv */
158 #define CSR_FIFO 0x2 /* reset fifo */
159 #define CSR_INTR 0x4 /* interrupt enable */
160 #define CSR_SCSI 0x1 
161
162 #define VME_DATA24 0x3d00
163
164 #endif /* SUN3_SCSI_H */
165