diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2005-12-13 02:01:21 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-01-08 22:53:55 -0500 |
commit | cc5d0189b9ba95260857a5018a1c2fef90008507 (patch) | |
tree | 1202c94b6b3cb81a96d0a0e54424cad10eef68bb /drivers/video | |
parent | 9cf84d7c97992dbe5360b241327341c07ce30fc9 (diff) |
[PATCH] powerpc: Remove device_node addrs/n_addr
The pre-parsed addrs/n_addrs fields in struct device_node are finally
gone. Remove the dodgy heuristics that did that parsing at boot and
remove the fields themselves since we now have a good replacement with
the new OF parsing code. This patch also fixes a bunch of drivers to use
the new code instead, so that at least pmac32, pseries, iseries and g5
defconfigs build.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
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 | 86 | ||||
-rw-r--r-- | drivers/video/valkyriefb.c | 12 |
4 files changed, 166 insertions, 168 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, | |||
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 00d87f5bb7be..ad1434e3f227 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 ba0af1b66bb6..335e37465559 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, |
@@ -485,7 +484,7 @@ static int platinum_var_to_par(struct fb_var_screeninfo *var, | |||
485 | /* | 484 | /* |
486 | * Parse user speficied options (`video=platinumfb:') | 485 | * Parse user speficied options (`video=platinumfb:') |
487 | */ | 486 | */ |
488 | int __init platinumfb_setup(char *options) | 487 | static int __init platinumfb_setup(char *options) |
489 | { | 488 | { |
490 | char *this_opt; | 489 | char *this_opt; |
491 | 490 | ||
@@ -526,19 +525,15 @@ int __init platinumfb_setup(char *options) | |||
526 | #define invalidate_cache(addr) | 525 | #define invalidate_cache(addr) |
527 | #endif | 526 | #endif |
528 | 527 | ||
529 | 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) | ||
530 | { | 530 | { |
531 | struct device_node *dp = odev->node; | 531 | struct device_node *dp = odev->node; |
532 | struct fb_info *info; | 532 | struct fb_info *info; |
533 | struct fb_info_platinum *pinfo; | 533 | struct fb_info_platinum *pinfo; |
534 | unsigned long addr, size; | ||
535 | volatile __u8 *fbuffer; | 534 | volatile __u8 *fbuffer; |
536 | int i, bank0, bank1, bank2, bank3, rc; | 535 | int bank0, bank1, bank2, bank3, rc; |
537 | 536 | ||
538 | if (dp->n_addrs != 2) { | ||
539 | printk(KERN_ERR "expecting 2 address for platinum (got %d)", dp->n_addrs); | ||
540 | return -ENXIO; | ||
541 | } | ||
542 | printk(KERN_INFO "platinumfb: Found Apple Platinum video hardware\n"); | 537 | printk(KERN_INFO "platinumfb: Found Apple Platinum video hardware\n"); |
543 | 538 | ||
544 | info = framebuffer_alloc(sizeof(*pinfo), &odev->dev); | 539 | info = framebuffer_alloc(sizeof(*pinfo), &odev->dev); |
@@ -546,26 +541,39 @@ static int __devinit platinumfb_probe(struct of_device* odev, const struct of_de | |||
546 | return -ENOMEM; | 541 | return -ENOMEM; |
547 | pinfo = info->par; | 542 | pinfo = info->par; |
548 | 543 | ||
549 | /* Map in frame buffer and registers */ | 544 | if (of_address_to_resource(dp, 0, &pinfo->rsrc_reg) || |
550 | for (i = 0; i < dp->n_addrs; ++i) { | 545 | of_address_to_resource(dp, 1, &pinfo->rsrc_fb)) { |
551 | addr = dp->addrs[i].address; | 546 | printk(KERN_ERR "platinumfb: Can't get resources\n"); |
552 | size = dp->addrs[i].size; | 547 | framebuffer_release(info); |
553 | /* Let's assume we can request either all or nothing */ | 548 | return -ENXIO; |
554 | if (!request_mem_region(addr, size, "platinumfb")) { | ||
555 | framebuffer_release(info); | ||
556 | return -ENXIO; | ||
557 | } | ||
558 | if (size >= 0x400000) { | ||
559 | /* frame buffer - map only 4MB */ | ||
560 | pinfo->frame_buffer_phys = addr; | ||
561 | pinfo->frame_buffer = __ioremap(addr, 0x400000, _PAGE_WRITETHRU); | ||
562 | pinfo->base_frame_buffer = pinfo->frame_buffer; | ||
563 | } else { | ||
564 | /* registers */ | ||
565 | pinfo->platinum_regs_phys = addr; | ||
566 | pinfo->platinum_regs = ioremap(addr, size); | ||
567 | } | ||
568 | } | 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); | ||
569 | 577 | ||
570 | pinfo->cmap_regs_phys = 0xf301b000; /* XXX not in prom? */ | 578 | pinfo->cmap_regs_phys = 0xf301b000; /* XXX not in prom? */ |
571 | request_mem_region(pinfo->cmap_regs_phys, 0x1000, "platinumfb cmap"); | 579 | request_mem_region(pinfo->cmap_regs_phys, 0x1000, "platinumfb cmap"); |
@@ -628,18 +636,16 @@ static int __devexit platinumfb_remove(struct of_device* odev) | |||
628 | { | 636 | { |
629 | struct fb_info *info = dev_get_drvdata(&odev->dev); | 637 | struct fb_info *info = dev_get_drvdata(&odev->dev); |
630 | struct fb_info_platinum *pinfo = info->par; | 638 | struct fb_info_platinum *pinfo = info->par; |
631 | struct device_node *dp = odev->node; | ||
632 | unsigned long addr, size; | ||
633 | int i; | ||
634 | 639 | ||
635 | unregister_framebuffer (info); | 640 | unregister_framebuffer (info); |
636 | 641 | ||
637 | /* Unmap frame buffer and registers */ | 642 | /* Unmap frame buffer and registers */ |
638 | for (i = 0; i < dp->n_addrs; ++i) { | 643 | release_mem_region(pinfo->rsrc_fb.start, |
639 | addr = dp->addrs[i].address; | 644 | pinfo->rsrc_fb.end - |
640 | size = dp->addrs[i].size; | 645 | pinfo->rsrc_fb.start + 1); |
641 | release_mem_region(addr, size); | 646 | release_mem_region(pinfo->rsrc_reg.start, |
642 | } | 647 | pinfo->rsrc_reg.end - |
648 | pinfo->rsrc_reg.start + 1); | ||
643 | iounmap(pinfo->frame_buffer); | 649 | iounmap(pinfo->frame_buffer); |
644 | iounmap(pinfo->platinum_regs); | 650 | iounmap(pinfo->platinum_regs); |
645 | release_mem_region(pinfo->cmap_regs_phys, 0x1000); | 651 | release_mem_region(pinfo->cmap_regs_phys, 0x1000); |
@@ -666,7 +672,7 @@ static struct of_platform_driver platinum_driver = | |||
666 | .remove = platinumfb_remove, | 672 | .remove = platinumfb_remove, |
667 | }; | 673 | }; |
668 | 674 | ||
669 | int __init platinumfb_init(void) | 675 | static int __init platinumfb_init(void) |
670 | { | 676 | { |
671 | #ifndef MODULE | 677 | #ifndef MODULE |
672 | char *option = NULL; | 678 | char *option = NULL; |
@@ -680,7 +686,7 @@ int __init platinumfb_init(void) | |||
680 | return 0; | 686 | return 0; |
681 | } | 687 | } |
682 | 688 | ||
683 | void __exit platinumfb_exit(void) | 689 | static void __exit platinumfb_exit(void) |
684 | { | 690 | { |
685 | of_unregister_driver(&platinum_driver); | 691 | of_unregister_driver(&platinum_driver); |
686 | } | 692 | } |
diff --git a/drivers/video/valkyriefb.c b/drivers/video/valkyriefb.c index ce97ec8eae97..2bdeb4baa952 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) */ |