0004-clk-mediatek-Add-basic-clocks-for-Mediatek-MT8135.patch 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938
  1. From 242572135fdb513cba0506415c7e26a0909eb4b5 Mon Sep 17 00:00:00 2001
  2. From: James Liao <[email protected]>
  3. Date: Thu, 23 Apr 2015 10:35:41 +0200
  4. Subject: [PATCH 04/76] clk: mediatek: Add basic clocks for Mediatek MT8135.
  5. This patch adds basic clocks for MT8135, including TOPCKGEN, PLLs,
  6. INFRA and PERI clocks.
  7. Signed-off-by: James Liao <[email protected]>
  8. Signed-off-by: Henry Chen <[email protected]>
  9. Signed-off-by: Sascha Hauer <[email protected]>
  10. ---
  11. drivers/clk/mediatek/Makefile | 1 +
  12. drivers/clk/mediatek/clk-mt8135.c | 644 ++++++++++++++++++++
  13. include/dt-bindings/clock/mt8135-clk.h | 194 ++++++
  14. .../dt-bindings/reset-controller/mt8135-resets.h | 64 ++
  15. 4 files changed, 903 insertions(+)
  16. create mode 100644 drivers/clk/mediatek/clk-mt8135.c
  17. create mode 100644 include/dt-bindings/clock/mt8135-clk.h
  18. create mode 100644 include/dt-bindings/reset-controller/mt8135-resets.h
  19. --- a/drivers/clk/mediatek/Makefile
  20. +++ b/drivers/clk/mediatek/Makefile
  21. @@ -1,2 +1,3 @@
  22. obj-y += clk-mtk.o clk-pll.o clk-gate.o
  23. obj-$(CONFIG_RESET_CONTROLLER) += reset.o
  24. +obj-y += clk-mt8135.o
  25. --- /dev/null
  26. +++ b/drivers/clk/mediatek/clk-mt8135.c
  27. @@ -0,0 +1,644 @@
  28. +/*
  29. + * Copyright (c) 2014 MediaTek Inc.
  30. + * Author: James Liao <[email protected]>
  31. + *
  32. + * This program is free software; you can redistribute it and/or modify
  33. + * it under the terms of the GNU General Public License version 2 as
  34. + * published by the Free Software Foundation.
  35. + *
  36. + * This program is distributed in the hope that it will be useful,
  37. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  38. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  39. + * GNU General Public License for more details.
  40. + */
  41. +
  42. +#include <linux/of.h>
  43. +#include <linux/of_address.h>
  44. +#include <linux/slab.h>
  45. +#include <linux/mfd/syscon.h>
  46. +#include <dt-bindings/clock/mt8135-clk.h>
  47. +
  48. +#include "clk-mtk.h"
  49. +#include "clk-gate.h"
  50. +
  51. +static DEFINE_SPINLOCK(mt8135_clk_lock);
  52. +
  53. +static const struct mtk_fixed_factor root_clk_alias[] __initconst = {
  54. + FACTOR(CLK_TOP_DSI0_LNTC_DSICLK, "dsi0_lntc_dsiclk", "clk_null", 1, 1),
  55. + FACTOR(CLK_TOP_HDMITX_CLKDIG_CTS, "hdmitx_clkdig_cts", "clk_null", 1, 1),
  56. + FACTOR(CLK_TOP_CLKPH_MCK, "clkph_mck", "clk_null", 1, 1),
  57. + FACTOR(CLK_TOP_CPUM_TCK_IN, "cpum_tck_in", "clk_null", 1, 1),
  58. +};
  59. +
  60. +static const struct mtk_fixed_factor top_divs[] __initconst = {
  61. + FACTOR(CLK_TOP_MAINPLL_806M, "mainpll_806m", "mainpll", 1, 2),
  62. + FACTOR(CLK_TOP_MAINPLL_537P3M, "mainpll_537p3m", "mainpll", 1, 3),
  63. + FACTOR(CLK_TOP_MAINPLL_322P4M, "mainpll_322p4m", "mainpll", 1, 5),
  64. + FACTOR(CLK_TOP_MAINPLL_230P3M, "mainpll_230p3m", "mainpll", 1, 7),
  65. +
  66. + FACTOR(CLK_TOP_UNIVPLL_624M, "univpll_624m", "univpll", 1, 2),
  67. + FACTOR(CLK_TOP_UNIVPLL_416M, "univpll_416m", "univpll", 1, 3),
  68. + FACTOR(CLK_TOP_UNIVPLL_249P6M, "univpll_249p6m", "univpll", 1, 5),
  69. + FACTOR(CLK_TOP_UNIVPLL_178P3M, "univpll_178p3m", "univpll", 1, 7),
  70. + FACTOR(CLK_TOP_UNIVPLL_48M, "univpll_48m", "univpll", 1, 26),
  71. +
  72. + FACTOR(CLK_TOP_MMPLL_D2, "mmpll_d2", "mmpll", 1, 2),
  73. + FACTOR(CLK_TOP_MMPLL_D3, "mmpll_d3", "mmpll", 1, 3),
  74. + FACTOR(CLK_TOP_MMPLL_D5, "mmpll_d5", "mmpll", 1, 5),
  75. + FACTOR(CLK_TOP_MMPLL_D7, "mmpll_d7", "mmpll", 1, 7),
  76. + FACTOR(CLK_TOP_MMPLL_D4, "mmpll_d4", "mmpll_d2", 1, 2),
  77. + FACTOR(CLK_TOP_MMPLL_D6, "mmpll_d6", "mmpll_d3", 1, 2),
  78. +
  79. + FACTOR(CLK_TOP_SYSPLL_D2, "syspll_d2", "mainpll_806m", 1, 1),
  80. + FACTOR(CLK_TOP_SYSPLL_D4, "syspll_d4", "mainpll_806m", 1, 2),
  81. + FACTOR(CLK_TOP_SYSPLL_D6, "syspll_d6", "mainpll_806m", 1, 3),
  82. + FACTOR(CLK_TOP_SYSPLL_D8, "syspll_d8", "mainpll_806m", 1, 4),
  83. + FACTOR(CLK_TOP_SYSPLL_D10, "syspll_d10", "mainpll_806m", 1, 5),
  84. + FACTOR(CLK_TOP_SYSPLL_D12, "syspll_d12", "mainpll_806m", 1, 6),
  85. + FACTOR(CLK_TOP_SYSPLL_D16, "syspll_d16", "mainpll_806m", 1, 8),
  86. + FACTOR(CLK_TOP_SYSPLL_D24, "syspll_d24", "mainpll_806m", 1, 12),
  87. +
  88. + FACTOR(CLK_TOP_SYSPLL_D3, "syspll_d3", "mainpll_537p3m", 1, 1),
  89. +
  90. + FACTOR(CLK_TOP_SYSPLL_D2P5, "syspll_d2p5", "mainpll_322p4m", 2, 1),
  91. + FACTOR(CLK_TOP_SYSPLL_D5, "syspll_d5", "mainpll_322p4m", 1, 1),
  92. +
  93. + FACTOR(CLK_TOP_SYSPLL_D3P5, "syspll_d3p5", "mainpll_230p3m", 2, 1),
  94. +
  95. + FACTOR(CLK_TOP_UNIVPLL1_D2, "univpll1_d2", "univpll_624m", 1, 2),
  96. + FACTOR(CLK_TOP_UNIVPLL1_D4, "univpll1_d4", "univpll_624m", 1, 4),
  97. + FACTOR(CLK_TOP_UNIVPLL1_D6, "univpll1_d6", "univpll_624m", 1, 6),
  98. + FACTOR(CLK_TOP_UNIVPLL1_D8, "univpll1_d8", "univpll_624m", 1, 8),
  99. + FACTOR(CLK_TOP_UNIVPLL1_D10, "univpll1_d10", "univpll_624m", 1, 10),
  100. +
  101. + FACTOR(CLK_TOP_UNIVPLL2_D2, "univpll2_d2", "univpll_416m", 1, 2),
  102. + FACTOR(CLK_TOP_UNIVPLL2_D4, "univpll2_d4", "univpll_416m", 1, 4),
  103. + FACTOR(CLK_TOP_UNIVPLL2_D6, "univpll2_d6", "univpll_416m", 1, 6),
  104. + FACTOR(CLK_TOP_UNIVPLL2_D8, "univpll2_d8", "univpll_416m", 1, 8),
  105. +
  106. + FACTOR(CLK_TOP_UNIVPLL_D3, "univpll_d3", "univpll_416m", 1, 1),
  107. + FACTOR(CLK_TOP_UNIVPLL_D5, "univpll_d5", "univpll_249p6m", 1, 1),
  108. + FACTOR(CLK_TOP_UNIVPLL_D7, "univpll_d7", "univpll_178p3m", 1, 1),
  109. + FACTOR(CLK_TOP_UNIVPLL_D10, "univpll_d10", "univpll_249p6m", 1, 2),
  110. + FACTOR(CLK_TOP_UNIVPLL_D26, "univpll_d26", "univpll_48m", 1, 1),
  111. +
  112. + FACTOR(CLK_TOP_APLL, "apll_ck", "audpll", 1, 1),
  113. + FACTOR(CLK_TOP_APLL_D4, "apll_d4", "audpll", 1, 4),
  114. + FACTOR(CLK_TOP_APLL_D8, "apll_d8", "audpll", 1, 8),
  115. + FACTOR(CLK_TOP_APLL_D16, "apll_d16", "audpll", 1, 16),
  116. + FACTOR(CLK_TOP_APLL_D24, "apll_d24", "audpll", 1, 24),
  117. +
  118. + FACTOR(CLK_TOP_LVDSPLL_D2, "lvdspll_d2", "lvdspll", 1, 2),
  119. + FACTOR(CLK_TOP_LVDSPLL_D4, "lvdspll_d4", "lvdspll", 1, 4),
  120. + FACTOR(CLK_TOP_LVDSPLL_D8, "lvdspll_d8", "lvdspll", 1, 8),
  121. +
  122. + FACTOR(CLK_TOP_LVDSTX_CLKDIG_CT, "lvdstx_clkdig_cts", "lvdspll", 1, 1),
  123. + FACTOR(CLK_TOP_VPLL_DPIX, "vpll_dpix_ck", "lvdspll", 1, 1),
  124. +
  125. + FACTOR(CLK_TOP_TVHDMI_H, "tvhdmi_h_ck", "tvdpll", 1, 1),
  126. +
  127. + FACTOR(CLK_TOP_HDMITX_CLKDIG_D2, "hdmitx_clkdig_d2", "hdmitx_clkdig_cts", 1, 2),
  128. + FACTOR(CLK_TOP_HDMITX_CLKDIG_D3, "hdmitx_clkdig_d3", "hdmitx_clkdig_cts", 1, 3),
  129. +
  130. + FACTOR(CLK_TOP_TVHDMI_D2, "tvhdmi_d2", "tvhdmi_h_ck", 1, 2),
  131. + FACTOR(CLK_TOP_TVHDMI_D4, "tvhdmi_d4", "tvhdmi_h_ck", 1, 4),
  132. +
  133. + FACTOR(CLK_TOP_MEMPLL_MCK_D4, "mempll_mck_d4", "clkph_mck", 1, 4),
  134. +};
  135. +
  136. +static const char * const axi_parents[] __initconst = {
  137. + "clk26m",
  138. + "syspll_d3",
  139. + "syspll_d4",
  140. + "syspll_d6",
  141. + "univpll_d5",
  142. + "univpll2_d2",
  143. + "syspll_d3p5"
  144. +};
  145. +
  146. +static const char * const smi_parents[] __initconst = {
  147. + "clk26m",
  148. + "clkph_mck",
  149. + "syspll_d2p5",
  150. + "syspll_d3",
  151. + "syspll_d8",
  152. + "univpll_d5",
  153. + "univpll1_d2",
  154. + "univpll1_d6",
  155. + "mmpll_d3",
  156. + "mmpll_d4",
  157. + "mmpll_d5",
  158. + "mmpll_d6",
  159. + "mmpll_d7",
  160. + "vdecpll",
  161. + "lvdspll"
  162. +};
  163. +
  164. +static const char * const mfg_parents[] __initconst = {
  165. + "clk26m",
  166. + "univpll1_d4",
  167. + "syspll_d2",
  168. + "syspll_d2p5",
  169. + "syspll_d3",
  170. + "univpll_d5",
  171. + "univpll1_d2",
  172. + "mmpll_d2",
  173. + "mmpll_d3",
  174. + "mmpll_d4",
  175. + "mmpll_d5",
  176. + "mmpll_d6",
  177. + "mmpll_d7"
  178. +};
  179. +
  180. +static const char * const irda_parents[] __initconst = {
  181. + "clk26m",
  182. + "univpll2_d8",
  183. + "univpll1_d6"
  184. +};
  185. +
  186. +static const char * const cam_parents[] __initconst = {
  187. + "clk26m",
  188. + "syspll_d3",
  189. + "syspll_d3p5",
  190. + "syspll_d4",
  191. + "univpll_d5",
  192. + "univpll2_d2",
  193. + "univpll_d7",
  194. + "univpll1_d4"
  195. +};
  196. +
  197. +static const char * const aud_intbus_parents[] __initconst = {
  198. + "clk26m",
  199. + "syspll_d6",
  200. + "univpll_d10"
  201. +};
  202. +
  203. +static const char * const jpg_parents[] __initconst = {
  204. + "clk26m",
  205. + "syspll_d5",
  206. + "syspll_d4",
  207. + "syspll_d3",
  208. + "univpll_d7",
  209. + "univpll2_d2",
  210. + "univpll_d5"
  211. +};
  212. +
  213. +static const char * const disp_parents[] __initconst = {
  214. + "clk26m",
  215. + "syspll_d3p5",
  216. + "syspll_d3",
  217. + "univpll2_d2",
  218. + "univpll_d5",
  219. + "univpll1_d2",
  220. + "lvdspll",
  221. + "vdecpll"
  222. +};
  223. +
  224. +static const char * const msdc30_parents[] __initconst = {
  225. + "clk26m",
  226. + "syspll_d6",
  227. + "syspll_d5",
  228. + "univpll1_d4",
  229. + "univpll2_d4",
  230. + "msdcpll"
  231. +};
  232. +
  233. +static const char * const usb20_parents[] __initconst = {
  234. + "clk26m",
  235. + "univpll2_d6",
  236. + "univpll1_d10"
  237. +};
  238. +
  239. +static const char * const venc_parents[] __initconst = {
  240. + "clk26m",
  241. + "syspll_d3",
  242. + "syspll_d8",
  243. + "univpll_d5",
  244. + "univpll1_d6",
  245. + "mmpll_d4",
  246. + "mmpll_d5",
  247. + "mmpll_d6"
  248. +};
  249. +
  250. +static const char * const spi_parents[] __initconst = {
  251. + "clk26m",
  252. + "syspll_d6",
  253. + "syspll_d8",
  254. + "syspll_d10",
  255. + "univpll1_d6",
  256. + "univpll1_d8"
  257. +};
  258. +
  259. +static const char * const uart_parents[] __initconst = {
  260. + "clk26m",
  261. + "univpll2_d8"
  262. +};
  263. +
  264. +static const char * const mem_parents[] __initconst = {
  265. + "clk26m",
  266. + "clkph_mck"
  267. +};
  268. +
  269. +static const char * const camtg_parents[] __initconst = {
  270. + "clk26m",
  271. + "univpll_d26",
  272. + "univpll1_d6",
  273. + "syspll_d16",
  274. + "syspll_d8"
  275. +};
  276. +
  277. +static const char * const audio_parents[] __initconst = {
  278. + "clk26m",
  279. + "syspll_d24"
  280. +};
  281. +
  282. +static const char * const fix_parents[] __initconst = {
  283. + "rtc32k",
  284. + "clk26m",
  285. + "univpll_d5",
  286. + "univpll_d7",
  287. + "univpll1_d2",
  288. + "univpll1_d4",
  289. + "univpll1_d6",
  290. + "univpll1_d8"
  291. +};
  292. +
  293. +static const char * const vdec_parents[] __initconst = {
  294. + "clk26m",
  295. + "vdecpll",
  296. + "clkph_mck",
  297. + "syspll_d2p5",
  298. + "syspll_d3",
  299. + "syspll_d3p5",
  300. + "syspll_d4",
  301. + "syspll_d5",
  302. + "syspll_d6",
  303. + "syspll_d8",
  304. + "univpll1_d2",
  305. + "univpll2_d2",
  306. + "univpll_d7",
  307. + "univpll_d10",
  308. + "univpll2_d4",
  309. + "lvdspll"
  310. +};
  311. +
  312. +static const char * const ddrphycfg_parents[] __initconst = {
  313. + "clk26m",
  314. + "axi_sel",
  315. + "syspll_d12"
  316. +};
  317. +
  318. +static const char * const dpilvds_parents[] __initconst = {
  319. + "clk26m",
  320. + "lvdspll",
  321. + "lvdspll_d2",
  322. + "lvdspll_d4",
  323. + "lvdspll_d8"
  324. +};
  325. +
  326. +static const char * const pmicspi_parents[] __initconst = {
  327. + "clk26m",
  328. + "univpll2_d6",
  329. + "syspll_d8",
  330. + "syspll_d10",
  331. + "univpll1_d10",
  332. + "mempll_mck_d4",
  333. + "univpll_d26",
  334. + "syspll_d24"
  335. +};
  336. +
  337. +static const char * const smi_mfg_as_parents[] __initconst = {
  338. + "clk26m",
  339. + "smi_sel",
  340. + "mfg_sel",
  341. + "mem_sel"
  342. +};
  343. +
  344. +static const char * const gcpu_parents[] __initconst = {
  345. + "clk26m",
  346. + "syspll_d4",
  347. + "univpll_d7",
  348. + "syspll_d5",
  349. + "syspll_d6"
  350. +};
  351. +
  352. +static const char * const dpi1_parents[] __initconst = {
  353. + "clk26m",
  354. + "tvhdmi_h_ck",
  355. + "tvhdmi_d2",
  356. + "tvhdmi_d4"
  357. +};
  358. +
  359. +static const char * const cci_parents[] __initconst = {
  360. + "clk26m",
  361. + "mainpll_537p3m",
  362. + "univpll_d3",
  363. + "syspll_d2p5",
  364. + "syspll_d3",
  365. + "syspll_d5"
  366. +};
  367. +
  368. +static const char * const apll_parents[] __initconst = {
  369. + "clk26m",
  370. + "apll_ck",
  371. + "apll_d4",
  372. + "apll_d8",
  373. + "apll_d16",
  374. + "apll_d24"
  375. +};
  376. +
  377. +static const char * const hdmipll_parents[] __initconst = {
  378. + "clk26m",
  379. + "hdmitx_clkdig_cts",
  380. + "hdmitx_clkdig_d2",
  381. + "hdmitx_clkdig_d3"
  382. +};
  383. +
  384. +static const struct mtk_composite top_muxes[] __initconst = {
  385. + /* CLK_CFG_0 */
  386. + MUX_GATE(CLK_TOP_AXI_SEL, "axi_sel", axi_parents,
  387. + 0x0140, 0, 3, INVALID_MUX_GATE_BIT),
  388. + MUX_GATE(CLK_TOP_SMI_SEL, "smi_sel", smi_parents, 0x0140, 8, 4, 15),
  389. + MUX_GATE(CLK_TOP_MFG_SEL, "mfg_sel", mfg_parents, 0x0140, 16, 4, 23),
  390. + MUX_GATE(CLK_TOP_IRDA_SEL, "irda_sel", irda_parents, 0x0140, 24, 2, 31),
  391. + /* CLK_CFG_1 */
  392. + MUX_GATE(CLK_TOP_CAM_SEL, "cam_sel", cam_parents, 0x0144, 0, 3, 7),
  393. + MUX_GATE(CLK_TOP_AUD_INTBUS_SEL, "aud_intbus_sel", aud_intbus_parents,
  394. + 0x0144, 8, 2, 15),
  395. + MUX_GATE(CLK_TOP_JPG_SEL, "jpg_sel", jpg_parents, 0x0144, 16, 3, 23),
  396. + MUX_GATE(CLK_TOP_DISP_SEL, "disp_sel", disp_parents, 0x0144, 24, 3, 31),
  397. + /* CLK_CFG_2 */
  398. + MUX_GATE(CLK_TOP_MSDC30_1_SEL, "msdc30_1_sel", msdc30_parents, 0x0148, 0, 3, 7),
  399. + MUX_GATE(CLK_TOP_MSDC30_2_SEL, "msdc30_2_sel", msdc30_parents, 0x0148, 8, 3, 15),
  400. + MUX_GATE(CLK_TOP_MSDC30_3_SEL, "msdc30_3_sel", msdc30_parents, 0x0148, 16, 3, 23),
  401. + MUX_GATE(CLK_TOP_MSDC30_4_SEL, "msdc30_4_sel", msdc30_parents, 0x0148, 24, 3, 31),
  402. + /* CLK_CFG_3 */
  403. + MUX_GATE(CLK_TOP_USB20_SEL, "usb20_sel", usb20_parents, 0x014c, 0, 2, 7),
  404. + /* CLK_CFG_4 */
  405. + MUX_GATE(CLK_TOP_VENC_SEL, "venc_sel", venc_parents, 0x0150, 8, 3, 15),
  406. + MUX_GATE(CLK_TOP_SPI_SEL, "spi_sel", spi_parents, 0x0150, 16, 3, 23),
  407. + MUX_GATE(CLK_TOP_UART_SEL, "uart_sel", uart_parents, 0x0150, 24, 2, 31),
  408. + /* CLK_CFG_6 */
  409. + MUX_GATE(CLK_TOP_MEM_SEL, "mem_sel", mem_parents, 0x0158, 0, 2, 7),
  410. + MUX_GATE(CLK_TOP_CAMTG_SEL, "camtg_sel", camtg_parents, 0x0158, 8, 3, 15),
  411. + MUX_GATE(CLK_TOP_AUDIO_SEL, "audio_sel", audio_parents, 0x0158, 24, 2, 31),
  412. + /* CLK_CFG_7 */
  413. + MUX_GATE(CLK_TOP_FIX_SEL, "fix_sel", fix_parents, 0x015c, 0, 3, 7),
  414. + MUX_GATE(CLK_TOP_VDEC_SEL, "vdec_sel", vdec_parents, 0x015c, 8, 4, 15),
  415. + MUX_GATE(CLK_TOP_DDRPHYCFG_SEL, "ddrphycfg_sel", ddrphycfg_parents,
  416. + 0x015c, 16, 2, 23),
  417. + MUX_GATE(CLK_TOP_DPILVDS_SEL, "dpilvds_sel", dpilvds_parents, 0x015c, 24, 3, 31),
  418. + /* CLK_CFG_8 */
  419. + MUX_GATE(CLK_TOP_PMICSPI_SEL, "pmicspi_sel", pmicspi_parents, 0x0164, 0, 3, 7),
  420. + MUX_GATE(CLK_TOP_MSDC30_0_SEL, "msdc30_0_sel", msdc30_parents, 0x0164, 8, 3, 15),
  421. + MUX_GATE(CLK_TOP_SMI_MFG_AS_SEL, "smi_mfg_as_sel", smi_mfg_as_parents,
  422. + 0x0164, 16, 2, 23),
  423. + MUX_GATE(CLK_TOP_GCPU_SEL, "gcpu_sel", gcpu_parents, 0x0164, 24, 3, 31),
  424. + /* CLK_CFG_9 */
  425. + MUX_GATE(CLK_TOP_DPI1_SEL, "dpi1_sel", dpi1_parents, 0x0168, 0, 2, 7),
  426. + MUX_GATE(CLK_TOP_CCI_SEL, "cci_sel", cci_parents, 0x0168, 8, 3, 15),
  427. + MUX_GATE(CLK_TOP_APLL_SEL, "apll_sel", apll_parents, 0x0168, 16, 3, 23),
  428. + MUX_GATE(CLK_TOP_HDMIPLL_SEL, "hdmipll_sel", hdmipll_parents, 0x0168, 24, 2, 31),
  429. +};
  430. +
  431. +static const struct mtk_gate_regs infra_cg_regs = {
  432. + .set_ofs = 0x0040,
  433. + .clr_ofs = 0x0044,
  434. + .sta_ofs = 0x0048,
  435. +};
  436. +
  437. +#define GATE_ICG(_id, _name, _parent, _shift) { \
  438. + .id = _id, \
  439. + .name = _name, \
  440. + .parent_name = _parent, \
  441. + .regs = &infra_cg_regs, \
  442. + .shift = _shift, \
  443. + .ops = &mtk_clk_gate_ops_setclr, \
  444. + }
  445. +
  446. +static const struct mtk_gate infra_clks[] __initconst = {
  447. + GATE_ICG(CLK_INFRA_PMIC_WRAP, "pmic_wrap_ck", "axi_sel", 23),
  448. + GATE_ICG(CLK_INFRA_PMICSPI, "pmicspi_ck", "pmicspi_sel", 22),
  449. + GATE_ICG(CLK_INFRA_CCIF1_AP_CTRL, "ccif1_ap_ctrl", "axi_sel", 21),
  450. + GATE_ICG(CLK_INFRA_CCIF0_AP_CTRL, "ccif0_ap_ctrl", "axi_sel", 20),
  451. + GATE_ICG(CLK_INFRA_KP, "kp_ck", "axi_sel", 16),
  452. + GATE_ICG(CLK_INFRA_CPUM, "cpum_ck", "cpum_tck_in", 15),
  453. + GATE_ICG(CLK_INFRA_M4U, "m4u_ck", "mem_sel", 8),
  454. + GATE_ICG(CLK_INFRA_MFGAXI, "mfgaxi_ck", "axi_sel", 7),
  455. + GATE_ICG(CLK_INFRA_DEVAPC, "devapc_ck", "axi_sel", 6),
  456. + GATE_ICG(CLK_INFRA_AUDIO, "audio_ck", "aud_intbus_sel", 5),
  457. + GATE_ICG(CLK_INFRA_MFG_BUS, "mfg_bus_ck", "axi_sel", 2),
  458. + GATE_ICG(CLK_INFRA_SMI, "smi_ck", "smi_sel", 1),
  459. + GATE_ICG(CLK_INFRA_DBGCLK, "dbgclk_ck", "axi_sel", 0),
  460. +};
  461. +
  462. +static const struct mtk_gate_regs peri0_cg_regs = {
  463. + .set_ofs = 0x0008,
  464. + .clr_ofs = 0x0010,
  465. + .sta_ofs = 0x0018,
  466. +};
  467. +
  468. +static const struct mtk_gate_regs peri1_cg_regs = {
  469. + .set_ofs = 0x000c,
  470. + .clr_ofs = 0x0014,
  471. + .sta_ofs = 0x001c,
  472. +};
  473. +
  474. +#define GATE_PERI0(_id, _name, _parent, _shift) { \
  475. + .id = _id, \
  476. + .name = _name, \
  477. + .parent_name = _parent, \
  478. + .regs = &peri0_cg_regs, \
  479. + .shift = _shift, \
  480. + .ops = &mtk_clk_gate_ops_setclr, \
  481. + }
  482. +
  483. +#define GATE_PERI1(_id, _name, _parent, _shift) { \
  484. + .id = _id, \
  485. + .name = _name, \
  486. + .parent_name = _parent, \
  487. + .regs = &peri1_cg_regs, \
  488. + .shift = _shift, \
  489. + .ops = &mtk_clk_gate_ops_setclr, \
  490. + }
  491. +
  492. +static const struct mtk_gate peri_gates[] __initconst = {
  493. + /* PERI0 */
  494. + GATE_PERI0(CLK_PERI_I2C5, "i2c5_ck", "axi_sel", 31),
  495. + GATE_PERI0(CLK_PERI_I2C4, "i2c4_ck", "axi_sel", 30),
  496. + GATE_PERI0(CLK_PERI_I2C3, "i2c3_ck", "axi_sel", 29),
  497. + GATE_PERI0(CLK_PERI_I2C2, "i2c2_ck", "axi_sel", 28),
  498. + GATE_PERI0(CLK_PERI_I2C1, "i2c1_ck", "axi_sel", 27),
  499. + GATE_PERI0(CLK_PERI_I2C0, "i2c0_ck", "axi_sel", 26),
  500. + GATE_PERI0(CLK_PERI_UART3, "uart3_ck", "axi_sel", 25),
  501. + GATE_PERI0(CLK_PERI_UART2, "uart2_ck", "axi_sel", 24),
  502. + GATE_PERI0(CLK_PERI_UART1, "uart1_ck", "axi_sel", 23),
  503. + GATE_PERI0(CLK_PERI_UART0, "uart0_ck", "axi_sel", 22),
  504. + GATE_PERI0(CLK_PERI_IRDA, "irda_ck", "irda_sel", 21),
  505. + GATE_PERI0(CLK_PERI_NLI, "nli_ck", "axi_sel", 20),
  506. + GATE_PERI0(CLK_PERI_MD_HIF, "md_hif_ck", "axi_sel", 19),
  507. + GATE_PERI0(CLK_PERI_AP_HIF, "ap_hif_ck", "axi_sel", 18),
  508. + GATE_PERI0(CLK_PERI_MSDC30_3, "msdc30_3_ck", "msdc30_4_sel", 17),
  509. + GATE_PERI0(CLK_PERI_MSDC30_2, "msdc30_2_ck", "msdc30_3_sel", 16),
  510. + GATE_PERI0(CLK_PERI_MSDC30_1, "msdc30_1_ck", "msdc30_2_sel", 15),
  511. + GATE_PERI0(CLK_PERI_MSDC20_2, "msdc20_2_ck", "msdc30_1_sel", 14),
  512. + GATE_PERI0(CLK_PERI_MSDC20_1, "msdc20_1_ck", "msdc30_0_sel", 13),
  513. + GATE_PERI0(CLK_PERI_AP_DMA, "ap_dma_ck", "axi_sel", 12),
  514. + GATE_PERI0(CLK_PERI_USB1, "usb1_ck", "usb20_sel", 11),
  515. + GATE_PERI0(CLK_PERI_USB0, "usb0_ck", "usb20_sel", 10),
  516. + GATE_PERI0(CLK_PERI_PWM, "pwm_ck", "axi_sel", 9),
  517. + GATE_PERI0(CLK_PERI_PWM7, "pwm7_ck", "axi_sel", 8),
  518. + GATE_PERI0(CLK_PERI_PWM6, "pwm6_ck", "axi_sel", 7),
  519. + GATE_PERI0(CLK_PERI_PWM5, "pwm5_ck", "axi_sel", 6),
  520. + GATE_PERI0(CLK_PERI_PWM4, "pwm4_ck", "axi_sel", 5),
  521. + GATE_PERI0(CLK_PERI_PWM3, "pwm3_ck", "axi_sel", 4),
  522. + GATE_PERI0(CLK_PERI_PWM2, "pwm2_ck", "axi_sel", 3),
  523. + GATE_PERI0(CLK_PERI_PWM1, "pwm1_ck", "axi_sel", 2),
  524. + GATE_PERI0(CLK_PERI_THERM, "therm_ck", "axi_sel", 1),
  525. + GATE_PERI0(CLK_PERI_NFI, "nfi_ck", "axi_sel", 0),
  526. + /* PERI1 */
  527. + GATE_PERI1(CLK_PERI_USBSLV, "usbslv_ck", "axi_sel", 8),
  528. + GATE_PERI1(CLK_PERI_USB1_MCU, "usb1_mcu_ck", "axi_sel", 7),
  529. + GATE_PERI1(CLK_PERI_USB0_MCU, "usb0_mcu_ck", "axi_sel", 6),
  530. + GATE_PERI1(CLK_PERI_GCPU, "gcpu_ck", "gcpu_sel", 5),
  531. + GATE_PERI1(CLK_PERI_FHCTL, "fhctl_ck", "clk26m", 4),
  532. + GATE_PERI1(CLK_PERI_SPI1, "spi1_ck", "spi_sel", 3),
  533. + GATE_PERI1(CLK_PERI_AUXADC, "auxadc_ck", "clk26m", 2),
  534. + GATE_PERI1(CLK_PERI_PERI_PWRAP, "peri_pwrap_ck", "axi_sel", 1),
  535. + GATE_PERI1(CLK_PERI_I2C6, "i2c6_ck", "axi_sel", 0),
  536. +};
  537. +
  538. +static const char * const uart_ck_sel_parents[] __initconst = {
  539. + "clk26m",
  540. + "uart_sel",
  541. +};
  542. +
  543. +static const struct mtk_composite peri_clks[] __initconst = {
  544. + MUX(CLK_PERI_UART0_SEL, "uart0_ck_sel", uart_ck_sel_parents, 0x40c, 0, 1),
  545. + MUX(CLK_PERI_UART1_SEL, "uart1_ck_sel", uart_ck_sel_parents, 0x40c, 1, 1),
  546. + MUX(CLK_PERI_UART2_SEL, "uart2_ck_sel", uart_ck_sel_parents, 0x40c, 2, 1),
  547. + MUX(CLK_PERI_UART3_SEL, "uart3_ck_sel", uart_ck_sel_parents, 0x40c, 3, 1),
  548. +};
  549. +
  550. +static void __init mtk_topckgen_init(struct device_node *node)
  551. +{
  552. + struct clk_onecell_data *clk_data;
  553. + void __iomem *base;
  554. + int r;
  555. +
  556. + base = of_iomap(node, 0);
  557. + if (!base) {
  558. + pr_err("%s(): ioremap failed\n", __func__);
  559. + return;
  560. + }
  561. +
  562. + clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK);
  563. +
  564. + mtk_clk_register_factors(root_clk_alias, ARRAY_SIZE(root_clk_alias), clk_data);
  565. + mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data);
  566. + mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base,
  567. + &mt8135_clk_lock, clk_data);
  568. +
  569. + clk_prepare_enable(clk_data->clks[CLK_TOP_CCI_SEL]);
  570. +
  571. + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
  572. + if (r)
  573. + pr_err("%s(): could not register clock provider: %d\n",
  574. + __func__, r);
  575. +}
  576. +CLK_OF_DECLARE(mtk_topckgen, "mediatek,mt8135-topckgen", mtk_topckgen_init);
  577. +
  578. +static void __init mtk_infrasys_init(struct device_node *node)
  579. +{
  580. + struct clk_onecell_data *clk_data;
  581. + int r;
  582. +
  583. + clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK);
  584. +
  585. + mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
  586. + clk_data);
  587. +
  588. + clk_prepare_enable(clk_data->clks[CLK_INFRA_M4U]);
  589. +
  590. + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
  591. + if (r)
  592. + pr_err("%s(): could not register clock provider: %d\n",
  593. + __func__, r);
  594. +
  595. + mtk_register_reset_controller(node, 2, 0x30);
  596. +}
  597. +CLK_OF_DECLARE(mtk_infrasys, "mediatek,mt8135-infracfg", mtk_infrasys_init);
  598. +
  599. +static void __init mtk_pericfg_init(struct device_node *node)
  600. +{
  601. + struct clk_onecell_data *clk_data;
  602. + int r;
  603. + void __iomem *base;
  604. +
  605. + base = of_iomap(node, 0);
  606. + if (!base) {
  607. + pr_err("%s(): ioremap failed\n", __func__);
  608. + return;
  609. + }
  610. +
  611. + clk_data = mtk_alloc_clk_data(CLK_PERI_NR_CLK);
  612. +
  613. + mtk_clk_register_gates(node, peri_gates, ARRAY_SIZE(peri_gates),
  614. + clk_data);
  615. + mtk_clk_register_composites(peri_clks, ARRAY_SIZE(peri_clks), base,
  616. + &mt8135_clk_lock, clk_data);
  617. +
  618. + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
  619. + if (r)
  620. + pr_err("%s(): could not register clock provider: %d\n",
  621. + __func__, r);
  622. +
  623. + mtk_register_reset_controller(node, 2, 0);
  624. +}
  625. +CLK_OF_DECLARE(mtk_pericfg, "mediatek,mt8135-pericfg", mtk_pericfg_init);
  626. +
  627. +#define MT8135_PLL_FMAX (2000 * MHZ)
  628. +#define CON0_MT8135_RST_BAR BIT(27)
  629. +
  630. +#define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, _pd_reg, _pd_shift, _tuner_reg, _pcw_reg, _pcw_shift) { \
  631. + .id = _id, \
  632. + .name = _name, \
  633. + .reg = _reg, \
  634. + .pwr_reg = _pwr_reg, \
  635. + .en_mask = _en_mask, \
  636. + .flags = _flags, \
  637. + .rst_bar_mask = CON0_MT8135_RST_BAR, \
  638. + .fmax = MT8135_PLL_FMAX, \
  639. + .pcwbits = _pcwbits, \
  640. + .pd_reg = _pd_reg, \
  641. + .pd_shift = _pd_shift, \
  642. + .tuner_reg = _tuner_reg, \
  643. + .pcw_reg = _pcw_reg, \
  644. + .pcw_shift = _pcw_shift, \
  645. + }
  646. +
  647. +static const struct mtk_pll_data plls[] = {
  648. + PLL(CLK_APMIXED_ARMPLL1, "armpll1", 0x200, 0x218, 0x80000001, 0, 21, 0x204, 24, 0x0, 0x204, 0),
  649. + PLL(CLK_APMIXED_ARMPLL2, "armpll2", 0x2cc, 0x2e4, 0x80000001, 0, 21, 0x2d0, 24, 0x0, 0x2d0, 0),
  650. + PLL(CLK_APMIXED_MAINPLL, "mainpll", 0x21c, 0x234, 0xf0000001, HAVE_RST_BAR, 21, 0x21c, 6, 0x0, 0x220, 0),
  651. + PLL(CLK_APMIXED_UNIVPLL, "univpll", 0x238, 0x250, 0xf3000001, HAVE_RST_BAR, 7, 0x238, 6, 0x0, 0x238, 9),
  652. + PLL(CLK_APMIXED_MMPLL, "mmpll", 0x254, 0x26c, 0xf0000001, HAVE_RST_BAR, 21, 0x254, 6, 0x0, 0x258, 0),
  653. + PLL(CLK_APMIXED_MSDCPLL, "msdcpll", 0x278, 0x290, 0x80000001, 0, 21, 0x278, 6, 0x0, 0x27c, 0),
  654. + PLL(CLK_APMIXED_TVDPLL, "tvdpll", 0x294, 0x2ac, 0x80000001, 0, 31, 0x294, 6, 0x0, 0x298, 0),
  655. + PLL(CLK_APMIXED_LVDSPLL, "lvdspll", 0x2b0, 0x2c8, 0x80000001, 0, 21, 0x2b0, 6, 0x0, 0x2b4, 0),
  656. + PLL(CLK_APMIXED_AUDPLL, "audpll", 0x2e8, 0x300, 0x80000001, 0, 31, 0x2e8, 6, 0x2f8, 0x2ec, 0),
  657. + PLL(CLK_APMIXED_VDECPLL, "vdecpll", 0x304, 0x31c, 0x80000001, 0, 21, 0x2b0, 6, 0x0, 0x308, 0),
  658. +};
  659. +
  660. +static void __init mtk_apmixedsys_init(struct device_node *node)
  661. +{
  662. + struct clk_onecell_data *clk_data;
  663. +
  664. + clk_data = mtk_alloc_clk_data(ARRAY_SIZE(plls));
  665. + if (!clk_data)
  666. + return;
  667. +
  668. + mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
  669. +}
  670. +CLK_OF_DECLARE(mtk_apmixedsys, "mediatek,mt8135-apmixedsys",
  671. + mtk_apmixedsys_init);
  672. --- /dev/null
  673. +++ b/include/dt-bindings/clock/mt8135-clk.h
  674. @@ -0,0 +1,194 @@
  675. +/*
  676. + * Copyright (c) 2014 MediaTek Inc.
  677. + * Author: James Liao <[email protected]>
  678. + *
  679. + * This program is free software; you can redistribute it and/or modify
  680. + * it under the terms of the GNU General Public License version 2 as
  681. + * published by the Free Software Foundation.
  682. + *
  683. + * This program is distributed in the hope that it will be useful,
  684. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  685. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  686. + * GNU General Public License for more details.
  687. + */
  688. +
  689. +#ifndef _DT_BINDINGS_CLK_MT8135_H
  690. +#define _DT_BINDINGS_CLK_MT8135_H
  691. +
  692. +/* TOPCKGEN */
  693. +
  694. +#define CLK_TOP_DSI0_LNTC_DSICLK 1
  695. +#define CLK_TOP_HDMITX_CLKDIG_CTS 2
  696. +#define CLK_TOP_CLKPH_MCK 3
  697. +#define CLK_TOP_CPUM_TCK_IN 4
  698. +#define CLK_TOP_MAINPLL_806M 5
  699. +#define CLK_TOP_MAINPLL_537P3M 6
  700. +#define CLK_TOP_MAINPLL_322P4M 7
  701. +#define CLK_TOP_MAINPLL_230P3M 8
  702. +#define CLK_TOP_UNIVPLL_624M 9
  703. +#define CLK_TOP_UNIVPLL_416M 10
  704. +#define CLK_TOP_UNIVPLL_249P6M 11
  705. +#define CLK_TOP_UNIVPLL_178P3M 12
  706. +#define CLK_TOP_UNIVPLL_48M 13
  707. +#define CLK_TOP_MMPLL_D2 14
  708. +#define CLK_TOP_MMPLL_D3 15
  709. +#define CLK_TOP_MMPLL_D5 16
  710. +#define CLK_TOP_MMPLL_D7 17
  711. +#define CLK_TOP_MMPLL_D4 18
  712. +#define CLK_TOP_MMPLL_D6 19
  713. +#define CLK_TOP_SYSPLL_D2 20
  714. +#define CLK_TOP_SYSPLL_D4 21
  715. +#define CLK_TOP_SYSPLL_D6 22
  716. +#define CLK_TOP_SYSPLL_D8 23
  717. +#define CLK_TOP_SYSPLL_D10 24
  718. +#define CLK_TOP_SYSPLL_D12 25
  719. +#define CLK_TOP_SYSPLL_D16 26
  720. +#define CLK_TOP_SYSPLL_D24 27
  721. +#define CLK_TOP_SYSPLL_D3 28
  722. +#define CLK_TOP_SYSPLL_D2P5 29
  723. +#define CLK_TOP_SYSPLL_D5 30
  724. +#define CLK_TOP_SYSPLL_D3P5 31
  725. +#define CLK_TOP_UNIVPLL1_D2 32
  726. +#define CLK_TOP_UNIVPLL1_D4 33
  727. +#define CLK_TOP_UNIVPLL1_D6 34
  728. +#define CLK_TOP_UNIVPLL1_D8 35
  729. +#define CLK_TOP_UNIVPLL1_D10 36
  730. +#define CLK_TOP_UNIVPLL2_D2 37
  731. +#define CLK_TOP_UNIVPLL2_D4 38
  732. +#define CLK_TOP_UNIVPLL2_D6 39
  733. +#define CLK_TOP_UNIVPLL2_D8 40
  734. +#define CLK_TOP_UNIVPLL_D3 41
  735. +#define CLK_TOP_UNIVPLL_D5 42
  736. +#define CLK_TOP_UNIVPLL_D7 43
  737. +#define CLK_TOP_UNIVPLL_D10 44
  738. +#define CLK_TOP_UNIVPLL_D26 45
  739. +#define CLK_TOP_APLL 46
  740. +#define CLK_TOP_APLL_D4 47
  741. +#define CLK_TOP_APLL_D8 48
  742. +#define CLK_TOP_APLL_D16 49
  743. +#define CLK_TOP_APLL_D24 50
  744. +#define CLK_TOP_LVDSPLL_D2 51
  745. +#define CLK_TOP_LVDSPLL_D4 52
  746. +#define CLK_TOP_LVDSPLL_D8 53
  747. +#define CLK_TOP_LVDSTX_CLKDIG_CT 54
  748. +#define CLK_TOP_VPLL_DPIX 55
  749. +#define CLK_TOP_TVHDMI_H 56
  750. +#define CLK_TOP_HDMITX_CLKDIG_D2 57
  751. +#define CLK_TOP_HDMITX_CLKDIG_D3 58
  752. +#define CLK_TOP_TVHDMI_D2 59
  753. +#define CLK_TOP_TVHDMI_D4 60
  754. +#define CLK_TOP_MEMPLL_MCK_D4 61
  755. +#define CLK_TOP_AXI_SEL 62
  756. +#define CLK_TOP_SMI_SEL 63
  757. +#define CLK_TOP_MFG_SEL 64
  758. +#define CLK_TOP_IRDA_SEL 65
  759. +#define CLK_TOP_CAM_SEL 66
  760. +#define CLK_TOP_AUD_INTBUS_SEL 67
  761. +#define CLK_TOP_JPG_SEL 68
  762. +#define CLK_TOP_DISP_SEL 69
  763. +#define CLK_TOP_MSDC30_1_SEL 70
  764. +#define CLK_TOP_MSDC30_2_SEL 71
  765. +#define CLK_TOP_MSDC30_3_SEL 72
  766. +#define CLK_TOP_MSDC30_4_SEL 73
  767. +#define CLK_TOP_USB20_SEL 74
  768. +#define CLK_TOP_VENC_SEL 75
  769. +#define CLK_TOP_SPI_SEL 76
  770. +#define CLK_TOP_UART_SEL 77
  771. +#define CLK_TOP_MEM_SEL 78
  772. +#define CLK_TOP_CAMTG_SEL 79
  773. +#define CLK_TOP_AUDIO_SEL 80
  774. +#define CLK_TOP_FIX_SEL 81
  775. +#define CLK_TOP_VDEC_SEL 82
  776. +#define CLK_TOP_DDRPHYCFG_SEL 83
  777. +#define CLK_TOP_DPILVDS_SEL 84
  778. +#define CLK_TOP_PMICSPI_SEL 85
  779. +#define CLK_TOP_MSDC30_0_SEL 86
  780. +#define CLK_TOP_SMI_MFG_AS_SEL 87
  781. +#define CLK_TOP_GCPU_SEL 88
  782. +#define CLK_TOP_DPI1_SEL 89
  783. +#define CLK_TOP_CCI_SEL 90
  784. +#define CLK_TOP_APLL_SEL 91
  785. +#define CLK_TOP_HDMIPLL_SEL 92
  786. +#define CLK_TOP_NR_CLK 93
  787. +
  788. +/* APMIXED_SYS */
  789. +
  790. +#define CLK_APMIXED_ARMPLL1 1
  791. +#define CLK_APMIXED_ARMPLL2 2
  792. +#define CLK_APMIXED_MAINPLL 3
  793. +#define CLK_APMIXED_UNIVPLL 4
  794. +#define CLK_APMIXED_MMPLL 5
  795. +#define CLK_APMIXED_MSDCPLL 6
  796. +#define CLK_APMIXED_TVDPLL 7
  797. +#define CLK_APMIXED_LVDSPLL 8
  798. +#define CLK_APMIXED_AUDPLL 9
  799. +#define CLK_APMIXED_VDECPLL 10
  800. +#define CLK_APMIXED_NR_CLK 11
  801. +
  802. +/* INFRA_SYS */
  803. +
  804. +#define CLK_INFRA_PMIC_WRAP 1
  805. +#define CLK_INFRA_PMICSPI 2
  806. +#define CLK_INFRA_CCIF1_AP_CTRL 3
  807. +#define CLK_INFRA_CCIF0_AP_CTRL 4
  808. +#define CLK_INFRA_KP 5
  809. +#define CLK_INFRA_CPUM 6
  810. +#define CLK_INFRA_M4U 7
  811. +#define CLK_INFRA_MFGAXI 8
  812. +#define CLK_INFRA_DEVAPC 9
  813. +#define CLK_INFRA_AUDIO 10
  814. +#define CLK_INFRA_MFG_BUS 11
  815. +#define CLK_INFRA_SMI 12
  816. +#define CLK_INFRA_DBGCLK 13
  817. +#define CLK_INFRA_NR_CLK 14
  818. +
  819. +/* PERI_SYS */
  820. +
  821. +#define CLK_PERI_I2C5 1
  822. +#define CLK_PERI_I2C4 2
  823. +#define CLK_PERI_I2C3 3
  824. +#define CLK_PERI_I2C2 4
  825. +#define CLK_PERI_I2C1 5
  826. +#define CLK_PERI_I2C0 6
  827. +#define CLK_PERI_UART3 7
  828. +#define CLK_PERI_UART2 8
  829. +#define CLK_PERI_UART1 9
  830. +#define CLK_PERI_UART0 10
  831. +#define CLK_PERI_IRDA 11
  832. +#define CLK_PERI_NLI 12
  833. +#define CLK_PERI_MD_HIF 13
  834. +#define CLK_PERI_AP_HIF 14
  835. +#define CLK_PERI_MSDC30_3 15
  836. +#define CLK_PERI_MSDC30_2 16
  837. +#define CLK_PERI_MSDC30_1 17
  838. +#define CLK_PERI_MSDC20_2 18
  839. +#define CLK_PERI_MSDC20_1 19
  840. +#define CLK_PERI_AP_DMA 20
  841. +#define CLK_PERI_USB1 21
  842. +#define CLK_PERI_USB0 22
  843. +#define CLK_PERI_PWM 23
  844. +#define CLK_PERI_PWM7 24
  845. +#define CLK_PERI_PWM6 25
  846. +#define CLK_PERI_PWM5 26
  847. +#define CLK_PERI_PWM4 27
  848. +#define CLK_PERI_PWM3 28
  849. +#define CLK_PERI_PWM2 29
  850. +#define CLK_PERI_PWM1 30
  851. +#define CLK_PERI_THERM 31
  852. +#define CLK_PERI_NFI 32
  853. +#define CLK_PERI_USBSLV 33
  854. +#define CLK_PERI_USB1_MCU 34
  855. +#define CLK_PERI_USB0_MCU 35
  856. +#define CLK_PERI_GCPU 36
  857. +#define CLK_PERI_FHCTL 37
  858. +#define CLK_PERI_SPI1 38
  859. +#define CLK_PERI_AUXADC 39
  860. +#define CLK_PERI_PERI_PWRAP 40
  861. +#define CLK_PERI_I2C6 41
  862. +#define CLK_PERI_UART0_SEL 42
  863. +#define CLK_PERI_UART1_SEL 43
  864. +#define CLK_PERI_UART2_SEL 44
  865. +#define CLK_PERI_UART3_SEL 45
  866. +#define CLK_PERI_NR_CLK 46
  867. +
  868. +#endif /* _DT_BINDINGS_CLK_MT8135_H */
  869. --- /dev/null
  870. +++ b/include/dt-bindings/reset-controller/mt8135-resets.h
  871. @@ -0,0 +1,64 @@
  872. +/*
  873. + * Copyright (c) 2014 MediaTek Inc.
  874. + * Author: Flora Fu, MediaTek
  875. + *
  876. + * This program is free software; you can redistribute it and/or modify
  877. + * it under the terms of the GNU General Public License version 2 as
  878. + * published by the Free Software Foundation.
  879. + *
  880. + * This program is distributed in the hope that it will be useful,
  881. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  882. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  883. + * GNU General Public License for more details.
  884. + */
  885. +
  886. +#ifndef _DT_BINDINGS_RESET_CONTROLLER_MT8135
  887. +#define _DT_BINDINGS_RESET_CONTROLLER_MT8135
  888. +
  889. +/* INFRACFG resets */
  890. +#define MT8135_INFRA_EMI_REG_RST 0
  891. +#define MT8135_INFRA_DRAMC0_A0_RST 1
  892. +#define MT8135_INFRA_CCIF0_RST 2
  893. +#define MT8135_INFRA_APCIRQ_EINT_RST 3
  894. +#define MT8135_INFRA_APXGPT_RST 4
  895. +#define MT8135_INFRA_SCPSYS_RST 5
  896. +#define MT8135_INFRA_CCIF1_RST 6
  897. +#define MT8135_INFRA_PMIC_WRAP_RST 7
  898. +#define MT8135_INFRA_KP_RST 8
  899. +#define MT8135_INFRA_EMI_RST 32
  900. +#define MT8135_INFRA_DRAMC0_RST 34
  901. +#define MT8135_INFRA_SMI_RST 35
  902. +#define MT8135_INFRA_M4U_RST 36
  903. +
  904. +/* PERICFG resets */
  905. +#define MT8135_PERI_UART0_SW_RST 0
  906. +#define MT8135_PERI_UART1_SW_RST 1
  907. +#define MT8135_PERI_UART2_SW_RST 2
  908. +#define MT8135_PERI_UART3_SW_RST 3
  909. +#define MT8135_PERI_IRDA_SW_RST 4
  910. +#define MT8135_PERI_PTP_SW_RST 5
  911. +#define MT8135_PERI_AP_HIF_SW_RST 6
  912. +#define MT8135_PERI_GPCU_SW_RST 7
  913. +#define MT8135_PERI_MD_HIF_SW_RST 8
  914. +#define MT8135_PERI_NLI_SW_RST 9
  915. +#define MT8135_PERI_AUXADC_SW_RST 10
  916. +#define MT8135_PERI_DMA_SW_RST 11
  917. +#define MT8135_PERI_NFI_SW_RST 14
  918. +#define MT8135_PERI_PWM_SW_RST 15
  919. +#define MT8135_PERI_THERM_SW_RST 16
  920. +#define MT8135_PERI_MSDC0_SW_RST 17
  921. +#define MT8135_PERI_MSDC1_SW_RST 18
  922. +#define MT8135_PERI_MSDC2_SW_RST 19
  923. +#define MT8135_PERI_MSDC3_SW_RST 20
  924. +#define MT8135_PERI_I2C0_SW_RST 22
  925. +#define MT8135_PERI_I2C1_SW_RST 23
  926. +#define MT8135_PERI_I2C2_SW_RST 24
  927. +#define MT8135_PERI_I2C3_SW_RST 25
  928. +#define MT8135_PERI_I2C4_SW_RST 26
  929. +#define MT8135_PERI_I2C5_SW_RST 27
  930. +#define MT8135_PERI_I2C6_SW_RST 28
  931. +#define MT8135_PERI_USB_SW_RST 29
  932. +#define MT8135_PERI_SPI1_SW_RST 33
  933. +#define MT8135_PERI_PWRAP_BRIDGE_SW_RST 34
  934. +
  935. +#endif /* _DT_BINDINGS_RESET_CONTROLLER_MT8135 */