board-generic.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /*
  2. * Copyright (C) 2005 Nokia Corporation
  3. * Author: Paul Mundt <paul.mundt@nokia.com>
  4. *
  5. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
  6. *
  7. * Modified from the original mach-omap/omap2/board-generic.c did by Paul
  8. * to support the OMAP2+ device tree boards with an unique board file.
  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/io.h>
  15. #include <linux/of_irq.h>
  16. #include <linux/of_platform.h>
  17. #include <linux/irqdomain.h>
  18. #include <linux/i2c/twl.h>
  19. #include <mach/hardware.h>
  20. #include <asm/hardware/gic.h>
  21. #include <asm/mach/arch.h>
  22. #include <plat/board.h>
  23. #include "common.h"
  24. #include "common-board-devices.h"
  25. #if !(defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3))
  26. #define omap_intc_of_init NULL
  27. #endif
  28. #ifndef CONFIG_ARCH_OMAP4
  29. #define gic_of_init NULL
  30. #endif
  31. static struct of_device_id irq_match[] __initdata = {
  32. { .compatible = "ti,omap2-intc", .data = omap_intc_of_init, },
  33. { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
  34. { }
  35. };
  36. static void __init omap_init_irq(void)
  37. {
  38. of_irq_init(irq_match);
  39. }
  40. /*
  41. * XXX: Still needed to boot until the i2c & twl driver is adapted to
  42. * device-tree
  43. */
  44. #ifdef CONFIG_ARCH_OMAP4
  45. static struct twl4030_platform_data sdp4430_twldata = {
  46. .irq_base = TWL6030_IRQ_BASE,
  47. .irq_end = TWL6030_IRQ_END,
  48. };
  49. static void __init omap4_i2c_init(void)
  50. {
  51. omap4_pmic_init("twl6030", &sdp4430_twldata);
  52. }
  53. #endif
  54. #ifdef CONFIG_ARCH_OMAP3
  55. static struct twl4030_platform_data beagle_twldata = {
  56. .irq_base = TWL4030_IRQ_BASE,
  57. .irq_end = TWL4030_IRQ_END,
  58. };
  59. static void __init omap3_i2c_init(void)
  60. {
  61. omap3_pmic_init("twl4030", &beagle_twldata);
  62. }
  63. #endif
  64. static struct of_device_id omap_dt_match_table[] __initdata = {
  65. { .compatible = "simple-bus", },
  66. { .compatible = "ti,omap-infra", },
  67. { }
  68. };
  69. static void __init omap_generic_init(void)
  70. {
  71. omap_sdrc_init(NULL, NULL);
  72. of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
  73. }
  74. #ifdef CONFIG_ARCH_OMAP4
  75. static void __init omap4_init(void)
  76. {
  77. omap4_i2c_init();
  78. omap_generic_init();
  79. }
  80. #endif
  81. #ifdef CONFIG_ARCH_OMAP3
  82. static void __init omap3_init(void)
  83. {
  84. omap3_i2c_init();
  85. omap_generic_init();
  86. }
  87. #endif
  88. #ifdef CONFIG_SOC_OMAP2420
  89. static const char *omap242x_boards_compat[] __initdata = {
  90. "ti,omap2420",
  91. NULL,
  92. };
  93. DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
  94. .reserve = omap_reserve,
  95. .map_io = omap242x_map_io,
  96. .init_early = omap2420_init_early,
  97. .init_irq = omap_init_irq,
  98. .handle_irq = omap2_intc_handle_irq,
  99. .init_machine = omap_generic_init,
  100. .timer = &omap2_timer,
  101. .dt_compat = omap242x_boards_compat,
  102. .restart = omap_prcm_restart,
  103. MACHINE_END
  104. #endif
  105. #ifdef CONFIG_SOC_OMAP2430
  106. static const char *omap243x_boards_compat[] __initdata = {
  107. "ti,omap2430",
  108. NULL,
  109. };
  110. DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
  111. .reserve = omap_reserve,
  112. .map_io = omap243x_map_io,
  113. .init_early = omap2430_init_early,
  114. .init_irq = omap_init_irq,
  115. .handle_irq = omap2_intc_handle_irq,
  116. .init_machine = omap_generic_init,
  117. .timer = &omap2_timer,
  118. .dt_compat = omap243x_boards_compat,
  119. .restart = omap_prcm_restart,
  120. MACHINE_END
  121. #endif
  122. #ifdef CONFIG_ARCH_OMAP3
  123. static const char *omap3_boards_compat[] __initdata = {
  124. "ti,omap3",
  125. NULL,
  126. };
  127. DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
  128. .reserve = omap_reserve,
  129. .map_io = omap3_map_io,
  130. .init_early = omap3430_init_early,
  131. .init_irq = omap_init_irq,
  132. .handle_irq = omap3_intc_handle_irq,
  133. .init_machine = omap3_init,
  134. .timer = &omap3_timer,
  135. .dt_compat = omap3_boards_compat,
  136. .restart = omap_prcm_restart,
  137. MACHINE_END
  138. #endif
  139. #ifdef CONFIG_ARCH_OMAP4
  140. static const char *omap4_boards_compat[] __initdata = {
  141. "ti,omap4",
  142. NULL,
  143. };
  144. DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
  145. .reserve = omap_reserve,
  146. .map_io = omap4_map_io,
  147. .init_early = omap4430_init_early,
  148. .init_irq = omap_init_irq,
  149. .handle_irq = gic_handle_irq,
  150. .init_machine = omap4_init,
  151. .timer = &omap4_timer,
  152. .dt_compat = omap4_boards_compat,
  153. .restart = omap_prcm_restart,
  154. MACHINE_END
  155. #endif