io.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  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_control_base_init();
  354. omap2xxx_check_revision();
  355. omap2_prcm_base_init();
  356. omap2xxx_voltagedomains_init();
  357. omap242x_powerdomains_init();
  358. omap242x_clockdomains_init();
  359. omap2420_hwmod_init();
  360. omap_hwmod_init_postsetup();
  361. omap_clk_soc_init = omap2420_dt_clk_init;
  362. rate_table = omap2420_rate_table;
  363. }
  364. void __init omap2420_init_late(void)
  365. {
  366. omap_common_late_init();
  367. omap2_pm_init();
  368. omap2_clk_enable_autoidle_all();
  369. }
  370. #endif
  371. #ifdef CONFIG_SOC_OMAP2430
  372. void __init omap2430_init_early(void)
  373. {
  374. omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000));
  375. omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
  376. OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));
  377. omap2_control_base_init();
  378. omap2xxx_check_revision();
  379. omap2_prcm_base_init();
  380. omap2xxx_voltagedomains_init();
  381. omap243x_powerdomains_init();
  382. omap243x_clockdomains_init();
  383. omap2430_hwmod_init();
  384. omap_hwmod_init_postsetup();
  385. omap_clk_soc_init = omap2430_dt_clk_init;
  386. rate_table = omap2430_rate_table;
  387. }
  388. void __init omap2430_init_late(void)
  389. {
  390. omap_common_late_init();
  391. omap2_pm_init();
  392. omap2_clk_enable_autoidle_all();
  393. }
  394. #endif
  395. /*
  396. * Currently only board-omap3beagle.c should call this because of the
  397. * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT.
  398. */
  399. #ifdef CONFIG_ARCH_OMAP3
  400. void __init omap3_init_early(void)
  401. {
  402. omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000));
  403. omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
  404. OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));
  405. /* XXX: remove these once OMAP3 is DT only */
  406. if (!of_have_populated_dt()) {
  407. omap2_set_globals_control(
  408. OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE));
  409. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE));
  410. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
  411. NULL);
  412. }
  413. omap2_control_base_init();
  414. omap3xxx_check_revision();
  415. omap3xxx_check_features();
  416. omap2_prcm_base_init();
  417. /* XXX: remove these once OMAP3 is DT only */
  418. if (!of_have_populated_dt()) {
  419. omap3xxx_prm_init(NULL);
  420. omap3xxx_cm_init(NULL);
  421. }
  422. omap3xxx_voltagedomains_init();
  423. omap3xxx_powerdomains_init();
  424. omap3xxx_clockdomains_init();
  425. omap3xxx_hwmod_init();
  426. omap_hwmod_init_postsetup();
  427. if (!of_have_populated_dt()) {
  428. omap3_control_legacy_iomap_init();
  429. if (soc_is_am35xx())
  430. omap_clk_soc_init = am35xx_clk_legacy_init;
  431. else if (cpu_is_omap3630())
  432. omap_clk_soc_init = omap36xx_clk_legacy_init;
  433. else if (omap_rev() == OMAP3430_REV_ES1_0)
  434. omap_clk_soc_init = omap3430es1_clk_legacy_init;
  435. else
  436. omap_clk_soc_init = omap3430_clk_legacy_init;
  437. }
  438. }
  439. void __init omap3430_init_early(void)
  440. {
  441. omap3_init_early();
  442. if (of_have_populated_dt())
  443. omap_clk_soc_init = omap3430_dt_clk_init;
  444. }
  445. void __init omap35xx_init_early(void)
  446. {
  447. omap3_init_early();
  448. if (of_have_populated_dt())
  449. omap_clk_soc_init = omap3430_dt_clk_init;
  450. }
  451. void __init omap3630_init_early(void)
  452. {
  453. omap3_init_early();
  454. if (of_have_populated_dt())
  455. omap_clk_soc_init = omap3630_dt_clk_init;
  456. }
  457. void __init am35xx_init_early(void)
  458. {
  459. omap3_init_early();
  460. if (of_have_populated_dt())
  461. omap_clk_soc_init = am35xx_dt_clk_init;
  462. }
  463. void __init omap3_init_late(void)
  464. {
  465. omap_common_late_init();
  466. omap3_pm_init();
  467. omap2_clk_enable_autoidle_all();
  468. }
  469. void __init omap3430_init_late(void)
  470. {
  471. omap_common_late_init();
  472. omap3_pm_init();
  473. omap2_clk_enable_autoidle_all();
  474. }
  475. void __init omap35xx_init_late(void)
  476. {
  477. omap_common_late_init();
  478. omap3_pm_init();
  479. omap2_clk_enable_autoidle_all();
  480. }
  481. void __init omap3630_init_late(void)
  482. {
  483. omap_common_late_init();
  484. omap3_pm_init();
  485. omap2_clk_enable_autoidle_all();
  486. }
  487. void __init am35xx_init_late(void)
  488. {
  489. omap_common_late_init();
  490. omap3_pm_init();
  491. omap2_clk_enable_autoidle_all();
  492. }
  493. void __init ti81xx_init_late(void)
  494. {
  495. omap_common_late_init();
  496. omap2_clk_enable_autoidle_all();
  497. }
  498. #endif
  499. #ifdef CONFIG_SOC_TI81XX
  500. void __init ti814x_init_early(void)
  501. {
  502. omap2_set_globals_tap(TI814X_CLASS,
  503. OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
  504. omap2_control_base_init();
  505. omap3xxx_check_revision();
  506. ti81xx_check_features();
  507. omap2_prcm_base_init();
  508. omap3xxx_voltagedomains_init();
  509. omap3xxx_powerdomains_init();
  510. ti814x_clockdomains_init();
  511. dm814x_hwmod_init();
  512. omap_hwmod_init_postsetup();
  513. if (of_have_populated_dt())
  514. omap_clk_soc_init = dm814x_dt_clk_init;
  515. }
  516. void __init ti816x_init_early(void)
  517. {
  518. omap2_set_globals_tap(TI816X_CLASS,
  519. OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
  520. omap2_control_base_init();
  521. omap3xxx_check_revision();
  522. ti81xx_check_features();
  523. omap2_prcm_base_init();
  524. omap3xxx_voltagedomains_init();
  525. omap3xxx_powerdomains_init();
  526. ti816x_clockdomains_init();
  527. dm816x_hwmod_init();
  528. omap_hwmod_init_postsetup();
  529. if (of_have_populated_dt())
  530. omap_clk_soc_init = dm816x_dt_clk_init;
  531. }
  532. #endif
  533. #ifdef CONFIG_SOC_AM33XX
  534. void __init am33xx_init_early(void)
  535. {
  536. omap2_set_globals_tap(AM335X_CLASS,
  537. AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
  538. omap2_control_base_init();
  539. omap3xxx_check_revision();
  540. am33xx_check_features();
  541. omap2_prcm_base_init();
  542. am33xx_powerdomains_init();
  543. am33xx_clockdomains_init();
  544. am33xx_hwmod_init();
  545. omap_hwmod_init_postsetup();
  546. omap_clk_soc_init = am33xx_dt_clk_init;
  547. }
  548. void __init am33xx_init_late(void)
  549. {
  550. omap_common_late_init();
  551. }
  552. #endif
  553. #ifdef CONFIG_SOC_AM43XX
  554. void __init am43xx_init_early(void)
  555. {
  556. omap2_set_globals_tap(AM335X_CLASS,
  557. AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
  558. omap2_control_base_init();
  559. omap3xxx_check_revision();
  560. am33xx_check_features();
  561. omap2_prcm_base_init();
  562. am43xx_powerdomains_init();
  563. am43xx_clockdomains_init();
  564. am43xx_hwmod_init();
  565. omap_hwmod_init_postsetup();
  566. omap_l2_cache_init();
  567. omap_clk_soc_init = am43xx_dt_clk_init;
  568. }
  569. void __init am43xx_init_late(void)
  570. {
  571. omap_common_late_init();
  572. }
  573. #endif
  574. #ifdef CONFIG_ARCH_OMAP4
  575. void __init omap4430_init_early(void)
  576. {
  577. omap2_set_globals_tap(OMAP443X_CLASS,
  578. OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE));
  579. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE));
  580. omap2_control_base_init();
  581. omap4xxx_check_revision();
  582. omap4xxx_check_features();
  583. omap2_prcm_base_init();
  584. omap4_pm_init_early();
  585. omap44xx_voltagedomains_init();
  586. omap44xx_powerdomains_init();
  587. omap44xx_clockdomains_init();
  588. omap44xx_hwmod_init();
  589. omap_hwmod_init_postsetup();
  590. omap_l2_cache_init();
  591. omap_clk_soc_init = omap4xxx_dt_clk_init;
  592. }
  593. void __init omap4430_init_late(void)
  594. {
  595. omap_common_late_init();
  596. omap4_pm_init();
  597. omap2_clk_enable_autoidle_all();
  598. }
  599. #endif
  600. #ifdef CONFIG_SOC_OMAP5
  601. void __init omap5_init_early(void)
  602. {
  603. omap2_set_globals_tap(OMAP54XX_CLASS,
  604. OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
  605. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
  606. omap2_control_base_init();
  607. omap4_pm_init_early();
  608. omap2_prcm_base_init();
  609. omap5xxx_check_revision();
  610. omap54xx_voltagedomains_init();
  611. omap54xx_powerdomains_init();
  612. omap54xx_clockdomains_init();
  613. omap54xx_hwmod_init();
  614. omap_hwmod_init_postsetup();
  615. omap_clk_soc_init = omap5xxx_dt_clk_init;
  616. }
  617. void __init omap5_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_DRA7XX
  625. void __init dra7xx_init_early(void)
  626. {
  627. omap2_set_globals_tap(-1, OMAP2_L4_IO_ADDRESS(DRA7XX_TAP_BASE));
  628. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
  629. omap2_control_base_init();
  630. omap4_pm_init_early();
  631. omap2_prcm_base_init();
  632. dra7xxx_check_revision();
  633. dra7xx_powerdomains_init();
  634. dra7xx_clockdomains_init();
  635. dra7xx_hwmod_init();
  636. omap_hwmod_init_postsetup();
  637. omap_clk_soc_init = dra7xx_dt_clk_init;
  638. }
  639. void __init dra7xx_init_late(void)
  640. {
  641. omap_common_late_init();
  642. omap4_pm_init();
  643. omap2_clk_enable_autoidle_all();
  644. }
  645. #endif
  646. void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
  647. struct omap_sdrc_params *sdrc_cs1)
  648. {
  649. omap_sram_init();
  650. if (cpu_is_omap24xx() || omap3_has_sdrc()) {
  651. omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
  652. _omap2_init_reprogram_sdrc();
  653. }
  654. }
  655. int __init omap_clk_init(void)
  656. {
  657. int ret = 0;
  658. if (!omap_clk_soc_init)
  659. return 0;
  660. ti_clk_init_features();
  661. if (of_have_populated_dt()) {
  662. ret = omap_control_init();
  663. if (ret)
  664. return ret;
  665. ret = omap_prcm_init();
  666. if (ret)
  667. return ret;
  668. of_clk_init(NULL);
  669. ti_dt_clk_init_retry_clks();
  670. ti_dt_clockdomains_setup();
  671. }
  672. ret = omap_clk_soc_init();
  673. return ret;
  674. }