Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: sunxi-ng: add support for the Allwinner H6 CCU

The Allwinner H6 SoC has a CCU which has been largely rearranged.

Add support for it in the sunxi-ng CCU framework.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>

authored by

Icenowy Zheng and committed by
Maxime Ripard
524353ea 2e08e4d2

+1466
+5
drivers/clk/sunxi-ng/Kconfig
··· 11 11 default ARM64 && ARCH_SUNXI 12 12 depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST 13 13 14 + config SUN50I_H6_CCU 15 + bool "Support for the Allwinner H6 CCU" 16 + default ARM64 && ARCH_SUNXI 17 + depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST 18 + 14 19 config SUN4I_A10_CCU 15 20 bool "Support for the Allwinner A10/A20 CCU" 16 21 default MACH_SUN4I
+1
drivers/clk/sunxi-ng/Makefile
··· 22 22 23 23 # SoC support 24 24 obj-$(CONFIG_SUN50I_A64_CCU) += ccu-sun50i-a64.o 25 + obj-$(CONFIG_SUN50I_H6_CCU) += ccu-sun50i-h6.o 25 26 obj-$(CONFIG_SUN4I_A10_CCU) += ccu-sun4i-a10.o 26 27 obj-$(CONFIG_SUN5I_CCU) += ccu-sun5i.o 27 28 obj-$(CONFIG_SUN6I_A31_CCU) += ccu-sun6i-a31.o
+1207
drivers/clk/sunxi-ng/ccu-sun50i-h6.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (c) 2017 Icenowy Zheng <icenowy@aosc.io> 4 + */ 5 + 6 + #include <linux/clk-provider.h> 7 + #include <linux/of_address.h> 8 + #include <linux/platform_device.h> 9 + 10 + #include "ccu_common.h" 11 + #include "ccu_reset.h" 12 + 13 + #include "ccu_div.h" 14 + #include "ccu_gate.h" 15 + #include "ccu_mp.h" 16 + #include "ccu_mult.h" 17 + #include "ccu_nk.h" 18 + #include "ccu_nkm.h" 19 + #include "ccu_nkmp.h" 20 + #include "ccu_nm.h" 21 + 22 + #include "ccu-sun50i-h6.h" 23 + 24 + /* 25 + * The CPU PLL is actually NP clock, with P being /1, /2 or /4. However 26 + * P should only be used for output frequencies lower than 288 MHz. 27 + * 28 + * For now we can just model it as a multiplier clock, and force P to /1. 29 + * 30 + * The M factor is present in the register's description, but not in the 31 + * frequency formula, and it's documented as "M is only used for backdoor 32 + * testing", so it's not modelled and then force to 0. 33 + */ 34 + #define SUN50I_H6_PLL_CPUX_REG 0x000 35 + static struct ccu_mult pll_cpux_clk = { 36 + .enable = BIT(31), 37 + .lock = BIT(28), 38 + .mult = _SUNXI_CCU_MULT_MIN(8, 8, 12), 39 + .common = { 40 + .reg = 0x000, 41 + .hw.init = CLK_HW_INIT("pll-cpux", "osc24M", 42 + &ccu_mult_ops, 43 + CLK_SET_RATE_UNGATE), 44 + }, 45 + }; 46 + 47 + /* Some PLLs are input * N / div1 / P. Model them as NKMP with no K */ 48 + #define SUN50I_H6_PLL_DDR0_REG 0x010 49 + static struct ccu_nkmp pll_ddr0_clk = { 50 + .enable = BIT(31), 51 + .lock = BIT(28), 52 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 53 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 54 + .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 55 + .common = { 56 + .reg = 0x010, 57 + .hw.init = CLK_HW_INIT("pll-ddr0", "osc24M", 58 + &ccu_nkmp_ops, 59 + CLK_SET_RATE_UNGATE), 60 + }, 61 + }; 62 + 63 + #define SUN50I_H6_PLL_PERIPH0_REG 0x020 64 + static struct ccu_nkmp pll_periph0_clk = { 65 + .enable = BIT(31), 66 + .lock = BIT(28), 67 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 68 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 69 + .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 70 + .fixed_post_div = 4, 71 + .common = { 72 + .reg = 0x020, 73 + .features = CCU_FEATURE_FIXED_POSTDIV, 74 + .hw.init = CLK_HW_INIT("pll-periph0", "osc24M", 75 + &ccu_nkmp_ops, 76 + CLK_SET_RATE_UNGATE), 77 + }, 78 + }; 79 + 80 + #define SUN50I_H6_PLL_PERIPH1_REG 0x028 81 + static struct ccu_nkmp pll_periph1_clk = { 82 + .enable = BIT(31), 83 + .lock = BIT(28), 84 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 85 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 86 + .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 87 + .fixed_post_div = 4, 88 + .common = { 89 + .reg = 0x028, 90 + .features = CCU_FEATURE_FIXED_POSTDIV, 91 + .hw.init = CLK_HW_INIT("pll-periph1", "osc24M", 92 + &ccu_nkmp_ops, 93 + CLK_SET_RATE_UNGATE), 94 + }, 95 + }; 96 + 97 + #define SUN50I_H6_PLL_GPU_REG 0x030 98 + static struct ccu_nkmp pll_gpu_clk = { 99 + .enable = BIT(31), 100 + .lock = BIT(28), 101 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 102 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 103 + .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 104 + .common = { 105 + .reg = 0x030, 106 + .hw.init = CLK_HW_INIT("pll-gpu", "osc24M", 107 + &ccu_nkmp_ops, 108 + CLK_SET_RATE_UNGATE), 109 + }, 110 + }; 111 + 112 + /* 113 + * For Video PLLs, the output divider is described as "used for testing" 114 + * in the user manual. So it's not modelled and forced to 0. 115 + */ 116 + #define SUN50I_H6_PLL_VIDEO0_REG 0x040 117 + static struct ccu_nm pll_video0_clk = { 118 + .enable = BIT(31), 119 + .lock = BIT(28), 120 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 121 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 122 + .fixed_post_div = 4, 123 + .common = { 124 + .reg = 0x040, 125 + .features = CCU_FEATURE_FIXED_POSTDIV, 126 + .hw.init = CLK_HW_INIT("pll-video0", "osc24M", 127 + &ccu_nm_ops, 128 + CLK_SET_RATE_UNGATE), 129 + }, 130 + }; 131 + 132 + #define SUN50I_H6_PLL_VIDEO1_REG 0x048 133 + static struct ccu_nm pll_video1_clk = { 134 + .enable = BIT(31), 135 + .lock = BIT(28), 136 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 137 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 138 + .fixed_post_div = 4, 139 + .common = { 140 + .reg = 0x048, 141 + .features = CCU_FEATURE_FIXED_POSTDIV, 142 + .hw.init = CLK_HW_INIT("pll-video1", "osc24M", 143 + &ccu_nm_ops, 144 + CLK_SET_RATE_UNGATE), 145 + }, 146 + }; 147 + 148 + #define SUN50I_H6_PLL_VE_REG 0x058 149 + static struct ccu_nkmp pll_ve_clk = { 150 + .enable = BIT(31), 151 + .lock = BIT(28), 152 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 153 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 154 + .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 155 + .common = { 156 + .reg = 0x058, 157 + .hw.init = CLK_HW_INIT("pll-ve", "osc24M", 158 + &ccu_nkmp_ops, 159 + CLK_SET_RATE_UNGATE), 160 + }, 161 + }; 162 + 163 + #define SUN50I_H6_PLL_DE_REG 0x060 164 + static struct ccu_nkmp pll_de_clk = { 165 + .enable = BIT(31), 166 + .lock = BIT(28), 167 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 168 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 169 + .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 170 + .common = { 171 + .reg = 0x060, 172 + .hw.init = CLK_HW_INIT("pll-de", "osc24M", 173 + &ccu_nkmp_ops, 174 + CLK_SET_RATE_UNGATE), 175 + }, 176 + }; 177 + 178 + #define SUN50I_H6_PLL_HSIC_REG 0x070 179 + static struct ccu_nkmp pll_hsic_clk = { 180 + .enable = BIT(31), 181 + .lock = BIT(28), 182 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 183 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 184 + .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 185 + .common = { 186 + .reg = 0x070, 187 + .hw.init = CLK_HW_INIT("pll-hsic", "osc24M", 188 + &ccu_nkmp_ops, 189 + CLK_SET_RATE_UNGATE), 190 + }, 191 + }; 192 + 193 + /* 194 + * The Audio PLL is supposed to have 3 outputs: 2 fixed factors from 195 + * the base (2x and 4x), and one variable divider (the one true pll audio). 196 + * 197 + * We don't have any need for the variable divider for now, so we just 198 + * hardcode it to match with the clock names. 199 + */ 200 + #define SUN50I_H6_PLL_AUDIO_REG 0x078 201 + static struct ccu_nm pll_audio_base_clk = { 202 + .enable = BIT(31), 203 + .lock = BIT(28), 204 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 205 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 206 + .common = { 207 + .reg = 0x078, 208 + .hw.init = CLK_HW_INIT("pll-audio-base", "osc24M", 209 + &ccu_nm_ops, 210 + CLK_SET_RATE_UNGATE), 211 + }, 212 + }; 213 + 214 + static const char * const cpux_parents[] = { "osc24M", "osc32k", 215 + "iosc", "pll-cpux" }; 216 + static SUNXI_CCU_MUX(cpux_clk, "cpux", cpux_parents, 217 + 0x500, 24, 2, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); 218 + static SUNXI_CCU_M(axi_clk, "axi", "cpux", 0x500, 0, 2, 0); 219 + static SUNXI_CCU_M(cpux_apb_clk, "cpux-apb", "cpux", 0x500, 8, 2, 0); 220 + 221 + static const char * const psi_ahb1_ahb2_parents[] = { "osc24M", "osc32k", 222 + "iosc", "pll-periph0" }; 223 + static SUNXI_CCU_MP_WITH_MUX(psi_ahb1_ahb2_clk, "psi-ahb1-ahb2", 224 + psi_ahb1_ahb2_parents, 225 + 0x510, 226 + 0, 5, /* M */ 227 + 16, 2, /* P */ 228 + 24, 2, /* mux */ 229 + 0); 230 + 231 + static const char * const ahb3_apb1_apb2_parents[] = { "osc24M", "osc32k", 232 + "psi-ahb1-ahb2", 233 + "pll-periph0" }; 234 + static SUNXI_CCU_MP_WITH_MUX(ahb3_clk, "ahb3", ahb3_apb1_apb2_parents, 0x51c, 235 + 0, 5, /* M */ 236 + 16, 2, /* P */ 237 + 24, 2, /* mux */ 238 + 0); 239 + 240 + static SUNXI_CCU_MP_WITH_MUX(apb1_clk, "apb1", ahb3_apb1_apb2_parents, 0x520, 241 + 0, 5, /* M */ 242 + 16, 2, /* P */ 243 + 24, 2, /* mux */ 244 + 0); 245 + 246 + static SUNXI_CCU_MP_WITH_MUX(apb2_clk, "apb2", ahb3_apb1_apb2_parents, 0x524, 247 + 0, 5, /* M */ 248 + 16, 2, /* P */ 249 + 24, 2, /* mux */ 250 + 0); 251 + 252 + static const char * const mbus_parents[] = { "osc24M", "pll-periph0-2x", 253 + "pll-ddr0", "pll-periph0-4x" }; 254 + static SUNXI_CCU_M_WITH_MUX_GATE(mbus_clk, "mbus", mbus_parents, 0x540, 255 + 0, 3, /* M */ 256 + 24, 2, /* mux */ 257 + BIT(31), /* gate */ 258 + CLK_IS_CRITICAL); 259 + 260 + static const char * const de_parents[] = { "pll-de", "pll-periph0-2x" }; 261 + static SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", de_parents, 0x600, 262 + 0, 4, /* M */ 263 + 24, 1, /* mux */ 264 + BIT(31), /* gate */ 265 + 0); 266 + 267 + static SUNXI_CCU_GATE(bus_de_clk, "bus-de", "psi-ahb1-ahb2", 268 + 0x60c, BIT(0), 0); 269 + 270 + static const char * const deinterlace_parents[] = { "pll-periph0", 271 + "pll-periph1" }; 272 + static SUNXI_CCU_M_WITH_MUX_GATE(deinterlace_clk, "deinterlace", 273 + deinterlace_parents, 274 + 0x620, 275 + 0, 4, /* M */ 276 + 24, 1, /* mux */ 277 + BIT(31), /* gate */ 278 + 0); 279 + 280 + static SUNXI_CCU_GATE(bus_deinterlace_clk, "bus-deinterlace", "psi-ahb1-ahb2", 281 + 0x62c, BIT(0), 0); 282 + 283 + static const char * const gpu_parents[] = { "pll-gpu" }; 284 + static SUNXI_CCU_M_WITH_MUX_GATE(gpu_clk, "gpu", gpu_parents, 0x670, 285 + 0, 3, /* M */ 286 + 24, 1, /* mux */ 287 + BIT(31), /* gate */ 288 + 0); 289 + 290 + static SUNXI_CCU_GATE(bus_gpu_clk, "bus-gpu", "psi-ahb1-ahb2", 291 + 0x67c, BIT(0), 0); 292 + 293 + /* Also applies to EMCE */ 294 + static const char * const ce_parents[] = { "osc24M", "pll-periph0-2x" }; 295 + static SUNXI_CCU_MP_WITH_MUX_GATE(ce_clk, "ce", ce_parents, 0x680, 296 + 0, 4, /* M */ 297 + 8, 2, /* N */ 298 + 24, 1, /* mux */ 299 + BIT(31),/* gate */ 300 + 0); 301 + 302 + static SUNXI_CCU_GATE(bus_ce_clk, "bus-ce", "psi-ahb1-ahb2", 303 + 0x68c, BIT(0), 0); 304 + 305 + static const char * const ve_parents[] = { "pll-ve" }; 306 + static SUNXI_CCU_M_WITH_MUX_GATE(ve_clk, "ve", ve_parents, 0x690, 307 + 0, 3, /* M */ 308 + 24, 1, /* mux */ 309 + BIT(31), /* gate */ 310 + 0); 311 + 312 + static SUNXI_CCU_GATE(bus_ve_clk, "bus-ve", "psi-ahb1-ahb2", 313 + 0x69c, BIT(0), 0); 314 + 315 + static SUNXI_CCU_MP_WITH_MUX_GATE(emce_clk, "emce", ce_parents, 0x6b0, 316 + 0, 4, /* M */ 317 + 8, 2, /* N */ 318 + 24, 1, /* mux */ 319 + BIT(31),/* gate */ 320 + 0); 321 + 322 + static SUNXI_CCU_GATE(bus_emce_clk, "bus-emce", "psi-ahb1-ahb2", 323 + 0x6bc, BIT(0), 0); 324 + 325 + static const char * const vp9_parents[] = { "pll-ve", "pll-periph0-2x" }; 326 + static SUNXI_CCU_M_WITH_MUX_GATE(vp9_clk, "vp9", vp9_parents, 0x6c0, 327 + 0, 3, /* M */ 328 + 24, 1, /* mux */ 329 + BIT(31), /* gate */ 330 + 0); 331 + 332 + static SUNXI_CCU_GATE(bus_vp9_clk, "bus-vp9", "psi-ahb1-ahb2", 333 + 0x6cc, BIT(0), 0); 334 + 335 + static SUNXI_CCU_GATE(bus_dma_clk, "bus-dma", "psi-ahb1-ahb2", 336 + 0x70c, BIT(0), 0); 337 + 338 + static SUNXI_CCU_GATE(bus_msgbox_clk, "bus-msgbox", "psi-ahb1-ahb2", 339 + 0x71c, BIT(0), 0); 340 + 341 + static SUNXI_CCU_GATE(bus_spinlock_clk, "bus-spinlock", "psi-ahb1-ahb2", 342 + 0x72c, BIT(0), 0); 343 + 344 + static SUNXI_CCU_GATE(bus_hstimer_clk, "bus-hstimer", "psi-ahb1-ahb2", 345 + 0x73c, BIT(0), 0); 346 + 347 + static SUNXI_CCU_GATE(avs_clk, "avs", "osc24M", 0x740, BIT(31), 0); 348 + 349 + static SUNXI_CCU_GATE(bus_dbg_clk, "bus-dbg", "psi-ahb1-ahb2", 350 + 0x78c, BIT(0), 0); 351 + 352 + static SUNXI_CCU_GATE(bus_psi_clk, "bus-psi", "psi-ahb1-ahb2", 353 + 0x79c, BIT(0), 0); 354 + 355 + static SUNXI_CCU_GATE(bus_pwm_clk, "bus-pwm", "apb1", 0x79c, BIT(0), 0); 356 + 357 + static SUNXI_CCU_GATE(bus_iommu_clk, "bus-iommu", "apb1", 0x7bc, BIT(0), 0); 358 + 359 + static const char * const dram_parents[] = { "pll-ddr0" }; 360 + static struct ccu_div dram_clk = { 361 + .div = _SUNXI_CCU_DIV(0, 2), 362 + .mux = _SUNXI_CCU_MUX(24, 2), 363 + .common = { 364 + .reg = 0x800, 365 + .hw.init = CLK_HW_INIT_PARENTS("dram", 366 + dram_parents, 367 + &ccu_div_ops, 368 + CLK_IS_CRITICAL), 369 + }, 370 + }; 371 + 372 + static SUNXI_CCU_GATE(mbus_dma_clk, "mbus-dma", "mbus", 373 + 0x804, BIT(0), 0); 374 + static SUNXI_CCU_GATE(mbus_ve_clk, "mbus-ve", "mbus", 375 + 0x804, BIT(1), 0); 376 + static SUNXI_CCU_GATE(mbus_ce_clk, "mbus-ce", "mbus", 377 + 0x804, BIT(2), 0); 378 + static SUNXI_CCU_GATE(mbus_ts_clk, "mbus-ts", "mbus", 379 + 0x804, BIT(3), 0); 380 + static SUNXI_CCU_GATE(mbus_nand_clk, "mbus-nand", "mbus", 381 + 0x804, BIT(5), 0); 382 + static SUNXI_CCU_GATE(mbus_csi_clk, "mbus-csi", "mbus", 383 + 0x804, BIT(8), 0); 384 + static SUNXI_CCU_GATE(mbus_deinterlace_clk, "mbus-deinterlace", "mbus", 385 + 0x804, BIT(11), 0); 386 + 387 + static SUNXI_CCU_GATE(bus_dram_clk, "bus-dram", "psi-ahb1-ahb2", 388 + 0x80c, BIT(0), CLK_IS_CRITICAL); 389 + 390 + static const char * const nand_spi_parents[] = { "osc24M", "pll-periph0", 391 + "pll-periph1", "pll-periph0-2x", 392 + "pll-periph1-2x" }; 393 + static SUNXI_CCU_MP_WITH_MUX_GATE(nand0_clk, "nand0", nand_spi_parents, 0x810, 394 + 0, 4, /* M */ 395 + 8, 2, /* N */ 396 + 24, 3, /* mux */ 397 + BIT(31),/* gate */ 398 + 0); 399 + 400 + static SUNXI_CCU_MP_WITH_MUX_GATE(nand1_clk, "nand1", nand_spi_parents, 0x814, 401 + 0, 4, /* M */ 402 + 8, 2, /* N */ 403 + 24, 3, /* mux */ 404 + BIT(31),/* gate */ 405 + 0); 406 + 407 + static SUNXI_CCU_GATE(bus_nand_clk, "bus-nand", "ahb3", 0x82c, BIT(0), 0); 408 + 409 + static const char * const mmc_parents[] = { "osc24M", "pll-periph0-2x", 410 + "pll-periph1-2x" }; 411 + static SUNXI_CCU_MP_WITH_MUX_GATE(mmc0_clk, "mmc0", mmc_parents, 0x830, 412 + 0, 4, /* M */ 413 + 8, 2, /* N */ 414 + 24, 3, /* mux */ 415 + BIT(31),/* gate */ 416 + 0); 417 + 418 + static SUNXI_CCU_MP_WITH_MUX_GATE(mmc1_clk, "mmc1", mmc_parents, 0x834, 419 + 0, 4, /* M */ 420 + 8, 2, /* N */ 421 + 24, 3, /* mux */ 422 + BIT(31),/* gate */ 423 + 0); 424 + 425 + static SUNXI_CCU_MP_WITH_MUX_GATE(mmc2_clk, "mmc2", mmc_parents, 0x838, 426 + 0, 4, /* M */ 427 + 8, 2, /* N */ 428 + 24, 3, /* mux */ 429 + BIT(31),/* gate */ 430 + 0); 431 + 432 + static SUNXI_CCU_GATE(bus_mmc0_clk, "bus-mmc0", "ahb3", 0x84c, BIT(0), 0); 433 + static SUNXI_CCU_GATE(bus_mmc1_clk, "bus-mmc1", "ahb3", 0x84c, BIT(1), 0); 434 + static SUNXI_CCU_GATE(bus_mmc2_clk, "bus-mmc2", "ahb3", 0x84c, BIT(2), 0); 435 + 436 + static SUNXI_CCU_GATE(bus_uart0_clk, "bus-uart0", "apb2", 0x90c, BIT(0), 0); 437 + static SUNXI_CCU_GATE(bus_uart1_clk, "bus-uart1", "apb2", 0x90c, BIT(1), 0); 438 + static SUNXI_CCU_GATE(bus_uart2_clk, "bus-uart2", "apb2", 0x90c, BIT(2), 0); 439 + static SUNXI_CCU_GATE(bus_uart3_clk, "bus-uart3", "apb2", 0x90c, BIT(3), 0); 440 + 441 + static SUNXI_CCU_GATE(bus_i2c0_clk, "bus-i2c0", "apb2", 0x91c, BIT(0), 0); 442 + static SUNXI_CCU_GATE(bus_i2c1_clk, "bus-i2c1", "apb2", 0x91c, BIT(1), 0); 443 + static SUNXI_CCU_GATE(bus_i2c2_clk, "bus-i2c2", "apb2", 0x91c, BIT(2), 0); 444 + static SUNXI_CCU_GATE(bus_i2c3_clk, "bus-i2c3", "apb2", 0x91c, BIT(3), 0); 445 + 446 + static SUNXI_CCU_GATE(bus_scr0_clk, "bus-scr0", "apb2", 0x93c, BIT(0), 0); 447 + static SUNXI_CCU_GATE(bus_scr1_clk, "bus-scr1", "apb2", 0x93c, BIT(1), 0); 448 + 449 + static SUNXI_CCU_MP_WITH_MUX_GATE(spi0_clk, "spi0", nand_spi_parents, 0x940, 450 + 0, 4, /* M */ 451 + 8, 2, /* N */ 452 + 24, 3, /* mux */ 453 + BIT(31),/* gate */ 454 + 0); 455 + 456 + static SUNXI_CCU_MP_WITH_MUX_GATE(spi1_clk, "spi1", nand_spi_parents, 0x944, 457 + 0, 4, /* M */ 458 + 8, 2, /* N */ 459 + 24, 3, /* mux */ 460 + BIT(31),/* gate */ 461 + 0); 462 + 463 + static SUNXI_CCU_GATE(bus_spi0_clk, "bus-spi0", "ahb3", 0x96c, BIT(0), 0); 464 + static SUNXI_CCU_GATE(bus_spi1_clk, "bus-spi1", "ahb3", 0x96c, BIT(1), 0); 465 + 466 + static SUNXI_CCU_GATE(bus_emac_clk, "bus-emac", "ahb3", 0x97c, BIT(0), 0); 467 + 468 + static const char * const ts_parents[] = { "osc24M", "pll-periph0" }; 469 + static SUNXI_CCU_MP_WITH_MUX_GATE(ts_clk, "ts", ts_parents, 0x9b0, 470 + 0, 4, /* M */ 471 + 8, 2, /* N */ 472 + 24, 1, /* mux */ 473 + BIT(31),/* gate */ 474 + 0); 475 + 476 + static SUNXI_CCU_GATE(bus_ts_clk, "bus-ts", "ahb3", 0x9bc, BIT(0), 0); 477 + 478 + static const char * const ir_tx_parents[] = { "osc32k", "osc24M" }; 479 + static SUNXI_CCU_MP_WITH_MUX_GATE(ir_tx_clk, "ir-tx", ir_tx_parents, 0x9c0, 480 + 0, 4, /* M */ 481 + 8, 2, /* N */ 482 + 24, 1, /* mux */ 483 + BIT(31),/* gate */ 484 + 0); 485 + 486 + static SUNXI_CCU_GATE(bus_ir_tx_clk, "bus-ir-tx", "apb1", 0x9cc, BIT(0), 0); 487 + 488 + static SUNXI_CCU_GATE(bus_ths_clk, "bus-ths", "apb1", 0x9fc, BIT(0), 0); 489 + 490 + static const char * const audio_parents[] = { "pll-audio", "pll-audio-2x", "pll-audio-4x" }; 491 + static struct ccu_div i2s3_clk = { 492 + .enable = BIT(31), 493 + .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 494 + .mux = _SUNXI_CCU_MUX(24, 2), 495 + .common = { 496 + .reg = 0xa0c, 497 + .hw.init = CLK_HW_INIT_PARENTS("i2s3", 498 + audio_parents, 499 + &ccu_div_ops, 500 + 0), 501 + }, 502 + }; 503 + 504 + static struct ccu_div i2s0_clk = { 505 + .enable = BIT(31), 506 + .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 507 + .mux = _SUNXI_CCU_MUX(24, 2), 508 + .common = { 509 + .reg = 0xa10, 510 + .hw.init = CLK_HW_INIT_PARENTS("i2s0", 511 + audio_parents, 512 + &ccu_div_ops, 513 + 0), 514 + }, 515 + }; 516 + 517 + static struct ccu_div i2s1_clk = { 518 + .enable = BIT(31), 519 + .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 520 + .mux = _SUNXI_CCU_MUX(24, 2), 521 + .common = { 522 + .reg = 0xa14, 523 + .hw.init = CLK_HW_INIT_PARENTS("i2s1", 524 + audio_parents, 525 + &ccu_div_ops, 526 + 0), 527 + }, 528 + }; 529 + 530 + static struct ccu_div i2s2_clk = { 531 + .enable = BIT(31), 532 + .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 533 + .mux = _SUNXI_CCU_MUX(24, 2), 534 + .common = { 535 + .reg = 0xa18, 536 + .hw.init = CLK_HW_INIT_PARENTS("i2s2", 537 + audio_parents, 538 + &ccu_div_ops, 539 + 0), 540 + }, 541 + }; 542 + 543 + static SUNXI_CCU_GATE(bus_i2s0_clk, "bus-i2s0", "apb1", 0xa1c, BIT(0), 0); 544 + static SUNXI_CCU_GATE(bus_i2s1_clk, "bus-i2s1", "apb1", 0xa1c, BIT(1), 0); 545 + static SUNXI_CCU_GATE(bus_i2s2_clk, "bus-i2s2", "apb1", 0xa1c, BIT(2), 0); 546 + static SUNXI_CCU_GATE(bus_i2s3_clk, "bus-i2s3", "apb1", 0xa1c, BIT(3), 0); 547 + 548 + static struct ccu_div spdif_clk = { 549 + .enable = BIT(31), 550 + .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 551 + .mux = _SUNXI_CCU_MUX(24, 2), 552 + .common = { 553 + .reg = 0xa20, 554 + .hw.init = CLK_HW_INIT_PARENTS("spdif", 555 + audio_parents, 556 + &ccu_div_ops, 557 + 0), 558 + }, 559 + }; 560 + 561 + static SUNXI_CCU_GATE(bus_spdif_clk, "bus-spdif", "apb1", 0xa2c, BIT(0), 0); 562 + 563 + static struct ccu_div dmic_clk = { 564 + .enable = BIT(31), 565 + .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 566 + .mux = _SUNXI_CCU_MUX(24, 2), 567 + .common = { 568 + .reg = 0xa40, 569 + .hw.init = CLK_HW_INIT_PARENTS("dmic", 570 + audio_parents, 571 + &ccu_div_ops, 572 + 0), 573 + }, 574 + }; 575 + 576 + static SUNXI_CCU_GATE(bus_dmic_clk, "bus-dmic", "apb1", 0xa4c, BIT(0), 0); 577 + 578 + static struct ccu_div audio_hub_clk = { 579 + .enable = BIT(31), 580 + .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 581 + .mux = _SUNXI_CCU_MUX(24, 2), 582 + .common = { 583 + .reg = 0xa60, 584 + .hw.init = CLK_HW_INIT_PARENTS("audio-hub", 585 + audio_parents, 586 + &ccu_div_ops, 587 + 0), 588 + }, 589 + }; 590 + 591 + static SUNXI_CCU_GATE(bus_audio_hub_clk, "bus-audio-hub", "apb1", 0xa6c, BIT(0), 0); 592 + 593 + /* 594 + * There are OHCI 12M clock source selection bits for 2 USB 2.0 ports. 595 + * We will force them to 0 (12M divided from 48M). 596 + */ 597 + #define SUN50I_H6_USB0_CLK_REG 0xa70 598 + #define SUN50I_H6_USB3_CLK_REG 0xa7c 599 + 600 + static SUNXI_CCU_GATE(usb_ohci0_clk, "usb-ohci0", "osc12M", 0xa70, BIT(31), 0); 601 + static SUNXI_CCU_GATE(usb_phy0_clk, "usb-phy0", "osc24M", 0xa70, BIT(29), 0); 602 + 603 + static SUNXI_CCU_GATE(usb_phy1_clk, "usb-phy1", "osc24M", 0xa74, BIT(29), 0); 604 + 605 + static SUNXI_CCU_GATE(usb_ohci3_clk, "usb-ohci3", "osc12M", 0xa7c, BIT(31), 0); 606 + static SUNXI_CCU_GATE(usb_phy3_clk, "usb-phy3", "osc12M", 0xa7c, BIT(29), 0); 607 + static SUNXI_CCU_GATE(usb_hsic_12m_clk, "usb-hsic-12M", "osc12M", 0xa7c, BIT(27), 0); 608 + static SUNXI_CCU_GATE(usb_hsic_clk, "usb-hsic", "pll-hsic", 0xa7c, BIT(26), 0); 609 + 610 + static SUNXI_CCU_GATE(bus_ohci0_clk, "bus-ohci0", "ahb3", 0xa8c, BIT(0), 0); 611 + static SUNXI_CCU_GATE(bus_ohci3_clk, "bus-ohci3", "ahb3", 0xa8c, BIT(3), 0); 612 + static SUNXI_CCU_GATE(bus_ehci0_clk, "bus-ehci0", "ahb3", 0xa8c, BIT(4), 0); 613 + static SUNXI_CCU_GATE(bus_xhci_clk, "bus-xhci", "ahb3", 0xa8c, BIT(5), 0); 614 + static SUNXI_CCU_GATE(bus_ehci3_clk, "bus-ehci3", "ahb3", 0xa8c, BIT(7), 0); 615 + static SUNXI_CCU_GATE(bus_otg_clk, "bus-otg", "ahb3", 0xa8c, BIT(8), 0); 616 + 617 + static CLK_FIXED_FACTOR(pcie_ref_100m_clk, "pcie-ref-100M", 618 + "pll-periph0-4x", 24, 1, 0); 619 + static SUNXI_CCU_GATE(pcie_ref_clk, "pcie-ref", "pcie-ref-100M", 620 + 0xab0, BIT(31), 0); 621 + static SUNXI_CCU_GATE(pcie_ref_out_clk, "pcie-ref-out", "pcie-ref", 622 + 0xab0, BIT(30), 0); 623 + 624 + static SUNXI_CCU_M_WITH_GATE(pcie_maxi_clk, "pcie-maxi", 625 + "pll-periph0", 0xab4, 626 + 0, 4, /* M */ 627 + BIT(31), /* gate */ 628 + 0); 629 + 630 + static SUNXI_CCU_M_WITH_GATE(pcie_aux_clk, "pcie-aux", "osc24M", 0xab8, 631 + 0, 5, /* M */ 632 + BIT(31), /* gate */ 633 + 0); 634 + 635 + static SUNXI_CCU_GATE(bus_pcie_clk, "bus-pcie", "psi-ahb1-ahb2", 636 + 0xabc, BIT(0), 0); 637 + 638 + static const char * const hdmi_parents[] = { "pll-video0", "pll-video1", 639 + "pll-video1-4x" }; 640 + static SUNXI_CCU_M_WITH_MUX_GATE(hdmi_clk, "hdmi", hdmi_parents, 0xb00, 641 + 0, 4, /* M */ 642 + 24, 2, /* mux */ 643 + BIT(31), /* gate */ 644 + 0); 645 + 646 + static const char * const hdmi_cec_parents[] = { "osc32k", "pll-periph0-2x" }; 647 + static const struct ccu_mux_fixed_prediv hdmi_cec_predivs[] = { 648 + { .index = 1, .div = 36621 }, 649 + }; 650 + static struct ccu_mux hdmi_cec_clk = { 651 + .enable = BIT(31), 652 + 653 + .mux = { 654 + .shift = 24, 655 + .width = 2, 656 + 657 + .fixed_predivs = hdmi_cec_predivs, 658 + .n_predivs = ARRAY_SIZE(hdmi_cec_predivs), 659 + }, 660 + 661 + .common = { 662 + .reg = 0xb10, 663 + .features = CCU_FEATURE_VARIABLE_PREDIV, 664 + .hw.init = CLK_HW_INIT_PARENTS("hdmi-cec", 665 + hdmi_cec_parents, 666 + &ccu_mux_ops, 667 + 0), 668 + }, 669 + }; 670 + 671 + static SUNXI_CCU_GATE(bus_hdmi_clk, "bus-hdmi", "ahb3", 0xb1c, BIT(0), 0); 672 + 673 + static SUNXI_CCU_GATE(bus_tcon_top_clk, "bus-tcon-top", "ahb3", 674 + 0xb5c, BIT(0), 0); 675 + 676 + static const char * const tcon_lcd0_parents[] = { "pll-video0", 677 + "pll-video0-4x", 678 + "pll-video1" }; 679 + static SUNXI_CCU_MUX_WITH_GATE(tcon_lcd0_clk, "tcon-lcd0", 680 + tcon_lcd0_parents, 0xb60, 681 + 24, 3, /* mux */ 682 + BIT(31), /* gate */ 683 + 0); 684 + 685 + static SUNXI_CCU_GATE(bus_tcon_lcd0_clk, "bus-tcon-lcd0", "ahb3", 686 + 0xb7c, BIT(0), 0); 687 + 688 + static const char * const tcon_tv0_parents[] = { "pll-video0", 689 + "pll-video0-4x", 690 + "pll-video1", 691 + "pll-video1-4x" }; 692 + static SUNXI_CCU_MP_WITH_MUX_GATE(tcon_tv0_clk, "tcon-tv0", 693 + tcon_tv0_parents, 0xb80, 694 + 0, 4, /* M */ 695 + 8, 2, /* P */ 696 + 24, 3, /* mux */ 697 + BIT(31), /* gate */ 698 + 0); 699 + 700 + static SUNXI_CCU_GATE(bus_tcon_tv0_clk, "bus-tcon-tv0", "ahb3", 701 + 0xb9c, BIT(0), 0); 702 + 703 + static SUNXI_CCU_GATE(csi_cci_clk, "csi-cci", "osc24M", 0xc00, BIT(0), 0); 704 + 705 + static const char * const csi_top_parents[] = { "pll-video0", "pll-ve", 706 + "pll-periph0" }; 707 + static const u8 csi_top_table[] = { 0, 2, 3 }; 708 + static SUNXI_CCU_M_WITH_MUX_TABLE_GATE(csi_top_clk, "csi-top", 709 + csi_top_parents, csi_top_table, 0xc04, 710 + 0, 4, /* M */ 711 + 24, 3, /* mux */ 712 + BIT(31), /* gate */ 713 + 0); 714 + 715 + static const char * const csi_mclk_parents[] = { "osc24M", "pll-video0", 716 + "pll-periph0", "pll-periph1" }; 717 + static SUNXI_CCU_M_WITH_MUX_GATE(csi_mclk_clk, "csi-mclk", 718 + csi_mclk_parents, 0xc08, 719 + 0, 5, /* M */ 720 + 24, 3, /* mux */ 721 + BIT(31), /* gate */ 722 + 0); 723 + 724 + static SUNXI_CCU_GATE(bus_csi_clk, "bus-csi", "ahb3", 0xc2c, BIT(0), 0); 725 + 726 + static const char * const hdcp_parents[] = { "pll-periph0", "pll-periph1" }; 727 + static SUNXI_CCU_M_WITH_MUX_GATE(hdcp_clk, "hdcp", hdcp_parents, 0xc40, 728 + 0, 4, /* M */ 729 + 24, 2, /* mux */ 730 + BIT(31), /* gate */ 731 + 0); 732 + 733 + static SUNXI_CCU_GATE(bus_hdcp_clk, "bus-hdcp", "ahb3", 0xc4c, BIT(0), 0); 734 + 735 + /* Fixed factor clocks */ 736 + static CLK_FIXED_FACTOR(osc12M_clk, "osc12M", "osc24M", 2, 1, 0); 737 + 738 + /* 739 + * The divider of pll-audio is fixed to 8 now, as pll-audio-4x has a 740 + * fixed post-divider 2. 741 + */ 742 + static CLK_FIXED_FACTOR(pll_audio_clk, "pll-audio", 743 + "pll-audio-base", 8, 1, CLK_SET_RATE_PARENT); 744 + static CLK_FIXED_FACTOR(pll_audio_2x_clk, "pll-audio-2x", 745 + "pll-audio-base", 4, 1, CLK_SET_RATE_PARENT); 746 + static CLK_FIXED_FACTOR(pll_audio_4x_clk, "pll-audio-4x", 747 + "pll-audio-base", 2, 1, CLK_SET_RATE_PARENT); 748 + 749 + static CLK_FIXED_FACTOR(pll_periph0_4x_clk, "pll-periph0-4x", 750 + "pll-periph0", 1, 4, 0); 751 + static CLK_FIXED_FACTOR(pll_periph0_2x_clk, "pll-periph0-2x", 752 + "pll-periph0", 1, 2, 0); 753 + 754 + static CLK_FIXED_FACTOR(pll_periph1_4x_clk, "pll-periph1-4x", 755 + "pll-periph1", 1, 4, 0); 756 + static CLK_FIXED_FACTOR(pll_periph1_2x_clk, "pll-periph1-2x", 757 + "pll-periph1", 1, 2, 0); 758 + 759 + static CLK_FIXED_FACTOR(pll_video0_4x_clk, "pll-video0-4x", 760 + "pll-video0", 1, 4, CLK_SET_RATE_PARENT); 761 + 762 + static CLK_FIXED_FACTOR(pll_video1_4x_clk, "pll-video1-4x", 763 + "pll-video1", 1, 4, CLK_SET_RATE_PARENT); 764 + 765 + static struct ccu_common *sun50i_h6_ccu_clks[] = { 766 + &pll_cpux_clk.common, 767 + &pll_ddr0_clk.common, 768 + &pll_periph0_clk.common, 769 + &pll_periph1_clk.common, 770 + &pll_gpu_clk.common, 771 + &pll_video0_clk.common, 772 + &pll_video1_clk.common, 773 + &pll_ve_clk.common, 774 + &pll_de_clk.common, 775 + &pll_hsic_clk.common, 776 + &pll_audio_base_clk.common, 777 + &cpux_clk.common, 778 + &axi_clk.common, 779 + &cpux_apb_clk.common, 780 + &psi_ahb1_ahb2_clk.common, 781 + &ahb3_clk.common, 782 + &apb1_clk.common, 783 + &apb2_clk.common, 784 + &mbus_clk.common, 785 + &de_clk.common, 786 + &bus_de_clk.common, 787 + &deinterlace_clk.common, 788 + &bus_deinterlace_clk.common, 789 + &gpu_clk.common, 790 + &bus_gpu_clk.common, 791 + &ce_clk.common, 792 + &bus_ce_clk.common, 793 + &ve_clk.common, 794 + &bus_ve_clk.common, 795 + &emce_clk.common, 796 + &bus_emce_clk.common, 797 + &vp9_clk.common, 798 + &bus_vp9_clk.common, 799 + &bus_dma_clk.common, 800 + &bus_msgbox_clk.common, 801 + &bus_spinlock_clk.common, 802 + &bus_hstimer_clk.common, 803 + &avs_clk.common, 804 + &bus_dbg_clk.common, 805 + &bus_psi_clk.common, 806 + &bus_pwm_clk.common, 807 + &bus_iommu_clk.common, 808 + &dram_clk.common, 809 + &mbus_dma_clk.common, 810 + &mbus_ve_clk.common, 811 + &mbus_ce_clk.common, 812 + &mbus_ts_clk.common, 813 + &mbus_nand_clk.common, 814 + &mbus_csi_clk.common, 815 + &mbus_deinterlace_clk.common, 816 + &bus_dram_clk.common, 817 + &nand0_clk.common, 818 + &nand1_clk.common, 819 + &bus_nand_clk.common, 820 + &mmc0_clk.common, 821 + &mmc1_clk.common, 822 + &mmc2_clk.common, 823 + &bus_mmc0_clk.common, 824 + &bus_mmc1_clk.common, 825 + &bus_mmc2_clk.common, 826 + &bus_uart0_clk.common, 827 + &bus_uart1_clk.common, 828 + &bus_uart2_clk.common, 829 + &bus_uart3_clk.common, 830 + &bus_i2c0_clk.common, 831 + &bus_i2c1_clk.common, 832 + &bus_i2c2_clk.common, 833 + &bus_i2c3_clk.common, 834 + &bus_scr0_clk.common, 835 + &bus_scr1_clk.common, 836 + &spi0_clk.common, 837 + &spi1_clk.common, 838 + &bus_spi0_clk.common, 839 + &bus_spi1_clk.common, 840 + &bus_emac_clk.common, 841 + &ts_clk.common, 842 + &bus_ts_clk.common, 843 + &ir_tx_clk.common, 844 + &bus_ir_tx_clk.common, 845 + &bus_ths_clk.common, 846 + &i2s3_clk.common, 847 + &i2s0_clk.common, 848 + &i2s1_clk.common, 849 + &i2s2_clk.common, 850 + &bus_i2s0_clk.common, 851 + &bus_i2s1_clk.common, 852 + &bus_i2s2_clk.common, 853 + &bus_i2s3_clk.common, 854 + &spdif_clk.common, 855 + &bus_spdif_clk.common, 856 + &dmic_clk.common, 857 + &bus_dmic_clk.common, 858 + &audio_hub_clk.common, 859 + &bus_audio_hub_clk.common, 860 + &usb_ohci0_clk.common, 861 + &usb_phy0_clk.common, 862 + &usb_phy1_clk.common, 863 + &usb_ohci3_clk.common, 864 + &usb_phy3_clk.common, 865 + &usb_hsic_12m_clk.common, 866 + &usb_hsic_clk.common, 867 + &bus_ohci0_clk.common, 868 + &bus_ohci3_clk.common, 869 + &bus_ehci0_clk.common, 870 + &bus_xhci_clk.common, 871 + &bus_ehci3_clk.common, 872 + &bus_otg_clk.common, 873 + &pcie_ref_clk.common, 874 + &pcie_ref_out_clk.common, 875 + &pcie_maxi_clk.common, 876 + &pcie_aux_clk.common, 877 + &bus_pcie_clk.common, 878 + &hdmi_clk.common, 879 + &hdmi_cec_clk.common, 880 + &bus_hdmi_clk.common, 881 + &bus_tcon_top_clk.common, 882 + &tcon_lcd0_clk.common, 883 + &bus_tcon_lcd0_clk.common, 884 + &tcon_tv0_clk.common, 885 + &bus_tcon_tv0_clk.common, 886 + &csi_cci_clk.common, 887 + &csi_top_clk.common, 888 + &csi_mclk_clk.common, 889 + &bus_csi_clk.common, 890 + &hdcp_clk.common, 891 + &bus_hdcp_clk.common, 892 + }; 893 + 894 + static struct clk_hw_onecell_data sun50i_h6_hw_clks = { 895 + .hws = { 896 + [CLK_OSC12M] = &osc12M_clk.hw, 897 + [CLK_PLL_CPUX] = &pll_cpux_clk.common.hw, 898 + [CLK_PLL_DDR0] = &pll_ddr0_clk.common.hw, 899 + [CLK_PLL_PERIPH0] = &pll_periph0_clk.common.hw, 900 + [CLK_PLL_PERIPH0_2X] = &pll_periph0_2x_clk.hw, 901 + [CLK_PLL_PERIPH0_4X] = &pll_periph0_4x_clk.hw, 902 + [CLK_PLL_PERIPH1] = &pll_periph1_clk.common.hw, 903 + [CLK_PLL_PERIPH1_2X] = &pll_periph1_2x_clk.hw, 904 + [CLK_PLL_PERIPH1_4X] = &pll_periph1_4x_clk.hw, 905 + [CLK_PLL_GPU] = &pll_gpu_clk.common.hw, 906 + [CLK_PLL_VIDEO0] = &pll_video0_clk.common.hw, 907 + [CLK_PLL_VIDEO0_4X] = &pll_video0_4x_clk.hw, 908 + [CLK_PLL_VIDEO1] = &pll_video1_clk.common.hw, 909 + [CLK_PLL_VIDEO1_4X] = &pll_video1_4x_clk.hw, 910 + [CLK_PLL_VE] = &pll_ve_clk.common.hw, 911 + [CLK_PLL_DE] = &pll_de_clk.common.hw, 912 + [CLK_PLL_HSIC] = &pll_hsic_clk.common.hw, 913 + [CLK_PLL_AUDIO_BASE] = &pll_audio_base_clk.common.hw, 914 + [CLK_PLL_AUDIO] = &pll_audio_clk.hw, 915 + [CLK_PLL_AUDIO_2X] = &pll_audio_2x_clk.hw, 916 + [CLK_PLL_AUDIO_4X] = &pll_audio_4x_clk.hw, 917 + [CLK_CPUX] = &cpux_clk.common.hw, 918 + [CLK_AXI] = &axi_clk.common.hw, 919 + [CLK_CPUX_APB] = &cpux_apb_clk.common.hw, 920 + [CLK_PSI_AHB1_AHB2] = &psi_ahb1_ahb2_clk.common.hw, 921 + [CLK_AHB3] = &ahb3_clk.common.hw, 922 + [CLK_APB1] = &apb1_clk.common.hw, 923 + [CLK_APB2] = &apb2_clk.common.hw, 924 + [CLK_MBUS] = &mbus_clk.common.hw, 925 + [CLK_DE] = &de_clk.common.hw, 926 + [CLK_BUS_DE] = &bus_de_clk.common.hw, 927 + [CLK_DEINTERLACE] = &deinterlace_clk.common.hw, 928 + [CLK_BUS_DEINTERLACE] = &bus_deinterlace_clk.common.hw, 929 + [CLK_GPU] = &gpu_clk.common.hw, 930 + [CLK_BUS_GPU] = &bus_gpu_clk.common.hw, 931 + [CLK_CE] = &ce_clk.common.hw, 932 + [CLK_BUS_CE] = &bus_ce_clk.common.hw, 933 + [CLK_VE] = &ve_clk.common.hw, 934 + [CLK_BUS_VE] = &bus_ve_clk.common.hw, 935 + [CLK_EMCE] = &emce_clk.common.hw, 936 + [CLK_BUS_EMCE] = &bus_emce_clk.common.hw, 937 + [CLK_VP9] = &vp9_clk.common.hw, 938 + [CLK_BUS_VP9] = &bus_vp9_clk.common.hw, 939 + [CLK_BUS_DMA] = &bus_dma_clk.common.hw, 940 + [CLK_BUS_MSGBOX] = &bus_msgbox_clk.common.hw, 941 + [CLK_BUS_SPINLOCK] = &bus_spinlock_clk.common.hw, 942 + [CLK_BUS_HSTIMER] = &bus_hstimer_clk.common.hw, 943 + [CLK_AVS] = &avs_clk.common.hw, 944 + [CLK_BUS_DBG] = &bus_dbg_clk.common.hw, 945 + [CLK_BUS_PSI] = &bus_psi_clk.common.hw, 946 + [CLK_BUS_PWM] = &bus_pwm_clk.common.hw, 947 + [CLK_BUS_IOMMU] = &bus_iommu_clk.common.hw, 948 + [CLK_DRAM] = &dram_clk.common.hw, 949 + [CLK_MBUS_DMA] = &mbus_dma_clk.common.hw, 950 + [CLK_MBUS_VE] = &mbus_ve_clk.common.hw, 951 + [CLK_MBUS_CE] = &mbus_ce_clk.common.hw, 952 + [CLK_MBUS_TS] = &mbus_ts_clk.common.hw, 953 + [CLK_MBUS_NAND] = &mbus_nand_clk.common.hw, 954 + [CLK_MBUS_CSI] = &mbus_csi_clk.common.hw, 955 + [CLK_MBUS_DEINTERLACE] = &mbus_deinterlace_clk.common.hw, 956 + [CLK_BUS_DRAM] = &bus_dram_clk.common.hw, 957 + [CLK_NAND0] = &nand0_clk.common.hw, 958 + [CLK_NAND1] = &nand1_clk.common.hw, 959 + [CLK_BUS_NAND] = &bus_nand_clk.common.hw, 960 + [CLK_MMC0] = &mmc0_clk.common.hw, 961 + [CLK_MMC1] = &mmc1_clk.common.hw, 962 + [CLK_MMC2] = &mmc2_clk.common.hw, 963 + [CLK_BUS_MMC0] = &bus_mmc0_clk.common.hw, 964 + [CLK_BUS_MMC1] = &bus_mmc1_clk.common.hw, 965 + [CLK_BUS_MMC2] = &bus_mmc2_clk.common.hw, 966 + [CLK_BUS_UART0] = &bus_uart0_clk.common.hw, 967 + [CLK_BUS_UART1] = &bus_uart1_clk.common.hw, 968 + [CLK_BUS_UART2] = &bus_uart2_clk.common.hw, 969 + [CLK_BUS_UART3] = &bus_uart3_clk.common.hw, 970 + [CLK_BUS_I2C0] = &bus_i2c0_clk.common.hw, 971 + [CLK_BUS_I2C1] = &bus_i2c1_clk.common.hw, 972 + [CLK_BUS_I2C2] = &bus_i2c2_clk.common.hw, 973 + [CLK_BUS_I2C3] = &bus_i2c3_clk.common.hw, 974 + [CLK_BUS_SCR0] = &bus_scr0_clk.common.hw, 975 + [CLK_BUS_SCR1] = &bus_scr1_clk.common.hw, 976 + [CLK_SPI0] = &spi0_clk.common.hw, 977 + [CLK_SPI1] = &spi1_clk.common.hw, 978 + [CLK_BUS_SPI0] = &bus_spi0_clk.common.hw, 979 + [CLK_BUS_SPI1] = &bus_spi1_clk.common.hw, 980 + [CLK_BUS_EMAC] = &bus_emac_clk.common.hw, 981 + [CLK_TS] = &ts_clk.common.hw, 982 + [CLK_BUS_TS] = &bus_ts_clk.common.hw, 983 + [CLK_IR_TX] = &ir_tx_clk.common.hw, 984 + [CLK_BUS_IR_TX] = &bus_ir_tx_clk.common.hw, 985 + [CLK_BUS_THS] = &bus_ths_clk.common.hw, 986 + [CLK_I2S3] = &i2s3_clk.common.hw, 987 + [CLK_I2S0] = &i2s0_clk.common.hw, 988 + [CLK_I2S1] = &i2s1_clk.common.hw, 989 + [CLK_I2S2] = &i2s2_clk.common.hw, 990 + [CLK_BUS_I2S0] = &bus_i2s0_clk.common.hw, 991 + [CLK_BUS_I2S1] = &bus_i2s1_clk.common.hw, 992 + [CLK_BUS_I2S2] = &bus_i2s2_clk.common.hw, 993 + [CLK_BUS_I2S3] = &bus_i2s3_clk.common.hw, 994 + [CLK_SPDIF] = &spdif_clk.common.hw, 995 + [CLK_BUS_SPDIF] = &bus_spdif_clk.common.hw, 996 + [CLK_DMIC] = &dmic_clk.common.hw, 997 + [CLK_BUS_DMIC] = &bus_dmic_clk.common.hw, 998 + [CLK_AUDIO_HUB] = &audio_hub_clk.common.hw, 999 + [CLK_BUS_AUDIO_HUB] = &bus_audio_hub_clk.common.hw, 1000 + [CLK_USB_OHCI0] = &usb_ohci0_clk.common.hw, 1001 + [CLK_USB_PHY0] = &usb_phy0_clk.common.hw, 1002 + [CLK_USB_PHY1] = &usb_phy1_clk.common.hw, 1003 + [CLK_USB_OHCI3] = &usb_ohci3_clk.common.hw, 1004 + [CLK_USB_PHY3] = &usb_phy3_clk.common.hw, 1005 + [CLK_USB_HSIC_12M] = &usb_hsic_12m_clk.common.hw, 1006 + [CLK_USB_HSIC] = &usb_hsic_clk.common.hw, 1007 + [CLK_BUS_OHCI0] = &bus_ohci0_clk.common.hw, 1008 + [CLK_BUS_OHCI3] = &bus_ohci3_clk.common.hw, 1009 + [CLK_BUS_EHCI0] = &bus_ehci0_clk.common.hw, 1010 + [CLK_BUS_XHCI] = &bus_xhci_clk.common.hw, 1011 + [CLK_BUS_EHCI3] = &bus_ehci3_clk.common.hw, 1012 + [CLK_BUS_OTG] = &bus_otg_clk.common.hw, 1013 + [CLK_PCIE_REF_100M] = &pcie_ref_100m_clk.hw, 1014 + [CLK_PCIE_REF] = &pcie_ref_clk.common.hw, 1015 + [CLK_PCIE_REF_OUT] = &pcie_ref_out_clk.common.hw, 1016 + [CLK_PCIE_MAXI] = &pcie_maxi_clk.common.hw, 1017 + [CLK_PCIE_AUX] = &pcie_aux_clk.common.hw, 1018 + [CLK_BUS_PCIE] = &bus_pcie_clk.common.hw, 1019 + [CLK_HDMI] = &hdmi_clk.common.hw, 1020 + [CLK_HDMI_CEC] = &hdmi_cec_clk.common.hw, 1021 + [CLK_BUS_HDMI] = &bus_hdmi_clk.common.hw, 1022 + [CLK_BUS_TCON_TOP] = &bus_tcon_top_clk.common.hw, 1023 + [CLK_TCON_LCD0] = &tcon_lcd0_clk.common.hw, 1024 + [CLK_BUS_TCON_LCD0] = &bus_tcon_lcd0_clk.common.hw, 1025 + [CLK_TCON_TV0] = &tcon_tv0_clk.common.hw, 1026 + [CLK_BUS_TCON_TV0] = &bus_tcon_tv0_clk.common.hw, 1027 + [CLK_CSI_CCI] = &csi_cci_clk.common.hw, 1028 + [CLK_CSI_TOP] = &csi_top_clk.common.hw, 1029 + [CLK_CSI_MCLK] = &csi_mclk_clk.common.hw, 1030 + [CLK_BUS_CSI] = &bus_csi_clk.common.hw, 1031 + [CLK_HDCP] = &hdcp_clk.common.hw, 1032 + [CLK_BUS_HDCP] = &bus_hdcp_clk.common.hw, 1033 + }, 1034 + .num = CLK_NUMBER, 1035 + }; 1036 + 1037 + static struct ccu_reset_map sun50i_h6_ccu_resets[] = { 1038 + [RST_MBUS] = { 0x540, BIT(30) }, 1039 + 1040 + [RST_BUS_DE] = { 0x60c, BIT(16) }, 1041 + [RST_BUS_DEINTERLACE] = { 0x62c, BIT(16) }, 1042 + [RST_BUS_GPU] = { 0x67c, BIT(16) }, 1043 + [RST_BUS_CE] = { 0x68c, BIT(16) }, 1044 + [RST_BUS_VE] = { 0x69c, BIT(16) }, 1045 + [RST_BUS_EMCE] = { 0x6bc, BIT(16) }, 1046 + [RST_BUS_VP9] = { 0x6cc, BIT(16) }, 1047 + [RST_BUS_DMA] = { 0x70c, BIT(16) }, 1048 + [RST_BUS_MSGBOX] = { 0x71c, BIT(16) }, 1049 + [RST_BUS_SPINLOCK] = { 0x72c, BIT(16) }, 1050 + [RST_BUS_HSTIMER] = { 0x73c, BIT(16) }, 1051 + [RST_BUS_DBG] = { 0x78c, BIT(16) }, 1052 + [RST_BUS_PSI] = { 0x79c, BIT(16) }, 1053 + [RST_BUS_PWM] = { 0x7ac, BIT(16) }, 1054 + [RST_BUS_IOMMU] = { 0x7bc, BIT(16) }, 1055 + [RST_BUS_DRAM] = { 0x80c, BIT(16) }, 1056 + [RST_BUS_NAND] = { 0x82c, BIT(16) }, 1057 + [RST_BUS_MMC0] = { 0x84c, BIT(16) }, 1058 + [RST_BUS_MMC1] = { 0x84c, BIT(17) }, 1059 + [RST_BUS_MMC2] = { 0x84c, BIT(18) }, 1060 + [RST_BUS_UART0] = { 0x90c, BIT(16) }, 1061 + [RST_BUS_UART1] = { 0x90c, BIT(17) }, 1062 + [RST_BUS_UART2] = { 0x90c, BIT(18) }, 1063 + [RST_BUS_UART3] = { 0x90c, BIT(19) }, 1064 + [RST_BUS_I2C0] = { 0x91c, BIT(16) }, 1065 + [RST_BUS_I2C1] = { 0x91c, BIT(17) }, 1066 + [RST_BUS_I2C2] = { 0x91c, BIT(18) }, 1067 + [RST_BUS_I2C3] = { 0x91c, BIT(19) }, 1068 + [RST_BUS_SCR0] = { 0x93c, BIT(16) }, 1069 + [RST_BUS_SCR1] = { 0x93c, BIT(17) }, 1070 + [RST_BUS_SPI0] = { 0x96c, BIT(16) }, 1071 + [RST_BUS_SPI1] = { 0x96c, BIT(17) }, 1072 + [RST_BUS_EMAC] = { 0x97c, BIT(16) }, 1073 + [RST_BUS_TS] = { 0x9bc, BIT(16) }, 1074 + [RST_BUS_IR_TX] = { 0x9cc, BIT(16) }, 1075 + [RST_BUS_THS] = { 0x9fc, BIT(16) }, 1076 + [RST_BUS_I2S0] = { 0xa1c, BIT(16) }, 1077 + [RST_BUS_I2S1] = { 0xa1c, BIT(17) }, 1078 + [RST_BUS_I2S2] = { 0xa1c, BIT(18) }, 1079 + [RST_BUS_I2S3] = { 0xa1c, BIT(19) }, 1080 + [RST_BUS_SPDIF] = { 0xa2c, BIT(16) }, 1081 + [RST_BUS_DMIC] = { 0xa4c, BIT(16) }, 1082 + [RST_BUS_AUDIO_HUB] = { 0xa6c, BIT(16) }, 1083 + 1084 + [RST_USB_PHY0] = { 0xa70, BIT(30) }, 1085 + [RST_USB_PHY1] = { 0xa74, BIT(30) }, 1086 + [RST_USB_PHY3] = { 0xa7c, BIT(30) }, 1087 + [RST_USB_HSIC] = { 0xa7c, BIT(28) }, 1088 + 1089 + [RST_BUS_OHCI0] = { 0xa8c, BIT(16) }, 1090 + [RST_BUS_OHCI3] = { 0xa8c, BIT(19) }, 1091 + [RST_BUS_EHCI0] = { 0xa8c, BIT(20) }, 1092 + [RST_BUS_XHCI] = { 0xa8c, BIT(21) }, 1093 + [RST_BUS_EHCI3] = { 0xa8c, BIT(23) }, 1094 + [RST_BUS_OTG] = { 0xa8c, BIT(24) }, 1095 + [RST_BUS_PCIE] = { 0xabc, BIT(16) }, 1096 + 1097 + [RST_PCIE_POWERUP] = { 0xabc, BIT(17) }, 1098 + 1099 + [RST_BUS_HDMI] = { 0xb1c, BIT(16) }, 1100 + [RST_BUS_HDMI_SUB] = { 0xb1c, BIT(17) }, 1101 + [RST_BUS_TCON_TOP] = { 0xb5c, BIT(16) }, 1102 + [RST_BUS_TCON_LCD0] = { 0xb7c, BIT(16) }, 1103 + [RST_BUS_TCON_TV0] = { 0xb9c, BIT(16) }, 1104 + [RST_BUS_CSI] = { 0xc2c, BIT(16) }, 1105 + [RST_BUS_HDCP] = { 0xc4c, BIT(16) }, 1106 + }; 1107 + 1108 + static const struct sunxi_ccu_desc sun50i_h6_ccu_desc = { 1109 + .ccu_clks = sun50i_h6_ccu_clks, 1110 + .num_ccu_clks = ARRAY_SIZE(sun50i_h6_ccu_clks), 1111 + 1112 + .hw_clks = &sun50i_h6_hw_clks, 1113 + 1114 + .resets = sun50i_h6_ccu_resets, 1115 + .num_resets = ARRAY_SIZE(sun50i_h6_ccu_resets), 1116 + }; 1117 + 1118 + static const u32 pll_regs[] = { 1119 + SUN50I_H6_PLL_CPUX_REG, 1120 + SUN50I_H6_PLL_DDR0_REG, 1121 + SUN50I_H6_PLL_PERIPH0_REG, 1122 + SUN50I_H6_PLL_PERIPH1_REG, 1123 + SUN50I_H6_PLL_GPU_REG, 1124 + SUN50I_H6_PLL_VIDEO0_REG, 1125 + SUN50I_H6_PLL_VIDEO1_REG, 1126 + SUN50I_H6_PLL_VE_REG, 1127 + SUN50I_H6_PLL_DE_REG, 1128 + SUN50I_H6_PLL_HSIC_REG, 1129 + SUN50I_H6_PLL_AUDIO_REG, 1130 + }; 1131 + 1132 + static const u32 pll_video_regs[] = { 1133 + SUN50I_H6_PLL_VIDEO0_REG, 1134 + SUN50I_H6_PLL_VIDEO1_REG, 1135 + }; 1136 + 1137 + static const u32 usb2_clk_regs[] = { 1138 + SUN50I_H6_USB0_CLK_REG, 1139 + SUN50I_H6_USB3_CLK_REG, 1140 + }; 1141 + 1142 + static int sun50i_h6_ccu_probe(struct platform_device *pdev) 1143 + { 1144 + struct resource *res; 1145 + void __iomem *reg; 1146 + u32 val; 1147 + int i; 1148 + 1149 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1150 + reg = devm_ioremap_resource(&pdev->dev, res); 1151 + if (IS_ERR(reg)) 1152 + return PTR_ERR(reg); 1153 + 1154 + /* Enable the lock bits on all PLLs */ 1155 + for (i = 0; i < ARRAY_SIZE(pll_regs); i++) { 1156 + val = readl(reg + pll_regs[i]); 1157 + val |= BIT(29); 1158 + writel(val, reg + pll_regs[i]); 1159 + } 1160 + 1161 + /* 1162 + * Force the output divider of video PLLs to 0. 1163 + * 1164 + * See the comment before pll-video0 definition for the reason. 1165 + */ 1166 + for (i = 0; i < ARRAY_SIZE(pll_video_regs); i++) { 1167 + val = readl(reg + pll_video_regs[i]); 1168 + val &= ~BIT(0); 1169 + writel(val, reg + pll_video_regs[i]); 1170 + } 1171 + 1172 + /* 1173 + * Force OHCI 12M clock sources to 00 (12MHz divided from 48MHz) 1174 + * 1175 + * This clock mux is still mysterious, and the code just enforces 1176 + * it to have a valid clock parent. 1177 + */ 1178 + for (i = 0; i < ARRAY_SIZE(usb2_clk_regs); i++) { 1179 + val = readl(reg + usb2_clk_regs[i]); 1180 + val &= ~GENMASK(25, 24); 1181 + writel (val, reg + usb2_clk_regs[i]); 1182 + } 1183 + 1184 + /* 1185 + * Force the post-divider of pll-audio to 8 and the output divider 1186 + * of it to 1, to make the clock name represents the real frequency. 1187 + */ 1188 + val = readl(reg + SUN50I_H6_PLL_AUDIO_REG); 1189 + val &= ~(GENMASK(21, 16) | BIT(0)); 1190 + writel(val | (7 << 16), reg + SUN50I_H6_PLL_AUDIO_REG); 1191 + 1192 + return sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_h6_ccu_desc); 1193 + } 1194 + 1195 + static const struct of_device_id sun50i_h6_ccu_ids[] = { 1196 + { .compatible = "allwinner,sun50i-h6-ccu" }, 1197 + { } 1198 + }; 1199 + 1200 + static struct platform_driver sun50i_h6_ccu_driver = { 1201 + .probe = sun50i_h6_ccu_probe, 1202 + .driver = { 1203 + .name = "sun50i-h6-ccu", 1204 + .of_match_table = sun50i_h6_ccu_ids, 1205 + }, 1206 + }; 1207 + builtin_platform_driver(sun50i_h6_ccu_driver);
+56
drivers/clk/sunxi-ng/ccu-sun50i-h6.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright 2016 Icenowy Zheng <icenowy@aosc.io> 4 + */ 5 + 6 + #ifndef _CCU_SUN50I_H6_H_ 7 + #define _CCU_SUN50I_H6_H_ 8 + 9 + #include <dt-bindings/clock/sun50i-h6-ccu.h> 10 + #include <dt-bindings/reset/sun50i-h6-ccu.h> 11 + 12 + #define CLK_OSC12M 0 13 + #define CLK_PLL_CPUX 1 14 + #define CLK_PLL_DDR0 2 15 + 16 + /* PLL_PERIPH0 exported for PRCM */ 17 + 18 + #define CLK_PLL_PERIPH0_2X 4 19 + #define CLK_PLL_PERIPH0_4X 5 20 + #define CLK_PLL_PERIPH1 6 21 + #define CLK_PLL_PERIPH1_2X 7 22 + #define CLK_PLL_PERIPH1_4X 8 23 + #define CLK_PLL_GPU 9 24 + #define CLK_PLL_VIDEO0 10 25 + #define CLK_PLL_VIDEO0_4X 11 26 + #define CLK_PLL_VIDEO1 12 27 + #define CLK_PLL_VIDEO1_4X 13 28 + #define CLK_PLL_VE 14 29 + #define CLK_PLL_DE 15 30 + #define CLK_PLL_HSIC 16 31 + #define CLK_PLL_AUDIO_BASE 17 32 + #define CLK_PLL_AUDIO 18 33 + #define CLK_PLL_AUDIO_2X 19 34 + #define CLK_PLL_AUDIO_4X 20 35 + 36 + /* CPUX clock exported for DVFS */ 37 + 38 + #define CLK_AXI 22 39 + #define CLK_CPUX_APB 23 40 + #define CLK_PSI_AHB1_AHB2 24 41 + #define CLK_AHB3 25 42 + 43 + /* APB1 clock exported for PIO */ 44 + 45 + #define CLK_APB2 27 46 + #define CLK_MBUS 28 47 + 48 + /* All module clocks and bus gates are exported except DRAM */ 49 + 50 + #define CLK_DRAM 52 51 + 52 + #define CLK_BUS_DRAM 60 53 + 54 + #define CLK_NUMBER 137 55 + 56 + #endif /* _CCU_SUN50I_H6_H_ */
+124
include/dt-bindings/clock/sun50i-h6-ccu.h
··· 1 + // SPDX-License-Identifier: (GPL-2.0+ or MIT) 2 + /* 3 + * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.io> 4 + */ 5 + 6 + #ifndef _DT_BINDINGS_CLK_SUN50I_H6_H_ 7 + #define _DT_BINDINGS_CLK_SUN50I_H6_H_ 8 + 9 + #define CLK_PLL_PERIPH0 3 10 + 11 + #define CLK_CPUX 21 12 + 13 + #define CLK_APB1 26 14 + 15 + #define CLK_DE 29 16 + #define CLK_BUS_DE 30 17 + #define CLK_DEINTERLACE 31 18 + #define CLK_BUS_DEINTERLACE 32 19 + #define CLK_GPU 33 20 + #define CLK_BUS_GPU 34 21 + #define CLK_CE 35 22 + #define CLK_BUS_CE 36 23 + #define CLK_VE 37 24 + #define CLK_BUS_VE 38 25 + #define CLK_EMCE 39 26 + #define CLK_BUS_EMCE 40 27 + #define CLK_VP9 41 28 + #define CLK_BUS_VP9 42 29 + #define CLK_BUS_DMA 43 30 + #define CLK_BUS_MSGBOX 44 31 + #define CLK_BUS_SPINLOCK 45 32 + #define CLK_BUS_HSTIMER 46 33 + #define CLK_AVS 47 34 + #define CLK_BUS_DBG 48 35 + #define CLK_BUS_PSI 49 36 + #define CLK_BUS_PWM 50 37 + #define CLK_BUS_IOMMU 51 38 + 39 + #define CLK_MBUS_DMA 53 40 + #define CLK_MBUS_VE 54 41 + #define CLK_MBUS_CE 55 42 + #define CLK_MBUS_TS 56 43 + #define CLK_MBUS_NAND 57 44 + #define CLK_MBUS_CSI 58 45 + #define CLK_MBUS_DEINTERLACE 59 46 + 47 + #define CLK_NAND0 61 48 + #define CLK_NAND1 62 49 + #define CLK_BUS_NAND 63 50 + #define CLK_MMC0 64 51 + #define CLK_MMC1 65 52 + #define CLK_MMC2 66 53 + #define CLK_BUS_MMC0 67 54 + #define CLK_BUS_MMC1 68 55 + #define CLK_BUS_MMC2 69 56 + #define CLK_BUS_UART0 70 57 + #define CLK_BUS_UART1 71 58 + #define CLK_BUS_UART2 72 59 + #define CLK_BUS_UART3 73 60 + #define CLK_BUS_I2C0 74 61 + #define CLK_BUS_I2C1 75 62 + #define CLK_BUS_I2C2 76 63 + #define CLK_BUS_I2C3 77 64 + #define CLK_BUS_SCR0 78 65 + #define CLK_BUS_SCR1 79 66 + #define CLK_SPI0 80 67 + #define CLK_SPI1 81 68 + #define CLK_BUS_SPI0 82 69 + #define CLK_BUS_SPI1 83 70 + #define CLK_BUS_EMAC 84 71 + #define CLK_TS 85 72 + #define CLK_BUS_TS 86 73 + #define CLK_IR_TX 87 74 + #define CLK_BUS_IR_TX 88 75 + #define CLK_BUS_THS 89 76 + #define CLK_I2S3 90 77 + #define CLK_I2S0 91 78 + #define CLK_I2S1 92 79 + #define CLK_I2S2 93 80 + #define CLK_BUS_I2S0 94 81 + #define CLK_BUS_I2S1 95 82 + #define CLK_BUS_I2S2 96 83 + #define CLK_BUS_I2S3 97 84 + #define CLK_SPDIF 98 85 + #define CLK_BUS_SPDIF 99 86 + #define CLK_DMIC 100 87 + #define CLK_BUS_DMIC 101 88 + #define CLK_AUDIO_HUB 102 89 + #define CLK_BUS_AUDIO_HUB 103 90 + #define CLK_USB_OHCI0 104 91 + #define CLK_USB_PHY0 105 92 + #define CLK_USB_PHY1 106 93 + #define CLK_USB_OHCI3 107 94 + #define CLK_USB_PHY3 108 95 + #define CLK_USB_HSIC_12M 109 96 + #define CLK_USB_HSIC 110 97 + #define CLK_BUS_OHCI0 111 98 + #define CLK_BUS_OHCI3 112 99 + #define CLK_BUS_EHCI0 113 100 + #define CLK_BUS_XHCI 114 101 + #define CLK_BUS_EHCI3 115 102 + #define CLK_BUS_OTG 116 103 + #define CLK_PCIE_REF_100M 117 104 + #define CLK_PCIE_REF 118 105 + #define CLK_PCIE_REF_OUT 119 106 + #define CLK_PCIE_MAXI 120 107 + #define CLK_PCIE_AUX 121 108 + #define CLK_BUS_PCIE 122 109 + #define CLK_HDMI 123 110 + #define CLK_HDMI_CEC 124 111 + #define CLK_BUS_HDMI 125 112 + #define CLK_BUS_TCON_TOP 126 113 + #define CLK_TCON_LCD0 127 114 + #define CLK_BUS_TCON_LCD0 128 115 + #define CLK_TCON_TV0 129 116 + #define CLK_BUS_TCON_TV0 130 117 + #define CLK_CSI_CCI 131 118 + #define CLK_CSI_TOP 132 119 + #define CLK_CSI_MCLK 133 120 + #define CLK_BUS_CSI 134 121 + #define CLK_HDCP 135 122 + #define CLK_BUS_HDCP 136 123 + 124 + #endif /* _DT_BINDINGS_CLK_SUN50I_H6_H_ */
+73
include/dt-bindings/reset/sun50i-h6-ccu.h
··· 1 + // SPDX-License-Identifier: (GPL-2.0+ or MIT) 2 + /* 3 + * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.io> 4 + */ 5 + 6 + #ifndef _DT_BINDINGS_RESET_SUN50I_H6_H_ 7 + #define _DT_BINDINGS_RESET_SUN50I_H6_H_ 8 + 9 + #define RST_MBUS 0 10 + #define RST_BUS_DE 1 11 + #define RST_BUS_DEINTERLACE 2 12 + #define RST_BUS_GPU 3 13 + #define RST_BUS_CE 4 14 + #define RST_BUS_VE 5 15 + #define RST_BUS_EMCE 6 16 + #define RST_BUS_VP9 7 17 + #define RST_BUS_DMA 8 18 + #define RST_BUS_MSGBOX 9 19 + #define RST_BUS_SPINLOCK 10 20 + #define RST_BUS_HSTIMER 11 21 + #define RST_BUS_DBG 12 22 + #define RST_BUS_PSI 13 23 + #define RST_BUS_PWM 14 24 + #define RST_BUS_IOMMU 15 25 + #define RST_BUS_DRAM 16 26 + #define RST_BUS_NAND 17 27 + #define RST_BUS_MMC0 18 28 + #define RST_BUS_MMC1 19 29 + #define RST_BUS_MMC2 20 30 + #define RST_BUS_UART0 21 31 + #define RST_BUS_UART1 22 32 + #define RST_BUS_UART2 23 33 + #define RST_BUS_UART3 24 34 + #define RST_BUS_I2C0 25 35 + #define RST_BUS_I2C1 26 36 + #define RST_BUS_I2C2 27 37 + #define RST_BUS_I2C3 28 38 + #define RST_BUS_SCR0 29 39 + #define RST_BUS_SCR1 30 40 + #define RST_BUS_SPI0 31 41 + #define RST_BUS_SPI1 32 42 + #define RST_BUS_EMAC 33 43 + #define RST_BUS_TS 34 44 + #define RST_BUS_IR_TX 35 45 + #define RST_BUS_THS 36 46 + #define RST_BUS_I2S0 37 47 + #define RST_BUS_I2S1 38 48 + #define RST_BUS_I2S2 39 49 + #define RST_BUS_I2S3 40 50 + #define RST_BUS_SPDIF 41 51 + #define RST_BUS_DMIC 42 52 + #define RST_BUS_AUDIO_HUB 43 53 + #define RST_USB_PHY0 44 54 + #define RST_USB_PHY1 45 55 + #define RST_USB_PHY3 46 56 + #define RST_USB_HSIC 47 57 + #define RST_BUS_OHCI0 48 58 + #define RST_BUS_OHCI3 49 59 + #define RST_BUS_EHCI0 50 60 + #define RST_BUS_XHCI 51 61 + #define RST_BUS_EHCI3 52 62 + #define RST_BUS_OTG 53 63 + #define RST_BUS_PCIE 54 64 + #define RST_PCIE_POWERUP 55 65 + #define RST_BUS_HDMI 56 66 + #define RST_BUS_HDMI_SUB 57 67 + #define RST_BUS_TCON_TOP 58 68 + #define RST_BUS_TCON_LCD0 59 69 + #define RST_BUS_TCON_TV0 60 70 + #define RST_BUS_CSI 61 71 + #define RST_BUS_HDCP 62 72 + 73 + #endif /* _DT_BINDINGS_RESET_SUN50I_H6_H_ */