aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via/accel.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/via/accel.c')
-rw-r--r--drivers/video/via/accel.c53
1 files changed, 33 insertions, 20 deletions
diff --git a/drivers/video/via/accel.c b/drivers/video/via/accel.c
index e44893ea590d..3c969cdef0af 100644
--- a/drivers/video/via/accel.c
+++ b/drivers/video/via/accel.c
@@ -283,11 +283,12 @@ static int hw_bitblt_2(void __iomem *engine, u8 op, u32 width, u32 height,
283 writel(tmp, engine + 0x1C); 283 writel(tmp, engine + 0x1C);
284 } 284 }
285 285
286 if (op != VIA_BITBLT_COLOR) 286 if (op == VIA_BITBLT_FILL) {
287 writel(fg_color, engine + 0x58);
288 } else if (op == VIA_BITBLT_MONO) {
287 writel(fg_color, engine + 0x4C); 289 writel(fg_color, engine + 0x4C);
288
289 if (op == VIA_BITBLT_MONO)
290 writel(bg_color, engine + 0x50); 290 writel(bg_color, engine + 0x50);
291 }
291 292
292 if (op == VIA_BITBLT_FILL) 293 if (op == VIA_BITBLT_FILL)
293 ge_cmd |= fill_rop << 24 | 0x00002000 | 0x00000001; 294 ge_cmd |= fill_rop << 24 | 0x00002000 | 0x00000001;
@@ -314,13 +315,11 @@ static int hw_bitblt_2(void __iomem *engine, u8 op, u32 width, u32 height,
314 return 0; 315 return 0;
315} 316}
316 317
317int viafb_init_engine(struct fb_info *info) 318int viafb_setup_engine(struct fb_info *info)
318{ 319{
319 struct viafb_par *viapar = info->par; 320 struct viafb_par *viapar = info->par;
320 void __iomem *engine; 321 void __iomem *engine;
321 int highest_reg, i; 322 u32 chip_name = viapar->shared->chip_info.gfx_chip_name;
322 u32 vq_start_addr, vq_end_addr, vq_start_low, vq_end_low, vq_high,
323 vq_len, chip_name = viapar->shared->chip_info.gfx_chip_name;
324 323
325 engine = viapar->shared->vdev->engine_mmio; 324 engine = viapar->shared->vdev->engine_mmio;
326 if (!engine) { 325 if (!engine) {
@@ -329,18 +328,6 @@ int viafb_init_engine(struct fb_info *info)
329 return -ENOMEM; 328 return -ENOMEM;
330 } 329 }
331 330
332 /* Initialize registers to reset the 2D engine */
333 switch (viapar->shared->chip_info.twod_engine) {
334 case VIA_2D_ENG_M1:
335 highest_reg = 0x5c;
336 break;
337 default:
338 highest_reg = 0x40;
339 break;
340 }
341 for (i = 0; i <= highest_reg; i += 4)
342 writel(0x0, engine + i);
343
344 switch (chip_name) { 331 switch (chip_name) {
345 case UNICHROME_CLE266: 332 case UNICHROME_CLE266:
346 case UNICHROME_K400: 333 case UNICHROME_K400:
@@ -356,6 +343,7 @@ int viafb_init_engine(struct fb_info *info)
356 break; 343 break;
357 case UNICHROME_VX800: 344 case UNICHROME_VX800:
358 case UNICHROME_VX855: 345 case UNICHROME_VX855:
346 case UNICHROME_VX900:
359 viapar->shared->hw_bitblt = hw_bitblt_2; 347 viapar->shared->hw_bitblt = hw_bitblt_2;
360 break; 348 break;
361 default: 349 default:
@@ -386,12 +374,36 @@ int viafb_init_engine(struct fb_info *info)
386 viapar->shared->vdev->camera_fbmem_offset = viapar->fbmem_free; 374 viapar->shared->vdev->camera_fbmem_offset = viapar->fbmem_free;
387#endif 375#endif
388 376
377 viafb_reset_engine(viapar);
378 return 0;
379}
380
381void viafb_reset_engine(struct viafb_par *viapar)
382{
383 void __iomem *engine = viapar->shared->vdev->engine_mmio;
384 int highest_reg, i;
385 u32 vq_start_addr, vq_end_addr, vq_start_low, vq_end_low, vq_high,
386 vq_len, chip_name = viapar->shared->chip_info.gfx_chip_name;
387
388 /* Initialize registers to reset the 2D engine */
389 switch (viapar->shared->chip_info.twod_engine) {
390 case VIA_2D_ENG_M1:
391 highest_reg = 0x5c;
392 break;
393 default:
394 highest_reg = 0x40;
395 break;
396 }
397 for (i = 0; i <= highest_reg; i += 4)
398 writel(0x0, engine + i);
399
389 /* Init AGP and VQ regs */ 400 /* Init AGP and VQ regs */
390 switch (chip_name) { 401 switch (chip_name) {
391 case UNICHROME_K8M890: 402 case UNICHROME_K8M890:
392 case UNICHROME_P4M900: 403 case UNICHROME_P4M900:
393 case UNICHROME_VX800: 404 case UNICHROME_VX800:
394 case UNICHROME_VX855: 405 case UNICHROME_VX855:
406 case UNICHROME_VX900:
395 writel(0x00100000, engine + VIA_REG_CR_TRANSET); 407 writel(0x00100000, engine + VIA_REG_CR_TRANSET);
396 writel(0x680A0000, engine + VIA_REG_CR_TRANSPACE); 408 writel(0x680A0000, engine + VIA_REG_CR_TRANSPACE);
397 writel(0x02000000, engine + VIA_REG_CR_TRANSPACE); 409 writel(0x02000000, engine + VIA_REG_CR_TRANSPACE);
@@ -428,6 +440,7 @@ int viafb_init_engine(struct fb_info *info)
428 case UNICHROME_P4M900: 440 case UNICHROME_P4M900:
429 case UNICHROME_VX800: 441 case UNICHROME_VX800:
430 case UNICHROME_VX855: 442 case UNICHROME_VX855:
443 case UNICHROME_VX900:
431 vq_start_low |= 0x20000000; 444 vq_start_low |= 0x20000000;
432 vq_end_low |= 0x20000000; 445 vq_end_low |= 0x20000000;
433 vq_high |= 0x20000000; 446 vq_high |= 0x20000000;
@@ -473,7 +486,7 @@ int viafb_init_engine(struct fb_info *info)
473 writel(0x0, engine + VIA_REG_CURSOR_ORG); 486 writel(0x0, engine + VIA_REG_CURSOR_ORG);
474 writel(0x0, engine + VIA_REG_CURSOR_BG); 487 writel(0x0, engine + VIA_REG_CURSOR_BG);
475 writel(0x0, engine + VIA_REG_CURSOR_FG); 488 writel(0x0, engine + VIA_REG_CURSOR_FG);
476 return 0; 489 return;
477} 490}
478 491
479void viafb_show_hw_cursor(struct fb_info *info, int Status) 492void viafb_show_hw_cursor(struct fb_info *info, int Status)