io.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  1. /*
  2. * linux/arch/arm/mach-omap2/io.c
  3. *
  4. * OMAP2 I/O mapping code
  5. *
  6. * Copyright (C) 2005 Nokia Corporation
  7. * Copyright (C) 2007-2009 Texas Instruments
  8. *
  9. * Author:
  10. * Juha Yrjola <juha.yrjola@nokia.com>
  11. * Syed Khasim <x0khasim@ti.com>
  12. *
  13. * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
  14. *
  15. * This program is free software; you can redistribute it and/or modify
  16. * it under the terms of the GNU General Public License version 2 as
  17. * published by the Free Software Foundation.
  18. */
  19. #include <linux/module.h>
  20. #include <linux/kernel.h>
  21. #include <linux/init.h>
  22. #include <linux/io.h>
  23. #include <linux/clk.h>
  24. #include <asm/tlb.h>
  25. #include <asm/mach/map.h>
  26. #include <linux/omap-dma.h>
  27. #include "omap_hwmod.h"
  28. #include "soc.h"
  29. #include "iomap.h"
  30. #include "voltage.h"
  31. #include "powerdomain.h"
  32. #include "clockdomain.h"
  33. #include "common.h"
  34. #include "clock.h"
  35. #include "clock2xxx.h"
  36. #include "clock3xxx.h"
  37. #include "clock44xx.h"
  38. #include "omap-pm.h"
  39. #include "sdrc.h"
  40. #include "control.h"
  41. #include "serial.h"
  42. #include "sram.h"
  43. #include "cm2xxx.h"
  44. #include "cm3xxx.h"
  45. #include "cm33xx.h"
  46. #include "cm44xx.h"
  47. #include "prm.h"
  48. #include "cm.h"
  49. #include "prcm_mpu44xx.h"
  50. #include "prminst44xx.h"
  51. #include "prm2xxx.h"
  52. #include "prm3xxx.h"
  53. #include "prm33xx.h"
  54. #include "prm44xx.h"
  55. #include "opp2xxx.h"
  56. /*
  57. * omap_clk_soc_init: points to a function that does the SoC-specific
  58. * clock initializations
  59. */
  60. static int (*omap_clk_soc_init)(void);
  61. /*
  62. * The machine specific code may provide the extra mapping besides the
  63. * default mapping provided here.
  64. */
  65. #if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430)
  66. static struct map_desc omap24xx_io_desc[] __initdata = {
  67. {
  68. .virtual = L3_24XX_VIRT,
  69. .pfn = __phys_to_pfn(L3_24XX_PHYS),
  70. .length = L3_24XX_SIZE,
  71. .type = MT_DEVICE
  72. },
  73. {
  74. .virtual = L4_24XX_VIRT,
  75. .pfn = __phys_to_pfn(L4_24XX_PHYS),
  76. .length = L4_24XX_SIZE,
  77. .type = MT_DEVICE
  78. },
  79. };
  80. #ifdef CONFIG_SOC_OMAP2420
  81. static struct map_desc omap242x_io_desc[] __initdata = {
  82. {
  83. .virtual = DSP_MEM_2420_VIRT,
  84. .pfn = __phys_to_pfn(DSP_MEM_2420_PHYS),
  85. .length = DSP_MEM_2420_SIZE,
  86. .type = MT_DEVICE
  87. },
  88. {
  89. .virtual = DSP_IPI_2420_VIRT,
  90. .pfn = __phys_to_pfn(DSP_IPI_2420_PHYS),
  91. .length = DSP_IPI_2420_SIZE,
  92. .type = MT_DEVICE
  93. },
  94. {
  95. .virtual = DSP_MMU_2420_VIRT,
  96. .pfn = __phys_to_pfn(DSP_MMU_2420_PHYS),
  97. .length = DSP_MMU_2420_SIZE,
  98. .type = MT_DEVICE
  99. },
  100. };
  101. #endif
  102. #ifdef CONFIG_SOC_OMAP2430
  103. static struct map_desc omap243x_io_desc[] __initdata = {
  104. {
  105. .virtual = L4_WK_243X_VIRT,
  106. .pfn = __phys_to_pfn(L4_WK_243X_PHYS),
  107. .length = L4_WK_243X_SIZE,
  108. .type = MT_DEVICE
  109. },
  110. {
  111. .virtual = OMAP243X_GPMC_VIRT,
  112. .pfn = __phys_to_pfn(OMAP243X_GPMC_PHYS),
  113. .length = OMAP243X_GPMC_SIZE,
  114. .type = MT_DEVICE
  115. },
  116. {
  117. .virtual = OMAP243X_SDRC_VIRT,
  118. .pfn = __phys_to_pfn(OMAP243X_SDRC_PHYS),
  119. .length = OMAP243X_SDRC_SIZE,
  120. .type = MT_DEVICE
  121. },
  122. {
  123. .virtual = OMAP243X_SMS_VIRT,
  124. .pfn = __phys_to_pfn(OMAP243X_SMS_PHYS),
  125. .length = OMAP243X_SMS_SIZE,
  126. .type = MT_DEVICE
  127. },
  128. };
  129. #endif
  130. #endif
  131. #ifdef CONFIG_ARCH_OMAP3
  132. static struct map_desc omap34xx_io_desc[] __initdata = {
  133. {
  134. .virtual = L3_34XX_VIRT,
  135. .pfn = __phys_to_pfn(L3_34XX_PHYS),
  136. .length = L3_34XX_SIZE,
  137. .type = MT_DEVICE
  138. },
  139. {
  140. .virtual = L4_34XX_VIRT,
  141. .pfn = __phys_to_pfn(L4_34XX_PHYS),
  142. .length = L4_34XX_SIZE,
  143. .type = MT_DEVICE
  144. },
  145. {
  146. .virtual = OMAP34XX_GPMC_VIRT,
  147. .pfn = __phys_to_pfn(OMAP34XX_GPMC_PHYS),
  148. .length = OMAP34XX_GPMC_SIZE,
  149. .type = MT_DEVICE
  150. },
  151. {
  152. .virtual = OMAP343X_SMS_VIRT,
  153. .pfn = __phys_to_pfn(OMAP343X_SMS_PHYS),
  154. .length = OMAP343X_SMS_SIZE,
  155. .type = MT_DEVICE
  156. },
  157. {
  158. .virtual = OMAP343X_SDRC_VIRT,
  159. .pfn = __phys_to_pfn(OMAP343X_SDRC_PHYS),
  160. .length = OMAP343X_SDRC_SIZE,
  161. .type = MT_DEVICE
  162. },
  163. {
  164. .virtual = L4_PER_34XX_VIRT,
  165. .pfn = __phys_to_pfn(L4_PER_34XX_PHYS),
  166. .length = L4_PER_34XX_SIZE,
  167. .type = MT_DEVICE
  168. },
  169. {
  170. .virtual = L4_EMU_34XX_VIRT,
  171. .pfn = __phys_to_pfn(L4_EMU_34XX_PHYS),
  172. .length = L4_EMU_34XX_SIZE,
  173. .type = MT_DEVICE
  174. },
  175. };
  176. #endif
  177. #ifdef CONFIG_SOC_TI81XX
  178. static struct map_desc omapti81xx_io_desc[] __initdata = {
  179. {
  180. .virtual = L4_34XX_VIRT,
  181. .pfn = __phys_to_pfn(L4_34XX_PHYS),
  182. .length = L4_34XX_SIZE,
  183. .type = MT_DEVICE
  184. }
  185. };
  186. #endif
  187. #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
  188. static struct map_desc omapam33xx_io_desc[] __initdata = {
  189. {
  190. .virtual = L4_34XX_VIRT,
  191. .pfn = __phys_to_pfn(L4_34XX_PHYS),
  192. .length = L4_34XX_SIZE,
  193. .type = MT_DEVICE
  194. },
  195. {
  196. .virtual = L4_WK_AM33XX_VIRT,
  197. .pfn = __phys_to_pfn(L4_WK_AM33XX_PHYS),
  198. .length = L4_WK_AM33XX_SIZE,
  199. .type = MT_DEVICE
  200. }
  201. };
  202. #endif
  203. #ifdef CONFIG_ARCH_OMAP4
  204. static struct map_desc omap44xx_io_desc[] __initdata = {
  205. {
  206. .virtual = L3_44XX_VIRT,
  207. .pfn = __phys_to_pfn(L3_44XX_PHYS),
  208. .length = L3_44XX_SIZE,
  209. .type = MT_DEVICE,
  210. },
  211. {
  212. .virtual = L4_44XX_VIRT,
  213. .pfn = __phys_to_pfn(L4_44XX_PHYS),
  214. .length = L4_44XX_SIZE,
  215. .type = MT_DEVICE,
  216. },
  217. {
  218. .virtual = L4_PER_44XX_VIRT,
  219. .pfn = __phys_to_pfn(L4_PER_44XX_PHYS),
  220. .length = L4_PER_44XX_SIZE,
  221. .type = MT_DEVICE,
  222. },
  223. };
  224. #endif
  225. #if defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX)
  226. static struct map_desc omap54xx_io_desc[] __initdata = {
  227. {
  228. .virtual = L3_54XX_VIRT,
  229. .pfn = __phys_to_pfn(L3_54XX_PHYS),
  230. .length = L3_54XX_SIZE,
  231. .type = MT_DEVICE,
  232. },
  233. {
  234. .virtual = L4_54XX_VIRT,
  235. .pfn = __phys_to_pfn(L4_54XX_PHYS),
  236. .length = L4_54XX_SIZE,
  237. .type = MT_DEVICE,
  238. },
  239. {
  240. .virtual = L4_WK_54XX_VIRT,
  241. .pfn = __phys_to_pfn(L4_WK_54XX_PHYS),
  242. .length = L4_WK_54XX_SIZE,
  243. .type = MT_DEVICE,
  244. },
  245. {
  246. .virtual = L4_PER_54XX_VIRT,
  247. .pfn = __phys_to_pfn(L4_PER_54XX_PHYS),
  248. .length = L4_PER_54XX_SIZE,
  249. .type = MT_DEVICE,
  250. },
  251. };
  252. #endif
  253. #ifdef CONFIG_SOC_OMAP2420
  254. void __init omap242x_map_io(void)
  255. {
  256. iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
  257. iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
  258. }
  259. #endif
  260. #ifdef CONFIG_SOC_OMAP2430
  261. void __init omap243x_map_io(void)
  262. {
  263. iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
  264. iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
  265. }
  266. #endif
  267. #ifdef CONFIG_ARCH_OMAP3
  268. void __init omap3_map_io(void)
  269. {
  270. iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
  271. }
  272. #endif
  273. #ifdef CONFIG_SOC_TI81XX
  274. void __init ti81xx_map_io(void)
  275. {
  276. iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc));
  277. }
  278. #endif
  279. #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
  280. void __init am33xx_map_io(void)
  281. {
  282. iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc));
  283. }
  284. #endif
  285. #ifdef CONFIG_ARCH_OMAP4
  286. void __init omap4_map_io(void)
  287. {
  288. iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
  289. }
  290. #endif
  291. #if defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX)
  292. void __init omap5_map_io(void)
  293. {
  294. iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc));
  295. }
  296. #endif
  297. /*
  298. * omap2_init_reprogram_sdrc - reprogram SDRC timing parameters
  299. *
  300. * Sets the CORE DPLL3 M2 divider to the same value that it's at
  301. * currently. This has the effect of setting the SDRC SDRAM AC timing
  302. * registers to the values currently defined by the kernel. Currently
  303. * only defined for OMAP3; will return 0 if called on OMAP2. Returns
  304. * -EINVAL if the dpll3_m2_ck cannot be found, 0 if called on OMAP2,
  305. * or passes along the return value of clk_set_rate().
  306. */
  307. static int __init _omap2_init_reprogram_sdrc(void)
  308. {
  309. struct clk *dpll3_m2_ck;
  310. int v = -EINVAL;
  311. long rate;
  312. if (!cpu_is_omap34xx())
  313. return 0;
  314. dpll3_m2_ck = clk_get(NULL, "dpll3_m2_ck");
  315. if (IS_ERR(dpll3_m2_ck))
  316. return -EINVAL;
  317. rate = clk_get_rate(dpll3_m2_ck);
  318. pr_info("Reprogramming SDRC clock to %ld Hz\n", rate);
  319. v = clk_set_rate(dpll3_m2_ck, rate);
  320. if (v)
  321. pr_err("dpll3_m2_clk rate change failed: %d\n", v);
  322. clk_put(dpll3_m2_ck);
  323. return v;
  324. }
  325. static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
  326. {
  327. return omap_hwmod_set_postsetup_state(oh, *(u8 *)data);
  328. }
  329. static void __init omap_hwmod_init_postsetup(void)
  330. {
  331. u8 postsetup_state;
  332. /* Set the default postsetup state for all hwmods */
  333. #ifdef CONFIG_PM
  334. postsetup_state = _HWMOD_STATE_IDLE;
  335. #else
  336. postsetup_state = _HWMOD_STATE_ENABLED;
  337. #endif
  338. omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state);
  339. omap_pm_if_early_init();
  340. }
  341. static void __init __maybe_unused omap_common_late_init(void)
  342. {
  343. omap_mux_late_init();
  344. omap2_common_pm_late_init();
  345. omap_soc_device_init();
  346. }
  347. #ifdef CONFIG_SOC_OMAP2420
  348. void __init omap2420_init_early(void)
  349. {
  350. omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000));
  351. omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
  352. OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE));
  353. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
  354. NULL);
  355. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE));
  356. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE), NULL);
  357. omap2xxx_check_revision();
  358. omap2xxx_prm_init();
  359. omap2xxx_cm_init();
  360. omap2xxx_voltagedomains_init();
  361. omap242x_powerdomains_init();
  362. omap242x_clockdomains_init();
  363. omap2420_hwmod_init();
  364. omap_hwmod_init_postsetup();
  365. omap_clk_soc_init = omap2420_dt_clk_init;
  366. rate_table = omap2420_rate_table;
  367. }
  368. void __init omap2420_init_late(void)
  369. {
  370. omap_common_late_init();
  371. omap2_pm_init();
  372. omap2_clk_enable_autoidle_all();
  373. }
  374. #endif
  375. #ifdef CONFIG_SOC_OMAP2430
  376. void __init omap2430_init_early(void)
  377. {
  378. omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000));
  379. omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
  380. OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));
  381. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
  382. NULL);
  383. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE));
  384. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE), NULL);
  385. omap2xxx_check_revision();
  386. omap2xxx_prm_init();
  387. omap2xxx_cm_init();
  388. omap2xxx_voltagedomains_init();
  389. omap243x_powerdomains_init();
  390. omap243x_clockdomains_init();
  391. omap2430_hwmod_init();
  392. omap_hwmod_init_postsetup();
  393. omap_clk_soc_init = omap2430_dt_clk_init;
  394. rate_table = omap2430_rate_table;
  395. }
  396. void __init omap2430_init_late(void)
  397. {
  398. omap_common_late_init();
  399. omap2_pm_init();
  400. omap2_clk_enable_autoidle_all();
  401. }
  402. #endif
  403. /*
  404. * Currently only board-omap3beagle.c should call this because of the
  405. * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT.
  406. */
  407. #ifdef CONFIG_ARCH_OMAP3
  408. void __init omap3_init_early(void)
  409. {
  410. omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000));
  411. omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
  412. OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));
  413. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
  414. NULL);
  415. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE));
  416. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE), NULL);
  417. omap3xxx_check_revision();
  418. omap3xxx_check_features();
  419. omap3xxx_prm_init();
  420. omap3xxx_cm_init();
  421. omap3xxx_voltagedomains_init();
  422. omap3xxx_powerdomains_init();
  423. omap3xxx_clockdomains_init();
  424. omap3xxx_hwmod_init();
  425. omap_hwmod_init_postsetup();
  426. if (!of_have_populated_dt()) {
  427. omap3_prcm_legacy_iomaps_init();
  428. if (soc_is_am35xx())
  429. omap_clk_soc_init = am35xx_clk_legacy_init;
  430. else if (cpu_is_omap3630())
  431. omap_clk_soc_init = omap36xx_clk_legacy_init;
  432. else if (omap_rev() == OMAP3430_REV_ES1_0)
  433. omap_clk_soc_init = omap3430es1_clk_legacy_init;
  434. else
  435. omap_clk_soc_init = omap3430_clk_legacy_init;
  436. }
  437. }
  438. void __init omap3430_init_early(void)
  439. {
  440. omap3_init_early();
  441. if (of_have_populated_dt())
  442. omap_clk_soc_init = omap3430_dt_clk_init;
  443. }
  444. void __init omap35xx_init_early(void)
  445. {
  446. omap3_init_early();
  447. if (of_have_populated_dt())
  448. omap_clk_soc_init = omap3430_dt_clk_init;
  449. }
  450. void __init omap3630_init_early(void)
  451. {
  452. omap3_init_early();
  453. if (of_have_populated_dt())
  454. omap_clk_soc_init = omap3630_dt_clk_init;
  455. }
  456. void __init am35xx_init_early(void)
  457. {
  458. omap3_init_early();
  459. if (of_have_populated_dt())
  460. omap_clk_soc_init = am35xx_dt_clk_init;
  461. }
  462. void __init omap3_init_late(void)
  463. {
  464. omap_common_late_init();
  465. omap3_pm_init();
  466. omap2_clk_enable_autoidle_all();
  467. }
  468. void __init omap3430_init_late(void)
  469. {
  470. omap_common_late_init();
  471. omap3_pm_init();
  472. omap2_clk_enable_autoidle_all();
  473. }
  474. void __init omap35xx_init_late(void)
  475. {
  476. omap_common_late_init();
  477. omap3_pm_init();
  478. omap2_clk_enable_autoidle_all();
  479. }
  480. void __init omap3630_init_late(void)
  481. {
  482. omap_common_late_init();
  483. omap3_pm_init();
  484. omap2_clk_enable_autoidle_all();
  485. }
  486. void __init am35xx_init_late(void)
  487. {
  488. omap_common_late_init();
  489. omap3_pm_init();
  490. omap2_clk_enable_autoidle_all();
  491. }
  492. void __init ti81xx_init_late(void)
  493. {
  494. omap_common_late_init();
  495. omap2_clk_enable_autoidle_all();
  496. }
  497. #endif
  498. #ifdef CONFIG_SOC_TI81XX
  499. void __init ti814x_init_early(void)
  500. {
  501. omap2_set_globals_tap(TI814X_CLASS,
  502. OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
  503. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
  504. NULL);
  505. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE));
  506. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE), NULL);
  507. omap3xxx_check_revision();
  508. ti81xx_check_features();
  509. am33xx_prm_init();
  510. am33xx_cm_init();
  511. omap3xxx_voltagedomains_init();
  512. omap3xxx_powerdomains_init();
  513. ti81xx_clockdomains_init();
  514. ti81xx_hwmod_init();
  515. omap_hwmod_init_postsetup();
  516. if (of_have_populated_dt())
  517. omap_clk_soc_init = ti81xx_dt_clk_init;
  518. }
  519. void __init ti816x_init_early(void)
  520. {
  521. omap2_set_globals_tap(TI816X_CLASS,
  522. OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
  523. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
  524. NULL);
  525. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE));
  526. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE), NULL);
  527. omap3xxx_check_revision();
  528. ti81xx_check_features();
  529. am33xx_prm_init();
  530. am33xx_cm_init();
  531. omap3xxx_voltagedomains_init();
  532. omap3xxx_powerdomains_init();
  533. ti81xx_clockdomains_init();
  534. ti81xx_hwmod_init();
  535. omap_hwmod_init_postsetup();
  536. if (of_have_populated_dt())
  537. omap_clk_soc_init = ti81xx_dt_clk_init;
  538. }
  539. #endif
  540. #ifdef CONFIG_SOC_AM33XX
  541. void __init am33xx_init_early(void)
  542. {
  543. omap2_set_globals_tap(AM335X_CLASS,
  544. AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
  545. omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
  546. NULL);
  547. omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE));
  548. omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE), NULL);
  549. omap3xxx_check_revision();
  550. am33xx_check_features();
  551. am33xx_prm_init();
  552. am33xx_cm_init();
  553. am33xx_powerdomains_init();
  554. am33xx_clockdomains_init();
  555. am33xx_hwmod_init();
  556. omap_hwmod_init_postsetup();
  557. omap_clk_soc_init = am33xx_dt_clk_init;
  558. }
  559. void __init am33xx_init_late(void)
  560. {
  561. omap_common_late_init();
  562. }
  563. #endif
  564. #ifdef CONFIG_SOC_AM43XX
  565. void __init am43xx_init_early(void)
  566. {
  567. omap2_set_globals_tap(AM335X_CLASS,
  568. AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
  569. omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
  570. NULL);
  571. omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE));
  572. omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE), NULL);
  573. omap_prm_base_init();
  574. omap_cm_base_init();
  575. omap3xxx_check_revision();
  576. am33xx_check_features();
  577. omap44xx_prm_init();
  578. omap4_cm_init();
  579. am43xx_powerdomains_init();
  580. am43xx_clockdomains_init();
  581. am43xx_hwmod_init();
  582. omap_hwmod_init_postsetup();
  583. omap_l2_cache_init();
  584. omap_clk_soc_init = am43xx_dt_clk_init;
  585. }
  586. void __init am43xx_init_late(void)
  587. {
  588. omap_common_late_init();
  589. }
  590. #endif
  591. #ifdef CONFIG_ARCH_OMAP4
  592. void __init omap4430_init_early(void)
  593. {
  594. omap2_set_globals_tap(OMAP443X_CLASS,
  595. OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE));
  596. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
  597. OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE));
  598. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE));
  599. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
  600. OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE));
  601. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE));
  602. omap_prm_base_init();
  603. omap_cm_base_init();
  604. omap4xxx_check_revision();
  605. omap4xxx_check_features();
  606. omap4_cm_init();
  607. omap4_pm_init_early();
  608. omap44xx_prm_init();
  609. omap44xx_voltagedomains_init();
  610. omap44xx_powerdomains_init();
  611. omap44xx_clockdomains_init();
  612. omap44xx_hwmod_init();
  613. omap_hwmod_init_postsetup();
  614. omap_l2_cache_init();
  615. omap_clk_soc_init = omap4xxx_dt_clk_init;
  616. }
  617. void __init omap4430_init_late(void)
  618. {
  619. omap_common_late_init();
  620. omap4_pm_init();
  621. omap2_clk_enable_autoidle_all();
  622. }
  623. #endif
  624. #ifdef CONFIG_SOC_OMAP5
  625. void __init omap5_init_early(void)
  626. {
  627. omap2_set_globals_tap(OMAP54XX_CLASS,
  628. OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
  629. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
  630. OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE));
  631. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE));
  632. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
  633. OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
  634. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
  635. omap4_pm_init_early();
  636. omap_prm_base_init();
  637. omap_cm_base_init();
  638. omap44xx_prm_init();
  639. omap5xxx_check_revision();
  640. omap4_cm_init();
  641. omap54xx_voltagedomains_init();
  642. omap54xx_powerdomains_init();
  643. omap54xx_clockdomains_init();
  644. omap54xx_hwmod_init();
  645. omap_hwmod_init_postsetup();
  646. omap_clk_soc_init = omap5xxx_dt_clk_init;
  647. }
  648. void __init omap5_init_late(void)
  649. {
  650. omap_common_late_init();
  651. omap4_pm_init();
  652. omap2_clk_enable_autoidle_all();
  653. }
  654. #endif
  655. #ifdef CONFIG_SOC_DRA7XX
  656. void __init dra7xx_init_early(void)
  657. {
  658. omap2_set_globals_tap(-1, OMAP2_L4_IO_ADDRESS(DRA7XX_TAP_BASE));
  659. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
  660. OMAP2_L4_IO_ADDRESS(DRA7XX_CTRL_BASE));
  661. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE));
  662. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(DRA7XX_CM_CORE_AON_BASE),
  663. OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
  664. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
  665. omap4_pm_init_early();
  666. omap_prm_base_init();
  667. omap_cm_base_init();
  668. omap44xx_prm_init();
  669. dra7xxx_check_revision();
  670. omap4_cm_init();
  671. dra7xx_powerdomains_init();
  672. dra7xx_clockdomains_init();
  673. dra7xx_hwmod_init();
  674. omap_hwmod_init_postsetup();
  675. omap_clk_soc_init = dra7xx_dt_clk_init;
  676. }
  677. void __init dra7xx_init_late(void)
  678. {
  679. omap_common_late_init();
  680. omap4_pm_init();
  681. omap2_clk_enable_autoidle_all();
  682. }
  683. #endif
  684. void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
  685. struct omap_sdrc_params *sdrc_cs1)
  686. {
  687. omap_sram_init();
  688. if (cpu_is_omap24xx() || omap3_has_sdrc()) {
  689. omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
  690. _omap2_init_reprogram_sdrc();
  691. }
  692. }
  693. int __init omap_clk_init(void)
  694. {
  695. int ret = 0;
  696. if (!omap_clk_soc_init)
  697. return 0;
  698. ti_clk_init_features();
  699. if (of_have_populated_dt()) {
  700. ret = of_prcm_init();
  701. if (ret)
  702. return ret;
  703. of_clk_init(NULL);
  704. ti_dt_clk_init_retry_clks();
  705. ti_dt_clockdomains_setup();
  706. }
  707. ret = omap_clk_soc_init();
  708. return ret;
  709. }