sun3_scsi: Convert to platform device
[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
18 #ifndef SUN3_SCSI_H
19 #define SUN3_SCSI_H
20
21 #define MAX_TAGS 32
22
23 #define NCR5380_implementation_fields /* none */
24
25 #define NCR5380_local_declare() \
26         struct Scsi_Host *_instance
27
28 #define NCR5380_setup(instance) \
29         _instance = instance
30
31 #define NCR5380_read(reg) sun3scsi_read(reg)
32 #define NCR5380_write(reg, value) sun3scsi_write(reg, value)
33
34 #define NCR5380_queue_command sun3scsi_queue_command
35 #define NCR5380_bus_reset sun3scsi_bus_reset
36 #define NCR5380_abort sun3scsi_abort
37 #define NCR5380_show_info sun3scsi_show_info
38 #define NCR5380_info sun3scsi_info
39 #define NCR5380_dma_xfer_len(i, cmd, phase) \
40         sun3scsi_dma_xfer_len(cmd->SCp.this_residual,cmd,((phase) & SR_IO) ? 0 : 1)
41
42 #define NCR5380_dma_write_setup(instance, data, count) sun3scsi_dma_setup(data, count, 1)
43 #define NCR5380_dma_read_setup(instance, data, count) sun3scsi_dma_setup(data, count, 0)
44 #define NCR5380_dma_residual sun3scsi_dma_residual
45
46 /* additional registers - mainly DMA control regs */
47 /* these start at regbase + 8 -- directly after the NCR regs */
48 struct sun3_dma_regs {
49         unsigned short dma_addr_hi; /* vme only */
50         unsigned short dma_addr_lo; /* vme only */
51         unsigned short dma_count_hi; /* vme only */
52         unsigned short dma_count_lo; /* vme only */
53         unsigned short udc_data; /* udc dma data reg (obio only) */
54         unsigned short udc_addr; /* uda dma addr reg (obio only) */
55         unsigned short fifo_data; /* fifo data reg, holds extra byte on
56                                      odd dma reads */
57         unsigned short fifo_count; 
58         unsigned short csr; /* control/status reg */
59         unsigned short bpack_hi; /* vme only */
60         unsigned short bpack_lo; /* vme only */
61         unsigned short ivect; /* vme only */
62         unsigned short fifo_count_hi; /* vme only */
63 };
64
65 /* ucd chip specific regs - live in dvma space */
66 struct sun3_udc_regs {
67      unsigned short rsel; /* select regs to load */
68      unsigned short addr_hi; /* high word of addr */
69      unsigned short addr_lo; /* low word */
70      unsigned short count; /* words to be xfer'd */
71      unsigned short mode_hi; /* high word of channel mode */
72      unsigned short mode_lo; /* low word of channel mode */
73 };
74
75 /* addresses of the udc registers */
76 #define UDC_MODE 0x38 
77 #define UDC_CSR 0x2e /* command/status */
78 #define UDC_CHN_HI 0x26 /* chain high word */
79 #define UDC_CHN_LO 0x22 /* chain lo word */
80 #define UDC_CURA_HI 0x1a /* cur reg A high */
81 #define UDC_CURA_LO 0x0a /* cur reg A low */
82 #define UDC_CURB_HI 0x12 /* cur reg B high */
83 #define UDC_CURB_LO 0x02 /* cur reg B low */
84 #define UDC_MODE_HI 0x56 /* mode reg high */
85 #define UDC_MODE_LO 0x52 /* mode reg low */
86 #define UDC_COUNT 0x32 /* words to xfer */
87
88 /* some udc commands */
89 #define UDC_RESET 0
90 #define UDC_CHN_START 0xa0 /* start chain */
91 #define UDC_INT_ENABLE 0x32 /* channel 1 int on */
92
93 /* udc mode words */
94 #define UDC_MODE_HIWORD 0x40
95 #define UDC_MODE_LSEND 0xc2
96 #define UDC_MODE_LRECV 0xd2
97
98 /* udc reg selections */
99 #define UDC_RSEL_SEND 0x282
100 #define UDC_RSEL_RECV 0x182
101
102 /* bits in csr reg */
103 #define CSR_DMA_ACTIVE 0x8000
104 #define CSR_DMA_CONFLICT 0x4000
105 #define CSR_DMA_BUSERR 0x2000
106
107 #define CSR_FIFO_EMPTY 0x400 /* fifo flushed? */
108 #define CSR_SDB_INT 0x200 /* sbc interrupt pending */
109 #define CSR_DMA_INT 0x100 /* dma interrupt pending */
110
111 #define CSR_LEFT 0xc0
112 #define CSR_LEFT_3 0xc0
113 #define CSR_LEFT_2 0x80
114 #define CSR_LEFT_1 0x40
115 #define CSR_PACK_ENABLE 0x20
116
117 #define CSR_DMA_ENABLE 0x10
118
119 #define CSR_SEND 0x8 /* 1 = send  0 = recv */
120 #define CSR_FIFO 0x2 /* reset fifo */
121 #define CSR_INTR 0x4 /* interrupt enable */
122 #define CSR_SCSI 0x1 
123
124 #define VME_DATA24 0x3d00
125
126 #endif /* SUN3_SCSI_H */
127