]> err.no Git - linux-2.6/blobdiff - drivers/video/geode/gx1fb_core.c
ibm_newemac: Fixes kernel crashes when speed of cable connected changes
[linux-2.6] / drivers / video / geode / gx1fb_core.c
index 8e8da743399416eafa71a730f50cca80a4b1f1e8..bb20a2289760bffea5e8064b65cd1ff709970f12 100644 (file)
@@ -15,7 +15,6 @@
 #include <linux/errno.h>
 #include <linux/string.h>
 #include <linux/mm.h>
-#include <linux/tty.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/fb.h>
@@ -215,11 +214,11 @@ static int __init gx1fb_map_video_memory(struct fb_info *info, struct pci_dev *d
        if (ret < 0)
                return ret;
 
-       ret = pci_request_region(dev, 1, "gx1fb (video)");
+       ret = pci_request_region(dev, 0, "gx1fb (video)");
        if (ret < 0)
                return ret;
-       par->vid_regs = ioremap(pci_resource_start(dev, 1),
-                               pci_resource_len(dev, 1));
+       par->vid_regs = ioremap(pci_resource_start(dev, 0),
+                               pci_resource_len(dev, 0));
        if (!par->vid_regs)
                return -ENOMEM;
 
@@ -229,12 +228,9 @@ static int __init gx1fb_map_video_memory(struct fb_info *info, struct pci_dev *d
        if (!par->dc_regs)
                return -ENOMEM;
 
-       ret = pci_request_region(dev, 0, "gx1fb (frame buffer)");
-       if (ret < 0 )
-               return -EBUSY;
        if ((fb_len = gx1_frame_buffer_size()) < 0)
                return -ENOMEM;
-       info->fix.smem_start = pci_resource_start(dev, 0);
+       info->fix.smem_start = gx_base + 0x800000;
        info->fix.smem_len = fb_len;
        info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len);
        if (!info->screen_base)
@@ -379,8 +375,6 @@ static int __init gx1fb_probe(struct pci_dev *pdev, const struct pci_device_id *
                release_mem_region(gx1_gx_base() + 0x8300, 0x100);
        }
 
-       pci_disable_device(pdev);
-
        if (info)
                framebuffer_release(info);
        return ret;
@@ -402,12 +396,35 @@ static void gx1fb_remove(struct pci_dev *pdev)
        iounmap(par->dc_regs);
        release_mem_region(gx1_gx_base() + 0x8300, 0x100);
 
-       pci_disable_device(pdev);
        pci_set_drvdata(pdev, NULL);
 
        framebuffer_release(info);
 }
 
+#ifndef MODULE
+static void __init gx1fb_setup(char *options)
+{
+       char *this_opt;
+
+       if (!options || !*options)
+               return;
+
+       while ((this_opt = strsep(&options, ","))) {
+               if (!*this_opt)
+                       continue;
+
+               if (!strncmp(this_opt, "mode:", 5))
+                       strlcpy(mode_option, this_opt + 5, sizeof(mode_option));
+               else if (!strncmp(this_opt, "crt:", 4))
+                       crt_option = !!simple_strtoul(this_opt + 4, NULL, 0);
+               else if (!strncmp(this_opt, "panel:", 6))
+                       strlcpy(panel_option, this_opt + 6, sizeof(panel_option));
+               else
+                       strlcpy(mode_option, this_opt, sizeof(mode_option));
+       }
+}
+#endif
+
 static struct pci_device_id gx1fb_id_table[] = {
        { PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_VIDEO,
          PCI_ANY_ID, PCI_ANY_ID, PCI_BASE_CLASS_DISPLAY << 16,
@@ -427,8 +444,11 @@ static struct pci_driver gx1fb_driver = {
 static int __init gx1fb_init(void)
 {
 #ifndef MODULE
-       if (fb_get_options("gx1fb", NULL))
+       char *option = NULL;
+
+       if (fb_get_options("gx1fb", &option))
                return -ENODEV;
+       gx1fb_setup(option);
 #endif
        return pci_register_driver(&gx1fb_driver);
 }