blob: 91ebdafcca3918011553e11a1e6cc061656309d0 [file] [log] [blame]
Tony Lindgren0dc5e772006-04-02 17:46:26 +01001#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
18static struct omapfb_platform_data omapfb_config;
19
20static u64 omap_fb_dma_mask = ~(u32)0;
21
22static 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 */
34void 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
Imre Deak771af222006-12-06 17:13:50 -080058void omapfb_set_ctrl_platform_data(void *data)
59{
60 omapfb_config.ctrl_platform_data = data;
61}
62
Tony Lindgren0dc5e772006-04-02 17:46:26 +010063static inline int omap_init_fb(void)
64{
65 const struct omap_lcd_config *conf;
66
67 conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
68 if (conf == NULL)
69 return 0;
70
71 omapfb_config.lcd = *conf;
72
73 return platform_device_register(&omap_fb_device);
74}
75
76arch_initcall(omap_init_fb);
77
78#else
79
80void omapfb_reserve_mem(void) {}
81
82#endif
83
84