Import 2.3.18pre1
[davej-history.git] / include / asm-mips / newport.h
blob503deb1e3ea641fe92ea63590223708955acd872
1 /* $Id: newport.h,v 1.1 1998/08/19 21:58:12 ralf Exp $
3 * newport.h: Defines and register layout for NEWPORT graphics
4 * hardware.
6 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
7 */
9 #ifndef _SGI_NEWPORT_H
10 #define _SGI_NEWPORT_H
13 typedef volatile unsigned long npireg_t;
15 union npfloat {
16 volatile float f;
17 npireg_t i;
20 typedef union npfloat npfreg_t;
22 union np_dcb {
23 npireg_t all;
24 struct { volatile unsigned short s0, s1; } hwords;
25 struct { volatile unsigned char b0, b1, b2, b3; } bytes;
28 struct newport_rexregs {
29 npireg_t drawmode1; /* GL extra mode bits */
31 #define DM1_PLANES 0x00000007
32 #define DM1_NOPLANES 0x00000000
33 #define DM1_RGBPLANES 0x00000001
34 #define DM1_RGBAPLANES 0x00000002
35 #define DM1_OLAYPLANES 0x00000004
36 #define DM1_PUPPLANES 0x00000005
37 #define DM1_CIDPLANES 0x00000006
39 #define NPORT_DMODE1_DDMASK 0x00000018
40 #define NPORT_DMODE1_DD4 0x00000000
41 #define NPORT_DMODE1_DD8 0x00000008
42 #define NPORT_DMODE1_DD12 0x00000010
43 #define NPORT_DMODE1_DD24 0x00000018
44 #define NPORT_DMODE1_DSRC 0x00000020
45 #define NPORT_DMODE1_YFLIP 0x00000040
46 #define NPORT_DMODE1_RWPCKD 0x00000080
47 #define NPORT_DMODE1_HDMASK 0x00000300
48 #define NPORT_DMODE1_HD4 0x00000000
49 #define NPORT_DMODE1_HD8 0x00000100
50 #define NPORT_DMODE1_HD12 0x00000200
51 #define NPORT_DMODE1_HD32 0x00000300
52 #define NPORT_DMODE1_RWDBL 0x00000400
53 #define NPORT_DMODE1_ESWAP 0x00000800 /* Endian swap */
54 #define NPORT_DMODE1_CCMASK 0x00007000
55 #define NPORT_DMODE1_CCLT 0x00001000
56 #define NPORT_DMODE1_CCEQ 0x00002000
57 #define NPORT_DMODE1_CCGT 0x00004000
58 #define NPORT_DMODE1_RGBMD 0x00008000
59 #define NPORT_DMODE1_DENAB 0x00010000 /* Dither enable */
60 #define NPORT_DMODE1_FCLR 0x00020000 /* Fast clear */
61 #define NPORT_DMODE1_BENAB 0x00040000 /* Blend enable */
62 #define NPORT_DMODE1_SFMASK 0x00380000
63 #define NPORT_DMODE1_SF0 0x00000000
64 #define NPORT_DMODE1_SF1 0x00080000
65 #define NPORT_DMODE1_SFDC 0x00100000
66 #define NPORT_DMODE1_SFMDC 0x00180000
67 #define NPORT_DMODE1_SFSA 0x00200000
68 #define NPORT_DMODE1_SFMSA 0x00280000
69 #define NPORT_DMODE1_DFMASK 0x01c00000
70 #define NPORT_DMODE1_DF0 0x00000000
71 #define NPORT_DMODE1_DF1 0x00400000
72 #define NPORT_DMODE1_DFSC 0x00800000
73 #define NPORT_DMODE1_DFMSC 0x00c00000
74 #define NPORT_DMODE1_DFSA 0x01000000
75 #define NPORT_DMODE1_DFMSA 0x01400000
76 #define NPORT_DMODE1_BBENAB 0x02000000 /* Back blend enable */
77 #define NPORT_DMODE1_PFENAB 0x04000000 /* Pre-fetch enable */
78 #define NPORT_DMODE1_ABLEND 0x08000000 /* Alpha blend */
79 #define NPORT_DMODE1_LOMASK 0xf0000000
80 #define NPORT_DMODE1_LOZERO 0x00000000
81 #define NPORT_DMODE1_LOAND 0x10000000
82 #define NPORT_DMODE1_LOANDR 0x20000000
83 #define NPORT_DMODE1_LOSRC 0x30000000
84 #define NPORT_DMODE1_LOANDI 0x40000000
85 #define NPORT_DMODE1_LODST 0x50000000
86 #define NPORT_DMODE1_LOXOR 0x60000000
87 #define NPORT_DMODE1_LOOR 0x70000000
88 #define NPORT_DMODE1_LONOR 0x80000000
89 #define NPORT_DMODE1_LOXNOR 0x90000000
90 #define NPORT_DMODE1_LONDST 0xa0000000
91 #define NPORT_DMODE1_LOORR 0xb0000000
92 #define NPORT_DMODE1_LONSRC 0xc0000000
93 #define NPORT_DMODE1_LOORI 0xd0000000
94 #define NPORT_DMODE1_LONAND 0xe0000000
95 #define NPORT_DMODE1_LOONE 0xf0000000
97 npireg_t drawmode0; /* REX command register */
99 /* These bits define the graphics opcode being performed. */
100 #define NPORT_DMODE0_OPMASK 0x00000003 /* Opcode mask */
101 #define NPORT_DMODE0_NOP 0x00000000 /* No operation */
102 #define NPORT_DMODE0_RD 0x00000001 /* Read operation */
103 #define NPORT_DMODE0_DRAW 0x00000002 /* Draw operation */
104 #define NPORT_DMODE0_S2S 0x00000003 /* Screen to screen operation */
106 /* The following decide what addressing mode(s) are to be used */
107 #define NPORT_DMODE0_AMMASK 0x0000001c /* Address mode mask */
108 #define NPORT_DMODE0_SPAN 0x00000000 /* Spanning address mode */
109 #define NPORT_DMODE0_BLOCK 0x00000004 /* Block address mode */
110 #define NPORT_DMODE0_ILINE 0x00000008 /* Iline address mode */
111 #define NPORT_DMODE0_FLINE 0x0000000c /* Fline address mode */
112 #define NPORT_DMODE0_ALINE 0x00000010 /* Aline address mode */
113 #define NPORT_DMODE0_TLINE 0x00000014 /* Tline address mode */
114 #define NPORT_DMODE0_BLINE 0x00000018 /* Bline address mode */
116 /* And now some misc. operation control bits. */
117 #define NPORT_DMODE0_DOSETUP 0x00000020
118 #define NPORT_DMODE0_CHOST 0x00000040
119 #define NPORT_DMODE0_AHOST 0x00000080
120 #define NPORT_DMODE0_STOPX 0x00000100
121 #define NPORT_DMODE0_STOPY 0x00000200
122 #define NPORT_DMODE0_SK1ST 0x00000400
123 #define NPORT_DMODE0_SKLST 0x00000800
124 #define NPORT_DMODE0_ZPENAB 0x00001000
125 #define NPORT_DMODE0_LISPENAB 0x00002000
126 #define NPORT_DMODE0_LISLST 0x00004000
127 #define NPORT_DMODE0_L32 0x00008000
128 #define NPORT_DMODE0_ZOPQ 0x00010000
129 #define NPORT_DMODE0_LISOPQ 0x00020000
130 #define NPORT_DMODE0_SHADE 0x00040000
131 #define NPORT_DMODE0_LRONLY 0x00080000
132 #define NPORT_DMODE0_XYOFF 0x00100000
133 #define NPORT_DMODE0_CLAMP 0x00200000
134 #define NPORT_DMODE0_ENDPF 0x00400000
135 #define NPORT_DMODE0_YSTR 0x00800000
137 npireg_t lsmode; /* Mode for line stipple ops */
138 npireg_t lspattern; /* Pattern for line stipple ops */
139 npireg_t lspatsave; /* Backup save pattern */
140 npireg_t zpattern; /* Pixel zpattern */
141 npireg_t colorback; /* Background color */
142 npireg_t colorvram; /* Clear color for fast vram */
143 npireg_t alpharef; /* Reference value for afunctions */
144 unsigned long pad0;
145 npireg_t smask0x; /* Window GL relative screen mask 0 */
146 npireg_t smask0y; /* Window GL relative screen mask 0 */
147 npireg_t _setup;
148 npireg_t _stepz;
149 npireg_t _lsrestore;
150 npireg_t _lssave;
152 unsigned long _pad1[0x30];
154 /* Iterators, full state for context switch */
155 npfreg_t _xstart; /* X-start point (current) */
156 npfreg_t _ystart; /* Y-start point (current) */
157 npfreg_t _xend; /* x-end point */
158 npfreg_t _yend; /* y-end point */
159 npireg_t xsave; /* copy of xstart integer value for BLOCk addressing MODE */
160 npireg_t xymove; /* x.y offset from xstart, ystart for relative operations */
161 npfreg_t bresd;
162 npfreg_t bress1;;
163 npireg_t bresoctinc1;
164 volatile int bresrndinc2;
165 npireg_t brese1;
166 npireg_t bress2;
167 npireg_t aweight0;
168 npireg_t aweight1;
169 npfreg_t xstartf;
170 npfreg_t ystartf;
171 npfreg_t xendf;
172 npfreg_t yendf;
173 npireg_t xstarti;
174 npfreg_t xendf1;
175 npireg_t xystarti;
176 npireg_t xyendi;
177 npireg_t xstartendi;
179 unsigned long _unused2[0x29];
181 npfreg_t colorred;
182 npfreg_t coloralpha;
183 npfreg_t colorgrn;
184 npfreg_t colorblue;
185 npfreg_t slopered;
186 npfreg_t slopealpha;
187 npfreg_t slopegrn;
188 npfreg_t slopeblue;
189 npireg_t wrmask;
190 npireg_t colori;
191 npfreg_t colorx;
192 npfreg_t slopered1;
193 npireg_t hostrw0;
194 npireg_t hostrw1;
195 npireg_t dcbmode;
196 #define NPORT_DMODE_WMASK 0x00000003
197 #define NPORT_DMODE_W4 0x00000000
198 #define NPORT_DMODE_W1 0x00000001
199 #define NPORT_DMODE_W2 0x00000002
200 #define NPORT_DMODE_W3 0x00000003
201 #define NPORT_DMODE_EDPACK 0x00000004
202 #define NPORT_DMODE_ECINC 0x00000008
203 #define NPORT_DMODE_CMASK 0x00000070
204 #define NPORT_DMODE_AMASK 0x00000780
205 #define NPORT_DMODE_AVC2 0x00000000
206 #define NPORT_DMODE_ACMALL 0x00000080
207 #define NPORT_DMODE_ACM0 0x00000100
208 #define NPORT_DMODE_ACM1 0x00000180
209 #define NPORT_DMODE_AXMALL 0x00000200
210 #define NPORT_DMODE_AXM0 0x00000280
211 #define NPORT_DMODE_AXM1 0x00000300
212 #define NPORT_DMODE_ABT 0x00000380
213 #define NPORT_DMODE_AVCC1 0x00000400
214 #define NPORT_DMODE_AVAB1 0x00000480
215 #define NPORT_DMODE_ALG3V0 0x00000500
216 #define NPORT_DMODE_A1562 0x00000580
217 #define NPORT_DMODE_ESACK 0x00000800
218 #define NPORT_DMODE_EASACK 0x00001000
219 #define NPORT_DMODE_CWMASK 0x0003e000
220 #define NPORT_DMODE_CHMASK 0x007c0000
221 #define NPORT_DMODE_CSMASK 0x0f800000
222 #define NPORT_DMODE_SENDIAN 0x10000000
224 unsigned long _unused3;
226 union np_dcb dcbdata0;
227 npireg_t dcbdata1;
230 struct newport_cregs {
231 npireg_t smask1x;
232 npireg_t smask1y;
233 npireg_t smask2x;
234 npireg_t smask2y;
235 npireg_t smask3x;
236 npireg_t smask3y;
237 npireg_t smask4x;
238 npireg_t smask4y;
239 npireg_t topscan;
240 npireg_t xywin;
241 npireg_t clipmode;
242 #define NPORT_CMODE_SM0 0x00000001
243 #define NPORT_CMODE_SM1 0x00000002
244 #define NPORT_CMODE_SM2 0x00000004
245 #define NPORT_CMODE_SM3 0x00000008
246 #define NPORT_CMODE_SM4 0x00000010
247 #define NPORT_CMODE_CMSK 0x00001e00
249 unsigned long _unused0;
250 unsigned long config;
251 #define NPORT_CFG_G32MD 0x00000001
252 #define NPORT_CFG_BWIDTH 0x00000002
253 #define NPORT_CFG_ERCVR 0x00000004
254 #define NPORT_CFG_BDMSK 0x00000078
255 #define NPORT_CFG_GDMSK 0x00000f80
256 #define NPORT_CFG_GD0 0x00000080
257 #define NPORT_CFG_GD1 0x00000100
258 #define NPORT_CFG_GD2 0x00000200
259 #define NPORT_CFG_GD3 0x00000400
260 #define NPORT_CFG_GD4 0x00000800
261 #define NPORT_CFG_GFAINT 0x00001000
262 #define NPORT_CFG_TOMSK 0x0000e000
263 #define NPORT_CFG_VRMSK 0x00070000
264 #define NPORT_CFG_FBTYP 0x00080000
266 npireg_t _unused1;
267 npireg_t stat;
268 #define NPORT_STAT_VERS 0x00000007
269 #define NPORT_STAT_GBUSY 0x00000008
270 #define NPORT_STAT_BBUSY 0x00000010
271 #define NPORT_STAT_VRINT 0x00000020
272 #define NPORT_STAT_VIDINT 0x00000040
273 #define NPORT_STAT_GLMSK 0x00001f80
274 #define NPORT_STAT_BLMSK 0x0007e000
275 #define NPORT_STAT_BFIRQ 0x00080000
276 #define NPORT_STAT_GFIRQ 0x00100000
278 npireg_t ustat;
279 npireg_t dreset;
282 struct newport_regs {
283 struct newport_rexregs set;
284 unsigned long _unused0[0x16e];
285 struct newport_rexregs go;
286 unsigned long _unused1[0x22e];
287 struct newport_cregs cset;
288 unsigned long _unused2[0x1ef];
289 struct newport_cregs cgo;
291 extern struct newport_regs *npregs;
294 typedef struct {
295 unsigned int drawmode1;
296 unsigned int drawmode0;
297 unsigned int lsmode;
298 unsigned int lspattern;
299 unsigned int lspatsave;
300 unsigned int zpattern;
301 unsigned int colorback;
302 unsigned int colorvram;
303 unsigned int alpharef;
304 unsigned int smask0x;
305 unsigned int smask0y;
306 unsigned int _xstart;
307 unsigned int _ystart;
308 unsigned int _xend;
309 unsigned int _yend;
310 unsigned int xsave;
311 unsigned int xymove;
312 unsigned int bresd;
313 unsigned int bress1;
314 unsigned int bresoctinc1;
315 unsigned int bresrndinc2;
316 unsigned int brese1;
317 unsigned int bress2;
319 unsigned int aweight0;
320 unsigned int aweight1;
321 unsigned int colorred;
322 unsigned int coloralpha;
323 unsigned int colorgrn;
324 unsigned int colorblue;
325 unsigned int slopered;
326 unsigned int slopealpha;
327 unsigned int slopegrn;
328 unsigned int slopeblue;
329 unsigned int wrmask;
330 unsigned int hostrw0;
331 unsigned int hostrw1;
333 /* configregs */
335 unsigned int smask1x;
336 unsigned int smask1y;
337 unsigned int smask2x;
338 unsigned int smask2y;
339 unsigned int smask3x;
340 unsigned int smask3y;
341 unsigned int smask4x;
342 unsigned int smask4y;
343 unsigned int topscan;
344 unsigned int xywin;
345 unsigned int clipmode;
346 unsigned int config;
348 /* dcb registers */
349 unsigned int dcbmode;
350 unsigned int dcbdata0;
351 unsigned int dcbdata1;
352 } newport_ctx;
354 /* Reading/writing VC2 registers. */
355 #define VC2_REGADDR_INDEX 0x00000000
356 #define VC2_REGADDR_IREG 0x00000010
357 #define VC2_REGADDR_RAM 0x00000030
358 #define VC2_PROTOCOL (NPORT_DMODE_EASACK | 0x00800000 | 0x00040000)
360 #define VC2_VLINET_ADDR 0x000
361 #define VC2_VFRAMET_ADDR 0x400
362 #define VC2_CGLYPH_ADDR 0x500
364 /* Now the Indexed registers of the VC2. */
365 #define VC2_IREG_VENTRY 0x00
366 #define VC2_IREG_CENTRY 0x01
367 #define VC2_IREG_CURSX 0x02
368 #define VC2_IREG_CURSY 0x03
369 #define VC2_IREG_CCURSX 0x04
370 #define VC2_IREG_DENTRY 0x05
371 #define VC2_IREG_SLEN 0x06
372 #define VC2_IREG_RADDR 0x07
373 #define VC2_IREG_VFPTR 0x08
374 #define VC2_IREG_VLSPTR 0x09
375 #define VC2_IREG_VLIR 0x0a
376 #define VC2_IREG_VLCTR 0x0b
377 #define VC2_IREG_CTPTR 0x0c
378 #define VC2_IREG_WCURSY 0x0d
379 #define VC2_IREG_DFPTR 0x0e
380 #define VC2_IREG_DLTPTR 0x0f
381 #define VC2_IREG_CONTROL 0x10
382 #define VC2_IREG_CONFIG 0x20
384 extern inline void newport_vc2_set(struct newport_regs *regs, unsigned char vc2ireg,
385 unsigned short val)
387 regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W3 |
388 NPORT_DMODE_ECINC | VC2_PROTOCOL);
389 regs->set.dcbdata0.all = (vc2ireg << 24) | (val << 8);
392 extern inline unsigned short newport_vc2_get(struct newport_regs *regs,
393 unsigned char vc2ireg)
395 regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W1 |
396 NPORT_DMODE_ECINC | VC2_PROTOCOL);
397 regs->set.dcbdata0.bytes.b3 = vc2ireg;
398 regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_IREG | NPORT_DMODE_W2 |
399 NPORT_DMODE_ECINC | VC2_PROTOCOL);
400 return regs->set.dcbdata0.hwords.s1;
403 /* VC2 Control register bits */
404 #define VC2_CTRL_EVIRQ 0x0001
405 #define VC2_CTRL_EDISP 0x0002
406 #define VC2_CTRL_EVIDEO 0x0004
407 #define VC2_CTRL_EDIDS 0x0008
408 #define VC2_CTRL_ECURS 0x0010
409 #define VC2_CTRL_EGSYNC 0x0020
410 #define VC2_CTRL_EILACE 0x0040
411 #define VC2_CTRL_ECDISP 0x0080
412 #define VC2_CTRL_ECCURS 0x0100
413 #define VC2_CTRL_ECG64 0x0200
414 #define VC2_CTRL_GLSEL 0x0400
416 /* Controlling the color map on NEWPORT. */
417 #define NCMAP_REGADDR_AREG 0x00000000
418 #define NCMAP_REGADDR_ALO 0x00000000
419 #define NCMAP_REGADDR_AHI 0x00000010
420 #define NCMAP_REGADDR_PBUF 0x00000020
421 #define NCMAP_REGADDR_CREG 0x00000030
422 #define NCMAP_REGADDR_SREG 0x00000040
423 #define NCMAP_REGADDR_RREG 0x00000060
424 #define NCMAP_PROTOCOL (0x00008000 | 0x00040000 | 0x00800000)
426 static inline void newport_cmap_setaddr(struct newport_regs *regs,
427 unsigned short addr)
429 regs->set.dcbmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL |
430 NPORT_DMODE_SENDIAN | NPORT_DMODE_ECINC |
431 NCMAP_REGADDR_AREG | NPORT_DMODE_W2);
432 regs->set.dcbdata0.hwords.s1 = addr;
433 regs->set.dcbmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL |
434 NCMAP_REGADDR_PBUF | NPORT_DMODE_W3);
437 static inline void newport_cmap_setrgb(struct newport_regs *regs,
438 unsigned char red,
439 unsigned char green,
440 unsigned char blue)
442 regs->set.dcbdata0.all =
443 (red << 24) |
444 (green << 16) |
445 (blue << 8);
448 /* Miscellaneous NEWPORT routines. */
449 #define BUSY_TIMEOUT 100000
450 static inline int newport_wait(void)
452 int i = 0;
454 while(i < BUSY_TIMEOUT)
455 if(!(npregs->cset.stat & NPORT_STAT_GBUSY))
456 break;
457 if(i == BUSY_TIMEOUT)
458 return 1;
459 return 0;
462 static inline int newport_bfwait(void)
464 int i = 0;
466 while(i < BUSY_TIMEOUT)
467 if(!(npregs->cset.stat & NPORT_STAT_BBUSY))
468 break;
469 if(i == BUSY_TIMEOUT)
470 return 1;
471 return 0;
474 /* newport.c and cons_newport.c routines */
475 extern struct graphics_ops *newport_probe (int, const char **);
477 void newport_save (void *);
478 void newport_restore (void *);
479 void newport_reset (void);
480 int newport_ioctl (int card, int cmd, unsigned long arg);
483 * DCBMODE register defines:
486 /* Widht of the data being transfered for each DCBDATA[01] word */
487 #define DCB_DATAWIDTH_4 0x0
488 #define DCB_DATAWIDTH_1 0x1
489 #define DCB_DATAWIDTH_2 0x2
490 #define DCB_DATAWIDTH_3 0x3
492 /* If set, all of DCBDATA will be moved, otherwise only DATAWIDTH bytes */
493 #define DCB_ENDATAPACK (1 << 2)
495 /* Enables DCBCRS auto increment after each DCB transfer */
496 #define DCB_ENCRSINC (1 << 3)
498 /* shift for accessing the control register select address (DBCCRS, 3 bits) */
499 #define DCB_CRS_SHIFT 4
501 /* DCBADDR (4 bits): display bus slave address */
502 #define DCB_ADDR_SHIFT 7
503 #define DCB_VC2 (0 << DCB_ADDR_SHIFT)
504 #define DCB_CMAP_ALL (1 << DCB_ADDR_SHIFT)
505 #define DCB_CMAP0 (2 << DCB_ADDR_SHIFT)
506 #define DCB_CMAP1 (3 << DCB_ADDR_SHIFT)
507 #define DCB_XMAP_ALL (4 << DCB_ADDR_SHIFT)
508 #define DCB_XMAP0 (5 << DCB_ADDR_SHIFT)
509 #define DCB_XMAP1 (6 << DCB_ADDR_SHIFT)
510 #define DCB_BT445 (7 << DCB_ADDR_SHIFT)
511 #define DCB_VCC1 (8 << DCB_ADDR_SHIFT)
512 #define DCB_VAB1 (9 << DCB_ADDR_SHIFT)
513 #define DCB_LG3_BDVERS0 (10 << DCB_ADDR_SHIFT)
514 #define DCB_LG3_ICS1562 (11 << DCB_ADDR_SHIFT)
515 #define DCB_RESERVED (15 << DCB_ADDR_SHIFT)
517 /* DCB protocol ack types */
518 #define DCB_ENSYNCACK (1 << 11)
519 #define DCB_ENASYNCACK (1 << 12)
521 #define DCB_CSWIDTH_SHIFT 13
522 #define DCB_CSHOLD_SHIFT 18
523 #define DCB_CSSETUP_SHIFT 23
525 /* XMAP9 specific defines */
526 /* XMAP9 -- registers as seen on the DCBMODE register*/
527 # define XM9_CRS_CONFIG (0 << DCB_CRS_SHIFT)
528 # define XM9_PUPMODE (1 << 0)
529 # define XM9_ODD_PIXEL (1 << 1)
530 # define XM9_8_BITPLANES (1 << 2)
531 # define XM9_SLOW_DCB (1 << 3)
532 # define XM9_VIDEO_RGBMAP_MASK (3 << 4)
533 # define XM9_EXPRESS_VIDEO (1 << 6)
534 # define XM9_VIDEO_OPTION (1 << 7)
535 # define XM9_CRS_REVISION (1 << DCB_CRS_SHIFT)
536 # define XM9_CRS_FIFO_AVAIL (2 << DCB_CRS_SHIFT)
537 # define XM9_FIFO_0_AVAIL 0
538 # define XM9_FIFO_1_AVAIL 1
539 # define XM9_FIFO_2_AVAIL 3
540 # define XM9_FIFO_3_AVAIL 2
541 # define XM9_FIFO_FULL XM9_FIFO_0_AVAIL
542 # define XM9_FIFO_EMPTY XM9_FIFO_3_AVAIL
543 # define XM9_CRS_CURS_CMAP_MSB (3 << DCB_CRS_SHIFT)
544 # define XM9_CRS_PUP_CMAP_MSB (4 << DCB_CRS_SHIFT)
545 # define XM9_CRS_MODE_REG_DATA (5 << DCB_CRS_SHIFT)
546 # define XM9_CRS_MODE_REG_INDEX (7 << DCB_CRS_SHIFT)
549 #define DCB_CYCLES(setup,hold,width) \
550 ((hold << DCB_CSHOLD_SHIFT) | \
551 (setup << DCB_CSSETUP_SHIFT)| \
552 (width << DCB_CSWIDTH_SHIFT))
554 #define W_DCB_XMAP9_PROTOCOL DCB_CYCLES (2, 1, 0)
555 #define WSLOW_DCB_XMAP9_PROTOCOL DCB_CYCLES (5, 5, 0)
556 #define WAYSLOW_DCB_XMAP9_PROTOCOL DCB_CYCLES (12, 12, 0)
557 #define R_DCB_XMAP9_PROTOCOL DCB_CYCLES (2, 1, 3)
559 static inline void
560 xmap9FIFOWait (struct newport_regs *rex)
562 rex->set.dcbmode = DCB_XMAP0 | XM9_CRS_FIFO_AVAIL |
563 DCB_DATAWIDTH_1 | R_DCB_XMAP9_PROTOCOL;
564 newport_bfwait ();
566 while ((rex->set.dcbdata0.bytes.b3 & 3) != XM9_FIFO_EMPTY)
570 static inline void
571 xmap9SetModeReg (struct newport_regs *rex, unsigned int modereg, unsigned int data24, int cfreq)
573 if (cfreq > 119)
574 rex->set.dcbmode = DCB_XMAP_ALL | XM9_CRS_MODE_REG_DATA |
575 DCB_DATAWIDTH_4 | W_DCB_XMAP9_PROTOCOL;
576 else if (cfreq > 59)
577 rex->set.dcbmode = DCB_XMAP_ALL | XM9_CRS_MODE_REG_DATA |
578 DCB_DATAWIDTH_4 | WSLOW_DCB_XMAP9_PROTOCOL;
579 else
580 rex->set.dcbmode = DCB_XMAP_ALL | XM9_CRS_MODE_REG_DATA |
581 DCB_DATAWIDTH_4 | WAYSLOW_DCB_XMAP9_PROTOCOL;
582 rex->set.dcbdata0.all = ((modereg) << 24) | (data24 & 0xffffff);
585 #define BT445_PROTOCOL DCB_CYCLES(1,1,3)
587 #define BT445_CSR_ADDR_REG (0 << DCB_CRS_SHIFT)
588 #define BT445_CSR_REVISION (2 << DCB_CRS_SHIFT)
590 #define BT445_REVISION_REG 0x01
592 #endif /* !(_SGI_NEWPORT_H) */