Lines Matching refs:drvdata

166 static void xilinx_fb_out32(struct xilinxfb_drvdata *drvdata, u32 offset,  in xilinx_fb_out32()  argument
169 if (drvdata->flags & BUS_ACCESS_FLAG) { in xilinx_fb_out32()
170 if (drvdata->flags & LITTLE_ENDIAN_ACCESS) in xilinx_fb_out32()
171 iowrite32(val, drvdata->regs + (offset << 2)); in xilinx_fb_out32()
173 iowrite32be(val, drvdata->regs + (offset << 2)); in xilinx_fb_out32()
177 dcr_write(drvdata->dcr_host, offset, val); in xilinx_fb_out32()
181 static u32 xilinx_fb_in32(struct xilinxfb_drvdata *drvdata, u32 offset) in xilinx_fb_in32() argument
183 if (drvdata->flags & BUS_ACCESS_FLAG) { in xilinx_fb_in32()
184 if (drvdata->flags & LITTLE_ENDIAN_ACCESS) in xilinx_fb_in32()
185 return ioread32(drvdata->regs + (offset << 2)); in xilinx_fb_in32()
187 return ioread32be(drvdata->regs + (offset << 2)); in xilinx_fb_in32()
191 return dcr_read(drvdata->dcr_host, offset); in xilinx_fb_in32()
229 struct xilinxfb_drvdata *drvdata = to_xilinxfb_drvdata(fbi); in xilinx_fb_blank() local
234 xilinx_fb_out32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); in xilinx_fb_blank()
242 xilinx_fb_out32(drvdata, REG_CTRL, 0); in xilinx_fb_blank()
263 struct xilinxfb_drvdata *drvdata, in xilinxfb_assign() argument
270 if (drvdata->flags & BUS_ACCESS_FLAG) { in xilinxfb_assign()
273 drvdata->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); in xilinxfb_assign()
274 if (IS_ERR(drvdata->regs)) in xilinxfb_assign()
275 return PTR_ERR(drvdata->regs); in xilinxfb_assign()
277 drvdata->regs_phys = res->start; in xilinxfb_assign()
282 drvdata->fb_phys = pdata->fb_phys; in xilinxfb_assign()
283 drvdata->fb_virt = ioremap(pdata->fb_phys, fbsize); in xilinxfb_assign()
285 drvdata->fb_alloced = 1; in xilinxfb_assign()
286 drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(fbsize), in xilinxfb_assign()
287 &drvdata->fb_phys, in xilinxfb_assign()
291 if (!drvdata->fb_virt) { in xilinxfb_assign()
297 memset_io((void __iomem *)drvdata->fb_virt, 0, fbsize); in xilinxfb_assign()
300 xilinx_fb_out32(drvdata, REG_FB_ADDR, drvdata->fb_phys); in xilinxfb_assign()
301 rc = xilinx_fb_in32(drvdata, REG_FB_ADDR); in xilinxfb_assign()
303 if (rc != drvdata->fb_phys) { in xilinxfb_assign()
304 drvdata->flags |= LITTLE_ENDIAN_ACCESS; in xilinxfb_assign()
305 xilinx_fb_out32(drvdata, REG_FB_ADDR, drvdata->fb_phys); in xilinxfb_assign()
309 drvdata->reg_ctrl_default = REG_CTRL_ENABLE; in xilinxfb_assign()
311 drvdata->reg_ctrl_default |= REG_CTRL_ROTATE; in xilinxfb_assign()
312 xilinx_fb_out32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); in xilinxfb_assign()
315 drvdata->info.device = dev; in xilinxfb_assign()
316 drvdata->info.screen_base = (void __iomem *)drvdata->fb_virt; in xilinxfb_assign()
317 drvdata->info.fbops = &xilinxfb_ops; in xilinxfb_assign()
318 drvdata->info.fix = xilinx_fb_fix; in xilinxfb_assign()
319 drvdata->info.fix.smem_start = drvdata->fb_phys; in xilinxfb_assign()
320 drvdata->info.fix.smem_len = fbsize; in xilinxfb_assign()
321 drvdata->info.fix.line_length = pdata->xvirt * BYTES_PER_PIXEL; in xilinxfb_assign()
323 drvdata->info.pseudo_palette = drvdata->pseudo_palette; in xilinxfb_assign()
324 drvdata->info.var = xilinx_fb_var; in xilinxfb_assign()
325 drvdata->info.var.height = pdata->screen_height_mm; in xilinxfb_assign()
326 drvdata->info.var.width = pdata->screen_width_mm; in xilinxfb_assign()
327 drvdata->info.var.xres = pdata->xres; in xilinxfb_assign()
328 drvdata->info.var.yres = pdata->yres; in xilinxfb_assign()
329 drvdata->info.var.xres_virtual = pdata->xvirt; in xilinxfb_assign()
330 drvdata->info.var.yres_virtual = pdata->yvirt; in xilinxfb_assign()
333 rc = fb_alloc_cmap(&drvdata->info.cmap, PALETTE_ENTRIES_NO, 0); in xilinxfb_assign()
341 rc = register_framebuffer(&drvdata->info); in xilinxfb_assign()
347 if (drvdata->flags & BUS_ACCESS_FLAG) { in xilinxfb_assign()
350 &drvdata->regs_phys, drvdata->regs); in xilinxfb_assign()
354 (unsigned long long)drvdata->fb_phys, drvdata->fb_virt, fbsize); in xilinxfb_assign()
359 fb_dealloc_cmap(&drvdata->info.cmap); in xilinxfb_assign()
362 if (drvdata->fb_alloced) in xilinxfb_assign()
363 dma_free_coherent(dev, PAGE_ALIGN(fbsize), drvdata->fb_virt, in xilinxfb_assign()
364 drvdata->fb_phys); in xilinxfb_assign()
366 iounmap(drvdata->fb_virt); in xilinxfb_assign()
369 xilinx_fb_out32(drvdata, REG_CTRL, 0); in xilinxfb_assign()
376 struct xilinxfb_drvdata *drvdata = dev_get_drvdata(dev); in xilinxfb_release() local
379 xilinx_fb_blank(VESA_POWERDOWN, &drvdata->info); in xilinxfb_release()
382 unregister_framebuffer(&drvdata->info); in xilinxfb_release()
384 fb_dealloc_cmap(&drvdata->info.cmap); in xilinxfb_release()
386 if (drvdata->fb_alloced) in xilinxfb_release()
387 dma_free_coherent(dev, PAGE_ALIGN(drvdata->info.fix.smem_len), in xilinxfb_release()
388 drvdata->fb_virt, drvdata->fb_phys); in xilinxfb_release()
390 iounmap(drvdata->fb_virt); in xilinxfb_release()
393 xilinx_fb_out32(drvdata, REG_CTRL, 0); in xilinxfb_release()
397 if (!(drvdata->flags & BUS_ACCESS_FLAG)) in xilinxfb_release()
398 dcr_unmap(drvdata->dcr_host, drvdata->dcr_len); in xilinxfb_release()
412 struct xilinxfb_drvdata *drvdata; in xilinxfb_of_probe() local
418 drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); in xilinxfb_of_probe()
419 if (!drvdata) in xilinxfb_of_probe()
434 drvdata->flags |= BUS_ACCESS_FLAG; in xilinxfb_of_probe()
440 drvdata->dcr_len = dcr_resource_len(pdev->dev.of_node, 0); in xilinxfb_of_probe()
441 drvdata->dcr_host = dcr_map(pdev->dev.of_node, start, drvdata->dcr_len); in xilinxfb_of_probe()
442 if (!DCR_MAP_OK(drvdata->dcr_host)) { in xilinxfb_of_probe()
469 platform_set_drvdata(pdev, drvdata); in xilinxfb_of_probe()
470 return xilinxfb_assign(pdev, drvdata, &pdata); in xilinxfb_of_probe()