aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-03-26 19:39:07 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-03-26 19:39:07 -0400
commit95d517cfce023eb24c5363ab82377146bd659816 (patch)
tree9440b75251a6d043ec396b9bdbd6864e4d7f8760
parentc91faa61697a60ee5cc653db9b6fd3c7049890a6 (diff)
viafb: gather common good, old VGA initialization in one place
This patch moves all unprotected VGA initialization in one table and provides some documentation for those values. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
-rw-r--r--drivers/video/via/hw.c49
-rw-r--r--drivers/video/via/viamode.c19
2 files changed, 37 insertions, 31 deletions
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 0098270ac425..5b9c096654be 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -308,6 +308,42 @@ static struct io_reg scaling_parameters[] = {
308 {VIACR, CR87, 0xFF, 0x1F}, /* LCD Scaling Parameter 14 */ 308 {VIACR, CR87, 0xFF, 0x1F}, /* LCD Scaling Parameter 14 */
309}; 309};
310 310
311static struct io_reg common_vga[] = {
312 {VIACR, CR07, 0x10, 0x10}, /* [0] vertical total (bit 8)
313 [1] vertical display end (bit 8)
314 [2] vertical retrace start (bit 8)
315 [3] start vertical blanking (bit 8)
316 [4] line compare (bit 8)
317 [5] vertical total (bit 9)
318 [6] vertical display end (bit 9)
319 [7] vertical retrace start (bit 9) */
320 {VIACR, CR08, 0xFF, 0x00}, /* [0-4] preset row scan
321 [5-6] byte panning */
322 {VIACR, CR09, 0xDF, 0x40}, /* [0-4] max scan line
323 [5] start vertical blanking (bit 9)
324 [6] line compare (bit 9)
325 [7] scan doubling */
326 {VIACR, CR0A, 0xFF, 0x1E}, /* [0-4] cursor start
327 [5] cursor disable */
328 {VIACR, CR0B, 0xFF, 0x00}, /* [0-4] cursor end
329 [5-6] cursor skew */
330 {VIACR, CR0E, 0xFF, 0x00}, /* [0-7] cursor location (high) */
331 {VIACR, CR0F, 0xFF, 0x00}, /* [0-7] cursor location (low) */
332 {VIACR, CR11, 0xF0, 0x80}, /* [0-3] vertical retrace end
333 [6] memory refresh bandwidth
334 [7] CRTC register protect enable */
335 {VIACR, CR14, 0xFF, 0x00}, /* [0-4] underline location
336 [5] divide memory address clock by 4
337 [6] double word addressing */
338 {VIACR, CR17, 0xFF, 0x63}, /* [0-1] mapping of display address 13-14
339 [2] divide scan line clock by 2
340 [3] divide memory address clock by 2
341 [5] address wrap
342 [6] byte mode select
343 [7] sync enable */
344 {VIACR, CR18, 0xFF, 0xFF}, /* [0-7] line compare */
345};
346
311static struct fifo_depth_select display_fifo_depth_reg = { 347static struct fifo_depth_select display_fifo_depth_reg = {
312 /* IGA1 FIFO Depth_Select */ 348 /* IGA1 FIFO Depth_Select */
313 {IGA1_FIFO_DEPTH_SELECT_REG_NUM, {{SR17, 0, 7} } }, 349 {IGA1_FIFO_DEPTH_SELECT_REG_NUM, {{SR17, 0, 7} } },
@@ -1167,22 +1203,10 @@ static void load_fix_bit_crtc_reg(void)
1167 /* always set to 1 */ 1203 /* always set to 1 */
1168 viafb_write_reg_mask(CR03, VIACR, 0x80, BIT7); 1204 viafb_write_reg_mask(CR03, VIACR, 0x80, BIT7);
1169 /* line compare should set all bits = 1 (extend modes) */ 1205 /* line compare should set all bits = 1 (extend modes) */
1170 viafb_write_reg(CR18, VIACR, 0xff);
1171 /* line compare should set all bits = 1 (extend modes) */
1172 viafb_write_reg_mask(CR07, VIACR, 0x10, BIT4);
1173 /* line compare should set all bits = 1 (extend modes) */
1174 viafb_write_reg_mask(CR35, VIACR, 0x10, BIT4); 1206 viafb_write_reg_mask(CR35, VIACR, 0x10, BIT4);
1175 /* line compare should set all bits = 1 (extend modes) */ 1207 /* line compare should set all bits = 1 (extend modes) */
1176 viafb_write_reg_mask(CR33, VIACR, 0x06, BIT0 + BIT1 + BIT2); 1208 viafb_write_reg_mask(CR33, VIACR, 0x06, BIT0 + BIT1 + BIT2);
1177 /*viafb_write_reg_mask(CR32, VIACR, 0x01, BIT0); */ 1209 /*viafb_write_reg_mask(CR32, VIACR, 0x01, BIT0); */
1178 /* extend mode always set to e3h */
1179 viafb_write_reg(CR17, VIACR, 0xe3);
1180 /* extend mode always set to 0h */
1181 viafb_write_reg(CR08, VIACR, 0x00);
1182 /* extend mode always set to 0h */
1183 viafb_write_reg(CR14, VIACR, 0x00);
1184 viafb_write_reg_mask(CR09, VIACR, 0x40, 0xDF);
1185 viafb_write_reg_mask(CR11, VIACR, 0x00, BIT4 + BIT5 + BIT6);
1186 1210
1187 viafb_lock_crt(); 1211 viafb_lock_crt();
1188 1212
@@ -2353,6 +2377,7 @@ int viafb_setmode(struct VideoModeTable *vmode_tbl, int video_bpp,
2353 outb(0x00, VIAAR); 2377 outb(0x00, VIAAR);
2354 2378
2355 /* Write Common Setting for Video Mode */ 2379 /* Write Common Setting for Video Mode */
2380 viafb_write_regx(common_vga, ARRAY_SIZE(common_vga));
2356 switch (viaparinfo->chip_info->gfx_chip_name) { 2381 switch (viaparinfo->chip_info->gfx_chip_name) {
2357 case UNICHROME_CLE266: 2382 case UNICHROME_CLE266:
2358 viafb_write_regx(CLE266_ModeXregs, NUM_TOTAL_CLE266_ModeXregs); 2383 viafb_write_regx(CLE266_ModeXregs, NUM_TOTAL_CLE266_ModeXregs);
diff --git a/drivers/video/via/viamode.c b/drivers/video/via/viamode.c
index 8c5bc41ff6a4..036ad3ab6b9d 100644
--- a/drivers/video/via/viamode.c
+++ b/drivers/video/via/viamode.c
@@ -30,10 +30,6 @@ struct io_reg CN400_ModeXregs[] = { {VIASR, SR10, 0xFF, 0x01},
30{VIASR, SR1A, 0xFB, 0x08}, 30{VIASR, SR1A, 0xFB, 0x08},
31{VIASR, SR1E, 0x0F, 0x01}, 31{VIASR, SR1E, 0x0F, 0x01},
32{VIASR, SR2A, 0xFF, 0x00}, 32{VIASR, SR2A, 0xFF, 0x00},
33{VIACR, CR0A, 0xFF, 0x1E}, /* Cursor Start */
34{VIACR, CR0B, 0xFF, 0x00}, /* Cursor End */
35{VIACR, CR0E, 0xFF, 0x00}, /* Cursor Location High */
36{VIACR, CR0F, 0xFF, 0x00}, /* Cursor Localtion Low */
37{VIACR, CR32, 0xFF, 0x00}, 33{VIACR, CR32, 0xFF, 0x00},
38{VIACR, CR33, 0xFF, 0x00}, 34{VIACR, CR33, 0xFF, 0x00},
39{VIACR, CR35, 0xFF, 0x00}, 35{VIACR, CR35, 0xFF, 0x00},
@@ -125,10 +121,6 @@ struct io_reg KM400_ModeXregs[] = {
125 {VIASR, SR2A, 0xFF, 0x00}, /* Power Management Control 5 */ 121 {VIASR, SR2A, 0xFF, 0x00}, /* Power Management Control 5 */
126 {VIASR, SR2D, 0xFF, 0xFF}, /* Power Management Control 1 */ 122 {VIASR, SR2D, 0xFF, 0xFF}, /* Power Management Control 1 */
127 {VIASR, SR2E, 0xFF, 0xFF}, /* Power Management Control 2 */ 123 {VIASR, SR2E, 0xFF, 0xFF}, /* Power Management Control 2 */
128 {VIACR, CR0A, 0xFF, 0x1E}, /* Cursor Start */
129 {VIACR, CR0B, 0xFF, 0x00}, /* Cursor End */
130 {VIACR, CR0E, 0xFF, 0x00}, /* Cursor Location High */
131 {VIACR, CR0F, 0xFF, 0x00}, /* Cursor Localtion Low */
132 {VIACR, CR33, 0xFF, 0x00}, 124 {VIACR, CR33, 0xFF, 0x00},
133 {VIACR, CR55, 0x80, 0x00}, 125 {VIACR, CR55, 0x80, 0x00},
134 {VIACR, CR5D, 0x80, 0x00}, 126 {VIACR, CR5D, 0x80, 0x00},
@@ -162,10 +154,6 @@ struct io_reg CX700_ModeXregs[] = { {VIASR, SR10, 0xFF, 0x01},
162{VIASR, SR1E, 0xFF, 0x01}, 154{VIASR, SR1E, 0xFF, 0x01},
163{VIASR, SR2A, 0xFF, 0x00}, 155{VIASR, SR2A, 0xFF, 0x00},
164{VIASR, SR2D, 0xFF, 0xFF}, /* VCK and LCK PLL power on. */ 156{VIASR, SR2D, 0xFF, 0xFF}, /* VCK and LCK PLL power on. */
165{VIACR, CR0A, 0xFF, 0x1E}, /* Cursor Start */
166{VIACR, CR0B, 0xFF, 0x00}, /* Cursor End */
167{VIACR, CR0E, 0xFF, 0x00}, /* Cursor Location High */
168{VIACR, CR0F, 0xFF, 0x00}, /* Cursor Localtion Low */
169{VIACR, CR32, 0xFF, 0x00}, 157{VIACR, CR32, 0xFF, 0x00},
170{VIACR, CR33, 0xFF, 0x00}, 158{VIACR, CR33, 0xFF, 0x00},
171{VIACR, CR35, 0xFF, 0x00}, 159{VIACR, CR35, 0xFF, 0x00},
@@ -205,13 +193,6 @@ struct io_reg VX855_ModeXregs[] = {
205{VIASR, SR58, 0xFF, 0x00}, 193{VIASR, SR58, 0xFF, 0x00},
206{VIASR, SR59, 0xFF, 0x00}, 194{VIASR, SR59, 0xFF, 0x00},
207{VIASR, SR2D, 0xFF, 0xFF}, /* VCK and LCK PLL power on. */ 195{VIASR, SR2D, 0xFF, 0xFF}, /* VCK and LCK PLL power on. */
208{VIACR, CR09, 0xFF, 0x00}, /* Initial CR09=0*/
209{VIACR, CR11, 0x8F, 0x00}, /* IGA1 initial Vertical end */
210{VIACR, CR17, 0x7F, 0x00}, /* IGA1 CRT Mode control init */
211{VIACR, CR0A, 0xFF, 0x1E}, /* Cursor Start */
212{VIACR, CR0B, 0xFF, 0x00}, /* Cursor End */
213{VIACR, CR0E, 0xFF, 0x00}, /* Cursor Location High */
214{VIACR, CR0F, 0xFF, 0x00}, /* Cursor Localtion Low */
215{VIACR, CR32, 0xFF, 0x00}, 196{VIACR, CR32, 0xFF, 0x00},
216{VIACR, CR33, 0x7F, 0x00}, 197{VIACR, CR33, 0x7F, 0x00},
217{VIACR, CR35, 0xFF, 0x00}, 198{VIACR, CR35, 0xFF, 0x00},