diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-09 13:03:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-09 13:03:44 -0500 |
commit | 6150c32589d1976ca8a5c987df951088c05a7542 (patch) | |
tree | 94073696576323ff966e365d8c47b8ecd8372f97 /drivers/video | |
parent | 44637a12f80b80157d9c1bc5b7d6ef09c9e05713 (diff) | |
parent | be42d5fa3772241b8ecebd443f1fb36247959c54 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc-merge
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/controlfb.c | 114 | ||||
-rw-r--r-- | drivers/video/offb.c | 122 | ||||
-rw-r--r-- | drivers/video/platinumfb.c | 98 | ||||
-rw-r--r-- | drivers/video/platinumfb.h | 4 | ||||
-rw-r--r-- | drivers/video/valkyriefb.c | 12 |
5 files changed, 177 insertions, 173 deletions
diff --git a/drivers/video/controlfb.c b/drivers/video/controlfb.c index 403d17377f8..03798e9c882 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, | |||
133 | static int controlfb_set_par (struct fb_info *info); | 133 | static int controlfb_set_par (struct fb_info *info); |
134 | static int controlfb_check_var (struct fb_var_screeninfo *var, struct fb_info *info); | 134 | static int controlfb_check_var (struct fb_var_screeninfo *var, struct fb_info *info); |
135 | 135 | ||
136 | /* | ||
137 | * inititialization | ||
138 | */ | ||
139 | int control_init(void); | ||
140 | void control_setup(char *); | ||
141 | |||
142 | /******************** Prototypes for internal functions **********************/ | 136 | /******************** Prototypes for internal functions **********************/ |
143 | 137 | ||
144 | static void set_control_clock(unsigned char *params); | 138 | static 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 | */ |
555 | int __init control_init(void) | 549 | static 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 | |||
586 | static 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) | |||
651 | static int __init control_of_init(struct device_node *dp) | 682 | static 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, ®_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 | */ | ||
1065 | void __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 | |||
diff --git a/drivers/video/offb.c b/drivers/video/offb.c index 00d87f5bb7b..ad1434e3f22 100644 --- a/drivers/video/offb.c +++ b/drivers/video/offb.c | |||
@@ -223,6 +223,7 @@ static int offb_blank(int blank, struct fb_info *info) | |||
223 | int __init offb_init(void) | 223 | int __init offb_init(void) |
224 | { | 224 | { |
225 | struct device_node *dp = NULL, *boot_disp = NULL; | 225 | struct device_node *dp = NULL, *boot_disp = NULL; |
226 | |||
226 | #if defined(CONFIG_BOOTX_TEXT) && defined(CONFIG_PPC32) | 227 | #if defined(CONFIG_BOOTX_TEXT) && defined(CONFIG_PPC32) |
227 | struct device_node *macos_display = NULL; | 228 | struct device_node *macos_display = NULL; |
228 | #endif | 229 | #endif |
@@ -234,60 +235,54 @@ int __init offb_init(void) | |||
234 | if (boot_infos != 0) { | 235 | if (boot_infos != 0) { |
235 | unsigned long addr = | 236 | unsigned long addr = |
236 | (unsigned long) boot_infos->dispDeviceBase; | 237 | (unsigned long) boot_infos->dispDeviceBase; |
238 | u32 *addrp; | ||
239 | u64 daddr, dsize; | ||
240 | unsigned int flags; | ||
241 | |||
237 | /* find the device node corresponding to the macos display */ | 242 | /* find the device node corresponding to the macos display */ |
238 | while ((dp = of_find_node_by_type(dp, "display"))) { | 243 | while ((dp = of_find_node_by_type(dp, "display"))) { |
239 | int i; | 244 | int i; |
240 | /* | ||
241 | * Grrr... It looks like the MacOS ATI driver | ||
242 | * munges the assigned-addresses property (but | ||
243 | * the AAPL,address value is OK). | ||
244 | */ | ||
245 | if (strncmp(dp->name, "ATY,", 4) == 0 | ||
246 | && dp->n_addrs == 1) { | ||
247 | unsigned int *ap = | ||
248 | (unsigned int *) get_property(dp, | ||
249 | "AAPL,address", | ||
250 | NULL); | ||
251 | if (ap != NULL) { | ||
252 | dp->addrs[0].address = *ap; | ||
253 | dp->addrs[0].size = 0x01000000; | ||
254 | } | ||
255 | } | ||
256 | 245 | ||
257 | /* | 246 | /* |
258 | * The LTPro on the Lombard powerbook has no addresses | 247 | * Look for an AAPL,address property first. |
259 | * on the display nodes, they are on their parent. | ||
260 | */ | 248 | */ |
261 | if (dp->n_addrs == 0 | 249 | unsigned int na; |
262 | && device_is_compatible(dp, "ATY,264LTPro")) { | 250 | unsigned int *ap = |
263 | int na; | 251 | (unsigned int *)get_property(dp, "AAPL,address", |
264 | unsigned int *ap = (unsigned int *) | 252 | &na); |
265 | get_property(dp, "AAPL,address", &na); | 253 | if (ap != 0) { |
266 | if (ap != 0) | 254 | for (na /= sizeof(unsigned int); na > 0; |
267 | for (na /= sizeof(unsigned int); | 255 | --na, ++ap) |
268 | na > 0; --na, ++ap) | 256 | if (*ap <= addr && |
269 | if (*ap <= addr | 257 | addr < *ap + 0x1000000) { |
270 | && addr < | 258 | macos_display = dp; |
271 | *ap + 0x1000000) | 259 | goto foundit; |
272 | goto foundit; | 260 | } |
273 | } | 261 | } |
274 | 262 | ||
275 | /* | 263 | /* |
276 | * See if the display address is in one of the address | 264 | * See if the display address is in one of the address |
277 | * ranges for this display. | 265 | * ranges for this display. |
278 | */ | 266 | */ |
279 | for (i = 0; i < dp->n_addrs; ++i) { | 267 | i = 0; |
280 | if (dp->addrs[i].address <= addr | 268 | for (;;) { |
281 | && addr < | 269 | addrp = of_get_address(dp, i++, &dsize, &flags); |
282 | dp->addrs[i].address + | 270 | if (addrp == NULL) |
283 | dp->addrs[i].size) | ||
284 | break; | 271 | break; |
272 | if (!(flags & IORESOURCE_MEM)) | ||
273 | continue; | ||
274 | daddr = of_translate_address(dp, addrp); | ||
275 | if (daddr == OF_BAD_ADDR) | ||
276 | continue; | ||
277 | if (daddr <= addr && addr < (daddr + dsize)) { | ||
278 | macos_display = dp; | ||
279 | goto foundit; | ||
280 | } | ||
285 | } | 281 | } |
286 | if (i < dp->n_addrs) { | 282 | foundit: |
287 | foundit: | 283 | if (macos_display) { |
288 | printk(KERN_INFO "MacOS display is %s\n", | 284 | printk(KERN_INFO "MacOS display is %s\n", |
289 | dp->full_name); | 285 | dp->full_name); |
290 | macos_display = dp; | ||
291 | break; | 286 | break; |
292 | } | 287 | } |
293 | } | 288 | } |
@@ -326,8 +321,10 @@ static void __init offb_init_nodriver(struct device_node *dp) | |||
326 | int *pp, i; | 321 | int *pp, i; |
327 | unsigned int len; | 322 | unsigned int len; |
328 | int width = 640, height = 480, depth = 8, pitch; | 323 | int width = 640, height = 480, depth = 8, pitch; |
329 | unsigned int rsize, *up; | 324 | unsigned int flags, rsize, *up; |
330 | unsigned long address = 0; | 325 | u64 address = OF_BAD_ADDR; |
326 | u32 *addrp; | ||
327 | u64 asize; | ||
331 | 328 | ||
332 | if ((pp = (int *) get_property(dp, "depth", &len)) != NULL | 329 | if ((pp = (int *) get_property(dp, "depth", &len)) != NULL |
333 | && len == sizeof(int)) | 330 | && len == sizeof(int)) |
@@ -363,7 +360,7 @@ static void __init offb_init_nodriver(struct device_node *dp) | |||
363 | break; | 360 | break; |
364 | } | 361 | } |
365 | if (pdev) { | 362 | if (pdev) { |
366 | for (i = 0; i < 6 && address == 0; i++) { | 363 | for (i = 0; i < 6 && address == OF_BAD_ADDR; i++) { |
367 | if ((pci_resource_flags(pdev, i) & | 364 | if ((pci_resource_flags(pdev, i) & |
368 | IORESOURCE_MEM) && | 365 | IORESOURCE_MEM) && |
369 | (pci_resource_len(pdev, i) >= rsize)) | 366 | (pci_resource_len(pdev, i) >= rsize)) |
@@ -374,27 +371,33 @@ static void __init offb_init_nodriver(struct device_node *dp) | |||
374 | } | 371 | } |
375 | #endif /* CONFIG_PCI */ | 372 | #endif /* CONFIG_PCI */ |
376 | 373 | ||
377 | if (address == 0 && | 374 | /* This one is dodgy, we may drop it ... */ |
378 | (up = (unsigned *) get_property(dp, "address", &len)) != NULL && | 375 | if (address == OF_BAD_ADDR && |
379 | len == sizeof(unsigned)) | 376 | (up = (unsigned *) get_property(dp, "address", &len)) != NULL && |
380 | address = (u_long) * up; | 377 | len == sizeof(unsigned int)) |
381 | if (address == 0) { | 378 | address = (u64) * up; |
382 | for (i = 0; i < dp->n_addrs; ++i) | 379 | |
383 | if (dp->addrs[i].size >= | 380 | if (address == OF_BAD_ADDR) { |
384 | pitch * height * depth / 8) | 381 | for (i = 0; (addrp = of_get_address(dp, i, &asize, &flags)) |
385 | break; | 382 | != NULL; i++) { |
386 | if (i >= dp->n_addrs) { | 383 | if (!(flags & IORESOURCE_MEM)) |
384 | continue; | ||
385 | if (asize >= pitch * height * depth / 8) | ||
386 | break; | ||
387 | } | ||
388 | if (addrp == NULL) { | ||
387 | printk(KERN_ERR | 389 | printk(KERN_ERR |
388 | "no framebuffer address found for %s\n", | 390 | "no framebuffer address found for %s\n", |
389 | dp->full_name); | 391 | dp->full_name); |
390 | return; | 392 | return; |
391 | } | 393 | } |
392 | 394 | address = of_translate_address(dp, addrp); | |
393 | address = (u_long) dp->addrs[i].address; | 395 | if (address == OF_BAD_ADDR) { |
394 | 396 | printk(KERN_ERR | |
395 | #ifdef CONFIG_PPC64 | 397 | "can't translate framebuffer address for %s\n", |
396 | address += ((struct pci_dn *)dp->data)->phb->pci_mem_offset; | 398 | dp->full_name); |
397 | #endif | 399 | return; |
400 | } | ||
398 | 401 | ||
399 | /* kludge for valkyrie */ | 402 | /* kludge for valkyrie */ |
400 | if (strcmp(dp->name, "valkyrie") == 0) | 403 | if (strcmp(dp->name, "valkyrie") == 0) |
@@ -459,7 +462,9 @@ static void __init offb_init_fb(const char *name, const char *full_name, | |||
459 | 462 | ||
460 | par->cmap_type = cmap_unknown; | 463 | par->cmap_type = cmap_unknown; |
461 | if (depth == 8) { | 464 | if (depth == 8) { |
462 | /* XXX kludge for ati */ | 465 | |
466 | /* Palette hacks disabled for now */ | ||
467 | #if 0 | ||
463 | if (dp && !strncmp(name, "ATY,Rage128", 11)) { | 468 | if (dp && !strncmp(name, "ATY,Rage128", 11)) { |
464 | unsigned long regbase = dp->addrs[2].address; | 469 | unsigned long regbase = dp->addrs[2].address; |
465 | par->cmap_adr = ioremap(regbase, 0x1FFF); | 470 | par->cmap_adr = ioremap(regbase, 0x1FFF); |
@@ -490,6 +495,7 @@ static void __init offb_init_fb(const char *name, const char *full_name, | |||
490 | par->cmap_adr = ioremap(regbase + 0x6000, 0x1000); | 495 | par->cmap_adr = ioremap(regbase + 0x6000, 0x1000); |
491 | par->cmap_type = cmap_gxt2000; | 496 | par->cmap_type = cmap_gxt2000; |
492 | } | 497 | } |
498 | #endif | ||
493 | fix->visual = par->cmap_adr ? FB_VISUAL_PSEUDOCOLOR | 499 | fix->visual = par->cmap_adr ? FB_VISUAL_PSEUDOCOLOR |
494 | : FB_VISUAL_STATIC_PSEUDOCOLOR; | 500 | : FB_VISUAL_STATIC_PSEUDOCOLOR; |
495 | } else | 501 | } else |
diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c index ca4082ae5a1..335e3746555 100644 --- a/drivers/video/platinumfb.c +++ b/drivers/video/platinumfb.c | |||
@@ -69,6 +69,8 @@ struct fb_info_platinum { | |||
69 | unsigned long total_vram; | 69 | unsigned long total_vram; |
70 | int clktype; | 70 | int clktype; |
71 | int dactype; | 71 | int dactype; |
72 | |||
73 | struct resource rsrc_fb, rsrc_reg; | ||
72 | }; | 74 | }; |
73 | 75 | ||
74 | /* | 76 | /* |
@@ -97,9 +99,6 @@ static int platinum_var_to_par(struct fb_var_screeninfo *var, | |||
97 | * Interface used by the world | 99 | * Interface used by the world |
98 | */ | 100 | */ |
99 | 101 | ||
100 | int platinumfb_init(void); | ||
101 | int platinumfb_setup(char*); | ||
102 | |||
103 | static struct fb_ops platinumfb_ops = { | 102 | static struct fb_ops platinumfb_ops = { |
104 | .owner = THIS_MODULE, | 103 | .owner = THIS_MODULE, |
105 | .fb_check_var = platinumfb_check_var, | 104 | .fb_check_var = platinumfb_check_var, |
@@ -138,13 +137,15 @@ static int platinumfb_set_par (struct fb_info *info) | |||
138 | 137 | ||
139 | init = platinum_reg_init[pinfo->vmode-1]; | 138 | init = platinum_reg_init[pinfo->vmode-1]; |
140 | 139 | ||
141 | if (pinfo->vmode == 13 && pinfo->cmode > 0) | 140 | if ((pinfo->vmode == VMODE_832_624_75) && (pinfo->cmode > CMODE_8)) |
142 | offset = 0x10; | 141 | offset = 0x10; |
142 | |||
143 | info->screen_base = pinfo->frame_buffer + init->fb_offset + offset; | 143 | info->screen_base = pinfo->frame_buffer + init->fb_offset + offset; |
144 | info->fix.smem_start = (pinfo->frame_buffer_phys) + init->fb_offset + offset; | 144 | info->fix.smem_start = (pinfo->frame_buffer_phys) + init->fb_offset + offset; |
145 | info->fix.visual = (pinfo->cmode == CMODE_8) ? | 145 | info->fix.visual = (pinfo->cmode == CMODE_8) ? |
146 | FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR; | 146 | FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR; |
147 | info->fix.line_length = vmode_attrs[pinfo->vmode-1].hres * (1<<pinfo->cmode) + offset; | 147 | info->fix.line_length = vmode_attrs[pinfo->vmode-1].hres * (1<<pinfo->cmode) |
148 | + offset; | ||
148 | printk("line_length: %x\n", info->fix.line_length); | 149 | printk("line_length: %x\n", info->fix.line_length); |
149 | return 0; | 150 | return 0; |
150 | } | 151 | } |
@@ -221,7 +222,9 @@ static int platinumfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
221 | static inline int platinum_vram_reqd(int video_mode, int color_mode) | 222 | static inline int platinum_vram_reqd(int video_mode, int color_mode) |
222 | { | 223 | { |
223 | return vmode_attrs[video_mode-1].vres * | 224 | return vmode_attrs[video_mode-1].vres * |
224 | (vmode_attrs[video_mode-1].hres * (1<<color_mode) + 0x20) +0x1000; | 225 | (vmode_attrs[video_mode-1].hres * (1<<color_mode) + |
226 | ((video_mode == VMODE_832_624_75) && | ||
227 | (color_mode > CMODE_8)) ? 0x10 : 0x20) + 0x1000; | ||
225 | } | 228 | } |
226 | 229 | ||
227 | #define STORE_D2(a, d) { \ | 230 | #define STORE_D2(a, d) { \ |
@@ -481,7 +484,7 @@ static int platinum_var_to_par(struct fb_var_screeninfo *var, | |||
481 | /* | 484 | /* |
482 | * Parse user speficied options (`video=platinumfb:') | 485 | * Parse user speficied options (`video=platinumfb:') |
483 | */ | 486 | */ |
484 | int __init platinumfb_setup(char *options) | 487 | static int __init platinumfb_setup(char *options) |
485 | { | 488 | { |
486 | char *this_opt; | 489 | char *this_opt; |
487 | 490 | ||
@@ -522,19 +525,15 @@ int __init platinumfb_setup(char *options) | |||
522 | #define invalidate_cache(addr) | 525 | #define invalidate_cache(addr) |
523 | #endif | 526 | #endif |
524 | 527 | ||
525 | static int __devinit platinumfb_probe(struct of_device* odev, const struct of_device_id *match) | 528 | static int __devinit platinumfb_probe(struct of_device* odev, |
529 | const struct of_device_id *match) | ||
526 | { | 530 | { |
527 | struct device_node *dp = odev->node; | 531 | struct device_node *dp = odev->node; |
528 | struct fb_info *info; | 532 | struct fb_info *info; |
529 | struct fb_info_platinum *pinfo; | 533 | struct fb_info_platinum *pinfo; |
530 | unsigned long addr, size; | ||
531 | volatile __u8 *fbuffer; | 534 | volatile __u8 *fbuffer; |
532 | int i, bank0, bank1, bank2, bank3, rc; | 535 | int bank0, bank1, bank2, bank3, rc; |
533 | 536 | ||
534 | if (dp->n_addrs != 2) { | ||
535 | printk(KERN_ERR "expecting 2 address for platinum (got %d)", dp->n_addrs); | ||
536 | return -ENXIO; | ||
537 | } | ||
538 | printk(KERN_INFO "platinumfb: Found Apple Platinum video hardware\n"); | 537 | printk(KERN_INFO "platinumfb: Found Apple Platinum video hardware\n"); |
539 | 538 | ||
540 | info = framebuffer_alloc(sizeof(*pinfo), &odev->dev); | 539 | info = framebuffer_alloc(sizeof(*pinfo), &odev->dev); |
@@ -542,26 +541,39 @@ static int __devinit platinumfb_probe(struct of_device* odev, const struct of_de | |||
542 | return -ENOMEM; | 541 | return -ENOMEM; |
543 | pinfo = info->par; | 542 | pinfo = info->par; |
544 | 543 | ||
545 | /* Map in frame buffer and registers */ | 544 | if (of_address_to_resource(dp, 0, &pinfo->rsrc_reg) || |
546 | for (i = 0; i < dp->n_addrs; ++i) { | 545 | of_address_to_resource(dp, 1, &pinfo->rsrc_fb)) { |
547 | addr = dp->addrs[i].address; | 546 | printk(KERN_ERR "platinumfb: Can't get resources\n"); |
548 | size = dp->addrs[i].size; | 547 | framebuffer_release(info); |
549 | /* Let's assume we can request either all or nothing */ | 548 | return -ENXIO; |
550 | if (!request_mem_region(addr, size, "platinumfb")) { | ||
551 | framebuffer_release(info); | ||
552 | return -ENXIO; | ||
553 | } | ||
554 | if (size >= 0x400000) { | ||
555 | /* frame buffer - map only 4MB */ | ||
556 | pinfo->frame_buffer_phys = addr; | ||
557 | pinfo->frame_buffer = __ioremap(addr, 0x400000, _PAGE_WRITETHRU); | ||
558 | pinfo->base_frame_buffer = pinfo->frame_buffer; | ||
559 | } else { | ||
560 | /* registers */ | ||
561 | pinfo->platinum_regs_phys = addr; | ||
562 | pinfo->platinum_regs = ioremap(addr, size); | ||
563 | } | ||
564 | } | 549 | } |
550 | if (!request_mem_region(pinfo->rsrc_reg.start, | ||
551 | pinfo->rsrc_reg.start - | ||
552 | pinfo->rsrc_reg.end + 1, | ||
553 | "platinumfb registers")) { | ||
554 | framebuffer_release(info); | ||
555 | return -ENXIO; | ||
556 | } | ||
557 | if (!request_mem_region(pinfo->rsrc_fb.start, | ||
558 | pinfo->rsrc_fb.start | ||
559 | - pinfo->rsrc_fb.end + 1, | ||
560 | "platinumfb framebuffer")) { | ||
561 | release_mem_region(pinfo->rsrc_reg.start, | ||
562 | pinfo->rsrc_reg.end - | ||
563 | pinfo->rsrc_reg.start + 1); | ||
564 | framebuffer_release(info); | ||
565 | return -ENXIO; | ||
566 | } | ||
567 | |||
568 | /* frame buffer - map only 4MB */ | ||
569 | pinfo->frame_buffer_phys = pinfo->rsrc_fb.start; | ||
570 | pinfo->frame_buffer = __ioremap(pinfo->rsrc_fb.start, 0x400000, | ||
571 | _PAGE_WRITETHRU); | ||
572 | pinfo->base_frame_buffer = pinfo->frame_buffer; | ||
573 | |||
574 | /* registers */ | ||
575 | pinfo->platinum_regs_phys = pinfo->rsrc_reg.start; | ||
576 | pinfo->platinum_regs = ioremap(pinfo->rsrc_reg.start, 0x1000); | ||
565 | 577 | ||
566 | pinfo->cmap_regs_phys = 0xf301b000; /* XXX not in prom? */ | 578 | pinfo->cmap_regs_phys = 0xf301b000; /* XXX not in prom? */ |
567 | request_mem_region(pinfo->cmap_regs_phys, 0x1000, "platinumfb cmap"); | 579 | request_mem_region(pinfo->cmap_regs_phys, 0x1000, "platinumfb cmap"); |
@@ -624,18 +636,16 @@ static int __devexit platinumfb_remove(struct of_device* odev) | |||
624 | { | 636 | { |
625 | struct fb_info *info = dev_get_drvdata(&odev->dev); | 637 | struct fb_info *info = dev_get_drvdata(&odev->dev); |
626 | struct fb_info_platinum *pinfo = info->par; | 638 | struct fb_info_platinum *pinfo = info->par; |
627 | struct device_node *dp = odev->node; | ||
628 | unsigned long addr, size; | ||
629 | int i; | ||
630 | 639 | ||
631 | unregister_framebuffer (info); | 640 | unregister_framebuffer (info); |
632 | 641 | ||
633 | /* Unmap frame buffer and registers */ | 642 | /* Unmap frame buffer and registers */ |
634 | for (i = 0; i < dp->n_addrs; ++i) { | 643 | release_mem_region(pinfo->rsrc_fb.start, |
635 | addr = dp->addrs[i].address; | 644 | pinfo->rsrc_fb.end - |
636 | size = dp->addrs[i].size; | 645 | pinfo->rsrc_fb.start + 1); |
637 | release_mem_region(addr, size); | 646 | release_mem_region(pinfo->rsrc_reg.start, |
638 | } | 647 | pinfo->rsrc_reg.end - |
648 | pinfo->rsrc_reg.start + 1); | ||
639 | iounmap(pinfo->frame_buffer); | 649 | iounmap(pinfo->frame_buffer); |
640 | iounmap(pinfo->platinum_regs); | 650 | iounmap(pinfo->platinum_regs); |
641 | release_mem_region(pinfo->cmap_regs_phys, 0x1000); | 651 | release_mem_region(pinfo->cmap_regs_phys, 0x1000); |
@@ -662,7 +672,7 @@ static struct of_platform_driver platinum_driver = | |||
662 | .remove = platinumfb_remove, | 672 | .remove = platinumfb_remove, |
663 | }; | 673 | }; |
664 | 674 | ||
665 | int __init platinumfb_init(void) | 675 | static int __init platinumfb_init(void) |
666 | { | 676 | { |
667 | #ifndef MODULE | 677 | #ifndef MODULE |
668 | char *option = NULL; | 678 | char *option = NULL; |
@@ -676,7 +686,7 @@ int __init platinumfb_init(void) | |||
676 | return 0; | 686 | return 0; |
677 | } | 687 | } |
678 | 688 | ||
679 | void __exit platinumfb_exit(void) | 689 | static void __exit platinumfb_exit(void) |
680 | { | 690 | { |
681 | of_unregister_driver(&platinum_driver); | 691 | of_unregister_driver(&platinum_driver); |
682 | } | 692 | } |
diff --git a/drivers/video/platinumfb.h b/drivers/video/platinumfb.h index 2834fc1c344..f6bd77cafd1 100644 --- a/drivers/video/platinumfb.h +++ b/drivers/video/platinumfb.h | |||
@@ -158,7 +158,9 @@ static struct platinum_regvals platinum_reg_init_14 = { | |||
158 | /* 832x624, 75Hz (13) */ | 158 | /* 832x624, 75Hz (13) */ |
159 | static struct platinum_regvals platinum_reg_init_13 = { | 159 | static struct platinum_regvals platinum_reg_init_13 = { |
160 | 0x70, | 160 | 0x70, |
161 | { 864, 1680, 3360 }, /* MacOS does 1680 instead of 1696 to fit 16bpp in 1MB */ | 161 | { 864, 1680, 3344 }, /* MacOS does 1680 instead of 1696 to fit 16bpp in 1MB, |
162 | * and we use 3344 instead of 3360 to fit in 2Mb | ||
163 | */ | ||
162 | { 0xff0, 4, 0, 0, 0, 0, 0x299, 0, | 164 | { 0xff0, 4, 0, 0, 0, 0, 0x299, 0, |
163 | 0, 0x21e, 0x120, 0x10, 0x23f, 0x1f, 0x25, 0x37, | 165 | 0, 0x21e, 0x120, 0x10, 0x23f, 0x1f, 0x25, 0x37, |
164 | 0x8a, 0x22a, 0x23e, 0x536, 0x534, 4, 9, 0x52, | 166 | 0x8a, 0x22a, 0x23e, 0x536, 0x534, 4, 9, 0x52, |
diff --git a/drivers/video/valkyriefb.c b/drivers/video/valkyriefb.c index ce97ec8eae9..2bdeb4baa95 100644 --- a/drivers/video/valkyriefb.c +++ b/drivers/video/valkyriefb.c | |||
@@ -342,19 +342,19 @@ int __init valkyriefb_init(void) | |||
342 | #else /* ppc (!CONFIG_MAC) */ | 342 | #else /* ppc (!CONFIG_MAC) */ |
343 | { | 343 | { |
344 | struct device_node *dp; | 344 | struct device_node *dp; |
345 | struct resource r; | ||
345 | 346 | ||
346 | dp = find_devices("valkyrie"); | 347 | dp = of_find_node_by_name(NULL, "valkyrie"); |
347 | if (dp == 0) | 348 | if (dp == 0) |
348 | return 0; | 349 | return 0; |
349 | 350 | ||
350 | if (dp->n_addrs != 1) { | 351 | if (of_address_to_resource(dp, 0, &r)) { |
351 | printk(KERN_ERR "expecting 1 address for valkyrie (got %d)\n", | 352 | printk(KERN_ERR "can't find address for valkyrie\n"); |
352 | dp->n_addrs); | ||
353 | return 0; | 353 | return 0; |
354 | } | 354 | } |
355 | 355 | ||
356 | frame_buffer_phys = dp->addrs[0].address; | 356 | frame_buffer_phys = r.start; |
357 | cmap_regs_phys = dp->addrs[0].address+0x304000; | 357 | cmap_regs_phys = r.start + 0x304000; |
358 | flags = _PAGE_WRITETHRU; | 358 | flags = _PAGE_WRITETHRU; |
359 | } | 359 | } |
360 | #endif /* ppc (!CONFIG_MAC) */ | 360 | #endif /* ppc (!CONFIG_MAC) */ |