Merge master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb
[linux-2.6] / arch / arm / plat-omap / fb.c
1 #include <linux/module.h>
2 #include <linux/kernel.h>
3 #include <linux/init.h>
4 #include <linux/platform_device.h>
5 #include <linux/bootmem.h>
6
7 #include <asm/hardware.h>
8 #include <asm/io.h>
9 #include <asm/mach-types.h>
10 #include <asm/mach/map.h>
11
12 #include <asm/arch/board.h>
13 #include <asm/arch/sram.h>
14 #include <asm/arch/omapfb.h>
15
16 #if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE)
17
18 static struct omapfb_platform_data omapfb_config;
19
20 static u64 omap_fb_dma_mask = ~(u32)0;
21
22 static struct platform_device omap_fb_device = {
23         .name           = "omapfb",
24         .id             = -1,
25         .dev = {
26                 .dma_mask               = &omap_fb_dma_mask,
27                 .coherent_dma_mask      = ~(u32)0,
28                 .platform_data          = &omapfb_config,
29         },
30         .num_resources = 0,
31 };
32
33 /* called from map_io */
34 void omapfb_reserve_mem(void)
35 {
36         const struct omap_fbmem_config *fbmem_conf;
37
38         omapfb_config.fbmem.fb_sram_start = omap_fb_sram_start;
39         omapfb_config.fbmem.fb_sram_size = omap_fb_sram_size;
40
41         fbmem_conf = omap_get_config(OMAP_TAG_FBMEM, struct omap_fbmem_config);
42
43         if (fbmem_conf != NULL) {
44                 /* indicate that the bootloader already initialized the
45                  * fb device, so we'll skip that part in the fb driver
46                  */
47                 omapfb_config.fbmem.fb_sdram_start = fbmem_conf->fb_sdram_start;
48                 omapfb_config.fbmem.fb_sdram_size = fbmem_conf->fb_sdram_size;
49                 if (fbmem_conf->fb_sdram_size) {
50                         pr_info("Reserving %u bytes SDRAM for frame buffer\n",
51                                 fbmem_conf->fb_sdram_size);
52                         reserve_bootmem(fbmem_conf->fb_sdram_start,
53                                         fbmem_conf->fb_sdram_size);
54                 }
55         }
56 }
57
58 static inline int omap_init_fb(void)
59 {
60         const struct omap_lcd_config *conf;
61
62         conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
63         if (conf == NULL)
64                 return 0;
65
66         omapfb_config.lcd = *conf;
67
68         return platform_device_register(&omap_fb_device);
69 }
70
71 arch_initcall(omap_init_fb);
72
73 #else
74
75 void omapfb_reserve_mem(void) {}
76
77 #endif
78
79