io.c 17 KB

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