io.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  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. omap_barriers_init();
  290. }
  291. #endif
  292. #if defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX)
  293. void __init omap5_map_io(void)
  294. {
  295. iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc));
  296. omap_barriers_init();
  297. }
  298. #endif
  299. /*
  300. * omap2_init_reprogram_sdrc - reprogram SDRC timing parameters
  301. *
  302. * Sets the CORE DPLL3 M2 divider to the same value that it's at
  303. * currently. This has the effect of setting the SDRC SDRAM AC timing
  304. * registers to the values currently defined by the kernel. Currently
  305. * only defined for OMAP3; will return 0 if called on OMAP2. Returns
  306. * -EINVAL if the dpll3_m2_ck cannot be found, 0 if called on OMAP2,
  307. * or passes along the return value of clk_set_rate().
  308. */
  309. static int __init _omap2_init_reprogram_sdrc(void)
  310. {
  311. struct clk *dpll3_m2_ck;
  312. int v = -EINVAL;
  313. long rate;
  314. if (!cpu_is_omap34xx())
  315. return 0;
  316. dpll3_m2_ck = clk_get(NULL, "dpll3_m2_ck");
  317. if (IS_ERR(dpll3_m2_ck))
  318. return -EINVAL;
  319. rate = clk_get_rate(dpll3_m2_ck);
  320. pr_info("Reprogramming SDRC clock to %ld Hz\n", rate);
  321. v = clk_set_rate(dpll3_m2_ck, rate);
  322. if (v)
  323. pr_err("dpll3_m2_clk rate change failed: %d\n", v);
  324. clk_put(dpll3_m2_ck);
  325. return v;
  326. }
  327. static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
  328. {
  329. return omap_hwmod_set_postsetup_state(oh, *(u8 *)data);
  330. }
  331. static void __init omap_hwmod_init_postsetup(void)
  332. {
  333. u8 postsetup_state;
  334. /* Set the default postsetup state for all hwmods */
  335. #ifdef CONFIG_PM
  336. postsetup_state = _HWMOD_STATE_IDLE;
  337. #else
  338. postsetup_state = _HWMOD_STATE_ENABLED;
  339. #endif
  340. omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state);
  341. omap_pm_if_early_init();
  342. }
  343. static void __init __maybe_unused omap_common_late_init(void)
  344. {
  345. omap_mux_late_init();
  346. omap2_common_pm_late_init();
  347. omap_soc_device_init();
  348. }
  349. #ifdef CONFIG_SOC_OMAP2420
  350. void __init omap2420_init_early(void)
  351. {
  352. omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000));
  353. omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
  354. OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE));
  355. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
  356. NULL);
  357. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE));
  358. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE), NULL);
  359. omap2xxx_check_revision();
  360. omap2xxx_prm_init();
  361. omap2xxx_cm_init();
  362. omap2xxx_voltagedomains_init();
  363. omap242x_powerdomains_init();
  364. omap242x_clockdomains_init();
  365. omap2420_hwmod_init();
  366. omap_hwmod_init_postsetup();
  367. omap_clk_soc_init = omap2420_dt_clk_init;
  368. rate_table = omap2420_rate_table;
  369. }
  370. void __init omap2420_init_late(void)
  371. {
  372. omap_common_late_init();
  373. omap2_pm_init();
  374. omap2_clk_enable_autoidle_all();
  375. }
  376. #endif
  377. #ifdef CONFIG_SOC_OMAP2430
  378. void __init omap2430_init_early(void)
  379. {
  380. omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000));
  381. omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
  382. OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));
  383. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
  384. NULL);
  385. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE));
  386. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE), NULL);
  387. omap2xxx_check_revision();
  388. omap2xxx_prm_init();
  389. omap2xxx_cm_init();
  390. omap2xxx_voltagedomains_init();
  391. omap243x_powerdomains_init();
  392. omap243x_clockdomains_init();
  393. omap2430_hwmod_init();
  394. omap_hwmod_init_postsetup();
  395. omap_clk_soc_init = omap2430_dt_clk_init;
  396. rate_table = omap2430_rate_table;
  397. }
  398. void __init omap2430_init_late(void)
  399. {
  400. omap_common_late_init();
  401. omap2_pm_init();
  402. omap2_clk_enable_autoidle_all();
  403. }
  404. #endif
  405. /*
  406. * Currently only board-omap3beagle.c should call this because of the
  407. * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT.
  408. */
  409. #ifdef CONFIG_ARCH_OMAP3
  410. void __init omap3_init_early(void)
  411. {
  412. omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000));
  413. omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
  414. OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));
  415. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
  416. NULL);
  417. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE));
  418. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE), NULL);
  419. omap3xxx_check_revision();
  420. omap3xxx_check_features();
  421. omap3xxx_prm_init();
  422. omap3xxx_cm_init();
  423. omap3xxx_voltagedomains_init();
  424. omap3xxx_powerdomains_init();
  425. omap3xxx_clockdomains_init();
  426. omap3xxx_hwmod_init();
  427. omap_hwmod_init_postsetup();
  428. if (!of_have_populated_dt()) {
  429. omap3_prcm_legacy_iomaps_init();
  430. if (soc_is_am35xx())
  431. omap_clk_soc_init = am35xx_clk_legacy_init;
  432. else if (cpu_is_omap3630())
  433. omap_clk_soc_init = omap36xx_clk_legacy_init;
  434. else if (omap_rev() == OMAP3430_REV_ES1_0)
  435. omap_clk_soc_init = omap3430es1_clk_legacy_init;
  436. else
  437. omap_clk_soc_init = omap3430_clk_legacy_init;
  438. }
  439. }
  440. void __init omap3430_init_early(void)
  441. {
  442. omap3_init_early();
  443. if (of_have_populated_dt())
  444. omap_clk_soc_init = omap3430_dt_clk_init;
  445. }
  446. void __init omap35xx_init_early(void)
  447. {
  448. omap3_init_early();
  449. if (of_have_populated_dt())
  450. omap_clk_soc_init = omap3430_dt_clk_init;
  451. }
  452. void __init omap3630_init_early(void)
  453. {
  454. omap3_init_early();
  455. if (of_have_populated_dt())
  456. omap_clk_soc_init = omap3630_dt_clk_init;
  457. }
  458. void __init am35xx_init_early(void)
  459. {
  460. omap3_init_early();
  461. if (of_have_populated_dt())
  462. omap_clk_soc_init = am35xx_dt_clk_init;
  463. }
  464. void __init omap3_init_late(void)
  465. {
  466. omap_common_late_init();
  467. omap3_pm_init();
  468. omap2_clk_enable_autoidle_all();
  469. }
  470. void __init omap3430_init_late(void)
  471. {
  472. omap_common_late_init();
  473. omap3_pm_init();
  474. omap2_clk_enable_autoidle_all();
  475. }
  476. void __init omap35xx_init_late(void)
  477. {
  478. omap_common_late_init();
  479. omap3_pm_init();
  480. omap2_clk_enable_autoidle_all();
  481. }
  482. void __init omap3630_init_late(void)
  483. {
  484. omap_common_late_init();
  485. omap3_pm_init();
  486. omap2_clk_enable_autoidle_all();
  487. }
  488. void __init am35xx_init_late(void)
  489. {
  490. omap_common_late_init();
  491. omap3_pm_init();
  492. omap2_clk_enable_autoidle_all();
  493. }
  494. void __init ti81xx_init_late(void)
  495. {
  496. omap_common_late_init();
  497. omap2_clk_enable_autoidle_all();
  498. }
  499. #endif
  500. #ifdef CONFIG_SOC_TI81XX
  501. void __init ti814x_init_early(void)
  502. {
  503. omap2_set_globals_tap(TI814X_CLASS,
  504. OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
  505. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
  506. NULL);
  507. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE));
  508. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE), NULL);
  509. omap3xxx_check_revision();
  510. ti81xx_check_features();
  511. am33xx_prm_init();
  512. am33xx_cm_init();
  513. omap3xxx_voltagedomains_init();
  514. omap3xxx_powerdomains_init();
  515. ti81xx_clockdomains_init();
  516. ti81xx_hwmod_init();
  517. omap_hwmod_init_postsetup();
  518. if (of_have_populated_dt())
  519. omap_clk_soc_init = ti81xx_dt_clk_init;
  520. }
  521. void __init ti816x_init_early(void)
  522. {
  523. omap2_set_globals_tap(TI816X_CLASS,
  524. OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
  525. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
  526. NULL);
  527. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE));
  528. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE), NULL);
  529. omap3xxx_check_revision();
  530. ti81xx_check_features();
  531. am33xx_prm_init();
  532. am33xx_cm_init();
  533. omap3xxx_voltagedomains_init();
  534. omap3xxx_powerdomains_init();
  535. ti81xx_clockdomains_init();
  536. ti81xx_hwmod_init();
  537. omap_hwmod_init_postsetup();
  538. if (of_have_populated_dt())
  539. omap_clk_soc_init = ti81xx_dt_clk_init;
  540. }
  541. #endif
  542. #ifdef CONFIG_SOC_AM33XX
  543. void __init am33xx_init_early(void)
  544. {
  545. omap2_set_globals_tap(AM335X_CLASS,
  546. AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
  547. omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
  548. NULL);
  549. omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE));
  550. omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE), NULL);
  551. omap3xxx_check_revision();
  552. am33xx_check_features();
  553. am33xx_prm_init();
  554. am33xx_cm_init();
  555. am33xx_powerdomains_init();
  556. am33xx_clockdomains_init();
  557. am33xx_hwmod_init();
  558. omap_hwmod_init_postsetup();
  559. omap_clk_soc_init = am33xx_dt_clk_init;
  560. }
  561. void __init am33xx_init_late(void)
  562. {
  563. omap_common_late_init();
  564. }
  565. #endif
  566. #ifdef CONFIG_SOC_AM43XX
  567. void __init am43xx_init_early(void)
  568. {
  569. omap2_set_globals_tap(AM335X_CLASS,
  570. AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
  571. omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
  572. NULL);
  573. omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE));
  574. omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE), NULL);
  575. omap_prm_base_init();
  576. omap_cm_base_init();
  577. omap3xxx_check_revision();
  578. am33xx_check_features();
  579. omap44xx_prm_init();
  580. omap4_cm_init();
  581. am43xx_powerdomains_init();
  582. am43xx_clockdomains_init();
  583. am43xx_hwmod_init();
  584. omap_hwmod_init_postsetup();
  585. omap_l2_cache_init();
  586. omap_clk_soc_init = am43xx_dt_clk_init;
  587. }
  588. void __init am43xx_init_late(void)
  589. {
  590. omap_common_late_init();
  591. }
  592. #endif
  593. #ifdef CONFIG_ARCH_OMAP4
  594. void __init omap4430_init_early(void)
  595. {
  596. omap2_set_globals_tap(OMAP443X_CLASS,
  597. OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE));
  598. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
  599. OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE));
  600. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE));
  601. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
  602. OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE));
  603. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE));
  604. omap_prm_base_init();
  605. omap_cm_base_init();
  606. omap4xxx_check_revision();
  607. omap4xxx_check_features();
  608. omap4_cm_init();
  609. omap4_pm_init_early();
  610. omap44xx_prm_init();
  611. omap44xx_voltagedomains_init();
  612. omap44xx_powerdomains_init();
  613. omap44xx_clockdomains_init();
  614. omap44xx_hwmod_init();
  615. omap_hwmod_init_postsetup();
  616. omap_l2_cache_init();
  617. omap_clk_soc_init = omap4xxx_dt_clk_init;
  618. }
  619. void __init omap4430_init_late(void)
  620. {
  621. omap_common_late_init();
  622. omap4_pm_init();
  623. omap2_clk_enable_autoidle_all();
  624. }
  625. #endif
  626. #ifdef CONFIG_SOC_OMAP5
  627. void __init omap5_init_early(void)
  628. {
  629. omap2_set_globals_tap(OMAP54XX_CLASS,
  630. OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
  631. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
  632. OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE));
  633. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE));
  634. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
  635. OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
  636. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
  637. omap4_pm_init_early();
  638. omap_prm_base_init();
  639. omap_cm_base_init();
  640. omap44xx_prm_init();
  641. omap5xxx_check_revision();
  642. omap4_cm_init();
  643. omap54xx_voltagedomains_init();
  644. omap54xx_powerdomains_init();
  645. omap54xx_clockdomains_init();
  646. omap54xx_hwmod_init();
  647. omap_hwmod_init_postsetup();
  648. omap_clk_soc_init = omap5xxx_dt_clk_init;
  649. }
  650. void __init omap5_init_late(void)
  651. {
  652. omap_common_late_init();
  653. omap4_pm_init();
  654. omap2_clk_enable_autoidle_all();
  655. }
  656. #endif
  657. #ifdef CONFIG_SOC_DRA7XX
  658. void __init dra7xx_init_early(void)
  659. {
  660. omap2_set_globals_tap(-1, OMAP2_L4_IO_ADDRESS(DRA7XX_TAP_BASE));
  661. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
  662. OMAP2_L4_IO_ADDRESS(DRA7XX_CTRL_BASE));
  663. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE));
  664. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(DRA7XX_CM_CORE_AON_BASE),
  665. OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
  666. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
  667. omap4_pm_init_early();
  668. omap_prm_base_init();
  669. omap_cm_base_init();
  670. omap44xx_prm_init();
  671. dra7xxx_check_revision();
  672. omap4_cm_init();
  673. dra7xx_powerdomains_init();
  674. dra7xx_clockdomains_init();
  675. dra7xx_hwmod_init();
  676. omap_hwmod_init_postsetup();
  677. omap_clk_soc_init = dra7xx_dt_clk_init;
  678. }
  679. void __init dra7xx_init_late(void)
  680. {
  681. omap_common_late_init();
  682. omap4_pm_init();
  683. omap2_clk_enable_autoidle_all();
  684. }
  685. #endif
  686. void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
  687. struct omap_sdrc_params *sdrc_cs1)
  688. {
  689. omap_sram_init();
  690. if (cpu_is_omap24xx() || omap3_has_sdrc()) {
  691. omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
  692. _omap2_init_reprogram_sdrc();
  693. }
  694. }
  695. int __init omap_clk_init(void)
  696. {
  697. int ret = 0;
  698. if (!omap_clk_soc_init)
  699. return 0;
  700. ti_clk_init_features();
  701. if (of_have_populated_dt()) {
  702. ret = omap_prcm_init();
  703. if (ret)
  704. return ret;
  705. of_clk_init(NULL);
  706. ti_dt_clk_init_retry_clks();
  707. ti_dt_clockdomains_setup();
  708. }
  709. ret = omap_clk_soc_init();
  710. return ret;
  711. }