board-generic.c 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  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 <asm/setup.h>
  19. #include <asm/mach/arch.h>
  20. #include <asm/system_info.h>
  21. #include "common.h"
  22. static const struct of_device_id omap_dt_match_table[] __initconst = {
  23. { .compatible = "simple-bus", },
  24. { .compatible = "ti,omap-infra", },
  25. { }
  26. };
  27. static void __init __maybe_unused omap_generic_init(void)
  28. {
  29. pdata_quirks_init(omap_dt_match_table);
  30. omapdss_init_of();
  31. }
  32. #ifdef CONFIG_SOC_OMAP2420
  33. static const char *const omap242x_boards_compat[] __initconst = {
  34. "ti,omap2420",
  35. NULL,
  36. };
  37. DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
  38. .reserve = omap_reserve,
  39. .map_io = omap242x_map_io,
  40. .init_early = omap2420_init_early,
  41. .init_machine = omap_generic_init,
  42. .init_time = omap_init_time,
  43. .dt_compat = omap242x_boards_compat,
  44. .restart = omap2xxx_restart,
  45. MACHINE_END
  46. #endif
  47. #ifdef CONFIG_SOC_OMAP2430
  48. static const char *const omap243x_boards_compat[] __initconst = {
  49. "ti,omap2430",
  50. NULL,
  51. };
  52. DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
  53. .reserve = omap_reserve,
  54. .map_io = omap243x_map_io,
  55. .init_early = omap2430_init_early,
  56. .init_machine = omap_generic_init,
  57. .init_time = omap_init_time,
  58. .dt_compat = omap243x_boards_compat,
  59. .restart = omap2xxx_restart,
  60. MACHINE_END
  61. #endif
  62. #ifdef CONFIG_ARCH_OMAP3
  63. /* Some boards need board name for legacy userspace in /proc/cpuinfo */
  64. static const char *const n900_boards_compat[] __initconst = {
  65. "nokia,omap3-n900",
  66. NULL,
  67. };
  68. /* Set system_rev from atags */
  69. static void __init rx51_set_system_rev(const struct tag *tags)
  70. {
  71. const struct tag *tag;
  72. if (tags->hdr.tag != ATAG_CORE)
  73. return;
  74. for_each_tag(tag, tags) {
  75. if (tag->hdr.tag == ATAG_REVISION) {
  76. system_rev = tag->u.revision.rev;
  77. break;
  78. }
  79. }
  80. }
  81. /* Legacy userspace on Nokia N900 needs ATAGS exported in /proc/atags,
  82. * save them while the data is still not overwritten
  83. */
  84. static void __init rx51_reserve(void)
  85. {
  86. const struct tag *tags = (const struct tag *)(PAGE_OFFSET + 0x100);
  87. save_atags(tags);
  88. rx51_set_system_rev(tags);
  89. omap_reserve();
  90. }
  91. DT_MACHINE_START(OMAP3_N900_DT, "Nokia RX-51 board")
  92. .reserve = rx51_reserve,
  93. .map_io = omap3_map_io,
  94. .init_early = omap3430_init_early,
  95. .init_machine = omap_generic_init,
  96. .init_late = omap3_init_late,
  97. .init_time = omap_init_time,
  98. .dt_compat = n900_boards_compat,
  99. .restart = omap3xxx_restart,
  100. MACHINE_END
  101. /* Generic omap3 boards, most boards can use these */
  102. static const char *const omap3_boards_compat[] __initconst = {
  103. "ti,omap3430",
  104. "ti,omap3",
  105. NULL,
  106. };
  107. DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
  108. .reserve = omap_reserve,
  109. .map_io = omap3_map_io,
  110. .init_early = omap3430_init_early,
  111. .init_machine = omap_generic_init,
  112. .init_late = omap3_init_late,
  113. .init_time = omap_init_time,
  114. .dt_compat = omap3_boards_compat,
  115. .restart = omap3xxx_restart,
  116. MACHINE_END
  117. static const char *const omap36xx_boards_compat[] __initconst = {
  118. "ti,omap3630",
  119. "ti,omap36xx",
  120. NULL,
  121. };
  122. DT_MACHINE_START(OMAP36XX_DT, "Generic OMAP36xx (Flattened Device Tree)")
  123. .reserve = omap_reserve,
  124. .map_io = omap3_map_io,
  125. .init_early = omap3630_init_early,
  126. .init_machine = omap_generic_init,
  127. .init_late = omap3_init_late,
  128. .init_time = omap_init_time,
  129. .dt_compat = omap36xx_boards_compat,
  130. .restart = omap3xxx_restart,
  131. MACHINE_END
  132. static const char *const omap3_gp_boards_compat[] __initconst = {
  133. "ti,omap3-beagle",
  134. "timll,omap3-devkit8000",
  135. NULL,
  136. };
  137. DT_MACHINE_START(OMAP3_GP_DT, "Generic OMAP3-GP (Flattened Device Tree)")
  138. .reserve = omap_reserve,
  139. .map_io = omap3_map_io,
  140. .init_early = omap3430_init_early,
  141. .init_machine = omap_generic_init,
  142. .init_late = omap3_init_late,
  143. .init_time = omap3_secure_sync32k_timer_init,
  144. .dt_compat = omap3_gp_boards_compat,
  145. .restart = omap3xxx_restart,
  146. MACHINE_END
  147. static const char *const am3517_boards_compat[] __initconst = {
  148. "ti,am3517",
  149. NULL,
  150. };
  151. DT_MACHINE_START(AM3517_DT, "Generic AM3517 (Flattened Device Tree)")
  152. .reserve = omap_reserve,
  153. .map_io = omap3_map_io,
  154. .init_early = am35xx_init_early,
  155. .init_machine = omap_generic_init,
  156. .init_late = omap3_init_late,
  157. .init_time = omap3_gptimer_timer_init,
  158. .dt_compat = am3517_boards_compat,
  159. .restart = omap3xxx_restart,
  160. MACHINE_END
  161. #endif
  162. #ifdef CONFIG_SOC_TI81XX
  163. static const char *const ti814x_boards_compat[] __initconst = {
  164. "ti,dm8148",
  165. "ti,dm814",
  166. NULL,
  167. };
  168. DT_MACHINE_START(TI814X_DT, "Generic ti814x (Flattened Device Tree)")
  169. .reserve = omap_reserve,
  170. .map_io = ti81xx_map_io,
  171. .init_early = ti814x_init_early,
  172. .init_machine = omap_generic_init,
  173. .init_late = ti81xx_init_late,
  174. .init_time = omap3_gptimer_timer_init,
  175. .dt_compat = ti814x_boards_compat,
  176. .restart = ti81xx_restart,
  177. MACHINE_END
  178. static const char *const ti816x_boards_compat[] __initconst = {
  179. "ti,dm8168",
  180. "ti,dm816",
  181. NULL,
  182. };
  183. DT_MACHINE_START(TI816X_DT, "Generic ti816x (Flattened Device Tree)")
  184. .reserve = omap_reserve,
  185. .map_io = ti81xx_map_io,
  186. .init_early = ti816x_init_early,
  187. .init_machine = omap_generic_init,
  188. .init_late = ti81xx_init_late,
  189. .init_time = omap3_gptimer_timer_init,
  190. .dt_compat = ti816x_boards_compat,
  191. .restart = ti81xx_restart,
  192. MACHINE_END
  193. #endif
  194. #ifdef CONFIG_SOC_AM33XX
  195. static const char *const am33xx_boards_compat[] __initconst = {
  196. "ti,am33xx",
  197. NULL,
  198. };
  199. DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
  200. .reserve = omap_reserve,
  201. .map_io = am33xx_map_io,
  202. .init_early = am33xx_init_early,
  203. .init_machine = omap_generic_init,
  204. .init_late = am33xx_init_late,
  205. .init_time = omap3_gptimer_timer_init,
  206. .dt_compat = am33xx_boards_compat,
  207. .restart = am33xx_restart,
  208. MACHINE_END
  209. #endif
  210. #ifdef CONFIG_ARCH_OMAP4
  211. static const char *const omap4_boards_compat[] __initconst = {
  212. "ti,omap4460",
  213. "ti,omap4430",
  214. "ti,omap4",
  215. NULL,
  216. };
  217. DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
  218. .l2c_aux_val = OMAP_L2C_AUX_CTRL,
  219. .l2c_aux_mask = 0xcf9fffff,
  220. .l2c_write_sec = omap4_l2c310_write_sec,
  221. .reserve = omap_reserve,
  222. .smp = smp_ops(omap4_smp_ops),
  223. .map_io = omap4_map_io,
  224. .init_early = omap4430_init_early,
  225. .init_irq = omap_gic_of_init,
  226. .init_machine = omap_generic_init,
  227. .init_late = omap4430_init_late,
  228. .init_time = omap4_local_timer_init,
  229. .dt_compat = omap4_boards_compat,
  230. .restart = omap44xx_restart,
  231. MACHINE_END
  232. #endif
  233. #ifdef CONFIG_SOC_OMAP5
  234. static const char *const omap5_boards_compat[] __initconst = {
  235. "ti,omap5432",
  236. "ti,omap5430",
  237. "ti,omap5",
  238. NULL,
  239. };
  240. DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
  241. #if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE)
  242. .dma_zone_size = SZ_2G,
  243. #endif
  244. .reserve = omap_reserve,
  245. .smp = smp_ops(omap4_smp_ops),
  246. .map_io = omap5_map_io,
  247. .init_early = omap5_init_early,
  248. .init_irq = omap_gic_of_init,
  249. .init_machine = omap_generic_init,
  250. .init_late = omap5_init_late,
  251. .init_time = omap5_realtime_timer_init,
  252. .dt_compat = omap5_boards_compat,
  253. .restart = omap44xx_restart,
  254. MACHINE_END
  255. #endif
  256. #ifdef CONFIG_SOC_AM43XX
  257. static const char *const am43_boards_compat[] __initconst = {
  258. "ti,am4372",
  259. "ti,am43",
  260. NULL,
  261. };
  262. DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
  263. .l2c_aux_val = OMAP_L2C_AUX_CTRL,
  264. .l2c_aux_mask = 0xcf9fffff,
  265. .l2c_write_sec = omap4_l2c310_write_sec,
  266. .map_io = am33xx_map_io,
  267. .init_early = am43xx_init_early,
  268. .init_late = am43xx_init_late,
  269. .init_irq = omap_gic_of_init,
  270. .init_machine = omap_generic_init,
  271. .init_time = omap3_gptimer_timer_init,
  272. .dt_compat = am43_boards_compat,
  273. .restart = omap44xx_restart,
  274. MACHINE_END
  275. #endif
  276. #ifdef CONFIG_SOC_DRA7XX
  277. static const char *const dra74x_boards_compat[] __initconst = {
  278. "ti,am5728",
  279. "ti,am5726",
  280. "ti,dra742",
  281. "ti,dra7",
  282. NULL,
  283. };
  284. DT_MACHINE_START(DRA74X_DT, "Generic DRA74X (Flattened Device Tree)")
  285. #if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE)
  286. .dma_zone_size = SZ_2G,
  287. #endif
  288. .reserve = omap_reserve,
  289. .smp = smp_ops(omap4_smp_ops),
  290. .map_io = dra7xx_map_io,
  291. .init_early = dra7xx_init_early,
  292. .init_late = dra7xx_init_late,
  293. .init_irq = omap_gic_of_init,
  294. .init_machine = omap_generic_init,
  295. .init_time = omap5_realtime_timer_init,
  296. .dt_compat = dra74x_boards_compat,
  297. .restart = omap44xx_restart,
  298. MACHINE_END
  299. static const char *const dra72x_boards_compat[] __initconst = {
  300. "ti,am5718",
  301. "ti,am5716",
  302. "ti,dra722",
  303. "ti,dra718",
  304. NULL,
  305. };
  306. DT_MACHINE_START(DRA72X_DT, "Generic DRA72X (Flattened Device Tree)")
  307. #if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE)
  308. .dma_zone_size = SZ_2G,
  309. #endif
  310. .reserve = omap_reserve,
  311. .map_io = dra7xx_map_io,
  312. .init_early = dra7xx_init_early,
  313. .init_late = dra7xx_init_late,
  314. .init_irq = omap_gic_of_init,
  315. .init_machine = omap_generic_init,
  316. .init_time = omap5_realtime_timer_init,
  317. .dt_compat = dra72x_boards_compat,
  318. .restart = omap44xx_restart,
  319. MACHINE_END
  320. #endif