aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/controlfb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/controlfb.c')
-rw-r--r--drivers/video/controlfb.c114
1 files changed, 50 insertions, 64 deletions
diff --git a/drivers/video/controlfb.c b/drivers/video/controlfb.c
index 403d17377f8d..03798e9c882d 100644
--- a/drivers/video/controlfb.c
+++ b/drivers/video/controlfb.c
@@ -133,12 +133,6 @@ static int controlfb_mmap(struct fb_info *info, struct file *file,
133static int controlfb_set_par (struct fb_info *info); 133static int controlfb_set_par (struct fb_info *info);
134static int controlfb_check_var (struct fb_var_screeninfo *var, struct fb_info *info); 134static int controlfb_check_var (struct fb_var_screeninfo *var, struct fb_info *info);
135 135
136/*
137 * inititialization
138 */
139int control_init(void);
140void control_setup(char *);
141
142/******************** Prototypes for internal functions **********************/ 136/******************** Prototypes for internal functions **********************/
143 137
144static void set_control_clock(unsigned char *params); 138static void set_control_clock(unsigned char *params);
@@ -550,9 +544,46 @@ static void control_set_hardware(struct fb_info_control *p, struct fb_par_contro
550 544
551 545
552/* 546/*
553 * Called from fbmem.c for probing & initializing 547 * Parse user speficied options (`video=controlfb:')
554 */ 548 */
555int __init control_init(void) 549static void __init control_setup(char *options)
550{
551 char *this_opt;
552
553 if (!options || !*options)
554 return;
555
556 while ((this_opt = strsep(&options, ",")) != NULL) {
557 if (!strncmp(this_opt, "vmode:", 6)) {
558 int vmode = simple_strtoul(this_opt+6, NULL, 0);
559 if (vmode > 0 && vmode <= VMODE_MAX &&
560 control_mac_modes[vmode - 1].m[1] >= 0)
561 default_vmode = vmode;
562 } else if (!strncmp(this_opt, "cmode:", 6)) {
563 int depth = simple_strtoul(this_opt+6, NULL, 0);
564 switch (depth) {
565 case CMODE_8:
566 case CMODE_16:
567 case CMODE_32:
568 default_cmode = depth;
569 break;
570 case 8:
571 default_cmode = CMODE_8;
572 break;
573 case 15:
574 case 16:
575 default_cmode = CMODE_16;
576 break;
577 case 24:
578 case 32:
579 default_cmode = CMODE_32;
580 break;
581 }
582 }
583 }
584}
585
586static int __init control_init(void)
556{ 587{
557 struct device_node *dp; 588 struct device_node *dp;
558 char *option = NULL; 589 char *option = NULL;
@@ -651,15 +682,16 @@ static void __init find_vram_size(struct fb_info_control *p)
651static int __init control_of_init(struct device_node *dp) 682static int __init control_of_init(struct device_node *dp)
652{ 683{
653 struct fb_info_control *p; 684 struct fb_info_control *p;
654 unsigned long addr; 685 struct resource fb_res, reg_res;
655 int i;
656 686
657 if (control_fb) { 687 if (control_fb) {
658 printk(KERN_ERR "controlfb: only one control is supported\n"); 688 printk(KERN_ERR "controlfb: only one control is supported\n");
659 return -ENXIO; 689 return -ENXIO;
660 } 690 }
661 if(dp->n_addrs != 2) { 691
662 printk(KERN_ERR "expecting 2 address for control (got %d)", dp->n_addrs); 692 if (of_pci_address_to_resource(dp, 2, &fb_res) ||
693 of_pci_address_to_resource(dp, 1, &reg_res)) {
694 printk(KERN_ERR "can't get 2 addresses for control\n");
663 return -ENXIO; 695 return -ENXIO;
664 } 696 }
665 p = kmalloc(sizeof(*p), GFP_KERNEL); 697 p = kmalloc(sizeof(*p), GFP_KERNEL);
@@ -669,18 +701,12 @@ static int __init control_of_init(struct device_node *dp)
669 memset(p, 0, sizeof(*p)); 701 memset(p, 0, sizeof(*p));
670 702
671 /* Map in frame buffer and registers */ 703 /* Map in frame buffer and registers */
672 for (i = 0; i < dp->n_addrs; ++i) { 704 p->fb_orig_base = fb_res.start;
673 addr = dp->addrs[i].address; 705 p->fb_orig_size = fb_res.end - fb_res.start + 1;
674 if (dp->addrs[i].size >= 0x800000) { 706 /* use the big-endian aperture (??) */
675 p->fb_orig_base = addr; 707 p->frame_buffer_phys = fb_res.start + 0x800000;
676 p->fb_orig_size = dp->addrs[i].size; 708 p->control_regs_phys = reg_res.start;
677 /* use the big-endian aperture (??) */ 709 p->control_regs_size = reg_res.end - reg_res.start + 1;
678 p->frame_buffer_phys = addr + 0x800000;
679 } else {
680 p->control_regs_phys = addr;
681 p->control_regs_size = dp->addrs[i].size;
682 }
683 }
684 710
685 if (!p->fb_orig_base || 711 if (!p->fb_orig_base ||
686 !request_mem_region(p->fb_orig_base,p->fb_orig_size,"controlfb")) { 712 !request_mem_region(p->fb_orig_base,p->fb_orig_size,"controlfb")) {
@@ -1059,43 +1085,3 @@ static void control_cleanup(void)
1059} 1085}
1060 1086
1061 1087
1062/*
1063 * Parse user speficied options (`video=controlfb:')
1064 */
1065void __init control_setup(char *options)
1066{
1067 char *this_opt;
1068
1069 if (!options || !*options)
1070 return;
1071
1072 while ((this_opt = strsep(&options, ",")) != NULL) {
1073 if (!strncmp(this_opt, "vmode:", 6)) {
1074 int vmode = simple_strtoul(this_opt+6, NULL, 0);
1075 if (vmode > 0 && vmode <= VMODE_MAX &&
1076 control_mac_modes[vmode - 1].m[1] >= 0)
1077 default_vmode = vmode;
1078 } else if (!strncmp(this_opt, "cmode:", 6)) {
1079 int depth = simple_strtoul(this_opt+6, NULL, 0);
1080 switch (depth) {
1081 case CMODE_8:
1082 case CMODE_16:
1083 case CMODE_32:
1084 default_cmode = depth;
1085 break;
1086 case 8:
1087 default_cmode = CMODE_8;
1088 break;
1089 case 15:
1090 case 16:
1091 default_cmode = CMODE_16;
1092 break;
1093 case 24:
1094 case 32:
1095 default_cmode = CMODE_32;
1096 break;
1097 }
1098 }
1099 }
1100}
1101