fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / video / valkyriefb.c
index fd8eb47..06fc19a 100644 (file)
  *  more details.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/string.h>
 #include <linux/mm.h>
-#include <linux/tty.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/delay.h>
@@ -89,13 +87,13 @@ struct fb_par_valkyrie {
 struct fb_info_valkyrie {
        struct fb_info          info;
        struct fb_par_valkyrie  par;
-       struct cmap_regs        *cmap_regs;
+       struct cmap_regs        __iomem *cmap_regs;
        unsigned long           cmap_regs_phys;
        
-       struct valkyrie_regs    *valkyrie_regs;
+       struct valkyrie_regs    __iomem *valkyrie_regs;
        unsigned long           valkyrie_regs_phys;
        
-       __u8                    *frame_buffer;
+       __u8                    __iomem *frame_buffer;
        unsigned long           frame_buffer_phys;
        
        int                     sense;
@@ -135,14 +133,13 @@ static struct fb_ops valkyriefb_ops = {
        .fb_fillrect    = cfb_fillrect,
        .fb_copyarea    = cfb_copyarea,
        .fb_imageblit   = cfb_imageblit,
-       .fb_cursor      = soft_cursor,
 };
 
 /* Sets the video mode according to info->var */
 static int valkyriefb_set_par(struct fb_info *info)
 {
        struct fb_info_valkyrie *p = (struct fb_info_valkyrie *) info;
-       volatile struct valkyrie_regs *valkyrie_regs = p->valkyrie_regs;
+       volatile struct valkyrie_regs __iomem *valkyrie_regs = p->valkyrie_regs;
        struct fb_par_valkyrie *par = info->par;
        struct valkyrie_regvals *init;
        int err;
@@ -207,13 +204,13 @@ static int valkyriefb_blank(int blank_mode, struct fb_info *info)
                return 1;
 
        switch (blank_mode) {
-       case 0:                 /* unblank */
+       case FB_BLANK_UNBLANK:                  /* unblank */
                out_8(&p->valkyrie_regs->mode.r, init->mode);
                break;
-       case 1:
+       case FB_BLANK_NORMAL:
                return 1;       /* get caller to set CLUT to all black */
-       case VESA_VSYNC_SUSPEND+1:
-       case VESA_HSYNC_SUSPEND+1:
+       case FB_BLANK_VSYNC_SUSPEND:
+       case FB_BLANK_HSYNC_SUSPEND:
                /*
                 * [kps] Value extracted from MacOS. I don't know
                 * whether this bit disables hsync or vsync, or
@@ -221,7 +218,7 @@ static int valkyriefb_blank(int blank_mode, struct fb_info *info)
                 */
                out_8(&p->valkyrie_regs->mode.r, init->mode | 0x40);
                break;
-       case VESA_POWERDOWN+1:
+       case FB_BLANK_POWERDOWN:
                out_8(&p->valkyrie_regs->mode.r, 0x66);
                break;
        }
@@ -232,7 +229,7 @@ static int valkyriefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
                             u_int transp, struct fb_info *info)
 {
        struct fb_info_valkyrie *p = (struct fb_info_valkyrie *) info;
-       volatile struct cmap_regs *cmap_regs = p->cmap_regs;
+       volatile struct cmap_regs __iomem *cmap_regs = p->cmap_regs;
        struct fb_par_valkyrie *par = info->par;
 
        if (regno > 255)
@@ -287,7 +284,7 @@ static void __init valkyrie_choose_mode(struct fb_info_valkyrie *p)
        printk(KERN_INFO "Monitor sense value = 0x%x\n", p->sense);
 
        /* Try to pick a video mode out of NVRAM if we have one. */
-#ifndef CONFIG_MAC
+#if !defined(CONFIG_MAC) && defined(CONFIG_NVRAM)
        if (default_vmode == VMODE_NVRAM) {
                default_vmode = nvram_read_byte(NV_VMODE);
                if (default_vmode <= 0
@@ -300,7 +297,7 @@ static void __init valkyrie_choose_mode(struct fb_info_valkyrie *p)
                default_vmode = mac_map_monitor_sense(p->sense);
        if (!valkyrie_reg_init[default_vmode - 1])
                default_vmode = VMODE_640_480_67;
-#ifndef CONFIG_MAC
+#if !defined(CONFIG_MAC) && defined(CONFIG_NVRAM)
        if (default_cmode == CMODE_NVRAM)
                default_cmode = nvram_read_byte(NV_CMODE);
 #endif
@@ -322,6 +319,11 @@ int __init valkyriefb_init(void)
        struct fb_info_valkyrie *p;
        unsigned long frame_buffer_phys, cmap_regs_phys, flags;
        int err;
+       char *option = NULL;
+
+       if (fb_get_options("valkyriefb", &option))
+               return -ENODEV;
+       valkyriefb_setup(option);
 
 #ifdef CONFIG_MAC
        if (!MACH_IS_MAC)
@@ -336,21 +338,23 @@ int __init valkyriefb_init(void)
        cmap_regs_phys = 0x50f24000;
        flags = IOMAP_NOCACHE_SER; /* IOMAP_WRITETHROUGH?? */
 #else /* ppc (!CONFIG_MAC) */
-       struct device_node *dp;
+       {
+               struct device_node *dp;
+               struct resource r;
 
-       dp = find_devices("valkyrie");
-       if (dp == 0)
-               return 0;
+               dp = of_find_node_by_name(NULL, "valkyrie");
+               if (dp == 0)
+                       return 0;
 
-       if (dp->n_addrs != 1) {
-               printk(KERN_ERR "expecting 1 address for valkyrie (got %d)\n",
-                      dp->n_addrs);
-               return 0;
-       }
+               if (of_address_to_resource(dp, 0, &r)) {
+                       printk(KERN_ERR "can't find address for valkyrie\n");
+                       return 0;
+               }
 
-       frame_buffer_phys = dp->addrs[0].address;
-       cmap_regs_phys = dp->addrs[0].address+0x304000;
-       flags = _PAGE_WRITETHRU;
+               frame_buffer_phys = r.start;
+               cmap_regs_phys = r.start + 0x304000;
+               flags = _PAGE_WRITETHRU;
+       }
 #endif /* ppc (!CONFIG_MAC) */
 
        p = kmalloc(sizeof(*p), GFP_ATOMIC);
@@ -539,8 +543,8 @@ static void valkyrie_par_to_fix(struct fb_par_valkyrie *par,
 static void __init valkyrie_init_info(struct fb_info *info, struct fb_info_valkyrie *p)
 {
        info->fbops = &valkyriefb_ops;
-       info->screen_base = (char *) p->frame_buffer + 0x1000;
-       info->flags = FBINFO_FLAG_DEFAULT;
+       info->screen_base = p->frame_buffer + 0x1000;
+       info->flags = FBINFO_DEFAULT;
        info->pseudo_palette = p->pseudo_palette;
        fb_alloc_cmap(&info->cmap, 256, 0);
        info->par = &p->par;
@@ -579,4 +583,5 @@ int __init valkyriefb_setup(char *options)
        return 0;
 }
 
+module_init(valkyriefb_init);
 MODULE_LICENSE("GPL");