board-generic.c 9.4 KB

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