Lines Matching +full:pci +full:- +full:ep
1 /* sunxvr500.c: Sun 3DLABS XVR-500 Expert3D fb driver for sparc64 systems
11 #include <linux/pci.h>
17 /* XXX This device has a 'dev-comm' property which apparently is
22 * XXX as the values in the 'dev-comm' area are accurate then
56 static int e3d_get_props(struct e3d_info *ep) in e3d_get_props() argument
58 ep->width = of_getintprop_default(ep->of_node, "width", 0); in e3d_get_props()
59 ep->height = of_getintprop_default(ep->of_node, "height", 0); in e3d_get_props()
60 ep->depth = of_getintprop_default(ep->of_node, "depth", 8); in e3d_get_props()
62 if (!ep->width || !ep->height) { in e3d_get_props()
64 pci_name(ep->pdev)); in e3d_get_props()
65 return -EINVAL; in e3d_get_props()
71 /* My XVR-500 comes up, at 1280x768 and a FB base register value of
85 #define RAMDAC_VID_WH 0x00000070UL /* (height-1)<<16 | (width-1) */
87 #define RAMDAC_VID_32FB_0 0x00000078UL /* PCI base 32bpp FB buffer 0 */
88 #define RAMDAC_VID_32FB_1 0x0000007cUL /* PCI base 32bpp FB buffer 1 */
89 #define RAMDAC_VID_8FB_0 0x00000080UL /* PCI base 8bpp FB buffer 0 */
90 #define RAMDAC_VID_8FB_1 0x00000084UL /* PCI base 8bpp FB buffer 1 */
91 #define RAMDAC_VID_XXXFB 0x00000088UL /* PCI base of XXX FB */
92 #define RAMDAC_VID_YYYFB 0x0000008cUL /* PCI base of YYY FB */
93 #define RAMDAC_VID_ZZZFB 0x00000090UL /* PCI base of ZZZ FB */
99 static void e3d_clut_write(struct e3d_info *ep, int index, u32 val) in e3d_clut_write() argument
101 void __iomem *ramdac = ep->ramdac; in e3d_clut_write()
104 spin_lock_irqsave(&ep->lock, flags); in e3d_clut_write()
109 spin_unlock_irqrestore(&ep->lock, flags); in e3d_clut_write()
116 struct e3d_info *ep = info->par; in e3d_setcolreg() local
130 if (info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 16) in e3d_setcolreg()
131 ((u32 *)info->pseudo_palette)[regno] = value; in e3d_setcolreg()
139 e3d_clut_write(ep, regno, value); in e3d_setcolreg()
153 struct e3d_info *ep = info->par; in e3d_imageblit() local
156 spin_lock_irqsave(&ep->lock, flags); in e3d_imageblit()
158 info->screen_base += ep->fb8_buf_diff; in e3d_imageblit()
160 info->screen_base -= ep->fb8_buf_diff; in e3d_imageblit()
161 spin_unlock_irqrestore(&ep->lock, flags); in e3d_imageblit()
166 struct e3d_info *ep = info->par; in e3d_fillrect() local
169 spin_lock_irqsave(&ep->lock, flags); in e3d_fillrect()
171 info->screen_base += ep->fb8_buf_diff; in e3d_fillrect()
173 info->screen_base -= ep->fb8_buf_diff; in e3d_fillrect()
174 spin_unlock_irqrestore(&ep->lock, flags); in e3d_fillrect()
179 struct e3d_info *ep = info->par; in e3d_copyarea() local
182 spin_lock_irqsave(&ep->lock, flags); in e3d_copyarea()
184 info->screen_base += ep->fb8_buf_diff; in e3d_copyarea()
186 info->screen_base -= ep->fb8_buf_diff; in e3d_copyarea()
187 spin_unlock_irqrestore(&ep->lock, flags); in e3d_copyarea()
200 static int e3d_set_fbinfo(struct e3d_info *ep) in e3d_set_fbinfo() argument
202 struct fb_info *info = ep->info; in e3d_set_fbinfo()
203 struct fb_var_screeninfo *var = &info->var; in e3d_set_fbinfo()
205 info->fbops = &e3d_ops; in e3d_set_fbinfo()
206 info->screen_base = ep->fb_base; in e3d_set_fbinfo()
207 info->screen_size = ep->fb_size; in e3d_set_fbinfo()
209 info->pseudo_palette = ep->pseudo_palette; in e3d_set_fbinfo()
212 strscpy(info->fix.id, "e3d", sizeof(info->fix.id)); in e3d_set_fbinfo()
213 info->fix.smem_start = ep->fb_base_phys; in e3d_set_fbinfo()
214 info->fix.smem_len = ep->fb_size; in e3d_set_fbinfo()
215 info->fix.type = FB_TYPE_PACKED_PIXELS; in e3d_set_fbinfo()
216 if (ep->depth == 32 || ep->depth == 24) in e3d_set_fbinfo()
217 info->fix.visual = FB_VISUAL_TRUECOLOR; in e3d_set_fbinfo()
219 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; in e3d_set_fbinfo()
221 var->xres = ep->width; in e3d_set_fbinfo()
222 var->yres = ep->height; in e3d_set_fbinfo()
223 var->xres_virtual = var->xres; in e3d_set_fbinfo()
224 var->yres_virtual = var->yres; in e3d_set_fbinfo()
225 var->bits_per_pixel = ep->depth; in e3d_set_fbinfo()
227 var->red.offset = 8; in e3d_set_fbinfo()
228 var->red.length = 8; in e3d_set_fbinfo()
229 var->green.offset = 16; in e3d_set_fbinfo()
230 var->green.length = 8; in e3d_set_fbinfo()
231 var->blue.offset = 24; in e3d_set_fbinfo()
232 var->blue.length = 8; in e3d_set_fbinfo()
233 var->transp.offset = 0; in e3d_set_fbinfo()
234 var->transp.length = 0; in e3d_set_fbinfo()
236 if (fb_alloc_cmap(&info->cmap, 256, 0)) { in e3d_set_fbinfo()
238 return -ENOMEM; in e3d_set_fbinfo()
250 struct e3d_info *ep; in e3d_pci_register() local
262 return -ENODEV; in e3d_pci_register()
269 return -ENODEV; in e3d_pci_register()
274 printk(KERN_ERR "e3d: Cannot enable PCI device %s\n", in e3d_pci_register()
279 info = framebuffer_alloc(sizeof(struct e3d_info), &pdev->dev); in e3d_pci_register()
281 err = -ENOMEM; in e3d_pci_register()
285 ep = info->par; in e3d_pci_register()
286 ep->info = info; in e3d_pci_register()
287 ep->pdev = pdev; in e3d_pci_register()
288 spin_lock_init(&ep->lock); in e3d_pci_register()
289 ep->of_node = of_node; in e3d_pci_register()
291 /* Read the PCI base register of the frame buffer, which we in e3d_pci_register()
296 &ep->fb_base_reg); in e3d_pci_register()
297 ep->fb_base_reg &= PCI_BASE_ADDRESS_MEM_MASK; in e3d_pci_register()
299 ep->regs_base_phys = pci_resource_start (pdev, 1); in e3d_pci_register()
306 ep->ramdac = ioremap(ep->regs_base_phys + 0x8000, 0x1000); in e3d_pci_register()
307 if (!ep->ramdac) { in e3d_pci_register()
308 err = -ENOMEM; in e3d_pci_register()
312 ep->fb8_0_off = readl(ep->ramdac + RAMDAC_VID_8FB_0); in e3d_pci_register()
313 ep->fb8_0_off -= ep->fb_base_reg; in e3d_pci_register()
315 ep->fb8_1_off = readl(ep->ramdac + RAMDAC_VID_8FB_1); in e3d_pci_register()
316 ep->fb8_1_off -= ep->fb_base_reg; in e3d_pci_register()
318 ep->fb8_buf_diff = ep->fb8_1_off - ep->fb8_0_off; in e3d_pci_register()
320 ep->fb_base_phys = pci_resource_start (pdev, 0); in e3d_pci_register()
321 ep->fb_base_phys += ep->fb8_0_off; in e3d_pci_register()
330 err = e3d_get_props(ep); in e3d_pci_register()
334 line_length = (readl(ep->ramdac + RAMDAC_VID_CFG) >> 16) & 0xff; in e3d_pci_register()
337 switch (ep->depth) { in e3d_pci_register()
339 info->fix.line_length = line_length; in e3d_pci_register()
342 info->fix.line_length = line_length * 2; in e3d_pci_register()
345 info->fix.line_length = line_length * 3; in e3d_pci_register()
348 info->fix.line_length = line_length * 4; in e3d_pci_register()
351 ep->fb_size = info->fix.line_length * ep->height; in e3d_pci_register()
353 ep->fb_base = ioremap(ep->fb_base_phys, ep->fb_size); in e3d_pci_register()
354 if (!ep->fb_base) { in e3d_pci_register()
355 err = -ENOMEM; in e3d_pci_register()
359 err = e3d_set_fbinfo(ep); in e3d_pci_register()
377 fb_dealloc_cmap(&info->cmap); in e3d_pci_register()
380 iounmap(ep->fb_base); in e3d_pci_register()
386 iounmap(ep->ramdac); in e3d_pci_register()
435 return -ENODEV; in e3d_init()
438 return -ENODEV; in e3d_init()