tdvfbreg.h revision 1.1 1 /* $NetBSD: tdvfbreg.h,v 1.1 2012/07/18 23:30:14 rkujawa Exp $ */
2
3 /*
4 * Copyright (c) 2012 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Radoslaw Kujawa.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 /* 3Dfx Voodoo 2 register definition (mostly from specification) */
32
33 #ifndef TDVFBREG_H
34 #define TDVFBREG_H
35
36 #define TDV_CVG_CLK 75000 /* 75MHz, max is around 90MHz */
37
38 /* CVG PCI config registers */
39 #define TDV_MM_BAR 0x10
40
41 #define TDV_INITENABLE_REG 0x40
42 #define TDV_INITENABLE_EN_INIT __BIT(0)
43 #define TDV_INITENABLE_EN_FIFO __BIT(1)
44 #define TDV_INITENABLE_REMAPDAC __BIT(2)
45 #define TDV_VCLK_ENABLE_REG 0xC0 /* undocumented? */
46 #define TDV_VCLK_DISABLE_REG 0xE0 /* undocumented? */
47
48 /* CVG address space */
49 #define TDV_OFF_MMREG 0x0 /* memory mapped registers */
50 #define TDV_OFF_FB 0x400000/* frame buffer */
51 #define TDV_FB_SIZE 0x3FFFFF/* 4MB */
52
53 /* CVG registers */
54 #define TDV_OFF_STATUS 0x0
55 #define TDV_STATUS_FBI_BUSY __BIT(7) /* FBI == CVG Bruce */
56 #define TDV_STATUS_TREX_BUSY __BIT(8) /* TREX == CVG Chuck */
57 #define TDV_STATUS_GFX_BUSY __BIT(9)
58
59 #define TDV_OFF_ALPHAMODE 0x10C
60
61 #define TDV_OFF_FBZMODE 0x0110
62 #define TDV_FBZMODE_CLIPPING __BIT(0)
63 #define TDV_FBZMODE_RGB_WR __BIT(9)
64 #define TDV_FBZMODE_ALPHA_WR __BIT(10)
65 #define TDV_FBZMODE_INVERT_Y __BIT(17)
66
67 #define TDV_OFF_LFBMODE 0x0114
68 #define TDV_LFBMODE_565 0 //__BIT(0)
69 #define TDV_LFBMODE_8888 5
70 #define TDV_LFBMODE_PIXPIPE __BIT(8)
71 #define TDV_LFBMODE_WSW_WR __BIT(11)
72 #define TDV_LFBMODE_BSW_WR __BIT(12)
73 #define TDV_LFBMODE_WSW_RD __BIT(15)
74 #define TDV_LFBMODE_BSW_RD __BIT(16)
75
76 #define TDV_OFF_CLIP_LR 0x0118
77 #define TDV_OFF_CLIP_TB 0x011C
78
79 #define TDV_OFF_NOPCMD 0x0120
80
81 #define TDV_OFF_FBIINIT0 0x0210
82 #define TDV_FBIINIT0_VGA_PASS __BIT(0)
83 #define TDV_FBIINIT0_FBI_RST __BIT(1)
84 #define TDV_FBIINIT0_FIFO_RST __BIT(2)
85
86 #define TDV_OFF_FBIINIT1 0x0214
87 #define TDV_FBIINIT1_PCIWAIT __BIT(1)
88 #define TDV_FBIINIT1_LFB_EN __BIT(3)
89 #define TDV_FBIINIT1_TILES_X 4 /* shift, bits 4-7 */
90 #define TDV_FBIINIT1_VIDEO_RST __BIT(8)
91 #define TDV_FBIINIT1_BLANKING __BIT(12)
92 #define TDV_FBIINIT1_DR_DATA __BIT(13)
93 #define TDV_FBIINIT1_DR_BLANKING __BIT(14)
94 #define TDV_FBIINIT1_DR_HVSYNC __BIT(15)
95 #define TDV_FBIINIT1_DR_DCLK __BIT(16)
96 #define TDV_FBIINIT1_IN_VCLK_2X 0 /* __BIT(17) */
97 #define TDV_FBIINIT1_VCLK_SRC 20 /* shift, bits 20-21 actually */
98 #define TDV_FBIINIT1_VCLK_2X 0x2
99 #define TDV_FBIINIT1_TILES_X_MSB 24
100 #define TDV_FBIINIT1_VIDMASK 0x8080010F
101
102 #define TDV_OFF_FBIINIT2 0x0218
103 #define TDV_OFF_DAC_READ TDV_OFF_FBIINIT2
104 #define TDV_FBIINIT2_FAST_RAS __BIT(5)
105 #define TDV_FBIINIT2_DRAM_OE __BIT(6)
106 #define TDV_FBIINIT2_SWB_ALG 0 //__BITS(9,10) /* 00 - based on DAC vsync */
107 #define TDV_FBIINIT2_FIFO_RDA __BIT(21)
108 #define TDV_FBIINIT2_DRAM_REFR __BIT(22)
109 #define TDV_FBIINIT2_DRAM_REFLD 23 /* shift, bits 23-31 */
110 #define TDV_FBIINIT2_DRAM_REF16 0x30 /* 16ms */
111
112 #define TDV_OFF_FBIINIT3 0x021C
113 #define TDV_FBIINIT3_TREX_DIS __BIT(6)
114
115 #define TDV_OFF_FBIINIT4 0x0200
116 #define TDV_FBIINIT4_PCIWAIT __BIT(0)
117 #define TDV_FBIINIT4_LFB_RDA __BIT(1)
118
119 #define TDV_OFF_BACKPORCH 0x0208
120 #define TDV_OFF_VDIMENSIONS 0x020C
121 #define TDV_OFF_HSYNC 0x0220
122 #define TDV_OFF_VSYNC 0x0224
123
124 #define TDV_OFF_DAC_DATA 0x022C
125 #define TDV_DAC_DATA_READ __BIT(11)
126
127 #define TDV_OFF_FBIINIT5 0x0244
128 #define TDV_FBIINIT5_VIDMASK 0xFA40FFFF
129 #define TDV_FBIINIT5_PHSYNC __BIT(23)
130 #define TDV_FBIINIT5_PVSYNC __BIT(24)
131
132 #define TDV_OFF_FBIINIT6 0x0248
133 #define TDV_FBIINIT6_TILES_X_LSB 30
134
135 /* DAC */
136 #define TDV_GENDAC_REFFREQ 14318
137 #define TDV_GENDAC_MAXVCO 250000 /* not sure about that */
138
139 #define TDV_GENDAC_MIN_N1 1
140 #define TDV_GENDAC_MAX_N1 31
141 #define TDV_GENDAC_MIN_N2 0
142 #define TDV_GENDAC_MAX_N2 3
143 #define TDV_GENDAC_MIN_M 1
144 #define TDV_GENDAC_MAX_M 127
145
146 #define TDV_GENDAC_ADDRMASK 0x07
147
148 #define TDV_GENDAC_WR 0x0
149 #define TDV_GENDAC_LUT 0x01
150 #define TDV_GENDAC_PIXMASK 0x02
151 #define TDV_GENDAC_RD 0x03
152
153 #define TDV_GENDAC_PLLWR 0x04
154 #define TDV_GENDAC_PLLDATA 0x05
155 #define TDV_GENDAC_CMD 0x06
156 #define TDV_GENDAC_CMD_16BITS 0x50
157 #define TDV_GENDAC_CMD_24BITS 0x60
158 #define TDV_GENDAC_CMD_PWDOWN __BIT(0)
159 #define TDV_GENDAC_PLLRD 0x07
160
161 #define TDV_GENDAC_PLL_A 0xA
162 #define TDV_GENDAC_PLL_0 0x0
163
164 #define TDV_GENDAC_PLL_CTRL 0x0
165 #define TDV_GENDAC_PLL_VIDCLK __BIT(5)
166 #define TDV_GENDAC_PLL_VIDCLK0 0
167 #define TDV_GENDAC_PLL_CVGCLKA 0
168
169 #define TDV_GENDAC_CVGPLLMASK 0xEF
170 #define TDV_GENDAC_VIDPLLMASK 0xD8
171
172 #define TDV_GENDAC_DFLT_F1_M 0x55
173 #define TDV_GENDAC_DFLT_F1_N 0x49
174 #define TDV_GENDAC_DFLT_F7_M 0x71
175 #define TDV_GENDAC_DFLT_F7_N 0x29
176 #define TDV_GENDAC_DFLT_FB_M 0x79
177 #define TDV_GENDAC_DFLT_FB_N 0x2E
178
179 #endif /* TDVFBREG_H */
180