38 #include <linux/pci.h>
44 #define PFX "rivafb: "
46 static inline unsigned char MISCin(
struct riva_par *par)
58 if(second) PRAMDAC += 0x800;
60 reg52C =
NV_RD32(PRAMDAC, 0x052C);
61 reg608 =
NV_RD32(PRAMDAC, 0x0608);
63 NV_WR32(PRAMDAC, 0x0608, reg608 & ~0x00010000);
65 NV_WR32(PRAMDAC, 0x052C, reg52C & 0x0000FEEE);
79 NV_WR32(PRAMDAC, 0x052C, reg52C);
80 NV_WR32(PRAMDAC, 0x0608, reg608);
86 riva_override_CRTC(
struct riva_par *par)
89 "Detected CRTC controller %i being used\n",
94 "Forcing usage of CRTC %i\n", par->
forceCRTC);
100 riva_is_second(
struct riva_par *par)
103 switch(par->
Chipset & 0xffff) {
137 if(riva_is_connected(par, 0)) {
144 if (riva_is_connected(par, 1)) {
152 riva_override_CRTC(par);
158 unsigned long memlen = 0;
165 if (
NV_RD32(chip->
PFB, 0x00000000) & 0x00000020) {
166 if (((
NV_RD32(chip->
PMC, 0x00000000) & 0xF0) == 0x20)
167 && ((
NV_RD32(chip->
PMC, 0x00000000)&0x0F)>=0x02)) {
171 switch (
NV_RD32(chip->
PFB,0x00000000) & 0x03) {
189 switch (
NV_RD32(chip->
PFB, 0x00000000) & 0x00000003) {
203 if (
NV_RD32(chip->
PFB, 0x00000000) & 0x00000100) {
204 memlen = ((
NV_RD32(chip->
PFB, 0x00000000)>>12)&0x0F) *
207 switch (
NV_RD32(chip->
PFB, 0x00000000) & 0x00000003) {
230 pci_read_config_dword(dev, 0x7C, &amt);
232 memlen = (((amt >> 6) & 31) + 1) * 1024;
235 pci_read_config_dword(dev, 0x84, &amt);
237 memlen = (((amt >> 4) & 127) + 1) * 1024;
239 switch ((
NV_RD32(chip->
PFB, 0x0000020C) >> 20) &
275 unsigned long dclk = 0;
279 if (
NV_RD32(chip->
PFB, 0x00000000) & 0x00000020) {
280 if (((
NV_RD32(chip->
PMC, 0x00000000) & 0xF0) == 0x20)
281 && ((
NV_RD32(chip->
PMC,0x00000000)&0x0F) >= 0x02)) {
300 switch ((
NV_RD32(chip->
PFB, 0x00000000) >> 3) & 0x00000003) {
337 par->
riva.
IO = (MISCin(par) & 0x01) ? 0x3D0 : 0x3B0;
340 switch (par->
Chipset & 0xffff) {
368 "On a laptop. Assuming Digital Flat Panel\n");
376 switch (par->
Chipset & 0x0ff0) {
380 #if defined(__powerpc__)
384 riva_override_CRTC(par);