1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#include <linux/device.h>
21#include <linux/init.h>
22#include <linux/dma-mapping.h>
23#include <linux/amba/bus.h>
24#include <linux/amba/clcd.h>
25#include <linux/err.h>
26#include <linux/gfp.h>
27
28#include <asm/irq.h>
29
30#include <mach/netx-regs.h>
31#include <mach/hardware.h>
32
33static struct clcd_panel *netx_panel;
34
35void netx_clcd_enable(struct clcd_fb *fb)
36{
37}
38
39int netx_clcd_setup(struct clcd_fb *fb)
40{
41 dma_addr_t dma;
42
43 fb->panel = netx_panel;
44
45 fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev, 1024*1024,
46 &dma, GFP_KERNEL);
47 if (!fb->fb.screen_base) {
48 printk(KERN_ERR "CLCD: unable to map framebuffer\n");
49 return -ENOMEM;
50 }
51
52 fb->fb.fix.smem_start = dma;
53 fb->fb.fix.smem_len = 1024*1024;
54
55 return 0;
56}
57
58int netx_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
59{
60 return dma_mmap_writecombine(&fb->dev->dev, vma,
61 fb->fb.screen_base,
62 fb->fb.fix.smem_start,
63 fb->fb.fix.smem_len);
64}
65
66void netx_clcd_remove(struct clcd_fb *fb)
67{
68 dma_free_writecombine(&fb->dev->dev, fb->fb.fix.smem_len,
69 fb->fb.screen_base, fb->fb.fix.smem_start);
70}
71
72static AMBA_AHB_DEVICE(fb, "fb", 0, 0x00104000, { NETX_IRQ_LCD }, NULL);
73
74int netx_fb_init(struct clcd_board *board, struct clcd_panel *panel)
75{
76 netx_panel = panel;
77 fb_device.dev.platform_data = board;
78 return amba_device_register(&fb_device, &iomem_resource);
79}
80