io.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  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. #include "opp2xxx.h"
  54. /*
  55. * omap_clk_soc_init: points to a function that does the SoC-specific
  56. * clock initializations
  57. */
  58. static int (*omap_clk_soc_init)(void);
  59. /*
  60. * The machine specific code may provide the extra mapping besides the
  61. * default mapping provided here.
  62. */
  63. #if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430)
  64. static struct map_desc omap24xx_io_desc[] __initdata = {
  65. {
  66. .virtual = L3_24XX_VIRT,
  67. .pfn = __phys_to_pfn(L3_24XX_PHYS),
  68. .length = L3_24XX_SIZE,
  69. .type = MT_DEVICE
  70. },
  71. {
  72. .virtual = L4_24XX_VIRT,
  73. .pfn = __phys_to_pfn(L4_24XX_PHYS),
  74. .length = L4_24XX_SIZE,
  75. .type = MT_DEVICE
  76. },
  77. };
  78. #ifdef CONFIG_SOC_OMAP2420
  79. static struct map_desc omap242x_io_desc[] __initdata = {
  80. {
  81. .virtual = DSP_MEM_2420_VIRT,
  82. .pfn = __phys_to_pfn(DSP_MEM_2420_PHYS),
  83. .length = DSP_MEM_2420_SIZE,
  84. .type = MT_DEVICE
  85. },
  86. {
  87. .virtual = DSP_IPI_2420_VIRT,
  88. .pfn = __phys_to_pfn(DSP_IPI_2420_PHYS),
  89. .length = DSP_IPI_2420_SIZE,
  90. .type = MT_DEVICE
  91. },
  92. {
  93. .virtual = DSP_MMU_2420_VIRT,
  94. .pfn = __phys_to_pfn(DSP_MMU_2420_PHYS),
  95. .length = DSP_MMU_2420_SIZE,
  96. .type = MT_DEVICE
  97. },
  98. };
  99. #endif
  100. #ifdef CONFIG_SOC_OMAP2430
  101. static struct map_desc omap243x_io_desc[] __initdata = {
  102. {
  103. .virtual = L4_WK_243X_VIRT,
  104. .pfn = __phys_to_pfn(L4_WK_243X_PHYS),
  105. .length = L4_WK_243X_SIZE,
  106. .type = MT_DEVICE
  107. },
  108. {
  109. .virtual = OMAP243X_GPMC_VIRT,
  110. .pfn = __phys_to_pfn(OMAP243X_GPMC_PHYS),
  111. .length = OMAP243X_GPMC_SIZE,
  112. .type = MT_DEVICE
  113. },
  114. {
  115. .virtual = OMAP243X_SDRC_VIRT,
  116. .pfn = __phys_to_pfn(OMAP243X_SDRC_PHYS),
  117. .length = OMAP243X_SDRC_SIZE,
  118. .type = MT_DEVICE
  119. },
  120. {
  121. .virtual = OMAP243X_SMS_VIRT,
  122. .pfn = __phys_to_pfn(OMAP243X_SMS_PHYS),
  123. .length = OMAP243X_SMS_SIZE,
  124. .type = MT_DEVICE
  125. },
  126. };
  127. #endif
  128. #endif
  129. #ifdef CONFIG_ARCH_OMAP3
  130. static struct map_desc omap34xx_io_desc[] __initdata = {
  131. {
  132. .virtual = L3_34XX_VIRT,
  133. .pfn = __phys_to_pfn(L3_34XX_PHYS),
  134. .length = L3_34XX_SIZE,
  135. .type = MT_DEVICE
  136. },
  137. {
  138. .virtual = L4_34XX_VIRT,
  139. .pfn = __phys_to_pfn(L4_34XX_PHYS),
  140. .length = L4_34XX_SIZE,
  141. .type = MT_DEVICE
  142. },
  143. {
  144. .virtual = OMAP34XX_GPMC_VIRT,
  145. .pfn = __phys_to_pfn(OMAP34XX_GPMC_PHYS),
  146. .length = OMAP34XX_GPMC_SIZE,
  147. .type = MT_DEVICE
  148. },
  149. {
  150. .virtual = OMAP343X_SMS_VIRT,
  151. .pfn = __phys_to_pfn(OMAP343X_SMS_PHYS),
  152. .length = OMAP343X_SMS_SIZE,
  153. .type = MT_DEVICE
  154. },
  155. {
  156. .virtual = OMAP343X_SDRC_VIRT,
  157. .pfn = __phys_to_pfn(OMAP343X_SDRC_PHYS),
  158. .length = OMAP343X_SDRC_SIZE,
  159. .type = MT_DEVICE
  160. },
  161. {
  162. .virtual = L4_PER_34XX_VIRT,
  163. .pfn = __phys_to_pfn(L4_PER_34XX_PHYS),
  164. .length = L4_PER_34XX_SIZE,
  165. .type = MT_DEVICE
  166. },
  167. {
  168. .virtual = L4_EMU_34XX_VIRT,
  169. .pfn = __phys_to_pfn(L4_EMU_34XX_PHYS),
  170. .length = L4_EMU_34XX_SIZE,
  171. .type = MT_DEVICE
  172. },
  173. };
  174. #endif
  175. #ifdef CONFIG_SOC_TI81XX
  176. static struct map_desc omapti81xx_io_desc[] __initdata = {
  177. {
  178. .virtual = L4_34XX_VIRT,
  179. .pfn = __phys_to_pfn(L4_34XX_PHYS),
  180. .length = L4_34XX_SIZE,
  181. .type = MT_DEVICE
  182. }
  183. };
  184. #endif
  185. #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
  186. static struct map_desc omapam33xx_io_desc[] __initdata = {
  187. {
  188. .virtual = L4_34XX_VIRT,
  189. .pfn = __phys_to_pfn(L4_34XX_PHYS),
  190. .length = L4_34XX_SIZE,
  191. .type = MT_DEVICE
  192. },
  193. {
  194. .virtual = L4_WK_AM33XX_VIRT,
  195. .pfn = __phys_to_pfn(L4_WK_AM33XX_PHYS),
  196. .length = L4_WK_AM33XX_SIZE,
  197. .type = MT_DEVICE
  198. }
  199. };
  200. #endif
  201. #ifdef CONFIG_ARCH_OMAP4
  202. static struct map_desc omap44xx_io_desc[] __initdata = {
  203. {
  204. .virtual = L3_44XX_VIRT,
  205. .pfn = __phys_to_pfn(L3_44XX_PHYS),
  206. .length = L3_44XX_SIZE,
  207. .type = MT_DEVICE,
  208. },
  209. {
  210. .virtual = L4_44XX_VIRT,
  211. .pfn = __phys_to_pfn(L4_44XX_PHYS),
  212. .length = L4_44XX_SIZE,
  213. .type = MT_DEVICE,
  214. },
  215. {
  216. .virtual = L4_PER_44XX_VIRT,
  217. .pfn = __phys_to_pfn(L4_PER_44XX_PHYS),
  218. .length = L4_PER_44XX_SIZE,
  219. .type = MT_DEVICE,
  220. },
  221. };
  222. #endif
  223. #if defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX)
  224. static struct map_desc omap54xx_io_desc[] __initdata = {
  225. {
  226. .virtual = L3_54XX_VIRT,
  227. .pfn = __phys_to_pfn(L3_54XX_PHYS),
  228. .length = L3_54XX_SIZE,
  229. .type = MT_DEVICE,
  230. },
  231. {
  232. .virtual = L4_54XX_VIRT,
  233. .pfn = __phys_to_pfn(L4_54XX_PHYS),
  234. .length = L4_54XX_SIZE,
  235. .type = MT_DEVICE,
  236. },
  237. {
  238. .virtual = L4_WK_54XX_VIRT,
  239. .pfn = __phys_to_pfn(L4_WK_54XX_PHYS),
  240. .length = L4_WK_54XX_SIZE,
  241. .type = MT_DEVICE,
  242. },
  243. {
  244. .virtual = L4_PER_54XX_VIRT,
  245. .pfn = __phys_to_pfn(L4_PER_54XX_PHYS),
  246. .length = L4_PER_54XX_SIZE,
  247. .type = MT_DEVICE,
  248. },
  249. };
  250. #endif
  251. #ifdef CONFIG_SOC_OMAP2420
  252. void __init omap242x_map_io(void)
  253. {
  254. iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
  255. iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
  256. }
  257. #endif
  258. #ifdef CONFIG_SOC_OMAP2430
  259. void __init omap243x_map_io(void)
  260. {
  261. iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
  262. iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
  263. }
  264. #endif
  265. #ifdef CONFIG_ARCH_OMAP3
  266. void __init omap3_map_io(void)
  267. {
  268. iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
  269. }
  270. #endif
  271. #ifdef CONFIG_SOC_TI81XX
  272. void __init ti81xx_map_io(void)
  273. {
  274. iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc));
  275. }
  276. #endif
  277. #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
  278. void __init am33xx_map_io(void)
  279. {
  280. iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc));
  281. }
  282. #endif
  283. #ifdef CONFIG_ARCH_OMAP4
  284. void __init omap4_map_io(void)
  285. {
  286. iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
  287. omap_barriers_init();
  288. }
  289. #endif
  290. #if defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX)
  291. void __init omap5_map_io(void)
  292. {
  293. iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc));
  294. omap_barriers_init();
  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_RUNTIME
  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_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
  354. NULL);
  355. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE));
  356. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE), NULL);
  357. omap2xxx_check_revision();
  358. omap2xxx_prm_init();
  359. omap2xxx_cm_init();
  360. omap2xxx_voltagedomains_init();
  361. omap242x_powerdomains_init();
  362. omap242x_clockdomains_init();
  363. omap2420_hwmod_init();
  364. omap_hwmod_init_postsetup();
  365. omap_clk_soc_init = omap2420_dt_clk_init;
  366. rate_table = omap2420_rate_table;
  367. }
  368. void __init omap2420_init_late(void)
  369. {
  370. omap_common_late_init();
  371. omap2_pm_init();
  372. omap2_clk_enable_autoidle_all();
  373. }
  374. #endif
  375. #ifdef CONFIG_SOC_OMAP2430
  376. void __init omap2430_init_early(void)
  377. {
  378. omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000));
  379. omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
  380. OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));
  381. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
  382. NULL);
  383. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE));
  384. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE), NULL);
  385. omap2xxx_check_revision();
  386. omap2xxx_prm_init();
  387. omap2xxx_cm_init();
  388. omap2xxx_voltagedomains_init();
  389. omap243x_powerdomains_init();
  390. omap243x_clockdomains_init();
  391. omap2430_hwmod_init();
  392. omap_hwmod_init_postsetup();
  393. omap_clk_soc_init = omap2430_dt_clk_init;
  394. rate_table = omap2430_rate_table;
  395. }
  396. void __init omap2430_init_late(void)
  397. {
  398. omap_common_late_init();
  399. omap2_pm_init();
  400. omap2_clk_enable_autoidle_all();
  401. }
  402. #endif
  403. /*
  404. * Currently only board-omap3beagle.c should call this because of the
  405. * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT.
  406. */
  407. #ifdef CONFIG_ARCH_OMAP3
  408. void __init omap3_init_early(void)
  409. {
  410. omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000));
  411. omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
  412. OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));
  413. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
  414. NULL);
  415. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE));
  416. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE), NULL);
  417. omap3xxx_check_revision();
  418. omap3xxx_check_features();
  419. omap3xxx_prm_init();
  420. omap3xxx_cm_init();
  421. omap3xxx_voltagedomains_init();
  422. omap3xxx_powerdomains_init();
  423. omap3xxx_clockdomains_init();
  424. omap3xxx_hwmod_init();
  425. omap_hwmod_init_postsetup();
  426. omap_clk_soc_init = omap3xxx_clk_init;
  427. }
  428. void __init omap3430_init_early(void)
  429. {
  430. omap3_init_early();
  431. if (of_have_populated_dt())
  432. omap_clk_soc_init = omap3430_dt_clk_init;
  433. }
  434. void __init omap35xx_init_early(void)
  435. {
  436. omap3_init_early();
  437. if (of_have_populated_dt())
  438. omap_clk_soc_init = omap3430_dt_clk_init;
  439. }
  440. void __init omap3630_init_early(void)
  441. {
  442. omap3_init_early();
  443. if (of_have_populated_dt())
  444. omap_clk_soc_init = omap3630_dt_clk_init;
  445. }
  446. void __init am35xx_init_early(void)
  447. {
  448. omap3_init_early();
  449. if (of_have_populated_dt())
  450. omap_clk_soc_init = am35xx_dt_clk_init;
  451. }
  452. void __init ti81xx_init_early(void)
  453. {
  454. omap2_set_globals_tap(OMAP343X_CLASS,
  455. OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
  456. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
  457. NULL);
  458. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE));
  459. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE), NULL);
  460. omap3xxx_check_revision();
  461. ti81xx_check_features();
  462. omap3xxx_voltagedomains_init();
  463. omap3xxx_powerdomains_init();
  464. omap3xxx_clockdomains_init();
  465. omap3xxx_hwmod_init();
  466. omap_hwmod_init_postsetup();
  467. if (of_have_populated_dt())
  468. omap_clk_soc_init = ti81xx_dt_clk_init;
  469. else
  470. omap_clk_soc_init = omap3xxx_clk_init;
  471. }
  472. void __init omap3_init_late(void)
  473. {
  474. omap_common_late_init();
  475. omap3_pm_init();
  476. omap2_clk_enable_autoidle_all();
  477. }
  478. void __init omap3430_init_late(void)
  479. {
  480. omap_common_late_init();
  481. omap3_pm_init();
  482. omap2_clk_enable_autoidle_all();
  483. }
  484. void __init omap35xx_init_late(void)
  485. {
  486. omap_common_late_init();
  487. omap3_pm_init();
  488. omap2_clk_enable_autoidle_all();
  489. }
  490. void __init omap3630_init_late(void)
  491. {
  492. omap_common_late_init();
  493. omap3_pm_init();
  494. omap2_clk_enable_autoidle_all();
  495. }
  496. void __init am35xx_init_late(void)
  497. {
  498. omap_common_late_init();
  499. omap3_pm_init();
  500. omap2_clk_enable_autoidle_all();
  501. }
  502. void __init ti81xx_init_late(void)
  503. {
  504. omap_common_late_init();
  505. omap3_pm_init();
  506. omap2_clk_enable_autoidle_all();
  507. }
  508. #endif
  509. #ifdef CONFIG_SOC_AM33XX
  510. void __init am33xx_init_early(void)
  511. {
  512. omap2_set_globals_tap(AM335X_CLASS,
  513. AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
  514. omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
  515. NULL);
  516. omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE));
  517. omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE), NULL);
  518. omap3xxx_check_revision();
  519. am33xx_check_features();
  520. am33xx_powerdomains_init();
  521. am33xx_clockdomains_init();
  522. am33xx_hwmod_init();
  523. omap_hwmod_init_postsetup();
  524. omap_clk_soc_init = am33xx_dt_clk_init;
  525. }
  526. void __init am33xx_init_late(void)
  527. {
  528. omap_common_late_init();
  529. }
  530. #endif
  531. #ifdef CONFIG_SOC_AM43XX
  532. void __init am43xx_init_early(void)
  533. {
  534. omap2_set_globals_tap(AM335X_CLASS,
  535. AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
  536. omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
  537. NULL);
  538. omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE));
  539. omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE), NULL);
  540. omap_prm_base_init();
  541. omap_cm_base_init();
  542. omap3xxx_check_revision();
  543. am33xx_check_features();
  544. am43xx_powerdomains_init();
  545. am43xx_clockdomains_init();
  546. am43xx_hwmod_init();
  547. omap_hwmod_init_postsetup();
  548. omap_l2_cache_init();
  549. omap_clk_soc_init = am43xx_dt_clk_init;
  550. }
  551. void __init am43xx_init_late(void)
  552. {
  553. omap_common_late_init();
  554. }
  555. #endif
  556. #ifdef CONFIG_ARCH_OMAP4
  557. void __init omap4430_init_early(void)
  558. {
  559. omap2_set_globals_tap(OMAP443X_CLASS,
  560. OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE));
  561. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
  562. OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE));
  563. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE));
  564. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
  565. OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE));
  566. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE));
  567. omap_prm_base_init();
  568. omap_cm_base_init();
  569. omap4xxx_check_revision();
  570. omap4xxx_check_features();
  571. omap4_pm_init_early();
  572. omap44xx_prm_init();
  573. omap44xx_voltagedomains_init();
  574. omap44xx_powerdomains_init();
  575. omap44xx_clockdomains_init();
  576. omap44xx_hwmod_init();
  577. omap_hwmod_init_postsetup();
  578. omap_l2_cache_init();
  579. omap_clk_soc_init = omap4xxx_dt_clk_init;
  580. }
  581. void __init omap4430_init_late(void)
  582. {
  583. omap_common_late_init();
  584. omap4_pm_init();
  585. omap2_clk_enable_autoidle_all();
  586. }
  587. #endif
  588. #ifdef CONFIG_SOC_OMAP5
  589. void __init omap5_init_early(void)
  590. {
  591. omap2_set_globals_tap(OMAP54XX_CLASS,
  592. OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
  593. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
  594. OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE));
  595. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE));
  596. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
  597. OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
  598. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
  599. omap4_pm_init_early();
  600. omap_prm_base_init();
  601. omap_cm_base_init();
  602. omap44xx_prm_init();
  603. omap5xxx_check_revision();
  604. omap54xx_voltagedomains_init();
  605. omap54xx_powerdomains_init();
  606. omap54xx_clockdomains_init();
  607. omap54xx_hwmod_init();
  608. omap_hwmod_init_postsetup();
  609. omap_clk_soc_init = omap5xxx_dt_clk_init;
  610. }
  611. void __init omap5_init_late(void)
  612. {
  613. omap_common_late_init();
  614. omap4_pm_init();
  615. omap2_clk_enable_autoidle_all();
  616. }
  617. #endif
  618. #ifdef CONFIG_SOC_DRA7XX
  619. void __init dra7xx_init_early(void)
  620. {
  621. omap2_set_globals_tap(-1, OMAP2_L4_IO_ADDRESS(DRA7XX_TAP_BASE));
  622. omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
  623. OMAP2_L4_IO_ADDRESS(DRA7XX_CTRL_BASE));
  624. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE));
  625. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(DRA7XX_CM_CORE_AON_BASE),
  626. OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
  627. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
  628. omap4_pm_init_early();
  629. omap_prm_base_init();
  630. omap_cm_base_init();
  631. omap44xx_prm_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. ret = of_prcm_init();
  662. if (!ret)
  663. ret = omap_clk_soc_init();
  664. return ret;
  665. }