002-0027-clk-mediatek-add-clock-driver-support-for-MediaTek-M.patch 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985
  1. From d525836896235c4678f6144cc4608d5b15e02660 Mon Sep 17 00:00:00 2001
  2. From: Weijie Gao <[email protected]>
  3. Date: Wed, 31 Aug 2022 19:05:16 +0800
  4. Subject: [PATCH 27/32] clk: mediatek: add clock driver support for MediaTek
  5. MT7981 SoC
  6. This patch adds clock driver support for MediaTek MT7981 SoC
  7. Reviewed-by: Sean Anderson <[email protected]>
  8. Reviewed-by: Simon Glass <[email protected]>
  9. Signed-off-by: Weijie Gao <[email protected]>
  10. ---
  11. drivers/clk/mediatek/Makefile | 1 +
  12. drivers/clk/mediatek/clk-mt7981.c | 683 +++++++++++++++++++++++++
  13. include/dt-bindings/clock/mt7981-clk.h | 267 ++++++++++
  14. 3 files changed, 951 insertions(+)
  15. create mode 100644 drivers/clk/mediatek/clk-mt7981.c
  16. create mode 100644 include/dt-bindings/clock/mt7981-clk.h
  17. --- a/drivers/clk/mediatek/Makefile
  18. +++ b/drivers/clk/mediatek/Makefile
  19. @@ -8,6 +8,7 @@ obj-$(CONFIG_TARGET_MT7623) += clk-mt762
  20. obj-$(CONFIG_TARGET_MT7622) += clk-mt7622.o
  21. obj-$(CONFIG_TARGET_MT7629) += clk-mt7629.o
  22. obj-$(CONFIG_TARGET_MT7986) += clk-mt7986.o
  23. +obj-$(CONFIG_TARGET_MT7981) += clk-mt7981.o
  24. obj-$(CONFIG_TARGET_MT8183) += clk-mt8183.o
  25. obj-$(CONFIG_TARGET_MT8516) += clk-mt8516.o
  26. obj-$(CONFIG_TARGET_MT8518) += clk-mt8518.o
  27. --- /dev/null
  28. +++ b/drivers/clk/mediatek/clk-mt7981.c
  29. @@ -0,0 +1,683 @@
  30. +// SPDX-License-Identifier: GPL-2.0
  31. +/*
  32. + * MediaTek clock driver for MT7981 SoC
  33. + *
  34. + * Copyright (C) 2022 MediaTek Inc.
  35. + * Author: Sam Shih <[email protected]>
  36. + */
  37. +
  38. +#include <dm.h>
  39. +#include <log.h>
  40. +#include <asm/arch-mediatek/reset.h>
  41. +#include <asm/io.h>
  42. +#include <dt-bindings/clock/mt7981-clk.h>
  43. +#include <linux/bitops.h>
  44. +
  45. +#include "clk-mtk.h"
  46. +
  47. +#define MT7981_CLK_PDN 0x250
  48. +#define MT7981_CLK_PDN_EN_WRITE BIT(31)
  49. +
  50. +#define PLL_FACTOR(_id, _name, _parent, _mult, _div) \
  51. + FACTOR(_id, _parent, _mult, _div, CLK_PARENT_APMIXED)
  52. +
  53. +#define TOP_FACTOR(_id, _name, _parent, _mult, _div) \
  54. + FACTOR(_id, _parent, _mult, _div, CLK_PARENT_TOPCKGEN)
  55. +
  56. +#define INFRA_FACTOR(_id, _name, _parent, _mult, _div) \
  57. + FACTOR(_id, _parent, _mult, _div, CLK_PARENT_INFRASYS)
  58. +
  59. +/* FIXED PLLS */
  60. +static const struct mtk_fixed_clk fixed_pll_clks[] = {
  61. + FIXED_CLK(CK_APMIXED_ARMPLL, CLK_XTAL, 1300000000),
  62. + FIXED_CLK(CK_APMIXED_NET2PLL, CLK_XTAL, 800000000),
  63. + FIXED_CLK(CK_APMIXED_MMPLL, CLK_XTAL, 720000000),
  64. + FIXED_CLK(CK_APMIXED_SGMPLL, CLK_XTAL, 325000000),
  65. + FIXED_CLK(CK_APMIXED_WEDMCUPLL, CLK_XTAL, 208000000),
  66. + FIXED_CLK(CK_APMIXED_NET1PLL, CLK_XTAL, 2500000000),
  67. + FIXED_CLK(CK_APMIXED_MPLL, CLK_XTAL, 416000000),
  68. + FIXED_CLK(CK_APMIXED_APLL2, CLK_XTAL, 196608000),
  69. +};
  70. +
  71. +/* TOPCKGEN FIXED CLK */
  72. +static const struct mtk_fixed_clk top_fixed_clks[] = {
  73. + FIXED_CLK(CK_TOP_CB_CKSQ_40M, CLK_XTAL, 40000000),
  74. +};
  75. +
  76. +/* TOPCKGEN FIXED DIV */
  77. +static const struct mtk_fixed_factor top_fixed_divs[] = {
  78. + PLL_FACTOR(CK_TOP_CB_M_416M, "cb_m_416m", CK_APMIXED_MPLL, 1, 1),
  79. + PLL_FACTOR(CK_TOP_CB_M_D2, "cb_m_d2", CK_APMIXED_MPLL, 1, 2),
  80. + PLL_FACTOR(CK_TOP_CB_M_D3, "cb_m_d3", CK_APMIXED_MPLL, 1, 3),
  81. + PLL_FACTOR(CK_TOP_M_D3_D2, "m_d3_d2", CK_APMIXED_MPLL, 1, 2),
  82. + PLL_FACTOR(CK_TOP_CB_M_D4, "cb_m_d4", CK_APMIXED_MPLL, 1, 4),
  83. + PLL_FACTOR(CK_TOP_CB_M_D8, "cb_m_d8", CK_APMIXED_MPLL, 1, 8),
  84. + PLL_FACTOR(CK_TOP_M_D8_D2, "m_d8_d2", CK_APMIXED_MPLL, 1, 16),
  85. + PLL_FACTOR(CK_TOP_CB_MM_720M, "cb_mm_720m", CK_APMIXED_MMPLL, 1, 1),
  86. + PLL_FACTOR(CK_TOP_CB_MM_D2, "cb_mm_d2", CK_APMIXED_MMPLL, 1, 2),
  87. + PLL_FACTOR(CK_TOP_CB_MM_D3, "cb_mm_d3", CK_APMIXED_MMPLL, 1, 3),
  88. + PLL_FACTOR(CK_TOP_CB_MM_D3_D5, "cb_mm_d3_d5", CK_APMIXED_MMPLL, 1, 15),
  89. + PLL_FACTOR(CK_TOP_CB_MM_D4, "cb_mm_d4", CK_APMIXED_MMPLL, 1, 4),
  90. + PLL_FACTOR(CK_TOP_CB_MM_D6, "cb_mm_d6", CK_APMIXED_MMPLL, 1, 6),
  91. + PLL_FACTOR(CK_TOP_MM_D6_D2, "mm_d6_d2", CK_APMIXED_MMPLL, 1, 12),
  92. + PLL_FACTOR(CK_TOP_CB_MM_D8, "cb_mm_d8", CK_APMIXED_MMPLL, 1, 8),
  93. + PLL_FACTOR(CK_TOP_CB_APLL2_196M, "cb_apll2_196m", CK_APMIXED_APLL2, 1,
  94. + 1),
  95. + PLL_FACTOR(CK_TOP_APLL2_D2, "apll2_d2", CK_APMIXED_APLL2, 1, 2),
  96. + PLL_FACTOR(CK_TOP_APLL2_D4, "apll2_d4", CK_APMIXED_APLL2, 1, 4),
  97. + PLL_FACTOR(CK_TOP_NET1_2500M, "net1_2500m", CK_APMIXED_NET1PLL, 1, 1),
  98. + PLL_FACTOR(CK_TOP_CB_NET1_D4, "cb_net1_d4", CK_APMIXED_NET1PLL, 1, 4),
  99. + PLL_FACTOR(CK_TOP_CB_NET1_D5, "cb_net1_d5", CK_APMIXED_NET1PLL, 1, 5),
  100. + PLL_FACTOR(CK_TOP_NET1_D5_D2, "net1_d5_d2", CK_APMIXED_NET1PLL, 1, 10),
  101. + PLL_FACTOR(CK_TOP_NET1_D5_D4, "net1_d5_d4", CK_APMIXED_NET1PLL, 1, 20),
  102. + PLL_FACTOR(CK_TOP_CB_NET1_D8, "cb_net1_d8", CK_APMIXED_NET1PLL, 1, 8),
  103. + PLL_FACTOR(CK_TOP_NET1_D8_D2, "net1_d8_d2", CK_APMIXED_NET1PLL, 1, 16),
  104. + PLL_FACTOR(CK_TOP_NET1_D8_D4, "net1_d8_d4", CK_APMIXED_NET1PLL, 1, 32),
  105. + PLL_FACTOR(CK_TOP_CB_NET2_800M, "cb_net2_800m", CK_APMIXED_NET2PLL, 1,
  106. + 1),
  107. + PLL_FACTOR(CK_TOP_CB_NET2_D2, "cb_net2_d2", CK_APMIXED_NET2PLL, 1, 2),
  108. + PLL_FACTOR(CK_TOP_CB_NET2_D4, "cb_net2_d4", CK_APMIXED_NET2PLL, 1, 4),
  109. + PLL_FACTOR(CK_TOP_NET2_D4_D2, "net2_d4_d2", CK_APMIXED_NET2PLL, 1, 8),
  110. + PLL_FACTOR(CK_TOP_NET2_D4_D4, "net2_d4_d4", CK_APMIXED_NET2PLL, 1, 16),
  111. + PLL_FACTOR(CK_TOP_CB_NET2_D6, "cb_net2_d6", CK_APMIXED_NET2PLL, 1, 6),
  112. + PLL_FACTOR(CK_TOP_CB_WEDMCU_208M, "cb_wedmcu_208m",
  113. + CK_APMIXED_WEDMCUPLL, 1, 1),
  114. + PLL_FACTOR(CK_TOP_CB_SGM_325M, "cb_sgm_325m", CK_APMIXED_SGMPLL, 1, 1),
  115. + TOP_FACTOR(CK_TOP_CKSQ_40M_D2, "cksq_40m_d2", CK_TOP_CB_CKSQ_40M, 1, 2),
  116. + TOP_FACTOR(CK_TOP_CB_RTC_32K, "cb_rtc_32k", CK_TOP_CB_CKSQ_40M, 1,
  117. + 1250),
  118. + TOP_FACTOR(CK_TOP_CB_RTC_32P7K, "cb_rtc_32p7k", CK_TOP_CB_CKSQ_40M, 1,
  119. + 1220),
  120. + TOP_FACTOR(CK_TOP_USB_TX250M, "usb_tx250m", CK_TOP_CB_CKSQ_40M, 1, 1),
  121. + TOP_FACTOR(CK_TOP_FAUD, "faud", CK_TOP_CB_CKSQ_40M, 1, 1),
  122. + TOP_FACTOR(CK_TOP_NFI1X, "nfi1x", CK_TOP_NFI1X_SEL, 1, 1),
  123. + TOP_FACTOR(CK_TOP_USB_EQ_RX250M, "usb_eq_rx250m", CK_TOP_CB_CKSQ_40M, 1,
  124. + 1),
  125. + TOP_FACTOR(CK_TOP_USB_CDR_CK, "usb_cdr", CK_TOP_CB_CKSQ_40M, 1, 1),
  126. + TOP_FACTOR(CK_TOP_USB_LN0_CK, "usb_ln0", CK_TOP_CB_CKSQ_40M, 1, 1),
  127. + TOP_FACTOR(CK_TOP_SPINFI_BCK, "spinfi_bck", CK_TOP_SPINFI_SEL, 1, 1),
  128. + TOP_FACTOR(CK_TOP_SPI, "spi", CK_TOP_SPI_SEL, 1, 1),
  129. + TOP_FACTOR(CK_TOP_SPIM_MST, "spim_mst", CK_TOP_SPIM_MST_SEL, 1, 1),
  130. + TOP_FACTOR(CK_TOP_UART_BCK, "uart_bck", CK_TOP_UART_SEL, 1, 1),
  131. + TOP_FACTOR(CK_TOP_PWM_BCK, "pwm_bck", CK_TOP_PWM_SEL, 1, 1),
  132. + TOP_FACTOR(CK_TOP_I2C_BCK, "i2c_bck", CK_TOP_I2C_SEL, 1, 1),
  133. + TOP_FACTOR(CK_TOP_PEXTP_TL, "pextp_tl", CK_TOP_PEXTP_TL_SEL, 1, 1),
  134. + TOP_FACTOR(CK_TOP_EMMC_208M, "emmc_208m", CK_TOP_EMMC_208M_SEL, 1, 1),
  135. + TOP_FACTOR(CK_TOP_EMMC_400M, "emmc_400m", CK_TOP_EMMC_400M_SEL, 1, 1),
  136. + TOP_FACTOR(CK_TOP_DRAMC_REF, "dramc_ref", CK_TOP_DRAMC_SEL, 1, 1),
  137. + TOP_FACTOR(CK_TOP_DRAMC_MD32, "dramc_md32", CK_TOP_DRAMC_MD32_SEL, 1,
  138. + 1),
  139. + TOP_FACTOR(CK_TOP_SYSAXI, "sysaxi", CK_TOP_SYSAXI_SEL, 1, 1),
  140. + TOP_FACTOR(CK_TOP_SYSAPB, "sysapb", CK_TOP_SYSAPB_SEL, 1, 1),
  141. + TOP_FACTOR(CK_TOP_ARM_DB_MAIN, "arm_db_main", CK_TOP_ARM_DB_MAIN_SEL, 1,
  142. + 1),
  143. + TOP_FACTOR(CK_TOP_AP2CNN_HOST, "ap2cnn_host", CK_TOP_AP2CNN_HOST_SEL, 1,
  144. + 1),
  145. + TOP_FACTOR(CK_TOP_NETSYS, "netsys", CK_TOP_NETSYS_SEL, 1, 1),
  146. + TOP_FACTOR(CK_TOP_NETSYS_500M, "netsys_500m", CK_TOP_NETSYS_500M_SEL, 1,
  147. + 1),
  148. + TOP_FACTOR(CK_TOP_NETSYS_WED_MCU, "netsys_wed_mcu",
  149. + CK_TOP_NETSYS_MCU_SEL, 1, 1),
  150. + TOP_FACTOR(CK_TOP_NETSYS_2X, "netsys_2x", CK_TOP_NETSYS_2X_SEL, 1, 1),
  151. + TOP_FACTOR(CK_TOP_SGM_325M, "sgm_325m", CK_TOP_SGM_325M_SEL, 1, 1),
  152. + TOP_FACTOR(CK_TOP_SGM_REG, "sgm_reg", CK_TOP_SGM_REG_SEL, 1, 1),
  153. + TOP_FACTOR(CK_TOP_F26M, "csw_f26m", CK_TOP_F26M_SEL, 1, 1),
  154. + TOP_FACTOR(CK_TOP_EIP97B, "eip97b", CK_TOP_EIP97B_SEL, 1, 1),
  155. + TOP_FACTOR(CK_TOP_USB3_PHY, "usb3_phy", CK_TOP_USB3_PHY_SEL, 1, 1),
  156. + TOP_FACTOR(CK_TOP_AUD, "aud", CK_TOP_FAUD, 1, 1),
  157. + TOP_FACTOR(CK_TOP_A1SYS, "a1sys", CK_TOP_A1SYS_SEL, 1, 1),
  158. + TOP_FACTOR(CK_TOP_AUD_L, "aud_l", CK_TOP_AUD_L_SEL, 1, 1),
  159. + TOP_FACTOR(CK_TOP_A_TUNER, "a_tuner", CK_TOP_A_TUNER_SEL, 1, 1),
  160. + TOP_FACTOR(CK_TOP_U2U3_REF, "u2u3_ref", CK_TOP_U2U3_SEL, 1, 1),
  161. + TOP_FACTOR(CK_TOP_U2U3_SYS, "u2u3_sys", CK_TOP_U2U3_SYS_SEL, 1, 1),
  162. + TOP_FACTOR(CK_TOP_U2U3_XHCI, "u2u3_xhci", CK_TOP_U2U3_XHCI_SEL, 1, 1),
  163. + TOP_FACTOR(CK_TOP_USB_FRMCNT, "usb_frmcnt", CK_TOP_USB_FRMCNT_SEL, 1,
  164. + 1),
  165. +};
  166. +
  167. +/* TOPCKGEN MUX PARENTS */
  168. +static const int nfi1x_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_MM_D4,
  169. + CK_TOP_NET1_D8_D2, CK_TOP_CB_NET2_D6,
  170. + CK_TOP_CB_M_D4, CK_TOP_CB_MM_D8,
  171. + CK_TOP_NET1_D8_D4, CK_TOP_CB_M_D8 };
  172. +
  173. +static const int spinfi_parents[] = { CK_TOP_CKSQ_40M_D2, CK_TOP_CB_CKSQ_40M,
  174. + CK_TOP_NET1_D5_D4, CK_TOP_CB_M_D4,
  175. + CK_TOP_CB_MM_D8, CK_TOP_NET1_D8_D4,
  176. + CK_TOP_MM_D6_D2, CK_TOP_CB_M_D8 };
  177. +
  178. +static const int spi_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_M_D2,
  179. + CK_TOP_CB_MM_D4, CK_TOP_NET1_D8_D2,
  180. + CK_TOP_CB_NET2_D6, CK_TOP_NET1_D5_D4,
  181. + CK_TOP_CB_M_D4, CK_TOP_NET1_D8_D4 };
  182. +
  183. +static const int uart_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_M_D8,
  184. + CK_TOP_M_D8_D2 };
  185. +
  186. +static const int pwm_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_NET1_D8_D2,
  187. + CK_TOP_NET1_D5_D4, CK_TOP_CB_M_D4,
  188. + CK_TOP_M_D8_D2, CK_TOP_CB_RTC_32K };
  189. +
  190. +static const int i2c_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_NET1_D5_D4,
  191. + CK_TOP_CB_M_D4, CK_TOP_NET1_D8_D4 };
  192. +
  193. +static const int pextp_tl_ck_parents[] = { CK_TOP_CB_CKSQ_40M,
  194. + CK_TOP_NET1_D5_D4, CK_TOP_CB_M_D4,
  195. + CK_TOP_CB_RTC_32K };
  196. +
  197. +static const int emmc_208m_parents[] = {
  198. + CK_TOP_CB_CKSQ_40M, CK_TOP_CB_M_D2, CK_TOP_CB_NET2_D4,
  199. + CK_TOP_CB_APLL2_196M, CK_TOP_CB_MM_D4, CK_TOP_NET1_D8_D2,
  200. + CK_TOP_CB_MM_D6
  201. +};
  202. +
  203. +static const int emmc_400m_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_NET2_D2,
  204. + CK_TOP_CB_MM_D2, CK_TOP_CB_NET2_D2 };
  205. +
  206. +static const int csw_f26m_parents[] = { CK_TOP_CKSQ_40M_D2, CK_TOP_M_D8_D2 };
  207. +
  208. +static const int dramc_md32_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_M_D2,
  209. + CK_TOP_CB_WEDMCU_208M };
  210. +
  211. +static const int sysaxi_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_NET1_D8_D2 };
  212. +
  213. +static const int sysapb_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_M_D3_D2 };
  214. +
  215. +static const int arm_db_main_parents[] = { CK_TOP_CB_CKSQ_40M,
  216. + CK_TOP_CB_NET2_D6 };
  217. +
  218. +static const int ap2cnn_host_parents[] = { CK_TOP_CB_CKSQ_40M,
  219. + CK_TOP_NET1_D8_D4 };
  220. +
  221. +static const int netsys_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_MM_D2 };
  222. +
  223. +static const int netsys_500m_parents[] = { CK_TOP_CB_CKSQ_40M,
  224. + CK_TOP_CB_NET1_D5 };
  225. +
  226. +static const int netsys_mcu_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_MM_720M,
  227. + CK_TOP_CB_NET1_D4, CK_TOP_CB_NET1_D5,
  228. + CK_TOP_CB_M_416M };
  229. +
  230. +static const int netsys_2x_parents[] = { CK_TOP_CB_CKSQ_40M,
  231. + CK_TOP_CB_NET2_800M,
  232. + CK_TOP_CB_MM_720M };
  233. +
  234. +static const int sgm_325m_parents[] = { CK_TOP_CB_CKSQ_40M,
  235. + CK_TOP_CB_SGM_325M };
  236. +
  237. +static const int sgm_reg_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_NET2_D4 };
  238. +
  239. +static const int eip97b_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_NET1_D5,
  240. + CK_TOP_CB_M_416M, CK_TOP_CB_MM_D2,
  241. + CK_TOP_NET1_D5_D2 };
  242. +
  243. +static const int aud_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_APLL2_196M };
  244. +
  245. +static const int a1sys_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_APLL2_D4 };
  246. +
  247. +static const int aud_l_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_CB_APLL2_196M,
  248. + CK_TOP_M_D8_D2 };
  249. +
  250. +static const int a_tuner_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_APLL2_D4,
  251. + CK_TOP_M_D8_D2 };
  252. +
  253. +static const int u2u3_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_M_D8_D2 };
  254. +
  255. +static const int u2u3_sys_parents[] = { CK_TOP_CB_CKSQ_40M, CK_TOP_NET1_D5_D4 };
  256. +
  257. +static const int usb_frmcnt_parents[] = { CK_TOP_CB_CKSQ_40M,
  258. + CK_TOP_CB_MM_D3_D5 };
  259. +
  260. +#define TOP_MUX(_id, _name, _parents, _mux_ofs, _mux_set_ofs, _mux_clr_ofs, \
  261. + _shift, _width, _gate, _upd_ofs, _upd) \
  262. + { \
  263. + .id = _id, .mux_reg = _mux_ofs, .mux_set_reg = _mux_set_ofs, \
  264. + .mux_clr_reg = _mux_clr_ofs, .upd_reg = _upd_ofs, \
  265. + .upd_shift = _upd, .mux_shift = _shift, \
  266. + .mux_mask = BIT(_width) - 1, .gate_reg = _mux_ofs, \
  267. + .gate_shift = _gate, .parent = _parents, \
  268. + .num_parents = ARRAY_SIZE(_parents), \
  269. + .flags = CLK_MUX_SETCLR_UPD, \
  270. + }
  271. +
  272. +/* TOPCKGEN MUX_GATE */
  273. +static const struct mtk_composite top_muxes[] = {
  274. + TOP_MUX(CK_TOP_NFI1X_SEL, "nfi1x_sel", nfi1x_parents, 0x0, 0x4, 0x8, 0,
  275. + 3, 7, 0x1c0, 0),
  276. + TOP_MUX(CK_TOP_SPINFI_SEL, "spinfi_sel", spinfi_parents, 0x0, 0x4, 0x8,
  277. + 8, 3, 15, 0x1c0, 1),
  278. + TOP_MUX(CK_TOP_SPI_SEL, "spi_sel", spi_parents, 0x0, 0x4, 0x8, 16, 3,
  279. + 23, 0x1c0, 2),
  280. + TOP_MUX(CK_TOP_SPIM_MST_SEL, "spim_mst_sel", spi_parents, 0x0, 0x4, 0x8,
  281. + 24, 3, 31, 0x1c0, 3),
  282. + TOP_MUX(CK_TOP_UART_SEL, "uart_sel", uart_parents, 0x10, 0x14, 0x18, 0,
  283. + 2, 7, 0x1c0, 4),
  284. + TOP_MUX(CK_TOP_PWM_SEL, "pwm_sel", pwm_parents, 0x10, 0x14, 0x18, 8, 3,
  285. + 15, 0x1c0, 5),
  286. + TOP_MUX(CK_TOP_I2C_SEL, "i2c_sel", i2c_parents, 0x10, 0x14, 0x18, 16, 2,
  287. + 23, 0x1c0, 6),
  288. + TOP_MUX(CK_TOP_PEXTP_TL_SEL, "pextp_tl_ck_sel", pextp_tl_ck_parents,
  289. + 0x10, 0x14, 0x18, 24, 2, 31, 0x1c0, 7),
  290. + TOP_MUX(CK_TOP_EMMC_208M_SEL, "emmc_208m_sel", emmc_208m_parents, 0x20,
  291. + 0x24, 0x28, 0, 3, 7, 0x1c0, 8),
  292. + TOP_MUX(CK_TOP_EMMC_400M_SEL, "emmc_400m_sel", emmc_400m_parents, 0x20,
  293. + 0x24, 0x28, 8, 2, 15, 0x1c0, 9),
  294. + TOP_MUX(CK_TOP_F26M_SEL, "csw_f26m_sel", csw_f26m_parents, 0x20, 0x24,
  295. + 0x28, 16, 1, 23, 0x1c0, 10),
  296. + TOP_MUX(CK_TOP_DRAMC_SEL, "dramc_sel", csw_f26m_parents, 0x20, 0x24,
  297. + 0x28, 24, 1, 31, 0x1c0, 11),
  298. + TOP_MUX(CK_TOP_DRAMC_MD32_SEL, "dramc_md32_sel", dramc_md32_parents,
  299. + 0x30, 0x34, 0x38, 0, 2, 7, 0x1c0, 12),
  300. + TOP_MUX(CK_TOP_SYSAXI_SEL, "sysaxi_sel", sysaxi_parents, 0x30, 0x34,
  301. + 0x38, 8, 1, 15, 0x1c0, 13),
  302. + TOP_MUX(CK_TOP_SYSAPB_SEL, "sysapb_sel", sysapb_parents, 0x30, 0x34,
  303. + 0x38, 16, 1, 23, 0x1c0, 14),
  304. + TOP_MUX(CK_TOP_ARM_DB_MAIN_SEL, "arm_db_main_sel", arm_db_main_parents,
  305. + 0x30, 0x34, 0x38, 24, 1, 31, 0x1c0, 15),
  306. + TOP_MUX(CK_TOP_AP2CNN_HOST_SEL, "ap2cnn_host_sel", ap2cnn_host_parents,
  307. + 0x40, 0x44, 0x48, 0, 1, 7, 0x1c0, 16),
  308. + TOP_MUX(CK_TOP_NETSYS_SEL, "netsys_sel", netsys_parents, 0x40, 0x44,
  309. + 0x48, 8, 1, 15, 0x1c0, 17),
  310. + TOP_MUX(CK_TOP_NETSYS_500M_SEL, "netsys_500m_sel", netsys_500m_parents,
  311. + 0x40, 0x44, 0x48, 16, 1, 23, 0x1c0, 18),
  312. + TOP_MUX(CK_TOP_NETSYS_MCU_SEL, "netsys_mcu_sel", netsys_mcu_parents,
  313. + 0x40, 0x44, 0x48, 24, 3, 31, 0x1c0, 19),
  314. + TOP_MUX(CK_TOP_NETSYS_2X_SEL, "netsys_2x_sel", netsys_2x_parents, 0x50,
  315. + 0x54, 0x58, 0, 2, 7, 0x1c0, 20),
  316. + TOP_MUX(CK_TOP_SGM_325M_SEL, "sgm_325m_sel", sgm_325m_parents, 0x50,
  317. + 0x54, 0x58, 8, 1, 15, 0x1c0, 21),
  318. + TOP_MUX(CK_TOP_SGM_REG_SEL, "sgm_reg_sel", sgm_reg_parents, 0x50, 0x54,
  319. + 0x58, 16, 1, 23, 0x1c0, 22),
  320. + TOP_MUX(CK_TOP_EIP97B_SEL, "eip97b_sel", eip97b_parents, 0x50, 0x54,
  321. + 0x58, 24, 3, 31, 0x1c0, 23),
  322. + TOP_MUX(CK_TOP_USB3_PHY_SEL, "usb3_phy_sel", csw_f26m_parents, 0x60,
  323. + 0x64, 0x68, 0, 1, 7, 0x1c0, 24),
  324. + TOP_MUX(CK_TOP_AUD_SEL, "aud_sel", aud_parents, 0x60, 0x64, 0x68, 8, 1,
  325. + 15, 0x1c0, 25),
  326. + TOP_MUX(CK_TOP_A1SYS_SEL, "a1sys_sel", a1sys_parents, 0x60, 0x64, 0x68,
  327. + 16, 1, 23, 0x1c0, 26),
  328. + TOP_MUX(CK_TOP_AUD_L_SEL, "aud_l_sel", aud_l_parents, 0x60, 0x64, 0x68,
  329. + 24, 2, 31, 0x1c0, 27),
  330. + TOP_MUX(CK_TOP_A_TUNER_SEL, "a_tuner_sel", a_tuner_parents, 0x70, 0x74,
  331. + 0x78, 0, 2, 7, 0x1c0, 28),
  332. + TOP_MUX(CK_TOP_U2U3_SEL, "u2u3_sel", u2u3_parents, 0x70, 0x74, 0x78, 8,
  333. + 1, 15, 0x1c0, 29),
  334. + TOP_MUX(CK_TOP_U2U3_SYS_SEL, "u2u3_sys_sel", u2u3_sys_parents, 0x70,
  335. + 0x74, 0x78, 16, 1, 23, 0x1c0, 30),
  336. + TOP_MUX(CK_TOP_U2U3_XHCI_SEL, "u2u3_xhci_sel", u2u3_sys_parents, 0x70,
  337. + 0x74, 0x78, 24, 1, 31, 0x1c4, 0),
  338. + TOP_MUX(CK_TOP_USB_FRMCNT_SEL, "usb_frmcnt_sel", usb_frmcnt_parents,
  339. + 0x80, 0x84, 0x88, 0, 1, 7, 0x1c4, 1),
  340. +};
  341. +
  342. +/* INFRA FIXED DIV */
  343. +static const struct mtk_fixed_factor infra_fixed_divs[] = {
  344. + TOP_FACTOR(CK_INFRA_CK_F26M, "infra_ck_f26m", CK_TOP_F26M_SEL, 1, 1),
  345. + TOP_FACTOR(CK_INFRA_UART, "infra_uart", CK_TOP_UART_SEL, 1, 1),
  346. + TOP_FACTOR(CK_INFRA_ISPI0, "infra_ispi0", CK_TOP_SPI_SEL, 1, 1),
  347. + TOP_FACTOR(CK_INFRA_I2C, "infra_i2c", CK_TOP_I2C_SEL, 1, 1),
  348. + TOP_FACTOR(CK_INFRA_ISPI1, "infra_ispi1", CK_TOP_SPIM_MST_SEL, 1, 1),
  349. + TOP_FACTOR(CK_INFRA_PWM, "infra_pwm", CK_TOP_PWM_SEL, 1, 1),
  350. + TOP_FACTOR(CK_INFRA_66M_MCK, "infra_66m_mck", CK_TOP_SYSAXI_SEL, 1, 2),
  351. + TOP_FACTOR(CK_INFRA_CK_F32K, "infra_ck_f32k", CK_TOP_CB_RTC_32P7K, 1,
  352. + 1),
  353. + TOP_FACTOR(CK_INFRA_PCIE_CK, "infra_pcie", CK_TOP_PEXTP_TL_SEL, 1, 1),
  354. + INFRA_FACTOR(CK_INFRA_PWM_BCK, "infra_pwm_bck", CK_INFRA_PWM_BSEL, 1,
  355. + 1),
  356. + INFRA_FACTOR(CK_INFRA_PWM_CK1, "infra_pwm_ck1", CK_INFRA_PWM1_SEL, 1,
  357. + 1),
  358. + INFRA_FACTOR(CK_INFRA_PWM_CK2, "infra_pwm_ck2", CK_INFRA_PWM2_SEL, 1,
  359. + 1),
  360. + TOP_FACTOR(CK_INFRA_133M_HCK, "infra_133m_hck", CK_TOP_SYSAXI, 1, 1),
  361. + INFRA_FACTOR(CK_INFRA_66M_PHCK, "infra_66m_phck", CK_INFRA_133M_HCK, 1,
  362. + 1),
  363. + TOP_FACTOR(CK_INFRA_FAUD_L_CK, "infra_faud_l", CK_TOP_AUD_L, 1, 1),
  364. + TOP_FACTOR(CK_INFRA_FAUD_AUD_CK, "infra_faud_aud", CK_TOP_A1SYS, 1, 1),
  365. + TOP_FACTOR(CK_INFRA_FAUD_EG2_CK, "infra_faud_eg2", CK_TOP_A_TUNER, 1,
  366. + 1),
  367. + TOP_FACTOR(CK_INFRA_I2CS_CK, "infra_i2cs", CK_TOP_I2C_BCK, 1, 1),
  368. + INFRA_FACTOR(CK_INFRA_MUX_UART0, "infra_mux_uart0", CK_INFRA_UART0_SEL,
  369. + 1, 1),
  370. + INFRA_FACTOR(CK_INFRA_MUX_UART1, "infra_mux_uart1", CK_INFRA_UART1_SEL,
  371. + 1, 1),
  372. + INFRA_FACTOR(CK_INFRA_MUX_UART2, "infra_mux_uart2", CK_INFRA_UART2_SEL,
  373. + 1, 1),
  374. + TOP_FACTOR(CK_INFRA_NFI_CK, "infra_nfi", CK_TOP_NFI1X, 1, 1),
  375. + TOP_FACTOR(CK_INFRA_SPINFI_CK, "infra_spinfi", CK_TOP_SPINFI_BCK, 1, 1),
  376. + INFRA_FACTOR(CK_INFRA_MUX_SPI0, "infra_mux_spi0", CK_INFRA_SPI0_SEL, 1,
  377. + 1),
  378. + INFRA_FACTOR(CK_INFRA_MUX_SPI1, "infra_mux_spi1", CK_INFRA_SPI1_SEL, 1,
  379. + 1),
  380. + INFRA_FACTOR(CK_INFRA_MUX_SPI2, "infra_mux_spi2", CK_INFRA_SPI2_SEL, 1,
  381. + 1),
  382. + TOP_FACTOR(CK_INFRA_RTC_32K, "infra_rtc_32k", CK_TOP_CB_RTC_32K, 1, 1),
  383. + TOP_FACTOR(CK_INFRA_FMSDC_CK, "infra_fmsdc", CK_TOP_EMMC_400M, 1, 1),
  384. + TOP_FACTOR(CK_INFRA_FMSDC_HCK_CK, "infra_fmsdc_hck", CK_TOP_EMMC_208M,
  385. + 1, 1),
  386. + TOP_FACTOR(CK_INFRA_PERI_133M, "infra_peri_133m", CK_TOP_SYSAXI, 1, 1),
  387. + TOP_FACTOR(CK_INFRA_133M_PHCK, "infra_133m_phck", CK_TOP_SYSAXI, 1, 1),
  388. + TOP_FACTOR(CK_INFRA_USB_SYS_CK, "infra_usb_sys", CK_TOP_U2U3_SYS, 1, 1),
  389. + TOP_FACTOR(CK_INFRA_USB_CK, "infra_usb", CK_TOP_U2U3_REF, 1, 1),
  390. + TOP_FACTOR(CK_INFRA_USB_XHCI_CK, "infra_usb_xhci", CK_TOP_U2U3_XHCI, 1,
  391. + 1),
  392. + TOP_FACTOR(CK_INFRA_PCIE_GFMUX_TL_O_PRE, "infra_pcie_mux",
  393. + CK_TOP_PEXTP_TL, 1, 1),
  394. + TOP_FACTOR(CK_INFRA_F26M_CK0, "infra_f26m_ck0", CK_TOP_F26M, 1, 1),
  395. + TOP_FACTOR(CK_INFRA_133M_MCK, "infra_133m_mck", CK_TOP_SYSAXI, 1, 1),
  396. +};
  397. +
  398. +/* INFRASYS MUX PARENTS */
  399. +static const int infra_uart0_parents[] = { CK_INFRA_CK_F26M, CK_INFRA_UART };
  400. +
  401. +static const int infra_spi0_parents[] = { CK_INFRA_I2C, CK_INFRA_ISPI0 };
  402. +
  403. +static const int infra_spi1_parents[] = { CK_INFRA_I2C, CK_INFRA_ISPI1 };
  404. +
  405. +static const int infra_pwm1_parents[] = { -1, -1, -1, CK_INFRA_PWM };
  406. +
  407. +static const int infra_pwm_bsel_parents[] = { -1, -1, -1, CK_INFRA_PWM };
  408. +
  409. +static const int infra_pcie_parents[] = { CK_INFRA_CK_F32K, CK_INFRA_CK_F26M,
  410. + CK_TOP_CB_CKSQ_40M, CK_INFRA_PCIE_CK};
  411. +
  412. +#define INFRA_MUX(_id, _name, _parents, _reg, _shift, _width) \
  413. + { \
  414. + .id = _id, .mux_reg = (_reg) + 0x8, \
  415. + .mux_set_reg = (_reg) + 0x0, .mux_clr_reg = (_reg) + 0x4, \
  416. + .mux_shift = _shift, .mux_mask = BIT(_width) - 1, \
  417. + .parent = _parents, .num_parents = ARRAY_SIZE(_parents), \
  418. + .flags = CLK_MUX_SETCLR_UPD | CLK_PARENT_INFRASYS, \
  419. + }
  420. +
  421. +/* INFRA MUX */
  422. +static const struct mtk_composite infra_muxes[] = {
  423. + INFRA_MUX(CK_INFRA_UART0_SEL, "infra_uart0_sel", infra_uart0_parents,
  424. + 0x10, 0, 1),
  425. + INFRA_MUX(CK_INFRA_UART1_SEL, "infra_uart1_sel", infra_uart0_parents,
  426. + 0x10, 1, 1),
  427. + INFRA_MUX(CK_INFRA_UART2_SEL, "infra_uart2_sel", infra_uart0_parents,
  428. + 0x10, 2, 1),
  429. + INFRA_MUX(CK_INFRA_SPI0_SEL, "infra_spi0_sel", infra_spi0_parents, 0x10,
  430. + 4, 1),
  431. + INFRA_MUX(CK_INFRA_SPI1_SEL, "infra_spi1_sel", infra_spi1_parents, 0x10,
  432. + 5, 1),
  433. + INFRA_MUX(CK_INFRA_SPI2_SEL, "infra_spi2_sel", infra_spi0_parents, 0x10,
  434. + 6, 1),
  435. + INFRA_MUX(CK_INFRA_PWM1_SEL, "infra_pwm1_sel", infra_pwm1_parents, 0x10,
  436. + 9, 2),
  437. + INFRA_MUX(CK_INFRA_PWM2_SEL, "infra_pwm2_sel", infra_pwm1_parents, 0x10,
  438. + 11, 2),
  439. + INFRA_MUX(CK_INFRA_PWM_BSEL, "infra_pwm_bsel", infra_pwm_bsel_parents,
  440. + 0x10, 13, 2),
  441. + INFRA_MUX(CK_INFRA_PCIE_SEL, "infra_pcie_sel", infra_pcie_parents, 0x20,
  442. + 0, 2),
  443. +};
  444. +
  445. +static const struct mtk_gate_regs infra_0_cg_regs = {
  446. + .set_ofs = 0x40,
  447. + .clr_ofs = 0x44,
  448. + .sta_ofs = 0x48,
  449. +};
  450. +
  451. +static const struct mtk_gate_regs infra_1_cg_regs = {
  452. + .set_ofs = 0x50,
  453. + .clr_ofs = 0x54,
  454. + .sta_ofs = 0x58,
  455. +};
  456. +
  457. +static const struct mtk_gate_regs infra_2_cg_regs = {
  458. + .set_ofs = 0x60,
  459. + .clr_ofs = 0x64,
  460. + .sta_ofs = 0x68,
  461. +};
  462. +
  463. +#define GATE_INFRA0(_id, _name, _parent, _shift) \
  464. + { \
  465. + .id = _id, .parent = _parent, .regs = &infra_0_cg_regs, \
  466. + .shift = _shift, \
  467. + .flags = CLK_GATE_SETCLR | CLK_PARENT_INFRASYS, \
  468. + }
  469. +
  470. +#define GATE_INFRA1(_id, _name, _parent, _shift) \
  471. + { \
  472. + .id = _id, .parent = _parent, .regs = &infra_1_cg_regs, \
  473. + .shift = _shift, \
  474. + .flags = CLK_GATE_SETCLR | CLK_PARENT_INFRASYS, \
  475. + }
  476. +
  477. +#define GATE_INFRA2(_id, _name, _parent, _shift) \
  478. + { \
  479. + .id = _id, .parent = _parent, .regs = &infra_2_cg_regs, \
  480. + .shift = _shift, \
  481. + .flags = CLK_GATE_SETCLR | CLK_PARENT_INFRASYS, \
  482. + }
  483. +
  484. +/* INFRA GATE */
  485. +static const struct mtk_gate infracfg_ao_gates[] = {
  486. + GATE_INFRA0(CK_INFRA_GPT_STA, "infra_gpt_sta", CK_INFRA_66M_MCK, 0),
  487. + GATE_INFRA0(CK_INFRA_PWM_HCK, "infra_pwm_hck", CK_INFRA_66M_MCK, 1),
  488. + GATE_INFRA0(CK_INFRA_PWM_STA, "infra_pwm_sta", CK_INFRA_PWM_BCK, 2),
  489. + GATE_INFRA0(CK_INFRA_PWM1_CK, "infra_pwm1", CK_INFRA_PWM_CK1, 3),
  490. + GATE_INFRA0(CK_INFRA_PWM2_CK, "infra_pwm2", CK_INFRA_PWM_CK2, 4),
  491. + GATE_INFRA0(CK_INFRA_CQ_DMA_CK, "infra_cq_dma", CK_INFRA_133M_HCK, 6),
  492. + GATE_INFRA0(CK_INFRA_AUD_BUS_CK, "infra_aud_bus", CK_INFRA_66M_PHCK, 8),
  493. + GATE_INFRA0(CK_INFRA_AUD_26M_CK, "infra_aud_26m", CK_INFRA_CK_F26M, 9),
  494. + GATE_INFRA0(CK_INFRA_AUD_L_CK, "infra_aud_l", CK_INFRA_FAUD_L_CK, 10),
  495. + GATE_INFRA0(CK_INFRA_AUD_AUD_CK, "infra_aud_aud", CK_INFRA_FAUD_AUD_CK,
  496. + 11),
  497. + GATE_INFRA0(CK_INFRA_AUD_EG2_CK, "infra_aud_eg2", CK_INFRA_FAUD_EG2_CK,
  498. + 13),
  499. + GATE_INFRA0(CK_INFRA_DRAMC_26M_CK, "infra_dramc_26m", CK_INFRA_CK_F26M,
  500. + 14),
  501. + GATE_INFRA0(CK_INFRA_DBG_CK, "infra_dbg", CK_INFRA_66M_MCK, 15),
  502. + GATE_INFRA0(CK_INFRA_AP_DMA_CK, "infra_ap_dma", CK_INFRA_66M_MCK, 16),
  503. + GATE_INFRA0(CK_INFRA_SEJ_CK, "infra_sej", CK_INFRA_66M_MCK, 24),
  504. + GATE_INFRA0(CK_INFRA_SEJ_13M_CK, "infra_sej_13m", CK_INFRA_CK_F26M, 25),
  505. + GATE_INFRA1(CK_INFRA_THERM_CK, "infra_therm", CK_INFRA_CK_F26M, 0),
  506. + GATE_INFRA1(CK_INFRA_I2CO_CK, "infra_i2co", CK_INFRA_I2CS_CK, 1),
  507. + GATE_INFRA1(CK_INFRA_UART0_CK, "infra_uart0", CK_INFRA_MUX_UART0, 2),
  508. + GATE_INFRA1(CK_INFRA_UART1_CK, "infra_uart1", CK_INFRA_MUX_UART1, 3),
  509. + GATE_INFRA1(CK_INFRA_UART2_CK, "infra_uart2", CK_INFRA_MUX_UART2, 4),
  510. + GATE_INFRA1(CK_INFRA_SPI2_CK, "infra_spi2", CK_INFRA_MUX_SPI2, 6),
  511. + GATE_INFRA1(CK_INFRA_SPI2_HCK_CK, "infra_spi2_hck", CK_INFRA_66M_MCK,
  512. + 7),
  513. + GATE_INFRA1(CK_INFRA_NFI1_CK, "infra_nfi1", CK_INFRA_NFI_CK, 8),
  514. + GATE_INFRA1(CK_INFRA_SPINFI1_CK, "infra_spinfi1", CK_INFRA_SPINFI_CK,
  515. + 9),
  516. + GATE_INFRA1(CK_INFRA_NFI_HCK_CK, "infra_nfi_hck", CK_INFRA_66M_MCK, 10),
  517. + GATE_INFRA1(CK_INFRA_SPI0_CK, "infra_spi0", CK_INFRA_MUX_SPI0, 11),
  518. + GATE_INFRA1(CK_INFRA_SPI1_CK, "infra_spi1", CK_INFRA_MUX_SPI1, 12),
  519. + GATE_INFRA1(CK_INFRA_SPI0_HCK_CK, "infra_spi0_hck", CK_INFRA_66M_MCK,
  520. + 13),
  521. + GATE_INFRA1(CK_INFRA_SPI1_HCK_CK, "infra_spi1_hck", CK_INFRA_66M_MCK,
  522. + 14),
  523. + GATE_INFRA1(CK_INFRA_FRTC_CK, "infra_frtc", CK_INFRA_RTC_32K, 15),
  524. + GATE_INFRA1(CK_INFRA_MSDC_CK, "infra_msdc", CK_INFRA_FMSDC_CK, 16),
  525. + GATE_INFRA1(CK_INFRA_MSDC_HCK_CK, "infra_msdc_hck",
  526. + CK_INFRA_FMSDC_HCK_CK, 17),
  527. + GATE_INFRA1(CK_INFRA_MSDC_133M_CK, "infra_msdc_133m",
  528. + CK_INFRA_PERI_133M, 18),
  529. + GATE_INFRA1(CK_INFRA_MSDC_66M_CK, "infra_msdc_66m", CK_INFRA_66M_PHCK,
  530. + 19),
  531. + GATE_INFRA1(CK_INFRA_ADC_26M_CK, "infra_adc_26m", CK_TOP_F26M, 20),
  532. + GATE_INFRA1(CK_INFRA_ADC_FRC_CK, "infra_adc_frc", CK_TOP_F26M, 21),
  533. + GATE_INFRA1(CK_INFRA_FBIST2FPC_CK, "infra_fbist2fpc", CK_INFRA_NFI_CK,
  534. + 23),
  535. + GATE_INFRA1(CK_INFRA_I2C_MCK_CK, "infra_i2c_mck", CK_INFRA_133M_MCK,
  536. + 25),
  537. + GATE_INFRA1(CK_INFRA_I2C_PCK_CK, "infra_i2c_pck", CK_INFRA_66M_MCK, 26),
  538. + GATE_INFRA2(CK_INFRA_IUSB_133_CK, "infra_iusb_133", CK_INFRA_133M_PHCK,
  539. + 0),
  540. + GATE_INFRA2(CK_INFRA_IUSB_66M_CK, "infra_iusb_66m", CK_INFRA_66M_PHCK,
  541. + 1),
  542. + GATE_INFRA2(CK_INFRA_IUSB_SYS_CK, "infra_iusb_sys", CK_INFRA_USB_SYS_CK,
  543. + 2),
  544. + GATE_INFRA2(CK_INFRA_IUSB_CK, "infra_iusb", CK_INFRA_USB_CK, 3),
  545. + GATE_INFRA2(CK_INFRA_IPCIE_CK, "infra_ipcie",
  546. + CK_INFRA_PCIE_GFMUX_TL_O_PRE, 12),
  547. + GATE_INFRA2(CK_INFRA_IPCIER_CK, "infra_ipcier", CK_INFRA_F26M_CK0, 14),
  548. + GATE_INFRA2(CK_INFRA_IPCIEB_CK, "infra_ipcieb", CK_INFRA_133M_PHCK, 15),
  549. +};
  550. +
  551. +static const struct mtk_clk_tree mt7981_fixed_pll_clk_tree = {
  552. + .fdivs_offs = CLK_APMIXED_NR_CLK,
  553. + .xtal_rate = 40 * MHZ,
  554. + .fclks = fixed_pll_clks,
  555. +};
  556. +
  557. +static const struct mtk_clk_tree mt7981_topckgen_clk_tree = {
  558. + .fdivs_offs = CK_TOP_CB_M_416M,
  559. + .muxes_offs = CK_TOP_NFI1X_SEL,
  560. + .fclks = top_fixed_clks,
  561. + .fdivs = top_fixed_divs,
  562. + .muxes = top_muxes,
  563. + .flags = CLK_BYPASS_XTAL,
  564. +};
  565. +
  566. +static const struct mtk_clk_tree mt7981_infracfg_clk_tree = {
  567. + .fdivs_offs = CK_INFRA_CK_F26M,
  568. + .muxes_offs = CK_INFRA_UART0_SEL,
  569. + .fdivs = infra_fixed_divs,
  570. + .muxes = infra_muxes,
  571. +};
  572. +
  573. +static const struct udevice_id mt7981_fixed_pll_compat[] = {
  574. + { .compatible = "mediatek,mt7981-fixed-plls" },
  575. + {}
  576. +};
  577. +
  578. +static const struct udevice_id mt7981_topckgen_compat[] = {
  579. + { .compatible = "mediatek,mt7981-topckgen" },
  580. + {}
  581. +};
  582. +
  583. +static int mt7981_fixed_pll_probe(struct udevice *dev)
  584. +{
  585. + return mtk_common_clk_init(dev, &mt7981_fixed_pll_clk_tree);
  586. +}
  587. +
  588. +static int mt7981_topckgen_probe(struct udevice *dev)
  589. +{
  590. + struct mtk_clk_priv *priv = dev_get_priv(dev);
  591. +
  592. + priv->base = dev_read_addr_ptr(dev);
  593. + writel(MT7981_CLK_PDN_EN_WRITE, priv->base + MT7981_CLK_PDN);
  594. +
  595. + return mtk_common_clk_init(dev, &mt7981_topckgen_clk_tree);
  596. +}
  597. +
  598. +U_BOOT_DRIVER(mtk_clk_apmixedsys) = {
  599. + .name = "mt7981-clock-fixed-pll",
  600. + .id = UCLASS_CLK,
  601. + .of_match = mt7981_fixed_pll_compat,
  602. + .probe = mt7981_fixed_pll_probe,
  603. + .priv_auto = sizeof(struct mtk_clk_priv),
  604. + .ops = &mtk_clk_topckgen_ops,
  605. + .flags = DM_FLAG_PRE_RELOC,
  606. +};
  607. +
  608. +U_BOOT_DRIVER(mtk_clk_topckgen) = {
  609. + .name = "mt7981-clock-topckgen",
  610. + .id = UCLASS_CLK,
  611. + .of_match = mt7981_topckgen_compat,
  612. + .probe = mt7981_topckgen_probe,
  613. + .priv_auto = sizeof(struct mtk_clk_priv),
  614. + .ops = &mtk_clk_topckgen_ops,
  615. + .flags = DM_FLAG_PRE_RELOC,
  616. +};
  617. +
  618. +static const struct udevice_id mt7981_infracfg_compat[] = {
  619. + { .compatible = "mediatek,mt7981-infracfg" },
  620. + {}
  621. +};
  622. +
  623. +static const struct udevice_id mt7981_infracfg_ao_compat[] = {
  624. + { .compatible = "mediatek,mt7981-infracfg_ao" },
  625. + {}
  626. +};
  627. +
  628. +static int mt7981_infracfg_probe(struct udevice *dev)
  629. +{
  630. + return mtk_common_clk_init(dev, &mt7981_infracfg_clk_tree);
  631. +}
  632. +
  633. +static int mt7981_infracfg_ao_probe(struct udevice *dev)
  634. +{
  635. + return mtk_common_clk_gate_init(dev, &mt7981_infracfg_clk_tree,
  636. + infracfg_ao_gates);
  637. +}
  638. +
  639. +U_BOOT_DRIVER(mtk_clk_infracfg) = {
  640. + .name = "mt7981-clock-infracfg",
  641. + .id = UCLASS_CLK,
  642. + .of_match = mt7981_infracfg_compat,
  643. + .probe = mt7981_infracfg_probe,
  644. + .priv_auto = sizeof(struct mtk_clk_priv),
  645. + .ops = &mtk_clk_infrasys_ops,
  646. + .flags = DM_FLAG_PRE_RELOC,
  647. +};
  648. +
  649. +U_BOOT_DRIVER(mtk_clk_infracfg_ao) = {
  650. + .name = "mt7981-clock-infracfg-ao",
  651. + .id = UCLASS_CLK,
  652. + .of_match = mt7981_infracfg_ao_compat,
  653. + .probe = mt7981_infracfg_ao_probe,
  654. + .priv_auto = sizeof(struct mtk_cg_priv),
  655. + .ops = &mtk_clk_gate_ops,
  656. + .flags = DM_FLAG_PRE_RELOC,
  657. +};
  658. +
  659. +/* ethsys */
  660. +static const struct mtk_gate_regs eth_cg_regs = {
  661. + .set_ofs = 0x30,
  662. + .clr_ofs = 0x30,
  663. + .sta_ofs = 0x30,
  664. +};
  665. +
  666. +#define GATE_ETH(_id, _name, _parent, _shift) \
  667. + { \
  668. + .id = _id, .parent = _parent, .regs = &eth_cg_regs, \
  669. + .shift = _shift, \
  670. + .flags = CLK_GATE_NO_SETCLR_INV | CLK_PARENT_TOPCKGEN, \
  671. + }
  672. +
  673. +static const struct mtk_gate eth_cgs[] = {
  674. + GATE_ETH(CK_ETH_FE_EN, "eth_fe_en", CK_TOP_NETSYS_2X, 6),
  675. + GATE_ETH(CK_ETH_GP2_EN, "eth_gp2_en", CK_TOP_SGM_325M, 7),
  676. + GATE_ETH(CK_ETH_GP1_EN, "eth_gp1_en", CK_TOP_SGM_325M, 8),
  677. + GATE_ETH(CK_ETH_WOCPU0_EN, "eth_wocpu0_en", CK_TOP_NETSYS_WED_MCU, 15),
  678. +};
  679. +
  680. +static int mt7981_ethsys_probe(struct udevice *dev)
  681. +{
  682. + return mtk_common_clk_gate_init(dev, &mt7981_topckgen_clk_tree,
  683. + eth_cgs);
  684. +}
  685. +
  686. +static int mt7981_ethsys_bind(struct udevice *dev)
  687. +{
  688. + int ret = 0;
  689. +
  690. + if (CONFIG_IS_ENABLED(RESET_MEDIATEK)) {
  691. + ret = mediatek_reset_bind(dev, ETHSYS_HIFSYS_RST_CTRL_OFS, 1);
  692. + if (ret)
  693. + debug("Warning: failed to bind reset controller\n");
  694. + }
  695. +
  696. + return ret;
  697. +}
  698. +
  699. +static const struct udevice_id mt7981_ethsys_compat[] = {
  700. + { .compatible = "mediatek,mt7981-ethsys", },
  701. + {}
  702. +};
  703. +
  704. +U_BOOT_DRIVER(mtk_clk_ethsys) = {
  705. + .name = "mt7981-clock-ethsys",
  706. + .id = UCLASS_CLK,
  707. + .of_match = mt7981_ethsys_compat,
  708. + .probe = mt7981_ethsys_probe,
  709. + .bind = mt7981_ethsys_bind,
  710. + .priv_auto = sizeof(struct mtk_cg_priv),
  711. + .ops = &mtk_clk_gate_ops,
  712. +};
  713. --- /dev/null
  714. +++ b/include/dt-bindings/clock/mt7981-clk.h
  715. @@ -0,0 +1,267 @@
  716. +/* SPDX-License-Identifier: GPL-2.0 */
  717. +/*
  718. + * Copyright (C) 2022 MediaTek Inc. All rights reserved.
  719. + *
  720. + * Author: Sam Shih <[email protected]>
  721. + */
  722. +
  723. +#ifndef _DT_BINDINGS_CLK_MT7981_H
  724. +#define _DT_BINDINGS_CLK_MT7981_H
  725. +
  726. +/* INFRACFG */
  727. +
  728. +#define CK_INFRA_CK_F26M 0
  729. +#define CK_INFRA_UART 1
  730. +#define CK_INFRA_ISPI0 2
  731. +#define CK_INFRA_I2C 3
  732. +#define CK_INFRA_ISPI1 4
  733. +#define CK_INFRA_PWM 5
  734. +#define CK_INFRA_66M_MCK 6
  735. +#define CK_INFRA_CK_F32K 7
  736. +#define CK_INFRA_PCIE_CK 8
  737. +#define CK_INFRA_PWM_BCK 9
  738. +#define CK_INFRA_PWM_CK1 10
  739. +#define CK_INFRA_PWM_CK2 11
  740. +#define CK_INFRA_133M_HCK 12
  741. +#define CK_INFRA_66M_PHCK 13
  742. +#define CK_INFRA_FAUD_L_CK 14
  743. +#define CK_INFRA_FAUD_AUD_CK 15
  744. +#define CK_INFRA_FAUD_EG2_CK 16
  745. +#define CK_INFRA_I2CS_CK 17
  746. +#define CK_INFRA_MUX_UART0 18
  747. +#define CK_INFRA_MUX_UART1 19
  748. +#define CK_INFRA_MUX_UART2 20
  749. +#define CK_INFRA_NFI_CK 21
  750. +#define CK_INFRA_SPINFI_CK 22
  751. +#define CK_INFRA_MUX_SPI0 23
  752. +#define CK_INFRA_MUX_SPI1 24
  753. +#define CK_INFRA_MUX_SPI2 25
  754. +#define CK_INFRA_RTC_32K 26
  755. +#define CK_INFRA_FMSDC_CK 27
  756. +#define CK_INFRA_FMSDC_HCK_CK 28
  757. +#define CK_INFRA_PERI_133M 29
  758. +#define CK_INFRA_133M_PHCK 30
  759. +#define CK_INFRA_USB_SYS_CK 31
  760. +#define CK_INFRA_USB_CK 32
  761. +#define CK_INFRA_USB_XHCI_CK 33
  762. +#define CK_INFRA_PCIE_GFMUX_TL_O_PRE 34
  763. +#define CK_INFRA_F26M_CK0 35
  764. +#define CK_INFRA_133M_MCK 36
  765. +#define CLK_INFRA_NR_CLK 37
  766. +
  767. +/* TOPCKGEN */
  768. +
  769. +#define CK_TOP_CB_CKSQ_40M 0
  770. +#define CK_TOP_CB_M_416M 1
  771. +#define CK_TOP_CB_M_D2 2
  772. +#define CK_TOP_CB_M_D3 3
  773. +#define CK_TOP_M_D3_D2 4
  774. +#define CK_TOP_CB_M_D4 5
  775. +#define CK_TOP_CB_M_D8 6
  776. +#define CK_TOP_M_D8_D2 7
  777. +#define CK_TOP_CB_MM_720M 8
  778. +#define CK_TOP_CB_MM_D2 9
  779. +#define CK_TOP_CB_MM_D3 10
  780. +#define CK_TOP_CB_MM_D3_D5 11
  781. +#define CK_TOP_CB_MM_D4 12
  782. +#define CK_TOP_CB_MM_D6 13
  783. +#define CK_TOP_MM_D6_D2 14
  784. +#define CK_TOP_CB_MM_D8 15
  785. +#define CK_TOP_CB_APLL2_196M 16
  786. +#define CK_TOP_APLL2_D2 17
  787. +#define CK_TOP_APLL2_D4 18
  788. +#define CK_TOP_NET1_2500M 19
  789. +#define CK_TOP_CB_NET1_D4 20
  790. +#define CK_TOP_CB_NET1_D5 21
  791. +#define CK_TOP_NET1_D5_D2 22
  792. +#define CK_TOP_NET1_D5_D4 23
  793. +#define CK_TOP_CB_NET1_D8 24
  794. +#define CK_TOP_NET1_D8_D2 25
  795. +#define CK_TOP_NET1_D8_D4 26
  796. +#define CK_TOP_CB_NET2_800M 27
  797. +#define CK_TOP_CB_NET2_D2 28
  798. +#define CK_TOP_CB_NET2_D4 29
  799. +#define CK_TOP_NET2_D4_D2 30
  800. +#define CK_TOP_NET2_D4_D4 31
  801. +#define CK_TOP_CB_NET2_D6 32
  802. +#define CK_TOP_CB_WEDMCU_208M 33
  803. +#define CK_TOP_CB_SGM_325M 34
  804. +#define CK_TOP_CKSQ_40M_D2 35
  805. +#define CK_TOP_CB_RTC_32K 36
  806. +#define CK_TOP_CB_RTC_32P7K 37
  807. +#define CK_TOP_USB_TX250M 38
  808. +#define CK_TOP_FAUD 39
  809. +#define CK_TOP_NFI1X 40
  810. +#define CK_TOP_USB_EQ_RX250M 41
  811. +#define CK_TOP_USB_CDR_CK 42
  812. +#define CK_TOP_USB_LN0_CK 43
  813. +#define CK_TOP_SPINFI_BCK 44
  814. +#define CK_TOP_SPI 45
  815. +#define CK_TOP_SPIM_MST 46
  816. +#define CK_TOP_UART_BCK 47
  817. +#define CK_TOP_PWM_BCK 48
  818. +#define CK_TOP_I2C_BCK 49
  819. +#define CK_TOP_PEXTP_TL 50
  820. +#define CK_TOP_EMMC_208M 51
  821. +#define CK_TOP_EMMC_400M 52
  822. +#define CK_TOP_DRAMC_REF 53
  823. +#define CK_TOP_DRAMC_MD32 54
  824. +#define CK_TOP_SYSAXI 55
  825. +#define CK_TOP_SYSAPB 56
  826. +#define CK_TOP_ARM_DB_MAIN 57
  827. +#define CK_TOP_AP2CNN_HOST 58
  828. +#define CK_TOP_NETSYS 59
  829. +#define CK_TOP_NETSYS_500M 60
  830. +#define CK_TOP_NETSYS_WED_MCU 61
  831. +#define CK_TOP_NETSYS_2X 62
  832. +#define CK_TOP_SGM_325M 63
  833. +#define CK_TOP_SGM_REG 64
  834. +#define CK_TOP_F26M 65
  835. +#define CK_TOP_EIP97B 66
  836. +#define CK_TOP_USB3_PHY 67
  837. +#define CK_TOP_AUD 68
  838. +#define CK_TOP_A1SYS 69
  839. +#define CK_TOP_AUD_L 70
  840. +#define CK_TOP_A_TUNER 71
  841. +#define CK_TOP_U2U3_REF 72
  842. +#define CK_TOP_U2U3_SYS 73
  843. +#define CK_TOP_U2U3_XHCI 74
  844. +#define CK_TOP_USB_FRMCNT 75
  845. +#define CK_TOP_NFI1X_SEL 76
  846. +#define CK_TOP_SPINFI_SEL 77
  847. +#define CK_TOP_SPI_SEL 78
  848. +#define CK_TOP_SPIM_MST_SEL 79
  849. +#define CK_TOP_UART_SEL 80
  850. +#define CK_TOP_PWM_SEL 81
  851. +#define CK_TOP_I2C_SEL 82
  852. +#define CK_TOP_PEXTP_TL_SEL 83
  853. +#define CK_TOP_EMMC_208M_SEL 84
  854. +#define CK_TOP_EMMC_400M_SEL 85
  855. +#define CK_TOP_F26M_SEL 86
  856. +#define CK_TOP_DRAMC_SEL 87
  857. +#define CK_TOP_DRAMC_MD32_SEL 88
  858. +#define CK_TOP_SYSAXI_SEL 89
  859. +#define CK_TOP_SYSAPB_SEL 90
  860. +#define CK_TOP_ARM_DB_MAIN_SEL 91
  861. +#define CK_TOP_AP2CNN_HOST_SEL 92
  862. +#define CK_TOP_NETSYS_SEL 93
  863. +#define CK_TOP_NETSYS_500M_SEL 94
  864. +#define CK_TOP_NETSYS_MCU_SEL 95
  865. +#define CK_TOP_NETSYS_2X_SEL 96
  866. +#define CK_TOP_SGM_325M_SEL 97
  867. +#define CK_TOP_SGM_REG_SEL 98
  868. +#define CK_TOP_EIP97B_SEL 99
  869. +#define CK_TOP_USB3_PHY_SEL 100
  870. +#define CK_TOP_AUD_SEL 101
  871. +#define CK_TOP_A1SYS_SEL 102
  872. +#define CK_TOP_AUD_L_SEL 103
  873. +#define CK_TOP_A_TUNER_SEL 104
  874. +#define CK_TOP_U2U3_SEL 105
  875. +#define CK_TOP_U2U3_SYS_SEL 106
  876. +#define CK_TOP_U2U3_XHCI_SEL 107
  877. +#define CK_TOP_USB_FRMCNT_SEL 108
  878. +#define CLK_TOP_NR_CLK 109
  879. +
  880. +/*
  881. + * INFRACFG_AO
  882. + * clock muxes need to be append to infracfg domain, and clock gates
  883. + * need to be keep in infracgh_ao domain
  884. + */
  885. +#define INFRACFG_AO_OFFSET 10
  886. +
  887. +#define CK_INFRA_UART0_SEL (0 + CLK_INFRA_NR_CLK)
  888. +#define CK_INFRA_UART1_SEL (1 + CLK_INFRA_NR_CLK)
  889. +#define CK_INFRA_UART2_SEL (2 + CLK_INFRA_NR_CLK)
  890. +#define CK_INFRA_SPI0_SEL (3 + CLK_INFRA_NR_CLK)
  891. +#define CK_INFRA_SPI1_SEL (4 + CLK_INFRA_NR_CLK)
  892. +#define CK_INFRA_SPI2_SEL (5 + CLK_INFRA_NR_CLK)
  893. +#define CK_INFRA_PWM1_SEL (6 + CLK_INFRA_NR_CLK)
  894. +#define CK_INFRA_PWM2_SEL (7 + CLK_INFRA_NR_CLK)
  895. +#define CK_INFRA_PWM_BSEL (8 + CLK_INFRA_NR_CLK)
  896. +#define CK_INFRA_PCIE_SEL (9 + CLK_INFRA_NR_CLK)
  897. +#define CK_INFRA_GPT_STA (10 - INFRACFG_AO_OFFSET)
  898. +#define CK_INFRA_PWM_HCK (11 - INFRACFG_AO_OFFSET)
  899. +#define CK_INFRA_PWM_STA (12 - INFRACFG_AO_OFFSET)
  900. +#define CK_INFRA_PWM1_CK (13 - INFRACFG_AO_OFFSET)
  901. +#define CK_INFRA_PWM2_CK (14 - INFRACFG_AO_OFFSET)
  902. +#define CK_INFRA_CQ_DMA_CK (15 - INFRACFG_AO_OFFSET)
  903. +#define CK_INFRA_AUD_BUS_CK (16 - INFRACFG_AO_OFFSET)
  904. +#define CK_INFRA_AUD_26M_CK (17 - INFRACFG_AO_OFFSET)
  905. +#define CK_INFRA_AUD_L_CK (18 - INFRACFG_AO_OFFSET)
  906. +#define CK_INFRA_AUD_AUD_CK (19 - INFRACFG_AO_OFFSET)
  907. +#define CK_INFRA_AUD_EG2_CK (20 - INFRACFG_AO_OFFSET)
  908. +#define CK_INFRA_DRAMC_26M_CK (21 - INFRACFG_AO_OFFSET)
  909. +#define CK_INFRA_DBG_CK (22 - INFRACFG_AO_OFFSET)
  910. +#define CK_INFRA_AP_DMA_CK (23 - INFRACFG_AO_OFFSET)
  911. +#define CK_INFRA_SEJ_CK (24 - INFRACFG_AO_OFFSET)
  912. +#define CK_INFRA_SEJ_13M_CK (25 - INFRACFG_AO_OFFSET)
  913. +#define CK_INFRA_THERM_CK (26 - INFRACFG_AO_OFFSET)
  914. +#define CK_INFRA_I2CO_CK (27 - INFRACFG_AO_OFFSET)
  915. +#define CK_INFRA_UART0_CK (28 - INFRACFG_AO_OFFSET)
  916. +#define CK_INFRA_UART1_CK (29 - INFRACFG_AO_OFFSET)
  917. +#define CK_INFRA_UART2_CK (30 - INFRACFG_AO_OFFSET)
  918. +#define CK_INFRA_SPI2_CK (31 - INFRACFG_AO_OFFSET)
  919. +#define CK_INFRA_SPI2_HCK_CK (32 - INFRACFG_AO_OFFSET)
  920. +#define CK_INFRA_NFI1_CK (33 - INFRACFG_AO_OFFSET)
  921. +#define CK_INFRA_SPINFI1_CK (34 - INFRACFG_AO_OFFSET)
  922. +#define CK_INFRA_NFI_HCK_CK (35 - INFRACFG_AO_OFFSET)
  923. +#define CK_INFRA_SPI0_CK (36 - INFRACFG_AO_OFFSET)
  924. +#define CK_INFRA_SPI1_CK (37 - INFRACFG_AO_OFFSET)
  925. +#define CK_INFRA_SPI0_HCK_CK (38 - INFRACFG_AO_OFFSET)
  926. +#define CK_INFRA_SPI1_HCK_CK (39 - INFRACFG_AO_OFFSET)
  927. +#define CK_INFRA_FRTC_CK (40 - INFRACFG_AO_OFFSET)
  928. +#define CK_INFRA_MSDC_CK (41 - INFRACFG_AO_OFFSET)
  929. +#define CK_INFRA_MSDC_HCK_CK (42 - INFRACFG_AO_OFFSET)
  930. +#define CK_INFRA_MSDC_133M_CK (43 - INFRACFG_AO_OFFSET)
  931. +#define CK_INFRA_MSDC_66M_CK (44 - INFRACFG_AO_OFFSET)
  932. +#define CK_INFRA_ADC_26M_CK (45 - INFRACFG_AO_OFFSET)
  933. +#define CK_INFRA_ADC_FRC_CK (46 - INFRACFG_AO_OFFSET)
  934. +#define CK_INFRA_FBIST2FPC_CK (47 - INFRACFG_AO_OFFSET)
  935. +#define CK_INFRA_I2C_MCK_CK (48 - INFRACFG_AO_OFFSET)
  936. +#define CK_INFRA_I2C_PCK_CK (49 - INFRACFG_AO_OFFSET)
  937. +#define CK_INFRA_IUSB_133_CK (50 - INFRACFG_AO_OFFSET)
  938. +#define CK_INFRA_IUSB_66M_CK (51 - INFRACFG_AO_OFFSET)
  939. +#define CK_INFRA_IUSB_SYS_CK (52 - INFRACFG_AO_OFFSET)
  940. +#define CK_INFRA_IUSB_CK (53 - INFRACFG_AO_OFFSET)
  941. +#define CK_INFRA_IPCIE_CK (54 - INFRACFG_AO_OFFSET)
  942. +#define CK_INFRA_IPCIER_CK (55 - INFRACFG_AO_OFFSET)
  943. +#define CK_INFRA_IPCIEB_CK (56 - INFRACFG_AO_OFFSET)
  944. +#define CLK_INFRA_AO_NR_CLK (57 - INFRACFG_AO_OFFSET)
  945. +
  946. +/* APMIXEDSYS */
  947. +
  948. +#define CK_APMIXED_ARMPLL 0
  949. +#define CK_APMIXED_NET2PLL 1
  950. +#define CK_APMIXED_MMPLL 2
  951. +#define CK_APMIXED_SGMPLL 3
  952. +#define CK_APMIXED_WEDMCUPLL 4
  953. +#define CK_APMIXED_NET1PLL 5
  954. +#define CK_APMIXED_MPLL 6
  955. +#define CK_APMIXED_APLL2 7
  956. +#define CLK_APMIXED_NR_CLK 8
  957. +
  958. +/* SGMIISYS_0 */
  959. +
  960. +#define CK_SGM0_TX_EN 0
  961. +#define CK_SGM0_RX_EN 1
  962. +#define CK_SGM0_CK0_EN 2
  963. +#define CK_SGM0_CDR_CK0_EN 3
  964. +#define CLK_SGMII0_NR_CLK 4
  965. +
  966. +/* SGMIISYS_1 */
  967. +
  968. +#define CK_SGM1_TX_EN 0
  969. +#define CK_SGM1_RX_EN 1
  970. +#define CK_SGM1_CK1_EN 2
  971. +#define CK_SGM1_CDR_CK1_EN 3
  972. +#define CLK_SGMII1_NR_CLK 4
  973. +
  974. +/* ETHSYS */
  975. +
  976. +#define CK_ETH_FE_EN 0
  977. +#define CK_ETH_GP2_EN 1
  978. +#define CK_ETH_GP1_EN 2
  979. +#define CK_ETH_WOCPU0_EN 3
  980. +#define CLK_ETH_NR_CLK 4
  981. +
  982. +#endif /* _DT_BINDINGS_CLK_MT7981_H */