diff options
author | Richard Drummond <evilrich@rcdrummond.net> | 2005-05-01 11:59:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-01 11:59:25 -0400 |
commit | 333f981720d619e2038b980a55ad01b10580eb9f (patch) | |
tree | 419e52ba014d85275dd39614649e09a4c9c7245f /drivers/video/tdfxfb.c | |
parent | 0fbe9cafff72799700713e6a9d5a4ec7191e8d19 (diff) |
[PATCH] Clean-up and bug fix for tdfxfb framebuffer size detection
Attached is a patch against 2.6.11.7 which tidies up the tdfxfb framebuffer
size detection code a little and fixes the broken support for Voodoo4/5
cards. (I haven't tested this on a Voodoo5, however, because I don't have
the hardware).
Signed-off-by: Richard Drummond <evilrich@rcdrummond.net>
Cc: <linux-fbdev-devel@lists.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video/tdfxfb.c')
-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); |