io.c 18 KB

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