diff options
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/tdfxfb.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/drivers/video/tdfxfb.c b/drivers/video/tdfxfb.c index c8b0be2d8715..7044226c5d4c 100644 --- a/drivers/video/tdfxfb.c +++ b/drivers/video/tdfxfb.c | |||
@@ -430,36 +430,35 @@ static void do_write_regs(struct fb_info *info, struct banshee_reg* reg) | |||
430 | 430 | ||
431 | static unsigned long do_lfb_size(struct tdfx_par *par, unsigned short dev_id) | 431 | static unsigned long do_lfb_size(struct tdfx_par *par, unsigned short dev_id) |
432 | { | 432 | { |
433 | u32 draminit0 = 0; | 433 | u32 draminit0; |
434 | u32 draminit1 = 0; | 434 | u32 draminit1; |
435 | u32 miscinit1 = 0; | 435 | u32 miscinit1; |
436 | u32 lfbsize = 0; | 436 | |
437 | int sgram_p = 0; | 437 | int num_chips; |
438 | int chip_size; /* in MB */ | ||
439 | u32 lfbsize; | ||
440 | int has_sgram; | ||
438 | 441 | ||
439 | draminit0 = tdfx_inl(par, DRAMINIT0); | 442 | draminit0 = tdfx_inl(par, DRAMINIT0); |
440 | draminit1 = tdfx_inl(par, DRAMINIT1); | 443 | draminit1 = tdfx_inl(par, DRAMINIT1); |
444 | |||
445 | num_chips = (draminit0 & DRAMINIT0_SGRAM_NUM) ? 8 : 4; | ||
441 | 446 | ||
442 | if ((dev_id == PCI_DEVICE_ID_3DFX_BANSHEE) || | 447 | if (dev_id < PCI_DEVICE_ID_3DFX_VOODOO5) { |
443 | (dev_id == PCI_DEVICE_ID_3DFX_VOODOO3)) { | 448 | /* Banshee/Voodoo3 */ |
444 | sgram_p = (draminit1 & DRAMINIT1_MEM_SDRAM) ? 0 : 1; | 449 | has_sgram = draminit1 & DRAMINIT1_MEM_SDRAM; |
445 | 450 | chip_size = has_sgram ? ((draminit0 & DRAMINIT0_SGRAM_TYPE) ? 2 : 1) | |
446 | lfbsize = sgram_p ? | 451 | : 2; |
447 | (((draminit0 & DRAMINIT0_SGRAM_NUM) ? 2 : 1) * | ||
448 | ((draminit0 & DRAMINIT0_SGRAM_TYPE) ? 8 : 4) * 1024 * 1024) : | ||
449 | 16 * 1024 * 1024; | ||
450 | } else { | 452 | } else { |
451 | /* Voodoo4/5 */ | 453 | /* Voodoo4/5 */ |
452 | u32 chips, psize, banks; | 454 | has_sgram = 0; |
453 | 455 | chip_size = 1 << ((draminit0 & DRAMINIT0_SGRAM_TYPE_MASK) >> DRAMINIT0_SGRAM_TYPE_SHIFT); | |
454 | chips = ((draminit0 & (1 << 26)) == 0) ? 4 : 8; | 456 | } |
455 | psize = 1 << ((draminit0 & 0x38000000) >> 28); | 457 | lfbsize = num_chips * chip_size * 1024 * 1024; |
456 | banks = ((draminit0 & (1 << 30)) == 0) ? 2 : 4; | 458 | |
457 | lfbsize = chips * psize * banks; | 459 | /* disable block writes for SDRAM */ |
458 | lfbsize <<= 20; | ||
459 | } | ||
460 | /* disable block writes for SDRAM (why?) */ | ||
461 | miscinit1 = tdfx_inl(par, MISCINIT1); | 460 | miscinit1 = tdfx_inl(par, MISCINIT1); |
462 | miscinit1 |= sgram_p ? 0 : MISCINIT1_2DBLOCK_DIS; | 461 | miscinit1 |= has_sgram ? 0 : MISCINIT1_2DBLOCK_DIS; |
463 | miscinit1 |= MISCINIT1_CLUT_INV; | 462 | miscinit1 |= MISCINIT1_CLUT_INV; |
464 | 463 | ||
465 | banshee_make_room(par, 1); | 464 | banshee_make_room(par, 1); |