Merge branch 'linus' into tracing/kmemtrace
[linux-2.6] / arch / arm / plat-s3c / dev-fb.c
1 /* linux/arch/arm/plat-s3c/dev-fb.c
2  *
3  * Copyright 2008 Simtec Electronics
4  *      Ben Dooks <ben@simtec.co.uk>
5  *      http://armlinux.simtec.co.uk/
6  *
7  * S3C series device definition for framebuffer device
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12 */
13
14 #include <linux/kernel.h>
15 #include <linux/string.h>
16 #include <linux/platform_device.h>
17 #include <linux/fb.h>
18
19 #include <mach/map.h>
20 #include <mach/regs-fb.h>
21
22 #include <plat/fb.h>
23 #include <plat/devs.h>
24 #include <plat/cpu.h>
25
26 static struct resource s3c_fb_resource[] = {
27         [0] = {
28                 .start = S3C_PA_FB,
29                 .end   = S3C_PA_FB + SZ_16K - 1,
30                 .flags = IORESOURCE_MEM,
31         },
32         [1] = {
33                 .start = IRQ_LCD_VSYNC,
34                 .end   = IRQ_LCD_VSYNC,
35                 .flags = IORESOURCE_IRQ,
36         },
37         [2] = {
38                 .start = IRQ_LCD_FIFO,
39                 .end   = IRQ_LCD_FIFO,
40                 .flags = IORESOURCE_IRQ,
41         },
42         [3] = {
43                 .start = IRQ_LCD_SYSTEM,
44                 .end   = IRQ_LCD_SYSTEM,
45                 .flags = IORESOURCE_IRQ,
46         },
47 };
48
49 struct platform_device s3c_device_fb = {
50         .name             = "s3c-fb",
51         .id               = -1,
52         .num_resources    = ARRAY_SIZE(s3c_fb_resource),
53         .resource         = s3c_fb_resource,
54         .dev.dma_mask     = &s3c_device_fb.dev.coherent_dma_mask,
55         .dev.coherent_dma_mask = 0xffffffffUL,
56 };
57
58 void __init s3c_fb_set_platdata(struct s3c_fb_platdata *pd)
59 {
60         struct s3c_fb_platdata *npd;
61
62         if (!pd) {
63                 printk(KERN_ERR "%s: no platform data\n", __func__);
64                 return;
65         }
66
67         npd = kmemdup(pd, sizeof(struct s3c_fb_platdata), GFP_KERNEL);
68         if (!npd)
69                 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
70
71         s3c_device_fb.dev.platform_data = npd;
72 }