aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2006-01-09 23:53:33 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-10 11:01:49 -0500
commitc549dc6422e4b720fed6702d70fddd8cee0f5c9a (patch)
tree6050aaf2c7fc679376e98dd383c0fbb6b4317b4e /drivers/video
parenta14b2283c5fb8504d15768cbd20fbe337ffdb3d6 (diff)
[PATCH] nvidiafb: Add support for some pci-e chipsets
Chipsets with PCI device ids & 0xf0 == 0x00f0 has their actual chipset type in offset 0x1800 of the mmio space. Add support for this. Signed-off-by: Antonino Daplas <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/nvidia/nvidia.c75
1 files changed, 54 insertions, 21 deletions
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index dcf2e7a7d215..099d64af37be 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -284,6 +284,16 @@ static struct pci_device_id nvidiafb_pci_tbl[] = {
284 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 284 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
285 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6200, 285 {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6200,
286 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 286 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
287 {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_ALT1,
288 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
289 {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT1,
290 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
291 {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT2,
292 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
293 {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6200_ALT1,
294 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
295 {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_GT,
296 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
287 {PCI_VENDOR_ID_NVIDIA, 0x0252, 297 {PCI_VENDOR_ID_NVIDIA, 0x0252,
288 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 298 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
289 {PCI_VENDOR_ID_NVIDIA, 0x0313, 299 {PCI_VENDOR_ID_NVIDIA, 0x0313,
@@ -1448,11 +1458,34 @@ static int __devinit nvidia_set_fbinfo(struct fb_info *info)
1448 return nvidiafb_check_var(&info->var, info); 1458 return nvidiafb_check_var(&info->var, info);
1449} 1459}
1450 1460
1451static u32 __devinit nvidia_get_arch(struct pci_dev *pd) 1461static u32 __devinit nvidia_get_chipset(struct fb_info *info)
1452{ 1462{
1463 struct nvidia_par *par = info->par;
1464 u32 id = (par->pci_dev->vendor << 16) | par->pci_dev->device;
1465
1466 printk("nvidiafb: PCI id - %x\n", id);
1467 if ((id & 0xfff0) == 0x00f0) {
1468 /* pci-e */
1469 printk("nvidiafb: PCI-E card\n");
1470 id = NV_RD32(par->REGS, 0x1800);
1471
1472 if ((id & 0x0000ffff) == 0x000010DE)
1473 id = 0x10DE0000 | (id >> 16);
1474 else if ((id & 0xffff0000) == 0xDE100000) /* wrong endian */
1475 id = 0x10DE0000 | ((id << 8) & 0x0000ff00) |
1476 ((id >> 8) & 0x000000ff);
1477 }
1478
1479 printk("nvidiafb: Actual id - %x\n", id);
1480 return id;
1481}
1482
1483static u32 __devinit nvidia_get_arch(struct fb_info *info)
1484{
1485 struct nvidia_par *par = info->par;
1453 u32 arch = 0; 1486 u32 arch = 0;
1454 1487
1455 switch (pd->device & 0x0ff0) { 1488 switch (par->Chipset & 0x0ff0) {
1456 case 0x0100: /* GeForce 256 */ 1489 case 0x0100: /* GeForce 256 */
1457 case 0x0110: /* GeForce2 MX */ 1490 case 0x0110: /* GeForce2 MX */
1458 case 0x0150: /* GeForce2 */ 1491 case 0x0150: /* GeForce2 */
@@ -1535,18 +1568,6 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,
1535 goto err_out_request; 1568 goto err_out_request;
1536 } 1569 }
1537 1570
1538 par->Architecture = nvidia_get_arch(pd);
1539
1540 par->Chipset = (pd->vendor << 16) | pd->device;
1541 printk(KERN_INFO PFX "nVidia device/chipset %X\n", par->Chipset);
1542
1543 if (par->Architecture == 0) {
1544 printk(KERN_ERR PFX "unknown NV_ARCH\n");
1545 goto err_out_free_base0;
1546 }
1547
1548 sprintf(nvidiafb_fix.id, "NV%x", (pd->device & 0x0ff0) >> 4);
1549
1550 par->FlatPanel = flatpanel; 1571 par->FlatPanel = flatpanel;
1551 if (flatpanel == 1) 1572 if (flatpanel == 1)
1552 printk(KERN_INFO PFX "flatpanel support enabled\n"); 1573 printk(KERN_INFO PFX "flatpanel support enabled\n");
@@ -1572,6 +1593,17 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,
1572 goto err_out_free_base0; 1593 goto err_out_free_base0;
1573 } 1594 }
1574 1595
1596 par->Chipset = nvidia_get_chipset(info);
1597 printk(KERN_INFO PFX "nVidia device/chipset %X\n", par->Chipset);
1598 par->Architecture = nvidia_get_arch(info);
1599
1600 if (par->Architecture == 0) {
1601 printk(KERN_ERR PFX "unknown NV_ARCH\n");
1602 goto err_out_arch;
1603 }
1604
1605 sprintf(nvidiafb_fix.id, "NV%x", (pd->device & 0x0ff0) >> 4);
1606
1575 NVCommonSetup(info); 1607 NVCommonSetup(info);
1576 1608
1577 par->FbAddress = nvidiafb_fix.smem_start; 1609 par->FbAddress = nvidiafb_fix.smem_start;
@@ -1647,21 +1679,22 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,
1647 NVTRACE_LEAVE(); 1679 NVTRACE_LEAVE();
1648 return 0; 1680 return 0;
1649 1681
1650 err_out_iounmap_fb: 1682err_out_iounmap_fb:
1651 iounmap(info->screen_base); 1683 iounmap(info->screen_base);
1652 err_out_free_base1: 1684err_out_free_base1:
1653 fb_destroy_modedb(info->monspecs.modedb); 1685 fb_destroy_modedb(info->monspecs.modedb);
1654 nvidia_delete_i2c_busses(par); 1686 nvidia_delete_i2c_busses(par);
1687err_out_arch:
1655 iounmap(par->REGS); 1688 iounmap(par->REGS);
1656 err_out_free_base0: 1689err_out_free_base0:
1657 pci_release_regions(pd); 1690 pci_release_regions(pd);
1658 err_out_request: 1691err_out_request:
1659 pci_disable_device(pd); 1692 pci_disable_device(pd);
1660 err_out_enable: 1693err_out_enable:
1661 kfree(info->pixmap.addr); 1694 kfree(info->pixmap.addr);
1662 err_out_kfree: 1695err_out_kfree:
1663 framebuffer_release(info); 1696 framebuffer_release(info);
1664 err_out: 1697err_out:
1665 return -ENODEV; 1698 return -ENODEV;
1666} 1699}
1667 1700