sc9860-clk.c 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053
  1. // SPDX-License-Identifier: GPL-2.0
  2. //
  3. // Spreatrum SC9860 clock driver
  4. //
  5. // Copyright (C) 2017 Spreadtrum, Inc.
  6. // Author: Chunyan Zhang <[email protected]>
  7. #include <linux/clk-provider.h>
  8. #include <linux/err.h>
  9. #include <linux/io.h>
  10. #include <linux/module.h>
  11. #include <linux/of_device.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/slab.h>
  14. #include <dt-bindings/clock/sprd,sc9860-clk.h>
  15. #include "common.h"
  16. #include "composite.h"
  17. #include "div.h"
  18. #include "gate.h"
  19. #include "mux.h"
  20. #include "pll.h"
  21. static CLK_FIXED_FACTOR(fac_4m, "fac-4m", "ext-26m",
  22. 6, 1, 0);
  23. static CLK_FIXED_FACTOR(fac_2m, "fac-2m", "ext-26m",
  24. 13, 1, 0);
  25. static CLK_FIXED_FACTOR(fac_1m, "fac-1m", "ext-26m",
  26. 26, 1, 0);
  27. static CLK_FIXED_FACTOR(fac_250k, "fac-250k", "ext-26m",
  28. 104, 1, 0);
  29. static CLK_FIXED_FACTOR(fac_rpll0_26m, "rpll0-26m", "ext-26m",
  30. 1, 1, 0);
  31. static CLK_FIXED_FACTOR(fac_rpll1_26m, "rpll1-26m", "ext-26m",
  32. 1, 1, 0);
  33. static CLK_FIXED_FACTOR(fac_rco_25m, "rco-25m", "ext-rc0-100m",
  34. 4, 1, 0);
  35. static CLK_FIXED_FACTOR(fac_rco_4m, "rco-4m", "ext-rc0-100m",
  36. 25, 1, 0);
  37. static CLK_FIXED_FACTOR(fac_rco_2m, "rco-2m", "ext-rc0-100m",
  38. 50, 1, 0);
  39. static CLK_FIXED_FACTOR(fac_3k2, "fac-3k2", "ext-32k",
  40. 10, 1, 0);
  41. static CLK_FIXED_FACTOR(fac_1k, "fac-1k", "ext-32k",
  42. 32, 1, 0);
  43. static SPRD_SC_GATE_CLK(mpll0_gate, "mpll0-gate", "ext-26m", 0xb0,
  44. 0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
  45. static SPRD_SC_GATE_CLK(mpll1_gate, "mpll1-gate", "ext-26m", 0xb0,
  46. 0x1000, BIT(18), CLK_IGNORE_UNUSED, 0);
  47. static SPRD_SC_GATE_CLK(dpll0_gate, "dpll0-gate", "ext-26m", 0xb4,
  48. 0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
  49. static SPRD_SC_GATE_CLK(dpll1_gate, "dpll1-gate", "ext-26m", 0xb4,
  50. 0x1000, BIT(18), CLK_IGNORE_UNUSED, 0);
  51. static SPRD_SC_GATE_CLK(ltepll0_gate, "ltepll0-gate", "ext-26m", 0xb8,
  52. 0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
  53. static SPRD_SC_GATE_CLK(twpll_gate, "twpll-gate", "ext-26m", 0xbc,
  54. 0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
  55. static SPRD_SC_GATE_CLK(ltepll1_gate, "ltepll1-gate", "ext-26m", 0x10c,
  56. 0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
  57. static SPRD_SC_GATE_CLK(rpll0_gate, "rpll0-gate", "ext-26m", 0x16c,
  58. 0x1000, BIT(2), 0, 0);
  59. static SPRD_SC_GATE_CLK(rpll1_gate, "rpll1-gate", "ext-26m", 0x16c,
  60. 0x1000, BIT(18), 0, 0);
  61. static SPRD_SC_GATE_CLK(cppll_gate, "cppll-gate", "ext-26m", 0x2b4,
  62. 0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
  63. static SPRD_SC_GATE_CLK(gpll_gate, "gpll-gate", "ext-26m", 0x32c,
  64. 0x1000, BIT(0), CLK_IGNORE_UNUSED, CLK_GATE_SET_TO_DISABLE);
  65. static struct sprd_clk_common *sc9860_pmu_gate_clks[] = {
  66. /* address base is 0x402b0000 */
  67. &mpll0_gate.common,
  68. &mpll1_gate.common,
  69. &dpll0_gate.common,
  70. &dpll1_gate.common,
  71. &ltepll0_gate.common,
  72. &twpll_gate.common,
  73. &ltepll1_gate.common,
  74. &rpll0_gate.common,
  75. &rpll1_gate.common,
  76. &cppll_gate.common,
  77. &gpll_gate.common,
  78. };
  79. static struct clk_hw_onecell_data sc9860_pmu_gate_hws = {
  80. .hws = {
  81. [CLK_FAC_4M] = &fac_4m.hw,
  82. [CLK_FAC_2M] = &fac_2m.hw,
  83. [CLK_FAC_1M] = &fac_1m.hw,
  84. [CLK_FAC_250K] = &fac_250k.hw,
  85. [CLK_FAC_RPLL0_26M] = &fac_rpll0_26m.hw,
  86. [CLK_FAC_RPLL1_26M] = &fac_rpll1_26m.hw,
  87. [CLK_FAC_RCO25M] = &fac_rco_25m.hw,
  88. [CLK_FAC_RCO4M] = &fac_rco_4m.hw,
  89. [CLK_FAC_RCO2M] = &fac_rco_2m.hw,
  90. [CLK_FAC_3K2] = &fac_3k2.hw,
  91. [CLK_FAC_1K] = &fac_1k.hw,
  92. [CLK_MPLL0_GATE] = &mpll0_gate.common.hw,
  93. [CLK_MPLL1_GATE] = &mpll1_gate.common.hw,
  94. [CLK_DPLL0_GATE] = &dpll0_gate.common.hw,
  95. [CLK_DPLL1_GATE] = &dpll1_gate.common.hw,
  96. [CLK_LTEPLL0_GATE] = &ltepll0_gate.common.hw,
  97. [CLK_TWPLL_GATE] = &twpll_gate.common.hw,
  98. [CLK_LTEPLL1_GATE] = &ltepll1_gate.common.hw,
  99. [CLK_RPLL0_GATE] = &rpll0_gate.common.hw,
  100. [CLK_RPLL1_GATE] = &rpll1_gate.common.hw,
  101. [CLK_CPPLL_GATE] = &cppll_gate.common.hw,
  102. [CLK_GPLL_GATE] = &gpll_gate.common.hw,
  103. },
  104. .num = CLK_PMU_GATE_NUM,
  105. };
  106. static const struct sprd_clk_desc sc9860_pmu_gate_desc = {
  107. .clk_clks = sc9860_pmu_gate_clks,
  108. .num_clk_clks = ARRAY_SIZE(sc9860_pmu_gate_clks),
  109. .hw_clks = &sc9860_pmu_gate_hws,
  110. };
  111. /* GPLL/LPLL/DPLL/RPLL/CPLL */
  112. static const u64 itable1[4] = {3, 780000000, 988000000, 1196000000};
  113. /* TWPLL/MPLL0/MPLL1 */
  114. static const u64 itable2[4] = {3, 1638000000, 2080000000, 2600000000UL};
  115. static const struct clk_bit_field f_mpll0[PLL_FACT_MAX] = {
  116. { .shift = 20, .width = 1 }, /* lock_done */
  117. { .shift = 19, .width = 1 }, /* div_s */
  118. { .shift = 18, .width = 1 }, /* mod_en */
  119. { .shift = 17, .width = 1 }, /* sdm_en */
  120. { .shift = 0, .width = 0 }, /* refin */
  121. { .shift = 11, .width = 2 }, /* ibias */
  122. { .shift = 0, .width = 7 }, /* n */
  123. { .shift = 57, .width = 7 }, /* nint */
  124. { .shift = 32, .width = 23}, /* kint */
  125. { .shift = 0, .width = 0 }, /* prediv */
  126. { .shift = 56, .width = 1 }, /* postdiv */
  127. };
  128. static SPRD_PLL_WITH_ITABLE_K_FVCO(mpll0_clk, "mpll0", "mpll0-gate", 0x24,
  129. 2, itable2, f_mpll0, 200,
  130. 1000, 1000, 1, 1300000000);
  131. static const struct clk_bit_field f_mpll1[PLL_FACT_MAX] = {
  132. { .shift = 20, .width = 1 }, /* lock_done */
  133. { .shift = 19, .width = 1 }, /* div_s */
  134. { .shift = 18, .width = 1 }, /* mod_en */
  135. { .shift = 17, .width = 1 }, /* sdm_en */
  136. { .shift = 0, .width = 0 }, /* refin */
  137. { .shift = 11, .width = 2 }, /* ibias */
  138. { .shift = 0, .width = 7 }, /* n */
  139. { .shift = 57, .width = 7 }, /* nint */
  140. { .shift = 32, .width = 23}, /* kint */
  141. { .shift = 56, .width = 1 }, /* prediv */
  142. { .shift = 0, .width = 0 }, /* postdiv */
  143. };
  144. static SPRD_PLL_WITH_ITABLE_1K(mpll1_clk, "mpll1", "mpll1-gate", 0x2c,
  145. 2, itable2, f_mpll1, 200);
  146. static const struct clk_bit_field f_dpll[PLL_FACT_MAX] = {
  147. { .shift = 16, .width = 1 }, /* lock_done */
  148. { .shift = 15, .width = 1 }, /* div_s */
  149. { .shift = 14, .width = 1 }, /* mod_en */
  150. { .shift = 13, .width = 1 }, /* sdm_en */
  151. { .shift = 0, .width = 0 }, /* refin */
  152. { .shift = 8, .width = 2 }, /* ibias */
  153. { .shift = 0, .width = 7 }, /* n */
  154. { .shift = 57, .width = 7 }, /* nint */
  155. { .shift = 32, .width = 23}, /* kint */
  156. { .shift = 0, .width = 0 }, /* prediv */
  157. { .shift = 0, .width = 0 }, /* postdiv */
  158. };
  159. static SPRD_PLL_WITH_ITABLE_1K(dpll0_clk, "dpll0", "dpll0-gate", 0x34,
  160. 2, itable1, f_dpll, 200);
  161. static SPRD_PLL_WITH_ITABLE_1K(dpll1_clk, "dpll1", "dpll1-gate", 0x3c,
  162. 2, itable1, f_dpll, 200);
  163. static const struct clk_bit_field f_rpll[PLL_FACT_MAX] = {
  164. { .shift = 0, .width = 1 }, /* lock_done */
  165. { .shift = 3, .width = 1 }, /* div_s */
  166. { .shift = 80, .width = 1 }, /* mod_en */
  167. { .shift = 81, .width = 1 }, /* sdm_en */
  168. { .shift = 0, .width = 0 }, /* refin */
  169. { .shift = 14, .width = 2 }, /* ibias */
  170. { .shift = 16, .width = 7 }, /* n */
  171. { .shift = 4, .width = 7 }, /* nint */
  172. { .shift = 32, .width = 23}, /* kint */
  173. { .shift = 0, .width = 0 }, /* prediv */
  174. { .shift = 0, .width = 0 }, /* postdiv */
  175. };
  176. static SPRD_PLL_WITH_ITABLE_1K(rpll0_clk, "rpll0", "rpll0-gate", 0x44,
  177. 3, itable1, f_rpll, 200);
  178. static SPRD_PLL_WITH_ITABLE_1K(rpll1_clk, "rpll1", "rpll1-gate", 0x50,
  179. 3, itable1, f_rpll, 200);
  180. static const struct clk_bit_field f_twpll[PLL_FACT_MAX] = {
  181. { .shift = 21, .width = 1 }, /* lock_done */
  182. { .shift = 20, .width = 1 }, /* div_s */
  183. { .shift = 19, .width = 1 }, /* mod_en */
  184. { .shift = 18, .width = 1 }, /* sdm_en */
  185. { .shift = 0, .width = 0 }, /* refin */
  186. { .shift = 13, .width = 2 }, /* ibias */
  187. { .shift = 0, .width = 7 }, /* n */
  188. { .shift = 57, .width = 7 }, /* nint */
  189. { .shift = 32, .width = 23}, /* kint */
  190. { .shift = 0, .width = 0 }, /* prediv */
  191. { .shift = 0, .width = 0 }, /* postdiv */
  192. };
  193. static SPRD_PLL_WITH_ITABLE_1K(twpll_clk, "twpll", "twpll-gate", 0x5c,
  194. 2, itable2, f_twpll, 200);
  195. static const struct clk_bit_field f_ltepll[PLL_FACT_MAX] = {
  196. { .shift = 31, .width = 1 }, /* lock_done */
  197. { .shift = 27, .width = 1 }, /* div_s */
  198. { .shift = 26, .width = 1 }, /* mod_en */
  199. { .shift = 25, .width = 1 }, /* sdm_en */
  200. { .shift = 0, .width = 0 }, /* refin */
  201. { .shift = 20, .width = 2 }, /* ibias */
  202. { .shift = 0, .width = 7 }, /* n */
  203. { .shift = 57, .width = 7 }, /* nint */
  204. { .shift = 32, .width = 23}, /* kint */
  205. { .shift = 0, .width = 0 }, /* prediv */
  206. { .shift = 0, .width = 0 }, /* postdiv */
  207. };
  208. static SPRD_PLL_WITH_ITABLE_1K(ltepll0_clk, "ltepll0", "ltepll0-gate",
  209. 0x64, 2, itable1,
  210. f_ltepll, 200);
  211. static SPRD_PLL_WITH_ITABLE_1K(ltepll1_clk, "ltepll1", "ltepll1-gate",
  212. 0x6c, 2, itable1,
  213. f_ltepll, 200);
  214. static const struct clk_bit_field f_gpll[PLL_FACT_MAX] = {
  215. { .shift = 18, .width = 1 }, /* lock_done */
  216. { .shift = 15, .width = 1 }, /* div_s */
  217. { .shift = 14, .width = 1 }, /* mod_en */
  218. { .shift = 13, .width = 1 }, /* sdm_en */
  219. { .shift = 0, .width = 0 }, /* refin */
  220. { .shift = 8, .width = 2 }, /* ibias */
  221. { .shift = 0, .width = 7 }, /* n */
  222. { .shift = 57, .width = 7 }, /* nint */
  223. { .shift = 32, .width = 23}, /* kint */
  224. { .shift = 0, .width = 0 }, /* prediv */
  225. { .shift = 17, .width = 1 }, /* postdiv */
  226. };
  227. static SPRD_PLL_WITH_ITABLE_K_FVCO(gpll_clk, "gpll", "gpll-gate", 0x9c,
  228. 2, itable1, f_gpll, 200,
  229. 1000, 1000, 1, 600000000);
  230. static const struct clk_bit_field f_cppll[PLL_FACT_MAX] = {
  231. { .shift = 17, .width = 1 }, /* lock_done */
  232. { .shift = 15, .width = 1 }, /* div_s */
  233. { .shift = 14, .width = 1 }, /* mod_en */
  234. { .shift = 13, .width = 1 }, /* sdm_en */
  235. { .shift = 0, .width = 0 }, /* refin */
  236. { .shift = 8, .width = 2 }, /* ibias */
  237. { .shift = 0, .width = 7 }, /* n */
  238. { .shift = 57, .width = 7 }, /* nint */
  239. { .shift = 32, .width = 23}, /* kint */
  240. { .shift = 0, .width = 0 }, /* prediv */
  241. { .shift = 0, .width = 0 }, /* postdiv */
  242. };
  243. static SPRD_PLL_WITH_ITABLE_1K(cppll_clk, "cppll", "cppll-gate", 0xc4,
  244. 2, itable1, f_cppll, 200);
  245. static CLK_FIXED_FACTOR(gpll_42m5, "gpll-42m5", "gpll", 20, 1, 0);
  246. static CLK_FIXED_FACTOR(twpll_768m, "twpll-768m", "twpll", 2, 1, 0);
  247. static CLK_FIXED_FACTOR(twpll_384m, "twpll-384m", "twpll", 4, 1, 0);
  248. static CLK_FIXED_FACTOR(twpll_192m, "twpll-192m", "twpll", 8, 1, 0);
  249. static CLK_FIXED_FACTOR(twpll_96m, "twpll-96m", "twpll", 16, 1, 0);
  250. static CLK_FIXED_FACTOR(twpll_48m, "twpll-48m", "twpll", 32, 1, 0);
  251. static CLK_FIXED_FACTOR(twpll_24m, "twpll-24m", "twpll", 64, 1, 0);
  252. static CLK_FIXED_FACTOR(twpll_12m, "twpll-12m", "twpll", 128, 1, 0);
  253. static CLK_FIXED_FACTOR(twpll_512m, "twpll-512m", "twpll", 3, 1, 0);
  254. static CLK_FIXED_FACTOR(twpll_256m, "twpll-256m", "twpll", 6, 1, 0);
  255. static CLK_FIXED_FACTOR(twpll_128m, "twpll-128m", "twpll", 12, 1, 0);
  256. static CLK_FIXED_FACTOR(twpll_64m, "twpll-64m", "twpll", 24, 1, 0);
  257. static CLK_FIXED_FACTOR(twpll_307m2, "twpll-307m2", "twpll", 5, 1, 0);
  258. static CLK_FIXED_FACTOR(twpll_153m6, "twpll-153m6", "twpll", 10, 1, 0);
  259. static CLK_FIXED_FACTOR(twpll_76m8, "twpll-76m8", "twpll", 20, 1, 0);
  260. static CLK_FIXED_FACTOR(twpll_51m2, "twpll-51m2", "twpll", 30, 1, 0);
  261. static CLK_FIXED_FACTOR(twpll_38m4, "twpll-38m4", "twpll", 40, 1, 0);
  262. static CLK_FIXED_FACTOR(twpll_19m2, "twpll-19m2", "twpll", 80, 1, 0);
  263. static CLK_FIXED_FACTOR(l0_614m4, "l0-614m4", "ltepll0", 2, 1, 0);
  264. static CLK_FIXED_FACTOR(l0_409m6, "l0-409m6", "ltepll0", 3, 1, 0);
  265. static CLK_FIXED_FACTOR(l0_38m, "l0-38m", "ltepll0", 32, 1, 0);
  266. static CLK_FIXED_FACTOR(l1_38m, "l1-38m", "ltepll1", 32, 1, 0);
  267. static CLK_FIXED_FACTOR(rpll0_192m, "rpll0-192m", "rpll0", 6, 1, 0);
  268. static CLK_FIXED_FACTOR(rpll0_96m, "rpll0-96m", "rpll0", 12, 1, 0);
  269. static CLK_FIXED_FACTOR(rpll0_48m, "rpll0-48m", "rpll0", 24, 1, 0);
  270. static CLK_FIXED_FACTOR(rpll1_468m, "rpll1-468m", "rpll1", 2, 1, 0);
  271. static CLK_FIXED_FACTOR(rpll1_192m, "rpll1-192m", "rpll1", 6, 1, 0);
  272. static CLK_FIXED_FACTOR(rpll1_96m, "rpll1-96m", "rpll1", 12, 1, 0);
  273. static CLK_FIXED_FACTOR(rpll1_64m, "rpll1-64m", "rpll1", 18, 1, 0);
  274. static CLK_FIXED_FACTOR(rpll1_48m, "rpll1-48m", "rpll1", 24, 1, 0);
  275. static CLK_FIXED_FACTOR(dpll0_50m, "dpll0-50m", "dpll0", 16, 1, 0);
  276. static CLK_FIXED_FACTOR(dpll1_50m, "dpll1-50m", "dpll1", 16, 1, 0);
  277. static CLK_FIXED_FACTOR(cppll_50m, "cppll-50m", "cppll", 18, 1, 0);
  278. static CLK_FIXED_FACTOR(m0_39m, "m0-39m", "mpll0", 32, 1, 0);
  279. static CLK_FIXED_FACTOR(m1_63m, "m1-63m", "mpll1", 32, 1, 0);
  280. static struct sprd_clk_common *sc9860_pll_clks[] = {
  281. /* address base is 0x40400000 */
  282. &mpll0_clk.common,
  283. &mpll1_clk.common,
  284. &dpll0_clk.common,
  285. &dpll1_clk.common,
  286. &rpll0_clk.common,
  287. &rpll1_clk.common,
  288. &twpll_clk.common,
  289. &ltepll0_clk.common,
  290. &ltepll1_clk.common,
  291. &gpll_clk.common,
  292. &cppll_clk.common,
  293. };
  294. static struct clk_hw_onecell_data sc9860_pll_hws = {
  295. .hws = {
  296. [CLK_MPLL0] = &mpll0_clk.common.hw,
  297. [CLK_MPLL1] = &mpll1_clk.common.hw,
  298. [CLK_DPLL0] = &dpll0_clk.common.hw,
  299. [CLK_DPLL1] = &dpll1_clk.common.hw,
  300. [CLK_RPLL0] = &rpll0_clk.common.hw,
  301. [CLK_RPLL1] = &rpll1_clk.common.hw,
  302. [CLK_TWPLL] = &twpll_clk.common.hw,
  303. [CLK_LTEPLL0] = &ltepll0_clk.common.hw,
  304. [CLK_LTEPLL1] = &ltepll1_clk.common.hw,
  305. [CLK_GPLL] = &gpll_clk.common.hw,
  306. [CLK_CPPLL] = &cppll_clk.common.hw,
  307. [CLK_GPLL_42M5] = &gpll_42m5.hw,
  308. [CLK_TWPLL_768M] = &twpll_768m.hw,
  309. [CLK_TWPLL_384M] = &twpll_384m.hw,
  310. [CLK_TWPLL_192M] = &twpll_192m.hw,
  311. [CLK_TWPLL_96M] = &twpll_96m.hw,
  312. [CLK_TWPLL_48M] = &twpll_48m.hw,
  313. [CLK_TWPLL_24M] = &twpll_24m.hw,
  314. [CLK_TWPLL_12M] = &twpll_12m.hw,
  315. [CLK_TWPLL_512M] = &twpll_512m.hw,
  316. [CLK_TWPLL_256M] = &twpll_256m.hw,
  317. [CLK_TWPLL_128M] = &twpll_128m.hw,
  318. [CLK_TWPLL_64M] = &twpll_64m.hw,
  319. [CLK_TWPLL_307M2] = &twpll_307m2.hw,
  320. [CLK_TWPLL_153M6] = &twpll_153m6.hw,
  321. [CLK_TWPLL_76M8] = &twpll_76m8.hw,
  322. [CLK_TWPLL_51M2] = &twpll_51m2.hw,
  323. [CLK_TWPLL_38M4] = &twpll_38m4.hw,
  324. [CLK_TWPLL_19M2] = &twpll_19m2.hw,
  325. [CLK_L0_614M4] = &l0_614m4.hw,
  326. [CLK_L0_409M6] = &l0_409m6.hw,
  327. [CLK_L0_38M] = &l0_38m.hw,
  328. [CLK_L1_38M] = &l1_38m.hw,
  329. [CLK_RPLL0_192M] = &rpll0_192m.hw,
  330. [CLK_RPLL0_96M] = &rpll0_96m.hw,
  331. [CLK_RPLL0_48M] = &rpll0_48m.hw,
  332. [CLK_RPLL1_468M] = &rpll1_468m.hw,
  333. [CLK_RPLL1_192M] = &rpll1_192m.hw,
  334. [CLK_RPLL1_96M] = &rpll1_96m.hw,
  335. [CLK_RPLL1_64M] = &rpll1_64m.hw,
  336. [CLK_RPLL1_48M] = &rpll1_48m.hw,
  337. [CLK_DPLL0_50M] = &dpll0_50m.hw,
  338. [CLK_DPLL1_50M] = &dpll1_50m.hw,
  339. [CLK_CPPLL_50M] = &cppll_50m.hw,
  340. [CLK_M0_39M] = &m0_39m.hw,
  341. [CLK_M1_63M] = &m1_63m.hw,
  342. },
  343. .num = CLK_PLL_NUM,
  344. };
  345. static const struct sprd_clk_desc sc9860_pll_desc = {
  346. .clk_clks = sc9860_pll_clks,
  347. .num_clk_clks = ARRAY_SIZE(sc9860_pll_clks),
  348. .hw_clks = &sc9860_pll_hws,
  349. };
  350. #define SC9860_MUX_FLAG \
  351. (CLK_GET_RATE_NOCACHE | CLK_SET_RATE_NO_REPARENT)
  352. static const char * const ap_apb_parents[] = { "ext-26m", "twpll-64m",
  353. "twpll-96m", "twpll-128m" };
  354. static SPRD_MUX_CLK(ap_apb, "ap-apb", ap_apb_parents,
  355. 0x20, 0, 1, SC9860_MUX_FLAG);
  356. static const char * const ap_apb_usb3[] = { "ext-32k", "twpll-24m" };
  357. static SPRD_MUX_CLK(ap_usb3, "ap-usb3", ap_apb_usb3,
  358. 0x2c, 0, 1, SC9860_MUX_FLAG);
  359. static const char * const uart_parents[] = { "ext-26m", "twpll-48m",
  360. "twpll-51m2", "twpll-96m" };
  361. static SPRD_COMP_CLK(uart0_clk, "uart0", uart_parents, 0x30,
  362. 0, 2, 8, 3, 0);
  363. static SPRD_COMP_CLK(uart1_clk, "uart1", uart_parents, 0x34,
  364. 0, 2, 8, 3, 0);
  365. static SPRD_COMP_CLK(uart2_clk, "uart2", uart_parents, 0x38,
  366. 0, 2, 8, 3, 0);
  367. static SPRD_COMP_CLK(uart3_clk, "uart3", uart_parents, 0x3c,
  368. 0, 2, 8, 3, 0);
  369. static SPRD_COMP_CLK(uart4_clk, "uart4", uart_parents, 0x40,
  370. 0, 2, 8, 3, 0);
  371. static const char * const i2c_parents[] = { "ext-26m", "twpll-48m",
  372. "twpll-51m2", "twpll-153m6" };
  373. static SPRD_COMP_CLK(i2c0_clk, "i2c0", i2c_parents, 0x44,
  374. 0, 2, 8, 3, 0);
  375. static SPRD_COMP_CLK(i2c1_clk, "i2c1", i2c_parents, 0x48,
  376. 0, 2, 8, 3, 0);
  377. static SPRD_COMP_CLK(i2c2_clk, "i2c2", i2c_parents, 0x4c,
  378. 0, 2, 8, 3, 0);
  379. static SPRD_COMP_CLK(i2c3_clk, "i2c3", i2c_parents, 0x50,
  380. 0, 2, 8, 3, 0);
  381. static SPRD_COMP_CLK(i2c4_clk, "i2c4", i2c_parents, 0x54,
  382. 0, 2, 8, 3, 0);
  383. static SPRD_COMP_CLK(i2c5_clk, "i2c5", i2c_parents, 0x58,
  384. 0, 2, 8, 3, 0);
  385. static const char * const spi_parents[] = { "ext-26m", "twpll-128m",
  386. "twpll-153m6", "twpll-192m" };
  387. static SPRD_COMP_CLK(spi0_clk, "spi0", spi_parents, 0x5c,
  388. 0, 2, 8, 3, 0);
  389. static SPRD_COMP_CLK(spi1_clk, "spi1", spi_parents, 0x60,
  390. 0, 2, 8, 3, 0);
  391. static SPRD_COMP_CLK(spi2_clk, "spi2", spi_parents, 0x64,
  392. 0, 2, 8, 3, 0);
  393. static SPRD_COMP_CLK(spi3_clk, "spi3", spi_parents, 0x68,
  394. 0, 2, 8, 3, 0);
  395. static const char * const iis_parents[] = { "ext-26m",
  396. "twpll-128m",
  397. "twpll-153m6" };
  398. static SPRD_COMP_CLK(iis0_clk, "iis0", iis_parents, 0x6c,
  399. 0, 2, 8, 6, 0);
  400. static SPRD_COMP_CLK(iis1_clk, "iis1", iis_parents, 0x70,
  401. 0, 2, 8, 6, 0);
  402. static SPRD_COMP_CLK(iis2_clk, "iis2", iis_parents, 0x74,
  403. 0, 2, 8, 6, 0);
  404. static SPRD_COMP_CLK(iis3_clk, "iis3", iis_parents, 0x78,
  405. 0, 2, 8, 6, 0);
  406. static struct sprd_clk_common *sc9860_ap_clks[] = {
  407. /* address base is 0x20000000 */
  408. &ap_apb.common,
  409. &ap_usb3.common,
  410. &uart0_clk.common,
  411. &uart1_clk.common,
  412. &uart2_clk.common,
  413. &uart3_clk.common,
  414. &uart4_clk.common,
  415. &i2c0_clk.common,
  416. &i2c1_clk.common,
  417. &i2c2_clk.common,
  418. &i2c3_clk.common,
  419. &i2c4_clk.common,
  420. &i2c5_clk.common,
  421. &spi0_clk.common,
  422. &spi1_clk.common,
  423. &spi2_clk.common,
  424. &spi3_clk.common,
  425. &iis0_clk.common,
  426. &iis1_clk.common,
  427. &iis2_clk.common,
  428. &iis3_clk.common,
  429. };
  430. static struct clk_hw_onecell_data sc9860_ap_clk_hws = {
  431. .hws = {
  432. [CLK_AP_APB] = &ap_apb.common.hw,
  433. [CLK_AP_USB3] = &ap_usb3.common.hw,
  434. [CLK_UART0] = &uart0_clk.common.hw,
  435. [CLK_UART1] = &uart1_clk.common.hw,
  436. [CLK_UART2] = &uart2_clk.common.hw,
  437. [CLK_UART3] = &uart3_clk.common.hw,
  438. [CLK_UART4] = &uart4_clk.common.hw,
  439. [CLK_I2C0] = &i2c0_clk.common.hw,
  440. [CLK_I2C1] = &i2c1_clk.common.hw,
  441. [CLK_I2C2] = &i2c2_clk.common.hw,
  442. [CLK_I2C3] = &i2c3_clk.common.hw,
  443. [CLK_I2C4] = &i2c4_clk.common.hw,
  444. [CLK_I2C5] = &i2c5_clk.common.hw,
  445. [CLK_SPI0] = &spi0_clk.common.hw,
  446. [CLK_SPI1] = &spi1_clk.common.hw,
  447. [CLK_SPI2] = &spi2_clk.common.hw,
  448. [CLK_SPI3] = &spi3_clk.common.hw,
  449. [CLK_IIS0] = &iis0_clk.common.hw,
  450. [CLK_IIS1] = &iis1_clk.common.hw,
  451. [CLK_IIS2] = &iis2_clk.common.hw,
  452. [CLK_IIS3] = &iis3_clk.common.hw,
  453. },
  454. .num = CLK_AP_CLK_NUM,
  455. };
  456. static const struct sprd_clk_desc sc9860_ap_clk_desc = {
  457. .clk_clks = sc9860_ap_clks,
  458. .num_clk_clks = ARRAY_SIZE(sc9860_ap_clks),
  459. .hw_clks = &sc9860_ap_clk_hws,
  460. };
  461. static const char * const aon_apb_parents[] = { "rco-25m", "ext-26m",
  462. "ext-rco-100m", "twpll-96m",
  463. "twpll-128m",
  464. "twpll-153m6" };
  465. static SPRD_COMP_CLK(aon_apb, "aon-apb", aon_apb_parents, 0x230,
  466. 0, 3, 8, 2, 0);
  467. static const char * const aux_parents[] = { "ext-32k", "rpll0-26m",
  468. "rpll1-26m", "ext-26m",
  469. "cppll-50m", "rco-25m",
  470. "dpll0-50m", "dpll1-50m",
  471. "gpll-42m5", "twpll-48m",
  472. "m0-39m", "m1-63m",
  473. "l0-38m", "l1-38m" };
  474. static SPRD_COMP_CLK(aux0_clk, "aux0", aux_parents, 0x238,
  475. 0, 5, 8, 4, 0);
  476. static SPRD_COMP_CLK(aux1_clk, "aux1", aux_parents, 0x23c,
  477. 0, 5, 8, 4, 0);
  478. static SPRD_COMP_CLK(aux2_clk, "aux2", aux_parents, 0x240,
  479. 0, 5, 8, 4, 0);
  480. static SPRD_COMP_CLK(probe_clk, "probe", aux_parents, 0x244,
  481. 0, 5, 8, 4, 0);
  482. static const char * const sp_ahb_parents[] = { "rco-4m", "ext-26m",
  483. "ext-rco-100m", "twpll-96m",
  484. "twpll-128m",
  485. "twpll-153m6" };
  486. static SPRD_COMP_CLK(sp_ahb, "sp-ahb", sp_ahb_parents, 0x2d0,
  487. 0, 3, 8, 2, 0);
  488. static const char * const cci_parents[] = { "ext-26m", "twpll-384m",
  489. "l0-614m4", "twpll-768m" };
  490. static SPRD_COMP_CLK(cci_clk, "cci", cci_parents, 0x300,
  491. 0, 2, 8, 2, 0);
  492. static SPRD_COMP_CLK(gic_clk, "gic", cci_parents, 0x304,
  493. 0, 2, 8, 2, 0);
  494. static SPRD_COMP_CLK(cssys_clk, "cssys", cci_parents, 0x310,
  495. 0, 2, 8, 2, 0);
  496. static const char * const sdio_2x_parents[] = { "fac-1m", "ext-26m",
  497. "twpll-307m2", "twpll-384m",
  498. "l0-409m6" };
  499. static SPRD_COMP_CLK(sdio0_2x, "sdio0-2x", sdio_2x_parents, 0x328,
  500. 0, 3, 8, 4, 0);
  501. static SPRD_COMP_CLK(sdio1_2x, "sdio1-2x", sdio_2x_parents, 0x330,
  502. 0, 3, 8, 4, 0);
  503. static SPRD_COMP_CLK(sdio2_2x, "sdio2-2x", sdio_2x_parents, 0x338,
  504. 0, 3, 8, 4, 0);
  505. static SPRD_COMP_CLK(emmc_2x, "emmc-2x", sdio_2x_parents, 0x340,
  506. 0, 3, 8, 4, 0);
  507. static SPRD_DIV_CLK(sdio0_1x, "sdio0-1x", "sdio0-2x", 0x32c,
  508. 8, 1, 0);
  509. static SPRD_DIV_CLK(sdio1_1x, "sdio1-1x", "sdio1-2x", 0x334,
  510. 8, 1, 0);
  511. static SPRD_DIV_CLK(sdio2_1x, "sdio2-1x", "sdio2-2x", 0x33c,
  512. 8, 1, 0);
  513. static SPRD_DIV_CLK(emmc_1x, "emmc-1x", "emmc-2x", 0x344,
  514. 8, 1, 0);
  515. static const char * const adi_parents[] = { "rco-4m", "ext-26m",
  516. "rco-25m", "twpll-38m4",
  517. "twpll-51m2" };
  518. static SPRD_MUX_CLK(adi_clk, "adi", adi_parents, 0x234,
  519. 0, 3, SC9860_MUX_FLAG);
  520. static const char * const pwm_parents[] = { "ext-32k", "ext-26m",
  521. "rco-4m", "rco-25m",
  522. "twpll-48m" };
  523. static SPRD_MUX_CLK(pwm0_clk, "pwm0", pwm_parents, 0x248,
  524. 0, 3, SC9860_MUX_FLAG);
  525. static SPRD_MUX_CLK(pwm1_clk, "pwm1", pwm_parents, 0x24c,
  526. 0, 3, SC9860_MUX_FLAG);
  527. static SPRD_MUX_CLK(pwm2_clk, "pwm2", pwm_parents, 0x250,
  528. 0, 3, SC9860_MUX_FLAG);
  529. static SPRD_MUX_CLK(pwm3_clk, "pwm3", pwm_parents, 0x254,
  530. 0, 3, SC9860_MUX_FLAG);
  531. static const char * const efuse_parents[] = { "rco-25m", "ext-26m" };
  532. static SPRD_MUX_CLK(efuse_clk, "efuse", efuse_parents, 0x258,
  533. 0, 1, SC9860_MUX_FLAG);
  534. static const char * const cm3_uart_parents[] = { "rco-4m", "ext-26m",
  535. "rco-100m", "twpll-48m",
  536. "twpll-51m2", "twpll-96m",
  537. "twpll-128m" };
  538. static SPRD_MUX_CLK(cm3_uart0, "cm3-uart0", cm3_uart_parents, 0x25c,
  539. 0, 3, SC9860_MUX_FLAG);
  540. static SPRD_MUX_CLK(cm3_uart1, "cm3-uart1", cm3_uart_parents, 0x260,
  541. 0, 3, SC9860_MUX_FLAG);
  542. static const char * const thm_parents[] = { "ext-32k", "fac-250k" };
  543. static SPRD_MUX_CLK(thm_clk, "thm", thm_parents, 0x270,
  544. 0, 1, SC9860_MUX_FLAG);
  545. static const char * const cm3_i2c_parents[] = { "rco-4m",
  546. "ext-26m",
  547. "rco-100m",
  548. "twpll-48m",
  549. "twpll-51m2",
  550. "twpll-153m6" };
  551. static SPRD_MUX_CLK(cm3_i2c0, "cm3-i2c0", cm3_i2c_parents, 0x274,
  552. 0, 3, SC9860_MUX_FLAG);
  553. static SPRD_MUX_CLK(cm3_i2c1, "cm3-i2c1", cm3_i2c_parents, 0x278,
  554. 0, 3, SC9860_MUX_FLAG);
  555. static SPRD_MUX_CLK(aon_i2c, "aon-i2c", cm3_i2c_parents, 0x280,
  556. 0, 3, SC9860_MUX_FLAG);
  557. static const char * const cm4_spi_parents[] = { "ext-26m", "twpll-96m",
  558. "rco-100m", "twpll-128m",
  559. "twpll-153m6", "twpll-192m" };
  560. static SPRD_MUX_CLK(cm4_spi, "cm4-spi", cm4_spi_parents, 0x27c,
  561. 0, 3, SC9860_MUX_FLAG);
  562. static SPRD_MUX_CLK(avs_clk, "avs", uart_parents, 0x284,
  563. 0, 2, SC9860_MUX_FLAG);
  564. static const char * const ca53_dap_parents[] = { "ext-26m", "rco-4m",
  565. "rco-100m", "twpll-76m8",
  566. "twpll-128m", "twpll-153m6" };
  567. static SPRD_MUX_CLK(ca53_dap, "ca53-dap", ca53_dap_parents, 0x288,
  568. 0, 3, SC9860_MUX_FLAG);
  569. static const char * const ca53_ts_parents[] = { "ext-32k", "ext-26m",
  570. "clk-twpll-128m",
  571. "clk-twpll-153m6" };
  572. static SPRD_MUX_CLK(ca53_ts, "ca53-ts", ca53_ts_parents, 0x290,
  573. 0, 2, SC9860_MUX_FLAG);
  574. static const char * const djtag_tck_parents[] = { "rco-4m", "ext-26m" };
  575. static SPRD_MUX_CLK(djtag_tck, "djtag-tck", djtag_tck_parents, 0x2c8,
  576. 0, 1, SC9860_MUX_FLAG);
  577. static const char * const pmu_parents[] = { "ext-32k", "rco-4m", "clk-4m" };
  578. static SPRD_MUX_CLK(pmu_clk, "pmu", pmu_parents, 0x2e0,
  579. 0, 2, SC9860_MUX_FLAG);
  580. static const char * const pmu_26m_parents[] = { "rco-25m", "ext-26m" };
  581. static SPRD_MUX_CLK(pmu_26m, "pmu-26m", pmu_26m_parents, 0x2e4,
  582. 0, 1, SC9860_MUX_FLAG);
  583. static const char * const debounce_parents[] = { "ext-32k", "rco-4m",
  584. "rco-25m", "ext-26m" };
  585. static SPRD_MUX_CLK(debounce_clk, "debounce", debounce_parents, 0x2e8,
  586. 0, 2, SC9860_MUX_FLAG);
  587. static const char * const otg2_ref_parents[] = { "twpll-12m", "twpll-24m" };
  588. static SPRD_MUX_CLK(otg2_ref, "otg2-ref", otg2_ref_parents, 0x2f4,
  589. 0, 1, SC9860_MUX_FLAG);
  590. static const char * const usb3_ref_parents[] = { "twpll-24m", "twpll-19m2",
  591. "twpll-48m" };
  592. static SPRD_MUX_CLK(usb3_ref, "usb3-ref", usb3_ref_parents, 0x2f8,
  593. 0, 2, SC9860_MUX_FLAG);
  594. static const char * const ap_axi_parents[] = { "ext-26m", "twpll-76m8",
  595. "twpll-128m", "twpll-256m" };
  596. static SPRD_MUX_CLK(ap_axi, "ap-axi", ap_axi_parents, 0x324,
  597. 0, 2, SC9860_MUX_FLAG);
  598. static struct sprd_clk_common *sc9860_aon_prediv[] = {
  599. /* address base is 0x402d0000 */
  600. &aon_apb.common,
  601. &aux0_clk.common,
  602. &aux1_clk.common,
  603. &aux2_clk.common,
  604. &probe_clk.common,
  605. &sp_ahb.common,
  606. &cci_clk.common,
  607. &gic_clk.common,
  608. &cssys_clk.common,
  609. &sdio0_2x.common,
  610. &sdio1_2x.common,
  611. &sdio2_2x.common,
  612. &emmc_2x.common,
  613. &sdio0_1x.common,
  614. &sdio1_1x.common,
  615. &sdio2_1x.common,
  616. &emmc_1x.common,
  617. &adi_clk.common,
  618. &pwm0_clk.common,
  619. &pwm1_clk.common,
  620. &pwm2_clk.common,
  621. &pwm3_clk.common,
  622. &efuse_clk.common,
  623. &cm3_uart0.common,
  624. &cm3_uart1.common,
  625. &thm_clk.common,
  626. &cm3_i2c0.common,
  627. &cm3_i2c1.common,
  628. &cm4_spi.common,
  629. &aon_i2c.common,
  630. &avs_clk.common,
  631. &ca53_dap.common,
  632. &ca53_ts.common,
  633. &djtag_tck.common,
  634. &pmu_clk.common,
  635. &pmu_26m.common,
  636. &debounce_clk.common,
  637. &otg2_ref.common,
  638. &usb3_ref.common,
  639. &ap_axi.common,
  640. };
  641. static struct clk_hw_onecell_data sc9860_aon_prediv_hws = {
  642. .hws = {
  643. [CLK_AON_APB] = &aon_apb.common.hw,
  644. [CLK_AUX0] = &aux0_clk.common.hw,
  645. [CLK_AUX1] = &aux1_clk.common.hw,
  646. [CLK_AUX2] = &aux2_clk.common.hw,
  647. [CLK_PROBE] = &probe_clk.common.hw,
  648. [CLK_SP_AHB] = &sp_ahb.common.hw,
  649. [CLK_CCI] = &cci_clk.common.hw,
  650. [CLK_GIC] = &gic_clk.common.hw,
  651. [CLK_CSSYS] = &cssys_clk.common.hw,
  652. [CLK_SDIO0_2X] = &sdio0_2x.common.hw,
  653. [CLK_SDIO1_2X] = &sdio1_2x.common.hw,
  654. [CLK_SDIO2_2X] = &sdio2_2x.common.hw,
  655. [CLK_EMMC_2X] = &emmc_2x.common.hw,
  656. [CLK_SDIO0_1X] = &sdio0_1x.common.hw,
  657. [CLK_SDIO1_1X] = &sdio1_1x.common.hw,
  658. [CLK_SDIO2_1X] = &sdio2_1x.common.hw,
  659. [CLK_EMMC_1X] = &emmc_1x.common.hw,
  660. [CLK_ADI] = &adi_clk.common.hw,
  661. [CLK_PWM0] = &pwm0_clk.common.hw,
  662. [CLK_PWM1] = &pwm1_clk.common.hw,
  663. [CLK_PWM2] = &pwm2_clk.common.hw,
  664. [CLK_PWM3] = &pwm3_clk.common.hw,
  665. [CLK_EFUSE] = &efuse_clk.common.hw,
  666. [CLK_CM3_UART0] = &cm3_uart0.common.hw,
  667. [CLK_CM3_UART1] = &cm3_uart1.common.hw,
  668. [CLK_THM] = &thm_clk.common.hw,
  669. [CLK_CM3_I2C0] = &cm3_i2c0.common.hw,
  670. [CLK_CM3_I2C1] = &cm3_i2c1.common.hw,
  671. [CLK_CM4_SPI] = &cm4_spi.common.hw,
  672. [CLK_AON_I2C] = &aon_i2c.common.hw,
  673. [CLK_AVS] = &avs_clk.common.hw,
  674. [CLK_CA53_DAP] = &ca53_dap.common.hw,
  675. [CLK_CA53_TS] = &ca53_ts.common.hw,
  676. [CLK_DJTAG_TCK] = &djtag_tck.common.hw,
  677. [CLK_PMU] = &pmu_clk.common.hw,
  678. [CLK_PMU_26M] = &pmu_26m.common.hw,
  679. [CLK_DEBOUNCE] = &debounce_clk.common.hw,
  680. [CLK_OTG2_REF] = &otg2_ref.common.hw,
  681. [CLK_USB3_REF] = &usb3_ref.common.hw,
  682. [CLK_AP_AXI] = &ap_axi.common.hw,
  683. },
  684. .num = CLK_AON_PREDIV_NUM,
  685. };
  686. static const struct sprd_clk_desc sc9860_aon_prediv_desc = {
  687. .clk_clks = sc9860_aon_prediv,
  688. .num_clk_clks = ARRAY_SIZE(sc9860_aon_prediv),
  689. .hw_clks = &sc9860_aon_prediv_hws,
  690. };
  691. static SPRD_SC_GATE_CLK(usb3_eb, "usb3-eb", "ap-axi", 0x0,
  692. 0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
  693. static SPRD_SC_GATE_CLK(usb3_suspend, "usb3-suspend", "ap-axi", 0x0,
  694. 0x1000, BIT(3), CLK_IGNORE_UNUSED, 0);
  695. static SPRD_SC_GATE_CLK(usb3_ref_eb, "usb3-ref-eb", "ap-axi", 0x0,
  696. 0x1000, BIT(4), CLK_IGNORE_UNUSED, 0);
  697. static SPRD_SC_GATE_CLK(dma_eb, "dma-eb", "ap-axi", 0x0,
  698. 0x1000, BIT(5), CLK_IGNORE_UNUSED, 0);
  699. static SPRD_SC_GATE_CLK(sdio0_eb, "sdio0-eb", "ap-axi", 0x0,
  700. 0x1000, BIT(7), CLK_IGNORE_UNUSED, 0);
  701. static SPRD_SC_GATE_CLK(sdio1_eb, "sdio1-eb", "ap-axi", 0x0,
  702. 0x1000, BIT(8), CLK_IGNORE_UNUSED, 0);
  703. static SPRD_SC_GATE_CLK(sdio2_eb, "sdio2-eb", "ap-axi", 0x0,
  704. 0x1000, BIT(9), CLK_IGNORE_UNUSED, 0);
  705. static SPRD_SC_GATE_CLK(emmc_eb, "emmc-eb", "ap-axi", 0x0,
  706. 0x1000, BIT(10), CLK_IGNORE_UNUSED, 0);
  707. static SPRD_SC_GATE_CLK(rom_eb, "rom-eb", "ap-axi", 0x0,
  708. 0x1000, BIT(12), CLK_IGNORE_UNUSED, 0);
  709. static SPRD_SC_GATE_CLK(busmon_eb, "busmon-eb", "ap-axi", 0x0,
  710. 0x1000, BIT(13), CLK_IGNORE_UNUSED, 0);
  711. static SPRD_SC_GATE_CLK(cc63s_eb, "cc63s-eb", "ap-axi", 0x0,
  712. 0x1000, BIT(22), CLK_IGNORE_UNUSED, 0);
  713. static SPRD_SC_GATE_CLK(cc63p_eb, "cc63p-eb", "ap-axi", 0x0,
  714. 0x1000, BIT(23), CLK_IGNORE_UNUSED, 0);
  715. static SPRD_SC_GATE_CLK(ce0_eb, "ce0-eb", "ap-axi", 0x0,
  716. 0x1000, BIT(24), CLK_IGNORE_UNUSED, 0);
  717. static SPRD_SC_GATE_CLK(ce1_eb, "ce1-eb", "ap-axi", 0x0,
  718. 0x1000, BIT(25), CLK_IGNORE_UNUSED, 0);
  719. static struct sprd_clk_common *sc9860_apahb_gate[] = {
  720. /* address base is 0x20210000 */
  721. &usb3_eb.common,
  722. &usb3_suspend.common,
  723. &usb3_ref_eb.common,
  724. &dma_eb.common,
  725. &sdio0_eb.common,
  726. &sdio1_eb.common,
  727. &sdio2_eb.common,
  728. &emmc_eb.common,
  729. &rom_eb.common,
  730. &busmon_eb.common,
  731. &cc63s_eb.common,
  732. &cc63p_eb.common,
  733. &ce0_eb.common,
  734. &ce1_eb.common,
  735. };
  736. static struct clk_hw_onecell_data sc9860_apahb_gate_hws = {
  737. .hws = {
  738. [CLK_USB3_EB] = &usb3_eb.common.hw,
  739. [CLK_USB3_SUSPEND_EB] = &usb3_suspend.common.hw,
  740. [CLK_USB3_REF_EB] = &usb3_ref_eb.common.hw,
  741. [CLK_DMA_EB] = &dma_eb.common.hw,
  742. [CLK_SDIO0_EB] = &sdio0_eb.common.hw,
  743. [CLK_SDIO1_EB] = &sdio1_eb.common.hw,
  744. [CLK_SDIO2_EB] = &sdio2_eb.common.hw,
  745. [CLK_EMMC_EB] = &emmc_eb.common.hw,
  746. [CLK_ROM_EB] = &rom_eb.common.hw,
  747. [CLK_BUSMON_EB] = &busmon_eb.common.hw,
  748. [CLK_CC63S_EB] = &cc63s_eb.common.hw,
  749. [CLK_CC63P_EB] = &cc63p_eb.common.hw,
  750. [CLK_CE0_EB] = &ce0_eb.common.hw,
  751. [CLK_CE1_EB] = &ce1_eb.common.hw,
  752. },
  753. .num = CLK_APAHB_GATE_NUM,
  754. };
  755. static const struct sprd_clk_desc sc9860_apahb_gate_desc = {
  756. .clk_clks = sc9860_apahb_gate,
  757. .num_clk_clks = ARRAY_SIZE(sc9860_apahb_gate),
  758. .hw_clks = &sc9860_apahb_gate_hws,
  759. };
  760. static SPRD_SC_GATE_CLK(avs_lit_eb, "avs-lit-eb", "aon-apb", 0x0,
  761. 0x1000, BIT(0), CLK_IGNORE_UNUSED, 0);
  762. static SPRD_SC_GATE_CLK(avs_big_eb, "avs-big-eb", "aon-apb", 0x0,
  763. 0x1000, BIT(1), CLK_IGNORE_UNUSED, 0);
  764. static SPRD_SC_GATE_CLK(ap_intc5_eb, "ap-intc5-eb", "aon-apb", 0x0,
  765. 0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
  766. static SPRD_SC_GATE_CLK(gpio_eb, "gpio-eb", "aon-apb", 0x0,
  767. 0x1000, BIT(3), CLK_IGNORE_UNUSED, 0);
  768. static SPRD_SC_GATE_CLK(pwm0_eb, "pwm0-eb", "aon-apb", 0x0,
  769. 0x1000, BIT(4), CLK_IGNORE_UNUSED, 0);
  770. static SPRD_SC_GATE_CLK(pwm1_eb, "pwm1-eb", "aon-apb", 0x0,
  771. 0x1000, BIT(5), CLK_IGNORE_UNUSED, 0);
  772. static SPRD_SC_GATE_CLK(pwm2_eb, "pwm2-eb", "aon-apb", 0x0,
  773. 0x1000, BIT(6), CLK_IGNORE_UNUSED, 0);
  774. static SPRD_SC_GATE_CLK(pwm3_eb, "pwm3-eb", "aon-apb", 0x0,
  775. 0x1000, BIT(7), CLK_IGNORE_UNUSED, 0);
  776. static SPRD_SC_GATE_CLK(kpd_eb, "kpd-eb", "aon-apb", 0x0,
  777. 0x1000, BIT(8), CLK_IGNORE_UNUSED, 0);
  778. static SPRD_SC_GATE_CLK(aon_sys_eb, "aon-sys-eb", "aon-apb", 0x0,
  779. 0x1000, BIT(9), CLK_IGNORE_UNUSED, 0);
  780. static SPRD_SC_GATE_CLK(ap_sys_eb, "ap-sys-eb", "aon-apb", 0x0,
  781. 0x1000, BIT(10), CLK_IGNORE_UNUSED, 0);
  782. static SPRD_SC_GATE_CLK(aon_tmr_eb, "aon-tmr-eb", "aon-apb", 0x0,
  783. 0x1000, BIT(11), CLK_IGNORE_UNUSED, 0);
  784. static SPRD_SC_GATE_CLK(ap_tmr0_eb, "ap-tmr0-eb", "aon-apb", 0x0,
  785. 0x1000, BIT(12), CLK_IGNORE_UNUSED, 0);
  786. static SPRD_SC_GATE_CLK(efuse_eb, "efuse-eb", "aon-apb", 0x0,
  787. 0x1000, BIT(13), CLK_IGNORE_UNUSED, 0);
  788. static SPRD_SC_GATE_CLK(eic_eb, "eic-eb", "aon-apb", 0x0,
  789. 0x1000, BIT(14), CLK_IGNORE_UNUSED, 0);
  790. static SPRD_SC_GATE_CLK(pub1_reg_eb, "pub1-reg-eb", "aon-apb", 0x0,
  791. 0x1000, BIT(15), CLK_IGNORE_UNUSED, 0);
  792. static SPRD_SC_GATE_CLK(adi_eb, "adi-eb", "aon-apb", 0x0,
  793. 0x1000, BIT(16), CLK_IGNORE_UNUSED, 0);
  794. static SPRD_SC_GATE_CLK(ap_intc0_eb, "ap-intc0-eb", "aon-apb", 0x0,
  795. 0x1000, BIT(17), CLK_IGNORE_UNUSED, 0);
  796. static SPRD_SC_GATE_CLK(ap_intc1_eb, "ap-intc1-eb", "aon-apb", 0x0,
  797. 0x1000, BIT(18), CLK_IGNORE_UNUSED, 0);
  798. static SPRD_SC_GATE_CLK(ap_intc2_eb, "ap-intc2-eb", "aon-apb", 0x0,
  799. 0x1000, BIT(19), CLK_IGNORE_UNUSED, 0);
  800. static SPRD_SC_GATE_CLK(ap_intc3_eb, "ap-intc3-eb", "aon-apb", 0x0,
  801. 0x1000, BIT(20), CLK_IGNORE_UNUSED, 0);
  802. static SPRD_SC_GATE_CLK(ap_intc4_eb, "ap-intc4-eb", "aon-apb", 0x0,
  803. 0x1000, BIT(21), CLK_IGNORE_UNUSED, 0);
  804. static SPRD_SC_GATE_CLK(splk_eb, "splk-eb", "aon-apb", 0x0,
  805. 0x1000, BIT(22), CLK_IGNORE_UNUSED, 0);
  806. static SPRD_SC_GATE_CLK(mspi_eb, "mspi-eb", "aon-apb", 0x0,
  807. 0x1000, BIT(23), CLK_IGNORE_UNUSED, 0);
  808. static SPRD_SC_GATE_CLK(pub0_reg_eb, "pub0-reg-eb", "aon-apb", 0x0,
  809. 0x1000, BIT(24), CLK_IGNORE_UNUSED, 0);
  810. static SPRD_SC_GATE_CLK(pin_eb, "pin-eb", "aon-apb", 0x0,
  811. 0x1000, BIT(25), CLK_IGNORE_UNUSED, 0);
  812. static SPRD_SC_GATE_CLK(aon_ckg_eb, "aon-ckg-eb", "aon-apb", 0x0,
  813. 0x1000, BIT(26), CLK_IGNORE_UNUSED, 0);
  814. static SPRD_SC_GATE_CLK(gpu_eb, "gpu-eb", "aon-apb", 0x0,
  815. 0x1000, BIT(27), CLK_IGNORE_UNUSED, 0);
  816. static SPRD_SC_GATE_CLK(apcpu_ts0_eb, "apcpu-ts0-eb", "aon-apb", 0x0,
  817. 0x1000, BIT(28), CLK_IGNORE_UNUSED, 0);
  818. static SPRD_SC_GATE_CLK(apcpu_ts1_eb, "apcpu-ts1-eb", "aon-apb", 0x0,
  819. 0x1000, BIT(29), CLK_IGNORE_UNUSED, 0);
  820. static SPRD_SC_GATE_CLK(dap_eb, "dap-eb", "aon-apb", 0x0,
  821. 0x1000, BIT(30), CLK_IGNORE_UNUSED, 0);
  822. static SPRD_SC_GATE_CLK(i2c_eb, "i2c-eb", "aon-apb", 0x0,
  823. 0x1000, BIT(31), CLK_IGNORE_UNUSED, 0);
  824. static SPRD_SC_GATE_CLK(pmu_eb, "pmu-eb", "aon-apb", 0x4,
  825. 0x1000, BIT(0), CLK_IGNORE_UNUSED, 0);
  826. static SPRD_SC_GATE_CLK(thm_eb, "thm-eb", "aon-apb", 0x4,
  827. 0x1000, BIT(1), CLK_IGNORE_UNUSED, 0);
  828. static SPRD_SC_GATE_CLK(aux0_eb, "aux0-eb", "aon-apb", 0x4,
  829. 0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
  830. static SPRD_SC_GATE_CLK(aux1_eb, "aux1-eb", "aon-apb", 0x4,
  831. 0x1000, BIT(3), CLK_IGNORE_UNUSED, 0);
  832. static SPRD_SC_GATE_CLK(aux2_eb, "aux2-eb", "aon-apb", 0x4,
  833. 0x1000, BIT(4), CLK_IGNORE_UNUSED, 0);
  834. static SPRD_SC_GATE_CLK(probe_eb, "probe-eb", "aon-apb", 0x4,
  835. 0x1000, BIT(5), CLK_IGNORE_UNUSED, 0);
  836. static SPRD_SC_GATE_CLK(gpu0_avs_eb, "gpu0-avs-eb", "aon-apb", 0x4,
  837. 0x1000, BIT(6), CLK_IGNORE_UNUSED, 0);
  838. static SPRD_SC_GATE_CLK(gpu1_avs_eb, "gpu1-avs-eb", "aon-apb", 0x4,
  839. 0x1000, BIT(7), CLK_IGNORE_UNUSED, 0);
  840. static SPRD_SC_GATE_CLK(apcpu_wdg_eb, "apcpu-wdg-eb", "aon-apb", 0x4,
  841. 0x1000, BIT(8), CLK_IGNORE_UNUSED, 0);
  842. static SPRD_SC_GATE_CLK(ap_tmr1_eb, "ap-tmr1-eb", "aon-apb", 0x4,
  843. 0x1000, BIT(9), CLK_IGNORE_UNUSED, 0);
  844. static SPRD_SC_GATE_CLK(ap_tmr2_eb, "ap-tmr2-eb", "aon-apb", 0x4,
  845. 0x1000, BIT(10), CLK_IGNORE_UNUSED, 0);
  846. static SPRD_SC_GATE_CLK(disp_emc_eb, "disp-emc-eb", "aon-apb", 0x4,
  847. 0x1000, BIT(11), CLK_IGNORE_UNUSED, 0);
  848. static SPRD_SC_GATE_CLK(zip_emc_eb, "zip-emc-eb", "aon-apb", 0x4,
  849. 0x1000, BIT(12), CLK_IGNORE_UNUSED, 0);
  850. static SPRD_SC_GATE_CLK(gsp_emc_eb, "gsp-emc-eb", "aon-apb", 0x4,
  851. 0x1000, BIT(13), CLK_IGNORE_UNUSED, 0);
  852. static SPRD_SC_GATE_CLK(osc_aon_eb, "osc-aon-eb", "aon-apb", 0x4,
  853. 0x1000, BIT(14), CLK_IGNORE_UNUSED, 0);
  854. static SPRD_SC_GATE_CLK(lvds_trx_eb, "lvds-trx-eb", "aon-apb", 0x4,
  855. 0x1000, BIT(15), CLK_IGNORE_UNUSED, 0);
  856. static SPRD_SC_GATE_CLK(lvds_tcxo_eb, "lvds-tcxo-eb", "aon-apb", 0x4,
  857. 0x1000, BIT(16), CLK_IGNORE_UNUSED, 0);
  858. static SPRD_SC_GATE_CLK(mdar_eb, "mdar-eb", "aon-apb", 0x4,
  859. 0x1000, BIT(17), CLK_IGNORE_UNUSED, 0);
  860. static SPRD_SC_GATE_CLK(rtc4m0_cal_eb, "rtc4m0-cal-eb", "aon-apb", 0x4,
  861. 0x1000, BIT(18), CLK_IGNORE_UNUSED, 0);
  862. static SPRD_SC_GATE_CLK(rct100m_cal_eb, "rct100m-cal-eb", "aon-apb", 0x4,
  863. 0x1000, BIT(19), CLK_IGNORE_UNUSED, 0);
  864. static SPRD_SC_GATE_CLK(djtag_eb, "djtag-eb", "aon-apb", 0x4,
  865. 0x1000, BIT(20), CLK_IGNORE_UNUSED, 0);
  866. static SPRD_SC_GATE_CLK(mbox_eb, "mbox-eb", "aon-apb", 0x4,
  867. 0x1000, BIT(21), CLK_IGNORE_UNUSED, 0);
  868. static SPRD_SC_GATE_CLK(aon_dma_eb, "aon-dma-eb", "aon-apb", 0x4,
  869. 0x1000, BIT(22), CLK_IGNORE_UNUSED, 0);
  870. static SPRD_SC_GATE_CLK(dbg_emc_eb, "dbg-emc-eb", "aon-apb", 0x4,
  871. 0x1000, BIT(23), CLK_IGNORE_UNUSED, 0);
  872. static SPRD_SC_GATE_CLK(lvds_pll_div_en, "lvds-pll-div-en", "aon-apb", 0x4,
  873. 0x1000, BIT(24), CLK_IGNORE_UNUSED, 0);
  874. static SPRD_SC_GATE_CLK(def_eb, "def-eb", "aon-apb", 0x4,
  875. 0x1000, BIT(25), CLK_IGNORE_UNUSED, 0);
  876. static SPRD_SC_GATE_CLK(aon_apb_rsv0, "aon-apb-rsv0", "aon-apb", 0x4,
  877. 0x1000, BIT(26), CLK_IGNORE_UNUSED, 0);
  878. static SPRD_SC_GATE_CLK(orp_jtag_eb, "orp-jtag-eb", "aon-apb", 0x4,
  879. 0x1000, BIT(27), CLK_IGNORE_UNUSED, 0);
  880. static SPRD_SC_GATE_CLK(vsp_eb, "vsp-eb", "aon-apb", 0x4,
  881. 0x1000, BIT(28), CLK_IGNORE_UNUSED, 0);
  882. static SPRD_SC_GATE_CLK(cam_eb, "cam-eb", "aon-apb", 0x4,
  883. 0x1000, BIT(29), CLK_IGNORE_UNUSED, 0);
  884. static SPRD_SC_GATE_CLK(disp_eb, "disp-eb", "aon-apb", 0x4,
  885. 0x1000, BIT(30), CLK_IGNORE_UNUSED, 0);
  886. static SPRD_SC_GATE_CLK(dbg_axi_if_eb, "dbg-axi-if-eb", "aon-apb", 0x4,
  887. 0x1000, BIT(31), CLK_IGNORE_UNUSED, 0);
  888. static SPRD_SC_GATE_CLK(sdio0_2x_en, "sdio0-2x-en", "aon-apb", 0x13c,
  889. 0x1000, BIT(2), 0, 0);
  890. static SPRD_SC_GATE_CLK(sdio1_2x_en, "sdio1-2x-en", "aon-apb", 0x13c,
  891. 0x1000, BIT(4), 0, 0);
  892. static SPRD_SC_GATE_CLK(sdio2_2x_en, "sdio2-2x-en", "aon-apb", 0x13c,
  893. 0x1000, BIT(6), 0, 0);
  894. static SPRD_SC_GATE_CLK(emmc_2x_en, "emmc-2x-en", "aon-apb", 0x13c,
  895. 0x1000, BIT(9), 0, 0);
  896. static SPRD_SC_GATE_CLK(arch_rtc_eb, "arch-rtc-eb", "aon-apb", 0x10,
  897. 0x1000, BIT(0), CLK_IGNORE_UNUSED, 0);
  898. static SPRD_SC_GATE_CLK(kpb_rtc_eb, "kpb-rtc-eb", "aon-apb", 0x10,
  899. 0x1000, BIT(1), CLK_IGNORE_UNUSED, 0);
  900. static SPRD_SC_GATE_CLK(aon_syst_rtc_eb, "aon-syst-rtc-eb", "aon-apb", 0x10,
  901. 0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
  902. static SPRD_SC_GATE_CLK(ap_syst_rtc_eb, "ap-syst-rtc-eb", "aon-apb", 0x10,
  903. 0x1000, BIT(3), CLK_IGNORE_UNUSED, 0);
  904. static SPRD_SC_GATE_CLK(aon_tmr_rtc_eb, "aon-tmr-rtc-eb", "aon-apb", 0x10,
  905. 0x1000, BIT(4), CLK_IGNORE_UNUSED, 0);
  906. static SPRD_SC_GATE_CLK(ap_tmr0_rtc_eb, "ap-tmr0-rtc-eb", "aon-apb", 0x10,
  907. 0x1000, BIT(5), CLK_IGNORE_UNUSED, 0);
  908. static SPRD_SC_GATE_CLK(eic_rtc_eb, "eic-rtc-eb", "aon-apb", 0x10,
  909. 0x1000, BIT(6), CLK_IGNORE_UNUSED, 0);
  910. static SPRD_SC_GATE_CLK(eic_rtcdv5_eb, "eic-rtcdv5-eb", "aon-apb", 0x10,
  911. 0x1000, BIT(7), CLK_IGNORE_UNUSED, 0);
  912. static SPRD_SC_GATE_CLK(ap_wdg_rtc_eb, "ap-wdg-rtc-eb", "aon-apb", 0x10,
  913. 0x1000, BIT(9), CLK_IGNORE_UNUSED, 0);
  914. static SPRD_SC_GATE_CLK(ap_tmr1_rtc_eb, "ap-tmr1-rtc-eb", "aon-apb", 0x10,
  915. 0x1000, BIT(15), CLK_IGNORE_UNUSED, 0);
  916. static SPRD_SC_GATE_CLK(ap_tmr2_rtc_eb, "ap-tmr2-rtc-eb", "aon-apb", 0x10,
  917. 0x1000, BIT(16), CLK_IGNORE_UNUSED, 0);
  918. static SPRD_SC_GATE_CLK(dcxo_tmr_rtc_eb, "dcxo-tmr-rtc-eb", "aon-apb", 0x10,
  919. 0x1000, BIT(17), CLK_IGNORE_UNUSED, 0);
  920. static SPRD_SC_GATE_CLK(bb_cal_rtc_eb, "bb-cal-rtc-eb", "aon-apb", 0x10,
  921. 0x1000, BIT(18), CLK_IGNORE_UNUSED, 0);
  922. static SPRD_SC_GATE_CLK(avs_big_rtc_eb, "avs-big-rtc-eb", "aon-apb", 0x10,
  923. 0x1000, BIT(20), CLK_IGNORE_UNUSED, 0);
  924. static SPRD_SC_GATE_CLK(avs_lit_rtc_eb, "avs-lit-rtc-eb", "aon-apb", 0x10,
  925. 0x1000, BIT(21), CLK_IGNORE_UNUSED, 0);
  926. static SPRD_SC_GATE_CLK(avs_gpu0_rtc_eb, "avs-gpu0-rtc-eb", "aon-apb", 0x10,
  927. 0x1000, BIT(22), CLK_IGNORE_UNUSED, 0);
  928. static SPRD_SC_GATE_CLK(avs_gpu1_rtc_eb, "avs-gpu1-rtc-eb", "aon-apb", 0x10,
  929. 0x1000, BIT(23), CLK_IGNORE_UNUSED, 0);
  930. static SPRD_SC_GATE_CLK(gpu_ts_eb, "gpu-ts-eb", "aon-apb", 0x10,
  931. 0x1000, BIT(24), CLK_IGNORE_UNUSED, 0);
  932. static SPRD_SC_GATE_CLK(rtcdv10_eb, "rtcdv10-eb", "aon-apb", 0x10,
  933. 0x1000, BIT(27), CLK_IGNORE_UNUSED, 0);
  934. static struct sprd_clk_common *sc9860_aon_gate[] = {
  935. /* address base is 0x402e0000 */
  936. &avs_lit_eb.common,
  937. &avs_big_eb.common,
  938. &ap_intc5_eb.common,
  939. &gpio_eb.common,
  940. &pwm0_eb.common,
  941. &pwm1_eb.common,
  942. &pwm2_eb.common,
  943. &pwm3_eb.common,
  944. &kpd_eb.common,
  945. &aon_sys_eb.common,
  946. &ap_sys_eb.common,
  947. &aon_tmr_eb.common,
  948. &ap_tmr0_eb.common,
  949. &efuse_eb.common,
  950. &eic_eb.common,
  951. &pub1_reg_eb.common,
  952. &adi_eb.common,
  953. &ap_intc0_eb.common,
  954. &ap_intc1_eb.common,
  955. &ap_intc2_eb.common,
  956. &ap_intc3_eb.common,
  957. &ap_intc4_eb.common,
  958. &splk_eb.common,
  959. &mspi_eb.common,
  960. &pub0_reg_eb.common,
  961. &pin_eb.common,
  962. &aon_ckg_eb.common,
  963. &gpu_eb.common,
  964. &apcpu_ts0_eb.common,
  965. &apcpu_ts1_eb.common,
  966. &dap_eb.common,
  967. &i2c_eb.common,
  968. &pmu_eb.common,
  969. &thm_eb.common,
  970. &aux0_eb.common,
  971. &aux1_eb.common,
  972. &aux2_eb.common,
  973. &probe_eb.common,
  974. &gpu0_avs_eb.common,
  975. &gpu1_avs_eb.common,
  976. &apcpu_wdg_eb.common,
  977. &ap_tmr1_eb.common,
  978. &ap_tmr2_eb.common,
  979. &disp_emc_eb.common,
  980. &zip_emc_eb.common,
  981. &gsp_emc_eb.common,
  982. &osc_aon_eb.common,
  983. &lvds_trx_eb.common,
  984. &lvds_tcxo_eb.common,
  985. &mdar_eb.common,
  986. &rtc4m0_cal_eb.common,
  987. &rct100m_cal_eb.common,
  988. &djtag_eb.common,
  989. &mbox_eb.common,
  990. &aon_dma_eb.common,
  991. &dbg_emc_eb.common,
  992. &lvds_pll_div_en.common,
  993. &def_eb.common,
  994. &aon_apb_rsv0.common,
  995. &orp_jtag_eb.common,
  996. &vsp_eb.common,
  997. &cam_eb.common,
  998. &disp_eb.common,
  999. &dbg_axi_if_eb.common,
  1000. &sdio0_2x_en.common,
  1001. &sdio1_2x_en.common,
  1002. &sdio2_2x_en.common,
  1003. &emmc_2x_en.common,
  1004. &arch_rtc_eb.common,
  1005. &kpb_rtc_eb.common,
  1006. &aon_syst_rtc_eb.common,
  1007. &ap_syst_rtc_eb.common,
  1008. &aon_tmr_rtc_eb.common,
  1009. &ap_tmr0_rtc_eb.common,
  1010. &eic_rtc_eb.common,
  1011. &eic_rtcdv5_eb.common,
  1012. &ap_wdg_rtc_eb.common,
  1013. &ap_tmr1_rtc_eb.common,
  1014. &ap_tmr2_rtc_eb.common,
  1015. &dcxo_tmr_rtc_eb.common,
  1016. &bb_cal_rtc_eb.common,
  1017. &avs_big_rtc_eb.common,
  1018. &avs_lit_rtc_eb.common,
  1019. &avs_gpu0_rtc_eb.common,
  1020. &avs_gpu1_rtc_eb.common,
  1021. &gpu_ts_eb.common,
  1022. &rtcdv10_eb.common,
  1023. };
  1024. static struct clk_hw_onecell_data sc9860_aon_gate_hws = {
  1025. .hws = {
  1026. [CLK_AVS_LIT_EB] = &avs_lit_eb.common.hw,
  1027. [CLK_AVS_BIG_EB] = &avs_big_eb.common.hw,
  1028. [CLK_AP_INTC5_EB] = &ap_intc5_eb.common.hw,
  1029. [CLK_GPIO_EB] = &gpio_eb.common.hw,
  1030. [CLK_PWM0_EB] = &pwm0_eb.common.hw,
  1031. [CLK_PWM1_EB] = &pwm1_eb.common.hw,
  1032. [CLK_PWM2_EB] = &pwm2_eb.common.hw,
  1033. [CLK_PWM3_EB] = &pwm3_eb.common.hw,
  1034. [CLK_KPD_EB] = &kpd_eb.common.hw,
  1035. [CLK_AON_SYS_EB] = &aon_sys_eb.common.hw,
  1036. [CLK_AP_SYS_EB] = &ap_sys_eb.common.hw,
  1037. [CLK_AON_TMR_EB] = &aon_tmr_eb.common.hw,
  1038. [CLK_AP_TMR0_EB] = &ap_tmr0_eb.common.hw,
  1039. [CLK_EFUSE_EB] = &efuse_eb.common.hw,
  1040. [CLK_EIC_EB] = &eic_eb.common.hw,
  1041. [CLK_PUB1_REG_EB] = &pub1_reg_eb.common.hw,
  1042. [CLK_ADI_EB] = &adi_eb.common.hw,
  1043. [CLK_AP_INTC0_EB] = &ap_intc0_eb.common.hw,
  1044. [CLK_AP_INTC1_EB] = &ap_intc1_eb.common.hw,
  1045. [CLK_AP_INTC2_EB] = &ap_intc2_eb.common.hw,
  1046. [CLK_AP_INTC3_EB] = &ap_intc3_eb.common.hw,
  1047. [CLK_AP_INTC4_EB] = &ap_intc4_eb.common.hw,
  1048. [CLK_SPLK_EB] = &splk_eb.common.hw,
  1049. [CLK_MSPI_EB] = &mspi_eb.common.hw,
  1050. [CLK_PUB0_REG_EB] = &pub0_reg_eb.common.hw,
  1051. [CLK_PIN_EB] = &pin_eb.common.hw,
  1052. [CLK_AON_CKG_EB] = &aon_ckg_eb.common.hw,
  1053. [CLK_GPU_EB] = &gpu_eb.common.hw,
  1054. [CLK_APCPU_TS0_EB] = &apcpu_ts0_eb.common.hw,
  1055. [CLK_APCPU_TS1_EB] = &apcpu_ts1_eb.common.hw,
  1056. [CLK_DAP_EB] = &dap_eb.common.hw,
  1057. [CLK_I2C_EB] = &i2c_eb.common.hw,
  1058. [CLK_PMU_EB] = &pmu_eb.common.hw,
  1059. [CLK_THM_EB] = &thm_eb.common.hw,
  1060. [CLK_AUX0_EB] = &aux0_eb.common.hw,
  1061. [CLK_AUX1_EB] = &aux1_eb.common.hw,
  1062. [CLK_AUX2_EB] = &aux2_eb.common.hw,
  1063. [CLK_PROBE_EB] = &probe_eb.common.hw,
  1064. [CLK_GPU0_AVS_EB] = &gpu0_avs_eb.common.hw,
  1065. [CLK_GPU1_AVS_EB] = &gpu1_avs_eb.common.hw,
  1066. [CLK_APCPU_WDG_EB] = &apcpu_wdg_eb.common.hw,
  1067. [CLK_AP_TMR1_EB] = &ap_tmr1_eb.common.hw,
  1068. [CLK_AP_TMR2_EB] = &ap_tmr2_eb.common.hw,
  1069. [CLK_DISP_EMC_EB] = &disp_emc_eb.common.hw,
  1070. [CLK_ZIP_EMC_EB] = &zip_emc_eb.common.hw,
  1071. [CLK_GSP_EMC_EB] = &gsp_emc_eb.common.hw,
  1072. [CLK_OSC_AON_EB] = &osc_aon_eb.common.hw,
  1073. [CLK_LVDS_TRX_EB] = &lvds_trx_eb.common.hw,
  1074. [CLK_LVDS_TCXO_EB] = &lvds_tcxo_eb.common.hw,
  1075. [CLK_MDAR_EB] = &mdar_eb.common.hw,
  1076. [CLK_RTC4M0_CAL_EB] = &rtc4m0_cal_eb.common.hw,
  1077. [CLK_RCT100M_CAL_EB] = &rct100m_cal_eb.common.hw,
  1078. [CLK_DJTAG_EB] = &djtag_eb.common.hw,
  1079. [CLK_MBOX_EB] = &mbox_eb.common.hw,
  1080. [CLK_AON_DMA_EB] = &aon_dma_eb.common.hw,
  1081. [CLK_DBG_EMC_EB] = &dbg_emc_eb.common.hw,
  1082. [CLK_LVDS_PLL_DIV_EN] = &lvds_pll_div_en.common.hw,
  1083. [CLK_DEF_EB] = &def_eb.common.hw,
  1084. [CLK_AON_APB_RSV0] = &aon_apb_rsv0.common.hw,
  1085. [CLK_ORP_JTAG_EB] = &orp_jtag_eb.common.hw,
  1086. [CLK_VSP_EB] = &vsp_eb.common.hw,
  1087. [CLK_CAM_EB] = &cam_eb.common.hw,
  1088. [CLK_DISP_EB] = &disp_eb.common.hw,
  1089. [CLK_DBG_AXI_IF_EB] = &dbg_axi_if_eb.common.hw,
  1090. [CLK_SDIO0_2X_EN] = &sdio0_2x_en.common.hw,
  1091. [CLK_SDIO1_2X_EN] = &sdio1_2x_en.common.hw,
  1092. [CLK_SDIO2_2X_EN] = &sdio2_2x_en.common.hw,
  1093. [CLK_EMMC_2X_EN] = &emmc_2x_en.common.hw,
  1094. [CLK_ARCH_RTC_EB] = &arch_rtc_eb.common.hw,
  1095. [CLK_KPB_RTC_EB] = &kpb_rtc_eb.common.hw,
  1096. [CLK_AON_SYST_RTC_EB] = &aon_syst_rtc_eb.common.hw,
  1097. [CLK_AP_SYST_RTC_EB] = &ap_syst_rtc_eb.common.hw,
  1098. [CLK_AON_TMR_RTC_EB] = &aon_tmr_rtc_eb.common.hw,
  1099. [CLK_AP_TMR0_RTC_EB] = &ap_tmr0_rtc_eb.common.hw,
  1100. [CLK_EIC_RTC_EB] = &eic_rtc_eb.common.hw,
  1101. [CLK_EIC_RTCDV5_EB] = &eic_rtcdv5_eb.common.hw,
  1102. [CLK_AP_WDG_RTC_EB] = &ap_wdg_rtc_eb.common.hw,
  1103. [CLK_AP_TMR1_RTC_EB] = &ap_tmr1_rtc_eb.common.hw,
  1104. [CLK_AP_TMR2_RTC_EB] = &ap_tmr2_rtc_eb.common.hw,
  1105. [CLK_DCXO_TMR_RTC_EB] = &dcxo_tmr_rtc_eb.common.hw,
  1106. [CLK_BB_CAL_RTC_EB] = &bb_cal_rtc_eb.common.hw,
  1107. [CLK_AVS_BIG_RTC_EB] = &avs_big_rtc_eb.common.hw,
  1108. [CLK_AVS_LIT_RTC_EB] = &avs_lit_rtc_eb.common.hw,
  1109. [CLK_AVS_GPU0_RTC_EB] = &avs_gpu0_rtc_eb.common.hw,
  1110. [CLK_AVS_GPU1_RTC_EB] = &avs_gpu1_rtc_eb.common.hw,
  1111. [CLK_GPU_TS_EB] = &gpu_ts_eb.common.hw,
  1112. [CLK_RTCDV10_EB] = &rtcdv10_eb.common.hw,
  1113. },
  1114. .num = CLK_AON_GATE_NUM,
  1115. };
  1116. static const struct sprd_clk_desc sc9860_aon_gate_desc = {
  1117. .clk_clks = sc9860_aon_gate,
  1118. .num_clk_clks = ARRAY_SIZE(sc9860_aon_gate),
  1119. .hw_clks = &sc9860_aon_gate_hws,
  1120. };
  1121. static const u8 mcu_table[] = { 0, 1, 2, 3, 4, 8 };
  1122. static const char * const lit_mcu_parents[] = { "ext-26m", "twpll-512m",
  1123. "twpll-768m", "ltepll0",
  1124. "twpll", "mpll0" };
  1125. static SPRD_COMP_CLK_TABLE(lit_mcu, "lit-mcu", lit_mcu_parents, 0x20,
  1126. mcu_table, 0, 4, 4, 3, 0);
  1127. static const char * const big_mcu_parents[] = { "ext-26m", "twpll-512m",
  1128. "twpll-768m", "ltepll0",
  1129. "twpll", "mpll1" };
  1130. static SPRD_COMP_CLK_TABLE(big_mcu, "big-mcu", big_mcu_parents, 0x24,
  1131. mcu_table, 0, 4, 4, 3, 0);
  1132. static struct sprd_clk_common *sc9860_aonsecure_clk[] = {
  1133. /* address base is 0x40880000 */
  1134. &lit_mcu.common,
  1135. &big_mcu.common,
  1136. };
  1137. static struct clk_hw_onecell_data sc9860_aonsecure_clk_hws = {
  1138. .hws = {
  1139. [CLK_LIT_MCU] = &lit_mcu.common.hw,
  1140. [CLK_BIG_MCU] = &big_mcu.common.hw,
  1141. },
  1142. .num = CLK_AONSECURE_NUM,
  1143. };
  1144. static const struct sprd_clk_desc sc9860_aonsecure_clk_desc = {
  1145. .clk_clks = sc9860_aonsecure_clk,
  1146. .num_clk_clks = ARRAY_SIZE(sc9860_aonsecure_clk),
  1147. .hw_clks = &sc9860_aonsecure_clk_hws,
  1148. };
  1149. static SPRD_SC_GATE_CLK(agcp_iis0_eb, "agcp-iis0-eb", "aon-apb",
  1150. 0x0, 0x100, BIT(0), 0, 0);
  1151. static SPRD_SC_GATE_CLK(agcp_iis1_eb, "agcp-iis1-eb", "aon-apb",
  1152. 0x0, 0x100, BIT(1), 0, 0);
  1153. static SPRD_SC_GATE_CLK(agcp_iis2_eb, "agcp-iis2-eb", "aon-apb",
  1154. 0x0, 0x100, BIT(2), 0, 0);
  1155. static SPRD_SC_GATE_CLK(agcp_iis3_eb, "agcp-iis3-eb", "aon-apb",
  1156. 0x0, 0x100, BIT(3), 0, 0);
  1157. static SPRD_SC_GATE_CLK(agcp_uart_eb, "agcp-uart-eb", "aon-apb",
  1158. 0x0, 0x100, BIT(4), 0, 0);
  1159. static SPRD_SC_GATE_CLK(agcp_dmacp_eb, "agcp-dmacp-eb", "aon-apb",
  1160. 0x0, 0x100, BIT(5), 0, 0);
  1161. static SPRD_SC_GATE_CLK(agcp_dmaap_eb, "agcp-dmaap-eb", "aon-apb",
  1162. 0x0, 0x100, BIT(6), 0, 0);
  1163. static SPRD_SC_GATE_CLK(agcp_arc48k_eb, "agcp-arc48k-eb", "aon-apb",
  1164. 0x0, 0x100, BIT(10), 0, 0);
  1165. static SPRD_SC_GATE_CLK(agcp_src44p1k_eb, "agcp-src44p1k-eb", "aon-apb",
  1166. 0x0, 0x100, BIT(11), 0, 0);
  1167. static SPRD_SC_GATE_CLK(agcp_mcdt_eb, "agcp-mcdt-eb", "aon-apb",
  1168. 0x0, 0x100, BIT(12), 0, 0);
  1169. static SPRD_SC_GATE_CLK(agcp_vbcifd_eb, "agcp-vbcifd-eb", "aon-apb",
  1170. 0x0, 0x100, BIT(13), 0, 0);
  1171. static SPRD_SC_GATE_CLK(agcp_vbc_eb, "agcp-vbc-eb", "aon-apb",
  1172. 0x0, 0x100, BIT(14), 0, 0);
  1173. static SPRD_SC_GATE_CLK(agcp_spinlock_eb, "agcp-spinlock-eb", "aon-apb",
  1174. 0x0, 0x100, BIT(15), 0, 0);
  1175. static SPRD_SC_GATE_CLK(agcp_icu_eb, "agcp-icu-eb", "aon-apb",
  1176. 0x0, 0x100, BIT(16), CLK_IGNORE_UNUSED, 0);
  1177. static SPRD_SC_GATE_CLK(agcp_ap_ashb_eb, "agcp-ap-ashb-eb", "aon-apb",
  1178. 0x0, 0x100, BIT(17), 0, 0);
  1179. static SPRD_SC_GATE_CLK(agcp_cp_ashb_eb, "agcp-cp-ashb-eb", "aon-apb",
  1180. 0x0, 0x100, BIT(18), 0, 0);
  1181. static SPRD_SC_GATE_CLK(agcp_aud_eb, "agcp-aud-eb", "aon-apb",
  1182. 0x0, 0x100, BIT(19), 0, 0);
  1183. static SPRD_SC_GATE_CLK(agcp_audif_eb, "agcp-audif-eb", "aon-apb",
  1184. 0x0, 0x100, BIT(20), 0, 0);
  1185. static struct sprd_clk_common *sc9860_agcp_gate[] = {
  1186. /* address base is 0x415e0000 */
  1187. &agcp_iis0_eb.common,
  1188. &agcp_iis1_eb.common,
  1189. &agcp_iis2_eb.common,
  1190. &agcp_iis3_eb.common,
  1191. &agcp_uart_eb.common,
  1192. &agcp_dmacp_eb.common,
  1193. &agcp_dmaap_eb.common,
  1194. &agcp_arc48k_eb.common,
  1195. &agcp_src44p1k_eb.common,
  1196. &agcp_mcdt_eb.common,
  1197. &agcp_vbcifd_eb.common,
  1198. &agcp_vbc_eb.common,
  1199. &agcp_spinlock_eb.common,
  1200. &agcp_icu_eb.common,
  1201. &agcp_ap_ashb_eb.common,
  1202. &agcp_cp_ashb_eb.common,
  1203. &agcp_aud_eb.common,
  1204. &agcp_audif_eb.common,
  1205. };
  1206. static struct clk_hw_onecell_data sc9860_agcp_gate_hws = {
  1207. .hws = {
  1208. [CLK_AGCP_IIS0_EB] = &agcp_iis0_eb.common.hw,
  1209. [CLK_AGCP_IIS1_EB] = &agcp_iis1_eb.common.hw,
  1210. [CLK_AGCP_IIS2_EB] = &agcp_iis2_eb.common.hw,
  1211. [CLK_AGCP_IIS3_EB] = &agcp_iis3_eb.common.hw,
  1212. [CLK_AGCP_UART_EB] = &agcp_uart_eb.common.hw,
  1213. [CLK_AGCP_DMACP_EB] = &agcp_dmacp_eb.common.hw,
  1214. [CLK_AGCP_DMAAP_EB] = &agcp_dmaap_eb.common.hw,
  1215. [CLK_AGCP_ARC48K_EB] = &agcp_arc48k_eb.common.hw,
  1216. [CLK_AGCP_SRC44P1K_EB] = &agcp_src44p1k_eb.common.hw,
  1217. [CLK_AGCP_MCDT_EB] = &agcp_mcdt_eb.common.hw,
  1218. [CLK_AGCP_VBCIFD_EB] = &agcp_vbcifd_eb.common.hw,
  1219. [CLK_AGCP_VBC_EB] = &agcp_vbc_eb.common.hw,
  1220. [CLK_AGCP_SPINLOCK_EB] = &agcp_spinlock_eb.common.hw,
  1221. [CLK_AGCP_ICU_EB] = &agcp_icu_eb.common.hw,
  1222. [CLK_AGCP_AP_ASHB_EB] = &agcp_ap_ashb_eb.common.hw,
  1223. [CLK_AGCP_CP_ASHB_EB] = &agcp_cp_ashb_eb.common.hw,
  1224. [CLK_AGCP_AUD_EB] = &agcp_aud_eb.common.hw,
  1225. [CLK_AGCP_AUDIF_EB] = &agcp_audif_eb.common.hw,
  1226. },
  1227. .num = CLK_AGCP_GATE_NUM,
  1228. };
  1229. static const struct sprd_clk_desc sc9860_agcp_gate_desc = {
  1230. .clk_clks = sc9860_agcp_gate,
  1231. .num_clk_clks = ARRAY_SIZE(sc9860_agcp_gate),
  1232. .hw_clks = &sc9860_agcp_gate_hws,
  1233. };
  1234. static const char * const gpu_parents[] = { "twpll-512m",
  1235. "twpll-768m",
  1236. "gpll" };
  1237. static SPRD_COMP_CLK(gpu_clk, "gpu", gpu_parents, 0x20,
  1238. 0, 2, 8, 4, 0);
  1239. static struct sprd_clk_common *sc9860_gpu_clk[] = {
  1240. /* address base is 0x60200000 */
  1241. &gpu_clk.common,
  1242. };
  1243. static struct clk_hw_onecell_data sc9860_gpu_clk_hws = {
  1244. .hws = {
  1245. [CLK_GPU] = &gpu_clk.common.hw,
  1246. },
  1247. .num = CLK_GPU_NUM,
  1248. };
  1249. static const struct sprd_clk_desc sc9860_gpu_clk_desc = {
  1250. .clk_clks = sc9860_gpu_clk,
  1251. .num_clk_clks = ARRAY_SIZE(sc9860_gpu_clk),
  1252. .hw_clks = &sc9860_gpu_clk_hws,
  1253. };
  1254. static const char * const ahb_parents[] = { "ext-26m", "twpll-96m",
  1255. "twpll-128m", "twpll-153m6" };
  1256. static SPRD_MUX_CLK(ahb_vsp, "ahb-vsp", ahb_parents, 0x20,
  1257. 0, 2, SC9860_MUX_FLAG);
  1258. static const char * const vsp_parents[] = { "twpll-76m8", "twpll-128m",
  1259. "twpll-256m", "twpll-307m2",
  1260. "twpll-384m" };
  1261. static SPRD_COMP_CLK(vsp_clk, "vsp", vsp_parents, 0x24, 0, 3, 8, 2, 0);
  1262. static const char * const dispc_parents[] = { "twpll-76m8", "twpll-128m",
  1263. "twpll-256m", "twpll-307m2" };
  1264. static SPRD_COMP_CLK(vsp_enc, "vsp-enc", dispc_parents, 0x28, 0, 2, 8, 2, 0);
  1265. static const char * const vpp_parents[] = { "twpll-96m", "twpll-153m6",
  1266. "twpll-192m", "twpll-256m" };
  1267. static SPRD_MUX_CLK(vpp_clk, "vpp", vpp_parents, 0x2c,
  1268. 0, 2, SC9860_MUX_FLAG);
  1269. static const char * const vsp_26m_parents[] = { "ext-26m" };
  1270. static SPRD_MUX_CLK(vsp_26m, "vsp-26m", vsp_26m_parents, 0x30,
  1271. 0, 1, SC9860_MUX_FLAG);
  1272. static struct sprd_clk_common *sc9860_vsp_clk[] = {
  1273. /* address base is 0x61000000 */
  1274. &ahb_vsp.common,
  1275. &vsp_clk.common,
  1276. &vsp_enc.common,
  1277. &vpp_clk.common,
  1278. &vsp_26m.common,
  1279. };
  1280. static struct clk_hw_onecell_data sc9860_vsp_clk_hws = {
  1281. .hws = {
  1282. [CLK_AHB_VSP] = &ahb_vsp.common.hw,
  1283. [CLK_VSP] = &vsp_clk.common.hw,
  1284. [CLK_VSP_ENC] = &vsp_enc.common.hw,
  1285. [CLK_VPP] = &vpp_clk.common.hw,
  1286. [CLK_VSP_26M] = &vsp_26m.common.hw,
  1287. },
  1288. .num = CLK_VSP_NUM,
  1289. };
  1290. static const struct sprd_clk_desc sc9860_vsp_clk_desc = {
  1291. .clk_clks = sc9860_vsp_clk,
  1292. .num_clk_clks = ARRAY_SIZE(sc9860_vsp_clk),
  1293. .hw_clks = &sc9860_vsp_clk_hws,
  1294. };
  1295. static SPRD_SC_GATE_CLK(vsp_dec_eb, "vsp-dec-eb", "ahb-vsp", 0x0,
  1296. 0x1000, BIT(0), 0, 0);
  1297. static SPRD_SC_GATE_CLK(vsp_ckg_eb, "vsp-ckg-eb", "ahb-vsp", 0x0,
  1298. 0x1000, BIT(1), 0, 0);
  1299. static SPRD_SC_GATE_CLK(vsp_mmu_eb, "vsp-mmu-eb", "ahb-vsp", 0x0,
  1300. 0x1000, BIT(2), 0, 0);
  1301. static SPRD_SC_GATE_CLK(vsp_enc_eb, "vsp-enc-eb", "ahb-vsp", 0x0,
  1302. 0x1000, BIT(3), 0, 0);
  1303. static SPRD_SC_GATE_CLK(vpp_eb, "vpp-eb", "ahb-vsp", 0x0,
  1304. 0x1000, BIT(4), 0, 0);
  1305. static SPRD_SC_GATE_CLK(vsp_26m_eb, "vsp-26m-eb", "ahb-vsp", 0x0,
  1306. 0x1000, BIT(5), 0, 0);
  1307. static SPRD_GATE_CLK(vsp_axi_gate, "vsp-axi-gate", "ahb-vsp", 0x8,
  1308. BIT(0), 0, 0);
  1309. static SPRD_GATE_CLK(vsp_enc_gate, "vsp-enc-gate", "ahb-vsp", 0x8,
  1310. BIT(1), 0, 0);
  1311. static SPRD_GATE_CLK(vpp_axi_gate, "vpp-axi-gate", "ahb-vsp", 0x8,
  1312. BIT(2), 0, 0);
  1313. static SPRD_GATE_CLK(vsp_bm_gate, "vsp-bm-gate", "ahb-vsp", 0x8,
  1314. BIT(8), 0, 0);
  1315. static SPRD_GATE_CLK(vsp_enc_bm_gate, "vsp-enc-bm-gate", "ahb-vsp", 0x8,
  1316. BIT(9), 0, 0);
  1317. static SPRD_GATE_CLK(vpp_bm_gate, "vpp-bm-gate", "ahb-vsp", 0x8,
  1318. BIT(10), 0, 0);
  1319. static struct sprd_clk_common *sc9860_vsp_gate[] = {
  1320. /* address base is 0x61100000 */
  1321. &vsp_dec_eb.common,
  1322. &vsp_ckg_eb.common,
  1323. &vsp_mmu_eb.common,
  1324. &vsp_enc_eb.common,
  1325. &vpp_eb.common,
  1326. &vsp_26m_eb.common,
  1327. &vsp_axi_gate.common,
  1328. &vsp_enc_gate.common,
  1329. &vpp_axi_gate.common,
  1330. &vsp_bm_gate.common,
  1331. &vsp_enc_bm_gate.common,
  1332. &vpp_bm_gate.common,
  1333. };
  1334. static struct clk_hw_onecell_data sc9860_vsp_gate_hws = {
  1335. .hws = {
  1336. [CLK_VSP_DEC_EB] = &vsp_dec_eb.common.hw,
  1337. [CLK_VSP_CKG_EB] = &vsp_ckg_eb.common.hw,
  1338. [CLK_VSP_MMU_EB] = &vsp_mmu_eb.common.hw,
  1339. [CLK_VSP_ENC_EB] = &vsp_enc_eb.common.hw,
  1340. [CLK_VPP_EB] = &vpp_eb.common.hw,
  1341. [CLK_VSP_26M_EB] = &vsp_26m_eb.common.hw,
  1342. [CLK_VSP_AXI_GATE] = &vsp_axi_gate.common.hw,
  1343. [CLK_VSP_ENC_GATE] = &vsp_enc_gate.common.hw,
  1344. [CLK_VPP_AXI_GATE] = &vpp_axi_gate.common.hw,
  1345. [CLK_VSP_BM_GATE] = &vsp_bm_gate.common.hw,
  1346. [CLK_VSP_ENC_BM_GATE] = &vsp_enc_bm_gate.common.hw,
  1347. [CLK_VPP_BM_GATE] = &vpp_bm_gate.common.hw,
  1348. },
  1349. .num = CLK_VSP_GATE_NUM,
  1350. };
  1351. static const struct sprd_clk_desc sc9860_vsp_gate_desc = {
  1352. .clk_clks = sc9860_vsp_gate,
  1353. .num_clk_clks = ARRAY_SIZE(sc9860_vsp_gate),
  1354. .hw_clks = &sc9860_vsp_gate_hws,
  1355. };
  1356. static SPRD_MUX_CLK(ahb_cam, "ahb-cam", ahb_parents, 0x20,
  1357. 0, 2, SC9860_MUX_FLAG);
  1358. static const char * const sensor_parents[] = { "ext-26m", "twpll-48m",
  1359. "twpll-76m8", "twpll-96m" };
  1360. static SPRD_COMP_CLK(sensor0_clk, "sensor0", sensor_parents, 0x24,
  1361. 0, 2, 8, 3, 0);
  1362. static SPRD_COMP_CLK(sensor1_clk, "sensor1", sensor_parents, 0x28,
  1363. 0, 2, 8, 3, 0);
  1364. static SPRD_COMP_CLK(sensor2_clk, "sensor2", sensor_parents, 0x2c,
  1365. 0, 2, 8, 3, 0);
  1366. static SPRD_GATE_CLK(mipi_csi0_eb, "mipi-csi0-eb", "ahb-cam", 0x4c,
  1367. BIT(16), 0, 0);
  1368. static SPRD_GATE_CLK(mipi_csi1_eb, "mipi-csi1-eb", "ahb-cam", 0x50,
  1369. BIT(16), 0, 0);
  1370. static struct sprd_clk_common *sc9860_cam_clk[] = {
  1371. /* address base is 0x62000000 */
  1372. &ahb_cam.common,
  1373. &sensor0_clk.common,
  1374. &sensor1_clk.common,
  1375. &sensor2_clk.common,
  1376. &mipi_csi0_eb.common,
  1377. &mipi_csi1_eb.common,
  1378. };
  1379. static struct clk_hw_onecell_data sc9860_cam_clk_hws = {
  1380. .hws = {
  1381. [CLK_AHB_CAM] = &ahb_cam.common.hw,
  1382. [CLK_SENSOR0] = &sensor0_clk.common.hw,
  1383. [CLK_SENSOR1] = &sensor1_clk.common.hw,
  1384. [CLK_SENSOR2] = &sensor2_clk.common.hw,
  1385. [CLK_MIPI_CSI0_EB] = &mipi_csi0_eb.common.hw,
  1386. [CLK_MIPI_CSI1_EB] = &mipi_csi1_eb.common.hw,
  1387. },
  1388. .num = CLK_CAM_NUM,
  1389. };
  1390. static const struct sprd_clk_desc sc9860_cam_clk_desc = {
  1391. .clk_clks = sc9860_cam_clk,
  1392. .num_clk_clks = ARRAY_SIZE(sc9860_cam_clk),
  1393. .hw_clks = &sc9860_cam_clk_hws,
  1394. };
  1395. static SPRD_SC_GATE_CLK(dcam0_eb, "dcam0-eb", "ahb-cam", 0x0,
  1396. 0x1000, BIT(0), 0, 0);
  1397. static SPRD_SC_GATE_CLK(dcam1_eb, "dcam1-eb", "ahb-cam", 0x0,
  1398. 0x1000, BIT(1), 0, 0);
  1399. static SPRD_SC_GATE_CLK(isp0_eb, "isp0-eb", "ahb-cam", 0x0,
  1400. 0x1000, BIT(2), 0, 0);
  1401. static SPRD_SC_GATE_CLK(csi0_eb, "csi0-eb", "ahb-cam", 0x0,
  1402. 0x1000, BIT(3), 0, 0);
  1403. static SPRD_SC_GATE_CLK(csi1_eb, "csi1-eb", "ahb-cam", 0x0,
  1404. 0x1000, BIT(4), 0, 0);
  1405. static SPRD_SC_GATE_CLK(jpg0_eb, "jpg0-eb", "ahb-cam", 0x0,
  1406. 0x1000, BIT(5), 0, 0);
  1407. static SPRD_SC_GATE_CLK(jpg1_eb, "jpg1-eb", "ahb-cam", 0x0,
  1408. 0x1000, BIT(6), 0, 0);
  1409. static SPRD_SC_GATE_CLK(cam_ckg_eb, "cam-ckg-eb", "ahb-cam", 0x0,
  1410. 0x1000, BIT(7), 0, 0);
  1411. static SPRD_SC_GATE_CLK(cam_mmu_eb, "cam-mmu-eb", "ahb-cam", 0x0,
  1412. 0x1000, BIT(8), 0, 0);
  1413. static SPRD_SC_GATE_CLK(isp1_eb, "isp1-eb", "ahb-cam", 0x0,
  1414. 0x1000, BIT(9), 0, 0);
  1415. static SPRD_SC_GATE_CLK(cpp_eb, "cpp-eb", "ahb-cam", 0x0,
  1416. 0x1000, BIT(10), 0, 0);
  1417. static SPRD_SC_GATE_CLK(mmu_pf_eb, "mmu-pf-eb", "ahb-cam", 0x0,
  1418. 0x1000, BIT(11), 0, 0);
  1419. static SPRD_SC_GATE_CLK(isp2_eb, "isp2-eb", "ahb-cam", 0x0,
  1420. 0x1000, BIT(12), 0, 0);
  1421. static SPRD_SC_GATE_CLK(dcam2isp_if_eb, "dcam2isp-if-eb", "ahb-cam", 0x0,
  1422. 0x1000, BIT(13), 0, 0);
  1423. static SPRD_SC_GATE_CLK(isp2dcam_if_eb, "isp2dcam-if-eb", "ahb-cam", 0x0,
  1424. 0x1000, BIT(14), 0, 0);
  1425. static SPRD_SC_GATE_CLK(isp_lclk_eb, "isp-lclk-eb", "ahb-cam", 0x0,
  1426. 0x1000, BIT(15), 0, 0);
  1427. static SPRD_SC_GATE_CLK(isp_iclk_eb, "isp-iclk-eb", "ahb-cam", 0x0,
  1428. 0x1000, BIT(16), 0, 0);
  1429. static SPRD_SC_GATE_CLK(isp_mclk_eb, "isp-mclk-eb", "ahb-cam", 0x0,
  1430. 0x1000, BIT(17), 0, 0);
  1431. static SPRD_SC_GATE_CLK(isp_pclk_eb, "isp-pclk-eb", "ahb-cam", 0x0,
  1432. 0x1000, BIT(18), 0, 0);
  1433. static SPRD_SC_GATE_CLK(isp_isp2dcam_eb, "isp-isp2dcam-eb", "ahb-cam", 0x0,
  1434. 0x1000, BIT(19), 0, 0);
  1435. static SPRD_SC_GATE_CLK(dcam0_if_eb, "dcam0-if-eb", "ahb-cam", 0x0,
  1436. 0x1000, BIT(20), 0, 0);
  1437. static SPRD_SC_GATE_CLK(clk26m_if_eb, "clk26m-if-eb", "ahb-cam", 0x0,
  1438. 0x1000, BIT(21), 0, 0);
  1439. static SPRD_GATE_CLK(cphy0_gate, "cphy0-gate", "ahb-cam", 0x8,
  1440. BIT(0), 0, 0);
  1441. static SPRD_GATE_CLK(mipi_csi0_gate, "mipi-csi0-gate", "ahb-cam", 0x8,
  1442. BIT(1), 0, 0);
  1443. static SPRD_GATE_CLK(cphy1_gate, "cphy1-gate", "ahb-cam", 0x8,
  1444. BIT(2), 0, 0);
  1445. static SPRD_GATE_CLK(mipi_csi1, "mipi-csi1", "ahb-cam", 0x8,
  1446. BIT(3), 0, 0);
  1447. static SPRD_GATE_CLK(dcam0_axi_gate, "dcam0-axi-gate", "ahb-cam", 0x8,
  1448. BIT(4), 0, 0);
  1449. static SPRD_GATE_CLK(dcam1_axi_gate, "dcam1-axi-gate", "ahb-cam", 0x8,
  1450. BIT(5), 0, 0);
  1451. static SPRD_GATE_CLK(sensor0_gate, "sensor0-gate", "ahb-cam", 0x8,
  1452. BIT(6), 0, 0);
  1453. static SPRD_GATE_CLK(sensor1_gate, "sensor1-gate", "ahb-cam", 0x8,
  1454. BIT(7), 0, 0);
  1455. static SPRD_GATE_CLK(jpg0_axi_gate, "jpg0-axi-gate", "ahb-cam", 0x8,
  1456. BIT(8), 0, 0);
  1457. static SPRD_GATE_CLK(gpg1_axi_gate, "gpg1-axi-gate", "ahb-cam", 0x8,
  1458. BIT(9), 0, 0);
  1459. static SPRD_GATE_CLK(isp0_axi_gate, "isp0-axi-gate", "ahb-cam", 0x8,
  1460. BIT(10), 0, 0);
  1461. static SPRD_GATE_CLK(isp1_axi_gate, "isp1-axi-gate", "ahb-cam", 0x8,
  1462. BIT(11), 0, 0);
  1463. static SPRD_GATE_CLK(isp2_axi_gate, "isp2-axi-gate", "ahb-cam", 0x8,
  1464. BIT(12), 0, 0);
  1465. static SPRD_GATE_CLK(cpp_axi_gate, "cpp-axi-gate", "ahb-cam", 0x8,
  1466. BIT(13), 0, 0);
  1467. static SPRD_GATE_CLK(d0_if_axi_gate, "d0-if-axi-gate", "ahb-cam", 0x8,
  1468. BIT(14), 0, 0);
  1469. static SPRD_GATE_CLK(d2i_if_axi_gate, "d2i-if-axi-gate", "ahb-cam", 0x8,
  1470. BIT(15), 0, 0);
  1471. static SPRD_GATE_CLK(i2d_if_axi_gate, "i2d-if-axi-gate", "ahb-cam", 0x8,
  1472. BIT(16), 0, 0);
  1473. static SPRD_GATE_CLK(spare_axi_gate, "spare-axi-gate", "ahb-cam", 0x8,
  1474. BIT(17), 0, 0);
  1475. static SPRD_GATE_CLK(sensor2_gate, "sensor2-gate", "ahb-cam", 0x8,
  1476. BIT(18), 0, 0);
  1477. static SPRD_SC_GATE_CLK(d0if_in_d_en, "d0if-in-d-en", "ahb-cam", 0x28,
  1478. 0x1000, BIT(0), 0, 0);
  1479. static SPRD_SC_GATE_CLK(d1if_in_d_en, "d1if-in-d-en", "ahb-cam", 0x28,
  1480. 0x1000, BIT(1), 0, 0);
  1481. static SPRD_SC_GATE_CLK(d0if_in_d2i_en, "d0if-in-d2i-en", "ahb-cam", 0x28,
  1482. 0x1000, BIT(2), 0, 0);
  1483. static SPRD_SC_GATE_CLK(d1if_in_d2i_en, "d1if-in-d2i-en", "ahb-cam", 0x28,
  1484. 0x1000, BIT(3), 0, 0);
  1485. static SPRD_SC_GATE_CLK(ia_in_d2i_en, "ia-in-d2i-en", "ahb-cam", 0x28,
  1486. 0x1000, BIT(4), 0, 0);
  1487. static SPRD_SC_GATE_CLK(ib_in_d2i_en, "ib-in-d2i-en", "ahb-cam", 0x28,
  1488. 0x1000, BIT(5), 0, 0);
  1489. static SPRD_SC_GATE_CLK(ic_in_d2i_en, "ic-in-d2i-en", "ahb-cam", 0x28,
  1490. 0x1000, BIT(6), 0, 0);
  1491. static SPRD_SC_GATE_CLK(ia_in_i_en, "ia-in-i-en", "ahb-cam", 0x28,
  1492. 0x1000, BIT(7), 0, 0);
  1493. static SPRD_SC_GATE_CLK(ib_in_i_en, "ib-in-i-en", "ahb-cam", 0x28,
  1494. 0x1000, BIT(8), 0, 0);
  1495. static SPRD_SC_GATE_CLK(ic_in_i_en, "ic-in-i-en", "ahb-cam", 0x28,
  1496. 0x1000, BIT(9), 0, 0);
  1497. static struct sprd_clk_common *sc9860_cam_gate[] = {
  1498. /* address base is 0x62100000 */
  1499. &dcam0_eb.common,
  1500. &dcam1_eb.common,
  1501. &isp0_eb.common,
  1502. &csi0_eb.common,
  1503. &csi1_eb.common,
  1504. &jpg0_eb.common,
  1505. &jpg1_eb.common,
  1506. &cam_ckg_eb.common,
  1507. &cam_mmu_eb.common,
  1508. &isp1_eb.common,
  1509. &cpp_eb.common,
  1510. &mmu_pf_eb.common,
  1511. &isp2_eb.common,
  1512. &dcam2isp_if_eb.common,
  1513. &isp2dcam_if_eb.common,
  1514. &isp_lclk_eb.common,
  1515. &isp_iclk_eb.common,
  1516. &isp_mclk_eb.common,
  1517. &isp_pclk_eb.common,
  1518. &isp_isp2dcam_eb.common,
  1519. &dcam0_if_eb.common,
  1520. &clk26m_if_eb.common,
  1521. &cphy0_gate.common,
  1522. &mipi_csi0_gate.common,
  1523. &cphy1_gate.common,
  1524. &mipi_csi1.common,
  1525. &dcam0_axi_gate.common,
  1526. &dcam1_axi_gate.common,
  1527. &sensor0_gate.common,
  1528. &sensor1_gate.common,
  1529. &jpg0_axi_gate.common,
  1530. &gpg1_axi_gate.common,
  1531. &isp0_axi_gate.common,
  1532. &isp1_axi_gate.common,
  1533. &isp2_axi_gate.common,
  1534. &cpp_axi_gate.common,
  1535. &d0_if_axi_gate.common,
  1536. &d2i_if_axi_gate.common,
  1537. &i2d_if_axi_gate.common,
  1538. &spare_axi_gate.common,
  1539. &sensor2_gate.common,
  1540. &d0if_in_d_en.common,
  1541. &d1if_in_d_en.common,
  1542. &d0if_in_d2i_en.common,
  1543. &d1if_in_d2i_en.common,
  1544. &ia_in_d2i_en.common,
  1545. &ib_in_d2i_en.common,
  1546. &ic_in_d2i_en.common,
  1547. &ia_in_i_en.common,
  1548. &ib_in_i_en.common,
  1549. &ic_in_i_en.common,
  1550. };
  1551. static struct clk_hw_onecell_data sc9860_cam_gate_hws = {
  1552. .hws = {
  1553. [CLK_DCAM0_EB] = &dcam0_eb.common.hw,
  1554. [CLK_DCAM1_EB] = &dcam1_eb.common.hw,
  1555. [CLK_ISP0_EB] = &isp0_eb.common.hw,
  1556. [CLK_CSI0_EB] = &csi0_eb.common.hw,
  1557. [CLK_CSI1_EB] = &csi1_eb.common.hw,
  1558. [CLK_JPG0_EB] = &jpg0_eb.common.hw,
  1559. [CLK_JPG1_EB] = &jpg1_eb.common.hw,
  1560. [CLK_CAM_CKG_EB] = &cam_ckg_eb.common.hw,
  1561. [CLK_CAM_MMU_EB] = &cam_mmu_eb.common.hw,
  1562. [CLK_ISP1_EB] = &isp1_eb.common.hw,
  1563. [CLK_CPP_EB] = &cpp_eb.common.hw,
  1564. [CLK_MMU_PF_EB] = &mmu_pf_eb.common.hw,
  1565. [CLK_ISP2_EB] = &isp2_eb.common.hw,
  1566. [CLK_DCAM2ISP_IF_EB] = &dcam2isp_if_eb.common.hw,
  1567. [CLK_ISP2DCAM_IF_EB] = &isp2dcam_if_eb.common.hw,
  1568. [CLK_ISP_LCLK_EB] = &isp_lclk_eb.common.hw,
  1569. [CLK_ISP_ICLK_EB] = &isp_iclk_eb.common.hw,
  1570. [CLK_ISP_MCLK_EB] = &isp_mclk_eb.common.hw,
  1571. [CLK_ISP_PCLK_EB] = &isp_pclk_eb.common.hw,
  1572. [CLK_ISP_ISP2DCAM_EB] = &isp_isp2dcam_eb.common.hw,
  1573. [CLK_DCAM0_IF_EB] = &dcam0_if_eb.common.hw,
  1574. [CLK_CLK26M_IF_EB] = &clk26m_if_eb.common.hw,
  1575. [CLK_CPHY0_GATE] = &cphy0_gate.common.hw,
  1576. [CLK_MIPI_CSI0_GATE] = &mipi_csi0_gate.common.hw,
  1577. [CLK_CPHY1_GATE] = &cphy1_gate.common.hw,
  1578. [CLK_MIPI_CSI1] = &mipi_csi1.common.hw,
  1579. [CLK_DCAM0_AXI_GATE] = &dcam0_axi_gate.common.hw,
  1580. [CLK_DCAM1_AXI_GATE] = &dcam1_axi_gate.common.hw,
  1581. [CLK_SENSOR0_GATE] = &sensor0_gate.common.hw,
  1582. [CLK_SENSOR1_GATE] = &sensor1_gate.common.hw,
  1583. [CLK_JPG0_AXI_GATE] = &jpg0_axi_gate.common.hw,
  1584. [CLK_GPG1_AXI_GATE] = &gpg1_axi_gate.common.hw,
  1585. [CLK_ISP0_AXI_GATE] = &isp0_axi_gate.common.hw,
  1586. [CLK_ISP1_AXI_GATE] = &isp1_axi_gate.common.hw,
  1587. [CLK_ISP2_AXI_GATE] = &isp2_axi_gate.common.hw,
  1588. [CLK_CPP_AXI_GATE] = &cpp_axi_gate.common.hw,
  1589. [CLK_D0_IF_AXI_GATE] = &d0_if_axi_gate.common.hw,
  1590. [CLK_D2I_IF_AXI_GATE] = &d2i_if_axi_gate.common.hw,
  1591. [CLK_I2D_IF_AXI_GATE] = &i2d_if_axi_gate.common.hw,
  1592. [CLK_SPARE_AXI_GATE] = &spare_axi_gate.common.hw,
  1593. [CLK_SENSOR2_GATE] = &sensor2_gate.common.hw,
  1594. [CLK_D0IF_IN_D_EN] = &d0if_in_d_en.common.hw,
  1595. [CLK_D1IF_IN_D_EN] = &d1if_in_d_en.common.hw,
  1596. [CLK_D0IF_IN_D2I_EN] = &d0if_in_d2i_en.common.hw,
  1597. [CLK_D1IF_IN_D2I_EN] = &d1if_in_d2i_en.common.hw,
  1598. [CLK_IA_IN_D2I_EN] = &ia_in_d2i_en.common.hw,
  1599. [CLK_IB_IN_D2I_EN] = &ib_in_d2i_en.common.hw,
  1600. [CLK_IC_IN_D2I_EN] = &ic_in_d2i_en.common.hw,
  1601. [CLK_IA_IN_I_EN] = &ia_in_i_en.common.hw,
  1602. [CLK_IB_IN_I_EN] = &ib_in_i_en.common.hw,
  1603. [CLK_IC_IN_I_EN] = &ic_in_i_en.common.hw,
  1604. },
  1605. .num = CLK_CAM_GATE_NUM,
  1606. };
  1607. static const struct sprd_clk_desc sc9860_cam_gate_desc = {
  1608. .clk_clks = sc9860_cam_gate,
  1609. .num_clk_clks = ARRAY_SIZE(sc9860_cam_gate),
  1610. .hw_clks = &sc9860_cam_gate_hws,
  1611. };
  1612. static SPRD_MUX_CLK(ahb_disp, "ahb-disp", ahb_parents, 0x20,
  1613. 0, 2, SC9860_MUX_FLAG);
  1614. static SPRD_COMP_CLK(dispc0_dpi, "dispc0-dpi", dispc_parents, 0x34,
  1615. 0, 2, 8, 2, 0);
  1616. static SPRD_COMP_CLK(dispc1_dpi, "dispc1-dpi", dispc_parents, 0x40,
  1617. 0, 2, 8, 2, 0);
  1618. static struct sprd_clk_common *sc9860_disp_clk[] = {
  1619. /* address base is 0x63000000 */
  1620. &ahb_disp.common,
  1621. &dispc0_dpi.common,
  1622. &dispc1_dpi.common,
  1623. };
  1624. static struct clk_hw_onecell_data sc9860_disp_clk_hws = {
  1625. .hws = {
  1626. [CLK_AHB_DISP] = &ahb_disp.common.hw,
  1627. [CLK_DISPC0_DPI] = &dispc0_dpi.common.hw,
  1628. [CLK_DISPC1_DPI] = &dispc1_dpi.common.hw,
  1629. },
  1630. .num = CLK_DISP_NUM,
  1631. };
  1632. static const struct sprd_clk_desc sc9860_disp_clk_desc = {
  1633. .clk_clks = sc9860_disp_clk,
  1634. .num_clk_clks = ARRAY_SIZE(sc9860_disp_clk),
  1635. .hw_clks = &sc9860_disp_clk_hws,
  1636. };
  1637. static SPRD_SC_GATE_CLK(dispc0_eb, "dispc0-eb", "ahb-disp", 0x0,
  1638. 0x1000, BIT(0), 0, 0);
  1639. static SPRD_SC_GATE_CLK(dispc1_eb, "dispc1-eb", "ahb-disp", 0x0,
  1640. 0x1000, BIT(1), 0, 0);
  1641. static SPRD_SC_GATE_CLK(dispc_mmu_eb, "dispc-mmu-eb", "ahb-disp", 0x0,
  1642. 0x1000, BIT(2), 0, 0);
  1643. static SPRD_SC_GATE_CLK(gsp0_eb, "gsp0-eb", "ahb-disp", 0x0,
  1644. 0x1000, BIT(3), 0, 0);
  1645. static SPRD_SC_GATE_CLK(gsp1_eb, "gsp1-eb", "ahb-disp", 0x0,
  1646. 0x1000, BIT(4), 0, 0);
  1647. static SPRD_SC_GATE_CLK(gsp0_mmu_eb, "gsp0-mmu-eb", "ahb-disp", 0x0,
  1648. 0x1000, BIT(5), 0, 0);
  1649. static SPRD_SC_GATE_CLK(gsp1_mmu_eb, "gsp1-mmu-eb", "ahb-disp", 0x0,
  1650. 0x1000, BIT(6), 0, 0);
  1651. static SPRD_SC_GATE_CLK(dsi0_eb, "dsi0-eb", "ahb-disp", 0x0,
  1652. 0x1000, BIT(7), 0, 0);
  1653. static SPRD_SC_GATE_CLK(dsi1_eb, "dsi1-eb", "ahb-disp", 0x0,
  1654. 0x1000, BIT(8), 0, 0);
  1655. static SPRD_SC_GATE_CLK(disp_ckg_eb, "disp-ckg-eb", "ahb-disp", 0x0,
  1656. 0x1000, BIT(9), 0, 0);
  1657. static SPRD_SC_GATE_CLK(disp_gpu_eb, "disp-gpu-eb", "ahb-disp", 0x0,
  1658. 0x1000, BIT(10), 0, 0);
  1659. static SPRD_SC_GATE_CLK(gpu_mtx_eb, "gpu-mtx-eb", "ahb-disp", 0x0,
  1660. 0x1000, BIT(13), 0, 0);
  1661. static SPRD_SC_GATE_CLK(gsp_mtx_eb, "gsp-mtx-eb", "ahb-disp", 0x0,
  1662. 0x1000, BIT(14), 0, 0);
  1663. static SPRD_SC_GATE_CLK(tmc_mtx_eb, "tmc-mtx-eb", "ahb-disp", 0x0,
  1664. 0x1000, BIT(15), 0, 0);
  1665. static SPRD_SC_GATE_CLK(dispc_mtx_eb, "dispc-mtx-eb", "ahb-disp", 0x0,
  1666. 0x1000, BIT(16), 0, 0);
  1667. static SPRD_GATE_CLK(dphy0_gate, "dphy0-gate", "ahb-disp", 0x8,
  1668. BIT(0), 0, 0);
  1669. static SPRD_GATE_CLK(dphy1_gate, "dphy1-gate", "ahb-disp", 0x8,
  1670. BIT(1), 0, 0);
  1671. static SPRD_GATE_CLK(gsp0_a_gate, "gsp0-a-gate", "ahb-disp", 0x8,
  1672. BIT(2), 0, 0);
  1673. static SPRD_GATE_CLK(gsp1_a_gate, "gsp1-a-gate", "ahb-disp", 0x8,
  1674. BIT(3), 0, 0);
  1675. static SPRD_GATE_CLK(gsp0_f_gate, "gsp0-f-gate", "ahb-disp", 0x8,
  1676. BIT(4), 0, 0);
  1677. static SPRD_GATE_CLK(gsp1_f_gate, "gsp1-f-gate", "ahb-disp", 0x8,
  1678. BIT(5), 0, 0);
  1679. static SPRD_GATE_CLK(d_mtx_f_gate, "d-mtx-f-gate", "ahb-disp", 0x8,
  1680. BIT(6), 0, 0);
  1681. static SPRD_GATE_CLK(d_mtx_a_gate, "d-mtx-a-gate", "ahb-disp", 0x8,
  1682. BIT(7), 0, 0);
  1683. static SPRD_GATE_CLK(d_noc_f_gate, "d-noc-f-gate", "ahb-disp", 0x8,
  1684. BIT(8), 0, 0);
  1685. static SPRD_GATE_CLK(d_noc_a_gate, "d-noc-a-gate", "ahb-disp", 0x8,
  1686. BIT(9), 0, 0);
  1687. static SPRD_GATE_CLK(gsp_mtx_f_gate, "gsp-mtx-f-gate", "ahb-disp", 0x8,
  1688. BIT(10), 0, 0);
  1689. static SPRD_GATE_CLK(gsp_mtx_a_gate, "gsp-mtx-a-gate", "ahb-disp", 0x8,
  1690. BIT(11), 0, 0);
  1691. static SPRD_GATE_CLK(gsp_noc_f_gate, "gsp-noc-f-gate", "ahb-disp", 0x8,
  1692. BIT(12), 0, 0);
  1693. static SPRD_GATE_CLK(gsp_noc_a_gate, "gsp-noc-a-gate", "ahb-disp", 0x8,
  1694. BIT(13), 0, 0);
  1695. static SPRD_GATE_CLK(dispm0idle_gate, "dispm0idle-gate", "ahb-disp", 0x8,
  1696. BIT(14), 0, 0);
  1697. static SPRD_GATE_CLK(gspm0idle_gate, "gspm0idle-gate", "ahb-disp", 0x8,
  1698. BIT(15), 0, 0);
  1699. static struct sprd_clk_common *sc9860_disp_gate[] = {
  1700. /* address base is 0x63100000 */
  1701. &dispc0_eb.common,
  1702. &dispc1_eb.common,
  1703. &dispc_mmu_eb.common,
  1704. &gsp0_eb.common,
  1705. &gsp1_eb.common,
  1706. &gsp0_mmu_eb.common,
  1707. &gsp1_mmu_eb.common,
  1708. &dsi0_eb.common,
  1709. &dsi1_eb.common,
  1710. &disp_ckg_eb.common,
  1711. &disp_gpu_eb.common,
  1712. &gpu_mtx_eb.common,
  1713. &gsp_mtx_eb.common,
  1714. &tmc_mtx_eb.common,
  1715. &dispc_mtx_eb.common,
  1716. &dphy0_gate.common,
  1717. &dphy1_gate.common,
  1718. &gsp0_a_gate.common,
  1719. &gsp1_a_gate.common,
  1720. &gsp0_f_gate.common,
  1721. &gsp1_f_gate.common,
  1722. &d_mtx_f_gate.common,
  1723. &d_mtx_a_gate.common,
  1724. &d_noc_f_gate.common,
  1725. &d_noc_a_gate.common,
  1726. &gsp_mtx_f_gate.common,
  1727. &gsp_mtx_a_gate.common,
  1728. &gsp_noc_f_gate.common,
  1729. &gsp_noc_a_gate.common,
  1730. &dispm0idle_gate.common,
  1731. &gspm0idle_gate.common,
  1732. };
  1733. static struct clk_hw_onecell_data sc9860_disp_gate_hws = {
  1734. .hws = {
  1735. [CLK_DISPC0_EB] = &dispc0_eb.common.hw,
  1736. [CLK_DISPC1_EB] = &dispc1_eb.common.hw,
  1737. [CLK_DISPC_MMU_EB] = &dispc_mmu_eb.common.hw,
  1738. [CLK_GSP0_EB] = &gsp0_eb.common.hw,
  1739. [CLK_GSP1_EB] = &gsp1_eb.common.hw,
  1740. [CLK_GSP0_MMU_EB] = &gsp0_mmu_eb.common.hw,
  1741. [CLK_GSP1_MMU_EB] = &gsp1_mmu_eb.common.hw,
  1742. [CLK_DSI0_EB] = &dsi0_eb.common.hw,
  1743. [CLK_DSI1_EB] = &dsi1_eb.common.hw,
  1744. [CLK_DISP_CKG_EB] = &disp_ckg_eb.common.hw,
  1745. [CLK_DISP_GPU_EB] = &disp_gpu_eb.common.hw,
  1746. [CLK_GPU_MTX_EB] = &gpu_mtx_eb.common.hw,
  1747. [CLK_GSP_MTX_EB] = &gsp_mtx_eb.common.hw,
  1748. [CLK_TMC_MTX_EB] = &tmc_mtx_eb.common.hw,
  1749. [CLK_DISPC_MTX_EB] = &dispc_mtx_eb.common.hw,
  1750. [CLK_DPHY0_GATE] = &dphy0_gate.common.hw,
  1751. [CLK_DPHY1_GATE] = &dphy1_gate.common.hw,
  1752. [CLK_GSP0_A_GATE] = &gsp0_a_gate.common.hw,
  1753. [CLK_GSP1_A_GATE] = &gsp1_a_gate.common.hw,
  1754. [CLK_GSP0_F_GATE] = &gsp0_f_gate.common.hw,
  1755. [CLK_GSP1_F_GATE] = &gsp1_f_gate.common.hw,
  1756. [CLK_D_MTX_F_GATE] = &d_mtx_f_gate.common.hw,
  1757. [CLK_D_MTX_A_GATE] = &d_mtx_a_gate.common.hw,
  1758. [CLK_D_NOC_F_GATE] = &d_noc_f_gate.common.hw,
  1759. [CLK_D_NOC_A_GATE] = &d_noc_a_gate.common.hw,
  1760. [CLK_GSP_MTX_F_GATE] = &gsp_mtx_f_gate.common.hw,
  1761. [CLK_GSP_MTX_A_GATE] = &gsp_mtx_a_gate.common.hw,
  1762. [CLK_GSP_NOC_F_GATE] = &gsp_noc_f_gate.common.hw,
  1763. [CLK_GSP_NOC_A_GATE] = &gsp_noc_a_gate.common.hw,
  1764. [CLK_DISPM0IDLE_GATE] = &dispm0idle_gate.common.hw,
  1765. [CLK_GSPM0IDLE_GATE] = &gspm0idle_gate.common.hw,
  1766. },
  1767. .num = CLK_DISP_GATE_NUM,
  1768. };
  1769. static const struct sprd_clk_desc sc9860_disp_gate_desc = {
  1770. .clk_clks = sc9860_disp_gate,
  1771. .num_clk_clks = ARRAY_SIZE(sc9860_disp_gate),
  1772. .hw_clks = &sc9860_disp_gate_hws,
  1773. };
  1774. static SPRD_SC_GATE_CLK(sim0_eb, "sim0-eb", "ap-apb", 0x0,
  1775. 0x1000, BIT(0), CLK_IGNORE_UNUSED, 0);
  1776. static SPRD_SC_GATE_CLK(iis0_eb, "iis0-eb", "ap-apb", 0x0,
  1777. 0x1000, BIT(1), CLK_IGNORE_UNUSED, 0);
  1778. static SPRD_SC_GATE_CLK(iis1_eb, "iis1-eb", "ap-apb", 0x0,
  1779. 0x1000, BIT(2), CLK_IGNORE_UNUSED, 0);
  1780. static SPRD_SC_GATE_CLK(iis2_eb, "iis2-eb", "ap-apb", 0x0,
  1781. 0x1000, BIT(3), CLK_IGNORE_UNUSED, 0);
  1782. static SPRD_SC_GATE_CLK(iis3_eb, "iis3-eb", "ap-apb", 0x0,
  1783. 0x1000, BIT(4), CLK_IGNORE_UNUSED, 0);
  1784. static SPRD_SC_GATE_CLK(spi0_eb, "spi0-eb", "ap-apb", 0x0,
  1785. 0x1000, BIT(5), CLK_IGNORE_UNUSED, 0);
  1786. static SPRD_SC_GATE_CLK(spi1_eb, "spi1-eb", "ap-apb", 0x0,
  1787. 0x1000, BIT(6), CLK_IGNORE_UNUSED, 0);
  1788. static SPRD_SC_GATE_CLK(spi2_eb, "spi2-eb", "ap-apb", 0x0,
  1789. 0x1000, BIT(7), CLK_IGNORE_UNUSED, 0);
  1790. static SPRD_SC_GATE_CLK(i2c0_eb, "i2c0-eb", "ap-apb", 0x0,
  1791. 0x1000, BIT(8), CLK_IGNORE_UNUSED, 0);
  1792. static SPRD_SC_GATE_CLK(i2c1_eb, "i2c1-eb", "ap-apb", 0x0,
  1793. 0x1000, BIT(9), CLK_IGNORE_UNUSED, 0);
  1794. static SPRD_SC_GATE_CLK(i2c2_eb, "i2c2-eb", "ap-apb", 0x0,
  1795. 0x1000, BIT(10), CLK_IGNORE_UNUSED, 0);
  1796. static SPRD_SC_GATE_CLK(i2c3_eb, "i2c3-eb", "ap-apb", 0x0,
  1797. 0x1000, BIT(11), CLK_IGNORE_UNUSED, 0);
  1798. static SPRD_SC_GATE_CLK(i2c4_eb, "i2c4-eb", "ap-apb", 0x0,
  1799. 0x1000, BIT(12), CLK_IGNORE_UNUSED, 0);
  1800. static SPRD_SC_GATE_CLK(i2c5_eb, "i2c5-eb", "ap-apb", 0x0,
  1801. 0x1000, BIT(13), CLK_IGNORE_UNUSED, 0);
  1802. static SPRD_SC_GATE_CLK(uart0_eb, "uart0-eb", "ap-apb", 0x0,
  1803. 0x1000, BIT(14), CLK_IGNORE_UNUSED, 0);
  1804. static SPRD_SC_GATE_CLK(uart1_eb, "uart1-eb", "ap-apb", 0x0,
  1805. 0x1000, BIT(15), CLK_IGNORE_UNUSED, 0);
  1806. static SPRD_SC_GATE_CLK(uart2_eb, "uart2-eb", "ap-apb", 0x0,
  1807. 0x1000, BIT(16), CLK_IGNORE_UNUSED, 0);
  1808. static SPRD_SC_GATE_CLK(uart3_eb, "uart3-eb", "ap-apb", 0x0,
  1809. 0x1000, BIT(17), CLK_IGNORE_UNUSED, 0);
  1810. static SPRD_SC_GATE_CLK(uart4_eb, "uart4-eb", "ap-apb", 0x0,
  1811. 0x1000, BIT(18), CLK_IGNORE_UNUSED, 0);
  1812. static SPRD_SC_GATE_CLK(ap_ckg_eb, "ap-ckg-eb", "ap-apb", 0x0,
  1813. 0x1000, BIT(19), CLK_IGNORE_UNUSED, 0);
  1814. static SPRD_SC_GATE_CLK(spi3_eb, "spi3-eb", "ap-apb", 0x0,
  1815. 0x1000, BIT(20), CLK_IGNORE_UNUSED, 0);
  1816. static struct sprd_clk_common *sc9860_apapb_gate[] = {
  1817. /* address base is 0x70b00000 */
  1818. &sim0_eb.common,
  1819. &iis0_eb.common,
  1820. &iis1_eb.common,
  1821. &iis2_eb.common,
  1822. &iis3_eb.common,
  1823. &spi0_eb.common,
  1824. &spi1_eb.common,
  1825. &spi2_eb.common,
  1826. &i2c0_eb.common,
  1827. &i2c1_eb.common,
  1828. &i2c2_eb.common,
  1829. &i2c3_eb.common,
  1830. &i2c4_eb.common,
  1831. &i2c5_eb.common,
  1832. &uart0_eb.common,
  1833. &uart1_eb.common,
  1834. &uart2_eb.common,
  1835. &uart3_eb.common,
  1836. &uart4_eb.common,
  1837. &ap_ckg_eb.common,
  1838. &spi3_eb.common,
  1839. };
  1840. static struct clk_hw_onecell_data sc9860_apapb_gate_hws = {
  1841. .hws = {
  1842. [CLK_SIM0_EB] = &sim0_eb.common.hw,
  1843. [CLK_IIS0_EB] = &iis0_eb.common.hw,
  1844. [CLK_IIS1_EB] = &iis1_eb.common.hw,
  1845. [CLK_IIS2_EB] = &iis2_eb.common.hw,
  1846. [CLK_IIS3_EB] = &iis3_eb.common.hw,
  1847. [CLK_SPI0_EB] = &spi0_eb.common.hw,
  1848. [CLK_SPI1_EB] = &spi1_eb.common.hw,
  1849. [CLK_SPI2_EB] = &spi2_eb.common.hw,
  1850. [CLK_I2C0_EB] = &i2c0_eb.common.hw,
  1851. [CLK_I2C1_EB] = &i2c1_eb.common.hw,
  1852. [CLK_I2C2_EB] = &i2c2_eb.common.hw,
  1853. [CLK_I2C3_EB] = &i2c3_eb.common.hw,
  1854. [CLK_I2C4_EB] = &i2c4_eb.common.hw,
  1855. [CLK_I2C5_EB] = &i2c5_eb.common.hw,
  1856. [CLK_UART0_EB] = &uart0_eb.common.hw,
  1857. [CLK_UART1_EB] = &uart1_eb.common.hw,
  1858. [CLK_UART2_EB] = &uart2_eb.common.hw,
  1859. [CLK_UART3_EB] = &uart3_eb.common.hw,
  1860. [CLK_UART4_EB] = &uart4_eb.common.hw,
  1861. [CLK_AP_CKG_EB] = &ap_ckg_eb.common.hw,
  1862. [CLK_SPI3_EB] = &spi3_eb.common.hw,
  1863. },
  1864. .num = CLK_APAPB_GATE_NUM,
  1865. };
  1866. static const struct sprd_clk_desc sc9860_apapb_gate_desc = {
  1867. .clk_clks = sc9860_apapb_gate,
  1868. .num_clk_clks = ARRAY_SIZE(sc9860_apapb_gate),
  1869. .hw_clks = &sc9860_apapb_gate_hws,
  1870. };
  1871. static const struct of_device_id sprd_sc9860_clk_ids[] = {
  1872. { .compatible = "sprd,sc9860-pmu-gate", /* 0x402b */
  1873. .data = &sc9860_pmu_gate_desc },
  1874. { .compatible = "sprd,sc9860-pll", /* 0x4040 */
  1875. .data = &sc9860_pll_desc },
  1876. { .compatible = "sprd,sc9860-ap-clk", /* 0x2000 */
  1877. .data = &sc9860_ap_clk_desc },
  1878. { .compatible = "sprd,sc9860-aon-prediv", /* 0x402d */
  1879. .data = &sc9860_aon_prediv_desc },
  1880. { .compatible = "sprd,sc9860-apahb-gate", /* 0x2021 */
  1881. .data = &sc9860_apahb_gate_desc },
  1882. { .compatible = "sprd,sc9860-aon-gate", /* 0x402e */
  1883. .data = &sc9860_aon_gate_desc },
  1884. { .compatible = "sprd,sc9860-aonsecure-clk", /* 0x4088 */
  1885. .data = &sc9860_aonsecure_clk_desc },
  1886. { .compatible = "sprd,sc9860-agcp-gate", /* 0x415e */
  1887. .data = &sc9860_agcp_gate_desc },
  1888. { .compatible = "sprd,sc9860-gpu-clk", /* 0x6020 */
  1889. .data = &sc9860_gpu_clk_desc },
  1890. { .compatible = "sprd,sc9860-vsp-clk", /* 0x6100 */
  1891. .data = &sc9860_vsp_clk_desc },
  1892. { .compatible = "sprd,sc9860-vsp-gate", /* 0x6110 */
  1893. .data = &sc9860_vsp_gate_desc },
  1894. { .compatible = "sprd,sc9860-cam-clk", /* 0x6200 */
  1895. .data = &sc9860_cam_clk_desc },
  1896. { .compatible = "sprd,sc9860-cam-gate", /* 0x6210 */
  1897. .data = &sc9860_cam_gate_desc },
  1898. { .compatible = "sprd,sc9860-disp-clk", /* 0x6300 */
  1899. .data = &sc9860_disp_clk_desc },
  1900. { .compatible = "sprd,sc9860-disp-gate", /* 0x6310 */
  1901. .data = &sc9860_disp_gate_desc },
  1902. { .compatible = "sprd,sc9860-apapb-gate", /* 0x70b0 */
  1903. .data = &sc9860_apapb_gate_desc },
  1904. { }
  1905. };
  1906. MODULE_DEVICE_TABLE(of, sprd_sc9860_clk_ids);
  1907. static int sc9860_clk_probe(struct platform_device *pdev)
  1908. {
  1909. const struct of_device_id *match;
  1910. const struct sprd_clk_desc *desc;
  1911. int ret;
  1912. match = of_match_node(sprd_sc9860_clk_ids, pdev->dev.of_node);
  1913. if (!match) {
  1914. pr_err("%s: of_match_node() failed", __func__);
  1915. return -ENODEV;
  1916. }
  1917. desc = match->data;
  1918. ret = sprd_clk_regmap_init(pdev, desc);
  1919. if (ret)
  1920. return ret;
  1921. return sprd_clk_probe(&pdev->dev, desc->hw_clks);
  1922. }
  1923. static struct platform_driver sc9860_clk_driver = {
  1924. .probe = sc9860_clk_probe,
  1925. .driver = {
  1926. .name = "sc9860-clk",
  1927. .of_match_table = sprd_sc9860_clk_ids,
  1928. },
  1929. };
  1930. module_platform_driver(sc9860_clk_driver);
  1931. MODULE_DESCRIPTION("Spreadtrum SC9860 Clock Driver");
  1932. MODULE_LICENSE("GPL v2");
  1933. MODULE_ALIAS("platform:sc9860-clk");