io.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  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 ti81xx_init_early(void)
  465. {
  466. omap2_set_globals_tap(OMAP343X_CLASS,
  467. OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
  468. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
  469. NULL);
  470. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE));
  471. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE), NULL);
  472. omap3xxx_check_revision();
  473. ti81xx_check_features();
  474. omap3xxx_voltagedomains_init();
  475. omap3xxx_powerdomains_init();
  476. omap3xxx_clockdomains_init();
  477. omap3xxx_hwmod_init();
  478. omap_hwmod_init_postsetup();
  479. if (of_have_populated_dt())
  480. omap_clk_soc_init = ti81xx_dt_clk_init;
  481. }
  482. void __init omap3_init_late(void)
  483. {
  484. omap_common_late_init();
  485. omap3_pm_init();
  486. omap2_clk_enable_autoidle_all();
  487. }
  488. void __init omap3430_init_late(void)
  489. {
  490. omap_common_late_init();
  491. omap3_pm_init();
  492. omap2_clk_enable_autoidle_all();
  493. }
  494. void __init omap35xx_init_late(void)
  495. {
  496. omap_common_late_init();
  497. omap3_pm_init();
  498. omap2_clk_enable_autoidle_all();
  499. }
  500. void __init omap3630_init_late(void)
  501. {
  502. omap_common_late_init();
  503. omap3_pm_init();
  504. omap2_clk_enable_autoidle_all();
  505. }
  506. void __init am35xx_init_late(void)
  507. {
  508. omap_common_late_init();
  509. omap3_pm_init();
  510. omap2_clk_enable_autoidle_all();
  511. }
  512. void __init ti81xx_init_late(void)
  513. {
  514. omap_common_late_init();
  515. omap3_pm_init();
  516. omap2_clk_enable_autoidle_all();
  517. }
  518. #endif
  519. #ifdef CONFIG_SOC_AM33XX
  520. void __init am33xx_init_early(void)
  521. {
  522. omap2_set_globals_tap(AM335X_CLASS,
  523. AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
  524. omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
  525. NULL);
  526. omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE));
  527. omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE), NULL);
  528. omap3xxx_check_revision();
  529. am33xx_check_features();
  530. am33xx_prm_init();
  531. am33xx_cm_init();
  532. am33xx_powerdomains_init();
  533. am33xx_clockdomains_init();
  534. am33xx_hwmod_init();
  535. omap_hwmod_init_postsetup();
  536. omap_clk_soc_init = am33xx_dt_clk_init;
  537. }
  538. void __init am33xx_init_late(void)
  539. {
  540. omap_common_late_init();
  541. }
  542. #endif
  543. #ifdef CONFIG_SOC_AM43XX
  544. void __init am43xx_init_early(void)
  545. {
  546. omap2_set_globals_tap(AM335X_CLASS,
  547. AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
  548. omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
  549. NULL);
  550. omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE));
  551. omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE), NULL);
  552. omap_prm_base_init();
  553. omap_cm_base_init();
  554. omap3xxx_check_revision();
  555. am33xx_check_features();
  556. omap44xx_prm_init();
  557. omap4_cm_init();
  558. am43xx_powerdomains_init();
  559. am43xx_clockdomains_init();
  560. am43xx_hwmod_init();
  561. omap_hwmod_init_postsetup();
  562. omap_l2_cache_init();
  563. omap_clk_soc_init = am43xx_dt_clk_init;
  564. }
  565. void __init am43xx_init_late(void)
  566. {
  567. omap_common_late_init();
  568. }
  569. #endif
  570. #ifdef CONFIG_ARCH_OMAP4
  571. void __init omap4430_init_early(void)
  572. {
  573. omap2_set_globals_tap(OMAP443X_CLASS,
  574. OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE));
  575. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
  576. OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE));
  577. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE));
  578. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
  579. OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE));
  580. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE));
  581. omap_prm_base_init();
  582. omap_cm_base_init();
  583. omap4xxx_check_revision();
  584. omap4xxx_check_features();
  585. omap4_cm_init();
  586. omap4_pm_init_early();
  587. omap44xx_prm_init();
  588. omap44xx_voltagedomains_init();
  589. omap44xx_powerdomains_init();
  590. omap44xx_clockdomains_init();
  591. omap44xx_hwmod_init();
  592. omap_hwmod_init_postsetup();
  593. omap_l2_cache_init();
  594. omap_clk_soc_init = omap4xxx_dt_clk_init;
  595. }
  596. void __init omap4430_init_late(void)
  597. {
  598. omap_common_late_init();
  599. omap4_pm_init();
  600. omap2_clk_enable_autoidle_all();
  601. }
  602. #endif
  603. #ifdef CONFIG_SOC_OMAP5
  604. void __init omap5_init_early(void)
  605. {
  606. omap2_set_globals_tap(OMAP54XX_CLASS,
  607. OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
  608. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
  609. OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE));
  610. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE));
  611. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
  612. OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
  613. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
  614. omap4_pm_init_early();
  615. omap_prm_base_init();
  616. omap_cm_base_init();
  617. omap44xx_prm_init();
  618. omap5xxx_check_revision();
  619. omap4_cm_init();
  620. omap54xx_voltagedomains_init();
  621. omap54xx_powerdomains_init();
  622. omap54xx_clockdomains_init();
  623. omap54xx_hwmod_init();
  624. omap_hwmod_init_postsetup();
  625. omap_clk_soc_init = omap5xxx_dt_clk_init;
  626. }
  627. void __init omap5_init_late(void)
  628. {
  629. omap_common_late_init();
  630. omap4_pm_init();
  631. omap2_clk_enable_autoidle_all();
  632. }
  633. #endif
  634. #ifdef CONFIG_SOC_DRA7XX
  635. void __init dra7xx_init_early(void)
  636. {
  637. omap2_set_globals_tap(-1, OMAP2_L4_IO_ADDRESS(DRA7XX_TAP_BASE));
  638. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
  639. OMAP2_L4_IO_ADDRESS(DRA7XX_CTRL_BASE));
  640. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE));
  641. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(DRA7XX_CM_CORE_AON_BASE),
  642. OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
  643. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
  644. omap4_pm_init_early();
  645. omap_prm_base_init();
  646. omap_cm_base_init();
  647. omap44xx_prm_init();
  648. dra7xxx_check_revision();
  649. omap4_cm_init();
  650. dra7xx_powerdomains_init();
  651. dra7xx_clockdomains_init();
  652. dra7xx_hwmod_init();
  653. omap_hwmod_init_postsetup();
  654. omap_clk_soc_init = dra7xx_dt_clk_init;
  655. }
  656. void __init dra7xx_init_late(void)
  657. {
  658. omap_common_late_init();
  659. omap4_pm_init();
  660. omap2_clk_enable_autoidle_all();
  661. }
  662. #endif
  663. void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
  664. struct omap_sdrc_params *sdrc_cs1)
  665. {
  666. omap_sram_init();
  667. if (cpu_is_omap24xx() || omap3_has_sdrc()) {
  668. omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
  669. _omap2_init_reprogram_sdrc();
  670. }
  671. }
  672. int __init omap_clk_init(void)
  673. {
  674. int ret = 0;
  675. if (!omap_clk_soc_init)
  676. return 0;
  677. ti_clk_init_features();
  678. if (of_have_populated_dt()) {
  679. ret = of_prcm_init();
  680. if (ret)
  681. return ret;
  682. of_clk_init(NULL);
  683. ti_dt_clk_init_retry_clks();
  684. ti_dt_clockdomains_setup();
  685. }
  686. ret = omap_clk_soc_init();
  687. return ret;
  688. }