Lines Matching +full:ati +full:- +full:base

2  *  linux/drivers/video/offb.c -- Open Firmware based frame buffer device
42 cmap_simple, /* ATI Mach64 */
43 cmap_r128, /* ATI Rage128 */
44 cmap_M3A, /* ATI Rage Mobility M3 Head A */
45 cmap_M3B, /* ATI Rage Mobility M3 Head B */
46 cmap_radeon, /* ATI Radeon */
48 cmap_avivo, /* ATI R5xx */
58 resource_size_t base; member
102 struct offb_par *par = (struct offb_par *) info->par; in offb_setcolreg()
104 if (info->fix.visual == FB_VISUAL_TRUECOLOR) { in offb_setcolreg()
105 u32 *pal = info->pseudo_palette; in offb_setcolreg()
106 u32 cr = red >> (16 - info->var.red.length); in offb_setcolreg()
107 u32 cg = green >> (16 - info->var.green.length); in offb_setcolreg()
108 u32 cb = blue >> (16 - info->var.blue.length); in offb_setcolreg()
112 return -EINVAL; in offb_setcolreg()
114 value = (cr << info->var.red.offset) | in offb_setcolreg()
115 (cg << info->var.green.offset) | in offb_setcolreg()
116 (cb << info->var.blue.offset); in offb_setcolreg()
117 if (info->var.transp.length > 0) { in offb_setcolreg()
118 u32 mask = (1 << info->var.transp.length) - 1; in offb_setcolreg()
119 mask <<= info->var.transp.offset; in offb_setcolreg()
127 return -EINVAL; in offb_setcolreg()
133 if (!par->cmap_adr) in offb_setcolreg()
136 switch (par->cmap_type) { in offb_setcolreg()
138 writeb(regno, par->cmap_adr); in offb_setcolreg()
139 writeb(red, par->cmap_data); in offb_setcolreg()
140 writeb(green, par->cmap_data); in offb_setcolreg()
141 writeb(blue, par->cmap_data); in offb_setcolreg()
145 out_le32(par->cmap_adr + 0x58, in offb_setcolreg()
146 in_le32(par->cmap_adr + 0x58) & ~0x20); in offb_setcolreg()
150 out_8(par->cmap_adr + 0xb0, regno); in offb_setcolreg()
151 out_le32(par->cmap_adr + 0xb4, in offb_setcolreg()
156 out_le32(par->cmap_adr + 0x58, in offb_setcolreg()
157 in_le32(par->cmap_adr + 0x58) | 0x20); in offb_setcolreg()
159 out_8(par->cmap_adr + 0xb0, regno); in offb_setcolreg()
160 out_le32(par->cmap_adr + 0xb4, (red << 16 | green << 8 | blue)); in offb_setcolreg()
164 out_8(par->cmap_adr + 0xb0, regno); in offb_setcolreg()
165 out_le32(par->cmap_adr + 0xb4, (red << 16 | green << 8 | blue)); in offb_setcolreg()
168 out_le32(((unsigned __iomem *) par->cmap_adr) + regno, in offb_setcolreg()
173 writel(1, par->cmap_adr + AVIVO_DC_LUT_RW_SELECT); in offb_setcolreg()
174 writeb(regno, par->cmap_adr + AVIVO_DC_LUT_RW_INDEX); in offb_setcolreg()
176 par->cmap_adr + AVIVO_DC_LUT_30_COLOR); in offb_setcolreg()
177 writel(0, par->cmap_adr + AVIVO_DC_LUT_RW_SELECT); in offb_setcolreg()
178 writeb(regno, par->cmap_adr + AVIVO_DC_LUT_RW_INDEX); in offb_setcolreg()
180 par->cmap_adr + AVIVO_DC_LUT_30_COLOR); in offb_setcolreg()
193 struct offb_par *par = (struct offb_par *) info->par; in offb_blank()
196 if (!par->cmap_adr) in offb_blank()
199 if (!par->blanked) in offb_blank()
203 par->blanked = blank; in offb_blank()
207 switch (par->cmap_type) { in offb_blank()
209 writeb(i, par->cmap_adr); in offb_blank()
211 writeb(0, par->cmap_data); in offb_blank()
215 out_le32(par->cmap_adr + 0x58, in offb_blank()
216 in_le32(par->cmap_adr + 0x58) & ~0x20); in offb_blank()
220 out_8(par->cmap_adr + 0xb0, i); in offb_blank()
221 out_le32(par->cmap_adr + 0xb4, 0); in offb_blank()
225 out_le32(par->cmap_adr + 0x58, in offb_blank()
226 in_le32(par->cmap_adr + 0x58) | 0x20); in offb_blank()
228 out_8(par->cmap_adr + 0xb0, i); in offb_blank()
229 out_le32(par->cmap_adr + 0xb4, 0); in offb_blank()
232 out_8(par->cmap_adr + 0xb0, i); in offb_blank()
233 out_le32(par->cmap_adr + 0xb4, 0); in offb_blank()
236 out_le32(((unsigned __iomem *) par->cmap_adr) + i, in offb_blank()
240 writel(1, par->cmap_adr + AVIVO_DC_LUT_RW_SELECT); in offb_blank()
241 writeb(i, par->cmap_adr + AVIVO_DC_LUT_RW_INDEX); in offb_blank()
242 writel(0, par->cmap_adr + AVIVO_DC_LUT_30_COLOR); in offb_blank()
243 writel(0, par->cmap_adr + AVIVO_DC_LUT_RW_SELECT); in offb_blank()
244 writeb(i, par->cmap_adr + AVIVO_DC_LUT_RW_INDEX); in offb_blank()
245 writel(0, par->cmap_adr + AVIVO_DC_LUT_30_COLOR); in offb_blank()
249 fb_set_cmap(&info->cmap, info); in offb_blank()
255 struct offb_par *par = (struct offb_par *) info->par; in offb_set_par()
258 if (par->cmap_type == cmap_avivo) { in offb_set_par()
259 writel(0, par->cmap_adr + AVIVO_DC_LUTA_CONTROL); in offb_set_par()
260 writel(0, par->cmap_adr + AVIVO_DC_LUTA_BLACK_OFFSET_BLUE); in offb_set_par()
261 writel(0, par->cmap_adr + AVIVO_DC_LUTA_BLACK_OFFSET_GREEN); in offb_set_par()
262 writel(0, par->cmap_adr + AVIVO_DC_LUTA_BLACK_OFFSET_RED); in offb_set_par()
263 writel(0x0000ffff, par->cmap_adr + AVIVO_DC_LUTA_WHITE_OFFSET_BLUE); in offb_set_par()
264 writel(0x0000ffff, par->cmap_adr + AVIVO_DC_LUTA_WHITE_OFFSET_GREEN); in offb_set_par()
265 writel(0x0000ffff, par->cmap_adr + AVIVO_DC_LUTA_WHITE_OFFSET_RED); in offb_set_par()
266 writel(0, par->cmap_adr + AVIVO_DC_LUTB_CONTROL); in offb_set_par()
267 writel(0, par->cmap_adr + AVIVO_DC_LUTB_BLACK_OFFSET_BLUE); in offb_set_par()
268 writel(0, par->cmap_adr + AVIVO_DC_LUTB_BLACK_OFFSET_GREEN); in offb_set_par()
269 writel(0, par->cmap_adr + AVIVO_DC_LUTB_BLACK_OFFSET_RED); in offb_set_par()
270 writel(0x0000ffff, par->cmap_adr + AVIVO_DC_LUTB_WHITE_OFFSET_BLUE); in offb_set_par()
271 writel(0x0000ffff, par->cmap_adr + AVIVO_DC_LUTB_WHITE_OFFSET_GREEN); in offb_set_par()
272 writel(0x0000ffff, par->cmap_adr + AVIVO_DC_LUTB_WHITE_OFFSET_RED); in offb_set_par()
273 writel(1, par->cmap_adr + AVIVO_DC_LUT_RW_SELECT); in offb_set_par()
274 writel(0, par->cmap_adr + AVIVO_DC_LUT_RW_MODE); in offb_set_par()
275 writel(0x0000003f, par->cmap_adr + AVIVO_DC_LUT_WRITE_EN_MASK); in offb_set_par()
276 writel(0, par->cmap_adr + AVIVO_DC_LUT_RW_SELECT); in offb_set_par()
277 writel(0, par->cmap_adr + AVIVO_DC_LUT_RW_MODE); in offb_set_par()
278 writel(0x0000003f, par->cmap_adr + AVIVO_DC_LUT_WRITE_EN_MASK); in offb_set_par()
285 struct offb_par *par = info->par; in offb_destroy()
287 if (info->screen_base) in offb_destroy()
288 iounmap(info->screen_base); in offb_destroy()
289 release_mem_region(par->base, par->size); in offb_destroy()
290 fb_dealloc_cmap(&info->cmap); in offb_destroy()
328 struct offb_par *par = (struct offb_par *) info->par; in offb_init_palette_hacks()
331 par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff); in offb_init_palette_hacks()
332 if (par->cmap_adr) in offb_init_palette_hacks()
333 par->cmap_type = cmap_r128; in offb_init_palette_hacks()
336 par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff); in offb_init_palette_hacks()
337 if (par->cmap_adr) in offb_init_palette_hacks()
338 par->cmap_type = cmap_M3A; in offb_init_palette_hacks()
340 par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff); in offb_init_palette_hacks()
341 if (par->cmap_adr) in offb_init_palette_hacks()
342 par->cmap_type = cmap_M3B; in offb_init_palette_hacks()
344 par->cmap_adr = offb_map_reg(dp, 1, 0, 0x1fff); in offb_init_palette_hacks()
345 if (par->cmap_adr) in offb_init_palette_hacks()
346 par->cmap_type = cmap_radeon; in offb_init_palette_hacks()
348 unsigned long base = address & 0xff000000UL; in offb_init_palette_hacks() local
349 par->cmap_adr = in offb_init_palette_hacks()
350 ioremap(base + 0x7ff000, 0x1000) + 0xcc0; in offb_init_palette_hacks()
351 par->cmap_data = par->cmap_adr + 1; in offb_init_palette_hacks()
352 par->cmap_type = cmap_simple; in offb_init_palette_hacks()
355 par->cmap_adr = offb_map_reg(dp, 0, 0x6000, 0x1000); in offb_init_palette_hacks()
356 if (par->cmap_adr) in offb_init_palette_hacks()
357 par->cmap_type = cmap_gxt2000; in offb_init_palette_hacks()
358 } else if (of_node_name_prefix(dp, "vga,Display-")) { in offb_init_palette_hacks()
362 vid = of_get_property(pciparent, "vendor-id", NULL); in offb_init_palette_hacks()
363 did = of_get_property(pciparent, "device-id", NULL); in offb_init_palette_hacks()
368 par->cmap_adr = offb_map_reg(pciparent, 2, 0, 0x10000); in offb_init_palette_hacks()
369 if (par->cmap_adr) in offb_init_palette_hacks()
370 par->cmap_type = cmap_avivo; in offb_init_palette_hacks()
372 } else if (dp && of_device_is_compatible(dp, "qemu,std-vga")) { in offb_init_palette_hacks()
380 par->cmap_adr = ioremap(io_addr + 0x3c8, 2); in offb_init_palette_hacks()
381 if (par->cmap_adr) { in offb_init_palette_hacks()
382 par->cmap_type = cmap_simple; in offb_init_palette_hacks()
383 par->cmap_data = par->cmap_adr + 1; in offb_init_palette_hacks()
387 info->fix.visual = (par->cmap_type != cmap_unknown) ? in offb_init_palette_hacks()
415 info = framebuffer_alloc(sizeof(*par), &parent->dev); in offb_init_fb()
421 par = info->par; in offb_init_fb()
422 fix = &info->fix; in offb_init_fb()
423 var = &info->var; in offb_init_fb()
426 snprintf(fix->id, sizeof(fix->id), "OFfb %s", name); in offb_init_fb()
428 snprintf(fix->id, sizeof(fix->id), "OFfb %pOFn", dp); in offb_init_fb()
431 var->xres = var->xres_virtual = width; in offb_init_fb()
432 var->yres = var->yres_virtual = height; in offb_init_fb()
433 fix->line_length = pitch; in offb_init_fb()
435 fix->smem_start = address; in offb_init_fb()
436 fix->smem_len = pitch * height; in offb_init_fb()
437 fix->type = FB_TYPE_PACKED_PIXELS; in offb_init_fb()
438 fix->type_aux = 0; in offb_init_fb()
440 par->cmap_type = cmap_unknown; in offb_init_fb()
444 fix->visual = FB_VISUAL_TRUECOLOR; in offb_init_fb()
446 var->xoffset = var->yoffset = 0; in offb_init_fb()
449 var->bits_per_pixel = 8; in offb_init_fb()
450 var->red.offset = 0; in offb_init_fb()
451 var->red.length = 8; in offb_init_fb()
452 var->green.offset = 0; in offb_init_fb()
453 var->green.length = 8; in offb_init_fb()
454 var->blue.offset = 0; in offb_init_fb()
455 var->blue.length = 8; in offb_init_fb()
456 var->transp.offset = 0; in offb_init_fb()
457 var->transp.length = 0; in offb_init_fb()
460 var->bits_per_pixel = 16; in offb_init_fb()
461 var->red.offset = 10; in offb_init_fb()
462 var->red.length = 5; in offb_init_fb()
463 var->green.offset = 5; in offb_init_fb()
464 var->green.length = 5; in offb_init_fb()
465 var->blue.offset = 0; in offb_init_fb()
466 var->blue.length = 5; in offb_init_fb()
467 var->transp.offset = 0; in offb_init_fb()
468 var->transp.length = 0; in offb_init_fb()
471 var->bits_per_pixel = 16; in offb_init_fb()
472 var->red.offset = 11; in offb_init_fb()
473 var->red.length = 5; in offb_init_fb()
474 var->green.offset = 5; in offb_init_fb()
475 var->green.length = 6; in offb_init_fb()
476 var->blue.offset = 0; in offb_init_fb()
477 var->blue.length = 5; in offb_init_fb()
478 var->transp.offset = 0; in offb_init_fb()
479 var->transp.length = 0; in offb_init_fb()
482 var->bits_per_pixel = 32; in offb_init_fb()
483 var->red.offset = 16; in offb_init_fb()
484 var->red.length = 8; in offb_init_fb()
485 var->green.offset = 8; in offb_init_fb()
486 var->green.length = 8; in offb_init_fb()
487 var->blue.offset = 0; in offb_init_fb()
488 var->blue.length = 8; in offb_init_fb()
489 var->transp.offset = 24; in offb_init_fb()
490 var->transp.length = 8; in offb_init_fb()
493 var->red.msb_right = var->green.msb_right = var->blue.msb_right = in offb_init_fb()
494 var->transp.msb_right = 0; in offb_init_fb()
495 var->grayscale = 0; in offb_init_fb()
496 var->nonstd = 0; in offb_init_fb()
497 var->activate = 0; in offb_init_fb()
498 var->height = var->width = -1; in offb_init_fb()
499 var->pixclock = 10000; in offb_init_fb()
500 var->left_margin = var->right_margin = 16; in offb_init_fb()
501 var->upper_margin = var->lower_margin = 16; in offb_init_fb()
502 var->hsync_len = var->vsync_len = 8; in offb_init_fb()
503 var->sync = 0; in offb_init_fb()
504 var->vmode = FB_VMODE_NONINTERLACED; in offb_init_fb()
506 par->base = address; in offb_init_fb()
507 par->size = fix->smem_len; in offb_init_fb()
509 info->fbops = &offb_ops; in offb_init_fb()
510 info->screen_base = ioremap(address, fix->smem_len); in offb_init_fb()
511 info->pseudo_palette = par->pseudo_palette; in offb_init_fb()
512 info->flags = foreign_endian; in offb_init_fb()
514 fb_alloc_cmap(&info->cmap, 256, 0); in offb_init_fb()
516 if (devm_aperture_acquire_for_platform_device(parent, par->base, par->size) < 0) in offb_init_fb()
525 fb_dealloc_cmap(&info->cmap); in offb_init_fb()
526 iounmap(info->screen_base); in offb_init_fb()
527 iounmap(par->cmap_adr); in offb_init_fb()
528 par->cmap_adr = NULL; in offb_init_fb()
547 if (of_property_read_bool(dp, "little-endian")) in offb_init_nodriver()
550 if (of_property_read_bool(dp, "big-endian")) in offb_init_nodriver()
554 pp = of_get_property(dp, "linux,bootx-depth", &len); in offb_init_nodriver()
560 pp = of_get_property(dp, "linux,bootx-width", &len); in offb_init_nodriver()
566 pp = of_get_property(dp, "linux,bootx-height", &len); in offb_init_nodriver()
572 pp = of_get_property(dp, "linux,bootx-linebytes", &len); in offb_init_nodriver()
592 up = of_get_property(dp, "linux,bootx-addr", &len); in offb_init_nodriver()
637 vidp = of_get_property(dp, "vendor-id", NULL); in offb_init_nodriver()
638 didp = of_get_property(dp, "device-id", NULL); in offb_init_nodriver()
673 .name = "bootx-noscreen",
681 offb_init_nodriver(pdev, pdev->dev.of_node, 0); in offb_probe_display()
694 .name = "of-display",
704 return -ENODEV; in offb_init()