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

Merge tag 'v4.11-rockchip-clk1' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip into clk-next

Pull Rockchip clk updates from Heiko Stuebner:

A new clock-type for the 1-2 muxes per soc that are for whatever reason
controlled through the General Register Files, support for the rk3328
clock-controller (including a new pll-type) and the usual clock ids and
some fixes.

* tag 'v4.11-rockchip-clk1' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip:
dt-bindings: clk: add rockchip,grf property for RK3399
clk: rockchip: use clock ids for memory controller parts on rk3066/rk3188
clk: rockchip: use rk3288 isp_in clock ids
clk: rockchip: add clock ids for memory controller parts on rk3066/rk3188
clk: rockchip: add rk3288 isp_in clock ids
clk: rockchip: Remove useless init of "grf" to -EPROBE_DEFER
clk: rockchip: add clock controller for rk3328
dt-bindings: add bindings for rk3328 clock controller
clk: rockchip: add dt-binding header for rk3328
clk: rockchip: add new pll-type for rk3328
clk: rockchip: describe aclk_vcodec using the new muxgrf type on rk3288
clk: rockchip: add a clock-type for muxes based in the grf

+1533 -13
+57
Documentation/devicetree/bindings/clock/rockchip,rk3328-cru.txt
··· 1 + * Rockchip RK3328 Clock and Reset Unit 2 + 3 + The RK3328 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,rk3328-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/rk3328-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 + - "clkin_i2s" - external I2S clock - optional, 33 + - "gmac_clkin" - external GMAC clock - optional 34 + - "phy_50m_out" - output clock of the pll in the mac phy 35 + 36 + Example: Clock controller node: 37 + 38 + cru: clock-controller@ff440000 { 39 + compatible = "rockchip,rk3328-cru"; 40 + reg = <0x0 0xff440000 0x0 0x1000>; 41 + rockchip,grf = <&grf>; 42 + 43 + #clock-cells = <1>; 44 + #reset-cells = <1>; 45 + }; 46 + 47 + Example: UART controller node that consumes the clock generated by the clock 48 + controller: 49 + 50 + uart0: serial@ff120000 { 51 + compatible = "snps,dw-apb-uart"; 52 + reg = <0xff120000 0x100>; 53 + interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>; 54 + reg-shift = <2>; 55 + reg-io-width = <4>; 56 + clocks = <&cru SCLK_UART0>; 57 + };
+6
Documentation/devicetree/bindings/clock/rockchip,rk3399-cru.txt
··· 13 13 - #clock-cells: should be 1. 14 14 - #reset-cells: should be 1. 15 15 16 + Optional Properties: 17 + 18 + - rockchip,grf: phandle to the syscon managing the "general register files". 19 + It is used for GRF muxes, if missing any muxes present in the GRF will not 20 + be available. 21 + 16 22 Each clock is assigned an identifier and client nodes can use this identifier 17 23 to specify the clock which they consume. All available clocks are defined as 18 24 preprocessor macros in the dt-bindings/clock/rk3399-cru.h headers and can be
+2
drivers/clk/rockchip/Makefile
··· 8 8 obj-y += clk-cpu.o 9 9 obj-y += clk-inverter.o 10 10 obj-y += clk-mmc-phase.o 11 + obj-y += clk-muxgrf.o 11 12 obj-y += clk-ddr.o 12 13 obj-$(CONFIG_RESET_CONTROLLER) += softrst.o 13 14 ··· 17 16 obj-y += clk-rk3188.o 18 17 obj-y += clk-rk3228.o 19 18 obj-y += clk-rk3288.o 19 + obj-y += clk-rk3328.o 20 20 obj-y += clk-rk3368.o 21 21 obj-y += clk-rk3399.o
+102
drivers/clk/rockchip/clk-muxgrf.c
··· 1 + /* 2 + * 3 + * This software is licensed under the terms of the GNU General Public 4 + * License version 2, as published by the Free Software Foundation, and 5 + * may be copied, distributed, and modified under those terms. 6 + * 7 + * This program is distributed in the hope that it will be useful, 8 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 + * GNU General Public License for more details. 11 + */ 12 + 13 + #include <linux/slab.h> 14 + #include <linux/bitops.h> 15 + #include <linux/regmap.h> 16 + #include <linux/clk.h> 17 + #include <linux/clk-provider.h> 18 + #include "clk.h" 19 + 20 + struct rockchip_muxgrf_clock { 21 + struct clk_hw hw; 22 + struct regmap *regmap; 23 + u32 reg; 24 + u32 shift; 25 + u32 width; 26 + int flags; 27 + }; 28 + 29 + #define to_muxgrf_clock(_hw) container_of(_hw, struct rockchip_muxgrf_clock, hw) 30 + 31 + static u8 rockchip_muxgrf_get_parent(struct clk_hw *hw) 32 + { 33 + struct rockchip_muxgrf_clock *mux = to_muxgrf_clock(hw); 34 + unsigned int mask = GENMASK(mux->width - 1, 0); 35 + unsigned int val; 36 + 37 + regmap_read(mux->regmap, mux->reg, &val); 38 + 39 + val >>= mux->shift; 40 + val &= mask; 41 + 42 + return val; 43 + } 44 + 45 + static int rockchip_muxgrf_set_parent(struct clk_hw *hw, u8 index) 46 + { 47 + struct rockchip_muxgrf_clock *mux = to_muxgrf_clock(hw); 48 + unsigned int mask = GENMASK(mux->width + mux->shift - 1, mux->shift); 49 + unsigned int val; 50 + 51 + val = index; 52 + val <<= mux->shift; 53 + 54 + if (mux->flags & CLK_MUX_HIWORD_MASK) 55 + return regmap_write(mux->regmap, mux->reg, val | (mask << 16)); 56 + else 57 + return regmap_update_bits(mux->regmap, mux->reg, mask, val); 58 + } 59 + 60 + static const struct clk_ops rockchip_muxgrf_clk_ops = { 61 + .get_parent = rockchip_muxgrf_get_parent, 62 + .set_parent = rockchip_muxgrf_set_parent, 63 + .determine_rate = __clk_mux_determine_rate, 64 + }; 65 + 66 + struct clk *rockchip_clk_register_muxgrf(const char *name, 67 + const char *const *parent_names, u8 num_parents, 68 + int flags, struct regmap *regmap, int reg, 69 + int shift, int width, int mux_flags) 70 + { 71 + struct rockchip_muxgrf_clock *muxgrf_clock; 72 + struct clk_init_data init; 73 + struct clk *clk; 74 + 75 + if (IS_ERR(regmap)) { 76 + pr_err("%s: regmap not available\n", __func__); 77 + return ERR_PTR(-ENOTSUPP); 78 + } 79 + 80 + muxgrf_clock = kmalloc(sizeof(*muxgrf_clock), GFP_KERNEL); 81 + if (!muxgrf_clock) 82 + return ERR_PTR(-ENOMEM); 83 + 84 + init.name = name; 85 + init.flags = flags; 86 + init.num_parents = num_parents; 87 + init.parent_names = parent_names; 88 + init.ops = &rockchip_muxgrf_clk_ops; 89 + 90 + muxgrf_clock->hw.init = &init; 91 + muxgrf_clock->regmap = regmap; 92 + muxgrf_clock->reg = reg; 93 + muxgrf_clock->shift = shift; 94 + muxgrf_clock->width = width; 95 + muxgrf_clock->flags = mux_flags; 96 + 97 + clk = clk_register(NULL, &muxgrf_clock->hw); 98 + if (IS_ERR(clk)) 99 + kfree(muxgrf_clock); 100 + 101 + return clk; 102 + }
+13 -3
drivers/clk/rockchip/clk-pll.c
··· 29 29 #define PLL_MODE_SLOW 0x0 30 30 #define PLL_MODE_NORM 0x1 31 31 #define PLL_MODE_DEEP 0x2 32 + #define PLL_RK3328_MODE_MASK 0x1 32 33 33 34 struct rockchip_clk_pll { 34 35 struct clk_hw hw; ··· 849 848 struct clk *pll_clk, *mux_clk; 850 849 char pll_name[20]; 851 850 852 - if (num_parents != 2) { 851 + if ((pll_type != pll_rk3328 && num_parents != 2) || 852 + (pll_type == pll_rk3328 && num_parents != 1)) { 853 853 pr_err("%s: needs two parent clocks\n", __func__); 854 854 return ERR_PTR(-EINVAL); 855 855 } ··· 867 865 pll_mux = &pll->pll_mux; 868 866 pll_mux->reg = ctx->reg_base + mode_offset; 869 867 pll_mux->shift = mode_shift; 870 - pll_mux->mask = PLL_MODE_MASK; 868 + if (pll_type == pll_rk3328) 869 + pll_mux->mask = PLL_RK3328_MODE_MASK; 870 + else 871 + pll_mux->mask = PLL_MODE_MASK; 871 872 pll_mux->flags = 0; 872 873 pll_mux->lock = &ctx->lock; 873 874 pll_mux->hw.init = &init; 874 875 875 876 if (pll_type == pll_rk3036 || 876 877 pll_type == pll_rk3066 || 878 + pll_type == pll_rk3328 || 877 879 pll_type == pll_rk3399) 878 880 pll_mux->flags |= CLK_MUX_HIWORD_MASK; 879 881 ··· 890 884 init.flags = CLK_SET_RATE_PARENT; 891 885 init.ops = pll->pll_mux_ops; 892 886 init.parent_names = pll_parents; 893 - init.num_parents = ARRAY_SIZE(pll_parents); 887 + if (pll_type == pll_rk3328) 888 + init.num_parents = 2; 889 + else 890 + init.num_parents = ARRAY_SIZE(pll_parents); 894 891 895 892 mux_clk = clk_register(NULL, &pll_mux->hw); 896 893 if (IS_ERR(mux_clk)) ··· 927 918 928 919 switch (pll_type) { 929 920 case pll_rk3036: 921 + case pll_rk3328: 930 922 if (!pll->rate_table || IS_ERR(ctx->grf)) 931 923 init.ops = &rockchip_rk3036_pll_clk_norate_ops; 932 924 else
+2 -2
drivers/clk/rockchip/clk-rk3188.c
··· 507 507 GATE(PCLK_GPIO2, "pclk_gpio2", "pclk_cpu", 0, RK2928_CLKGATE_CON(8), 11, GFLAGS), 508 508 GATE(PCLK_EFUSE, "pclk_efuse", "pclk_cpu", 0, RK2928_CLKGATE_CON(5), 2, GFLAGS), 509 509 GATE(PCLK_TZPC, "pclk_tzpc", "pclk_cpu", 0, RK2928_CLKGATE_CON(5), 3, GFLAGS), 510 - GATE(0, "pclk_ddrupctl", "pclk_cpu", 0, RK2928_CLKGATE_CON(5), 7, GFLAGS), 511 - GATE(0, "pclk_ddrpubl", "pclk_cpu", 0, RK2928_CLKGATE_CON(9), 6, GFLAGS), 510 + GATE(PCLK_DDRUPCTL, "pclk_ddrupctl", "pclk_cpu", 0, RK2928_CLKGATE_CON(5), 7, GFLAGS), 511 + GATE(PCLK_PUBL, "pclk_ddrpubl", "pclk_cpu", 0, RK2928_CLKGATE_CON(9), 6, GFLAGS), 512 512 GATE(0, "pclk_dbg", "pclk_cpu", 0, RK2928_CLKGATE_CON(9), 1, GFLAGS), 513 513 GATE(PCLK_GRF, "pclk_grf", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(5), 4, GFLAGS), 514 514 GATE(PCLK_PMU, "pclk_pmu", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(5), 5, GFLAGS),
+6 -7
drivers/clk/rockchip/clk-rk3288.c
··· 198 198 PNAME(mux_edp_24m_p) = { "ext_edp_24m", "xin24m" }; 199 199 PNAME(mux_tspout_p) = { "cpll", "gpll", "npll", "xin27m" }; 200 200 201 + PNAME(mux_aclk_vcodec_pre_p) = { "aclk_vepu", "aclk_vdpu" }; 201 202 PNAME(mux_usbphy480m_p) = { "sclk_otgphy1_480m", "sclk_otgphy2_480m", 202 203 "sclk_otgphy0_480m" }; 203 204 PNAME(mux_hsicphy480m_p) = { "cpll", "gpll", "usbphy480m_src" }; ··· 399 398 COMPOSITE(0, "aclk_vdpu", mux_pll_src_cpll_gpll_usb480m_p, 0, 400 399 RK3288_CLKSEL_CON(32), 14, 2, MFLAGS, 8, 5, DFLAGS, 401 400 RK3288_CLKGATE_CON(3), 11, GFLAGS), 402 - /* 403 - * We use aclk_vdpu by default GRF_SOC_CON0[7] setting in system, 404 - * so we ignore the mux and make clocks nodes as following, 405 - */ 406 - GATE(ACLK_VCODEC, "aclk_vcodec", "aclk_vdpu", 0, 401 + MUXGRF(0, "aclk_vcodec_pre", mux_aclk_vcodec_pre_p, 0, 402 + RK3288_GRF_SOC_CON(0), 7, 1, MFLAGS), 403 + GATE(ACLK_VCODEC, "aclk_vcodec", "aclk_vcodec_pre", 0, 407 404 RK3288_CLKGATE_CON(9), 0, GFLAGS), 408 405 409 - FACTOR_GATE(0, "hclk_vcodec_pre", "aclk_vdpu", 0, 1, 4, 406 + FACTOR_GATE(0, "hclk_vcodec_pre", "aclk_vcodec_pre", 0, 1, 4, 410 407 RK3288_CLKGATE_CON(3), 10, GFLAGS), 411 408 412 409 GATE(HCLK_VCODEC, "hclk_vcodec", "hclk_vcodec_pre", 0, ··· 800 801 801 802 GATE(0, "pclk_vip_in", "ext_vip", 0, RK3288_CLKGATE_CON(16), 0, GFLAGS), 802 803 INVERTER(0, "pclk_vip", "pclk_vip_in", RK3288_CLKSEL_CON(29), 4, IFLAGS), 803 - GATE(0, "pclk_isp_in", "ext_isp", 0, RK3288_CLKGATE_CON(16), 3, GFLAGS), 804 + GATE(PCLK_ISP_IN, "pclk_isp_in", "ext_isp", 0, RK3288_CLKGATE_CON(16), 3, GFLAGS), 804 805 INVERTER(0, "pclk_isp", "pclk_isp_in", RK3288_CLKSEL_CON(29), 3, IFLAGS), 805 806 }; 806 807
+895
drivers/clk/rockchip/clk-rk3328.c
··· 1 + /* 2 + * Copyright (c) 2016 Rockchip Electronics Co. Ltd. 3 + * Author: Elaine <zhangqing@rock-chips.com> 4 + * 5 + * This program is free software; you can redistribute it and/or modify 6 + * it under the terms of the GNU General Public License as published by 7 + * the Free Software Foundation; either version 2 of the License, or 8 + * (at your option) any later version. 9 + * 10 + * This program is distributed in the hope that it will be useful, 11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License for more details. 14 + */ 15 + 16 + #include <linux/clk-provider.h> 17 + #include <linux/of.h> 18 + #include <linux/of_address.h> 19 + #include <linux/syscore_ops.h> 20 + #include <dt-bindings/clock/rk3328-cru.h> 21 + #include "clk.h" 22 + 23 + #define RK3328_GRF_SOC_STATUS0 0x480 24 + #define RK3328_GRF_MAC_CON1 0x904 25 + #define RK3328_GRF_MAC_CON2 0x908 26 + 27 + enum rk3328_plls { 28 + apll, dpll, cpll, gpll, npll, 29 + }; 30 + 31 + static struct rockchip_pll_rate_table rk3328_pll_rates[] = { 32 + /* _mhz, _refdiv, _fbdiv, _postdiv1, _postdiv2, _dsmpd, _frac */ 33 + RK3036_PLL_RATE(1608000000, 1, 67, 1, 1, 1, 0), 34 + RK3036_PLL_RATE(1584000000, 1, 66, 1, 1, 1, 0), 35 + RK3036_PLL_RATE(1560000000, 1, 65, 1, 1, 1, 0), 36 + RK3036_PLL_RATE(1536000000, 1, 64, 1, 1, 1, 0), 37 + RK3036_PLL_RATE(1512000000, 1, 63, 1, 1, 1, 0), 38 + RK3036_PLL_RATE(1488000000, 1, 62, 1, 1, 1, 0), 39 + RK3036_PLL_RATE(1464000000, 1, 61, 1, 1, 1, 0), 40 + RK3036_PLL_RATE(1440000000, 1, 60, 1, 1, 1, 0), 41 + RK3036_PLL_RATE(1416000000, 1, 59, 1, 1, 1, 0), 42 + RK3036_PLL_RATE(1392000000, 1, 58, 1, 1, 1, 0), 43 + RK3036_PLL_RATE(1368000000, 1, 57, 1, 1, 1, 0), 44 + RK3036_PLL_RATE(1344000000, 1, 56, 1, 1, 1, 0), 45 + RK3036_PLL_RATE(1320000000, 1, 55, 1, 1, 1, 0), 46 + RK3036_PLL_RATE(1296000000, 1, 54, 1, 1, 1, 0), 47 + RK3036_PLL_RATE(1272000000, 1, 53, 1, 1, 1, 0), 48 + RK3036_PLL_RATE(1248000000, 1, 52, 1, 1, 1, 0), 49 + RK3036_PLL_RATE(1200000000, 1, 50, 1, 1, 1, 0), 50 + RK3036_PLL_RATE(1188000000, 2, 99, 1, 1, 1, 0), 51 + RK3036_PLL_RATE(1104000000, 1, 46, 1, 1, 1, 0), 52 + RK3036_PLL_RATE(1100000000, 12, 550, 1, 1, 1, 0), 53 + RK3036_PLL_RATE(1008000000, 1, 84, 2, 1, 1, 0), 54 + RK3036_PLL_RATE(1000000000, 6, 500, 2, 1, 1, 0), 55 + RK3036_PLL_RATE(984000000, 1, 82, 2, 1, 1, 0), 56 + RK3036_PLL_RATE(960000000, 1, 80, 2, 1, 1, 0), 57 + RK3036_PLL_RATE(936000000, 1, 78, 2, 1, 1, 0), 58 + RK3036_PLL_RATE(912000000, 1, 76, 2, 1, 1, 0), 59 + RK3036_PLL_RATE(900000000, 4, 300, 2, 1, 1, 0), 60 + RK3036_PLL_RATE(888000000, 1, 74, 2, 1, 1, 0), 61 + RK3036_PLL_RATE(864000000, 1, 72, 2, 1, 1, 0), 62 + RK3036_PLL_RATE(840000000, 1, 70, 2, 1, 1, 0), 63 + RK3036_PLL_RATE(816000000, 1, 68, 2, 1, 1, 0), 64 + RK3036_PLL_RATE(800000000, 6, 400, 2, 1, 1, 0), 65 + RK3036_PLL_RATE(700000000, 6, 350, 2, 1, 1, 0), 66 + RK3036_PLL_RATE(696000000, 1, 58, 2, 1, 1, 0), 67 + RK3036_PLL_RATE(600000000, 1, 75, 3, 1, 1, 0), 68 + RK3036_PLL_RATE(594000000, 2, 99, 2, 1, 1, 0), 69 + RK3036_PLL_RATE(504000000, 1, 63, 3, 1, 1, 0), 70 + RK3036_PLL_RATE(500000000, 6, 250, 2, 1, 1, 0), 71 + RK3036_PLL_RATE(408000000, 1, 68, 2, 2, 1, 0), 72 + RK3036_PLL_RATE(312000000, 1, 52, 2, 2, 1, 0), 73 + RK3036_PLL_RATE(216000000, 1, 72, 4, 2, 1, 0), 74 + RK3036_PLL_RATE(96000000, 1, 64, 4, 4, 1, 0), 75 + { /* sentinel */ }, 76 + }; 77 + 78 + static struct rockchip_pll_rate_table rk3328_pll_frac_rates[] = { 79 + /* _mhz, _refdiv, _fbdiv, _postdiv1, _postdiv2, _dsmpd, _frac */ 80 + RK3036_PLL_RATE(1016064000, 3, 127, 1, 1, 0, 134217), 81 + /* vco = 1016064000 */ 82 + RK3036_PLL_RATE(983040000, 24, 983, 1, 1, 0, 671088), 83 + /* vco = 983040000 */ 84 + RK3036_PLL_RATE(491520000, 24, 983, 2, 1, 0, 671088), 85 + /* vco = 983040000 */ 86 + RK3036_PLL_RATE(61440000, 6, 215, 7, 2, 0, 671088), 87 + /* vco = 860156000 */ 88 + RK3036_PLL_RATE(56448000, 12, 451, 4, 4, 0, 9797894), 89 + /* vco = 903168000 */ 90 + RK3036_PLL_RATE(40960000, 12, 409, 4, 5, 0, 10066329), 91 + /* vco = 819200000 */ 92 + { /* sentinel */ }, 93 + }; 94 + 95 + #define RK3328_DIV_ACLKM_MASK 0x7 96 + #define RK3328_DIV_ACLKM_SHIFT 4 97 + #define RK3328_DIV_PCLK_DBG_MASK 0xf 98 + #define RK3328_DIV_PCLK_DBG_SHIFT 0 99 + 100 + #define RK3328_CLKSEL1(_aclk_core, _pclk_dbg) \ 101 + { \ 102 + .reg = RK3328_CLKSEL_CON(1), \ 103 + .val = HIWORD_UPDATE(_aclk_core, RK3328_DIV_ACLKM_MASK, \ 104 + RK3328_DIV_ACLKM_SHIFT) | \ 105 + HIWORD_UPDATE(_pclk_dbg, RK3328_DIV_PCLK_DBG_MASK, \ 106 + RK3328_DIV_PCLK_DBG_SHIFT), \ 107 + } 108 + 109 + #define RK3328_CPUCLK_RATE(_prate, _aclk_core, _pclk_dbg) \ 110 + { \ 111 + .prate = _prate, \ 112 + .divs = { \ 113 + RK3328_CLKSEL1(_aclk_core, _pclk_dbg), \ 114 + }, \ 115 + } 116 + 117 + static struct rockchip_cpuclk_rate_table rk3328_cpuclk_rates[] __initdata = { 118 + RK3328_CPUCLK_RATE(1800000000, 1, 7), 119 + RK3328_CPUCLK_RATE(1704000000, 1, 7), 120 + RK3328_CPUCLK_RATE(1608000000, 1, 7), 121 + RK3328_CPUCLK_RATE(1512000000, 1, 7), 122 + RK3328_CPUCLK_RATE(1488000000, 1, 5), 123 + RK3328_CPUCLK_RATE(1416000000, 1, 5), 124 + RK3328_CPUCLK_RATE(1392000000, 1, 5), 125 + RK3328_CPUCLK_RATE(1296000000, 1, 5), 126 + RK3328_CPUCLK_RATE(1200000000, 1, 5), 127 + RK3328_CPUCLK_RATE(1104000000, 1, 5), 128 + RK3328_CPUCLK_RATE(1008000000, 1, 5), 129 + RK3328_CPUCLK_RATE(912000000, 1, 5), 130 + RK3328_CPUCLK_RATE(816000000, 1, 3), 131 + RK3328_CPUCLK_RATE(696000000, 1, 3), 132 + RK3328_CPUCLK_RATE(600000000, 1, 3), 133 + RK3328_CPUCLK_RATE(408000000, 1, 1), 134 + RK3328_CPUCLK_RATE(312000000, 1, 1), 135 + RK3328_CPUCLK_RATE(216000000, 1, 1), 136 + RK3328_CPUCLK_RATE(96000000, 1, 1), 137 + }; 138 + 139 + static const struct rockchip_cpuclk_reg_data rk3328_cpuclk_data = { 140 + .core_reg = RK3328_CLKSEL_CON(0), 141 + .div_core_shift = 0, 142 + .div_core_mask = 0x1f, 143 + .mux_core_alt = 1, 144 + .mux_core_main = 3, 145 + .mux_core_shift = 6, 146 + .mux_core_mask = 0x3, 147 + }; 148 + 149 + PNAME(mux_pll_p) = { "xin24m" }; 150 + 151 + PNAME(mux_2plls_p) = { "cpll", "gpll" }; 152 + PNAME(mux_gpll_cpll_p) = { "gpll", "cpll" }; 153 + PNAME(mux_cpll_gpll_apll_p) = { "cpll", "gpll", "apll" }; 154 + PNAME(mux_2plls_xin24m_p) = { "cpll", "gpll", "xin24m" }; 155 + PNAME(mux_2plls_hdmiphy_p) = { "cpll", "gpll", 156 + "dummy_hdmiphy" }; 157 + PNAME(mux_4plls_p) = { "cpll", "gpll", 158 + "dummy_hdmiphy", 159 + "usb480m" }; 160 + PNAME(mux_2plls_u480m_p) = { "cpll", "gpll", 161 + "usb480m" }; 162 + PNAME(mux_2plls_24m_u480m_p) = { "cpll", "gpll", 163 + "xin24m", "usb480m" }; 164 + 165 + PNAME(mux_ddrphy_p) = { "dpll", "apll", "cpll" }; 166 + PNAME(mux_armclk_p) = { "apll_core", 167 + "gpll_core", 168 + "dpll_core", 169 + "npll_core"}; 170 + PNAME(mux_hdmiphy_p) = { "hdmi_phy", "xin24m" }; 171 + PNAME(mux_usb480m_p) = { "usb480m_phy", 172 + "xin24m" }; 173 + 174 + PNAME(mux_i2s0_p) = { "clk_i2s0_div", 175 + "clk_i2s0_frac", 176 + "xin12m", 177 + "xin12m" }; 178 + PNAME(mux_i2s1_p) = { "clk_i2s1_div", 179 + "clk_i2s1_frac", 180 + "clkin_i2s1", 181 + "xin12m" }; 182 + PNAME(mux_i2s2_p) = { "clk_i2s2_div", 183 + "clk_i2s2_frac", 184 + "clkin_i2s2", 185 + "xin12m" }; 186 + PNAME(mux_i2s1out_p) = { "clk_i2s1", "xin12m"}; 187 + PNAME(mux_i2s2out_p) = { "clk_i2s2", "xin12m" }; 188 + PNAME(mux_spdif_p) = { "clk_spdif_div", 189 + "clk_spdif_frac", 190 + "xin12m", 191 + "xin12m" }; 192 + PNAME(mux_uart0_p) = { "clk_uart0_div", 193 + "clk_uart0_frac", 194 + "xin24m" }; 195 + PNAME(mux_uart1_p) = { "clk_uart1_div", 196 + "clk_uart1_frac", 197 + "xin24m" }; 198 + PNAME(mux_uart2_p) = { "clk_uart2_div", 199 + "clk_uart2_frac", 200 + "xin24m" }; 201 + 202 + PNAME(mux_sclk_cif_p) = { "clk_cif_src", 203 + "xin24m" }; 204 + PNAME(mux_dclk_lcdc_p) = { "hdmiphy", 205 + "dclk_lcdc_src" }; 206 + PNAME(mux_aclk_peri_pre_p) = { "cpll_peri", 207 + "gpll_peri", 208 + "hdmiphy_peri" }; 209 + PNAME(mux_ref_usb3otg_src_p) = { "xin24m", 210 + "clk_usb3otg_ref" }; 211 + PNAME(mux_xin24m_32k_p) = { "xin24m", 212 + "clk_rtc32k" }; 213 + PNAME(mux_mac2io_src_p) = { "clk_mac2io_src", 214 + "gmac_clkin" }; 215 + PNAME(mux_mac2phy_src_p) = { "clk_mac2phy_src", 216 + "phy_50m_out" }; 217 + 218 + static struct rockchip_pll_clock rk3328_pll_clks[] __initdata = { 219 + [apll] = PLL(pll_rk3328, PLL_APLL, "apll", mux_pll_p, 220 + 0, RK3328_PLL_CON(0), 221 + RK3328_MODE_CON, 0, 4, 0, rk3328_pll_frac_rates), 222 + [dpll] = PLL(pll_rk3328, PLL_DPLL, "dpll", mux_pll_p, 223 + 0, RK3328_PLL_CON(8), 224 + RK3328_MODE_CON, 4, 3, 0, NULL), 225 + [cpll] = PLL(pll_rk3328, PLL_CPLL, "cpll", mux_pll_p, 226 + 0, RK3328_PLL_CON(16), 227 + RK3328_MODE_CON, 8, 2, 0, rk3328_pll_rates), 228 + [gpll] = PLL(pll_rk3328, PLL_GPLL, "gpll", mux_pll_p, 229 + 0, RK3328_PLL_CON(24), 230 + RK3328_MODE_CON, 12, 1, 0, rk3328_pll_frac_rates), 231 + [npll] = PLL(pll_rk3328, PLL_NPLL, "npll", mux_pll_p, 232 + 0, RK3328_PLL_CON(40), 233 + RK3328_MODE_CON, 1, 0, 0, rk3328_pll_rates), 234 + }; 235 + 236 + #define MFLAGS CLK_MUX_HIWORD_MASK 237 + #define DFLAGS CLK_DIVIDER_HIWORD_MASK 238 + #define GFLAGS (CLK_GATE_HIWORD_MASK | CLK_GATE_SET_TO_DISABLE) 239 + 240 + static struct rockchip_clk_branch rk3328_i2s0_fracmux __initdata = 241 + MUX(0, "i2s0_pre", mux_i2s0_p, CLK_SET_RATE_PARENT, 242 + RK3328_CLKSEL_CON(6), 8, 2, MFLAGS); 243 + 244 + static struct rockchip_clk_branch rk3328_i2s1_fracmux __initdata = 245 + MUX(0, "i2s1_pre", mux_i2s1_p, CLK_SET_RATE_PARENT, 246 + RK3328_CLKSEL_CON(8), 8, 2, MFLAGS); 247 + 248 + static struct rockchip_clk_branch rk3328_i2s2_fracmux __initdata = 249 + MUX(0, "i2s2_pre", mux_i2s2_p, CLK_SET_RATE_PARENT, 250 + RK3328_CLKSEL_CON(10), 8, 2, MFLAGS); 251 + 252 + static struct rockchip_clk_branch rk3328_spdif_fracmux __initdata = 253 + MUX(SCLK_SPDIF, "sclk_spdif", mux_spdif_p, CLK_SET_RATE_PARENT, 254 + RK3328_CLKSEL_CON(12), 8, 2, MFLAGS); 255 + 256 + static struct rockchip_clk_branch rk3328_uart0_fracmux __initdata = 257 + MUX(SCLK_UART0, "sclk_uart0", mux_uart0_p, CLK_SET_RATE_PARENT, 258 + RK3328_CLKSEL_CON(14), 8, 2, MFLAGS); 259 + 260 + static struct rockchip_clk_branch rk3328_uart1_fracmux __initdata = 261 + MUX(SCLK_UART1, "sclk_uart1", mux_uart1_p, CLK_SET_RATE_PARENT, 262 + RK3328_CLKSEL_CON(16), 8, 2, MFLAGS); 263 + 264 + static struct rockchip_clk_branch rk3328_uart2_fracmux __initdata = 265 + MUX(SCLK_UART2, "sclk_uart2", mux_uart2_p, CLK_SET_RATE_PARENT, 266 + RK3328_CLKSEL_CON(18), 8, 2, MFLAGS); 267 + 268 + static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = { 269 + /* 270 + * Clock-Architecture Diagram 1 271 + */ 272 + 273 + DIV(0, "clk_24m", "xin24m", CLK_IGNORE_UNUSED, 274 + RK3328_CLKSEL_CON(2), 8, 5, DFLAGS), 275 + COMPOSITE(SCLK_RTC32K, "clk_rtc32k", mux_2plls_xin24m_p, 0, 276 + RK3328_CLKSEL_CON(38), 14, 2, MFLAGS, 0, 14, DFLAGS, 277 + RK3328_CLKGATE_CON(0), 11, GFLAGS), 278 + 279 + /* PD_MISC */ 280 + MUX(HDMIPHY, "hdmiphy", mux_hdmiphy_p, CLK_SET_RATE_PARENT, 281 + RK3328_MISC_CON, 13, 1, MFLAGS), 282 + MUX(USB480M, "usb480m", mux_usb480m_p, CLK_SET_RATE_PARENT, 283 + RK3328_MISC_CON, 15, 1, MFLAGS), 284 + 285 + /* 286 + * Clock-Architecture Diagram 2 287 + */ 288 + 289 + /* PD_CORE */ 290 + GATE(0, "apll_core", "apll", CLK_IGNORE_UNUSED, 291 + RK3328_CLKGATE_CON(0), 0, GFLAGS), 292 + GATE(0, "gpll_core", "gpll", CLK_IGNORE_UNUSED, 293 + RK3328_CLKGATE_CON(0), 2, GFLAGS), 294 + GATE(0, "dpll_core", "dpll", CLK_IGNORE_UNUSED, 295 + RK3328_CLKGATE_CON(0), 1, GFLAGS), 296 + GATE(0, "npll_core", "npll", CLK_IGNORE_UNUSED, 297 + RK3328_CLKGATE_CON(0), 12, GFLAGS), 298 + COMPOSITE_NOMUX(0, "pclk_dbg", "armclk", CLK_IGNORE_UNUSED, 299 + RK3328_CLKSEL_CON(1), 0, 4, DFLAGS | CLK_DIVIDER_READ_ONLY, 300 + RK3328_CLKGATE_CON(7), 0, GFLAGS), 301 + COMPOSITE_NOMUX(0, "aclk_core", "armclk", CLK_IGNORE_UNUSED, 302 + RK3328_CLKSEL_CON(1), 4, 3, DFLAGS | CLK_DIVIDER_READ_ONLY, 303 + RK3328_CLKGATE_CON(7), 1, GFLAGS), 304 + GATE(0, "aclk_core_niu", "aclk_core", CLK_IGNORE_UNUSED, 305 + RK3328_CLKGATE_CON(13), 0, GFLAGS), 306 + GATE(0, "aclk_gic400", "aclk_core", CLK_IGNORE_UNUSED, 307 + RK3328_CLKGATE_CON(13), 1, GFLAGS), 308 + 309 + GATE(0, "clk_jtag", "jtag_clkin", CLK_IGNORE_UNUSED, 310 + RK3328_CLKGATE_CON(7), 2, GFLAGS), 311 + 312 + /* PD_GPU */ 313 + COMPOSITE(0, "aclk_gpu_pre", mux_4plls_p, 0, 314 + RK3328_CLKSEL_CON(44), 6, 2, MFLAGS, 0, 5, DFLAGS, 315 + RK3328_CLKGATE_CON(6), 6, GFLAGS), 316 + GATE(ACLK_GPU, "aclk_gpu", "aclk_gpu_pre", CLK_SET_RATE_PARENT, 317 + RK3328_CLKGATE_CON(14), 0, GFLAGS), 318 + GATE(0, "aclk_gpu_niu", "aclk_gpu_pre", CLK_IGNORE_UNUSED, 319 + RK3328_CLKGATE_CON(14), 1, GFLAGS), 320 + 321 + /* PD_DDR */ 322 + COMPOSITE(0, "clk_ddr", mux_ddrphy_p, CLK_IGNORE_UNUSED, 323 + RK3328_CLKSEL_CON(3), 8, 2, MFLAGS, 0, 3, DFLAGS | CLK_DIVIDER_POWER_OF_TWO, 324 + RK3328_CLKGATE_CON(0), 4, GFLAGS), 325 + GATE(0, "clk_ddrmsch", "clk_ddr", CLK_IGNORE_UNUSED, 326 + RK3328_CLKGATE_CON(18), 6, GFLAGS), 327 + GATE(0, "clk_ddrupctl", "clk_ddr", CLK_IGNORE_UNUSED, 328 + RK3328_CLKGATE_CON(18), 5, GFLAGS), 329 + GATE(0, "aclk_ddrupctl", "clk_ddr", CLK_IGNORE_UNUSED, 330 + RK3328_CLKGATE_CON(18), 4, GFLAGS), 331 + GATE(0, "clk_ddrmon", "xin24m", CLK_IGNORE_UNUSED, 332 + RK3328_CLKGATE_CON(0), 6, GFLAGS), 333 + 334 + COMPOSITE(PCLK_DDR, "pclk_ddr", mux_2plls_hdmiphy_p, 0, 335 + RK3328_CLKSEL_CON(4), 13, 2, MFLAGS, 8, 3, DFLAGS, 336 + RK3328_CLKGATE_CON(7), 4, GFLAGS), 337 + GATE(0, "pclk_ddrupctl", "pclk_ddr", CLK_IGNORE_UNUSED, 338 + RK3328_CLKGATE_CON(18), 1, GFLAGS), 339 + GATE(0, "pclk_ddr_msch", "pclk_ddr", CLK_IGNORE_UNUSED, 340 + RK3328_CLKGATE_CON(18), 2, GFLAGS), 341 + GATE(0, "pclk_ddr_mon", "pclk_ddr", CLK_IGNORE_UNUSED, 342 + RK3328_CLKGATE_CON(18), 3, GFLAGS), 343 + GATE(0, "pclk_ddrstdby", "pclk_ddr", CLK_IGNORE_UNUSED, 344 + RK3328_CLKGATE_CON(18), 7, GFLAGS), 345 + GATE(0, "pclk_ddr_grf", "pclk_ddr", CLK_IGNORE_UNUSED, 346 + RK3328_CLKGATE_CON(18), 9, GFLAGS), 347 + 348 + /* 349 + * Clock-Architecture Diagram 3 350 + */ 351 + 352 + /* PD_BUS */ 353 + COMPOSITE(ACLK_BUS_PRE, "aclk_bus_pre", mux_2plls_hdmiphy_p, 0, 354 + RK3328_CLKSEL_CON(0), 13, 2, MFLAGS, 8, 5, DFLAGS, 355 + RK3328_CLKGATE_CON(8), 0, GFLAGS), 356 + COMPOSITE_NOMUX(HCLK_BUS_PRE, "hclk_bus_pre", "aclk_bus_pre", 0, 357 + RK3328_CLKSEL_CON(1), 8, 2, DFLAGS, 358 + RK3328_CLKGATE_CON(8), 1, GFLAGS), 359 + COMPOSITE_NOMUX(PCLK_BUS_PRE, "pclk_bus_pre", "aclk_bus_pre", 0, 360 + RK3328_CLKSEL_CON(1), 12, 3, DFLAGS, 361 + RK3328_CLKGATE_CON(8), 2, GFLAGS), 362 + GATE(0, "pclk_bus", "pclk_bus_pre", 0, 363 + RK3328_CLKGATE_CON(8), 3, GFLAGS), 364 + GATE(0, "pclk_phy_pre", "pclk_bus_pre", 0, 365 + RK3328_CLKGATE_CON(8), 4, GFLAGS), 366 + 367 + COMPOSITE(SCLK_TSP, "clk_tsp", mux_2plls_p, 0, 368 + RK3328_CLKSEL_CON(21), 15, 1, MFLAGS, 8, 5, DFLAGS, 369 + RK3328_CLKGATE_CON(2), 5, GFLAGS), 370 + GATE(0, "clk_hsadc_tsp", "ext_gpio3a2", 0, 371 + RK3328_CLKGATE_CON(17), 13, GFLAGS), 372 + 373 + /* PD_I2S */ 374 + COMPOSITE(0, "clk_i2s0_div", mux_2plls_p, 0, 375 + RK3328_CLKSEL_CON(6), 15, 1, MFLAGS, 0, 7, DFLAGS, 376 + RK3328_CLKGATE_CON(1), 1, GFLAGS), 377 + COMPOSITE_FRACMUX(0, "clk_i2s0_frac", "clk_i2s0_div", CLK_SET_RATE_PARENT, 378 + RK3328_CLKSEL_CON(7), 0, 379 + RK3328_CLKGATE_CON(1), 2, GFLAGS, 380 + &rk3328_i2s0_fracmux), 381 + GATE(SCLK_I2S0, "clk_i2s0", "i2s0_pre", CLK_SET_RATE_PARENT, 382 + RK3328_CLKGATE_CON(1), 3, GFLAGS), 383 + 384 + COMPOSITE(0, "clk_i2s1_div", mux_2plls_p, 0, 385 + RK3328_CLKSEL_CON(8), 15, 1, MFLAGS, 0, 7, DFLAGS, 386 + RK3328_CLKGATE_CON(1), 4, GFLAGS), 387 + COMPOSITE_FRACMUX(0, "clk_i2s1_frac", "clk_i2s1_div", CLK_SET_RATE_PARENT, 388 + RK3328_CLKSEL_CON(9), 0, 389 + RK3328_CLKGATE_CON(1), 5, GFLAGS, 390 + &rk3328_i2s1_fracmux), 391 + GATE(SCLK_I2S1, "clk_i2s1", "i2s1_pre", CLK_SET_RATE_PARENT, 392 + RK3328_CLKGATE_CON(0), 6, GFLAGS), 393 + COMPOSITE_NODIV(SCLK_I2S1_OUT, "i2s1_out", mux_i2s1out_p, 0, 394 + RK3328_CLKSEL_CON(8), 12, 1, MFLAGS, 395 + RK3328_CLKGATE_CON(1), 7, GFLAGS), 396 + 397 + COMPOSITE(0, "clk_i2s2_div", mux_2plls_p, 0, 398 + RK3328_CLKSEL_CON(10), 15, 1, MFLAGS, 0, 7, DFLAGS, 399 + RK3328_CLKGATE_CON(1), 8, GFLAGS), 400 + COMPOSITE_FRACMUX(0, "clk_i2s2_frac", "clk_i2s2_div", CLK_SET_RATE_PARENT, 401 + RK3328_CLKSEL_CON(11), 0, 402 + RK3328_CLKGATE_CON(1), 9, GFLAGS, 403 + &rk3328_i2s2_fracmux), 404 + GATE(SCLK_I2S2, "clk_i2s2", "i2s2_pre", CLK_SET_RATE_PARENT, 405 + RK3328_CLKGATE_CON(1), 10, GFLAGS), 406 + COMPOSITE_NODIV(SCLK_I2S2_OUT, "i2s2_out", mux_i2s2out_p, 0, 407 + RK3328_CLKSEL_CON(10), 12, 1, MFLAGS, 408 + RK3328_CLKGATE_CON(1), 11, GFLAGS), 409 + 410 + COMPOSITE(0, "clk_spdif_div", mux_2plls_p, 0, 411 + RK3328_CLKSEL_CON(12), 15, 1, MFLAGS, 0, 7, DFLAGS, 412 + RK3328_CLKGATE_CON(1), 12, GFLAGS), 413 + COMPOSITE_FRACMUX(0, "clk_spdif_frac", "clk_spdif_div", CLK_SET_RATE_PARENT, 414 + RK3328_CLKSEL_CON(13), 0, 415 + RK3328_CLKGATE_CON(1), 13, GFLAGS, 416 + &rk3328_spdif_fracmux), 417 + 418 + /* PD_UART */ 419 + COMPOSITE(0, "clk_uart0_div", mux_2plls_u480m_p, 0, 420 + RK3328_CLKSEL_CON(14), 12, 2, MFLAGS, 0, 7, DFLAGS, 421 + RK3328_CLKGATE_CON(1), 14, GFLAGS), 422 + COMPOSITE(0, "clk_uart1_div", mux_2plls_u480m_p, 0, 423 + RK3328_CLKSEL_CON(16), 12, 2, MFLAGS, 0, 7, DFLAGS, 424 + RK3328_CLKGATE_CON(2), 0, GFLAGS), 425 + COMPOSITE(0, "clk_uart2_div", mux_2plls_u480m_p, 0, 426 + RK3328_CLKSEL_CON(18), 12, 2, MFLAGS, 0, 7, DFLAGS, 427 + RK3328_CLKGATE_CON(2), 2, GFLAGS), 428 + COMPOSITE_FRACMUX(0, "clk_uart0_frac", "clk_uart0_div", CLK_SET_RATE_PARENT, 429 + RK3328_CLKSEL_CON(15), 0, 430 + RK3328_CLKGATE_CON(1), 15, GFLAGS, 431 + &rk3328_uart0_fracmux), 432 + COMPOSITE_FRACMUX(0, "clk_uart1_frac", "clk_uart1_div", CLK_SET_RATE_PARENT, 433 + RK3328_CLKSEL_CON(17), 0, 434 + RK3328_CLKGATE_CON(2), 1, GFLAGS, 435 + &rk3328_uart1_fracmux), 436 + COMPOSITE_FRACMUX(0, "clk_uart2_frac", "clk_uart2_div", CLK_SET_RATE_PARENT, 437 + RK3328_CLKSEL_CON(19), 0, 438 + RK3328_CLKGATE_CON(2), 3, GFLAGS, 439 + &rk3328_uart2_fracmux), 440 + 441 + /* 442 + * Clock-Architecture Diagram 4 443 + */ 444 + 445 + COMPOSITE(SCLK_I2C0, "clk_i2c0", mux_2plls_p, 0, 446 + RK3328_CLKSEL_CON(34), 7, 1, MFLAGS, 0, 7, DFLAGS, 447 + RK3328_CLKGATE_CON(2), 9, GFLAGS), 448 + COMPOSITE(SCLK_I2C1, "clk_i2c1", mux_2plls_p, 0, 449 + RK3328_CLKSEL_CON(34), 15, 1, MFLAGS, 8, 7, DFLAGS, 450 + RK3328_CLKGATE_CON(2), 10, GFLAGS), 451 + COMPOSITE(SCLK_I2C2, "clk_i2c2", mux_2plls_p, 0, 452 + RK3328_CLKSEL_CON(35), 7, 1, MFLAGS, 0, 7, DFLAGS, 453 + RK3328_CLKGATE_CON(2), 11, GFLAGS), 454 + COMPOSITE(SCLK_I2C3, "clk_i2c3", mux_2plls_p, 0, 455 + RK3328_CLKSEL_CON(35), 15, 1, MFLAGS, 8, 7, DFLAGS, 456 + RK3328_CLKGATE_CON(2), 12, GFLAGS), 457 + COMPOSITE(SCLK_CRYPTO, "clk_crypto", mux_2plls_p, 0, 458 + RK3328_CLKSEL_CON(20), 7, 1, MFLAGS, 0, 7, DFLAGS, 459 + RK3328_CLKGATE_CON(2), 4, GFLAGS), 460 + COMPOSITE_NOMUX(SCLK_TSADC, "clk_tsadc", "clk_24m", 0, 461 + RK3328_CLKSEL_CON(22), 0, 10, DFLAGS, 462 + RK3328_CLKGATE_CON(2), 6, GFLAGS), 463 + COMPOSITE_NOMUX(SCLK_SARADC, "clk_saradc", "clk_24m", 0, 464 + RK3328_CLKSEL_CON(23), 0, 10, DFLAGS, 465 + RK3328_CLKGATE_CON(2), 14, GFLAGS), 466 + COMPOSITE(SCLK_SPI, "clk_spi", mux_2plls_p, 0, 467 + RK3328_CLKSEL_CON(24), 7, 1, MFLAGS, 0, 7, DFLAGS, 468 + RK3328_CLKGATE_CON(2), 7, GFLAGS), 469 + COMPOSITE(SCLK_PWM, "clk_pwm", mux_2plls_p, 0, 470 + RK3328_CLKSEL_CON(24), 15, 1, MFLAGS, 8, 7, DFLAGS, 471 + RK3328_CLKGATE_CON(2), 8, GFLAGS), 472 + COMPOSITE(SCLK_OTP, "clk_otp", mux_2plls_xin24m_p, 0, 473 + RK3328_CLKSEL_CON(4), 6, 2, MFLAGS, 0, 6, DFLAGS, 474 + RK3328_CLKGATE_CON(3), 8, GFLAGS), 475 + COMPOSITE(SCLK_EFUSE, "clk_efuse", mux_2plls_xin24m_p, 0, 476 + RK3328_CLKSEL_CON(5), 14, 2, MFLAGS, 8, 5, DFLAGS, 477 + RK3328_CLKGATE_CON(2), 13, GFLAGS), 478 + COMPOSITE(SCLK_PDM, "clk_pdm", mux_cpll_gpll_apll_p, CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT, 479 + RK3328_CLKSEL_CON(20), 14, 2, MFLAGS, 8, 5, DFLAGS, 480 + RK3328_CLKGATE_CON(2), 15, GFLAGS), 481 + 482 + GATE(SCLK_TIMER0, "sclk_timer0", "xin24m", 0, 483 + RK3328_CLKGATE_CON(8), 5, GFLAGS), 484 + GATE(SCLK_TIMER1, "sclk_timer1", "xin24m", 0, 485 + RK3328_CLKGATE_CON(8), 6, GFLAGS), 486 + GATE(SCLK_TIMER2, "sclk_timer2", "xin24m", 0, 487 + RK3328_CLKGATE_CON(8), 7, GFLAGS), 488 + GATE(SCLK_TIMER3, "sclk_timer3", "xin24m", 0, 489 + RK3328_CLKGATE_CON(8), 8, GFLAGS), 490 + GATE(SCLK_TIMER4, "sclk_timer4", "xin24m", 0, 491 + RK3328_CLKGATE_CON(8), 9, GFLAGS), 492 + GATE(SCLK_TIMER5, "sclk_timer5", "xin24m", 0, 493 + RK3328_CLKGATE_CON(8), 10, GFLAGS), 494 + 495 + COMPOSITE(SCLK_WIFI, "clk_wifi", mux_2plls_u480m_p, 0, 496 + RK3328_CLKSEL_CON(52), 6, 2, MFLAGS, 0, 6, DFLAGS, 497 + RK3328_CLKGATE_CON(0), 10, GFLAGS), 498 + 499 + /* 500 + * Clock-Architecture Diagram 5 501 + */ 502 + 503 + /* PD_VIDEO */ 504 + COMPOSITE(ACLK_RKVDEC_PRE, "aclk_rkvdec_pre", mux_4plls_p, 0, 505 + RK3328_CLKSEL_CON(48), 6, 2, MFLAGS, 0, 5, DFLAGS, 506 + RK3328_CLKGATE_CON(6), 0, GFLAGS), 507 + FACTOR_GATE(HCLK_RKVDEC_PRE, "hclk_rkvdec_pre", "aclk_rkvdec_pre", 0, 1, 4, 508 + RK3328_CLKGATE_CON(11), 0, GFLAGS), 509 + GATE(ACLK_RKVDEC, "aclk_rkvdec", "aclk_rkvdec_pre", CLK_SET_RATE_PARENT, 510 + RK3328_CLKGATE_CON(24), 0, GFLAGS), 511 + GATE(HCLK_RKVDEC, "hclk_rkvdec", "hclk_rkvdec_pre", CLK_SET_RATE_PARENT, 512 + RK3328_CLKGATE_CON(24), 1, GFLAGS), 513 + GATE(0, "aclk_rkvdec_niu", "aclk_rkvdec_pre", CLK_IGNORE_UNUSED, 514 + RK3328_CLKGATE_CON(24), 2, GFLAGS), 515 + GATE(0, "hclk_rkvdec_niu", "hclk_rkvdec_pre", CLK_IGNORE_UNUSED, 516 + RK3328_CLKGATE_CON(24), 3, GFLAGS), 517 + 518 + COMPOSITE(SCLK_VDEC_CABAC, "sclk_vdec_cabac", mux_4plls_p, 0, 519 + RK3328_CLKSEL_CON(48), 14, 2, MFLAGS, 8, 5, DFLAGS, 520 + RK3328_CLKGATE_CON(6), 1, GFLAGS), 521 + 522 + COMPOSITE(SCLK_VDEC_CORE, "sclk_vdec_core", mux_4plls_p, 0, 523 + RK3328_CLKSEL_CON(49), 6, 2, MFLAGS, 0, 5, DFLAGS, 524 + RK3328_CLKGATE_CON(6), 2, GFLAGS), 525 + 526 + COMPOSITE(ACLK_VPU_PRE, "aclk_vpu_pre", mux_4plls_p, 0, 527 + RK3328_CLKSEL_CON(50), 6, 2, MFLAGS, 0, 5, DFLAGS, 528 + RK3328_CLKGATE_CON(6), 5, GFLAGS), 529 + FACTOR_GATE(HCLK_VPU_PRE, "hclk_vpu_pre", "aclk_vpu_pre", 0, 1, 4, 530 + RK3328_CLKGATE_CON(11), 8, GFLAGS), 531 + GATE(ACLK_VPU, "aclk_vpu", "aclk_vpu_pre", CLK_SET_RATE_PARENT, 532 + RK3328_CLKGATE_CON(23), 0, GFLAGS), 533 + GATE(HCLK_VPU, "hclk_vpu", "hclk_vpu_pre", CLK_SET_RATE_PARENT, 534 + RK3328_CLKGATE_CON(23), 1, GFLAGS), 535 + GATE(0, "aclk_vpu_niu", "aclk_vpu_pre", CLK_IGNORE_UNUSED, 536 + RK3328_CLKGATE_CON(23), 2, GFLAGS), 537 + GATE(0, "hclk_vpu_niu", "hclk_vpu_pre", CLK_IGNORE_UNUSED, 538 + RK3328_CLKGATE_CON(23), 3, GFLAGS), 539 + 540 + COMPOSITE(ACLK_RKVENC, "aclk_rkvenc", mux_4plls_p, 0, 541 + RK3328_CLKSEL_CON(51), 6, 2, MFLAGS, 0, 5, DFLAGS, 542 + RK3328_CLKGATE_CON(6), 3, GFLAGS), 543 + FACTOR_GATE(HCLK_RKVENC, "hclk_rkvenc", "aclk_rkvenc", 0, 1, 4, 544 + RK3328_CLKGATE_CON(11), 4, GFLAGS), 545 + GATE(0, "aclk_rkvenc_niu", "aclk_rkvenc", CLK_IGNORE_UNUSED, 546 + RK3328_CLKGATE_CON(25), 0, GFLAGS), 547 + GATE(0, "hclk_rkvenc_niu", "hclk_rkvenc", CLK_IGNORE_UNUSED, 548 + RK3328_CLKGATE_CON(25), 1, GFLAGS), 549 + GATE(ACLK_H265, "aclk_h265", "aclk_rkvenc", 0, 550 + RK3328_CLKGATE_CON(25), 0, GFLAGS), 551 + GATE(PCLK_H265, "pclk_h265", "hclk_rkvenc", 0, 552 + RK3328_CLKGATE_CON(25), 1, GFLAGS), 553 + GATE(ACLK_H264, "aclk_h264", "aclk_rkvenc", 0, 554 + RK3328_CLKGATE_CON(25), 0, GFLAGS), 555 + GATE(HCLK_H264, "hclk_h264", "hclk_rkvenc", 0, 556 + RK3328_CLKGATE_CON(25), 1, GFLAGS), 557 + GATE(ACLK_AXISRAM, "aclk_axisram", "aclk_rkvenc", CLK_IGNORE_UNUSED, 558 + RK3328_CLKGATE_CON(25), 0, GFLAGS), 559 + 560 + COMPOSITE(SCLK_VENC_CORE, "sclk_venc_core", mux_4plls_p, 0, 561 + RK3328_CLKSEL_CON(51), 14, 2, MFLAGS, 8, 5, DFLAGS, 562 + RK3328_CLKGATE_CON(6), 4, GFLAGS), 563 + 564 + COMPOSITE(SCLK_VENC_DSP, "sclk_venc_dsp", mux_4plls_p, 0, 565 + RK3328_CLKSEL_CON(52), 14, 2, MFLAGS, 8, 5, DFLAGS, 566 + RK3328_CLKGATE_CON(6), 7, GFLAGS), 567 + 568 + /* 569 + * Clock-Architecture Diagram 6 570 + */ 571 + 572 + /* PD_VIO */ 573 + COMPOSITE(ACLK_VIO_PRE, "aclk_vio_pre", mux_4plls_p, 0, 574 + RK3328_CLKSEL_CON(37), 6, 2, MFLAGS, 0, 5, DFLAGS, 575 + RK3328_CLKGATE_CON(5), 2, GFLAGS), 576 + DIV(HCLK_VIO_PRE, "hclk_vio_pre", "aclk_vio_pre", 0, 577 + RK3328_CLKSEL_CON(37), 8, 5, DFLAGS), 578 + 579 + COMPOSITE(ACLK_RGA_PRE, "aclk_rga_pre", mux_4plls_p, 0, 580 + RK3328_CLKSEL_CON(36), 14, 2, MFLAGS, 8, 5, DFLAGS, 581 + RK3328_CLKGATE_CON(5), 0, GFLAGS), 582 + COMPOSITE(SCLK_RGA, "clk_rga", mux_4plls_p, 0, 583 + RK3328_CLKSEL_CON(36), 6, 2, MFLAGS, 0, 5, DFLAGS, 584 + RK3328_CLKGATE_CON(5), 1, GFLAGS), 585 + COMPOSITE(ACLK_VOP_PRE, "aclk_vop_pre", mux_4plls_p, 0, 586 + RK3328_CLKSEL_CON(39), 6, 2, MFLAGS, 0, 5, DFLAGS, 587 + RK3328_CLKGATE_CON(5), 5, GFLAGS), 588 + GATE(0, "clk_hdmi_sfc", "xin24m", 0, 589 + RK3328_CLKGATE_CON(5), 4, GFLAGS), 590 + 591 + COMPOSITE_NODIV(0, "clk_cif_src", mux_2plls_p, 0, 592 + RK3328_CLKSEL_CON(42), 7, 1, MFLAGS, 593 + RK3328_CLKGATE_CON(5), 3, GFLAGS), 594 + COMPOSITE_NOGATE(SCLK_CIF_OUT, "clk_cif_out", mux_sclk_cif_p, CLK_SET_RATE_PARENT, 595 + RK3328_CLKSEL_CON(42), 5, 1, MFLAGS, 0, 5, DFLAGS), 596 + 597 + COMPOSITE(DCLK_LCDC_SRC, "dclk_lcdc_src", mux_gpll_cpll_p, 0, 598 + RK3328_CLKSEL_CON(40), 0, 1, MFLAGS, 8, 8, DFLAGS, 599 + RK3328_CLKGATE_CON(5), 6, GFLAGS), 600 + DIV(DCLK_HDMIPHY, "dclk_hdmiphy", "dclk_lcdc_src", 0, 601 + RK3328_CLKSEL_CON(40), 3, 3, DFLAGS), 602 + MUX(DCLK_LCDC, "dclk_lcdc", mux_dclk_lcdc_p, 0, 603 + RK3328_CLKSEL_CON(40), 1, 1, MFLAGS), 604 + 605 + /* 606 + * Clock-Architecture Diagram 7 607 + */ 608 + 609 + /* PD_PERI */ 610 + GATE(0, "gpll_peri", "gpll", CLK_IGNORE_UNUSED, 611 + RK3328_CLKGATE_CON(4), 0, GFLAGS), 612 + GATE(0, "cpll_peri", "cpll", CLK_IGNORE_UNUSED, 613 + RK3328_CLKGATE_CON(4), 1, GFLAGS), 614 + GATE(0, "hdmiphy_peri", "hdmiphy", CLK_IGNORE_UNUSED, 615 + RK3328_CLKGATE_CON(4), 2, GFLAGS), 616 + COMPOSITE_NOGATE(ACLK_PERI_PRE, "aclk_peri_pre", mux_aclk_peri_pre_p, 0, 617 + RK3328_CLKSEL_CON(28), 6, 2, MFLAGS, 0, 5, DFLAGS), 618 + COMPOSITE_NOMUX(PCLK_PERI, "pclk_peri", "aclk_peri_pre", CLK_IGNORE_UNUSED, 619 + RK3328_CLKSEL_CON(29), 0, 2, DFLAGS, 620 + RK3328_CLKGATE_CON(10), 2, GFLAGS), 621 + COMPOSITE_NOMUX(HCLK_PERI, "hclk_peri", "aclk_peri_pre", CLK_IGNORE_UNUSED, 622 + RK3328_CLKSEL_CON(29), 4, 3, DFLAGS, 623 + RK3328_CLKGATE_CON(10), 1, GFLAGS), 624 + GATE(ACLK_PERI, "aclk_peri", "aclk_peri_pre", CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 625 + RK3328_CLKGATE_CON(10), 0, GFLAGS), 626 + 627 + COMPOSITE(SCLK_SDMMC, "clk_sdmmc", mux_2plls_24m_u480m_p, 0, 628 + RK3328_CLKSEL_CON(30), 8, 2, MFLAGS, 0, 8, DFLAGS, 629 + RK3328_CLKGATE_CON(4), 3, GFLAGS), 630 + 631 + COMPOSITE(SCLK_SDIO, "clk_sdio", mux_2plls_24m_u480m_p, 0, 632 + RK3328_CLKSEL_CON(31), 8, 2, MFLAGS, 0, 8, DFLAGS, 633 + RK3328_CLKGATE_CON(4), 4, GFLAGS), 634 + 635 + COMPOSITE(SCLK_EMMC, "clk_emmc", mux_2plls_24m_u480m_p, 0, 636 + RK3328_CLKSEL_CON(32), 8, 2, MFLAGS, 0, 8, DFLAGS, 637 + RK3328_CLKGATE_CON(4), 5, GFLAGS), 638 + 639 + COMPOSITE(SCLK_SDMMC_EXT, "clk_sdmmc_ext", mux_2plls_24m_u480m_p, 0, 640 + RK3328_CLKSEL_CON(43), 8, 2, MFLAGS, 0, 8, DFLAGS, 641 + RK3328_CLKGATE_CON(4), 10, GFLAGS), 642 + 643 + COMPOSITE(SCLK_REF_USB3OTG_SRC, "clk_ref_usb3otg_src", mux_2plls_p, 0, 644 + RK3328_CLKSEL_CON(45), 7, 1, MFLAGS, 0, 7, DFLAGS, 645 + RK3328_CLKGATE_CON(4), 9, GFLAGS), 646 + 647 + MUX(SCLK_REF_USB3OTG, "clk_ref_usb3otg", mux_ref_usb3otg_src_p, CLK_SET_RATE_PARENT, 648 + RK3328_CLKSEL_CON(45), 8, 1, MFLAGS), 649 + 650 + GATE(SCLK_USB3OTG_REF, "clk_usb3otg_ref", "xin24m", 0, 651 + RK3328_CLKGATE_CON(4), 7, GFLAGS), 652 + 653 + COMPOSITE(SCLK_USB3OTG_SUSPEND, "clk_usb3otg_suspend", mux_xin24m_32k_p, 0, 654 + RK3328_CLKSEL_CON(33), 15, 1, MFLAGS, 0, 10, DFLAGS, 655 + RK3328_CLKGATE_CON(4), 8, GFLAGS), 656 + 657 + /* 658 + * Clock-Architecture Diagram 8 659 + */ 660 + 661 + /* PD_GMAC */ 662 + COMPOSITE(ACLK_GMAC, "aclk_gmac", mux_2plls_hdmiphy_p, 0, 663 + RK3328_CLKSEL_CON(35), 6, 2, MFLAGS, 0, 5, DFLAGS, 664 + RK3328_CLKGATE_CON(3), 2, GFLAGS), 665 + COMPOSITE_NOMUX(PCLK_GMAC, "pclk_gmac", "aclk_gmac", 0, 666 + RK3328_CLKSEL_CON(25), 8, 3, DFLAGS, 667 + RK3328_CLKGATE_CON(9), 0, GFLAGS), 668 + 669 + COMPOSITE(SCLK_MAC2IO_SRC, "clk_mac2io_src", mux_2plls_p, 0, 670 + RK3328_CLKSEL_CON(27), 7, 1, MFLAGS, 0, 5, DFLAGS, 671 + RK3328_CLKGATE_CON(3), 1, GFLAGS), 672 + GATE(SCLK_MAC2IO_REF, "clk_mac2io_ref", "clk_mac2io", 0, 673 + RK3328_CLKGATE_CON(9), 7, GFLAGS), 674 + GATE(SCLK_MAC2IO_RX, "clk_mac2io_rx", "clk_mac2io", 0, 675 + RK3328_CLKGATE_CON(9), 4, GFLAGS), 676 + GATE(SCLK_MAC2IO_TX, "clk_mac2io_tx", "clk_mac2io", 0, 677 + RK3328_CLKGATE_CON(9), 5, GFLAGS), 678 + GATE(SCLK_MAC2IO_REFOUT, "clk_mac2io_refout", "clk_mac2io", 0, 679 + RK3328_CLKGATE_CON(9), 6, GFLAGS), 680 + COMPOSITE(SCLK_MAC2IO_OUT, "clk_mac2io_out", mux_2plls_p, 0, 681 + RK3328_CLKSEL_CON(27), 15, 1, MFLAGS, 8, 5, DFLAGS, 682 + RK3328_CLKGATE_CON(3), 5, GFLAGS), 683 + 684 + COMPOSITE(SCLK_MAC2PHY_SRC, "clk_mac2phy_src", mux_2plls_p, 0, 685 + RK3328_CLKSEL_CON(26), 7, 1, MFLAGS, 0, 5, DFLAGS, 686 + RK3328_CLKGATE_CON(3), 0, GFLAGS), 687 + GATE(SCLK_MAC2PHY_REF, "clk_mac2phy_ref", "clk_mac2phy", 0, 688 + RK3328_CLKGATE_CON(9), 3, GFLAGS), 689 + GATE(SCLK_MAC2PHY_RXTX, "clk_mac2phy_rxtx", "clk_mac2phy", 0, 690 + RK3328_CLKGATE_CON(9), 1, GFLAGS), 691 + COMPOSITE_NOMUX(SCLK_MAC2PHY_OUT, "clk_mac2phy_out", "clk_mac2phy", 0, 692 + RK3328_CLKSEL_CON(26), 8, 2, DFLAGS, 693 + RK3328_CLKGATE_CON(9), 2, GFLAGS), 694 + 695 + FACTOR(0, "xin12m", "xin24m", 0, 1, 2), 696 + 697 + /* 698 + * Clock-Architecture Diagram 9 699 + */ 700 + 701 + /* PD_VOP */ 702 + GATE(ACLK_RGA, "aclk_rga", "aclk_rga_pre", 0, RK3328_CLKGATE_CON(21), 10, GFLAGS), 703 + GATE(0, "aclk_rga_niu", "aclk_rga_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(22), 3, GFLAGS), 704 + GATE(ACLK_VOP, "aclk_vop", "aclk_vop_pre", 0, RK3328_CLKGATE_CON(21), 2, GFLAGS), 705 + GATE(0, "aclk_vop_niu", "aclk_vop_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(21), 4, GFLAGS), 706 + 707 + GATE(ACLK_IEP, "aclk_iep", "aclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 6, GFLAGS), 708 + GATE(ACLK_CIF, "aclk_cif", "aclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 8, GFLAGS), 709 + GATE(ACLK_HDCP, "aclk_hdcp", "aclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 15, GFLAGS), 710 + GATE(0, "aclk_vio_niu", "aclk_vio_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(22), 2, GFLAGS), 711 + 712 + GATE(HCLK_VOP, "hclk_vop", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 3, GFLAGS), 713 + GATE(0, "hclk_vop_niu", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 5, GFLAGS), 714 + GATE(HCLK_IEP, "hclk_iep", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 7, GFLAGS), 715 + GATE(HCLK_CIF, "hclk_cif", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 9, GFLAGS), 716 + GATE(HCLK_RGA, "hclk_rga", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 11, GFLAGS), 717 + GATE(0, "hclk_ahb1tom", "hclk_vio_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(21), 12, GFLAGS), 718 + GATE(0, "pclk_vio_h2p", "hclk_vio_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(21), 13, GFLAGS), 719 + GATE(0, "hclk_vio_h2p", "hclk_vio_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(21), 14, GFLAGS), 720 + GATE(HCLK_HDCP, "hclk_hdcp", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(22), 0, GFLAGS), 721 + GATE(HCLK_VIO, "hclk_vio", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(22), 1, GFLAGS), 722 + GATE(PCLK_HDMI, "pclk_hdmi", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(22), 4, GFLAGS), 723 + GATE(PCLK_HDCP, "pclk_hdcp", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(22), 5, GFLAGS), 724 + 725 + /* PD_PERI */ 726 + GATE(0, "aclk_peri_noc", "aclk_peri", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(19), 11, GFLAGS), 727 + GATE(ACLK_USB3OTG, "aclk_usb3otg", "aclk_peri", 0, RK3328_CLKGATE_CON(19), 4, GFLAGS), 728 + 729 + GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 0, GFLAGS), 730 + GATE(HCLK_SDIO, "hclk_sdio", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 1, GFLAGS), 731 + GATE(HCLK_EMMC, "hclk_emmc", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 2, GFLAGS), 732 + GATE(HCLK_SDMMC_EXT, "hclk_sdmmc_ext", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 15, GFLAGS), 733 + GATE(HCLK_HOST0, "hclk_host0", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 6, GFLAGS), 734 + GATE(HCLK_HOST0_ARB, "hclk_host0_arb", "hclk_peri", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(19), 7, GFLAGS), 735 + GATE(HCLK_OTG, "hclk_otg", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 8, GFLAGS), 736 + GATE(HCLK_OTG_PMU, "hclk_otg_pmu", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 9, GFLAGS), 737 + GATE(0, "hclk_peri_niu", "hclk_peri", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(19), 12, GFLAGS), 738 + GATE(0, "pclk_peri_niu", "hclk_peri", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(19), 13, GFLAGS), 739 + 740 + /* PD_GMAC */ 741 + GATE(ACLK_MAC2PHY, "aclk_mac2phy", "aclk_gmac", 0, RK3328_CLKGATE_CON(26), 0, GFLAGS), 742 + GATE(ACLK_MAC2IO, "aclk_mac2io", "aclk_gmac", 0, RK3328_CLKGATE_CON(26), 2, GFLAGS), 743 + GATE(0, "aclk_gmac_niu", "aclk_gmac", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(26), 4, GFLAGS), 744 + GATE(PCLK_MAC2PHY, "pclk_mac2phy", "pclk_gmac", 0, RK3328_CLKGATE_CON(26), 1, GFLAGS), 745 + GATE(PCLK_MAC2IO, "pclk_mac2io", "pclk_gmac", 0, RK3328_CLKGATE_CON(26), 3, GFLAGS), 746 + GATE(0, "pclk_gmac_niu", "pclk_gmac", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(26), 5, GFLAGS), 747 + 748 + /* PD_BUS */ 749 + GATE(0, "aclk_bus_niu", "aclk_bus_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 12, GFLAGS), 750 + GATE(ACLK_DCF, "aclk_dcf", "aclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 11, GFLAGS), 751 + GATE(ACLK_TSP, "aclk_tsp", "aclk_bus_pre", 0, RK3328_CLKGATE_CON(17), 12, GFLAGS), 752 + GATE(0, "aclk_intmem", "aclk_bus_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 0, GFLAGS), 753 + GATE(ACLK_DMAC, "aclk_dmac_bus", "aclk_bus_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 1, GFLAGS), 754 + 755 + GATE(0, "hclk_rom", "hclk_bus_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 2, GFLAGS), 756 + GATE(HCLK_I2S0_8CH, "hclk_i2s0_8ch", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 3, GFLAGS), 757 + GATE(HCLK_I2S1_8CH, "hclk_i2s1_8ch", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 4, GFLAGS), 758 + GATE(HCLK_I2S2_2CH, "hclk_i2s2_2ch", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 5, GFLAGS), 759 + GATE(HCLK_SPDIF_8CH, "hclk_spdif_8ch", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 6, GFLAGS), 760 + GATE(HCLK_TSP, "hclk_tsp", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(17), 11, GFLAGS), 761 + GATE(HCLK_CRYPTO_MST, "hclk_crypto_mst", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 7, GFLAGS), 762 + GATE(HCLK_CRYPTO_SLV, "hclk_crypto_slv", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 8, GFLAGS), 763 + GATE(0, "hclk_bus_niu", "hclk_bus_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 13, GFLAGS), 764 + GATE(HCLK_PDM, "hclk_pdm", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(28), 0, GFLAGS), 765 + 766 + GATE(0, "pclk_bus_niu", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 14, GFLAGS), 767 + GATE(0, "pclk_efuse", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 9, GFLAGS), 768 + GATE(0, "pclk_otp", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(28), 4, GFLAGS), 769 + GATE(PCLK_I2C0, "pclk_i2c0", "pclk_bus", 0, RK3328_CLKGATE_CON(15), 10, GFLAGS), 770 + GATE(PCLK_I2C1, "pclk_i2c1", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 0, GFLAGS), 771 + GATE(PCLK_I2C2, "pclk_i2c2", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 1, GFLAGS), 772 + GATE(PCLK_I2C3, "pclk_i2c3", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 2, GFLAGS), 773 + GATE(PCLK_TIMER, "pclk_timer0", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 3, GFLAGS), 774 + GATE(0, "pclk_stimer", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 4, GFLAGS), 775 + GATE(PCLK_SPI, "pclk_spi", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 5, GFLAGS), 776 + GATE(PCLK_PWM, "pclk_rk_pwm", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 6, GFLAGS), 777 + GATE(PCLK_GPIO0, "pclk_gpio0", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 7, GFLAGS), 778 + GATE(PCLK_GPIO1, "pclk_gpio1", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 8, GFLAGS), 779 + GATE(PCLK_GPIO2, "pclk_gpio2", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 9, GFLAGS), 780 + GATE(PCLK_GPIO3, "pclk_gpio3", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 10, GFLAGS), 781 + GATE(PCLK_UART0, "pclk_uart0", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 11, GFLAGS), 782 + GATE(PCLK_UART1, "pclk_uart1", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 12, GFLAGS), 783 + GATE(PCLK_UART2, "pclk_uart2", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 13, GFLAGS), 784 + GATE(PCLK_TSADC, "pclk_tsadc", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 14, GFLAGS), 785 + GATE(PCLK_DCF, "pclk_dcf", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 15, GFLAGS), 786 + GATE(PCLK_GRF, "pclk_grf", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 0, GFLAGS), 787 + GATE(0, "pclk_cru", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 4, GFLAGS), 788 + GATE(0, "pclk_sgrf", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 6, GFLAGS), 789 + GATE(0, "pclk_sim", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 10, GFLAGS), 790 + GATE(PCLK_SARADC, "pclk_saradc", "pclk_bus", 0, RK3328_CLKGATE_CON(17), 15, GFLAGS), 791 + GATE(0, "pclk_pmu", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(28), 3, GFLAGS), 792 + 793 + GATE(PCLK_USB3PHY_OTG, "pclk_usb3phy_otg", "pclk_phy_pre", 0, RK3328_CLKGATE_CON(28), 1, GFLAGS), 794 + GATE(PCLK_USB3PHY_PIPE, "pclk_usb3phy_pipe", "pclk_phy_pre", 0, RK3328_CLKGATE_CON(28), 2, GFLAGS), 795 + GATE(PCLK_USB3_GRF, "pclk_usb3_grf", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 2, GFLAGS), 796 + GATE(PCLK_USB2_GRF, "pclk_usb2_grf", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 14, GFLAGS), 797 + GATE(0, "pclk_ddrphy", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 13, GFLAGS), 798 + GATE(0, "pclk_acodecphy", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 5, GFLAGS), 799 + GATE(PCLK_HDMIPHY, "pclk_hdmiphy", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 7, GFLAGS), 800 + GATE(0, "pclk_vdacphy", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 8, GFLAGS), 801 + GATE(0, "pclk_phy_niu", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 15, GFLAGS), 802 + 803 + /* PD_MMC */ 804 + MMC(SCLK_SDMMC_DRV, "sdmmc_drv", "sclk_sdmmc", 805 + RK3328_SDMMC_CON0, 1), 806 + MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "sclk_sdmmc", 807 + RK3328_SDMMC_CON1, 1), 808 + 809 + MMC(SCLK_SDIO_DRV, "sdio_drv", "sclk_sdio", 810 + RK3328_SDIO_CON0, 1), 811 + MMC(SCLK_SDIO_SAMPLE, "sdio_sample", "sclk_sdio", 812 + RK3328_SDIO_CON1, 1), 813 + 814 + MMC(SCLK_EMMC_DRV, "emmc_drv", "sclk_emmc", 815 + RK3328_EMMC_CON0, 1), 816 + MMC(SCLK_EMMC_SAMPLE, "emmc_sample", "sclk_emmc", 817 + RK3328_EMMC_CON1, 1), 818 + 819 + MMC(SCLK_SDMMC_EXT_DRV, "sdmmc_ext_drv", "sclk_sdmmc_ext", 820 + RK3328_SDMMC_EXT_CON0, 1), 821 + MMC(SCLK_SDMMC_EXT_SAMPLE, "sdmmc_ext_sample", "sclk_sdmmc_ext", 822 + RK3328_SDMMC_EXT_CON1, 1), 823 + }; 824 + 825 + static const char *const rk3328_critical_clocks[] __initconst = { 826 + "aclk_bus", 827 + "pclk_bus", 828 + "hclk_bus", 829 + "aclk_peri", 830 + "hclk_peri", 831 + "pclk_peri", 832 + "pclk_dbg", 833 + "aclk_core_niu", 834 + "aclk_gic400", 835 + "aclk_intmem", 836 + "hclk_rom", 837 + "pclk_grf", 838 + "pclk_cru", 839 + "pclk_sgrf", 840 + "pclk_timer0", 841 + "clk_timer0", 842 + "pclk_ddr_msch", 843 + "pclk_ddr_mon", 844 + "pclk_ddr_grf", 845 + "clk_ddrupctl", 846 + "clk_ddrmsch", 847 + "hclk_ahb1tom", 848 + "clk_jtag", 849 + "pclk_ddrphy", 850 + "pclk_pmu", 851 + "hclk_otg_pmu", 852 + "aclk_rga_niu", 853 + "pclk_vio_h2p", 854 + "hclk_vio_h2p", 855 + }; 856 + 857 + static void __init rk3328_clk_init(struct device_node *np) 858 + { 859 + struct rockchip_clk_provider *ctx; 860 + void __iomem *reg_base; 861 + 862 + reg_base = of_iomap(np, 0); 863 + if (!reg_base) { 864 + pr_err("%s: could not map cru region\n", __func__); 865 + return; 866 + } 867 + 868 + ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS); 869 + if (IS_ERR(ctx)) { 870 + pr_err("%s: rockchip clk init failed\n", __func__); 871 + iounmap(reg_base); 872 + return; 873 + } 874 + 875 + rockchip_clk_register_plls(ctx, rk3328_pll_clks, 876 + ARRAY_SIZE(rk3328_pll_clks), 877 + RK3328_GRF_SOC_STATUS0); 878 + rockchip_clk_register_branches(ctx, rk3328_clk_branches, 879 + ARRAY_SIZE(rk3328_clk_branches)); 880 + rockchip_clk_protect_critical(rk3328_critical_clocks, 881 + ARRAY_SIZE(rk3328_critical_clocks)); 882 + 883 + rockchip_clk_register_armclk(ctx, ARMCLK, "armclk", 884 + mux_armclk_p, ARRAY_SIZE(mux_armclk_p), 885 + &rk3328_cpuclk_data, rk3328_cpuclk_rates, 886 + ARRAY_SIZE(rk3328_cpuclk_rates)); 887 + 888 + rockchip_register_softrst(np, 11, reg_base + RK3328_SOFTRST_CON(0), 889 + ROCKCHIP_SOFTRST_HIWORD_MASK); 890 + 891 + rockchip_register_restart_notifier(ctx, RK3328_GLB_SRST_FST, NULL); 892 + 893 + rockchip_clk_of_add_provider(np, ctx); 894 + } 895 + CLK_OF_DECLARE(rk3328_cru, "rockchip,rk3328-cru", rk3328_clk_init);
+7 -1
drivers/clk/rockchip/clk.c
··· 344 344 ctx->clk_data.clks = clk_table; 345 345 ctx->clk_data.clk_num = nr_clks; 346 346 ctx->cru_node = np; 347 - ctx->grf = ERR_PTR(-EPROBE_DEFER); 348 347 spin_lock_init(&ctx->lock); 349 348 350 349 ctx->grf = syscon_regmap_lookup_by_phandle(ctx->cru_node, ··· 415 416 flags, ctx->reg_base + list->muxdiv_offset, 416 417 list->mux_shift, list->mux_width, 417 418 list->mux_flags, &ctx->lock); 419 + break; 420 + case branch_muxgrf: 421 + clk = rockchip_clk_register_muxgrf(list->name, 422 + list->parent_names, list->num_parents, 423 + flags, ctx->grf, list->muxdiv_offset, 424 + list->mux_shift, list->mux_width, 425 + list->mux_flags); 418 426 break; 419 427 case branch_divider: 420 428 if (list->div_table)
+40
drivers/clk/rockchip/clk.h
··· 91 91 #define RK3288_EMMC_CON0 0x218 92 92 #define RK3288_EMMC_CON1 0x21c 93 93 94 + #define RK3328_PLL_CON(x) RK2928_PLL_CON(x) 95 + #define RK3328_CLKSEL_CON(x) ((x) * 0x4 + 0x100) 96 + #define RK3328_CLKGATE_CON(x) ((x) * 0x4 + 0x200) 97 + #define RK3328_GRFCLKSEL_CON(x) ((x) * 0x4 + 0x100) 98 + #define RK3328_GLB_SRST_FST 0x9c 99 + #define RK3328_GLB_SRST_SND 0x98 100 + #define RK3328_SOFTRST_CON(x) ((x) * 0x4 + 0x300) 101 + #define RK3328_MODE_CON 0x80 102 + #define RK3328_MISC_CON 0x84 103 + #define RK3328_SDMMC_CON0 0x380 104 + #define RK3328_SDMMC_CON1 0x384 105 + #define RK3328_SDIO_CON0 0x388 106 + #define RK3328_SDIO_CON1 0x38c 107 + #define RK3328_EMMC_CON0 0x390 108 + #define RK3328_EMMC_CON1 0x394 109 + #define RK3328_SDMMC_EXT_CON0 0x398 110 + #define RK3328_SDMMC_EXT_CON1 0x39C 111 + 94 112 #define RK3368_PLL_CON(x) RK2928_PLL_CON(x) 95 113 #define RK3368_CLKSEL_CON(x) ((x) * 0x4 + 0x100) 96 114 #define RK3368_CLKGATE_CON(x) ((x) * 0x4 + 0x200) ··· 148 130 enum rockchip_pll_type { 149 131 pll_rk3036, 150 132 pll_rk3066, 133 + pll_rk3328, 151 134 pll_rk3399, 152 135 }; 153 136 ··· 336 317 void __iomem *reg, int shift, int flags, 337 318 spinlock_t *lock); 338 319 320 + struct clk *rockchip_clk_register_muxgrf(const char *name, 321 + const char *const *parent_names, u8 num_parents, 322 + int flags, struct regmap *grf, int reg, 323 + int shift, int width, int mux_flags); 324 + 339 325 #define PNAME(x) static const char *const x[] __initconst 340 326 341 327 enum rockchip_clk_branch_type { 342 328 branch_composite, 343 329 branch_mux, 330 + branch_muxgrf, 344 331 branch_divider, 345 332 branch_fraction_divider, 346 333 branch_gate, ··· 565 540 { \ 566 541 .id = _id, \ 567 542 .branch_type = branch_mux, \ 543 + .name = cname, \ 544 + .parent_names = pnames, \ 545 + .num_parents = ARRAY_SIZE(pnames), \ 546 + .flags = f, \ 547 + .muxdiv_offset = o, \ 548 + .mux_shift = s, \ 549 + .mux_width = w, \ 550 + .mux_flags = mf, \ 551 + .gate_offset = -1, \ 552 + } 553 + 554 + #define MUXGRF(_id, cname, pnames, f, o, s, w, mf) \ 555 + { \ 556 + .id = _id, \ 557 + .branch_type = branch_muxgrf, \ 568 558 .name = cname, \ 569 559 .parent_names = pnames, \ 570 560 .num_parents = ARRAY_SIZE(pnames), \
+2
include/dt-bindings/clock/rk3188-cru-common.h
··· 108 108 #define PCLK_TSADC 349 109 109 #define PCLK_CPU 350 110 110 #define PCLK_PERI 351 111 + #define PCLK_DDRUPCTL 352 112 + #define PCLK_PUBL 353 111 113 112 114 /* hclk gates */ 113 115 #define HCLK_SDMMC 448
+1
include/dt-bindings/clock/rk3288-cru.h
··· 168 168 #define PCLK_WDT 368 169 169 #define PCLK_EFUSE256 369 170 170 #define PCLK_EFUSE1024 370 171 + #define PCLK_ISP_IN 371 171 172 172 173 /* hclk gates */ 173 174 #define HCLK_GPS 448
+400
include/dt-bindings/clock/rk3328-cru.h
··· 1 + /* 2 + * Copyright (c) 2016 Rockchip Electronics Co. Ltd. 3 + * Author: Elaine <zhangqing@rock-chips.com> 4 + * 5 + * This program is free software; you can redistribute it and/or modify 6 + * it under the terms of the GNU General Public License as published by 7 + * the Free Software Foundation; either version 2 of the License, or 8 + * (at your option) any later version. 9 + * 10 + * This program is distributed in the hope that it will be useful, 11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License for more details. 14 + */ 15 + 16 + #ifndef _DT_BINDINGS_CLK_ROCKCHIP_RK3328_H 17 + #define _DT_BINDINGS_CLK_ROCKCHIP_RK3328_H 18 + 19 + /* core clocks */ 20 + #define PLL_APLL 1 21 + #define PLL_DPLL 2 22 + #define PLL_CPLL 3 23 + #define PLL_GPLL 4 24 + #define PLL_NPLL 5 25 + #define ARMCLK 6 26 + 27 + /* sclk gates (special clocks) */ 28 + #define SCLK_RTC32K 30 29 + #define SCLK_SDMMC_EXT 31 30 + #define SCLK_SPI 32 31 + #define SCLK_SDMMC 33 32 + #define SCLK_SDIO 34 33 + #define SCLK_EMMC 35 34 + #define SCLK_TSADC 36 35 + #define SCLK_SARADC 37 36 + #define SCLK_UART0 38 37 + #define SCLK_UART1 39 38 + #define SCLK_UART2 40 39 + #define SCLK_I2S0 41 40 + #define SCLK_I2S1 42 41 + #define SCLK_I2S2 43 42 + #define SCLK_I2S1_OUT 44 43 + #define SCLK_I2S2_OUT 45 44 + #define SCLK_SPDIF 46 45 + #define SCLK_TIMER0 47 46 + #define SCLK_TIMER1 48 47 + #define SCLK_TIMER2 49 48 + #define SCLK_TIMER3 50 49 + #define SCLK_TIMER4 51 50 + #define SCLK_TIMER5 52 51 + #define SCLK_WIFI 53 52 + #define SCLK_CIF_OUT 54 53 + #define SCLK_I2C0 55 54 + #define SCLK_I2C1 56 55 + #define SCLK_I2C2 57 56 + #define SCLK_I2C3 58 57 + #define SCLK_CRYPTO 59 58 + #define SCLK_PWM 60 59 + #define SCLK_PDM 61 60 + #define SCLK_EFUSE 62 61 + #define SCLK_OTP 63 62 + #define SCLK_DDRCLK 64 63 + #define SCLK_VDEC_CABAC 65 64 + #define SCLK_VDEC_CORE 66 65 + #define SCLK_VENC_DSP 67 66 + #define SCLK_VENC_CORE 68 67 + #define SCLK_RGA 69 68 + #define SCLK_HDMI_SFC 70 69 + #define SCLK_HDMI_CEC 71 70 + #define SCLK_USB3_REF 72 71 + #define SCLK_USB3_SUSPEND 73 72 + #define SCLK_SDMMC_DRV 74 73 + #define SCLK_SDIO_DRV 75 74 + #define SCLK_EMMC_DRV 76 75 + #define SCLK_SDMMC_EXT_DRV 77 76 + #define SCLK_SDMMC_SAMPLE 78 77 + #define SCLK_SDIO_SAMPLE 79 78 + #define SCLK_EMMC_SAMPLE 80 79 + #define SCLK_SDMMC_EXT_SAMPLE 81 80 + #define SCLK_VOP 82 81 + #define SCLK_MAC2PHY_RXTX 83 82 + #define SCLK_MAC2PHY_SRC 84 83 + #define SCLK_MAC2PHY_REF 85 84 + #define SCLK_MAC2PHY_OUT 86 85 + #define SCLK_MAC2IO_RX 87 86 + #define SCLK_MAC2IO_TX 88 87 + #define SCLK_MAC2IO_REFOUT 89 88 + #define SCLK_MAC2IO_REF 90 89 + #define SCLK_MAC2IO_OUT 91 90 + #define SCLK_TSP 92 91 + #define SCLK_HSADC_TSP 93 92 + #define SCLK_USB3PHY_REF 94 93 + #define SCLK_REF_USB3OTG 95 94 + #define SCLK_USB3OTG_REF 96 95 + #define SCLK_USB3OTG_SUSPEND 97 96 + #define SCLK_REF_USB3OTG_SRC 98 97 + #define SCLK_MAC2IO_SRC 99 98 + #define SCLK_MAC2IO 100 99 + #define SCLK_MAC2PHY 101 100 + 101 + /* dclk gates */ 102 + #define DCLK_LCDC 120 103 + #define DCLK_HDMIPHY 121 104 + #define HDMIPHY 122 105 + #define USB480M 123 106 + #define DCLK_LCDC_SRC 124 107 + 108 + /* aclk gates */ 109 + #define ACLK_AXISRAM 130 110 + #define ACLK_VOP_PRE 131 111 + #define ACLK_USB3OTG 132 112 + #define ACLK_RGA_PRE 133 113 + #define ACLK_DMAC 134 114 + #define ACLK_GPU 135 115 + #define ACLK_BUS_PRE 136 116 + #define ACLK_PERI_PRE 137 117 + #define ACLK_RKVDEC_PRE 138 118 + #define ACLK_RKVDEC 139 119 + #define ACLK_RKVENC 140 120 + #define ACLK_VPU_PRE 141 121 + #define ACLK_VIO_PRE 142 122 + #define ACLK_VPU 143 123 + #define ACLK_VIO 144 124 + #define ACLK_VOP 145 125 + #define ACLK_GMAC 146 126 + #define ACLK_H265 147 127 + #define ACLK_H264 148 128 + #define ACLK_MAC2PHY 149 129 + #define ACLK_MAC2IO 150 130 + #define ACLK_DCF 151 131 + #define ACLK_TSP 152 132 + #define ACLK_PERI 153 133 + #define ACLK_RGA 154 134 + #define ACLK_IEP 155 135 + #define ACLK_CIF 156 136 + #define ACLK_HDCP 157 137 + 138 + /* pclk gates */ 139 + #define PCLK_GPIO0 200 140 + #define PCLK_GPIO1 201 141 + #define PCLK_GPIO2 202 142 + #define PCLK_GPIO3 203 143 + #define PCLK_GRF 204 144 + #define PCLK_I2C0 205 145 + #define PCLK_I2C1 206 146 + #define PCLK_I2C2 207 147 + #define PCLK_I2C3 208 148 + #define PCLK_SPI 209 149 + #define PCLK_UART0 210 150 + #define PCLK_UART1 211 151 + #define PCLK_UART2 212 152 + #define PCLK_TSADC 213 153 + #define PCLK_PWM 214 154 + #define PCLK_TIMER 215 155 + #define PCLK_BUS_PRE 216 156 + #define PCLK_PERI_PRE 217 157 + #define PCLK_HDMI_CTRL 218 158 + #define PCLK_HDMI_PHY 219 159 + #define PCLK_GMAC 220 160 + #define PCLK_H265 221 161 + #define PCLK_MAC2PHY 222 162 + #define PCLK_MAC2IO 223 163 + #define PCLK_USB3PHY_OTG 224 164 + #define PCLK_USB3PHY_PIPE 225 165 + #define PCLK_USB3_GRF 226 166 + #define PCLK_USB2_GRF 227 167 + #define PCLK_HDMIPHY 228 168 + #define PCLK_DDR 229 169 + #define PCLK_PERI 230 170 + #define PCLK_HDMI 231 171 + #define PCLK_HDCP 232 172 + #define PCLK_DCF 233 173 + #define PCLK_SARADC 234 174 + 175 + /* hclk gates */ 176 + #define HCLK_PERI 308 177 + #define HCLK_TSP 309 178 + #define HCLK_GMAC 310 179 + #define HCLK_I2S0_8CH 311 180 + #define HCLK_I2S1_8CH 313 181 + #define HCLK_I2S2_2CH 313 182 + #define HCLK_SPDIF_8CH 314 183 + #define HCLK_VOP 315 184 + #define HCLK_NANDC 316 185 + #define HCLK_SDMMC 317 186 + #define HCLK_SDIO 318 187 + #define HCLK_EMMC 319 188 + #define HCLK_SDMMC_EXT 320 189 + #define HCLK_RKVDEC_PRE 321 190 + #define HCLK_RKVDEC 322 191 + #define HCLK_RKVENC 323 192 + #define HCLK_VPU_PRE 324 193 + #define HCLK_VIO_PRE 325 194 + #define HCLK_VPU 326 195 + #define HCLK_VIO 327 196 + #define HCLK_BUS_PRE 328 197 + #define HCLK_PERI_PRE 329 198 + #define HCLK_H264 330 199 + #define HCLK_CIF 331 200 + #define HCLK_OTG_PMU 332 201 + #define HCLK_OTG 333 202 + #define HCLK_HOST0 334 203 + #define HCLK_HOST0_ARB 335 204 + #define HCLK_CRYPTO_MST 336 205 + #define HCLK_CRYPTO_SLV 337 206 + #define HCLK_PDM 338 207 + #define HCLK_IEP 339 208 + #define HCLK_RGA 340 209 + #define HCLK_HDCP 341 210 + 211 + #define CLK_NR_CLKS (HCLK_HDCP + 1) 212 + 213 + /* soft-reset indices */ 214 + #define SRST_CORE0_PO 0 215 + #define SRST_CORE1_PO 1 216 + #define SRST_CORE2_PO 2 217 + #define SRST_CORE3_PO 3 218 + #define SRST_CORE0 4 219 + #define SRST_CORE1 5 220 + #define SRST_CORE2 6 221 + #define SRST_CORE3 7 222 + #define SRST_CORE0_DBG 8 223 + #define SRST_CORE1_DBG 9 224 + #define SRST_CORE2_DBG 10 225 + #define SRST_CORE3_DBG 11 226 + #define SRST_TOPDBG 12 227 + #define SRST_CORE_NIU 13 228 + #define SRST_STRC_A 14 229 + #define SRST_L2C 15 230 + 231 + #define SRST_A53_GIC 18 232 + #define SRST_DAP 19 233 + #define SRST_PMU_P 21 234 + #define SRST_EFUSE 22 235 + #define SRST_BUSSYS_H 23 236 + #define SRST_BUSSYS_P 24 237 + #define SRST_SPDIF 25 238 + #define SRST_INTMEM 26 239 + #define SRST_ROM 27 240 + #define SRST_GPIO0 28 241 + #define SRST_GPIO1 29 242 + #define SRST_GPIO2 30 243 + #define SRST_GPIO3 31 244 + 245 + #define SRST_I2S0 32 246 + #define SRST_I2S1 33 247 + #define SRST_I2S2 34 248 + #define SRST_I2S0_H 35 249 + #define SRST_I2S1_H 36 250 + #define SRST_I2S2_H 37 251 + #define SRST_UART0 38 252 + #define SRST_UART1 39 253 + #define SRST_UART2 40 254 + #define SRST_UART0_P 41 255 + #define SRST_UART1_P 42 256 + #define SRST_UART2_P 43 257 + #define SRST_I2C0 44 258 + #define SRST_I2C1 45 259 + #define SRST_I2C2 46 260 + #define SRST_I2C3 47 261 + 262 + #define SRST_I2C0_P 48 263 + #define SRST_I2C1_P 49 264 + #define SRST_I2C2_P 50 265 + #define SRST_I2C3_P 51 266 + #define SRST_EFUSE_SE_P 52 267 + #define SRST_EFUSE_NS_P 53 268 + #define SRST_PWM0 54 269 + #define SRST_PWM0_P 55 270 + #define SRST_DMA 56 271 + #define SRST_TSP_A 57 272 + #define SRST_TSP_H 58 273 + #define SRST_TSP 59 274 + #define SRST_TSP_HSADC 60 275 + #define SRST_DCF_A 61 276 + #define SRST_DCF_P 62 277 + 278 + #define SRST_SCR 64 279 + #define SRST_SPI 65 280 + #define SRST_TSADC 66 281 + #define SRST_TSADC_P 67 282 + #define SRST_CRYPTO 68 283 + #define SRST_SGRF 69 284 + #define SRST_GRF 70 285 + #define SRST_USB_GRF 71 286 + #define SRST_TIMER_6CH_P 72 287 + #define SRST_TIMER0 73 288 + #define SRST_TIMER1 74 289 + #define SRST_TIMER2 75 290 + #define SRST_TIMER3 76 291 + #define SRST_TIMER4 77 292 + #define SRST_TIMER5 78 293 + #define SRST_USB3GRF 79 294 + 295 + #define SRST_PHYNIU 80 296 + #define SRST_HDMIPHY 81 297 + #define SRST_VDAC 82 298 + #define SRST_ACODEC_p 83 299 + #define SRST_SARADC 85 300 + #define SRST_SARADC_P 86 301 + #define SRST_GRF_DDR 87 302 + #define SRST_DFIMON 88 303 + #define SRST_MSCH 89 304 + #define SRST_DDRMSCH 91 305 + #define SRST_DDRCTRL 92 306 + #define SRST_DDRCTRL_P 93 307 + #define SRST_DDRPHY 94 308 + #define SRST_DDRPHY_P 95 309 + 310 + #define SRST_GMAC_NIU_A 96 311 + #define SRST_GMAC_NIU_P 97 312 + #define SRST_GMAC2PHY_A 98 313 + #define SRST_GMAC2IO_A 99 314 + #define SRST_MACPHY 100 315 + #define SRST_OTP_PHY 101 316 + #define SRST_GPU_A 102 317 + #define SRST_GPU_NIU_A 103 318 + #define SRST_SDMMCEXT 104 319 + #define SRST_PERIPH_NIU_A 105 320 + #define SRST_PERIHP_NIU_H 106 321 + #define SRST_PERIHP_P 107 322 + #define SRST_PERIPHSYS_H 108 323 + #define SRST_MMC0 109 324 + #define SRST_SDIO 110 325 + #define SRST_EMMC 111 326 + 327 + #define SRST_USB2OTG_H 112 328 + #define SRST_USB2OTG 113 329 + #define SRST_USB2OTG_ADP 114 330 + #define SRST_USB2HOST_H 115 331 + #define SRST_USB2HOST_ARB 116 332 + #define SRST_USB2HOST_AUX 117 333 + #define SRST_USB2HOST_EHCIPHY 118 334 + #define SRST_USB2HOST_UTMI 119 335 + #define SRST_USB3OTG 120 336 + #define SRST_USBPOR 121 337 + #define SRST_USB2OTG_UTMI 122 338 + #define SRST_USB2HOST_PHY_UTMI 123 339 + #define SRST_USB3OTG_UTMI 124 340 + #define SRST_USB3PHY_U2 125 341 + #define SRST_USB3PHY_U3 126 342 + #define SRST_USB3PHY_PIPE 127 343 + 344 + #define SRST_VIO_A 128 345 + #define SRST_VIO_BUS_H 129 346 + #define SRST_VIO_H2P_H 130 347 + #define SRST_VIO_ARBI_H 131 348 + #define SRST_VOP_NIU_A 132 349 + #define SRST_VOP_A 133 350 + #define SRST_VOP_H 134 351 + #define SRST_VOP_D 135 352 + #define SRST_RGA 136 353 + #define SRST_RGA_NIU_A 137 354 + #define SRST_RGA_A 138 355 + #define SRST_RGA_H 139 356 + #define SRST_IEP_A 140 357 + #define SRST_IEP_H 141 358 + #define SRST_HDMI 142 359 + #define SRST_HDMI_P 143 360 + 361 + #define SRST_HDCP_A 144 362 + #define SRST_HDCP 145 363 + #define SRST_HDCP_H 146 364 + #define SRST_CIF_A 147 365 + #define SRST_CIF_H 148 366 + #define SRST_CIF_P 149 367 + #define SRST_OTP_P 150 368 + #define SRST_OTP_SBPI 151 369 + #define SRST_OTP_USER 152 370 + #define SRST_DDRCTRL_A 153 371 + #define SRST_DDRSTDY_P 154 372 + #define SRST_DDRSTDY 155 373 + #define SRST_PDM_H 156 374 + #define SRST_PDM 157 375 + #define SRST_USB3PHY_OTG_P 158 376 + #define SRST_USB3PHY_PIPE_P 159 377 + 378 + #define SRST_VCODEC_A 160 379 + #define SRST_VCODEC_NIU_A 161 380 + #define SRST_VCODEC_H 162 381 + #define SRST_VCODEC_NIU_H 163 382 + #define SRST_VDEC_A 164 383 + #define SRST_VDEC_NIU_A 165 384 + #define SRST_VDEC_H 166 385 + #define SRST_VDEC_NIU_H 167 386 + #define SRST_VDEC_CORE 168 387 + #define SRST_VDEC_CABAC 169 388 + #define SRST_DDRPHYDIV 175 389 + 390 + #define SRST_RKVENC_NIU_A 176 391 + #define SRST_RKVENC_NIU_H 177 392 + #define SRST_RKVENC_H265_A 178 393 + #define SRST_RKVENC_H265_P 179 394 + #define SRST_RKVENC_H265_CORE 180 395 + #define SRST_RKVENC_H265_DSP 181 396 + #define SRST_RKVENC_H264_A 182 397 + #define SRST_RKVENC_H264_H 183 398 + #define SRST_RKVENC_INTMEM 184 399 + 400 + #endif