Lines Matching refs:drvdata
167 static void xilinx_fb_out32(struct xilinxfb_drvdata *drvdata, u32 offset, in xilinx_fb_out32() argument
170 if (drvdata->flags & BUS_ACCESS_FLAG) { in xilinx_fb_out32()
171 if (drvdata->flags & LITTLE_ENDIAN_ACCESS) in xilinx_fb_out32()
172 iowrite32(val, drvdata->regs + (offset << 2)); in xilinx_fb_out32()
174 iowrite32be(val, drvdata->regs + (offset << 2)); in xilinx_fb_out32()
178 dcr_write(drvdata->dcr_host, offset, val); in xilinx_fb_out32()
182 static u32 xilinx_fb_in32(struct xilinxfb_drvdata *drvdata, u32 offset) in xilinx_fb_in32() argument
184 if (drvdata->flags & BUS_ACCESS_FLAG) { in xilinx_fb_in32()
185 if (drvdata->flags & LITTLE_ENDIAN_ACCESS) in xilinx_fb_in32()
186 return ioread32(drvdata->regs + (offset << 2)); in xilinx_fb_in32()
188 return ioread32be(drvdata->regs + (offset << 2)); in xilinx_fb_in32()
192 return dcr_read(drvdata->dcr_host, offset); in xilinx_fb_in32()
230 struct xilinxfb_drvdata *drvdata = to_xilinxfb_drvdata(fbi); in xilinx_fb_blank() local
235 xilinx_fb_out32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); in xilinx_fb_blank()
243 xilinx_fb_out32(drvdata, REG_CTRL, 0); in xilinx_fb_blank()
266 struct xilinxfb_drvdata *drvdata, in xilinxfb_assign() argument
273 if (drvdata->flags & BUS_ACCESS_FLAG) { in xilinxfb_assign()
277 drvdata->regs = devm_ioremap_resource(&pdev->dev, res); in xilinxfb_assign()
278 if (IS_ERR(drvdata->regs)) in xilinxfb_assign()
279 return PTR_ERR(drvdata->regs); in xilinxfb_assign()
281 drvdata->regs_phys = res->start; in xilinxfb_assign()
286 drvdata->fb_phys = pdata->fb_phys; in xilinxfb_assign()
287 drvdata->fb_virt = ioremap(pdata->fb_phys, fbsize); in xilinxfb_assign()
289 drvdata->fb_alloced = 1; in xilinxfb_assign()
290 drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(fbsize), in xilinxfb_assign()
291 &drvdata->fb_phys, in xilinxfb_assign()
295 if (!drvdata->fb_virt) { in xilinxfb_assign()
301 memset_io((void __iomem *)drvdata->fb_virt, 0, fbsize); in xilinxfb_assign()
304 xilinx_fb_out32(drvdata, REG_FB_ADDR, drvdata->fb_phys); in xilinxfb_assign()
305 rc = xilinx_fb_in32(drvdata, REG_FB_ADDR); in xilinxfb_assign()
307 if (rc != drvdata->fb_phys) { in xilinxfb_assign()
308 drvdata->flags |= LITTLE_ENDIAN_ACCESS; in xilinxfb_assign()
309 xilinx_fb_out32(drvdata, REG_FB_ADDR, drvdata->fb_phys); in xilinxfb_assign()
313 drvdata->reg_ctrl_default = REG_CTRL_ENABLE; in xilinxfb_assign()
315 drvdata->reg_ctrl_default |= REG_CTRL_ROTATE; in xilinxfb_assign()
316 xilinx_fb_out32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); in xilinxfb_assign()
319 drvdata->info.device = dev; in xilinxfb_assign()
320 drvdata->info.screen_base = (void __iomem *)drvdata->fb_virt; in xilinxfb_assign()
321 drvdata->info.fbops = &xilinxfb_ops; in xilinxfb_assign()
322 drvdata->info.fix = xilinx_fb_fix; in xilinxfb_assign()
323 drvdata->info.fix.smem_start = drvdata->fb_phys; in xilinxfb_assign()
324 drvdata->info.fix.smem_len = fbsize; in xilinxfb_assign()
325 drvdata->info.fix.line_length = pdata->xvirt * BYTES_PER_PIXEL; in xilinxfb_assign()
327 drvdata->info.pseudo_palette = drvdata->pseudo_palette; in xilinxfb_assign()
328 drvdata->info.flags = FBINFO_DEFAULT; in xilinxfb_assign()
329 drvdata->info.var = xilinx_fb_var; in xilinxfb_assign()
330 drvdata->info.var.height = pdata->screen_height_mm; in xilinxfb_assign()
331 drvdata->info.var.width = pdata->screen_width_mm; in xilinxfb_assign()
332 drvdata->info.var.xres = pdata->xres; in xilinxfb_assign()
333 drvdata->info.var.yres = pdata->yres; in xilinxfb_assign()
334 drvdata->info.var.xres_virtual = pdata->xvirt; in xilinxfb_assign()
335 drvdata->info.var.yres_virtual = pdata->yvirt; in xilinxfb_assign()
338 rc = fb_alloc_cmap(&drvdata->info.cmap, PALETTE_ENTRIES_NO, 0); in xilinxfb_assign()
346 rc = register_framebuffer(&drvdata->info); in xilinxfb_assign()
352 if (drvdata->flags & BUS_ACCESS_FLAG) { in xilinxfb_assign()
355 &drvdata->regs_phys, drvdata->regs); in xilinxfb_assign()
359 (unsigned long long)drvdata->fb_phys, drvdata->fb_virt, fbsize); in xilinxfb_assign()
364 fb_dealloc_cmap(&drvdata->info.cmap); in xilinxfb_assign()
367 if (drvdata->fb_alloced) in xilinxfb_assign()
368 dma_free_coherent(dev, PAGE_ALIGN(fbsize), drvdata->fb_virt, in xilinxfb_assign()
369 drvdata->fb_phys); in xilinxfb_assign()
371 iounmap(drvdata->fb_virt); in xilinxfb_assign()
374 xilinx_fb_out32(drvdata, REG_CTRL, 0); in xilinxfb_assign()
381 struct xilinxfb_drvdata *drvdata = dev_get_drvdata(dev); in xilinxfb_release() local
384 xilinx_fb_blank(VESA_POWERDOWN, &drvdata->info); in xilinxfb_release()
387 unregister_framebuffer(&drvdata->info); in xilinxfb_release()
389 fb_dealloc_cmap(&drvdata->info.cmap); in xilinxfb_release()
391 if (drvdata->fb_alloced) in xilinxfb_release()
392 dma_free_coherent(dev, PAGE_ALIGN(drvdata->info.fix.smem_len), in xilinxfb_release()
393 drvdata->fb_virt, drvdata->fb_phys); in xilinxfb_release()
395 iounmap(drvdata->fb_virt); in xilinxfb_release()
398 xilinx_fb_out32(drvdata, REG_CTRL, 0); in xilinxfb_release()
402 if (!(drvdata->flags & BUS_ACCESS_FLAG)) in xilinxfb_release()
403 dcr_unmap(drvdata->dcr_host, drvdata->dcr_len); in xilinxfb_release()
417 struct xilinxfb_drvdata *drvdata; in xilinxfb_of_probe() local
423 drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); in xilinxfb_of_probe()
424 if (!drvdata) in xilinxfb_of_probe()
439 drvdata->flags |= BUS_ACCESS_FLAG; in xilinxfb_of_probe()
445 drvdata->dcr_len = dcr_resource_len(pdev->dev.of_node, 0); in xilinxfb_of_probe()
446 drvdata->dcr_host = dcr_map(pdev->dev.of_node, start, drvdata->dcr_len); in xilinxfb_of_probe()
447 if (!DCR_MAP_OK(drvdata->dcr_host)) { in xilinxfb_of_probe()
475 platform_set_drvdata(pdev, drvdata); in xilinxfb_of_probe()
476 return xilinxfb_assign(pdev, drvdata, &pdata); in xilinxfb_of_probe()