mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 13:53:33 +00:00
[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>
This commit is contained in:
parent
0fbe9cafff
commit
333f981720
2 changed files with 23 additions and 22 deletions
|
@ -430,36 +430,35 @@ static void do_write_regs(struct fb_info *info, struct banshee_reg* reg)
|
||||||
|
|
||||||
static unsigned long do_lfb_size(struct tdfx_par *par, unsigned short dev_id)
|
static unsigned long do_lfb_size(struct tdfx_par *par, unsigned short dev_id)
|
||||||
{
|
{
|
||||||
u32 draminit0 = 0;
|
u32 draminit0;
|
||||||
u32 draminit1 = 0;
|
u32 draminit1;
|
||||||
u32 miscinit1 = 0;
|
u32 miscinit1;
|
||||||
u32 lfbsize = 0;
|
|
||||||
int sgram_p = 0;
|
int num_chips;
|
||||||
|
int chip_size; /* in MB */
|
||||||
|
u32 lfbsize;
|
||||||
|
int has_sgram;
|
||||||
|
|
||||||
draminit0 = tdfx_inl(par, DRAMINIT0);
|
draminit0 = tdfx_inl(par, DRAMINIT0);
|
||||||
draminit1 = tdfx_inl(par, DRAMINIT1);
|
draminit1 = tdfx_inl(par, DRAMINIT1);
|
||||||
|
|
||||||
if ((dev_id == PCI_DEVICE_ID_3DFX_BANSHEE) ||
|
num_chips = (draminit0 & DRAMINIT0_SGRAM_NUM) ? 8 : 4;
|
||||||
(dev_id == PCI_DEVICE_ID_3DFX_VOODOO3)) {
|
|
||||||
sgram_p = (draminit1 & DRAMINIT1_MEM_SDRAM) ? 0 : 1;
|
|
||||||
|
|
||||||
lfbsize = sgram_p ?
|
if (dev_id < PCI_DEVICE_ID_3DFX_VOODOO5) {
|
||||||
(((draminit0 & DRAMINIT0_SGRAM_NUM) ? 2 : 1) *
|
/* Banshee/Voodoo3 */
|
||||||
((draminit0 & DRAMINIT0_SGRAM_TYPE) ? 8 : 4) * 1024 * 1024) :
|
has_sgram = draminit1 & DRAMINIT1_MEM_SDRAM;
|
||||||
16 * 1024 * 1024;
|
chip_size = has_sgram ? ((draminit0 & DRAMINIT0_SGRAM_TYPE) ? 2 : 1)
|
||||||
|
: 2;
|
||||||
} else {
|
} else {
|
||||||
/* Voodoo4/5 */
|
/* Voodoo4/5 */
|
||||||
u32 chips, psize, banks;
|
has_sgram = 0;
|
||||||
|
chip_size = 1 << ((draminit0 & DRAMINIT0_SGRAM_TYPE_MASK) >> DRAMINIT0_SGRAM_TYPE_SHIFT);
|
||||||
chips = ((draminit0 & (1 << 26)) == 0) ? 4 : 8;
|
|
||||||
psize = 1 << ((draminit0 & 0x38000000) >> 28);
|
|
||||||
banks = ((draminit0 & (1 << 30)) == 0) ? 2 : 4;
|
|
||||||
lfbsize = chips * psize * banks;
|
|
||||||
lfbsize <<= 20;
|
|
||||||
}
|
}
|
||||||
/* disable block writes for SDRAM (why?) */
|
lfbsize = num_chips * chip_size * 1024 * 1024;
|
||||||
|
|
||||||
|
/* disable block writes for SDRAM */
|
||||||
miscinit1 = tdfx_inl(par, MISCINIT1);
|
miscinit1 = tdfx_inl(par, MISCINIT1);
|
||||||
miscinit1 |= sgram_p ? 0 : MISCINIT1_2DBLOCK_DIS;
|
miscinit1 |= has_sgram ? 0 : MISCINIT1_2DBLOCK_DIS;
|
||||||
miscinit1 |= MISCINIT1_CLUT_INV;
|
miscinit1 |= MISCINIT1_CLUT_INV;
|
||||||
|
|
||||||
banshee_make_room(par, 1);
|
banshee_make_room(par, 1);
|
||||||
|
|
|
@ -99,6 +99,8 @@
|
||||||
#define MISCINIT1_2DBLOCK_DIS BIT(15)
|
#define MISCINIT1_2DBLOCK_DIS BIT(15)
|
||||||
#define DRAMINIT0_SGRAM_NUM BIT(26)
|
#define DRAMINIT0_SGRAM_NUM BIT(26)
|
||||||
#define DRAMINIT0_SGRAM_TYPE BIT(27)
|
#define DRAMINIT0_SGRAM_TYPE BIT(27)
|
||||||
|
#define DRAMINIT0_SGRAM_TYPE_MASK (BIT(27)|BIT(28)|BIT(29))
|
||||||
|
#define DRAMINIT0_SGRAM_TYPE_SHIFT 27
|
||||||
#define DRAMINIT1_MEM_SDRAM BIT(30)
|
#define DRAMINIT1_MEM_SDRAM BIT(30)
|
||||||
#define VGAINIT0_VGA_DISABLE BIT(0)
|
#define VGAINIT0_VGA_DISABLE BIT(0)
|
||||||
#define VGAINIT0_EXT_TIMING BIT(1)
|
#define VGAINIT0_EXT_TIMING BIT(1)
|
||||||
|
|
Loading…
Reference in a new issue