common.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * linux/arch/arm/plat-omap/common.c
  3. *
  4. * Code common to all OMAP machines.
  5. * The file is created by Tony Lindgren <tony@atomide.com>
  6. *
  7. * Copyright (C) 2009 Texas Instruments
  8. * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/init.h>
  16. #include <linux/io.h>
  17. #include <linux/omapfb.h>
  18. #include <plat/common.h>
  19. #include <plat/board.h>
  20. #include <plat/vram.h>
  21. #define NO_LENGTH_CHECK 0xffffffff
  22. struct omap_board_config_kernel *omap_board_config;
  23. int omap_board_config_size;
  24. static const void *get_config(u16 tag, size_t len, int skip, size_t *len_out)
  25. {
  26. struct omap_board_config_kernel *kinfo = NULL;
  27. int i;
  28. /* Try to find the config from the board-specific structures
  29. * in the kernel. */
  30. for (i = 0; i < omap_board_config_size; i++) {
  31. if (omap_board_config[i].tag == tag) {
  32. if (skip == 0) {
  33. kinfo = &omap_board_config[i];
  34. break;
  35. } else {
  36. skip--;
  37. }
  38. }
  39. }
  40. if (kinfo == NULL)
  41. return NULL;
  42. return kinfo->data;
  43. }
  44. const void *__omap_get_config(u16 tag, size_t len, int nr)
  45. {
  46. return get_config(tag, len, nr, NULL);
  47. }
  48. EXPORT_SYMBOL(__omap_get_config);
  49. const void *omap_get_var_config(u16 tag, size_t *len)
  50. {
  51. return get_config(tag, NO_LENGTH_CHECK, 0, len);
  52. }
  53. EXPORT_SYMBOL(omap_get_var_config);
  54. void __init omap_reserve(void)
  55. {
  56. omapfb_reserve_sdram_memblock();
  57. omap_vram_reserve_sdram_memblock();
  58. }