io.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725
  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 "sdrc.h"
  38. #include "control.h"
  39. #include "serial.h"
  40. #include "sram.h"
  41. #include "cm2xxx.h"
  42. #include "cm3xxx.h"
  43. #include "cm33xx.h"
  44. #include "cm44xx.h"
  45. #include "prm.h"
  46. #include "cm.h"
  47. #include "prcm_mpu44xx.h"
  48. #include "prminst44xx.h"
  49. #include "prm2xxx.h"
  50. #include "prm3xxx.h"
  51. #include "prm33xx.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. #ifdef CONFIG_SOC_OMAP5
  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_DRA7XX
  252. static struct map_desc dra7xx_io_desc[] __initdata = {
  253. {
  254. .virtual = L4_CFG_MPU_DRA7XX_VIRT,
  255. .pfn = __phys_to_pfn(L4_CFG_MPU_DRA7XX_PHYS),
  256. .length = L4_CFG_MPU_DRA7XX_SIZE,
  257. .type = MT_DEVICE,
  258. },
  259. {
  260. .virtual = L3_MAIN_SN_DRA7XX_VIRT,
  261. .pfn = __phys_to_pfn(L3_MAIN_SN_DRA7XX_PHYS),
  262. .length = L3_MAIN_SN_DRA7XX_SIZE,
  263. .type = MT_DEVICE,
  264. },
  265. {
  266. .virtual = L4_PER1_DRA7XX_VIRT,
  267. .pfn = __phys_to_pfn(L4_PER1_DRA7XX_PHYS),
  268. .length = L4_PER1_DRA7XX_SIZE,
  269. .type = MT_DEVICE,
  270. },
  271. {
  272. .virtual = L4_PER2_DRA7XX_VIRT,
  273. .pfn = __phys_to_pfn(L4_PER2_DRA7XX_PHYS),
  274. .length = L4_PER2_DRA7XX_SIZE,
  275. .type = MT_DEVICE,
  276. },
  277. {
  278. .virtual = L4_PER3_DRA7XX_VIRT,
  279. .pfn = __phys_to_pfn(L4_PER3_DRA7XX_PHYS),
  280. .length = L4_PER3_DRA7XX_SIZE,
  281. .type = MT_DEVICE,
  282. },
  283. {
  284. .virtual = L4_CFG_DRA7XX_VIRT,
  285. .pfn = __phys_to_pfn(L4_CFG_DRA7XX_PHYS),
  286. .length = L4_CFG_DRA7XX_SIZE,
  287. .type = MT_DEVICE,
  288. },
  289. {
  290. .virtual = L4_WKUP_DRA7XX_VIRT,
  291. .pfn = __phys_to_pfn(L4_WKUP_DRA7XX_PHYS),
  292. .length = L4_WKUP_DRA7XX_SIZE,
  293. .type = MT_DEVICE,
  294. },
  295. };
  296. #endif
  297. #ifdef CONFIG_SOC_OMAP2420
  298. void __init omap242x_map_io(void)
  299. {
  300. iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
  301. iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
  302. }
  303. #endif
  304. #ifdef CONFIG_SOC_OMAP2430
  305. void __init omap243x_map_io(void)
  306. {
  307. iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
  308. iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
  309. }
  310. #endif
  311. #ifdef CONFIG_ARCH_OMAP3
  312. void __init omap3_map_io(void)
  313. {
  314. iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
  315. }
  316. #endif
  317. #ifdef CONFIG_SOC_TI81XX
  318. void __init ti81xx_map_io(void)
  319. {
  320. iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc));
  321. }
  322. #endif
  323. #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
  324. void __init am33xx_map_io(void)
  325. {
  326. iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc));
  327. }
  328. #endif
  329. #ifdef CONFIG_ARCH_OMAP4
  330. void __init omap4_map_io(void)
  331. {
  332. iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
  333. omap_barriers_init();
  334. }
  335. #endif
  336. #ifdef CONFIG_SOC_OMAP5
  337. void __init omap5_map_io(void)
  338. {
  339. iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc));
  340. omap_barriers_init();
  341. }
  342. #endif
  343. #ifdef CONFIG_SOC_DRA7XX
  344. void __init dra7xx_map_io(void)
  345. {
  346. iotable_init(dra7xx_io_desc, ARRAY_SIZE(dra7xx_io_desc));
  347. omap_barriers_init();
  348. }
  349. #endif
  350. /*
  351. * omap2_init_reprogram_sdrc - reprogram SDRC timing parameters
  352. *
  353. * Sets the CORE DPLL3 M2 divider to the same value that it's at
  354. * currently. This has the effect of setting the SDRC SDRAM AC timing
  355. * registers to the values currently defined by the kernel. Currently
  356. * only defined for OMAP3; will return 0 if called on OMAP2. Returns
  357. * -EINVAL if the dpll3_m2_ck cannot be found, 0 if called on OMAP2,
  358. * or passes along the return value of clk_set_rate().
  359. */
  360. static int __init _omap2_init_reprogram_sdrc(void)
  361. {
  362. struct clk *dpll3_m2_ck;
  363. int v = -EINVAL;
  364. long rate;
  365. if (!cpu_is_omap34xx())
  366. return 0;
  367. dpll3_m2_ck = clk_get(NULL, "dpll3_m2_ck");
  368. if (IS_ERR(dpll3_m2_ck))
  369. return -EINVAL;
  370. rate = clk_get_rate(dpll3_m2_ck);
  371. pr_info("Reprogramming SDRC clock to %ld Hz\n", rate);
  372. v = clk_set_rate(dpll3_m2_ck, rate);
  373. if (v)
  374. pr_err("dpll3_m2_clk rate change failed: %d\n", v);
  375. clk_put(dpll3_m2_ck);
  376. return v;
  377. }
  378. static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
  379. {
  380. return omap_hwmod_set_postsetup_state(oh, *(u8 *)data);
  381. }
  382. static void __init __maybe_unused omap_hwmod_init_postsetup(void)
  383. {
  384. u8 postsetup_state;
  385. /* Set the default postsetup state for all hwmods */
  386. #ifdef CONFIG_PM
  387. postsetup_state = _HWMOD_STATE_IDLE;
  388. #else
  389. postsetup_state = _HWMOD_STATE_ENABLED;
  390. #endif
  391. omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state);
  392. }
  393. #ifdef CONFIG_SOC_OMAP2420
  394. void __init omap2420_init_early(void)
  395. {
  396. omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000));
  397. omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
  398. OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE));
  399. omap2_control_base_init();
  400. omap2xxx_check_revision();
  401. omap2_prcm_base_init();
  402. omap2xxx_voltagedomains_init();
  403. omap242x_powerdomains_init();
  404. omap242x_clockdomains_init();
  405. omap2420_hwmod_init();
  406. omap_hwmod_init_postsetup();
  407. omap_clk_soc_init = omap2420_dt_clk_init;
  408. rate_table = omap2420_rate_table;
  409. }
  410. void __init omap2420_init_late(void)
  411. {
  412. omap_pm_soc_init = omap2_pm_init;
  413. }
  414. #endif
  415. #ifdef CONFIG_SOC_OMAP2430
  416. void __init omap2430_init_early(void)
  417. {
  418. omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000));
  419. omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
  420. OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));
  421. omap2_control_base_init();
  422. omap2xxx_check_revision();
  423. omap2_prcm_base_init();
  424. omap2xxx_voltagedomains_init();
  425. omap243x_powerdomains_init();
  426. omap243x_clockdomains_init();
  427. omap2430_hwmod_init();
  428. omap_hwmod_init_postsetup();
  429. omap_clk_soc_init = omap2430_dt_clk_init;
  430. rate_table = omap2430_rate_table;
  431. }
  432. void __init omap2430_init_late(void)
  433. {
  434. omap_pm_soc_init = omap2_pm_init;
  435. }
  436. #endif
  437. /*
  438. * Currently only board-omap3beagle.c should call this because of the
  439. * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT.
  440. */
  441. #ifdef CONFIG_ARCH_OMAP3
  442. void __init omap3_init_early(void)
  443. {
  444. omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000));
  445. omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
  446. OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));
  447. omap2_control_base_init();
  448. omap3xxx_check_revision();
  449. omap3xxx_check_features();
  450. omap2_prcm_base_init();
  451. omap3xxx_voltagedomains_init();
  452. omap3xxx_powerdomains_init();
  453. omap3xxx_clockdomains_init();
  454. omap3xxx_hwmod_init();
  455. omap_hwmod_init_postsetup();
  456. }
  457. void __init omap3430_init_early(void)
  458. {
  459. omap3_init_early();
  460. omap_clk_soc_init = omap3430_dt_clk_init;
  461. }
  462. void __init omap35xx_init_early(void)
  463. {
  464. omap3_init_early();
  465. omap_clk_soc_init = omap3430_dt_clk_init;
  466. }
  467. void __init omap3630_init_early(void)
  468. {
  469. omap3_init_early();
  470. omap_clk_soc_init = omap3630_dt_clk_init;
  471. }
  472. void __init am35xx_init_early(void)
  473. {
  474. omap3_init_early();
  475. omap_clk_soc_init = am35xx_dt_clk_init;
  476. }
  477. void __init omap3_init_late(void)
  478. {
  479. omap_pm_soc_init = omap3_pm_init;
  480. }
  481. void __init ti81xx_init_late(void)
  482. {
  483. omap_pm_soc_init = omap_pm_nop_init;
  484. }
  485. #endif
  486. #ifdef CONFIG_SOC_TI81XX
  487. void __init ti814x_init_early(void)
  488. {
  489. omap2_set_globals_tap(TI814X_CLASS,
  490. OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
  491. omap2_control_base_init();
  492. omap3xxx_check_revision();
  493. ti81xx_check_features();
  494. omap2_prcm_base_init();
  495. omap3xxx_voltagedomains_init();
  496. omap3xxx_powerdomains_init();
  497. ti814x_clockdomains_init();
  498. dm814x_hwmod_init();
  499. omap_hwmod_init_postsetup();
  500. omap_clk_soc_init = dm814x_dt_clk_init;
  501. }
  502. void __init ti816x_init_early(void)
  503. {
  504. omap2_set_globals_tap(TI816X_CLASS,
  505. OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
  506. omap2_control_base_init();
  507. omap3xxx_check_revision();
  508. ti81xx_check_features();
  509. omap2_prcm_base_init();
  510. omap3xxx_voltagedomains_init();
  511. omap3xxx_powerdomains_init();
  512. ti816x_clockdomains_init();
  513. dm816x_hwmod_init();
  514. omap_hwmod_init_postsetup();
  515. omap_clk_soc_init = dm816x_dt_clk_init;
  516. }
  517. #endif
  518. #ifdef CONFIG_SOC_AM33XX
  519. void __init am33xx_init_early(void)
  520. {
  521. omap2_set_globals_tap(AM335X_CLASS,
  522. AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
  523. omap2_control_base_init();
  524. omap3xxx_check_revision();
  525. am33xx_check_features();
  526. omap2_prcm_base_init();
  527. am33xx_powerdomains_init();
  528. am33xx_clockdomains_init();
  529. am33xx_hwmod_init();
  530. omap_hwmod_init_postsetup();
  531. omap_clk_soc_init = am33xx_dt_clk_init;
  532. }
  533. void __init am33xx_init_late(void)
  534. {
  535. omap_pm_soc_init = amx3_common_pm_init;
  536. }
  537. #endif
  538. #ifdef CONFIG_SOC_AM43XX
  539. void __init am43xx_init_early(void)
  540. {
  541. omap2_set_globals_tap(AM335X_CLASS,
  542. AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
  543. omap2_control_base_init();
  544. omap3xxx_check_revision();
  545. am33xx_check_features();
  546. omap2_prcm_base_init();
  547. am43xx_powerdomains_init();
  548. am43xx_clockdomains_init();
  549. am43xx_hwmod_init();
  550. omap_hwmod_init_postsetup();
  551. omap_l2_cache_init();
  552. omap_clk_soc_init = am43xx_dt_clk_init;
  553. }
  554. void __init am43xx_init_late(void)
  555. {
  556. omap_pm_soc_init = amx3_common_pm_init;
  557. }
  558. #endif
  559. #ifdef CONFIG_ARCH_OMAP4
  560. void __init omap4430_init_early(void)
  561. {
  562. omap2_set_globals_tap(OMAP443X_CLASS,
  563. OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE));
  564. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE));
  565. omap2_control_base_init();
  566. omap4xxx_check_revision();
  567. omap4xxx_check_features();
  568. omap2_prcm_base_init();
  569. omap4_sar_ram_init();
  570. omap4_mpuss_early_init();
  571. omap4_pm_init_early();
  572. omap44xx_voltagedomains_init();
  573. omap44xx_powerdomains_init();
  574. omap44xx_clockdomains_init();
  575. omap44xx_hwmod_init();
  576. omap_hwmod_init_postsetup();
  577. omap_l2_cache_init();
  578. omap_clk_soc_init = omap4xxx_dt_clk_init;
  579. }
  580. void __init omap4430_init_late(void)
  581. {
  582. omap_pm_soc_init = omap4_pm_init;
  583. }
  584. #endif
  585. #ifdef CONFIG_SOC_OMAP5
  586. void __init omap5_init_early(void)
  587. {
  588. omap2_set_globals_tap(OMAP54XX_CLASS,
  589. OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
  590. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
  591. omap2_control_base_init();
  592. omap2_prcm_base_init();
  593. omap5xxx_check_revision();
  594. omap4_sar_ram_init();
  595. omap4_mpuss_early_init();
  596. omap4_pm_init_early();
  597. omap54xx_voltagedomains_init();
  598. omap54xx_powerdomains_init();
  599. omap54xx_clockdomains_init();
  600. omap54xx_hwmod_init();
  601. omap_hwmod_init_postsetup();
  602. omap_clk_soc_init = omap5xxx_dt_clk_init;
  603. }
  604. void __init omap5_init_late(void)
  605. {
  606. omap_pm_soc_init = omap4_pm_init;
  607. }
  608. #endif
  609. #ifdef CONFIG_SOC_DRA7XX
  610. void __init dra7xx_init_early(void)
  611. {
  612. omap2_set_globals_tap(DRA7XX_CLASS,
  613. OMAP2_L4_IO_ADDRESS(DRA7XX_TAP_BASE));
  614. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
  615. omap2_control_base_init();
  616. omap4_pm_init_early();
  617. omap2_prcm_base_init();
  618. dra7xxx_check_revision();
  619. dra7xx_powerdomains_init();
  620. dra7xx_clockdomains_init();
  621. dra7xx_hwmod_init();
  622. omap_hwmod_init_postsetup();
  623. omap_clk_soc_init = dra7xx_dt_clk_init;
  624. }
  625. void __init dra7xx_init_late(void)
  626. {
  627. omap_pm_soc_init = omap4_pm_init;
  628. }
  629. #endif
  630. void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
  631. struct omap_sdrc_params *sdrc_cs1)
  632. {
  633. omap_sram_init();
  634. if (cpu_is_omap24xx() || omap3_has_sdrc()) {
  635. omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
  636. _omap2_init_reprogram_sdrc();
  637. }
  638. }
  639. int __init omap_clk_init(void)
  640. {
  641. int ret = 0;
  642. if (!omap_clk_soc_init)
  643. return 0;
  644. ti_clk_init_features();
  645. omap2_clk_setup_ll_ops();
  646. ret = omap_control_init();
  647. if (ret)
  648. return ret;
  649. ret = omap_prcm_init();
  650. if (ret)
  651. return ret;
  652. of_clk_init(NULL);
  653. ti_dt_clk_init_retry_clks();
  654. ti_dt_clockdomains_setup();
  655. ret = omap_clk_soc_init();
  656. return ret;
  657. }