io.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809
  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 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. omap_mux_late_init();
  398. omap2_common_pm_late_init();
  399. omap_soc_device_init();
  400. }
  401. #ifdef CONFIG_SOC_OMAP2420
  402. void __init omap2420_init_early(void)
  403. {
  404. omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000));
  405. omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
  406. OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE));
  407. omap2_control_base_init();
  408. omap2xxx_check_revision();
  409. omap2_prcm_base_init();
  410. omap2xxx_voltagedomains_init();
  411. omap242x_powerdomains_init();
  412. omap242x_clockdomains_init();
  413. omap2420_hwmod_init();
  414. omap_hwmod_init_postsetup();
  415. omap_clk_soc_init = omap2420_dt_clk_init;
  416. rate_table = omap2420_rate_table;
  417. }
  418. void __init omap2420_init_late(void)
  419. {
  420. omap_common_late_init();
  421. omap2_pm_init();
  422. omap2_clk_enable_autoidle_all();
  423. }
  424. #endif
  425. #ifdef CONFIG_SOC_OMAP2430
  426. void __init omap2430_init_early(void)
  427. {
  428. omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000));
  429. omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
  430. OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));
  431. omap2_control_base_init();
  432. omap2xxx_check_revision();
  433. omap2_prcm_base_init();
  434. omap2xxx_voltagedomains_init();
  435. omap243x_powerdomains_init();
  436. omap243x_clockdomains_init();
  437. omap2430_hwmod_init();
  438. omap_hwmod_init_postsetup();
  439. omap_clk_soc_init = omap2430_dt_clk_init;
  440. rate_table = omap2430_rate_table;
  441. }
  442. void __init omap2430_init_late(void)
  443. {
  444. omap_common_late_init();
  445. omap2_pm_init();
  446. omap2_clk_enable_autoidle_all();
  447. }
  448. #endif
  449. /*
  450. * Currently only board-omap3beagle.c should call this because of the
  451. * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT.
  452. */
  453. #ifdef CONFIG_ARCH_OMAP3
  454. void __init omap3_init_early(void)
  455. {
  456. omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000));
  457. omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
  458. OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));
  459. /* XXX: remove these once OMAP3 is DT only */
  460. if (!of_have_populated_dt()) {
  461. omap2_set_globals_control(
  462. OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE));
  463. omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE));
  464. omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
  465. NULL);
  466. }
  467. omap2_control_base_init();
  468. omap3xxx_check_revision();
  469. omap3xxx_check_features();
  470. omap2_prcm_base_init();
  471. /* XXX: remove these once OMAP3 is DT only */
  472. if (!of_have_populated_dt()) {
  473. omap3xxx_prm_init(NULL);
  474. omap3xxx_cm_init(NULL);
  475. }
  476. omap3xxx_voltagedomains_init();
  477. omap3xxx_powerdomains_init();
  478. omap3xxx_clockdomains_init();
  479. omap3xxx_hwmod_init();
  480. omap_hwmod_init_postsetup();
  481. if (!of_have_populated_dt()) {
  482. omap3_control_legacy_iomap_init();
  483. if (soc_is_am35xx())
  484. omap_clk_soc_init = am35xx_clk_legacy_init;
  485. else if (cpu_is_omap3630())
  486. omap_clk_soc_init = omap36xx_clk_legacy_init;
  487. else if (omap_rev() == OMAP3430_REV_ES1_0)
  488. omap_clk_soc_init = omap3430es1_clk_legacy_init;
  489. else
  490. omap_clk_soc_init = omap3430_clk_legacy_init;
  491. }
  492. }
  493. void __init omap3430_init_early(void)
  494. {
  495. omap3_init_early();
  496. if (of_have_populated_dt())
  497. omap_clk_soc_init = omap3430_dt_clk_init;
  498. }
  499. void __init omap35xx_init_early(void)
  500. {
  501. omap3_init_early();
  502. if (of_have_populated_dt())
  503. omap_clk_soc_init = omap3430_dt_clk_init;
  504. }
  505. void __init omap3630_init_early(void)
  506. {
  507. omap3_init_early();
  508. if (of_have_populated_dt())
  509. omap_clk_soc_init = omap3630_dt_clk_init;
  510. }
  511. void __init am35xx_init_early(void)
  512. {
  513. omap3_init_early();
  514. if (of_have_populated_dt())
  515. omap_clk_soc_init = am35xx_dt_clk_init;
  516. }
  517. void __init omap3_init_late(void)
  518. {
  519. omap_common_late_init();
  520. omap3_pm_init();
  521. omap2_clk_enable_autoidle_all();
  522. }
  523. void __init omap3430_init_late(void)
  524. {
  525. omap_common_late_init();
  526. omap3_pm_init();
  527. omap2_clk_enable_autoidle_all();
  528. }
  529. void __init omap35xx_init_late(void)
  530. {
  531. omap_common_late_init();
  532. omap3_pm_init();
  533. omap2_clk_enable_autoidle_all();
  534. }
  535. void __init omap3630_init_late(void)
  536. {
  537. omap_common_late_init();
  538. omap3_pm_init();
  539. omap2_clk_enable_autoidle_all();
  540. }
  541. void __init am35xx_init_late(void)
  542. {
  543. omap_common_late_init();
  544. omap3_pm_init();
  545. omap2_clk_enable_autoidle_all();
  546. }
  547. void __init ti81xx_init_late(void)
  548. {
  549. omap_common_late_init();
  550. omap2_clk_enable_autoidle_all();
  551. }
  552. #endif
  553. #ifdef CONFIG_SOC_TI81XX
  554. void __init ti814x_init_early(void)
  555. {
  556. omap2_set_globals_tap(TI814X_CLASS,
  557. OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
  558. omap2_control_base_init();
  559. omap3xxx_check_revision();
  560. ti81xx_check_features();
  561. omap2_prcm_base_init();
  562. omap3xxx_voltagedomains_init();
  563. omap3xxx_powerdomains_init();
  564. ti814x_clockdomains_init();
  565. dm814x_hwmod_init();
  566. omap_hwmod_init_postsetup();
  567. omap_clk_soc_init = dm814x_dt_clk_init;
  568. }
  569. void __init ti816x_init_early(void)
  570. {
  571. omap2_set_globals_tap(TI816X_CLASS,
  572. OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
  573. omap2_control_base_init();
  574. omap3xxx_check_revision();
  575. ti81xx_check_features();
  576. omap2_prcm_base_init();
  577. omap3xxx_voltagedomains_init();
  578. omap3xxx_powerdomains_init();
  579. ti816x_clockdomains_init();
  580. dm816x_hwmod_init();
  581. omap_hwmod_init_postsetup();
  582. if (of_have_populated_dt())
  583. omap_clk_soc_init = dm816x_dt_clk_init;
  584. }
  585. #endif
  586. #ifdef CONFIG_SOC_AM33XX
  587. void __init am33xx_init_early(void)
  588. {
  589. omap2_set_globals_tap(AM335X_CLASS,
  590. AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
  591. omap2_control_base_init();
  592. omap3xxx_check_revision();
  593. am33xx_check_features();
  594. omap2_prcm_base_init();
  595. am33xx_powerdomains_init();
  596. am33xx_clockdomains_init();
  597. am33xx_hwmod_init();
  598. omap_hwmod_init_postsetup();
  599. omap_clk_soc_init = am33xx_dt_clk_init;
  600. }
  601. void __init am33xx_init_late(void)
  602. {
  603. omap_common_late_init();
  604. }
  605. #endif
  606. #ifdef CONFIG_SOC_AM43XX
  607. void __init am43xx_init_early(void)
  608. {
  609. omap2_set_globals_tap(AM335X_CLASS,
  610. AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
  611. omap2_control_base_init();
  612. omap3xxx_check_revision();
  613. am33xx_check_features();
  614. omap2_prcm_base_init();
  615. am43xx_powerdomains_init();
  616. am43xx_clockdomains_init();
  617. am43xx_hwmod_init();
  618. omap_hwmod_init_postsetup();
  619. omap_l2_cache_init();
  620. omap_clk_soc_init = am43xx_dt_clk_init;
  621. }
  622. void __init am43xx_init_late(void)
  623. {
  624. omap_common_late_init();
  625. omap2_clk_enable_autoidle_all();
  626. }
  627. #endif
  628. #ifdef CONFIG_ARCH_OMAP4
  629. void __init omap4430_init_early(void)
  630. {
  631. omap2_set_globals_tap(OMAP443X_CLASS,
  632. OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE));
  633. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE));
  634. omap2_control_base_init();
  635. omap4xxx_check_revision();
  636. omap4xxx_check_features();
  637. omap2_prcm_base_init();
  638. omap4_sar_ram_init();
  639. omap4_mpuss_early_init();
  640. omap4_pm_init_early();
  641. omap44xx_voltagedomains_init();
  642. omap44xx_powerdomains_init();
  643. omap44xx_clockdomains_init();
  644. omap44xx_hwmod_init();
  645. omap_hwmod_init_postsetup();
  646. omap_l2_cache_init();
  647. omap_clk_soc_init = omap4xxx_dt_clk_init;
  648. }
  649. void __init omap4430_init_late(void)
  650. {
  651. omap_common_late_init();
  652. omap4_pm_init();
  653. omap2_clk_enable_autoidle_all();
  654. }
  655. #endif
  656. #ifdef CONFIG_SOC_OMAP5
  657. void __init omap5_init_early(void)
  658. {
  659. omap2_set_globals_tap(OMAP54XX_CLASS,
  660. OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
  661. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
  662. omap2_control_base_init();
  663. omap2_prcm_base_init();
  664. omap5xxx_check_revision();
  665. omap4_sar_ram_init();
  666. omap4_mpuss_early_init();
  667. omap4_pm_init_early();
  668. omap54xx_voltagedomains_init();
  669. omap54xx_powerdomains_init();
  670. omap54xx_clockdomains_init();
  671. omap54xx_hwmod_init();
  672. omap_hwmod_init_postsetup();
  673. omap_clk_soc_init = omap5xxx_dt_clk_init;
  674. }
  675. void __init omap5_init_late(void)
  676. {
  677. omap_common_late_init();
  678. omap4_pm_init();
  679. omap2_clk_enable_autoidle_all();
  680. }
  681. #endif
  682. #ifdef CONFIG_SOC_DRA7XX
  683. void __init dra7xx_init_early(void)
  684. {
  685. omap2_set_globals_tap(DRA7XX_CLASS,
  686. OMAP2_L4_IO_ADDRESS(DRA7XX_TAP_BASE));
  687. omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
  688. omap2_control_base_init();
  689. omap4_pm_init_early();
  690. omap2_prcm_base_init();
  691. dra7xxx_check_revision();
  692. dra7xx_powerdomains_init();
  693. dra7xx_clockdomains_init();
  694. dra7xx_hwmod_init();
  695. omap_hwmod_init_postsetup();
  696. omap_clk_soc_init = dra7xx_dt_clk_init;
  697. }
  698. void __init dra7xx_init_late(void)
  699. {
  700. omap_common_late_init();
  701. omap4_pm_init();
  702. omap2_clk_enable_autoidle_all();
  703. }
  704. #endif
  705. void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
  706. struct omap_sdrc_params *sdrc_cs1)
  707. {
  708. omap_sram_init();
  709. if (cpu_is_omap24xx() || omap3_has_sdrc()) {
  710. omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
  711. _omap2_init_reprogram_sdrc();
  712. }
  713. }
  714. int __init omap_clk_init(void)
  715. {
  716. int ret = 0;
  717. if (!omap_clk_soc_init)
  718. return 0;
  719. ti_clk_init_features();
  720. omap2_clk_setup_ll_ops();
  721. if (of_have_populated_dt()) {
  722. ret = omap_control_init();
  723. if (ret)
  724. return ret;
  725. ret = omap_prcm_init();
  726. if (ret)
  727. return ret;
  728. of_clk_init(NULL);
  729. ti_dt_clk_init_retry_clks();
  730. ti_dt_clockdomains_setup();
  731. }
  732. ret = omap_clk_soc_init();
  733. return ret;
  734. }