io.c 17 KB

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