clock-exynos4.c 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577
  1. /*
  2. * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd.
  3. * http://www.samsung.com
  4. *
  5. * EXYNOS4 - Clock support
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/err.h>
  13. #include <linux/io.h>
  14. #include <linux/syscore_ops.h>
  15. #include <plat/cpu-freq.h>
  16. #include <plat/clock.h>
  17. #include <plat/cpu.h>
  18. #include <plat/pll.h>
  19. #include <plat/s5p-clock.h>
  20. #include <plat/clock-clksrc.h>
  21. #include <plat/pm.h>
  22. #include <mach/map.h>
  23. #include <mach/regs-clock.h>
  24. #include <mach/sysmmu.h>
  25. #include "common.h"
  26. #include "clock-exynos4.h"
  27. #ifdef CONFIG_PM_SLEEP
  28. static struct sleep_save exynos4_clock_save[] = {
  29. SAVE_ITEM(EXYNOS4_CLKDIV_LEFTBUS),
  30. SAVE_ITEM(EXYNOS4_CLKGATE_IP_LEFTBUS),
  31. SAVE_ITEM(EXYNOS4_CLKDIV_RIGHTBUS),
  32. SAVE_ITEM(EXYNOS4_CLKGATE_IP_RIGHTBUS),
  33. SAVE_ITEM(EXYNOS4_CLKSRC_TOP0),
  34. SAVE_ITEM(EXYNOS4_CLKSRC_TOP1),
  35. SAVE_ITEM(EXYNOS4_CLKSRC_CAM),
  36. SAVE_ITEM(EXYNOS4_CLKSRC_TV),
  37. SAVE_ITEM(EXYNOS4_CLKSRC_MFC),
  38. SAVE_ITEM(EXYNOS4_CLKSRC_G3D),
  39. SAVE_ITEM(EXYNOS4_CLKSRC_LCD0),
  40. SAVE_ITEM(EXYNOS4_CLKSRC_MAUDIO),
  41. SAVE_ITEM(EXYNOS4_CLKSRC_FSYS),
  42. SAVE_ITEM(EXYNOS4_CLKSRC_PERIL0),
  43. SAVE_ITEM(EXYNOS4_CLKSRC_PERIL1),
  44. SAVE_ITEM(EXYNOS4_CLKDIV_CAM),
  45. SAVE_ITEM(EXYNOS4_CLKDIV_TV),
  46. SAVE_ITEM(EXYNOS4_CLKDIV_MFC),
  47. SAVE_ITEM(EXYNOS4_CLKDIV_G3D),
  48. SAVE_ITEM(EXYNOS4_CLKDIV_LCD0),
  49. SAVE_ITEM(EXYNOS4_CLKDIV_MAUDIO),
  50. SAVE_ITEM(EXYNOS4_CLKDIV_FSYS0),
  51. SAVE_ITEM(EXYNOS4_CLKDIV_FSYS1),
  52. SAVE_ITEM(EXYNOS4_CLKDIV_FSYS2),
  53. SAVE_ITEM(EXYNOS4_CLKDIV_FSYS3),
  54. SAVE_ITEM(EXYNOS4_CLKDIV_PERIL0),
  55. SAVE_ITEM(EXYNOS4_CLKDIV_PERIL1),
  56. SAVE_ITEM(EXYNOS4_CLKDIV_PERIL2),
  57. SAVE_ITEM(EXYNOS4_CLKDIV_PERIL3),
  58. SAVE_ITEM(EXYNOS4_CLKDIV_PERIL4),
  59. SAVE_ITEM(EXYNOS4_CLKDIV_PERIL5),
  60. SAVE_ITEM(EXYNOS4_CLKDIV_TOP),
  61. SAVE_ITEM(EXYNOS4_CLKSRC_MASK_TOP),
  62. SAVE_ITEM(EXYNOS4_CLKSRC_MASK_CAM),
  63. SAVE_ITEM(EXYNOS4_CLKSRC_MASK_TV),
  64. SAVE_ITEM(EXYNOS4_CLKSRC_MASK_LCD0),
  65. SAVE_ITEM(EXYNOS4_CLKSRC_MASK_MAUDIO),
  66. SAVE_ITEM(EXYNOS4_CLKSRC_MASK_FSYS),
  67. SAVE_ITEM(EXYNOS4_CLKSRC_MASK_PERIL0),
  68. SAVE_ITEM(EXYNOS4_CLKSRC_MASK_PERIL1),
  69. SAVE_ITEM(EXYNOS4_CLKDIV2_RATIO),
  70. SAVE_ITEM(EXYNOS4_CLKGATE_SCLKCAM),
  71. SAVE_ITEM(EXYNOS4_CLKGATE_IP_CAM),
  72. SAVE_ITEM(EXYNOS4_CLKGATE_IP_TV),
  73. SAVE_ITEM(EXYNOS4_CLKGATE_IP_MFC),
  74. SAVE_ITEM(EXYNOS4_CLKGATE_IP_G3D),
  75. SAVE_ITEM(EXYNOS4_CLKGATE_IP_LCD0),
  76. SAVE_ITEM(EXYNOS4_CLKGATE_IP_FSYS),
  77. SAVE_ITEM(EXYNOS4_CLKGATE_IP_GPS),
  78. SAVE_ITEM(EXYNOS4_CLKGATE_IP_PERIL),
  79. SAVE_ITEM(EXYNOS4_CLKGATE_BLOCK),
  80. SAVE_ITEM(EXYNOS4_CLKSRC_MASK_DMC),
  81. SAVE_ITEM(EXYNOS4_CLKSRC_DMC),
  82. SAVE_ITEM(EXYNOS4_CLKDIV_DMC0),
  83. SAVE_ITEM(EXYNOS4_CLKDIV_DMC1),
  84. SAVE_ITEM(EXYNOS4_CLKGATE_IP_DMC),
  85. SAVE_ITEM(EXYNOS4_CLKSRC_CPU),
  86. SAVE_ITEM(EXYNOS4_CLKDIV_CPU),
  87. SAVE_ITEM(EXYNOS4_CLKDIV_CPU + 0x4),
  88. SAVE_ITEM(EXYNOS4_CLKGATE_SCLKCPU),
  89. SAVE_ITEM(EXYNOS4_CLKGATE_IP_CPU),
  90. };
  91. #endif
  92. static struct clk exynos4_clk_sclk_hdmi27m = {
  93. .name = "sclk_hdmi27m",
  94. .rate = 27000000,
  95. };
  96. static struct clk exynos4_clk_sclk_hdmiphy = {
  97. .name = "sclk_hdmiphy",
  98. };
  99. static struct clk exynos4_clk_sclk_usbphy0 = {
  100. .name = "sclk_usbphy0",
  101. .rate = 27000000,
  102. };
  103. static struct clk exynos4_clk_sclk_usbphy1 = {
  104. .name = "sclk_usbphy1",
  105. };
  106. static struct clk dummy_apb_pclk = {
  107. .name = "apb_pclk",
  108. .id = -1,
  109. };
  110. static int exynos4_clksrc_mask_top_ctrl(struct clk *clk, int enable)
  111. {
  112. return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_TOP, clk, enable);
  113. }
  114. static int exynos4_clksrc_mask_cam_ctrl(struct clk *clk, int enable)
  115. {
  116. return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_CAM, clk, enable);
  117. }
  118. static int exynos4_clksrc_mask_lcd0_ctrl(struct clk *clk, int enable)
  119. {
  120. return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_LCD0, clk, enable);
  121. }
  122. int exynos4_clksrc_mask_fsys_ctrl(struct clk *clk, int enable)
  123. {
  124. return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_FSYS, clk, enable);
  125. }
  126. static int exynos4_clksrc_mask_peril0_ctrl(struct clk *clk, int enable)
  127. {
  128. return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_PERIL0, clk, enable);
  129. }
  130. static int exynos4_clksrc_mask_peril1_ctrl(struct clk *clk, int enable)
  131. {
  132. return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_PERIL1, clk, enable);
  133. }
  134. static int exynos4_clk_ip_mfc_ctrl(struct clk *clk, int enable)
  135. {
  136. return s5p_gatectrl(EXYNOS4_CLKGATE_IP_MFC, clk, enable);
  137. }
  138. static int exynos4_clksrc_mask_tv_ctrl(struct clk *clk, int enable)
  139. {
  140. return s5p_gatectrl(EXYNOS4_CLKSRC_MASK_TV, clk, enable);
  141. }
  142. static int exynos4_clk_ip_cam_ctrl(struct clk *clk, int enable)
  143. {
  144. return s5p_gatectrl(EXYNOS4_CLKGATE_IP_CAM, clk, enable);
  145. }
  146. static int exynos4_clk_ip_tv_ctrl(struct clk *clk, int enable)
  147. {
  148. return s5p_gatectrl(EXYNOS4_CLKGATE_IP_TV, clk, enable);
  149. }
  150. static int exynos4_clk_ip_image_ctrl(struct clk *clk, int enable)
  151. {
  152. return s5p_gatectrl(EXYNOS4_CLKGATE_IP_IMAGE, clk, enable);
  153. }
  154. static int exynos4_clk_ip_lcd0_ctrl(struct clk *clk, int enable)
  155. {
  156. return s5p_gatectrl(EXYNOS4_CLKGATE_IP_LCD0, clk, enable);
  157. }
  158. int exynos4_clk_ip_lcd1_ctrl(struct clk *clk, int enable)
  159. {
  160. return s5p_gatectrl(EXYNOS4210_CLKGATE_IP_LCD1, clk, enable);
  161. }
  162. int exynos4_clk_ip_fsys_ctrl(struct clk *clk, int enable)
  163. {
  164. return s5p_gatectrl(EXYNOS4_CLKGATE_IP_FSYS, clk, enable);
  165. }
  166. static int exynos4_clk_ip_peril_ctrl(struct clk *clk, int enable)
  167. {
  168. return s5p_gatectrl(EXYNOS4_CLKGATE_IP_PERIL, clk, enable);
  169. }
  170. static int exynos4_clk_ip_perir_ctrl(struct clk *clk, int enable)
  171. {
  172. return s5p_gatectrl(EXYNOS4_CLKGATE_IP_PERIR, clk, enable);
  173. }
  174. static int exynos4_clk_hdmiphy_ctrl(struct clk *clk, int enable)
  175. {
  176. return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable);
  177. }
  178. static int exynos4_clk_dac_ctrl(struct clk *clk, int enable)
  179. {
  180. return s5p_gatectrl(S5P_DAC_PHY_CONTROL, clk, enable);
  181. }
  182. /* Core list of CMU_CPU side */
  183. static struct clksrc_clk exynos4_clk_mout_apll = {
  184. .clk = {
  185. .name = "mout_apll",
  186. },
  187. .sources = &clk_src_apll,
  188. .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 0, .size = 1 },
  189. };
  190. static struct clksrc_clk exynos4_clk_sclk_apll = {
  191. .clk = {
  192. .name = "sclk_apll",
  193. .parent = &exynos4_clk_mout_apll.clk,
  194. },
  195. .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 24, .size = 3 },
  196. };
  197. static struct clksrc_clk exynos4_clk_mout_epll = {
  198. .clk = {
  199. .name = "mout_epll",
  200. },
  201. .sources = &clk_src_epll,
  202. .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 4, .size = 1 },
  203. };
  204. struct clksrc_clk exynos4_clk_mout_mpll = {
  205. .clk = {
  206. .name = "mout_mpll",
  207. },
  208. .sources = &clk_src_mpll,
  209. /* reg_src will be added in each SoCs' clock */
  210. };
  211. static struct clk *exynos4_clkset_moutcore_list[] = {
  212. [0] = &exynos4_clk_mout_apll.clk,
  213. [1] = &exynos4_clk_mout_mpll.clk,
  214. };
  215. static struct clksrc_sources exynos4_clkset_moutcore = {
  216. .sources = exynos4_clkset_moutcore_list,
  217. .nr_sources = ARRAY_SIZE(exynos4_clkset_moutcore_list),
  218. };
  219. static struct clksrc_clk exynos4_clk_moutcore = {
  220. .clk = {
  221. .name = "moutcore",
  222. },
  223. .sources = &exynos4_clkset_moutcore,
  224. .reg_src = { .reg = EXYNOS4_CLKSRC_CPU, .shift = 16, .size = 1 },
  225. };
  226. static struct clksrc_clk exynos4_clk_coreclk = {
  227. .clk = {
  228. .name = "core_clk",
  229. .parent = &exynos4_clk_moutcore.clk,
  230. },
  231. .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 0, .size = 3 },
  232. };
  233. static struct clksrc_clk exynos4_clk_armclk = {
  234. .clk = {
  235. .name = "armclk",
  236. .parent = &exynos4_clk_coreclk.clk,
  237. },
  238. };
  239. static struct clksrc_clk exynos4_clk_aclk_corem0 = {
  240. .clk = {
  241. .name = "aclk_corem0",
  242. .parent = &exynos4_clk_coreclk.clk,
  243. },
  244. .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 4, .size = 3 },
  245. };
  246. static struct clksrc_clk exynos4_clk_aclk_cores = {
  247. .clk = {
  248. .name = "aclk_cores",
  249. .parent = &exynos4_clk_coreclk.clk,
  250. },
  251. .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 4, .size = 3 },
  252. };
  253. static struct clksrc_clk exynos4_clk_aclk_corem1 = {
  254. .clk = {
  255. .name = "aclk_corem1",
  256. .parent = &exynos4_clk_coreclk.clk,
  257. },
  258. .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 8, .size = 3 },
  259. };
  260. static struct clksrc_clk exynos4_clk_periphclk = {
  261. .clk = {
  262. .name = "periphclk",
  263. .parent = &exynos4_clk_coreclk.clk,
  264. },
  265. .reg_div = { .reg = EXYNOS4_CLKDIV_CPU, .shift = 12, .size = 3 },
  266. };
  267. /* Core list of CMU_CORE side */
  268. static struct clk *exynos4_clkset_corebus_list[] = {
  269. [0] = &exynos4_clk_mout_mpll.clk,
  270. [1] = &exynos4_clk_sclk_apll.clk,
  271. };
  272. struct clksrc_sources exynos4_clkset_mout_corebus = {
  273. .sources = exynos4_clkset_corebus_list,
  274. .nr_sources = ARRAY_SIZE(exynos4_clkset_corebus_list),
  275. };
  276. static struct clksrc_clk exynos4_clk_mout_corebus = {
  277. .clk = {
  278. .name = "mout_corebus",
  279. },
  280. .sources = &exynos4_clkset_mout_corebus,
  281. .reg_src = { .reg = EXYNOS4_CLKSRC_DMC, .shift = 4, .size = 1 },
  282. };
  283. static struct clksrc_clk exynos4_clk_sclk_dmc = {
  284. .clk = {
  285. .name = "sclk_dmc",
  286. .parent = &exynos4_clk_mout_corebus.clk,
  287. },
  288. .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 12, .size = 3 },
  289. };
  290. static struct clksrc_clk exynos4_clk_aclk_cored = {
  291. .clk = {
  292. .name = "aclk_cored",
  293. .parent = &exynos4_clk_sclk_dmc.clk,
  294. },
  295. .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 16, .size = 3 },
  296. };
  297. static struct clksrc_clk exynos4_clk_aclk_corep = {
  298. .clk = {
  299. .name = "aclk_corep",
  300. .parent = &exynos4_clk_aclk_cored.clk,
  301. },
  302. .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 20, .size = 3 },
  303. };
  304. static struct clksrc_clk exynos4_clk_aclk_acp = {
  305. .clk = {
  306. .name = "aclk_acp",
  307. .parent = &exynos4_clk_mout_corebus.clk,
  308. },
  309. .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 0, .size = 3 },
  310. };
  311. static struct clksrc_clk exynos4_clk_pclk_acp = {
  312. .clk = {
  313. .name = "pclk_acp",
  314. .parent = &exynos4_clk_aclk_acp.clk,
  315. },
  316. .reg_div = { .reg = EXYNOS4_CLKDIV_DMC0, .shift = 4, .size = 3 },
  317. };
  318. /* Core list of CMU_TOP side */
  319. struct clk *exynos4_clkset_aclk_top_list[] = {
  320. [0] = &exynos4_clk_mout_mpll.clk,
  321. [1] = &exynos4_clk_sclk_apll.clk,
  322. };
  323. static struct clksrc_sources exynos4_clkset_aclk = {
  324. .sources = exynos4_clkset_aclk_top_list,
  325. .nr_sources = ARRAY_SIZE(exynos4_clkset_aclk_top_list),
  326. };
  327. static struct clksrc_clk exynos4_clk_aclk_200 = {
  328. .clk = {
  329. .name = "aclk_200",
  330. },
  331. .sources = &exynos4_clkset_aclk,
  332. .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 12, .size = 1 },
  333. .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 0, .size = 3 },
  334. };
  335. static struct clksrc_clk exynos4_clk_aclk_100 = {
  336. .clk = {
  337. .name = "aclk_100",
  338. },
  339. .sources = &exynos4_clkset_aclk,
  340. .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 16, .size = 1 },
  341. .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 4, .size = 4 },
  342. };
  343. static struct clksrc_clk exynos4_clk_aclk_160 = {
  344. .clk = {
  345. .name = "aclk_160",
  346. },
  347. .sources = &exynos4_clkset_aclk,
  348. .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 20, .size = 1 },
  349. .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 8, .size = 3 },
  350. };
  351. struct clksrc_clk exynos4_clk_aclk_133 = {
  352. .clk = {
  353. .name = "aclk_133",
  354. },
  355. .sources = &exynos4_clkset_aclk,
  356. .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 24, .size = 1 },
  357. .reg_div = { .reg = EXYNOS4_CLKDIV_TOP, .shift = 12, .size = 3 },
  358. };
  359. static struct clk *exynos4_clkset_vpllsrc_list[] = {
  360. [0] = &clk_fin_vpll,
  361. [1] = &exynos4_clk_sclk_hdmi27m,
  362. };
  363. static struct clksrc_sources exynos4_clkset_vpllsrc = {
  364. .sources = exynos4_clkset_vpllsrc_list,
  365. .nr_sources = ARRAY_SIZE(exynos4_clkset_vpllsrc_list),
  366. };
  367. static struct clksrc_clk exynos4_clk_vpllsrc = {
  368. .clk = {
  369. .name = "vpll_src",
  370. .enable = exynos4_clksrc_mask_top_ctrl,
  371. .ctrlbit = (1 << 0),
  372. },
  373. .sources = &exynos4_clkset_vpllsrc,
  374. .reg_src = { .reg = EXYNOS4_CLKSRC_TOP1, .shift = 0, .size = 1 },
  375. };
  376. static struct clk *exynos4_clkset_sclk_vpll_list[] = {
  377. [0] = &exynos4_clk_vpllsrc.clk,
  378. [1] = &clk_fout_vpll,
  379. };
  380. static struct clksrc_sources exynos4_clkset_sclk_vpll = {
  381. .sources = exynos4_clkset_sclk_vpll_list,
  382. .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_vpll_list),
  383. };
  384. static struct clksrc_clk exynos4_clk_sclk_vpll = {
  385. .clk = {
  386. .name = "sclk_vpll",
  387. },
  388. .sources = &exynos4_clkset_sclk_vpll,
  389. .reg_src = { .reg = EXYNOS4_CLKSRC_TOP0, .shift = 8, .size = 1 },
  390. };
  391. static struct clk exynos4_init_clocks_off[] = {
  392. {
  393. .name = "timers",
  394. .parent = &exynos4_clk_aclk_100.clk,
  395. .enable = exynos4_clk_ip_peril_ctrl,
  396. .ctrlbit = (1<<24),
  397. }, {
  398. .name = "csis",
  399. .devname = "s5p-mipi-csis.0",
  400. .enable = exynos4_clk_ip_cam_ctrl,
  401. .ctrlbit = (1 << 4),
  402. }, {
  403. .name = "csis",
  404. .devname = "s5p-mipi-csis.1",
  405. .enable = exynos4_clk_ip_cam_ctrl,
  406. .ctrlbit = (1 << 5),
  407. }, {
  408. .name = "jpeg",
  409. .id = 0,
  410. .enable = exynos4_clk_ip_cam_ctrl,
  411. .ctrlbit = (1 << 6),
  412. }, {
  413. .name = "fimc",
  414. .devname = "exynos4-fimc.0",
  415. .enable = exynos4_clk_ip_cam_ctrl,
  416. .ctrlbit = (1 << 0),
  417. }, {
  418. .name = "fimc",
  419. .devname = "exynos4-fimc.1",
  420. .enable = exynos4_clk_ip_cam_ctrl,
  421. .ctrlbit = (1 << 1),
  422. }, {
  423. .name = "fimc",
  424. .devname = "exynos4-fimc.2",
  425. .enable = exynos4_clk_ip_cam_ctrl,
  426. .ctrlbit = (1 << 2),
  427. }, {
  428. .name = "fimc",
  429. .devname = "exynos4-fimc.3",
  430. .enable = exynos4_clk_ip_cam_ctrl,
  431. .ctrlbit = (1 << 3),
  432. }, {
  433. .name = "fimd",
  434. .devname = "exynos4-fb.0",
  435. .enable = exynos4_clk_ip_lcd0_ctrl,
  436. .ctrlbit = (1 << 0),
  437. }, {
  438. .name = "hsmmc",
  439. .devname = "s3c-sdhci.0",
  440. .parent = &exynos4_clk_aclk_133.clk,
  441. .enable = exynos4_clk_ip_fsys_ctrl,
  442. .ctrlbit = (1 << 5),
  443. }, {
  444. .name = "hsmmc",
  445. .devname = "s3c-sdhci.1",
  446. .parent = &exynos4_clk_aclk_133.clk,
  447. .enable = exynos4_clk_ip_fsys_ctrl,
  448. .ctrlbit = (1 << 6),
  449. }, {
  450. .name = "hsmmc",
  451. .devname = "s3c-sdhci.2",
  452. .parent = &exynos4_clk_aclk_133.clk,
  453. .enable = exynos4_clk_ip_fsys_ctrl,
  454. .ctrlbit = (1 << 7),
  455. }, {
  456. .name = "hsmmc",
  457. .devname = "s3c-sdhci.3",
  458. .parent = &exynos4_clk_aclk_133.clk,
  459. .enable = exynos4_clk_ip_fsys_ctrl,
  460. .ctrlbit = (1 << 8),
  461. }, {
  462. .name = "dwmmc",
  463. .parent = &exynos4_clk_aclk_133.clk,
  464. .enable = exynos4_clk_ip_fsys_ctrl,
  465. .ctrlbit = (1 << 9),
  466. }, {
  467. .name = "dac",
  468. .devname = "s5p-sdo",
  469. .enable = exynos4_clk_ip_tv_ctrl,
  470. .ctrlbit = (1 << 2),
  471. }, {
  472. .name = "mixer",
  473. .devname = "s5p-mixer",
  474. .enable = exynos4_clk_ip_tv_ctrl,
  475. .ctrlbit = (1 << 1),
  476. }, {
  477. .name = "vp",
  478. .devname = "s5p-mixer",
  479. .enable = exynos4_clk_ip_tv_ctrl,
  480. .ctrlbit = (1 << 0),
  481. }, {
  482. .name = "hdmi",
  483. .devname = "exynos4-hdmi",
  484. .enable = exynos4_clk_ip_tv_ctrl,
  485. .ctrlbit = (1 << 3),
  486. }, {
  487. .name = "hdmiphy",
  488. .devname = "exynos4-hdmi",
  489. .enable = exynos4_clk_hdmiphy_ctrl,
  490. .ctrlbit = (1 << 0),
  491. }, {
  492. .name = "dacphy",
  493. .devname = "s5p-sdo",
  494. .enable = exynos4_clk_dac_ctrl,
  495. .ctrlbit = (1 << 0),
  496. }, {
  497. .name = "adc",
  498. .enable = exynos4_clk_ip_peril_ctrl,
  499. .ctrlbit = (1 << 15),
  500. }, {
  501. .name = "keypad",
  502. .enable = exynos4_clk_ip_perir_ctrl,
  503. .ctrlbit = (1 << 16),
  504. }, {
  505. .name = "rtc",
  506. .enable = exynos4_clk_ip_perir_ctrl,
  507. .ctrlbit = (1 << 15),
  508. }, {
  509. .name = "watchdog",
  510. .parent = &exynos4_clk_aclk_100.clk,
  511. .enable = exynos4_clk_ip_perir_ctrl,
  512. .ctrlbit = (1 << 14),
  513. }, {
  514. .name = "usbhost",
  515. .enable = exynos4_clk_ip_fsys_ctrl ,
  516. .ctrlbit = (1 << 12),
  517. }, {
  518. .name = "otg",
  519. .enable = exynos4_clk_ip_fsys_ctrl,
  520. .ctrlbit = (1 << 13),
  521. }, {
  522. .name = "spi",
  523. .devname = "s3c64xx-spi.0",
  524. .enable = exynos4_clk_ip_peril_ctrl,
  525. .ctrlbit = (1 << 16),
  526. }, {
  527. .name = "spi",
  528. .devname = "s3c64xx-spi.1",
  529. .enable = exynos4_clk_ip_peril_ctrl,
  530. .ctrlbit = (1 << 17),
  531. }, {
  532. .name = "spi",
  533. .devname = "s3c64xx-spi.2",
  534. .enable = exynos4_clk_ip_peril_ctrl,
  535. .ctrlbit = (1 << 18),
  536. }, {
  537. .name = "iis",
  538. .devname = "samsung-i2s.0",
  539. .enable = exynos4_clk_ip_peril_ctrl,
  540. .ctrlbit = (1 << 19),
  541. }, {
  542. .name = "iis",
  543. .devname = "samsung-i2s.1",
  544. .enable = exynos4_clk_ip_peril_ctrl,
  545. .ctrlbit = (1 << 20),
  546. }, {
  547. .name = "iis",
  548. .devname = "samsung-i2s.2",
  549. .enable = exynos4_clk_ip_peril_ctrl,
  550. .ctrlbit = (1 << 21),
  551. }, {
  552. .name = "ac97",
  553. .devname = "samsung-ac97",
  554. .enable = exynos4_clk_ip_peril_ctrl,
  555. .ctrlbit = (1 << 27),
  556. }, {
  557. .name = "fimg2d",
  558. .enable = exynos4_clk_ip_image_ctrl,
  559. .ctrlbit = (1 << 0),
  560. }, {
  561. .name = "mfc",
  562. .devname = "s5p-mfc",
  563. .enable = exynos4_clk_ip_mfc_ctrl,
  564. .ctrlbit = (1 << 0),
  565. }, {
  566. .name = "i2c",
  567. .devname = "s3c2440-i2c.0",
  568. .parent = &exynos4_clk_aclk_100.clk,
  569. .enable = exynos4_clk_ip_peril_ctrl,
  570. .ctrlbit = (1 << 6),
  571. }, {
  572. .name = "i2c",
  573. .devname = "s3c2440-i2c.1",
  574. .parent = &exynos4_clk_aclk_100.clk,
  575. .enable = exynos4_clk_ip_peril_ctrl,
  576. .ctrlbit = (1 << 7),
  577. }, {
  578. .name = "i2c",
  579. .devname = "s3c2440-i2c.2",
  580. .parent = &exynos4_clk_aclk_100.clk,
  581. .enable = exynos4_clk_ip_peril_ctrl,
  582. .ctrlbit = (1 << 8),
  583. }, {
  584. .name = "i2c",
  585. .devname = "s3c2440-i2c.3",
  586. .parent = &exynos4_clk_aclk_100.clk,
  587. .enable = exynos4_clk_ip_peril_ctrl,
  588. .ctrlbit = (1 << 9),
  589. }, {
  590. .name = "i2c",
  591. .devname = "s3c2440-i2c.4",
  592. .parent = &exynos4_clk_aclk_100.clk,
  593. .enable = exynos4_clk_ip_peril_ctrl,
  594. .ctrlbit = (1 << 10),
  595. }, {
  596. .name = "i2c",
  597. .devname = "s3c2440-i2c.5",
  598. .parent = &exynos4_clk_aclk_100.clk,
  599. .enable = exynos4_clk_ip_peril_ctrl,
  600. .ctrlbit = (1 << 11),
  601. }, {
  602. .name = "i2c",
  603. .devname = "s3c2440-i2c.6",
  604. .parent = &exynos4_clk_aclk_100.clk,
  605. .enable = exynos4_clk_ip_peril_ctrl,
  606. .ctrlbit = (1 << 12),
  607. }, {
  608. .name = "i2c",
  609. .devname = "s3c2440-i2c.7",
  610. .parent = &exynos4_clk_aclk_100.clk,
  611. .enable = exynos4_clk_ip_peril_ctrl,
  612. .ctrlbit = (1 << 13),
  613. }, {
  614. .name = "i2c",
  615. .devname = "s3c2440-hdmiphy-i2c",
  616. .parent = &exynos4_clk_aclk_100.clk,
  617. .enable = exynos4_clk_ip_peril_ctrl,
  618. .ctrlbit = (1 << 14),
  619. }, {
  620. .name = "SYSMMU_MDMA",
  621. .enable = exynos4_clk_ip_image_ctrl,
  622. .ctrlbit = (1 << 5),
  623. }, {
  624. .name = "SYSMMU_FIMC0",
  625. .enable = exynos4_clk_ip_cam_ctrl,
  626. .ctrlbit = (1 << 7),
  627. }, {
  628. .name = "SYSMMU_FIMC1",
  629. .enable = exynos4_clk_ip_cam_ctrl,
  630. .ctrlbit = (1 << 8),
  631. }, {
  632. .name = "SYSMMU_FIMC2",
  633. .enable = exynos4_clk_ip_cam_ctrl,
  634. .ctrlbit = (1 << 9),
  635. }, {
  636. .name = "SYSMMU_FIMC3",
  637. .enable = exynos4_clk_ip_cam_ctrl,
  638. .ctrlbit = (1 << 10),
  639. }, {
  640. .name = "SYSMMU_JPEG",
  641. .enable = exynos4_clk_ip_cam_ctrl,
  642. .ctrlbit = (1 << 11),
  643. }, {
  644. .name = "SYSMMU_FIMD0",
  645. .enable = exynos4_clk_ip_lcd0_ctrl,
  646. .ctrlbit = (1 << 4),
  647. }, {
  648. .name = "SYSMMU_FIMD1",
  649. .enable = exynos4_clk_ip_lcd1_ctrl,
  650. .ctrlbit = (1 << 4),
  651. }, {
  652. .name = "SYSMMU_PCIe",
  653. .enable = exynos4_clk_ip_fsys_ctrl,
  654. .ctrlbit = (1 << 18),
  655. }, {
  656. .name = "SYSMMU_G2D",
  657. .enable = exynos4_clk_ip_image_ctrl,
  658. .ctrlbit = (1 << 3),
  659. }, {
  660. .name = "SYSMMU_ROTATOR",
  661. .enable = exynos4_clk_ip_image_ctrl,
  662. .ctrlbit = (1 << 4),
  663. }, {
  664. .name = "SYSMMU_TV",
  665. .enable = exynos4_clk_ip_tv_ctrl,
  666. .ctrlbit = (1 << 4),
  667. }, {
  668. .name = "SYSMMU_MFC_L",
  669. .enable = exynos4_clk_ip_mfc_ctrl,
  670. .ctrlbit = (1 << 1),
  671. }, {
  672. .name = "SYSMMU_MFC_R",
  673. .enable = exynos4_clk_ip_mfc_ctrl,
  674. .ctrlbit = (1 << 2),
  675. }
  676. };
  677. static struct clk exynos4_init_clocks_on[] = {
  678. {
  679. .name = "uart",
  680. .devname = "s5pv210-uart.0",
  681. .enable = exynos4_clk_ip_peril_ctrl,
  682. .ctrlbit = (1 << 0),
  683. }, {
  684. .name = "uart",
  685. .devname = "s5pv210-uart.1",
  686. .enable = exynos4_clk_ip_peril_ctrl,
  687. .ctrlbit = (1 << 1),
  688. }, {
  689. .name = "uart",
  690. .devname = "s5pv210-uart.2",
  691. .enable = exynos4_clk_ip_peril_ctrl,
  692. .ctrlbit = (1 << 2),
  693. }, {
  694. .name = "uart",
  695. .devname = "s5pv210-uart.3",
  696. .enable = exynos4_clk_ip_peril_ctrl,
  697. .ctrlbit = (1 << 3),
  698. }, {
  699. .name = "uart",
  700. .devname = "s5pv210-uart.4",
  701. .enable = exynos4_clk_ip_peril_ctrl,
  702. .ctrlbit = (1 << 4),
  703. }, {
  704. .name = "uart",
  705. .devname = "s5pv210-uart.5",
  706. .enable = exynos4_clk_ip_peril_ctrl,
  707. .ctrlbit = (1 << 5),
  708. }
  709. };
  710. static struct clk exynos4_clk_pdma0 = {
  711. .name = "dma",
  712. .devname = "dma-pl330.0",
  713. .enable = exynos4_clk_ip_fsys_ctrl,
  714. .ctrlbit = (1 << 0),
  715. };
  716. static struct clk exynos4_clk_pdma1 = {
  717. .name = "dma",
  718. .devname = "dma-pl330.1",
  719. .enable = exynos4_clk_ip_fsys_ctrl,
  720. .ctrlbit = (1 << 1),
  721. };
  722. static struct clk exynos4_clk_mdma1 = {
  723. .name = "dma",
  724. .devname = "dma-pl330.2",
  725. .enable = exynos4_clk_ip_image_ctrl,
  726. .ctrlbit = ((1 << 8) | (1 << 5) | (1 << 2)),
  727. };
  728. struct clk *exynos4_clkset_group_list[] = {
  729. [0] = &clk_ext_xtal_mux,
  730. [1] = &clk_xusbxti,
  731. [2] = &exynos4_clk_sclk_hdmi27m,
  732. [3] = &exynos4_clk_sclk_usbphy0,
  733. [4] = &exynos4_clk_sclk_usbphy1,
  734. [5] = &exynos4_clk_sclk_hdmiphy,
  735. [6] = &exynos4_clk_mout_mpll.clk,
  736. [7] = &exynos4_clk_mout_epll.clk,
  737. [8] = &exynos4_clk_sclk_vpll.clk,
  738. };
  739. struct clksrc_sources exynos4_clkset_group = {
  740. .sources = exynos4_clkset_group_list,
  741. .nr_sources = ARRAY_SIZE(exynos4_clkset_group_list),
  742. };
  743. static struct clk *exynos4_clkset_mout_g2d0_list[] = {
  744. [0] = &exynos4_clk_mout_mpll.clk,
  745. [1] = &exynos4_clk_sclk_apll.clk,
  746. };
  747. static struct clksrc_sources exynos4_clkset_mout_g2d0 = {
  748. .sources = exynos4_clkset_mout_g2d0_list,
  749. .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_g2d0_list),
  750. };
  751. static struct clksrc_clk exynos4_clk_mout_g2d0 = {
  752. .clk = {
  753. .name = "mout_g2d0",
  754. },
  755. .sources = &exynos4_clkset_mout_g2d0,
  756. .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 0, .size = 1 },
  757. };
  758. static struct clk *exynos4_clkset_mout_g2d1_list[] = {
  759. [0] = &exynos4_clk_mout_epll.clk,
  760. [1] = &exynos4_clk_sclk_vpll.clk,
  761. };
  762. static struct clksrc_sources exynos4_clkset_mout_g2d1 = {
  763. .sources = exynos4_clkset_mout_g2d1_list,
  764. .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_g2d1_list),
  765. };
  766. static struct clksrc_clk exynos4_clk_mout_g2d1 = {
  767. .clk = {
  768. .name = "mout_g2d1",
  769. },
  770. .sources = &exynos4_clkset_mout_g2d1,
  771. .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 4, .size = 1 },
  772. };
  773. static struct clk *exynos4_clkset_mout_g2d_list[] = {
  774. [0] = &exynos4_clk_mout_g2d0.clk,
  775. [1] = &exynos4_clk_mout_g2d1.clk,
  776. };
  777. static struct clksrc_sources exynos4_clkset_mout_g2d = {
  778. .sources = exynos4_clkset_mout_g2d_list,
  779. .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_g2d_list),
  780. };
  781. static struct clk *exynos4_clkset_mout_mfc0_list[] = {
  782. [0] = &exynos4_clk_mout_mpll.clk,
  783. [1] = &exynos4_clk_sclk_apll.clk,
  784. };
  785. static struct clksrc_sources exynos4_clkset_mout_mfc0 = {
  786. .sources = exynos4_clkset_mout_mfc0_list,
  787. .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc0_list),
  788. };
  789. static struct clksrc_clk exynos4_clk_mout_mfc0 = {
  790. .clk = {
  791. .name = "mout_mfc0",
  792. },
  793. .sources = &exynos4_clkset_mout_mfc0,
  794. .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 0, .size = 1 },
  795. };
  796. static struct clk *exynos4_clkset_mout_mfc1_list[] = {
  797. [0] = &exynos4_clk_mout_epll.clk,
  798. [1] = &exynos4_clk_sclk_vpll.clk,
  799. };
  800. static struct clksrc_sources exynos4_clkset_mout_mfc1 = {
  801. .sources = exynos4_clkset_mout_mfc1_list,
  802. .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc1_list),
  803. };
  804. static struct clksrc_clk exynos4_clk_mout_mfc1 = {
  805. .clk = {
  806. .name = "mout_mfc1",
  807. },
  808. .sources = &exynos4_clkset_mout_mfc1,
  809. .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 4, .size = 1 },
  810. };
  811. static struct clk *exynos4_clkset_mout_mfc_list[] = {
  812. [0] = &exynos4_clk_mout_mfc0.clk,
  813. [1] = &exynos4_clk_mout_mfc1.clk,
  814. };
  815. static struct clksrc_sources exynos4_clkset_mout_mfc = {
  816. .sources = exynos4_clkset_mout_mfc_list,
  817. .nr_sources = ARRAY_SIZE(exynos4_clkset_mout_mfc_list),
  818. };
  819. static struct clk *exynos4_clkset_sclk_dac_list[] = {
  820. [0] = &exynos4_clk_sclk_vpll.clk,
  821. [1] = &exynos4_clk_sclk_hdmiphy,
  822. };
  823. static struct clksrc_sources exynos4_clkset_sclk_dac = {
  824. .sources = exynos4_clkset_sclk_dac_list,
  825. .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_dac_list),
  826. };
  827. static struct clksrc_clk exynos4_clk_sclk_dac = {
  828. .clk = {
  829. .name = "sclk_dac",
  830. .enable = exynos4_clksrc_mask_tv_ctrl,
  831. .ctrlbit = (1 << 8),
  832. },
  833. .sources = &exynos4_clkset_sclk_dac,
  834. .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 8, .size = 1 },
  835. };
  836. static struct clksrc_clk exynos4_clk_sclk_pixel = {
  837. .clk = {
  838. .name = "sclk_pixel",
  839. .parent = &exynos4_clk_sclk_vpll.clk,
  840. },
  841. .reg_div = { .reg = EXYNOS4_CLKDIV_TV, .shift = 0, .size = 4 },
  842. };
  843. static struct clk *exynos4_clkset_sclk_hdmi_list[] = {
  844. [0] = &exynos4_clk_sclk_pixel.clk,
  845. [1] = &exynos4_clk_sclk_hdmiphy,
  846. };
  847. static struct clksrc_sources exynos4_clkset_sclk_hdmi = {
  848. .sources = exynos4_clkset_sclk_hdmi_list,
  849. .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_hdmi_list),
  850. };
  851. static struct clksrc_clk exynos4_clk_sclk_hdmi = {
  852. .clk = {
  853. .name = "sclk_hdmi",
  854. .enable = exynos4_clksrc_mask_tv_ctrl,
  855. .ctrlbit = (1 << 0),
  856. },
  857. .sources = &exynos4_clkset_sclk_hdmi,
  858. .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 0, .size = 1 },
  859. };
  860. static struct clk *exynos4_clkset_sclk_mixer_list[] = {
  861. [0] = &exynos4_clk_sclk_dac.clk,
  862. [1] = &exynos4_clk_sclk_hdmi.clk,
  863. };
  864. static struct clksrc_sources exynos4_clkset_sclk_mixer = {
  865. .sources = exynos4_clkset_sclk_mixer_list,
  866. .nr_sources = ARRAY_SIZE(exynos4_clkset_sclk_mixer_list),
  867. };
  868. static struct clksrc_clk exynos4_clk_sclk_mixer = {
  869. .clk = {
  870. .name = "sclk_mixer",
  871. .enable = exynos4_clksrc_mask_tv_ctrl,
  872. .ctrlbit = (1 << 4),
  873. },
  874. .sources = &exynos4_clkset_sclk_mixer,
  875. .reg_src = { .reg = EXYNOS4_CLKSRC_TV, .shift = 4, .size = 1 },
  876. };
  877. static struct clksrc_clk *exynos4_sclk_tv[] = {
  878. &exynos4_clk_sclk_dac,
  879. &exynos4_clk_sclk_pixel,
  880. &exynos4_clk_sclk_hdmi,
  881. &exynos4_clk_sclk_mixer,
  882. };
  883. static struct clksrc_clk exynos4_clk_dout_mmc0 = {
  884. .clk = {
  885. .name = "dout_mmc0",
  886. },
  887. .sources = &exynos4_clkset_group,
  888. .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 0, .size = 4 },
  889. .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 0, .size = 4 },
  890. };
  891. static struct clksrc_clk exynos4_clk_dout_mmc1 = {
  892. .clk = {
  893. .name = "dout_mmc1",
  894. },
  895. .sources = &exynos4_clkset_group,
  896. .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 4, .size = 4 },
  897. .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 16, .size = 4 },
  898. };
  899. static struct clksrc_clk exynos4_clk_dout_mmc2 = {
  900. .clk = {
  901. .name = "dout_mmc2",
  902. },
  903. .sources = &exynos4_clkset_group,
  904. .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 8, .size = 4 },
  905. .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 0, .size = 4 },
  906. };
  907. static struct clksrc_clk exynos4_clk_dout_mmc3 = {
  908. .clk = {
  909. .name = "dout_mmc3",
  910. },
  911. .sources = &exynos4_clkset_group,
  912. .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 12, .size = 4 },
  913. .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 16, .size = 4 },
  914. };
  915. static struct clksrc_clk exynos4_clk_dout_mmc4 = {
  916. .clk = {
  917. .name = "dout_mmc4",
  918. },
  919. .sources = &exynos4_clkset_group,
  920. .reg_src = { .reg = EXYNOS4_CLKSRC_FSYS, .shift = 16, .size = 4 },
  921. .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS3, .shift = 0, .size = 4 },
  922. };
  923. static struct clksrc_clk exynos4_clksrcs[] = {
  924. {
  925. .clk = {
  926. .name = "sclk_pwm",
  927. .enable = exynos4_clksrc_mask_peril0_ctrl,
  928. .ctrlbit = (1 << 24),
  929. },
  930. .sources = &exynos4_clkset_group,
  931. .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 24, .size = 4 },
  932. .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL3, .shift = 0, .size = 4 },
  933. }, {
  934. .clk = {
  935. .name = "sclk_csis",
  936. .devname = "s5p-mipi-csis.0",
  937. .enable = exynos4_clksrc_mask_cam_ctrl,
  938. .ctrlbit = (1 << 24),
  939. },
  940. .sources = &exynos4_clkset_group,
  941. .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 24, .size = 4 },
  942. .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 24, .size = 4 },
  943. }, {
  944. .clk = {
  945. .name = "sclk_csis",
  946. .devname = "s5p-mipi-csis.1",
  947. .enable = exynos4_clksrc_mask_cam_ctrl,
  948. .ctrlbit = (1 << 28),
  949. },
  950. .sources = &exynos4_clkset_group,
  951. .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 28, .size = 4 },
  952. .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 28, .size = 4 },
  953. }, {
  954. .clk = {
  955. .name = "sclk_cam0",
  956. .enable = exynos4_clksrc_mask_cam_ctrl,
  957. .ctrlbit = (1 << 16),
  958. },
  959. .sources = &exynos4_clkset_group,
  960. .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 16, .size = 4 },
  961. .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 16, .size = 4 },
  962. }, {
  963. .clk = {
  964. .name = "sclk_cam1",
  965. .enable = exynos4_clksrc_mask_cam_ctrl,
  966. .ctrlbit = (1 << 20),
  967. },
  968. .sources = &exynos4_clkset_group,
  969. .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 20, .size = 4 },
  970. .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 20, .size = 4 },
  971. }, {
  972. .clk = {
  973. .name = "sclk_fimc",
  974. .devname = "exynos4-fimc.0",
  975. .enable = exynos4_clksrc_mask_cam_ctrl,
  976. .ctrlbit = (1 << 0),
  977. },
  978. .sources = &exynos4_clkset_group,
  979. .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 0, .size = 4 },
  980. .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 0, .size = 4 },
  981. }, {
  982. .clk = {
  983. .name = "sclk_fimc",
  984. .devname = "exynos4-fimc.1",
  985. .enable = exynos4_clksrc_mask_cam_ctrl,
  986. .ctrlbit = (1 << 4),
  987. },
  988. .sources = &exynos4_clkset_group,
  989. .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 4, .size = 4 },
  990. .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 4, .size = 4 },
  991. }, {
  992. .clk = {
  993. .name = "sclk_fimc",
  994. .devname = "exynos4-fimc.2",
  995. .enable = exynos4_clksrc_mask_cam_ctrl,
  996. .ctrlbit = (1 << 8),
  997. },
  998. .sources = &exynos4_clkset_group,
  999. .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 8, .size = 4 },
  1000. .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 8, .size = 4 },
  1001. }, {
  1002. .clk = {
  1003. .name = "sclk_fimc",
  1004. .devname = "exynos4-fimc.3",
  1005. .enable = exynos4_clksrc_mask_cam_ctrl,
  1006. .ctrlbit = (1 << 12),
  1007. },
  1008. .sources = &exynos4_clkset_group,
  1009. .reg_src = { .reg = EXYNOS4_CLKSRC_CAM, .shift = 12, .size = 4 },
  1010. .reg_div = { .reg = EXYNOS4_CLKDIV_CAM, .shift = 12, .size = 4 },
  1011. }, {
  1012. .clk = {
  1013. .name = "sclk_fimd",
  1014. .devname = "exynos4-fb.0",
  1015. .enable = exynos4_clksrc_mask_lcd0_ctrl,
  1016. .ctrlbit = (1 << 0),
  1017. },
  1018. .sources = &exynos4_clkset_group,
  1019. .reg_src = { .reg = EXYNOS4_CLKSRC_LCD0, .shift = 0, .size = 4 },
  1020. .reg_div = { .reg = EXYNOS4_CLKDIV_LCD0, .shift = 0, .size = 4 },
  1021. }, {
  1022. .clk = {
  1023. .name = "sclk_fimg2d",
  1024. },
  1025. .sources = &exynos4_clkset_mout_g2d,
  1026. .reg_src = { .reg = EXYNOS4_CLKSRC_IMAGE, .shift = 8, .size = 1 },
  1027. .reg_div = { .reg = EXYNOS4_CLKDIV_IMAGE, .shift = 0, .size = 4 },
  1028. }, {
  1029. .clk = {
  1030. .name = "sclk_mfc",
  1031. .devname = "s5p-mfc",
  1032. },
  1033. .sources = &exynos4_clkset_mout_mfc,
  1034. .reg_src = { .reg = EXYNOS4_CLKSRC_MFC, .shift = 8, .size = 1 },
  1035. .reg_div = { .reg = EXYNOS4_CLKDIV_MFC, .shift = 0, .size = 4 },
  1036. }, {
  1037. .clk = {
  1038. .name = "sclk_dwmmc",
  1039. .parent = &exynos4_clk_dout_mmc4.clk,
  1040. .enable = exynos4_clksrc_mask_fsys_ctrl,
  1041. .ctrlbit = (1 << 16),
  1042. },
  1043. .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS3, .shift = 8, .size = 8 },
  1044. }
  1045. };
  1046. static struct clksrc_clk exynos4_clk_sclk_uart0 = {
  1047. .clk = {
  1048. .name = "uclk1",
  1049. .devname = "exynos4210-uart.0",
  1050. .enable = exynos4_clksrc_mask_peril0_ctrl,
  1051. .ctrlbit = (1 << 0),
  1052. },
  1053. .sources = &exynos4_clkset_group,
  1054. .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 0, .size = 4 },
  1055. .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 0, .size = 4 },
  1056. };
  1057. static struct clksrc_clk exynos4_clk_sclk_uart1 = {
  1058. .clk = {
  1059. .name = "uclk1",
  1060. .devname = "exynos4210-uart.1",
  1061. .enable = exynos4_clksrc_mask_peril0_ctrl,
  1062. .ctrlbit = (1 << 4),
  1063. },
  1064. .sources = &exynos4_clkset_group,
  1065. .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 4, .size = 4 },
  1066. .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 4, .size = 4 },
  1067. };
  1068. static struct clksrc_clk exynos4_clk_sclk_uart2 = {
  1069. .clk = {
  1070. .name = "uclk1",
  1071. .devname = "exynos4210-uart.2",
  1072. .enable = exynos4_clksrc_mask_peril0_ctrl,
  1073. .ctrlbit = (1 << 8),
  1074. },
  1075. .sources = &exynos4_clkset_group,
  1076. .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 8, .size = 4 },
  1077. .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 8, .size = 4 },
  1078. };
  1079. static struct clksrc_clk exynos4_clk_sclk_uart3 = {
  1080. .clk = {
  1081. .name = "uclk1",
  1082. .devname = "exynos4210-uart.3",
  1083. .enable = exynos4_clksrc_mask_peril0_ctrl,
  1084. .ctrlbit = (1 << 12),
  1085. },
  1086. .sources = &exynos4_clkset_group,
  1087. .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL0, .shift = 12, .size = 4 },
  1088. .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL0, .shift = 12, .size = 4 },
  1089. };
  1090. static struct clksrc_clk exynos4_clk_sclk_mmc0 = {
  1091. .clk = {
  1092. .name = "sclk_mmc",
  1093. .devname = "s3c-sdhci.0",
  1094. .parent = &exynos4_clk_dout_mmc0.clk,
  1095. .enable = exynos4_clksrc_mask_fsys_ctrl,
  1096. .ctrlbit = (1 << 0),
  1097. },
  1098. .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 8, .size = 8 },
  1099. };
  1100. static struct clksrc_clk exynos4_clk_sclk_mmc1 = {
  1101. .clk = {
  1102. .name = "sclk_mmc",
  1103. .devname = "s3c-sdhci.1",
  1104. .parent = &exynos4_clk_dout_mmc1.clk,
  1105. .enable = exynos4_clksrc_mask_fsys_ctrl,
  1106. .ctrlbit = (1 << 4),
  1107. },
  1108. .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS1, .shift = 24, .size = 8 },
  1109. };
  1110. static struct clksrc_clk exynos4_clk_sclk_mmc2 = {
  1111. .clk = {
  1112. .name = "sclk_mmc",
  1113. .devname = "s3c-sdhci.2",
  1114. .parent = &exynos4_clk_dout_mmc2.clk,
  1115. .enable = exynos4_clksrc_mask_fsys_ctrl,
  1116. .ctrlbit = (1 << 8),
  1117. },
  1118. .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 8, .size = 8 },
  1119. };
  1120. static struct clksrc_clk exynos4_clk_sclk_mmc3 = {
  1121. .clk = {
  1122. .name = "sclk_mmc",
  1123. .devname = "s3c-sdhci.3",
  1124. .parent = &exynos4_clk_dout_mmc3.clk,
  1125. .enable = exynos4_clksrc_mask_fsys_ctrl,
  1126. .ctrlbit = (1 << 12),
  1127. },
  1128. .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 24, .size = 8 },
  1129. };
  1130. static struct clksrc_clk exynos4_clk_sclk_spi0 = {
  1131. .clk = {
  1132. .name = "sclk_spi",
  1133. .devname = "s3c64xx-spi.0",
  1134. .enable = exynos4_clksrc_mask_peril1_ctrl,
  1135. .ctrlbit = (1 << 16),
  1136. },
  1137. .sources = &exynos4_clkset_group,
  1138. .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 16, .size = 4 },
  1139. .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 0, .size = 4 },
  1140. };
  1141. static struct clksrc_clk exynos4_clk_sclk_spi1 = {
  1142. .clk = {
  1143. .name = "sclk_spi",
  1144. .devname = "s3c64xx-spi.1",
  1145. .enable = exynos4_clksrc_mask_peril1_ctrl,
  1146. .ctrlbit = (1 << 20),
  1147. },
  1148. .sources = &exynos4_clkset_group,
  1149. .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 20, .size = 4 },
  1150. .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 16, .size = 4 },
  1151. };
  1152. static struct clksrc_clk exynos4_clk_sclk_spi2 = {
  1153. .clk = {
  1154. .name = "sclk_spi",
  1155. .devname = "s3c64xx-spi.2",
  1156. .enable = exynos4_clksrc_mask_peril1_ctrl,
  1157. .ctrlbit = (1 << 24),
  1158. },
  1159. .sources = &exynos4_clkset_group,
  1160. .reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 24, .size = 4 },
  1161. .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL2, .shift = 0, .size = 4 },
  1162. };
  1163. /* Clock initialization code */
  1164. static struct clksrc_clk *exynos4_sysclks[] = {
  1165. &exynos4_clk_mout_apll,
  1166. &exynos4_clk_sclk_apll,
  1167. &exynos4_clk_mout_epll,
  1168. &exynos4_clk_mout_mpll,
  1169. &exynos4_clk_moutcore,
  1170. &exynos4_clk_coreclk,
  1171. &exynos4_clk_armclk,
  1172. &exynos4_clk_aclk_corem0,
  1173. &exynos4_clk_aclk_cores,
  1174. &exynos4_clk_aclk_corem1,
  1175. &exynos4_clk_periphclk,
  1176. &exynos4_clk_mout_corebus,
  1177. &exynos4_clk_sclk_dmc,
  1178. &exynos4_clk_aclk_cored,
  1179. &exynos4_clk_aclk_corep,
  1180. &exynos4_clk_aclk_acp,
  1181. &exynos4_clk_pclk_acp,
  1182. &exynos4_clk_vpllsrc,
  1183. &exynos4_clk_sclk_vpll,
  1184. &exynos4_clk_aclk_200,
  1185. &exynos4_clk_aclk_100,
  1186. &exynos4_clk_aclk_160,
  1187. &exynos4_clk_aclk_133,
  1188. &exynos4_clk_dout_mmc0,
  1189. &exynos4_clk_dout_mmc1,
  1190. &exynos4_clk_dout_mmc2,
  1191. &exynos4_clk_dout_mmc3,
  1192. &exynos4_clk_dout_mmc4,
  1193. &exynos4_clk_mout_mfc0,
  1194. &exynos4_clk_mout_mfc1,
  1195. };
  1196. static struct clk *exynos4_clk_cdev[] = {
  1197. &exynos4_clk_pdma0,
  1198. &exynos4_clk_pdma1,
  1199. &exynos4_clk_mdma1,
  1200. };
  1201. static struct clksrc_clk *exynos4_clksrc_cdev[] = {
  1202. &exynos4_clk_sclk_uart0,
  1203. &exynos4_clk_sclk_uart1,
  1204. &exynos4_clk_sclk_uart2,
  1205. &exynos4_clk_sclk_uart3,
  1206. &exynos4_clk_sclk_mmc0,
  1207. &exynos4_clk_sclk_mmc1,
  1208. &exynos4_clk_sclk_mmc2,
  1209. &exynos4_clk_sclk_mmc3,
  1210. &exynos4_clk_sclk_spi0,
  1211. &exynos4_clk_sclk_spi1,
  1212. &exynos4_clk_sclk_spi2,
  1213. };
  1214. static struct clk_lookup exynos4_clk_lookup[] = {
  1215. CLKDEV_INIT("exynos4210-uart.0", "clk_uart_baud0", &exynos4_clk_sclk_uart0.clk),
  1216. CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos4_clk_sclk_uart1.clk),
  1217. CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos4_clk_sclk_uart2.clk),
  1218. CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos4_clk_sclk_uart3.clk),
  1219. CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &exynos4_clk_sclk_mmc0.clk),
  1220. CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &exynos4_clk_sclk_mmc1.clk),
  1221. CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &exynos4_clk_sclk_mmc2.clk),
  1222. CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &exynos4_clk_sclk_mmc3.clk),
  1223. CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0),
  1224. CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1),
  1225. CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos4_clk_mdma1),
  1226. CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk0", &exynos4_clk_sclk_spi0.clk),
  1227. CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk0", &exynos4_clk_sclk_spi1.clk),
  1228. CLKDEV_INIT("s3c64xx-spi.2", "spi_busclk0", &exynos4_clk_sclk_spi2.clk),
  1229. };
  1230. static int xtal_rate;
  1231. static unsigned long exynos4_fout_apll_get_rate(struct clk *clk)
  1232. {
  1233. if (soc_is_exynos4210())
  1234. return s5p_get_pll45xx(xtal_rate, __raw_readl(EXYNOS4_APLL_CON0),
  1235. pll_4508);
  1236. else if (soc_is_exynos4212() || soc_is_exynos4412())
  1237. return s5p_get_pll35xx(xtal_rate, __raw_readl(EXYNOS4_APLL_CON0));
  1238. else
  1239. return 0;
  1240. }
  1241. static struct clk_ops exynos4_fout_apll_ops = {
  1242. .get_rate = exynos4_fout_apll_get_rate,
  1243. };
  1244. static u32 exynos4_vpll_div[][8] = {
  1245. { 54000000, 3, 53, 3, 1024, 0, 17, 0 },
  1246. { 108000000, 3, 53, 2, 1024, 0, 17, 0 },
  1247. };
  1248. static unsigned long exynos4_vpll_get_rate(struct clk *clk)
  1249. {
  1250. return clk->rate;
  1251. }
  1252. static int exynos4_vpll_set_rate(struct clk *clk, unsigned long rate)
  1253. {
  1254. unsigned int vpll_con0, vpll_con1 = 0;
  1255. unsigned int i;
  1256. /* Return if nothing changed */
  1257. if (clk->rate == rate)
  1258. return 0;
  1259. vpll_con0 = __raw_readl(EXYNOS4_VPLL_CON0);
  1260. vpll_con0 &= ~(0x1 << 27 | \
  1261. PLL90XX_MDIV_MASK << PLL46XX_MDIV_SHIFT | \
  1262. PLL90XX_PDIV_MASK << PLL46XX_PDIV_SHIFT | \
  1263. PLL90XX_SDIV_MASK << PLL46XX_SDIV_SHIFT);
  1264. vpll_con1 = __raw_readl(EXYNOS4_VPLL_CON1);
  1265. vpll_con1 &= ~(PLL46XX_MRR_MASK << PLL46XX_MRR_SHIFT | \
  1266. PLL46XX_MFR_MASK << PLL46XX_MFR_SHIFT | \
  1267. PLL4650C_KDIV_MASK << PLL46XX_KDIV_SHIFT);
  1268. for (i = 0; i < ARRAY_SIZE(exynos4_vpll_div); i++) {
  1269. if (exynos4_vpll_div[i][0] == rate) {
  1270. vpll_con0 |= exynos4_vpll_div[i][1] << PLL46XX_PDIV_SHIFT;
  1271. vpll_con0 |= exynos4_vpll_div[i][2] << PLL46XX_MDIV_SHIFT;
  1272. vpll_con0 |= exynos4_vpll_div[i][3] << PLL46XX_SDIV_SHIFT;
  1273. vpll_con1 |= exynos4_vpll_div[i][4] << PLL46XX_KDIV_SHIFT;
  1274. vpll_con1 |= exynos4_vpll_div[i][5] << PLL46XX_MFR_SHIFT;
  1275. vpll_con1 |= exynos4_vpll_div[i][6] << PLL46XX_MRR_SHIFT;
  1276. vpll_con0 |= exynos4_vpll_div[i][7] << 27;
  1277. break;
  1278. }
  1279. }
  1280. if (i == ARRAY_SIZE(exynos4_vpll_div)) {
  1281. printk(KERN_ERR "%s: Invalid Clock VPLL Frequency\n",
  1282. __func__);
  1283. return -EINVAL;
  1284. }
  1285. __raw_writel(vpll_con0, EXYNOS4_VPLL_CON0);
  1286. __raw_writel(vpll_con1, EXYNOS4_VPLL_CON1);
  1287. /* Wait for VPLL lock */
  1288. while (!(__raw_readl(EXYNOS4_VPLL_CON0) & (1 << PLL46XX_LOCKED_SHIFT)))
  1289. continue;
  1290. clk->rate = rate;
  1291. return 0;
  1292. }
  1293. static struct clk_ops exynos4_vpll_ops = {
  1294. .get_rate = exynos4_vpll_get_rate,
  1295. .set_rate = exynos4_vpll_set_rate,
  1296. };
  1297. void __init_or_cpufreq exynos4_setup_clocks(void)
  1298. {
  1299. struct clk *xtal_clk;
  1300. unsigned long apll = 0;
  1301. unsigned long mpll = 0;
  1302. unsigned long epll = 0;
  1303. unsigned long vpll = 0;
  1304. unsigned long vpllsrc;
  1305. unsigned long xtal;
  1306. unsigned long armclk;
  1307. unsigned long sclk_dmc;
  1308. unsigned long aclk_200;
  1309. unsigned long aclk_100;
  1310. unsigned long aclk_160;
  1311. unsigned long aclk_133;
  1312. unsigned int ptr;
  1313. printk(KERN_DEBUG "%s: registering clocks\n", __func__);
  1314. xtal_clk = clk_get(NULL, "xtal");
  1315. BUG_ON(IS_ERR(xtal_clk));
  1316. xtal = clk_get_rate(xtal_clk);
  1317. xtal_rate = xtal;
  1318. clk_put(xtal_clk);
  1319. printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
  1320. if (soc_is_exynos4210()) {
  1321. apll = s5p_get_pll45xx(xtal, __raw_readl(EXYNOS4_APLL_CON0),
  1322. pll_4508);
  1323. mpll = s5p_get_pll45xx(xtal, __raw_readl(EXYNOS4_MPLL_CON0),
  1324. pll_4508);
  1325. epll = s5p_get_pll46xx(xtal, __raw_readl(EXYNOS4_EPLL_CON0),
  1326. __raw_readl(EXYNOS4_EPLL_CON1), pll_4600);
  1327. vpllsrc = clk_get_rate(&exynos4_clk_vpllsrc.clk);
  1328. vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(EXYNOS4_VPLL_CON0),
  1329. __raw_readl(EXYNOS4_VPLL_CON1), pll_4650c);
  1330. } else if (soc_is_exynos4212() || soc_is_exynos4412()) {
  1331. apll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS4_APLL_CON0));
  1332. mpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS4_MPLL_CON0));
  1333. epll = s5p_get_pll36xx(xtal, __raw_readl(EXYNOS4_EPLL_CON0),
  1334. __raw_readl(EXYNOS4_EPLL_CON1));
  1335. vpllsrc = clk_get_rate(&exynos4_clk_vpllsrc.clk);
  1336. vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(EXYNOS4_VPLL_CON0),
  1337. __raw_readl(EXYNOS4_VPLL_CON1));
  1338. } else {
  1339. /* nothing */
  1340. }
  1341. clk_fout_apll.ops = &exynos4_fout_apll_ops;
  1342. clk_fout_mpll.rate = mpll;
  1343. clk_fout_epll.rate = epll;
  1344. clk_fout_vpll.ops = &exynos4_vpll_ops;
  1345. clk_fout_vpll.rate = vpll;
  1346. printk(KERN_INFO "EXYNOS4: PLL settings, A=%ld, M=%ld, E=%ld V=%ld",
  1347. apll, mpll, epll, vpll);
  1348. armclk = clk_get_rate(&exynos4_clk_armclk.clk);
  1349. sclk_dmc = clk_get_rate(&exynos4_clk_sclk_dmc.clk);
  1350. aclk_200 = clk_get_rate(&exynos4_clk_aclk_200.clk);
  1351. aclk_100 = clk_get_rate(&exynos4_clk_aclk_100.clk);
  1352. aclk_160 = clk_get_rate(&exynos4_clk_aclk_160.clk);
  1353. aclk_133 = clk_get_rate(&exynos4_clk_aclk_133.clk);
  1354. printk(KERN_INFO "EXYNOS4: ARMCLK=%ld, DMC=%ld, ACLK200=%ld\n"
  1355. "ACLK100=%ld, ACLK160=%ld, ACLK133=%ld\n",
  1356. armclk, sclk_dmc, aclk_200,
  1357. aclk_100, aclk_160, aclk_133);
  1358. clk_f.rate = armclk;
  1359. clk_h.rate = sclk_dmc;
  1360. clk_p.rate = aclk_100;
  1361. for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clksrcs); ptr++)
  1362. s3c_set_clksrc(&exynos4_clksrcs[ptr], true);
  1363. }
  1364. static struct clk *exynos4_clks[] __initdata = {
  1365. &exynos4_clk_sclk_hdmi27m,
  1366. &exynos4_clk_sclk_hdmiphy,
  1367. &exynos4_clk_sclk_usbphy0,
  1368. &exynos4_clk_sclk_usbphy1,
  1369. };
  1370. #ifdef CONFIG_PM_SLEEP
  1371. static int exynos4_clock_suspend(void)
  1372. {
  1373. s3c_pm_do_save(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save));
  1374. return 0;
  1375. }
  1376. static void exynos4_clock_resume(void)
  1377. {
  1378. s3c_pm_do_restore_core(exynos4_clock_save, ARRAY_SIZE(exynos4_clock_save));
  1379. }
  1380. #else
  1381. #define exynos4_clock_suspend NULL
  1382. #define exynos4_clock_resume NULL
  1383. #endif
  1384. static struct syscore_ops exynos4_clock_syscore_ops = {
  1385. .suspend = exynos4_clock_suspend,
  1386. .resume = exynos4_clock_resume,
  1387. };
  1388. void __init exynos4_register_clocks(void)
  1389. {
  1390. int ptr;
  1391. s3c24xx_register_clocks(exynos4_clks, ARRAY_SIZE(exynos4_clks));
  1392. for (ptr = 0; ptr < ARRAY_SIZE(exynos4_sysclks); ptr++)
  1393. s3c_register_clksrc(exynos4_sysclks[ptr], 1);
  1394. for (ptr = 0; ptr < ARRAY_SIZE(exynos4_sclk_tv); ptr++)
  1395. s3c_register_clksrc(exynos4_sclk_tv[ptr], 1);
  1396. for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clksrc_cdev); ptr++)
  1397. s3c_register_clksrc(exynos4_clksrc_cdev[ptr], 1);
  1398. s3c_register_clksrc(exynos4_clksrcs, ARRAY_SIZE(exynos4_clksrcs));
  1399. s3c_register_clocks(exynos4_init_clocks_on, ARRAY_SIZE(exynos4_init_clocks_on));
  1400. s3c24xx_register_clocks(exynos4_clk_cdev, ARRAY_SIZE(exynos4_clk_cdev));
  1401. for (ptr = 0; ptr < ARRAY_SIZE(exynos4_clk_cdev); ptr++)
  1402. s3c_disable_clocks(exynos4_clk_cdev[ptr], 1);
  1403. s3c_register_clocks(exynos4_init_clocks_off, ARRAY_SIZE(exynos4_init_clocks_off));
  1404. s3c_disable_clocks(exynos4_init_clocks_off, ARRAY_SIZE(exynos4_init_clocks_off));
  1405. clkdev_add_table(exynos4_clk_lookup, ARRAY_SIZE(exynos4_clk_lookup));
  1406. register_syscore_ops(&exynos4_clock_syscore_ops);
  1407. s3c24xx_register_clock(&dummy_apb_pclk);
  1408. s3c_pwmclk_init();
  1409. }