]> err.no Git - linux-2.6/commitdiff
[PATCH] nvidiafb: Add support for some pci-e chipsets
authorAntonino A. Daplas <adaplas@gmail.com>
Tue, 10 Jan 2006 04:53:33 +0000 (20:53 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 10 Jan 2006 16:01:49 +0000 (08:01 -0800)
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>
drivers/video/nvidia/nvidia.c
include/linux/pci_ids.h

index dcf2e7a7d2150c2943194488792799024304ea6a..099d64af37be7830c4ad503c7e7af80eb35555ce 100644 (file)
@@ -284,6 +284,16 @@ static struct pci_device_id nvidiafb_pci_tbl[] = {
         PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
        {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6200,
         PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+       {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_ALT1,
+        PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+       {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT1,
+        PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+       {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT2,
+        PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+       {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6200_ALT1,
+        PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+       {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_GT,
+        PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
        {PCI_VENDOR_ID_NVIDIA, 0x0252,
         PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
        {PCI_VENDOR_ID_NVIDIA, 0x0313,
@@ -1448,11 +1458,34 @@ static int __devinit nvidia_set_fbinfo(struct fb_info *info)
        return nvidiafb_check_var(&info->var, info);
 }
 
-static u32 __devinit nvidia_get_arch(struct pci_dev *pd)
+static u32 __devinit nvidia_get_chipset(struct fb_info *info)
 {
+       struct nvidia_par *par = info->par;
+       u32 id = (par->pci_dev->vendor << 16) | par->pci_dev->device;
+
+       printk("nvidiafb: PCI id - %x\n", id);
+       if ((id & 0xfff0) == 0x00f0) {
+               /* pci-e */
+               printk("nvidiafb: PCI-E card\n");
+               id = NV_RD32(par->REGS, 0x1800);
+
+               if ((id & 0x0000ffff) == 0x000010DE)
+                       id = 0x10DE0000 | (id >> 16);
+               else if ((id & 0xffff0000) == 0xDE100000) /* wrong endian */
+                       id = 0x10DE0000 | ((id << 8) & 0x0000ff00) |
+                            ((id >> 8) & 0x000000ff);
+       }
+
+       printk("nvidiafb: Actual id - %x\n", id);
+       return id;
+}
+
+static u32 __devinit nvidia_get_arch(struct fb_info *info)
+{
+       struct nvidia_par *par = info->par;
        u32 arch = 0;
 
-       switch (pd->device & 0x0ff0) {
+       switch (par->Chipset & 0x0ff0) {
        case 0x0100:            /* GeForce 256 */
        case 0x0110:            /* GeForce2 MX */
        case 0x0150:            /* GeForce2 */
@@ -1535,18 +1568,6 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,
                goto err_out_request;
        }
 
-       par->Architecture = nvidia_get_arch(pd);
-
-       par->Chipset = (pd->vendor << 16) | pd->device;
-       printk(KERN_INFO PFX "nVidia device/chipset %X\n", par->Chipset);
-
-       if (par->Architecture == 0) {
-               printk(KERN_ERR PFX "unknown NV_ARCH\n");
-               goto err_out_free_base0;
-       }
-
-       sprintf(nvidiafb_fix.id, "NV%x", (pd->device & 0x0ff0) >> 4);
-
        par->FlatPanel = flatpanel;
        if (flatpanel == 1)
                printk(KERN_INFO PFX "flatpanel support enabled\n");
@@ -1572,6 +1593,17 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,
                goto err_out_free_base0;
        }
 
+       par->Chipset = nvidia_get_chipset(info);
+       printk(KERN_INFO PFX "nVidia device/chipset %X\n", par->Chipset);
+       par->Architecture = nvidia_get_arch(info);
+
+       if (par->Architecture == 0) {
+               printk(KERN_ERR PFX "unknown NV_ARCH\n");
+               goto err_out_arch;
+       }
+
+       sprintf(nvidiafb_fix.id, "NV%x", (pd->device & 0x0ff0) >> 4);
+
        NVCommonSetup(info);
 
        par->FbAddress = nvidiafb_fix.smem_start;
@@ -1647,21 +1679,22 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,
        NVTRACE_LEAVE();
        return 0;
 
-      err_out_iounmap_fb:
+err_out_iounmap_fb:
        iounmap(info->screen_base);
-      err_out_free_base1:
+err_out_free_base1:
        fb_destroy_modedb(info->monspecs.modedb);
        nvidia_delete_i2c_busses(par);
+err_out_arch:
        iounmap(par->REGS);
-      err_out_free_base0:
+err_out_free_base0:
        pci_release_regions(pd);
-      err_out_request:
+err_out_request:
        pci_disable_device(pd);
-      err_out_enable:
+err_out_enable:
        kfree(info->pixmap.addr);
-      err_out_kfree:
+err_out_kfree:
        framebuffer_release(info);
-      err_out:
+err_out:
        return -ENODEV;
 }
 
index 100eba0f4771ae1cff13f82c9748cdbb264c19a6..f55c98a68aa913c0a12aefb233ddcc7fcff9e3d2 100644 (file)
 #define PCI_DEVICE_ID_NVIDIA_NVENET_6          0x00e6
 #define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO                0x00ea
 #define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2    0x00ee
+#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_ALT1 0x00f0
+#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT1 0x00f1
+#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT2 0x00f2
+#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6200_ALT1 0x00f3
+#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_GT   0x00f9
 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR       0x0100
 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR       0x0101
 #define PCI_DEVICE_ID_NVIDIA_QUADRO            0x0103