fb.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. #include <asm/hardware.h>
  7. #include <asm/io.h>
  8. #include <asm/mach-types.h>
  9. #include <asm/mach/map.h>
  10. #include <asm/arch/board.h>
  11. #include <asm/arch/sram.h>
  12. #include <asm/arch/omapfb.h>
  13. #if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE)
  14. static struct omapfb_platform_data omapfb_config;
  15. static u64 omap_fb_dma_mask = ~(u32)0;
  16. static struct platform_device omap_fb_device = {
  17. .name = "omapfb",
  18. .id = -1,
  19. .dev = {
  20. .dma_mask = &omap_fb_dma_mask,
  21. .coherent_dma_mask = ~(u32)0,
  22. .platform_data = &omapfb_config,
  23. },
  24. .num_resources = 0,
  25. };
  26. /* called from map_io */
  27. void omapfb_reserve_mem(void)
  28. {
  29. const struct omap_fbmem_config *fbmem_conf;
  30. omapfb_config.fbmem.fb_sram_start = omap_fb_sram_start;
  31. omapfb_config.fbmem.fb_sram_size = omap_fb_sram_size;
  32. fbmem_conf = omap_get_config(OMAP_TAG_FBMEM, struct omap_fbmem_config);
  33. if (fbmem_conf != NULL) {
  34. /* indicate that the bootloader already initialized the
  35. * fb device, so we'll skip that part in the fb driver
  36. */
  37. omapfb_config.fbmem.fb_sdram_start = fbmem_conf->fb_sdram_start;
  38. omapfb_config.fbmem.fb_sdram_size = fbmem_conf->fb_sdram_size;
  39. if (fbmem_conf->fb_sdram_size) {
  40. pr_info("Reserving %u bytes SDRAM for frame buffer\n",
  41. fbmem_conf->fb_sdram_size);
  42. reserve_bootmem(fbmem_conf->fb_sdram_start,
  43. fbmem_conf->fb_sdram_size);
  44. }
  45. }
  46. }
  47. static inline int omap_init_fb(void)
  48. {
  49. const struct omap_lcd_config *conf;
  50. conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
  51. if (conf == NULL)
  52. return 0;
  53. omapfb_config.lcd = *conf;
  54. return platform_device_register(&omap_fb_device);
  55. }
  56. arch_initcall(omap_init_fb);
  57. #else
  58. void omapfb_reserve_mem(void) {}
  59. #endif