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

Merge branch 'clk-rk3368' into clk-next

* clk-rk3368:
clk: rockchip: add rk3368 clock controller
clk: rockchip: add missing include guards
clk: rockchip: add dt-binding header for rk3368
dt-bindings: add documentation of rk3668 clock controller
clk: rockchip: define the inverters of rk3066/rk3188 and rk3288
clk: rockchip: fix issues in the mmc-phase clock
clk: rockchip: add support for phase inverters
clk: rockchip: add COMPOSITE_NOGATE_DIVTBL variant
clk: rockchip: protect register macros against multipart values
clk: rockchip: fix faulty vip parent name on rk3288
clk: rockchip: rk3288: add CLK_SET_RATE_PARENT to sclk_mac

+1555 -16
+61
Documentation/devicetree/bindings/clock/rockchip,rk3368-cru.txt
··· 1 + * Rockchip RK3368 Clock and Reset Unit 2 + 3 + The RK3368 clock controller generates and supplies clock to various 4 + controllers within the SoC and also implements a reset controller for SoC 5 + peripherals. 6 + 7 + Required Properties: 8 + 9 + - compatible: should be "rockchip,rk3368-cru" 10 + - reg: physical base address of the controller and length of memory mapped 11 + region. 12 + - #clock-cells: should be 1. 13 + - #reset-cells: should be 1. 14 + 15 + Optional Properties: 16 + 17 + - rockchip,grf: phandle to the syscon managing the "general register files" 18 + If missing, pll rates are not changeable, due to the missing pll lock status. 19 + 20 + Each clock is assigned an identifier and client nodes can use this identifier 21 + to specify the clock which they consume. All available clocks are defined as 22 + preprocessor macros in the dt-bindings/clock/rk3368-cru.h headers and can be 23 + used in device tree sources. Similar macros exist for the reset sources in 24 + these files. 25 + 26 + External clocks: 27 + 28 + There are several clocks that are generated outside the SoC. It is expected 29 + that they are defined using standard clock bindings with following 30 + clock-output-names: 31 + - "xin24m" - crystal input - required, 32 + - "xin32k" - rtc clock - optional, 33 + - "ext_i2s" - external I2S clock - optional, 34 + - "ext_gmac" - external GMAC clock - optional 35 + - "ext_hsadc" - external HSADC clock - optional, 36 + - "ext_isp" - external ISP clock - optional, 37 + - "ext_jtag" - external JTAG clock - optional 38 + - "ext_vip" - external VIP clock - optional, 39 + - "usbotg_out" - output clock of the pll in the otg phy 40 + 41 + Example: Clock controller node: 42 + 43 + cru: clock-controller@ff760000 { 44 + compatible = "rockchip,rk3368-cru"; 45 + reg = <0x0 0xff760000 0x0 0x1000>; 46 + rockchip,grf = <&grf>; 47 + #clock-cells = <1>; 48 + #reset-cells = <1>; 49 + }; 50 + 51 + Example: UART controller node that consumes the clock generated by the clock 52 + controller: 53 + 54 + uart0: serial@10124000 { 55 + compatible = "snps,dw-apb-uart"; 56 + reg = <0x10124000 0x400>; 57 + interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>; 58 + reg-shift = <2>; 59 + reg-io-width = <1>; 60 + clocks = <&cru SCLK_UART0>; 61 + };
+2
drivers/clk/rockchip/Makefile
··· 6 6 obj-y += clk.o 7 7 obj-y += clk-pll.o 8 8 obj-y += clk-cpu.o 9 + obj-y += clk-inverter.o 9 10 obj-y += clk-mmc-phase.o 10 11 obj-$(CONFIG_RESET_CONTROLLER) += softrst.o 11 12 12 13 obj-y += clk-rk3188.o 13 14 obj-y += clk-rk3288.o 15 + obj-y += clk-rk3368.o
+116
drivers/clk/rockchip/clk-inverter.c
··· 1 + /* 2 + * Copyright 2015 Heiko Stuebner <heiko@sntech.de> 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + * This program is distributed in the hope that it will be useful, 10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 + * GNU General Public License for more details. 13 + */ 14 + 15 + #include <linux/slab.h> 16 + #include <linux/clk-provider.h> 17 + #include <linux/io.h> 18 + #include <linux/spinlock.h> 19 + #include <linux/kernel.h> 20 + #include "clk.h" 21 + 22 + struct rockchip_inv_clock { 23 + struct clk_hw hw; 24 + void __iomem *reg; 25 + int shift; 26 + int flags; 27 + spinlock_t *lock; 28 + }; 29 + 30 + #define to_inv_clock(_hw) container_of(_hw, struct rockchip_inv_clock, hw) 31 + 32 + #define INVERTER_MASK 0x1 33 + 34 + static int rockchip_inv_get_phase(struct clk_hw *hw) 35 + { 36 + struct rockchip_inv_clock *inv_clock = to_inv_clock(hw); 37 + u32 val; 38 + 39 + val = readl(inv_clock->reg) >> inv_clock->shift; 40 + val &= INVERTER_MASK; 41 + return val ? 180 : 0; 42 + } 43 + 44 + static int rockchip_inv_set_phase(struct clk_hw *hw, int degrees) 45 + { 46 + struct rockchip_inv_clock *inv_clock = to_inv_clock(hw); 47 + u32 val; 48 + 49 + if (degrees % 180 == 0) { 50 + val = !!degrees; 51 + } else { 52 + pr_err("%s: unsupported phase %d for %s\n", 53 + __func__, degrees, __clk_get_name(hw->clk)); 54 + return -EINVAL; 55 + } 56 + 57 + if (inv_clock->flags & ROCKCHIP_INVERTER_HIWORD_MASK) { 58 + writel(HIWORD_UPDATE(val, INVERTER_MASK, inv_clock->shift), 59 + inv_clock->reg); 60 + } else { 61 + unsigned long flags; 62 + u32 reg; 63 + 64 + spin_lock_irqsave(inv_clock->lock, flags); 65 + 66 + reg = readl(inv_clock->reg); 67 + reg &= ~BIT(inv_clock->shift); 68 + reg |= val; 69 + writel(reg, inv_clock->reg); 70 + 71 + spin_unlock_irqrestore(inv_clock->lock, flags); 72 + } 73 + 74 + return 0; 75 + } 76 + 77 + static const struct clk_ops rockchip_inv_clk_ops = { 78 + .get_phase = rockchip_inv_get_phase, 79 + .set_phase = rockchip_inv_set_phase, 80 + }; 81 + 82 + struct clk *rockchip_clk_register_inverter(const char *name, 83 + const char *const *parent_names, u8 num_parents, 84 + void __iomem *reg, int shift, int flags, 85 + spinlock_t *lock) 86 + { 87 + struct clk_init_data init; 88 + struct rockchip_inv_clock *inv_clock; 89 + struct clk *clk; 90 + 91 + inv_clock = kmalloc(sizeof(*inv_clock), GFP_KERNEL); 92 + if (!inv_clock) 93 + return NULL; 94 + 95 + init.name = name; 96 + init.num_parents = num_parents; 97 + init.flags = CLK_SET_RATE_PARENT; 98 + init.parent_names = parent_names; 99 + init.ops = &rockchip_inv_clk_ops; 100 + 101 + inv_clock->hw.init = &init; 102 + inv_clock->reg = reg; 103 + inv_clock->shift = shift; 104 + inv_clock->flags = flags; 105 + inv_clock->lock = lock; 106 + 107 + clk = clk_register(NULL, &inv_clock->hw); 108 + if (IS_ERR(clk)) 109 + goto err_free; 110 + 111 + return clk; 112 + 113 + err_free: 114 + kfree(inv_clock); 115 + return NULL; 116 + }
+3 -3
drivers/clk/rockchip/clk-mmc-phase.c
··· 15 15 16 16 #include <linux/slab.h> 17 17 #include <linux/clk-provider.h> 18 + #include <linux/io.h> 19 + #include <linux/kernel.h> 18 20 #include "clk.h" 19 21 20 22 struct rockchip_mmc_clock { ··· 133 131 if (!mmc_clock) 134 132 return NULL; 135 133 134 + init.name = name; 136 135 init.num_parents = num_parents; 137 136 init.parent_names = parent_names; 138 137 init.ops = &rockchip_mmc_clk_ops; ··· 141 138 mmc_clock->hw.init = &init; 142 139 mmc_clock->reg = reg; 143 140 mmc_clock->shift = shift; 144 - 145 - if (name) 146 - init.name = name; 147 141 148 142 clk = clk_register(NULL, &mmc_clock->hw); 149 143 if (IS_ERR(clk))
+8 -1
drivers/clk/rockchip/clk-rk3188.c
··· 235 235 #define MFLAGS CLK_MUX_HIWORD_MASK 236 236 #define DFLAGS CLK_DIVIDER_HIWORD_MASK 237 237 #define GFLAGS (CLK_GATE_HIWORD_MASK | CLK_GATE_SET_TO_DISABLE) 238 + #define IFLAGS ROCKCHIP_INVERTER_HIWORD_MASK 238 239 239 240 /* 2 ^ (val + 1) */ 240 241 static struct clk_div_table div_core_peri_t[] = { ··· 311 310 312 311 GATE(0, "pclkin_cif0", "ext_cif0", 0, 313 312 RK2928_CLKGATE_CON(3), 3, GFLAGS), 313 + INVERTER(0, "pclk_cif0", "pclkin_cif0", 314 + RK2928_CLKSEL_CON(30), 8, IFLAGS), 314 315 315 316 /* 316 317 * the 480m are generated inside the usb block from these clocks, ··· 337 334 COMPOSITE_FRAC(0, "hsadc_frac", "hsadc_src", 0, 338 335 RK2928_CLKSEL_CON(23), 0, 339 336 RK2928_CLKGATE_CON(2), 7, GFLAGS), 340 - MUX(SCLK_HSADC, "sclk_hsadc", mux_sclk_hsadc_p, 0, 337 + MUX(0, "sclk_hsadc_out", mux_sclk_hsadc_p, 0, 341 338 RK2928_CLKSEL_CON(22), 4, 2, MFLAGS), 339 + INVERTER(SCLK_HSADC, "sclk_hsadc", "sclk_hsadc_out", 340 + RK2928_CLKSEL_CON(22), 7, IFLAGS), 342 341 343 342 COMPOSITE_NOMUX(SCLK_SARADC, "sclk_saradc", "xin24m", 0, 344 343 RK2928_CLKSEL_CON(24), 8, 8, DFLAGS, ··· 562 557 563 558 GATE(0, "pclkin_cif1", "ext_cif1", 0, 564 559 RK2928_CLKGATE_CON(3), 4, GFLAGS), 560 + INVERTER(0, "pclk_cif1", "pclkin_cif1", 561 + RK2928_CLKSEL_CON(30), 12, IFLAGS), 565 562 566 563 COMPOSITE(0, "aclk_gpu_src", mux_pll_src_cpll_gpll_p, 0, 567 564 RK2928_CLKSEL_CON(33), 8, 1, MFLAGS, 0, 5, DFLAGS,
+9 -4
drivers/clk/rockchip/clk-rk3288.c
··· 189 189 PNAME(mux_uart2_p) = { "uart2_src", "uart2_frac", "xin24m" }; 190 190 PNAME(mux_uart3_p) = { "uart3_src", "uart3_frac", "xin24m" }; 191 191 PNAME(mux_uart4_p) = { "uart4_src", "uart4_frac", "xin24m" }; 192 - PNAME(mux_cif_out_p) = { "cif_src", "xin24m" }; 192 + PNAME(mux_vip_out_p) = { "vip_src", "xin24m" }; 193 193 PNAME(mux_mac_p) = { "mac_pll_src", "ext_gmac" }; 194 194 PNAME(mux_hsadcout_p) = { "hsadc_src", "ext_hsadc" }; 195 195 PNAME(mux_edp_24m_p) = { "ext_edp_24m", "xin24m" }; ··· 223 223 #define MFLAGS CLK_MUX_HIWORD_MASK 224 224 #define DFLAGS CLK_DIVIDER_HIWORD_MASK 225 225 #define GFLAGS (CLK_GATE_HIWORD_MASK | CLK_GATE_SET_TO_DISABLE) 226 + #define IFLAGS ROCKCHIP_INVERTER_HIWORD_MASK 226 227 227 228 static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { 228 229 /* ··· 435 434 COMPOSITE_NODIV(0, "vip_src", mux_pll_src_cpll_gpll_p, 0, 436 435 RK3288_CLKSEL_CON(26), 8, 1, MFLAGS, 437 436 RK3288_CLKGATE_CON(3), 7, GFLAGS), 438 - COMPOSITE_NOGATE(0, "sclk_vip_out", mux_cif_out_p, 0, 437 + COMPOSITE_NOGATE(0, "sclk_vip_out", mux_vip_out_p, 0, 439 438 RK3288_CLKSEL_CON(26), 15, 1, MFLAGS, 9, 5, DFLAGS), 440 439 441 440 DIV(0, "pclk_pd_alive", "gpll", 0, ··· 579 578 COMPOSITE(0, "mac_pll_src", mux_pll_src_npll_cpll_gpll_p, 0, 580 579 RK3288_CLKSEL_CON(21), 0, 2, MFLAGS, 8, 5, DFLAGS, 581 580 RK3288_CLKGATE_CON(2), 5, GFLAGS), 582 - MUX(SCLK_MAC, "mac_clk", mux_mac_p, 0, 581 + MUX(SCLK_MAC, "mac_clk", mux_mac_p, CLK_SET_RATE_PARENT, 583 582 RK3288_CLKSEL_CON(21), 4, 1, MFLAGS), 584 583 GATE(SCLK_MACREF_OUT, "sclk_macref_out", "mac_clk", 0, 585 584 RK3288_CLKGATE_CON(5), 3, GFLAGS), ··· 593 592 COMPOSITE(0, "hsadc_src", mux_pll_src_cpll_gpll_p, 0, 594 593 RK3288_CLKSEL_CON(22), 0, 1, MFLAGS, 8, 8, DFLAGS, 595 594 RK3288_CLKGATE_CON(2), 6, GFLAGS), 596 - MUX(SCLK_HSADC, "sclk_hsadc_out", mux_hsadcout_p, 0, 595 + MUX(0, "sclk_hsadc_out", mux_hsadcout_p, 0, 597 596 RK3288_CLKSEL_CON(22), 4, 1, MFLAGS), 597 + INVERTER(SCLK_HSADC, "sclk_hsadc", "sclk_hsadc_out", 598 + RK3288_CLKSEL_CON(22), 7, IFLAGS), 598 599 599 600 GATE(0, "jtag", "ext_jtag", 0, 600 601 RK3288_CLKGATE_CON(4), 14, GFLAGS), ··· 771 768 */ 772 769 773 770 GATE(0, "pclk_vip_in", "ext_vip", 0, RK3288_CLKGATE_CON(16), 0, GFLAGS), 771 + INVERTER(0, "pclk_vip", "pclk_vip_in", RK3288_CLKSEL_CON(29), 4, IFLAGS), 774 772 GATE(0, "pclk_isp_in", "ext_isp", 0, RK3288_CLKGATE_CON(16), 3, GFLAGS), 773 + INVERTER(0, "pclk_isp", "pclk_isp_in", RK3288_CLKSEL_CON(29), 3, IFLAGS), 775 774 }; 776 775 777 776 static const char *const rk3288_critical_clocks[] __initconst = {
+881
drivers/clk/rockchip/clk-rk3368.c
··· 1 + /* 2 + * Copyright (c) 2015 Heiko Stuebner <heiko@sntech.de> 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + * This program is distributed in the hope that it will be useful, 10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 + * GNU General Public License for more details. 13 + */ 14 + 15 + #include <linux/clk-provider.h> 16 + #include <linux/of.h> 17 + #include <linux/of_address.h> 18 + #include <linux/platform_device.h> 19 + #include <dt-bindings/clock/rk3368-cru.h> 20 + #include "clk.h" 21 + 22 + #define RK3368_GRF_SOC_STATUS0 0x480 23 + 24 + enum rk3368_plls { 25 + apllb, aplll, dpll, cpll, gpll, npll, 26 + }; 27 + 28 + static struct rockchip_pll_rate_table rk3368_pll_rates[] = { 29 + RK3066_PLL_RATE(2208000000, 1, 92, 1), 30 + RK3066_PLL_RATE(2184000000, 1, 91, 1), 31 + RK3066_PLL_RATE(2160000000, 1, 90, 1), 32 + RK3066_PLL_RATE(2136000000, 1, 89, 1), 33 + RK3066_PLL_RATE(2112000000, 1, 88, 1), 34 + RK3066_PLL_RATE(2088000000, 1, 87, 1), 35 + RK3066_PLL_RATE(2064000000, 1, 86, 1), 36 + RK3066_PLL_RATE(2040000000, 1, 85, 1), 37 + RK3066_PLL_RATE(2016000000, 1, 84, 1), 38 + RK3066_PLL_RATE(1992000000, 1, 83, 1), 39 + RK3066_PLL_RATE(1968000000, 1, 82, 1), 40 + RK3066_PLL_RATE(1944000000, 1, 81, 1), 41 + RK3066_PLL_RATE(1920000000, 1, 80, 1), 42 + RK3066_PLL_RATE(1896000000, 1, 79, 1), 43 + RK3066_PLL_RATE(1872000000, 1, 78, 1), 44 + RK3066_PLL_RATE(1848000000, 1, 77, 1), 45 + RK3066_PLL_RATE(1824000000, 1, 76, 1), 46 + RK3066_PLL_RATE(1800000000, 1, 75, 1), 47 + RK3066_PLL_RATE(1776000000, 1, 74, 1), 48 + RK3066_PLL_RATE(1752000000, 1, 73, 1), 49 + RK3066_PLL_RATE(1728000000, 1, 72, 1), 50 + RK3066_PLL_RATE(1704000000, 1, 71, 1), 51 + RK3066_PLL_RATE(1680000000, 1, 70, 1), 52 + RK3066_PLL_RATE(1656000000, 1, 69, 1), 53 + RK3066_PLL_RATE(1632000000, 1, 68, 1), 54 + RK3066_PLL_RATE(1608000000, 1, 67, 1), 55 + RK3066_PLL_RATE(1560000000, 1, 65, 1), 56 + RK3066_PLL_RATE(1512000000, 1, 63, 1), 57 + RK3066_PLL_RATE(1488000000, 1, 62, 1), 58 + RK3066_PLL_RATE(1464000000, 1, 61, 1), 59 + RK3066_PLL_RATE(1440000000, 1, 60, 1), 60 + RK3066_PLL_RATE(1416000000, 1, 59, 1), 61 + RK3066_PLL_RATE(1392000000, 1, 58, 1), 62 + RK3066_PLL_RATE(1368000000, 1, 57, 1), 63 + RK3066_PLL_RATE(1344000000, 1, 56, 1), 64 + RK3066_PLL_RATE(1320000000, 1, 55, 1), 65 + RK3066_PLL_RATE(1296000000, 1, 54, 1), 66 + RK3066_PLL_RATE(1272000000, 1, 53, 1), 67 + RK3066_PLL_RATE(1248000000, 1, 52, 1), 68 + RK3066_PLL_RATE(1224000000, 1, 51, 1), 69 + RK3066_PLL_RATE(1200000000, 1, 50, 1), 70 + RK3066_PLL_RATE(1176000000, 1, 49, 1), 71 + RK3066_PLL_RATE(1128000000, 1, 47, 1), 72 + RK3066_PLL_RATE(1104000000, 1, 46, 1), 73 + RK3066_PLL_RATE(1008000000, 1, 84, 2), 74 + RK3066_PLL_RATE( 912000000, 1, 76, 2), 75 + RK3066_PLL_RATE( 888000000, 1, 74, 2), 76 + RK3066_PLL_RATE( 816000000, 1, 68, 2), 77 + RK3066_PLL_RATE( 792000000, 1, 66, 2), 78 + RK3066_PLL_RATE( 696000000, 1, 58, 2), 79 + RK3066_PLL_RATE( 672000000, 1, 56, 2), 80 + RK3066_PLL_RATE( 648000000, 1, 54, 2), 81 + RK3066_PLL_RATE( 624000000, 1, 52, 2), 82 + RK3066_PLL_RATE( 600000000, 1, 50, 2), 83 + RK3066_PLL_RATE( 576000000, 1, 48, 2), 84 + RK3066_PLL_RATE( 552000000, 1, 46, 2), 85 + RK3066_PLL_RATE( 528000000, 1, 88, 4), 86 + RK3066_PLL_RATE( 504000000, 1, 84, 4), 87 + RK3066_PLL_RATE( 480000000, 1, 80, 4), 88 + RK3066_PLL_RATE( 456000000, 1, 76, 4), 89 + RK3066_PLL_RATE( 408000000, 1, 68, 4), 90 + RK3066_PLL_RATE( 312000000, 1, 52, 4), 91 + RK3066_PLL_RATE( 252000000, 1, 84, 8), 92 + RK3066_PLL_RATE( 216000000, 1, 72, 8), 93 + RK3066_PLL_RATE( 126000000, 2, 84, 8), 94 + RK3066_PLL_RATE( 48000000, 2, 32, 8), 95 + { /* sentinel */ }, 96 + }; 97 + 98 + PNAME(mux_pll_p) = { "xin24m", "xin32k" }; 99 + PNAME(mux_armclkb_p) = { "apllb_core", "gpllb_core" }; 100 + PNAME(mux_armclkl_p) = { "aplll_core", "gplll_core" }; 101 + PNAME(mux_ddrphy_p) = { "dpll_ddr", "gpll_ddr" }; 102 + PNAME(mux_cs_src_p) = { "apllb_cs", "aplll_cs", "gpll_cs"}; 103 + PNAME(mux_aclk_bus_src_p) = { "cpll_aclk_bus", "gpll_aclk_bus" }; 104 + 105 + PNAME(mux_pll_src_cpll_gpll_p) = { "cpll", "gpll" }; 106 + PNAME(mux_pll_src_cpll_gpll_npll_p) = { "cpll", "gpll", "npll" }; 107 + PNAME(mux_pll_src_npll_cpll_gpll_p) = { "npll", "cpll", "gpll" }; 108 + PNAME(mux_pll_src_cpll_gpll_usb_p) = { "cpll", "gpll", "usbphy_480m" }; 109 + PNAME(mux_pll_src_cpll_gpll_usb_usb_p) = { "cpll", "gpll", "usbphy_480m", 110 + "usbphy_480m" }; 111 + PNAME(mux_pll_src_cpll_gpll_usb_npll_p) = { "cpll", "gpll", "usbphy_480m", 112 + "npll" }; 113 + PNAME(mux_pll_src_cpll_gpll_npll_npll_p) = { "cpll", "gpll", "npll", "npll" }; 114 + PNAME(mux_pll_src_cpll_gpll_npll_usb_p) = { "cpll", "gpll", "npll", 115 + "usbphy_480m" }; 116 + 117 + PNAME(mux_i2s_8ch_pre_p) = { "i2s_8ch_src", "i2s_8ch_frac", 118 + "ext_i2s", "xin12m" }; 119 + PNAME(mux_i2s_8ch_clkout_p) = { "i2s_8ch_pre", "xin12m" }; 120 + PNAME(mux_i2s_2ch_p) = { "i2s_2ch_src", "i2s_2ch_frac", 121 + "dummy", "xin12m" }; 122 + PNAME(mux_spdif_8ch_p) = { "spdif_8ch_pre", "spdif_8ch_frac", 123 + "ext_i2s", "xin12m" }; 124 + PNAME(mux_edp_24m_p) = { "dummy", "xin24m" }; 125 + PNAME(mux_vip_out_p) = { "vip_src", "xin24m" }; 126 + PNAME(mux_usbphy480m_p) = { "usbotg_out", "xin24m" }; 127 + PNAME(mux_hsic_usbphy480m_p) = { "usbotg_out", "dummy" }; 128 + PNAME(mux_hsicphy480m_p) = { "cpll", "gpll", "usbphy_480m" }; 129 + PNAME(mux_uart0_p) = { "uart0_src", "uart0_frac", "xin24m" }; 130 + PNAME(mux_uart1_p) = { "uart1_src", "uart1_frac", "xin24m" }; 131 + PNAME(mux_uart2_p) = { "uart2_src", "xin24m" }; 132 + PNAME(mux_uart3_p) = { "uart3_src", "uart3_frac", "xin24m" }; 133 + PNAME(mux_uart4_p) = { "uart4_src", "uart4_frac", "xin24m" }; 134 + PNAME(mux_mac_p) = { "mac_pll_src", "ext_gmac" }; 135 + PNAME(mux_mmc_src_p) = { "cpll", "gpll", "usbphy_480m", "xin24m" }; 136 + 137 + static struct rockchip_pll_clock rk3368_pll_clks[] __initdata = { 138 + [apllb] = PLL(pll_rk3066, PLL_APLLB, "apllb", mux_pll_p, 0, RK3368_PLL_CON(0), 139 + RK3368_PLL_CON(3), 8, 1, 0, rk3368_pll_rates), 140 + [aplll] = PLL(pll_rk3066, PLL_APLLL, "aplll", mux_pll_p, 0, RK3368_PLL_CON(4), 141 + RK3368_PLL_CON(7), 8, 0, 0, rk3368_pll_rates), 142 + [dpll] = PLL(pll_rk3066, PLL_DPLL, "dpll", mux_pll_p, 0, RK3368_PLL_CON(8), 143 + RK3368_PLL_CON(11), 8, 2, 0, NULL), 144 + [cpll] = PLL(pll_rk3066, PLL_CPLL, "cpll", mux_pll_p, 0, RK3368_PLL_CON(12), 145 + RK3368_PLL_CON(15), 8, 3, ROCKCHIP_PLL_SYNC_RATE, rk3368_pll_rates), 146 + [gpll] = PLL(pll_rk3066, PLL_GPLL, "gpll", mux_pll_p, 0, RK3368_PLL_CON(16), 147 + RK3368_PLL_CON(19), 8, 4, ROCKCHIP_PLL_SYNC_RATE, rk3368_pll_rates), 148 + [npll] = PLL(pll_rk3066, PLL_NPLL, "npll", mux_pll_p, 0, RK3368_PLL_CON(20), 149 + RK3368_PLL_CON(23), 8, 5, ROCKCHIP_PLL_SYNC_RATE, rk3368_pll_rates), 150 + }; 151 + 152 + static struct clk_div_table div_ddrphy_t[] = { 153 + { .val = 0, .div = 1 }, 154 + { .val = 1, .div = 2 }, 155 + { .val = 3, .div = 4 }, 156 + { /* sentinel */ }, 157 + }; 158 + 159 + #define MFLAGS CLK_MUX_HIWORD_MASK 160 + #define DFLAGS CLK_DIVIDER_HIWORD_MASK 161 + #define GFLAGS (CLK_GATE_HIWORD_MASK | CLK_GATE_SET_TO_DISABLE) 162 + #define IFLAGS ROCKCHIP_INVERTER_HIWORD_MASK 163 + 164 + static const struct rockchip_cpuclk_reg_data rk3368_cpuclkb_data = { 165 + .core_reg = RK3368_CLKSEL_CON(0), 166 + .div_core_shift = 0, 167 + .div_core_mask = 0x1f, 168 + .mux_core_shift = 15, 169 + }; 170 + 171 + static const struct rockchip_cpuclk_reg_data rk3368_cpuclkl_data = { 172 + .core_reg = RK3368_CLKSEL_CON(2), 173 + .div_core_shift = 0, 174 + .div_core_mask = 0x1f, 175 + .mux_core_shift = 7, 176 + }; 177 + 178 + #define RK3368_DIV_ACLKM_MASK 0x1f 179 + #define RK3368_DIV_ACLKM_SHIFT 8 180 + #define RK3368_DIV_ATCLK_MASK 0x1f 181 + #define RK3368_DIV_ATCLK_SHIFT 0 182 + #define RK3368_DIV_PCLK_DBG_MASK 0x1f 183 + #define RK3368_DIV_PCLK_DBG_SHIFT 8 184 + 185 + #define RK3368_CLKSEL0(_offs, _aclkm) \ 186 + { \ 187 + .reg = RK3288_CLKSEL_CON(0 + _offs), \ 188 + .val = HIWORD_UPDATE(_aclkm, RK3368_DIV_ACLKM_MASK, \ 189 + RK3368_DIV_ACLKM_SHIFT), \ 190 + } 191 + #define RK3368_CLKSEL1(_offs, _atclk, _pdbg) \ 192 + { \ 193 + .reg = RK3288_CLKSEL_CON(1 + _offs), \ 194 + .val = HIWORD_UPDATE(_atclk, RK3368_DIV_ATCLK_MASK, \ 195 + RK3368_DIV_ATCLK_SHIFT) | \ 196 + HIWORD_UPDATE(_pdbg, RK3368_DIV_PCLK_DBG_MASK, \ 197 + RK3368_DIV_PCLK_DBG_SHIFT), \ 198 + } 199 + 200 + /* cluster_b: aclkm in clksel0, rest in clksel1 */ 201 + #define RK3368_CPUCLKB_RATE(_prate, _aclkm, _atclk, _pdbg) \ 202 + { \ 203 + .prate = _prate, \ 204 + .divs = { \ 205 + RK3368_CLKSEL0(0, _aclkm), \ 206 + RK3368_CLKSEL1(0, _atclk, _pdbg), \ 207 + }, \ 208 + } 209 + 210 + /* cluster_l: aclkm in clksel2, rest in clksel3 */ 211 + #define RK3368_CPUCLKL_RATE(_prate, _aclkm, _atclk, _pdbg) \ 212 + { \ 213 + .prate = _prate, \ 214 + .divs = { \ 215 + RK3368_CLKSEL0(2, _aclkm), \ 216 + RK3368_CLKSEL1(2, _atclk, _pdbg), \ 217 + }, \ 218 + } 219 + 220 + static struct rockchip_cpuclk_rate_table rk3368_cpuclkb_rates[] __initdata = { 221 + RK3368_CPUCLKB_RATE(1512000000, 2, 6, 6), 222 + RK3368_CPUCLKB_RATE(1488000000, 2, 5, 5), 223 + RK3368_CPUCLKB_RATE(1416000000, 2, 5, 5), 224 + RK3368_CPUCLKB_RATE(1200000000, 2, 4, 4), 225 + RK3368_CPUCLKB_RATE(1008000000, 2, 4, 4), 226 + RK3368_CPUCLKB_RATE( 816000000, 2, 3, 3), 227 + RK3368_CPUCLKB_RATE( 696000000, 2, 3, 3), 228 + RK3368_CPUCLKB_RATE( 600000000, 2, 2, 2), 229 + RK3368_CPUCLKB_RATE( 408000000, 2, 2, 2), 230 + RK3368_CPUCLKB_RATE( 312000000, 2, 2, 2), 231 + }; 232 + 233 + static struct rockchip_cpuclk_rate_table rk3368_cpuclkl_rates[] __initdata = { 234 + RK3368_CPUCLKL_RATE(1512000000, 2, 7, 7), 235 + RK3368_CPUCLKL_RATE(1488000000, 2, 6, 6), 236 + RK3368_CPUCLKL_RATE(1416000000, 2, 6, 6), 237 + RK3368_CPUCLKL_RATE(1200000000, 2, 5, 5), 238 + RK3368_CPUCLKL_RATE(1008000000, 2, 5, 5), 239 + RK3368_CPUCLKL_RATE( 816000000, 2, 4, 4), 240 + RK3368_CPUCLKL_RATE( 696000000, 2, 3, 3), 241 + RK3368_CPUCLKL_RATE( 600000000, 2, 3, 3), 242 + RK3368_CPUCLKL_RATE( 408000000, 2, 2, 2), 243 + RK3368_CPUCLKL_RATE( 312000000, 2, 2, 2), 244 + }; 245 + 246 + static struct rockchip_clk_branch rk3368_clk_branches[] __initdata = { 247 + /* 248 + * Clock-Architecture Diagram 2 249 + */ 250 + 251 + MUX(SCLK_USBPHY480M, "usbphy_480m", mux_usbphy480m_p, CLK_SET_RATE_PARENT, 252 + RK3368_CLKSEL_CON(13), 8, 1, MFLAGS), 253 + 254 + GATE(0, "apllb_core", "apllb", CLK_IGNORE_UNUSED, 255 + RK3368_CLKGATE_CON(0), 0, GFLAGS), 256 + GATE(0, "gpllb_core", "gpll", CLK_IGNORE_UNUSED, 257 + RK3368_CLKGATE_CON(0), 1, GFLAGS), 258 + 259 + GATE(0, "aplll_core", "aplll", CLK_IGNORE_UNUSED, 260 + RK3368_CLKGATE_CON(0), 4, GFLAGS), 261 + GATE(0, "gplll_core", "gpll", CLK_IGNORE_UNUSED, 262 + RK3368_CLKGATE_CON(0), 5, GFLAGS), 263 + 264 + DIV(0, "aclkm_core_b", "armclkb", 0, 265 + RK3368_CLKSEL_CON(0), 8, 5, DFLAGS | CLK_DIVIDER_READ_ONLY), 266 + DIV(0, "atclk_core_b", "armclkb", 0, 267 + RK3368_CLKSEL_CON(1), 0, 5, DFLAGS | CLK_DIVIDER_READ_ONLY), 268 + DIV(0, "pclk_dbg_b", "armclkb", 0, 269 + RK3368_CLKSEL_CON(1), 8, 5, DFLAGS | CLK_DIVIDER_READ_ONLY), 270 + 271 + DIV(0, "aclkm_core_l", "armclkl", 0, 272 + RK3368_CLKSEL_CON(2), 8, 5, DFLAGS | CLK_DIVIDER_READ_ONLY), 273 + DIV(0, "atclk_core_l", "armclkl", 0, 274 + RK3368_CLKSEL_CON(3), 0, 5, DFLAGS | CLK_DIVIDER_READ_ONLY), 275 + DIV(0, "pclk_dbg_l", "armclkl", 0, 276 + RK3368_CLKSEL_CON(3), 8, 5, DFLAGS | CLK_DIVIDER_READ_ONLY), 277 + 278 + GATE(0, "apllb_cs", "apllb", CLK_IGNORE_UNUSED, 279 + RK3368_CLKGATE_CON(0), 9, GFLAGS), 280 + GATE(0, "aplll_cs", "aplll", CLK_IGNORE_UNUSED, 281 + RK3368_CLKGATE_CON(0), 10, GFLAGS), 282 + GATE(0, "gpll_cs", "gpll", CLK_IGNORE_UNUSED, 283 + RK3368_CLKGATE_CON(0), 8, GFLAGS), 284 + COMPOSITE_NOGATE(0, "sclk_cs_pre", mux_cs_src_p, CLK_IGNORE_UNUSED, 285 + RK3368_CLKSEL_CON(4), 6, 2, MFLAGS, 0, 5, DFLAGS), 286 + COMPOSITE_NOMUX(0, "clkin_trace", "sclk_cs_pre", CLK_IGNORE_UNUSED, 287 + RK3368_CLKSEL_CON(4), 8, 5, DFLAGS, 288 + RK3368_CLKGATE_CON(0), 13, GFLAGS), 289 + 290 + COMPOSITE(0, "aclk_cci_pre", mux_pll_src_cpll_gpll_usb_npll_p, CLK_IGNORE_UNUSED, 291 + RK3368_CLKSEL_CON(5), 6, 2, MFLAGS, 0, 7, DFLAGS, 292 + RK3368_CLKGATE_CON(0), 12, GFLAGS), 293 + GATE(SCLK_PVTM_CORE, "sclk_pvtm_core", "xin24m", 0, RK3368_CLKGATE_CON(7), 10, GFLAGS), 294 + 295 + GATE(0, "dpll_ddr", "dpll", CLK_IGNORE_UNUSED, 296 + RK3368_CLKGATE_CON(1), 8, GFLAGS), 297 + GATE(0, "gpll_ddr", "gpll", 0, 298 + RK3368_CLKGATE_CON(1), 9, GFLAGS), 299 + COMPOSITE_NOGATE_DIVTBL(0, "ddrphy_src", mux_ddrphy_p, CLK_IGNORE_UNUSED, 300 + RK3368_CLKSEL_CON(13), 4, 1, MFLAGS, 0, 2, DFLAGS, div_ddrphy_t), 301 + 302 + GATE(0, "sclk_ddr", "ddrphy_div4", CLK_IGNORE_UNUSED, 303 + RK3368_CLKGATE_CON(6), 14, GFLAGS), 304 + GATE(0, "sclk_ddr4x", "ddrphy_src", CLK_IGNORE_UNUSED, 305 + RK3368_CLKGATE_CON(6), 15, GFLAGS), 306 + 307 + GATE(0, "gpll_aclk_bus", "gpll", CLK_IGNORE_UNUSED, 308 + RK3368_CLKGATE_CON(1), 10, GFLAGS), 309 + GATE(0, "cpll_aclk_bus", "cpll", CLK_IGNORE_UNUSED, 310 + RK3368_CLKGATE_CON(1), 11, GFLAGS), 311 + COMPOSITE_NOGATE(0, "aclk_bus_src", mux_aclk_bus_src_p, CLK_IGNORE_UNUSED, 312 + RK3368_CLKSEL_CON(8), 7, 1, MFLAGS, 0, 5, DFLAGS), 313 + 314 + GATE(ACLK_BUS, "aclk_bus", "aclk_bus_src", CLK_IGNORE_UNUSED, 315 + RK3368_CLKGATE_CON(1), 0, GFLAGS), 316 + COMPOSITE_NOMUX(PCLK_BUS, "pclk_bus", "aclk_bus_src", CLK_IGNORE_UNUSED, 317 + RK3368_CLKSEL_CON(8), 12, 3, DFLAGS, 318 + RK3368_CLKGATE_CON(1), 2, GFLAGS), 319 + COMPOSITE_NOMUX(HCLK_BUS, "hclk_bus", "aclk_bus_src", CLK_IGNORE_UNUSED, 320 + RK3368_CLKSEL_CON(8), 8, 2, DFLAGS, 321 + RK3368_CLKGATE_CON(1), 1, GFLAGS), 322 + COMPOSITE_NOMUX(0, "sclk_crypto", "aclk_bus_src", 0, 323 + RK3368_CLKSEL_CON(10), 14, 2, DFLAGS, 324 + RK3368_CLKGATE_CON(7), 2, GFLAGS), 325 + 326 + COMPOSITE(0, "fclk_mcu_src", mux_pll_src_cpll_gpll_p, CLK_IGNORE_UNUSED, 327 + RK3368_CLKSEL_CON(12), 7, 1, MFLAGS, 0, 5, DFLAGS, 328 + RK3368_CLKGATE_CON(1), 3, GFLAGS), 329 + /* 330 + * stclk_mcu is listed as child of fclk_mcu_src in diagram 5, 331 + * but stclk_mcu has an additional own divider in diagram 2 332 + */ 333 + COMPOSITE_NOMUX(0, "stclk_mcu", "fclk_mcu_src", 0, 334 + RK3368_CLKSEL_CON(12), 8, 3, DFLAGS, 335 + RK3368_CLKGATE_CON(13), 13, GFLAGS), 336 + 337 + COMPOSITE(0, "i2s_8ch_src", mux_pll_src_cpll_gpll_p, 0, 338 + RK3368_CLKSEL_CON(27), 12, 1, MFLAGS, 0, 7, DFLAGS, 339 + RK3368_CLKGATE_CON(6), 1, GFLAGS), 340 + COMPOSITE_FRAC(0, "i2s_8ch_frac", "i2s_8ch_src", CLK_SET_RATE_PARENT, 341 + RK3368_CLKSEL_CON(28), 0, 342 + RK3368_CLKGATE_CON(6), 2, GFLAGS), 343 + MUX(0, "i2s_8ch_pre", mux_i2s_8ch_pre_p, CLK_SET_RATE_PARENT, 344 + RK3368_CLKSEL_CON(27), 8, 2, MFLAGS), 345 + COMPOSITE_NODIV(SCLK_I2S_8CH_OUT, "i2s_8ch_clkout", mux_i2s_8ch_clkout_p, 0, 346 + RK3368_CLKSEL_CON(27), 15, 1, MFLAGS, 347 + RK3368_CLKGATE_CON(6), 0, GFLAGS), 348 + GATE(SCLK_I2S_8CH, "sclk_i2s_8ch", "i2s_8ch_pre", CLK_SET_RATE_PARENT, 349 + RK3368_CLKGATE_CON(6), 3, GFLAGS), 350 + COMPOSITE(0, "spdif_8ch_src", mux_pll_src_cpll_gpll_p, 0, 351 + RK3368_CLKSEL_CON(31), 12, 1, MFLAGS, 0, 7, DFLAGS, 352 + RK3368_CLKGATE_CON(6), 4, GFLAGS), 353 + COMPOSITE_FRAC(0, "spdif_8ch_frac", "spdif_8ch_src", CLK_SET_RATE_PARENT, 354 + RK3368_CLKSEL_CON(32), 0, 355 + RK3368_CLKGATE_CON(6), 5, GFLAGS), 356 + COMPOSITE_NODIV(SCLK_SPDIF_8CH, "sclk_spdif_8ch", mux_spdif_8ch_p, 0, 357 + RK3368_CLKSEL_CON(31), 8, 2, MFLAGS, 358 + RK3368_CLKGATE_CON(6), 6, GFLAGS), 359 + COMPOSITE(0, "i2s_2ch_src", mux_pll_src_cpll_gpll_p, 0, 360 + RK3368_CLKSEL_CON(53), 12, 1, MFLAGS, 0, 7, DFLAGS, 361 + RK3368_CLKGATE_CON(5), 13, GFLAGS), 362 + COMPOSITE_FRAC(0, "i2s_2ch_frac", "i2s_2ch_src", CLK_SET_RATE_PARENT, 363 + RK3368_CLKSEL_CON(54), 0, 364 + RK3368_CLKGATE_CON(5), 14, GFLAGS), 365 + COMPOSITE_NODIV(SCLK_I2S_2CH, "sclk_i2s_2ch", mux_i2s_2ch_p, 0, 366 + RK3368_CLKSEL_CON(53), 8, 2, MFLAGS, 367 + RK3368_CLKGATE_CON(5), 15, GFLAGS), 368 + 369 + COMPOSITE(0, "sclk_tsp", mux_pll_src_cpll_gpll_npll_p, 0, 370 + RK3368_CLKSEL_CON(46), 6, 2, MFLAGS, 0, 5, DFLAGS, 371 + RK3368_CLKGATE_CON(6), 12, GFLAGS), 372 + GATE(0, "sclk_hsadc_tsp", "ext_hsadc_tsp", 0, 373 + RK3368_CLKGATE_CON(13), 7, GFLAGS), 374 + 375 + MUX(0, "uart_src", mux_pll_src_cpll_gpll_p, 0, 376 + RK3368_CLKSEL_CON(35), 12, 1, MFLAGS), 377 + COMPOSITE_NOMUX(0, "uart2_src", "uart_src", 0, 378 + RK3368_CLKSEL_CON(37), 0, 7, DFLAGS, 379 + RK3368_CLKGATE_CON(2), 4, GFLAGS), 380 + MUX(SCLK_UART2, "sclk_uart2", mux_uart2_p, CLK_SET_RATE_PARENT, 381 + RK3368_CLKSEL_CON(37), 8, 1, MFLAGS), 382 + 383 + /* 384 + * Clock-Architecture Diagram 3 385 + */ 386 + 387 + COMPOSITE(0, "aclk_vepu", mux_pll_src_cpll_gpll_usb_p, 0, 388 + RK3368_CLKSEL_CON(15), 6, 2, MFLAGS, 0, 5, DFLAGS, 389 + RK3368_CLKGATE_CON(4), 6, GFLAGS), 390 + COMPOSITE(0, "aclk_vdpu", mux_pll_src_cpll_gpll_usb_p, 0, 391 + RK3368_CLKSEL_CON(15), 14, 2, MFLAGS, 8, 5, DFLAGS, 392 + RK3368_CLKGATE_CON(4), 7, GFLAGS), 393 + 394 + /* 395 + * We introduce a virtual node of hclk_vodec_pre_v to split one clock 396 + * struct with a gate and a fix divider into two node in software. 397 + */ 398 + GATE(0, "hclk_video_pre_v", "aclk_vdpu", 0, 399 + RK3368_CLKGATE_CON(4), 8, GFLAGS), 400 + 401 + COMPOSITE(0, "sclk_hevc_cabac_src", mux_pll_src_cpll_gpll_npll_usb_p, 0, 402 + RK3368_CLKSEL_CON(17), 6, 2, MFLAGS, 0, 5, DFLAGS, 403 + RK3368_CLKGATE_CON(5), 1, GFLAGS), 404 + COMPOSITE(0, "sclk_hevc_core_src", mux_pll_src_cpll_gpll_npll_usb_p, 0, 405 + RK3368_CLKSEL_CON(17), 14, 2, MFLAGS, 8, 5, DFLAGS, 406 + RK3368_CLKGATE_CON(5), 2, GFLAGS), 407 + 408 + COMPOSITE(0, "aclk_vio0", mux_pll_src_cpll_gpll_usb_p, CLK_IGNORE_UNUSED, 409 + RK3368_CLKSEL_CON(19), 6, 2, MFLAGS, 0, 5, DFLAGS, 410 + RK3368_CLKGATE_CON(4), 0, GFLAGS), 411 + DIV(0, "hclk_vio", "aclk_vio0", 0, 412 + RK3368_CLKSEL_CON(21), 0, 5, DFLAGS), 413 + 414 + COMPOSITE(0, "aclk_rga_pre", mux_pll_src_cpll_gpll_usb_p, 0, 415 + RK3368_CLKSEL_CON(18), 14, 2, MFLAGS, 8, 5, DFLAGS, 416 + RK3368_CLKGATE_CON(4), 3, GFLAGS), 417 + COMPOSITE(SCLK_RGA, "sclk_rga", mux_pll_src_cpll_gpll_usb_p, 0, 418 + RK3368_CLKSEL_CON(18), 6, 2, MFLAGS, 0, 5, DFLAGS, 419 + RK3368_CLKGATE_CON(4), 4, GFLAGS), 420 + 421 + COMPOSITE(DCLK_VOP, "dclk_vop", mux_pll_src_cpll_gpll_npll_p, 0, 422 + RK3368_CLKSEL_CON(20), 8, 2, MFLAGS, 0, 8, DFLAGS, 423 + RK3368_CLKGATE_CON(4), 1, GFLAGS), 424 + 425 + GATE(SCLK_VOP0_PWM, "sclk_vop0_pwm", "xin24m", 0, 426 + RK3368_CLKGATE_CON(4), 2, GFLAGS), 427 + 428 + COMPOSITE(SCLK_ISP, "sclk_isp", mux_pll_src_cpll_gpll_npll_npll_p, 0, 429 + RK3368_CLKSEL_CON(22), 6, 2, MFLAGS, 0, 6, DFLAGS, 430 + RK3368_CLKGATE_CON(4), 9, GFLAGS), 431 + 432 + GATE(0, "pclk_isp_in", "ext_isp", 0, 433 + RK3368_CLKGATE_CON(17), 2, GFLAGS), 434 + INVERTER(PCLK_ISP, "pclk_isp", "pclk_isp_in", 435 + RK3368_CLKSEL_CON(21), 6, IFLAGS), 436 + 437 + GATE(0, "pclk_vip_in", "ext_vip", 0, 438 + RK3368_CLKGATE_CON(16), 13, GFLAGS), 439 + INVERTER(PCLK_VIP, "pclk_vip", "pclk_vip_in", 440 + RK3368_CLKSEL_CON(21), 13, IFLAGS), 441 + 442 + GATE(SCLK_HDMI_HDCP, "sclk_hdmi_hdcp", "xin24m", 0, 443 + RK3368_CLKGATE_CON(4), 13, GFLAGS), 444 + GATE(SCLK_HDMI_CEC, "sclk_hdmi_cec", "xin32k", 0, 445 + RK3368_CLKGATE_CON(5), 12, GFLAGS), 446 + 447 + COMPOSITE_NODIV(0, "vip_src", mux_pll_src_cpll_gpll_p, 0, 448 + RK3368_CLKSEL_CON(21), 15, 1, MFLAGS, 449 + RK3368_CLKGATE_CON(4), 5, GFLAGS), 450 + COMPOSITE_NOGATE(0, "sclk_vip_out", mux_vip_out_p, 0, 451 + RK3368_CLKSEL_CON(21), 14, 1, MFLAGS, 8, 5, DFLAGS), 452 + 453 + COMPOSITE_NODIV(SCLK_EDP_24M, "sclk_edp_24m", mux_edp_24m_p, 0, 454 + RK3368_CLKSEL_CON(23), 8, 1, MFLAGS, 455 + RK3368_CLKGATE_CON(5), 4, GFLAGS), 456 + COMPOSITE(SCLK_EDP, "sclk_edp", mux_pll_src_cpll_gpll_npll_npll_p, 0, 457 + RK3368_CLKSEL_CON(23), 6, 2, MFLAGS, 0, 6, DFLAGS, 458 + RK3368_CLKGATE_CON(5), 3, GFLAGS), 459 + 460 + COMPOSITE(SCLK_HDCP, "sclk_hdcp", mux_pll_src_cpll_gpll_npll_npll_p, 0, 461 + RK3368_CLKSEL_CON(55), 6, 2, MFLAGS, 0, 6, DFLAGS, 462 + RK3368_CLKGATE_CON(5), 5, GFLAGS), 463 + 464 + DIV(0, "pclk_pd_alive", "gpll", 0, 465 + RK3368_CLKSEL_CON(10), 8, 5, DFLAGS), 466 + 467 + /* sclk_timer has a gate in the sgrf */ 468 + 469 + COMPOSITE_NOMUX(0, "pclk_pd_pmu", "gpll", CLK_IGNORE_UNUSED, 470 + RK3368_CLKSEL_CON(10), 0, 5, DFLAGS, 471 + RK3368_CLKGATE_CON(7), 9, GFLAGS), 472 + GATE(SCLK_PVTM_PMU, "sclk_pvtm_pmu", "xin24m", 0, 473 + RK3368_CLKGATE_CON(7), 3, GFLAGS), 474 + COMPOSITE(0, "sclk_gpu_core_src", mux_pll_src_cpll_gpll_usb_npll_p, 0, 475 + RK3368_CLKSEL_CON(14), 6, 2, MFLAGS, 0, 5, DFLAGS, 476 + RK3368_CLKGATE_CON(4), 11, GFLAGS), 477 + MUX(0, "aclk_gpu_src", mux_pll_src_cpll_gpll_p, 0, 478 + RK3368_CLKSEL_CON(14), 14, 1, MFLAGS), 479 + COMPOSITE_NOMUX(0, "aclk_gpu_mem_pre", "aclk_gpu_src", 0, 480 + RK3368_CLKSEL_CON(14), 8, 5, DFLAGS, 481 + RK3368_CLKGATE_CON(5), 8, GFLAGS), 482 + COMPOSITE_NOMUX(0, "aclk_gpu_cfg_pre", "aclk_gpu_src", 0, 483 + RK3368_CLKSEL_CON(16), 8, 5, DFLAGS, 484 + RK3368_CLKGATE_CON(5), 9, GFLAGS), 485 + GATE(SCLK_PVTM_GPU, "sclk_pvtm_gpu", "xin24m", 0, 486 + RK3368_CLKGATE_CON(7), 11, GFLAGS), 487 + 488 + COMPOSITE(0, "aclk_peri_src", mux_pll_src_cpll_gpll_p, CLK_IGNORE_UNUSED, 489 + RK3368_CLKSEL_CON(9), 7, 1, MFLAGS, 0, 5, DFLAGS, 490 + RK3368_CLKGATE_CON(3), 0, GFLAGS), 491 + COMPOSITE_NOMUX(PCLK_PERI, "pclk_peri", "aclk_peri_src", 0, 492 + RK3368_CLKSEL_CON(9), 12, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO, 493 + RK3368_CLKGATE_CON(3), 3, GFLAGS), 494 + COMPOSITE_NOMUX(HCLK_PERI, "hclk_peri", "aclk_peri_src", CLK_IGNORE_UNUSED, 495 + RK3368_CLKSEL_CON(9), 8, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO, 496 + RK3368_CLKGATE_CON(3), 2, GFLAGS), 497 + GATE(ACLK_PERI, "aclk_peri", "aclk_peri_src", CLK_IGNORE_UNUSED, 498 + RK3368_CLKGATE_CON(3), 1, GFLAGS), 499 + 500 + GATE(0, "sclk_mipidsi_24m", "xin24m", 0, RK3368_CLKGATE_CON(4), 14, GFLAGS), 501 + 502 + /* 503 + * Clock-Architecture Diagram 4 504 + */ 505 + 506 + COMPOSITE(SCLK_SPI0, "sclk_spi0", mux_pll_src_cpll_gpll_p, 0, 507 + RK3368_CLKSEL_CON(45), 7, 1, MFLAGS, 0, 7, DFLAGS, 508 + RK3368_CLKGATE_CON(3), 7, GFLAGS), 509 + COMPOSITE(SCLK_SPI1, "sclk_spi1", mux_pll_src_cpll_gpll_p, 0, 510 + RK3368_CLKSEL_CON(45), 15, 1, MFLAGS, 8, 7, DFLAGS, 511 + RK3368_CLKGATE_CON(3), 8, GFLAGS), 512 + COMPOSITE(SCLK_SPI2, "sclk_spi2", mux_pll_src_cpll_gpll_p, 0, 513 + RK3368_CLKSEL_CON(46), 15, 1, MFLAGS, 8, 7, DFLAGS, 514 + RK3368_CLKGATE_CON(3), 9, GFLAGS), 515 + 516 + 517 + COMPOSITE(SCLK_SDMMC, "sclk_sdmmc", mux_mmc_src_p, 0, 518 + RK3368_CLKSEL_CON(50), 8, 2, MFLAGS, 0, 7, DFLAGS, 519 + RK3368_CLKGATE_CON(7), 12, GFLAGS), 520 + COMPOSITE(SCLK_SDIO0, "sclk_sdio0", mux_mmc_src_p, 0, 521 + RK3368_CLKSEL_CON(48), 8, 2, MFLAGS, 0, 7, DFLAGS, 522 + RK3368_CLKGATE_CON(7), 13, GFLAGS), 523 + COMPOSITE(SCLK_EMMC, "sclk_emmc", mux_mmc_src_p, 0, 524 + RK3368_CLKSEL_CON(51), 8, 2, MFLAGS, 0, 7, DFLAGS, 525 + RK3368_CLKGATE_CON(7), 15, GFLAGS), 526 + 527 + MMC(SCLK_SDMMC_DRV, "sdmmc_drv", "sclk_sdmmc", RK3368_SDMMC_CON0, 1), 528 + MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "sclk_sdmmc", RK3368_SDMMC_CON1, 0), 529 + 530 + MMC(SCLK_SDIO0_DRV, "sdio0_drv", "sclk_sdio0", RK3368_SDIO0_CON0, 1), 531 + MMC(SCLK_SDIO0_SAMPLE, "sdio0_sample", "sclk_sdio0", RK3368_SDIO0_CON1, 0), 532 + 533 + MMC(SCLK_EMMC_DRV, "emmc_drv", "sclk_emmc", RK3368_EMMC_CON0, 1), 534 + MMC(SCLK_EMMC_SAMPLE, "emmc_sample", "sclk_emmc", RK3368_EMMC_CON1, 0), 535 + 536 + GATE(SCLK_OTGPHY0, "sclk_otgphy0", "xin24m", CLK_IGNORE_UNUSED, 537 + RK3368_CLKGATE_CON(8), 1, GFLAGS), 538 + 539 + /* pmu_grf_soc_con0[6] allows to select between xin32k and pvtm_pmu */ 540 + GATE(SCLK_OTG_ADP, "sclk_otg_adp", "xin32k", CLK_IGNORE_UNUSED, 541 + RK3368_CLKGATE_CON(8), 4, GFLAGS), 542 + 543 + /* pmu_grf_soc_con0[6] allows to select between xin32k and pvtm_pmu */ 544 + COMPOSITE_NOMUX(SCLK_TSADC, "sclk_tsadc", "xin32k", 0, 545 + RK3368_CLKSEL_CON(25), 0, 6, DFLAGS, 546 + RK3368_CLKGATE_CON(3), 5, GFLAGS), 547 + 548 + COMPOSITE_NOMUX(SCLK_SARADC, "sclk_saradc", "xin24m", 0, 549 + RK3368_CLKSEL_CON(25), 8, 8, DFLAGS, 550 + RK3368_CLKGATE_CON(3), 6, GFLAGS), 551 + 552 + COMPOSITE(SCLK_NANDC0, "sclk_nandc0", mux_pll_src_cpll_gpll_p, 0, 553 + RK3368_CLKSEL_CON(47), 7, 1, MFLAGS, 0, 5, DFLAGS, 554 + RK3368_CLKGATE_CON(7), 8, GFLAGS), 555 + 556 + COMPOSITE(SCLK_SFC, "sclk_sfc", mux_pll_src_cpll_gpll_p, 0, 557 + RK3368_CLKSEL_CON(52), 7, 1, MFLAGS, 0, 5, DFLAGS, 558 + RK3368_CLKGATE_CON(6), 7, GFLAGS), 559 + 560 + COMPOSITE(0, "uart0_src", mux_pll_src_cpll_gpll_usb_usb_p, 0, 561 + RK3368_CLKSEL_CON(33), 12, 2, MFLAGS, 0, 7, DFLAGS, 562 + RK3368_CLKGATE_CON(2), 0, GFLAGS), 563 + COMPOSITE_FRAC(0, "uart0_frac", "uart0_src", CLK_SET_RATE_PARENT, 564 + RK3368_CLKSEL_CON(34), 0, 565 + RK3368_CLKGATE_CON(2), 1, GFLAGS), 566 + MUX(SCLK_UART0, "sclk_uart0", mux_uart0_p, CLK_SET_RATE_PARENT, 567 + RK3368_CLKSEL_CON(33), 8, 2, MFLAGS), 568 + 569 + COMPOSITE_NOMUX(0, "uart1_src", "uart_src", 0, 570 + RK3368_CLKSEL_CON(35), 0, 7, DFLAGS, 571 + RK3368_CLKGATE_CON(2), 2, GFLAGS), 572 + COMPOSITE_FRAC(0, "uart1_frac", "uart1_src", CLK_SET_RATE_PARENT, 573 + RK3368_CLKSEL_CON(36), 0, 574 + RK3368_CLKGATE_CON(2), 3, GFLAGS), 575 + MUX(SCLK_UART1, "sclk_uart1", mux_uart1_p, CLK_SET_RATE_PARENT, 576 + RK3368_CLKSEL_CON(35), 8, 2, MFLAGS), 577 + 578 + COMPOSITE_NOMUX(0, "uart3_src", "uart_src", 0, 579 + RK3368_CLKSEL_CON(39), 0, 7, DFLAGS, 580 + RK3368_CLKGATE_CON(2), 6, GFLAGS), 581 + COMPOSITE_FRAC(0, "uart3_frac", "uart3_src", CLK_SET_RATE_PARENT, 582 + RK3368_CLKSEL_CON(40), 0, 583 + RK3368_CLKGATE_CON(2), 7, GFLAGS), 584 + MUX(SCLK_UART3, "sclk_uart3", mux_uart3_p, CLK_SET_RATE_PARENT, 585 + RK3368_CLKSEL_CON(39), 8, 2, MFLAGS), 586 + 587 + COMPOSITE_NOMUX(0, "uart4_src", "uart_src", 0, 588 + RK3368_CLKSEL_CON(41), 0, 7, DFLAGS, 589 + RK3368_CLKGATE_CON(2), 8, GFLAGS), 590 + COMPOSITE_FRAC(0, "uart4_frac", "uart4_src", CLK_SET_RATE_PARENT, 591 + RK3368_CLKSEL_CON(42), 0, 592 + RK3368_CLKGATE_CON(2), 9, GFLAGS), 593 + MUX(SCLK_UART4, "sclk_uart4", mux_uart4_p, CLK_SET_RATE_PARENT, 594 + RK3368_CLKSEL_CON(41), 8, 2, MFLAGS), 595 + 596 + COMPOSITE(0, "mac_pll_src", mux_pll_src_npll_cpll_gpll_p, 0, 597 + RK3368_CLKSEL_CON(43), 6, 2, MFLAGS, 0, 5, DFLAGS, 598 + RK3368_CLKGATE_CON(3), 4, GFLAGS), 599 + MUX(SCLK_MAC, "mac_clk", mux_mac_p, CLK_SET_RATE_PARENT, 600 + RK3368_CLKSEL_CON(43), 8, 1, MFLAGS), 601 + GATE(SCLK_MACREF_OUT, "sclk_macref_out", "mac_clk", 0, 602 + RK3368_CLKGATE_CON(7), 7, GFLAGS), 603 + GATE(SCLK_MACREF, "sclk_macref", "mac_clk", 0, 604 + RK3368_CLKGATE_CON(7), 6, GFLAGS), 605 + GATE(SCLK_MAC_RX, "sclk_mac_rx", "mac_clk", 0, 606 + RK3368_CLKGATE_CON(7), 4, GFLAGS), 607 + GATE(SCLK_MAC_TX, "sclk_mac_tx", "mac_clk", 0, 608 + RK3368_CLKGATE_CON(7), 5, GFLAGS), 609 + 610 + GATE(0, "jtag", "ext_jtag", 0, 611 + RK3368_CLKGATE_CON(7), 0, GFLAGS), 612 + 613 + COMPOSITE_NODIV(0, "hsic_usbphy_480m", mux_hsic_usbphy480m_p, 0, 614 + RK3368_CLKSEL_CON(26), 8, 2, MFLAGS, 615 + RK3368_CLKGATE_CON(8), 0, GFLAGS), 616 + COMPOSITE_NODIV(SCLK_HSICPHY480M, "sclk_hsicphy480m", mux_hsicphy480m_p, 0, 617 + RK3368_CLKSEL_CON(26), 12, 2, MFLAGS, 618 + RK3368_CLKGATE_CON(8), 7, GFLAGS), 619 + GATE(SCLK_HSICPHY12M, "sclk_hsicphy12m", "xin12m", 0, 620 + RK3368_CLKGATE_CON(8), 6, GFLAGS), 621 + 622 + /* 623 + * Clock-Architecture Diagram 5 624 + */ 625 + 626 + /* aclk_cci_pre gates */ 627 + GATE(0, "aclk_core_niu_cpup", "aclk_cci_pre", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(11), 4, GFLAGS), 628 + GATE(0, "aclk_core_niu_cci", "aclk_cci_pre", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(11), 3, GFLAGS), 629 + GATE(0, "aclk_cci400", "aclk_cci_pre", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(11), 2, GFLAGS), 630 + GATE(0, "aclk_adb400m_pd_core_b", "aclk_cci_pre", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(11), 1, GFLAGS), 631 + GATE(0, "aclk_adb400m_pd_core_l", "aclk_cci_pre", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(11), 0, GFLAGS), 632 + 633 + /* aclkm_core_* gates */ 634 + GATE(0, "aclk_adb400s_pd_core_b", "aclkm_core_b", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(10), 0, GFLAGS), 635 + GATE(0, "aclk_adb400s_pd_core_l", "aclkm_core_l", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(9), 0, GFLAGS), 636 + 637 + /* armclk* gates */ 638 + GATE(0, "sclk_dbg_pd_core_b", "armclkb", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(10), 1, GFLAGS), 639 + GATE(0, "sclk_dbg_pd_core_l", "armclkl", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(9), 1, GFLAGS), 640 + 641 + /* sclk_cs_pre gates */ 642 + GATE(0, "sclk_dbg", "sclk_cs_pre", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(11), 7, GFLAGS), 643 + GATE(0, "pclk_core_niu_sdbg", "sclk_cs_pre", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(11), 6, GFLAGS), 644 + GATE(0, "hclk_core_niu_dbg", "sclk_cs_pre", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(11), 5, GFLAGS), 645 + 646 + /* aclk_bus gates */ 647 + GATE(0, "aclk_strc_sys", "aclk_bus", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(12), 12, GFLAGS), 648 + GATE(ACLK_DMAC_BUS, "aclk_dmac_bus", "aclk_bus", 0, RK3368_CLKGATE_CON(12), 11, GFLAGS), 649 + GATE(0, "sclk_intmem1", "aclk_bus", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(12), 6, GFLAGS), 650 + GATE(0, "sclk_intmem0", "aclk_bus", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(12), 5, GFLAGS), 651 + GATE(0, "aclk_intmem", "aclk_bus", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(12), 4, GFLAGS), 652 + GATE(0, "aclk_gic400", "aclk_bus", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(13), 9, GFLAGS), 653 + 654 + /* sclk_ddr gates */ 655 + GATE(0, "nclk_ddrupctl", "sclk_ddr", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(13), 2, GFLAGS), 656 + 657 + /* clk_hsadc_tsp is part of diagram2 */ 658 + 659 + /* fclk_mcu_src gates */ 660 + GATE(0, "hclk_noc_mcu", "fclk_mcu_src", 0, RK3368_CLKGATE_CON(13), 14, GFLAGS), 661 + GATE(0, "fclk_mcu", "fclk_mcu_src", 0, RK3368_CLKGATE_CON(13), 12, GFLAGS), 662 + GATE(0, "hclk_mcu", "fclk_mcu_src", 0, RK3368_CLKGATE_CON(13), 11, GFLAGS), 663 + 664 + /* hclk_cpu gates */ 665 + GATE(HCLK_SPDIF, "hclk_spdif", "hclk_bus", 0, RK3368_CLKGATE_CON(12), 10, GFLAGS), 666 + GATE(HCLK_ROM, "hclk_rom", "hclk_bus", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(12), 9, GFLAGS), 667 + GATE(HCLK_I2S_2CH, "hclk_i2s_2ch", "hclk_bus", 0, RK3368_CLKGATE_CON(12), 8, GFLAGS), 668 + GATE(HCLK_I2S_8CH, "hclk_i2s_8ch", "hclk_bus", 0, RK3368_CLKGATE_CON(12), 7, GFLAGS), 669 + GATE(HCLK_TSP, "hclk_tsp", "hclk_bus", 0, RK3368_CLKGATE_CON(13), 10, GFLAGS), 670 + GATE(HCLK_CRYPTO, "hclk_crypto", "hclk_bus", 0, RK3368_CLKGATE_CON(13), 4, GFLAGS), 671 + GATE(MCLK_CRYPTO, "mclk_crypto", "hclk_bus", 0, RK3368_CLKGATE_CON(13), 3, GFLAGS), 672 + 673 + /* pclk_cpu gates */ 674 + GATE(PCLK_DDRPHY, "pclk_ddrphy", "pclk_bus", 0, RK3368_CLKGATE_CON(12), 14, GFLAGS), 675 + GATE(PCLK_DDRUPCTL, "pclk_ddrupctl", "pclk_bus", 0, RK3368_CLKGATE_CON(12), 13, GFLAGS), 676 + GATE(PCLK_I2C1, "pclk_i2c1", "pclk_bus", 0, RK3368_CLKGATE_CON(12), 3, GFLAGS), 677 + GATE(PCLK_I2C0, "pclk_i2c0", "pclk_bus", 0, RK3368_CLKGATE_CON(12), 2, GFLAGS), 678 + GATE(PCLK_MAILBOX, "pclk_mailbox", "pclk_bus", 0, RK3368_CLKGATE_CON(12), 1, GFLAGS), 679 + GATE(PCLK_PWM0, "pclk_pwm0", "pclk_bus", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(12), 0, GFLAGS), 680 + GATE(PCLK_SIM, "pclk_sim", "pclk_bus", 0, RK3368_CLKGATE_CON(13), 8, GFLAGS), 681 + GATE(PCLK_PWM1, "pclk_pwm1", "pclk_bus", 0, RK3368_CLKGATE_CON(13), 6, GFLAGS), 682 + GATE(PCLK_UART2, "pclk_uart2", "pclk_bus", 0, RK3368_CLKGATE_CON(13), 5, GFLAGS), 683 + GATE(0, "pclk_efuse_256", "pclk_bus", 0, RK3368_CLKGATE_CON(13), 1, GFLAGS), 684 + GATE(0, "pclk_efuse_1024", "pclk_bus", 0, RK3368_CLKGATE_CON(13), 0, GFLAGS), 685 + 686 + /* 687 + * video clk gates 688 + * aclk_video(_pre) can actually select between parents of aclk_vdpu 689 + * and aclk_vepu by setting bit GRF_SOC_CON0[7]. 690 + */ 691 + GATE(ACLK_VIDEO, "aclk_video", "aclk_vdpu", 0, RK3368_CLKGATE_CON(15), 0, GFLAGS), 692 + GATE(SCLK_HEVC_CABAC, "sclk_hevc_cabac", "sclk_hevc_cabac_src", 0, RK3368_CLKGATE_CON(15), 3, GFLAGS), 693 + GATE(SCLK_HEVC_CORE, "sclk_hevc_core", "sclk_hevc_core_src", 0, RK3368_CLKGATE_CON(15), 2, GFLAGS), 694 + GATE(HCLK_VIDEO, "hclk_video", "hclk_video_pre", 0, RK3368_CLKGATE_CON(15), 1, GFLAGS), 695 + 696 + /* aclk_rga_pre gates */ 697 + GATE(ACLK_VIO1_NOC, "aclk_vio1_noc", "aclk_rga_pre", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(16), 10, GFLAGS), 698 + GATE(ACLK_RGA, "aclk_rga", "aclk_rga_pre", 0, RK3368_CLKGATE_CON(16), 0, GFLAGS), 699 + GATE(ACLK_HDCP, "aclk_hdcp", "aclk_rga_pre", 0, RK3368_CLKGATE_CON(17), 10, GFLAGS), 700 + 701 + /* aclk_vio0 gates */ 702 + GATE(ACLK_VIP, "aclk_vip", "aclk_vio0", 0, RK3368_CLKGATE_CON(16), 11, GFLAGS), 703 + GATE(ACLK_VIO0_NOC, "aclk_vio0_noc", "aclk_vio0", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(16), 9, GFLAGS), 704 + GATE(ACLK_VOP, "aclk_vop", "aclk_vio0", 0, RK3368_CLKGATE_CON(16), 5, GFLAGS), 705 + GATE(ACLK_VOP_IEP, "aclk_vop_iep", "aclk_vio0", 0, RK3368_CLKGATE_CON(16), 4, GFLAGS), 706 + GATE(ACLK_IEP, "aclk_iep", "aclk_vio0", 0, RK3368_CLKGATE_CON(16), 2, GFLAGS), 707 + 708 + /* sclk_isp gates */ 709 + GATE(HCLK_ISP, "hclk_isp", "sclk_isp", 0, RK3368_CLKGATE_CON(16), 14, GFLAGS), 710 + GATE(ACLK_ISP, "aclk_isp", "sclk_isp", 0, RK3368_CLKGATE_CON(17), 0, GFLAGS), 711 + 712 + /* hclk_vio gates */ 713 + GATE(HCLK_VIP, "hclk_vip", "hclk_vio", 0, RK3368_CLKGATE_CON(16), 12, GFLAGS), 714 + GATE(HCLK_VIO_NOC, "hclk_vio_noc", "hclk_vio", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(16), 8, GFLAGS), 715 + GATE(HCLK_VIO_AHB_ARBI, "hclk_vio_ahb_arbi", "hclk_vio", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(16), 7, GFLAGS), 716 + GATE(HCLK_VOP, "hclk_vop", "hclk_vio", 0, RK3368_CLKGATE_CON(16), 6, GFLAGS), 717 + GATE(HCLK_IEP, "hclk_iep", "hclk_vio", 0, RK3368_CLKGATE_CON(16), 3, GFLAGS), 718 + GATE(HCLK_RGA, "hclk_rga", "hclk_vio", 0, RK3368_CLKGATE_CON(16), 1, GFLAGS), 719 + GATE(HCLK_VIO_HDCPMMU, "hclk_hdcpmmu", "hclk_vio", 0, RK3368_CLKGATE_CON(17), 12, GFLAGS), 720 + GATE(HCLK_VIO_H2P, "hclk_vio_h2p", "hclk_vio", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(17), 7, GFLAGS), 721 + 722 + /* 723 + * pclk_vio gates 724 + * pclk_vio comes from the exactly same source as hclk_vio 725 + */ 726 + GATE(PCLK_HDCP, "pclk_hdcp", "hclk_vio", 0, RK3368_CLKGATE_CON(17), 11, GFLAGS), 727 + GATE(PCLK_EDP_CTRL, "pclk_edp_ctrl", "hclk_vio", 0, RK3368_CLKGATE_CON(17), 9, GFLAGS), 728 + GATE(PCLK_VIO_H2P, "pclk_vio_h2p", "hclk_vio", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(17), 8, GFLAGS), 729 + GATE(PCLK_HDMI_CTRL, "pclk_hdmi_ctrl", "hclk_vio", 0, RK3368_CLKGATE_CON(17), 6, GFLAGS), 730 + GATE(PCLK_MIPI_CSI, "pclk_mipi_csi", "hclk_vio", 0, RK3368_CLKGATE_CON(17), 4, GFLAGS), 731 + GATE(PCLK_MIPI_DSI0, "pclk_mipi_dsi0", "hclk_vio", 0, RK3368_CLKGATE_CON(17), 3, GFLAGS), 732 + 733 + /* ext_vip gates in diagram3 */ 734 + 735 + /* gpu gates */ 736 + GATE(SCLK_GPU_CORE, "sclk_gpu_core", "sclk_gpu_core_src", 0, RK3368_CLKGATE_CON(18), 2, GFLAGS), 737 + GATE(ACLK_GPU_MEM, "aclk_gpu_mem", "aclk_gpu_mem_pre", 0, RK3368_CLKGATE_CON(18), 1, GFLAGS), 738 + GATE(ACLK_GPU_CFG, "aclk_gpu_cfg", "aclk_gpu_cfg_pre", 0, RK3368_CLKGATE_CON(18), 0, GFLAGS), 739 + 740 + /* aclk_peri gates */ 741 + GATE(ACLK_DMAC_PERI, "aclk_dmac_peri", "aclk_peri", 0, RK3368_CLKGATE_CON(19), 3, GFLAGS), 742 + GATE(0, "aclk_peri_axi_matrix", "aclk_peri", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(19), 2, GFLAGS), 743 + GATE(HCLK_SFC, "hclk_sfc", "aclk_peri", 0, RK3368_CLKGATE_CON(20), 15, GFLAGS), 744 + GATE(ACLK_GMAC, "aclk_gmac", "aclk_peri", 0, RK3368_CLKGATE_CON(20), 13, GFLAGS), 745 + GATE(0, "aclk_peri_niu", "aclk_peri", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(20), 8, GFLAGS), 746 + GATE(ACLK_PERI_MMU, "aclk_peri_mmu", "aclk_peri", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(21), 4, GFLAGS), 747 + 748 + /* hclk_peri gates */ 749 + GATE(0, "hclk_peri_axi_matrix", "hclk_peri", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(19), 0, GFLAGS), 750 + GATE(HCLK_NANDC0, "hclk_nandc0", "hclk_peri", 0, RK3368_CLKGATE_CON(20), 11, GFLAGS), 751 + GATE(0, "hclk_mmc_peri", "hclk_peri", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(20), 10, GFLAGS), 752 + GATE(0, "hclk_emem_peri", "hclk_peri", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(20), 9, GFLAGS), 753 + GATE(0, "hclk_peri_ahb_arbi", "hclk_peri", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(20), 7, GFLAGS), 754 + GATE(0, "hclk_usb_peri", "hclk_peri", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(20), 6, GFLAGS), 755 + GATE(HCLK_HSIC, "hclk_hsic", "hclk_peri", 0, RK3368_CLKGATE_CON(20), 5, GFLAGS), 756 + GATE(HCLK_HOST1, "hclk_host1", "hclk_peri", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(20), 4, GFLAGS), 757 + GATE(HCLK_HOST0, "hclk_host0", "hclk_peri", 0, RK3368_CLKGATE_CON(20), 3, GFLAGS), 758 + GATE(0, "pmu_hclk_otg0", "hclk_peri", 0, RK3368_CLKGATE_CON(20), 2, GFLAGS), 759 + GATE(HCLK_OTG0, "hclk_otg0", "hclk_peri", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(20), 1, GFLAGS), 760 + GATE(HCLK_HSADC, "hclk_hsadc", "hclk_peri", 0, RK3368_CLKGATE_CON(21), 3, GFLAGS), 761 + GATE(HCLK_EMMC, "hclk_emmc", "hclk_peri", 0, RK3368_CLKGATE_CON(21), 2, GFLAGS), 762 + GATE(HCLK_SDIO0, "hclk_sdio0", "hclk_peri", 0, RK3368_CLKGATE_CON(21), 1, GFLAGS), 763 + GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_peri", 0, RK3368_CLKGATE_CON(21), 0, GFLAGS), 764 + 765 + /* pclk_peri gates */ 766 + GATE(PCLK_SARADC, "pclk_saradc", "pclk_peri", 0, RK3368_CLKGATE_CON(19), 15, GFLAGS), 767 + GATE(PCLK_I2C5, "pclk_i2c5", "pclk_peri", 0, RK3368_CLKGATE_CON(19), 14, GFLAGS), 768 + GATE(PCLK_I2C4, "pclk_i2c4", "pclk_peri", 0, RK3368_CLKGATE_CON(19), 13, GFLAGS), 769 + GATE(PCLK_I2C3, "pclk_i2c3", "pclk_peri", 0, RK3368_CLKGATE_CON(19), 12, GFLAGS), 770 + GATE(PCLK_I2C2, "pclk_i2c2", "pclk_peri", 0, RK3368_CLKGATE_CON(19), 11, GFLAGS), 771 + GATE(PCLK_UART4, "pclk_uart4", "pclk_peri", 0, RK3368_CLKGATE_CON(19), 10, GFLAGS), 772 + GATE(PCLK_UART3, "pclk_uart3", "pclk_peri", 0, RK3368_CLKGATE_CON(19), 9, GFLAGS), 773 + GATE(PCLK_UART1, "pclk_uart1", "pclk_peri", 0, RK3368_CLKGATE_CON(19), 8, GFLAGS), 774 + GATE(PCLK_UART0, "pclk_uart0", "pclk_peri", 0, RK3368_CLKGATE_CON(19), 7, GFLAGS), 775 + GATE(PCLK_SPI2, "pclk_spi2", "pclk_peri", 0, RK3368_CLKGATE_CON(19), 6, GFLAGS), 776 + GATE(PCLK_SPI1, "pclk_spi1", "pclk_peri", 0, RK3368_CLKGATE_CON(19), 5, GFLAGS), 777 + GATE(PCLK_SPI0, "pclk_spi0", "pclk_peri", 0, RK3368_CLKGATE_CON(19), 4, GFLAGS), 778 + GATE(0, "pclk_peri_axi_matrix", "pclk_peri", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(19), 1, GFLAGS), 779 + GATE(PCLK_GMAC, "pclk_gmac", "pclk_peri", 0, RK3368_CLKGATE_CON(20), 14, GFLAGS), 780 + GATE(PCLK_TSADC, "pclk_tsadc", "pclk_peri", 0, RK3368_CLKGATE_CON(20), 0, GFLAGS), 781 + 782 + /* pclk_pd_alive gates */ 783 + GATE(PCLK_TIMER1, "pclk_timer1", "pclk_pd_alive", 0, RK3368_CLKGATE_CON(14), 8, GFLAGS), 784 + GATE(PCLK_TIMER0, "pclk_timer0", "pclk_pd_alive", 0, RK3368_CLKGATE_CON(14), 7, GFLAGS), 785 + GATE(0, "pclk_alive_niu", "pclk_pd_alive", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(14), 12, GFLAGS), 786 + GATE(PCLK_GRF, "pclk_grf", "pclk_pd_alive", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(14), 11, GFLAGS), 787 + GATE(PCLK_GPIO3, "pclk_gpio3", "pclk_pd_alive", 0, RK3368_CLKGATE_CON(14), 3, GFLAGS), 788 + GATE(PCLK_GPIO2, "pclk_gpio2", "pclk_pd_alive", 0, RK3368_CLKGATE_CON(14), 2, GFLAGS), 789 + GATE(PCLK_GPIO1, "pclk_gpio1", "pclk_pd_alive", 0, RK3368_CLKGATE_CON(14), 1, GFLAGS), 790 + 791 + /* 792 + * pclk_vio gates 793 + * pclk_vio comes from the exactly same source as hclk_vio 794 + */ 795 + GATE(0, "pclk_dphyrx", "hclk_vio", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(14), 8, GFLAGS), 796 + GATE(0, "pclk_dphytx", "hclk_vio", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(14), 8, GFLAGS), 797 + 798 + /* pclk_pd_pmu gates */ 799 + GATE(PCLK_PMUGRF, "pclk_pmugrf", "pclk_pd_pmu", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(17), 0, GFLAGS), 800 + GATE(PCLK_GPIO0, "pclk_gpio0", "pclk_pd_pmu", 0, RK3368_CLKGATE_CON(17), 4, GFLAGS), 801 + GATE(PCLK_SGRF, "pclk_sgrf", "pclk_pd_pmu", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(17), 3, GFLAGS), 802 + GATE(0, "pclk_pmu_noc", "pclk_pd_pmu", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(17), 2, GFLAGS), 803 + GATE(0, "pclk_intmem1", "pclk_pd_pmu", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(17), 1, GFLAGS), 804 + GATE(PCLK_PMU, "pclk_pmu", "pclk_pd_pmu", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(17), 2, GFLAGS), 805 + 806 + /* timer gates */ 807 + GATE(0, "sclk_timer15", "xin24m", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(24), 11, GFLAGS), 808 + GATE(0, "sclk_timer14", "xin24m", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(24), 10, GFLAGS), 809 + GATE(0, "sclk_timer13", "xin24m", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(24), 9, GFLAGS), 810 + GATE(0, "sclk_timer12", "xin24m", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(24), 8, GFLAGS), 811 + GATE(0, "sclk_timer11", "xin24m", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(24), 7, GFLAGS), 812 + GATE(0, "sclk_timer10", "xin24m", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(24), 6, GFLAGS), 813 + GATE(0, "sclk_timer05", "xin24m", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(24), 5, GFLAGS), 814 + GATE(0, "sclk_timer04", "xin24m", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(24), 4, GFLAGS), 815 + GATE(0, "sclk_timer03", "xin24m", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(24), 3, GFLAGS), 816 + GATE(0, "sclk_timer02", "xin24m", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(24), 2, GFLAGS), 817 + GATE(0, "sclk_timer01", "xin24m", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(24), 1, GFLAGS), 818 + GATE(0, "sclk_timer00", "xin24m", CLK_IGNORE_UNUSED, RK3368_CLKGATE_CON(24), 0, GFLAGS), 819 + }; 820 + 821 + static void __init rk3368_clk_init(struct device_node *np) 822 + { 823 + void __iomem *reg_base; 824 + struct clk *clk; 825 + 826 + reg_base = of_iomap(np, 0); 827 + if (!reg_base) { 828 + pr_err("%s: could not map cru region\n", __func__); 829 + return; 830 + } 831 + 832 + rockchip_clk_init(np, reg_base, CLK_NR_CLKS); 833 + 834 + /* xin12m is created by a cru-internal divider */ 835 + clk = clk_register_fixed_factor(NULL, "xin12m", "xin24m", 0, 1, 2); 836 + if (IS_ERR(clk)) 837 + pr_warn("%s: could not register clock xin12m: %ld\n", 838 + __func__, PTR_ERR(clk)); 839 + 840 + /* ddrphy_div4 is created by a cru-internal divider */ 841 + clk = clk_register_fixed_factor(NULL, "ddrphy_div4", "ddrphy_src", 0, 1, 4); 842 + if (IS_ERR(clk)) 843 + pr_warn("%s: could not register clock xin12m: %ld\n", 844 + __func__, PTR_ERR(clk)); 845 + 846 + clk = clk_register_fixed_factor(NULL, "hclk_video_pre", 847 + "hclk_video_pre_v", 0, 1, 4); 848 + if (IS_ERR(clk)) 849 + pr_warn("%s: could not register clock hclk_vcodec_pre: %ld\n", 850 + __func__, PTR_ERR(clk)); 851 + 852 + /* Watchdog pclk is controlled by sgrf_soc_con3[7]. */ 853 + clk = clk_register_fixed_factor(NULL, "pclk_wdt", "pclk_pd_alive", 0, 1, 1); 854 + if (IS_ERR(clk)) 855 + pr_warn("%s: could not register clock pclk_wdt: %ld\n", 856 + __func__, PTR_ERR(clk)); 857 + else 858 + rockchip_clk_add_lookup(clk, PCLK_WDT); 859 + 860 + rockchip_clk_register_plls(rk3368_pll_clks, 861 + ARRAY_SIZE(rk3368_pll_clks), 862 + RK3368_GRF_SOC_STATUS0); 863 + rockchip_clk_register_branches(rk3368_clk_branches, 864 + ARRAY_SIZE(rk3368_clk_branches)); 865 + 866 + rockchip_clk_register_armclk(ARMCLKB, "armclkb", 867 + mux_armclkb_p, ARRAY_SIZE(mux_armclkb_p), 868 + &rk3368_cpuclkb_data, rk3368_cpuclkb_rates, 869 + ARRAY_SIZE(rk3368_cpuclkb_rates)); 870 + 871 + rockchip_clk_register_armclk(ARMCLKL, "armclkl", 872 + mux_armclkl_p, ARRAY_SIZE(mux_armclkl_p), 873 + &rk3368_cpuclkl_data, rk3368_cpuclkl_rates, 874 + ARRAY_SIZE(rk3368_cpuclkl_rates)); 875 + 876 + rockchip_register_softrst(np, 15, reg_base + RK3368_SOFTRST_CON(0), 877 + ROCKCHIP_SOFTRST_HIWORD_MASK); 878 + 879 + rockchip_register_restart_notifier(RK3368_GLB_SRST_FST); 880 + } 881 + CLK_OF_DECLARE(rk3368_cru, "rockchip,rk3368-cru", rk3368_clk_init);
+7
drivers/clk/rockchip/clk.c
··· 277 277 list->div_shift 278 278 ); 279 279 break; 280 + case branch_inverter: 281 + clk = rockchip_clk_register_inverter( 282 + list->name, list->parent_names, 283 + list->num_parents, 284 + reg_base + list->muxdiv_offset, 285 + list->div_shift, list->div_flags, &clk_lock); 286 + break; 280 287 } 281 288 282 289 /* none of the cases above matched */
+64 -8
drivers/clk/rockchip/clk.h
··· 31 31 ((val) << (shift) | (mask) << ((shift) + 16)) 32 32 33 33 /* register positions shared by RK2928, RK3066 and RK3188 */ 34 - #define RK2928_PLL_CON(x) (x * 0x4) 34 + #define RK2928_PLL_CON(x) ((x) * 0x4) 35 35 #define RK2928_MODE_CON 0x40 36 - #define RK2928_CLKSEL_CON(x) (x * 0x4 + 0x44) 37 - #define RK2928_CLKGATE_CON(x) (x * 0x4 + 0xd0) 36 + #define RK2928_CLKSEL_CON(x) ((x) * 0x4 + 0x44) 37 + #define RK2928_CLKGATE_CON(x) ((x) * 0x4 + 0xd0) 38 38 #define RK2928_GLB_SRST_FST 0x100 39 39 #define RK2928_GLB_SRST_SND 0x104 40 - #define RK2928_SOFTRST_CON(x) (x * 0x4 + 0x110) 40 + #define RK2928_SOFTRST_CON(x) ((x) * 0x4 + 0x110) 41 41 #define RK2928_MISC_CON 0x134 42 42 43 43 #define RK3288_PLL_CON(x) RK2928_PLL_CON(x) 44 44 #define RK3288_MODE_CON 0x50 45 - #define RK3288_CLKSEL_CON(x) (x * 0x4 + 0x60) 46 - #define RK3288_CLKGATE_CON(x) (x * 0x4 + 0x160) 45 + #define RK3288_CLKSEL_CON(x) ((x) * 0x4 + 0x60) 46 + #define RK3288_CLKGATE_CON(x) ((x) * 0x4 + 0x160) 47 47 #define RK3288_GLB_SRST_FST 0x1b0 48 48 #define RK3288_GLB_SRST_SND 0x1b4 49 - #define RK3288_SOFTRST_CON(x) (x * 0x4 + 0x1b8) 49 + #define RK3288_SOFTRST_CON(x) ((x) * 0x4 + 0x1b8) 50 50 #define RK3288_MISC_CON 0x1e8 51 51 #define RK3288_SDMMC_CON0 0x200 52 52 #define RK3288_SDMMC_CON1 0x204 ··· 56 56 #define RK3288_SDIO1_CON1 0x214 57 57 #define RK3288_EMMC_CON0 0x218 58 58 #define RK3288_EMMC_CON1 0x21c 59 + 60 + #define RK3368_PLL_CON(x) RK2928_PLL_CON(x) 61 + #define RK3368_CLKSEL_CON(x) ((x) * 0x4 + 0x100) 62 + #define RK3368_CLKGATE_CON(x) ((x) * 0x4 + 0x200) 63 + #define RK3368_GLB_SRST_FST 0x280 64 + #define RK3368_GLB_SRST_SND 0x284 65 + #define RK3368_SOFTRST_CON(x) ((x) * 0x4 + 0x300) 66 + #define RK3368_MISC_CON 0x380 67 + #define RK3368_SDMMC_CON0 0x400 68 + #define RK3368_SDMMC_CON1 0x404 69 + #define RK3368_SDIO0_CON0 0x408 70 + #define RK3368_SDIO0_CON1 0x40c 71 + #define RK3368_SDIO1_CON0 0x410 72 + #define RK3368_SDIO1_CON1 0x414 73 + #define RK3368_EMMC_CON0 0x418 74 + #define RK3368_EMMC_CON1 0x41c 59 75 60 76 enum rockchip_pll_type { 61 77 pll_rk3066, ··· 83 67 .nr = _nr, \ 84 68 .nf = _nf, \ 85 69 .no = _no, \ 86 - .bwadj = (_nf >> 1), \ 70 + .bwadj = ((_nf) >> 1), \ 87 71 } 88 72 89 73 #define RK3066_PLL_RATE_BWADJ(_rate, _nr, _nf, _no, _bw) \ ··· 198 182 const char *const *parent_names, u8 num_parents, 199 183 void __iomem *reg, int shift); 200 184 185 + #define ROCKCHIP_INVERTER_HIWORD_MASK BIT(0) 186 + 187 + struct clk *rockchip_clk_register_inverter(const char *name, 188 + const char *const *parent_names, u8 num_parents, 189 + void __iomem *reg, int shift, int flags, 190 + spinlock_t *lock); 191 + 201 192 #define PNAME(x) static const char *const x[] __initconst 202 193 203 194 enum rockchip_clk_branch_type { ··· 214 191 branch_fraction_divider, 215 192 branch_gate, 216 193 branch_mmc, 194 + branch_inverter, 217 195 }; 218 196 219 197 struct rockchip_clk_branch { ··· 332 308 .gate_offset = -1, \ 333 309 } 334 310 311 + #define COMPOSITE_NOGATE_DIVTBL(_id, cname, pnames, f, mo, ms, \ 312 + mw, mf, ds, dw, df, dt) \ 313 + { \ 314 + .id = _id, \ 315 + .branch_type = branch_composite, \ 316 + .name = cname, \ 317 + .parent_names = pnames, \ 318 + .num_parents = ARRAY_SIZE(pnames), \ 319 + .flags = f, \ 320 + .muxdiv_offset = mo, \ 321 + .mux_shift = ms, \ 322 + .mux_width = mw, \ 323 + .mux_flags = mf, \ 324 + .div_shift = ds, \ 325 + .div_width = dw, \ 326 + .div_flags = df, \ 327 + .div_table = dt, \ 328 + .gate_offset = -1, \ 329 + } 330 + 335 331 #define COMPOSITE_FRAC(_id, cname, pname, f, mo, df, go, gs, gf)\ 336 332 { \ 337 333 .id = _id, \ ··· 436 392 .num_parents = 1, \ 437 393 .muxdiv_offset = offset, \ 438 394 .div_shift = shift, \ 395 + } 396 + 397 + #define INVERTER(_id, cname, pname, io, is, if) \ 398 + { \ 399 + .id = _id, \ 400 + .branch_type = branch_inverter, \ 401 + .name = cname, \ 402 + .parent_names = (const char *[]){ pname }, \ 403 + .num_parents = 1, \ 404 + .muxdiv_offset = io, \ 405 + .div_shift = is, \ 406 + .div_flags = if, \ 439 407 } 440 408 441 409 void rockchip_clk_init(struct device_node *np, void __iomem *base,
+5
include/dt-bindings/clock/rk3066a-cru.h
··· 13 13 * GNU General Public License for more details. 14 14 */ 15 15 16 + #ifndef _DT_BINDINGS_CLK_ROCKCHIP_RK3066A_H 17 + #define _DT_BINDINGS_CLK_ROCKCHIP_RK3066A_H 18 + 16 19 #include <dt-bindings/clock/rk3188-cru-common.h> 17 20 18 21 /* soft-reset indices */ ··· 36 33 #define SRST_HDMI 96 37 34 #define SRST_HDMI_APB 97 38 35 #define SRST_CIF1 111 36 + 37 + #endif
+5
include/dt-bindings/clock/rk3188-cru-common.h
··· 13 13 * GNU General Public License for more details. 14 14 */ 15 15 16 + #ifndef _DT_BINDINGS_CLK_ROCKCHIP_RK3188_COMMON_H 17 + #define _DT_BINDINGS_CLK_ROCKCHIP_RK3188_COMMON_H 18 + 16 19 /* core clocks from */ 17 20 #define PLL_APLL 1 18 21 #define PLL_DPLL 2 ··· 251 248 #define SRST_PTM1_ATB 141 252 249 #define SRST_CTM 142 253 250 #define SRST_TS 143 251 + 252 + #endif
+5
include/dt-bindings/clock/rk3188-cru.h
··· 13 13 * GNU General Public License for more details. 14 14 */ 15 15 16 + #ifndef _DT_BINDINGS_CLK_ROCKCHIP_RK3188_H 17 + #define _DT_BINDINGS_CLK_ROCKCHIP_RK3188_H 18 + 16 19 #include <dt-bindings/clock/rk3188-cru-common.h> 17 20 18 21 /* soft-reset indices */ ··· 52 49 #define SRST_GPU_BRIDGE 121 53 50 #define SRST_CTI3 123 54 51 #define SRST_CTI3_APB 124 52 + 53 + #endif
+5
include/dt-bindings/clock/rk3288-cru.h
··· 13 13 * GNU General Public License for more details. 14 14 */ 15 15 16 + #ifndef _DT_BINDINGS_CLK_ROCKCHIP_RK3288_H 17 + #define _DT_BINDINGS_CLK_ROCKCHIP_RK3288_H 18 + 16 19 /* core clocks */ 17 20 #define PLL_APLL 1 18 21 #define PLL_DPLL 2 ··· 379 376 #define SRST_TSP_CLKIN0 189 380 377 #define SRST_TSP_CLKIN1 190 381 378 #define SRST_TSP_27M 191 379 + 380 + #endif
+384
include/dt-bindings/clock/rk3368-cru.h
··· 1 + /* 2 + * Copyright (c) 2015 Heiko Stuebner <heiko@sntech.de> 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + * This program is distributed in the hope that it will be useful, 10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 + * GNU General Public License for more details. 13 + */ 14 + 15 + #ifndef _DT_BINDINGS_CLK_ROCKCHIP_RK3368_H 16 + #define _DT_BINDINGS_CLK_ROCKCHIP_RK3368_H 17 + 18 + /* core clocks */ 19 + #define PLL_APLLB 1 20 + #define PLL_APLLL 2 21 + #define PLL_DPLL 3 22 + #define PLL_CPLL 4 23 + #define PLL_GPLL 5 24 + #define PLL_NPLL 6 25 + #define ARMCLKB 7 26 + #define ARMCLKL 8 27 + 28 + /* sclk gates (special clocks) */ 29 + #define SCLK_GPU_CORE 64 30 + #define SCLK_SPI0 65 31 + #define SCLK_SPI1 66 32 + #define SCLK_SPI2 67 33 + #define SCLK_SDMMC 68 34 + #define SCLK_SDIO0 69 35 + #define SCLK_EMMC 71 36 + #define SCLK_TSADC 72 37 + #define SCLK_SARADC 73 38 + #define SCLK_NANDC0 75 39 + #define SCLK_UART0 77 40 + #define SCLK_UART1 78 41 + #define SCLK_UART2 79 42 + #define SCLK_UART3 80 43 + #define SCLK_UART4 81 44 + #define SCLK_I2S_8CH 82 45 + #define SCLK_SPDIF_8CH 83 46 + #define SCLK_I2S_2CH 84 47 + #define SCLK_TIMER0 85 48 + #define SCLK_TIMER1 86 49 + #define SCLK_TIMER2 87 50 + #define SCLK_TIMER3 88 51 + #define SCLK_TIMER4 89 52 + #define SCLK_TIMER5 90 53 + #define SCLK_TIMER6 91 54 + #define SCLK_OTGPHY0 93 55 + #define SCLK_OTG_ADP 96 56 + #define SCLK_HSICPHY480M 97 57 + #define SCLK_HSICPHY12M 98 58 + #define SCLK_MACREF 99 59 + #define SCLK_VOP0_PWM 100 60 + #define SCLK_MAC_RX 102 61 + #define SCLK_MAC_TX 103 62 + #define SCLK_EDP_24M 104 63 + #define SCLK_EDP 105 64 + #define SCLK_RGA 106 65 + #define SCLK_ISP 107 66 + #define SCLK_HDCP 108 67 + #define SCLK_HDMI_HDCP 109 68 + #define SCLK_HDMI_CEC 110 69 + #define SCLK_HEVC_CABAC 111 70 + #define SCLK_HEVC_CORE 112 71 + #define SCLK_I2S_8CH_OUT 113 72 + #define SCLK_SDMMC_DRV 114 73 + #define SCLK_SDIO0_DRV 115 74 + #define SCLK_EMMC_DRV 117 75 + #define SCLK_SDMMC_SAMPLE 118 76 + #define SCLK_SDIO0_SAMPLE 119 77 + #define SCLK_EMMC_SAMPLE 121 78 + #define SCLK_USBPHY480M 122 79 + #define SCLK_PVTM_CORE 123 80 + #define SCLK_PVTM_GPU 124 81 + #define SCLK_PVTM_PMU 125 82 + #define SCLK_SFC 126 83 + #define SCLK_MAC 127 84 + #define SCLK_MACREF_OUT 128 85 + 86 + #define DCLK_VOP 190 87 + #define MCLK_CRYPTO 191 88 + 89 + /* aclk gates */ 90 + #define ACLK_GPU_MEM 192 91 + #define ACLK_GPU_CFG 193 92 + #define ACLK_DMAC_BUS 194 93 + #define ACLK_DMAC_PERI 195 94 + #define ACLK_PERI_MMU 196 95 + #define ACLK_GMAC 197 96 + #define ACLK_VOP 198 97 + #define ACLK_VOP_IEP 199 98 + #define ACLK_RGA 200 99 + #define ACLK_HDCP 201 100 + #define ACLK_IEP 202 101 + #define ACLK_VIO0_NOC 203 102 + #define ACLK_VIP 204 103 + #define ACLK_ISP 205 104 + #define ACLK_VIO1_NOC 206 105 + #define ACLK_VIDEO 208 106 + #define ACLK_BUS 209 107 + #define ACLK_PERI 210 108 + 109 + /* pclk gates */ 110 + #define PCLK_GPIO0 320 111 + #define PCLK_GPIO1 321 112 + #define PCLK_GPIO2 322 113 + #define PCLK_GPIO3 323 114 + #define PCLK_PMUGRF 324 115 + #define PCLK_MAILBOX 325 116 + #define PCLK_GRF 329 117 + #define PCLK_SGRF 330 118 + #define PCLK_PMU 331 119 + #define PCLK_I2C0 332 120 + #define PCLK_I2C1 333 121 + #define PCLK_I2C2 334 122 + #define PCLK_I2C3 335 123 + #define PCLK_I2C4 336 124 + #define PCLK_I2C5 337 125 + #define PCLK_SPI0 338 126 + #define PCLK_SPI1 339 127 + #define PCLK_SPI2 340 128 + #define PCLK_UART0 341 129 + #define PCLK_UART1 342 130 + #define PCLK_UART2 343 131 + #define PCLK_UART3 344 132 + #define PCLK_UART4 345 133 + #define PCLK_TSADC 346 134 + #define PCLK_SARADC 347 135 + #define PCLK_SIM 348 136 + #define PCLK_GMAC 349 137 + #define PCLK_PWM0 350 138 + #define PCLK_PWM1 351 139 + #define PCLK_TIMER0 353 140 + #define PCLK_TIMER1 354 141 + #define PCLK_EDP_CTRL 355 142 + #define PCLK_MIPI_DSI0 356 143 + #define PCLK_MIPI_CSI 358 144 + #define PCLK_HDCP 359 145 + #define PCLK_HDMI_CTRL 360 146 + #define PCLK_VIO_H2P 361 147 + #define PCLK_BUS 362 148 + #define PCLK_PERI 363 149 + #define PCLK_DDRUPCTL 364 150 + #define PCLK_DDRPHY 365 151 + #define PCLK_ISP 366 152 + #define PCLK_VIP 367 153 + #define PCLK_WDT 368 154 + 155 + /* hclk gates */ 156 + #define HCLK_SFC 448 157 + #define HCLK_OTG0 449 158 + #define HCLK_HOST0 450 159 + #define HCLK_HOST1 451 160 + #define HCLK_HSIC 452 161 + #define HCLK_NANDC0 453 162 + #define HCLK_TSP 455 163 + #define HCLK_SDMMC 456 164 + #define HCLK_SDIO0 457 165 + #define HCLK_EMMC 459 166 + #define HCLK_HSADC 460 167 + #define HCLK_CRYPTO 461 168 + #define HCLK_I2S_2CH 462 169 + #define HCLK_I2S_8CH 463 170 + #define HCLK_SPDIF 464 171 + #define HCLK_VOP 465 172 + #define HCLK_ROM 467 173 + #define HCLK_IEP 468 174 + #define HCLK_ISP 469 175 + #define HCLK_RGA 470 176 + #define HCLK_VIO_AHB_ARBI 471 177 + #define HCLK_VIO_NOC 472 178 + #define HCLK_VIP 473 179 + #define HCLK_VIO_H2P 474 180 + #define HCLK_VIO_HDCPMMU 475 181 + #define HCLK_VIDEO 476 182 + #define HCLK_BUS 477 183 + #define HCLK_PERI 478 184 + 185 + #define CLK_NR_CLKS (HCLK_PERI + 1) 186 + 187 + /* soft-reset indices */ 188 + #define SRST_CORE_B0 0 189 + #define SRST_CORE_B1 1 190 + #define SRST_CORE_B2 2 191 + #define SRST_CORE_B3 3 192 + #define SRST_CORE_B0_PO 4 193 + #define SRST_CORE_B1_PO 5 194 + #define SRST_CORE_B2_PO 6 195 + #define SRST_CORE_B3_PO 7 196 + #define SRST_L2_B 8 197 + #define SRST_ADB_B 9 198 + #define SRST_PD_CORE_B_NIU 10 199 + #define SRST_PDBUS_STRSYS 11 200 + #define SRST_SOCDBG_B 14 201 + #define SRST_CORE_B_DBG 15 202 + 203 + #define SRST_DMAC1 18 204 + #define SRST_INTMEM 19 205 + #define SRST_ROM 20 206 + #define SRST_SPDIF8CH 21 207 + #define SRST_I2S8CH 23 208 + #define SRST_MAILBOX 24 209 + #define SRST_I2S2CH 25 210 + #define SRST_EFUSE_256 26 211 + #define SRST_MCU_SYS 28 212 + #define SRST_MCU_PO 29 213 + #define SRST_MCU_NOC 30 214 + #define SRST_EFUSE 31 215 + 216 + #define SRST_GPIO0 32 217 + #define SRST_GPIO1 33 218 + #define SRST_GPIO2 34 219 + #define SRST_GPIO3 35 220 + #define SRST_GPIO4 36 221 + #define SRST_PMUGRF 41 222 + #define SRST_I2C0 42 223 + #define SRST_I2C1 43 224 + #define SRST_I2C2 44 225 + #define SRST_I2C3 45 226 + #define SRST_I2C4 46 227 + #define SRST_I2C5 47 228 + 229 + #define SRST_DWPWM 48 230 + #define SRST_MMC_PERI 49 231 + #define SRST_PERIPH_MMU 50 232 + #define SRST_GRF 55 233 + #define SRST_PMU 56 234 + #define SRST_PERIPH_AXI 57 235 + #define SRST_PERIPH_AHB 58 236 + #define SRST_PERIPH_APB 59 237 + #define SRST_PERIPH_NIU 60 238 + #define SRST_PDPERI_AHB_ARBI 61 239 + #define SRST_EMEM 62 240 + #define SRST_USB_PERI 63 241 + 242 + #define SRST_DMAC2 64 243 + #define SRST_MAC 66 244 + #define SRST_GPS 67 245 + #define SRST_RKPWM 69 246 + #define SRST_USBHOST0 72 247 + #define SRST_HSIC 73 248 + #define SRST_HSIC_AUX 74 249 + #define SRST_HSIC_PHY 75 250 + #define SRST_HSADC 76 251 + #define SRST_NANDC0 77 252 + #define SRST_SFC 79 253 + 254 + #define SRST_SPI0 83 255 + #define SRST_SPI1 84 256 + #define SRST_SPI2 85 257 + #define SRST_SARADC 87 258 + #define SRST_PDALIVE_NIU 88 259 + #define SRST_PDPMU_INTMEM 89 260 + #define SRST_PDPMU_NIU 90 261 + #define SRST_SGRF 91 262 + 263 + #define SRST_VIO_ARBI 96 264 + #define SRST_RGA_NIU 97 265 + #define SRST_VIO0_NIU_AXI 98 266 + #define SRST_VIO_NIU_AHB 99 267 + #define SRST_LCDC0_AXI 100 268 + #define SRST_LCDC0_AHB 101 269 + #define SRST_LCDC0_DCLK 102 270 + #define SRST_VIP 104 271 + #define SRST_RGA_CORE 105 272 + #define SRST_IEP_AXI 106 273 + #define SRST_IEP_AHB 107 274 + #define SRST_RGA_AXI 108 275 + #define SRST_RGA_AHB 109 276 + #define SRST_ISP 110 277 + #define SRST_EDP_24M 111 278 + 279 + #define SRST_VIDEO_AXI 112 280 + #define SRST_VIDEO_AHB 113 281 + #define SRST_MIPIDPHYTX 114 282 + #define SRST_MIPIDSI0 115 283 + #define SRST_MIPIDPHYRX 116 284 + #define SRST_MIPICSI 117 285 + #define SRST_GPU 120 286 + #define SRST_HDMI 121 287 + #define SRST_EDP 122 288 + #define SRST_PMU_PVTM 123 289 + #define SRST_CORE_PVTM 124 290 + #define SRST_GPU_PVTM 125 291 + #define SRST_GPU_SYS 126 292 + #define SRST_GPU_MEM_NIU 127 293 + 294 + #define SRST_MMC0 128 295 + #define SRST_SDIO0 129 296 + #define SRST_EMMC 131 297 + #define SRST_USBOTG_AHB 132 298 + #define SRST_USBOTG_PHY 133 299 + #define SRST_USBOTG_CON 134 300 + #define SRST_USBHOST0_AHB 135 301 + #define SRST_USBHOST0_PHY 136 302 + #define SRST_USBHOST0_CON 137 303 + #define SRST_USBOTG_UTMI 138 304 + #define SRST_USBHOST1_UTMI 139 305 + #define SRST_USB_ADP 141 306 + 307 + #define SRST_CORESIGHT 144 308 + #define SRST_PD_CORE_AHB_NOC 145 309 + #define SRST_PD_CORE_APB_NOC 146 310 + #define SRST_GIC 148 311 + #define SRST_LCDC_PWM0 149 312 + #define SRST_RGA_H2P_BRG 153 313 + #define SRST_VIDEO 154 314 + #define SRST_GPU_CFG_NIU 157 315 + #define SRST_TSADC 159 316 + 317 + #define SRST_DDRPHY0 160 318 + #define SRST_DDRPHY0_APB 161 319 + #define SRST_DDRCTRL0 162 320 + #define SRST_DDRCTRL0_APB 163 321 + #define SRST_VIDEO_NIU 165 322 + #define SRST_VIDEO_NIU_AHB 167 323 + #define SRST_DDRMSCH0 170 324 + #define SRST_PDBUS_AHB 173 325 + #define SRST_CRYPTO 174 326 + 327 + #define SRST_UART0 179 328 + #define SRST_UART1 180 329 + #define SRST_UART2 181 330 + #define SRST_UART3 182 331 + #define SRST_UART4 183 332 + #define SRST_SIMC 186 333 + #define SRST_TSP 188 334 + #define SRST_TSP_CLKIN0 189 335 + 336 + #define SRST_CORE_L0 192 337 + #define SRST_CORE_L1 193 338 + #define SRST_CORE_L2 194 339 + #define SRST_CORE_L3 195 340 + #define SRST_CORE_L0_PO 195 341 + #define SRST_CORE_L1_PO 197 342 + #define SRST_CORE_L2_PO 198 343 + #define SRST_CORE_L3_PO 199 344 + #define SRST_L2_L 200 345 + #define SRST_ADB_L 201 346 + #define SRST_PD_CORE_L_NIU 202 347 + #define SRST_CCI_SYS 203 348 + #define SRST_CCI_DDR 204 349 + #define SRST_CCI 205 350 + #define SRST_SOCDBG_L 206 351 + #define SRST_CORE_L_DBG 207 352 + 353 + #define SRST_CORE_B0_NC 208 354 + #define SRST_CORE_B0_PO_NC 209 355 + #define SRST_L2_B_NC 210 356 + #define SRST_ADB_B_NC 211 357 + #define SRST_PD_CORE_B_NIU_NC 212 358 + #define SRST_PDBUS_STRSYS_NC 213 359 + #define SRST_CORE_L0_NC 214 360 + #define SRST_CORE_L0_PO_NC 215 361 + #define SRST_L2_L_NC 216 362 + #define SRST_ADB_L_NC 217 363 + #define SRST_PD_CORE_L_NIU_NC 218 364 + #define SRST_CCI_SYS_NC 219 365 + #define SRST_CCI_DDR_NC 220 366 + #define SRST_CCI_NC 221 367 + #define SRST_TRACE_NC 222 368 + 369 + #define SRST_TIMER00 224 370 + #define SRST_TIMER01 225 371 + #define SRST_TIMER02 226 372 + #define SRST_TIMER03 227 373 + #define SRST_TIMER04 228 374 + #define SRST_TIMER05 229 375 + #define SRST_TIMER10 230 376 + #define SRST_TIMER11 231 377 + #define SRST_TIMER12 232 378 + #define SRST_TIMER13 233 379 + #define SRST_TIMER14 234 380 + #define SRST_TIMER15 235 381 + #define SRST_TIMER0_APB 236 382 + #define SRST_TIMER1_APB 237 383 + 384 + #endif