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

Merge tag 'clk-for-linus-3.20' of git://git.linaro.org/people/mike.turquette/linux

Pull clock framework updates from Mike Turquette:
"The clock framework changes contain the usual driver additions,
enhancements and fixes mostly for ARM32, ARM64, MIPS and Power-based
devices.

Additionally the framework core underwent a bit of surgery with two
major changes:

- The boundary between the clock core and clock providers (e.g clock
drivers) is now more well defined with dedicated provider helper
functions. struct clk no longer maps 1:1 with the hardware clock
but is a true per-user cookie which helps us tracker users of
hardware clocks and debug bad behavior.

- The addition of rate constraints for clocks. Rate ranges are now
supported which are analogous to the voltage ranges in the
regulator framework.

Unfortunately these changes to the core created some breakeage. We
think we fixed it all up but for this reason there are lots of last
minute commits trying to undo the damage"

* tag 'clk-for-linus-3.20' of git://git.linaro.org/people/mike.turquette/linux: (113 commits)
clk: Only recalculate the rate if needed
Revert "clk: mxs: Fix invalid 32-bit access to frac registers"
clk: qoriq: Add support for the platform PLL
powerpc/corenet: Enable CLK_QORIQ
clk: Replace explicit clk assignment with __clk_hw_set_clk
clk: Add __clk_hw_set_clk helper function
clk: Don't dereference parent clock if is NULL
MIPS: Alchemy: Remove bogus args from alchemy_clk_fgcs_detr
clkdev: Always allocate a struct clk and call __clk_get() w/ CCF
clk: shmobile: div6: Avoid division by zero in .round_rate()
clk: mxs: Fix invalid 32-bit access to frac registers
clk: omap: compile legacy omap3 clocks conditionally
clkdev: Export clk_register_clkdev
clk: Add rate constraints to clocks
clk: remove clk-private.h
pci: xgene: do not use clk-private.h
arm: omap2+ remove dead clock code
clk: Make clk API return per-user struct clk instances
clk: tegra: Define PLLD_DSI and remove dsia(b)_mux
clk: tegra: Add support for the Tegra132 CAR IP block
...

+13048 -5705
+2
Documentation/clk.txt
··· 73 73 unsigned long *parent_rate); 74 74 long (*determine_rate)(struct clk_hw *hw, 75 75 unsigned long rate, 76 + unsigned long min_rate, 77 + unsigned long max_rate, 76 78 unsigned long *best_parent_rate, 77 79 struct clk_hw **best_parent_clk); 78 80 int (*set_parent)(struct clk_hw *hw, u8 index);
+15
Documentation/devicetree/bindings/clock/exynos7-clock.txt
··· 34 34 - "samsung,exynos7-clock-peris" 35 35 - "samsung,exynos7-clock-fsys0" 36 36 - "samsung,exynos7-clock-fsys1" 37 + - "samsung,exynos7-clock-mscl" 38 + - "samsung,exynos7-clock-aud" 37 39 38 40 - reg: physical base address of the controller and the length of 39 41 memory mapped region. ··· 55 53 - dout_sclk_bus1_pll 56 54 - dout_sclk_cc_pll 57 55 - dout_sclk_mfc_pll 56 + - dout_sclk_aud_pll 58 57 59 58 Input clocks for top1 clock controller: 60 59 - fin_pll ··· 79 76 - sclk_uart1 80 77 - sclk_uart2 81 78 - sclk_uart3 79 + - sclk_spi0 80 + - sclk_spi1 81 + - sclk_spi2 82 + - sclk_spi3 83 + - sclk_spi4 84 + - sclk_i2s1 85 + - sclk_pcm1 86 + - sclk_spdif 82 87 83 88 Input clocks for peris clock controller: 84 89 - fin_pll ··· 102 91 - dout_aclk_fsys1_200 103 92 - dout_sclk_mmc0 104 93 - dout_sclk_mmc1 94 + 95 + Input clocks for aud clock controller: 96 + - fin_pll 97 + - fout_aud_pll
+6 -4
Documentation/devicetree/bindings/clock/nvidia,tegra124-car.txt
··· 1 - NVIDIA Tegra124 Clock And Reset Controller 1 + NVIDIA Tegra124 and Tegra132 Clock And Reset Controller 2 2 3 3 This binding uses the common clock binding: 4 4 Documentation/devicetree/bindings/clock/clock-bindings.txt ··· 7 7 for muxing and gating Tegra's clocks, and setting their rates. 8 8 9 9 Required properties : 10 - - compatible : Should be "nvidia,tegra124-car" 10 + - compatible : Should be "nvidia,tegra124-car" or "nvidia,tegra132-car" 11 11 - reg : Should contain CAR registers location and length 12 12 - clocks : Should contain phandle and clock specifiers for two clocks: 13 13 the 32 KHz "32k_in", and the board-specific oscillator "osc". 14 14 - #clock-cells : Should be 1. 15 15 In clock consumers, this cell represents the clock ID exposed by the 16 - CAR. The assignments may be found in header file 17 - <dt-bindings/clock/tegra124-car.h>. 16 + CAR. The assignments may be found in the header files 17 + <dt-bindings/clock/tegra124-car-common.h> (which covers IDs common 18 + to Tegra124 and Tegra132) and <dt-bindings/clock/tegra124-car.h> 19 + (for Tegra124-specific clocks). 18 20 - #reset-cells : Should be 1. 19 21 In clock consumers, this cell represents the bit number in the CAR's 20 22 array of CLK_RST_CONTROLLER_RST_DEVICES_* registers.
+21
Documentation/devicetree/bindings/clock/qcom,lcc.txt
··· 1 + Qualcomm LPASS Clock & Reset Controller Binding 2 + ------------------------------------------------ 3 + 4 + Required properties : 5 + - compatible : shall contain only one of the following: 6 + 7 + "qcom,lcc-msm8960" 8 + "qcom,lcc-apq8064" 9 + "qcom,lcc-ipq8064" 10 + 11 + - reg : shall contain base register location and length 12 + - #clock-cells : shall contain 1 13 + - #reset-cells : shall contain 1 14 + 15 + Example: 16 + clock-controller@28000000 { 17 + compatible = "qcom,lcc-ipq8064"; 18 + reg = <0x28000000 0x1000>; 19 + #clock-cells = <1>; 20 + #reset-cells = <1>; 21 + };
+3 -2
Documentation/devicetree/bindings/clock/qoriq-clock.txt
··· 1 - * Clock Block on Freescale CoreNet Platforms 1 + * Clock Block on Freescale QorIQ Platforms 2 2 3 - Freescale CoreNet chips take primary clocking input from the external 3 + Freescale qoriq chips take primary clocking input from the external 4 4 SYSCLK signal. The SYSCLK input (frequency) is multiplied using 5 5 multiple phase locked loops (PLL) to create a variety of frequencies 6 6 which can then be passed to a variety of internal logic, including ··· 29 29 * "fsl,t4240-clockgen" 30 30 * "fsl,b4420-clockgen" 31 31 * "fsl,b4860-clockgen" 32 + * "fsl,ls1021a-clockgen" 32 33 Chassis clock strings include: 33 34 * "fsl,qoriq-clockgen-1.0": for chassis 1.0 clocks 34 35 * "fsl,qoriq-clockgen-2.0": for chassis 2.0 clocks
+1
Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt
··· 11 11 12 12 - compatible: Must be one of the following 13 13 - "renesas,r7s72100-mstp-clocks" for R7S72100 (RZ) MSTP gate clocks 14 + - "renesas,r8a73a4-mstp-clocks" for R8A73A4 (R-Mobile APE6) MSTP gate clocks 14 15 - "renesas,r8a7740-mstp-clocks" for R8A7740 (R-Mobile A1) MSTP gate clocks 15 16 - "renesas,r8a7779-mstp-clocks" for R8A7779 (R-Car H1) MSTP gate clocks 16 17 - "renesas,r8a7790-mstp-clocks" for R8A7790 (R-Car H2) MSTP gate clocks
+33
Documentation/devicetree/bindings/clock/renesas,r8a73a4-cpg-clocks.txt
··· 1 + * Renesas R8A73A4 Clock Pulse Generator (CPG) 2 + 3 + The CPG generates core clocks for the R8A73A4 SoC. It includes five PLLs 4 + and several fixed ratio dividers. 5 + 6 + Required Properties: 7 + 8 + - compatible: Must be "renesas,r8a73a4-cpg-clocks" 9 + 10 + - reg: Base address and length of the memory resource used by the CPG 11 + 12 + - clocks: Reference to the parent clocks ("extal1" and "extal2") 13 + 14 + - #clock-cells: Must be 1 15 + 16 + - clock-output-names: The names of the clocks. Supported clocks are "main", 17 + "pll0", "pll1", "pll2", "pll2s", "pll2h", "z", "z2", "i", "m3", "b", 18 + "m1", "m2", "zx", "zs", and "hp". 19 + 20 + 21 + Example 22 + ------- 23 + 24 + cpg_clocks: cpg_clocks@e6150000 { 25 + compatible = "renesas,r8a73a4-cpg-clocks"; 26 + reg = <0 0xe6150000 0 0x10000>; 27 + clocks = <&extal1_clk>, <&extal2_clk>; 28 + #clock-cells = <1>; 29 + clock-output-names = "main", "pll0", "pll1", "pll2", 30 + "pll2s", "pll2h", "z", "z2", 31 + "i", "m3", "b", "m1", "m2", 32 + "zx", "zs", "hp"; 33 + };
+8 -4
Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt
··· 8 8 - compatible: Must be one of 9 9 - "renesas,r8a7790-cpg-clocks" for the r8a7790 CPG 10 10 - "renesas,r8a7791-cpg-clocks" for the r8a7791 CPG 11 + - "renesas,r8a7793-cpg-clocks" for the r8a7793 CPG 11 12 - "renesas,r8a7794-cpg-clocks" for the r8a7794 CPG 12 13 - "renesas,rcar-gen2-cpg-clocks" for the generic R-Car Gen2 CPG 13 14 14 15 - reg: Base address and length of the memory resource used by the CPG 15 16 16 - - clocks: Reference to the parent clock 17 + - clocks: References to the parent clocks: first to the EXTAL clock, second 18 + to the USB_EXTAL clock 17 19 - #clock-cells: Must be 1 18 20 - clock-output-names: The names of the clocks. Supported clocks are "main", 19 - "pll0", "pll1", "pll3", "lb", "qspi", "sdh", "sd0", "sd1" and "z" 21 + "pll0", "pll1", "pll3", "lb", "qspi", "sdh", "sd0", "sd1", "z", "rcan", and 22 + "adsp" 20 23 21 24 22 25 Example ··· 29 26 compatible = "renesas,r8a7790-cpg-clocks", 30 27 "renesas,rcar-gen2-cpg-clocks"; 31 28 reg = <0 0xe6150000 0 0x1000>; 32 - clocks = <&extal_clk>; 29 + clocks = <&extal_clk &usb_extal_clk>; 33 30 #clock-cells = <1>; 34 31 clock-output-names = "main", "pll0, "pll1", "pll3", 35 - "lb", "qspi", "sdh", "sd0", "sd1", "z"; 32 + "lb", "qspi", "sdh", "sd0", "sd1", "z", 33 + "rcan", "adsp"; 36 34 };
+36 -7
Documentation/devicetree/bindings/clock/sunxi.txt
··· 26 26 "allwinner,sun5i-a10s-ahb-gates-clk" - for the AHB gates on A10s 27 27 "allwinner,sun7i-a20-ahb-gates-clk" - for the AHB gates on A20 28 28 "allwinner,sun6i-a31-ar100-clk" - for the AR100 on A31 29 - "allwinner,sun6i-a31-ahb1-mux-clk" - for the AHB1 multiplexer on A31 29 + "allwinner,sun6i-a31-ahb1-clk" - for the AHB1 clock on A31 30 30 "allwinner,sun6i-a31-ahb1-gates-clk" - for the AHB1 gates on A31 31 31 "allwinner,sun8i-a23-ahb1-gates-clk" - for the AHB1 gates on A23 32 32 "allwinner,sun9i-a80-ahb0-gates-clk" - for the AHB0 gates on A80 ··· 55 55 "allwinner,sun6i-a31-apb2-gates-clk" - for the APB2 gates on A31 56 56 "allwinner,sun8i-a23-apb2-gates-clk" - for the APB2 gates on A23 57 57 "allwinner,sun5i-a13-mbus-clk" - for the MBUS clock on A13 58 - "allwinner,sun4i-a10-mmc-output-clk" - for the MMC output clock on A10 59 - "allwinner,sun4i-a10-mmc-sample-clk" - for the MMC sample clock on A10 58 + "allwinner,sun4i-a10-mmc-clk" - for the MMC clock 59 + "allwinner,sun9i-a80-mmc-clk" - for mmc module clocks on A80 60 + "allwinner,sun9i-a80-mmc-config-clk" - for mmc gates + resets on A80 60 61 "allwinner,sun4i-a10-mod0-clk" - for the module 0 family of clocks 62 + "allwinner,sun9i-a80-mod0-clk" - for module 0 (storage) clocks on A80 61 63 "allwinner,sun8i-a23-mbus-clk" - for the MBUS clock on A23 62 64 "allwinner,sun7i-a20-out-clk" - for the external output clocks 63 65 "allwinner,sun7i-a20-gmac-clk" - for the GMAC clock module on A20/A31 ··· 75 73 - #clock-cells : from common clock binding; shall be set to 0 except for 76 74 the following compatibles where it shall be set to 1: 77 75 "allwinner,*-gates-clk", "allwinner,sun4i-pll5-clk", 78 - "allwinner,sun4i-pll6-clk", "allwinner,sun6i-a31-pll6-clk" 76 + "allwinner,sun4i-pll6-clk", "allwinner,sun6i-a31-pll6-clk", 77 + "allwinner,*-usb-clk", "allwinner,*-mmc-clk", 78 + "allwinner,*-mmc-config-clk" 79 79 - clock-output-names : shall be the corresponding names of the outputs. 80 80 If the clock module only has one output, the name shall be the 81 81 module name. 82 82 83 83 And "allwinner,*-usb-clk" clocks also require: 84 84 - reset-cells : shall be set to 1 85 + 86 + The "allwinner,sun9i-a80-mmc-config-clk" clock also requires: 87 + - #reset-cells : shall be set to 1 88 + - resets : shall be the reset control phandle for the mmc block. 85 89 86 90 For "allwinner,sun7i-a20-gmac-clk", the parent clocks shall be fixed rate 87 91 dummy clocks at 25 MHz and 125 MHz, respectively. See example. ··· 102 94 For "allwinner,sun6i-a31-pll6-clk", there are 2 outputs. The first output 103 95 is the normal PLL6 output, or "pll6". The second output is rate doubled 104 96 PLL6, or "pll6x2". 97 + 98 + The "allwinner,*-mmc-clk" clocks have three different outputs: the 99 + main clock, with the ID 0, and the output and sample clocks, with the 100 + IDs 1 and 2, respectively. 101 + 102 + The "allwinner,sun9i-a80-mmc-config-clk" clock has one clock/reset output 103 + per mmc controller. The number of outputs is determined by the size of 104 + the address block, which is related to the overall mmc block. 105 105 106 106 For example: 107 107 ··· 154 138 }; 155 139 156 140 mmc0_clk: clk@01c20088 { 157 - #clock-cells = <0>; 158 - compatible = "allwinner,sun4i-mod0-clk"; 141 + #clock-cells = <1>; 142 + compatible = "allwinner,sun4i-a10-mmc-clk"; 159 143 reg = <0x01c20088 0x4>; 160 144 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>; 161 - clock-output-names = "mmc0"; 145 + clock-output-names = "mmc0", "mmc0_output", "mmc0_sample"; 162 146 }; 163 147 164 148 mii_phy_tx_clk: clk@2 { ··· 185 169 */ 186 170 clocks = <&mii_phy_tx_clk>, <&gmac_int_tx_clk>; 187 171 clock-output-names = "gmac"; 172 + }; 173 + 174 + mmc_config_clk: clk@01c13000 { 175 + compatible = "allwinner,sun9i-a80-mmc-config-clk"; 176 + reg = <0x01c13000 0x10>; 177 + clocks = <&ahb0_gates 8>; 178 + clock-names = "ahb"; 179 + resets = <&ahb0_resets 8>; 180 + reset-names = "ahb"; 181 + #clock-cells = <1>; 182 + #reset-cells = <1>; 183 + clock-output-names = "mmc0_config", "mmc1_config", 184 + "mmc2_config", "mmc3_config"; 188 185 };
+42
Documentation/devicetree/bindings/clock/ti,cdce706.txt
··· 1 + Bindings for Texas Instruments CDCE706 programmable 3-PLL clock 2 + synthesizer/multiplier/divider. 3 + 4 + Reference: http://www.ti.com/lit/ds/symlink/cdce706.pdf 5 + 6 + I2C device node required properties: 7 + - compatible: shall be "ti,cdce706". 8 + - reg: i2c device address, shall be in range [0x68...0x6b]. 9 + - #clock-cells: from common clock binding; shall be set to 1. 10 + - clocks: from common clock binding; list of parent clock 11 + handles, shall be reference clock(s) connected to CLK_IN0 12 + and CLK_IN1 pins. 13 + - clock-names: shall be clk_in0 and/or clk_in1. Use clk_in0 14 + in case of crystal oscillator or differential signal input 15 + configuration. Use clk_in0 and clk_in1 in case of independent 16 + single-ended LVCMOS inputs configuration. 17 + 18 + Example: 19 + 20 + clocks { 21 + clk54: clk54 { 22 + #clock-cells = <0>; 23 + compatible = "fixed-clock"; 24 + clock-frequency = <54000000>; 25 + }; 26 + }; 27 + ... 28 + i2c0: i2c-master@0d090000 { 29 + ... 30 + cdce706: clock-synth@69 { 31 + compatible = "ti,cdce706"; 32 + #clock-cells = <1>; 33 + reg = <0x69>; 34 + clocks = <&clk54>; 35 + clock-names = "clk_in0"; 36 + }; 37 + }; 38 + ... 39 + simple-audio-card,codec { 40 + ... 41 + clocks = <&cdce706 4>; 42 + };
+33
Documentation/devicetree/bindings/clock/ti/fapll.txt
··· 1 + Binding for Texas Instruments FAPLL clock. 2 + 3 + Binding status: Unstable - ABI compatibility may be broken in the future 4 + 5 + This binding uses the common clock binding[1]. It assumes a 6 + register-mapped FAPLL with usually two selectable input clocks 7 + (reference clock and bypass clock), and one or more child 8 + syntesizers. 9 + 10 + [1] Documentation/devicetree/bindings/clock/clock-bindings.txt 11 + 12 + Required properties: 13 + - compatible : shall be "ti,dm816-fapll-clock" 14 + - #clock-cells : from common clock binding; shall be set to 0. 15 + - clocks : link phandles of parent clocks (clk-ref and clk-bypass) 16 + - reg : address and length of the register set for controlling the FAPLL. 17 + 18 + Examples: 19 + main_fapll: main_fapll { 20 + #clock-cells = <1>; 21 + compatible = "ti,dm816-fapll-clock"; 22 + reg = <0x400 0x40>; 23 + clocks = <&sys_clkin_ck &sys_clkin_ck>; 24 + clock-indices = <1>, <2>, <3>, <4>, <5>, 25 + <6>, <7>; 26 + clock-output-names = "main_pll_clk1", 27 + "main_pll_clk2", 28 + "main_pll_clk3", 29 + "main_pll_clk4", 30 + "main_pll_clk5", 31 + "main_pll_clk6", 32 + "main_pll_clk7"; 33 + };
+4 -4
Documentation/devicetree/bindings/mmc/sunxi-mmc.txt
··· 10 10 Required properties: 11 11 - compatible : "allwinner,sun4i-a10-mmc" or "allwinner,sun5i-a13-mmc" 12 12 - reg : mmc controller base registers 13 - - clocks : a list with 2 phandle + clock specifier pairs 14 - - clock-names : must contain "ahb" and "mmc" 13 + - clocks : a list with 4 phandle + clock specifier pairs 14 + - clock-names : must contain "ahb", "mmc", "output" and "sample" 15 15 - interrupts : mmc controller interrupt 16 16 17 17 Optional properties: ··· 25 25 mmc0: mmc@01c0f000 { 26 26 compatible = "allwinner,sun5i-a13-mmc"; 27 27 reg = <0x01c0f000 0x1000>; 28 - clocks = <&ahb_gates 8>, <&mmc0_clk>; 29 - clock-names = "ahb", "mod"; 28 + clocks = <&ahb_gates 8>, <&mmc0_clk>, <&mmc0_output_clk>, <&mmc0_sample_clk>; 29 + clock-names = "ahb", "mod", "output", "sample"; 30 30 interrupts = <0 32 4>; 31 31 status = "disabled"; 32 32 };
+5
MAINTAINERS
··· 9719 9719 S: Maintained 9720 9720 F: drivers/thermal/ti-soc-thermal/ 9721 9721 9722 + TI CDCE706 CLOCK DRIVER 9723 + M: Max Filippov <jcmvbkbc@gmail.com> 9724 + S: Maintained 9725 + F: drivers/clk/clk-cdce706.c 9726 + 9722 9727 TI CLOCK DRIVER 9723 9728 M: Tero Kristo <t-kristo@ti.com> 9724 9729 L: linux-omap@vger.kernel.org
+52 -20
arch/arm/boot/dts/sun4i-a10.dtsi
··· 294 294 }; 295 295 296 296 mmc0_clk: clk@01c20088 { 297 - #clock-cells = <0>; 298 - compatible = "allwinner,sun4i-a10-mod0-clk"; 297 + #clock-cells = <1>; 298 + compatible = "allwinner,sun4i-a10-mmc-clk"; 299 299 reg = <0x01c20088 0x4>; 300 300 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>; 301 - clock-output-names = "mmc0"; 301 + clock-output-names = "mmc0", 302 + "mmc0_output", 303 + "mmc0_sample"; 302 304 }; 303 305 304 306 mmc1_clk: clk@01c2008c { 305 - #clock-cells = <0>; 306 - compatible = "allwinner,sun4i-a10-mod0-clk"; 307 + #clock-cells = <1>; 308 + compatible = "allwinner,sun4i-a10-mmc-clk"; 307 309 reg = <0x01c2008c 0x4>; 308 310 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>; 309 - clock-output-names = "mmc1"; 311 + clock-output-names = "mmc1", 312 + "mmc1_output", 313 + "mmc1_sample"; 310 314 }; 311 315 312 316 mmc2_clk: clk@01c20090 { 313 - #clock-cells = <0>; 314 - compatible = "allwinner,sun4i-a10-mod0-clk"; 317 + #clock-cells = <1>; 318 + compatible = "allwinner,sun4i-a10-mmc-clk"; 315 319 reg = <0x01c20090 0x4>; 316 320 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>; 317 - clock-output-names = "mmc2"; 321 + clock-output-names = "mmc2", 322 + "mmc2_output", 323 + "mmc2_sample"; 318 324 }; 319 325 320 326 mmc3_clk: clk@01c20094 { 321 - #clock-cells = <0>; 322 - compatible = "allwinner,sun4i-a10-mod0-clk"; 327 + #clock-cells = <1>; 328 + compatible = "allwinner,sun4i-a10-mmc-clk"; 323 329 reg = <0x01c20094 0x4>; 324 330 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>; 325 - clock-output-names = "mmc3"; 331 + clock-output-names = "mmc3", 332 + "mmc3_output", 333 + "mmc3_sample"; 326 334 }; 327 335 328 336 ts_clk: clk@01c20098 { ··· 476 468 mmc0: mmc@01c0f000 { 477 469 compatible = "allwinner,sun4i-a10-mmc"; 478 470 reg = <0x01c0f000 0x1000>; 479 - clocks = <&ahb_gates 8>, <&mmc0_clk>; 480 - clock-names = "ahb", "mmc"; 471 + clocks = <&ahb_gates 8>, 472 + <&mmc0_clk 0>, 473 + <&mmc0_clk 1>, 474 + <&mmc0_clk 2>; 475 + clock-names = "ahb", 476 + "mmc", 477 + "output", 478 + "sample"; 481 479 interrupts = <32>; 482 480 status = "disabled"; 483 481 }; ··· 491 477 mmc1: mmc@01c10000 { 492 478 compatible = "allwinner,sun4i-a10-mmc"; 493 479 reg = <0x01c10000 0x1000>; 494 - clocks = <&ahb_gates 9>, <&mmc1_clk>; 495 - clock-names = "ahb", "mmc"; 480 + clocks = <&ahb_gates 9>, 481 + <&mmc1_clk 0>, 482 + <&mmc1_clk 1>, 483 + <&mmc1_clk 2>; 484 + clock-names = "ahb", 485 + "mmc", 486 + "output", 487 + "sample"; 496 488 interrupts = <33>; 497 489 status = "disabled"; 498 490 }; ··· 506 486 mmc2: mmc@01c11000 { 507 487 compatible = "allwinner,sun4i-a10-mmc"; 508 488 reg = <0x01c11000 0x1000>; 509 - clocks = <&ahb_gates 10>, <&mmc2_clk>; 510 - clock-names = "ahb", "mmc"; 489 + clocks = <&ahb_gates 10>, 490 + <&mmc2_clk 0>, 491 + <&mmc2_clk 1>, 492 + <&mmc2_clk 2>; 493 + clock-names = "ahb", 494 + "mmc", 495 + "output", 496 + "sample"; 511 497 interrupts = <34>; 512 498 status = "disabled"; 513 499 }; ··· 521 495 mmc3: mmc@01c12000 { 522 496 compatible = "allwinner,sun4i-a10-mmc"; 523 497 reg = <0x01c12000 0x1000>; 524 - clocks = <&ahb_gates 11>, <&mmc3_clk>; 525 - clock-names = "ahb", "mmc"; 498 + clocks = <&ahb_gates 11>, 499 + <&mmc3_clk 0>, 500 + <&mmc3_clk 1>, 501 + <&mmc3_clk 2>; 502 + clock-names = "ahb", 503 + "mmc", 504 + "output", 505 + "sample"; 526 506 interrupts = <35>; 527 507 status = "disabled"; 528 508 };
+39 -15
arch/arm/boot/dts/sun5i-a10s.dtsi
··· 218 218 }; 219 219 220 220 mmc0_clk: clk@01c20088 { 221 - #clock-cells = <0>; 222 - compatible = "allwinner,sun4i-a10-mod0-clk"; 221 + #clock-cells = <1>; 222 + compatible = "allwinner,sun4i-a10-mmc-clk"; 223 223 reg = <0x01c20088 0x4>; 224 224 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>; 225 - clock-output-names = "mmc0"; 225 + clock-output-names = "mmc0", 226 + "mmc0_output", 227 + "mmc0_sample"; 226 228 }; 227 229 228 230 mmc1_clk: clk@01c2008c { 229 - #clock-cells = <0>; 230 - compatible = "allwinner,sun4i-a10-mod0-clk"; 231 + #clock-cells = <1>; 232 + compatible = "allwinner,sun4i-a10-mmc-clk"; 231 233 reg = <0x01c2008c 0x4>; 232 234 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>; 233 - clock-output-names = "mmc1"; 235 + clock-output-names = "mmc1", 236 + "mmc1_output", 237 + "mmc1_sample"; 234 238 }; 235 239 236 240 mmc2_clk: clk@01c20090 { 237 - #clock-cells = <0>; 238 - compatible = "allwinner,sun4i-a10-mod0-clk"; 241 + #clock-cells = <1>; 242 + compatible = "allwinner,sun4i-a10-mmc-clk"; 239 243 reg = <0x01c20090 0x4>; 240 244 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>; 241 - clock-output-names = "mmc2"; 245 + clock-output-names = "mmc2", 246 + "mmc2_output", 247 + "mmc2_sample"; 242 248 }; 243 249 244 250 ts_clk: clk@01c20098 { ··· 374 368 mmc0: mmc@01c0f000 { 375 369 compatible = "allwinner,sun5i-a13-mmc"; 376 370 reg = <0x01c0f000 0x1000>; 377 - clocks = <&ahb_gates 8>, <&mmc0_clk>; 378 - clock-names = "ahb", "mmc"; 371 + clocks = <&ahb_gates 8>, 372 + <&mmc0_clk 0>, 373 + <&mmc0_clk 1>, 374 + <&mmc0_clk 2>; 375 + clock-names = "ahb", 376 + "mmc", 377 + "output", 378 + "sample"; 379 379 interrupts = <32>; 380 380 status = "disabled"; 381 381 }; ··· 389 377 mmc1: mmc@01c10000 { 390 378 compatible = "allwinner,sun5i-a13-mmc"; 391 379 reg = <0x01c10000 0x1000>; 392 - clocks = <&ahb_gates 9>, <&mmc1_clk>; 393 - clock-names = "ahb", "mmc"; 380 + clocks = <&ahb_gates 9>, 381 + <&mmc1_clk 0>, 382 + <&mmc1_clk 1>, 383 + <&mmc1_clk 2>; 384 + clock-names = "ahb", 385 + "mmc", 386 + "output", 387 + "sample"; 394 388 interrupts = <33>; 395 389 status = "disabled"; 396 390 }; ··· 404 386 mmc2: mmc@01c11000 { 405 387 compatible = "allwinner,sun5i-a13-mmc"; 406 388 reg = <0x01c11000 0x1000>; 407 - clocks = <&ahb_gates 10>, <&mmc2_clk>; 408 - clock-names = "ahb", "mmc"; 389 + clocks = <&ahb_gates 10>, 390 + <&mmc2_clk 0>, 391 + <&mmc2_clk 1>, 392 + <&mmc2_clk 2>; 393 + clock-names = "ahb", 394 + "mmc", 395 + "output", 396 + "sample"; 409 397 interrupts = <34>; 410 398 status = "disabled"; 411 399 };
+31 -13
arch/arm/boot/dts/sun5i-a13.dtsi
··· 257 257 }; 258 258 259 259 mmc0_clk: clk@01c20088 { 260 - #clock-cells = <0>; 261 - compatible = "allwinner,sun4i-a10-mod0-clk"; 260 + #clock-cells = <1>; 261 + compatible = "allwinner,sun4i-a10-mmc-clk"; 262 262 reg = <0x01c20088 0x4>; 263 263 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>; 264 - clock-output-names = "mmc0"; 264 + clock-output-names = "mmc0", 265 + "mmc0_output", 266 + "mmc0_sample"; 265 267 }; 266 268 267 269 mmc1_clk: clk@01c2008c { 268 - #clock-cells = <0>; 269 - compatible = "allwinner,sun4i-a10-mod0-clk"; 270 + #clock-cells = <1>; 271 + compatible = "allwinner,sun4i-a10-mmc-clk"; 270 272 reg = <0x01c2008c 0x4>; 271 273 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>; 272 - clock-output-names = "mmc1"; 274 + clock-output-names = "mmc1", 275 + "mmc1_output", 276 + "mmc1_sample"; 273 277 }; 274 278 275 279 mmc2_clk: clk@01c20090 { 276 - #clock-cells = <0>; 277 - compatible = "allwinner,sun4i-a10-mod0-clk"; 280 + #clock-cells = <1>; 281 + compatible = "allwinner,sun4i-a10-mmc-clk"; 278 282 reg = <0x01c20090 0x4>; 279 283 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>; 280 - clock-output-names = "mmc2"; 284 + clock-output-names = "mmc2", 285 + "mmc2_output", 286 + "mmc2_sample"; 281 287 }; 282 288 283 289 ts_clk: clk@01c20098 { ··· 397 391 mmc0: mmc@01c0f000 { 398 392 compatible = "allwinner,sun5i-a13-mmc"; 399 393 reg = <0x01c0f000 0x1000>; 400 - clocks = <&ahb_gates 8>, <&mmc0_clk>; 401 - clock-names = "ahb", "mmc"; 394 + clocks = <&ahb_gates 8>, 395 + <&mmc0_clk 0>, 396 + <&mmc0_clk 1>, 397 + <&mmc0_clk 2>; 398 + clock-names = "ahb", 399 + "mmc", 400 + "output", 401 + "sample"; 402 402 interrupts = <32>; 403 403 status = "disabled"; 404 404 }; ··· 412 400 mmc2: mmc@01c11000 { 413 401 compatible = "allwinner,sun5i-a13-mmc"; 414 402 reg = <0x01c11000 0x1000>; 415 - clocks = <&ahb_gates 10>, <&mmc2_clk>; 416 - clock-names = "ahb", "mmc"; 403 + clocks = <&ahb_gates 10>, 404 + <&mmc2_clk 0>, 405 + <&mmc2_clk 1>, 406 + <&mmc2_clk 2>; 407 + clock-names = "ahb", 408 + "mmc", 409 + "output", 410 + "sample"; 417 411 interrupts = <34>; 418 412 status = "disabled"; 419 413 };
+55 -31
arch/arm/boot/dts/sun6i-a31.dtsi
··· 190 190 clock-output-names = "axi"; 191 191 }; 192 192 193 - ahb1_mux: ahb1_mux@01c20054 { 194 - #clock-cells = <0>; 195 - compatible = "allwinner,sun6i-a31-ahb1-mux-clk"; 196 - reg = <0x01c20054 0x4>; 197 - clocks = <&osc32k>, <&osc24M>, <&axi>, <&pll6 0>; 198 - clock-output-names = "ahb1_mux"; 199 - }; 200 - 201 193 ahb1: ahb1@01c20054 { 202 194 #clock-cells = <0>; 203 - compatible = "allwinner,sun4i-a10-ahb-clk"; 195 + compatible = "allwinner,sun6i-a31-ahb1-clk"; 204 196 reg = <0x01c20054 0x4>; 205 - clocks = <&ahb1_mux>; 197 + clocks = <&osc32k>, <&osc24M>, <&axi>, <&pll6 0>; 206 198 clock-output-names = "ahb1"; 207 199 }; 208 200 ··· 257 265 }; 258 266 259 267 mmc0_clk: clk@01c20088 { 260 - #clock-cells = <0>; 261 - compatible = "allwinner,sun4i-a10-mod0-clk"; 268 + #clock-cells = <1>; 269 + compatible = "allwinner,sun4i-a10-mmc-clk"; 262 270 reg = <0x01c20088 0x4>; 263 271 clocks = <&osc24M>, <&pll6 0>; 264 - clock-output-names = "mmc0"; 272 + clock-output-names = "mmc0", 273 + "mmc0_output", 274 + "mmc0_sample"; 265 275 }; 266 276 267 277 mmc1_clk: clk@01c2008c { 268 - #clock-cells = <0>; 269 - compatible = "allwinner,sun4i-a10-mod0-clk"; 278 + #clock-cells = <1>; 279 + compatible = "allwinner,sun4i-a10-mmc-clk"; 270 280 reg = <0x01c2008c 0x4>; 271 281 clocks = <&osc24M>, <&pll6 0>; 272 - clock-output-names = "mmc1"; 282 + clock-output-names = "mmc1", 283 + "mmc1_output", 284 + "mmc1_sample"; 273 285 }; 274 286 275 287 mmc2_clk: clk@01c20090 { 276 - #clock-cells = <0>; 277 - compatible = "allwinner,sun4i-a10-mod0-clk"; 288 + #clock-cells = <1>; 289 + compatible = "allwinner,sun4i-a10-mmc-clk"; 278 290 reg = <0x01c20090 0x4>; 279 291 clocks = <&osc24M>, <&pll6 0>; 280 - clock-output-names = "mmc2"; 292 + clock-output-names = "mmc2", 293 + "mmc2_output", 294 + "mmc2_sample"; 281 295 }; 282 296 283 297 mmc3_clk: clk@01c20094 { 284 - #clock-cells = <0>; 285 - compatible = "allwinner,sun4i-a10-mod0-clk"; 298 + #clock-cells = <1>; 299 + compatible = "allwinner,sun4i-a10-mmc-clk"; 286 300 reg = <0x01c20094 0x4>; 287 301 clocks = <&osc24M>, <&pll6 0>; 288 - clock-output-names = "mmc3"; 302 + clock-output-names = "mmc3", 303 + "mmc3_output", 304 + "mmc3_sample"; 289 305 }; 290 306 291 307 spi0_clk: clk@01c200a0 { ··· 383 383 #dma-cells = <1>; 384 384 385 385 /* DMA controller requires AHB1 clocked from PLL6 */ 386 - assigned-clocks = <&ahb1_mux>; 386 + assigned-clocks = <&ahb1>; 387 387 assigned-clock-parents = <&pll6 0>; 388 388 }; 389 389 390 390 mmc0: mmc@01c0f000 { 391 391 compatible = "allwinner,sun5i-a13-mmc"; 392 392 reg = <0x01c0f000 0x1000>; 393 - clocks = <&ahb1_gates 8>, <&mmc0_clk>; 394 - clock-names = "ahb", "mmc"; 393 + clocks = <&ahb1_gates 8>, 394 + <&mmc0_clk 0>, 395 + <&mmc0_clk 1>, 396 + <&mmc0_clk 2>; 397 + clock-names = "ahb", 398 + "mmc", 399 + "output", 400 + "sample"; 395 401 resets = <&ahb1_rst 8>; 396 402 reset-names = "ahb"; 397 403 interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>; ··· 407 401 mmc1: mmc@01c10000 { 408 402 compatible = "allwinner,sun5i-a13-mmc"; 409 403 reg = <0x01c10000 0x1000>; 410 - clocks = <&ahb1_gates 9>, <&mmc1_clk>; 411 - clock-names = "ahb", "mmc"; 404 + clocks = <&ahb1_gates 9>, 405 + <&mmc1_clk 0>, 406 + <&mmc1_clk 1>, 407 + <&mmc1_clk 2>; 408 + clock-names = "ahb", 409 + "mmc", 410 + "output", 411 + "sample"; 412 412 resets = <&ahb1_rst 9>; 413 413 reset-names = "ahb"; 414 414 interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>; ··· 424 412 mmc2: mmc@01c11000 { 425 413 compatible = "allwinner,sun5i-a13-mmc"; 426 414 reg = <0x01c11000 0x1000>; 427 - clocks = <&ahb1_gates 10>, <&mmc2_clk>; 428 - clock-names = "ahb", "mmc"; 415 + clocks = <&ahb1_gates 10>, 416 + <&mmc2_clk 0>, 417 + <&mmc2_clk 1>, 418 + <&mmc2_clk 2>; 419 + clock-names = "ahb", 420 + "mmc", 421 + "output", 422 + "sample"; 429 423 resets = <&ahb1_rst 10>; 430 424 reset-names = "ahb"; 431 425 interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>; ··· 441 423 mmc3: mmc@01c12000 { 442 424 compatible = "allwinner,sun5i-a13-mmc"; 443 425 reg = <0x01c12000 0x1000>; 444 - clocks = <&ahb1_gates 11>, <&mmc3_clk>; 445 - clock-names = "ahb", "mmc"; 426 + clocks = <&ahb1_gates 11>, 427 + <&mmc3_clk 0>, 428 + <&mmc3_clk 1>, 429 + <&mmc3_clk 2>; 430 + clock-names = "ahb", 431 + "mmc", 432 + "output", 433 + "sample"; 446 434 resets = <&ahb1_rst 11>; 447 435 reset-names = "ahb"; 448 436 interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>;
+52 -20
arch/arm/boot/dts/sun7i-a20.dtsi
··· 337 337 }; 338 338 339 339 mmc0_clk: clk@01c20088 { 340 - #clock-cells = <0>; 341 - compatible = "allwinner,sun4i-a10-mod0-clk"; 340 + #clock-cells = <1>; 341 + compatible = "allwinner,sun4i-a10-mmc-clk"; 342 342 reg = <0x01c20088 0x4>; 343 343 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>; 344 - clock-output-names = "mmc0"; 344 + clock-output-names = "mmc0", 345 + "mmc0_output", 346 + "mmc0_sample"; 345 347 }; 346 348 347 349 mmc1_clk: clk@01c2008c { 348 - #clock-cells = <0>; 349 - compatible = "allwinner,sun4i-a10-mod0-clk"; 350 + #clock-cells = <1>; 351 + compatible = "allwinner,sun4i-a10-mmc-clk"; 350 352 reg = <0x01c2008c 0x4>; 351 353 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>; 352 - clock-output-names = "mmc1"; 354 + clock-output-names = "mmc1", 355 + "mmc1_output", 356 + "mmc1_sample"; 353 357 }; 354 358 355 359 mmc2_clk: clk@01c20090 { 356 - #clock-cells = <0>; 357 - compatible = "allwinner,sun4i-a10-mod0-clk"; 360 + #clock-cells = <1>; 361 + compatible = "allwinner,sun4i-a10-mmc-clk"; 358 362 reg = <0x01c20090 0x4>; 359 363 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>; 360 - clock-output-names = "mmc2"; 364 + clock-output-names = "mmc2", 365 + "mmc2_output", 366 + "mmc2_sample"; 361 367 }; 362 368 363 369 mmc3_clk: clk@01c20094 { 364 - #clock-cells = <0>; 365 - compatible = "allwinner,sun4i-a10-mod0-clk"; 370 + #clock-cells = <1>; 371 + compatible = "allwinner,sun4i-a10-mmc-clk"; 366 372 reg = <0x01c20094 0x4>; 367 373 clocks = <&osc24M>, <&pll6 1>, <&pll5 1>; 368 - clock-output-names = "mmc3"; 374 + clock-output-names = "mmc3", 375 + "mmc3_output", 376 + "mmc3_sample"; 369 377 }; 370 378 371 379 ts_clk: clk@01c20098 { ··· 591 583 mmc0: mmc@01c0f000 { 592 584 compatible = "allwinner,sun5i-a13-mmc"; 593 585 reg = <0x01c0f000 0x1000>; 594 - clocks = <&ahb_gates 8>, <&mmc0_clk>; 595 - clock-names = "ahb", "mmc"; 586 + clocks = <&ahb_gates 8>, 587 + <&mmc0_clk 0>, 588 + <&mmc0_clk 1>, 589 + <&mmc0_clk 2>; 590 + clock-names = "ahb", 591 + "mmc", 592 + "output", 593 + "sample"; 596 594 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; 597 595 status = "disabled"; 598 596 }; ··· 606 592 mmc1: mmc@01c10000 { 607 593 compatible = "allwinner,sun5i-a13-mmc"; 608 594 reg = <0x01c10000 0x1000>; 609 - clocks = <&ahb_gates 9>, <&mmc1_clk>; 610 - clock-names = "ahb", "mmc"; 595 + clocks = <&ahb_gates 9>, 596 + <&mmc1_clk 0>, 597 + <&mmc1_clk 1>, 598 + <&mmc1_clk 2>; 599 + clock-names = "ahb", 600 + "mmc", 601 + "output", 602 + "sample"; 611 603 interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>; 612 604 status = "disabled"; 613 605 }; ··· 621 601 mmc2: mmc@01c11000 { 622 602 compatible = "allwinner,sun5i-a13-mmc"; 623 603 reg = <0x01c11000 0x1000>; 624 - clocks = <&ahb_gates 10>, <&mmc2_clk>; 625 - clock-names = "ahb", "mmc"; 604 + clocks = <&ahb_gates 10>, 605 + <&mmc2_clk 0>, 606 + <&mmc2_clk 1>, 607 + <&mmc2_clk 2>; 608 + clock-names = "ahb", 609 + "mmc", 610 + "output", 611 + "sample"; 626 612 interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>; 627 613 status = "disabled"; 628 614 }; ··· 636 610 mmc3: mmc@01c12000 { 637 611 compatible = "allwinner,sun5i-a13-mmc"; 638 612 reg = <0x01c12000 0x1000>; 639 - clocks = <&ahb_gates 11>, <&mmc3_clk>; 640 - clock-names = "ahb", "mmc"; 613 + clocks = <&ahb_gates 11>, 614 + <&mmc3_clk 0>, 615 + <&mmc3_clk 1>, 616 + <&mmc3_clk 2>; 617 + clock-names = "ahb", 618 + "mmc", 619 + "output", 620 + "sample"; 641 621 interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>; 642 622 status = "disabled"; 643 623 };
+64 -32
arch/arm/boot/dts/sun8i-a23.dtsi
··· 119 119 }; 120 120 121 121 /* dummy clock until actually implemented */ 122 - pll6: pll6_clk { 122 + pll5: pll5_clk { 123 123 #clock-cells = <0>; 124 124 compatible = "fixed-clock"; 125 - clock-frequency = <600000000>; 126 - clock-output-names = "pll6"; 125 + clock-frequency = <0>; 126 + clock-output-names = "pll5"; 127 + }; 128 + 129 + pll6: clk@01c20028 { 130 + #clock-cells = <1>; 131 + compatible = "allwinner,sun6i-a31-pll6-clk"; 132 + reg = <0x01c20028 0x4>; 133 + clocks = <&osc24M>; 134 + clock-output-names = "pll6", "pll6x2"; 127 135 }; 128 136 129 137 cpu: cpu_clk@01c20050 { ··· 157 149 clock-output-names = "axi"; 158 150 }; 159 151 160 - ahb1_mux: ahb1_mux_clk@01c20054 { 161 - #clock-cells = <0>; 162 - compatible = "allwinner,sun6i-a31-ahb1-mux-clk"; 163 - reg = <0x01c20054 0x4>; 164 - clocks = <&osc32k>, <&osc24M>, <&axi>, <&pll6>; 165 - clock-output-names = "ahb1_mux"; 166 - }; 167 - 168 152 ahb1: ahb1_clk@01c20054 { 169 153 #clock-cells = <0>; 170 - compatible = "allwinner,sun4i-a10-ahb-clk"; 154 + compatible = "allwinner,sun6i-a31-ahb1-clk"; 171 155 reg = <0x01c20054 0x4>; 172 - clocks = <&ahb1_mux>; 156 + clocks = <&osc32k>, <&osc24M>, <&axi>, <&pll6 0>; 173 157 clock-output-names = "ahb1"; 174 158 }; 175 159 ··· 202 202 #clock-cells = <0>; 203 203 compatible = "allwinner,sun4i-a10-apb1-clk"; 204 204 reg = <0x01c20058 0x4>; 205 - clocks = <&osc32k>, <&osc24M>, <&pll6>, <&pll6>; 205 + clocks = <&osc32k>, <&osc24M>, <&pll6 0>, <&pll6 0>; 206 206 clock-output-names = "apb2"; 207 207 }; 208 208 ··· 218 218 }; 219 219 220 220 mmc0_clk: clk@01c20088 { 221 - #clock-cells = <0>; 222 - compatible = "allwinner,sun4i-a10-mod0-clk"; 221 + #clock-cells = <1>; 222 + compatible = "allwinner,sun4i-a10-mmc-clk"; 223 223 reg = <0x01c20088 0x4>; 224 - clocks = <&osc24M>, <&pll6>; 225 - clock-output-names = "mmc0"; 224 + clocks = <&osc24M>, <&pll6 0>; 225 + clock-output-names = "mmc0", 226 + "mmc0_output", 227 + "mmc0_sample"; 226 228 }; 227 229 228 230 mmc1_clk: clk@01c2008c { 229 - #clock-cells = <0>; 230 - compatible = "allwinner,sun4i-a10-mod0-clk"; 231 + #clock-cells = <1>; 232 + compatible = "allwinner,sun4i-a10-mmc-clk"; 231 233 reg = <0x01c2008c 0x4>; 232 - clocks = <&osc24M>, <&pll6>; 233 - clock-output-names = "mmc1"; 234 + clocks = <&osc24M>, <&pll6 0>; 235 + clock-output-names = "mmc1", 236 + "mmc1_output", 237 + "mmc1_sample"; 234 238 }; 235 239 236 240 mmc2_clk: clk@01c20090 { 237 - #clock-cells = <0>; 238 - compatible = "allwinner,sun4i-a10-mod0-clk"; 241 + #clock-cells = <1>; 242 + compatible = "allwinner,sun4i-a10-mmc-clk"; 239 243 reg = <0x01c20090 0x4>; 240 - clocks = <&osc24M>, <&pll6>; 241 - clock-output-names = "mmc2"; 244 + clocks = <&osc24M>, <&pll6 0>; 245 + clock-output-names = "mmc2", 246 + "mmc2_output", 247 + "mmc2_sample"; 248 + }; 249 + 250 + mbus_clk: clk@01c2015c { 251 + #clock-cells = <0>; 252 + compatible = "allwinner,sun8i-a23-mbus-clk"; 253 + reg = <0x01c2015c 0x4>; 254 + clocks = <&osc24M>, <&pll6 1>, <&pll5>; 255 + clock-output-names = "mbus"; 242 256 }; 243 257 }; 244 258 ··· 274 260 mmc0: mmc@01c0f000 { 275 261 compatible = "allwinner,sun5i-a13-mmc"; 276 262 reg = <0x01c0f000 0x1000>; 277 - clocks = <&ahb1_gates 8>, <&mmc0_clk>; 278 - clock-names = "ahb", "mmc"; 263 + clocks = <&ahb1_gates 8>, 264 + <&mmc0_clk 0>, 265 + <&mmc0_clk 1>, 266 + <&mmc0_clk 2>; 267 + clock-names = "ahb", 268 + "mmc", 269 + "output", 270 + "sample"; 279 271 resets = <&ahb1_rst 8>; 280 272 reset-names = "ahb"; 281 273 interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>; ··· 291 271 mmc1: mmc@01c10000 { 292 272 compatible = "allwinner,sun5i-a13-mmc"; 293 273 reg = <0x01c10000 0x1000>; 294 - clocks = <&ahb1_gates 9>, <&mmc1_clk>; 295 - clock-names = "ahb", "mmc"; 274 + clocks = <&ahb1_gates 9>, 275 + <&mmc1_clk 0>, 276 + <&mmc1_clk 1>, 277 + <&mmc1_clk 2>; 278 + clock-names = "ahb", 279 + "mmc", 280 + "output", 281 + "sample"; 296 282 resets = <&ahb1_rst 9>; 297 283 reset-names = "ahb"; 298 284 interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>; ··· 308 282 mmc2: mmc@01c11000 { 309 283 compatible = "allwinner,sun5i-a13-mmc"; 310 284 reg = <0x01c11000 0x1000>; 311 - clocks = <&ahb1_gates 10>, <&mmc2_clk>; 312 - clock-names = "ahb", "mmc"; 285 + clocks = <&ahb1_gates 10>, 286 + <&mmc2_clk 0>, 287 + <&mmc2_clk 1>, 288 + <&mmc2_clk 2>; 289 + clock-names = "ahb", 290 + "mmc", 291 + "output", 292 + "sample"; 313 293 resets = <&ahb1_rst 10>; 314 294 reset-names = "ahb"; 315 295 interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+1 -1
arch/arm/mach-omap2/Makefile
··· 190 190 obj-$(CONFIG_ARCH_OMAP3) += $(clock-common) clock3xxx.o 191 191 obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o clkt34xx_dpll3m2.o 192 192 obj-$(CONFIG_ARCH_OMAP3) += clock3517.o clock36xx.o 193 - obj-$(CONFIG_ARCH_OMAP3) += dpll3xxx.o cclock3xxx_data.o 193 + obj-$(CONFIG_ARCH_OMAP3) += dpll3xxx.o 194 194 obj-$(CONFIG_ARCH_OMAP3) += clkt_iclk.o 195 195 obj-$(CONFIG_ARCH_OMAP4) += $(clock-common) 196 196 obj-$(CONFIG_ARCH_OMAP4) += dpll3xxx.o dpll44xx.o
-3688
arch/arm/mach-omap2/cclock3xxx_data.c
··· 1 - /* 2 - * OMAP3 clock data 3 - * 4 - * Copyright (C) 2007-2012 Texas Instruments, Inc. 5 - * Copyright (C) 2007-2011 Nokia Corporation 6 - * 7 - * Written by Paul Walmsley 8 - * Updated to COMMON clk data format by Rajendra Nayak <rnayak@ti.com> 9 - * With many device clock fixes by Kevin Hilman and Jouni Högander 10 - * DPLL bypass clock support added by Roman Tereshonkov 11 - * 12 - */ 13 - 14 - /* 15 - * Virtual clocks are introduced as convenient tools. 16 - * They are sources for other clocks and not supposed 17 - * to be requested from drivers directly. 18 - */ 19 - 20 - #include <linux/kernel.h> 21 - #include <linux/clk.h> 22 - #include <linux/clk-private.h> 23 - #include <linux/list.h> 24 - #include <linux/io.h> 25 - 26 - #include "soc.h" 27 - #include "iomap.h" 28 - #include "clock.h" 29 - #include "clock3xxx.h" 30 - #include "clock34xx.h" 31 - #include "clock36xx.h" 32 - #include "clock3517.h" 33 - #include "cm3xxx.h" 34 - #include "cm-regbits-34xx.h" 35 - #include "prm3xxx.h" 36 - #include "prm-regbits-34xx.h" 37 - #include "control.h" 38 - 39 - /* 40 - * clocks 41 - */ 42 - 43 - #define OMAP_CM_REGADDR OMAP34XX_CM_REGADDR 44 - 45 - /* Maximum DPLL multiplier, divider values for OMAP3 */ 46 - #define OMAP3_MAX_DPLL_MULT 2047 47 - #define OMAP3630_MAX_JTYPE_DPLL_MULT 4095 48 - #define OMAP3_MAX_DPLL_DIV 128 49 - 50 - DEFINE_CLK_FIXED_RATE(dummy_apb_pclk, CLK_IS_ROOT, 0x0, 0x0); 51 - 52 - DEFINE_CLK_FIXED_RATE(mcbsp_clks, CLK_IS_ROOT, 0x0, 0x0); 53 - 54 - DEFINE_CLK_FIXED_RATE(omap_32k_fck, CLK_IS_ROOT, 32768, 0x0); 55 - 56 - DEFINE_CLK_FIXED_RATE(pclk_ck, CLK_IS_ROOT, 27000000, 0x0); 57 - 58 - DEFINE_CLK_FIXED_RATE(rmii_ck, CLK_IS_ROOT, 50000000, 0x0); 59 - 60 - DEFINE_CLK_FIXED_RATE(secure_32k_fck, CLK_IS_ROOT, 32768, 0x0); 61 - 62 - DEFINE_CLK_FIXED_RATE(sys_altclk, CLK_IS_ROOT, 0x0, 0x0); 63 - 64 - DEFINE_CLK_FIXED_RATE(virt_12m_ck, CLK_IS_ROOT, 12000000, 0x0); 65 - 66 - DEFINE_CLK_FIXED_RATE(virt_13m_ck, CLK_IS_ROOT, 13000000, 0x0); 67 - 68 - DEFINE_CLK_FIXED_RATE(virt_16_8m_ck, CLK_IS_ROOT, 16800000, 0x0); 69 - 70 - DEFINE_CLK_FIXED_RATE(virt_19200000_ck, CLK_IS_ROOT, 19200000, 0x0); 71 - 72 - DEFINE_CLK_FIXED_RATE(virt_26000000_ck, CLK_IS_ROOT, 26000000, 0x0); 73 - 74 - DEFINE_CLK_FIXED_RATE(virt_38_4m_ck, CLK_IS_ROOT, 38400000, 0x0); 75 - 76 - static const char *osc_sys_ck_parent_names[] = { 77 - "virt_12m_ck", "virt_13m_ck", "virt_19200000_ck", "virt_26000000_ck", 78 - "virt_38_4m_ck", "virt_16_8m_ck", 79 - }; 80 - 81 - DEFINE_CLK_MUX(osc_sys_ck, osc_sys_ck_parent_names, NULL, 0x0, 82 - OMAP3430_PRM_CLKSEL, OMAP3430_SYS_CLKIN_SEL_SHIFT, 83 - OMAP3430_SYS_CLKIN_SEL_WIDTH, 0x0, NULL); 84 - 85 - DEFINE_CLK_DIVIDER(sys_ck, "osc_sys_ck", &osc_sys_ck, 0x0, 86 - OMAP3430_PRM_CLKSRC_CTRL, OMAP_SYSCLKDIV_SHIFT, 87 - OMAP_SYSCLKDIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL); 88 - 89 - static struct dpll_data dpll3_dd = { 90 - .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), 91 - .mult_mask = OMAP3430_CORE_DPLL_MULT_MASK, 92 - .div1_mask = OMAP3430_CORE_DPLL_DIV_MASK, 93 - .clk_bypass = &sys_ck, 94 - .clk_ref = &sys_ck, 95 - .freqsel_mask = OMAP3430_CORE_DPLL_FREQSEL_MASK, 96 - .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), 97 - .enable_mask = OMAP3430_EN_CORE_DPLL_MASK, 98 - .auto_recal_bit = OMAP3430_EN_CORE_DPLL_DRIFTGUARD_SHIFT, 99 - .recal_en_bit = OMAP3430_CORE_DPLL_RECAL_EN_SHIFT, 100 - .recal_st_bit = OMAP3430_CORE_DPLL_ST_SHIFT, 101 - .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE), 102 - .autoidle_mask = OMAP3430_AUTO_CORE_DPLL_MASK, 103 - .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 104 - .idlest_mask = OMAP3430_ST_CORE_CLK_MASK, 105 - .max_multiplier = OMAP3_MAX_DPLL_MULT, 106 - .min_divider = 1, 107 - .max_divider = OMAP3_MAX_DPLL_DIV, 108 - }; 109 - 110 - static struct clk dpll3_ck; 111 - 112 - static const char *dpll3_ck_parent_names[] = { 113 - "sys_ck", 114 - "sys_ck", 115 - }; 116 - 117 - static const struct clk_ops dpll3_ck_ops = { 118 - .init = &omap2_init_clk_clkdm, 119 - .get_parent = &omap2_init_dpll_parent, 120 - .recalc_rate = &omap3_dpll_recalc, 121 - .round_rate = &omap2_dpll_round_rate, 122 - }; 123 - 124 - static struct clk_hw_omap dpll3_ck_hw = { 125 - .hw = { 126 - .clk = &dpll3_ck, 127 - }, 128 - .ops = &clkhwops_omap3_dpll, 129 - .dpll_data = &dpll3_dd, 130 - .clkdm_name = "dpll3_clkdm", 131 - }; 132 - 133 - DEFINE_STRUCT_CLK(dpll3_ck, dpll3_ck_parent_names, dpll3_ck_ops); 134 - 135 - DEFINE_CLK_DIVIDER(dpll3_m2_ck, "dpll3_ck", &dpll3_ck, 0x0, 136 - OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), 137 - OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT, 138 - OMAP3430_CORE_DPLL_CLKOUT_DIV_WIDTH, 139 - CLK_DIVIDER_ONE_BASED, NULL); 140 - 141 - static struct clk core_ck; 142 - 143 - static const char *core_ck_parent_names[] = { 144 - "dpll3_m2_ck", 145 - }; 146 - 147 - static const struct clk_ops core_ck_ops = {}; 148 - 149 - DEFINE_STRUCT_CLK_HW_OMAP(core_ck, NULL); 150 - DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops); 151 - 152 - DEFINE_CLK_DIVIDER(l3_ick, "core_ck", &core_ck, 0x0, 153 - OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL), 154 - OMAP3430_CLKSEL_L3_SHIFT, OMAP3430_CLKSEL_L3_WIDTH, 155 - CLK_DIVIDER_ONE_BASED, NULL); 156 - 157 - DEFINE_CLK_DIVIDER(l4_ick, "l3_ick", &l3_ick, 0x0, 158 - OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL), 159 - OMAP3430_CLKSEL_L4_SHIFT, OMAP3430_CLKSEL_L4_WIDTH, 160 - CLK_DIVIDER_ONE_BASED, NULL); 161 - 162 - static struct clk security_l4_ick2; 163 - 164 - static const char *security_l4_ick2_parent_names[] = { 165 - "l4_ick", 166 - }; 167 - 168 - DEFINE_STRUCT_CLK_HW_OMAP(security_l4_ick2, NULL); 169 - DEFINE_STRUCT_CLK(security_l4_ick2, security_l4_ick2_parent_names, core_ck_ops); 170 - 171 - static struct clk aes1_ick; 172 - 173 - static const char *aes1_ick_parent_names[] = { 174 - "security_l4_ick2", 175 - }; 176 - 177 - static const struct clk_ops aes1_ick_ops = { 178 - .enable = &omap2_dflt_clk_enable, 179 - .disable = &omap2_dflt_clk_disable, 180 - .is_enabled = &omap2_dflt_clk_is_enabled, 181 - }; 182 - 183 - static struct clk_hw_omap aes1_ick_hw = { 184 - .hw = { 185 - .clk = &aes1_ick, 186 - }, 187 - .ops = &clkhwops_iclk_wait, 188 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 189 - .enable_bit = OMAP3430_EN_AES1_SHIFT, 190 - }; 191 - 192 - DEFINE_STRUCT_CLK(aes1_ick, aes1_ick_parent_names, aes1_ick_ops); 193 - 194 - static struct clk core_l4_ick; 195 - 196 - static const struct clk_ops core_l4_ick_ops = { 197 - .init = &omap2_init_clk_clkdm, 198 - }; 199 - 200 - DEFINE_STRUCT_CLK_HW_OMAP(core_l4_ick, "core_l4_clkdm"); 201 - DEFINE_STRUCT_CLK(core_l4_ick, security_l4_ick2_parent_names, core_l4_ick_ops); 202 - 203 - static struct clk aes2_ick; 204 - 205 - static const char *aes2_ick_parent_names[] = { 206 - "core_l4_ick", 207 - }; 208 - 209 - static const struct clk_ops aes2_ick_ops = { 210 - .init = &omap2_init_clk_clkdm, 211 - .enable = &omap2_dflt_clk_enable, 212 - .disable = &omap2_dflt_clk_disable, 213 - .is_enabled = &omap2_dflt_clk_is_enabled, 214 - }; 215 - 216 - static struct clk_hw_omap aes2_ick_hw = { 217 - .hw = { 218 - .clk = &aes2_ick, 219 - }, 220 - .ops = &clkhwops_iclk_wait, 221 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 222 - .enable_bit = OMAP3430_EN_AES2_SHIFT, 223 - .clkdm_name = "core_l4_clkdm", 224 - }; 225 - 226 - DEFINE_STRUCT_CLK(aes2_ick, aes2_ick_parent_names, aes2_ick_ops); 227 - 228 - static struct clk dpll1_fck; 229 - 230 - static struct dpll_data dpll1_dd = { 231 - .mult_div1_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL), 232 - .mult_mask = OMAP3430_MPU_DPLL_MULT_MASK, 233 - .div1_mask = OMAP3430_MPU_DPLL_DIV_MASK, 234 - .clk_bypass = &dpll1_fck, 235 - .clk_ref = &sys_ck, 236 - .freqsel_mask = OMAP3430_MPU_DPLL_FREQSEL_MASK, 237 - .control_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKEN_PLL), 238 - .enable_mask = OMAP3430_EN_MPU_DPLL_MASK, 239 - .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED), 240 - .auto_recal_bit = OMAP3430_EN_MPU_DPLL_DRIFTGUARD_SHIFT, 241 - .recal_en_bit = OMAP3430_MPU_DPLL_RECAL_EN_SHIFT, 242 - .recal_st_bit = OMAP3430_MPU_DPLL_ST_SHIFT, 243 - .autoidle_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL), 244 - .autoidle_mask = OMAP3430_AUTO_MPU_DPLL_MASK, 245 - .idlest_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL), 246 - .idlest_mask = OMAP3430_ST_MPU_CLK_MASK, 247 - .max_multiplier = OMAP3_MAX_DPLL_MULT, 248 - .min_divider = 1, 249 - .max_divider = OMAP3_MAX_DPLL_DIV, 250 - }; 251 - 252 - static struct clk dpll1_ck; 253 - 254 - static const struct clk_ops dpll1_ck_ops = { 255 - .init = &omap2_init_clk_clkdm, 256 - .enable = &omap3_noncore_dpll_enable, 257 - .disable = &omap3_noncore_dpll_disable, 258 - .get_parent = &omap2_init_dpll_parent, 259 - .recalc_rate = &omap3_dpll_recalc, 260 - .set_rate = &omap3_noncore_dpll_set_rate, 261 - .set_parent = &omap3_noncore_dpll_set_parent, 262 - .set_rate_and_parent = &omap3_noncore_dpll_set_rate_and_parent, 263 - .determine_rate = &omap3_noncore_dpll_determine_rate, 264 - .round_rate = &omap2_dpll_round_rate, 265 - }; 266 - 267 - static struct clk_hw_omap dpll1_ck_hw = { 268 - .hw = { 269 - .clk = &dpll1_ck, 270 - }, 271 - .ops = &clkhwops_omap3_dpll, 272 - .dpll_data = &dpll1_dd, 273 - .clkdm_name = "dpll1_clkdm", 274 - }; 275 - 276 - DEFINE_STRUCT_CLK(dpll1_ck, dpll3_ck_parent_names, dpll1_ck_ops); 277 - 278 - DEFINE_CLK_FIXED_FACTOR(dpll1_x2_ck, "dpll1_ck", &dpll1_ck, 0x0, 2, 1); 279 - 280 - DEFINE_CLK_DIVIDER(dpll1_x2m2_ck, "dpll1_x2_ck", &dpll1_x2_ck, 0x0, 281 - OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL), 282 - OMAP3430_MPU_DPLL_CLKOUT_DIV_SHIFT, 283 - OMAP3430_MPU_DPLL_CLKOUT_DIV_WIDTH, 284 - CLK_DIVIDER_ONE_BASED, NULL); 285 - 286 - static struct clk mpu_ck; 287 - 288 - static const char *mpu_ck_parent_names[] = { 289 - "dpll1_x2m2_ck", 290 - }; 291 - 292 - DEFINE_STRUCT_CLK_HW_OMAP(mpu_ck, "mpu_clkdm"); 293 - DEFINE_STRUCT_CLK(mpu_ck, mpu_ck_parent_names, core_l4_ick_ops); 294 - 295 - DEFINE_CLK_DIVIDER(arm_fck, "mpu_ck", &mpu_ck, 0x0, 296 - OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL), 297 - OMAP3430_ST_MPU_CLK_SHIFT, OMAP3430_ST_MPU_CLK_WIDTH, 298 - 0x0, NULL); 299 - 300 - static struct clk cam_ick; 301 - 302 - static struct clk_hw_omap cam_ick_hw = { 303 - .hw = { 304 - .clk = &cam_ick, 305 - }, 306 - .ops = &clkhwops_iclk, 307 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_ICLKEN), 308 - .enable_bit = OMAP3430_EN_CAM_SHIFT, 309 - .clkdm_name = "cam_clkdm", 310 - }; 311 - 312 - DEFINE_STRUCT_CLK(cam_ick, security_l4_ick2_parent_names, aes2_ick_ops); 313 - 314 - /* DPLL4 */ 315 - /* Supplies 96MHz, 54Mhz TV DAC, DSS fclk, CAM sensor clock, emul trace clk */ 316 - /* Type: DPLL */ 317 - static struct dpll_data dpll4_dd; 318 - 319 - static struct dpll_data dpll4_dd_34xx __initdata = { 320 - .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2), 321 - .mult_mask = OMAP3430_PERIPH_DPLL_MULT_MASK, 322 - .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK, 323 - .clk_bypass = &sys_ck, 324 - .clk_ref = &sys_ck, 325 - .freqsel_mask = OMAP3430_PERIPH_DPLL_FREQSEL_MASK, 326 - .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), 327 - .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK, 328 - .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED), 329 - .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT, 330 - .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT, 331 - .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT, 332 - .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE), 333 - .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK, 334 - .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 335 - .idlest_mask = OMAP3430_ST_PERIPH_CLK_MASK, 336 - .max_multiplier = OMAP3_MAX_DPLL_MULT, 337 - .min_divider = 1, 338 - .max_divider = OMAP3_MAX_DPLL_DIV, 339 - }; 340 - 341 - static struct dpll_data dpll4_dd_3630 __initdata = { 342 - .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2), 343 - .mult_mask = OMAP3630_PERIPH_DPLL_MULT_MASK, 344 - .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK, 345 - .clk_bypass = &sys_ck, 346 - .clk_ref = &sys_ck, 347 - .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), 348 - .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK, 349 - .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED), 350 - .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT, 351 - .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT, 352 - .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT, 353 - .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE), 354 - .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK, 355 - .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), 356 - .idlest_mask = OMAP3430_ST_PERIPH_CLK_MASK, 357 - .dco_mask = OMAP3630_PERIPH_DPLL_DCO_SEL_MASK, 358 - .sddiv_mask = OMAP3630_PERIPH_DPLL_SD_DIV_MASK, 359 - .max_multiplier = OMAP3630_MAX_JTYPE_DPLL_MULT, 360 - .min_divider = 1, 361 - .max_divider = OMAP3_MAX_DPLL_DIV, 362 - .flags = DPLL_J_TYPE 363 - }; 364 - 365 - static struct clk dpll4_ck; 366 - 367 - static const struct clk_ops dpll4_ck_ops = { 368 - .init = &omap2_init_clk_clkdm, 369 - .enable = &omap3_noncore_dpll_enable, 370 - .disable = &omap3_noncore_dpll_disable, 371 - .get_parent = &omap2_init_dpll_parent, 372 - .recalc_rate = &omap3_dpll_recalc, 373 - .set_rate = &omap3_dpll4_set_rate, 374 - .set_parent = &omap3_noncore_dpll_set_parent, 375 - .set_rate_and_parent = &omap3_dpll4_set_rate_and_parent, 376 - .determine_rate = &omap3_noncore_dpll_determine_rate, 377 - .round_rate = &omap2_dpll_round_rate, 378 - }; 379 - 380 - static struct clk_hw_omap dpll4_ck_hw = { 381 - .hw = { 382 - .clk = &dpll4_ck, 383 - }, 384 - .dpll_data = &dpll4_dd, 385 - .ops = &clkhwops_omap3_dpll, 386 - .clkdm_name = "dpll4_clkdm", 387 - }; 388 - 389 - DEFINE_STRUCT_CLK(dpll4_ck, dpll3_ck_parent_names, dpll4_ck_ops); 390 - 391 - static const struct clk_div_table dpll4_mx_ck_div_table[] = { 392 - { .div = 1, .val = 1 }, 393 - { .div = 2, .val = 2 }, 394 - { .div = 3, .val = 3 }, 395 - { .div = 4, .val = 4 }, 396 - { .div = 5, .val = 5 }, 397 - { .div = 6, .val = 6 }, 398 - { .div = 7, .val = 7 }, 399 - { .div = 8, .val = 8 }, 400 - { .div = 9, .val = 9 }, 401 - { .div = 10, .val = 10 }, 402 - { .div = 11, .val = 11 }, 403 - { .div = 12, .val = 12 }, 404 - { .div = 13, .val = 13 }, 405 - { .div = 14, .val = 14 }, 406 - { .div = 15, .val = 15 }, 407 - { .div = 16, .val = 16 }, 408 - { .div = 17, .val = 17 }, 409 - { .div = 18, .val = 18 }, 410 - { .div = 19, .val = 19 }, 411 - { .div = 20, .val = 20 }, 412 - { .div = 21, .val = 21 }, 413 - { .div = 22, .val = 22 }, 414 - { .div = 23, .val = 23 }, 415 - { .div = 24, .val = 24 }, 416 - { .div = 25, .val = 25 }, 417 - { .div = 26, .val = 26 }, 418 - { .div = 27, .val = 27 }, 419 - { .div = 28, .val = 28 }, 420 - { .div = 29, .val = 29 }, 421 - { .div = 30, .val = 30 }, 422 - { .div = 31, .val = 31 }, 423 - { .div = 32, .val = 32 }, 424 - { .div = 0 }, 425 - }; 426 - 427 - DEFINE_CLK_DIVIDER(dpll4_m5_ck, "dpll4_ck", &dpll4_ck, 0x0, 428 - OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_CLKSEL), 429 - OMAP3430_CLKSEL_CAM_SHIFT, OMAP3630_CLKSEL_CAM_WIDTH, 430 - CLK_DIVIDER_ONE_BASED, NULL); 431 - 432 - static struct clk dpll4_m5x2_ck; 433 - 434 - static const char *dpll4_m5x2_ck_parent_names[] = { 435 - "dpll4_m5_ck", 436 - }; 437 - 438 - static const struct clk_ops dpll4_m5x2_ck_ops = { 439 - .init = &omap2_init_clk_clkdm, 440 - .enable = &omap2_dflt_clk_enable, 441 - .disable = &omap2_dflt_clk_disable, 442 - .is_enabled = &omap2_dflt_clk_is_enabled, 443 - .set_rate = &omap3_clkoutx2_set_rate, 444 - .recalc_rate = &omap3_clkoutx2_recalc, 445 - .round_rate = &omap3_clkoutx2_round_rate, 446 - }; 447 - 448 - static const struct clk_ops dpll4_m5x2_ck_3630_ops = { 449 - .init = &omap2_init_clk_clkdm, 450 - .enable = &omap36xx_pwrdn_clk_enable_with_hsdiv_restore, 451 - .disable = &omap2_dflt_clk_disable, 452 - .recalc_rate = &omap3_clkoutx2_recalc, 453 - }; 454 - 455 - static struct clk_hw_omap dpll4_m5x2_ck_hw = { 456 - .hw = { 457 - .clk = &dpll4_m5x2_ck, 458 - }, 459 - .ops = &clkhwops_wait, 460 - .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), 461 - .enable_bit = OMAP3430_PWRDN_CAM_SHIFT, 462 - .flags = INVERT_ENABLE, 463 - .clkdm_name = "dpll4_clkdm", 464 - }; 465 - 466 - DEFINE_STRUCT_CLK_FLAGS(dpll4_m5x2_ck, dpll4_m5x2_ck_parent_names, 467 - dpll4_m5x2_ck_ops, CLK_SET_RATE_PARENT); 468 - 469 - static struct clk dpll4_m5x2_ck_3630 = { 470 - .name = "dpll4_m5x2_ck", 471 - .hw = &dpll4_m5x2_ck_hw.hw, 472 - .parent_names = dpll4_m5x2_ck_parent_names, 473 - .num_parents = ARRAY_SIZE(dpll4_m5x2_ck_parent_names), 474 - .ops = &dpll4_m5x2_ck_3630_ops, 475 - .flags = CLK_SET_RATE_PARENT, 476 - }; 477 - 478 - static struct clk cam_mclk; 479 - 480 - static const char *cam_mclk_parent_names[] = { 481 - "dpll4_m5x2_ck", 482 - }; 483 - 484 - static struct clk_hw_omap cam_mclk_hw = { 485 - .hw = { 486 - .clk = &cam_mclk, 487 - }, 488 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN), 489 - .enable_bit = OMAP3430_EN_CAM_SHIFT, 490 - .clkdm_name = "cam_clkdm", 491 - }; 492 - 493 - static struct clk cam_mclk = { 494 - .name = "cam_mclk", 495 - .hw = &cam_mclk_hw.hw, 496 - .parent_names = cam_mclk_parent_names, 497 - .num_parents = ARRAY_SIZE(cam_mclk_parent_names), 498 - .ops = &aes2_ick_ops, 499 - .flags = CLK_SET_RATE_PARENT, 500 - }; 501 - 502 - static const struct clksel_rate clkout2_src_core_rates[] = { 503 - { .div = 1, .val = 0, .flags = RATE_IN_3XXX }, 504 - { .div = 0 } 505 - }; 506 - 507 - static const struct clksel_rate clkout2_src_sys_rates[] = { 508 - { .div = 1, .val = 1, .flags = RATE_IN_3XXX }, 509 - { .div = 0 } 510 - }; 511 - 512 - static const struct clksel_rate clkout2_src_96m_rates[] = { 513 - { .div = 1, .val = 2, .flags = RATE_IN_3XXX }, 514 - { .div = 0 } 515 - }; 516 - 517 - DEFINE_CLK_DIVIDER(dpll4_m2_ck, "dpll4_ck", &dpll4_ck, 0x0, 518 - OMAP_CM_REGADDR(PLL_MOD, OMAP3430_CM_CLKSEL3), 519 - OMAP3430_DIV_96M_SHIFT, OMAP3630_DIV_96M_WIDTH, 520 - CLK_DIVIDER_ONE_BASED, NULL); 521 - 522 - static struct clk dpll4_m2x2_ck; 523 - 524 - static const char *dpll4_m2x2_ck_parent_names[] = { 525 - "dpll4_m2_ck", 526 - }; 527 - 528 - static struct clk_hw_omap dpll4_m2x2_ck_hw = { 529 - .hw = { 530 - .clk = &dpll4_m2x2_ck, 531 - }, 532 - .ops = &clkhwops_wait, 533 - .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), 534 - .enable_bit = OMAP3430_PWRDN_96M_SHIFT, 535 - .flags = INVERT_ENABLE, 536 - .clkdm_name = "dpll4_clkdm", 537 - }; 538 - 539 - DEFINE_STRUCT_CLK(dpll4_m2x2_ck, dpll4_m2x2_ck_parent_names, dpll4_m5x2_ck_ops); 540 - 541 - static struct clk dpll4_m2x2_ck_3630 = { 542 - .name = "dpll4_m2x2_ck", 543 - .hw = &dpll4_m2x2_ck_hw.hw, 544 - .parent_names = dpll4_m2x2_ck_parent_names, 545 - .num_parents = ARRAY_SIZE(dpll4_m2x2_ck_parent_names), 546 - .ops = &dpll4_m5x2_ck_3630_ops, 547 - }; 548 - 549 - static struct clk omap_96m_alwon_fck; 550 - 551 - static const char *omap_96m_alwon_fck_parent_names[] = { 552 - "dpll4_m2x2_ck", 553 - }; 554 - 555 - DEFINE_STRUCT_CLK_HW_OMAP(omap_96m_alwon_fck, NULL); 556 - DEFINE_STRUCT_CLK(omap_96m_alwon_fck, omap_96m_alwon_fck_parent_names, 557 - core_ck_ops); 558 - 559 - static struct clk cm_96m_fck; 560 - 561 - static const char *cm_96m_fck_parent_names[] = { 562 - "omap_96m_alwon_fck", 563 - }; 564 - 565 - DEFINE_STRUCT_CLK_HW_OMAP(cm_96m_fck, NULL); 566 - DEFINE_STRUCT_CLK(cm_96m_fck, cm_96m_fck_parent_names, core_ck_ops); 567 - 568 - static const struct clksel_rate clkout2_src_54m_rates[] = { 569 - { .div = 1, .val = 3, .flags = RATE_IN_3XXX }, 570 - { .div = 0 } 571 - }; 572 - 573 - DEFINE_CLK_DIVIDER_TABLE(dpll4_m3_ck, "dpll4_ck", &dpll4_ck, 0x0, 574 - OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL), 575 - OMAP3430_CLKSEL_TV_SHIFT, OMAP3630_CLKSEL_TV_WIDTH, 576 - 0, dpll4_mx_ck_div_table, NULL); 577 - 578 - static struct clk dpll4_m3x2_ck; 579 - 580 - static const char *dpll4_m3x2_ck_parent_names[] = { 581 - "dpll4_m3_ck", 582 - }; 583 - 584 - static struct clk_hw_omap dpll4_m3x2_ck_hw = { 585 - .hw = { 586 - .clk = &dpll4_m3x2_ck, 587 - }, 588 - .ops = &clkhwops_wait, 589 - .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), 590 - .enable_bit = OMAP3430_PWRDN_TV_SHIFT, 591 - .flags = INVERT_ENABLE, 592 - .clkdm_name = "dpll4_clkdm", 593 - }; 594 - 595 - DEFINE_STRUCT_CLK(dpll4_m3x2_ck, dpll4_m3x2_ck_parent_names, dpll4_m5x2_ck_ops); 596 - 597 - static struct clk dpll4_m3x2_ck_3630 = { 598 - .name = "dpll4_m3x2_ck", 599 - .hw = &dpll4_m3x2_ck_hw.hw, 600 - .parent_names = dpll4_m3x2_ck_parent_names, 601 - .num_parents = ARRAY_SIZE(dpll4_m3x2_ck_parent_names), 602 - .ops = &dpll4_m5x2_ck_3630_ops, 603 - }; 604 - 605 - static const char *omap_54m_fck_parent_names[] = { 606 - "dpll4_m3x2_ck", "sys_altclk", 607 - }; 608 - 609 - DEFINE_CLK_MUX(omap_54m_fck, omap_54m_fck_parent_names, NULL, 0x0, 610 - OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), OMAP3430_SOURCE_54M_SHIFT, 611 - OMAP3430_SOURCE_54M_WIDTH, 0x0, NULL); 612 - 613 - static const struct clksel clkout2_src_clksel[] = { 614 - { .parent = &core_ck, .rates = clkout2_src_core_rates }, 615 - { .parent = &sys_ck, .rates = clkout2_src_sys_rates }, 616 - { .parent = &cm_96m_fck, .rates = clkout2_src_96m_rates }, 617 - { .parent = &omap_54m_fck, .rates = clkout2_src_54m_rates }, 618 - { .parent = NULL }, 619 - }; 620 - 621 - static const char *clkout2_src_ck_parent_names[] = { 622 - "core_ck", "sys_ck", "cm_96m_fck", "omap_54m_fck", 623 - }; 624 - 625 - static const struct clk_ops clkout2_src_ck_ops = { 626 - .init = &omap2_init_clk_clkdm, 627 - .enable = &omap2_dflt_clk_enable, 628 - .disable = &omap2_dflt_clk_disable, 629 - .is_enabled = &omap2_dflt_clk_is_enabled, 630 - .recalc_rate = &omap2_clksel_recalc, 631 - .get_parent = &omap2_clksel_find_parent_index, 632 - .set_parent = &omap2_clksel_set_parent, 633 - }; 634 - 635 - DEFINE_CLK_OMAP_MUX_GATE(clkout2_src_ck, "core_clkdm", 636 - clkout2_src_clksel, OMAP3430_CM_CLKOUT_CTRL, 637 - OMAP3430_CLKOUT2SOURCE_MASK, 638 - OMAP3430_CM_CLKOUT_CTRL, OMAP3430_CLKOUT2_EN_SHIFT, 639 - NULL, clkout2_src_ck_parent_names, clkout2_src_ck_ops); 640 - 641 - static const struct clksel_rate omap_48m_cm96m_rates[] = { 642 - { .div = 2, .val = 0, .flags = RATE_IN_3XXX }, 643 - { .div = 0 } 644 - }; 645 - 646 - static const struct clksel_rate omap_48m_alt_rates[] = { 647 - { .div = 1, .val = 1, .flags = RATE_IN_3XXX }, 648 - { .div = 0 } 649 - }; 650 - 651 - static const struct clksel omap_48m_clksel[] = { 652 - { .parent = &cm_96m_fck, .rates = omap_48m_cm96m_rates }, 653 - { .parent = &sys_altclk, .rates = omap_48m_alt_rates }, 654 - { .parent = NULL }, 655 - }; 656 - 657 - static const char *omap_48m_fck_parent_names[] = { 658 - "cm_96m_fck", "sys_altclk", 659 - }; 660 - 661 - static struct clk omap_48m_fck; 662 - 663 - static const struct clk_ops omap_48m_fck_ops = { 664 - .recalc_rate = &omap2_clksel_recalc, 665 - .get_parent = &omap2_clksel_find_parent_index, 666 - .set_parent = &omap2_clksel_set_parent, 667 - }; 668 - 669 - static struct clk_hw_omap omap_48m_fck_hw = { 670 - .hw = { 671 - .clk = &omap_48m_fck, 672 - }, 673 - .clksel = omap_48m_clksel, 674 - .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), 675 - .clksel_mask = OMAP3430_SOURCE_48M_MASK, 676 - }; 677 - 678 - DEFINE_STRUCT_CLK(omap_48m_fck, omap_48m_fck_parent_names, omap_48m_fck_ops); 679 - 680 - DEFINE_CLK_FIXED_FACTOR(omap_12m_fck, "omap_48m_fck", &omap_48m_fck, 0x0, 1, 4); 681 - 682 - static struct clk core_12m_fck; 683 - 684 - static const char *core_12m_fck_parent_names[] = { 685 - "omap_12m_fck", 686 - }; 687 - 688 - DEFINE_STRUCT_CLK_HW_OMAP(core_12m_fck, "core_l4_clkdm"); 689 - DEFINE_STRUCT_CLK(core_12m_fck, core_12m_fck_parent_names, core_l4_ick_ops); 690 - 691 - static struct clk core_48m_fck; 692 - 693 - static const char *core_48m_fck_parent_names[] = { 694 - "omap_48m_fck", 695 - }; 696 - 697 - DEFINE_STRUCT_CLK_HW_OMAP(core_48m_fck, "core_l4_clkdm"); 698 - DEFINE_STRUCT_CLK(core_48m_fck, core_48m_fck_parent_names, core_l4_ick_ops); 699 - 700 - static const char *omap_96m_fck_parent_names[] = { 701 - "cm_96m_fck", "sys_ck", 702 - }; 703 - 704 - DEFINE_CLK_MUX(omap_96m_fck, omap_96m_fck_parent_names, NULL, 0x0, 705 - OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), 706 - OMAP3430_SOURCE_96M_SHIFT, OMAP3430_SOURCE_96M_WIDTH, 0x0, NULL); 707 - 708 - static struct clk core_96m_fck; 709 - 710 - static const char *core_96m_fck_parent_names[] = { 711 - "omap_96m_fck", 712 - }; 713 - 714 - DEFINE_STRUCT_CLK_HW_OMAP(core_96m_fck, "core_l4_clkdm"); 715 - DEFINE_STRUCT_CLK(core_96m_fck, core_96m_fck_parent_names, core_l4_ick_ops); 716 - 717 - static struct clk core_l3_ick; 718 - 719 - static const char *core_l3_ick_parent_names[] = { 720 - "l3_ick", 721 - }; 722 - 723 - DEFINE_STRUCT_CLK_HW_OMAP(core_l3_ick, "core_l3_clkdm"); 724 - DEFINE_STRUCT_CLK(core_l3_ick, core_l3_ick_parent_names, core_l4_ick_ops); 725 - 726 - DEFINE_CLK_FIXED_FACTOR(dpll3_m2x2_ck, "dpll3_m2_ck", &dpll3_m2_ck, 0x0, 2, 1); 727 - 728 - static struct clk corex2_fck; 729 - 730 - static const char *corex2_fck_parent_names[] = { 731 - "dpll3_m2x2_ck", 732 - }; 733 - 734 - DEFINE_STRUCT_CLK_HW_OMAP(corex2_fck, NULL); 735 - DEFINE_STRUCT_CLK(corex2_fck, corex2_fck_parent_names, core_ck_ops); 736 - 737 - static const char *cpefuse_fck_parent_names[] = { 738 - "sys_ck", 739 - }; 740 - 741 - static struct clk cpefuse_fck; 742 - 743 - static struct clk_hw_omap cpefuse_fck_hw = { 744 - .hw = { 745 - .clk = &cpefuse_fck, 746 - }, 747 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3), 748 - .enable_bit = OMAP3430ES2_EN_CPEFUSE_SHIFT, 749 - .clkdm_name = "core_l4_clkdm", 750 - }; 751 - 752 - DEFINE_STRUCT_CLK(cpefuse_fck, cpefuse_fck_parent_names, aes2_ick_ops); 753 - 754 - static struct clk csi2_96m_fck; 755 - 756 - static const char *csi2_96m_fck_parent_names[] = { 757 - "core_96m_fck", 758 - }; 759 - 760 - static struct clk_hw_omap csi2_96m_fck_hw = { 761 - .hw = { 762 - .clk = &csi2_96m_fck, 763 - }, 764 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN), 765 - .enable_bit = OMAP3430_EN_CSI2_SHIFT, 766 - .clkdm_name = "cam_clkdm", 767 - }; 768 - 769 - DEFINE_STRUCT_CLK(csi2_96m_fck, csi2_96m_fck_parent_names, aes2_ick_ops); 770 - 771 - static struct clk d2d_26m_fck; 772 - 773 - static struct clk_hw_omap d2d_26m_fck_hw = { 774 - .hw = { 775 - .clk = &d2d_26m_fck, 776 - }, 777 - .ops = &clkhwops_wait, 778 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 779 - .enable_bit = OMAP3430ES1_EN_D2D_SHIFT, 780 - .clkdm_name = "d2d_clkdm", 781 - }; 782 - 783 - DEFINE_STRUCT_CLK(d2d_26m_fck, cpefuse_fck_parent_names, aes2_ick_ops); 784 - 785 - static struct clk des1_ick; 786 - 787 - static struct clk_hw_omap des1_ick_hw = { 788 - .hw = { 789 - .clk = &des1_ick, 790 - }, 791 - .ops = &clkhwops_iclk_wait, 792 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 793 - .enable_bit = OMAP3430_EN_DES1_SHIFT, 794 - }; 795 - 796 - DEFINE_STRUCT_CLK(des1_ick, aes1_ick_parent_names, aes1_ick_ops); 797 - 798 - static struct clk des2_ick; 799 - 800 - static struct clk_hw_omap des2_ick_hw = { 801 - .hw = { 802 - .clk = &des2_ick, 803 - }, 804 - .ops = &clkhwops_iclk_wait, 805 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 806 - .enable_bit = OMAP3430_EN_DES2_SHIFT, 807 - .clkdm_name = "core_l4_clkdm", 808 - }; 809 - 810 - DEFINE_STRUCT_CLK(des2_ick, aes2_ick_parent_names, aes2_ick_ops); 811 - 812 - DEFINE_CLK_DIVIDER(dpll1_fck, "core_ck", &core_ck, 0x0, 813 - OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL), 814 - OMAP3430_MPU_CLK_SRC_SHIFT, OMAP3430_MPU_CLK_SRC_WIDTH, 815 - CLK_DIVIDER_ONE_BASED, NULL); 816 - 817 - static struct clk dpll2_fck; 818 - 819 - static struct dpll_data dpll2_dd = { 820 - .mult_div1_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL), 821 - .mult_mask = OMAP3430_IVA2_DPLL_MULT_MASK, 822 - .div1_mask = OMAP3430_IVA2_DPLL_DIV_MASK, 823 - .clk_bypass = &dpll2_fck, 824 - .clk_ref = &sys_ck, 825 - .freqsel_mask = OMAP3430_IVA2_DPLL_FREQSEL_MASK, 826 - .control_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKEN_PLL), 827 - .enable_mask = OMAP3430_EN_IVA2_DPLL_MASK, 828 - .modes = ((1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED) | 829 - (1 << DPLL_LOW_POWER_BYPASS)), 830 - .auto_recal_bit = OMAP3430_EN_IVA2_DPLL_DRIFTGUARD_SHIFT, 831 - .recal_en_bit = OMAP3430_PRM_IRQENABLE_MPU_IVA2_DPLL_RECAL_EN_SHIFT, 832 - .recal_st_bit = OMAP3430_PRM_IRQSTATUS_MPU_IVA2_DPLL_ST_SHIFT, 833 - .autoidle_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_AUTOIDLE_PLL), 834 - .autoidle_mask = OMAP3430_AUTO_IVA2_DPLL_MASK, 835 - .idlest_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_IDLEST_PLL), 836 - .idlest_mask = OMAP3430_ST_IVA2_CLK_MASK, 837 - .max_multiplier = OMAP3_MAX_DPLL_MULT, 838 - .min_divider = 1, 839 - .max_divider = OMAP3_MAX_DPLL_DIV, 840 - }; 841 - 842 - static struct clk dpll2_ck; 843 - 844 - static struct clk_hw_omap dpll2_ck_hw = { 845 - .hw = { 846 - .clk = &dpll2_ck, 847 - }, 848 - .ops = &clkhwops_omap3_dpll, 849 - .dpll_data = &dpll2_dd, 850 - .clkdm_name = "dpll2_clkdm", 851 - }; 852 - 853 - DEFINE_STRUCT_CLK(dpll2_ck, dpll3_ck_parent_names, dpll1_ck_ops); 854 - 855 - DEFINE_CLK_DIVIDER(dpll2_fck, "core_ck", &core_ck, 0x0, 856 - OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL), 857 - OMAP3430_IVA2_CLK_SRC_SHIFT, OMAP3430_IVA2_CLK_SRC_WIDTH, 858 - CLK_DIVIDER_ONE_BASED, NULL); 859 - 860 - DEFINE_CLK_DIVIDER(dpll2_m2_ck, "dpll2_ck", &dpll2_ck, 0x0, 861 - OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL2_PLL), 862 - OMAP3430_IVA2_DPLL_CLKOUT_DIV_SHIFT, 863 - OMAP3430_IVA2_DPLL_CLKOUT_DIV_WIDTH, 864 - CLK_DIVIDER_ONE_BASED, NULL); 865 - 866 - DEFINE_CLK_DIVIDER(dpll3_m3_ck, "dpll3_ck", &dpll3_ck, 0x0, 867 - OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), 868 - OMAP3430_DIV_DPLL3_SHIFT, OMAP3430_DIV_DPLL3_WIDTH, 869 - CLK_DIVIDER_ONE_BASED, NULL); 870 - 871 - static struct clk dpll3_m3x2_ck; 872 - 873 - static const char *dpll3_m3x2_ck_parent_names[] = { 874 - "dpll3_m3_ck", 875 - }; 876 - 877 - static struct clk_hw_omap dpll3_m3x2_ck_hw = { 878 - .hw = { 879 - .clk = &dpll3_m3x2_ck, 880 - }, 881 - .ops = &clkhwops_wait, 882 - .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), 883 - .enable_bit = OMAP3430_PWRDN_EMU_CORE_SHIFT, 884 - .flags = INVERT_ENABLE, 885 - .clkdm_name = "dpll3_clkdm", 886 - }; 887 - 888 - DEFINE_STRUCT_CLK(dpll3_m3x2_ck, dpll3_m3x2_ck_parent_names, dpll4_m5x2_ck_ops); 889 - 890 - static struct clk dpll3_m3x2_ck_3630 = { 891 - .name = "dpll3_m3x2_ck", 892 - .hw = &dpll3_m3x2_ck_hw.hw, 893 - .parent_names = dpll3_m3x2_ck_parent_names, 894 - .num_parents = ARRAY_SIZE(dpll3_m3x2_ck_parent_names), 895 - .ops = &dpll4_m5x2_ck_3630_ops, 896 - }; 897 - 898 - DEFINE_CLK_FIXED_FACTOR(dpll3_x2_ck, "dpll3_ck", &dpll3_ck, 0x0, 2, 1); 899 - 900 - DEFINE_CLK_DIVIDER_TABLE(dpll4_m4_ck, "dpll4_ck", &dpll4_ck, 0x0, 901 - OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL), 902 - OMAP3430_CLKSEL_DSS1_SHIFT, OMAP3630_CLKSEL_DSS1_WIDTH, 903 - 0, dpll4_mx_ck_div_table, NULL); 904 - 905 - static struct clk dpll4_m4x2_ck; 906 - 907 - static const char *dpll4_m4x2_ck_parent_names[] = { 908 - "dpll4_m4_ck", 909 - }; 910 - 911 - static struct clk_hw_omap dpll4_m4x2_ck_hw = { 912 - .hw = { 913 - .clk = &dpll4_m4x2_ck, 914 - }, 915 - .ops = &clkhwops_wait, 916 - .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), 917 - .enable_bit = OMAP3430_PWRDN_DSS1_SHIFT, 918 - .flags = INVERT_ENABLE, 919 - .clkdm_name = "dpll4_clkdm", 920 - }; 921 - 922 - DEFINE_STRUCT_CLK_FLAGS(dpll4_m4x2_ck, dpll4_m4x2_ck_parent_names, 923 - dpll4_m5x2_ck_ops, CLK_SET_RATE_PARENT); 924 - 925 - static struct clk dpll4_m4x2_ck_3630 = { 926 - .name = "dpll4_m4x2_ck", 927 - .hw = &dpll4_m4x2_ck_hw.hw, 928 - .parent_names = dpll4_m4x2_ck_parent_names, 929 - .num_parents = ARRAY_SIZE(dpll4_m4x2_ck_parent_names), 930 - .ops = &dpll4_m5x2_ck_3630_ops, 931 - .flags = CLK_SET_RATE_PARENT, 932 - }; 933 - 934 - DEFINE_CLK_DIVIDER(dpll4_m6_ck, "dpll4_ck", &dpll4_ck, 0x0, 935 - OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), 936 - OMAP3430_DIV_DPLL4_SHIFT, OMAP3630_DIV_DPLL4_WIDTH, 937 - CLK_DIVIDER_ONE_BASED, NULL); 938 - 939 - static struct clk dpll4_m6x2_ck; 940 - 941 - static const char *dpll4_m6x2_ck_parent_names[] = { 942 - "dpll4_m6_ck", 943 - }; 944 - 945 - static struct clk_hw_omap dpll4_m6x2_ck_hw = { 946 - .hw = { 947 - .clk = &dpll4_m6x2_ck, 948 - }, 949 - .ops = &clkhwops_wait, 950 - .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN), 951 - .enable_bit = OMAP3430_PWRDN_EMU_PERIPH_SHIFT, 952 - .flags = INVERT_ENABLE, 953 - .clkdm_name = "dpll4_clkdm", 954 - }; 955 - 956 - DEFINE_STRUCT_CLK(dpll4_m6x2_ck, dpll4_m6x2_ck_parent_names, dpll4_m5x2_ck_ops); 957 - 958 - static struct clk dpll4_m6x2_ck_3630 = { 959 - .name = "dpll4_m6x2_ck", 960 - .hw = &dpll4_m6x2_ck_hw.hw, 961 - .parent_names = dpll4_m6x2_ck_parent_names, 962 - .num_parents = ARRAY_SIZE(dpll4_m6x2_ck_parent_names), 963 - .ops = &dpll4_m5x2_ck_3630_ops, 964 - }; 965 - 966 - DEFINE_CLK_FIXED_FACTOR(dpll4_x2_ck, "dpll4_ck", &dpll4_ck, 0x0, 2, 1); 967 - 968 - static struct dpll_data dpll5_dd = { 969 - .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL4), 970 - .mult_mask = OMAP3430ES2_PERIPH2_DPLL_MULT_MASK, 971 - .div1_mask = OMAP3430ES2_PERIPH2_DPLL_DIV_MASK, 972 - .clk_bypass = &sys_ck, 973 - .clk_ref = &sys_ck, 974 - .freqsel_mask = OMAP3430ES2_PERIPH2_DPLL_FREQSEL_MASK, 975 - .control_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKEN2), 976 - .enable_mask = OMAP3430ES2_EN_PERIPH2_DPLL_MASK, 977 - .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED), 978 - .auto_recal_bit = OMAP3430ES2_EN_PERIPH2_DPLL_DRIFTGUARD_SHIFT, 979 - .recal_en_bit = OMAP3430ES2_SND_PERIPH_DPLL_RECAL_EN_SHIFT, 980 - .recal_st_bit = OMAP3430ES2_SND_PERIPH_DPLL_ST_SHIFT, 981 - .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_AUTOIDLE2_PLL), 982 - .autoidle_mask = OMAP3430ES2_AUTO_PERIPH2_DPLL_MASK, 983 - .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST2), 984 - .idlest_mask = OMAP3430ES2_ST_PERIPH2_CLK_MASK, 985 - .max_multiplier = OMAP3_MAX_DPLL_MULT, 986 - .min_divider = 1, 987 - .max_divider = OMAP3_MAX_DPLL_DIV, 988 - }; 989 - 990 - static struct clk dpll5_ck; 991 - 992 - static struct clk_hw_omap dpll5_ck_hw = { 993 - .hw = { 994 - .clk = &dpll5_ck, 995 - }, 996 - .ops = &clkhwops_omap3_dpll, 997 - .dpll_data = &dpll5_dd, 998 - .clkdm_name = "dpll5_clkdm", 999 - }; 1000 - 1001 - DEFINE_STRUCT_CLK(dpll5_ck, dpll3_ck_parent_names, dpll1_ck_ops); 1002 - 1003 - DEFINE_CLK_DIVIDER(dpll5_m2_ck, "dpll5_ck", &dpll5_ck, 0x0, 1004 - OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL5), 1005 - OMAP3430ES2_DIV_120M_SHIFT, OMAP3430ES2_DIV_120M_WIDTH, 1006 - CLK_DIVIDER_ONE_BASED, NULL); 1007 - 1008 - static struct clk dss1_alwon_fck_3430es1; 1009 - 1010 - static const char *dss1_alwon_fck_3430es1_parent_names[] = { 1011 - "dpll4_m4x2_ck", 1012 - }; 1013 - 1014 - static struct clk_hw_omap dss1_alwon_fck_3430es1_hw = { 1015 - .hw = { 1016 - .clk = &dss1_alwon_fck_3430es1, 1017 - }, 1018 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN), 1019 - .enable_bit = OMAP3430_EN_DSS1_SHIFT, 1020 - .clkdm_name = "dss_clkdm", 1021 - }; 1022 - 1023 - DEFINE_STRUCT_CLK_FLAGS(dss1_alwon_fck_3430es1, 1024 - dss1_alwon_fck_3430es1_parent_names, aes2_ick_ops, 1025 - CLK_SET_RATE_PARENT); 1026 - 1027 - static struct clk dss1_alwon_fck_3430es2; 1028 - 1029 - static struct clk_hw_omap dss1_alwon_fck_3430es2_hw = { 1030 - .hw = { 1031 - .clk = &dss1_alwon_fck_3430es2, 1032 - }, 1033 - .ops = &clkhwops_omap3430es2_dss_usbhost_wait, 1034 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN), 1035 - .enable_bit = OMAP3430_EN_DSS1_SHIFT, 1036 - .clkdm_name = "dss_clkdm", 1037 - }; 1038 - 1039 - DEFINE_STRUCT_CLK_FLAGS(dss1_alwon_fck_3430es2, 1040 - dss1_alwon_fck_3430es1_parent_names, aes2_ick_ops, 1041 - CLK_SET_RATE_PARENT); 1042 - 1043 - static struct clk dss2_alwon_fck; 1044 - 1045 - static struct clk_hw_omap dss2_alwon_fck_hw = { 1046 - .hw = { 1047 - .clk = &dss2_alwon_fck, 1048 - }, 1049 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN), 1050 - .enable_bit = OMAP3430_EN_DSS2_SHIFT, 1051 - .clkdm_name = "dss_clkdm", 1052 - }; 1053 - 1054 - DEFINE_STRUCT_CLK(dss2_alwon_fck, cpefuse_fck_parent_names, aes2_ick_ops); 1055 - 1056 - static struct clk dss_96m_fck; 1057 - 1058 - static struct clk_hw_omap dss_96m_fck_hw = { 1059 - .hw = { 1060 - .clk = &dss_96m_fck, 1061 - }, 1062 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN), 1063 - .enable_bit = OMAP3430_EN_TV_SHIFT, 1064 - .clkdm_name = "dss_clkdm", 1065 - }; 1066 - 1067 - DEFINE_STRUCT_CLK(dss_96m_fck, core_96m_fck_parent_names, aes2_ick_ops); 1068 - 1069 - static struct clk dss_ick_3430es1; 1070 - 1071 - static struct clk_hw_omap dss_ick_3430es1_hw = { 1072 - .hw = { 1073 - .clk = &dss_ick_3430es1, 1074 - }, 1075 - .ops = &clkhwops_iclk, 1076 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN), 1077 - .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT, 1078 - .clkdm_name = "dss_clkdm", 1079 - }; 1080 - 1081 - DEFINE_STRUCT_CLK(dss_ick_3430es1, security_l4_ick2_parent_names, aes2_ick_ops); 1082 - 1083 - static struct clk dss_ick_3430es2; 1084 - 1085 - static struct clk_hw_omap dss_ick_3430es2_hw = { 1086 - .hw = { 1087 - .clk = &dss_ick_3430es2, 1088 - }, 1089 - .ops = &clkhwops_omap3430es2_iclk_dss_usbhost_wait, 1090 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN), 1091 - .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT, 1092 - .clkdm_name = "dss_clkdm", 1093 - }; 1094 - 1095 - DEFINE_STRUCT_CLK(dss_ick_3430es2, security_l4_ick2_parent_names, aes2_ick_ops); 1096 - 1097 - static struct clk dss_tv_fck; 1098 - 1099 - static const char *dss_tv_fck_parent_names[] = { 1100 - "omap_54m_fck", 1101 - }; 1102 - 1103 - static struct clk_hw_omap dss_tv_fck_hw = { 1104 - .hw = { 1105 - .clk = &dss_tv_fck, 1106 - }, 1107 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN), 1108 - .enable_bit = OMAP3430_EN_TV_SHIFT, 1109 - .clkdm_name = "dss_clkdm", 1110 - }; 1111 - 1112 - DEFINE_STRUCT_CLK(dss_tv_fck, dss_tv_fck_parent_names, aes2_ick_ops); 1113 - 1114 - static struct clk emac_fck; 1115 - 1116 - static const char *emac_fck_parent_names[] = { 1117 - "rmii_ck", 1118 - }; 1119 - 1120 - static struct clk_hw_omap emac_fck_hw = { 1121 - .hw = { 1122 - .clk = &emac_fck, 1123 - }, 1124 - .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL), 1125 - .enable_bit = AM35XX_CPGMAC_FCLK_SHIFT, 1126 - }; 1127 - 1128 - DEFINE_STRUCT_CLK(emac_fck, emac_fck_parent_names, aes1_ick_ops); 1129 - 1130 - static struct clk ipss_ick; 1131 - 1132 - static const char *ipss_ick_parent_names[] = { 1133 - "core_l3_ick", 1134 - }; 1135 - 1136 - static struct clk_hw_omap ipss_ick_hw = { 1137 - .hw = { 1138 - .clk = &ipss_ick, 1139 - }, 1140 - .ops = &clkhwops_am35xx_ipss_wait, 1141 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1142 - .enable_bit = AM35XX_EN_IPSS_SHIFT, 1143 - .clkdm_name = "core_l3_clkdm", 1144 - }; 1145 - 1146 - DEFINE_STRUCT_CLK(ipss_ick, ipss_ick_parent_names, aes2_ick_ops); 1147 - 1148 - static struct clk emac_ick; 1149 - 1150 - static const char *emac_ick_parent_names[] = { 1151 - "ipss_ick", 1152 - }; 1153 - 1154 - static struct clk_hw_omap emac_ick_hw = { 1155 - .hw = { 1156 - .clk = &emac_ick, 1157 - }, 1158 - .ops = &clkhwops_am35xx_ipss_module_wait, 1159 - .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL), 1160 - .enable_bit = AM35XX_CPGMAC_VBUSP_CLK_SHIFT, 1161 - .clkdm_name = "core_l3_clkdm", 1162 - }; 1163 - 1164 - DEFINE_STRUCT_CLK(emac_ick, emac_ick_parent_names, aes2_ick_ops); 1165 - 1166 - static struct clk emu_core_alwon_ck; 1167 - 1168 - static const char *emu_core_alwon_ck_parent_names[] = { 1169 - "dpll3_m3x2_ck", 1170 - }; 1171 - 1172 - DEFINE_STRUCT_CLK_HW_OMAP(emu_core_alwon_ck, "dpll3_clkdm"); 1173 - DEFINE_STRUCT_CLK(emu_core_alwon_ck, emu_core_alwon_ck_parent_names, 1174 - core_l4_ick_ops); 1175 - 1176 - static struct clk emu_mpu_alwon_ck; 1177 - 1178 - static const char *emu_mpu_alwon_ck_parent_names[] = { 1179 - "mpu_ck", 1180 - }; 1181 - 1182 - DEFINE_STRUCT_CLK_HW_OMAP(emu_mpu_alwon_ck, NULL); 1183 - DEFINE_STRUCT_CLK(emu_mpu_alwon_ck, emu_mpu_alwon_ck_parent_names, core_ck_ops); 1184 - 1185 - static struct clk emu_per_alwon_ck; 1186 - 1187 - static const char *emu_per_alwon_ck_parent_names[] = { 1188 - "dpll4_m6x2_ck", 1189 - }; 1190 - 1191 - DEFINE_STRUCT_CLK_HW_OMAP(emu_per_alwon_ck, "dpll4_clkdm"); 1192 - DEFINE_STRUCT_CLK(emu_per_alwon_ck, emu_per_alwon_ck_parent_names, 1193 - core_l4_ick_ops); 1194 - 1195 - static const char *emu_src_ck_parent_names[] = { 1196 - "sys_ck", "emu_core_alwon_ck", "emu_per_alwon_ck", "emu_mpu_alwon_ck", 1197 - }; 1198 - 1199 - static const struct clksel_rate emu_src_sys_rates[] = { 1200 - { .div = 1, .val = 0, .flags = RATE_IN_3XXX }, 1201 - { .div = 0 }, 1202 - }; 1203 - 1204 - static const struct clksel_rate emu_src_core_rates[] = { 1205 - { .div = 1, .val = 1, .flags = RATE_IN_3XXX }, 1206 - { .div = 0 }, 1207 - }; 1208 - 1209 - static const struct clksel_rate emu_src_per_rates[] = { 1210 - { .div = 1, .val = 2, .flags = RATE_IN_3XXX }, 1211 - { .div = 0 }, 1212 - }; 1213 - 1214 - static const struct clksel_rate emu_src_mpu_rates[] = { 1215 - { .div = 1, .val = 3, .flags = RATE_IN_3XXX }, 1216 - { .div = 0 }, 1217 - }; 1218 - 1219 - static const struct clksel emu_src_clksel[] = { 1220 - { .parent = &sys_ck, .rates = emu_src_sys_rates }, 1221 - { .parent = &emu_core_alwon_ck, .rates = emu_src_core_rates }, 1222 - { .parent = &emu_per_alwon_ck, .rates = emu_src_per_rates }, 1223 - { .parent = &emu_mpu_alwon_ck, .rates = emu_src_mpu_rates }, 1224 - { .parent = NULL }, 1225 - }; 1226 - 1227 - static const struct clk_ops emu_src_ck_ops = { 1228 - .init = &omap2_init_clk_clkdm, 1229 - .recalc_rate = &omap2_clksel_recalc, 1230 - .get_parent = &omap2_clksel_find_parent_index, 1231 - .set_parent = &omap2_clksel_set_parent, 1232 - .enable = &omap2_clkops_enable_clkdm, 1233 - .disable = &omap2_clkops_disable_clkdm, 1234 - }; 1235 - 1236 - static struct clk emu_src_ck; 1237 - 1238 - static struct clk_hw_omap emu_src_ck_hw = { 1239 - .hw = { 1240 - .clk = &emu_src_ck, 1241 - }, 1242 - .clksel = emu_src_clksel, 1243 - .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), 1244 - .clksel_mask = OMAP3430_MUX_CTRL_MASK, 1245 - .clkdm_name = "emu_clkdm", 1246 - }; 1247 - 1248 - DEFINE_STRUCT_CLK(emu_src_ck, emu_src_ck_parent_names, emu_src_ck_ops); 1249 - 1250 - DEFINE_CLK_DIVIDER(atclk_fck, "emu_src_ck", &emu_src_ck, 0x0, 1251 - OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), 1252 - OMAP3430_CLKSEL_ATCLK_SHIFT, OMAP3430_CLKSEL_ATCLK_WIDTH, 1253 - CLK_DIVIDER_ONE_BASED, NULL); 1254 - 1255 - static struct clk fac_ick; 1256 - 1257 - static struct clk_hw_omap fac_ick_hw = { 1258 - .hw = { 1259 - .clk = &fac_ick, 1260 - }, 1261 - .ops = &clkhwops_iclk_wait, 1262 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1263 - .enable_bit = OMAP3430ES1_EN_FAC_SHIFT, 1264 - .clkdm_name = "core_l4_clkdm", 1265 - }; 1266 - 1267 - DEFINE_STRUCT_CLK(fac_ick, aes2_ick_parent_names, aes2_ick_ops); 1268 - 1269 - static struct clk fshostusb_fck; 1270 - 1271 - static const char *fshostusb_fck_parent_names[] = { 1272 - "core_48m_fck", 1273 - }; 1274 - 1275 - static struct clk_hw_omap fshostusb_fck_hw = { 1276 - .hw = { 1277 - .clk = &fshostusb_fck, 1278 - }, 1279 - .ops = &clkhwops_wait, 1280 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1281 - .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT, 1282 - .clkdm_name = "core_l4_clkdm", 1283 - }; 1284 - 1285 - DEFINE_STRUCT_CLK(fshostusb_fck, fshostusb_fck_parent_names, aes2_ick_ops); 1286 - 1287 - static struct clk gfx_l3_ck; 1288 - 1289 - static struct clk_hw_omap gfx_l3_ck_hw = { 1290 - .hw = { 1291 - .clk = &gfx_l3_ck, 1292 - }, 1293 - .ops = &clkhwops_wait, 1294 - .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN), 1295 - .enable_bit = OMAP_EN_GFX_SHIFT, 1296 - .clkdm_name = "gfx_3430es1_clkdm", 1297 - }; 1298 - 1299 - DEFINE_STRUCT_CLK(gfx_l3_ck, core_l3_ick_parent_names, aes1_ick_ops); 1300 - 1301 - DEFINE_CLK_DIVIDER(gfx_l3_fck, "l3_ick", &l3_ick, 0x0, 1302 - OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL), 1303 - OMAP_CLKSEL_GFX_SHIFT, OMAP_CLKSEL_GFX_WIDTH, 1304 - CLK_DIVIDER_ONE_BASED, NULL); 1305 - 1306 - static struct clk gfx_cg1_ck; 1307 - 1308 - static const char *gfx_cg1_ck_parent_names[] = { 1309 - "gfx_l3_fck", 1310 - }; 1311 - 1312 - static struct clk_hw_omap gfx_cg1_ck_hw = { 1313 - .hw = { 1314 - .clk = &gfx_cg1_ck, 1315 - }, 1316 - .ops = &clkhwops_wait, 1317 - .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN), 1318 - .enable_bit = OMAP3430ES1_EN_2D_SHIFT, 1319 - .clkdm_name = "gfx_3430es1_clkdm", 1320 - }; 1321 - 1322 - DEFINE_STRUCT_CLK(gfx_cg1_ck, gfx_cg1_ck_parent_names, aes2_ick_ops); 1323 - 1324 - static struct clk gfx_cg2_ck; 1325 - 1326 - static struct clk_hw_omap gfx_cg2_ck_hw = { 1327 - .hw = { 1328 - .clk = &gfx_cg2_ck, 1329 - }, 1330 - .ops = &clkhwops_wait, 1331 - .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN), 1332 - .enable_bit = OMAP3430ES1_EN_3D_SHIFT, 1333 - .clkdm_name = "gfx_3430es1_clkdm", 1334 - }; 1335 - 1336 - DEFINE_STRUCT_CLK(gfx_cg2_ck, gfx_cg1_ck_parent_names, aes2_ick_ops); 1337 - 1338 - static struct clk gfx_l3_ick; 1339 - 1340 - static const char *gfx_l3_ick_parent_names[] = { 1341 - "gfx_l3_ck", 1342 - }; 1343 - 1344 - DEFINE_STRUCT_CLK_HW_OMAP(gfx_l3_ick, "gfx_3430es1_clkdm"); 1345 - DEFINE_STRUCT_CLK(gfx_l3_ick, gfx_l3_ick_parent_names, core_l4_ick_ops); 1346 - 1347 - static struct clk wkup_32k_fck; 1348 - 1349 - static const char *wkup_32k_fck_parent_names[] = { 1350 - "omap_32k_fck", 1351 - }; 1352 - 1353 - DEFINE_STRUCT_CLK_HW_OMAP(wkup_32k_fck, "wkup_clkdm"); 1354 - DEFINE_STRUCT_CLK(wkup_32k_fck, wkup_32k_fck_parent_names, core_l4_ick_ops); 1355 - 1356 - static struct clk gpio1_dbck; 1357 - 1358 - static const char *gpio1_dbck_parent_names[] = { 1359 - "wkup_32k_fck", 1360 - }; 1361 - 1362 - static struct clk_hw_omap gpio1_dbck_hw = { 1363 - .hw = { 1364 - .clk = &gpio1_dbck, 1365 - }, 1366 - .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), 1367 - .enable_bit = OMAP3430_EN_GPIO1_SHIFT, 1368 - .clkdm_name = "wkup_clkdm", 1369 - }; 1370 - 1371 - DEFINE_STRUCT_CLK(gpio1_dbck, gpio1_dbck_parent_names, aes2_ick_ops); 1372 - 1373 - static struct clk wkup_l4_ick; 1374 - 1375 - DEFINE_STRUCT_CLK_HW_OMAP(wkup_l4_ick, "wkup_clkdm"); 1376 - DEFINE_STRUCT_CLK(wkup_l4_ick, cpefuse_fck_parent_names, core_l4_ick_ops); 1377 - 1378 - static struct clk gpio1_ick; 1379 - 1380 - static const char *gpio1_ick_parent_names[] = { 1381 - "wkup_l4_ick", 1382 - }; 1383 - 1384 - static struct clk_hw_omap gpio1_ick_hw = { 1385 - .hw = { 1386 - .clk = &gpio1_ick, 1387 - }, 1388 - .ops = &clkhwops_iclk_wait, 1389 - .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 1390 - .enable_bit = OMAP3430_EN_GPIO1_SHIFT, 1391 - .clkdm_name = "wkup_clkdm", 1392 - }; 1393 - 1394 - DEFINE_STRUCT_CLK(gpio1_ick, gpio1_ick_parent_names, aes2_ick_ops); 1395 - 1396 - static struct clk per_32k_alwon_fck; 1397 - 1398 - DEFINE_STRUCT_CLK_HW_OMAP(per_32k_alwon_fck, "per_clkdm"); 1399 - DEFINE_STRUCT_CLK(per_32k_alwon_fck, wkup_32k_fck_parent_names, 1400 - core_l4_ick_ops); 1401 - 1402 - static struct clk gpio2_dbck; 1403 - 1404 - static const char *gpio2_dbck_parent_names[] = { 1405 - "per_32k_alwon_fck", 1406 - }; 1407 - 1408 - static struct clk_hw_omap gpio2_dbck_hw = { 1409 - .hw = { 1410 - .clk = &gpio2_dbck, 1411 - }, 1412 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 1413 - .enable_bit = OMAP3430_EN_GPIO2_SHIFT, 1414 - .clkdm_name = "per_clkdm", 1415 - }; 1416 - 1417 - DEFINE_STRUCT_CLK(gpio2_dbck, gpio2_dbck_parent_names, aes2_ick_ops); 1418 - 1419 - static struct clk per_l4_ick; 1420 - 1421 - DEFINE_STRUCT_CLK_HW_OMAP(per_l4_ick, "per_clkdm"); 1422 - DEFINE_STRUCT_CLK(per_l4_ick, security_l4_ick2_parent_names, core_l4_ick_ops); 1423 - 1424 - static struct clk gpio2_ick; 1425 - 1426 - static const char *gpio2_ick_parent_names[] = { 1427 - "per_l4_ick", 1428 - }; 1429 - 1430 - static struct clk_hw_omap gpio2_ick_hw = { 1431 - .hw = { 1432 - .clk = &gpio2_ick, 1433 - }, 1434 - .ops = &clkhwops_iclk_wait, 1435 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 1436 - .enable_bit = OMAP3430_EN_GPIO2_SHIFT, 1437 - .clkdm_name = "per_clkdm", 1438 - }; 1439 - 1440 - DEFINE_STRUCT_CLK(gpio2_ick, gpio2_ick_parent_names, aes2_ick_ops); 1441 - 1442 - static struct clk gpio3_dbck; 1443 - 1444 - static struct clk_hw_omap gpio3_dbck_hw = { 1445 - .hw = { 1446 - .clk = &gpio3_dbck, 1447 - }, 1448 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 1449 - .enable_bit = OMAP3430_EN_GPIO3_SHIFT, 1450 - .clkdm_name = "per_clkdm", 1451 - }; 1452 - 1453 - DEFINE_STRUCT_CLK(gpio3_dbck, gpio2_dbck_parent_names, aes2_ick_ops); 1454 - 1455 - static struct clk gpio3_ick; 1456 - 1457 - static struct clk_hw_omap gpio3_ick_hw = { 1458 - .hw = { 1459 - .clk = &gpio3_ick, 1460 - }, 1461 - .ops = &clkhwops_iclk_wait, 1462 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 1463 - .enable_bit = OMAP3430_EN_GPIO3_SHIFT, 1464 - .clkdm_name = "per_clkdm", 1465 - }; 1466 - 1467 - DEFINE_STRUCT_CLK(gpio3_ick, gpio2_ick_parent_names, aes2_ick_ops); 1468 - 1469 - static struct clk gpio4_dbck; 1470 - 1471 - static struct clk_hw_omap gpio4_dbck_hw = { 1472 - .hw = { 1473 - .clk = &gpio4_dbck, 1474 - }, 1475 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 1476 - .enable_bit = OMAP3430_EN_GPIO4_SHIFT, 1477 - .clkdm_name = "per_clkdm", 1478 - }; 1479 - 1480 - DEFINE_STRUCT_CLK(gpio4_dbck, gpio2_dbck_parent_names, aes2_ick_ops); 1481 - 1482 - static struct clk gpio4_ick; 1483 - 1484 - static struct clk_hw_omap gpio4_ick_hw = { 1485 - .hw = { 1486 - .clk = &gpio4_ick, 1487 - }, 1488 - .ops = &clkhwops_iclk_wait, 1489 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 1490 - .enable_bit = OMAP3430_EN_GPIO4_SHIFT, 1491 - .clkdm_name = "per_clkdm", 1492 - }; 1493 - 1494 - DEFINE_STRUCT_CLK(gpio4_ick, gpio2_ick_parent_names, aes2_ick_ops); 1495 - 1496 - static struct clk gpio5_dbck; 1497 - 1498 - static struct clk_hw_omap gpio5_dbck_hw = { 1499 - .hw = { 1500 - .clk = &gpio5_dbck, 1501 - }, 1502 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 1503 - .enable_bit = OMAP3430_EN_GPIO5_SHIFT, 1504 - .clkdm_name = "per_clkdm", 1505 - }; 1506 - 1507 - DEFINE_STRUCT_CLK(gpio5_dbck, gpio2_dbck_parent_names, aes2_ick_ops); 1508 - 1509 - static struct clk gpio5_ick; 1510 - 1511 - static struct clk_hw_omap gpio5_ick_hw = { 1512 - .hw = { 1513 - .clk = &gpio5_ick, 1514 - }, 1515 - .ops = &clkhwops_iclk_wait, 1516 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 1517 - .enable_bit = OMAP3430_EN_GPIO5_SHIFT, 1518 - .clkdm_name = "per_clkdm", 1519 - }; 1520 - 1521 - DEFINE_STRUCT_CLK(gpio5_ick, gpio2_ick_parent_names, aes2_ick_ops); 1522 - 1523 - static struct clk gpio6_dbck; 1524 - 1525 - static struct clk_hw_omap gpio6_dbck_hw = { 1526 - .hw = { 1527 - .clk = &gpio6_dbck, 1528 - }, 1529 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 1530 - .enable_bit = OMAP3430_EN_GPIO6_SHIFT, 1531 - .clkdm_name = "per_clkdm", 1532 - }; 1533 - 1534 - DEFINE_STRUCT_CLK(gpio6_dbck, gpio2_dbck_parent_names, aes2_ick_ops); 1535 - 1536 - static struct clk gpio6_ick; 1537 - 1538 - static struct clk_hw_omap gpio6_ick_hw = { 1539 - .hw = { 1540 - .clk = &gpio6_ick, 1541 - }, 1542 - .ops = &clkhwops_iclk_wait, 1543 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 1544 - .enable_bit = OMAP3430_EN_GPIO6_SHIFT, 1545 - .clkdm_name = "per_clkdm", 1546 - }; 1547 - 1548 - DEFINE_STRUCT_CLK(gpio6_ick, gpio2_ick_parent_names, aes2_ick_ops); 1549 - 1550 - static struct clk gpmc_fck; 1551 - 1552 - static struct clk_hw_omap gpmc_fck_hw = { 1553 - .hw = { 1554 - .clk = &gpmc_fck, 1555 - }, 1556 - .flags = ENABLE_ON_INIT, 1557 - .clkdm_name = "core_l3_clkdm", 1558 - }; 1559 - 1560 - DEFINE_STRUCT_CLK(gpmc_fck, ipss_ick_parent_names, core_l4_ick_ops); 1561 - 1562 - static const struct clksel omap343x_gpt_clksel[] = { 1563 - { .parent = &omap_32k_fck, .rates = gpt_32k_rates }, 1564 - { .parent = &sys_ck, .rates = gpt_sys_rates }, 1565 - { .parent = NULL }, 1566 - }; 1567 - 1568 - static const char *gpt10_fck_parent_names[] = { 1569 - "omap_32k_fck", "sys_ck", 1570 - }; 1571 - 1572 - DEFINE_CLK_OMAP_MUX_GATE(gpt10_fck, "core_l4_clkdm", omap343x_gpt_clksel, 1573 - OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL), 1574 - OMAP3430_CLKSEL_GPT10_MASK, 1575 - OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1576 - OMAP3430_EN_GPT10_SHIFT, &clkhwops_wait, 1577 - gpt10_fck_parent_names, clkout2_src_ck_ops); 1578 - 1579 - static struct clk gpt10_ick; 1580 - 1581 - static struct clk_hw_omap gpt10_ick_hw = { 1582 - .hw = { 1583 - .clk = &gpt10_ick, 1584 - }, 1585 - .ops = &clkhwops_iclk_wait, 1586 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1587 - .enable_bit = OMAP3430_EN_GPT10_SHIFT, 1588 - .clkdm_name = "core_l4_clkdm", 1589 - }; 1590 - 1591 - DEFINE_STRUCT_CLK(gpt10_ick, aes2_ick_parent_names, aes2_ick_ops); 1592 - 1593 - DEFINE_CLK_OMAP_MUX_GATE(gpt11_fck, "core_l4_clkdm", omap343x_gpt_clksel, 1594 - OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL), 1595 - OMAP3430_CLKSEL_GPT11_MASK, 1596 - OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1597 - OMAP3430_EN_GPT11_SHIFT, &clkhwops_wait, 1598 - gpt10_fck_parent_names, clkout2_src_ck_ops); 1599 - 1600 - static struct clk gpt11_ick; 1601 - 1602 - static struct clk_hw_omap gpt11_ick_hw = { 1603 - .hw = { 1604 - .clk = &gpt11_ick, 1605 - }, 1606 - .ops = &clkhwops_iclk_wait, 1607 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1608 - .enable_bit = OMAP3430_EN_GPT11_SHIFT, 1609 - .clkdm_name = "core_l4_clkdm", 1610 - }; 1611 - 1612 - DEFINE_STRUCT_CLK(gpt11_ick, aes2_ick_parent_names, aes2_ick_ops); 1613 - 1614 - static struct clk gpt12_fck; 1615 - 1616 - static const char *gpt12_fck_parent_names[] = { 1617 - "secure_32k_fck", 1618 - }; 1619 - 1620 - DEFINE_STRUCT_CLK_HW_OMAP(gpt12_fck, "wkup_clkdm"); 1621 - DEFINE_STRUCT_CLK(gpt12_fck, gpt12_fck_parent_names, core_l4_ick_ops); 1622 - 1623 - static struct clk gpt12_ick; 1624 - 1625 - static struct clk_hw_omap gpt12_ick_hw = { 1626 - .hw = { 1627 - .clk = &gpt12_ick, 1628 - }, 1629 - .ops = &clkhwops_iclk_wait, 1630 - .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 1631 - .enable_bit = OMAP3430_EN_GPT12_SHIFT, 1632 - .clkdm_name = "wkup_clkdm", 1633 - }; 1634 - 1635 - DEFINE_STRUCT_CLK(gpt12_ick, gpio1_ick_parent_names, aes2_ick_ops); 1636 - 1637 - DEFINE_CLK_OMAP_MUX_GATE(gpt1_fck, "wkup_clkdm", omap343x_gpt_clksel, 1638 - OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL), 1639 - OMAP3430_CLKSEL_GPT1_MASK, 1640 - OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), 1641 - OMAP3430_EN_GPT1_SHIFT, &clkhwops_wait, 1642 - gpt10_fck_parent_names, clkout2_src_ck_ops); 1643 - 1644 - static struct clk gpt1_ick; 1645 - 1646 - static struct clk_hw_omap gpt1_ick_hw = { 1647 - .hw = { 1648 - .clk = &gpt1_ick, 1649 - }, 1650 - .ops = &clkhwops_iclk_wait, 1651 - .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 1652 - .enable_bit = OMAP3430_EN_GPT1_SHIFT, 1653 - .clkdm_name = "wkup_clkdm", 1654 - }; 1655 - 1656 - DEFINE_STRUCT_CLK(gpt1_ick, gpio1_ick_parent_names, aes2_ick_ops); 1657 - 1658 - DEFINE_CLK_OMAP_MUX_GATE(gpt2_fck, "per_clkdm", omap343x_gpt_clksel, 1659 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL), 1660 - OMAP3430_CLKSEL_GPT2_MASK, 1661 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 1662 - OMAP3430_EN_GPT2_SHIFT, &clkhwops_wait, 1663 - gpt10_fck_parent_names, clkout2_src_ck_ops); 1664 - 1665 - static struct clk gpt2_ick; 1666 - 1667 - static struct clk_hw_omap gpt2_ick_hw = { 1668 - .hw = { 1669 - .clk = &gpt2_ick, 1670 - }, 1671 - .ops = &clkhwops_iclk_wait, 1672 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 1673 - .enable_bit = OMAP3430_EN_GPT2_SHIFT, 1674 - .clkdm_name = "per_clkdm", 1675 - }; 1676 - 1677 - DEFINE_STRUCT_CLK(gpt2_ick, gpio2_ick_parent_names, aes2_ick_ops); 1678 - 1679 - DEFINE_CLK_OMAP_MUX_GATE(gpt3_fck, "per_clkdm", omap343x_gpt_clksel, 1680 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL), 1681 - OMAP3430_CLKSEL_GPT3_MASK, 1682 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 1683 - OMAP3430_EN_GPT3_SHIFT, &clkhwops_wait, 1684 - gpt10_fck_parent_names, clkout2_src_ck_ops); 1685 - 1686 - static struct clk gpt3_ick; 1687 - 1688 - static struct clk_hw_omap gpt3_ick_hw = { 1689 - .hw = { 1690 - .clk = &gpt3_ick, 1691 - }, 1692 - .ops = &clkhwops_iclk_wait, 1693 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 1694 - .enable_bit = OMAP3430_EN_GPT3_SHIFT, 1695 - .clkdm_name = "per_clkdm", 1696 - }; 1697 - 1698 - DEFINE_STRUCT_CLK(gpt3_ick, gpio2_ick_parent_names, aes2_ick_ops); 1699 - 1700 - DEFINE_CLK_OMAP_MUX_GATE(gpt4_fck, "per_clkdm", omap343x_gpt_clksel, 1701 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL), 1702 - OMAP3430_CLKSEL_GPT4_MASK, 1703 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 1704 - OMAP3430_EN_GPT4_SHIFT, &clkhwops_wait, 1705 - gpt10_fck_parent_names, clkout2_src_ck_ops); 1706 - 1707 - static struct clk gpt4_ick; 1708 - 1709 - static struct clk_hw_omap gpt4_ick_hw = { 1710 - .hw = { 1711 - .clk = &gpt4_ick, 1712 - }, 1713 - .ops = &clkhwops_iclk_wait, 1714 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 1715 - .enable_bit = OMAP3430_EN_GPT4_SHIFT, 1716 - .clkdm_name = "per_clkdm", 1717 - }; 1718 - 1719 - DEFINE_STRUCT_CLK(gpt4_ick, gpio2_ick_parent_names, aes2_ick_ops); 1720 - 1721 - DEFINE_CLK_OMAP_MUX_GATE(gpt5_fck, "per_clkdm", omap343x_gpt_clksel, 1722 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL), 1723 - OMAP3430_CLKSEL_GPT5_MASK, 1724 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 1725 - OMAP3430_EN_GPT5_SHIFT, &clkhwops_wait, 1726 - gpt10_fck_parent_names, clkout2_src_ck_ops); 1727 - 1728 - static struct clk gpt5_ick; 1729 - 1730 - static struct clk_hw_omap gpt5_ick_hw = { 1731 - .hw = { 1732 - .clk = &gpt5_ick, 1733 - }, 1734 - .ops = &clkhwops_iclk_wait, 1735 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 1736 - .enable_bit = OMAP3430_EN_GPT5_SHIFT, 1737 - .clkdm_name = "per_clkdm", 1738 - }; 1739 - 1740 - DEFINE_STRUCT_CLK(gpt5_ick, gpio2_ick_parent_names, aes2_ick_ops); 1741 - 1742 - DEFINE_CLK_OMAP_MUX_GATE(gpt6_fck, "per_clkdm", omap343x_gpt_clksel, 1743 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL), 1744 - OMAP3430_CLKSEL_GPT6_MASK, 1745 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 1746 - OMAP3430_EN_GPT6_SHIFT, &clkhwops_wait, 1747 - gpt10_fck_parent_names, clkout2_src_ck_ops); 1748 - 1749 - static struct clk gpt6_ick; 1750 - 1751 - static struct clk_hw_omap gpt6_ick_hw = { 1752 - .hw = { 1753 - .clk = &gpt6_ick, 1754 - }, 1755 - .ops = &clkhwops_iclk_wait, 1756 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 1757 - .enable_bit = OMAP3430_EN_GPT6_SHIFT, 1758 - .clkdm_name = "per_clkdm", 1759 - }; 1760 - 1761 - DEFINE_STRUCT_CLK(gpt6_ick, gpio2_ick_parent_names, aes2_ick_ops); 1762 - 1763 - DEFINE_CLK_OMAP_MUX_GATE(gpt7_fck, "per_clkdm", omap343x_gpt_clksel, 1764 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL), 1765 - OMAP3430_CLKSEL_GPT7_MASK, 1766 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 1767 - OMAP3430_EN_GPT7_SHIFT, &clkhwops_wait, 1768 - gpt10_fck_parent_names, clkout2_src_ck_ops); 1769 - 1770 - static struct clk gpt7_ick; 1771 - 1772 - static struct clk_hw_omap gpt7_ick_hw = { 1773 - .hw = { 1774 - .clk = &gpt7_ick, 1775 - }, 1776 - .ops = &clkhwops_iclk_wait, 1777 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 1778 - .enable_bit = OMAP3430_EN_GPT7_SHIFT, 1779 - .clkdm_name = "per_clkdm", 1780 - }; 1781 - 1782 - DEFINE_STRUCT_CLK(gpt7_ick, gpio2_ick_parent_names, aes2_ick_ops); 1783 - 1784 - DEFINE_CLK_OMAP_MUX_GATE(gpt8_fck, "per_clkdm", omap343x_gpt_clksel, 1785 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL), 1786 - OMAP3430_CLKSEL_GPT8_MASK, 1787 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 1788 - OMAP3430_EN_GPT8_SHIFT, &clkhwops_wait, 1789 - gpt10_fck_parent_names, clkout2_src_ck_ops); 1790 - 1791 - static struct clk gpt8_ick; 1792 - 1793 - static struct clk_hw_omap gpt8_ick_hw = { 1794 - .hw = { 1795 - .clk = &gpt8_ick, 1796 - }, 1797 - .ops = &clkhwops_iclk_wait, 1798 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 1799 - .enable_bit = OMAP3430_EN_GPT8_SHIFT, 1800 - .clkdm_name = "per_clkdm", 1801 - }; 1802 - 1803 - DEFINE_STRUCT_CLK(gpt8_ick, gpio2_ick_parent_names, aes2_ick_ops); 1804 - 1805 - DEFINE_CLK_OMAP_MUX_GATE(gpt9_fck, "per_clkdm", omap343x_gpt_clksel, 1806 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL), 1807 - OMAP3430_CLKSEL_GPT9_MASK, 1808 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 1809 - OMAP3430_EN_GPT9_SHIFT, &clkhwops_wait, 1810 - gpt10_fck_parent_names, clkout2_src_ck_ops); 1811 - 1812 - static struct clk gpt9_ick; 1813 - 1814 - static struct clk_hw_omap gpt9_ick_hw = { 1815 - .hw = { 1816 - .clk = &gpt9_ick, 1817 - }, 1818 - .ops = &clkhwops_iclk_wait, 1819 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 1820 - .enable_bit = OMAP3430_EN_GPT9_SHIFT, 1821 - .clkdm_name = "per_clkdm", 1822 - }; 1823 - 1824 - DEFINE_STRUCT_CLK(gpt9_ick, gpio2_ick_parent_names, aes2_ick_ops); 1825 - 1826 - static struct clk hdq_fck; 1827 - 1828 - static const char *hdq_fck_parent_names[] = { 1829 - "core_12m_fck", 1830 - }; 1831 - 1832 - static struct clk_hw_omap hdq_fck_hw = { 1833 - .hw = { 1834 - .clk = &hdq_fck, 1835 - }, 1836 - .ops = &clkhwops_wait, 1837 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1838 - .enable_bit = OMAP3430_EN_HDQ_SHIFT, 1839 - .clkdm_name = "core_l4_clkdm", 1840 - }; 1841 - 1842 - DEFINE_STRUCT_CLK(hdq_fck, hdq_fck_parent_names, aes2_ick_ops); 1843 - 1844 - static struct clk hdq_ick; 1845 - 1846 - static struct clk_hw_omap hdq_ick_hw = { 1847 - .hw = { 1848 - .clk = &hdq_ick, 1849 - }, 1850 - .ops = &clkhwops_iclk_wait, 1851 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1852 - .enable_bit = OMAP3430_EN_HDQ_SHIFT, 1853 - .clkdm_name = "core_l4_clkdm", 1854 - }; 1855 - 1856 - DEFINE_STRUCT_CLK(hdq_ick, aes2_ick_parent_names, aes2_ick_ops); 1857 - 1858 - static struct clk hecc_ck; 1859 - 1860 - static struct clk_hw_omap hecc_ck_hw = { 1861 - .hw = { 1862 - .clk = &hecc_ck, 1863 - }, 1864 - .ops = &clkhwops_am35xx_ipss_module_wait, 1865 - .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL), 1866 - .enable_bit = AM35XX_HECC_VBUSP_CLK_SHIFT, 1867 - .clkdm_name = "core_l3_clkdm", 1868 - }; 1869 - 1870 - DEFINE_STRUCT_CLK(hecc_ck, cpefuse_fck_parent_names, aes2_ick_ops); 1871 - 1872 - static struct clk hsotgusb_fck_am35xx; 1873 - 1874 - static struct clk_hw_omap hsotgusb_fck_am35xx_hw = { 1875 - .hw = { 1876 - .clk = &hsotgusb_fck_am35xx, 1877 - }, 1878 - .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL), 1879 - .enable_bit = AM35XX_USBOTG_FCLK_SHIFT, 1880 - .clkdm_name = "core_l3_clkdm", 1881 - }; 1882 - 1883 - DEFINE_STRUCT_CLK(hsotgusb_fck_am35xx, cpefuse_fck_parent_names, aes2_ick_ops); 1884 - 1885 - static struct clk hsotgusb_ick_3430es1; 1886 - 1887 - static struct clk_hw_omap hsotgusb_ick_3430es1_hw = { 1888 - .hw = { 1889 - .clk = &hsotgusb_ick_3430es1, 1890 - }, 1891 - .ops = &clkhwops_iclk, 1892 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1893 - .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT, 1894 - .clkdm_name = "core_l3_clkdm", 1895 - }; 1896 - 1897 - DEFINE_STRUCT_CLK(hsotgusb_ick_3430es1, ipss_ick_parent_names, aes2_ick_ops); 1898 - 1899 - static struct clk hsotgusb_ick_3430es2; 1900 - 1901 - static struct clk_hw_omap hsotgusb_ick_3430es2_hw = { 1902 - .hw = { 1903 - .clk = &hsotgusb_ick_3430es2, 1904 - }, 1905 - .ops = &clkhwops_omap3430es2_iclk_hsotgusb_wait, 1906 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1907 - .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT, 1908 - .clkdm_name = "core_l3_clkdm", 1909 - }; 1910 - 1911 - DEFINE_STRUCT_CLK(hsotgusb_ick_3430es2, ipss_ick_parent_names, aes2_ick_ops); 1912 - 1913 - static struct clk hsotgusb_ick_am35xx; 1914 - 1915 - static struct clk_hw_omap hsotgusb_ick_am35xx_hw = { 1916 - .hw = { 1917 - .clk = &hsotgusb_ick_am35xx, 1918 - }, 1919 - .ops = &clkhwops_am35xx_ipss_module_wait, 1920 - .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL), 1921 - .enable_bit = AM35XX_USBOTG_VBUSP_CLK_SHIFT, 1922 - .clkdm_name = "core_l3_clkdm", 1923 - }; 1924 - 1925 - DEFINE_STRUCT_CLK(hsotgusb_ick_am35xx, emac_ick_parent_names, aes2_ick_ops); 1926 - 1927 - static struct clk i2c1_fck; 1928 - 1929 - static struct clk_hw_omap i2c1_fck_hw = { 1930 - .hw = { 1931 - .clk = &i2c1_fck, 1932 - }, 1933 - .ops = &clkhwops_wait, 1934 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1935 - .enable_bit = OMAP3430_EN_I2C1_SHIFT, 1936 - .clkdm_name = "core_l4_clkdm", 1937 - }; 1938 - 1939 - DEFINE_STRUCT_CLK(i2c1_fck, csi2_96m_fck_parent_names, aes2_ick_ops); 1940 - 1941 - static struct clk i2c1_ick; 1942 - 1943 - static struct clk_hw_omap i2c1_ick_hw = { 1944 - .hw = { 1945 - .clk = &i2c1_ick, 1946 - }, 1947 - .ops = &clkhwops_iclk_wait, 1948 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1949 - .enable_bit = OMAP3430_EN_I2C1_SHIFT, 1950 - .clkdm_name = "core_l4_clkdm", 1951 - }; 1952 - 1953 - DEFINE_STRUCT_CLK(i2c1_ick, aes2_ick_parent_names, aes2_ick_ops); 1954 - 1955 - static struct clk i2c2_fck; 1956 - 1957 - static struct clk_hw_omap i2c2_fck_hw = { 1958 - .hw = { 1959 - .clk = &i2c2_fck, 1960 - }, 1961 - .ops = &clkhwops_wait, 1962 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1963 - .enable_bit = OMAP3430_EN_I2C2_SHIFT, 1964 - .clkdm_name = "core_l4_clkdm", 1965 - }; 1966 - 1967 - DEFINE_STRUCT_CLK(i2c2_fck, csi2_96m_fck_parent_names, aes2_ick_ops); 1968 - 1969 - static struct clk i2c2_ick; 1970 - 1971 - static struct clk_hw_omap i2c2_ick_hw = { 1972 - .hw = { 1973 - .clk = &i2c2_ick, 1974 - }, 1975 - .ops = &clkhwops_iclk_wait, 1976 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1977 - .enable_bit = OMAP3430_EN_I2C2_SHIFT, 1978 - .clkdm_name = "core_l4_clkdm", 1979 - }; 1980 - 1981 - DEFINE_STRUCT_CLK(i2c2_ick, aes2_ick_parent_names, aes2_ick_ops); 1982 - 1983 - static struct clk i2c3_fck; 1984 - 1985 - static struct clk_hw_omap i2c3_fck_hw = { 1986 - .hw = { 1987 - .clk = &i2c3_fck, 1988 - }, 1989 - .ops = &clkhwops_wait, 1990 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1991 - .enable_bit = OMAP3430_EN_I2C3_SHIFT, 1992 - .clkdm_name = "core_l4_clkdm", 1993 - }; 1994 - 1995 - DEFINE_STRUCT_CLK(i2c3_fck, csi2_96m_fck_parent_names, aes2_ick_ops); 1996 - 1997 - static struct clk i2c3_ick; 1998 - 1999 - static struct clk_hw_omap i2c3_ick_hw = { 2000 - .hw = { 2001 - .clk = &i2c3_ick, 2002 - }, 2003 - .ops = &clkhwops_iclk_wait, 2004 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2005 - .enable_bit = OMAP3430_EN_I2C3_SHIFT, 2006 - .clkdm_name = "core_l4_clkdm", 2007 - }; 2008 - 2009 - DEFINE_STRUCT_CLK(i2c3_ick, aes2_ick_parent_names, aes2_ick_ops); 2010 - 2011 - static struct clk icr_ick; 2012 - 2013 - static struct clk_hw_omap icr_ick_hw = { 2014 - .hw = { 2015 - .clk = &icr_ick, 2016 - }, 2017 - .ops = &clkhwops_iclk_wait, 2018 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2019 - .enable_bit = OMAP3430_EN_ICR_SHIFT, 2020 - .clkdm_name = "core_l4_clkdm", 2021 - }; 2022 - 2023 - DEFINE_STRUCT_CLK(icr_ick, aes2_ick_parent_names, aes2_ick_ops); 2024 - 2025 - static struct clk iva2_ck; 2026 - 2027 - static const char *iva2_ck_parent_names[] = { 2028 - "dpll2_m2_ck", 2029 - }; 2030 - 2031 - static struct clk_hw_omap iva2_ck_hw = { 2032 - .hw = { 2033 - .clk = &iva2_ck, 2034 - }, 2035 - .ops = &clkhwops_wait, 2036 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, CM_FCLKEN), 2037 - .enable_bit = OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_SHIFT, 2038 - .clkdm_name = "iva2_clkdm", 2039 - }; 2040 - 2041 - DEFINE_STRUCT_CLK(iva2_ck, iva2_ck_parent_names, aes2_ick_ops); 2042 - 2043 - static struct clk mad2d_ick; 2044 - 2045 - static struct clk_hw_omap mad2d_ick_hw = { 2046 - .hw = { 2047 - .clk = &mad2d_ick, 2048 - }, 2049 - .ops = &clkhwops_iclk_wait, 2050 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3), 2051 - .enable_bit = OMAP3430_EN_MAD2D_SHIFT, 2052 - .clkdm_name = "d2d_clkdm", 2053 - }; 2054 - 2055 - DEFINE_STRUCT_CLK(mad2d_ick, core_l3_ick_parent_names, aes2_ick_ops); 2056 - 2057 - static struct clk mailboxes_ick; 2058 - 2059 - static struct clk_hw_omap mailboxes_ick_hw = { 2060 - .hw = { 2061 - .clk = &mailboxes_ick, 2062 - }, 2063 - .ops = &clkhwops_iclk_wait, 2064 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2065 - .enable_bit = OMAP3430_EN_MAILBOXES_SHIFT, 2066 - .clkdm_name = "core_l4_clkdm", 2067 - }; 2068 - 2069 - DEFINE_STRUCT_CLK(mailboxes_ick, aes2_ick_parent_names, aes2_ick_ops); 2070 - 2071 - static const struct clksel_rate common_mcbsp_96m_rates[] = { 2072 - { .div = 1, .val = 0, .flags = RATE_IN_3XXX }, 2073 - { .div = 0 } 2074 - }; 2075 - 2076 - static const struct clksel_rate common_mcbsp_mcbsp_rates[] = { 2077 - { .div = 1, .val = 1, .flags = RATE_IN_3XXX }, 2078 - { .div = 0 } 2079 - }; 2080 - 2081 - static const struct clksel mcbsp_15_clksel[] = { 2082 - { .parent = &core_96m_fck, .rates = common_mcbsp_96m_rates }, 2083 - { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates }, 2084 - { .parent = NULL }, 2085 - }; 2086 - 2087 - static const char *mcbsp1_fck_parent_names[] = { 2088 - "core_96m_fck", "mcbsp_clks", 2089 - }; 2090 - 2091 - DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "core_l4_clkdm", mcbsp_15_clksel, 2092 - OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0), 2093 - OMAP2_MCBSP1_CLKS_MASK, 2094 - OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 2095 - OMAP3430_EN_MCBSP1_SHIFT, &clkhwops_wait, 2096 - mcbsp1_fck_parent_names, clkout2_src_ck_ops); 2097 - 2098 - static struct clk mcbsp1_ick; 2099 - 2100 - static struct clk_hw_omap mcbsp1_ick_hw = { 2101 - .hw = { 2102 - .clk = &mcbsp1_ick, 2103 - }, 2104 - .ops = &clkhwops_iclk_wait, 2105 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2106 - .enable_bit = OMAP3430_EN_MCBSP1_SHIFT, 2107 - .clkdm_name = "core_l4_clkdm", 2108 - }; 2109 - 2110 - DEFINE_STRUCT_CLK(mcbsp1_ick, aes2_ick_parent_names, aes2_ick_ops); 2111 - 2112 - static struct clk per_96m_fck; 2113 - 2114 - DEFINE_STRUCT_CLK_HW_OMAP(per_96m_fck, "per_clkdm"); 2115 - DEFINE_STRUCT_CLK(per_96m_fck, cm_96m_fck_parent_names, core_l4_ick_ops); 2116 - 2117 - static const struct clksel mcbsp_234_clksel[] = { 2118 - { .parent = &per_96m_fck, .rates = common_mcbsp_96m_rates }, 2119 - { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates }, 2120 - { .parent = NULL }, 2121 - }; 2122 - 2123 - static const char *mcbsp2_fck_parent_names[] = { 2124 - "per_96m_fck", "mcbsp_clks", 2125 - }; 2126 - 2127 - DEFINE_CLK_OMAP_MUX_GATE(mcbsp2_fck, "per_clkdm", mcbsp_234_clksel, 2128 - OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0), 2129 - OMAP2_MCBSP2_CLKS_MASK, 2130 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2131 - OMAP3430_EN_MCBSP2_SHIFT, &clkhwops_wait, 2132 - mcbsp2_fck_parent_names, clkout2_src_ck_ops); 2133 - 2134 - static struct clk mcbsp2_ick; 2135 - 2136 - static struct clk_hw_omap mcbsp2_ick_hw = { 2137 - .hw = { 2138 - .clk = &mcbsp2_ick, 2139 - }, 2140 - .ops = &clkhwops_iclk_wait, 2141 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2142 - .enable_bit = OMAP3430_EN_MCBSP2_SHIFT, 2143 - .clkdm_name = "per_clkdm", 2144 - }; 2145 - 2146 - DEFINE_STRUCT_CLK(mcbsp2_ick, gpio2_ick_parent_names, aes2_ick_ops); 2147 - 2148 - DEFINE_CLK_OMAP_MUX_GATE(mcbsp3_fck, "per_clkdm", mcbsp_234_clksel, 2149 - OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1), 2150 - OMAP2_MCBSP3_CLKS_MASK, 2151 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2152 - OMAP3430_EN_MCBSP3_SHIFT, &clkhwops_wait, 2153 - mcbsp2_fck_parent_names, clkout2_src_ck_ops); 2154 - 2155 - static struct clk mcbsp3_ick; 2156 - 2157 - static struct clk_hw_omap mcbsp3_ick_hw = { 2158 - .hw = { 2159 - .clk = &mcbsp3_ick, 2160 - }, 2161 - .ops = &clkhwops_iclk_wait, 2162 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2163 - .enable_bit = OMAP3430_EN_MCBSP3_SHIFT, 2164 - .clkdm_name = "per_clkdm", 2165 - }; 2166 - 2167 - DEFINE_STRUCT_CLK(mcbsp3_ick, gpio2_ick_parent_names, aes2_ick_ops); 2168 - 2169 - DEFINE_CLK_OMAP_MUX_GATE(mcbsp4_fck, "per_clkdm", mcbsp_234_clksel, 2170 - OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1), 2171 - OMAP2_MCBSP4_CLKS_MASK, 2172 - OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2173 - OMAP3430_EN_MCBSP4_SHIFT, &clkhwops_wait, 2174 - mcbsp2_fck_parent_names, clkout2_src_ck_ops); 2175 - 2176 - static struct clk mcbsp4_ick; 2177 - 2178 - static struct clk_hw_omap mcbsp4_ick_hw = { 2179 - .hw = { 2180 - .clk = &mcbsp4_ick, 2181 - }, 2182 - .ops = &clkhwops_iclk_wait, 2183 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2184 - .enable_bit = OMAP3430_EN_MCBSP4_SHIFT, 2185 - .clkdm_name = "per_clkdm", 2186 - }; 2187 - 2188 - DEFINE_STRUCT_CLK(mcbsp4_ick, gpio2_ick_parent_names, aes2_ick_ops); 2189 - 2190 - DEFINE_CLK_OMAP_MUX_GATE(mcbsp5_fck, "core_l4_clkdm", mcbsp_15_clksel, 2191 - OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1), 2192 - OMAP2_MCBSP5_CLKS_MASK, 2193 - OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 2194 - OMAP3430_EN_MCBSP5_SHIFT, &clkhwops_wait, 2195 - mcbsp1_fck_parent_names, clkout2_src_ck_ops); 2196 - 2197 - static struct clk mcbsp5_ick; 2198 - 2199 - static struct clk_hw_omap mcbsp5_ick_hw = { 2200 - .hw = { 2201 - .clk = &mcbsp5_ick, 2202 - }, 2203 - .ops = &clkhwops_iclk_wait, 2204 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2205 - .enable_bit = OMAP3430_EN_MCBSP5_SHIFT, 2206 - .clkdm_name = "core_l4_clkdm", 2207 - }; 2208 - 2209 - DEFINE_STRUCT_CLK(mcbsp5_ick, aes2_ick_parent_names, aes2_ick_ops); 2210 - 2211 - static struct clk mcspi1_fck; 2212 - 2213 - static struct clk_hw_omap mcspi1_fck_hw = { 2214 - .hw = { 2215 - .clk = &mcspi1_fck, 2216 - }, 2217 - .ops = &clkhwops_wait, 2218 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 2219 - .enable_bit = OMAP3430_EN_MCSPI1_SHIFT, 2220 - .clkdm_name = "core_l4_clkdm", 2221 - }; 2222 - 2223 - DEFINE_STRUCT_CLK(mcspi1_fck, fshostusb_fck_parent_names, aes2_ick_ops); 2224 - 2225 - static struct clk mcspi1_ick; 2226 - 2227 - static struct clk_hw_omap mcspi1_ick_hw = { 2228 - .hw = { 2229 - .clk = &mcspi1_ick, 2230 - }, 2231 - .ops = &clkhwops_iclk_wait, 2232 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2233 - .enable_bit = OMAP3430_EN_MCSPI1_SHIFT, 2234 - .clkdm_name = "core_l4_clkdm", 2235 - }; 2236 - 2237 - DEFINE_STRUCT_CLK(mcspi1_ick, aes2_ick_parent_names, aes2_ick_ops); 2238 - 2239 - static struct clk mcspi2_fck; 2240 - 2241 - static struct clk_hw_omap mcspi2_fck_hw = { 2242 - .hw = { 2243 - .clk = &mcspi2_fck, 2244 - }, 2245 - .ops = &clkhwops_wait, 2246 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 2247 - .enable_bit = OMAP3430_EN_MCSPI2_SHIFT, 2248 - .clkdm_name = "core_l4_clkdm", 2249 - }; 2250 - 2251 - DEFINE_STRUCT_CLK(mcspi2_fck, fshostusb_fck_parent_names, aes2_ick_ops); 2252 - 2253 - static struct clk mcspi2_ick; 2254 - 2255 - static struct clk_hw_omap mcspi2_ick_hw = { 2256 - .hw = { 2257 - .clk = &mcspi2_ick, 2258 - }, 2259 - .ops = &clkhwops_iclk_wait, 2260 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2261 - .enable_bit = OMAP3430_EN_MCSPI2_SHIFT, 2262 - .clkdm_name = "core_l4_clkdm", 2263 - }; 2264 - 2265 - DEFINE_STRUCT_CLK(mcspi2_ick, aes2_ick_parent_names, aes2_ick_ops); 2266 - 2267 - static struct clk mcspi3_fck; 2268 - 2269 - static struct clk_hw_omap mcspi3_fck_hw = { 2270 - .hw = { 2271 - .clk = &mcspi3_fck, 2272 - }, 2273 - .ops = &clkhwops_wait, 2274 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 2275 - .enable_bit = OMAP3430_EN_MCSPI3_SHIFT, 2276 - .clkdm_name = "core_l4_clkdm", 2277 - }; 2278 - 2279 - DEFINE_STRUCT_CLK(mcspi3_fck, fshostusb_fck_parent_names, aes2_ick_ops); 2280 - 2281 - static struct clk mcspi3_ick; 2282 - 2283 - static struct clk_hw_omap mcspi3_ick_hw = { 2284 - .hw = { 2285 - .clk = &mcspi3_ick, 2286 - }, 2287 - .ops = &clkhwops_iclk_wait, 2288 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2289 - .enable_bit = OMAP3430_EN_MCSPI3_SHIFT, 2290 - .clkdm_name = "core_l4_clkdm", 2291 - }; 2292 - 2293 - DEFINE_STRUCT_CLK(mcspi3_ick, aes2_ick_parent_names, aes2_ick_ops); 2294 - 2295 - static struct clk mcspi4_fck; 2296 - 2297 - static struct clk_hw_omap mcspi4_fck_hw = { 2298 - .hw = { 2299 - .clk = &mcspi4_fck, 2300 - }, 2301 - .ops = &clkhwops_wait, 2302 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 2303 - .enable_bit = OMAP3430_EN_MCSPI4_SHIFT, 2304 - .clkdm_name = "core_l4_clkdm", 2305 - }; 2306 - 2307 - DEFINE_STRUCT_CLK(mcspi4_fck, fshostusb_fck_parent_names, aes2_ick_ops); 2308 - 2309 - static struct clk mcspi4_ick; 2310 - 2311 - static struct clk_hw_omap mcspi4_ick_hw = { 2312 - .hw = { 2313 - .clk = &mcspi4_ick, 2314 - }, 2315 - .ops = &clkhwops_iclk_wait, 2316 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2317 - .enable_bit = OMAP3430_EN_MCSPI4_SHIFT, 2318 - .clkdm_name = "core_l4_clkdm", 2319 - }; 2320 - 2321 - DEFINE_STRUCT_CLK(mcspi4_ick, aes2_ick_parent_names, aes2_ick_ops); 2322 - 2323 - static struct clk mmchs1_fck; 2324 - 2325 - static struct clk_hw_omap mmchs1_fck_hw = { 2326 - .hw = { 2327 - .clk = &mmchs1_fck, 2328 - }, 2329 - .ops = &clkhwops_wait, 2330 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 2331 - .enable_bit = OMAP3430_EN_MMC1_SHIFT, 2332 - .clkdm_name = "core_l4_clkdm", 2333 - }; 2334 - 2335 - DEFINE_STRUCT_CLK(mmchs1_fck, csi2_96m_fck_parent_names, aes2_ick_ops); 2336 - 2337 - static struct clk mmchs1_ick; 2338 - 2339 - static struct clk_hw_omap mmchs1_ick_hw = { 2340 - .hw = { 2341 - .clk = &mmchs1_ick, 2342 - }, 2343 - .ops = &clkhwops_iclk_wait, 2344 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2345 - .enable_bit = OMAP3430_EN_MMC1_SHIFT, 2346 - .clkdm_name = "core_l4_clkdm", 2347 - }; 2348 - 2349 - DEFINE_STRUCT_CLK(mmchs1_ick, aes2_ick_parent_names, aes2_ick_ops); 2350 - 2351 - static struct clk mmchs2_fck; 2352 - 2353 - static struct clk_hw_omap mmchs2_fck_hw = { 2354 - .hw = { 2355 - .clk = &mmchs2_fck, 2356 - }, 2357 - .ops = &clkhwops_wait, 2358 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 2359 - .enable_bit = OMAP3430_EN_MMC2_SHIFT, 2360 - .clkdm_name = "core_l4_clkdm", 2361 - }; 2362 - 2363 - DEFINE_STRUCT_CLK(mmchs2_fck, csi2_96m_fck_parent_names, aes2_ick_ops); 2364 - 2365 - static struct clk mmchs2_ick; 2366 - 2367 - static struct clk_hw_omap mmchs2_ick_hw = { 2368 - .hw = { 2369 - .clk = &mmchs2_ick, 2370 - }, 2371 - .ops = &clkhwops_iclk_wait, 2372 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2373 - .enable_bit = OMAP3430_EN_MMC2_SHIFT, 2374 - .clkdm_name = "core_l4_clkdm", 2375 - }; 2376 - 2377 - DEFINE_STRUCT_CLK(mmchs2_ick, aes2_ick_parent_names, aes2_ick_ops); 2378 - 2379 - static struct clk mmchs3_fck; 2380 - 2381 - static struct clk_hw_omap mmchs3_fck_hw = { 2382 - .hw = { 2383 - .clk = &mmchs3_fck, 2384 - }, 2385 - .ops = &clkhwops_wait, 2386 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 2387 - .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT, 2388 - .clkdm_name = "core_l4_clkdm", 2389 - }; 2390 - 2391 - DEFINE_STRUCT_CLK(mmchs3_fck, csi2_96m_fck_parent_names, aes2_ick_ops); 2392 - 2393 - static struct clk mmchs3_ick; 2394 - 2395 - static struct clk_hw_omap mmchs3_ick_hw = { 2396 - .hw = { 2397 - .clk = &mmchs3_ick, 2398 - }, 2399 - .ops = &clkhwops_iclk_wait, 2400 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2401 - .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT, 2402 - .clkdm_name = "core_l4_clkdm", 2403 - }; 2404 - 2405 - DEFINE_STRUCT_CLK(mmchs3_ick, aes2_ick_parent_names, aes2_ick_ops); 2406 - 2407 - static struct clk modem_fck; 2408 - 2409 - static struct clk_hw_omap modem_fck_hw = { 2410 - .hw = { 2411 - .clk = &modem_fck, 2412 - }, 2413 - .ops = &clkhwops_iclk_wait, 2414 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 2415 - .enable_bit = OMAP3430_EN_MODEM_SHIFT, 2416 - .clkdm_name = "d2d_clkdm", 2417 - }; 2418 - 2419 - DEFINE_STRUCT_CLK(modem_fck, cpefuse_fck_parent_names, aes2_ick_ops); 2420 - 2421 - static struct clk mspro_fck; 2422 - 2423 - static struct clk_hw_omap mspro_fck_hw = { 2424 - .hw = { 2425 - .clk = &mspro_fck, 2426 - }, 2427 - .ops = &clkhwops_wait, 2428 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 2429 - .enable_bit = OMAP3430_EN_MSPRO_SHIFT, 2430 - .clkdm_name = "core_l4_clkdm", 2431 - }; 2432 - 2433 - DEFINE_STRUCT_CLK(mspro_fck, csi2_96m_fck_parent_names, aes2_ick_ops); 2434 - 2435 - static struct clk mspro_ick; 2436 - 2437 - static struct clk_hw_omap mspro_ick_hw = { 2438 - .hw = { 2439 - .clk = &mspro_ick, 2440 - }, 2441 - .ops = &clkhwops_iclk_wait, 2442 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2443 - .enable_bit = OMAP3430_EN_MSPRO_SHIFT, 2444 - .clkdm_name = "core_l4_clkdm", 2445 - }; 2446 - 2447 - DEFINE_STRUCT_CLK(mspro_ick, aes2_ick_parent_names, aes2_ick_ops); 2448 - 2449 - static struct clk omap_192m_alwon_fck; 2450 - 2451 - DEFINE_STRUCT_CLK_HW_OMAP(omap_192m_alwon_fck, NULL); 2452 - DEFINE_STRUCT_CLK(omap_192m_alwon_fck, omap_96m_alwon_fck_parent_names, 2453 - core_ck_ops); 2454 - 2455 - static struct clk omap_32ksync_ick; 2456 - 2457 - static struct clk_hw_omap omap_32ksync_ick_hw = { 2458 - .hw = { 2459 - .clk = &omap_32ksync_ick, 2460 - }, 2461 - .ops = &clkhwops_iclk_wait, 2462 - .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 2463 - .enable_bit = OMAP3430_EN_32KSYNC_SHIFT, 2464 - .clkdm_name = "wkup_clkdm", 2465 - }; 2466 - 2467 - DEFINE_STRUCT_CLK(omap_32ksync_ick, gpio1_ick_parent_names, aes2_ick_ops); 2468 - 2469 - static const struct clksel_rate omap_96m_alwon_fck_rates[] = { 2470 - { .div = 1, .val = 1, .flags = RATE_IN_36XX }, 2471 - { .div = 2, .val = 2, .flags = RATE_IN_36XX }, 2472 - { .div = 0 } 2473 - }; 2474 - 2475 - static const struct clksel omap_96m_alwon_fck_clksel[] = { 2476 - { .parent = &omap_192m_alwon_fck, .rates = omap_96m_alwon_fck_rates }, 2477 - { .parent = NULL } 2478 - }; 2479 - 2480 - static struct clk omap_96m_alwon_fck_3630; 2481 - 2482 - static const char *omap_96m_alwon_fck_3630_parent_names[] = { 2483 - "omap_192m_alwon_fck", 2484 - }; 2485 - 2486 - static const struct clk_ops omap_96m_alwon_fck_3630_ops = { 2487 - .set_rate = &omap2_clksel_set_rate, 2488 - .recalc_rate = &omap2_clksel_recalc, 2489 - .round_rate = &omap2_clksel_round_rate, 2490 - }; 2491 - 2492 - static struct clk_hw_omap omap_96m_alwon_fck_3630_hw = { 2493 - .hw = { 2494 - .clk = &omap_96m_alwon_fck_3630, 2495 - }, 2496 - .clksel = omap_96m_alwon_fck_clksel, 2497 - .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL), 2498 - .clksel_mask = OMAP3630_CLKSEL_96M_MASK, 2499 - }; 2500 - 2501 - static struct clk omap_96m_alwon_fck_3630 = { 2502 - .name = "omap_96m_alwon_fck", 2503 - .hw = &omap_96m_alwon_fck_3630_hw.hw, 2504 - .parent_names = omap_96m_alwon_fck_3630_parent_names, 2505 - .num_parents = ARRAY_SIZE(omap_96m_alwon_fck_3630_parent_names), 2506 - .ops = &omap_96m_alwon_fck_3630_ops, 2507 - }; 2508 - 2509 - static struct clk omapctrl_ick; 2510 - 2511 - static struct clk_hw_omap omapctrl_ick_hw = { 2512 - .hw = { 2513 - .clk = &omapctrl_ick, 2514 - }, 2515 - .ops = &clkhwops_iclk_wait, 2516 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2517 - .enable_bit = OMAP3430_EN_OMAPCTRL_SHIFT, 2518 - .flags = ENABLE_ON_INIT, 2519 - .clkdm_name = "core_l4_clkdm", 2520 - }; 2521 - 2522 - DEFINE_STRUCT_CLK(omapctrl_ick, aes2_ick_parent_names, aes2_ick_ops); 2523 - 2524 - DEFINE_CLK_DIVIDER(pclk_fck, "emu_src_ck", &emu_src_ck, 0x0, 2525 - OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), 2526 - OMAP3430_CLKSEL_PCLK_SHIFT, OMAP3430_CLKSEL_PCLK_WIDTH, 2527 - CLK_DIVIDER_ONE_BASED, NULL); 2528 - 2529 - DEFINE_CLK_DIVIDER(pclkx2_fck, "emu_src_ck", &emu_src_ck, 0x0, 2530 - OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), 2531 - OMAP3430_CLKSEL_PCLKX2_SHIFT, OMAP3430_CLKSEL_PCLKX2_WIDTH, 2532 - CLK_DIVIDER_ONE_BASED, NULL); 2533 - 2534 - static struct clk per_48m_fck; 2535 - 2536 - DEFINE_STRUCT_CLK_HW_OMAP(per_48m_fck, "per_clkdm"); 2537 - DEFINE_STRUCT_CLK(per_48m_fck, core_48m_fck_parent_names, core_l4_ick_ops); 2538 - 2539 - static struct clk security_l3_ick; 2540 - 2541 - DEFINE_STRUCT_CLK_HW_OMAP(security_l3_ick, NULL); 2542 - DEFINE_STRUCT_CLK(security_l3_ick, core_l3_ick_parent_names, core_ck_ops); 2543 - 2544 - static struct clk pka_ick; 2545 - 2546 - static const char *pka_ick_parent_names[] = { 2547 - "security_l3_ick", 2548 - }; 2549 - 2550 - static struct clk_hw_omap pka_ick_hw = { 2551 - .hw = { 2552 - .clk = &pka_ick, 2553 - }, 2554 - .ops = &clkhwops_iclk_wait, 2555 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 2556 - .enable_bit = OMAP3430_EN_PKA_SHIFT, 2557 - }; 2558 - 2559 - DEFINE_STRUCT_CLK(pka_ick, pka_ick_parent_names, aes1_ick_ops); 2560 - 2561 - DEFINE_CLK_DIVIDER(rm_ick, "l4_ick", &l4_ick, 0x0, 2562 - OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL), 2563 - OMAP3430_CLKSEL_RM_SHIFT, OMAP3430_CLKSEL_RM_WIDTH, 2564 - CLK_DIVIDER_ONE_BASED, NULL); 2565 - 2566 - static struct clk rng_ick; 2567 - 2568 - static struct clk_hw_omap rng_ick_hw = { 2569 - .hw = { 2570 - .clk = &rng_ick, 2571 - }, 2572 - .ops = &clkhwops_iclk_wait, 2573 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 2574 - .enable_bit = OMAP3430_EN_RNG_SHIFT, 2575 - }; 2576 - 2577 - DEFINE_STRUCT_CLK(rng_ick, aes1_ick_parent_names, aes1_ick_ops); 2578 - 2579 - static struct clk sad2d_ick; 2580 - 2581 - static struct clk_hw_omap sad2d_ick_hw = { 2582 - .hw = { 2583 - .clk = &sad2d_ick, 2584 - }, 2585 - .ops = &clkhwops_iclk_wait, 2586 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2587 - .enable_bit = OMAP3430_EN_SAD2D_SHIFT, 2588 - .clkdm_name = "d2d_clkdm", 2589 - }; 2590 - 2591 - DEFINE_STRUCT_CLK(sad2d_ick, core_l3_ick_parent_names, aes2_ick_ops); 2592 - 2593 - static struct clk sdrc_ick; 2594 - 2595 - static struct clk_hw_omap sdrc_ick_hw = { 2596 - .hw = { 2597 - .clk = &sdrc_ick, 2598 - }, 2599 - .ops = &clkhwops_wait, 2600 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2601 - .enable_bit = OMAP3430_EN_SDRC_SHIFT, 2602 - .flags = ENABLE_ON_INIT, 2603 - .clkdm_name = "core_l3_clkdm", 2604 - }; 2605 - 2606 - DEFINE_STRUCT_CLK(sdrc_ick, ipss_ick_parent_names, aes2_ick_ops); 2607 - 2608 - static const struct clksel_rate sgx_core_rates[] = { 2609 - { .div = 2, .val = 5, .flags = RATE_IN_36XX }, 2610 - { .div = 3, .val = 0, .flags = RATE_IN_3XXX }, 2611 - { .div = 4, .val = 1, .flags = RATE_IN_3XXX }, 2612 - { .div = 6, .val = 2, .flags = RATE_IN_3XXX }, 2613 - { .div = 0 } 2614 - }; 2615 - 2616 - static const struct clksel_rate sgx_96m_rates[] = { 2617 - { .div = 1, .val = 3, .flags = RATE_IN_3XXX }, 2618 - { .div = 0 } 2619 - }; 2620 - 2621 - static const struct clksel_rate sgx_192m_rates[] = { 2622 - { .div = 1, .val = 4, .flags = RATE_IN_36XX }, 2623 - { .div = 0 } 2624 - }; 2625 - 2626 - static const struct clksel_rate sgx_corex2_rates[] = { 2627 - { .div = 3, .val = 6, .flags = RATE_IN_36XX }, 2628 - { .div = 5, .val = 7, .flags = RATE_IN_36XX }, 2629 - { .div = 0 } 2630 - }; 2631 - 2632 - static const struct clksel sgx_clksel[] = { 2633 - { .parent = &core_ck, .rates = sgx_core_rates }, 2634 - { .parent = &cm_96m_fck, .rates = sgx_96m_rates }, 2635 - { .parent = &omap_192m_alwon_fck, .rates = sgx_192m_rates }, 2636 - { .parent = &corex2_fck, .rates = sgx_corex2_rates }, 2637 - { .parent = NULL }, 2638 - }; 2639 - 2640 - static const char *sgx_fck_parent_names[] = { 2641 - "core_ck", "cm_96m_fck", "omap_192m_alwon_fck", "corex2_fck", 2642 - }; 2643 - 2644 - static struct clk sgx_fck; 2645 - 2646 - static const struct clk_ops sgx_fck_ops = { 2647 - .init = &omap2_init_clk_clkdm, 2648 - .enable = &omap2_dflt_clk_enable, 2649 - .disable = &omap2_dflt_clk_disable, 2650 - .is_enabled = &omap2_dflt_clk_is_enabled, 2651 - .recalc_rate = &omap2_clksel_recalc, 2652 - .set_rate = &omap2_clksel_set_rate, 2653 - .round_rate = &omap2_clksel_round_rate, 2654 - .get_parent = &omap2_clksel_find_parent_index, 2655 - .set_parent = &omap2_clksel_set_parent, 2656 - }; 2657 - 2658 - DEFINE_CLK_OMAP_MUX_GATE(sgx_fck, "sgx_clkdm", sgx_clksel, 2659 - OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_CLKSEL), 2660 - OMAP3430ES2_CLKSEL_SGX_MASK, 2661 - OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_FCLKEN), 2662 - OMAP3430ES2_CM_FCLKEN_SGX_EN_SGX_SHIFT, 2663 - &clkhwops_wait, sgx_fck_parent_names, sgx_fck_ops); 2664 - 2665 - static struct clk sgx_ick; 2666 - 2667 - static struct clk_hw_omap sgx_ick_hw = { 2668 - .hw = { 2669 - .clk = &sgx_ick, 2670 - }, 2671 - .ops = &clkhwops_wait, 2672 - .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_ICLKEN), 2673 - .enable_bit = OMAP3430ES2_CM_ICLKEN_SGX_EN_SGX_SHIFT, 2674 - .clkdm_name = "sgx_clkdm", 2675 - }; 2676 - 2677 - DEFINE_STRUCT_CLK(sgx_ick, core_l3_ick_parent_names, aes2_ick_ops); 2678 - 2679 - static struct clk sha11_ick; 2680 - 2681 - static struct clk_hw_omap sha11_ick_hw = { 2682 - .hw = { 2683 - .clk = &sha11_ick, 2684 - }, 2685 - .ops = &clkhwops_iclk_wait, 2686 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 2687 - .enable_bit = OMAP3430_EN_SHA11_SHIFT, 2688 - }; 2689 - 2690 - DEFINE_STRUCT_CLK(sha11_ick, aes1_ick_parent_names, aes1_ick_ops); 2691 - 2692 - static struct clk sha12_ick; 2693 - 2694 - static struct clk_hw_omap sha12_ick_hw = { 2695 - .hw = { 2696 - .clk = &sha12_ick, 2697 - }, 2698 - .ops = &clkhwops_iclk_wait, 2699 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2700 - .enable_bit = OMAP3430_EN_SHA12_SHIFT, 2701 - .clkdm_name = "core_l4_clkdm", 2702 - }; 2703 - 2704 - DEFINE_STRUCT_CLK(sha12_ick, aes2_ick_parent_names, aes2_ick_ops); 2705 - 2706 - static struct clk sr1_fck; 2707 - 2708 - static struct clk_hw_omap sr1_fck_hw = { 2709 - .hw = { 2710 - .clk = &sr1_fck, 2711 - }, 2712 - .ops = &clkhwops_wait, 2713 - .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), 2714 - .enable_bit = OMAP3430_EN_SR1_SHIFT, 2715 - .clkdm_name = "wkup_clkdm", 2716 - }; 2717 - 2718 - DEFINE_STRUCT_CLK(sr1_fck, cpefuse_fck_parent_names, aes2_ick_ops); 2719 - 2720 - static struct clk sr2_fck; 2721 - 2722 - static struct clk_hw_omap sr2_fck_hw = { 2723 - .hw = { 2724 - .clk = &sr2_fck, 2725 - }, 2726 - .ops = &clkhwops_wait, 2727 - .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), 2728 - .enable_bit = OMAP3430_EN_SR2_SHIFT, 2729 - .clkdm_name = "wkup_clkdm", 2730 - }; 2731 - 2732 - DEFINE_STRUCT_CLK(sr2_fck, cpefuse_fck_parent_names, aes2_ick_ops); 2733 - 2734 - static struct clk sr_l4_ick; 2735 - 2736 - DEFINE_STRUCT_CLK_HW_OMAP(sr_l4_ick, "core_l4_clkdm"); 2737 - DEFINE_STRUCT_CLK(sr_l4_ick, security_l4_ick2_parent_names, core_l4_ick_ops); 2738 - 2739 - static struct clk ssi_l4_ick; 2740 - 2741 - DEFINE_STRUCT_CLK_HW_OMAP(ssi_l4_ick, "core_l4_clkdm"); 2742 - DEFINE_STRUCT_CLK(ssi_l4_ick, security_l4_ick2_parent_names, core_l4_ick_ops); 2743 - 2744 - static struct clk ssi_ick_3430es1; 2745 - 2746 - static const char *ssi_ick_3430es1_parent_names[] = { 2747 - "ssi_l4_ick", 2748 - }; 2749 - 2750 - static struct clk_hw_omap ssi_ick_3430es1_hw = { 2751 - .hw = { 2752 - .clk = &ssi_ick_3430es1, 2753 - }, 2754 - .ops = &clkhwops_iclk, 2755 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2756 - .enable_bit = OMAP3430_EN_SSI_SHIFT, 2757 - .clkdm_name = "core_l4_clkdm", 2758 - }; 2759 - 2760 - DEFINE_STRUCT_CLK(ssi_ick_3430es1, ssi_ick_3430es1_parent_names, aes2_ick_ops); 2761 - 2762 - static struct clk ssi_ick_3430es2; 2763 - 2764 - static struct clk_hw_omap ssi_ick_3430es2_hw = { 2765 - .hw = { 2766 - .clk = &ssi_ick_3430es2, 2767 - }, 2768 - .ops = &clkhwops_omap3430es2_iclk_ssi_wait, 2769 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2770 - .enable_bit = OMAP3430_EN_SSI_SHIFT, 2771 - .clkdm_name = "core_l4_clkdm", 2772 - }; 2773 - 2774 - DEFINE_STRUCT_CLK(ssi_ick_3430es2, ssi_ick_3430es1_parent_names, aes2_ick_ops); 2775 - 2776 - static const struct clksel_rate ssi_ssr_corex2_rates[] = { 2777 - { .div = 1, .val = 1, .flags = RATE_IN_3XXX }, 2778 - { .div = 2, .val = 2, .flags = RATE_IN_3XXX }, 2779 - { .div = 3, .val = 3, .flags = RATE_IN_3XXX }, 2780 - { .div = 4, .val = 4, .flags = RATE_IN_3XXX }, 2781 - { .div = 6, .val = 6, .flags = RATE_IN_3XXX }, 2782 - { .div = 8, .val = 8, .flags = RATE_IN_3XXX }, 2783 - { .div = 0 } 2784 - }; 2785 - 2786 - static const struct clksel ssi_ssr_clksel[] = { 2787 - { .parent = &corex2_fck, .rates = ssi_ssr_corex2_rates }, 2788 - { .parent = NULL }, 2789 - }; 2790 - 2791 - static const char *ssi_ssr_fck_3430es1_parent_names[] = { 2792 - "corex2_fck", 2793 - }; 2794 - 2795 - static const struct clk_ops ssi_ssr_fck_3430es1_ops = { 2796 - .init = &omap2_init_clk_clkdm, 2797 - .enable = &omap2_dflt_clk_enable, 2798 - .disable = &omap2_dflt_clk_disable, 2799 - .is_enabled = &omap2_dflt_clk_is_enabled, 2800 - .recalc_rate = &omap2_clksel_recalc, 2801 - .set_rate = &omap2_clksel_set_rate, 2802 - .round_rate = &omap2_clksel_round_rate, 2803 - }; 2804 - 2805 - DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_fck_3430es1, "core_l4_clkdm", 2806 - ssi_ssr_clksel, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL), 2807 - OMAP3430_CLKSEL_SSI_MASK, 2808 - OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 2809 - OMAP3430_EN_SSI_SHIFT, 2810 - NULL, ssi_ssr_fck_3430es1_parent_names, 2811 - ssi_ssr_fck_3430es1_ops); 2812 - 2813 - DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_fck_3430es2, "core_l4_clkdm", 2814 - ssi_ssr_clksel, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL), 2815 - OMAP3430_CLKSEL_SSI_MASK, 2816 - OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 2817 - OMAP3430_EN_SSI_SHIFT, 2818 - NULL, ssi_ssr_fck_3430es1_parent_names, 2819 - ssi_ssr_fck_3430es1_ops); 2820 - 2821 - DEFINE_CLK_FIXED_FACTOR(ssi_sst_fck_3430es1, "ssi_ssr_fck_3430es1", 2822 - &ssi_ssr_fck_3430es1, 0x0, 1, 2); 2823 - 2824 - DEFINE_CLK_FIXED_FACTOR(ssi_sst_fck_3430es2, "ssi_ssr_fck_3430es2", 2825 - &ssi_ssr_fck_3430es2, 0x0, 1, 2); 2826 - 2827 - static struct clk sys_clkout1; 2828 - 2829 - static const char *sys_clkout1_parent_names[] = { 2830 - "osc_sys_ck", 2831 - }; 2832 - 2833 - static struct clk_hw_omap sys_clkout1_hw = { 2834 - .hw = { 2835 - .clk = &sys_clkout1, 2836 - }, 2837 - .enable_reg = OMAP3430_PRM_CLKOUT_CTRL, 2838 - .enable_bit = OMAP3430_CLKOUT_EN_SHIFT, 2839 - }; 2840 - 2841 - DEFINE_STRUCT_CLK(sys_clkout1, sys_clkout1_parent_names, aes1_ick_ops); 2842 - 2843 - DEFINE_CLK_DIVIDER(sys_clkout2, "clkout2_src_ck", &clkout2_src_ck, 0x0, 2844 - OMAP3430_CM_CLKOUT_CTRL, OMAP3430_CLKOUT2_DIV_SHIFT, 2845 - OMAP3430_CLKOUT2_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL); 2846 - 2847 - DEFINE_CLK_MUX(traceclk_src_fck, emu_src_ck_parent_names, NULL, 0x0, 2848 - OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), 2849 - OMAP3430_TRACE_MUX_CTRL_SHIFT, OMAP3430_TRACE_MUX_CTRL_WIDTH, 2850 - 0x0, NULL); 2851 - 2852 - DEFINE_CLK_DIVIDER(traceclk_fck, "traceclk_src_fck", &traceclk_src_fck, 0x0, 2853 - OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), 2854 - OMAP3430_CLKSEL_TRACECLK_SHIFT, 2855 - OMAP3430_CLKSEL_TRACECLK_WIDTH, CLK_DIVIDER_ONE_BASED, NULL); 2856 - 2857 - static struct clk ts_fck; 2858 - 2859 - static struct clk_hw_omap ts_fck_hw = { 2860 - .hw = { 2861 - .clk = &ts_fck, 2862 - }, 2863 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3), 2864 - .enable_bit = OMAP3430ES2_EN_TS_SHIFT, 2865 - .clkdm_name = "core_l4_clkdm", 2866 - }; 2867 - 2868 - DEFINE_STRUCT_CLK(ts_fck, wkup_32k_fck_parent_names, aes2_ick_ops); 2869 - 2870 - static struct clk uart1_fck; 2871 - 2872 - static struct clk_hw_omap uart1_fck_hw = { 2873 - .hw = { 2874 - .clk = &uart1_fck, 2875 - }, 2876 - .ops = &clkhwops_wait, 2877 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 2878 - .enable_bit = OMAP3430_EN_UART1_SHIFT, 2879 - .clkdm_name = "core_l4_clkdm", 2880 - }; 2881 - 2882 - DEFINE_STRUCT_CLK(uart1_fck, fshostusb_fck_parent_names, aes2_ick_ops); 2883 - 2884 - static struct clk uart1_ick; 2885 - 2886 - static struct clk_hw_omap uart1_ick_hw = { 2887 - .hw = { 2888 - .clk = &uart1_ick, 2889 - }, 2890 - .ops = &clkhwops_iclk_wait, 2891 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2892 - .enable_bit = OMAP3430_EN_UART1_SHIFT, 2893 - .clkdm_name = "core_l4_clkdm", 2894 - }; 2895 - 2896 - DEFINE_STRUCT_CLK(uart1_ick, aes2_ick_parent_names, aes2_ick_ops); 2897 - 2898 - static struct clk uart2_fck; 2899 - 2900 - static struct clk_hw_omap uart2_fck_hw = { 2901 - .hw = { 2902 - .clk = &uart2_fck, 2903 - }, 2904 - .ops = &clkhwops_wait, 2905 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 2906 - .enable_bit = OMAP3430_EN_UART2_SHIFT, 2907 - .clkdm_name = "core_l4_clkdm", 2908 - }; 2909 - 2910 - DEFINE_STRUCT_CLK(uart2_fck, fshostusb_fck_parent_names, aes2_ick_ops); 2911 - 2912 - static struct clk uart2_ick; 2913 - 2914 - static struct clk_hw_omap uart2_ick_hw = { 2915 - .hw = { 2916 - .clk = &uart2_ick, 2917 - }, 2918 - .ops = &clkhwops_iclk_wait, 2919 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2920 - .enable_bit = OMAP3430_EN_UART2_SHIFT, 2921 - .clkdm_name = "core_l4_clkdm", 2922 - }; 2923 - 2924 - DEFINE_STRUCT_CLK(uart2_ick, aes2_ick_parent_names, aes2_ick_ops); 2925 - 2926 - static struct clk uart3_fck; 2927 - 2928 - static const char *uart3_fck_parent_names[] = { 2929 - "per_48m_fck", 2930 - }; 2931 - 2932 - static struct clk_hw_omap uart3_fck_hw = { 2933 - .hw = { 2934 - .clk = &uart3_fck, 2935 - }, 2936 - .ops = &clkhwops_wait, 2937 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2938 - .enable_bit = OMAP3430_EN_UART3_SHIFT, 2939 - .clkdm_name = "per_clkdm", 2940 - }; 2941 - 2942 - DEFINE_STRUCT_CLK(uart3_fck, uart3_fck_parent_names, aes2_ick_ops); 2943 - 2944 - static struct clk uart3_ick; 2945 - 2946 - static struct clk_hw_omap uart3_ick_hw = { 2947 - .hw = { 2948 - .clk = &uart3_ick, 2949 - }, 2950 - .ops = &clkhwops_iclk_wait, 2951 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2952 - .enable_bit = OMAP3430_EN_UART3_SHIFT, 2953 - .clkdm_name = "per_clkdm", 2954 - }; 2955 - 2956 - DEFINE_STRUCT_CLK(uart3_ick, gpio2_ick_parent_names, aes2_ick_ops); 2957 - 2958 - static struct clk uart4_fck; 2959 - 2960 - static struct clk_hw_omap uart4_fck_hw = { 2961 - .hw = { 2962 - .clk = &uart4_fck, 2963 - }, 2964 - .ops = &clkhwops_wait, 2965 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 2966 - .enable_bit = OMAP3630_EN_UART4_SHIFT, 2967 - .clkdm_name = "per_clkdm", 2968 - }; 2969 - 2970 - DEFINE_STRUCT_CLK(uart4_fck, uart3_fck_parent_names, aes2_ick_ops); 2971 - 2972 - static struct clk uart4_fck_am35xx; 2973 - 2974 - static struct clk_hw_omap uart4_fck_am35xx_hw = { 2975 - .hw = { 2976 - .clk = &uart4_fck_am35xx, 2977 - }, 2978 - .ops = &clkhwops_wait, 2979 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 2980 - .enable_bit = AM35XX_EN_UART4_SHIFT, 2981 - .clkdm_name = "core_l4_clkdm", 2982 - }; 2983 - 2984 - DEFINE_STRUCT_CLK(uart4_fck_am35xx, fshostusb_fck_parent_names, aes2_ick_ops); 2985 - 2986 - static struct clk uart4_ick; 2987 - 2988 - static struct clk_hw_omap uart4_ick_hw = { 2989 - .hw = { 2990 - .clk = &uart4_ick, 2991 - }, 2992 - .ops = &clkhwops_iclk_wait, 2993 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2994 - .enable_bit = OMAP3630_EN_UART4_SHIFT, 2995 - .clkdm_name = "per_clkdm", 2996 - }; 2997 - 2998 - DEFINE_STRUCT_CLK(uart4_ick, gpio2_ick_parent_names, aes2_ick_ops); 2999 - 3000 - static struct clk uart4_ick_am35xx; 3001 - 3002 - static struct clk_hw_omap uart4_ick_am35xx_hw = { 3003 - .hw = { 3004 - .clk = &uart4_ick_am35xx, 3005 - }, 3006 - .ops = &clkhwops_iclk_wait, 3007 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 3008 - .enable_bit = AM35XX_EN_UART4_SHIFT, 3009 - .clkdm_name = "core_l4_clkdm", 3010 - }; 3011 - 3012 - DEFINE_STRUCT_CLK(uart4_ick_am35xx, aes2_ick_parent_names, aes2_ick_ops); 3013 - 3014 - static const struct clksel_rate div2_rates[] = { 3015 - { .div = 1, .val = 1, .flags = RATE_IN_3XXX }, 3016 - { .div = 2, .val = 2, .flags = RATE_IN_3XXX }, 3017 - { .div = 0 } 3018 - }; 3019 - 3020 - static const struct clksel usb_l4_clksel[] = { 3021 - { .parent = &l4_ick, .rates = div2_rates }, 3022 - { .parent = NULL }, 3023 - }; 3024 - 3025 - static const char *usb_l4_ick_parent_names[] = { 3026 - "l4_ick", 3027 - }; 3028 - 3029 - DEFINE_CLK_OMAP_MUX_GATE(usb_l4_ick, "core_l4_clkdm", usb_l4_clksel, 3030 - OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL), 3031 - OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK, 3032 - OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 3033 - OMAP3430ES1_EN_FSHOSTUSB_SHIFT, 3034 - &clkhwops_iclk_wait, usb_l4_ick_parent_names, 3035 - ssi_ssr_fck_3430es1_ops); 3036 - 3037 - static struct clk usbhost_120m_fck; 3038 - 3039 - static const char *usbhost_120m_fck_parent_names[] = { 3040 - "dpll5_m2_ck", 3041 - }; 3042 - 3043 - static struct clk_hw_omap usbhost_120m_fck_hw = { 3044 - .hw = { 3045 - .clk = &usbhost_120m_fck, 3046 - }, 3047 - .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN), 3048 - .enable_bit = OMAP3430ES2_EN_USBHOST2_SHIFT, 3049 - .clkdm_name = "usbhost_clkdm", 3050 - }; 3051 - 3052 - DEFINE_STRUCT_CLK(usbhost_120m_fck, usbhost_120m_fck_parent_names, 3053 - aes2_ick_ops); 3054 - 3055 - static struct clk usbhost_48m_fck; 3056 - 3057 - static struct clk_hw_omap usbhost_48m_fck_hw = { 3058 - .hw = { 3059 - .clk = &usbhost_48m_fck, 3060 - }, 3061 - .ops = &clkhwops_omap3430es2_dss_usbhost_wait, 3062 - .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN), 3063 - .enable_bit = OMAP3430ES2_EN_USBHOST1_SHIFT, 3064 - .clkdm_name = "usbhost_clkdm", 3065 - }; 3066 - 3067 - DEFINE_STRUCT_CLK(usbhost_48m_fck, core_48m_fck_parent_names, aes2_ick_ops); 3068 - 3069 - static struct clk usbhost_ick; 3070 - 3071 - static struct clk_hw_omap usbhost_ick_hw = { 3072 - .hw = { 3073 - .clk = &usbhost_ick, 3074 - }, 3075 - .ops = &clkhwops_omap3430es2_iclk_dss_usbhost_wait, 3076 - .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_ICLKEN), 3077 - .enable_bit = OMAP3430ES2_EN_USBHOST_SHIFT, 3078 - .clkdm_name = "usbhost_clkdm", 3079 - }; 3080 - 3081 - DEFINE_STRUCT_CLK(usbhost_ick, security_l4_ick2_parent_names, aes2_ick_ops); 3082 - 3083 - static struct clk usbtll_fck; 3084 - 3085 - static struct clk_hw_omap usbtll_fck_hw = { 3086 - .hw = { 3087 - .clk = &usbtll_fck, 3088 - }, 3089 - .ops = &clkhwops_wait, 3090 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3), 3091 - .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT, 3092 - .clkdm_name = "core_l4_clkdm", 3093 - }; 3094 - 3095 - DEFINE_STRUCT_CLK(usbtll_fck, usbhost_120m_fck_parent_names, aes2_ick_ops); 3096 - 3097 - static struct clk usbtll_ick; 3098 - 3099 - static struct clk_hw_omap usbtll_ick_hw = { 3100 - .hw = { 3101 - .clk = &usbtll_ick, 3102 - }, 3103 - .ops = &clkhwops_iclk_wait, 3104 - .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3), 3105 - .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT, 3106 - .clkdm_name = "core_l4_clkdm", 3107 - }; 3108 - 3109 - DEFINE_STRUCT_CLK(usbtll_ick, aes2_ick_parent_names, aes2_ick_ops); 3110 - 3111 - static const struct clksel_rate usim_96m_rates[] = { 3112 - { .div = 2, .val = 3, .flags = RATE_IN_3XXX }, 3113 - { .div = 4, .val = 4, .flags = RATE_IN_3XXX }, 3114 - { .div = 8, .val = 5, .flags = RATE_IN_3XXX }, 3115 - { .div = 10, .val = 6, .flags = RATE_IN_3XXX }, 3116 - { .div = 0 } 3117 - }; 3118 - 3119 - static const struct clksel_rate usim_120m_rates[] = { 3120 - { .div = 4, .val = 7, .flags = RATE_IN_3XXX }, 3121 - { .div = 8, .val = 8, .flags = RATE_IN_3XXX }, 3122 - { .div = 16, .val = 9, .flags = RATE_IN_3XXX }, 3123 - { .div = 20, .val = 10, .flags = RATE_IN_3XXX }, 3124 - { .div = 0 } 3125 - }; 3126 - 3127 - static const struct clksel usim_clksel[] = { 3128 - { .parent = &omap_96m_fck, .rates = usim_96m_rates }, 3129 - { .parent = &dpll5_m2_ck, .rates = usim_120m_rates }, 3130 - { .parent = &sys_ck, .rates = div2_rates }, 3131 - { .parent = NULL }, 3132 - }; 3133 - 3134 - static const char *usim_fck_parent_names[] = { 3135 - "omap_96m_fck", "dpll5_m2_ck", "sys_ck", 3136 - }; 3137 - 3138 - static struct clk usim_fck; 3139 - 3140 - static const struct clk_ops usim_fck_ops = { 3141 - .enable = &omap2_dflt_clk_enable, 3142 - .disable = &omap2_dflt_clk_disable, 3143 - .is_enabled = &omap2_dflt_clk_is_enabled, 3144 - .recalc_rate = &omap2_clksel_recalc, 3145 - .get_parent = &omap2_clksel_find_parent_index, 3146 - .set_parent = &omap2_clksel_set_parent, 3147 - }; 3148 - 3149 - DEFINE_CLK_OMAP_MUX_GATE(usim_fck, NULL, usim_clksel, 3150 - OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL), 3151 - OMAP3430ES2_CLKSEL_USIMOCP_MASK, 3152 - OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), 3153 - OMAP3430ES2_EN_USIMOCP_SHIFT, &clkhwops_wait, 3154 - usim_fck_parent_names, usim_fck_ops); 3155 - 3156 - static struct clk usim_ick; 3157 - 3158 - static struct clk_hw_omap usim_ick_hw = { 3159 - .hw = { 3160 - .clk = &usim_ick, 3161 - }, 3162 - .ops = &clkhwops_iclk_wait, 3163 - .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 3164 - .enable_bit = OMAP3430ES2_EN_USIMOCP_SHIFT, 3165 - .clkdm_name = "wkup_clkdm", 3166 - }; 3167 - 3168 - DEFINE_STRUCT_CLK(usim_ick, gpio1_ick_parent_names, aes2_ick_ops); 3169 - 3170 - static struct clk vpfe_fck; 3171 - 3172 - static const char *vpfe_fck_parent_names[] = { 3173 - "pclk_ck", 3174 - }; 3175 - 3176 - static struct clk_hw_omap vpfe_fck_hw = { 3177 - .hw = { 3178 - .clk = &vpfe_fck, 3179 - }, 3180 - .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL), 3181 - .enable_bit = AM35XX_VPFE_FCLK_SHIFT, 3182 - }; 3183 - 3184 - DEFINE_STRUCT_CLK(vpfe_fck, vpfe_fck_parent_names, aes1_ick_ops); 3185 - 3186 - static struct clk vpfe_ick; 3187 - 3188 - static struct clk_hw_omap vpfe_ick_hw = { 3189 - .hw = { 3190 - .clk = &vpfe_ick, 3191 - }, 3192 - .ops = &clkhwops_am35xx_ipss_module_wait, 3193 - .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL), 3194 - .enable_bit = AM35XX_VPFE_VBUSP_CLK_SHIFT, 3195 - .clkdm_name = "core_l3_clkdm", 3196 - }; 3197 - 3198 - DEFINE_STRUCT_CLK(vpfe_ick, emac_ick_parent_names, aes2_ick_ops); 3199 - 3200 - static struct clk wdt1_fck; 3201 - 3202 - DEFINE_STRUCT_CLK_HW_OMAP(wdt1_fck, "wkup_clkdm"); 3203 - DEFINE_STRUCT_CLK(wdt1_fck, gpt12_fck_parent_names, core_l4_ick_ops); 3204 - 3205 - static struct clk wdt1_ick; 3206 - 3207 - static struct clk_hw_omap wdt1_ick_hw = { 3208 - .hw = { 3209 - .clk = &wdt1_ick, 3210 - }, 3211 - .ops = &clkhwops_iclk_wait, 3212 - .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 3213 - .enable_bit = OMAP3430_EN_WDT1_SHIFT, 3214 - .clkdm_name = "wkup_clkdm", 3215 - }; 3216 - 3217 - DEFINE_STRUCT_CLK(wdt1_ick, gpio1_ick_parent_names, aes2_ick_ops); 3218 - 3219 - static struct clk wdt2_fck; 3220 - 3221 - static struct clk_hw_omap wdt2_fck_hw = { 3222 - .hw = { 3223 - .clk = &wdt2_fck, 3224 - }, 3225 - .ops = &clkhwops_wait, 3226 - .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), 3227 - .enable_bit = OMAP3430_EN_WDT2_SHIFT, 3228 - .clkdm_name = "wkup_clkdm", 3229 - }; 3230 - 3231 - DEFINE_STRUCT_CLK(wdt2_fck, gpio1_dbck_parent_names, aes2_ick_ops); 3232 - 3233 - static struct clk wdt2_ick; 3234 - 3235 - static struct clk_hw_omap wdt2_ick_hw = { 3236 - .hw = { 3237 - .clk = &wdt2_ick, 3238 - }, 3239 - .ops = &clkhwops_iclk_wait, 3240 - .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 3241 - .enable_bit = OMAP3430_EN_WDT2_SHIFT, 3242 - .clkdm_name = "wkup_clkdm", 3243 - }; 3244 - 3245 - DEFINE_STRUCT_CLK(wdt2_ick, gpio1_ick_parent_names, aes2_ick_ops); 3246 - 3247 - static struct clk wdt3_fck; 3248 - 3249 - static struct clk_hw_omap wdt3_fck_hw = { 3250 - .hw = { 3251 - .clk = &wdt3_fck, 3252 - }, 3253 - .ops = &clkhwops_wait, 3254 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN), 3255 - .enable_bit = OMAP3430_EN_WDT3_SHIFT, 3256 - .clkdm_name = "per_clkdm", 3257 - }; 3258 - 3259 - DEFINE_STRUCT_CLK(wdt3_fck, gpio2_dbck_parent_names, aes2_ick_ops); 3260 - 3261 - static struct clk wdt3_ick; 3262 - 3263 - static struct clk_hw_omap wdt3_ick_hw = { 3264 - .hw = { 3265 - .clk = &wdt3_ick, 3266 - }, 3267 - .ops = &clkhwops_iclk_wait, 3268 - .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 3269 - .enable_bit = OMAP3430_EN_WDT3_SHIFT, 3270 - .clkdm_name = "per_clkdm", 3271 - }; 3272 - 3273 - DEFINE_STRUCT_CLK(wdt3_ick, gpio2_ick_parent_names, aes2_ick_ops); 3274 - 3275 - /* 3276 - * clocks specific to omap3430es1 3277 - */ 3278 - static struct omap_clk omap3430es1_clks[] = { 3279 - CLK(NULL, "gfx_l3_ck", &gfx_l3_ck), 3280 - CLK(NULL, "gfx_l3_fck", &gfx_l3_fck), 3281 - CLK(NULL, "gfx_l3_ick", &gfx_l3_ick), 3282 - CLK(NULL, "gfx_cg1_ck", &gfx_cg1_ck), 3283 - CLK(NULL, "gfx_cg2_ck", &gfx_cg2_ck), 3284 - CLK(NULL, "d2d_26m_fck", &d2d_26m_fck), 3285 - CLK(NULL, "fshostusb_fck", &fshostusb_fck), 3286 - CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es1), 3287 - CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es1), 3288 - CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es1), 3289 - CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es1), 3290 - CLK(NULL, "fac_ick", &fac_ick), 3291 - CLK(NULL, "ssi_ick", &ssi_ick_3430es1), 3292 - CLK(NULL, "usb_l4_ick", &usb_l4_ick), 3293 - CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es1), 3294 - CLK("omapdss_dss", "ick", &dss_ick_3430es1), 3295 - CLK(NULL, "dss_ick", &dss_ick_3430es1), 3296 - }; 3297 - 3298 - /* 3299 - * clocks specific to am35xx 3300 - */ 3301 - static struct omap_clk am35xx_clks[] = { 3302 - CLK(NULL, "ipss_ick", &ipss_ick), 3303 - CLK(NULL, "rmii_ck", &rmii_ck), 3304 - CLK(NULL, "pclk_ck", &pclk_ck), 3305 - CLK(NULL, "emac_ick", &emac_ick), 3306 - CLK(NULL, "emac_fck", &emac_fck), 3307 - CLK("davinci_emac.0", NULL, &emac_ick), 3308 - CLK("davinci_mdio.0", NULL, &emac_fck), 3309 - CLK("vpfe-capture", "master", &vpfe_ick), 3310 - CLK("vpfe-capture", "slave", &vpfe_fck), 3311 - CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_am35xx), 3312 - CLK(NULL, "hsotgusb_fck", &hsotgusb_fck_am35xx), 3313 - CLK(NULL, "hecc_ck", &hecc_ck), 3314 - CLK(NULL, "uart4_ick", &uart4_ick_am35xx), 3315 - CLK(NULL, "uart4_fck", &uart4_fck_am35xx), 3316 - }; 3317 - 3318 - /* 3319 - * clocks specific to omap36xx 3320 - */ 3321 - static struct omap_clk omap36xx_clks[] = { 3322 - CLK(NULL, "omap_192m_alwon_fck", &omap_192m_alwon_fck), 3323 - CLK(NULL, "uart4_fck", &uart4_fck), 3324 - }; 3325 - 3326 - /* 3327 - * clocks common to omap36xx omap34xx 3328 - */ 3329 - static struct omap_clk omap34xx_omap36xx_clks[] = { 3330 - CLK(NULL, "aes1_ick", &aes1_ick), 3331 - CLK("omap_rng", "ick", &rng_ick), 3332 - CLK("omap3-rom-rng", "ick", &rng_ick), 3333 - CLK(NULL, "sha11_ick", &sha11_ick), 3334 - CLK(NULL, "des1_ick", &des1_ick), 3335 - CLK(NULL, "cam_mclk", &cam_mclk), 3336 - CLK(NULL, "cam_ick", &cam_ick), 3337 - CLK(NULL, "csi2_96m_fck", &csi2_96m_fck), 3338 - CLK(NULL, "security_l3_ick", &security_l3_ick), 3339 - CLK(NULL, "pka_ick", &pka_ick), 3340 - CLK(NULL, "icr_ick", &icr_ick), 3341 - CLK("omap-aes", "ick", &aes2_ick), 3342 - CLK("omap-sham", "ick", &sha12_ick), 3343 - CLK(NULL, "des2_ick", &des2_ick), 3344 - CLK(NULL, "mspro_ick", &mspro_ick), 3345 - CLK(NULL, "mailboxes_ick", &mailboxes_ick), 3346 - CLK(NULL, "ssi_l4_ick", &ssi_l4_ick), 3347 - CLK(NULL, "sr1_fck", &sr1_fck), 3348 - CLK(NULL, "sr2_fck", &sr2_fck), 3349 - CLK(NULL, "sr_l4_ick", &sr_l4_ick), 3350 - CLK(NULL, "security_l4_ick2", &security_l4_ick2), 3351 - CLK(NULL, "wkup_l4_ick", &wkup_l4_ick), 3352 - CLK(NULL, "dpll2_fck", &dpll2_fck), 3353 - CLK(NULL, "iva2_ck", &iva2_ck), 3354 - CLK(NULL, "modem_fck", &modem_fck), 3355 - CLK(NULL, "sad2d_ick", &sad2d_ick), 3356 - CLK(NULL, "mad2d_ick", &mad2d_ick), 3357 - CLK(NULL, "mspro_fck", &mspro_fck), 3358 - CLK(NULL, "dpll2_ck", &dpll2_ck), 3359 - CLK(NULL, "dpll2_m2_ck", &dpll2_m2_ck), 3360 - }; 3361 - 3362 - /* 3363 - * clocks common to omap36xx and omap3430es2plus 3364 - */ 3365 - static struct omap_clk omap36xx_omap3430es2plus_clks[] = { 3366 - CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es2), 3367 - CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es2), 3368 - CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es2), 3369 - CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es2), 3370 - CLK(NULL, "ssi_ick", &ssi_ick_3430es2), 3371 - CLK(NULL, "usim_fck", &usim_fck), 3372 - CLK(NULL, "usim_ick", &usim_ick), 3373 - }; 3374 - 3375 - /* 3376 - * clocks common to am35xx omap36xx and omap3430es2plus 3377 - */ 3378 - static struct omap_clk omap36xx_am35xx_omap3430es2plus_clks[] = { 3379 - CLK(NULL, "virt_16_8m_ck", &virt_16_8m_ck), 3380 - CLK(NULL, "dpll5_ck", &dpll5_ck), 3381 - CLK(NULL, "dpll5_m2_ck", &dpll5_m2_ck), 3382 - CLK(NULL, "sgx_fck", &sgx_fck), 3383 - CLK(NULL, "sgx_ick", &sgx_ick), 3384 - CLK(NULL, "cpefuse_fck", &cpefuse_fck), 3385 - CLK(NULL, "ts_fck", &ts_fck), 3386 - CLK(NULL, "usbtll_fck", &usbtll_fck), 3387 - CLK(NULL, "usbtll_ick", &usbtll_ick), 3388 - CLK("omap_hsmmc.2", "ick", &mmchs3_ick), 3389 - CLK(NULL, "mmchs3_ick", &mmchs3_ick), 3390 - CLK(NULL, "mmchs3_fck", &mmchs3_fck), 3391 - CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es2), 3392 - CLK("omapdss_dss", "ick", &dss_ick_3430es2), 3393 - CLK(NULL, "dss_ick", &dss_ick_3430es2), 3394 - CLK(NULL, "usbhost_120m_fck", &usbhost_120m_fck), 3395 - CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck), 3396 - CLK(NULL, "usbhost_ick", &usbhost_ick), 3397 - }; 3398 - 3399 - /* 3400 - * common clocks 3401 - */ 3402 - static struct omap_clk omap3xxx_clks[] = { 3403 - CLK(NULL, "apb_pclk", &dummy_apb_pclk), 3404 - CLK(NULL, "omap_32k_fck", &omap_32k_fck), 3405 - CLK(NULL, "virt_12m_ck", &virt_12m_ck), 3406 - CLK(NULL, "virt_13m_ck", &virt_13m_ck), 3407 - CLK(NULL, "virt_19200000_ck", &virt_19200000_ck), 3408 - CLK(NULL, "virt_26000000_ck", &virt_26000000_ck), 3409 - CLK(NULL, "virt_38_4m_ck", &virt_38_4m_ck), 3410 - CLK(NULL, "osc_sys_ck", &osc_sys_ck), 3411 - CLK("twl", "fck", &osc_sys_ck), 3412 - CLK(NULL, "sys_ck", &sys_ck), 3413 - CLK(NULL, "omap_96m_alwon_fck", &omap_96m_alwon_fck), 3414 - CLK("etb", "emu_core_alwon_ck", &emu_core_alwon_ck), 3415 - CLK(NULL, "sys_altclk", &sys_altclk), 3416 - CLK(NULL, "mcbsp_clks", &mcbsp_clks), 3417 - CLK(NULL, "sys_clkout1", &sys_clkout1), 3418 - CLK(NULL, "dpll1_ck", &dpll1_ck), 3419 - CLK(NULL, "dpll1_x2_ck", &dpll1_x2_ck), 3420 - CLK(NULL, "dpll1_x2m2_ck", &dpll1_x2m2_ck), 3421 - CLK(NULL, "dpll3_ck", &dpll3_ck), 3422 - CLK(NULL, "core_ck", &core_ck), 3423 - CLK(NULL, "dpll3_x2_ck", &dpll3_x2_ck), 3424 - CLK(NULL, "dpll3_m2_ck", &dpll3_m2_ck), 3425 - CLK(NULL, "dpll3_m2x2_ck", &dpll3_m2x2_ck), 3426 - CLK(NULL, "dpll3_m3_ck", &dpll3_m3_ck), 3427 - CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck), 3428 - CLK(NULL, "dpll4_ck", &dpll4_ck), 3429 - CLK(NULL, "dpll4_x2_ck", &dpll4_x2_ck), 3430 - CLK(NULL, "omap_96m_fck", &omap_96m_fck), 3431 - CLK(NULL, "cm_96m_fck", &cm_96m_fck), 3432 - CLK(NULL, "omap_54m_fck", &omap_54m_fck), 3433 - CLK(NULL, "omap_48m_fck", &omap_48m_fck), 3434 - CLK(NULL, "omap_12m_fck", &omap_12m_fck), 3435 - CLK(NULL, "dpll4_m2_ck", &dpll4_m2_ck), 3436 - CLK(NULL, "dpll4_m2x2_ck", &dpll4_m2x2_ck), 3437 - CLK(NULL, "dpll4_m3_ck", &dpll4_m3_ck), 3438 - CLK(NULL, "dpll4_m3x2_ck", &dpll4_m3x2_ck), 3439 - CLK(NULL, "dpll4_m4_ck", &dpll4_m4_ck), 3440 - CLK(NULL, "dpll4_m4x2_ck", &dpll4_m4x2_ck), 3441 - CLK(NULL, "dpll4_m5_ck", &dpll4_m5_ck), 3442 - CLK(NULL, "dpll4_m5x2_ck", &dpll4_m5x2_ck), 3443 - CLK(NULL, "dpll4_m6_ck", &dpll4_m6_ck), 3444 - CLK(NULL, "dpll4_m6x2_ck", &dpll4_m6x2_ck), 3445 - CLK("etb", "emu_per_alwon_ck", &emu_per_alwon_ck), 3446 - CLK(NULL, "clkout2_src_ck", &clkout2_src_ck), 3447 - CLK(NULL, "sys_clkout2", &sys_clkout2), 3448 - CLK(NULL, "corex2_fck", &corex2_fck), 3449 - CLK(NULL, "dpll1_fck", &dpll1_fck), 3450 - CLK(NULL, "mpu_ck", &mpu_ck), 3451 - CLK(NULL, "arm_fck", &arm_fck), 3452 - CLK("etb", "emu_mpu_alwon_ck", &emu_mpu_alwon_ck), 3453 - CLK(NULL, "l3_ick", &l3_ick), 3454 - CLK(NULL, "l4_ick", &l4_ick), 3455 - CLK(NULL, "rm_ick", &rm_ick), 3456 - CLK(NULL, "gpt10_fck", &gpt10_fck), 3457 - CLK(NULL, "gpt11_fck", &gpt11_fck), 3458 - CLK(NULL, "core_96m_fck", &core_96m_fck), 3459 - CLK(NULL, "mmchs2_fck", &mmchs2_fck), 3460 - CLK(NULL, "mmchs1_fck", &mmchs1_fck), 3461 - CLK(NULL, "i2c3_fck", &i2c3_fck), 3462 - CLK(NULL, "i2c2_fck", &i2c2_fck), 3463 - CLK(NULL, "i2c1_fck", &i2c1_fck), 3464 - CLK(NULL, "mcbsp5_fck", &mcbsp5_fck), 3465 - CLK(NULL, "mcbsp1_fck", &mcbsp1_fck), 3466 - CLK(NULL, "core_48m_fck", &core_48m_fck), 3467 - CLK(NULL, "mcspi4_fck", &mcspi4_fck), 3468 - CLK(NULL, "mcspi3_fck", &mcspi3_fck), 3469 - CLK(NULL, "mcspi2_fck", &mcspi2_fck), 3470 - CLK(NULL, "mcspi1_fck", &mcspi1_fck), 3471 - CLK(NULL, "uart2_fck", &uart2_fck), 3472 - CLK(NULL, "uart1_fck", &uart1_fck), 3473 - CLK(NULL, "core_12m_fck", &core_12m_fck), 3474 - CLK("omap_hdq.0", "fck", &hdq_fck), 3475 - CLK(NULL, "hdq_fck", &hdq_fck), 3476 - CLK(NULL, "core_l3_ick", &core_l3_ick), 3477 - CLK(NULL, "sdrc_ick", &sdrc_ick), 3478 - CLK(NULL, "gpmc_fck", &gpmc_fck), 3479 - CLK(NULL, "core_l4_ick", &core_l4_ick), 3480 - CLK("omap_hsmmc.1", "ick", &mmchs2_ick), 3481 - CLK("omap_hsmmc.0", "ick", &mmchs1_ick), 3482 - CLK(NULL, "mmchs2_ick", &mmchs2_ick), 3483 - CLK(NULL, "mmchs1_ick", &mmchs1_ick), 3484 - CLK("omap_hdq.0", "ick", &hdq_ick), 3485 - CLK(NULL, "hdq_ick", &hdq_ick), 3486 - CLK("omap2_mcspi.4", "ick", &mcspi4_ick), 3487 - CLK("omap2_mcspi.3", "ick", &mcspi3_ick), 3488 - CLK("omap2_mcspi.2", "ick", &mcspi2_ick), 3489 - CLK("omap2_mcspi.1", "ick", &mcspi1_ick), 3490 - CLK(NULL, "mcspi4_ick", &mcspi4_ick), 3491 - CLK(NULL, "mcspi3_ick", &mcspi3_ick), 3492 - CLK(NULL, "mcspi2_ick", &mcspi2_ick), 3493 - CLK(NULL, "mcspi1_ick", &mcspi1_ick), 3494 - CLK("omap_i2c.3", "ick", &i2c3_ick), 3495 - CLK("omap_i2c.2", "ick", &i2c2_ick), 3496 - CLK("omap_i2c.1", "ick", &i2c1_ick), 3497 - CLK(NULL, "i2c3_ick", &i2c3_ick), 3498 - CLK(NULL, "i2c2_ick", &i2c2_ick), 3499 - CLK(NULL, "i2c1_ick", &i2c1_ick), 3500 - CLK(NULL, "uart2_ick", &uart2_ick), 3501 - CLK(NULL, "uart1_ick", &uart1_ick), 3502 - CLK(NULL, "gpt11_ick", &gpt11_ick), 3503 - CLK(NULL, "gpt10_ick", &gpt10_ick), 3504 - CLK("omap-mcbsp.5", "ick", &mcbsp5_ick), 3505 - CLK("omap-mcbsp.1", "ick", &mcbsp1_ick), 3506 - CLK(NULL, "mcbsp5_ick", &mcbsp5_ick), 3507 - CLK(NULL, "mcbsp1_ick", &mcbsp1_ick), 3508 - CLK(NULL, "omapctrl_ick", &omapctrl_ick), 3509 - CLK(NULL, "dss_tv_fck", &dss_tv_fck), 3510 - CLK(NULL, "dss_96m_fck", &dss_96m_fck), 3511 - CLK(NULL, "dss2_alwon_fck", &dss2_alwon_fck), 3512 - CLK(NULL, "init_60m_fclk", &dummy_ck), 3513 - CLK(NULL, "gpt1_fck", &gpt1_fck), 3514 - CLK(NULL, "aes2_ick", &aes2_ick), 3515 - CLK(NULL, "wkup_32k_fck", &wkup_32k_fck), 3516 - CLK(NULL, "gpio1_dbck", &gpio1_dbck), 3517 - CLK(NULL, "sha12_ick", &sha12_ick), 3518 - CLK(NULL, "wdt2_fck", &wdt2_fck), 3519 - CLK("omap_wdt", "ick", &wdt2_ick), 3520 - CLK(NULL, "wdt2_ick", &wdt2_ick), 3521 - CLK(NULL, "wdt1_ick", &wdt1_ick), 3522 - CLK(NULL, "gpio1_ick", &gpio1_ick), 3523 - CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick), 3524 - CLK(NULL, "gpt12_ick", &gpt12_ick), 3525 - CLK(NULL, "gpt1_ick", &gpt1_ick), 3526 - CLK(NULL, "per_96m_fck", &per_96m_fck), 3527 - CLK(NULL, "per_48m_fck", &per_48m_fck), 3528 - CLK(NULL, "uart3_fck", &uart3_fck), 3529 - CLK(NULL, "gpt2_fck", &gpt2_fck), 3530 - CLK(NULL, "gpt3_fck", &gpt3_fck), 3531 - CLK(NULL, "gpt4_fck", &gpt4_fck), 3532 - CLK(NULL, "gpt5_fck", &gpt5_fck), 3533 - CLK(NULL, "gpt6_fck", &gpt6_fck), 3534 - CLK(NULL, "gpt7_fck", &gpt7_fck), 3535 - CLK(NULL, "gpt8_fck", &gpt8_fck), 3536 - CLK(NULL, "gpt9_fck", &gpt9_fck), 3537 - CLK(NULL, "per_32k_alwon_fck", &per_32k_alwon_fck), 3538 - CLK(NULL, "gpio6_dbck", &gpio6_dbck), 3539 - CLK(NULL, "gpio5_dbck", &gpio5_dbck), 3540 - CLK(NULL, "gpio4_dbck", &gpio4_dbck), 3541 - CLK(NULL, "gpio3_dbck", &gpio3_dbck), 3542 - CLK(NULL, "gpio2_dbck", &gpio2_dbck), 3543 - CLK(NULL, "wdt3_fck", &wdt3_fck), 3544 - CLK(NULL, "per_l4_ick", &per_l4_ick), 3545 - CLK(NULL, "gpio6_ick", &gpio6_ick), 3546 - CLK(NULL, "gpio5_ick", &gpio5_ick), 3547 - CLK(NULL, "gpio4_ick", &gpio4_ick), 3548 - CLK(NULL, "gpio3_ick", &gpio3_ick), 3549 - CLK(NULL, "gpio2_ick", &gpio2_ick), 3550 - CLK(NULL, "wdt3_ick", &wdt3_ick), 3551 - CLK(NULL, "uart3_ick", &uart3_ick), 3552 - CLK(NULL, "uart4_ick", &uart4_ick), 3553 - CLK(NULL, "gpt9_ick", &gpt9_ick), 3554 - CLK(NULL, "gpt8_ick", &gpt8_ick), 3555 - CLK(NULL, "gpt7_ick", &gpt7_ick), 3556 - CLK(NULL, "gpt6_ick", &gpt6_ick), 3557 - CLK(NULL, "gpt5_ick", &gpt5_ick), 3558 - CLK(NULL, "gpt4_ick", &gpt4_ick), 3559 - CLK(NULL, "gpt3_ick", &gpt3_ick), 3560 - CLK(NULL, "gpt2_ick", &gpt2_ick), 3561 - CLK("omap-mcbsp.2", "ick", &mcbsp2_ick), 3562 - CLK("omap-mcbsp.3", "ick", &mcbsp3_ick), 3563 - CLK("omap-mcbsp.4", "ick", &mcbsp4_ick), 3564 - CLK(NULL, "mcbsp4_ick", &mcbsp2_ick), 3565 - CLK(NULL, "mcbsp3_ick", &mcbsp3_ick), 3566 - CLK(NULL, "mcbsp2_ick", &mcbsp4_ick), 3567 - CLK(NULL, "mcbsp2_fck", &mcbsp2_fck), 3568 - CLK(NULL, "mcbsp3_fck", &mcbsp3_fck), 3569 - CLK(NULL, "mcbsp4_fck", &mcbsp4_fck), 3570 - CLK("etb", "emu_src_ck", &emu_src_ck), 3571 - CLK(NULL, "emu_src_ck", &emu_src_ck), 3572 - CLK(NULL, "pclk_fck", &pclk_fck), 3573 - CLK(NULL, "pclkx2_fck", &pclkx2_fck), 3574 - CLK(NULL, "atclk_fck", &atclk_fck), 3575 - CLK(NULL, "traceclk_src_fck", &traceclk_src_fck), 3576 - CLK(NULL, "traceclk_fck", &traceclk_fck), 3577 - CLK(NULL, "secure_32k_fck", &secure_32k_fck), 3578 - CLK(NULL, "gpt12_fck", &gpt12_fck), 3579 - CLK(NULL, "wdt1_fck", &wdt1_fck), 3580 - CLK(NULL, "timer_32k_ck", &omap_32k_fck), 3581 - CLK(NULL, "timer_sys_ck", &sys_ck), 3582 - CLK(NULL, "cpufreq_ck", &dpll1_ck), 3583 - }; 3584 - 3585 - static const char *enable_init_clks[] = { 3586 - "sdrc_ick", 3587 - "gpmc_fck", 3588 - "omapctrl_ick", 3589 - }; 3590 - 3591 - int __init omap3xxx_clk_init(void) 3592 - { 3593 - if (omap3_has_192mhz_clk()) 3594 - omap_96m_alwon_fck = omap_96m_alwon_fck_3630; 3595 - 3596 - if (cpu_is_omap3630()) { 3597 - dpll3_m3x2_ck = dpll3_m3x2_ck_3630; 3598 - dpll4_m2x2_ck = dpll4_m2x2_ck_3630; 3599 - dpll4_m3x2_ck = dpll4_m3x2_ck_3630; 3600 - dpll4_m4x2_ck = dpll4_m4x2_ck_3630; 3601 - dpll4_m5x2_ck = dpll4_m5x2_ck_3630; 3602 - dpll4_m6x2_ck = dpll4_m6x2_ck_3630; 3603 - } 3604 - 3605 - /* 3606 - * XXX This type of dynamic rewriting of the clock tree is 3607 - * deprecated and should be revised soon. 3608 - */ 3609 - if (cpu_is_omap3630()) 3610 - dpll4_dd = dpll4_dd_3630; 3611 - else 3612 - dpll4_dd = dpll4_dd_34xx; 3613 - 3614 - 3615 - /* 3616 - * 3505 must be tested before 3517, since 3517 returns true 3617 - * for both AM3517 chips and AM3517 family chips, which 3618 - * includes 3505. Unfortunately there's no obvious family 3619 - * test for 3517/3505 :-( 3620 - */ 3621 - if (soc_is_am35xx()) { 3622 - cpu_mask = RATE_IN_34XX; 3623 - omap_clocks_register(am35xx_clks, ARRAY_SIZE(am35xx_clks)); 3624 - omap_clocks_register(omap36xx_am35xx_omap3430es2plus_clks, 3625 - ARRAY_SIZE(omap36xx_am35xx_omap3430es2plus_clks)); 3626 - omap_clocks_register(omap3xxx_clks, ARRAY_SIZE(omap3xxx_clks)); 3627 - } else if (cpu_is_omap3630()) { 3628 - cpu_mask = (RATE_IN_34XX | RATE_IN_36XX); 3629 - omap_clocks_register(omap36xx_clks, ARRAY_SIZE(omap36xx_clks)); 3630 - omap_clocks_register(omap36xx_omap3430es2plus_clks, 3631 - ARRAY_SIZE(omap36xx_omap3430es2plus_clks)); 3632 - omap_clocks_register(omap34xx_omap36xx_clks, 3633 - ARRAY_SIZE(omap34xx_omap36xx_clks)); 3634 - omap_clocks_register(omap36xx_am35xx_omap3430es2plus_clks, 3635 - ARRAY_SIZE(omap36xx_am35xx_omap3430es2plus_clks)); 3636 - omap_clocks_register(omap3xxx_clks, ARRAY_SIZE(omap3xxx_clks)); 3637 - } else if (cpu_is_omap34xx()) { 3638 - if (omap_rev() == OMAP3430_REV_ES1_0) { 3639 - cpu_mask = RATE_IN_3430ES1; 3640 - omap_clocks_register(omap3430es1_clks, 3641 - ARRAY_SIZE(omap3430es1_clks)); 3642 - omap_clocks_register(omap34xx_omap36xx_clks, 3643 - ARRAY_SIZE(omap34xx_omap36xx_clks)); 3644 - omap_clocks_register(omap3xxx_clks, 3645 - ARRAY_SIZE(omap3xxx_clks)); 3646 - } else { 3647 - /* 3648 - * Assume that anything that we haven't matched yet 3649 - * has 3430ES2-type clocks. 3650 - */ 3651 - cpu_mask = RATE_IN_3430ES2PLUS; 3652 - omap_clocks_register(omap34xx_omap36xx_clks, 3653 - ARRAY_SIZE(omap34xx_omap36xx_clks)); 3654 - omap_clocks_register(omap36xx_omap3430es2plus_clks, 3655 - ARRAY_SIZE(omap36xx_omap3430es2plus_clks)); 3656 - omap_clocks_register(omap36xx_am35xx_omap3430es2plus_clks, 3657 - ARRAY_SIZE(omap36xx_am35xx_omap3430es2plus_clks)); 3658 - omap_clocks_register(omap3xxx_clks, 3659 - ARRAY_SIZE(omap3xxx_clks)); 3660 - } 3661 - } else { 3662 - WARN(1, "clock: could not identify OMAP3 variant\n"); 3663 - } 3664 - 3665 - omap2_clk_disable_autoidle_all(); 3666 - 3667 - omap2_clk_enable_init_clocks(enable_init_clks, 3668 - ARRAY_SIZE(enable_init_clks)); 3669 - 3670 - pr_info("Clocking rate (Crystal/Core/MPU): %ld.%01ld/%ld/%ld MHz\n", 3671 - (clk_get_rate(&osc_sys_ck) / 1000000), 3672 - (clk_get_rate(&osc_sys_ck) / 100000) % 10, 3673 - (clk_get_rate(&core_ck) / 1000000), 3674 - (clk_get_rate(&arm_fck) / 1000000)); 3675 - 3676 - /* 3677 - * Lock DPLL5 -- here only until other device init code can 3678 - * handle this 3679 - */ 3680 - if (omap_rev() >= OMAP3430_REV_ES2_0) 3681 - omap3_clk_lock_dpll5(); 3682 - 3683 - /* Avoid sleeping during omap3_core_dpll_m2_set_rate() */ 3684 - sdrc_ick_p = clk_get(NULL, "sdrc_ick"); 3685 - arm_fck_p = clk_get(NULL, "arm_fck"); 3686 - 3687 - return 0; 3688 - }
-16
arch/arm/mach-omap2/clock.c
··· 23 23 #include <linux/clk-provider.h> 24 24 #include <linux/io.h> 25 25 #include <linux/bitops.h> 26 - #include <linux/clk-private.h> 27 26 #include <asm/cpu.h> 28 27 29 28 #include <trace/events/power.h> ··· 630 631 .find_idlest = omap2_clk_dflt_find_idlest, 631 632 .find_companion = omap2_clk_dflt_find_companion, 632 633 }; 633 - 634 - /** 635 - * omap_clocks_register - register an array of omap_clk 636 - * @ocs: pointer to an array of omap_clk to register 637 - */ 638 - void __init omap_clocks_register(struct omap_clk oclks[], int cnt) 639 - { 640 - struct omap_clk *c; 641 - 642 - for (c = oclks; c < oclks + cnt; c++) { 643 - clkdev_add(&c->lk); 644 - if (!__clk_init(NULL, c->lk.clk)) 645 - omap2_init_clk_hw_omap_clocks(c->lk.clk); 646 - } 647 - } 648 634 649 635 /** 650 636 * omap2_clk_switch_mpurate_at_boot - switch ARM MPU rate by boot-time argument
+8 -6
arch/arm/mach-omap2/clock.h
··· 40 40 struct clockdomain; 41 41 42 42 #define DEFINE_STRUCT_CLK(_name, _parent_array_name, _clkops_name) \ 43 - static struct clk _name = { \ 43 + static struct clk_core _name##_core = { \ 44 44 .name = #_name, \ 45 45 .hw = &_name##_hw.hw, \ 46 46 .parent_names = _parent_array_name, \ 47 47 .num_parents = ARRAY_SIZE(_parent_array_name), \ 48 48 .ops = &_clkops_name, \ 49 + }; \ 50 + static struct clk _name = { \ 51 + .core = &_name##_core, \ 49 52 }; 50 53 51 54 #define DEFINE_STRUCT_CLK_FLAGS(_name, _parent_array_name, \ 52 55 _clkops_name, _flags) \ 53 - static struct clk _name = { \ 56 + static struct clk_core _name##_core = { \ 54 57 .name = #_name, \ 55 58 .hw = &_name##_hw.hw, \ 56 59 .parent_names = _parent_array_name, \ 57 60 .num_parents = ARRAY_SIZE(_parent_array_name), \ 58 61 .ops = &_clkops_name, \ 59 62 .flags = _flags, \ 63 + }; \ 64 + static struct clk _name = { \ 65 + .core = &_name##_core, \ 60 66 }; 61 67 62 68 #define DEFINE_STRUCT_CLK_HW_OMAP(_name, _clkdm_name) \ ··· 244 238 extern struct ti_clk_features ti_clk_features; 245 239 246 240 extern const struct clkops clkops_omap2_dflt_wait; 247 - extern const struct clkops clkops_dummy; 248 241 extern const struct clkops clkops_omap2_dflt; 249 242 250 243 extern struct clk_functions omap2_clk_functions; ··· 252 247 extern const struct clksel_rate gpt_sys_rates[]; 253 248 extern const struct clksel_rate gfx_l3_rates[]; 254 249 extern const struct clksel_rate dsp_ick_rates[]; 255 - extern struct clk dummy_ck; 256 250 257 251 extern const struct clk_hw_omap_ops clkhwops_iclk_wait; 258 252 extern const struct clk_hw_omap_ops clkhwops_wait; ··· 275 271 276 272 extern int omap2_clkops_enable_clkdm(struct clk_hw *hw); 277 273 extern void omap2_clkops_disable_clkdm(struct clk_hw *hw); 278 - 279 - extern void omap_clocks_register(struct omap_clk *oclks, int cnt); 280 274 281 275 void __init ti_clk_init_features(void); 282 276 #endif
-11
arch/arm/mach-omap2/clock_common_data.c
··· 16 16 * OMAP3xxx clock definition files. 17 17 */ 18 18 19 - #include <linux/clk-private.h> 20 19 #include "clock.h" 21 20 22 21 /* clksel_rate data common to 24xx/343x */ ··· 112 113 { .div = 30, .val = 30, .flags = RATE_IN_4430 | RATE_IN_AM33XX }, 113 114 { .div = 31, .val = 31, .flags = RATE_IN_4430 | RATE_IN_AM33XX }, 114 115 { .div = 0 }, 115 - }; 116 - 117 - /* Clocks shared between various OMAP SoCs */ 118 - 119 - static struct clk_ops dummy_ck_ops = {}; 120 - 121 - struct clk dummy_ck = { 122 - .name = "dummy_clk", 123 - .ops = &dummy_ck_ops, 124 - .flags = CLK_IS_BASIC, 125 116 };
+8 -5
arch/arm/mach-omap2/dpll3xxx.c
··· 410 410 struct clk_hw_omap *clk = to_clk_hw_omap(hw); 411 411 int r; 412 412 struct dpll_data *dd; 413 - struct clk *parent; 413 + struct clk_hw *parent; 414 414 415 415 dd = clk->dpll_data; 416 416 if (!dd) ··· 427 427 } 428 428 } 429 429 430 - parent = __clk_get_parent(hw->clk); 430 + parent = __clk_get_hw(__clk_get_parent(hw->clk)); 431 431 432 432 if (__clk_get_rate(hw->clk) == __clk_get_rate(dd->clk_bypass)) { 433 - WARN_ON(parent != dd->clk_bypass); 433 + WARN_ON(parent != __clk_get_hw(dd->clk_bypass)); 434 434 r = _omap3_noncore_dpll_bypass(clk); 435 435 } else { 436 - WARN_ON(parent != dd->clk_ref); 436 + WARN_ON(parent != __clk_get_hw(dd->clk_ref)); 437 437 r = _omap3_noncore_dpll_lock(clk); 438 438 } 439 439 ··· 473 473 * in failure. 474 474 */ 475 475 long omap3_noncore_dpll_determine_rate(struct clk_hw *hw, unsigned long rate, 476 + unsigned long min_rate, 477 + unsigned long max_rate, 476 478 unsigned long *best_parent_rate, 477 479 struct clk_hw **best_parent_clk) 478 480 { ··· 551 549 if (!dd) 552 550 return -EINVAL; 553 551 554 - if (__clk_get_parent(hw->clk) != dd->clk_ref) 552 + if (__clk_get_hw(__clk_get_parent(hw->clk)) != 553 + __clk_get_hw(dd->clk_ref)) 555 554 return -EINVAL; 556 555 557 556 if (dd->last_rounded_rate == 0)
+2
arch/arm/mach-omap2/dpll44xx.c
··· 202 202 * in failure. 203 203 */ 204 204 long omap4_dpll_regm4xen_determine_rate(struct clk_hw *hw, unsigned long rate, 205 + unsigned long min_rate, 206 + unsigned long max_rate, 205 207 unsigned long *best_parent_rate, 206 208 struct clk_hw **best_parent_clk) 207 209 {
+19 -7
arch/arm/mach-omap2/io.c
··· 461 461 omap3xxx_clockdomains_init(); 462 462 omap3xxx_hwmod_init(); 463 463 omap_hwmod_init_postsetup(); 464 - omap_clk_soc_init = omap3xxx_clk_init; 464 + if (!of_have_populated_dt()) { 465 + omap3_prcm_legacy_iomaps_init(); 466 + if (soc_is_am35xx()) 467 + omap_clk_soc_init = am35xx_clk_legacy_init; 468 + else if (cpu_is_omap3630()) 469 + omap_clk_soc_init = omap36xx_clk_legacy_init; 470 + else if (omap_rev() == OMAP3430_REV_ES1_0) 471 + omap_clk_soc_init = omap3430es1_clk_legacy_init; 472 + else 473 + omap_clk_soc_init = omap3430_clk_legacy_init; 474 + } 465 475 } 466 476 467 477 void __init omap3430_init_early(void) ··· 763 753 764 754 ti_clk_init_features(); 765 755 766 - ret = of_prcm_init(); 767 - if (ret) 768 - return ret; 756 + if (of_have_populated_dt()) { 757 + ret = of_prcm_init(); 758 + if (ret) 759 + return ret; 769 760 770 - of_clk_init(NULL); 761 + of_clk_init(NULL); 771 762 772 - ti_dt_clk_init_retry_clks(); 763 + ti_dt_clk_init_retry_clks(); 773 764 774 - ti_dt_clockdomains_setup(); 765 + ti_dt_clockdomains_setup(); 766 + } 775 767 776 768 ret = omap_clk_soc_init(); 777 769
+1
arch/arm/mach-omap2/prm.h
··· 20 20 extern u16 prm_features; 21 21 extern void omap2_set_globals_prm(void __iomem *prm); 22 22 int of_prcm_init(void); 23 + void omap3_prcm_legacy_iomaps_init(void); 23 24 # endif 24 25 25 26 /*
+11
arch/arm/mach-omap2/prm_common.c
··· 35 35 #include "prm44xx.h" 36 36 #include "common.h" 37 37 #include "clock.h" 38 + #include "cm.h" 39 + #include "control.h" 38 40 39 41 /* 40 42 * OMAP_PRCM_MAX_NR_PENDING_REG: maximum number of PRM_IRQ*_MPU regs ··· 641 639 } 642 640 643 641 return 0; 642 + } 643 + 644 + void __init omap3_prcm_legacy_iomaps_init(void) 645 + { 646 + ti_clk_ll_ops = &omap_clk_ll_ops; 647 + 648 + clk_memmaps[TI_CLKM_CM] = cm_base + OMAP3430_IVA2_MOD; 649 + clk_memmaps[TI_CLKM_PRM] = prm_base + OMAP3430_IVA2_MOD; 650 + clk_memmaps[TI_CLKM_SCRM] = omap_ctrl_base_get(); 644 651 } 645 652 646 653 static int __init prm_late_init(void)
-2
arch/arm/mach-tegra/tegra.c
··· 91 91 struct soc_device *soc_dev; 92 92 struct device *parent = NULL; 93 93 94 - tegra_clocks_apply_init_table(); 95 - 96 94 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); 97 95 if (!soc_dev_attr) 98 96 goto out;
+6
arch/mips/alchemy/common/clock.c
··· 546 546 } 547 547 548 548 static long alchemy_clk_fgv1_detr(struct clk_hw *hw, unsigned long rate, 549 + unsigned long min_rate, 550 + unsigned long max_rate, 549 551 unsigned long *best_parent_rate, 550 552 struct clk_hw **best_parent_clk) 551 553 { ··· 680 678 } 681 679 682 680 static long alchemy_clk_fgv2_detr(struct clk_hw *hw, unsigned long rate, 681 + unsigned long min_rate, 682 + unsigned long max_rate, 683 683 unsigned long *best_parent_rate, 684 684 struct clk_hw **best_parent_clk) 685 685 { ··· 901 897 } 902 898 903 899 static long alchemy_clk_csrc_detr(struct clk_hw *hw, unsigned long rate, 900 + unsigned long min_rate, 901 + unsigned long max_rate, 904 902 unsigned long *best_parent_rate, 905 903 struct clk_hw **best_parent_clk) 906 904 {
+1
arch/powerpc/configs/corenet32_smp_defconfig
··· 142 142 CONFIG_FSL_HV_MANAGER=y 143 143 CONFIG_STAGING=y 144 144 CONFIG_FSL_CORENET_CF=y 145 + CONFIG_CLK_QORIQ=y 145 146 CONFIG_EXT2_FS=y 146 147 CONFIG_EXT3_FS=y 147 148 # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
+1
arch/powerpc/configs/corenet64_smp_defconfig
··· 122 122 CONFIG_FSL_DMA=y 123 123 CONFIG_VIRT_DRIVERS=y 124 124 CONFIG_FSL_HV_MANAGER=y 125 + CONFIG_CLK_QORIQ=y 125 126 CONFIG_FSL_CORENET_CF=y 126 127 CONFIG_EXT2_FS=y 127 128 CONFIG_EXT3_FS=y
+5
arch/powerpc/kernel/time.c
··· 54 54 #include <linux/irq.h> 55 55 #include <linux/delay.h> 56 56 #include <linux/irq_work.h> 57 + #include <linux/clk-provider.h> 57 58 #include <asm/trace.h> 58 59 59 60 #include <asm/io.h> ··· 976 975 977 976 init_decrementer_clockevent(); 978 977 tick_setup_hrtimer_broadcast(); 978 + 979 + #ifdef CONFIG_COMMON_CLK 980 + of_clk_init(NULL); 981 + #endif 979 982 } 980 983 981 984
+5 -6
arch/powerpc/platforms/512x/clock-commonclk.c
··· 1168 1168 } 1169 1169 } 1170 1170 1171 + /* 1172 + * The "fixed-clock" nodes (which includes the oscillator node if the board's 1173 + * DT provides one) has already been scanned by the of_clk_init() in 1174 + * time_init(). 1175 + */ 1171 1176 int __init mpc5121_clk_init(void) 1172 1177 { 1173 1178 struct device_node *clk_np; ··· 1190 1185 1191 1186 /* invalidate all not yet registered clock slots */ 1192 1187 mpc512x_clk_preset_data(); 1193 - 1194 - /* 1195 - * have the device tree scanned for "fixed-clock" nodes (which 1196 - * includes the oscillator node if the board's DT provides one) 1197 - */ 1198 - of_clk_init(NULL); 1199 1188 1200 1189 /* 1201 1190 * add a dummy clock for those situations where a clock spec is
+13 -5
drivers/clk/Kconfig
··· 102 102 Support for the Analog Devices axi-clkgen pcore clock generator for Xilinx 103 103 FPGAs. It is commonly used in Analog Devices' reference designs. 104 104 105 - config CLK_PPC_CORENET 106 - bool "Clock driver for PowerPC corenet platforms" 107 - depends on PPC_E500MC && OF 105 + config CLK_QORIQ 106 + bool "Clock driver for Freescale QorIQ platforms" 107 + depends on (PPC_E500MC || ARM) && OF 108 108 ---help--- 109 - This adds the clock driver support for Freescale PowerPC corenet 110 - platforms using common clock framework. 109 + This adds the clock driver support for Freescale QorIQ platforms 110 + using common clock framework. 111 111 112 112 config COMMON_CLK_XGENE 113 113 bool "Clock driver for APM XGene SoC" ··· 134 134 def_bool COMMON_CLK && ARCH_PXA 135 135 ---help--- 136 136 Sypport for the Marvell PXA SoC. 137 + 138 + config COMMON_CLK_CDCE706 139 + tristate "Clock driver for TI CDCE706 clock synthesizer" 140 + depends on I2C 141 + select REGMAP_I2C 142 + select RATIONAL 143 + ---help--- 144 + This driver supports TI CDCE706 programmable 3-PLL clock synthesizer. 137 145 138 146 source "drivers/clk/qcom/Kconfig" 139 147
+3 -1
drivers/clk/Makefile
··· 16 16 17 17 # hardware specific clock types 18 18 # please keep this section sorted lexicographically by file/directory path name 19 + obj-$(CONFIG_MACH_ASM9260) += clk-asm9260.o 19 20 obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN) += clk-axi-clkgen.o 20 21 obj-$(CONFIG_ARCH_AXXIA) += clk-axm5516.o 21 22 obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o 23 + obj-$(CONFIG_COMMON_CLK_CDCE706) += clk-cdce706.o 22 24 obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o 23 25 obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o 24 26 obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o ··· 32 30 obj-$(CONFIG_ARCH_NOMADIK) += clk-nomadik.o 33 31 obj-$(CONFIG_ARCH_NSPIRE) += clk-nspire.o 34 32 obj-$(CONFIG_COMMON_CLK_PALMAS) += clk-palmas.o 35 - obj-$(CONFIG_CLK_PPC_CORENET) += clk-ppc-corenet.o 33 + obj-$(CONFIG_CLK_QORIQ) += clk-qoriq.o 36 34 obj-$(CONFIG_COMMON_CLK_RK808) += clk-rk808.o 37 35 obj-$(CONFIG_COMMON_CLK_S2MPS11) += clk-s2mps11.o 38 36 obj-$(CONFIG_COMMON_CLK_SI5351) += clk-si5351.o
+2
drivers/clk/at91/clk-programmable.c
··· 56 56 57 57 static long clk_programmable_determine_rate(struct clk_hw *hw, 58 58 unsigned long rate, 59 + unsigned long min_rate, 60 + unsigned long max_rate, 59 61 unsigned long *best_parent_rate, 60 62 struct clk_hw **best_parent_hw) 61 63 {
+2
drivers/clk/bcm/clk-kona.c
··· 1032 1032 } 1033 1033 1034 1034 static long kona_peri_clk_determine_rate(struct clk_hw *hw, unsigned long rate, 1035 + unsigned long min_rate, 1036 + unsigned long max_rate, 1035 1037 unsigned long *best_parent_rate, struct clk_hw **best_parent) 1036 1038 { 1037 1039 struct kona_clk *bcm_clk = to_kona_clk(hw);
+348
drivers/clk/clk-asm9260.c
··· 1 + /* 2 + * Copyright (c) 2014 Oleksij Rempel <linux@rempel-privat.de>. 3 + * 4 + * This program is free software; you can redistribute it and/or modify it 5 + * under the terms and conditions of the GNU General Public License, 6 + * version 2, as published by the Free Software Foundation. 7 + * 8 + * This program is distributed in the hope it will be useful, but WITHOUT 9 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 + * more details. 12 + * 13 + * You should have received a copy of the GNU General Public License along with 14 + * this program. If not, see <http://www.gnu.org/licenses/>. 15 + */ 16 + 17 + #include <linux/clk.h> 18 + #include <linux/clkdev.h> 19 + #include <linux/err.h> 20 + #include <linux/io.h> 21 + #include <linux/clk-provider.h> 22 + #include <linux/spinlock.h> 23 + #include <linux/of.h> 24 + #include <linux/of_address.h> 25 + #include <dt-bindings/clock/alphascale,asm9260.h> 26 + 27 + #define HW_AHBCLKCTRL0 0x0020 28 + #define HW_AHBCLKCTRL1 0x0030 29 + #define HW_SYSPLLCTRL 0x0100 30 + #define HW_MAINCLKSEL 0x0120 31 + #define HW_MAINCLKUEN 0x0124 32 + #define HW_UARTCLKSEL 0x0128 33 + #define HW_UARTCLKUEN 0x012c 34 + #define HW_I2S0CLKSEL 0x0130 35 + #define HW_I2S0CLKUEN 0x0134 36 + #define HW_I2S1CLKSEL 0x0138 37 + #define HW_I2S1CLKUEN 0x013c 38 + #define HW_WDTCLKSEL 0x0160 39 + #define HW_WDTCLKUEN 0x0164 40 + #define HW_CLKOUTCLKSEL 0x0170 41 + #define HW_CLKOUTCLKUEN 0x0174 42 + #define HW_CPUCLKDIV 0x017c 43 + #define HW_SYSAHBCLKDIV 0x0180 44 + #define HW_I2S0MCLKDIV 0x0190 45 + #define HW_I2S0SCLKDIV 0x0194 46 + #define HW_I2S1MCLKDIV 0x0188 47 + #define HW_I2S1SCLKDIV 0x018c 48 + #define HW_UART0CLKDIV 0x0198 49 + #define HW_UART1CLKDIV 0x019c 50 + #define HW_UART2CLKDIV 0x01a0 51 + #define HW_UART3CLKDIV 0x01a4 52 + #define HW_UART4CLKDIV 0x01a8 53 + #define HW_UART5CLKDIV 0x01ac 54 + #define HW_UART6CLKDIV 0x01b0 55 + #define HW_UART7CLKDIV 0x01b4 56 + #define HW_UART8CLKDIV 0x01b8 57 + #define HW_UART9CLKDIV 0x01bc 58 + #define HW_SPI0CLKDIV 0x01c0 59 + #define HW_SPI1CLKDIV 0x01c4 60 + #define HW_QUADSPICLKDIV 0x01c8 61 + #define HW_SSP0CLKDIV 0x01d0 62 + #define HW_NANDCLKDIV 0x01d4 63 + #define HW_TRACECLKDIV 0x01e0 64 + #define HW_CAMMCLKDIV 0x01e8 65 + #define HW_WDTCLKDIV 0x01ec 66 + #define HW_CLKOUTCLKDIV 0x01f4 67 + #define HW_MACCLKDIV 0x01f8 68 + #define HW_LCDCLKDIV 0x01fc 69 + #define HW_ADCANACLKDIV 0x0200 70 + 71 + static struct clk *clks[MAX_CLKS]; 72 + static struct clk_onecell_data clk_data; 73 + static DEFINE_SPINLOCK(asm9260_clk_lock); 74 + 75 + struct asm9260_div_clk { 76 + unsigned int idx; 77 + const char *name; 78 + const char *parent_name; 79 + u32 reg; 80 + }; 81 + 82 + struct asm9260_gate_data { 83 + unsigned int idx; 84 + const char *name; 85 + const char *parent_name; 86 + u32 reg; 87 + u8 bit_idx; 88 + unsigned long flags; 89 + }; 90 + 91 + struct asm9260_mux_clock { 92 + u8 mask; 93 + u32 *table; 94 + const char *name; 95 + const char **parent_names; 96 + u8 num_parents; 97 + unsigned long offset; 98 + unsigned long flags; 99 + }; 100 + 101 + static void __iomem *base; 102 + 103 + static const struct asm9260_div_clk asm9260_div_clks[] __initconst = { 104 + { CLKID_SYS_CPU, "cpu_div", "main_gate", HW_CPUCLKDIV }, 105 + { CLKID_SYS_AHB, "ahb_div", "cpu_div", HW_SYSAHBCLKDIV }, 106 + 107 + /* i2s has two deviders: one for only external mclk and internal 108 + * devider for all clks. */ 109 + { CLKID_SYS_I2S0M, "i2s0m_div", "i2s0_mclk", HW_I2S0MCLKDIV }, 110 + { CLKID_SYS_I2S1M, "i2s1m_div", "i2s1_mclk", HW_I2S1MCLKDIV }, 111 + { CLKID_SYS_I2S0S, "i2s0s_div", "i2s0_gate", HW_I2S0SCLKDIV }, 112 + { CLKID_SYS_I2S1S, "i2s1s_div", "i2s0_gate", HW_I2S1SCLKDIV }, 113 + 114 + { CLKID_SYS_UART0, "uart0_div", "uart_gate", HW_UART0CLKDIV }, 115 + { CLKID_SYS_UART1, "uart1_div", "uart_gate", HW_UART1CLKDIV }, 116 + { CLKID_SYS_UART2, "uart2_div", "uart_gate", HW_UART2CLKDIV }, 117 + { CLKID_SYS_UART3, "uart3_div", "uart_gate", HW_UART3CLKDIV }, 118 + { CLKID_SYS_UART4, "uart4_div", "uart_gate", HW_UART4CLKDIV }, 119 + { CLKID_SYS_UART5, "uart5_div", "uart_gate", HW_UART5CLKDIV }, 120 + { CLKID_SYS_UART6, "uart6_div", "uart_gate", HW_UART6CLKDIV }, 121 + { CLKID_SYS_UART7, "uart7_div", "uart_gate", HW_UART7CLKDIV }, 122 + { CLKID_SYS_UART8, "uart8_div", "uart_gate", HW_UART8CLKDIV }, 123 + { CLKID_SYS_UART9, "uart9_div", "uart_gate", HW_UART9CLKDIV }, 124 + 125 + { CLKID_SYS_SPI0, "spi0_div", "main_gate", HW_SPI0CLKDIV }, 126 + { CLKID_SYS_SPI1, "spi1_div", "main_gate", HW_SPI1CLKDIV }, 127 + { CLKID_SYS_QUADSPI, "quadspi_div", "main_gate", HW_QUADSPICLKDIV }, 128 + { CLKID_SYS_SSP0, "ssp0_div", "main_gate", HW_SSP0CLKDIV }, 129 + { CLKID_SYS_NAND, "nand_div", "main_gate", HW_NANDCLKDIV }, 130 + { CLKID_SYS_TRACE, "trace_div", "main_gate", HW_TRACECLKDIV }, 131 + { CLKID_SYS_CAMM, "camm_div", "main_gate", HW_CAMMCLKDIV }, 132 + { CLKID_SYS_MAC, "mac_div", "main_gate", HW_MACCLKDIV }, 133 + { CLKID_SYS_LCD, "lcd_div", "main_gate", HW_LCDCLKDIV }, 134 + { CLKID_SYS_ADCANA, "adcana_div", "main_gate", HW_ADCANACLKDIV }, 135 + 136 + { CLKID_SYS_WDT, "wdt_div", "wdt_gate", HW_WDTCLKDIV }, 137 + { CLKID_SYS_CLKOUT, "clkout_div", "clkout_gate", HW_CLKOUTCLKDIV }, 138 + }; 139 + 140 + static const struct asm9260_gate_data asm9260_mux_gates[] __initconst = { 141 + { 0, "main_gate", "main_mux", HW_MAINCLKUEN, 0 }, 142 + { 0, "uart_gate", "uart_mux", HW_UARTCLKUEN, 0 }, 143 + { 0, "i2s0_gate", "i2s0_mux", HW_I2S0CLKUEN, 0 }, 144 + { 0, "i2s1_gate", "i2s1_mux", HW_I2S1CLKUEN, 0 }, 145 + { 0, "wdt_gate", "wdt_mux", HW_WDTCLKUEN, 0 }, 146 + { 0, "clkout_gate", "clkout_mux", HW_CLKOUTCLKUEN, 0 }, 147 + }; 148 + static const struct asm9260_gate_data asm9260_ahb_gates[] __initconst = { 149 + /* ahb gates */ 150 + { CLKID_AHB_ROM, "rom", "ahb_div", 151 + HW_AHBCLKCTRL0, 1, CLK_IGNORE_UNUSED}, 152 + { CLKID_AHB_RAM, "ram", "ahb_div", 153 + HW_AHBCLKCTRL0, 2, CLK_IGNORE_UNUSED}, 154 + { CLKID_AHB_GPIO, "gpio", "ahb_div", 155 + HW_AHBCLKCTRL0, 4 }, 156 + { CLKID_AHB_MAC, "mac", "ahb_div", 157 + HW_AHBCLKCTRL0, 5 }, 158 + { CLKID_AHB_EMI, "emi", "ahb_div", 159 + HW_AHBCLKCTRL0, 6, CLK_IGNORE_UNUSED}, 160 + { CLKID_AHB_USB0, "usb0", "ahb_div", 161 + HW_AHBCLKCTRL0, 7 }, 162 + { CLKID_AHB_USB1, "usb1", "ahb_div", 163 + HW_AHBCLKCTRL0, 8 }, 164 + { CLKID_AHB_DMA0, "dma0", "ahb_div", 165 + HW_AHBCLKCTRL0, 9 }, 166 + { CLKID_AHB_DMA1, "dma1", "ahb_div", 167 + HW_AHBCLKCTRL0, 10 }, 168 + { CLKID_AHB_UART0, "uart0", "ahb_div", 169 + HW_AHBCLKCTRL0, 11 }, 170 + { CLKID_AHB_UART1, "uart1", "ahb_div", 171 + HW_AHBCLKCTRL0, 12 }, 172 + { CLKID_AHB_UART2, "uart2", "ahb_div", 173 + HW_AHBCLKCTRL0, 13 }, 174 + { CLKID_AHB_UART3, "uart3", "ahb_div", 175 + HW_AHBCLKCTRL0, 14 }, 176 + { CLKID_AHB_UART4, "uart4", "ahb_div", 177 + HW_AHBCLKCTRL0, 15 }, 178 + { CLKID_AHB_UART5, "uart5", "ahb_div", 179 + HW_AHBCLKCTRL0, 16 }, 180 + { CLKID_AHB_UART6, "uart6", "ahb_div", 181 + HW_AHBCLKCTRL0, 17 }, 182 + { CLKID_AHB_UART7, "uart7", "ahb_div", 183 + HW_AHBCLKCTRL0, 18 }, 184 + { CLKID_AHB_UART8, "uart8", "ahb_div", 185 + HW_AHBCLKCTRL0, 19 }, 186 + { CLKID_AHB_UART9, "uart9", "ahb_div", 187 + HW_AHBCLKCTRL0, 20 }, 188 + { CLKID_AHB_I2S0, "i2s0", "ahb_div", 189 + HW_AHBCLKCTRL0, 21 }, 190 + { CLKID_AHB_I2C0, "i2c0", "ahb_div", 191 + HW_AHBCLKCTRL0, 22 }, 192 + { CLKID_AHB_I2C1, "i2c1", "ahb_div", 193 + HW_AHBCLKCTRL0, 23 }, 194 + { CLKID_AHB_SSP0, "ssp0", "ahb_div", 195 + HW_AHBCLKCTRL0, 24 }, 196 + { CLKID_AHB_IOCONFIG, "ioconf", "ahb_div", 197 + HW_AHBCLKCTRL0, 25 }, 198 + { CLKID_AHB_WDT, "wdt", "ahb_div", 199 + HW_AHBCLKCTRL0, 26 }, 200 + { CLKID_AHB_CAN0, "can0", "ahb_div", 201 + HW_AHBCLKCTRL0, 27 }, 202 + { CLKID_AHB_CAN1, "can1", "ahb_div", 203 + HW_AHBCLKCTRL0, 28 }, 204 + { CLKID_AHB_MPWM, "mpwm", "ahb_div", 205 + HW_AHBCLKCTRL0, 29 }, 206 + { CLKID_AHB_SPI0, "spi0", "ahb_div", 207 + HW_AHBCLKCTRL0, 30 }, 208 + { CLKID_AHB_SPI1, "spi1", "ahb_div", 209 + HW_AHBCLKCTRL0, 31 }, 210 + 211 + { CLKID_AHB_QEI, "qei", "ahb_div", 212 + HW_AHBCLKCTRL1, 0 }, 213 + { CLKID_AHB_QUADSPI0, "quadspi0", "ahb_div", 214 + HW_AHBCLKCTRL1, 1 }, 215 + { CLKID_AHB_CAMIF, "capmif", "ahb_div", 216 + HW_AHBCLKCTRL1, 2 }, 217 + { CLKID_AHB_LCDIF, "lcdif", "ahb_div", 218 + HW_AHBCLKCTRL1, 3 }, 219 + { CLKID_AHB_TIMER0, "timer0", "ahb_div", 220 + HW_AHBCLKCTRL1, 4 }, 221 + { CLKID_AHB_TIMER1, "timer1", "ahb_div", 222 + HW_AHBCLKCTRL1, 5 }, 223 + { CLKID_AHB_TIMER2, "timer2", "ahb_div", 224 + HW_AHBCLKCTRL1, 6 }, 225 + { CLKID_AHB_TIMER3, "timer3", "ahb_div", 226 + HW_AHBCLKCTRL1, 7 }, 227 + { CLKID_AHB_IRQ, "irq", "ahb_div", 228 + HW_AHBCLKCTRL1, 8, CLK_IGNORE_UNUSED}, 229 + { CLKID_AHB_RTC, "rtc", "ahb_div", 230 + HW_AHBCLKCTRL1, 9 }, 231 + { CLKID_AHB_NAND, "nand", "ahb_div", 232 + HW_AHBCLKCTRL1, 10 }, 233 + { CLKID_AHB_ADC0, "adc0", "ahb_div", 234 + HW_AHBCLKCTRL1, 11 }, 235 + { CLKID_AHB_LED, "led", "ahb_div", 236 + HW_AHBCLKCTRL1, 12 }, 237 + { CLKID_AHB_DAC0, "dac0", "ahb_div", 238 + HW_AHBCLKCTRL1, 13 }, 239 + { CLKID_AHB_LCD, "lcd", "ahb_div", 240 + HW_AHBCLKCTRL1, 14 }, 241 + { CLKID_AHB_I2S1, "i2s1", "ahb_div", 242 + HW_AHBCLKCTRL1, 15 }, 243 + { CLKID_AHB_MAC1, "mac1", "ahb_div", 244 + HW_AHBCLKCTRL1, 16 }, 245 + }; 246 + 247 + static const char __initdata *main_mux_p[] = { NULL, NULL }; 248 + static const char __initdata *i2s0_mux_p[] = { NULL, NULL, "i2s0m_div"}; 249 + static const char __initdata *i2s1_mux_p[] = { NULL, NULL, "i2s1m_div"}; 250 + static const char __initdata *clkout_mux_p[] = { NULL, NULL, "rtc"}; 251 + static u32 three_mux_table[] = {0, 1, 3}; 252 + 253 + static struct asm9260_mux_clock asm9260_mux_clks[] __initdata = { 254 + { 1, three_mux_table, "main_mux", main_mux_p, 255 + ARRAY_SIZE(main_mux_p), HW_MAINCLKSEL, }, 256 + { 1, three_mux_table, "uart_mux", main_mux_p, 257 + ARRAY_SIZE(main_mux_p), HW_UARTCLKSEL, }, 258 + { 1, three_mux_table, "wdt_mux", main_mux_p, 259 + ARRAY_SIZE(main_mux_p), HW_WDTCLKSEL, }, 260 + { 3, three_mux_table, "i2s0_mux", i2s0_mux_p, 261 + ARRAY_SIZE(i2s0_mux_p), HW_I2S0CLKSEL, }, 262 + { 3, three_mux_table, "i2s1_mux", i2s1_mux_p, 263 + ARRAY_SIZE(i2s1_mux_p), HW_I2S1CLKSEL, }, 264 + { 3, three_mux_table, "clkout_mux", clkout_mux_p, 265 + ARRAY_SIZE(clkout_mux_p), HW_CLKOUTCLKSEL, }, 266 + }; 267 + 268 + static void __init asm9260_acc_init(struct device_node *np) 269 + { 270 + struct clk *clk; 271 + const char *ref_clk, *pll_clk = "pll"; 272 + u32 rate; 273 + int n; 274 + u32 accuracy = 0; 275 + 276 + base = of_io_request_and_map(np, 0, np->name); 277 + if (!base) 278 + panic("%s: unable to map resource", np->name); 279 + 280 + /* register pll */ 281 + rate = (ioread32(base + HW_SYSPLLCTRL) & 0xffff) * 1000000; 282 + 283 + ref_clk = of_clk_get_parent_name(np, 0); 284 + accuracy = clk_get_accuracy(__clk_lookup(ref_clk)); 285 + clk = clk_register_fixed_rate_with_accuracy(NULL, pll_clk, 286 + ref_clk, 0, rate, accuracy); 287 + 288 + if (IS_ERR(clk)) 289 + panic("%s: can't register REFCLK. Check DT!", np->name); 290 + 291 + for (n = 0; n < ARRAY_SIZE(asm9260_mux_clks); n++) { 292 + const struct asm9260_mux_clock *mc = &asm9260_mux_clks[n]; 293 + 294 + mc->parent_names[0] = ref_clk; 295 + mc->parent_names[1] = pll_clk; 296 + clk = clk_register_mux_table(NULL, mc->name, mc->parent_names, 297 + mc->num_parents, mc->flags, base + mc->offset, 298 + 0, mc->mask, 0, mc->table, &asm9260_clk_lock); 299 + } 300 + 301 + /* clock mux gate cells */ 302 + for (n = 0; n < ARRAY_SIZE(asm9260_mux_gates); n++) { 303 + const struct asm9260_gate_data *gd = &asm9260_mux_gates[n]; 304 + 305 + clk = clk_register_gate(NULL, gd->name, 306 + gd->parent_name, gd->flags | CLK_SET_RATE_PARENT, 307 + base + gd->reg, gd->bit_idx, 0, &asm9260_clk_lock); 308 + } 309 + 310 + /* clock div cells */ 311 + for (n = 0; n < ARRAY_SIZE(asm9260_div_clks); n++) { 312 + const struct asm9260_div_clk *dc = &asm9260_div_clks[n]; 313 + 314 + clks[dc->idx] = clk_register_divider(NULL, dc->name, 315 + dc->parent_name, CLK_SET_RATE_PARENT, 316 + base + dc->reg, 0, 8, CLK_DIVIDER_ONE_BASED, 317 + &asm9260_clk_lock); 318 + } 319 + 320 + /* clock ahb gate cells */ 321 + for (n = 0; n < ARRAY_SIZE(asm9260_ahb_gates); n++) { 322 + const struct asm9260_gate_data *gd = &asm9260_ahb_gates[n]; 323 + 324 + clks[gd->idx] = clk_register_gate(NULL, gd->name, 325 + gd->parent_name, gd->flags, base + gd->reg, 326 + gd->bit_idx, 0, &asm9260_clk_lock); 327 + } 328 + 329 + /* check for errors on leaf clocks */ 330 + for (n = 0; n < MAX_CLKS; n++) { 331 + if (!IS_ERR(clks[n])) 332 + continue; 333 + 334 + pr_err("%s: Unable to register leaf clock %d\n", 335 + np->full_name, n); 336 + goto fail; 337 + } 338 + 339 + /* register clk-provider */ 340 + clk_data.clks = clks; 341 + clk_data.clk_num = MAX_CLKS; 342 + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 343 + return; 344 + fail: 345 + iounmap(base); 346 + } 347 + CLK_OF_DECLARE(asm9260_acc, "alphascale,asm9260-clock-controller", 348 + asm9260_acc_init);
+700
drivers/clk/clk-cdce706.c
··· 1 + /* 2 + * TI CDCE706 programmable 3-PLL clock synthesizer driver 3 + * 4 + * Copyright (c) 2014 Cadence Design Systems Inc. 5 + * 6 + * Reference: http://www.ti.com/lit/ds/symlink/cdce706.pdf 7 + * 8 + * This program is free software; you can redistribute it and/or modify 9 + * it under the terms of the GNU General Public License version 2 as 10 + * published by the Free Software Foundation. 11 + */ 12 + 13 + #include <linux/clk-provider.h> 14 + #include <linux/delay.h> 15 + #include <linux/i2c.h> 16 + #include <linux/interrupt.h> 17 + #include <linux/mod_devicetable.h> 18 + #include <linux/module.h> 19 + #include <linux/of.h> 20 + #include <linux/rational.h> 21 + #include <linux/regmap.h> 22 + #include <linux/slab.h> 23 + 24 + #define CDCE706_CLKIN_CLOCK 10 25 + #define CDCE706_CLKIN_SOURCE 11 26 + #define CDCE706_PLL_M_LOW(pll) (1 + 3 * (pll)) 27 + #define CDCE706_PLL_N_LOW(pll) (2 + 3 * (pll)) 28 + #define CDCE706_PLL_HI(pll) (3 + 3 * (pll)) 29 + #define CDCE706_PLL_MUX 3 30 + #define CDCE706_PLL_FVCO 6 31 + #define CDCE706_DIVIDER(div) (13 + (div)) 32 + #define CDCE706_CLKOUT(out) (19 + (out)) 33 + 34 + #define CDCE706_CLKIN_CLOCK_MASK 0x10 35 + #define CDCE706_CLKIN_SOURCE_SHIFT 6 36 + #define CDCE706_CLKIN_SOURCE_MASK 0xc0 37 + #define CDCE706_CLKIN_SOURCE_LVCMOS 0x40 38 + 39 + #define CDCE706_PLL_MUX_MASK(pll) (0x80 >> (pll)) 40 + #define CDCE706_PLL_LOW_M_MASK 0xff 41 + #define CDCE706_PLL_LOW_N_MASK 0xff 42 + #define CDCE706_PLL_HI_M_MASK 0x1 43 + #define CDCE706_PLL_HI_N_MASK 0x1e 44 + #define CDCE706_PLL_HI_N_SHIFT 1 45 + #define CDCE706_PLL_M_MAX 0x1ff 46 + #define CDCE706_PLL_N_MAX 0xfff 47 + #define CDCE706_PLL_FVCO_MASK(pll) (0x80 >> (pll)) 48 + #define CDCE706_PLL_FREQ_MIN 80000000 49 + #define CDCE706_PLL_FREQ_MAX 300000000 50 + #define CDCE706_PLL_FREQ_HI 180000000 51 + 52 + #define CDCE706_DIVIDER_PLL(div) (9 + (div) - ((div) > 2) - ((div) > 4)) 53 + #define CDCE706_DIVIDER_PLL_SHIFT(div) ((div) < 2 ? 5 : 3 * ((div) & 1)) 54 + #define CDCE706_DIVIDER_PLL_MASK(div) (0x7 << CDCE706_DIVIDER_PLL_SHIFT(div)) 55 + #define CDCE706_DIVIDER_DIVIDER_MASK 0x7f 56 + #define CDCE706_DIVIDER_DIVIDER_MAX 0x7f 57 + 58 + #define CDCE706_CLKOUT_DIVIDER_MASK 0x7 59 + #define CDCE706_CLKOUT_ENABLE_MASK 0x8 60 + 61 + static struct regmap_config cdce706_regmap_config = { 62 + .reg_bits = 8, 63 + .val_bits = 8, 64 + .val_format_endian = REGMAP_ENDIAN_NATIVE, 65 + }; 66 + 67 + #define to_hw_data(phw) (container_of((phw), struct cdce706_hw_data, hw)) 68 + 69 + struct cdce706_hw_data { 70 + struct cdce706_dev_data *dev_data; 71 + unsigned idx; 72 + unsigned parent; 73 + struct clk *clk; 74 + struct clk_hw hw; 75 + unsigned div; 76 + unsigned mul; 77 + unsigned mux; 78 + }; 79 + 80 + struct cdce706_dev_data { 81 + struct i2c_client *client; 82 + struct regmap *regmap; 83 + struct clk_onecell_data onecell; 84 + struct clk *clks[6]; 85 + struct clk *clkin_clk[2]; 86 + const char *clkin_name[2]; 87 + struct cdce706_hw_data clkin[1]; 88 + struct cdce706_hw_data pll[3]; 89 + struct cdce706_hw_data divider[6]; 90 + struct cdce706_hw_data clkout[6]; 91 + }; 92 + 93 + static const char * const cdce706_source_name[] = { 94 + "clk_in0", "clk_in1", 95 + }; 96 + 97 + static const char *cdce706_clkin_name[] = { 98 + "clk_in", 99 + }; 100 + 101 + static const char * const cdce706_pll_name[] = { 102 + "pll1", "pll2", "pll3", 103 + }; 104 + 105 + static const char *cdce706_divider_parent_name[] = { 106 + "clk_in", "pll1", "pll2", "pll2", "pll3", 107 + }; 108 + 109 + static const char *cdce706_divider_name[] = { 110 + "p0", "p1", "p2", "p3", "p4", "p5", 111 + }; 112 + 113 + static const char * const cdce706_clkout_name[] = { 114 + "clk_out0", "clk_out1", "clk_out2", "clk_out3", "clk_out4", "clk_out5", 115 + }; 116 + 117 + static int cdce706_reg_read(struct cdce706_dev_data *dev_data, unsigned reg, 118 + unsigned *val) 119 + { 120 + int rc = regmap_read(dev_data->regmap, reg | 0x80, val); 121 + 122 + if (rc < 0) 123 + dev_err(&dev_data->client->dev, "error reading reg %u", reg); 124 + return rc; 125 + } 126 + 127 + static int cdce706_reg_write(struct cdce706_dev_data *dev_data, unsigned reg, 128 + unsigned val) 129 + { 130 + int rc = regmap_write(dev_data->regmap, reg | 0x80, val); 131 + 132 + if (rc < 0) 133 + dev_err(&dev_data->client->dev, "error writing reg %u", reg); 134 + return rc; 135 + } 136 + 137 + static int cdce706_reg_update(struct cdce706_dev_data *dev_data, unsigned reg, 138 + unsigned mask, unsigned val) 139 + { 140 + int rc = regmap_update_bits(dev_data->regmap, reg | 0x80, mask, val); 141 + 142 + if (rc < 0) 143 + dev_err(&dev_data->client->dev, "error updating reg %u", reg); 144 + return rc; 145 + } 146 + 147 + static int cdce706_clkin_set_parent(struct clk_hw *hw, u8 index) 148 + { 149 + struct cdce706_hw_data *hwd = to_hw_data(hw); 150 + 151 + hwd->parent = index; 152 + return 0; 153 + } 154 + 155 + static u8 cdce706_clkin_get_parent(struct clk_hw *hw) 156 + { 157 + struct cdce706_hw_data *hwd = to_hw_data(hw); 158 + 159 + return hwd->parent; 160 + } 161 + 162 + static const struct clk_ops cdce706_clkin_ops = { 163 + .set_parent = cdce706_clkin_set_parent, 164 + .get_parent = cdce706_clkin_get_parent, 165 + }; 166 + 167 + static unsigned long cdce706_pll_recalc_rate(struct clk_hw *hw, 168 + unsigned long parent_rate) 169 + { 170 + struct cdce706_hw_data *hwd = to_hw_data(hw); 171 + 172 + dev_dbg(&hwd->dev_data->client->dev, 173 + "%s, pll: %d, mux: %d, mul: %u, div: %u\n", 174 + __func__, hwd->idx, hwd->mux, hwd->mul, hwd->div); 175 + 176 + if (!hwd->mux) { 177 + if (hwd->div && hwd->mul) { 178 + u64 res = (u64)parent_rate * hwd->mul; 179 + 180 + do_div(res, hwd->div); 181 + return res; 182 + } 183 + } else { 184 + if (hwd->div) 185 + return parent_rate / hwd->div; 186 + } 187 + return 0; 188 + } 189 + 190 + static long cdce706_pll_round_rate(struct clk_hw *hw, unsigned long rate, 191 + unsigned long *parent_rate) 192 + { 193 + struct cdce706_hw_data *hwd = to_hw_data(hw); 194 + unsigned long mul, div; 195 + u64 res; 196 + 197 + dev_dbg(&hwd->dev_data->client->dev, 198 + "%s, rate: %lu, parent_rate: %lu\n", 199 + __func__, rate, *parent_rate); 200 + 201 + rational_best_approximation(rate, *parent_rate, 202 + CDCE706_PLL_N_MAX, CDCE706_PLL_M_MAX, 203 + &mul, &div); 204 + hwd->mul = mul; 205 + hwd->div = div; 206 + 207 + dev_dbg(&hwd->dev_data->client->dev, 208 + "%s, pll: %d, mul: %lu, div: %lu\n", 209 + __func__, hwd->idx, mul, div); 210 + 211 + res = (u64)*parent_rate * hwd->mul; 212 + do_div(res, hwd->div); 213 + return res; 214 + } 215 + 216 + static int cdce706_pll_set_rate(struct clk_hw *hw, unsigned long rate, 217 + unsigned long parent_rate) 218 + { 219 + struct cdce706_hw_data *hwd = to_hw_data(hw); 220 + unsigned long mul = hwd->mul, div = hwd->div; 221 + int err; 222 + 223 + dev_dbg(&hwd->dev_data->client->dev, 224 + "%s, pll: %d, mul: %lu, div: %lu\n", 225 + __func__, hwd->idx, mul, div); 226 + 227 + err = cdce706_reg_update(hwd->dev_data, 228 + CDCE706_PLL_HI(hwd->idx), 229 + CDCE706_PLL_HI_M_MASK | CDCE706_PLL_HI_N_MASK, 230 + ((div >> 8) & CDCE706_PLL_HI_M_MASK) | 231 + ((mul >> (8 - CDCE706_PLL_HI_N_SHIFT)) & 232 + CDCE706_PLL_HI_N_MASK)); 233 + if (err < 0) 234 + return err; 235 + 236 + err = cdce706_reg_write(hwd->dev_data, 237 + CDCE706_PLL_M_LOW(hwd->idx), 238 + div & CDCE706_PLL_LOW_M_MASK); 239 + if (err < 0) 240 + return err; 241 + 242 + err = cdce706_reg_write(hwd->dev_data, 243 + CDCE706_PLL_N_LOW(hwd->idx), 244 + mul & CDCE706_PLL_LOW_N_MASK); 245 + if (err < 0) 246 + return err; 247 + 248 + err = cdce706_reg_update(hwd->dev_data, 249 + CDCE706_PLL_FVCO, 250 + CDCE706_PLL_FVCO_MASK(hwd->idx), 251 + rate > CDCE706_PLL_FREQ_HI ? 252 + CDCE706_PLL_FVCO_MASK(hwd->idx) : 0); 253 + return err; 254 + } 255 + 256 + static const struct clk_ops cdce706_pll_ops = { 257 + .recalc_rate = cdce706_pll_recalc_rate, 258 + .round_rate = cdce706_pll_round_rate, 259 + .set_rate = cdce706_pll_set_rate, 260 + }; 261 + 262 + static int cdce706_divider_set_parent(struct clk_hw *hw, u8 index) 263 + { 264 + struct cdce706_hw_data *hwd = to_hw_data(hw); 265 + 266 + if (hwd->parent == index) 267 + return 0; 268 + hwd->parent = index; 269 + return cdce706_reg_update(hwd->dev_data, 270 + CDCE706_DIVIDER_PLL(hwd->idx), 271 + CDCE706_DIVIDER_PLL_MASK(hwd->idx), 272 + index << CDCE706_DIVIDER_PLL_SHIFT(hwd->idx)); 273 + } 274 + 275 + static u8 cdce706_divider_get_parent(struct clk_hw *hw) 276 + { 277 + struct cdce706_hw_data *hwd = to_hw_data(hw); 278 + 279 + return hwd->parent; 280 + } 281 + 282 + static unsigned long cdce706_divider_recalc_rate(struct clk_hw *hw, 283 + unsigned long parent_rate) 284 + { 285 + struct cdce706_hw_data *hwd = to_hw_data(hw); 286 + 287 + dev_dbg(&hwd->dev_data->client->dev, 288 + "%s, divider: %d, div: %u\n", 289 + __func__, hwd->idx, hwd->div); 290 + if (hwd->div) 291 + return parent_rate / hwd->div; 292 + return 0; 293 + } 294 + 295 + static long cdce706_divider_round_rate(struct clk_hw *hw, unsigned long rate, 296 + unsigned long *parent_rate) 297 + { 298 + struct cdce706_hw_data *hwd = to_hw_data(hw); 299 + struct cdce706_dev_data *cdce = hwd->dev_data; 300 + unsigned long mul, div; 301 + 302 + dev_dbg(&hwd->dev_data->client->dev, 303 + "%s, rate: %lu, parent_rate: %lu\n", 304 + __func__, rate, *parent_rate); 305 + 306 + rational_best_approximation(rate, *parent_rate, 307 + 1, CDCE706_DIVIDER_DIVIDER_MAX, 308 + &mul, &div); 309 + if (!mul) 310 + div = CDCE706_DIVIDER_DIVIDER_MAX; 311 + 312 + if (__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT) { 313 + unsigned long best_diff = rate; 314 + unsigned long best_div = 0; 315 + struct clk *gp_clk = cdce->clkin_clk[cdce->clkin[0].parent]; 316 + unsigned long gp_rate = gp_clk ? clk_get_rate(gp_clk) : 0; 317 + 318 + for (div = CDCE706_PLL_FREQ_MIN / rate; best_diff && 319 + div <= CDCE706_PLL_FREQ_MAX / rate; ++div) { 320 + unsigned long n, m; 321 + unsigned long diff; 322 + unsigned long div_rate; 323 + u64 div_rate64; 324 + 325 + if (rate * div < CDCE706_PLL_FREQ_MIN) 326 + continue; 327 + 328 + rational_best_approximation(rate * div, gp_rate, 329 + CDCE706_PLL_N_MAX, 330 + CDCE706_PLL_M_MAX, 331 + &n, &m); 332 + div_rate64 = (u64)gp_rate * n; 333 + do_div(div_rate64, m); 334 + do_div(div_rate64, div); 335 + div_rate = div_rate64; 336 + diff = max(div_rate, rate) - min(div_rate, rate); 337 + 338 + if (diff < best_diff) { 339 + best_diff = diff; 340 + best_div = div; 341 + dev_dbg(&hwd->dev_data->client->dev, 342 + "%s, %lu * %lu / %lu / %lu = %lu\n", 343 + __func__, gp_rate, n, m, div, div_rate); 344 + } 345 + } 346 + 347 + div = best_div; 348 + 349 + dev_dbg(&hwd->dev_data->client->dev, 350 + "%s, altering parent rate: %lu -> %lu\n", 351 + __func__, *parent_rate, rate * div); 352 + *parent_rate = rate * div; 353 + } 354 + hwd->div = div; 355 + 356 + dev_dbg(&hwd->dev_data->client->dev, 357 + "%s, divider: %d, div: %lu\n", 358 + __func__, hwd->idx, div); 359 + 360 + return *parent_rate / div; 361 + } 362 + 363 + static int cdce706_divider_set_rate(struct clk_hw *hw, unsigned long rate, 364 + unsigned long parent_rate) 365 + { 366 + struct cdce706_hw_data *hwd = to_hw_data(hw); 367 + 368 + dev_dbg(&hwd->dev_data->client->dev, 369 + "%s, divider: %d, div: %u\n", 370 + __func__, hwd->idx, hwd->div); 371 + 372 + return cdce706_reg_update(hwd->dev_data, 373 + CDCE706_DIVIDER(hwd->idx), 374 + CDCE706_DIVIDER_DIVIDER_MASK, 375 + hwd->div); 376 + } 377 + 378 + static const struct clk_ops cdce706_divider_ops = { 379 + .set_parent = cdce706_divider_set_parent, 380 + .get_parent = cdce706_divider_get_parent, 381 + .recalc_rate = cdce706_divider_recalc_rate, 382 + .round_rate = cdce706_divider_round_rate, 383 + .set_rate = cdce706_divider_set_rate, 384 + }; 385 + 386 + static int cdce706_clkout_prepare(struct clk_hw *hw) 387 + { 388 + struct cdce706_hw_data *hwd = to_hw_data(hw); 389 + 390 + return cdce706_reg_update(hwd->dev_data, CDCE706_CLKOUT(hwd->idx), 391 + CDCE706_CLKOUT_ENABLE_MASK, 392 + CDCE706_CLKOUT_ENABLE_MASK); 393 + } 394 + 395 + static void cdce706_clkout_unprepare(struct clk_hw *hw) 396 + { 397 + struct cdce706_hw_data *hwd = to_hw_data(hw); 398 + 399 + cdce706_reg_update(hwd->dev_data, CDCE706_CLKOUT(hwd->idx), 400 + CDCE706_CLKOUT_ENABLE_MASK, 0); 401 + } 402 + 403 + static int cdce706_clkout_set_parent(struct clk_hw *hw, u8 index) 404 + { 405 + struct cdce706_hw_data *hwd = to_hw_data(hw); 406 + 407 + if (hwd->parent == index) 408 + return 0; 409 + hwd->parent = index; 410 + return cdce706_reg_update(hwd->dev_data, 411 + CDCE706_CLKOUT(hwd->idx), 412 + CDCE706_CLKOUT_ENABLE_MASK, index); 413 + } 414 + 415 + static u8 cdce706_clkout_get_parent(struct clk_hw *hw) 416 + { 417 + struct cdce706_hw_data *hwd = to_hw_data(hw); 418 + 419 + return hwd->parent; 420 + } 421 + 422 + static unsigned long cdce706_clkout_recalc_rate(struct clk_hw *hw, 423 + unsigned long parent_rate) 424 + { 425 + return parent_rate; 426 + } 427 + 428 + static long cdce706_clkout_round_rate(struct clk_hw *hw, unsigned long rate, 429 + unsigned long *parent_rate) 430 + { 431 + *parent_rate = rate; 432 + return rate; 433 + } 434 + 435 + static int cdce706_clkout_set_rate(struct clk_hw *hw, unsigned long rate, 436 + unsigned long parent_rate) 437 + { 438 + return 0; 439 + } 440 + 441 + static const struct clk_ops cdce706_clkout_ops = { 442 + .prepare = cdce706_clkout_prepare, 443 + .unprepare = cdce706_clkout_unprepare, 444 + .set_parent = cdce706_clkout_set_parent, 445 + .get_parent = cdce706_clkout_get_parent, 446 + .recalc_rate = cdce706_clkout_recalc_rate, 447 + .round_rate = cdce706_clkout_round_rate, 448 + .set_rate = cdce706_clkout_set_rate, 449 + }; 450 + 451 + static int cdce706_register_hw(struct cdce706_dev_data *cdce, 452 + struct cdce706_hw_data *hw, unsigned num_hw, 453 + const char * const *clk_names, 454 + struct clk_init_data *init) 455 + { 456 + unsigned i; 457 + 458 + for (i = 0; i < num_hw; ++i, ++hw) { 459 + init->name = clk_names[i]; 460 + hw->dev_data = cdce; 461 + hw->idx = i; 462 + hw->hw.init = init; 463 + hw->clk = devm_clk_register(&cdce->client->dev, 464 + &hw->hw); 465 + if (IS_ERR(hw->clk)) { 466 + dev_err(&cdce->client->dev, "Failed to register %s\n", 467 + clk_names[i]); 468 + return PTR_ERR(hw->clk); 469 + } 470 + } 471 + return 0; 472 + } 473 + 474 + static int cdce706_register_clkin(struct cdce706_dev_data *cdce) 475 + { 476 + struct clk_init_data init = { 477 + .ops = &cdce706_clkin_ops, 478 + .parent_names = cdce->clkin_name, 479 + .num_parents = ARRAY_SIZE(cdce->clkin_name), 480 + }; 481 + unsigned i; 482 + int ret; 483 + unsigned clock, source; 484 + 485 + for (i = 0; i < ARRAY_SIZE(cdce->clkin_name); ++i) { 486 + struct clk *parent = devm_clk_get(&cdce->client->dev, 487 + cdce706_source_name[i]); 488 + 489 + if (IS_ERR(parent)) { 490 + cdce->clkin_name[i] = cdce706_source_name[i]; 491 + } else { 492 + cdce->clkin_name[i] = __clk_get_name(parent); 493 + cdce->clkin_clk[i] = parent; 494 + } 495 + } 496 + 497 + ret = cdce706_reg_read(cdce, CDCE706_CLKIN_SOURCE, &source); 498 + if (ret < 0) 499 + return ret; 500 + if ((source & CDCE706_CLKIN_SOURCE_MASK) == 501 + CDCE706_CLKIN_SOURCE_LVCMOS) { 502 + ret = cdce706_reg_read(cdce, CDCE706_CLKIN_CLOCK, &clock); 503 + if (ret < 0) 504 + return ret; 505 + cdce->clkin[0].parent = !!(clock & CDCE706_CLKIN_CLOCK_MASK); 506 + } 507 + 508 + ret = cdce706_register_hw(cdce, cdce->clkin, 509 + ARRAY_SIZE(cdce->clkin), 510 + cdce706_clkin_name, &init); 511 + return ret; 512 + } 513 + 514 + static int cdce706_register_plls(struct cdce706_dev_data *cdce) 515 + { 516 + struct clk_init_data init = { 517 + .ops = &cdce706_pll_ops, 518 + .parent_names = cdce706_clkin_name, 519 + .num_parents = ARRAY_SIZE(cdce706_clkin_name), 520 + }; 521 + unsigned i; 522 + int ret; 523 + unsigned mux; 524 + 525 + ret = cdce706_reg_read(cdce, CDCE706_PLL_MUX, &mux); 526 + if (ret < 0) 527 + return ret; 528 + 529 + for (i = 0; i < ARRAY_SIZE(cdce->pll); ++i) { 530 + unsigned m, n, v; 531 + 532 + ret = cdce706_reg_read(cdce, CDCE706_PLL_M_LOW(i), &m); 533 + if (ret < 0) 534 + return ret; 535 + ret = cdce706_reg_read(cdce, CDCE706_PLL_N_LOW(i), &n); 536 + if (ret < 0) 537 + return ret; 538 + ret = cdce706_reg_read(cdce, CDCE706_PLL_HI(i), &v); 539 + if (ret < 0) 540 + return ret; 541 + cdce->pll[i].div = m | ((v & CDCE706_PLL_HI_M_MASK) << 8); 542 + cdce->pll[i].mul = n | ((v & CDCE706_PLL_HI_N_MASK) << 543 + (8 - CDCE706_PLL_HI_N_SHIFT)); 544 + cdce->pll[i].mux = mux & CDCE706_PLL_MUX_MASK(i); 545 + dev_dbg(&cdce->client->dev, 546 + "%s: i: %u, div: %u, mul: %u, mux: %d\n", __func__, i, 547 + cdce->pll[i].div, cdce->pll[i].mul, cdce->pll[i].mux); 548 + } 549 + 550 + ret = cdce706_register_hw(cdce, cdce->pll, 551 + ARRAY_SIZE(cdce->pll), 552 + cdce706_pll_name, &init); 553 + return ret; 554 + } 555 + 556 + static int cdce706_register_dividers(struct cdce706_dev_data *cdce) 557 + { 558 + struct clk_init_data init = { 559 + .ops = &cdce706_divider_ops, 560 + .parent_names = cdce706_divider_parent_name, 561 + .num_parents = ARRAY_SIZE(cdce706_divider_parent_name), 562 + .flags = CLK_SET_RATE_PARENT, 563 + }; 564 + unsigned i; 565 + int ret; 566 + 567 + for (i = 0; i < ARRAY_SIZE(cdce->divider); ++i) { 568 + unsigned val; 569 + 570 + ret = cdce706_reg_read(cdce, CDCE706_DIVIDER_PLL(i), &val); 571 + if (ret < 0) 572 + return ret; 573 + cdce->divider[i].parent = 574 + (val & CDCE706_DIVIDER_PLL_MASK(i)) >> 575 + CDCE706_DIVIDER_PLL_SHIFT(i); 576 + 577 + ret = cdce706_reg_read(cdce, CDCE706_DIVIDER(i), &val); 578 + if (ret < 0) 579 + return ret; 580 + cdce->divider[i].div = val & CDCE706_DIVIDER_DIVIDER_MASK; 581 + dev_dbg(&cdce->client->dev, 582 + "%s: i: %u, parent: %u, div: %u\n", __func__, i, 583 + cdce->divider[i].parent, cdce->divider[i].div); 584 + } 585 + 586 + ret = cdce706_register_hw(cdce, cdce->divider, 587 + ARRAY_SIZE(cdce->divider), 588 + cdce706_divider_name, &init); 589 + return ret; 590 + } 591 + 592 + static int cdce706_register_clkouts(struct cdce706_dev_data *cdce) 593 + { 594 + struct clk_init_data init = { 595 + .ops = &cdce706_clkout_ops, 596 + .parent_names = cdce706_divider_name, 597 + .num_parents = ARRAY_SIZE(cdce706_divider_name), 598 + .flags = CLK_SET_RATE_PARENT, 599 + }; 600 + unsigned i; 601 + int ret; 602 + 603 + for (i = 0; i < ARRAY_SIZE(cdce->clkout); ++i) { 604 + unsigned val; 605 + 606 + ret = cdce706_reg_read(cdce, CDCE706_CLKOUT(i), &val); 607 + if (ret < 0) 608 + return ret; 609 + cdce->clkout[i].parent = val & CDCE706_CLKOUT_DIVIDER_MASK; 610 + dev_dbg(&cdce->client->dev, 611 + "%s: i: %u, parent: %u\n", __func__, i, 612 + cdce->clkout[i].parent); 613 + } 614 + 615 + ret = cdce706_register_hw(cdce, cdce->clkout, 616 + ARRAY_SIZE(cdce->clkout), 617 + cdce706_clkout_name, &init); 618 + for (i = 0; i < ARRAY_SIZE(cdce->clkout); ++i) 619 + cdce->clks[i] = cdce->clkout[i].clk; 620 + 621 + return ret; 622 + } 623 + 624 + static int cdce706_probe(struct i2c_client *client, 625 + const struct i2c_device_id *id) 626 + { 627 + struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); 628 + struct cdce706_dev_data *cdce; 629 + int ret; 630 + 631 + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 632 + return -EIO; 633 + 634 + cdce = devm_kzalloc(&client->dev, sizeof(*cdce), GFP_KERNEL); 635 + if (!cdce) 636 + return -ENOMEM; 637 + 638 + cdce->client = client; 639 + cdce->regmap = devm_regmap_init_i2c(client, &cdce706_regmap_config); 640 + if (IS_ERR(cdce->regmap)) { 641 + dev_err(&client->dev, "Failed to initialize regmap\n"); 642 + return -EINVAL; 643 + } 644 + 645 + i2c_set_clientdata(client, cdce); 646 + 647 + ret = cdce706_register_clkin(cdce); 648 + if (ret < 0) 649 + return ret; 650 + ret = cdce706_register_plls(cdce); 651 + if (ret < 0) 652 + return ret; 653 + ret = cdce706_register_dividers(cdce); 654 + if (ret < 0) 655 + return ret; 656 + ret = cdce706_register_clkouts(cdce); 657 + if (ret < 0) 658 + return ret; 659 + cdce->onecell.clks = cdce->clks; 660 + cdce->onecell.clk_num = ARRAY_SIZE(cdce->clks); 661 + ret = of_clk_add_provider(client->dev.of_node, of_clk_src_onecell_get, 662 + &cdce->onecell); 663 + 664 + return ret; 665 + } 666 + 667 + static int cdce706_remove(struct i2c_client *client) 668 + { 669 + return 0; 670 + } 671 + 672 + 673 + #ifdef CONFIG_OF 674 + static const struct of_device_id cdce706_dt_match[] = { 675 + { .compatible = "ti,cdce706" }, 676 + { }, 677 + }; 678 + MODULE_DEVICE_TABLE(of, cdce706_dt_match); 679 + #endif 680 + 681 + static const struct i2c_device_id cdce706_id[] = { 682 + { "cdce706", 0 }, 683 + { } 684 + }; 685 + MODULE_DEVICE_TABLE(i2c, cdce706_id); 686 + 687 + static struct i2c_driver cdce706_i2c_driver = { 688 + .driver = { 689 + .name = "cdce706", 690 + .of_match_table = of_match_ptr(cdce706_dt_match), 691 + }, 692 + .probe = cdce706_probe, 693 + .remove = cdce706_remove, 694 + .id_table = cdce706_id, 695 + }; 696 + module_i2c_driver(cdce706_i2c_driver); 697 + 698 + MODULE_AUTHOR("Max Filippov <jcmvbkbc@gmail.com>"); 699 + MODULE_DESCRIPTION("TI CDCE 706 clock synthesizer driver"); 700 + MODULE_LICENSE("GPL");
+17 -12
drivers/clk/clk-composite.c
··· 27 27 const struct clk_ops *mux_ops = composite->mux_ops; 28 28 struct clk_hw *mux_hw = composite->mux_hw; 29 29 30 - mux_hw->clk = hw->clk; 30 + __clk_hw_set_clk(mux_hw, hw); 31 31 32 32 return mux_ops->get_parent(mux_hw); 33 33 } ··· 38 38 const struct clk_ops *mux_ops = composite->mux_ops; 39 39 struct clk_hw *mux_hw = composite->mux_hw; 40 40 41 - mux_hw->clk = hw->clk; 41 + __clk_hw_set_clk(mux_hw, hw); 42 42 43 43 return mux_ops->set_parent(mux_hw, index); 44 44 } ··· 50 50 const struct clk_ops *rate_ops = composite->rate_ops; 51 51 struct clk_hw *rate_hw = composite->rate_hw; 52 52 53 - rate_hw->clk = hw->clk; 53 + __clk_hw_set_clk(rate_hw, hw); 54 54 55 55 return rate_ops->recalc_rate(rate_hw, parent_rate); 56 56 } 57 57 58 58 static long clk_composite_determine_rate(struct clk_hw *hw, unsigned long rate, 59 + unsigned long min_rate, 60 + unsigned long max_rate, 59 61 unsigned long *best_parent_rate, 60 62 struct clk_hw **best_parent_p) 61 63 { ··· 74 72 int i; 75 73 76 74 if (rate_hw && rate_ops && rate_ops->determine_rate) { 77 - rate_hw->clk = hw->clk; 78 - return rate_ops->determine_rate(rate_hw, rate, best_parent_rate, 75 + __clk_hw_set_clk(rate_hw, hw); 76 + return rate_ops->determine_rate(rate_hw, rate, min_rate, 77 + max_rate, 78 + best_parent_rate, 79 79 best_parent_p); 80 80 } else if (rate_hw && rate_ops && rate_ops->round_rate && 81 81 mux_hw && mux_ops && mux_ops->set_parent) { ··· 120 116 121 117 return best_rate; 122 118 } else if (mux_hw && mux_ops && mux_ops->determine_rate) { 123 - mux_hw->clk = hw->clk; 124 - return mux_ops->determine_rate(mux_hw, rate, best_parent_rate, 119 + __clk_hw_set_clk(mux_hw, hw); 120 + return mux_ops->determine_rate(mux_hw, rate, min_rate, 121 + max_rate, best_parent_rate, 125 122 best_parent_p); 126 123 } else { 127 124 pr_err("clk: clk_composite_determine_rate function called, but no mux or rate callback set!\n"); ··· 137 132 const struct clk_ops *rate_ops = composite->rate_ops; 138 133 struct clk_hw *rate_hw = composite->rate_hw; 139 134 140 - rate_hw->clk = hw->clk; 135 + __clk_hw_set_clk(rate_hw, hw); 141 136 142 137 return rate_ops->round_rate(rate_hw, rate, prate); 143 138 } ··· 149 144 const struct clk_ops *rate_ops = composite->rate_ops; 150 145 struct clk_hw *rate_hw = composite->rate_hw; 151 146 152 - rate_hw->clk = hw->clk; 147 + __clk_hw_set_clk(rate_hw, hw); 153 148 154 149 return rate_ops->set_rate(rate_hw, rate, parent_rate); 155 150 } ··· 160 155 const struct clk_ops *gate_ops = composite->gate_ops; 161 156 struct clk_hw *gate_hw = composite->gate_hw; 162 157 163 - gate_hw->clk = hw->clk; 158 + __clk_hw_set_clk(gate_hw, hw); 164 159 165 160 return gate_ops->is_enabled(gate_hw); 166 161 } ··· 171 166 const struct clk_ops *gate_ops = composite->gate_ops; 172 167 struct clk_hw *gate_hw = composite->gate_hw; 173 168 174 - gate_hw->clk = hw->clk; 169 + __clk_hw_set_clk(gate_hw, hw); 175 170 176 171 return gate_ops->enable(gate_hw); 177 172 } ··· 182 177 const struct clk_ops *gate_ops = composite->gate_ops; 183 178 struct clk_hw *gate_hw = composite->gate_hw; 184 179 185 - gate_hw->clk = hw->clk; 180 + __clk_hw_set_clk(gate_hw, hw); 186 181 187 182 gate_ops->disable(gate_hw); 188 183 }
+146 -86
drivers/clk/clk-divider.c
··· 30 30 31 31 #define to_clk_divider(_hw) container_of(_hw, struct clk_divider, hw) 32 32 33 - #define div_mask(d) ((1 << ((d)->width)) - 1) 33 + #define div_mask(width) ((1 << (width)) - 1) 34 34 35 35 static unsigned int _get_table_maxdiv(const struct clk_div_table *table) 36 36 { ··· 54 54 return mindiv; 55 55 } 56 56 57 - static unsigned int _get_maxdiv(struct clk_divider *divider) 57 + static unsigned int _get_maxdiv(const struct clk_div_table *table, u8 width, 58 + unsigned long flags) 58 59 { 59 - if (divider->flags & CLK_DIVIDER_ONE_BASED) 60 - return div_mask(divider); 61 - if (divider->flags & CLK_DIVIDER_POWER_OF_TWO) 62 - return 1 << div_mask(divider); 63 - if (divider->table) 64 - return _get_table_maxdiv(divider->table); 65 - return div_mask(divider) + 1; 60 + if (flags & CLK_DIVIDER_ONE_BASED) 61 + return div_mask(width); 62 + if (flags & CLK_DIVIDER_POWER_OF_TWO) 63 + return 1 << div_mask(width); 64 + if (table) 65 + return _get_table_maxdiv(table); 66 + return div_mask(width) + 1; 66 67 } 67 68 68 69 static unsigned int _get_table_div(const struct clk_div_table *table, ··· 77 76 return 0; 78 77 } 79 78 80 - static unsigned int _get_div(struct clk_divider *divider, unsigned int val) 79 + static unsigned int _get_div(const struct clk_div_table *table, 80 + unsigned int val, unsigned long flags) 81 81 { 82 - if (divider->flags & CLK_DIVIDER_ONE_BASED) 82 + if (flags & CLK_DIVIDER_ONE_BASED) 83 83 return val; 84 - if (divider->flags & CLK_DIVIDER_POWER_OF_TWO) 84 + if (flags & CLK_DIVIDER_POWER_OF_TWO) 85 85 return 1 << val; 86 - if (divider->table) 87 - return _get_table_div(divider->table, val); 86 + if (table) 87 + return _get_table_div(table, val); 88 88 return val + 1; 89 89 } 90 90 ··· 100 98 return 0; 101 99 } 102 100 103 - static unsigned int _get_val(struct clk_divider *divider, unsigned int div) 101 + static unsigned int _get_val(const struct clk_div_table *table, 102 + unsigned int div, unsigned long flags) 104 103 { 105 - if (divider->flags & CLK_DIVIDER_ONE_BASED) 104 + if (flags & CLK_DIVIDER_ONE_BASED) 106 105 return div; 107 - if (divider->flags & CLK_DIVIDER_POWER_OF_TWO) 106 + if (flags & CLK_DIVIDER_POWER_OF_TWO) 108 107 return __ffs(div); 109 - if (divider->table) 110 - return _get_table_val(divider->table, div); 108 + if (table) 109 + return _get_table_val(table, div); 111 110 return div - 1; 112 111 } 113 112 114 - static unsigned long clk_divider_recalc_rate(struct clk_hw *hw, 115 - unsigned long parent_rate) 113 + unsigned long divider_recalc_rate(struct clk_hw *hw, unsigned long parent_rate, 114 + unsigned int val, 115 + const struct clk_div_table *table, 116 + unsigned long flags) 116 117 { 117 - struct clk_divider *divider = to_clk_divider(hw); 118 - unsigned int div, val; 118 + unsigned int div; 119 119 120 - val = clk_readl(divider->reg) >> divider->shift; 121 - val &= div_mask(divider); 122 - 123 - div = _get_div(divider, val); 120 + div = _get_div(table, val, flags); 124 121 if (!div) { 125 - WARN(!(divider->flags & CLK_DIVIDER_ALLOW_ZERO), 122 + WARN(!(flags & CLK_DIVIDER_ALLOW_ZERO), 126 123 "%s: Zero divisor and CLK_DIVIDER_ALLOW_ZERO not set\n", 127 124 __clk_get_name(hw->clk)); 128 125 return parent_rate; 129 126 } 130 127 131 128 return DIV_ROUND_UP(parent_rate, div); 129 + } 130 + EXPORT_SYMBOL_GPL(divider_recalc_rate); 131 + 132 + static unsigned long clk_divider_recalc_rate(struct clk_hw *hw, 133 + unsigned long parent_rate) 134 + { 135 + struct clk_divider *divider = to_clk_divider(hw); 136 + unsigned int val; 137 + 138 + val = clk_readl(divider->reg) >> divider->shift; 139 + val &= div_mask(divider->width); 140 + 141 + return divider_recalc_rate(hw, parent_rate, val, divider->table, 142 + divider->flags); 132 143 } 133 144 134 145 /* ··· 161 146 return false; 162 147 } 163 148 164 - static bool _is_valid_div(struct clk_divider *divider, unsigned int div) 149 + static bool _is_valid_div(const struct clk_div_table *table, unsigned int div, 150 + unsigned long flags) 165 151 { 166 - if (divider->flags & CLK_DIVIDER_POWER_OF_TWO) 152 + if (flags & CLK_DIVIDER_POWER_OF_TWO) 167 153 return is_power_of_2(div); 168 - if (divider->table) 169 - return _is_valid_table_div(divider->table, div); 154 + if (table) 155 + return _is_valid_table_div(table, div); 170 156 return true; 171 157 } 172 158 ··· 207 191 return down; 208 192 } 209 193 210 - static int _div_round_up(struct clk_divider *divider, 211 - unsigned long parent_rate, unsigned long rate) 194 + static int _div_round_up(const struct clk_div_table *table, 195 + unsigned long parent_rate, unsigned long rate, 196 + unsigned long flags) 212 197 { 213 198 int div = DIV_ROUND_UP(parent_rate, rate); 214 199 215 - if (divider->flags & CLK_DIVIDER_POWER_OF_TWO) 200 + if (flags & CLK_DIVIDER_POWER_OF_TWO) 216 201 div = __roundup_pow_of_two(div); 217 - if (divider->table) 218 - div = _round_up_table(divider->table, div); 202 + if (table) 203 + div = _round_up_table(table, div); 219 204 220 205 return div; 221 206 } 222 207 223 - static int _div_round_closest(struct clk_divider *divider, 224 - unsigned long parent_rate, unsigned long rate) 208 + static int _div_round_closest(const struct clk_div_table *table, 209 + unsigned long parent_rate, unsigned long rate, 210 + unsigned long flags) 225 211 { 226 212 int up, down, div; 227 213 228 214 up = down = div = DIV_ROUND_CLOSEST(parent_rate, rate); 229 215 230 - if (divider->flags & CLK_DIVIDER_POWER_OF_TWO) { 216 + if (flags & CLK_DIVIDER_POWER_OF_TWO) { 231 217 up = __roundup_pow_of_two(div); 232 218 down = __rounddown_pow_of_two(div); 233 - } else if (divider->table) { 234 - up = _round_up_table(divider->table, div); 235 - down = _round_down_table(divider->table, div); 219 + } else if (table) { 220 + up = _round_up_table(table, div); 221 + down = _round_down_table(table, div); 236 222 } 237 223 238 224 return (up - div) <= (div - down) ? up : down; 239 225 } 240 226 241 - static int _div_round(struct clk_divider *divider, unsigned long parent_rate, 242 - unsigned long rate) 227 + static int _div_round(const struct clk_div_table *table, 228 + unsigned long parent_rate, unsigned long rate, 229 + unsigned long flags) 243 230 { 244 - if (divider->flags & CLK_DIVIDER_ROUND_CLOSEST) 245 - return _div_round_closest(divider, parent_rate, rate); 231 + if (flags & CLK_DIVIDER_ROUND_CLOSEST) 232 + return _div_round_closest(table, parent_rate, rate, flags); 246 233 247 - return _div_round_up(divider, parent_rate, rate); 234 + return _div_round_up(table, parent_rate, rate, flags); 248 235 } 249 236 250 - static bool _is_best_div(struct clk_divider *divider, 251 - unsigned long rate, unsigned long now, unsigned long best) 237 + static bool _is_best_div(unsigned long rate, unsigned long now, 238 + unsigned long best, unsigned long flags) 252 239 { 253 - if (divider->flags & CLK_DIVIDER_ROUND_CLOSEST) 240 + if (flags & CLK_DIVIDER_ROUND_CLOSEST) 254 241 return abs(rate - now) < abs(rate - best); 255 242 256 243 return now <= rate && now > best; 257 244 } 258 245 259 - static int _next_div(struct clk_divider *divider, int div) 246 + static int _next_div(const struct clk_div_table *table, int div, 247 + unsigned long flags) 260 248 { 261 249 div++; 262 250 263 - if (divider->flags & CLK_DIVIDER_POWER_OF_TWO) 251 + if (flags & CLK_DIVIDER_POWER_OF_TWO) 264 252 return __roundup_pow_of_two(div); 265 - if (divider->table) 266 - return _round_up_table(divider->table, div); 253 + if (table) 254 + return _round_up_table(table, div); 267 255 268 256 return div; 269 257 } 270 258 271 259 static int clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate, 272 - unsigned long *best_parent_rate) 260 + unsigned long *best_parent_rate, 261 + const struct clk_div_table *table, u8 width, 262 + unsigned long flags) 273 263 { 274 - struct clk_divider *divider = to_clk_divider(hw); 275 264 int i, bestdiv = 0; 276 265 unsigned long parent_rate, best = 0, now, maxdiv; 277 266 unsigned long parent_rate_saved = *best_parent_rate; ··· 284 263 if (!rate) 285 264 rate = 1; 286 265 287 - /* if read only, just return current value */ 288 - if (divider->flags & CLK_DIVIDER_READ_ONLY) { 289 - bestdiv = readl(divider->reg) >> divider->shift; 290 - bestdiv &= div_mask(divider); 291 - bestdiv = _get_div(divider, bestdiv); 292 - return bestdiv; 293 - } 294 - 295 - maxdiv = _get_maxdiv(divider); 266 + maxdiv = _get_maxdiv(table, width, flags); 296 267 297 268 if (!(__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT)) { 298 269 parent_rate = *best_parent_rate; 299 - bestdiv = _div_round(divider, parent_rate, rate); 270 + bestdiv = _div_round(table, parent_rate, rate, flags); 300 271 bestdiv = bestdiv == 0 ? 1 : bestdiv; 301 272 bestdiv = bestdiv > maxdiv ? maxdiv : bestdiv; 302 273 return bestdiv; ··· 300 287 */ 301 288 maxdiv = min(ULONG_MAX / rate, maxdiv); 302 289 303 - for (i = 1; i <= maxdiv; i = _next_div(divider, i)) { 304 - if (!_is_valid_div(divider, i)) 290 + for (i = 1; i <= maxdiv; i = _next_div(table, i, flags)) { 291 + if (!_is_valid_div(table, i, flags)) 305 292 continue; 306 293 if (rate * i == parent_rate_saved) { 307 294 /* ··· 315 302 parent_rate = __clk_round_rate(__clk_get_parent(hw->clk), 316 303 MULT_ROUND_UP(rate, i)); 317 304 now = DIV_ROUND_UP(parent_rate, i); 318 - if (_is_best_div(divider, rate, now, best)) { 305 + if (_is_best_div(rate, now, best, flags)) { 319 306 bestdiv = i; 320 307 best = now; 321 308 *best_parent_rate = parent_rate; ··· 323 310 } 324 311 325 312 if (!bestdiv) { 326 - bestdiv = _get_maxdiv(divider); 313 + bestdiv = _get_maxdiv(table, width, flags); 327 314 *best_parent_rate = __clk_round_rate(__clk_get_parent(hw->clk), 1); 328 315 } 329 316 330 317 return bestdiv; 331 318 } 332 319 333 - static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate, 334 - unsigned long *prate) 320 + long divider_round_rate(struct clk_hw *hw, unsigned long rate, 321 + unsigned long *prate, const struct clk_div_table *table, 322 + u8 width, unsigned long flags) 335 323 { 336 324 int div; 337 - div = clk_divider_bestdiv(hw, rate, prate); 325 + 326 + div = clk_divider_bestdiv(hw, rate, prate, table, width, flags); 338 327 339 328 return DIV_ROUND_UP(*prate, div); 340 329 } 330 + EXPORT_SYMBOL_GPL(divider_round_rate); 331 + 332 + static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate, 333 + unsigned long *prate) 334 + { 335 + struct clk_divider *divider = to_clk_divider(hw); 336 + int bestdiv; 337 + 338 + /* if read only, just return current value */ 339 + if (divider->flags & CLK_DIVIDER_READ_ONLY) { 340 + bestdiv = readl(divider->reg) >> divider->shift; 341 + bestdiv &= div_mask(divider->width); 342 + bestdiv = _get_div(divider->table, bestdiv, divider->flags); 343 + return bestdiv; 344 + } 345 + 346 + return divider_round_rate(hw, rate, prate, divider->table, 347 + divider->width, divider->flags); 348 + } 349 + 350 + int divider_get_val(unsigned long rate, unsigned long parent_rate, 351 + const struct clk_div_table *table, u8 width, 352 + unsigned long flags) 353 + { 354 + unsigned int div, value; 355 + 356 + div = DIV_ROUND_UP(parent_rate, rate); 357 + 358 + if (!_is_valid_div(table, div, flags)) 359 + return -EINVAL; 360 + 361 + value = _get_val(table, div, flags); 362 + 363 + return min_t(unsigned int, value, div_mask(width)); 364 + } 365 + EXPORT_SYMBOL_GPL(divider_get_val); 341 366 342 367 static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, 343 368 unsigned long parent_rate) 344 369 { 345 370 struct clk_divider *divider = to_clk_divider(hw); 346 - unsigned int div, value; 371 + unsigned int value; 347 372 unsigned long flags = 0; 348 373 u32 val; 349 374 350 - div = DIV_ROUND_UP(parent_rate, rate); 351 - 352 - if (!_is_valid_div(divider, div)) 353 - return -EINVAL; 354 - 355 - value = _get_val(divider, div); 356 - 357 - if (value > div_mask(divider)) 358 - value = div_mask(divider); 375 + value = divider_get_val(rate, parent_rate, divider->table, 376 + divider->width, divider->flags); 359 377 360 378 if (divider->lock) 361 379 spin_lock_irqsave(divider->lock, flags); 362 380 363 381 if (divider->flags & CLK_DIVIDER_HIWORD_MASK) { 364 - val = div_mask(divider) << (divider->shift + 16); 382 + val = div_mask(divider->width) << (divider->shift + 16); 365 383 } else { 366 384 val = clk_readl(divider->reg); 367 - val &= ~(div_mask(divider) << divider->shift); 385 + val &= ~(div_mask(divider->width) << divider->shift); 368 386 } 369 387 val |= value << divider->shift; 370 388 clk_writel(val, divider->reg); ··· 507 463 width, clk_divider_flags, table, lock); 508 464 } 509 465 EXPORT_SYMBOL_GPL(clk_register_divider_table); 466 + 467 + void clk_unregister_divider(struct clk *clk) 468 + { 469 + struct clk_divider *div; 470 + struct clk_hw *hw; 471 + 472 + hw = __clk_get_hw(clk); 473 + if (!hw) 474 + return; 475 + 476 + div = to_clk_divider(hw); 477 + 478 + clk_unregister(clk); 479 + kfree(div); 480 + } 481 + EXPORT_SYMBOL_GPL(clk_unregister_divider);
+17 -1
drivers/clk/clk-gate.c
··· 128 128 struct clk_init_data init; 129 129 130 130 if (clk_gate_flags & CLK_GATE_HIWORD_MASK) { 131 - if (bit_idx > 16) { 131 + if (bit_idx > 15) { 132 132 pr_err("gate bit exceeds LOWORD field\n"); 133 133 return ERR_PTR(-EINVAL); 134 134 } ··· 162 162 return clk; 163 163 } 164 164 EXPORT_SYMBOL_GPL(clk_register_gate); 165 + 166 + void clk_unregister_gate(struct clk *clk) 167 + { 168 + struct clk_gate *gate; 169 + struct clk_hw *hw; 170 + 171 + hw = __clk_get_hw(clk); 172 + if (!hw) 173 + return; 174 + 175 + gate = to_clk_gate(hw); 176 + 177 + clk_unregister(clk); 178 + kfree(gate); 179 + } 180 + EXPORT_SYMBOL_GPL(clk_unregister_gate);
+16
drivers/clk/clk-mux.c
··· 177 177 NULL, lock); 178 178 } 179 179 EXPORT_SYMBOL_GPL(clk_register_mux); 180 + 181 + void clk_unregister_mux(struct clk *clk) 182 + { 183 + struct clk_mux *mux; 184 + struct clk_hw *hw; 185 + 186 + hw = __clk_get_hw(clk); 187 + if (!hw) 188 + return; 189 + 190 + mux = to_clk_mux(hw); 191 + 192 + clk_unregister(clk); 193 + kfree(mux); 194 + } 195 + EXPORT_SYMBOL_GPL(clk_unregister_mux);
+119 -63
drivers/clk/clk-ppc-corenet.c drivers/clk/clk-qoriq.c
··· 5 5 * it under the terms of the GNU General Public License version 2 as 6 6 * published by the Free Software Foundation. 7 7 * 8 - * clock driver for Freescale PowerPC corenet SoCs. 8 + * clock driver for Freescale QorIQ SoCs. 9 9 */ 10 + 11 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 12 + 10 13 #include <linux/clk-provider.h> 11 14 #include <linux/io.h> 12 15 #include <linux/kernel.h> ··· 22 19 struct cmux_clk { 23 20 struct clk_hw hw; 24 21 void __iomem *reg; 22 + unsigned int clk_per_pll; 25 23 u32 flags; 26 24 }; 27 25 ··· 31 27 #define CLKSEL_ADJUST BIT(0) 32 28 #define to_cmux_clk(p) container_of(p, struct cmux_clk, hw) 33 29 34 - static unsigned int clocks_per_pll; 35 - 36 30 static int cmux_set_parent(struct clk_hw *hw, u8 idx) 37 31 { 38 32 struct cmux_clk *clk = to_cmux_clk(hw); 39 33 u32 clksel; 40 34 41 - clksel = ((idx / clocks_per_pll) << 2) + idx % clocks_per_pll; 35 + clksel = ((idx / clk->clk_per_pll) << 2) + idx % clk->clk_per_pll; 42 36 if (clk->flags & CLKSEL_ADJUST) 43 37 clksel += 8; 44 38 clksel = (clksel & 0xf) << CLKSEL_SHIFT; ··· 54 52 clksel = (clksel >> CLKSEL_SHIFT) & 0xf; 55 53 if (clk->flags & CLKSEL_ADJUST) 56 54 clksel -= 8; 57 - clksel = (clksel >> 2) * clocks_per_pll + clksel % 4; 55 + clksel = (clksel >> 2) * clk->clk_per_pll + clksel % 4; 58 56 59 57 return clksel; 60 58 } 61 59 62 - const struct clk_ops cmux_ops = { 60 + static const struct clk_ops cmux_ops = { 63 61 .get_parent = cmux_get_parent, 64 62 .set_parent = cmux_set_parent, 65 63 }; ··· 74 72 u32 offset; 75 73 const char *clk_name; 76 74 const char **parent_names; 75 + struct of_phandle_args clkspec; 77 76 78 77 rc = of_property_read_u32(np, "reg", &offset); 79 78 if (rc) { ··· 88 85 pr_err("%s: get clock count error\n", np->name); 89 86 return; 90 87 } 91 - parent_names = kzalloc((sizeof(char *) * count), GFP_KERNEL); 92 - if (!parent_names) { 93 - pr_err("%s: could not allocate parent_names\n", __func__); 88 + parent_names = kcalloc(count, sizeof(char *), GFP_KERNEL); 89 + if (!parent_names) 94 90 return; 95 - } 96 91 97 92 for (i = 0; i < count; i++) 98 93 parent_names[i] = of_clk_get_parent_name(np, i); 99 94 100 - cmux_clk = kzalloc(sizeof(struct cmux_clk), GFP_KERNEL); 101 - if (!cmux_clk) { 102 - pr_err("%s: could not allocate cmux_clk\n", __func__); 95 + cmux_clk = kzalloc(sizeof(*cmux_clk), GFP_KERNEL); 96 + if (!cmux_clk) 103 97 goto err_name; 104 - } 98 + 105 99 cmux_clk->reg = of_iomap(np, 0); 106 100 if (!cmux_clk->reg) { 107 101 pr_err("%s: could not map register\n", __func__); 108 102 goto err_clk; 109 103 } 110 104 105 + rc = of_parse_phandle_with_args(np, "clocks", "#clock-cells", 0, 106 + &clkspec); 107 + if (rc) { 108 + pr_err("%s: parse clock node error\n", __func__); 109 + goto err_clk; 110 + } 111 + 112 + cmux_clk->clk_per_pll = of_property_count_strings(clkspec.np, 113 + "clock-output-names"); 114 + of_node_put(clkspec.np); 115 + 111 116 node = of_find_compatible_node(NULL, NULL, "fsl,p4080-clockgen"); 112 117 if (node && (offset >= 0x80)) 113 118 cmux_clk->flags = CLKSEL_ADJUST; 114 119 115 120 rc = of_property_read_string_index(np, "clock-output-names", 116 - 0, &clk_name); 121 + 0, &clk_name); 117 122 if (rc) { 118 123 pr_err("%s: read clock names error\n", np->name); 119 124 goto err_clk; ··· 143 132 rc = of_clk_add_provider(np, of_clk_src_simple_get, clk); 144 133 if (rc) { 145 134 pr_err("Could not register clock provider for node:%s\n", 146 - np->name); 135 + np->name); 147 136 goto err_clk; 148 137 } 149 138 goto err_name; ··· 166 155 167 156 base = of_iomap(np, 0); 168 157 if (!base) { 169 - pr_err("clk-ppc: iomap error\n"); 158 + pr_err("iomap error\n"); 170 159 return; 171 160 } 172 161 ··· 192 181 goto err_map; 193 182 } 194 183 195 - /* output clock number per PLL */ 196 - clocks_per_pll = count; 197 - 198 - subclks = kzalloc(sizeof(struct clk *) * count, GFP_KERNEL); 199 - if (!subclks) { 200 - pr_err("%s: could not allocate subclks\n", __func__); 184 + subclks = kcalloc(count, sizeof(struct clk *), GFP_KERNEL); 185 + if (!subclks) 201 186 goto err_map; 202 - } 203 187 204 - onecell_data = kzalloc(sizeof(struct clk_onecell_data), GFP_KERNEL); 205 - if (!onecell_data) { 206 - pr_err("%s: could not allocate onecell_data\n", __func__); 188 + onecell_data = kmalloc(sizeof(*onecell_data), GFP_KERNEL); 189 + if (!onecell_data) 207 190 goto err_clks; 208 - } 209 191 210 192 for (i = 0; i < count; i++) { 211 193 rc = of_property_read_string_index(np, "clock-output-names", 212 - i, &clk_name); 194 + i, &clk_name); 213 195 if (rc) { 214 196 pr_err("%s: could not get clock names\n", np->name); 215 197 goto err_cell; ··· 234 230 rc = of_clk_add_provider(np, of_clk_src_onecell_get, onecell_data); 235 231 if (rc) { 236 232 pr_err("Could not register clk provider for node:%s\n", 237 - np->name); 233 + np->name); 238 234 goto err_cell; 239 235 } 240 236 ··· 256 252 u32 rate; 257 253 258 254 if (!np) { 259 - pr_err("ppc-clk: could not get parent node\n"); 255 + pr_err("could not get parent node\n"); 260 256 return; 261 257 } 262 258 ··· 272 268 of_clk_add_provider(np, of_clk_src_simple_get, clk); 273 269 } 274 270 275 - static const struct of_device_id clk_match[] __initconst = { 276 - { .compatible = "fsl,qoriq-sysclk-1.0", .data = sysclk_init, }, 277 - { .compatible = "fsl,qoriq-sysclk-2.0", .data = sysclk_init, }, 278 - { .compatible = "fsl,qoriq-core-pll-1.0", .data = core_pll_init, }, 279 - { .compatible = "fsl,qoriq-core-pll-2.0", .data = core_pll_init, }, 280 - { .compatible = "fsl,qoriq-core-mux-1.0", .data = core_mux_init, }, 281 - { .compatible = "fsl,qoriq-core-mux-2.0", .data = core_mux_init, }, 282 - {} 283 - }; 284 - 285 - static int __init ppc_corenet_clk_probe(struct platform_device *pdev) 271 + static void __init pltfrm_pll_init(struct device_node *np) 286 272 { 287 - of_clk_init(clk_match); 273 + void __iomem *base; 274 + uint32_t mult; 275 + const char *parent_name, *clk_name; 276 + int i, _errno; 277 + struct clk_onecell_data *cod; 288 278 289 - return 0; 279 + base = of_iomap(np, 0); 280 + if (!base) { 281 + pr_err("%s(): %s: of_iomap() failed\n", __func__, np->name); 282 + return; 283 + } 284 + 285 + /* Get the multiple of PLL */ 286 + mult = ioread32be(base); 287 + 288 + iounmap(base); 289 + 290 + /* Check if this PLL is disabled */ 291 + if (mult & PLL_KILL) { 292 + pr_debug("%s(): %s: Disabled\n", __func__, np->name); 293 + return; 294 + } 295 + mult = (mult & GENMASK(6, 1)) >> 1; 296 + 297 + parent_name = of_clk_get_parent_name(np, 0); 298 + if (!parent_name) { 299 + pr_err("%s(): %s: of_clk_get_parent_name() failed\n", 300 + __func__, np->name); 301 + return; 302 + } 303 + 304 + i = of_property_count_strings(np, "clock-output-names"); 305 + if (i < 0) { 306 + pr_err("%s(): %s: of_property_count_strings(clock-output-names) = %d\n", 307 + __func__, np->name, i); 308 + return; 309 + } 310 + 311 + cod = kmalloc(sizeof(*cod) + i * sizeof(struct clk *), GFP_KERNEL); 312 + if (!cod) 313 + return; 314 + cod->clks = (struct clk **)(cod + 1); 315 + cod->clk_num = i; 316 + 317 + for (i = 0; i < cod->clk_num; i++) { 318 + _errno = of_property_read_string_index(np, "clock-output-names", 319 + i, &clk_name); 320 + if (_errno < 0) { 321 + pr_err("%s(): %s: of_property_read_string_index(clock-output-names) = %d\n", 322 + __func__, np->name, _errno); 323 + goto return_clk_unregister; 324 + } 325 + 326 + cod->clks[i] = clk_register_fixed_factor(NULL, clk_name, 327 + parent_name, 0, mult, 1 + i); 328 + if (IS_ERR(cod->clks[i])) { 329 + pr_err("%s(): %s: clk_register_fixed_factor(%s) = %ld\n", 330 + __func__, np->name, 331 + clk_name, PTR_ERR(cod->clks[i])); 332 + goto return_clk_unregister; 333 + } 334 + } 335 + 336 + _errno = of_clk_add_provider(np, of_clk_src_onecell_get, cod); 337 + if (_errno < 0) { 338 + pr_err("%s(): %s: of_clk_add_provider() = %d\n", 339 + __func__, np->name, _errno); 340 + goto return_clk_unregister; 341 + } 342 + 343 + return; 344 + 345 + return_clk_unregister: 346 + while (--i >= 0) 347 + clk_unregister(cod->clks[i]); 348 + kfree(cod); 290 349 } 291 350 292 - static const struct of_device_id ppc_clk_ids[] __initconst = { 293 - { .compatible = "fsl,qoriq-clockgen-1.0", }, 294 - { .compatible = "fsl,qoriq-clockgen-2.0", }, 295 - {} 296 - }; 297 - 298 - static struct platform_driver ppc_corenet_clk_driver = { 299 - .driver = { 300 - .name = "ppc_corenet_clock", 301 - .of_match_table = ppc_clk_ids, 302 - }, 303 - .probe = ppc_corenet_clk_probe, 304 - }; 305 - 306 - static int __init ppc_corenet_clk_init(void) 307 - { 308 - return platform_driver_register(&ppc_corenet_clk_driver); 309 - } 310 - subsys_initcall(ppc_corenet_clk_init); 351 + CLK_OF_DECLARE(qoriq_sysclk_1, "fsl,qoriq-sysclk-1.0", sysclk_init); 352 + CLK_OF_DECLARE(qoriq_sysclk_2, "fsl,qoriq-sysclk-2.0", sysclk_init); 353 + CLK_OF_DECLARE(qoriq_core_pll_1, "fsl,qoriq-core-pll-1.0", core_pll_init); 354 + CLK_OF_DECLARE(qoriq_core_pll_2, "fsl,qoriq-core-pll-2.0", core_pll_init); 355 + CLK_OF_DECLARE(qoriq_core_mux_1, "fsl,qoriq-core-mux-1.0", core_mux_init); 356 + CLK_OF_DECLARE(qoriq_core_mux_2, "fsl,qoriq-core-mux-2.0", core_mux_init); 357 + CLK_OF_DECLARE(qoriq_pltfrm_pll_1, "fsl,qoriq-platform-pll-1.0", pltfrm_pll_init); 358 + CLK_OF_DECLARE(qoriq_pltfrm_pll_2, "fsl,qoriq-platform-pll-2.0", pltfrm_pll_init);
+710 -309
drivers/clk/clk.c
··· 9 9 * Standard functionality for the common clock API. See Documentation/clk.txt 10 10 */ 11 11 12 - #include <linux/clk-private.h> 12 + #include <linux/clk-provider.h> 13 13 #include <linux/clk/clk-conf.h> 14 14 #include <linux/module.h> 15 15 #include <linux/mutex.h> ··· 36 36 static HLIST_HEAD(clk_root_list); 37 37 static HLIST_HEAD(clk_orphan_list); 38 38 static LIST_HEAD(clk_notifier_list); 39 + 40 + static long clk_core_get_accuracy(struct clk_core *clk); 41 + static unsigned long clk_core_get_rate(struct clk_core *clk); 42 + static int clk_core_get_phase(struct clk_core *clk); 43 + static bool clk_core_is_prepared(struct clk_core *clk); 44 + static bool clk_core_is_enabled(struct clk_core *clk); 45 + static struct clk_core *clk_core_lookup(const char *name); 46 + 47 + /*** private data structures ***/ 48 + 49 + struct clk_core { 50 + const char *name; 51 + const struct clk_ops *ops; 52 + struct clk_hw *hw; 53 + struct module *owner; 54 + struct clk_core *parent; 55 + const char **parent_names; 56 + struct clk_core **parents; 57 + u8 num_parents; 58 + u8 new_parent_index; 59 + unsigned long rate; 60 + unsigned long req_rate; 61 + unsigned long new_rate; 62 + struct clk_core *new_parent; 63 + struct clk_core *new_child; 64 + unsigned long flags; 65 + unsigned int enable_count; 66 + unsigned int prepare_count; 67 + unsigned long accuracy; 68 + int phase; 69 + struct hlist_head children; 70 + struct hlist_node child_node; 71 + struct hlist_node debug_node; 72 + struct hlist_head clks; 73 + unsigned int notifier_count; 74 + #ifdef CONFIG_DEBUG_FS 75 + struct dentry *dentry; 76 + #endif 77 + struct kref ref; 78 + }; 79 + 80 + struct clk { 81 + struct clk_core *core; 82 + const char *dev_id; 83 + const char *con_id; 84 + unsigned long min_rate; 85 + unsigned long max_rate; 86 + struct hlist_node child_node; 87 + }; 39 88 40 89 /*** locking ***/ 41 90 static void clk_prepare_lock(void) ··· 163 114 NULL, 164 115 }; 165 116 166 - static void clk_summary_show_one(struct seq_file *s, struct clk *c, int level) 117 + static void clk_summary_show_one(struct seq_file *s, struct clk_core *c, 118 + int level) 167 119 { 168 120 if (!c) 169 121 return; ··· 172 122 seq_printf(s, "%*s%-*s %11d %12d %11lu %10lu %-3d\n", 173 123 level * 3 + 1, "", 174 124 30 - level * 3, c->name, 175 - c->enable_count, c->prepare_count, clk_get_rate(c), 176 - clk_get_accuracy(c), clk_get_phase(c)); 125 + c->enable_count, c->prepare_count, clk_core_get_rate(c), 126 + clk_core_get_accuracy(c), clk_core_get_phase(c)); 177 127 } 178 128 179 - static void clk_summary_show_subtree(struct seq_file *s, struct clk *c, 129 + static void clk_summary_show_subtree(struct seq_file *s, struct clk_core *c, 180 130 int level) 181 131 { 182 - struct clk *child; 132 + struct clk_core *child; 183 133 184 134 if (!c) 185 135 return; ··· 192 142 193 143 static int clk_summary_show(struct seq_file *s, void *data) 194 144 { 195 - struct clk *c; 145 + struct clk_core *c; 196 146 struct hlist_head **lists = (struct hlist_head **)s->private; 197 147 198 148 seq_puts(s, " clock enable_cnt prepare_cnt rate accuracy phase\n"); ··· 222 172 .release = single_release, 223 173 }; 224 174 225 - static void clk_dump_one(struct seq_file *s, struct clk *c, int level) 175 + static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level) 226 176 { 227 177 if (!c) 228 178 return; ··· 230 180 seq_printf(s, "\"%s\": { ", c->name); 231 181 seq_printf(s, "\"enable_count\": %d,", c->enable_count); 232 182 seq_printf(s, "\"prepare_count\": %d,", c->prepare_count); 233 - seq_printf(s, "\"rate\": %lu", clk_get_rate(c)); 234 - seq_printf(s, "\"accuracy\": %lu", clk_get_accuracy(c)); 235 - seq_printf(s, "\"phase\": %d", clk_get_phase(c)); 183 + seq_printf(s, "\"rate\": %lu", clk_core_get_rate(c)); 184 + seq_printf(s, "\"accuracy\": %lu", clk_core_get_accuracy(c)); 185 + seq_printf(s, "\"phase\": %d", clk_core_get_phase(c)); 236 186 } 237 187 238 - static void clk_dump_subtree(struct seq_file *s, struct clk *c, int level) 188 + static void clk_dump_subtree(struct seq_file *s, struct clk_core *c, int level) 239 189 { 240 - struct clk *child; 190 + struct clk_core *child; 241 191 242 192 if (!c) 243 193 return; ··· 254 204 255 205 static int clk_dump(struct seq_file *s, void *data) 256 206 { 257 - struct clk *c; 207 + struct clk_core *c; 258 208 bool first_node = true; 259 209 struct hlist_head **lists = (struct hlist_head **)s->private; 260 210 ··· 290 240 .release = single_release, 291 241 }; 292 242 293 - static int clk_debug_create_one(struct clk *clk, struct dentry *pdentry) 243 + static int clk_debug_create_one(struct clk_core *clk, struct dentry *pdentry) 294 244 { 295 245 struct dentry *d; 296 246 int ret = -ENOMEM; ··· 365 315 * initialized. Otherwise it bails out early since the debugfs clk tree 366 316 * will be created lazily by clk_debug_init as part of a late_initcall. 367 317 */ 368 - static int clk_debug_register(struct clk *clk) 318 + static int clk_debug_register(struct clk_core *clk) 369 319 { 370 320 int ret = 0; 371 321 ··· 390 340 * debugfs clk tree if clk->dentry points to debugfs created by 391 341 * clk_debug_register in __clk_init. 392 342 */ 393 - static void clk_debug_unregister(struct clk *clk) 343 + static void clk_debug_unregister(struct clk_core *clk) 394 344 { 395 345 mutex_lock(&clk_debug_lock); 396 - if (!clk->dentry) 397 - goto out; 398 - 399 346 hlist_del_init(&clk->debug_node); 400 347 debugfs_remove_recursive(clk->dentry); 401 348 clk->dentry = NULL; 402 - out: 403 349 mutex_unlock(&clk_debug_lock); 404 350 } 405 351 ··· 404 358 { 405 359 struct dentry *d = NULL; 406 360 407 - if (hw->clk->dentry) 408 - d = debugfs_create_file(name, mode, hw->clk->dentry, data, fops); 361 + if (hw->core->dentry) 362 + d = debugfs_create_file(name, mode, hw->core->dentry, data, 363 + fops); 409 364 410 365 return d; 411 366 } ··· 426 379 */ 427 380 static int __init clk_debug_init(void) 428 381 { 429 - struct clk *clk; 382 + struct clk_core *clk; 430 383 struct dentry *d; 431 384 432 385 rootdir = debugfs_create_dir("clk", NULL); ··· 465 418 } 466 419 late_initcall(clk_debug_init); 467 420 #else 468 - static inline int clk_debug_register(struct clk *clk) { return 0; } 469 - static inline void clk_debug_reparent(struct clk *clk, struct clk *new_parent) 421 + static inline int clk_debug_register(struct clk_core *clk) { return 0; } 422 + static inline void clk_debug_reparent(struct clk_core *clk, 423 + struct clk_core *new_parent) 470 424 { 471 425 } 472 - static inline void clk_debug_unregister(struct clk *clk) 426 + static inline void clk_debug_unregister(struct clk_core *clk) 473 427 { 474 428 } 475 429 #endif 476 430 477 431 /* caller must hold prepare_lock */ 478 - static void clk_unprepare_unused_subtree(struct clk *clk) 432 + static void clk_unprepare_unused_subtree(struct clk_core *clk) 479 433 { 480 - struct clk *child; 481 - 482 - if (!clk) 483 - return; 434 + struct clk_core *child; 484 435 485 436 hlist_for_each_entry(child, &clk->children, child_node) 486 437 clk_unprepare_unused_subtree(child); ··· 489 444 if (clk->flags & CLK_IGNORE_UNUSED) 490 445 return; 491 446 492 - if (__clk_is_prepared(clk)) { 447 + if (clk_core_is_prepared(clk)) { 493 448 if (clk->ops->unprepare_unused) 494 449 clk->ops->unprepare_unused(clk->hw); 495 450 else if (clk->ops->unprepare) ··· 498 453 } 499 454 500 455 /* caller must hold prepare_lock */ 501 - static void clk_disable_unused_subtree(struct clk *clk) 456 + static void clk_disable_unused_subtree(struct clk_core *clk) 502 457 { 503 - struct clk *child; 458 + struct clk_core *child; 504 459 unsigned long flags; 505 - 506 - if (!clk) 507 - goto out; 508 460 509 461 hlist_for_each_entry(child, &clk->children, child_node) 510 462 clk_disable_unused_subtree(child); ··· 519 477 * sequence. call .disable_unused if available, otherwise fall 520 478 * back to .disable 521 479 */ 522 - if (__clk_is_enabled(clk)) { 480 + if (clk_core_is_enabled(clk)) { 523 481 if (clk->ops->disable_unused) 524 482 clk->ops->disable_unused(clk->hw); 525 483 else if (clk->ops->disable) ··· 528 486 529 487 unlock_out: 530 488 clk_enable_unlock(flags); 531 - 532 - out: 533 - return; 534 489 } 535 490 536 491 static bool clk_ignore_unused; ··· 540 501 541 502 static int clk_disable_unused(void) 542 503 { 543 - struct clk *clk; 504 + struct clk_core *clk; 544 505 545 506 if (clk_ignore_unused) { 546 507 pr_warn("clk: Not disabling unused clocks\n"); ··· 571 532 572 533 const char *__clk_get_name(struct clk *clk) 573 534 { 574 - return !clk ? NULL : clk->name; 535 + return !clk ? NULL : clk->core->name; 575 536 } 576 537 EXPORT_SYMBOL_GPL(__clk_get_name); 577 538 578 539 struct clk_hw *__clk_get_hw(struct clk *clk) 579 540 { 580 - return !clk ? NULL : clk->hw; 541 + return !clk ? NULL : clk->core->hw; 581 542 } 582 543 EXPORT_SYMBOL_GPL(__clk_get_hw); 583 544 584 545 u8 __clk_get_num_parents(struct clk *clk) 585 546 { 586 - return !clk ? 0 : clk->num_parents; 547 + return !clk ? 0 : clk->core->num_parents; 587 548 } 588 549 EXPORT_SYMBOL_GPL(__clk_get_num_parents); 589 550 590 551 struct clk *__clk_get_parent(struct clk *clk) 591 552 { 592 - return !clk ? NULL : clk->parent; 553 + if (!clk) 554 + return NULL; 555 + 556 + /* TODO: Create a per-user clk and change callers to call clk_put */ 557 + return !clk->core->parent ? NULL : clk->core->parent->hw->clk; 593 558 } 594 559 EXPORT_SYMBOL_GPL(__clk_get_parent); 595 560 596 - struct clk *clk_get_parent_by_index(struct clk *clk, u8 index) 561 + static struct clk_core *clk_core_get_parent_by_index(struct clk_core *clk, 562 + u8 index) 597 563 { 598 564 if (!clk || index >= clk->num_parents) 599 565 return NULL; 600 566 else if (!clk->parents) 601 - return __clk_lookup(clk->parent_names[index]); 567 + return clk_core_lookup(clk->parent_names[index]); 602 568 else if (!clk->parents[index]) 603 569 return clk->parents[index] = 604 - __clk_lookup(clk->parent_names[index]); 570 + clk_core_lookup(clk->parent_names[index]); 605 571 else 606 572 return clk->parents[index]; 573 + } 574 + 575 + struct clk *clk_get_parent_by_index(struct clk *clk, u8 index) 576 + { 577 + struct clk_core *parent; 578 + 579 + if (!clk) 580 + return NULL; 581 + 582 + parent = clk_core_get_parent_by_index(clk->core, index); 583 + 584 + return !parent ? NULL : parent->hw->clk; 607 585 } 608 586 EXPORT_SYMBOL_GPL(clk_get_parent_by_index); 609 587 610 588 unsigned int __clk_get_enable_count(struct clk *clk) 611 589 { 612 - return !clk ? 0 : clk->enable_count; 590 + return !clk ? 0 : clk->core->enable_count; 613 591 } 614 592 615 - unsigned long __clk_get_rate(struct clk *clk) 593 + static unsigned long clk_core_get_rate_nolock(struct clk_core *clk) 616 594 { 617 595 unsigned long ret; 618 596 ··· 649 593 out: 650 594 return ret; 651 595 } 596 + 597 + unsigned long __clk_get_rate(struct clk *clk) 598 + { 599 + if (!clk) 600 + return 0; 601 + 602 + return clk_core_get_rate_nolock(clk->core); 603 + } 652 604 EXPORT_SYMBOL_GPL(__clk_get_rate); 653 605 654 - static unsigned long __clk_get_accuracy(struct clk *clk) 606 + static unsigned long __clk_get_accuracy(struct clk_core *clk) 655 607 { 656 608 if (!clk) 657 609 return 0; ··· 669 605 670 606 unsigned long __clk_get_flags(struct clk *clk) 671 607 { 672 - return !clk ? 0 : clk->flags; 608 + return !clk ? 0 : clk->core->flags; 673 609 } 674 610 EXPORT_SYMBOL_GPL(__clk_get_flags); 675 611 676 - bool __clk_is_prepared(struct clk *clk) 612 + static bool clk_core_is_prepared(struct clk_core *clk) 677 613 { 678 614 int ret; 679 615 ··· 694 630 return !!ret; 695 631 } 696 632 697 - bool __clk_is_enabled(struct clk *clk) 633 + bool __clk_is_prepared(struct clk *clk) 634 + { 635 + if (!clk) 636 + return false; 637 + 638 + return clk_core_is_prepared(clk->core); 639 + } 640 + 641 + static bool clk_core_is_enabled(struct clk_core *clk) 698 642 { 699 643 int ret; 700 644 ··· 722 650 out: 723 651 return !!ret; 724 652 } 653 + 654 + bool __clk_is_enabled(struct clk *clk) 655 + { 656 + if (!clk) 657 + return false; 658 + 659 + return clk_core_is_enabled(clk->core); 660 + } 725 661 EXPORT_SYMBOL_GPL(__clk_is_enabled); 726 662 727 - static struct clk *__clk_lookup_subtree(const char *name, struct clk *clk) 663 + static struct clk_core *__clk_lookup_subtree(const char *name, 664 + struct clk_core *clk) 728 665 { 729 - struct clk *child; 730 - struct clk *ret; 666 + struct clk_core *child; 667 + struct clk_core *ret; 731 668 732 669 if (!strcmp(clk->name, name)) 733 670 return clk; ··· 750 669 return NULL; 751 670 } 752 671 753 - struct clk *__clk_lookup(const char *name) 672 + static struct clk_core *clk_core_lookup(const char *name) 754 673 { 755 - struct clk *root_clk; 756 - struct clk *ret; 674 + struct clk_core *root_clk; 675 + struct clk_core *ret; 757 676 758 677 if (!name) 759 678 return NULL; ··· 775 694 return NULL; 776 695 } 777 696 778 - /* 779 - * Helper for finding best parent to provide a given frequency. This can be used 780 - * directly as a determine_rate callback (e.g. for a mux), or from a more 781 - * complex clock that may combine a mux with other operations. 782 - */ 783 - long __clk_mux_determine_rate(struct clk_hw *hw, unsigned long rate, 784 - unsigned long *best_parent_rate, 785 - struct clk_hw **best_parent_p) 697 + static bool mux_is_better_rate(unsigned long rate, unsigned long now, 698 + unsigned long best, unsigned long flags) 786 699 { 787 - struct clk *clk = hw->clk, *parent, *best_parent = NULL; 700 + if (flags & CLK_MUX_ROUND_CLOSEST) 701 + return abs(now - rate) < abs(best - rate); 702 + 703 + return now <= rate && now > best; 704 + } 705 + 706 + static long 707 + clk_mux_determine_rate_flags(struct clk_hw *hw, unsigned long rate, 708 + unsigned long min_rate, 709 + unsigned long max_rate, 710 + unsigned long *best_parent_rate, 711 + struct clk_hw **best_parent_p, 712 + unsigned long flags) 713 + { 714 + struct clk_core *core = hw->core, *parent, *best_parent = NULL; 788 715 int i, num_parents; 789 716 unsigned long parent_rate, best = 0; 790 717 791 718 /* if NO_REPARENT flag set, pass through to current parent */ 792 - if (clk->flags & CLK_SET_RATE_NO_REPARENT) { 793 - parent = clk->parent; 794 - if (clk->flags & CLK_SET_RATE_PARENT) 795 - best = __clk_round_rate(parent, rate); 719 + if (core->flags & CLK_SET_RATE_NO_REPARENT) { 720 + parent = core->parent; 721 + if (core->flags & CLK_SET_RATE_PARENT) 722 + best = __clk_determine_rate(parent ? parent->hw : NULL, 723 + rate, min_rate, max_rate); 796 724 else if (parent) 797 - best = __clk_get_rate(parent); 725 + best = clk_core_get_rate_nolock(parent); 798 726 else 799 - best = __clk_get_rate(clk); 727 + best = clk_core_get_rate_nolock(core); 800 728 goto out; 801 729 } 802 730 803 731 /* find the parent that can provide the fastest rate <= rate */ 804 - num_parents = clk->num_parents; 732 + num_parents = core->num_parents; 805 733 for (i = 0; i < num_parents; i++) { 806 - parent = clk_get_parent_by_index(clk, i); 734 + parent = clk_core_get_parent_by_index(core, i); 807 735 if (!parent) 808 736 continue; 809 - if (clk->flags & CLK_SET_RATE_PARENT) 810 - parent_rate = __clk_round_rate(parent, rate); 737 + if (core->flags & CLK_SET_RATE_PARENT) 738 + parent_rate = __clk_determine_rate(parent->hw, rate, 739 + min_rate, 740 + max_rate); 811 741 else 812 - parent_rate = __clk_get_rate(parent); 813 - if (parent_rate <= rate && parent_rate > best) { 742 + parent_rate = clk_core_get_rate_nolock(parent); 743 + if (mux_is_better_rate(rate, parent_rate, best, flags)) { 814 744 best_parent = parent; 815 745 best = parent_rate; 816 746 } ··· 834 742 835 743 return best; 836 744 } 745 + 746 + struct clk *__clk_lookup(const char *name) 747 + { 748 + struct clk_core *core = clk_core_lookup(name); 749 + 750 + return !core ? NULL : core->hw->clk; 751 + } 752 + 753 + static void clk_core_get_boundaries(struct clk_core *clk, 754 + unsigned long *min_rate, 755 + unsigned long *max_rate) 756 + { 757 + struct clk *clk_user; 758 + 759 + *min_rate = 0; 760 + *max_rate = ULONG_MAX; 761 + 762 + hlist_for_each_entry(clk_user, &clk->clks, child_node) 763 + *min_rate = max(*min_rate, clk_user->min_rate); 764 + 765 + hlist_for_each_entry(clk_user, &clk->clks, child_node) 766 + *max_rate = min(*max_rate, clk_user->max_rate); 767 + } 768 + 769 + /* 770 + * Helper for finding best parent to provide a given frequency. This can be used 771 + * directly as a determine_rate callback (e.g. for a mux), or from a more 772 + * complex clock that may combine a mux with other operations. 773 + */ 774 + long __clk_mux_determine_rate(struct clk_hw *hw, unsigned long rate, 775 + unsigned long min_rate, 776 + unsigned long max_rate, 777 + unsigned long *best_parent_rate, 778 + struct clk_hw **best_parent_p) 779 + { 780 + return clk_mux_determine_rate_flags(hw, rate, min_rate, max_rate, 781 + best_parent_rate, 782 + best_parent_p, 0); 783 + } 837 784 EXPORT_SYMBOL_GPL(__clk_mux_determine_rate); 785 + 786 + long __clk_mux_determine_rate_closest(struct clk_hw *hw, unsigned long rate, 787 + unsigned long min_rate, 788 + unsigned long max_rate, 789 + unsigned long *best_parent_rate, 790 + struct clk_hw **best_parent_p) 791 + { 792 + return clk_mux_determine_rate_flags(hw, rate, min_rate, max_rate, 793 + best_parent_rate, 794 + best_parent_p, 795 + CLK_MUX_ROUND_CLOSEST); 796 + } 797 + EXPORT_SYMBOL_GPL(__clk_mux_determine_rate_closest); 838 798 839 799 /*** clk api ***/ 840 800 841 - void __clk_unprepare(struct clk *clk) 801 + static void clk_core_unprepare(struct clk_core *clk) 842 802 { 843 803 if (!clk) 844 804 return; ··· 906 762 if (clk->ops->unprepare) 907 763 clk->ops->unprepare(clk->hw); 908 764 909 - __clk_unprepare(clk->parent); 765 + clk_core_unprepare(clk->parent); 910 766 } 911 767 912 768 /** ··· 926 782 return; 927 783 928 784 clk_prepare_lock(); 929 - __clk_unprepare(clk); 785 + clk_core_unprepare(clk->core); 930 786 clk_prepare_unlock(); 931 787 } 932 788 EXPORT_SYMBOL_GPL(clk_unprepare); 933 789 934 - int __clk_prepare(struct clk *clk) 790 + static int clk_core_prepare(struct clk_core *clk) 935 791 { 936 792 int ret = 0; 937 793 ··· 939 795 return 0; 940 796 941 797 if (clk->prepare_count == 0) { 942 - ret = __clk_prepare(clk->parent); 798 + ret = clk_core_prepare(clk->parent); 943 799 if (ret) 944 800 return ret; 945 801 946 802 if (clk->ops->prepare) { 947 803 ret = clk->ops->prepare(clk->hw); 948 804 if (ret) { 949 - __clk_unprepare(clk->parent); 805 + clk_core_unprepare(clk->parent); 950 806 return ret; 951 807 } 952 808 } ··· 973 829 { 974 830 int ret; 975 831 832 + if (!clk) 833 + return 0; 834 + 976 835 clk_prepare_lock(); 977 - ret = __clk_prepare(clk); 836 + ret = clk_core_prepare(clk->core); 978 837 clk_prepare_unlock(); 979 838 980 839 return ret; 981 840 } 982 841 EXPORT_SYMBOL_GPL(clk_prepare); 983 842 984 - static void __clk_disable(struct clk *clk) 843 + static void clk_core_disable(struct clk_core *clk) 985 844 { 986 845 if (!clk) 987 846 return; ··· 998 851 if (clk->ops->disable) 999 852 clk->ops->disable(clk->hw); 1000 853 1001 - __clk_disable(clk->parent); 854 + clk_core_disable(clk->parent); 855 + } 856 + 857 + static void __clk_disable(struct clk *clk) 858 + { 859 + if (!clk) 860 + return; 861 + 862 + clk_core_disable(clk->core); 1002 863 } 1003 864 1004 865 /** ··· 1034 879 } 1035 880 EXPORT_SYMBOL_GPL(clk_disable); 1036 881 1037 - static int __clk_enable(struct clk *clk) 882 + static int clk_core_enable(struct clk_core *clk) 1038 883 { 1039 884 int ret = 0; 1040 885 ··· 1045 890 return -ESHUTDOWN; 1046 891 1047 892 if (clk->enable_count == 0) { 1048 - ret = __clk_enable(clk->parent); 893 + ret = clk_core_enable(clk->parent); 1049 894 1050 895 if (ret) 1051 896 return ret; ··· 1053 898 if (clk->ops->enable) { 1054 899 ret = clk->ops->enable(clk->hw); 1055 900 if (ret) { 1056 - __clk_disable(clk->parent); 901 + clk_core_disable(clk->parent); 1057 902 return ret; 1058 903 } 1059 904 } ··· 1061 906 1062 907 clk->enable_count++; 1063 908 return 0; 909 + } 910 + 911 + static int __clk_enable(struct clk *clk) 912 + { 913 + if (!clk) 914 + return 0; 915 + 916 + return clk_core_enable(clk->core); 1064 917 } 1065 918 1066 919 /** ··· 1097 934 } 1098 935 EXPORT_SYMBOL_GPL(clk_enable); 1099 936 1100 - /** 1101 - * __clk_round_rate - round the given rate for a clk 1102 - * @clk: round the rate of this clock 1103 - * @rate: the rate which is to be rounded 1104 - * 1105 - * Caller must hold prepare_lock. Useful for clk_ops such as .set_rate 1106 - */ 1107 - unsigned long __clk_round_rate(struct clk *clk, unsigned long rate) 937 + static unsigned long clk_core_round_rate_nolock(struct clk_core *clk, 938 + unsigned long rate, 939 + unsigned long min_rate, 940 + unsigned long max_rate) 1108 941 { 1109 942 unsigned long parent_rate = 0; 1110 - struct clk *parent; 943 + struct clk_core *parent; 1111 944 struct clk_hw *parent_hw; 1112 945 1113 946 if (!clk) ··· 1115 956 1116 957 if (clk->ops->determine_rate) { 1117 958 parent_hw = parent ? parent->hw : NULL; 1118 - return clk->ops->determine_rate(clk->hw, rate, &parent_rate, 1119 - &parent_hw); 959 + return clk->ops->determine_rate(clk->hw, rate, 960 + min_rate, max_rate, 961 + &parent_rate, &parent_hw); 1120 962 } else if (clk->ops->round_rate) 1121 963 return clk->ops->round_rate(clk->hw, rate, &parent_rate); 1122 964 else if (clk->flags & CLK_SET_RATE_PARENT) 1123 - return __clk_round_rate(clk->parent, rate); 965 + return clk_core_round_rate_nolock(clk->parent, rate, min_rate, 966 + max_rate); 1124 967 else 1125 968 return clk->rate; 969 + } 970 + 971 + /** 972 + * __clk_determine_rate - get the closest rate actually supported by a clock 973 + * @hw: determine the rate of this clock 974 + * @rate: target rate 975 + * @min_rate: returned rate must be greater than this rate 976 + * @max_rate: returned rate must be less than this rate 977 + * 978 + * Caller must hold prepare_lock. Useful for clk_ops such as .set_rate and 979 + * .determine_rate. 980 + */ 981 + unsigned long __clk_determine_rate(struct clk_hw *hw, 982 + unsigned long rate, 983 + unsigned long min_rate, 984 + unsigned long max_rate) 985 + { 986 + if (!hw) 987 + return 0; 988 + 989 + return clk_core_round_rate_nolock(hw->core, rate, min_rate, max_rate); 990 + } 991 + EXPORT_SYMBOL_GPL(__clk_determine_rate); 992 + 993 + /** 994 + * __clk_round_rate - round the given rate for a clk 995 + * @clk: round the rate of this clock 996 + * @rate: the rate which is to be rounded 997 + * 998 + * Caller must hold prepare_lock. Useful for clk_ops such as .set_rate 999 + */ 1000 + unsigned long __clk_round_rate(struct clk *clk, unsigned long rate) 1001 + { 1002 + unsigned long min_rate; 1003 + unsigned long max_rate; 1004 + 1005 + if (!clk) 1006 + return 0; 1007 + 1008 + clk_core_get_boundaries(clk->core, &min_rate, &max_rate); 1009 + 1010 + return clk_core_round_rate_nolock(clk->core, rate, min_rate, max_rate); 1126 1011 } 1127 1012 EXPORT_SYMBOL_GPL(__clk_round_rate); 1128 1013 ··· 1182 979 long clk_round_rate(struct clk *clk, unsigned long rate) 1183 980 { 1184 981 unsigned long ret; 982 + 983 + if (!clk) 984 + return 0; 1185 985 1186 986 clk_prepare_lock(); 1187 987 ret = __clk_round_rate(clk, rate); ··· 1208 1002 * called if all went well, or NOTIFY_STOP or NOTIFY_BAD immediately if 1209 1003 * a driver returns that. 1210 1004 */ 1211 - static int __clk_notify(struct clk *clk, unsigned long msg, 1005 + static int __clk_notify(struct clk_core *clk, unsigned long msg, 1212 1006 unsigned long old_rate, unsigned long new_rate) 1213 1007 { 1214 1008 struct clk_notifier *cn; 1215 1009 struct clk_notifier_data cnd; 1216 1010 int ret = NOTIFY_DONE; 1217 1011 1218 - cnd.clk = clk; 1219 1012 cnd.old_rate = old_rate; 1220 1013 cnd.new_rate = new_rate; 1221 1014 1222 1015 list_for_each_entry(cn, &clk_notifier_list, node) { 1223 - if (cn->clk == clk) { 1016 + if (cn->clk->core == clk) { 1017 + cnd.clk = cn->clk; 1224 1018 ret = srcu_notifier_call_chain(&cn->notifier_head, msg, 1225 1019 &cnd); 1226 - break; 1227 1020 } 1228 1021 } 1229 1022 ··· 1240 1035 * 1241 1036 * Caller must hold prepare_lock. 1242 1037 */ 1243 - static void __clk_recalc_accuracies(struct clk *clk) 1038 + static void __clk_recalc_accuracies(struct clk_core *clk) 1244 1039 { 1245 1040 unsigned long parent_accuracy = 0; 1246 - struct clk *child; 1041 + struct clk_core *child; 1247 1042 1248 1043 if (clk->parent) 1249 1044 parent_accuracy = clk->parent->accuracy; ··· 1258 1053 __clk_recalc_accuracies(child); 1259 1054 } 1260 1055 1261 - /** 1262 - * clk_get_accuracy - return the accuracy of clk 1263 - * @clk: the clk whose accuracy is being returned 1264 - * 1265 - * Simply returns the cached accuracy of the clk, unless 1266 - * CLK_GET_ACCURACY_NOCACHE flag is set, which means a recalc_rate will be 1267 - * issued. 1268 - * If clk is NULL then returns 0. 1269 - */ 1270 - long clk_get_accuracy(struct clk *clk) 1056 + static long clk_core_get_accuracy(struct clk_core *clk) 1271 1057 { 1272 1058 unsigned long accuracy; 1273 1059 ··· 1271 1075 1272 1076 return accuracy; 1273 1077 } 1078 + 1079 + /** 1080 + * clk_get_accuracy - return the accuracy of clk 1081 + * @clk: the clk whose accuracy is being returned 1082 + * 1083 + * Simply returns the cached accuracy of the clk, unless 1084 + * CLK_GET_ACCURACY_NOCACHE flag is set, which means a recalc_rate will be 1085 + * issued. 1086 + * If clk is NULL then returns 0. 1087 + */ 1088 + long clk_get_accuracy(struct clk *clk) 1089 + { 1090 + if (!clk) 1091 + return 0; 1092 + 1093 + return clk_core_get_accuracy(clk->core); 1094 + } 1274 1095 EXPORT_SYMBOL_GPL(clk_get_accuracy); 1275 1096 1276 - static unsigned long clk_recalc(struct clk *clk, unsigned long parent_rate) 1097 + static unsigned long clk_recalc(struct clk_core *clk, 1098 + unsigned long parent_rate) 1277 1099 { 1278 1100 if (clk->ops->recalc_rate) 1279 1101 return clk->ops->recalc_rate(clk->hw, parent_rate); ··· 1312 1098 * 1313 1099 * Caller must hold prepare_lock. 1314 1100 */ 1315 - static void __clk_recalc_rates(struct clk *clk, unsigned long msg) 1101 + static void __clk_recalc_rates(struct clk_core *clk, unsigned long msg) 1316 1102 { 1317 1103 unsigned long old_rate; 1318 1104 unsigned long parent_rate = 0; 1319 - struct clk *child; 1105 + struct clk_core *child; 1320 1106 1321 1107 old_rate = clk->rate; 1322 1108 ··· 1336 1122 __clk_recalc_rates(child, msg); 1337 1123 } 1338 1124 1125 + static unsigned long clk_core_get_rate(struct clk_core *clk) 1126 + { 1127 + unsigned long rate; 1128 + 1129 + clk_prepare_lock(); 1130 + 1131 + if (clk && (clk->flags & CLK_GET_RATE_NOCACHE)) 1132 + __clk_recalc_rates(clk, 0); 1133 + 1134 + rate = clk_core_get_rate_nolock(clk); 1135 + clk_prepare_unlock(); 1136 + 1137 + return rate; 1138 + } 1139 + EXPORT_SYMBOL_GPL(clk_core_get_rate); 1140 + 1339 1141 /** 1340 1142 * clk_get_rate - return the rate of clk 1341 1143 * @clk: the clk whose rate is being returned ··· 1362 1132 */ 1363 1133 unsigned long clk_get_rate(struct clk *clk) 1364 1134 { 1365 - unsigned long rate; 1135 + if (!clk) 1136 + return 0; 1366 1137 1367 - clk_prepare_lock(); 1368 - 1369 - if (clk && (clk->flags & CLK_GET_RATE_NOCACHE)) 1370 - __clk_recalc_rates(clk, 0); 1371 - 1372 - rate = __clk_get_rate(clk); 1373 - clk_prepare_unlock(); 1374 - 1375 - return rate; 1138 + return clk_core_get_rate(clk->core); 1376 1139 } 1377 1140 EXPORT_SYMBOL_GPL(clk_get_rate); 1378 1141 1379 - static int clk_fetch_parent_index(struct clk *clk, struct clk *parent) 1142 + static int clk_fetch_parent_index(struct clk_core *clk, 1143 + struct clk_core *parent) 1380 1144 { 1381 1145 int i; 1382 1146 ··· 1384 1160 /* 1385 1161 * find index of new parent clock using cached parent ptrs, 1386 1162 * or if not yet cached, use string name comparison and cache 1387 - * them now to avoid future calls to __clk_lookup. 1163 + * them now to avoid future calls to clk_core_lookup. 1388 1164 */ 1389 1165 for (i = 0; i < clk->num_parents; i++) { 1390 1166 if (clk->parents[i] == parent) ··· 1394 1170 continue; 1395 1171 1396 1172 if (!strcmp(clk->parent_names[i], parent->name)) { 1397 - clk->parents[i] = __clk_lookup(parent->name); 1173 + clk->parents[i] = clk_core_lookup(parent->name); 1398 1174 return i; 1399 1175 } 1400 1176 } ··· 1402 1178 return -EINVAL; 1403 1179 } 1404 1180 1405 - static void clk_reparent(struct clk *clk, struct clk *new_parent) 1181 + static void clk_reparent(struct clk_core *clk, struct clk_core *new_parent) 1406 1182 { 1407 1183 hlist_del(&clk->child_node); 1408 1184 ··· 1419 1195 clk->parent = new_parent; 1420 1196 } 1421 1197 1422 - static struct clk *__clk_set_parent_before(struct clk *clk, struct clk *parent) 1198 + static struct clk_core *__clk_set_parent_before(struct clk_core *clk, 1199 + struct clk_core *parent) 1423 1200 { 1424 1201 unsigned long flags; 1425 - struct clk *old_parent = clk->parent; 1202 + struct clk_core *old_parent = clk->parent; 1426 1203 1427 1204 /* 1428 1205 * Migrate prepare state between parents and prevent race with ··· 1443 1218 * See also: Comment for clk_set_parent() below. 1444 1219 */ 1445 1220 if (clk->prepare_count) { 1446 - __clk_prepare(parent); 1447 - clk_enable(parent); 1448 - clk_enable(clk); 1221 + clk_core_prepare(parent); 1222 + clk_core_enable(parent); 1223 + clk_core_enable(clk); 1449 1224 } 1450 1225 1451 1226 /* update the clk tree topology */ ··· 1456 1231 return old_parent; 1457 1232 } 1458 1233 1459 - static void __clk_set_parent_after(struct clk *clk, struct clk *parent, 1460 - struct clk *old_parent) 1234 + static void __clk_set_parent_after(struct clk_core *core, 1235 + struct clk_core *parent, 1236 + struct clk_core *old_parent) 1461 1237 { 1462 1238 /* 1463 1239 * Finish the migration of prepare state and undo the changes done 1464 1240 * for preventing a race with clk_enable(). 1465 1241 */ 1466 - if (clk->prepare_count) { 1467 - clk_disable(clk); 1468 - clk_disable(old_parent); 1469 - __clk_unprepare(old_parent); 1242 + if (core->prepare_count) { 1243 + clk_core_disable(core); 1244 + clk_core_disable(old_parent); 1245 + clk_core_unprepare(old_parent); 1470 1246 } 1471 1247 } 1472 1248 1473 - static int __clk_set_parent(struct clk *clk, struct clk *parent, u8 p_index) 1249 + static int __clk_set_parent(struct clk_core *clk, struct clk_core *parent, 1250 + u8 p_index) 1474 1251 { 1475 1252 unsigned long flags; 1476 1253 int ret = 0; 1477 - struct clk *old_parent; 1254 + struct clk_core *old_parent; 1478 1255 1479 1256 old_parent = __clk_set_parent_before(clk, parent); 1480 1257 ··· 1490 1263 clk_enable_unlock(flags); 1491 1264 1492 1265 if (clk->prepare_count) { 1493 - clk_disable(clk); 1494 - clk_disable(parent); 1495 - __clk_unprepare(parent); 1266 + clk_core_disable(clk); 1267 + clk_core_disable(parent); 1268 + clk_core_unprepare(parent); 1496 1269 } 1497 1270 return ret; 1498 1271 } ··· 1518 1291 * 1519 1292 * Caller must hold prepare_lock. 1520 1293 */ 1521 - static int __clk_speculate_rates(struct clk *clk, unsigned long parent_rate) 1294 + static int __clk_speculate_rates(struct clk_core *clk, 1295 + unsigned long parent_rate) 1522 1296 { 1523 - struct clk *child; 1297 + struct clk_core *child; 1524 1298 unsigned long new_rate; 1525 1299 int ret = NOTIFY_DONE; 1526 1300 ··· 1547 1319 return ret; 1548 1320 } 1549 1321 1550 - static void clk_calc_subtree(struct clk *clk, unsigned long new_rate, 1551 - struct clk *new_parent, u8 p_index) 1322 + static void clk_calc_subtree(struct clk_core *clk, unsigned long new_rate, 1323 + struct clk_core *new_parent, u8 p_index) 1552 1324 { 1553 - struct clk *child; 1325 + struct clk_core *child; 1554 1326 1555 1327 clk->new_rate = new_rate; 1556 1328 clk->new_parent = new_parent; ··· 1570 1342 * calculate the new rates returning the topmost clock that has to be 1571 1343 * changed. 1572 1344 */ 1573 - static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate) 1345 + static struct clk_core *clk_calc_new_rates(struct clk_core *clk, 1346 + unsigned long rate) 1574 1347 { 1575 - struct clk *top = clk; 1576 - struct clk *old_parent, *parent; 1348 + struct clk_core *top = clk; 1349 + struct clk_core *old_parent, *parent; 1577 1350 struct clk_hw *parent_hw; 1578 1351 unsigned long best_parent_rate = 0; 1579 1352 unsigned long new_rate; 1353 + unsigned long min_rate; 1354 + unsigned long max_rate; 1580 1355 int p_index = 0; 1581 1356 1582 1357 /* sanity */ ··· 1591 1360 if (parent) 1592 1361 best_parent_rate = parent->rate; 1593 1362 1363 + clk_core_get_boundaries(clk, &min_rate, &max_rate); 1364 + 1594 1365 /* find the closest rate and parent clk/rate */ 1595 1366 if (clk->ops->determine_rate) { 1596 1367 parent_hw = parent ? parent->hw : NULL; 1597 1368 new_rate = clk->ops->determine_rate(clk->hw, rate, 1369 + min_rate, 1370 + max_rate, 1598 1371 &best_parent_rate, 1599 1372 &parent_hw); 1600 - parent = parent_hw ? parent_hw->clk : NULL; 1373 + parent = parent_hw ? parent_hw->core : NULL; 1601 1374 } else if (clk->ops->round_rate) { 1602 1375 new_rate = clk->ops->round_rate(clk->hw, rate, 1603 1376 &best_parent_rate); 1377 + if (new_rate < min_rate || new_rate > max_rate) 1378 + return NULL; 1604 1379 } else if (!parent || !(clk->flags & CLK_SET_RATE_PARENT)) { 1605 1380 /* pass-through clock without adjustable parent */ 1606 1381 clk->new_rate = clk->rate; ··· 1627 1390 } 1628 1391 1629 1392 /* try finding the new parent index */ 1630 - if (parent) { 1393 + if (parent && clk->num_parents > 1) { 1631 1394 p_index = clk_fetch_parent_index(clk, parent); 1632 1395 if (p_index < 0) { 1633 1396 pr_debug("%s: clk %s can not be parent of clk %s\n", ··· 1651 1414 * so that in case of an error we can walk down the whole tree again and 1652 1415 * abort the change. 1653 1416 */ 1654 - static struct clk *clk_propagate_rate_change(struct clk *clk, unsigned long event) 1417 + static struct clk_core *clk_propagate_rate_change(struct clk_core *clk, 1418 + unsigned long event) 1655 1419 { 1656 - struct clk *child, *tmp_clk, *fail_clk = NULL; 1420 + struct clk_core *child, *tmp_clk, *fail_clk = NULL; 1657 1421 int ret = NOTIFY_DONE; 1658 1422 1659 1423 if (clk->rate == clk->new_rate) ··· 1689 1451 * walk down a subtree and set the new rates notifying the rate 1690 1452 * change on the way 1691 1453 */ 1692 - static void clk_change_rate(struct clk *clk) 1454 + static void clk_change_rate(struct clk_core *clk) 1693 1455 { 1694 - struct clk *child; 1456 + struct clk_core *child; 1695 1457 struct hlist_node *tmp; 1696 1458 unsigned long old_rate; 1697 1459 unsigned long best_parent_rate = 0; 1698 1460 bool skip_set_rate = false; 1699 - struct clk *old_parent; 1461 + struct clk_core *old_parent; 1700 1462 1701 1463 old_rate = clk->rate; 1702 1464 ··· 1744 1506 clk_change_rate(clk->new_child); 1745 1507 } 1746 1508 1509 + static int clk_core_set_rate_nolock(struct clk_core *clk, 1510 + unsigned long req_rate) 1511 + { 1512 + struct clk_core *top, *fail_clk; 1513 + unsigned long rate = req_rate; 1514 + int ret = 0; 1515 + 1516 + if (!clk) 1517 + return 0; 1518 + 1519 + /* bail early if nothing to do */ 1520 + if (rate == clk_core_get_rate_nolock(clk)) 1521 + return 0; 1522 + 1523 + if ((clk->flags & CLK_SET_RATE_GATE) && clk->prepare_count) 1524 + return -EBUSY; 1525 + 1526 + /* calculate new rates and get the topmost changed clock */ 1527 + top = clk_calc_new_rates(clk, rate); 1528 + if (!top) 1529 + return -EINVAL; 1530 + 1531 + /* notify that we are about to change rates */ 1532 + fail_clk = clk_propagate_rate_change(top, PRE_RATE_CHANGE); 1533 + if (fail_clk) { 1534 + pr_debug("%s: failed to set %s rate\n", __func__, 1535 + fail_clk->name); 1536 + clk_propagate_rate_change(top, ABORT_RATE_CHANGE); 1537 + return -EBUSY; 1538 + } 1539 + 1540 + /* change the rates */ 1541 + clk_change_rate(top); 1542 + 1543 + clk->req_rate = req_rate; 1544 + 1545 + return ret; 1546 + } 1547 + 1747 1548 /** 1748 1549 * clk_set_rate - specify a new rate for clk 1749 1550 * @clk: the clk whose rate is being changed ··· 1806 1529 */ 1807 1530 int clk_set_rate(struct clk *clk, unsigned long rate) 1808 1531 { 1809 - struct clk *top, *fail_clk; 1810 - int ret = 0; 1532 + int ret; 1811 1533 1812 1534 if (!clk) 1813 1535 return 0; ··· 1814 1538 /* prevent racing with updates to the clock topology */ 1815 1539 clk_prepare_lock(); 1816 1540 1817 - /* bail early if nothing to do */ 1818 - if (rate == clk_get_rate(clk)) 1819 - goto out; 1541 + ret = clk_core_set_rate_nolock(clk->core, rate); 1820 1542 1821 - if ((clk->flags & CLK_SET_RATE_GATE) && clk->prepare_count) { 1822 - ret = -EBUSY; 1823 - goto out; 1824 - } 1825 - 1826 - /* calculate new rates and get the topmost changed clock */ 1827 - top = clk_calc_new_rates(clk, rate); 1828 - if (!top) { 1829 - ret = -EINVAL; 1830 - goto out; 1831 - } 1832 - 1833 - /* notify that we are about to change rates */ 1834 - fail_clk = clk_propagate_rate_change(top, PRE_RATE_CHANGE); 1835 - if (fail_clk) { 1836 - pr_debug("%s: failed to set %s rate\n", __func__, 1837 - fail_clk->name); 1838 - clk_propagate_rate_change(top, ABORT_RATE_CHANGE); 1839 - ret = -EBUSY; 1840 - goto out; 1841 - } 1842 - 1843 - /* change the rates */ 1844 - clk_change_rate(top); 1845 - 1846 - out: 1847 1543 clk_prepare_unlock(); 1848 1544 1849 1545 return ret; 1850 1546 } 1851 1547 EXPORT_SYMBOL_GPL(clk_set_rate); 1548 + 1549 + /** 1550 + * clk_set_rate_range - set a rate range for a clock source 1551 + * @clk: clock source 1552 + * @min: desired minimum clock rate in Hz, inclusive 1553 + * @max: desired maximum clock rate in Hz, inclusive 1554 + * 1555 + * Returns success (0) or negative errno. 1556 + */ 1557 + int clk_set_rate_range(struct clk *clk, unsigned long min, unsigned long max) 1558 + { 1559 + int ret = 0; 1560 + 1561 + if (!clk) 1562 + return 0; 1563 + 1564 + if (min > max) { 1565 + pr_err("%s: clk %s dev %s con %s: invalid range [%lu, %lu]\n", 1566 + __func__, clk->core->name, clk->dev_id, clk->con_id, 1567 + min, max); 1568 + return -EINVAL; 1569 + } 1570 + 1571 + clk_prepare_lock(); 1572 + 1573 + if (min != clk->min_rate || max != clk->max_rate) { 1574 + clk->min_rate = min; 1575 + clk->max_rate = max; 1576 + ret = clk_core_set_rate_nolock(clk->core, clk->core->req_rate); 1577 + } 1578 + 1579 + clk_prepare_unlock(); 1580 + 1581 + return ret; 1582 + } 1583 + EXPORT_SYMBOL_GPL(clk_set_rate_range); 1584 + 1585 + /** 1586 + * clk_set_min_rate - set a minimum clock rate for a clock source 1587 + * @clk: clock source 1588 + * @rate: desired minimum clock rate in Hz, inclusive 1589 + * 1590 + * Returns success (0) or negative errno. 1591 + */ 1592 + int clk_set_min_rate(struct clk *clk, unsigned long rate) 1593 + { 1594 + if (!clk) 1595 + return 0; 1596 + 1597 + return clk_set_rate_range(clk, rate, clk->max_rate); 1598 + } 1599 + EXPORT_SYMBOL_GPL(clk_set_min_rate); 1600 + 1601 + /** 1602 + * clk_set_max_rate - set a maximum clock rate for a clock source 1603 + * @clk: clock source 1604 + * @rate: desired maximum clock rate in Hz, inclusive 1605 + * 1606 + * Returns success (0) or negative errno. 1607 + */ 1608 + int clk_set_max_rate(struct clk *clk, unsigned long rate) 1609 + { 1610 + if (!clk) 1611 + return 0; 1612 + 1613 + return clk_set_rate_range(clk, clk->min_rate, rate); 1614 + } 1615 + EXPORT_SYMBOL_GPL(clk_set_max_rate); 1852 1616 1853 1617 /** 1854 1618 * clk_get_parent - return the parent of a clk ··· 1915 1599 * 1916 1600 * For single-parent clocks without .get_parent, first check to see if the 1917 1601 * .parents array exists, and if so use it to avoid an expensive tree 1918 - * traversal. If .parents does not exist then walk the tree with __clk_lookup. 1602 + * traversal. If .parents does not exist then walk the tree. 1919 1603 */ 1920 - static struct clk *__clk_init_parent(struct clk *clk) 1604 + static struct clk_core *__clk_init_parent(struct clk_core *clk) 1921 1605 { 1922 - struct clk *ret = NULL; 1606 + struct clk_core *ret = NULL; 1923 1607 u8 index; 1924 1608 1925 1609 /* handle the trivial cases */ ··· 1929 1613 1930 1614 if (clk->num_parents == 1) { 1931 1615 if (IS_ERR_OR_NULL(clk->parent)) 1932 - clk->parent = __clk_lookup(clk->parent_names[0]); 1616 + clk->parent = clk_core_lookup(clk->parent_names[0]); 1933 1617 ret = clk->parent; 1934 1618 goto out; 1935 1619 } ··· 1943 1627 1944 1628 /* 1945 1629 * Do our best to cache parent clocks in clk->parents. This prevents 1946 - * unnecessary and expensive calls to __clk_lookup. We don't set 1947 - * clk->parent here; that is done by the calling function 1630 + * unnecessary and expensive lookups. We don't set clk->parent here; 1631 + * that is done by the calling function. 1948 1632 */ 1949 1633 1950 1634 index = clk->ops->get_parent(clk->hw); ··· 1954 1638 kcalloc(clk->num_parents, sizeof(struct clk *), 1955 1639 GFP_KERNEL); 1956 1640 1957 - ret = clk_get_parent_by_index(clk, index); 1641 + ret = clk_core_get_parent_by_index(clk, index); 1958 1642 1959 1643 out: 1960 1644 return ret; 1961 1645 } 1962 1646 1963 - void __clk_reparent(struct clk *clk, struct clk *new_parent) 1647 + static void clk_core_reparent(struct clk_core *clk, 1648 + struct clk_core *new_parent) 1964 1649 { 1965 1650 clk_reparent(clk, new_parent); 1966 1651 __clk_recalc_accuracies(clk); ··· 1969 1652 } 1970 1653 1971 1654 /** 1972 - * clk_set_parent - switch the parent of a mux clk 1973 - * @clk: the mux clk whose input we are switching 1974 - * @parent: the new input to clk 1655 + * clk_has_parent - check if a clock is a possible parent for another 1656 + * @clk: clock source 1657 + * @parent: parent clock source 1975 1658 * 1976 - * Re-parent clk to use parent as its new input source. If clk is in 1977 - * prepared state, the clk will get enabled for the duration of this call. If 1978 - * that's not acceptable for a specific clk (Eg: the consumer can't handle 1979 - * that, the reparenting is glitchy in hardware, etc), use the 1980 - * CLK_SET_PARENT_GATE flag to allow reparenting only when clk is unprepared. 1659 + * This function can be used in drivers that need to check that a clock can be 1660 + * the parent of another without actually changing the parent. 1981 1661 * 1982 - * After successfully changing clk's parent clk_set_parent will update the 1983 - * clk topology, sysfs topology and propagate rate recalculation via 1984 - * __clk_recalc_rates. 1985 - * 1986 - * Returns 0 on success, -EERROR otherwise. 1662 + * Returns true if @parent is a possible parent for @clk, false otherwise. 1987 1663 */ 1988 - int clk_set_parent(struct clk *clk, struct clk *parent) 1664 + bool clk_has_parent(struct clk *clk, struct clk *parent) 1665 + { 1666 + struct clk_core *core, *parent_core; 1667 + unsigned int i; 1668 + 1669 + /* NULL clocks should be nops, so return success if either is NULL. */ 1670 + if (!clk || !parent) 1671 + return true; 1672 + 1673 + core = clk->core; 1674 + parent_core = parent->core; 1675 + 1676 + /* Optimize for the case where the parent is already the parent. */ 1677 + if (core->parent == parent_core) 1678 + return true; 1679 + 1680 + for (i = 0; i < core->num_parents; i++) 1681 + if (strcmp(core->parent_names[i], parent_core->name) == 0) 1682 + return true; 1683 + 1684 + return false; 1685 + } 1686 + EXPORT_SYMBOL_GPL(clk_has_parent); 1687 + 1688 + static int clk_core_set_parent(struct clk_core *clk, struct clk_core *parent) 1989 1689 { 1990 1690 int ret = 0; 1991 1691 int p_index = 0; ··· 2062 1728 2063 1729 return ret; 2064 1730 } 1731 + 1732 + /** 1733 + * clk_set_parent - switch the parent of a mux clk 1734 + * @clk: the mux clk whose input we are switching 1735 + * @parent: the new input to clk 1736 + * 1737 + * Re-parent clk to use parent as its new input source. If clk is in 1738 + * prepared state, the clk will get enabled for the duration of this call. If 1739 + * that's not acceptable for a specific clk (Eg: the consumer can't handle 1740 + * that, the reparenting is glitchy in hardware, etc), use the 1741 + * CLK_SET_PARENT_GATE flag to allow reparenting only when clk is unprepared. 1742 + * 1743 + * After successfully changing clk's parent clk_set_parent will update the 1744 + * clk topology, sysfs topology and propagate rate recalculation via 1745 + * __clk_recalc_rates. 1746 + * 1747 + * Returns 0 on success, -EERROR otherwise. 1748 + */ 1749 + int clk_set_parent(struct clk *clk, struct clk *parent) 1750 + { 1751 + if (!clk) 1752 + return 0; 1753 + 1754 + return clk_core_set_parent(clk->core, parent ? parent->core : NULL); 1755 + } 2065 1756 EXPORT_SYMBOL_GPL(clk_set_parent); 2066 1757 2067 1758 /** ··· 2123 1764 2124 1765 clk_prepare_lock(); 2125 1766 2126 - if (!clk->ops->set_phase) 1767 + if (!clk->core->ops->set_phase) 2127 1768 goto out_unlock; 2128 1769 2129 - ret = clk->ops->set_phase(clk->hw, degrees); 1770 + ret = clk->core->ops->set_phase(clk->core->hw, degrees); 2130 1771 2131 1772 if (!ret) 2132 - clk->phase = degrees; 1773 + clk->core->phase = degrees; 2133 1774 2134 1775 out_unlock: 2135 1776 clk_prepare_unlock(); ··· 2137 1778 out: 2138 1779 return ret; 2139 1780 } 1781 + EXPORT_SYMBOL_GPL(clk_set_phase); 2140 1782 2141 - /** 2142 - * clk_get_phase - return the phase shift of a clock signal 2143 - * @clk: clock signal source 2144 - * 2145 - * Returns the phase shift of a clock node in degrees, otherwise returns 2146 - * -EERROR. 2147 - */ 2148 - int clk_get_phase(struct clk *clk) 1783 + static int clk_core_get_phase(struct clk_core *clk) 2149 1784 { 2150 1785 int ret = 0; 2151 1786 ··· 2153 1800 out: 2154 1801 return ret; 2155 1802 } 1803 + EXPORT_SYMBOL_GPL(clk_get_phase); 1804 + 1805 + /** 1806 + * clk_get_phase - return the phase shift of a clock signal 1807 + * @clk: clock signal source 1808 + * 1809 + * Returns the phase shift of a clock node in degrees, otherwise returns 1810 + * -EERROR. 1811 + */ 1812 + int clk_get_phase(struct clk *clk) 1813 + { 1814 + if (!clk) 1815 + return 0; 1816 + 1817 + return clk_core_get_phase(clk->core); 1818 + } 2156 1819 2157 1820 /** 2158 1821 * __clk_init - initialize the data structures in a struct clk 2159 1822 * @dev: device initializing this clk, placeholder for now 2160 1823 * @clk: clk being initialized 2161 1824 * 2162 - * Initializes the lists in struct clk, queries the hardware for the 1825 + * Initializes the lists in struct clk_core, queries the hardware for the 2163 1826 * parent and rate and sets them both. 2164 1827 */ 2165 - int __clk_init(struct device *dev, struct clk *clk) 1828 + static int __clk_init(struct device *dev, struct clk *clk_user) 2166 1829 { 2167 1830 int i, ret = 0; 2168 - struct clk *orphan; 1831 + struct clk_core *orphan; 2169 1832 struct hlist_node *tmp2; 1833 + struct clk_core *clk; 1834 + unsigned long rate; 2170 1835 2171 - if (!clk) 1836 + if (!clk_user) 2172 1837 return -EINVAL; 1838 + 1839 + clk = clk_user->core; 2173 1840 2174 1841 clk_prepare_lock(); 2175 1842 2176 1843 /* check to see if a clock with this name is already registered */ 2177 - if (__clk_lookup(clk->name)) { 1844 + if (clk_core_lookup(clk->name)) { 2178 1845 pr_debug("%s: clk %s already initialized\n", 2179 1846 __func__, clk->name); 2180 1847 ret = -EEXIST; ··· 2246 1873 clk->parents = kcalloc(clk->num_parents, sizeof(struct clk *), 2247 1874 GFP_KERNEL); 2248 1875 /* 2249 - * __clk_lookup returns NULL for parents that have not been 1876 + * clk_core_lookup returns NULL for parents that have not been 2250 1877 * clk_init'd; thus any access to clk->parents[] must check 2251 1878 * for a NULL pointer. We can always perform lazy lookups for 2252 1879 * missing parents later on. ··· 2254 1881 if (clk->parents) 2255 1882 for (i = 0; i < clk->num_parents; i++) 2256 1883 clk->parents[i] = 2257 - __clk_lookup(clk->parent_names[i]); 1884 + clk_core_lookup(clk->parent_names[i]); 2258 1885 } 2259 1886 2260 1887 clk->parent = __clk_init_parent(clk); ··· 2309 1936 * then rate is set to zero. 2310 1937 */ 2311 1938 if (clk->ops->recalc_rate) 2312 - clk->rate = clk->ops->recalc_rate(clk->hw, 2313 - __clk_get_rate(clk->parent)); 1939 + rate = clk->ops->recalc_rate(clk->hw, 1940 + clk_core_get_rate_nolock(clk->parent)); 2314 1941 else if (clk->parent) 2315 - clk->rate = clk->parent->rate; 1942 + rate = clk->parent->rate; 2316 1943 else 2317 - clk->rate = 0; 1944 + rate = 0; 1945 + clk->rate = clk->req_rate = rate; 2318 1946 2319 1947 /* 2320 1948 * walk the list of orphan clocks and reparent any that are children of ··· 2325 1951 if (orphan->num_parents && orphan->ops->get_parent) { 2326 1952 i = orphan->ops->get_parent(orphan->hw); 2327 1953 if (!strcmp(clk->name, orphan->parent_names[i])) 2328 - __clk_reparent(orphan, clk); 1954 + clk_core_reparent(orphan, clk); 2329 1955 continue; 2330 1956 } 2331 1957 2332 1958 for (i = 0; i < orphan->num_parents; i++) 2333 1959 if (!strcmp(clk->name, orphan->parent_names[i])) { 2334 - __clk_reparent(orphan, clk); 1960 + clk_core_reparent(orphan, clk); 2335 1961 break; 2336 1962 } 2337 1963 } ··· 2357 1983 return ret; 2358 1984 } 2359 1985 2360 - /** 2361 - * __clk_register - register a clock and return a cookie. 2362 - * 2363 - * Same as clk_register, except that the .clk field inside hw shall point to a 2364 - * preallocated (generally statically allocated) struct clk. None of the fields 2365 - * of the struct clk need to be initialized. 2366 - * 2367 - * The data pointed to by .init and .clk field shall NOT be marked as init 2368 - * data. 2369 - * 2370 - * __clk_register is only exposed via clk-private.h and is intended for use with 2371 - * very large numbers of clocks that need to be statically initialized. It is 2372 - * a layering violation to include clk-private.h from any code which implements 2373 - * a clock's .ops; as such any statically initialized clock data MUST be in a 2374 - * separate C file from the logic that implements its operations. Returns 0 2375 - * on success, otherwise an error code. 2376 - */ 2377 - struct clk *__clk_register(struct device *dev, struct clk_hw *hw) 1986 + struct clk *__clk_create_clk(struct clk_hw *hw, const char *dev_id, 1987 + const char *con_id) 2378 1988 { 2379 - int ret; 2380 1989 struct clk *clk; 2381 1990 2382 - clk = hw->clk; 2383 - clk->name = hw->init->name; 2384 - clk->ops = hw->init->ops; 2385 - clk->hw = hw; 2386 - clk->flags = hw->init->flags; 2387 - clk->parent_names = hw->init->parent_names; 2388 - clk->num_parents = hw->init->num_parents; 2389 - if (dev && dev->driver) 2390 - clk->owner = dev->driver->owner; 2391 - else 2392 - clk->owner = NULL; 1991 + /* This is to allow this function to be chained to others */ 1992 + if (!hw || IS_ERR(hw)) 1993 + return (struct clk *) hw; 2393 1994 2394 - ret = __clk_init(dev, clk); 2395 - if (ret) 2396 - return ERR_PTR(ret); 1995 + clk = kzalloc(sizeof(*clk), GFP_KERNEL); 1996 + if (!clk) 1997 + return ERR_PTR(-ENOMEM); 1998 + 1999 + clk->core = hw->core; 2000 + clk->dev_id = dev_id; 2001 + clk->con_id = con_id; 2002 + clk->max_rate = ULONG_MAX; 2003 + 2004 + clk_prepare_lock(); 2005 + hlist_add_head(&clk->child_node, &hw->core->clks); 2006 + clk_prepare_unlock(); 2397 2007 2398 2008 return clk; 2399 2009 } 2400 - EXPORT_SYMBOL_GPL(__clk_register); 2010 + 2011 + void __clk_free_clk(struct clk *clk) 2012 + { 2013 + clk_prepare_lock(); 2014 + hlist_del(&clk->child_node); 2015 + clk_prepare_unlock(); 2016 + 2017 + kfree(clk); 2018 + } 2401 2019 2402 2020 /** 2403 2021 * clk_register - allocate a new clock, register it and return an opaque cookie ··· 2405 2039 struct clk *clk_register(struct device *dev, struct clk_hw *hw) 2406 2040 { 2407 2041 int i, ret; 2408 - struct clk *clk; 2042 + struct clk_core *clk; 2409 2043 2410 2044 clk = kzalloc(sizeof(*clk), GFP_KERNEL); 2411 2045 if (!clk) { ··· 2426 2060 clk->hw = hw; 2427 2061 clk->flags = hw->init->flags; 2428 2062 clk->num_parents = hw->init->num_parents; 2429 - hw->clk = clk; 2063 + hw->core = clk; 2430 2064 2431 2065 /* allocate local copy in case parent_names is __initdata */ 2432 2066 clk->parent_names = kcalloc(clk->num_parents, sizeof(char *), ··· 2450 2084 } 2451 2085 } 2452 2086 2453 - ret = __clk_init(dev, clk); 2087 + INIT_HLIST_HEAD(&clk->clks); 2088 + 2089 + hw->clk = __clk_create_clk(hw, NULL, NULL); 2090 + if (IS_ERR(hw->clk)) { 2091 + pr_err("%s: could not allocate per-user clk\n", __func__); 2092 + ret = PTR_ERR(hw->clk); 2093 + goto fail_parent_names_copy; 2094 + } 2095 + 2096 + ret = __clk_init(dev, hw->clk); 2454 2097 if (!ret) 2455 - return clk; 2098 + return hw->clk; 2099 + 2100 + __clk_free_clk(hw->clk); 2101 + hw->clk = NULL; 2456 2102 2457 2103 fail_parent_names_copy: 2458 2104 while (--i >= 0) ··· 2485 2107 */ 2486 2108 static void __clk_release(struct kref *ref) 2487 2109 { 2488 - struct clk *clk = container_of(ref, struct clk, ref); 2110 + struct clk_core *clk = container_of(ref, struct clk_core, ref); 2489 2111 int i = clk->num_parents; 2490 2112 2491 2113 kfree(clk->parents); ··· 2543 2165 if (!clk || WARN_ON_ONCE(IS_ERR(clk))) 2544 2166 return; 2545 2167 2546 - clk_debug_unregister(clk); 2168 + clk_debug_unregister(clk->core); 2547 2169 2548 2170 clk_prepare_lock(); 2549 2171 2550 - if (clk->ops == &clk_nodrv_ops) { 2551 - pr_err("%s: unregistered clock: %s\n", __func__, clk->name); 2172 + if (clk->core->ops == &clk_nodrv_ops) { 2173 + pr_err("%s: unregistered clock: %s\n", __func__, 2174 + clk->core->name); 2552 2175 return; 2553 2176 } 2554 2177 /* ··· 2557 2178 * a reference to this clock. 2558 2179 */ 2559 2180 flags = clk_enable_lock(); 2560 - clk->ops = &clk_nodrv_ops; 2181 + clk->core->ops = &clk_nodrv_ops; 2561 2182 clk_enable_unlock(flags); 2562 2183 2563 - if (!hlist_empty(&clk->children)) { 2564 - struct clk *child; 2184 + if (!hlist_empty(&clk->core->children)) { 2185 + struct clk_core *child; 2565 2186 struct hlist_node *t; 2566 2187 2567 2188 /* Reparent all children to the orphan list. */ 2568 - hlist_for_each_entry_safe(child, t, &clk->children, child_node) 2569 - clk_set_parent(child, NULL); 2189 + hlist_for_each_entry_safe(child, t, &clk->core->children, 2190 + child_node) 2191 + clk_core_set_parent(child, NULL); 2570 2192 } 2571 2193 2572 - hlist_del_init(&clk->child_node); 2194 + hlist_del_init(&clk->core->child_node); 2573 2195 2574 - if (clk->prepare_count) 2196 + if (clk->core->prepare_count) 2575 2197 pr_warn("%s: unregistering prepared clock: %s\n", 2576 - __func__, clk->name); 2577 - kref_put(&clk->ref, __clk_release); 2198 + __func__, clk->core->name); 2199 + kref_put(&clk->core->ref, __clk_release); 2578 2200 2579 2201 clk_prepare_unlock(); 2580 2202 } ··· 2643 2263 */ 2644 2264 int __clk_get(struct clk *clk) 2645 2265 { 2646 - if (clk) { 2647 - if (!try_module_get(clk->owner)) 2266 + struct clk_core *core = !clk ? NULL : clk->core; 2267 + 2268 + if (core) { 2269 + if (!try_module_get(core->owner)) 2648 2270 return 0; 2649 2271 2650 - kref_get(&clk->ref); 2272 + kref_get(&core->ref); 2651 2273 } 2652 2274 return 1; 2653 2275 } ··· 2662 2280 return; 2663 2281 2664 2282 clk_prepare_lock(); 2665 - owner = clk->owner; 2666 - kref_put(&clk->ref, __clk_release); 2283 + 2284 + hlist_del(&clk->child_node); 2285 + if (clk->min_rate > clk->core->req_rate || 2286 + clk->max_rate < clk->core->req_rate) 2287 + clk_core_set_rate_nolock(clk->core, clk->core->req_rate); 2288 + 2289 + owner = clk->core->owner; 2290 + kref_put(&clk->core->ref, __clk_release); 2291 + 2667 2292 clk_prepare_unlock(); 2668 2293 2669 2294 module_put(owner); 2295 + 2296 + kfree(clk); 2670 2297 } 2671 2298 2672 2299 /*** clk rate change notifiers ***/ ··· 2730 2339 2731 2340 ret = srcu_notifier_chain_register(&cn->notifier_head, nb); 2732 2341 2733 - clk->notifier_count++; 2342 + clk->core->notifier_count++; 2734 2343 2735 2344 out: 2736 2345 clk_prepare_unlock(); ··· 2767 2376 if (cn->clk == clk) { 2768 2377 ret = srcu_notifier_chain_unregister(&cn->notifier_head, nb); 2769 2378 2770 - clk->notifier_count--; 2379 + clk->core->notifier_count--; 2771 2380 2772 2381 /* XXX the notifier code should handle this better */ 2773 2382 if (!cn->notifier_head.head) { ··· 2897 2506 } 2898 2507 EXPORT_SYMBOL_GPL(of_clk_del_provider); 2899 2508 2900 - struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec) 2509 + struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec, 2510 + const char *dev_id, const char *con_id) 2901 2511 { 2902 2512 struct of_clk_provider *provider; 2903 2513 struct clk *clk = ERR_PTR(-EPROBE_DEFER); ··· 2907 2515 list_for_each_entry(provider, &of_clk_providers, link) { 2908 2516 if (provider->node == clkspec->np) 2909 2517 clk = provider->get(clkspec, provider->data); 2910 - if (!IS_ERR(clk)) 2518 + if (!IS_ERR(clk)) { 2519 + clk = __clk_create_clk(__clk_get_hw(clk), dev_id, 2520 + con_id); 2521 + 2522 + if (!IS_ERR(clk) && !__clk_get(clk)) { 2523 + __clk_free_clk(clk); 2524 + clk = ERR_PTR(-ENOENT); 2525 + } 2526 + 2911 2527 break; 2528 + } 2912 2529 } 2913 2530 2914 2531 return clk; ··· 2928 2527 struct clk *clk; 2929 2528 2930 2529 mutex_lock(&of_clk_mutex); 2931 - clk = __of_clk_get_from_provider(clkspec); 2530 + clk = __of_clk_get_from_provider(clkspec, NULL, __func__); 2932 2531 mutex_unlock(&of_clk_mutex); 2933 2532 2934 2533 return clk;
+23 -1
drivers/clk/clk.h
··· 9 9 * published by the Free Software Foundation. 10 10 */ 11 11 12 + struct clk_hw; 13 + 12 14 #if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK) 13 15 struct clk *of_clk_get_by_clkspec(struct of_phandle_args *clkspec); 14 - struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec); 16 + struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec, 17 + const char *dev_id, const char *con_id); 15 18 void of_clk_lock(void); 16 19 void of_clk_unlock(void); 20 + #endif 21 + 22 + #ifdef CONFIG_COMMON_CLK 23 + struct clk *__clk_create_clk(struct clk_hw *hw, const char *dev_id, 24 + const char *con_id); 25 + void __clk_free_clk(struct clk *clk); 26 + #else 27 + /* All these casts to avoid ifdefs in clkdev... */ 28 + static inline struct clk * 29 + __clk_create_clk(struct clk_hw *hw, const char *dev_id, const char *con_id) 30 + { 31 + return (struct clk *)hw; 32 + } 33 + static inline void __clk_free_clk(struct clk *clk) { } 34 + static struct clk_hw *__clk_get_hw(struct clk *clk) 35 + { 36 + return (struct clk_hw *)clk; 37 + } 38 + 17 39 #endif
+76 -34
drivers/clk/clkdev.c
··· 19 19 #include <linux/mutex.h> 20 20 #include <linux/clk.h> 21 21 #include <linux/clkdev.h> 22 + #include <linux/clk-provider.h> 22 23 #include <linux/of.h> 23 24 24 25 #include "clk.h" ··· 28 27 static DEFINE_MUTEX(clocks_mutex); 29 28 30 29 #if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK) 30 + 31 + static struct clk *__of_clk_get_by_clkspec(struct of_phandle_args *clkspec, 32 + const char *dev_id, const char *con_id) 33 + { 34 + struct clk *clk; 35 + 36 + if (!clkspec) 37 + return ERR_PTR(-EINVAL); 38 + 39 + of_clk_lock(); 40 + clk = __of_clk_get_from_provider(clkspec, dev_id, con_id); 41 + of_clk_unlock(); 42 + return clk; 43 + } 31 44 32 45 /** 33 46 * of_clk_get_by_clkspec() - Lookup a clock form a clock provider ··· 53 38 */ 54 39 struct clk *of_clk_get_by_clkspec(struct of_phandle_args *clkspec) 55 40 { 56 - struct clk *clk; 57 - 58 - if (!clkspec) 59 - return ERR_PTR(-EINVAL); 60 - 61 - of_clk_lock(); 62 - clk = __of_clk_get_from_provider(clkspec); 63 - 64 - if (!IS_ERR(clk) && !__clk_get(clk)) 65 - clk = ERR_PTR(-ENOENT); 66 - 67 - of_clk_unlock(); 68 - return clk; 41 + return __of_clk_get_by_clkspec(clkspec, NULL, __func__); 69 42 } 70 43 71 - struct clk *of_clk_get(struct device_node *np, int index) 44 + static struct clk *__of_clk_get(struct device_node *np, int index, 45 + const char *dev_id, const char *con_id) 72 46 { 73 47 struct of_phandle_args clkspec; 74 48 struct clk *clk; ··· 71 67 if (rc) 72 68 return ERR_PTR(rc); 73 69 74 - clk = of_clk_get_by_clkspec(&clkspec); 70 + clk = __of_clk_get_by_clkspec(&clkspec, dev_id, con_id); 75 71 of_node_put(clkspec.np); 72 + 76 73 return clk; 74 + } 75 + 76 + struct clk *of_clk_get(struct device_node *np, int index) 77 + { 78 + return __of_clk_get(np, index, np->full_name, NULL); 77 79 } 78 80 EXPORT_SYMBOL(of_clk_get); 79 81 80 - /** 81 - * of_clk_get_by_name() - Parse and lookup a clock referenced by a device node 82 - * @np: pointer to clock consumer node 83 - * @name: name of consumer's clock input, or NULL for the first clock reference 84 - * 85 - * This function parses the clocks and clock-names properties, 86 - * and uses them to look up the struct clk from the registered list of clock 87 - * providers. 88 - */ 89 - struct clk *of_clk_get_by_name(struct device_node *np, const char *name) 82 + static struct clk *__of_clk_get_by_name(struct device_node *np, 83 + const char *dev_id, 84 + const char *name) 90 85 { 91 86 struct clk *clk = ERR_PTR(-ENOENT); 92 87 ··· 100 97 */ 101 98 if (name) 102 99 index = of_property_match_string(np, "clock-names", name); 103 - clk = of_clk_get(np, index); 104 - if (!IS_ERR(clk)) 100 + clk = __of_clk_get(np, index, dev_id, name); 101 + if (!IS_ERR(clk)) { 105 102 break; 106 - else if (name && index >= 0) { 103 + } else if (name && index >= 0) { 107 104 if (PTR_ERR(clk) != -EPROBE_DEFER) 108 105 pr_err("ERROR: could not get clock %s:%s(%i)\n", 109 106 np->full_name, name ? name : "", index); ··· 122 119 123 120 return clk; 124 121 } 122 + 123 + /** 124 + * of_clk_get_by_name() - Parse and lookup a clock referenced by a device node 125 + * @np: pointer to clock consumer node 126 + * @name: name of consumer's clock input, or NULL for the first clock reference 127 + * 128 + * This function parses the clocks and clock-names properties, 129 + * and uses them to look up the struct clk from the registered list of clock 130 + * providers. 131 + */ 132 + struct clk *of_clk_get_by_name(struct device_node *np, const char *name) 133 + { 134 + if (!np) 135 + return ERR_PTR(-ENOENT); 136 + 137 + return __of_clk_get_by_name(np, np->full_name, name); 138 + } 125 139 EXPORT_SYMBOL(of_clk_get_by_name); 140 + 141 + #else /* defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK) */ 142 + 143 + static struct clk *__of_clk_get_by_name(struct device_node *np, 144 + const char *dev_id, 145 + const char *name) 146 + { 147 + return ERR_PTR(-ENOENT); 148 + } 126 149 #endif 127 150 128 151 /* ··· 197 168 struct clk *clk_get_sys(const char *dev_id, const char *con_id) 198 169 { 199 170 struct clk_lookup *cl; 171 + struct clk *clk = NULL; 200 172 201 173 mutex_lock(&clocks_mutex); 174 + 202 175 cl = clk_find(dev_id, con_id); 203 - if (cl && !__clk_get(cl->clk)) 176 + if (!cl) 177 + goto out; 178 + 179 + clk = __clk_create_clk(__clk_get_hw(cl->clk), dev_id, con_id); 180 + if (IS_ERR(clk)) 181 + goto out; 182 + 183 + if (!__clk_get(clk)) { 184 + __clk_free_clk(clk); 204 185 cl = NULL; 186 + goto out; 187 + } 188 + 189 + out: 205 190 mutex_unlock(&clocks_mutex); 206 191 207 - return cl ? cl->clk : ERR_PTR(-ENOENT); 192 + return cl ? clk : ERR_PTR(-ENOENT); 208 193 } 209 194 EXPORT_SYMBOL(clk_get_sys); 210 195 ··· 228 185 struct clk *clk; 229 186 230 187 if (dev) { 231 - clk = of_clk_get_by_name(dev->of_node, con_id); 232 - if (!IS_ERR(clk)) 233 - return clk; 234 - if (PTR_ERR(clk) == -EPROBE_DEFER) 188 + clk = __of_clk_get_by_name(dev->of_node, dev_id, con_id); 189 + if (!IS_ERR(clk) || PTR_ERR(clk) == -EPROBE_DEFER) 235 190 return clk; 236 191 } 237 192 ··· 372 331 373 332 return 0; 374 333 } 334 + EXPORT_SYMBOL(clk_register_clkdev); 375 335 376 336 /** 377 337 * clk_register_clkdevs - register a set of clk_lookup for a struct clk
+2
drivers/clk/hisilicon/clk-hi3620.c
··· 295 295 } 296 296 297 297 static long mmc_clk_determine_rate(struct clk_hw *hw, unsigned long rate, 298 + unsigned long min_rate, 299 + unsigned long max_rate, 298 300 unsigned long *best_parent_rate, 299 301 struct clk_hw **best_parent_p) 300 302 {
+2
drivers/clk/mmp/clk-mix.c
··· 202 202 } 203 203 204 204 static long mmp_clk_mix_determine_rate(struct clk_hw *hw, unsigned long rate, 205 + unsigned long min_rate, 206 + unsigned long max_rate, 205 207 unsigned long *best_parent_rate, 206 208 struct clk_hw **best_parent_clk) 207 209 {
+1
drivers/clk/pxa/Makefile
··· 1 1 obj-y += clk-pxa.o 2 2 obj-$(CONFIG_PXA25x) += clk-pxa25x.o 3 3 obj-$(CONFIG_PXA27x) += clk-pxa27x.o 4 + obj-$(CONFIG_PXA3xx) += clk-pxa3xx.o
+1 -1
drivers/clk/pxa/clk-pxa.c
··· 46 46 fix = &pclk->lp; 47 47 else 48 48 fix = &pclk->hp; 49 - fix->hw.clk = hw->clk; 49 + __clk_hw_set_clk(&fix->hw, hw); 50 50 return clk_fixed_factor_ops.recalc_rate(&fix->hw, parent_rate); 51 51 } 52 52
+364
drivers/clk/pxa/clk-pxa3xx.c
··· 1 + /* 2 + * Marvell PXA3xxx family clocks 3 + * 4 + * Copyright (C) 2014 Robert Jarzmik 5 + * 6 + * Heavily inspired from former arch/arm/mach-pxa/pxa3xx.c 7 + * 8 + * This program is free software; you can redistribute it and/or modify 9 + * it under the terms of the GNU General Public License as published by 10 + * the Free Software Foundation; version 2 of the License. 11 + * 12 + * For non-devicetree platforms. Once pxa is fully converted to devicetree, this 13 + * should go away. 14 + */ 15 + #include <linux/io.h> 16 + #include <linux/clk.h> 17 + #include <linux/clk-provider.h> 18 + #include <linux/clkdev.h> 19 + #include <linux/of.h> 20 + #include <mach/smemc.h> 21 + #include <mach/pxa3xx-regs.h> 22 + 23 + #include <dt-bindings/clock/pxa-clock.h> 24 + #include "clk-pxa.h" 25 + 26 + #define KHz 1000 27 + #define MHz (1000 * 1000) 28 + 29 + enum { 30 + PXA_CORE_60Mhz = 0, 31 + PXA_CORE_RUN, 32 + PXA_CORE_TURBO, 33 + }; 34 + 35 + enum { 36 + PXA_BUS_60Mhz = 0, 37 + PXA_BUS_HSS, 38 + }; 39 + 40 + /* crystal frequency to HSIO bus frequency multiplier (HSS) */ 41 + static unsigned char hss_mult[4] = { 8, 12, 16, 24 }; 42 + 43 + /* crystal frequency to static memory controller multiplier (SMCFS) */ 44 + static unsigned int smcfs_mult[8] = { 6, 0, 8, 0, 0, 16, }; 45 + static unsigned int df_clkdiv[4] = { 1, 2, 4, 1 }; 46 + 47 + static const char * const get_freq_khz[] = { 48 + "core", "ring_osc_60mhz", "run", "cpll", "system_bus" 49 + }; 50 + 51 + /* 52 + * Get the clock frequency as reflected by ACSR and the turbo flag. 53 + * We assume these values have been applied via a fcs. 54 + * If info is not 0 we also display the current settings. 55 + */ 56 + unsigned int pxa3xx_get_clk_frequency_khz(int info) 57 + { 58 + struct clk *clk; 59 + unsigned long clks[5]; 60 + int i; 61 + 62 + for (i = 0; i < 5; i++) { 63 + clk = clk_get(NULL, get_freq_khz[i]); 64 + if (IS_ERR(clk)) { 65 + clks[i] = 0; 66 + } else { 67 + clks[i] = clk_get_rate(clk); 68 + clk_put(clk); 69 + } 70 + } 71 + if (info) { 72 + pr_info("RO Mode clock: %ld.%02ldMHz\n", 73 + clks[1] / 1000000, (clks[0] % 1000000) / 10000); 74 + pr_info("Run Mode clock: %ld.%02ldMHz\n", 75 + clks[2] / 1000000, (clks[1] % 1000000) / 10000); 76 + pr_info("Turbo Mode clock: %ld.%02ldMHz\n", 77 + clks[3] / 1000000, (clks[2] % 1000000) / 10000); 78 + pr_info("System bus clock: %ld.%02ldMHz\n", 79 + clks[4] / 1000000, (clks[4] % 1000000) / 10000); 80 + } 81 + return (unsigned int)clks[0]; 82 + } 83 + 84 + static unsigned long clk_pxa3xx_ac97_get_rate(struct clk_hw *hw, 85 + unsigned long parent_rate) 86 + { 87 + unsigned long ac97_div, rate; 88 + 89 + ac97_div = AC97_DIV; 90 + 91 + /* This may loose precision for some rates but won't for the 92 + * standard 24.576MHz. 93 + */ 94 + rate = parent_rate / 2; 95 + rate /= ((ac97_div >> 12) & 0x7fff); 96 + rate *= (ac97_div & 0xfff); 97 + 98 + return rate; 99 + } 100 + PARENTS(clk_pxa3xx_ac97) = { "spll_624mhz" }; 101 + RATE_RO_OPS(clk_pxa3xx_ac97, "ac97"); 102 + 103 + static unsigned long clk_pxa3xx_smemc_get_rate(struct clk_hw *hw, 104 + unsigned long parent_rate) 105 + { 106 + unsigned long acsr = ACSR; 107 + unsigned long memclkcfg = __raw_readl(MEMCLKCFG); 108 + 109 + return (parent_rate / 48) * smcfs_mult[(acsr >> 23) & 0x7] / 110 + df_clkdiv[(memclkcfg >> 16) & 0x3]; 111 + } 112 + PARENTS(clk_pxa3xx_smemc) = { "spll_624mhz" }; 113 + RATE_RO_OPS(clk_pxa3xx_smemc, "smemc"); 114 + 115 + static bool pxa3xx_is_ring_osc_forced(void) 116 + { 117 + unsigned long acsr = ACSR; 118 + 119 + return acsr & ACCR_D0CS; 120 + } 121 + 122 + PARENTS(pxa3xx_pbus) = { "ring_osc_60mhz", "spll_624mhz" }; 123 + PARENTS(pxa3xx_32Khz_bus) = { "osc_32_768khz", "osc_32_768khz" }; 124 + PARENTS(pxa3xx_13MHz_bus) = { "osc_13mhz", "osc_13mhz" }; 125 + PARENTS(pxa3xx_ac97_bus) = { "ring_osc_60mhz", "ac97" }; 126 + PARENTS(pxa3xx_sbus) = { "ring_osc_60mhz", "system_bus" }; 127 + PARENTS(pxa3xx_smemcbus) = { "ring_osc_60mhz", "smemc" }; 128 + 129 + #define CKEN_AB(bit) ((CKEN_ ## bit > 31) ? &CKENA : &CKENB) 130 + #define PXA3XX_CKEN(dev_id, con_id, parents, mult_lp, div_lp, mult_hp, \ 131 + div_hp, bit, is_lp, flags) \ 132 + PXA_CKEN(dev_id, con_id, bit, parents, mult_lp, div_lp, \ 133 + mult_hp, div_hp, is_lp, CKEN_AB(bit), \ 134 + (CKEN_ ## bit % 32), flags) 135 + #define PXA3XX_PBUS_CKEN(dev_id, con_id, bit, mult_lp, div_lp, \ 136 + mult_hp, div_hp, delay) \ 137 + PXA3XX_CKEN(dev_id, con_id, pxa3xx_pbus_parents, mult_lp, \ 138 + div_lp, mult_hp, div_hp, bit, pxa3xx_is_ring_osc_forced, 0) 139 + #define PXA3XX_CKEN_1RATE(dev_id, con_id, bit, parents) \ 140 + PXA_CKEN_1RATE(dev_id, con_id, bit, parents, \ 141 + CKEN_AB(bit), (CKEN_ ## bit % 32), 0) 142 + 143 + static struct desc_clk_cken pxa3xx_clocks[] __initdata = { 144 + PXA3XX_PBUS_CKEN("pxa2xx-uart.0", NULL, FFUART, 1, 4, 1, 42, 1), 145 + PXA3XX_PBUS_CKEN("pxa2xx-uart.1", NULL, BTUART, 1, 4, 1, 42, 1), 146 + PXA3XX_PBUS_CKEN("pxa2xx-uart.2", NULL, STUART, 1, 4, 1, 42, 1), 147 + PXA3XX_PBUS_CKEN("pxa2xx-i2c.0", NULL, I2C, 2, 5, 1, 19, 0), 148 + PXA3XX_PBUS_CKEN("pxa27x-udc", NULL, UDC, 1, 4, 1, 13, 5), 149 + PXA3XX_PBUS_CKEN("pxa27x-ohci", NULL, USBH, 1, 4, 1, 13, 0), 150 + PXA3XX_PBUS_CKEN("pxa3xx-u2d", NULL, USB2, 1, 4, 1, 13, 0), 151 + PXA3XX_PBUS_CKEN("pxa27x-pwm.0", NULL, PWM0, 1, 6, 1, 48, 0), 152 + PXA3XX_PBUS_CKEN("pxa27x-pwm.1", NULL, PWM1, 1, 6, 1, 48, 0), 153 + PXA3XX_PBUS_CKEN("pxa2xx-mci.0", NULL, MMC1, 1, 4, 1, 24, 0), 154 + PXA3XX_PBUS_CKEN("pxa2xx-mci.1", NULL, MMC2, 1, 4, 1, 24, 0), 155 + PXA3XX_PBUS_CKEN("pxa2xx-mci.2", NULL, MMC3, 1, 4, 1, 24, 0), 156 + 157 + PXA3XX_CKEN_1RATE("pxa27x-keypad", NULL, KEYPAD, 158 + pxa3xx_32Khz_bus_parents), 159 + PXA3XX_CKEN_1RATE("pxa3xx-ssp.0", NULL, SSP1, pxa3xx_13MHz_bus_parents), 160 + PXA3XX_CKEN_1RATE("pxa3xx-ssp.1", NULL, SSP2, pxa3xx_13MHz_bus_parents), 161 + PXA3XX_CKEN_1RATE("pxa3xx-ssp.2", NULL, SSP3, pxa3xx_13MHz_bus_parents), 162 + PXA3XX_CKEN_1RATE("pxa3xx-ssp.3", NULL, SSP4, pxa3xx_13MHz_bus_parents), 163 + 164 + PXA3XX_CKEN(NULL, "AC97CLK", pxa3xx_ac97_bus_parents, 1, 4, 1, 1, AC97, 165 + pxa3xx_is_ring_osc_forced, 0), 166 + PXA3XX_CKEN(NULL, "CAMCLK", pxa3xx_sbus_parents, 1, 2, 1, 1, CAMERA, 167 + pxa3xx_is_ring_osc_forced, 0), 168 + PXA3XX_CKEN("pxa2xx-fb", NULL, pxa3xx_sbus_parents, 1, 1, 1, 1, LCD, 169 + pxa3xx_is_ring_osc_forced, 0), 170 + PXA3XX_CKEN("pxa2xx-pcmcia", NULL, pxa3xx_smemcbus_parents, 1, 4, 171 + 1, 1, SMC, pxa3xx_is_ring_osc_forced, CLK_IGNORE_UNUSED), 172 + }; 173 + 174 + static struct desc_clk_cken pxa300_310_clocks[] __initdata = { 175 + 176 + PXA3XX_PBUS_CKEN("pxa3xx-gcu", NULL, PXA300_GCU, 1, 1, 1, 1, 0), 177 + PXA3XX_PBUS_CKEN("pxa3xx-nand", NULL, NAND, 1, 2, 1, 4, 0), 178 + PXA3XX_CKEN_1RATE("pxa3xx-gpio", NULL, GPIO, pxa3xx_13MHz_bus_parents), 179 + }; 180 + 181 + static struct desc_clk_cken pxa320_clocks[] __initdata = { 182 + PXA3XX_PBUS_CKEN("pxa3xx-nand", NULL, NAND, 1, 2, 1, 6, 0), 183 + PXA3XX_PBUS_CKEN("pxa3xx-gcu", NULL, PXA320_GCU, 1, 1, 1, 1, 0), 184 + PXA3XX_CKEN_1RATE("pxa3xx-gpio", NULL, GPIO, pxa3xx_13MHz_bus_parents), 185 + }; 186 + 187 + static struct desc_clk_cken pxa93x_clocks[] __initdata = { 188 + 189 + PXA3XX_PBUS_CKEN("pxa3xx-gcu", NULL, PXA300_GCU, 1, 1, 1, 1, 0), 190 + PXA3XX_PBUS_CKEN("pxa3xx-nand", NULL, NAND, 1, 2, 1, 4, 0), 191 + PXA3XX_CKEN_1RATE("pxa93x-gpio", NULL, GPIO, pxa3xx_13MHz_bus_parents), 192 + }; 193 + 194 + static unsigned long clk_pxa3xx_system_bus_get_rate(struct clk_hw *hw, 195 + unsigned long parent_rate) 196 + { 197 + unsigned long acsr = ACSR; 198 + unsigned int hss = (acsr >> 14) & 0x3; 199 + 200 + if (pxa3xx_is_ring_osc_forced()) 201 + return parent_rate; 202 + return parent_rate / 48 * hss_mult[hss]; 203 + } 204 + 205 + static u8 clk_pxa3xx_system_bus_get_parent(struct clk_hw *hw) 206 + { 207 + if (pxa3xx_is_ring_osc_forced()) 208 + return PXA_BUS_60Mhz; 209 + else 210 + return PXA_BUS_HSS; 211 + } 212 + 213 + PARENTS(clk_pxa3xx_system_bus) = { "ring_osc_60mhz", "spll_624mhz" }; 214 + MUX_RO_RATE_RO_OPS(clk_pxa3xx_system_bus, "system_bus"); 215 + 216 + static unsigned long clk_pxa3xx_core_get_rate(struct clk_hw *hw, 217 + unsigned long parent_rate) 218 + { 219 + return parent_rate; 220 + } 221 + 222 + static u8 clk_pxa3xx_core_get_parent(struct clk_hw *hw) 223 + { 224 + unsigned long xclkcfg; 225 + unsigned int t; 226 + 227 + if (pxa3xx_is_ring_osc_forced()) 228 + return PXA_CORE_60Mhz; 229 + 230 + /* Read XCLKCFG register turbo bit */ 231 + __asm__ __volatile__("mrc\tp14, 0, %0, c6, c0, 0" : "=r"(xclkcfg)); 232 + t = xclkcfg & 0x1; 233 + 234 + if (t) 235 + return PXA_CORE_TURBO; 236 + return PXA_CORE_RUN; 237 + } 238 + PARENTS(clk_pxa3xx_core) = { "ring_osc_60mhz", "run", "cpll" }; 239 + MUX_RO_RATE_RO_OPS(clk_pxa3xx_core, "core"); 240 + 241 + static unsigned long clk_pxa3xx_run_get_rate(struct clk_hw *hw, 242 + unsigned long parent_rate) 243 + { 244 + unsigned long acsr = ACSR; 245 + unsigned int xn = (acsr & ACCR_XN_MASK) >> 8; 246 + unsigned int t, xclkcfg; 247 + 248 + /* Read XCLKCFG register turbo bit */ 249 + __asm__ __volatile__("mrc\tp14, 0, %0, c6, c0, 0" : "=r"(xclkcfg)); 250 + t = xclkcfg & 0x1; 251 + 252 + return t ? (parent_rate / xn) * 2 : parent_rate; 253 + } 254 + PARENTS(clk_pxa3xx_run) = { "cpll" }; 255 + RATE_RO_OPS(clk_pxa3xx_run, "run"); 256 + 257 + static unsigned long clk_pxa3xx_cpll_get_rate(struct clk_hw *hw, 258 + unsigned long parent_rate) 259 + { 260 + unsigned long acsr = ACSR; 261 + unsigned int xn = (acsr & ACCR_XN_MASK) >> 8; 262 + unsigned int xl = acsr & ACCR_XL_MASK; 263 + unsigned int t, xclkcfg; 264 + 265 + /* Read XCLKCFG register turbo bit */ 266 + __asm__ __volatile__("mrc\tp14, 0, %0, c6, c0, 0" : "=r"(xclkcfg)); 267 + t = xclkcfg & 0x1; 268 + 269 + pr_info("RJK: parent_rate=%lu, xl=%u, xn=%u\n", parent_rate, xl, xn); 270 + return t ? parent_rate * xl * xn : parent_rate * xl; 271 + } 272 + PARENTS(clk_pxa3xx_cpll) = { "osc_13mhz" }; 273 + RATE_RO_OPS(clk_pxa3xx_cpll, "cpll"); 274 + 275 + static void __init pxa3xx_register_core(void) 276 + { 277 + clk_register_clk_pxa3xx_cpll(); 278 + clk_register_clk_pxa3xx_run(); 279 + 280 + clkdev_pxa_register(CLK_CORE, "core", NULL, 281 + clk_register_clk_pxa3xx_core()); 282 + } 283 + 284 + static void __init pxa3xx_register_plls(void) 285 + { 286 + clk_register_fixed_rate(NULL, "osc_13mhz", NULL, 287 + CLK_GET_RATE_NOCACHE | CLK_IS_ROOT, 288 + 13 * MHz); 289 + clk_register_fixed_rate(NULL, "osc_32_768khz", NULL, 290 + CLK_GET_RATE_NOCACHE | CLK_IS_ROOT, 291 + 32768); 292 + clk_register_fixed_rate(NULL, "ring_osc_120mhz", NULL, 293 + CLK_GET_RATE_NOCACHE | CLK_IS_ROOT, 294 + 120 * MHz); 295 + clk_register_fixed_rate(NULL, "clk_dummy", NULL, CLK_IS_ROOT, 0); 296 + clk_register_fixed_factor(NULL, "spll_624mhz", "osc_13mhz", 0, 48, 1); 297 + clk_register_fixed_factor(NULL, "ring_osc_60mhz", "ring_osc_120mhz", 298 + 0, 1, 2); 299 + } 300 + 301 + #define DUMMY_CLK(_con_id, _dev_id, _parent) \ 302 + { .con_id = _con_id, .dev_id = _dev_id, .parent = _parent } 303 + struct dummy_clk { 304 + const char *con_id; 305 + const char *dev_id; 306 + const char *parent; 307 + }; 308 + static struct dummy_clk dummy_clks[] __initdata = { 309 + DUMMY_CLK(NULL, "pxa93x-gpio", "osc_13mhz"), 310 + DUMMY_CLK(NULL, "sa1100-rtc", "osc_32_768khz"), 311 + DUMMY_CLK("UARTCLK", "pxa2xx-ir", "STUART"), 312 + DUMMY_CLK(NULL, "pxa3xx-pwri2c.1", "osc_13mhz"), 313 + }; 314 + 315 + static void __init pxa3xx_dummy_clocks_init(void) 316 + { 317 + struct clk *clk; 318 + struct dummy_clk *d; 319 + const char *name; 320 + int i; 321 + 322 + for (i = 0; i < ARRAY_SIZE(dummy_clks); i++) { 323 + d = &dummy_clks[i]; 324 + name = d->dev_id ? d->dev_id : d->con_id; 325 + clk = clk_register_fixed_factor(NULL, name, d->parent, 0, 1, 1); 326 + clk_register_clkdev(clk, d->con_id, d->dev_id); 327 + } 328 + } 329 + 330 + static void __init pxa3xx_base_clocks_init(void) 331 + { 332 + pxa3xx_register_plls(); 333 + pxa3xx_register_core(); 334 + clk_register_clk_pxa3xx_system_bus(); 335 + clk_register_clk_pxa3xx_ac97(); 336 + clk_register_clk_pxa3xx_smemc(); 337 + clk_register_gate(NULL, "CLK_POUT", "osc_13mhz", 0, 338 + (void __iomem *)&OSCC, 11, 0, NULL); 339 + } 340 + 341 + int __init pxa3xx_clocks_init(void) 342 + { 343 + int ret; 344 + 345 + pxa3xx_base_clocks_init(); 346 + pxa3xx_dummy_clocks_init(); 347 + ret = clk_pxa_cken_init(pxa3xx_clocks, ARRAY_SIZE(pxa3xx_clocks)); 348 + if (ret) 349 + return ret; 350 + if (cpu_is_pxa320()) 351 + return clk_pxa_cken_init(pxa320_clocks, 352 + ARRAY_SIZE(pxa320_clocks)); 353 + if (cpu_is_pxa300() || cpu_is_pxa310()) 354 + return clk_pxa_cken_init(pxa300_310_clocks, 355 + ARRAY_SIZE(pxa300_310_clocks)); 356 + return clk_pxa_cken_init(pxa93x_clocks, ARRAY_SIZE(pxa93x_clocks)); 357 + } 358 + 359 + static void __init pxa3xx_dt_clocks_init(struct device_node *np) 360 + { 361 + pxa3xx_clocks_init(); 362 + clk_pxa_dt_common_init(np); 363 + } 364 + CLK_OF_DECLARE(pxa_clks, "marvell,pxa300-clocks", pxa3xx_dt_clocks_init);
+18
drivers/clk/qcom/Kconfig
··· 29 29 Say Y if you want to use peripheral devices such as UART, SPI, 30 30 i2c, USB, SD/eMMC, etc. 31 31 32 + config IPQ_LCC_806X 33 + tristate "IPQ806x LPASS Clock Controller" 34 + select IPQ_GCC_806X 35 + depends on COMMON_CLK_QCOM 36 + help 37 + Support for the LPASS clock controller on ipq806x devices. 38 + Say Y if you want to use audio devices such as i2s, pcm, 39 + S/PDIF, etc. 40 + 32 41 config MSM_GCC_8660 33 42 tristate "MSM8660 Global Clock Controller" 34 43 depends on COMMON_CLK_QCOM ··· 53 44 Support for the global clock controller on apq8064/msm8960 devices. 54 45 Say Y if you want to use peripheral devices such as UART, SPI, 55 46 i2c, USB, SD/eMMC, SATA, PCIe, etc. 47 + 48 + config MSM_LCC_8960 49 + tristate "APQ8064/MSM8960 LPASS Clock Controller" 50 + select MSM_GCC_8960 51 + depends on COMMON_CLK_QCOM 52 + help 53 + Support for the LPASS clock controller on apq8064/msm8960 devices. 54 + Say Y if you want to use audio devices such as i2s, pcm, 55 + SLIMBus, etc. 56 56 57 57 config MSM_MMCC_8960 58 58 tristate "MSM8960 Multimedia Clock Controller"
+4
drivers/clk/qcom/Makefile
··· 6 6 clk-qcom-y += clk-rcg.o 7 7 clk-qcom-y += clk-rcg2.o 8 8 clk-qcom-y += clk-branch.o 9 + clk-qcom-y += clk-regmap-divider.o 10 + clk-qcom-y += clk-regmap-mux.o 9 11 clk-qcom-y += reset.o 10 12 11 13 obj-$(CONFIG_APQ_GCC_8084) += gcc-apq8084.o 12 14 obj-$(CONFIG_APQ_MMCC_8084) += mmcc-apq8084.o 13 15 obj-$(CONFIG_IPQ_GCC_806X) += gcc-ipq806x.o 16 + obj-$(CONFIG_IPQ_LCC_806X) += lcc-ipq806x.o 14 17 obj-$(CONFIG_MSM_GCC_8660) += gcc-msm8660.o 15 18 obj-$(CONFIG_MSM_GCC_8960) += gcc-msm8960.o 19 + obj-$(CONFIG_MSM_LCC_8960) += lcc-msm8960.o 16 20 obj-$(CONFIG_MSM_GCC_8974) += gcc-msm8974.o 17 21 obj-$(CONFIG_MSM_MMCC_8960) += mmcc-msm8960.o 18 22 obj-$(CONFIG_MSM_MMCC_8974) += mmcc-msm8974.o
+1
drivers/clk/qcom/clk-pll.c
··· 141 141 142 142 static long 143 143 clk_pll_determine_rate(struct clk_hw *hw, unsigned long rate, 144 + unsigned long min_rate, unsigned long max_rate, 144 145 unsigned long *p_rate, struct clk_hw **p) 145 146 { 146 147 struct clk_pll *pll = to_clk_pll(hw);
+8 -2
drivers/clk/qcom/clk-rcg.c
··· 368 368 369 369 static long _freq_tbl_determine_rate(struct clk_hw *hw, 370 370 const struct freq_tbl *f, unsigned long rate, 371 + unsigned long min_rate, unsigned long max_rate, 371 372 unsigned long *p_rate, struct clk_hw **p_hw) 372 373 { 373 374 unsigned long clk_flags; ··· 398 397 } 399 398 400 399 static long clk_rcg_determine_rate(struct clk_hw *hw, unsigned long rate, 400 + unsigned long min_rate, unsigned long max_rate, 401 401 unsigned long *p_rate, struct clk_hw **p) 402 402 { 403 403 struct clk_rcg *rcg = to_clk_rcg(hw); 404 404 405 - return _freq_tbl_determine_rate(hw, rcg->freq_tbl, rate, p_rate, p); 405 + return _freq_tbl_determine_rate(hw, rcg->freq_tbl, rate, min_rate, 406 + max_rate, p_rate, p); 406 407 } 407 408 408 409 static long clk_dyn_rcg_determine_rate(struct clk_hw *hw, unsigned long rate, 410 + unsigned long min_rate, unsigned long max_rate, 409 411 unsigned long *p_rate, struct clk_hw **p) 410 412 { 411 413 struct clk_dyn_rcg *rcg = to_clk_dyn_rcg(hw); 412 414 413 - return _freq_tbl_determine_rate(hw, rcg->freq_tbl, rate, p_rate, p); 415 + return _freq_tbl_determine_rate(hw, rcg->freq_tbl, rate, min_rate, 416 + max_rate, p_rate, p); 414 417 } 415 418 416 419 static long clk_rcg_bypass_determine_rate(struct clk_hw *hw, unsigned long rate, 420 + unsigned long min_rate, unsigned long max_rate, 417 421 unsigned long *p_rate, struct clk_hw **p_hw) 418 422 { 419 423 struct clk_rcg *rcg = to_clk_rcg(hw);
+6
drivers/clk/qcom/clk-rcg2.c
··· 208 208 } 209 209 210 210 static long clk_rcg2_determine_rate(struct clk_hw *hw, unsigned long rate, 211 + unsigned long min_rate, unsigned long max_rate, 211 212 unsigned long *p_rate, struct clk_hw **p) 212 213 { 213 214 struct clk_rcg2 *rcg = to_clk_rcg2(hw); ··· 362 361 } 363 362 364 363 static long clk_edp_pixel_determine_rate(struct clk_hw *hw, unsigned long rate, 364 + unsigned long min_rate, 365 + unsigned long max_rate, 365 366 unsigned long *p_rate, struct clk_hw **p) 366 367 { 367 368 struct clk_rcg2 *rcg = to_clk_rcg2(hw); ··· 415 412 EXPORT_SYMBOL_GPL(clk_edp_pixel_ops); 416 413 417 414 static long clk_byte_determine_rate(struct clk_hw *hw, unsigned long rate, 415 + unsigned long min_rate, unsigned long max_rate, 418 416 unsigned long *p_rate, struct clk_hw **p_hw) 419 417 { 420 418 struct clk_rcg2 *rcg = to_clk_rcg2(hw); ··· 480 476 }; 481 477 482 478 static long clk_pixel_determine_rate(struct clk_hw *hw, unsigned long rate, 479 + unsigned long min_rate, 480 + unsigned long max_rate, 483 481 unsigned long *p_rate, struct clk_hw **p) 484 482 { 485 483 struct clk_rcg2 *rcg = to_clk_rcg2(hw);
+70
drivers/clk/qcom/clk-regmap-divider.c
··· 1 + /* 2 + * Copyright (c) 2014, The Linux Foundation. All rights reserved. 3 + * 4 + * This software is licensed under the terms of the GNU General Public 5 + * License version 2, as published by the Free Software Foundation, and 6 + * may be copied, distributed, and modified under those terms. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + */ 13 + 14 + #include <linux/kernel.h> 15 + #include <linux/bitops.h> 16 + #include <linux/regmap.h> 17 + #include <linux/export.h> 18 + 19 + #include "clk-regmap-divider.h" 20 + 21 + static inline struct clk_regmap_div *to_clk_regmap_div(struct clk_hw *hw) 22 + { 23 + return container_of(to_clk_regmap(hw), struct clk_regmap_div, clkr); 24 + } 25 + 26 + static long div_round_rate(struct clk_hw *hw, unsigned long rate, 27 + unsigned long *prate) 28 + { 29 + struct clk_regmap_div *divider = to_clk_regmap_div(hw); 30 + 31 + return divider_round_rate(hw, rate, prate, NULL, divider->width, 32 + CLK_DIVIDER_ROUND_CLOSEST); 33 + } 34 + 35 + static int div_set_rate(struct clk_hw *hw, unsigned long rate, 36 + unsigned long parent_rate) 37 + { 38 + struct clk_regmap_div *divider = to_clk_regmap_div(hw); 39 + struct clk_regmap *clkr = &divider->clkr; 40 + u32 div; 41 + 42 + div = divider_get_val(rate, parent_rate, NULL, divider->width, 43 + CLK_DIVIDER_ROUND_CLOSEST); 44 + 45 + return regmap_update_bits(clkr->regmap, divider->reg, 46 + (BIT(divider->width) - 1) << divider->shift, 47 + div << divider->shift); 48 + } 49 + 50 + static unsigned long div_recalc_rate(struct clk_hw *hw, 51 + unsigned long parent_rate) 52 + { 53 + struct clk_regmap_div *divider = to_clk_regmap_div(hw); 54 + struct clk_regmap *clkr = &divider->clkr; 55 + u32 div; 56 + 57 + regmap_read(clkr->regmap, divider->reg, &div); 58 + div >>= divider->shift; 59 + div &= BIT(divider->width) - 1; 60 + 61 + return divider_recalc_rate(hw, parent_rate, div, NULL, 62 + CLK_DIVIDER_ROUND_CLOSEST); 63 + } 64 + 65 + const struct clk_ops clk_regmap_div_ops = { 66 + .round_rate = div_round_rate, 67 + .set_rate = div_set_rate, 68 + .recalc_rate = div_recalc_rate, 69 + }; 70 + EXPORT_SYMBOL_GPL(clk_regmap_div_ops);
+29
drivers/clk/qcom/clk-regmap-divider.h
··· 1 + /* 2 + * Copyright (c) 2014, The Linux Foundation. All rights reserved. 3 + * 4 + * This software is licensed under the terms of the GNU General Public 5 + * License version 2, as published by the Free Software Foundation, and 6 + * may be copied, distributed, and modified under those terms. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + */ 13 + 14 + #ifndef __QCOM_CLK_REGMAP_DIVIDER_H__ 15 + #define __QCOM_CLK_REGMAP_DIVIDER_H__ 16 + 17 + #include <linux/clk-provider.h> 18 + #include "clk-regmap.h" 19 + 20 + struct clk_regmap_div { 21 + u32 reg; 22 + u32 shift; 23 + u32 width; 24 + struct clk_regmap clkr; 25 + }; 26 + 27 + extern const struct clk_ops clk_regmap_div_ops; 28 + 29 + #endif
+59
drivers/clk/qcom/clk-regmap-mux.c
··· 1 + /* 2 + * Copyright (c) 2014, The Linux Foundation. All rights reserved. 3 + * 4 + * This software is licensed under the terms of the GNU General Public 5 + * License version 2, as published by the Free Software Foundation, and 6 + * may be copied, distributed, and modified under those terms. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + */ 13 + 14 + #include <linux/kernel.h> 15 + #include <linux/bitops.h> 16 + #include <linux/regmap.h> 17 + #include <linux/export.h> 18 + 19 + #include "clk-regmap-mux.h" 20 + 21 + static inline struct clk_regmap_mux *to_clk_regmap_mux(struct clk_hw *hw) 22 + { 23 + return container_of(to_clk_regmap(hw), struct clk_regmap_mux, clkr); 24 + } 25 + 26 + static u8 mux_get_parent(struct clk_hw *hw) 27 + { 28 + struct clk_regmap_mux *mux = to_clk_regmap_mux(hw); 29 + struct clk_regmap *clkr = to_clk_regmap(hw); 30 + unsigned int mask = GENMASK(mux->width - 1, 0); 31 + unsigned int val; 32 + 33 + regmap_read(clkr->regmap, mux->reg, &val); 34 + 35 + val >>= mux->shift; 36 + val &= mask; 37 + 38 + return val; 39 + } 40 + 41 + static int mux_set_parent(struct clk_hw *hw, u8 index) 42 + { 43 + struct clk_regmap_mux *mux = to_clk_regmap_mux(hw); 44 + struct clk_regmap *clkr = to_clk_regmap(hw); 45 + unsigned int mask = GENMASK(mux->width + mux->shift - 1, mux->shift); 46 + unsigned int val; 47 + 48 + val = index; 49 + val <<= mux->shift; 50 + 51 + return regmap_update_bits(clkr->regmap, mux->reg, mask, val); 52 + } 53 + 54 + const struct clk_ops clk_regmap_mux_closest_ops = { 55 + .get_parent = mux_get_parent, 56 + .set_parent = mux_set_parent, 57 + .determine_rate = __clk_mux_determine_rate_closest, 58 + }; 59 + EXPORT_SYMBOL_GPL(clk_regmap_mux_closest_ops);
+29
drivers/clk/qcom/clk-regmap-mux.h
··· 1 + /* 2 + * Copyright (c) 2014, The Linux Foundation. All rights reserved. 3 + * 4 + * This software is licensed under the terms of the GNU General Public 5 + * License version 2, as published by the Free Software Foundation, and 6 + * may be copied, distributed, and modified under those terms. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + */ 13 + 14 + #ifndef __QCOM_CLK_REGMAP_MUX_H__ 15 + #define __QCOM_CLK_REGMAP_MUX_H__ 16 + 17 + #include <linux/clk-provider.h> 18 + #include "clk-regmap.h" 19 + 20 + struct clk_regmap_mux { 21 + u32 reg; 22 + u32 shift; 23 + u32 width; 24 + struct clk_regmap clkr; 25 + }; 26 + 27 + extern const struct clk_ops clk_regmap_mux_closest_ops; 28 + 29 + #endif
+12
drivers/clk/qcom/gcc-ipq806x.c
··· 75 75 }, 76 76 }; 77 77 78 + static struct clk_regmap pll4_vote = { 79 + .enable_reg = 0x34c0, 80 + .enable_mask = BIT(4), 81 + .hw.init = &(struct clk_init_data){ 82 + .name = "pll4_vote", 83 + .parent_names = (const char *[]){ "pll4" }, 84 + .num_parents = 1, 85 + .ops = &clk_pll_vote_ops, 86 + }, 87 + }; 88 + 78 89 static struct clk_pll pll8 = { 79 90 .l_reg = 0x3144, 80 91 .m_reg = 0x3148, ··· 2174 2163 [PLL0] = &pll0.clkr, 2175 2164 [PLL0_VOTE] = &pll0_vote, 2176 2165 [PLL3] = &pll3.clkr, 2166 + [PLL4_VOTE] = &pll4_vote, 2177 2167 [PLL8] = &pll8.clkr, 2178 2168 [PLL8_VOTE] = &pll8_vote, 2179 2169 [PLL14] = &pll14.clkr,
+473
drivers/clk/qcom/lcc-ipq806x.c
··· 1 + /* 2 + * Copyright (c) 2014, The Linux Foundation. All rights reserved. 3 + * 4 + * This software is licensed under the terms of the GNU General Public 5 + * License version 2, as published by the Free Software Foundation, and 6 + * may be copied, distributed, and modified under those terms. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + */ 13 + 14 + #include <linux/kernel.h> 15 + #include <linux/bitops.h> 16 + #include <linux/err.h> 17 + #include <linux/platform_device.h> 18 + #include <linux/module.h> 19 + #include <linux/of.h> 20 + #include <linux/of_device.h> 21 + #include <linux/clk-provider.h> 22 + #include <linux/regmap.h> 23 + 24 + #include <dt-bindings/clock/qcom,lcc-ipq806x.h> 25 + 26 + #include "common.h" 27 + #include "clk-regmap.h" 28 + #include "clk-pll.h" 29 + #include "clk-rcg.h" 30 + #include "clk-branch.h" 31 + #include "clk-regmap-divider.h" 32 + #include "clk-regmap-mux.h" 33 + 34 + static struct clk_pll pll4 = { 35 + .l_reg = 0x4, 36 + .m_reg = 0x8, 37 + .n_reg = 0xc, 38 + .config_reg = 0x14, 39 + .mode_reg = 0x0, 40 + .status_reg = 0x18, 41 + .status_bit = 16, 42 + .clkr.hw.init = &(struct clk_init_data){ 43 + .name = "pll4", 44 + .parent_names = (const char *[]){ "pxo" }, 45 + .num_parents = 1, 46 + .ops = &clk_pll_ops, 47 + }, 48 + }; 49 + 50 + static const struct pll_config pll4_config = { 51 + .l = 0xf, 52 + .m = 0x91, 53 + .n = 0xc7, 54 + .vco_val = 0x0, 55 + .vco_mask = BIT(17) | BIT(16), 56 + .pre_div_val = 0x0, 57 + .pre_div_mask = BIT(19), 58 + .post_div_val = 0x0, 59 + .post_div_mask = BIT(21) | BIT(20), 60 + .mn_ena_mask = BIT(22), 61 + .main_output_mask = BIT(23), 62 + }; 63 + 64 + #define P_PXO 0 65 + #define P_PLL4 1 66 + 67 + static const u8 lcc_pxo_pll4_map[] = { 68 + [P_PXO] = 0, 69 + [P_PLL4] = 2, 70 + }; 71 + 72 + static const char *lcc_pxo_pll4[] = { 73 + "pxo", 74 + "pll4_vote", 75 + }; 76 + 77 + static struct freq_tbl clk_tbl_aif_mi2s[] = { 78 + { 1024000, P_PLL4, 4, 1, 96 }, 79 + { 1411200, P_PLL4, 4, 2, 139 }, 80 + { 1536000, P_PLL4, 4, 1, 64 }, 81 + { 2048000, P_PLL4, 4, 1, 48 }, 82 + { 2116800, P_PLL4, 4, 2, 93 }, 83 + { 2304000, P_PLL4, 4, 2, 85 }, 84 + { 2822400, P_PLL4, 4, 6, 209 }, 85 + { 3072000, P_PLL4, 4, 1, 32 }, 86 + { 3175200, P_PLL4, 4, 1, 31 }, 87 + { 4096000, P_PLL4, 4, 1, 24 }, 88 + { 4233600, P_PLL4, 4, 9, 209 }, 89 + { 4608000, P_PLL4, 4, 3, 64 }, 90 + { 5644800, P_PLL4, 4, 12, 209 }, 91 + { 6144000, P_PLL4, 4, 1, 16 }, 92 + { 6350400, P_PLL4, 4, 2, 31 }, 93 + { 8192000, P_PLL4, 4, 1, 12 }, 94 + { 8467200, P_PLL4, 4, 18, 209 }, 95 + { 9216000, P_PLL4, 4, 3, 32 }, 96 + { 11289600, P_PLL4, 4, 24, 209 }, 97 + { 12288000, P_PLL4, 4, 1, 8 }, 98 + { 12700800, P_PLL4, 4, 27, 209 }, 99 + { 13824000, P_PLL4, 4, 9, 64 }, 100 + { 16384000, P_PLL4, 4, 1, 6 }, 101 + { 16934400, P_PLL4, 4, 41, 238 }, 102 + { 18432000, P_PLL4, 4, 3, 16 }, 103 + { 22579200, P_PLL4, 2, 24, 209 }, 104 + { 24576000, P_PLL4, 4, 1, 4 }, 105 + { 27648000, P_PLL4, 4, 9, 32 }, 106 + { 33868800, P_PLL4, 4, 41, 119 }, 107 + { 36864000, P_PLL4, 4, 3, 8 }, 108 + { 45158400, P_PLL4, 1, 24, 209 }, 109 + { 49152000, P_PLL4, 4, 1, 2 }, 110 + { 50803200, P_PLL4, 1, 27, 209 }, 111 + { } 112 + }; 113 + 114 + static struct clk_rcg mi2s_osr_src = { 115 + .ns_reg = 0x48, 116 + .md_reg = 0x4c, 117 + .mn = { 118 + .mnctr_en_bit = 8, 119 + .mnctr_reset_bit = 7, 120 + .mnctr_mode_shift = 5, 121 + .n_val_shift = 24, 122 + .m_val_shift = 8, 123 + .width = 8, 124 + }, 125 + .p = { 126 + .pre_div_shift = 3, 127 + .pre_div_width = 2, 128 + }, 129 + .s = { 130 + .src_sel_shift = 0, 131 + .parent_map = lcc_pxo_pll4_map, 132 + }, 133 + .freq_tbl = clk_tbl_aif_mi2s, 134 + .clkr = { 135 + .enable_reg = 0x48, 136 + .enable_mask = BIT(9), 137 + .hw.init = &(struct clk_init_data){ 138 + .name = "mi2s_osr_src", 139 + .parent_names = lcc_pxo_pll4, 140 + .num_parents = 2, 141 + .ops = &clk_rcg_ops, 142 + .flags = CLK_SET_RATE_GATE, 143 + }, 144 + }, 145 + }; 146 + 147 + static const char *lcc_mi2s_parents[] = { 148 + "mi2s_osr_src", 149 + }; 150 + 151 + static struct clk_branch mi2s_osr_clk = { 152 + .halt_reg = 0x50, 153 + .halt_bit = 1, 154 + .halt_check = BRANCH_HALT_ENABLE, 155 + .clkr = { 156 + .enable_reg = 0x48, 157 + .enable_mask = BIT(17), 158 + .hw.init = &(struct clk_init_data){ 159 + .name = "mi2s_osr_clk", 160 + .parent_names = lcc_mi2s_parents, 161 + .num_parents = 1, 162 + .ops = &clk_branch_ops, 163 + .flags = CLK_SET_RATE_PARENT, 164 + }, 165 + }, 166 + }; 167 + 168 + static struct clk_regmap_div mi2s_div_clk = { 169 + .reg = 0x48, 170 + .shift = 10, 171 + .width = 4, 172 + .clkr = { 173 + .hw.init = &(struct clk_init_data){ 174 + .name = "mi2s_div_clk", 175 + .parent_names = lcc_mi2s_parents, 176 + .num_parents = 1, 177 + .ops = &clk_regmap_div_ops, 178 + }, 179 + }, 180 + }; 181 + 182 + static struct clk_branch mi2s_bit_div_clk = { 183 + .halt_reg = 0x50, 184 + .halt_bit = 0, 185 + .halt_check = BRANCH_HALT_ENABLE, 186 + .clkr = { 187 + .enable_reg = 0x48, 188 + .enable_mask = BIT(15), 189 + .hw.init = &(struct clk_init_data){ 190 + .name = "mi2s_bit_div_clk", 191 + .parent_names = (const char *[]){ "mi2s_div_clk" }, 192 + .num_parents = 1, 193 + .ops = &clk_branch_ops, 194 + .flags = CLK_SET_RATE_PARENT, 195 + }, 196 + }, 197 + }; 198 + 199 + 200 + static struct clk_regmap_mux mi2s_bit_clk = { 201 + .reg = 0x48, 202 + .shift = 14, 203 + .width = 1, 204 + .clkr = { 205 + .hw.init = &(struct clk_init_data){ 206 + .name = "mi2s_bit_clk", 207 + .parent_names = (const char *[]){ 208 + "mi2s_bit_div_clk", 209 + "mi2s_codec_clk", 210 + }, 211 + .num_parents = 2, 212 + .ops = &clk_regmap_mux_closest_ops, 213 + .flags = CLK_SET_RATE_PARENT, 214 + }, 215 + }, 216 + }; 217 + 218 + static struct freq_tbl clk_tbl_pcm[] = { 219 + { 64000, P_PLL4, 4, 1, 1536 }, 220 + { 128000, P_PLL4, 4, 1, 768 }, 221 + { 256000, P_PLL4, 4, 1, 384 }, 222 + { 512000, P_PLL4, 4, 1, 192 }, 223 + { 1024000, P_PLL4, 4, 1, 96 }, 224 + { 2048000, P_PLL4, 4, 1, 48 }, 225 + { }, 226 + }; 227 + 228 + static struct clk_rcg pcm_src = { 229 + .ns_reg = 0x54, 230 + .md_reg = 0x58, 231 + .mn = { 232 + .mnctr_en_bit = 8, 233 + .mnctr_reset_bit = 7, 234 + .mnctr_mode_shift = 5, 235 + .n_val_shift = 16, 236 + .m_val_shift = 16, 237 + .width = 16, 238 + }, 239 + .p = { 240 + .pre_div_shift = 3, 241 + .pre_div_width = 2, 242 + }, 243 + .s = { 244 + .src_sel_shift = 0, 245 + .parent_map = lcc_pxo_pll4_map, 246 + }, 247 + .freq_tbl = clk_tbl_pcm, 248 + .clkr = { 249 + .enable_reg = 0x54, 250 + .enable_mask = BIT(9), 251 + .hw.init = &(struct clk_init_data){ 252 + .name = "pcm_src", 253 + .parent_names = lcc_pxo_pll4, 254 + .num_parents = 2, 255 + .ops = &clk_rcg_ops, 256 + .flags = CLK_SET_RATE_GATE, 257 + }, 258 + }, 259 + }; 260 + 261 + static struct clk_branch pcm_clk_out = { 262 + .halt_reg = 0x5c, 263 + .halt_bit = 0, 264 + .halt_check = BRANCH_HALT_ENABLE, 265 + .clkr = { 266 + .enable_reg = 0x54, 267 + .enable_mask = BIT(11), 268 + .hw.init = &(struct clk_init_data){ 269 + .name = "pcm_clk_out", 270 + .parent_names = (const char *[]){ "pcm_src" }, 271 + .num_parents = 1, 272 + .ops = &clk_branch_ops, 273 + .flags = CLK_SET_RATE_PARENT, 274 + }, 275 + }, 276 + }; 277 + 278 + static struct clk_regmap_mux pcm_clk = { 279 + .reg = 0x54, 280 + .shift = 10, 281 + .width = 1, 282 + .clkr = { 283 + .hw.init = &(struct clk_init_data){ 284 + .name = "pcm_clk", 285 + .parent_names = (const char *[]){ 286 + "pcm_clk_out", 287 + "pcm_codec_clk", 288 + }, 289 + .num_parents = 2, 290 + .ops = &clk_regmap_mux_closest_ops, 291 + .flags = CLK_SET_RATE_PARENT, 292 + }, 293 + }, 294 + }; 295 + 296 + static struct freq_tbl clk_tbl_aif_osr[] = { 297 + { 22050, P_PLL4, 1, 147, 20480 }, 298 + { 32000, P_PLL4, 1, 1, 96 }, 299 + { 44100, P_PLL4, 1, 147, 10240 }, 300 + { 48000, P_PLL4, 1, 1, 64 }, 301 + { 88200, P_PLL4, 1, 147, 5120 }, 302 + { 96000, P_PLL4, 1, 1, 32 }, 303 + { 176400, P_PLL4, 1, 147, 2560 }, 304 + { 192000, P_PLL4, 1, 1, 16 }, 305 + { }, 306 + }; 307 + 308 + static struct clk_rcg spdif_src = { 309 + .ns_reg = 0xcc, 310 + .md_reg = 0xd0, 311 + .mn = { 312 + .mnctr_en_bit = 8, 313 + .mnctr_reset_bit = 7, 314 + .mnctr_mode_shift = 5, 315 + .n_val_shift = 16, 316 + .m_val_shift = 16, 317 + .width = 8, 318 + }, 319 + .p = { 320 + .pre_div_shift = 3, 321 + .pre_div_width = 2, 322 + }, 323 + .s = { 324 + .src_sel_shift = 0, 325 + .parent_map = lcc_pxo_pll4_map, 326 + }, 327 + .freq_tbl = clk_tbl_aif_osr, 328 + .clkr = { 329 + .enable_reg = 0xcc, 330 + .enable_mask = BIT(9), 331 + .hw.init = &(struct clk_init_data){ 332 + .name = "spdif_src", 333 + .parent_names = lcc_pxo_pll4, 334 + .num_parents = 2, 335 + .ops = &clk_rcg_ops, 336 + .flags = CLK_SET_RATE_GATE, 337 + }, 338 + }, 339 + }; 340 + 341 + static const char *lcc_spdif_parents[] = { 342 + "spdif_src", 343 + }; 344 + 345 + static struct clk_branch spdif_clk = { 346 + .halt_reg = 0xd4, 347 + .halt_bit = 1, 348 + .halt_check = BRANCH_HALT_ENABLE, 349 + .clkr = { 350 + .enable_reg = 0xcc, 351 + .enable_mask = BIT(12), 352 + .hw.init = &(struct clk_init_data){ 353 + .name = "spdif_clk", 354 + .parent_names = lcc_spdif_parents, 355 + .num_parents = 1, 356 + .ops = &clk_branch_ops, 357 + .flags = CLK_SET_RATE_PARENT, 358 + }, 359 + }, 360 + }; 361 + 362 + static struct freq_tbl clk_tbl_ahbix[] = { 363 + { 131072, P_PLL4, 1, 1, 3 }, 364 + { }, 365 + }; 366 + 367 + static struct clk_rcg ahbix_clk = { 368 + .ns_reg = 0x38, 369 + .md_reg = 0x3c, 370 + .mn = { 371 + .mnctr_en_bit = 8, 372 + .mnctr_reset_bit = 7, 373 + .mnctr_mode_shift = 5, 374 + .n_val_shift = 24, 375 + .m_val_shift = 8, 376 + .width = 8, 377 + }, 378 + .p = { 379 + .pre_div_shift = 3, 380 + .pre_div_width = 2, 381 + }, 382 + .s = { 383 + .src_sel_shift = 0, 384 + .parent_map = lcc_pxo_pll4_map, 385 + }, 386 + .freq_tbl = clk_tbl_ahbix, 387 + .clkr = { 388 + .enable_reg = 0x38, 389 + .enable_mask = BIT(10), /* toggle the gfmux to select mn/pxo */ 390 + .hw.init = &(struct clk_init_data){ 391 + .name = "ahbix", 392 + .parent_names = lcc_pxo_pll4, 393 + .num_parents = 2, 394 + .ops = &clk_rcg_ops, 395 + .flags = CLK_SET_RATE_GATE, 396 + }, 397 + }, 398 + }; 399 + 400 + static struct clk_regmap *lcc_ipq806x_clks[] = { 401 + [PLL4] = &pll4.clkr, 402 + [MI2S_OSR_SRC] = &mi2s_osr_src.clkr, 403 + [MI2S_OSR_CLK] = &mi2s_osr_clk.clkr, 404 + [MI2S_DIV_CLK] = &mi2s_div_clk.clkr, 405 + [MI2S_BIT_DIV_CLK] = &mi2s_bit_div_clk.clkr, 406 + [MI2S_BIT_CLK] = &mi2s_bit_clk.clkr, 407 + [PCM_SRC] = &pcm_src.clkr, 408 + [PCM_CLK_OUT] = &pcm_clk_out.clkr, 409 + [PCM_CLK] = &pcm_clk.clkr, 410 + [SPDIF_SRC] = &spdif_src.clkr, 411 + [SPDIF_CLK] = &spdif_clk.clkr, 412 + [AHBIX_CLK] = &ahbix_clk.clkr, 413 + }; 414 + 415 + static const struct regmap_config lcc_ipq806x_regmap_config = { 416 + .reg_bits = 32, 417 + .reg_stride = 4, 418 + .val_bits = 32, 419 + .max_register = 0xfc, 420 + .fast_io = true, 421 + }; 422 + 423 + static const struct qcom_cc_desc lcc_ipq806x_desc = { 424 + .config = &lcc_ipq806x_regmap_config, 425 + .clks = lcc_ipq806x_clks, 426 + .num_clks = ARRAY_SIZE(lcc_ipq806x_clks), 427 + }; 428 + 429 + static const struct of_device_id lcc_ipq806x_match_table[] = { 430 + { .compatible = "qcom,lcc-ipq8064" }, 431 + { } 432 + }; 433 + MODULE_DEVICE_TABLE(of, lcc_ipq806x_match_table); 434 + 435 + static int lcc_ipq806x_probe(struct platform_device *pdev) 436 + { 437 + u32 val; 438 + struct regmap *regmap; 439 + 440 + regmap = qcom_cc_map(pdev, &lcc_ipq806x_desc); 441 + if (IS_ERR(regmap)) 442 + return PTR_ERR(regmap); 443 + 444 + /* Configure the rate of PLL4 if the bootloader hasn't already */ 445 + val = regmap_read(regmap, 0x0, &val); 446 + if (!val) 447 + clk_pll_configure_sr(&pll4, regmap, &pll4_config, true); 448 + /* Enable PLL4 source on the LPASS Primary PLL Mux */ 449 + regmap_write(regmap, 0xc4, 0x1); 450 + 451 + return qcom_cc_really_probe(pdev, &lcc_ipq806x_desc, regmap); 452 + } 453 + 454 + static int lcc_ipq806x_remove(struct platform_device *pdev) 455 + { 456 + qcom_cc_remove(pdev); 457 + return 0; 458 + } 459 + 460 + static struct platform_driver lcc_ipq806x_driver = { 461 + .probe = lcc_ipq806x_probe, 462 + .remove = lcc_ipq806x_remove, 463 + .driver = { 464 + .name = "lcc-ipq806x", 465 + .owner = THIS_MODULE, 466 + .of_match_table = lcc_ipq806x_match_table, 467 + }, 468 + }; 469 + module_platform_driver(lcc_ipq806x_driver); 470 + 471 + MODULE_DESCRIPTION("QCOM LCC IPQ806x Driver"); 472 + MODULE_LICENSE("GPL v2"); 473 + MODULE_ALIAS("platform:lcc-ipq806x");
+585
drivers/clk/qcom/lcc-msm8960.c
··· 1 + /* 2 + * Copyright (c) 2014, The Linux Foundation. All rights reserved. 3 + * 4 + * This software is licensed under the terms of the GNU General Public 5 + * License version 2, as published by the Free Software Foundation, and 6 + * may be copied, distributed, and modified under those terms. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + */ 13 + 14 + #include <linux/kernel.h> 15 + #include <linux/bitops.h> 16 + #include <linux/err.h> 17 + #include <linux/platform_device.h> 18 + #include <linux/module.h> 19 + #include <linux/of.h> 20 + #include <linux/of_device.h> 21 + #include <linux/clk-provider.h> 22 + #include <linux/regmap.h> 23 + 24 + #include <dt-bindings/clock/qcom,lcc-msm8960.h> 25 + 26 + #include "common.h" 27 + #include "clk-regmap.h" 28 + #include "clk-pll.h" 29 + #include "clk-rcg.h" 30 + #include "clk-branch.h" 31 + #include "clk-regmap-divider.h" 32 + #include "clk-regmap-mux.h" 33 + 34 + static struct clk_pll pll4 = { 35 + .l_reg = 0x4, 36 + .m_reg = 0x8, 37 + .n_reg = 0xc, 38 + .config_reg = 0x14, 39 + .mode_reg = 0x0, 40 + .status_reg = 0x18, 41 + .status_bit = 16, 42 + .clkr.hw.init = &(struct clk_init_data){ 43 + .name = "pll4", 44 + .parent_names = (const char *[]){ "pxo" }, 45 + .num_parents = 1, 46 + .ops = &clk_pll_ops, 47 + }, 48 + }; 49 + 50 + #define P_PXO 0 51 + #define P_PLL4 1 52 + 53 + static const u8 lcc_pxo_pll4_map[] = { 54 + [P_PXO] = 0, 55 + [P_PLL4] = 2, 56 + }; 57 + 58 + static const char *lcc_pxo_pll4[] = { 59 + "pxo", 60 + "pll4_vote", 61 + }; 62 + 63 + static struct freq_tbl clk_tbl_aif_osr_492[] = { 64 + { 512000, P_PLL4, 4, 1, 240 }, 65 + { 768000, P_PLL4, 4, 1, 160 }, 66 + { 1024000, P_PLL4, 4, 1, 120 }, 67 + { 1536000, P_PLL4, 4, 1, 80 }, 68 + { 2048000, P_PLL4, 4, 1, 60 }, 69 + { 3072000, P_PLL4, 4, 1, 40 }, 70 + { 4096000, P_PLL4, 4, 1, 30 }, 71 + { 6144000, P_PLL4, 4, 1, 20 }, 72 + { 8192000, P_PLL4, 4, 1, 15 }, 73 + { 12288000, P_PLL4, 4, 1, 10 }, 74 + { 24576000, P_PLL4, 4, 1, 5 }, 75 + { 27000000, P_PXO, 1, 0, 0 }, 76 + { } 77 + }; 78 + 79 + static struct freq_tbl clk_tbl_aif_osr_393[] = { 80 + { 512000, P_PLL4, 4, 1, 192 }, 81 + { 768000, P_PLL4, 4, 1, 128 }, 82 + { 1024000, P_PLL4, 4, 1, 96 }, 83 + { 1536000, P_PLL4, 4, 1, 64 }, 84 + { 2048000, P_PLL4, 4, 1, 48 }, 85 + { 3072000, P_PLL4, 4, 1, 32 }, 86 + { 4096000, P_PLL4, 4, 1, 24 }, 87 + { 6144000, P_PLL4, 4, 1, 16 }, 88 + { 8192000, P_PLL4, 4, 1, 12 }, 89 + { 12288000, P_PLL4, 4, 1, 8 }, 90 + { 24576000, P_PLL4, 4, 1, 4 }, 91 + { 27000000, P_PXO, 1, 0, 0 }, 92 + { } 93 + }; 94 + 95 + static struct clk_rcg mi2s_osr_src = { 96 + .ns_reg = 0x48, 97 + .md_reg = 0x4c, 98 + .mn = { 99 + .mnctr_en_bit = 8, 100 + .mnctr_reset_bit = 7, 101 + .mnctr_mode_shift = 5, 102 + .n_val_shift = 24, 103 + .m_val_shift = 8, 104 + .width = 8, 105 + }, 106 + .p = { 107 + .pre_div_shift = 3, 108 + .pre_div_width = 2, 109 + }, 110 + .s = { 111 + .src_sel_shift = 0, 112 + .parent_map = lcc_pxo_pll4_map, 113 + }, 114 + .freq_tbl = clk_tbl_aif_osr_393, 115 + .clkr = { 116 + .enable_reg = 0x48, 117 + .enable_mask = BIT(9), 118 + .hw.init = &(struct clk_init_data){ 119 + .name = "mi2s_osr_src", 120 + .parent_names = lcc_pxo_pll4, 121 + .num_parents = 2, 122 + .ops = &clk_rcg_ops, 123 + .flags = CLK_SET_RATE_GATE, 124 + }, 125 + }, 126 + }; 127 + 128 + static const char *lcc_mi2s_parents[] = { 129 + "mi2s_osr_src", 130 + }; 131 + 132 + static struct clk_branch mi2s_osr_clk = { 133 + .halt_reg = 0x50, 134 + .halt_bit = 1, 135 + .halt_check = BRANCH_HALT_ENABLE, 136 + .clkr = { 137 + .enable_reg = 0x48, 138 + .enable_mask = BIT(17), 139 + .hw.init = &(struct clk_init_data){ 140 + .name = "mi2s_osr_clk", 141 + .parent_names = lcc_mi2s_parents, 142 + .num_parents = 1, 143 + .ops = &clk_branch_ops, 144 + .flags = CLK_SET_RATE_PARENT, 145 + }, 146 + }, 147 + }; 148 + 149 + static struct clk_regmap_div mi2s_div_clk = { 150 + .reg = 0x48, 151 + .shift = 10, 152 + .width = 4, 153 + .clkr = { 154 + .enable_reg = 0x48, 155 + .enable_mask = BIT(15), 156 + .hw.init = &(struct clk_init_data){ 157 + .name = "mi2s_div_clk", 158 + .parent_names = lcc_mi2s_parents, 159 + .num_parents = 1, 160 + .ops = &clk_regmap_div_ops, 161 + }, 162 + }, 163 + }; 164 + 165 + static struct clk_branch mi2s_bit_div_clk = { 166 + .halt_reg = 0x50, 167 + .halt_bit = 0, 168 + .halt_check = BRANCH_HALT_ENABLE, 169 + .clkr = { 170 + .enable_reg = 0x48, 171 + .enable_mask = BIT(15), 172 + .hw.init = &(struct clk_init_data){ 173 + .name = "mi2s_bit_div_clk", 174 + .parent_names = (const char *[]){ "mi2s_div_clk" }, 175 + .num_parents = 1, 176 + .ops = &clk_branch_ops, 177 + .flags = CLK_SET_RATE_PARENT, 178 + }, 179 + }, 180 + }; 181 + 182 + static struct clk_regmap_mux mi2s_bit_clk = { 183 + .reg = 0x48, 184 + .shift = 14, 185 + .width = 1, 186 + .clkr = { 187 + .hw.init = &(struct clk_init_data){ 188 + .name = "mi2s_bit_clk", 189 + .parent_names = (const char *[]){ 190 + "mi2s_bit_div_clk", 191 + "mi2s_codec_clk", 192 + }, 193 + .num_parents = 2, 194 + .ops = &clk_regmap_mux_closest_ops, 195 + .flags = CLK_SET_RATE_PARENT, 196 + }, 197 + }, 198 + }; 199 + 200 + #define CLK_AIF_OSR_DIV(prefix, _ns, _md, hr) \ 201 + static struct clk_rcg prefix##_osr_src = { \ 202 + .ns_reg = _ns, \ 203 + .md_reg = _md, \ 204 + .mn = { \ 205 + .mnctr_en_bit = 8, \ 206 + .mnctr_reset_bit = 7, \ 207 + .mnctr_mode_shift = 5, \ 208 + .n_val_shift = 24, \ 209 + .m_val_shift = 8, \ 210 + .width = 8, \ 211 + }, \ 212 + .p = { \ 213 + .pre_div_shift = 3, \ 214 + .pre_div_width = 2, \ 215 + }, \ 216 + .s = { \ 217 + .src_sel_shift = 0, \ 218 + .parent_map = lcc_pxo_pll4_map, \ 219 + }, \ 220 + .freq_tbl = clk_tbl_aif_osr_393, \ 221 + .clkr = { \ 222 + .enable_reg = _ns, \ 223 + .enable_mask = BIT(9), \ 224 + .hw.init = &(struct clk_init_data){ \ 225 + .name = #prefix "_osr_src", \ 226 + .parent_names = lcc_pxo_pll4, \ 227 + .num_parents = 2, \ 228 + .ops = &clk_rcg_ops, \ 229 + .flags = CLK_SET_RATE_GATE, \ 230 + }, \ 231 + }, \ 232 + }; \ 233 + \ 234 + static const char *lcc_##prefix##_parents[] = { \ 235 + #prefix "_osr_src", \ 236 + }; \ 237 + \ 238 + static struct clk_branch prefix##_osr_clk = { \ 239 + .halt_reg = hr, \ 240 + .halt_bit = 1, \ 241 + .halt_check = BRANCH_HALT_ENABLE, \ 242 + .clkr = { \ 243 + .enable_reg = _ns, \ 244 + .enable_mask = BIT(21), \ 245 + .hw.init = &(struct clk_init_data){ \ 246 + .name = #prefix "_osr_clk", \ 247 + .parent_names = lcc_##prefix##_parents, \ 248 + .num_parents = 1, \ 249 + .ops = &clk_branch_ops, \ 250 + .flags = CLK_SET_RATE_PARENT, \ 251 + }, \ 252 + }, \ 253 + }; \ 254 + \ 255 + static struct clk_regmap_div prefix##_div_clk = { \ 256 + .reg = _ns, \ 257 + .shift = 10, \ 258 + .width = 8, \ 259 + .clkr = { \ 260 + .hw.init = &(struct clk_init_data){ \ 261 + .name = #prefix "_div_clk", \ 262 + .parent_names = lcc_##prefix##_parents, \ 263 + .num_parents = 1, \ 264 + .ops = &clk_regmap_div_ops, \ 265 + }, \ 266 + }, \ 267 + }; \ 268 + \ 269 + static struct clk_branch prefix##_bit_div_clk = { \ 270 + .halt_reg = hr, \ 271 + .halt_bit = 0, \ 272 + .halt_check = BRANCH_HALT_ENABLE, \ 273 + .clkr = { \ 274 + .enable_reg = _ns, \ 275 + .enable_mask = BIT(19), \ 276 + .hw.init = &(struct clk_init_data){ \ 277 + .name = #prefix "_bit_div_clk", \ 278 + .parent_names = (const char *[]){ \ 279 + #prefix "_div_clk" \ 280 + }, \ 281 + .num_parents = 1, \ 282 + .ops = &clk_branch_ops, \ 283 + .flags = CLK_SET_RATE_PARENT, \ 284 + }, \ 285 + }, \ 286 + }; \ 287 + \ 288 + static struct clk_regmap_mux prefix##_bit_clk = { \ 289 + .reg = _ns, \ 290 + .shift = 18, \ 291 + .width = 1, \ 292 + .clkr = { \ 293 + .hw.init = &(struct clk_init_data){ \ 294 + .name = #prefix "_bit_clk", \ 295 + .parent_names = (const char *[]){ \ 296 + #prefix "_bit_div_clk", \ 297 + #prefix "_codec_clk", \ 298 + }, \ 299 + .num_parents = 2, \ 300 + .ops = &clk_regmap_mux_closest_ops, \ 301 + .flags = CLK_SET_RATE_PARENT, \ 302 + }, \ 303 + }, \ 304 + } 305 + 306 + CLK_AIF_OSR_DIV(codec_i2s_mic, 0x60, 0x64, 0x68); 307 + CLK_AIF_OSR_DIV(spare_i2s_mic, 0x78, 0x7c, 0x80); 308 + CLK_AIF_OSR_DIV(codec_i2s_spkr, 0x6c, 0x70, 0x74); 309 + CLK_AIF_OSR_DIV(spare_i2s_spkr, 0x84, 0x88, 0x8c); 310 + 311 + static struct freq_tbl clk_tbl_pcm_492[] = { 312 + { 256000, P_PLL4, 4, 1, 480 }, 313 + { 512000, P_PLL4, 4, 1, 240 }, 314 + { 768000, P_PLL4, 4, 1, 160 }, 315 + { 1024000, P_PLL4, 4, 1, 120 }, 316 + { 1536000, P_PLL4, 4, 1, 80 }, 317 + { 2048000, P_PLL4, 4, 1, 60 }, 318 + { 3072000, P_PLL4, 4, 1, 40 }, 319 + { 4096000, P_PLL4, 4, 1, 30 }, 320 + { 6144000, P_PLL4, 4, 1, 20 }, 321 + { 8192000, P_PLL4, 4, 1, 15 }, 322 + { 12288000, P_PLL4, 4, 1, 10 }, 323 + { 24576000, P_PLL4, 4, 1, 5 }, 324 + { 27000000, P_PXO, 1, 0, 0 }, 325 + { } 326 + }; 327 + 328 + static struct freq_tbl clk_tbl_pcm_393[] = { 329 + { 256000, P_PLL4, 4, 1, 384 }, 330 + { 512000, P_PLL4, 4, 1, 192 }, 331 + { 768000, P_PLL4, 4, 1, 128 }, 332 + { 1024000, P_PLL4, 4, 1, 96 }, 333 + { 1536000, P_PLL4, 4, 1, 64 }, 334 + { 2048000, P_PLL4, 4, 1, 48 }, 335 + { 3072000, P_PLL4, 4, 1, 32 }, 336 + { 4096000, P_PLL4, 4, 1, 24 }, 337 + { 6144000, P_PLL4, 4, 1, 16 }, 338 + { 8192000, P_PLL4, 4, 1, 12 }, 339 + { 12288000, P_PLL4, 4, 1, 8 }, 340 + { 24576000, P_PLL4, 4, 1, 4 }, 341 + { 27000000, P_PXO, 1, 0, 0 }, 342 + { } 343 + }; 344 + 345 + static struct clk_rcg pcm_src = { 346 + .ns_reg = 0x54, 347 + .md_reg = 0x58, 348 + .mn = { 349 + .mnctr_en_bit = 8, 350 + .mnctr_reset_bit = 7, 351 + .mnctr_mode_shift = 5, 352 + .n_val_shift = 16, 353 + .m_val_shift = 16, 354 + .width = 16, 355 + }, 356 + .p = { 357 + .pre_div_shift = 3, 358 + .pre_div_width = 2, 359 + }, 360 + .s = { 361 + .src_sel_shift = 0, 362 + .parent_map = lcc_pxo_pll4_map, 363 + }, 364 + .freq_tbl = clk_tbl_pcm_393, 365 + .clkr = { 366 + .enable_reg = 0x54, 367 + .enable_mask = BIT(9), 368 + .hw.init = &(struct clk_init_data){ 369 + .name = "pcm_src", 370 + .parent_names = lcc_pxo_pll4, 371 + .num_parents = 2, 372 + .ops = &clk_rcg_ops, 373 + .flags = CLK_SET_RATE_GATE, 374 + }, 375 + }, 376 + }; 377 + 378 + static struct clk_branch pcm_clk_out = { 379 + .halt_reg = 0x5c, 380 + .halt_bit = 0, 381 + .halt_check = BRANCH_HALT_ENABLE, 382 + .clkr = { 383 + .enable_reg = 0x54, 384 + .enable_mask = BIT(11), 385 + .hw.init = &(struct clk_init_data){ 386 + .name = "pcm_clk_out", 387 + .parent_names = (const char *[]){ "pcm_src" }, 388 + .num_parents = 1, 389 + .ops = &clk_branch_ops, 390 + .flags = CLK_SET_RATE_PARENT, 391 + }, 392 + }, 393 + }; 394 + 395 + static struct clk_regmap_mux pcm_clk = { 396 + .reg = 0x54, 397 + .shift = 10, 398 + .width = 1, 399 + .clkr = { 400 + .hw.init = &(struct clk_init_data){ 401 + .name = "pcm_clk", 402 + .parent_names = (const char *[]){ 403 + "pcm_clk_out", 404 + "pcm_codec_clk", 405 + }, 406 + .num_parents = 2, 407 + .ops = &clk_regmap_mux_closest_ops, 408 + .flags = CLK_SET_RATE_PARENT, 409 + }, 410 + }, 411 + }; 412 + 413 + static struct clk_rcg slimbus_src = { 414 + .ns_reg = 0xcc, 415 + .md_reg = 0xd0, 416 + .mn = { 417 + .mnctr_en_bit = 8, 418 + .mnctr_reset_bit = 7, 419 + .mnctr_mode_shift = 5, 420 + .n_val_shift = 16, 421 + .m_val_shift = 16, 422 + .width = 8, 423 + }, 424 + .p = { 425 + .pre_div_shift = 3, 426 + .pre_div_width = 2, 427 + }, 428 + .s = { 429 + .src_sel_shift = 0, 430 + .parent_map = lcc_pxo_pll4_map, 431 + }, 432 + .freq_tbl = clk_tbl_aif_osr_393, 433 + .clkr = { 434 + .enable_reg = 0xcc, 435 + .enable_mask = BIT(9), 436 + .hw.init = &(struct clk_init_data){ 437 + .name = "slimbus_src", 438 + .parent_names = lcc_pxo_pll4, 439 + .num_parents = 2, 440 + .ops = &clk_rcg_ops, 441 + .flags = CLK_SET_RATE_GATE, 442 + }, 443 + }, 444 + }; 445 + 446 + static const char *lcc_slimbus_parents[] = { 447 + "slimbus_src", 448 + }; 449 + 450 + static struct clk_branch audio_slimbus_clk = { 451 + .halt_reg = 0xd4, 452 + .halt_bit = 0, 453 + .halt_check = BRANCH_HALT_ENABLE, 454 + .clkr = { 455 + .enable_reg = 0xcc, 456 + .enable_mask = BIT(10), 457 + .hw.init = &(struct clk_init_data){ 458 + .name = "audio_slimbus_clk", 459 + .parent_names = lcc_slimbus_parents, 460 + .num_parents = 1, 461 + .ops = &clk_branch_ops, 462 + .flags = CLK_SET_RATE_PARENT, 463 + }, 464 + }, 465 + }; 466 + 467 + static struct clk_branch sps_slimbus_clk = { 468 + .halt_reg = 0xd4, 469 + .halt_bit = 1, 470 + .halt_check = BRANCH_HALT_ENABLE, 471 + .clkr = { 472 + .enable_reg = 0xcc, 473 + .enable_mask = BIT(12), 474 + .hw.init = &(struct clk_init_data){ 475 + .name = "sps_slimbus_clk", 476 + .parent_names = lcc_slimbus_parents, 477 + .num_parents = 1, 478 + .ops = &clk_branch_ops, 479 + .flags = CLK_SET_RATE_PARENT, 480 + }, 481 + }, 482 + }; 483 + 484 + static struct clk_regmap *lcc_msm8960_clks[] = { 485 + [PLL4] = &pll4.clkr, 486 + [MI2S_OSR_SRC] = &mi2s_osr_src.clkr, 487 + [MI2S_OSR_CLK] = &mi2s_osr_clk.clkr, 488 + [MI2S_DIV_CLK] = &mi2s_div_clk.clkr, 489 + [MI2S_BIT_DIV_CLK] = &mi2s_bit_div_clk.clkr, 490 + [MI2S_BIT_CLK] = &mi2s_bit_clk.clkr, 491 + [PCM_SRC] = &pcm_src.clkr, 492 + [PCM_CLK_OUT] = &pcm_clk_out.clkr, 493 + [PCM_CLK] = &pcm_clk.clkr, 494 + [SLIMBUS_SRC] = &slimbus_src.clkr, 495 + [AUDIO_SLIMBUS_CLK] = &audio_slimbus_clk.clkr, 496 + [SPS_SLIMBUS_CLK] = &sps_slimbus_clk.clkr, 497 + [CODEC_I2S_MIC_OSR_SRC] = &codec_i2s_mic_osr_src.clkr, 498 + [CODEC_I2S_MIC_OSR_CLK] = &codec_i2s_mic_osr_clk.clkr, 499 + [CODEC_I2S_MIC_DIV_CLK] = &codec_i2s_mic_div_clk.clkr, 500 + [CODEC_I2S_MIC_BIT_DIV_CLK] = &codec_i2s_mic_bit_div_clk.clkr, 501 + [CODEC_I2S_MIC_BIT_CLK] = &codec_i2s_mic_bit_clk.clkr, 502 + [SPARE_I2S_MIC_OSR_SRC] = &spare_i2s_mic_osr_src.clkr, 503 + [SPARE_I2S_MIC_OSR_CLK] = &spare_i2s_mic_osr_clk.clkr, 504 + [SPARE_I2S_MIC_DIV_CLK] = &spare_i2s_mic_div_clk.clkr, 505 + [SPARE_I2S_MIC_BIT_DIV_CLK] = &spare_i2s_mic_bit_div_clk.clkr, 506 + [SPARE_I2S_MIC_BIT_CLK] = &spare_i2s_mic_bit_clk.clkr, 507 + [CODEC_I2S_SPKR_OSR_SRC] = &codec_i2s_spkr_osr_src.clkr, 508 + [CODEC_I2S_SPKR_OSR_CLK] = &codec_i2s_spkr_osr_clk.clkr, 509 + [CODEC_I2S_SPKR_DIV_CLK] = &codec_i2s_spkr_div_clk.clkr, 510 + [CODEC_I2S_SPKR_BIT_DIV_CLK] = &codec_i2s_spkr_bit_div_clk.clkr, 511 + [CODEC_I2S_SPKR_BIT_CLK] = &codec_i2s_spkr_bit_clk.clkr, 512 + [SPARE_I2S_SPKR_OSR_SRC] = &spare_i2s_spkr_osr_src.clkr, 513 + [SPARE_I2S_SPKR_OSR_CLK] = &spare_i2s_spkr_osr_clk.clkr, 514 + [SPARE_I2S_SPKR_DIV_CLK] = &spare_i2s_spkr_div_clk.clkr, 515 + [SPARE_I2S_SPKR_BIT_DIV_CLK] = &spare_i2s_spkr_bit_div_clk.clkr, 516 + [SPARE_I2S_SPKR_BIT_CLK] = &spare_i2s_spkr_bit_clk.clkr, 517 + }; 518 + 519 + static const struct regmap_config lcc_msm8960_regmap_config = { 520 + .reg_bits = 32, 521 + .reg_stride = 4, 522 + .val_bits = 32, 523 + .max_register = 0xfc, 524 + .fast_io = true, 525 + }; 526 + 527 + static const struct qcom_cc_desc lcc_msm8960_desc = { 528 + .config = &lcc_msm8960_regmap_config, 529 + .clks = lcc_msm8960_clks, 530 + .num_clks = ARRAY_SIZE(lcc_msm8960_clks), 531 + }; 532 + 533 + static const struct of_device_id lcc_msm8960_match_table[] = { 534 + { .compatible = "qcom,lcc-msm8960" }, 535 + { .compatible = "qcom,lcc-apq8064" }, 536 + { } 537 + }; 538 + MODULE_DEVICE_TABLE(of, lcc_msm8960_match_table); 539 + 540 + static int lcc_msm8960_probe(struct platform_device *pdev) 541 + { 542 + u32 val; 543 + struct regmap *regmap; 544 + 545 + regmap = qcom_cc_map(pdev, &lcc_msm8960_desc); 546 + if (IS_ERR(regmap)) 547 + return PTR_ERR(regmap); 548 + 549 + /* Use the correct frequency plan depending on speed of PLL4 */ 550 + val = regmap_read(regmap, 0x4, &val); 551 + if (val == 0x12) { 552 + slimbus_src.freq_tbl = clk_tbl_aif_osr_492; 553 + mi2s_osr_src.freq_tbl = clk_tbl_aif_osr_492; 554 + codec_i2s_mic_osr_src.freq_tbl = clk_tbl_aif_osr_492; 555 + spare_i2s_mic_osr_src.freq_tbl = clk_tbl_aif_osr_492; 556 + codec_i2s_spkr_osr_src.freq_tbl = clk_tbl_aif_osr_492; 557 + spare_i2s_spkr_osr_src.freq_tbl = clk_tbl_aif_osr_492; 558 + pcm_src.freq_tbl = clk_tbl_pcm_492; 559 + } 560 + /* Enable PLL4 source on the LPASS Primary PLL Mux */ 561 + regmap_write(regmap, 0xc4, 0x1); 562 + 563 + return qcom_cc_really_probe(pdev, &lcc_msm8960_desc, regmap); 564 + } 565 + 566 + static int lcc_msm8960_remove(struct platform_device *pdev) 567 + { 568 + qcom_cc_remove(pdev); 569 + return 0; 570 + } 571 + 572 + static struct platform_driver lcc_msm8960_driver = { 573 + .probe = lcc_msm8960_probe, 574 + .remove = lcc_msm8960_remove, 575 + .driver = { 576 + .name = "lcc-msm8960", 577 + .owner = THIS_MODULE, 578 + .of_match_table = lcc_msm8960_match_table, 579 + }, 580 + }; 581 + module_platform_driver(lcc_msm8960_driver); 582 + 583 + MODULE_DESCRIPTION("QCOM LCC MSM8960 Driver"); 584 + MODULE_LICENSE("GPL v2"); 585 + MODULE_ALIAS("platform:lcc-msm8960");
+35 -13
drivers/clk/rockchip/clk-rk3288.c
··· 535 535 COMPOSITE(0, "uart0_src", mux_pll_src_cpll_gll_usb_npll_p, 0, 536 536 RK3288_CLKSEL_CON(13), 13, 2, MFLAGS, 0, 7, DFLAGS, 537 537 RK3288_CLKGATE_CON(1), 8, GFLAGS), 538 - COMPOSITE_FRAC(0, "uart0_frac", "uart0_src", 0, 538 + COMPOSITE_FRAC(0, "uart0_frac", "uart0_src", CLK_SET_RATE_PARENT, 539 539 RK3288_CLKSEL_CON(17), 0, 540 540 RK3288_CLKGATE_CON(1), 9, GFLAGS), 541 - MUX(SCLK_UART0, "sclk_uart0", mux_uart0_p, 0, 541 + MUX(SCLK_UART0, "sclk_uart0", mux_uart0_p, CLK_SET_RATE_PARENT, 542 542 RK3288_CLKSEL_CON(13), 8, 2, MFLAGS), 543 543 MUX(0, "uart_src", mux_pll_src_cpll_gpll_p, 0, 544 544 RK3288_CLKSEL_CON(13), 15, 1, MFLAGS), 545 545 COMPOSITE_NOMUX(0, "uart1_src", "uart_src", 0, 546 546 RK3288_CLKSEL_CON(14), 0, 7, DFLAGS, 547 547 RK3288_CLKGATE_CON(1), 10, GFLAGS), 548 - COMPOSITE_FRAC(0, "uart1_frac", "uart1_src", 0, 548 + COMPOSITE_FRAC(0, "uart1_frac", "uart1_src", CLK_SET_RATE_PARENT, 549 549 RK3288_CLKSEL_CON(18), 0, 550 550 RK3288_CLKGATE_CON(1), 11, GFLAGS), 551 - MUX(SCLK_UART1, "sclk_uart1", mux_uart1_p, 0, 551 + MUX(SCLK_UART1, "sclk_uart1", mux_uart1_p, CLK_SET_RATE_PARENT, 552 552 RK3288_CLKSEL_CON(14), 8, 2, MFLAGS), 553 553 COMPOSITE_NOMUX(0, "uart2_src", "uart_src", 0, 554 554 RK3288_CLKSEL_CON(15), 0, 7, DFLAGS, 555 555 RK3288_CLKGATE_CON(1), 12, GFLAGS), 556 - COMPOSITE_FRAC(0, "uart2_frac", "uart2_src", 0, 556 + COMPOSITE_FRAC(0, "uart2_frac", "uart2_src", CLK_SET_RATE_PARENT, 557 557 RK3288_CLKSEL_CON(19), 0, 558 558 RK3288_CLKGATE_CON(1), 13, GFLAGS), 559 - MUX(SCLK_UART2, "sclk_uart2", mux_uart2_p, 0, 559 + MUX(SCLK_UART2, "sclk_uart2", mux_uart2_p, CLK_SET_RATE_PARENT, 560 560 RK3288_CLKSEL_CON(15), 8, 2, MFLAGS), 561 561 COMPOSITE_NOMUX(0, "uart3_src", "uart_src", 0, 562 562 RK3288_CLKSEL_CON(16), 0, 7, DFLAGS, 563 563 RK3288_CLKGATE_CON(1), 14, GFLAGS), 564 - COMPOSITE_FRAC(0, "uart3_frac", "uart3_src", 0, 564 + COMPOSITE_FRAC(0, "uart3_frac", "uart3_src", CLK_SET_RATE_PARENT, 565 565 RK3288_CLKSEL_CON(20), 0, 566 566 RK3288_CLKGATE_CON(1), 15, GFLAGS), 567 - MUX(SCLK_UART3, "sclk_uart3", mux_uart3_p, 0, 567 + MUX(SCLK_UART3, "sclk_uart3", mux_uart3_p, CLK_SET_RATE_PARENT, 568 568 RK3288_CLKSEL_CON(16), 8, 2, MFLAGS), 569 569 COMPOSITE_NOMUX(0, "uart4_src", "uart_src", 0, 570 570 RK3288_CLKSEL_CON(3), 0, 7, DFLAGS, 571 571 RK3288_CLKGATE_CON(2), 12, GFLAGS), 572 - COMPOSITE_FRAC(0, "uart4_frac", "uart4_src", 0, 572 + COMPOSITE_FRAC(0, "uart4_frac", "uart4_src", CLK_SET_RATE_PARENT, 573 573 RK3288_CLKSEL_CON(7), 0, 574 574 RK3288_CLKGATE_CON(2), 13, GFLAGS), 575 - MUX(SCLK_UART4, "sclk_uart4", mux_uart4_p, 0, 575 + MUX(SCLK_UART4, "sclk_uart4", mux_uart4_p, CLK_SET_RATE_PARENT, 576 576 RK3288_CLKSEL_CON(3), 8, 2, MFLAGS), 577 577 578 578 COMPOSITE(0, "mac_pll_src", mux_pll_src_npll_cpll_gpll_p, 0, ··· 598 598 GATE(0, "jtag", "ext_jtag", 0, 599 599 RK3288_CLKGATE_CON(4), 14, GFLAGS), 600 600 601 - COMPOSITE_NODIV(0, "usbphy480m_src", mux_usbphy480m_p, 0, 601 + COMPOSITE_NODIV(SCLK_USBPHY480M_SRC, "usbphy480m_src", mux_usbphy480m_p, 0, 602 602 RK3288_CLKSEL_CON(13), 11, 2, MFLAGS, 603 603 RK3288_CLKGATE_CON(5), 14, GFLAGS), 604 604 COMPOSITE_NODIV(SCLK_HSICPHY480M, "sclk_hsicphy480m", mux_hsicphy480m_p, 0, ··· 704 704 705 705 GATE(SCLK_LCDC_PWM0, "sclk_lcdc_pwm0", "xin24m", 0, RK3288_CLKGATE_CON(13), 10, GFLAGS), 706 706 GATE(SCLK_LCDC_PWM1, "sclk_lcdc_pwm1", "xin24m", 0, RK3288_CLKGATE_CON(13), 11, GFLAGS), 707 - GATE(0, "sclk_pvtm_core", "xin24m", 0, RK3288_CLKGATE_CON(5), 9, GFLAGS), 708 - GATE(0, "sclk_pvtm_gpu", "xin24m", 0, RK3288_CLKGATE_CON(5), 10, GFLAGS), 707 + GATE(SCLK_PVTM_CORE, "sclk_pvtm_core", "xin24m", 0, RK3288_CLKGATE_CON(5), 9, GFLAGS), 708 + GATE(SCLK_PVTM_GPU, "sclk_pvtm_gpu", "xin24m", 0, RK3288_CLKGATE_CON(5), 10, GFLAGS), 709 709 GATE(0, "sclk_mipidsi_24m", "xin24m", 0, RK3288_CLKGATE_CON(5), 15, GFLAGS), 710 710 711 711 /* sclk_gpu gates */ ··· 805 805 rk3288_saved_cru_regs[i] = 806 806 readl_relaxed(rk3288_cru_base + reg_id); 807 807 } 808 + 809 + /* 810 + * Switch PLLs other than DPLL (for SDRAM) to slow mode to 811 + * avoid crashes on resume. The Mask ROM on the system will 812 + * put APLL, CPLL, and GPLL into slow mode at resume time 813 + * anyway (which is why we restore them), but we might not 814 + * even make it to the Mask ROM if this isn't done at suspend 815 + * time. 816 + * 817 + * NOTE: only APLL truly matters here, but we'll do them all. 818 + */ 819 + 820 + writel_relaxed(0xf3030000, rk3288_cru_base + RK3288_MODE_CON); 821 + 808 822 return 0; 809 823 } 810 824 ··· 879 865 if (IS_ERR(clk)) 880 866 pr_warn("%s: could not register clock hclk_vcodec_pre: %ld\n", 881 867 __func__, PTR_ERR(clk)); 868 + 869 + /* Watchdog pclk is controlled by RK3288_SGRF_SOC_CON0[1]. */ 870 + clk = clk_register_fixed_factor(NULL, "pclk_wdt", "pclk_pd_alive", 0, 1, 1); 871 + if (IS_ERR(clk)) 872 + pr_warn("%s: could not register clock pclk_wdt: %ld\n", 873 + __func__, PTR_ERR(clk)); 874 + else 875 + rockchip_clk_add_lookup(clk, PCLK_WDT); 882 876 883 877 rockchip_clk_register_plls(rk3288_pll_clks, 884 878 ARRAY_SIZE(rk3288_pll_clks),
+22 -10
drivers/clk/samsung/clk-exynos-audss.c
··· 82 82 {}, 83 83 }; 84 84 85 + static void exynos_audss_clk_teardown(void) 86 + { 87 + int i; 88 + 89 + for (i = EXYNOS_MOUT_AUDSS; i < EXYNOS_DOUT_SRP; i++) { 90 + if (!IS_ERR(clk_table[i])) 91 + clk_unregister_mux(clk_table[i]); 92 + } 93 + 94 + for (; i < EXYNOS_SRP_CLK; i++) { 95 + if (!IS_ERR(clk_table[i])) 96 + clk_unregister_divider(clk_table[i]); 97 + } 98 + 99 + for (; i < clk_data.clk_num; i++) { 100 + if (!IS_ERR(clk_table[i])) 101 + clk_unregister_gate(clk_table[i]); 102 + } 103 + } 104 + 85 105 /* register exynos_audss clocks */ 86 106 static int exynos_audss_clk_probe(struct platform_device *pdev) 87 107 { ··· 239 219 return 0; 240 220 241 221 unregister: 242 - for (i = 0; i < clk_data.clk_num; i++) { 243 - if (!IS_ERR(clk_table[i])) 244 - clk_unregister(clk_table[i]); 245 - } 222 + exynos_audss_clk_teardown(); 246 223 247 224 if (!IS_ERR(epll)) 248 225 clk_disable_unprepare(epll); ··· 249 232 250 233 static int exynos_audss_clk_remove(struct platform_device *pdev) 251 234 { 252 - int i; 253 - 254 235 #ifdef CONFIG_PM_SLEEP 255 236 unregister_syscore_ops(&exynos_audss_clk_syscore_ops); 256 237 #endif 257 238 258 239 of_clk_del_provider(pdev->dev.of_node); 259 240 260 - for (i = 0; i < clk_data.clk_num; i++) { 261 - if (!IS_ERR(clk_table[i])) 262 - clk_unregister(clk_table[i]); 263 - } 241 + exynos_audss_clk_teardown(); 264 242 265 243 if (!IS_ERR(epll)) 266 244 clk_disable_unprepare(epll);
+47 -170
drivers/clk/samsung/clk-exynos3250.c
··· 104 104 #define PWR_CTRL1_USE_CORE1_WFI (1 << 1) 105 105 #define PWR_CTRL1_USE_CORE0_WFI (1 << 0) 106 106 107 - /* list of PLLs to be registered */ 108 - enum exynos3250_plls { 109 - apll, mpll, vpll, upll, 110 - nr_plls 111 - }; 112 - 113 - /* list of PLLs in DMC block to be registered */ 114 - enum exynos3250_dmc_plls { 115 - bpll, epll, 116 - nr_dmc_plls 117 - }; 118 - 119 - static void __iomem *reg_base; 120 - static void __iomem *dmc_reg_base; 121 - 122 - /* 123 - * Support for CMU save/restore across system suspends 124 - */ 125 - #ifdef CONFIG_PM_SLEEP 126 - static struct samsung_clk_reg_dump *exynos3250_clk_regs; 127 - 128 107 static unsigned long exynos3250_cmu_clk_regs[] __initdata = { 129 108 SRC_LEFTBUS, 130 109 DIV_LEFTBUS, ··· 173 194 PWR_CTRL1, 174 195 PWR_CTRL2, 175 196 }; 176 - 177 - static int exynos3250_clk_suspend(void) 178 - { 179 - samsung_clk_save(reg_base, exynos3250_clk_regs, 180 - ARRAY_SIZE(exynos3250_cmu_clk_regs)); 181 - return 0; 182 - } 183 - 184 - static void exynos3250_clk_resume(void) 185 - { 186 - samsung_clk_restore(reg_base, exynos3250_clk_regs, 187 - ARRAY_SIZE(exynos3250_cmu_clk_regs)); 188 - } 189 - 190 - static struct syscore_ops exynos3250_clk_syscore_ops = { 191 - .suspend = exynos3250_clk_suspend, 192 - .resume = exynos3250_clk_resume, 193 - }; 194 - 195 - static void exynos3250_clk_sleep_init(void) 196 - { 197 - exynos3250_clk_regs = 198 - samsung_clk_alloc_reg_dump(exynos3250_cmu_clk_regs, 199 - ARRAY_SIZE(exynos3250_cmu_clk_regs)); 200 - if (!exynos3250_clk_regs) { 201 - pr_warn("%s: Failed to allocate sleep save data\n", __func__); 202 - goto err; 203 - } 204 - 205 - register_syscore_ops(&exynos3250_clk_syscore_ops); 206 - return; 207 - err: 208 - kfree(exynos3250_clk_regs); 209 - } 210 - #else 211 - static inline void exynos3250_clk_sleep_init(void) { } 212 - #endif 213 197 214 198 /* list of all parent clock list */ 215 199 PNAME(mout_vpllsrc_p) = { "fin_pll", }; ··· 724 782 { /* sentinel */ } 725 783 }; 726 784 727 - static struct samsung_pll_clock exynos3250_plls[nr_plls] __initdata = { 728 - [apll] = PLL(pll_35xx, CLK_FOUT_APLL, "fout_apll", "fin_pll", 729 - APLL_LOCK, APLL_CON0, NULL), 730 - [mpll] = PLL(pll_35xx, CLK_FOUT_MPLL, "fout_mpll", "fin_pll", 731 - MPLL_LOCK, MPLL_CON0, NULL), 732 - [vpll] = PLL(pll_36xx, CLK_FOUT_VPLL, "fout_vpll", "fin_pll", 733 - VPLL_LOCK, VPLL_CON0, NULL), 734 - [upll] = PLL(pll_35xx, CLK_FOUT_UPLL, "fout_upll", "fin_pll", 735 - UPLL_LOCK, UPLL_CON0, NULL), 785 + static struct samsung_pll_clock exynos3250_plls[] __initdata = { 786 + PLL(pll_35xx, CLK_FOUT_APLL, "fout_apll", "fin_pll", 787 + APLL_LOCK, APLL_CON0, exynos3250_pll_rates), 788 + PLL(pll_35xx, CLK_FOUT_MPLL, "fout_mpll", "fin_pll", 789 + MPLL_LOCK, MPLL_CON0, exynos3250_pll_rates), 790 + PLL(pll_36xx, CLK_FOUT_VPLL, "fout_vpll", "fin_pll", 791 + VPLL_LOCK, VPLL_CON0, exynos3250_vpll_rates), 792 + PLL(pll_35xx, CLK_FOUT_UPLL, "fout_upll", "fin_pll", 793 + UPLL_LOCK, UPLL_CON0, exynos3250_pll_rates), 736 794 }; 737 795 738 - static void __init exynos3_core_down_clock(void) 796 + static void __init exynos3_core_down_clock(void __iomem *reg_base) 739 797 { 740 798 unsigned int tmp; 741 799 ··· 756 814 __raw_writel(0x0, reg_base + PWR_CTRL2); 757 815 } 758 816 817 + static struct samsung_cmu_info cmu_info __initdata = { 818 + .pll_clks = exynos3250_plls, 819 + .nr_pll_clks = ARRAY_SIZE(exynos3250_plls), 820 + .mux_clks = mux_clks, 821 + .nr_mux_clks = ARRAY_SIZE(mux_clks), 822 + .div_clks = div_clks, 823 + .nr_div_clks = ARRAY_SIZE(div_clks), 824 + .gate_clks = gate_clks, 825 + .nr_gate_clks = ARRAY_SIZE(gate_clks), 826 + .fixed_factor_clks = fixed_factor_clks, 827 + .nr_fixed_factor_clks = ARRAY_SIZE(fixed_factor_clks), 828 + .nr_clk_ids = CLK_NR_CLKS, 829 + .clk_regs = exynos3250_cmu_clk_regs, 830 + .nr_clk_regs = ARRAY_SIZE(exynos3250_cmu_clk_regs), 831 + }; 832 + 759 833 static void __init exynos3250_cmu_init(struct device_node *np) 760 834 { 761 835 struct samsung_clk_provider *ctx; 762 836 763 - reg_base = of_iomap(np, 0); 764 - if (!reg_base) 765 - panic("%s: failed to map registers\n", __func__); 766 - 767 - ctx = samsung_clk_init(np, reg_base, CLK_NR_CLKS); 837 + ctx = samsung_cmu_register_one(np, &cmu_info); 768 838 if (!ctx) 769 - panic("%s: unable to allocate context.\n", __func__); 839 + return; 770 840 771 - samsung_clk_register_fixed_factor(ctx, fixed_factor_clks, 772 - ARRAY_SIZE(fixed_factor_clks)); 773 - 774 - exynos3250_plls[apll].rate_table = exynos3250_pll_rates; 775 - exynos3250_plls[mpll].rate_table = exynos3250_pll_rates; 776 - exynos3250_plls[vpll].rate_table = exynos3250_vpll_rates; 777 - exynos3250_plls[upll].rate_table = exynos3250_pll_rates; 778 - 779 - samsung_clk_register_pll(ctx, exynos3250_plls, 780 - ARRAY_SIZE(exynos3250_plls), reg_base); 781 - 782 - samsung_clk_register_mux(ctx, mux_clks, ARRAY_SIZE(mux_clks)); 783 - samsung_clk_register_div(ctx, div_clks, ARRAY_SIZE(div_clks)); 784 - samsung_clk_register_gate(ctx, gate_clks, ARRAY_SIZE(gate_clks)); 785 - 786 - exynos3_core_down_clock(); 787 - 788 - exynos3250_clk_sleep_init(); 789 - 790 - samsung_clk_of_add_provider(np, ctx); 841 + exynos3_core_down_clock(ctx->reg_base); 791 842 } 792 843 CLK_OF_DECLARE(exynos3250_cmu, "samsung,exynos3250-cmu", exynos3250_cmu_init); 793 844 ··· 807 872 #define EPLL_CON2 0x111c 808 873 #define SRC_EPLL 0x1120 809 874 810 - /* 811 - * Support for CMU save/restore across system suspends 812 - */ 813 - #ifdef CONFIG_PM_SLEEP 814 - static struct samsung_clk_reg_dump *exynos3250_dmc_clk_regs; 815 - 816 875 static unsigned long exynos3250_cmu_dmc_clk_regs[] __initdata = { 817 876 BPLL_LOCK, 818 877 BPLL_CON0, ··· 827 898 EPLL_CON2, 828 899 SRC_EPLL, 829 900 }; 830 - 831 - static int exynos3250_dmc_clk_suspend(void) 832 - { 833 - samsung_clk_save(dmc_reg_base, exynos3250_dmc_clk_regs, 834 - ARRAY_SIZE(exynos3250_cmu_dmc_clk_regs)); 835 - return 0; 836 - } 837 - 838 - static void exynos3250_dmc_clk_resume(void) 839 - { 840 - samsung_clk_restore(dmc_reg_base, exynos3250_dmc_clk_regs, 841 - ARRAY_SIZE(exynos3250_cmu_dmc_clk_regs)); 842 - } 843 - 844 - static struct syscore_ops exynos3250_dmc_clk_syscore_ops = { 845 - .suspend = exynos3250_dmc_clk_suspend, 846 - .resume = exynos3250_dmc_clk_resume, 847 - }; 848 - 849 - static void exynos3250_dmc_clk_sleep_init(void) 850 - { 851 - exynos3250_dmc_clk_regs = 852 - samsung_clk_alloc_reg_dump(exynos3250_cmu_dmc_clk_regs, 853 - ARRAY_SIZE(exynos3250_cmu_dmc_clk_regs)); 854 - if (!exynos3250_dmc_clk_regs) { 855 - pr_warn("%s: Failed to allocate sleep save data\n", __func__); 856 - goto err; 857 - } 858 - 859 - register_syscore_ops(&exynos3250_dmc_clk_syscore_ops); 860 - return; 861 - err: 862 - kfree(exynos3250_dmc_clk_regs); 863 - } 864 - #else 865 - static inline void exynos3250_dmc_clk_sleep_init(void) { } 866 - #endif 867 901 868 902 PNAME(mout_epll_p) = { "fin_pll", "fout_epll", }; 869 903 PNAME(mout_bpll_p) = { "fin_pll", "fout_bpll", }; ··· 869 977 DIV(CLK_DIV_DMCD, "div_dmcd", "div_dmc", DIV_DMC1, 11, 3), 870 978 }; 871 979 872 - static struct samsung_pll_clock exynos3250_dmc_plls[nr_dmc_plls] __initdata = { 873 - [bpll] = PLL(pll_35xx, CLK_FOUT_BPLL, "fout_bpll", "fin_pll", 874 - BPLL_LOCK, BPLL_CON0, NULL), 875 - [epll] = PLL(pll_36xx, CLK_FOUT_EPLL, "fout_epll", "fin_pll", 876 - EPLL_LOCK, EPLL_CON0, NULL), 980 + static struct samsung_pll_clock exynos3250_dmc_plls[] __initdata = { 981 + PLL(pll_35xx, CLK_FOUT_BPLL, "fout_bpll", "fin_pll", 982 + BPLL_LOCK, BPLL_CON0, exynos3250_pll_rates), 983 + PLL(pll_36xx, CLK_FOUT_EPLL, "fout_epll", "fin_pll", 984 + EPLL_LOCK, EPLL_CON0, exynos3250_epll_rates), 985 + }; 986 + 987 + static struct samsung_cmu_info dmc_cmu_info __initdata = { 988 + .pll_clks = exynos3250_dmc_plls, 989 + .nr_pll_clks = ARRAY_SIZE(exynos3250_dmc_plls), 990 + .mux_clks = dmc_mux_clks, 991 + .nr_mux_clks = ARRAY_SIZE(dmc_mux_clks), 992 + .div_clks = dmc_div_clks, 993 + .nr_div_clks = ARRAY_SIZE(dmc_div_clks), 994 + .nr_clk_ids = NR_CLKS_DMC, 995 + .clk_regs = exynos3250_cmu_dmc_clk_regs, 996 + .nr_clk_regs = ARRAY_SIZE(exynos3250_cmu_dmc_clk_regs), 877 997 }; 878 998 879 999 static void __init exynos3250_cmu_dmc_init(struct device_node *np) 880 1000 { 881 - struct samsung_clk_provider *ctx; 882 - 883 - dmc_reg_base = of_iomap(np, 0); 884 - if (!dmc_reg_base) 885 - panic("%s: failed to map registers\n", __func__); 886 - 887 - ctx = samsung_clk_init(np, dmc_reg_base, NR_CLKS_DMC); 888 - if (!ctx) 889 - panic("%s: unable to allocate context.\n", __func__); 890 - 891 - exynos3250_dmc_plls[bpll].rate_table = exynos3250_pll_rates; 892 - exynos3250_dmc_plls[epll].rate_table = exynos3250_epll_rates; 893 - 894 - pr_err("CLK registering epll bpll: %d, %d, %d, %d\n", 895 - exynos3250_dmc_plls[bpll].rate_table[0].rate, 896 - exynos3250_dmc_plls[bpll].rate_table[0].mdiv, 897 - exynos3250_dmc_plls[bpll].rate_table[0].pdiv, 898 - exynos3250_dmc_plls[bpll].rate_table[0].sdiv 899 - ); 900 - samsung_clk_register_pll(ctx, exynos3250_dmc_plls, 901 - ARRAY_SIZE(exynos3250_dmc_plls), dmc_reg_base); 902 - 903 - samsung_clk_register_mux(ctx, dmc_mux_clks, ARRAY_SIZE(dmc_mux_clks)); 904 - samsung_clk_register_div(ctx, dmc_div_clks, ARRAY_SIZE(dmc_div_clks)); 905 - 906 - exynos3250_dmc_clk_sleep_init(); 907 - 908 - samsung_clk_of_add_provider(np, ctx); 1001 + samsung_cmu_register_one(np, &dmc_cmu_info); 909 1002 } 910 1003 CLK_OF_DECLARE(exynos3250_cmu_dmc, "samsung,exynos3250-cmu-dmc", 911 1004 exynos3250_cmu_dmc_init);
+5 -5
drivers/clk/samsung/clk-exynos4.c
··· 703 703 704 704 /* list of divider clocks supported in all exynos4 soc's */ 705 705 static struct samsung_div_clock exynos4_div_clks[] __initdata = { 706 - DIV(0, "div_gdl", "mout_gdl", DIV_LEFTBUS, 0, 3), 706 + DIV(CLK_DIV_GDL, "div_gdl", "mout_gdl", DIV_LEFTBUS, 0, 3), 707 707 DIV(0, "div_gpl", "div_gdl", DIV_LEFTBUS, 4, 3), 708 708 DIV(0, "div_clkout_leftbus", "mout_clkout_leftbus", 709 709 CLKOUT_CMU_LEFTBUS, 8, 6), 710 710 711 - DIV(0, "div_gdr", "mout_gdr", DIV_RIGHTBUS, 0, 3), 711 + DIV(CLK_DIV_GDR, "div_gdr", "mout_gdr", DIV_RIGHTBUS, 0, 3), 712 712 DIV(0, "div_gpr", "div_gdr", DIV_RIGHTBUS, 4, 3), 713 713 DIV(0, "div_clkout_rightbus", "mout_clkout_rightbus", 714 714 CLKOUT_CMU_RIGHTBUS, 8, 6), ··· 781 781 CLK_SET_RATE_PARENT, 0), 782 782 DIV(0, "div_clkout_top", "mout_clkout_top", CLKOUT_CMU_TOP, 8, 6), 783 783 784 - DIV(0, "div_acp", "mout_dmc_bus", DIV_DMC0, 0, 3), 784 + DIV(CLK_DIV_ACP, "div_acp", "mout_dmc_bus", DIV_DMC0, 0, 3), 785 785 DIV(0, "div_acp_pclk", "div_acp", DIV_DMC0, 4, 3), 786 786 DIV(0, "div_dphy", "mout_dphy", DIV_DMC0, 8, 3), 787 - DIV(0, "div_dmc", "mout_dmc_bus", DIV_DMC0, 12, 3), 787 + DIV(CLK_DIV_DMC, "div_dmc", "mout_dmc_bus", DIV_DMC0, 12, 3), 788 788 DIV(0, "div_dmcd", "div_dmc", DIV_DMC0, 16, 3), 789 789 DIV(0, "div_dmcp", "div_dmcd", DIV_DMC0, 20, 3), 790 790 DIV(0, "div_pwi", "mout_pwi", DIV_DMC1, 8, 4), ··· 829 829 DIV_F(CLK_DIV_MCUISP1, "div_mcuisp1", "div_mcuisp0", E4X12_DIV_ISP1, 830 830 8, 3, CLK_GET_RATE_NOCACHE, 0), 831 831 DIV(CLK_SCLK_FIMG2D, "sclk_fimg2d", "mout_g2d", DIV_DMC1, 0, 4), 832 - DIV(0, "div_c2c", "mout_c2c", DIV_DMC1, 4, 3), 832 + DIV(CLK_DIV_C2C, "div_c2c", "mout_c2c", DIV_DMC1, 4, 3), 833 833 DIV(0, "div_c2c_aclk", "div_c2c", DIV_DMC1, 12, 3), 834 834 }; 835 835
+48 -168
drivers/clk/samsung/clk-exynos4415.c
··· 113 113 #define DIV_CPU0 0x14500 114 114 #define DIV_CPU1 0x14504 115 115 116 - enum exynos4415_plls { 117 - apll, epll, g3d_pll, isp_pll, disp_pll, 118 - nr_plls, 119 - }; 120 - 121 - static struct samsung_clk_provider *exynos4415_ctx; 122 - 123 - /* 124 - * Support for CMU save/restore across system suspends 125 - */ 126 - #ifdef CONFIG_PM_SLEEP 127 - static struct samsung_clk_reg_dump *exynos4415_clk_regs; 128 - 129 116 static unsigned long exynos4415_cmu_clk_regs[] __initdata = { 130 117 SRC_LEFTBUS, 131 118 DIV_LEFTBUS, ··· 205 218 DIV_CPU0, 206 219 DIV_CPU1, 207 220 }; 208 - 209 - static int exynos4415_clk_suspend(void) 210 - { 211 - samsung_clk_save(exynos4415_ctx->reg_base, exynos4415_clk_regs, 212 - ARRAY_SIZE(exynos4415_cmu_clk_regs)); 213 - 214 - return 0; 215 - } 216 - 217 - static void exynos4415_clk_resume(void) 218 - { 219 - samsung_clk_restore(exynos4415_ctx->reg_base, exynos4415_clk_regs, 220 - ARRAY_SIZE(exynos4415_cmu_clk_regs)); 221 - } 222 - 223 - static struct syscore_ops exynos4415_clk_syscore_ops = { 224 - .suspend = exynos4415_clk_suspend, 225 - .resume = exynos4415_clk_resume, 226 - }; 227 - 228 - static void exynos4415_clk_sleep_init(void) 229 - { 230 - exynos4415_clk_regs = 231 - samsung_clk_alloc_reg_dump(exynos4415_cmu_clk_regs, 232 - ARRAY_SIZE(exynos4415_cmu_clk_regs)); 233 - if (!exynos4415_clk_regs) { 234 - pr_warn("%s: Failed to allocate sleep save data\n", __func__); 235 - return; 236 - } 237 - 238 - register_syscore_ops(&exynos4415_clk_syscore_ops); 239 - } 240 - #else 241 - static inline void exynos4415_clk_sleep_init(void) { } 242 - #endif 243 221 244 222 /* list of all parent clock list */ 245 223 PNAME(mout_g3d_pllsrc_p) = { "fin_pll", }; ··· 911 959 { /* sentinel */ } 912 960 }; 913 961 914 - static struct samsung_pll_clock exynos4415_plls[nr_plls] __initdata = { 915 - [apll] = PLL(pll_35xx, CLK_FOUT_APLL, "fout_apll", "fin_pll", 916 - APLL_LOCK, APLL_CON0, NULL), 917 - [epll] = PLL(pll_36xx, CLK_FOUT_EPLL, "fout_epll", "fin_pll", 918 - EPLL_LOCK, EPLL_CON0, NULL), 919 - [g3d_pll] = PLL(pll_35xx, CLK_FOUT_G3D_PLL, "fout_g3d_pll", 920 - "mout_g3d_pllsrc", G3D_PLL_LOCK, G3D_PLL_CON0, NULL), 921 - [isp_pll] = PLL(pll_35xx, CLK_FOUT_ISP_PLL, "fout_isp_pll", "fin_pll", 922 - ISP_PLL_LOCK, ISP_PLL_CON0, NULL), 923 - [disp_pll] = PLL(pll_35xx, CLK_FOUT_DISP_PLL, "fout_disp_pll", 924 - "fin_pll", DISP_PLL_LOCK, DISP_PLL_CON0, NULL), 962 + static struct samsung_pll_clock exynos4415_plls[] __initdata = { 963 + PLL(pll_35xx, CLK_FOUT_APLL, "fout_apll", "fin_pll", 964 + APLL_LOCK, APLL_CON0, exynos4415_pll_rates), 965 + PLL(pll_36xx, CLK_FOUT_EPLL, "fout_epll", "fin_pll", 966 + EPLL_LOCK, EPLL_CON0, exynos4415_epll_rates), 967 + PLL(pll_35xx, CLK_FOUT_G3D_PLL, "fout_g3d_pll", "mout_g3d_pllsrc", 968 + G3D_PLL_LOCK, G3D_PLL_CON0, exynos4415_pll_rates), 969 + PLL(pll_35xx, CLK_FOUT_ISP_PLL, "fout_isp_pll", "fin_pll", 970 + ISP_PLL_LOCK, ISP_PLL_CON0, exynos4415_pll_rates), 971 + PLL(pll_35xx, CLK_FOUT_DISP_PLL, "fout_disp_pll", 972 + "fin_pll", DISP_PLL_LOCK, DISP_PLL_CON0, exynos4415_pll_rates), 973 + }; 974 + 975 + static struct samsung_cmu_info cmu_info __initdata = { 976 + .pll_clks = exynos4415_plls, 977 + .nr_pll_clks = ARRAY_SIZE(exynos4415_plls), 978 + .mux_clks = exynos4415_mux_clks, 979 + .nr_mux_clks = ARRAY_SIZE(exynos4415_mux_clks), 980 + .div_clks = exynos4415_div_clks, 981 + .nr_div_clks = ARRAY_SIZE(exynos4415_div_clks), 982 + .gate_clks = exynos4415_gate_clks, 983 + .nr_gate_clks = ARRAY_SIZE(exynos4415_gate_clks), 984 + .fixed_clks = exynos4415_fixed_rate_clks, 985 + .nr_fixed_clks = ARRAY_SIZE(exynos4415_fixed_rate_clks), 986 + .fixed_factor_clks = exynos4415_fixed_factor_clks, 987 + .nr_fixed_factor_clks = ARRAY_SIZE(exynos4415_fixed_factor_clks), 988 + .nr_clk_ids = CLK_NR_CLKS, 989 + .clk_regs = exynos4415_cmu_clk_regs, 990 + .nr_clk_regs = ARRAY_SIZE(exynos4415_cmu_clk_regs), 925 991 }; 926 992 927 993 static void __init exynos4415_cmu_init(struct device_node *np) 928 994 { 929 - void __iomem *reg_base; 930 - 931 - reg_base = of_iomap(np, 0); 932 - if (!reg_base) 933 - panic("%s: failed to map registers\n", __func__); 934 - 935 - exynos4415_ctx = samsung_clk_init(np, reg_base, CLK_NR_CLKS); 936 - if (!exynos4415_ctx) 937 - panic("%s: unable to allocate context.\n", __func__); 938 - 939 - exynos4415_plls[apll].rate_table = exynos4415_pll_rates; 940 - exynos4415_plls[epll].rate_table = exynos4415_epll_rates; 941 - exynos4415_plls[g3d_pll].rate_table = exynos4415_pll_rates; 942 - exynos4415_plls[isp_pll].rate_table = exynos4415_pll_rates; 943 - exynos4415_plls[disp_pll].rate_table = exynos4415_pll_rates; 944 - 945 - samsung_clk_register_fixed_factor(exynos4415_ctx, 946 - exynos4415_fixed_factor_clks, 947 - ARRAY_SIZE(exynos4415_fixed_factor_clks)); 948 - samsung_clk_register_fixed_rate(exynos4415_ctx, 949 - exynos4415_fixed_rate_clks, 950 - ARRAY_SIZE(exynos4415_fixed_rate_clks)); 951 - 952 - samsung_clk_register_pll(exynos4415_ctx, exynos4415_plls, 953 - ARRAY_SIZE(exynos4415_plls), reg_base); 954 - samsung_clk_register_mux(exynos4415_ctx, exynos4415_mux_clks, 955 - ARRAY_SIZE(exynos4415_mux_clks)); 956 - samsung_clk_register_div(exynos4415_ctx, exynos4415_div_clks, 957 - ARRAY_SIZE(exynos4415_div_clks)); 958 - samsung_clk_register_gate(exynos4415_ctx, exynos4415_gate_clks, 959 - ARRAY_SIZE(exynos4415_gate_clks)); 960 - 961 - exynos4415_clk_sleep_init(); 962 - 963 - samsung_clk_of_add_provider(np, exynos4415_ctx); 995 + samsung_cmu_register_one(np, &cmu_info); 964 996 } 965 997 CLK_OF_DECLARE(exynos4415_cmu, "samsung,exynos4415-cmu", exynos4415_cmu_init); 966 998 ··· 963 1027 #define SRC_DMC 0x300 964 1028 #define DIV_DMC1 0x504 965 1029 966 - enum exynos4415_dmc_plls { 967 - mpll, bpll, 968 - nr_dmc_plls, 969 - }; 970 - 971 - static struct samsung_clk_provider *exynos4415_dmc_ctx; 972 - 973 - #ifdef CONFIG_PM_SLEEP 974 - static struct samsung_clk_reg_dump *exynos4415_dmc_clk_regs; 975 - 976 1030 static unsigned long exynos4415_cmu_dmc_clk_regs[] __initdata = { 977 1031 MPLL_LOCK, 978 1032 MPLL_CON0, ··· 975 1049 SRC_DMC, 976 1050 DIV_DMC1, 977 1051 }; 978 - 979 - static int exynos4415_dmc_clk_suspend(void) 980 - { 981 - samsung_clk_save(exynos4415_dmc_ctx->reg_base, 982 - exynos4415_dmc_clk_regs, 983 - ARRAY_SIZE(exynos4415_cmu_dmc_clk_regs)); 984 - return 0; 985 - } 986 - 987 - static void exynos4415_dmc_clk_resume(void) 988 - { 989 - samsung_clk_restore(exynos4415_dmc_ctx->reg_base, 990 - exynos4415_dmc_clk_regs, 991 - ARRAY_SIZE(exynos4415_cmu_dmc_clk_regs)); 992 - } 993 - 994 - static struct syscore_ops exynos4415_dmc_clk_syscore_ops = { 995 - .suspend = exynos4415_dmc_clk_suspend, 996 - .resume = exynos4415_dmc_clk_resume, 997 - }; 998 - 999 - static void exynos4415_dmc_clk_sleep_init(void) 1000 - { 1001 - exynos4415_dmc_clk_regs = 1002 - samsung_clk_alloc_reg_dump(exynos4415_cmu_dmc_clk_regs, 1003 - ARRAY_SIZE(exynos4415_cmu_dmc_clk_regs)); 1004 - if (!exynos4415_dmc_clk_regs) { 1005 - pr_warn("%s: Failed to allocate sleep save data\n", __func__); 1006 - return; 1007 - } 1008 - 1009 - register_syscore_ops(&exynos4415_dmc_clk_syscore_ops); 1010 - } 1011 - #else 1012 - static inline void exynos4415_dmc_clk_sleep_init(void) { } 1013 - #endif /* CONFIG_PM_SLEEP */ 1014 1052 1015 1053 PNAME(mout_mpll_p) = { "fin_pll", "fout_mpll", }; 1016 1054 PNAME(mout_bpll_p) = { "fin_pll", "fout_bpll", }; ··· 997 1107 DIV(CLK_DMC_DIV_MPLL_PRE, "div_mpll_pre", "mout_mpll", DIV_DMC1, 8, 2), 998 1108 }; 999 1109 1000 - static struct samsung_pll_clock exynos4415_dmc_plls[nr_dmc_plls] __initdata = { 1001 - [mpll] = PLL(pll_35xx, CLK_DMC_FOUT_MPLL, "fout_mpll", "fin_pll", 1002 - MPLL_LOCK, MPLL_CON0, NULL), 1003 - [bpll] = PLL(pll_35xx, CLK_DMC_FOUT_BPLL, "fout_bpll", "fin_pll", 1004 - BPLL_LOCK, BPLL_CON0, NULL), 1110 + static struct samsung_pll_clock exynos4415_dmc_plls[] __initdata = { 1111 + PLL(pll_35xx, CLK_DMC_FOUT_MPLL, "fout_mpll", "fin_pll", 1112 + MPLL_LOCK, MPLL_CON0, exynos4415_pll_rates), 1113 + PLL(pll_35xx, CLK_DMC_FOUT_BPLL, "fout_bpll", "fin_pll", 1114 + BPLL_LOCK, BPLL_CON0, exynos4415_pll_rates), 1115 + }; 1116 + 1117 + static struct samsung_cmu_info cmu_dmc_info __initdata = { 1118 + .pll_clks = exynos4415_dmc_plls, 1119 + .nr_pll_clks = ARRAY_SIZE(exynos4415_dmc_plls), 1120 + .mux_clks = exynos4415_dmc_mux_clks, 1121 + .nr_mux_clks = ARRAY_SIZE(exynos4415_dmc_mux_clks), 1122 + .div_clks = exynos4415_dmc_div_clks, 1123 + .nr_div_clks = ARRAY_SIZE(exynos4415_dmc_div_clks), 1124 + .nr_clk_ids = NR_CLKS_DMC, 1125 + .clk_regs = exynos4415_cmu_dmc_clk_regs, 1126 + .nr_clk_regs = ARRAY_SIZE(exynos4415_cmu_dmc_clk_regs), 1005 1127 }; 1006 1128 1007 1129 static void __init exynos4415_cmu_dmc_init(struct device_node *np) 1008 1130 { 1009 - void __iomem *reg_base; 1010 - 1011 - reg_base = of_iomap(np, 0); 1012 - if (!reg_base) 1013 - panic("%s: failed to map registers\n", __func__); 1014 - 1015 - exynos4415_dmc_ctx = samsung_clk_init(np, reg_base, NR_CLKS_DMC); 1016 - if (!exynos4415_dmc_ctx) 1017 - panic("%s: unable to allocate context.\n", __func__); 1018 - 1019 - exynos4415_dmc_plls[mpll].rate_table = exynos4415_pll_rates; 1020 - exynos4415_dmc_plls[bpll].rate_table = exynos4415_pll_rates; 1021 - 1022 - samsung_clk_register_pll(exynos4415_dmc_ctx, exynos4415_dmc_plls, 1023 - ARRAY_SIZE(exynos4415_dmc_plls), reg_base); 1024 - samsung_clk_register_mux(exynos4415_dmc_ctx, exynos4415_dmc_mux_clks, 1025 - ARRAY_SIZE(exynos4415_dmc_mux_clks)); 1026 - samsung_clk_register_div(exynos4415_dmc_ctx, exynos4415_dmc_div_clks, 1027 - ARRAY_SIZE(exynos4415_dmc_div_clks)); 1028 - 1029 - exynos4415_dmc_clk_sleep_init(); 1030 - 1031 - samsung_clk_of_add_provider(np, exynos4415_dmc_ctx); 1131 + samsung_cmu_register_one(np, &cmu_dmc_info); 1032 1132 } 1033 1133 CLK_OF_DECLARE(exynos4415_cmu_dmc, "samsung,exynos4415-cmu-dmc", 1034 1134 exynos4415_cmu_dmc_init);
+406 -2
drivers/clk/samsung/clk-exynos7.c
··· 34 34 #define DIV_TOPC0 0x0600 35 35 #define DIV_TOPC1 0x0604 36 36 #define DIV_TOPC3 0x060C 37 + #define ENABLE_ACLK_TOPC1 0x0804 37 38 38 39 static struct samsung_fixed_factor_clock topc_fixed_factor_clks[] __initdata = { 39 40 FFACTOR(0, "ffac_topc_bus0_pll_div2", "mout_bus0_pll_ctrl", 1, 2, 0), ··· 46 45 }; 47 46 48 47 /* List of parent clocks for Muxes in CMU_TOPC */ 48 + PNAME(mout_aud_pll_ctrl_p) = { "fin_pll", "fout_aud_pll" }; 49 49 PNAME(mout_bus0_pll_ctrl_p) = { "fin_pll", "fout_bus0_pll" }; 50 50 PNAME(mout_bus1_pll_ctrl_p) = { "fin_pll", "fout_bus1_pll" }; 51 51 PNAME(mout_cc_pll_ctrl_p) = { "fin_pll", "fout_cc_pll" }; ··· 106 104 107 105 MUX(0, "mout_sclk_bus0_pll_out", mout_sclk_bus0_pll_out_p, 108 106 MUX_SEL_TOPC1, 16, 1), 107 + MUX(0, "mout_aud_pll_ctrl", mout_aud_pll_ctrl_p, MUX_SEL_TOPC1, 0, 1), 109 108 110 109 MUX(0, "mout_aclk_ccore_133", mout_topc_group2, MUX_SEL_TOPC2, 4, 2), 111 110 111 + MUX(0, "mout_aclk_mscl_532", mout_topc_group2, MUX_SEL_TOPC3, 20, 2), 112 112 MUX(0, "mout_aclk_peris_66", mout_topc_group2, MUX_SEL_TOPC3, 24, 2), 113 113 }; 114 114 ··· 118 114 DIV(DOUT_ACLK_CCORE_133, "dout_aclk_ccore_133", "mout_aclk_ccore_133", 119 115 DIV_TOPC0, 4, 4), 120 116 117 + DIV(DOUT_ACLK_MSCL_532, "dout_aclk_mscl_532", "mout_aclk_mscl_532", 118 + DIV_TOPC1, 20, 4), 121 119 DIV(DOUT_ACLK_PERIS, "dout_aclk_peris_66", "mout_aclk_peris_66", 122 120 DIV_TOPC1, 24, 4), 123 121 ··· 131 125 DIV_TOPC3, 12, 3), 132 126 DIV(DOUT_SCLK_MFC_PLL, "dout_sclk_mfc_pll", "mout_mfc_pll_ctrl", 133 127 DIV_TOPC3, 16, 3), 128 + DIV(DOUT_SCLK_AUD_PLL, "dout_sclk_aud_pll", "mout_aud_pll_ctrl", 129 + DIV_TOPC3, 28, 3), 130 + }; 131 + 132 + static struct samsung_pll_rate_table pll1460x_24mhz_tbl[] __initdata = { 133 + PLL_36XX_RATE(491520000, 20, 1, 0, 31457), 134 + {}, 135 + }; 136 + 137 + static struct samsung_gate_clock topc_gate_clks[] __initdata = { 138 + GATE(ACLK_MSCL_532, "aclk_mscl_532", "dout_aclk_mscl_532", 139 + ENABLE_ACLK_TOPC1, 20, 0, 0), 134 140 }; 135 141 136 142 static struct samsung_pll_clock topc_pll_clks[] __initdata = { ··· 154 136 BUS1_DPLL_CON0, NULL), 155 137 PLL(pll_1452x, 0, "fout_mfc_pll", "fin_pll", MFC_PLL_LOCK, 156 138 MFC_PLL_CON0, NULL), 157 - PLL(pll_1460x, 0, "fout_aud_pll", "fin_pll", AUD_PLL_LOCK, 158 - AUD_PLL_CON0, NULL), 139 + PLL(pll_1460x, FOUT_AUD_PLL, "fout_aud_pll", "fin_pll", AUD_PLL_LOCK, 140 + AUD_PLL_CON0, pll1460x_24mhz_tbl), 159 141 }; 160 142 161 143 static struct samsung_cmu_info topc_cmu_info __initdata = { ··· 165 147 .nr_mux_clks = ARRAY_SIZE(topc_mux_clks), 166 148 .div_clks = topc_div_clks, 167 149 .nr_div_clks = ARRAY_SIZE(topc_div_clks), 150 + .gate_clks = topc_gate_clks, 151 + .nr_gate_clks = ARRAY_SIZE(topc_gate_clks), 168 152 .fixed_factor_clks = topc_fixed_factor_clks, 169 153 .nr_fixed_factor_clks = ARRAY_SIZE(topc_fixed_factor_clks), 170 154 .nr_clk_ids = TOPC_NR_CLK, ··· 186 166 #define MUX_SEL_TOP00 0x0200 187 167 #define MUX_SEL_TOP01 0x0204 188 168 #define MUX_SEL_TOP03 0x020C 169 + #define MUX_SEL_TOP0_PERIC0 0x0230 170 + #define MUX_SEL_TOP0_PERIC1 0x0234 171 + #define MUX_SEL_TOP0_PERIC2 0x0238 189 172 #define MUX_SEL_TOP0_PERIC3 0x023C 190 173 #define DIV_TOP03 0x060C 174 + #define DIV_TOP0_PERIC0 0x0630 175 + #define DIV_TOP0_PERIC1 0x0634 176 + #define DIV_TOP0_PERIC2 0x0638 191 177 #define DIV_TOP0_PERIC3 0x063C 178 + #define ENABLE_SCLK_TOP0_PERIC0 0x0A30 179 + #define ENABLE_SCLK_TOP0_PERIC1 0x0A34 180 + #define ENABLE_SCLK_TOP0_PERIC2 0x0A38 192 181 #define ENABLE_SCLK_TOP0_PERIC3 0x0A3C 193 182 194 183 /* List of parent clocks for Muxes in CMU_TOP0 */ ··· 205 176 PNAME(mout_bus1_pll_p) = { "fin_pll", "dout_sclk_bus1_pll" }; 206 177 PNAME(mout_cc_pll_p) = { "fin_pll", "dout_sclk_cc_pll" }; 207 178 PNAME(mout_mfc_pll_p) = { "fin_pll", "dout_sclk_mfc_pll" }; 179 + PNAME(mout_aud_pll_p) = { "fin_pll", "dout_sclk_aud_pll" }; 208 180 209 181 PNAME(mout_top0_half_bus0_pll_p) = {"mout_top0_bus0_pll", 210 182 "ffac_top0_bus0_pll_div2"}; ··· 219 189 PNAME(mout_top0_group1) = {"mout_top0_half_bus0_pll", 220 190 "mout_top0_half_bus1_pll", "mout_top0_half_cc_pll", 221 191 "mout_top0_half_mfc_pll"}; 192 + PNAME(mout_top0_group3) = {"ioclk_audiocdclk0", 193 + "ioclk_audiocdclk1", "ioclk_spdif_extclk", 194 + "mout_top0_aud_pll", "mout_top0_half_bus0_pll", 195 + "mout_top0_half_bus1_pll"}; 196 + PNAME(mout_top0_group4) = {"ioclk_audiocdclk1", "mout_top0_aud_pll", 197 + "mout_top0_half_bus0_pll", "mout_top0_half_bus1_pll"}; 222 198 223 199 static unsigned long top0_clk_regs[] __initdata = { 224 200 MUX_SEL_TOP00, 225 201 MUX_SEL_TOP01, 226 202 MUX_SEL_TOP03, 203 + MUX_SEL_TOP0_PERIC0, 204 + MUX_SEL_TOP0_PERIC1, 205 + MUX_SEL_TOP0_PERIC2, 227 206 MUX_SEL_TOP0_PERIC3, 228 207 DIV_TOP03, 208 + DIV_TOP0_PERIC0, 209 + DIV_TOP0_PERIC1, 210 + DIV_TOP0_PERIC2, 229 211 DIV_TOP0_PERIC3, 212 + ENABLE_SCLK_TOP0_PERIC0, 213 + ENABLE_SCLK_TOP0_PERIC1, 214 + ENABLE_SCLK_TOP0_PERIC2, 230 215 ENABLE_SCLK_TOP0_PERIC3, 231 216 }; 232 217 233 218 static struct samsung_mux_clock top0_mux_clks[] __initdata = { 219 + MUX(0, "mout_top0_aud_pll", mout_aud_pll_p, MUX_SEL_TOP00, 0, 1), 234 220 MUX(0, "mout_top0_mfc_pll", mout_mfc_pll_p, MUX_SEL_TOP00, 4, 1), 235 221 MUX(0, "mout_top0_cc_pll", mout_cc_pll_p, MUX_SEL_TOP00, 8, 1), 236 222 MUX(0, "mout_top0_bus1_pll", mout_bus1_pll_p, MUX_SEL_TOP00, 12, 1), ··· 264 218 MUX(0, "mout_aclk_peric1_66", mout_top0_group1, MUX_SEL_TOP03, 12, 2), 265 219 MUX(0, "mout_aclk_peric0_66", mout_top0_group1, MUX_SEL_TOP03, 20, 2), 266 220 221 + MUX(0, "mout_sclk_spdif", mout_top0_group3, MUX_SEL_TOP0_PERIC0, 4, 3), 222 + MUX(0, "mout_sclk_pcm1", mout_top0_group4, MUX_SEL_TOP0_PERIC0, 8, 2), 223 + MUX(0, "mout_sclk_i2s1", mout_top0_group4, MUX_SEL_TOP0_PERIC0, 20, 2), 224 + 225 + MUX(0, "mout_sclk_spi1", mout_top0_group1, MUX_SEL_TOP0_PERIC1, 8, 2), 226 + MUX(0, "mout_sclk_spi0", mout_top0_group1, MUX_SEL_TOP0_PERIC1, 20, 2), 227 + 228 + MUX(0, "mout_sclk_spi3", mout_top0_group1, MUX_SEL_TOP0_PERIC2, 8, 2), 229 + MUX(0, "mout_sclk_spi2", mout_top0_group1, MUX_SEL_TOP0_PERIC2, 20, 2), 267 230 MUX(0, "mout_sclk_uart3", mout_top0_group1, MUX_SEL_TOP0_PERIC3, 4, 2), 268 231 MUX(0, "mout_sclk_uart2", mout_top0_group1, MUX_SEL_TOP0_PERIC3, 8, 2), 269 232 MUX(0, "mout_sclk_uart1", mout_top0_group1, MUX_SEL_TOP0_PERIC3, 12, 2), 270 233 MUX(0, "mout_sclk_uart0", mout_top0_group1, MUX_SEL_TOP0_PERIC3, 16, 2), 234 + MUX(0, "mout_sclk_spi4", mout_top0_group1, MUX_SEL_TOP0_PERIC3, 20, 2), 271 235 }; 272 236 273 237 static struct samsung_div_clock top0_div_clks[] __initdata = { ··· 286 230 DIV(DOUT_ACLK_PERIC0, "dout_aclk_peric0_66", "mout_aclk_peric0_66", 287 231 DIV_TOP03, 20, 6), 288 232 233 + DIV(0, "dout_sclk_spdif", "mout_sclk_spdif", DIV_TOP0_PERIC0, 4, 4), 234 + DIV(0, "dout_sclk_pcm1", "mout_sclk_pcm1", DIV_TOP0_PERIC0, 8, 12), 235 + DIV(0, "dout_sclk_i2s1", "mout_sclk_i2s1", DIV_TOP0_PERIC0, 20, 10), 236 + 237 + DIV(0, "dout_sclk_spi1", "mout_sclk_spi1", DIV_TOP0_PERIC1, 8, 12), 238 + DIV(0, "dout_sclk_spi0", "mout_sclk_spi0", DIV_TOP0_PERIC1, 20, 12), 239 + 240 + DIV(0, "dout_sclk_spi3", "mout_sclk_spi3", DIV_TOP0_PERIC2, 8, 12), 241 + DIV(0, "dout_sclk_spi2", "mout_sclk_spi2", DIV_TOP0_PERIC2, 20, 12), 242 + 289 243 DIV(0, "dout_sclk_uart3", "mout_sclk_uart3", DIV_TOP0_PERIC3, 4, 4), 290 244 DIV(0, "dout_sclk_uart2", "mout_sclk_uart2", DIV_TOP0_PERIC3, 8, 4), 291 245 DIV(0, "dout_sclk_uart1", "mout_sclk_uart1", DIV_TOP0_PERIC3, 12, 4), 292 246 DIV(0, "dout_sclk_uart0", "mout_sclk_uart0", DIV_TOP0_PERIC3, 16, 4), 247 + DIV(0, "dout_sclk_spi4", "mout_sclk_spi4", DIV_TOP0_PERIC3, 20, 12), 293 248 }; 294 249 295 250 static struct samsung_gate_clock top0_gate_clks[] __initdata = { 251 + GATE(CLK_SCLK_SPDIF, "sclk_spdif", "dout_sclk_spdif", 252 + ENABLE_SCLK_TOP0_PERIC0, 4, CLK_SET_RATE_PARENT, 0), 253 + GATE(CLK_SCLK_PCM1, "sclk_pcm1", "dout_sclk_pcm1", 254 + ENABLE_SCLK_TOP0_PERIC0, 8, CLK_SET_RATE_PARENT, 0), 255 + GATE(CLK_SCLK_I2S1, "sclk_i2s1", "dout_sclk_i2s1", 256 + ENABLE_SCLK_TOP0_PERIC0, 20, CLK_SET_RATE_PARENT, 0), 257 + 258 + GATE(CLK_SCLK_SPI1, "sclk_spi1", "dout_sclk_spi1", 259 + ENABLE_SCLK_TOP0_PERIC1, 8, CLK_SET_RATE_PARENT, 0), 260 + GATE(CLK_SCLK_SPI0, "sclk_spi0", "dout_sclk_spi0", 261 + ENABLE_SCLK_TOP0_PERIC1, 20, CLK_SET_RATE_PARENT, 0), 262 + 263 + GATE(CLK_SCLK_SPI3, "sclk_spi3", "dout_sclk_spi3", 264 + ENABLE_SCLK_TOP0_PERIC2, 8, CLK_SET_RATE_PARENT, 0), 265 + GATE(CLK_SCLK_SPI2, "sclk_spi2", "dout_sclk_spi2", 266 + ENABLE_SCLK_TOP0_PERIC2, 20, CLK_SET_RATE_PARENT, 0), 296 267 GATE(CLK_SCLK_UART3, "sclk_uart3", "dout_sclk_uart3", 297 268 ENABLE_SCLK_TOP0_PERIC3, 4, 0, 0), 298 269 GATE(CLK_SCLK_UART2, "sclk_uart2", "dout_sclk_uart2", ··· 328 245 ENABLE_SCLK_TOP0_PERIC3, 12, 0, 0), 329 246 GATE(CLK_SCLK_UART0, "sclk_uart0", "dout_sclk_uart0", 330 247 ENABLE_SCLK_TOP0_PERIC3, 16, 0, 0), 248 + GATE(CLK_SCLK_SPI4, "sclk_spi4", "dout_sclk_spi4", 249 + ENABLE_SCLK_TOP0_PERIC3, 20, CLK_SET_RATE_PARENT, 0), 331 250 }; 332 251 333 252 static struct samsung_fixed_factor_clock top0_fixed_factor_clks[] __initdata = { ··· 428 343 MUX(0, "mout_aclk_fsys0_200", mout_top1_group1, MUX_SEL_TOP13, 28, 2), 429 344 430 345 MUX(0, "mout_sclk_mmc2", mout_top1_group1, MUX_SEL_TOP1_FSYS0, 24, 2), 346 + MUX(0, "mout_sclk_usbdrd300", mout_top1_group1, 347 + MUX_SEL_TOP1_FSYS0, 28, 2), 431 348 432 349 MUX(0, "mout_sclk_mmc1", mout_top1_group1, MUX_SEL_TOP1_FSYS1, 24, 2), 433 350 MUX(0, "mout_sclk_mmc0", mout_top1_group1, MUX_SEL_TOP1_FSYS1, 28, 2), ··· 443 356 444 357 DIV(DOUT_SCLK_MMC2, "dout_sclk_mmc2", "mout_sclk_mmc2", 445 358 DIV_TOP1_FSYS0, 24, 4), 359 + DIV(0, "dout_sclk_usbdrd300", "mout_sclk_usbdrd300", 360 + DIV_TOP1_FSYS0, 28, 4), 446 361 447 362 DIV(DOUT_SCLK_MMC1, "dout_sclk_mmc1", "mout_sclk_mmc1", 448 363 DIV_TOP1_FSYS1, 24, 4), ··· 455 366 static struct samsung_gate_clock top1_gate_clks[] __initdata = { 456 367 GATE(CLK_SCLK_MMC2, "sclk_mmc2", "dout_sclk_mmc2", 457 368 ENABLE_SCLK_TOP1_FSYS0, 24, CLK_SET_RATE_PARENT, 0), 369 + GATE(0, "sclk_usbdrd300", "dout_sclk_usbdrd300", 370 + ENABLE_SCLK_TOP1_FSYS0, 28, 0, 0), 458 371 459 372 GATE(CLK_SCLK_MMC1, "sclk_mmc1", "dout_sclk_mmc1", 460 373 ENABLE_SCLK_TOP1_FSYS1, 24, CLK_SET_RATE_PARENT, 0), ··· 605 514 /* Register Offset definitions for CMU_PERIC1 (0x14C80000) */ 606 515 #define MUX_SEL_PERIC10 0x0200 607 516 #define MUX_SEL_PERIC11 0x0204 517 + #define MUX_SEL_PERIC12 0x0208 608 518 #define ENABLE_PCLK_PERIC1 0x0900 609 519 #define ENABLE_SCLK_PERIC10 0x0A00 610 520 ··· 617 525 PNAME(mout_sclk_uart1_p) = { "fin_pll", "sclk_uart1" }; 618 526 PNAME(mout_sclk_uart2_p) = { "fin_pll", "sclk_uart2" }; 619 527 PNAME(mout_sclk_uart3_p) = { "fin_pll", "sclk_uart3" }; 528 + PNAME(mout_sclk_spi0_p) = { "fin_pll", "sclk_spi0" }; 529 + PNAME(mout_sclk_spi1_p) = { "fin_pll", "sclk_spi1" }; 530 + PNAME(mout_sclk_spi2_p) = { "fin_pll", "sclk_spi2" }; 531 + PNAME(mout_sclk_spi3_p) = { "fin_pll", "sclk_spi3" }; 532 + PNAME(mout_sclk_spi4_p) = { "fin_pll", "sclk_spi4" }; 620 533 621 534 static unsigned long peric1_clk_regs[] __initdata = { 622 535 MUX_SEL_PERIC10, 623 536 MUX_SEL_PERIC11, 537 + MUX_SEL_PERIC12, 624 538 ENABLE_PCLK_PERIC1, 625 539 ENABLE_SCLK_PERIC10, 626 540 }; ··· 635 537 MUX(0, "mout_aclk_peric1_66_user", mout_aclk_peric1_66_p, 636 538 MUX_SEL_PERIC10, 0, 1), 637 539 540 + MUX_F(0, "mout_sclk_spi0_user", mout_sclk_spi0_p, 541 + MUX_SEL_PERIC11, 0, 1, CLK_SET_RATE_PARENT, 0), 542 + MUX_F(0, "mout_sclk_spi1_user", mout_sclk_spi1_p, 543 + MUX_SEL_PERIC11, 4, 1, CLK_SET_RATE_PARENT, 0), 544 + MUX_F(0, "mout_sclk_spi2_user", mout_sclk_spi2_p, 545 + MUX_SEL_PERIC11, 8, 1, CLK_SET_RATE_PARENT, 0), 546 + MUX_F(0, "mout_sclk_spi3_user", mout_sclk_spi3_p, 547 + MUX_SEL_PERIC11, 12, 1, CLK_SET_RATE_PARENT, 0), 548 + MUX_F(0, "mout_sclk_spi4_user", mout_sclk_spi4_p, 549 + MUX_SEL_PERIC11, 16, 1, CLK_SET_RATE_PARENT, 0), 638 550 MUX(0, "mout_sclk_uart1_user", mout_sclk_uart1_p, 639 551 MUX_SEL_PERIC11, 20, 1), 640 552 MUX(0, "mout_sclk_uart2_user", mout_sclk_uart2_p, ··· 670 562 ENABLE_PCLK_PERIC1, 10, 0, 0), 671 563 GATE(PCLK_UART3, "pclk_uart3", "mout_aclk_peric1_66_user", 672 564 ENABLE_PCLK_PERIC1, 11, 0, 0), 565 + GATE(PCLK_SPI0, "pclk_spi0", "mout_aclk_peric1_66_user", 566 + ENABLE_PCLK_PERIC1, 12, 0, 0), 567 + GATE(PCLK_SPI1, "pclk_spi1", "mout_aclk_peric1_66_user", 568 + ENABLE_PCLK_PERIC1, 13, 0, 0), 569 + GATE(PCLK_SPI2, "pclk_spi2", "mout_aclk_peric1_66_user", 570 + ENABLE_PCLK_PERIC1, 14, 0, 0), 571 + GATE(PCLK_SPI3, "pclk_spi3", "mout_aclk_peric1_66_user", 572 + ENABLE_PCLK_PERIC1, 15, 0, 0), 573 + GATE(PCLK_SPI4, "pclk_spi4", "mout_aclk_peric1_66_user", 574 + ENABLE_PCLK_PERIC1, 16, 0, 0), 575 + GATE(PCLK_I2S1, "pclk_i2s1", "mout_aclk_peric1_66_user", 576 + ENABLE_PCLK_PERIC1, 17, CLK_SET_RATE_PARENT, 0), 577 + GATE(PCLK_PCM1, "pclk_pcm1", "mout_aclk_peric1_66_user", 578 + ENABLE_PCLK_PERIC1, 18, 0, 0), 579 + GATE(PCLK_SPDIF, "pclk_spdif", "mout_aclk_peric1_66_user", 580 + ENABLE_PCLK_PERIC1, 19, 0, 0), 673 581 674 582 GATE(SCLK_UART1, "sclk_uart1_user", "mout_sclk_uart1_user", 675 583 ENABLE_SCLK_PERIC10, 9, 0, 0), ··· 693 569 ENABLE_SCLK_PERIC10, 10, 0, 0), 694 570 GATE(SCLK_UART3, "sclk_uart3_user", "mout_sclk_uart3_user", 695 571 ENABLE_SCLK_PERIC10, 11, 0, 0), 572 + GATE(SCLK_SPI0, "sclk_spi0_user", "mout_sclk_spi0_user", 573 + ENABLE_SCLK_PERIC10, 12, CLK_SET_RATE_PARENT, 0), 574 + GATE(SCLK_SPI1, "sclk_spi1_user", "mout_sclk_spi1_user", 575 + ENABLE_SCLK_PERIC10, 13, CLK_SET_RATE_PARENT, 0), 576 + GATE(SCLK_SPI2, "sclk_spi2_user", "mout_sclk_spi2_user", 577 + ENABLE_SCLK_PERIC10, 14, CLK_SET_RATE_PARENT, 0), 578 + GATE(SCLK_SPI3, "sclk_spi3_user", "mout_sclk_spi3_user", 579 + ENABLE_SCLK_PERIC10, 15, CLK_SET_RATE_PARENT, 0), 580 + GATE(SCLK_SPI4, "sclk_spi4_user", "mout_sclk_spi4_user", 581 + ENABLE_SCLK_PERIC10, 16, CLK_SET_RATE_PARENT, 0), 582 + GATE(SCLK_I2S1, "sclk_i2s1_user", "sclk_i2s1", 583 + ENABLE_SCLK_PERIC10, 17, CLK_SET_RATE_PARENT, 0), 584 + GATE(SCLK_PCM1, "sclk_pcm1_user", "sclk_pcm1", 585 + ENABLE_SCLK_PERIC10, 18, CLK_SET_RATE_PARENT, 0), 586 + GATE(SCLK_SPDIF, "sclk_spdif_user", "sclk_spdif", 587 + ENABLE_SCLK_PERIC10, 19, CLK_SET_RATE_PARENT, 0), 696 588 }; 697 589 698 590 static struct samsung_cmu_info peric1_cmu_info __initdata = { ··· 787 647 /* Register Offset definitions for CMU_FSYS0 (0x10E90000) */ 788 648 #define MUX_SEL_FSYS00 0x0200 789 649 #define MUX_SEL_FSYS01 0x0204 650 + #define MUX_SEL_FSYS02 0x0208 651 + #define ENABLE_ACLK_FSYS00 0x0800 790 652 #define ENABLE_ACLK_FSYS01 0x0804 653 + #define ENABLE_SCLK_FSYS01 0x0A04 654 + #define ENABLE_SCLK_FSYS02 0x0A08 655 + #define ENABLE_SCLK_FSYS04 0x0A10 791 656 792 657 /* 793 658 * List of parent clocks for Muxes in CMU_FSYS0 ··· 800 655 PNAME(mout_aclk_fsys0_200_p) = { "fin_pll", "dout_aclk_fsys0_200" }; 801 656 PNAME(mout_sclk_mmc2_p) = { "fin_pll", "sclk_mmc2" }; 802 657 658 + PNAME(mout_sclk_usbdrd300_p) = { "fin_pll", "sclk_usbdrd300" }; 659 + PNAME(mout_phyclk_usbdrd300_udrd30_phyclk_p) = { "fin_pll", 660 + "phyclk_usbdrd300_udrd30_phyclock" }; 661 + PNAME(mout_phyclk_usbdrd300_udrd30_pipe_pclk_p) = { "fin_pll", 662 + "phyclk_usbdrd300_udrd30_pipe_pclk" }; 663 + 664 + /* fixed rate clocks used in the FSYS0 block */ 665 + struct samsung_fixed_rate_clock fixed_rate_clks_fsys0[] __initdata = { 666 + FRATE(0, "phyclk_usbdrd300_udrd30_phyclock", NULL, 667 + CLK_IS_ROOT, 60000000), 668 + FRATE(0, "phyclk_usbdrd300_udrd30_pipe_pclk", NULL, 669 + CLK_IS_ROOT, 125000000), 670 + }; 671 + 803 672 static unsigned long fsys0_clk_regs[] __initdata = { 804 673 MUX_SEL_FSYS00, 805 674 MUX_SEL_FSYS01, 675 + MUX_SEL_FSYS02, 676 + ENABLE_ACLK_FSYS00, 806 677 ENABLE_ACLK_FSYS01, 678 + ENABLE_SCLK_FSYS01, 679 + ENABLE_SCLK_FSYS02, 680 + ENABLE_SCLK_FSYS04, 807 681 }; 808 682 809 683 static struct samsung_mux_clock fsys0_mux_clks[] __initdata = { ··· 830 666 MUX_SEL_FSYS00, 24, 1), 831 667 832 668 MUX(0, "mout_sclk_mmc2_user", mout_sclk_mmc2_p, MUX_SEL_FSYS01, 24, 1), 669 + MUX(0, "mout_sclk_usbdrd300_user", mout_sclk_usbdrd300_p, 670 + MUX_SEL_FSYS01, 28, 1), 671 + 672 + MUX(0, "mout_phyclk_usbdrd300_udrd30_pipe_pclk_user", 673 + mout_phyclk_usbdrd300_udrd30_pipe_pclk_p, 674 + MUX_SEL_FSYS02, 24, 1), 675 + MUX(0, "mout_phyclk_usbdrd300_udrd30_phyclk_user", 676 + mout_phyclk_usbdrd300_udrd30_phyclk_p, 677 + MUX_SEL_FSYS02, 28, 1), 833 678 }; 834 679 835 680 static struct samsung_gate_clock fsys0_gate_clks[] __initdata = { 681 + GATE(ACLK_AXIUS_USBDRD30X_FSYS0X, "aclk_axius_usbdrd30x_fsys0x", 682 + "mout_aclk_fsys0_200_user", 683 + ENABLE_ACLK_FSYS00, 19, 0, 0), 684 + GATE(ACLK_PDMA1, "aclk_pdma1", "mout_aclk_fsys0_200_user", 685 + ENABLE_ACLK_FSYS00, 3, 0, 0), 686 + GATE(ACLK_PDMA0, "aclk_pdma0", "mout_aclk_fsys0_200_user", 687 + ENABLE_ACLK_FSYS00, 4, 0, 0), 688 + 689 + GATE(ACLK_USBDRD300, "aclk_usbdrd300", "mout_aclk_fsys0_200_user", 690 + ENABLE_ACLK_FSYS01, 29, 0, 0), 836 691 GATE(ACLK_MMC2, "aclk_mmc2", "mout_aclk_fsys0_200_user", 837 692 ENABLE_ACLK_FSYS01, 31, 0, 0), 693 + 694 + GATE(SCLK_USBDRD300_SUSPENDCLK, "sclk_usbdrd300_suspendclk", 695 + "mout_sclk_usbdrd300_user", 696 + ENABLE_SCLK_FSYS01, 4, 0, 0), 697 + GATE(SCLK_USBDRD300_REFCLK, "sclk_usbdrd300_refclk", "fin_pll", 698 + ENABLE_SCLK_FSYS01, 8, 0, 0), 699 + 700 + GATE(PHYCLK_USBDRD300_UDRD30_PIPE_PCLK_USER, 701 + "phyclk_usbdrd300_udrd30_pipe_pclk_user", 702 + "mout_phyclk_usbdrd300_udrd30_pipe_pclk_user", 703 + ENABLE_SCLK_FSYS02, 24, 0, 0), 704 + GATE(PHYCLK_USBDRD300_UDRD30_PHYCLK_USER, 705 + "phyclk_usbdrd300_udrd30_phyclk_user", 706 + "mout_phyclk_usbdrd300_udrd30_phyclk_user", 707 + ENABLE_SCLK_FSYS02, 28, 0, 0), 708 + 709 + GATE(OSCCLK_PHY_CLKOUT_USB30_PHY, "oscclk_phy_clkout_usb30_phy", 710 + "fin_pll", 711 + ENABLE_SCLK_FSYS04, 28, 0, 0), 838 712 }; 839 713 840 714 static struct samsung_cmu_info fsys0_cmu_info __initdata = { ··· 943 741 944 742 CLK_OF_DECLARE(exynos7_clk_fsys1, "samsung,exynos7-clock-fsys1", 945 743 exynos7_clk_fsys1_init); 744 + 745 + #define MUX_SEL_MSCL 0x0200 746 + #define DIV_MSCL 0x0600 747 + #define ENABLE_ACLK_MSCL 0x0800 748 + #define ENABLE_PCLK_MSCL 0x0900 749 + 750 + /* List of parent clocks for Muxes in CMU_MSCL */ 751 + PNAME(mout_aclk_mscl_532_user_p) = { "fin_pll", "aclk_mscl_532" }; 752 + 753 + static unsigned long mscl_clk_regs[] __initdata = { 754 + MUX_SEL_MSCL, 755 + DIV_MSCL, 756 + ENABLE_ACLK_MSCL, 757 + ENABLE_PCLK_MSCL, 758 + }; 759 + 760 + static struct samsung_mux_clock mscl_mux_clks[] __initdata = { 761 + MUX(USERMUX_ACLK_MSCL_532, "usermux_aclk_mscl_532", 762 + mout_aclk_mscl_532_user_p, MUX_SEL_MSCL, 0, 1), 763 + }; 764 + static struct samsung_div_clock mscl_div_clks[] __initdata = { 765 + DIV(DOUT_PCLK_MSCL, "dout_pclk_mscl", "usermux_aclk_mscl_532", 766 + DIV_MSCL, 0, 3), 767 + }; 768 + static struct samsung_gate_clock mscl_gate_clks[] __initdata = { 769 + 770 + GATE(ACLK_MSCL_0, "aclk_mscl_0", "usermux_aclk_mscl_532", 771 + ENABLE_ACLK_MSCL, 31, 0, 0), 772 + GATE(ACLK_MSCL_1, "aclk_mscl_1", "usermux_aclk_mscl_532", 773 + ENABLE_ACLK_MSCL, 30, 0, 0), 774 + GATE(ACLK_JPEG, "aclk_jpeg", "usermux_aclk_mscl_532", 775 + ENABLE_ACLK_MSCL, 29, 0, 0), 776 + GATE(ACLK_G2D, "aclk_g2d", "usermux_aclk_mscl_532", 777 + ENABLE_ACLK_MSCL, 28, 0, 0), 778 + GATE(ACLK_LH_ASYNC_SI_MSCL_0, "aclk_lh_async_si_mscl_0", 779 + "usermux_aclk_mscl_532", 780 + ENABLE_ACLK_MSCL, 27, 0, 0), 781 + GATE(ACLK_LH_ASYNC_SI_MSCL_1, "aclk_lh_async_si_mscl_1", 782 + "usermux_aclk_mscl_532", 783 + ENABLE_ACLK_MSCL, 26, 0, 0), 784 + GATE(ACLK_XIU_MSCLX_0, "aclk_xiu_msclx_0", "usermux_aclk_mscl_532", 785 + ENABLE_ACLK_MSCL, 25, 0, 0), 786 + GATE(ACLK_XIU_MSCLX_1, "aclk_xiu_msclx_1", "usermux_aclk_mscl_532", 787 + ENABLE_ACLK_MSCL, 24, 0, 0), 788 + GATE(ACLK_AXI2ACEL_BRIDGE, "aclk_axi2acel_bridge", 789 + "usermux_aclk_mscl_532", 790 + ENABLE_ACLK_MSCL, 23, 0, 0), 791 + GATE(ACLK_QE_MSCL_0, "aclk_qe_mscl_0", "usermux_aclk_mscl_532", 792 + ENABLE_ACLK_MSCL, 22, 0, 0), 793 + GATE(ACLK_QE_MSCL_1, "aclk_qe_mscl_1", "usermux_aclk_mscl_532", 794 + ENABLE_ACLK_MSCL, 21, 0, 0), 795 + GATE(ACLK_QE_JPEG, "aclk_qe_jpeg", "usermux_aclk_mscl_532", 796 + ENABLE_ACLK_MSCL, 20, 0, 0), 797 + GATE(ACLK_QE_G2D, "aclk_qe_g2d", "usermux_aclk_mscl_532", 798 + ENABLE_ACLK_MSCL, 19, 0, 0), 799 + GATE(ACLK_PPMU_MSCL_0, "aclk_ppmu_mscl_0", "usermux_aclk_mscl_532", 800 + ENABLE_ACLK_MSCL, 18, 0, 0), 801 + GATE(ACLK_PPMU_MSCL_1, "aclk_ppmu_mscl_1", "usermux_aclk_mscl_532", 802 + ENABLE_ACLK_MSCL, 17, 0, 0), 803 + GATE(ACLK_MSCLNP_133, "aclk_msclnp_133", "usermux_aclk_mscl_532", 804 + ENABLE_ACLK_MSCL, 16, 0, 0), 805 + GATE(ACLK_AHB2APB_MSCL0P, "aclk_ahb2apb_mscl0p", 806 + "usermux_aclk_mscl_532", 807 + ENABLE_ACLK_MSCL, 15, 0, 0), 808 + GATE(ACLK_AHB2APB_MSCL1P, "aclk_ahb2apb_mscl1p", 809 + "usermux_aclk_mscl_532", 810 + ENABLE_ACLK_MSCL, 14, 0, 0), 811 + 812 + GATE(PCLK_MSCL_0, "pclk_mscl_0", "dout_pclk_mscl", 813 + ENABLE_PCLK_MSCL, 31, 0, 0), 814 + GATE(PCLK_MSCL_1, "pclk_mscl_1", "dout_pclk_mscl", 815 + ENABLE_PCLK_MSCL, 30, 0, 0), 816 + GATE(PCLK_JPEG, "pclk_jpeg", "dout_pclk_mscl", 817 + ENABLE_PCLK_MSCL, 29, 0, 0), 818 + GATE(PCLK_G2D, "pclk_g2d", "dout_pclk_mscl", 819 + ENABLE_PCLK_MSCL, 28, 0, 0), 820 + GATE(PCLK_QE_MSCL_0, "pclk_qe_mscl_0", "dout_pclk_mscl", 821 + ENABLE_PCLK_MSCL, 27, 0, 0), 822 + GATE(PCLK_QE_MSCL_1, "pclk_qe_mscl_1", "dout_pclk_mscl", 823 + ENABLE_PCLK_MSCL, 26, 0, 0), 824 + GATE(PCLK_QE_JPEG, "pclk_qe_jpeg", "dout_pclk_mscl", 825 + ENABLE_PCLK_MSCL, 25, 0, 0), 826 + GATE(PCLK_QE_G2D, "pclk_qe_g2d", "dout_pclk_mscl", 827 + ENABLE_PCLK_MSCL, 24, 0, 0), 828 + GATE(PCLK_PPMU_MSCL_0, "pclk_ppmu_mscl_0", "dout_pclk_mscl", 829 + ENABLE_PCLK_MSCL, 23, 0, 0), 830 + GATE(PCLK_PPMU_MSCL_1, "pclk_ppmu_mscl_1", "dout_pclk_mscl", 831 + ENABLE_PCLK_MSCL, 22, 0, 0), 832 + GATE(PCLK_AXI2ACEL_BRIDGE, "pclk_axi2acel_bridge", "dout_pclk_mscl", 833 + ENABLE_PCLK_MSCL, 21, 0, 0), 834 + GATE(PCLK_PMU_MSCL, "pclk_pmu_mscl", "dout_pclk_mscl", 835 + ENABLE_PCLK_MSCL, 20, 0, 0), 836 + }; 837 + 838 + static struct samsung_cmu_info mscl_cmu_info __initdata = { 839 + .mux_clks = mscl_mux_clks, 840 + .nr_mux_clks = ARRAY_SIZE(mscl_mux_clks), 841 + .div_clks = mscl_div_clks, 842 + .nr_div_clks = ARRAY_SIZE(mscl_div_clks), 843 + .gate_clks = mscl_gate_clks, 844 + .nr_gate_clks = ARRAY_SIZE(mscl_gate_clks), 845 + .nr_clk_ids = MSCL_NR_CLK, 846 + .clk_regs = mscl_clk_regs, 847 + .nr_clk_regs = ARRAY_SIZE(mscl_clk_regs), 848 + }; 849 + 850 + static void __init exynos7_clk_mscl_init(struct device_node *np) 851 + { 852 + samsung_cmu_register_one(np, &mscl_cmu_info); 853 + } 854 + 855 + CLK_OF_DECLARE(exynos7_clk_mscl, "samsung,exynos7-clock-mscl", 856 + exynos7_clk_mscl_init); 857 + 858 + /* Register Offset definitions for CMU_AUD (0x114C0000) */ 859 + #define MUX_SEL_AUD 0x0200 860 + #define DIV_AUD0 0x0600 861 + #define DIV_AUD1 0x0604 862 + #define ENABLE_ACLK_AUD 0x0800 863 + #define ENABLE_PCLK_AUD 0x0900 864 + #define ENABLE_SCLK_AUD 0x0A00 865 + 866 + /* 867 + * List of parent clocks for Muxes in CMU_AUD 868 + */ 869 + PNAME(mout_aud_pll_user_p) = { "fin_pll", "fout_aud_pll" }; 870 + PNAME(mout_aud_group_p) = { "dout_aud_cdclk", "ioclk_audiocdclk0" }; 871 + 872 + static unsigned long aud_clk_regs[] __initdata = { 873 + MUX_SEL_AUD, 874 + DIV_AUD0, 875 + DIV_AUD1, 876 + ENABLE_ACLK_AUD, 877 + ENABLE_PCLK_AUD, 878 + ENABLE_SCLK_AUD, 879 + }; 880 + 881 + static struct samsung_mux_clock aud_mux_clks[] __initdata = { 882 + MUX(0, "mout_sclk_i2s", mout_aud_group_p, MUX_SEL_AUD, 12, 1), 883 + MUX(0, "mout_sclk_pcm", mout_aud_group_p, MUX_SEL_AUD, 16, 1), 884 + MUX(0, "mout_aud_pll_user", mout_aud_pll_user_p, MUX_SEL_AUD, 20, 1), 885 + }; 886 + 887 + static struct samsung_div_clock aud_div_clks[] __initdata = { 888 + DIV(0, "dout_aud_ca5", "mout_aud_pll_user", DIV_AUD0, 0, 4), 889 + DIV(0, "dout_aclk_aud", "dout_aud_ca5", DIV_AUD0, 4, 4), 890 + DIV(0, "dout_aud_pclk_dbg", "dout_aud_ca5", DIV_AUD0, 8, 4), 891 + 892 + DIV(0, "dout_sclk_i2s", "mout_sclk_i2s", DIV_AUD1, 0, 4), 893 + DIV(0, "dout_sclk_pcm", "mout_sclk_pcm", DIV_AUD1, 4, 8), 894 + DIV(0, "dout_sclk_uart", "dout_aud_cdclk", DIV_AUD1, 12, 4), 895 + DIV(0, "dout_sclk_slimbus", "dout_aud_cdclk", DIV_AUD1, 16, 5), 896 + DIV(0, "dout_aud_cdclk", "mout_aud_pll_user", DIV_AUD1, 24, 4), 897 + }; 898 + 899 + static struct samsung_gate_clock aud_gate_clks[] __initdata = { 900 + GATE(SCLK_PCM, "sclk_pcm", "dout_sclk_pcm", 901 + ENABLE_SCLK_AUD, 27, CLK_SET_RATE_PARENT, 0), 902 + GATE(SCLK_I2S, "sclk_i2s", "dout_sclk_i2s", 903 + ENABLE_SCLK_AUD, 28, CLK_SET_RATE_PARENT, 0), 904 + GATE(0, "sclk_uart", "dout_sclk_uart", ENABLE_SCLK_AUD, 29, 0, 0), 905 + GATE(0, "sclk_slimbus", "dout_sclk_slimbus", 906 + ENABLE_SCLK_AUD, 30, 0, 0), 907 + 908 + GATE(0, "pclk_dbg_aud", "dout_aud_pclk_dbg", ENABLE_PCLK_AUD, 19, 0, 0), 909 + GATE(0, "pclk_gpio_aud", "dout_aclk_aud", ENABLE_PCLK_AUD, 20, 0, 0), 910 + GATE(0, "pclk_wdt1", "dout_aclk_aud", ENABLE_PCLK_AUD, 22, 0, 0), 911 + GATE(0, "pclk_wdt0", "dout_aclk_aud", ENABLE_PCLK_AUD, 23, 0, 0), 912 + GATE(0, "pclk_slimbus", "dout_aclk_aud", ENABLE_PCLK_AUD, 24, 0, 0), 913 + GATE(0, "pclk_uart", "dout_aclk_aud", ENABLE_PCLK_AUD, 25, 0, 0), 914 + GATE(PCLK_PCM, "pclk_pcm", "dout_aclk_aud", 915 + ENABLE_PCLK_AUD, 26, CLK_SET_RATE_PARENT, 0), 916 + GATE(PCLK_I2S, "pclk_i2s", "dout_aclk_aud", 917 + ENABLE_PCLK_AUD, 27, CLK_SET_RATE_PARENT, 0), 918 + GATE(0, "pclk_timer", "dout_aclk_aud", ENABLE_PCLK_AUD, 28, 0, 0), 919 + GATE(0, "pclk_smmu_aud", "dout_aclk_aud", ENABLE_PCLK_AUD, 31, 0, 0), 920 + 921 + GATE(0, "aclk_smmu_aud", "dout_aclk_aud", ENABLE_ACLK_AUD, 27, 0, 0), 922 + GATE(0, "aclk_acel_lh_async_si_top", "dout_aclk_aud", 923 + ENABLE_ACLK_AUD, 28, 0, 0), 924 + GATE(ACLK_ADMA, "aclk_dmac", "dout_aclk_aud", ENABLE_ACLK_AUD, 31, 0, 0), 925 + }; 926 + 927 + static struct samsung_cmu_info aud_cmu_info __initdata = { 928 + .mux_clks = aud_mux_clks, 929 + .nr_mux_clks = ARRAY_SIZE(aud_mux_clks), 930 + .div_clks = aud_div_clks, 931 + .nr_div_clks = ARRAY_SIZE(aud_div_clks), 932 + .gate_clks = aud_gate_clks, 933 + .nr_gate_clks = ARRAY_SIZE(aud_gate_clks), 934 + .nr_clk_ids = AUD_NR_CLK, 935 + .clk_regs = aud_clk_regs, 936 + .nr_clk_regs = ARRAY_SIZE(aud_clk_regs), 937 + }; 938 + 939 + static void __init exynos7_clk_aud_init(struct device_node *np) 940 + { 941 + samsung_cmu_register_one(np, &aud_cmu_info); 942 + } 943 + 944 + CLK_OF_DECLARE(exynos7_clk_aud, "samsung,exynos7-clock-aud", 945 + exynos7_clk_aud_init);
+10 -3
drivers/clk/samsung/clk.c
··· 374 374 * Common function which registers plls, muxes, dividers and gates 375 375 * for each CMU. It also add CMU register list to register cache. 376 376 */ 377 - void __init samsung_cmu_register_one(struct device_node *np, 377 + struct samsung_clk_provider * __init samsung_cmu_register_one( 378 + struct device_node *np, 378 379 struct samsung_cmu_info *cmu) 379 380 { 380 381 void __iomem *reg_base; 381 382 struct samsung_clk_provider *ctx; 382 383 383 384 reg_base = of_iomap(np, 0); 384 - if (!reg_base) 385 + if (!reg_base) { 385 386 panic("%s: failed to map registers\n", __func__); 387 + return NULL; 388 + } 386 389 387 390 ctx = samsung_clk_init(np, reg_base, cmu->nr_clk_ids); 388 - if (!ctx) 391 + if (!ctx) { 389 392 panic("%s: unable to alllocate ctx\n", __func__); 393 + return ctx; 394 + } 390 395 391 396 if (cmu->pll_clks) 392 397 samsung_clk_register_pll(ctx, cmu->pll_clks, cmu->nr_pll_clks, ··· 415 410 cmu->nr_clk_regs); 416 411 417 412 samsung_clk_of_add_provider(np, ctx); 413 + 414 + return ctx; 418 415 }
+2 -1
drivers/clk/samsung/clk.h
··· 392 392 struct samsung_pll_clock *pll_list, 393 393 unsigned int nr_clk, void __iomem *base); 394 394 395 - extern void __init samsung_cmu_register_one(struct device_node *, 395 + extern struct samsung_clk_provider __init *samsung_cmu_register_one( 396 + struct device_node *, 396 397 struct samsung_cmu_info *); 397 398 398 399 extern unsigned long _get_rate(const char *clk_name);
+2
drivers/clk/shmobile/Makefile
··· 1 1 obj-$(CONFIG_ARCH_EMEV2) += clk-emev2.o 2 2 obj-$(CONFIG_ARCH_R7S72100) += clk-rz.o 3 + obj-$(CONFIG_ARCH_R8A73A4) += clk-r8a73a4.o 3 4 obj-$(CONFIG_ARCH_R8A7740) += clk-r8a7740.o 4 5 obj-$(CONFIG_ARCH_R8A7779) += clk-r8a7779.o 5 6 obj-$(CONFIG_ARCH_R8A7790) += clk-rcar-gen2.o 6 7 obj-$(CONFIG_ARCH_R8A7791) += clk-rcar-gen2.o 8 + obj-$(CONFIG_ARCH_R8A7793) += clk-rcar-gen2.o 7 9 obj-$(CONFIG_ARCH_R8A7794) += clk-rcar-gen2.o 8 10 obj-$(CONFIG_ARCH_SH73A0) += clk-sh73a0.o 9 11 obj-$(CONFIG_ARCH_SHMOBILE_MULTI) += clk-div6.o
+14 -4
drivers/clk/shmobile/clk-div6.c
··· 54 54 static void cpg_div6_clock_disable(struct clk_hw *hw) 55 55 { 56 56 struct div6_clock *clock = to_div6_clock(hw); 57 + u32 val; 57 58 58 - /* DIV6 clocks require the divisor field to be non-zero when stopping 59 - * the clock. 59 + val = clk_readl(clock->reg); 60 + val |= CPG_DIV6_CKSTP; 61 + /* 62 + * DIV6 clocks require the divisor field to be non-zero when stopping 63 + * the clock. However, some clocks (e.g. ZB on sh73a0) fail to be 64 + * re-enabled later if the divisor field is changed when stopping the 65 + * clock 60 66 */ 61 - clk_writel(clk_readl(clock->reg) | CPG_DIV6_CKSTP | CPG_DIV6_DIV_MASK, 62 - clock->reg); 67 + if (!(val & CPG_DIV6_DIV_MASK)) 68 + val |= CPG_DIV6_DIV_MASK; 69 + clk_writel(val, clock->reg); 63 70 } 64 71 65 72 static int cpg_div6_clock_is_enabled(struct clk_hw *hw) ··· 89 82 unsigned long parent_rate) 90 83 { 91 84 unsigned int div; 85 + 86 + if (!rate) 87 + rate = 1; 92 88 93 89 div = DIV_ROUND_CLOSEST(parent_rate, rate); 94 90 return clamp_t(unsigned int, div, 1, 64);
+241
drivers/clk/shmobile/clk-r8a73a4.c
··· 1 + /* 2 + * r8a73a4 Core CPG Clocks 3 + * 4 + * Copyright (C) 2014 Ulrich Hecht 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License as published by 8 + * the Free Software Foundation; version 2 of the License. 9 + */ 10 + 11 + #include <linux/clk-provider.h> 12 + #include <linux/clkdev.h> 13 + #include <linux/clk/shmobile.h> 14 + #include <linux/init.h> 15 + #include <linux/kernel.h> 16 + #include <linux/of.h> 17 + #include <linux/of_address.h> 18 + #include <linux/spinlock.h> 19 + 20 + struct r8a73a4_cpg { 21 + struct clk_onecell_data data; 22 + spinlock_t lock; 23 + void __iomem *reg; 24 + }; 25 + 26 + #define CPG_CKSCR 0xc0 27 + #define CPG_FRQCRA 0x00 28 + #define CPG_FRQCRB 0x04 29 + #define CPG_FRQCRC 0xe0 30 + #define CPG_PLL0CR 0xd8 31 + #define CPG_PLL1CR 0x28 32 + #define CPG_PLL2CR 0x2c 33 + #define CPG_PLL2HCR 0xe4 34 + #define CPG_PLL2SCR 0xf4 35 + 36 + #define CLK_ENABLE_ON_INIT BIT(0) 37 + 38 + struct div4_clk { 39 + const char *name; 40 + unsigned int reg; 41 + unsigned int shift; 42 + }; 43 + 44 + static struct div4_clk div4_clks[] = { 45 + { "i", CPG_FRQCRA, 20 }, 46 + { "m3", CPG_FRQCRA, 12 }, 47 + { "b", CPG_FRQCRA, 8 }, 48 + { "m1", CPG_FRQCRA, 4 }, 49 + { "m2", CPG_FRQCRA, 0 }, 50 + { "zx", CPG_FRQCRB, 12 }, 51 + { "zs", CPG_FRQCRB, 8 }, 52 + { "hp", CPG_FRQCRB, 4 }, 53 + { NULL, 0, 0 }, 54 + }; 55 + 56 + static const struct clk_div_table div4_div_table[] = { 57 + { 0, 2 }, { 1, 3 }, { 2, 4 }, { 3, 6 }, { 4, 8 }, { 5, 12 }, 58 + { 6, 16 }, { 7, 18 }, { 8, 24 }, { 10, 36 }, { 11, 48 }, 59 + { 12, 10 }, { 0, 0 } 60 + }; 61 + 62 + static struct clk * __init 63 + r8a73a4_cpg_register_clock(struct device_node *np, struct r8a73a4_cpg *cpg, 64 + const char *name) 65 + { 66 + const struct clk_div_table *table = NULL; 67 + const char *parent_name; 68 + unsigned int shift, reg; 69 + unsigned int mult = 1; 70 + unsigned int div = 1; 71 + 72 + 73 + if (!strcmp(name, "main")) { 74 + u32 ckscr = clk_readl(cpg->reg + CPG_CKSCR); 75 + 76 + switch ((ckscr >> 28) & 3) { 77 + case 0: /* extal1 */ 78 + parent_name = of_clk_get_parent_name(np, 0); 79 + break; 80 + case 1: /* extal1 / 2 */ 81 + parent_name = of_clk_get_parent_name(np, 0); 82 + div = 2; 83 + break; 84 + case 2: /* extal2 */ 85 + parent_name = of_clk_get_parent_name(np, 1); 86 + break; 87 + case 3: /* extal2 / 2 */ 88 + parent_name = of_clk_get_parent_name(np, 1); 89 + div = 2; 90 + break; 91 + } 92 + } else if (!strcmp(name, "pll0")) { 93 + /* PLL0/1 are configurable multiplier clocks. Register them as 94 + * fixed factor clocks for now as there's no generic multiplier 95 + * clock implementation and we currently have no need to change 96 + * the multiplier value. 97 + */ 98 + u32 value = clk_readl(cpg->reg + CPG_PLL0CR); 99 + 100 + parent_name = "main"; 101 + mult = ((value >> 24) & 0x7f) + 1; 102 + if (value & BIT(20)) 103 + div = 2; 104 + } else if (!strcmp(name, "pll1")) { 105 + u32 value = clk_readl(cpg->reg + CPG_PLL1CR); 106 + 107 + parent_name = "main"; 108 + /* XXX: enable bit? */ 109 + mult = ((value >> 24) & 0x7f) + 1; 110 + if (value & BIT(7)) 111 + div = 2; 112 + } else if (!strncmp(name, "pll2", 4)) { 113 + u32 value, cr; 114 + 115 + switch (name[4]) { 116 + case 0: 117 + cr = CPG_PLL2CR; 118 + break; 119 + case 's': 120 + cr = CPG_PLL2SCR; 121 + break; 122 + case 'h': 123 + cr = CPG_PLL2HCR; 124 + break; 125 + default: 126 + return ERR_PTR(-EINVAL); 127 + } 128 + value = clk_readl(cpg->reg + cr); 129 + switch ((value >> 5) & 7) { 130 + case 0: 131 + parent_name = "main"; 132 + div = 2; 133 + break; 134 + case 1: 135 + parent_name = "extal2"; 136 + div = 2; 137 + break; 138 + case 3: 139 + parent_name = "extal2"; 140 + div = 4; 141 + break; 142 + case 4: 143 + parent_name = "main"; 144 + break; 145 + case 5: 146 + parent_name = "extal2"; 147 + break; 148 + default: 149 + pr_warn("%s: unexpected parent of %s\n", __func__, 150 + name); 151 + return ERR_PTR(-EINVAL); 152 + } 153 + /* XXX: enable bit? */ 154 + mult = ((value >> 24) & 0x7f) + 1; 155 + } else if (!strcmp(name, "z") || !strcmp(name, "z2")) { 156 + u32 shift = 8; 157 + 158 + parent_name = "pll0"; 159 + if (name[1] == '2') { 160 + div = 2; 161 + shift = 0; 162 + } 163 + div *= 32; 164 + mult = 0x20 - ((clk_readl(cpg->reg + CPG_FRQCRC) >> shift) 165 + & 0x1f); 166 + } else { 167 + struct div4_clk *c; 168 + 169 + for (c = div4_clks; c->name; c++) { 170 + if (!strcmp(name, c->name)) 171 + break; 172 + } 173 + if (!c->name) 174 + return ERR_PTR(-EINVAL); 175 + 176 + parent_name = "pll1"; 177 + table = div4_div_table; 178 + reg = c->reg; 179 + shift = c->shift; 180 + } 181 + 182 + if (!table) { 183 + return clk_register_fixed_factor(NULL, name, parent_name, 0, 184 + mult, div); 185 + } else { 186 + return clk_register_divider_table(NULL, name, parent_name, 0, 187 + cpg->reg + reg, shift, 4, 0, 188 + table, &cpg->lock); 189 + } 190 + } 191 + 192 + static void __init r8a73a4_cpg_clocks_init(struct device_node *np) 193 + { 194 + struct r8a73a4_cpg *cpg; 195 + struct clk **clks; 196 + unsigned int i; 197 + int num_clks; 198 + 199 + num_clks = of_property_count_strings(np, "clock-output-names"); 200 + if (num_clks < 0) { 201 + pr_err("%s: failed to count clocks\n", __func__); 202 + return; 203 + } 204 + 205 + cpg = kzalloc(sizeof(*cpg), GFP_KERNEL); 206 + clks = kcalloc(num_clks, sizeof(*clks), GFP_KERNEL); 207 + if (cpg == NULL || clks == NULL) { 208 + /* We're leaking memory on purpose, there's no point in cleaning 209 + * up as the system won't boot anyway. 210 + */ 211 + return; 212 + } 213 + 214 + spin_lock_init(&cpg->lock); 215 + 216 + cpg->data.clks = clks; 217 + cpg->data.clk_num = num_clks; 218 + 219 + cpg->reg = of_iomap(np, 0); 220 + if (WARN_ON(cpg->reg == NULL)) 221 + return; 222 + 223 + for (i = 0; i < num_clks; ++i) { 224 + const char *name; 225 + struct clk *clk; 226 + 227 + of_property_read_string_index(np, "clock-output-names", i, 228 + &name); 229 + 230 + clk = r8a73a4_cpg_register_clock(np, cpg, name); 231 + if (IS_ERR(clk)) 232 + pr_err("%s: failed to register %s %s clock (%ld)\n", 233 + __func__, np->name, name, PTR_ERR(clk)); 234 + else 235 + cpg->data.clks[i] = clk; 236 + } 237 + 238 + of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data); 239 + } 240 + CLK_OF_DECLARE(r8a73a4_cpg_clks, "renesas,r8a73a4-cpg-clocks", 241 + r8a73a4_cpg_clocks_init);
+88
drivers/clk/shmobile/clk-rcar-gen2.c
··· 33 33 #define CPG_FRQCRC 0x000000e0 34 34 #define CPG_FRQCRC_ZFC_MASK (0x1f << 8) 35 35 #define CPG_FRQCRC_ZFC_SHIFT 8 36 + #define CPG_ADSPCKCR 0x0000025c 37 + #define CPG_RCANCKCR 0x00000270 36 38 37 39 /* ----------------------------------------------------------------------------- 38 40 * Z Clock ··· 163 161 return clk; 164 162 } 165 163 164 + static struct clk * __init cpg_rcan_clk_register(struct rcar_gen2_cpg *cpg, 165 + struct device_node *np) 166 + { 167 + const char *parent_name = of_clk_get_parent_name(np, 1); 168 + struct clk_fixed_factor *fixed; 169 + struct clk_gate *gate; 170 + struct clk *clk; 171 + 172 + fixed = kzalloc(sizeof(*fixed), GFP_KERNEL); 173 + if (!fixed) 174 + return ERR_PTR(-ENOMEM); 175 + 176 + fixed->mult = 1; 177 + fixed->div = 6; 178 + 179 + gate = kzalloc(sizeof(*gate), GFP_KERNEL); 180 + if (!gate) { 181 + kfree(fixed); 182 + return ERR_PTR(-ENOMEM); 183 + } 184 + 185 + gate->reg = cpg->reg + CPG_RCANCKCR; 186 + gate->bit_idx = 8; 187 + gate->flags = CLK_GATE_SET_TO_DISABLE; 188 + gate->lock = &cpg->lock; 189 + 190 + clk = clk_register_composite(NULL, "rcan", &parent_name, 1, NULL, NULL, 191 + &fixed->hw, &clk_fixed_factor_ops, 192 + &gate->hw, &clk_gate_ops, 0); 193 + if (IS_ERR(clk)) { 194 + kfree(gate); 195 + kfree(fixed); 196 + } 197 + 198 + return clk; 199 + } 200 + 201 + /* ADSP divisors */ 202 + static const struct clk_div_table cpg_adsp_div_table[] = { 203 + { 1, 3 }, { 2, 4 }, { 3, 6 }, { 4, 8 }, 204 + { 5, 12 }, { 6, 16 }, { 7, 18 }, { 8, 24 }, 205 + { 10, 36 }, { 11, 48 }, { 0, 0 }, 206 + }; 207 + 208 + static struct clk * __init cpg_adsp_clk_register(struct rcar_gen2_cpg *cpg) 209 + { 210 + const char *parent_name = "pll1"; 211 + struct clk_divider *div; 212 + struct clk_gate *gate; 213 + struct clk *clk; 214 + 215 + div = kzalloc(sizeof(*div), GFP_KERNEL); 216 + if (!div) 217 + return ERR_PTR(-ENOMEM); 218 + 219 + div->reg = cpg->reg + CPG_ADSPCKCR; 220 + div->width = 4; 221 + div->table = cpg_adsp_div_table; 222 + div->lock = &cpg->lock; 223 + 224 + gate = kzalloc(sizeof(*gate), GFP_KERNEL); 225 + if (!gate) { 226 + kfree(div); 227 + return ERR_PTR(-ENOMEM); 228 + } 229 + 230 + gate->reg = cpg->reg + CPG_ADSPCKCR; 231 + gate->bit_idx = 8; 232 + gate->flags = CLK_GATE_SET_TO_DISABLE; 233 + gate->lock = &cpg->lock; 234 + 235 + clk = clk_register_composite(NULL, "adsp", &parent_name, 1, NULL, NULL, 236 + &div->hw, &clk_divider_ops, 237 + &gate->hw, &clk_gate_ops, 0); 238 + if (IS_ERR(clk)) { 239 + kfree(gate); 240 + kfree(div); 241 + } 242 + 243 + return clk; 244 + } 245 + 166 246 /* ----------------------------------------------------------------------------- 167 247 * CPG Clock Data 168 248 */ ··· 347 263 shift = 0; 348 264 } else if (!strcmp(name, "z")) { 349 265 return cpg_z_clk_register(cpg); 266 + } else if (!strcmp(name, "rcan")) { 267 + return cpg_rcan_clk_register(cpg, np); 268 + } else if (!strcmp(name, "adsp")) { 269 + return cpg_adsp_clk_register(cpg); 350 270 } else { 351 271 return ERR_PTR(-EINVAL); 352 272 }
+25 -14
drivers/clk/st/clk-flexgen.c
··· 37 37 struct clk_hw *pgate_hw = &flexgen->pgate.hw; 38 38 struct clk_hw *fgate_hw = &flexgen->fgate.hw; 39 39 40 - pgate_hw->clk = hw->clk; 41 - fgate_hw->clk = hw->clk; 40 + __clk_hw_set_clk(pgate_hw, hw); 41 + __clk_hw_set_clk(fgate_hw, hw); 42 42 43 43 clk_gate_ops.enable(pgate_hw); 44 44 ··· 54 54 struct clk_hw *fgate_hw = &flexgen->fgate.hw; 55 55 56 56 /* disable only the final gate */ 57 - fgate_hw->clk = hw->clk; 57 + __clk_hw_set_clk(fgate_hw, hw); 58 58 59 59 clk_gate_ops.disable(fgate_hw); 60 60 ··· 66 66 struct flexgen *flexgen = to_flexgen(hw); 67 67 struct clk_hw *fgate_hw = &flexgen->fgate.hw; 68 68 69 - fgate_hw->clk = hw->clk; 69 + __clk_hw_set_clk(fgate_hw, hw); 70 70 71 71 if (!clk_gate_ops.is_enabled(fgate_hw)) 72 72 return 0; ··· 79 79 struct flexgen *flexgen = to_flexgen(hw); 80 80 struct clk_hw *mux_hw = &flexgen->mux.hw; 81 81 82 - mux_hw->clk = hw->clk; 82 + __clk_hw_set_clk(mux_hw, hw); 83 83 84 84 return clk_mux_ops.get_parent(mux_hw); 85 85 } ··· 89 89 struct flexgen *flexgen = to_flexgen(hw); 90 90 struct clk_hw *mux_hw = &flexgen->mux.hw; 91 91 92 - mux_hw->clk = hw->clk; 92 + __clk_hw_set_clk(mux_hw, hw); 93 93 94 94 return clk_mux_ops.set_parent(mux_hw, index); 95 95 } ··· 124 124 struct clk_hw *fdiv_hw = &flexgen->fdiv.hw; 125 125 unsigned long mid_rate; 126 126 127 - pdiv_hw->clk = hw->clk; 128 - fdiv_hw->clk = hw->clk; 127 + __clk_hw_set_clk(pdiv_hw, hw); 128 + __clk_hw_set_clk(fdiv_hw, hw); 129 129 130 130 mid_rate = clk_divider_ops.recalc_rate(pdiv_hw, parent_rate); 131 131 ··· 138 138 struct flexgen *flexgen = to_flexgen(hw); 139 139 struct clk_hw *pdiv_hw = &flexgen->pdiv.hw; 140 140 struct clk_hw *fdiv_hw = &flexgen->fdiv.hw; 141 - unsigned long primary_div = 0; 141 + unsigned long div = 0; 142 142 int ret = 0; 143 143 144 - pdiv_hw->clk = hw->clk; 145 - fdiv_hw->clk = hw->clk; 144 + __clk_hw_set_clk(pdiv_hw, hw); 145 + __clk_hw_set_clk(fdiv_hw, hw); 146 146 147 - primary_div = clk_best_div(parent_rate, rate); 147 + div = clk_best_div(parent_rate, rate); 148 148 149 - clk_divider_ops.set_rate(fdiv_hw, parent_rate, parent_rate); 150 - ret = clk_divider_ops.set_rate(pdiv_hw, rate, rate * primary_div); 149 + /* 150 + * pdiv is mainly targeted for low freq results, while fdiv 151 + * should be used for div <= 64. The other way round can 152 + * lead to 'duty cycle' issues. 153 + */ 154 + 155 + if (div <= 64) { 156 + clk_divider_ops.set_rate(pdiv_hw, parent_rate, parent_rate); 157 + ret = clk_divider_ops.set_rate(fdiv_hw, rate, rate * div); 158 + } else { 159 + clk_divider_ops.set_rate(fdiv_hw, parent_rate, parent_rate); 160 + ret = clk_divider_ops.set_rate(pdiv_hw, rate, rate * div); 161 + } 151 162 152 163 return ret; 153 164 }
+7 -7
drivers/clk/st/clkgen-mux.c
··· 94 94 unsigned long timeout; 95 95 int ret = 0; 96 96 97 - mux_hw->clk = hw->clk; 97 + __clk_hw_set_clk(mux_hw, hw); 98 98 99 99 ret = clk_mux_ops.set_parent(mux_hw, genamux->muxsel); 100 100 if (ret) ··· 116 116 struct clkgena_divmux *genamux = to_clkgena_divmux(hw); 117 117 struct clk_hw *mux_hw = &genamux->mux.hw; 118 118 119 - mux_hw->clk = hw->clk; 119 + __clk_hw_set_clk(mux_hw, hw); 120 120 121 121 clk_mux_ops.set_parent(mux_hw, CKGAX_CLKOPSRC_SWITCH_OFF); 122 122 } ··· 126 126 struct clkgena_divmux *genamux = to_clkgena_divmux(hw); 127 127 struct clk_hw *mux_hw = &genamux->mux.hw; 128 128 129 - mux_hw->clk = hw->clk; 129 + __clk_hw_set_clk(mux_hw, hw); 130 130 131 131 return (s8)clk_mux_ops.get_parent(mux_hw) > 0; 132 132 } ··· 136 136 struct clkgena_divmux *genamux = to_clkgena_divmux(hw); 137 137 struct clk_hw *mux_hw = &genamux->mux.hw; 138 138 139 - mux_hw->clk = hw->clk; 139 + __clk_hw_set_clk(mux_hw, hw); 140 140 141 141 genamux->muxsel = clk_mux_ops.get_parent(mux_hw); 142 142 if ((s8)genamux->muxsel < 0) { ··· 174 174 struct clkgena_divmux *genamux = to_clkgena_divmux(hw); 175 175 struct clk_hw *div_hw = &genamux->div[genamux->muxsel].hw; 176 176 177 - div_hw->clk = hw->clk; 177 + __clk_hw_set_clk(div_hw, hw); 178 178 179 179 return clk_divider_ops.recalc_rate(div_hw, parent_rate); 180 180 } ··· 185 185 struct clkgena_divmux *genamux = to_clkgena_divmux(hw); 186 186 struct clk_hw *div_hw = &genamux->div[genamux->muxsel].hw; 187 187 188 - div_hw->clk = hw->clk; 188 + __clk_hw_set_clk(div_hw, hw); 189 189 190 190 return clk_divider_ops.set_rate(div_hw, rate, parent_rate); 191 191 } ··· 196 196 struct clkgena_divmux *genamux = to_clkgena_divmux(hw); 197 197 struct clk_hw *div_hw = &genamux->div[genamux->muxsel].hw; 198 198 199 - div_hw->clk = hw->clk; 199 + __clk_hw_set_clk(div_hw, hw); 200 200 201 201 return clk_divider_ops.round_rate(div_hw, rate, prate); 202 202 }
+1
drivers/clk/sunxi/Makefile
··· 8 8 obj-y += clk-mod0.o 9 9 obj-y += clk-sun8i-mbus.o 10 10 obj-y += clk-sun9i-core.o 11 + obj-y += clk-sun9i-mmc.o 11 12 12 13 obj-$(CONFIG_MFD_SUN6I_PRCM) += \ 13 14 clk-sun6i-ar100.o clk-sun6i-apb0.o clk-sun6i-apb0-gates.o \
+6 -6
drivers/clk/sunxi/clk-factors.c
··· 80 80 } 81 81 82 82 static long clk_factors_determine_rate(struct clk_hw *hw, unsigned long rate, 83 + unsigned long min_rate, 84 + unsigned long max_rate, 83 85 unsigned long *best_parent_rate, 84 86 struct clk_hw **best_parent_p) 85 87 { ··· 158 156 .set_rate = clk_factors_set_rate, 159 157 }; 160 158 161 - struct clk * __init sunxi_factors_register(struct device_node *node, 162 - const struct factors_data *data, 163 - spinlock_t *lock) 159 + struct clk *sunxi_factors_register(struct device_node *node, 160 + const struct factors_data *data, 161 + spinlock_t *lock, 162 + void __iomem *reg) 164 163 { 165 164 struct clk *clk; 166 165 struct clk_factors *factors; ··· 171 168 struct clk_hw *mux_hw = NULL; 172 169 const char *clk_name = node->name; 173 170 const char *parents[FACTORS_MAX_PARENTS]; 174 - void __iomem *reg; 175 171 int i = 0; 176 - 177 - reg = of_iomap(node, 0); 178 172 179 173 /* if we have a mux, we will have >1 parents */ 180 174 while (i < FACTORS_MAX_PARENTS &&
+4 -3
drivers/clk/sunxi/clk-factors.h
··· 36 36 spinlock_t *lock; 37 37 }; 38 38 39 - struct clk * __init sunxi_factors_register(struct device_node *node, 40 - const struct factors_data *data, 41 - spinlock_t *lock); 39 + struct clk *sunxi_factors_register(struct device_node *node, 40 + const struct factors_data *data, 41 + spinlock_t *lock, 42 + void __iomem *reg); 42 43 43 44 #endif
+161 -53
drivers/clk/sunxi/clk-mod0.c
··· 17 17 #include <linux/clk-provider.h> 18 18 #include <linux/clkdev.h> 19 19 #include <linux/of_address.h> 20 + #include <linux/platform_device.h> 20 21 21 22 #include "clk-factors.h" 22 23 ··· 68 67 .pwidth = 2, 69 68 }; 70 69 71 - static const struct factors_data sun4i_a10_mod0_data __initconst = { 70 + static const struct factors_data sun4i_a10_mod0_data = { 72 71 .enable = 31, 73 72 .mux = 24, 74 73 .muxmask = BIT(1) | BIT(0), ··· 80 79 81 80 static void __init sun4i_a10_mod0_setup(struct device_node *node) 82 81 { 83 - sunxi_factors_register(node, &sun4i_a10_mod0_data, &sun4i_a10_mod0_lock); 82 + void __iomem *reg; 83 + 84 + reg = of_iomap(node, 0); 85 + if (!reg) { 86 + /* 87 + * This happens with mod0 clk nodes instantiated through 88 + * mfd, as those do not have their resources assigned at 89 + * CLK_OF_DECLARE time yet, so do not print an error. 90 + */ 91 + return; 92 + } 93 + 94 + sunxi_factors_register(node, &sun4i_a10_mod0_data, 95 + &sun4i_a10_mod0_lock, reg); 84 96 } 85 97 CLK_OF_DECLARE(sun4i_a10_mod0, "allwinner,sun4i-a10-mod0-clk", sun4i_a10_mod0_setup); 98 + 99 + static int sun4i_a10_mod0_clk_probe(struct platform_device *pdev) 100 + { 101 + struct device_node *np = pdev->dev.of_node; 102 + struct resource *r; 103 + void __iomem *reg; 104 + 105 + if (!np) 106 + return -ENODEV; 107 + 108 + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 109 + reg = devm_ioremap_resource(&pdev->dev, r); 110 + if (IS_ERR(reg)) 111 + return PTR_ERR(reg); 112 + 113 + sunxi_factors_register(np, &sun4i_a10_mod0_data, 114 + &sun4i_a10_mod0_lock, reg); 115 + return 0; 116 + } 117 + 118 + static const struct of_device_id sun4i_a10_mod0_clk_dt_ids[] = { 119 + { .compatible = "allwinner,sun4i-a10-mod0-clk" }, 120 + { /* sentinel */ } 121 + }; 122 + 123 + static struct platform_driver sun4i_a10_mod0_clk_driver = { 124 + .driver = { 125 + .name = "sun4i-a10-mod0-clk", 126 + .of_match_table = sun4i_a10_mod0_clk_dt_ids, 127 + }, 128 + .probe = sun4i_a10_mod0_clk_probe, 129 + }; 130 + module_platform_driver(sun4i_a10_mod0_clk_driver); 131 + 132 + static const struct factors_data sun9i_a80_mod0_data __initconst = { 133 + .enable = 31, 134 + .mux = 24, 135 + .muxmask = BIT(3) | BIT(2) | BIT(1) | BIT(0), 136 + .table = &sun4i_a10_mod0_config, 137 + .getter = sun4i_a10_get_mod0_factors, 138 + }; 139 + 140 + static void __init sun9i_a80_mod0_setup(struct device_node *node) 141 + { 142 + void __iomem *reg; 143 + 144 + reg = of_io_request_and_map(node, 0, of_node_full_name(node)); 145 + if (IS_ERR(reg)) { 146 + pr_err("Could not get registers for mod0-clk: %s\n", 147 + node->name); 148 + return; 149 + } 150 + 151 + sunxi_factors_register(node, &sun9i_a80_mod0_data, 152 + &sun4i_a10_mod0_lock, reg); 153 + } 154 + CLK_OF_DECLARE(sun9i_a80_mod0, "allwinner,sun9i-a80-mod0-clk", sun9i_a80_mod0_setup); 86 155 87 156 static DEFINE_SPINLOCK(sun5i_a13_mbus_lock); 88 157 89 158 static void __init sun5i_a13_mbus_setup(struct device_node *node) 90 159 { 91 - struct clk *mbus = sunxi_factors_register(node, &sun4i_a10_mod0_data, &sun5i_a13_mbus_lock); 160 + struct clk *mbus; 161 + void __iomem *reg; 162 + 163 + reg = of_iomap(node, 0); 164 + if (!reg) { 165 + pr_err("Could not get registers for a13-mbus-clk\n"); 166 + return; 167 + } 168 + 169 + mbus = sunxi_factors_register(node, &sun4i_a10_mod0_data, 170 + &sun5i_a13_mbus_lock, reg); 92 171 93 172 /* The MBUS clocks needs to be always enabled */ 94 173 __clk_get(mbus); ··· 176 95 } 177 96 CLK_OF_DECLARE(sun5i_a13_mbus, "allwinner,sun5i-a13-mbus-clk", sun5i_a13_mbus_setup); 178 97 179 - struct mmc_phase_data { 180 - u8 offset; 181 - }; 182 - 183 98 struct mmc_phase { 184 99 struct clk_hw hw; 100 + u8 offset; 185 101 void __iomem *reg; 186 - struct mmc_phase_data *data; 187 102 spinlock_t *lock; 188 103 }; 189 104 ··· 195 118 u8 delay; 196 119 197 120 value = readl(phase->reg); 198 - delay = (value >> phase->data->offset) & 0x3; 121 + delay = (value >> phase->offset) & 0x3; 199 122 200 123 if (!delay) 201 124 return 180; ··· 283 206 284 207 spin_lock_irqsave(phase->lock, flags); 285 208 value = readl(phase->reg); 286 - value &= ~GENMASK(phase->data->offset + 3, phase->data->offset); 287 - value |= delay << phase->data->offset; 209 + value &= ~GENMASK(phase->offset + 3, phase->offset); 210 + value |= delay << phase->offset; 288 211 writel(value, phase->reg); 289 212 spin_unlock_irqrestore(phase->lock, flags); 290 213 ··· 296 219 .set_phase = mmc_set_phase, 297 220 }; 298 221 299 - static void __init sun4i_a10_mmc_phase_setup(struct device_node *node, 300 - struct mmc_phase_data *data) 222 + /* 223 + * sunxi_mmc_setup - Common setup function for mmc module clocks 224 + * 225 + * The only difference between module clocks on different platforms is the 226 + * width of the mux register bits and the valid values, which are passed in 227 + * through struct factors_data. The phase clocks parts are identical. 228 + */ 229 + static void __init sunxi_mmc_setup(struct device_node *node, 230 + const struct factors_data *data, 231 + spinlock_t *lock) 301 232 { 302 - const char *parent_names[1] = { of_clk_get_parent_name(node, 0) }; 303 - struct clk_init_data init = { 304 - .num_parents = 1, 305 - .parent_names = parent_names, 306 - .ops = &mmc_clk_ops, 307 - }; 233 + struct clk_onecell_data *clk_data; 234 + const char *parent; 235 + void __iomem *reg; 236 + int i; 308 237 309 - struct mmc_phase *phase; 310 - struct clk *clk; 238 + reg = of_io_request_and_map(node, 0, of_node_full_name(node)); 239 + if (IS_ERR(reg)) { 240 + pr_err("Couldn't map the %s clock registers\n", node->name); 241 + return; 242 + } 311 243 312 - phase = kmalloc(sizeof(*phase), GFP_KERNEL); 313 - if (!phase) 244 + clk_data = kmalloc(sizeof(*clk_data), GFP_KERNEL); 245 + if (!clk_data) 314 246 return; 315 247 316 - phase->hw.init = &init; 248 + clk_data->clks = kcalloc(3, sizeof(*clk_data->clks), GFP_KERNEL); 249 + if (!clk_data->clks) 250 + goto err_free_data; 317 251 318 - phase->reg = of_iomap(node, 0); 319 - if (!phase->reg) 320 - goto err_free; 252 + clk_data->clk_num = 3; 253 + clk_data->clks[0] = sunxi_factors_register(node, data, lock, reg); 254 + if (!clk_data->clks[0]) 255 + goto err_free_clks; 321 256 322 - phase->data = data; 323 - phase->lock = &sun4i_a10_mod0_lock; 257 + parent = __clk_get_name(clk_data->clks[0]); 324 258 325 - if (of_property_read_string(node, "clock-output-names", &init.name)) 326 - init.name = node->name; 259 + for (i = 1; i < 3; i++) { 260 + struct clk_init_data init = { 261 + .num_parents = 1, 262 + .parent_names = &parent, 263 + .ops = &mmc_clk_ops, 264 + }; 265 + struct mmc_phase *phase; 327 266 328 - clk = clk_register(NULL, &phase->hw); 329 - if (IS_ERR(clk)) 330 - goto err_unmap; 267 + phase = kmalloc(sizeof(*phase), GFP_KERNEL); 268 + if (!phase) 269 + continue; 331 270 332 - of_clk_add_provider(node, of_clk_src_simple_get, clk); 271 + phase->hw.init = &init; 272 + phase->reg = reg; 273 + phase->lock = lock; 274 + 275 + if (i == 1) 276 + phase->offset = 8; 277 + else 278 + phase->offset = 20; 279 + 280 + if (of_property_read_string_index(node, "clock-output-names", 281 + i, &init.name)) 282 + init.name = node->name; 283 + 284 + clk_data->clks[i] = clk_register(NULL, &phase->hw); 285 + if (IS_ERR(clk_data->clks[i])) { 286 + kfree(phase); 287 + continue; 288 + } 289 + } 290 + 291 + of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); 333 292 334 293 return; 335 294 336 - err_unmap: 337 - iounmap(phase->reg); 338 - err_free: 339 - kfree(phase); 295 + err_free_clks: 296 + kfree(clk_data->clks); 297 + err_free_data: 298 + kfree(clk_data); 340 299 } 341 300 301 + static DEFINE_SPINLOCK(sun4i_a10_mmc_lock); 342 302 343 - static struct mmc_phase_data mmc_output_clk = { 344 - .offset = 8, 345 - }; 346 - 347 - static struct mmc_phase_data mmc_sample_clk = { 348 - .offset = 20, 349 - }; 350 - 351 - static void __init sun4i_a10_mmc_output_setup(struct device_node *node) 303 + static void __init sun4i_a10_mmc_setup(struct device_node *node) 352 304 { 353 - sun4i_a10_mmc_phase_setup(node, &mmc_output_clk); 305 + sunxi_mmc_setup(node, &sun4i_a10_mod0_data, &sun4i_a10_mmc_lock); 354 306 } 355 - CLK_OF_DECLARE(sun4i_a10_mmc_output, "allwinner,sun4i-a10-mmc-output-clk", sun4i_a10_mmc_output_setup); 307 + CLK_OF_DECLARE(sun4i_a10_mmc, "allwinner,sun4i-a10-mmc-clk", sun4i_a10_mmc_setup); 356 308 357 - static void __init sun4i_a10_mmc_sample_setup(struct device_node *node) 309 + static DEFINE_SPINLOCK(sun9i_a80_mmc_lock); 310 + 311 + static void __init sun9i_a80_mmc_setup(struct device_node *node) 358 312 { 359 - sun4i_a10_mmc_phase_setup(node, &mmc_sample_clk); 313 + sunxi_mmc_setup(node, &sun9i_a80_mod0_data, &sun9i_a80_mmc_lock); 360 314 } 361 - CLK_OF_DECLARE(sun4i_a10_mmc_sample, "allwinner,sun4i-a10-mmc-sample-clk", sun4i_a10_mmc_sample_setup); 315 + CLK_OF_DECLARE(sun9i_a80_mmc, "allwinner,sun9i-a80-mmc-clk", sun9i_a80_mmc_setup);
+2
drivers/clk/sunxi/clk-sun6i-ar100.c
··· 45 45 } 46 46 47 47 static long ar100_determine_rate(struct clk_hw *hw, unsigned long rate, 48 + unsigned long min_rate, 49 + unsigned long max_rate, 48 50 unsigned long *best_parent_rate, 49 51 struct clk_hw **best_parent_clk) 50 52 {
+11 -2
drivers/clk/sunxi/clk-sun8i-mbus.c
··· 69 69 70 70 static void __init sun8i_a23_mbus_setup(struct device_node *node) 71 71 { 72 - struct clk *mbus = sunxi_factors_register(node, &sun8i_a23_mbus_data, 73 - &sun8i_a23_mbus_lock); 72 + struct clk *mbus; 73 + void __iomem *reg; 74 + 75 + reg = of_iomap(node, 0); 76 + if (!reg) { 77 + pr_err("Could not get registers for a23-mbus-clk\n"); 78 + return; 79 + } 80 + 81 + mbus = sunxi_factors_register(node, &sun8i_a23_mbus_data, 82 + &sun8i_a23_mbus_lock, reg); 74 83 75 84 /* The MBUS clocks needs to be always enabled */ 76 85 __clk_get(mbus);
+85 -34
drivers/clk/sunxi/clk-sun9i-core.c
··· 24 24 25 25 26 26 /** 27 - * sun9i_a80_get_pll4_factors() - calculates n, p, m factors for PLL1 27 + * sun9i_a80_get_pll4_factors() - calculates n, p, m factors for PLL4 28 28 * PLL4 rate is calculated as follows 29 29 * rate = (parent_rate * n >> p) / (m + 1); 30 - * parent_rate is always 24Mhz 30 + * parent_rate is always 24MHz 31 31 * 32 32 * p and m are named div1 and div2 in Allwinner's SDK 33 33 */ 34 34 35 35 static void sun9i_a80_get_pll4_factors(u32 *freq, u32 parent_rate, 36 - u8 *n, u8 *k, u8 *m, u8 *p) 36 + u8 *n_ret, u8 *k, u8 *m_ret, u8 *p_ret) 37 37 { 38 - int div; 38 + int n; 39 + int m = 1; 40 + int p = 1; 39 41 40 - /* Normalize value to a 6M multiple */ 41 - div = DIV_ROUND_UP(*freq, 6000000); 42 + /* Normalize value to a 6 MHz multiple (24 MHz / 4) */ 43 + n = DIV_ROUND_UP(*freq, 6000000); 42 44 43 - /* divs above 256 cannot be odd */ 44 - if (div > 256) 45 - div = round_up(div, 2); 45 + /* If n is too large switch to steps of 12 MHz */ 46 + if (n > 255) { 47 + m = 0; 48 + n = (n + 1) / 2; 49 + } 46 50 47 - /* divs above 512 must be a multiple of 4 */ 48 - if (div > 512) 49 - div = round_up(div, 4); 51 + /* If n is still too large switch to steps of 24 MHz */ 52 + if (n > 255) { 53 + p = 0; 54 + n = (n + 1) / 2; 55 + } 50 56 51 - *freq = 6000000 * div; 57 + /* n must be between 12 and 255 */ 58 + if (n > 255) 59 + n = 255; 60 + else if (n < 12) 61 + n = 12; 62 + 63 + *freq = ((24000000 * n) >> p) / (m + 1); 52 64 53 65 /* we were called to round the frequency, we can now return */ 54 - if (n == NULL) 66 + if (n_ret == NULL) 55 67 return; 56 68 57 - /* p will be 1 for divs under 512 */ 58 - if (div < 512) 59 - *p = 1; 60 - else 61 - *p = 0; 62 - 63 - /* m will be 1 if div is odd */ 64 - if (div & 1) 65 - *m = 1; 66 - else 67 - *m = 0; 68 - 69 - /* calculate a suitable n based on m and p */ 70 - *n = div / (*p + 1) / (*m + 1); 69 + *n_ret = n; 70 + *m_ret = m; 71 + *p_ret = p; 71 72 } 72 73 73 74 static struct clk_factors_config sun9i_a80_pll4_config = { ··· 90 89 91 90 static void __init sun9i_a80_pll4_setup(struct device_node *node) 92 91 { 93 - sunxi_factors_register(node, &sun9i_a80_pll4_data, &sun9i_a80_pll4_lock); 92 + void __iomem *reg; 93 + 94 + reg = of_io_request_and_map(node, 0, of_node_full_name(node)); 95 + if (!reg) { 96 + pr_err("Could not get registers for a80-pll4-clk: %s\n", 97 + node->name); 98 + return; 99 + } 100 + 101 + sunxi_factors_register(node, &sun9i_a80_pll4_data, 102 + &sun9i_a80_pll4_lock, reg); 94 103 } 95 104 CLK_OF_DECLARE(sun9i_a80_pll4, "allwinner,sun9i-a80-pll4-clk", sun9i_a80_pll4_setup); 96 105 ··· 150 139 151 140 static void __init sun9i_a80_gt_setup(struct device_node *node) 152 141 { 153 - struct clk *gt = sunxi_factors_register(node, &sun9i_a80_gt_data, 154 - &sun9i_a80_gt_lock); 142 + void __iomem *reg; 143 + struct clk *gt; 144 + 145 + reg = of_io_request_and_map(node, 0, of_node_full_name(node)); 146 + if (!reg) { 147 + pr_err("Could not get registers for a80-gt-clk: %s\n", 148 + node->name); 149 + return; 150 + } 151 + 152 + gt = sunxi_factors_register(node, &sun9i_a80_gt_data, 153 + &sun9i_a80_gt_lock, reg); 155 154 156 155 /* The GT bus clock needs to be always enabled */ 157 156 __clk_get(gt); ··· 215 194 216 195 static void __init sun9i_a80_ahb_setup(struct device_node *node) 217 196 { 218 - sunxi_factors_register(node, &sun9i_a80_ahb_data, &sun9i_a80_ahb_lock); 197 + void __iomem *reg; 198 + 199 + reg = of_io_request_and_map(node, 0, of_node_full_name(node)); 200 + if (!reg) { 201 + pr_err("Could not get registers for a80-ahb-clk: %s\n", 202 + node->name); 203 + return; 204 + } 205 + 206 + sunxi_factors_register(node, &sun9i_a80_ahb_data, 207 + &sun9i_a80_ahb_lock, reg); 219 208 } 220 209 CLK_OF_DECLARE(sun9i_a80_ahb, "allwinner,sun9i-a80-ahb-clk", sun9i_a80_ahb_setup); 221 210 ··· 241 210 242 211 static void __init sun9i_a80_apb0_setup(struct device_node *node) 243 212 { 244 - sunxi_factors_register(node, &sun9i_a80_apb0_data, &sun9i_a80_apb0_lock); 213 + void __iomem *reg; 214 + 215 + reg = of_io_request_and_map(node, 0, of_node_full_name(node)); 216 + if (!reg) { 217 + pr_err("Could not get registers for a80-apb0-clk: %s\n", 218 + node->name); 219 + return; 220 + } 221 + 222 + sunxi_factors_register(node, &sun9i_a80_apb0_data, 223 + &sun9i_a80_apb0_lock, reg); 245 224 } 246 225 CLK_OF_DECLARE(sun9i_a80_apb0, "allwinner,sun9i-a80-apb0-clk", sun9i_a80_apb0_setup); 247 226 ··· 307 266 308 267 static void __init sun9i_a80_apb1_setup(struct device_node *node) 309 268 { 310 - sunxi_factors_register(node, &sun9i_a80_apb1_data, &sun9i_a80_apb1_lock); 269 + void __iomem *reg; 270 + 271 + reg = of_io_request_and_map(node, 0, of_node_full_name(node)); 272 + if (!reg) { 273 + pr_err("Could not get registers for a80-apb1-clk: %s\n", 274 + node->name); 275 + return; 276 + } 277 + 278 + sunxi_factors_register(node, &sun9i_a80_apb1_data, 279 + &sun9i_a80_apb1_lock, reg); 311 280 } 312 281 CLK_OF_DECLARE(sun9i_a80_apb1, "allwinner,sun9i-a80-apb1-clk", sun9i_a80_apb1_setup);
+219
drivers/clk/sunxi/clk-sun9i-mmc.c
··· 1 + /* 2 + * Copyright 2015 Chen-Yu Tsai 3 + * 4 + * Chen-Yu Tsai <wens@csie.org> 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License as published by 8 + * the Free Software Foundation; either version 2 of the License, or 9 + * (at your option) any later version. 10 + * 11 + * This program is distributed in the hope that it will be useful, 12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + * GNU General Public License for more details. 15 + */ 16 + 17 + #include <linux/clk-provider.h> 18 + #include <linux/clkdev.h> 19 + #include <linux/module.h> 20 + #include <linux/of.h> 21 + #include <linux/of_device.h> 22 + #include <linux/reset.h> 23 + #include <linux/platform_device.h> 24 + #include <linux/reset-controller.h> 25 + #include <linux/spinlock.h> 26 + 27 + #define SUN9I_MMC_WIDTH 4 28 + 29 + #define SUN9I_MMC_GATE_BIT 16 30 + #define SUN9I_MMC_RESET_BIT 18 31 + 32 + struct sun9i_mmc_clk_data { 33 + spinlock_t lock; 34 + void __iomem *membase; 35 + struct clk *clk; 36 + struct reset_control *reset; 37 + struct clk_onecell_data clk_data; 38 + struct reset_controller_dev rcdev; 39 + }; 40 + 41 + static int sun9i_mmc_reset_assert(struct reset_controller_dev *rcdev, 42 + unsigned long id) 43 + { 44 + struct sun9i_mmc_clk_data *data = container_of(rcdev, 45 + struct sun9i_mmc_clk_data, 46 + rcdev); 47 + unsigned long flags; 48 + void __iomem *reg = data->membase + SUN9I_MMC_WIDTH * id; 49 + u32 val; 50 + 51 + clk_prepare_enable(data->clk); 52 + spin_lock_irqsave(&data->lock, flags); 53 + 54 + val = readl(reg); 55 + writel(val & ~BIT(SUN9I_MMC_RESET_BIT), reg); 56 + 57 + spin_unlock_irqrestore(&data->lock, flags); 58 + clk_disable_unprepare(data->clk); 59 + 60 + return 0; 61 + } 62 + 63 + static int sun9i_mmc_reset_deassert(struct reset_controller_dev *rcdev, 64 + unsigned long id) 65 + { 66 + struct sun9i_mmc_clk_data *data = container_of(rcdev, 67 + struct sun9i_mmc_clk_data, 68 + rcdev); 69 + unsigned long flags; 70 + void __iomem *reg = data->membase + SUN9I_MMC_WIDTH * id; 71 + u32 val; 72 + 73 + clk_prepare_enable(data->clk); 74 + spin_lock_irqsave(&data->lock, flags); 75 + 76 + val = readl(reg); 77 + writel(val | BIT(SUN9I_MMC_RESET_BIT), reg); 78 + 79 + spin_unlock_irqrestore(&data->lock, flags); 80 + clk_disable_unprepare(data->clk); 81 + 82 + return 0; 83 + } 84 + 85 + static struct reset_control_ops sun9i_mmc_reset_ops = { 86 + .assert = sun9i_mmc_reset_assert, 87 + .deassert = sun9i_mmc_reset_deassert, 88 + }; 89 + 90 + static int sun9i_a80_mmc_config_clk_probe(struct platform_device *pdev) 91 + { 92 + struct device_node *np = pdev->dev.of_node; 93 + struct sun9i_mmc_clk_data *data; 94 + struct clk_onecell_data *clk_data; 95 + const char *clk_name = np->name; 96 + const char *clk_parent; 97 + struct resource *r; 98 + int count, i, ret; 99 + 100 + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 101 + if (!data) 102 + return -ENOMEM; 103 + 104 + spin_lock_init(&data->lock); 105 + 106 + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 107 + /* one clock/reset pair per word */ 108 + count = DIV_ROUND_UP((r->end - r->start + 1), SUN9I_MMC_WIDTH); 109 + data->membase = devm_ioremap_resource(&pdev->dev, r); 110 + if (IS_ERR(data->membase)) 111 + return PTR_ERR(data->membase); 112 + 113 + clk_data = &data->clk_data; 114 + clk_data->clk_num = count; 115 + clk_data->clks = devm_kcalloc(&pdev->dev, count, sizeof(struct clk *), 116 + GFP_KERNEL); 117 + if (!clk_data->clks) 118 + return -ENOMEM; 119 + 120 + data->clk = devm_clk_get(&pdev->dev, NULL); 121 + if (IS_ERR(data->clk)) { 122 + dev_err(&pdev->dev, "Could not get clock\n"); 123 + return PTR_ERR(data->clk); 124 + } 125 + 126 + data->reset = devm_reset_control_get(&pdev->dev, NULL); 127 + if (IS_ERR(data->reset)) { 128 + dev_err(&pdev->dev, "Could not get reset control\n"); 129 + return PTR_ERR(data->reset); 130 + } 131 + 132 + ret = reset_control_deassert(data->reset); 133 + if (ret) { 134 + dev_err(&pdev->dev, "Reset deassert err %d\n", ret); 135 + return ret; 136 + } 137 + 138 + clk_parent = __clk_get_name(data->clk); 139 + for (i = 0; i < count; i++) { 140 + of_property_read_string_index(np, "clock-output-names", 141 + i, &clk_name); 142 + 143 + clk_data->clks[i] = clk_register_gate(&pdev->dev, clk_name, 144 + clk_parent, 0, 145 + data->membase + SUN9I_MMC_WIDTH * i, 146 + SUN9I_MMC_GATE_BIT, 0, 147 + &data->lock); 148 + 149 + if (IS_ERR(clk_data->clks[i])) { 150 + ret = PTR_ERR(clk_data->clks[i]); 151 + goto err_clk_register; 152 + } 153 + } 154 + 155 + ret = of_clk_add_provider(np, of_clk_src_onecell_get, clk_data); 156 + if (ret) 157 + goto err_clk_provider; 158 + 159 + data->rcdev.owner = THIS_MODULE; 160 + data->rcdev.nr_resets = count; 161 + data->rcdev.ops = &sun9i_mmc_reset_ops; 162 + data->rcdev.of_node = pdev->dev.of_node; 163 + 164 + ret = reset_controller_register(&data->rcdev); 165 + if (ret) 166 + goto err_rc_reg; 167 + 168 + platform_set_drvdata(pdev, data); 169 + 170 + return 0; 171 + 172 + err_rc_reg: 173 + of_clk_del_provider(np); 174 + 175 + err_clk_provider: 176 + for (i = 0; i < count; i++) 177 + clk_unregister(clk_data->clks[i]); 178 + 179 + err_clk_register: 180 + reset_control_assert(data->reset); 181 + 182 + return ret; 183 + } 184 + 185 + static int sun9i_a80_mmc_config_clk_remove(struct platform_device *pdev) 186 + { 187 + struct device_node *np = pdev->dev.of_node; 188 + struct sun9i_mmc_clk_data *data = platform_get_drvdata(pdev); 189 + struct clk_onecell_data *clk_data = &data->clk_data; 190 + int i; 191 + 192 + reset_controller_unregister(&data->rcdev); 193 + of_clk_del_provider(np); 194 + for (i = 0; i < clk_data->clk_num; i++) 195 + clk_unregister(clk_data->clks[i]); 196 + 197 + reset_control_assert(data->reset); 198 + 199 + return 0; 200 + } 201 + 202 + static const struct of_device_id sun9i_a80_mmc_config_clk_dt_ids[] = { 203 + { .compatible = "allwinner,sun9i-a80-mmc-config-clk" }, 204 + { /* sentinel */ } 205 + }; 206 + 207 + static struct platform_driver sun9i_a80_mmc_config_clk_driver = { 208 + .driver = { 209 + .name = "sun9i-a80-mmc-config-clk", 210 + .of_match_table = sun9i_a80_mmc_config_clk_dt_ids, 211 + }, 212 + .probe = sun9i_a80_mmc_config_clk_probe, 213 + .remove = sun9i_a80_mmc_config_clk_remove, 214 + }; 215 + module_platform_driver(sun9i_a80_mmc_config_clk_driver); 216 + 217 + MODULE_AUTHOR("Chen-Yu Tsai <wens@csie.org>"); 218 + MODULE_DESCRIPTION("Allwinner A80 MMC clock/reset Driver"); 219 + MODULE_LICENSE("GPL v2");
+222 -40
drivers/clk/sunxi/clk-sunxi.c
··· 20 20 #include <linux/of_address.h> 21 21 #include <linux/reset-controller.h> 22 22 #include <linux/spinlock.h> 23 + #include <linux/log2.h> 23 24 24 25 #include "clk-factors.h" 25 26 26 27 static DEFINE_SPINLOCK(clk_lock); 28 + 29 + /** 30 + * sun6i_a31_ahb1_clk_setup() - Setup function for a31 ahb1 composite clk 31 + */ 32 + 33 + #define SUN6I_AHB1_MAX_PARENTS 4 34 + #define SUN6I_AHB1_MUX_PARENT_PLL6 3 35 + #define SUN6I_AHB1_MUX_SHIFT 12 36 + /* un-shifted mask is what mux_clk expects */ 37 + #define SUN6I_AHB1_MUX_MASK 0x3 38 + #define SUN6I_AHB1_MUX_GET_PARENT(reg) ((reg >> SUN6I_AHB1_MUX_SHIFT) & \ 39 + SUN6I_AHB1_MUX_MASK) 40 + 41 + #define SUN6I_AHB1_DIV_SHIFT 4 42 + #define SUN6I_AHB1_DIV_MASK (0x3 << SUN6I_AHB1_DIV_SHIFT) 43 + #define SUN6I_AHB1_DIV_GET(reg) ((reg & SUN6I_AHB1_DIV_MASK) >> \ 44 + SUN6I_AHB1_DIV_SHIFT) 45 + #define SUN6I_AHB1_DIV_SET(reg, div) ((reg & ~SUN6I_AHB1_DIV_MASK) | \ 46 + (div << SUN6I_AHB1_DIV_SHIFT)) 47 + #define SUN6I_AHB1_PLL6_DIV_SHIFT 6 48 + #define SUN6I_AHB1_PLL6_DIV_MASK (0x3 << SUN6I_AHB1_PLL6_DIV_SHIFT) 49 + #define SUN6I_AHB1_PLL6_DIV_GET(reg) ((reg & SUN6I_AHB1_PLL6_DIV_MASK) >> \ 50 + SUN6I_AHB1_PLL6_DIV_SHIFT) 51 + #define SUN6I_AHB1_PLL6_DIV_SET(reg, div) ((reg & ~SUN6I_AHB1_PLL6_DIV_MASK) | \ 52 + (div << SUN6I_AHB1_PLL6_DIV_SHIFT)) 53 + 54 + struct sun6i_ahb1_clk { 55 + struct clk_hw hw; 56 + void __iomem *reg; 57 + }; 58 + 59 + #define to_sun6i_ahb1_clk(_hw) container_of(_hw, struct sun6i_ahb1_clk, hw) 60 + 61 + static unsigned long sun6i_ahb1_clk_recalc_rate(struct clk_hw *hw, 62 + unsigned long parent_rate) 63 + { 64 + struct sun6i_ahb1_clk *ahb1 = to_sun6i_ahb1_clk(hw); 65 + unsigned long rate; 66 + u32 reg; 67 + 68 + /* Fetch the register value */ 69 + reg = readl(ahb1->reg); 70 + 71 + /* apply pre-divider first if parent is pll6 */ 72 + if (SUN6I_AHB1_MUX_GET_PARENT(reg) == SUN6I_AHB1_MUX_PARENT_PLL6) 73 + parent_rate /= SUN6I_AHB1_PLL6_DIV_GET(reg) + 1; 74 + 75 + /* clk divider */ 76 + rate = parent_rate >> SUN6I_AHB1_DIV_GET(reg); 77 + 78 + return rate; 79 + } 80 + 81 + static long sun6i_ahb1_clk_round(unsigned long rate, u8 *divp, u8 *pre_divp, 82 + u8 parent, unsigned long parent_rate) 83 + { 84 + u8 div, calcp, calcm = 1; 85 + 86 + /* 87 + * clock can only divide, so we will never be able to achieve 88 + * frequencies higher than the parent frequency 89 + */ 90 + if (parent_rate && rate > parent_rate) 91 + rate = parent_rate; 92 + 93 + div = DIV_ROUND_UP(parent_rate, rate); 94 + 95 + /* calculate pre-divider if parent is pll6 */ 96 + if (parent == SUN6I_AHB1_MUX_PARENT_PLL6) { 97 + if (div < 4) 98 + calcp = 0; 99 + else if (div / 2 < 4) 100 + calcp = 1; 101 + else if (div / 4 < 4) 102 + calcp = 2; 103 + else 104 + calcp = 3; 105 + 106 + calcm = DIV_ROUND_UP(div, 1 << calcp); 107 + } else { 108 + calcp = __roundup_pow_of_two(div); 109 + calcp = calcp > 3 ? 3 : calcp; 110 + } 111 + 112 + /* we were asked to pass back divider values */ 113 + if (divp) { 114 + *divp = calcp; 115 + *pre_divp = calcm - 1; 116 + } 117 + 118 + return (parent_rate / calcm) >> calcp; 119 + } 120 + 121 + static long sun6i_ahb1_clk_determine_rate(struct clk_hw *hw, unsigned long rate, 122 + unsigned long min_rate, 123 + unsigned long max_rate, 124 + unsigned long *best_parent_rate, 125 + struct clk_hw **best_parent_clk) 126 + { 127 + struct clk *clk = hw->clk, *parent, *best_parent = NULL; 128 + int i, num_parents; 129 + unsigned long parent_rate, best = 0, child_rate, best_child_rate = 0; 130 + 131 + /* find the parent that can help provide the fastest rate <= rate */ 132 + num_parents = __clk_get_num_parents(clk); 133 + for (i = 0; i < num_parents; i++) { 134 + parent = clk_get_parent_by_index(clk, i); 135 + if (!parent) 136 + continue; 137 + if (__clk_get_flags(clk) & CLK_SET_RATE_PARENT) 138 + parent_rate = __clk_round_rate(parent, rate); 139 + else 140 + parent_rate = __clk_get_rate(parent); 141 + 142 + child_rate = sun6i_ahb1_clk_round(rate, NULL, NULL, i, 143 + parent_rate); 144 + 145 + if (child_rate <= rate && child_rate > best_child_rate) { 146 + best_parent = parent; 147 + best = parent_rate; 148 + best_child_rate = child_rate; 149 + } 150 + } 151 + 152 + if (best_parent) 153 + *best_parent_clk = __clk_get_hw(best_parent); 154 + *best_parent_rate = best; 155 + 156 + return best_child_rate; 157 + } 158 + 159 + static int sun6i_ahb1_clk_set_rate(struct clk_hw *hw, unsigned long rate, 160 + unsigned long parent_rate) 161 + { 162 + struct sun6i_ahb1_clk *ahb1 = to_sun6i_ahb1_clk(hw); 163 + unsigned long flags; 164 + u8 div, pre_div, parent; 165 + u32 reg; 166 + 167 + spin_lock_irqsave(&clk_lock, flags); 168 + 169 + reg = readl(ahb1->reg); 170 + 171 + /* need to know which parent is used to apply pre-divider */ 172 + parent = SUN6I_AHB1_MUX_GET_PARENT(reg); 173 + sun6i_ahb1_clk_round(rate, &div, &pre_div, parent, parent_rate); 174 + 175 + reg = SUN6I_AHB1_DIV_SET(reg, div); 176 + reg = SUN6I_AHB1_PLL6_DIV_SET(reg, pre_div); 177 + writel(reg, ahb1->reg); 178 + 179 + spin_unlock_irqrestore(&clk_lock, flags); 180 + 181 + return 0; 182 + } 183 + 184 + static const struct clk_ops sun6i_ahb1_clk_ops = { 185 + .determine_rate = sun6i_ahb1_clk_determine_rate, 186 + .recalc_rate = sun6i_ahb1_clk_recalc_rate, 187 + .set_rate = sun6i_ahb1_clk_set_rate, 188 + }; 189 + 190 + static void __init sun6i_ahb1_clk_setup(struct device_node *node) 191 + { 192 + struct clk *clk; 193 + struct sun6i_ahb1_clk *ahb1; 194 + struct clk_mux *mux; 195 + const char *clk_name = node->name; 196 + const char *parents[SUN6I_AHB1_MAX_PARENTS]; 197 + void __iomem *reg; 198 + int i = 0; 199 + 200 + reg = of_io_request_and_map(node, 0, of_node_full_name(node)); 201 + 202 + /* we have a mux, we will have >1 parents */ 203 + while (i < SUN6I_AHB1_MAX_PARENTS && 204 + (parents[i] = of_clk_get_parent_name(node, i)) != NULL) 205 + i++; 206 + 207 + of_property_read_string(node, "clock-output-names", &clk_name); 208 + 209 + ahb1 = kzalloc(sizeof(struct sun6i_ahb1_clk), GFP_KERNEL); 210 + if (!ahb1) 211 + return; 212 + 213 + mux = kzalloc(sizeof(struct clk_mux), GFP_KERNEL); 214 + if (!mux) { 215 + kfree(ahb1); 216 + return; 217 + } 218 + 219 + /* set up clock properties */ 220 + mux->reg = reg; 221 + mux->shift = SUN6I_AHB1_MUX_SHIFT; 222 + mux->mask = SUN6I_AHB1_MUX_MASK; 223 + mux->lock = &clk_lock; 224 + ahb1->reg = reg; 225 + 226 + clk = clk_register_composite(NULL, clk_name, parents, i, 227 + &mux->hw, &clk_mux_ops, 228 + &ahb1->hw, &sun6i_ahb1_clk_ops, 229 + NULL, NULL, 0); 230 + 231 + if (!IS_ERR(clk)) { 232 + of_clk_add_provider(node, of_clk_src_simple_get, clk); 233 + clk_register_clkdev(clk, clk_name, NULL); 234 + } 235 + } 236 + CLK_OF_DECLARE(sun6i_a31_ahb1, "allwinner,sun6i-a31-ahb1-clk", sun6i_ahb1_clk_setup); 27 237 28 238 /* Maximum number of parents our clocks have */ 29 239 #define SUNXI_MAX_PARENTS 5 ··· 565 355 } 566 356 567 357 /** 568 - * clk_sunxi_mmc_phase_control() - configures MMC clock phase control 569 - */ 570 - 571 - void clk_sunxi_mmc_phase_control(struct clk *clk, u8 sample, u8 output) 572 - { 573 - #define to_clk_composite(_hw) container_of(_hw, struct clk_composite, hw) 574 - #define to_clk_factors(_hw) container_of(_hw, struct clk_factors, hw) 575 - 576 - struct clk_hw *hw = __clk_get_hw(clk); 577 - struct clk_composite *composite = to_clk_composite(hw); 578 - struct clk_hw *rate_hw = composite->rate_hw; 579 - struct clk_factors *factors = to_clk_factors(rate_hw); 580 - unsigned long flags = 0; 581 - u32 reg; 582 - 583 - if (factors->lock) 584 - spin_lock_irqsave(factors->lock, flags); 585 - 586 - reg = readl(factors->reg); 587 - 588 - /* set sample clock phase control */ 589 - reg &= ~(0x7 << 20); 590 - reg |= ((sample & 0x7) << 20); 591 - 592 - /* set output clock phase control */ 593 - reg &= ~(0x7 << 8); 594 - reg |= ((output & 0x7) << 8); 595 - 596 - writel(reg, factors->reg); 597 - 598 - if (factors->lock) 599 - spin_unlock_irqrestore(factors->lock, flags); 600 - } 601 - EXPORT_SYMBOL(clk_sunxi_mmc_phase_control); 602 - 603 - 604 - /** 605 358 * sunxi_factors_clk_setup() - Setup function for factor clocks 606 359 */ 607 360 ··· 586 413 .kwidth = 2, 587 414 .mshift = 0, 588 415 .mwidth = 2, 416 + .n_start = 1, 589 417 }; 590 418 591 419 static struct clk_factors_config sun8i_a23_pll1_config = { ··· 694 520 static struct clk * __init sunxi_factors_clk_setup(struct device_node *node, 695 521 const struct factors_data *data) 696 522 { 697 - return sunxi_factors_register(node, data, &clk_lock); 523 + void __iomem *reg; 524 + 525 + reg = of_iomap(node, 0); 526 + if (!reg) { 527 + pr_err("Could not get registers for factors-clk: %s\n", 528 + node->name); 529 + return NULL; 530 + } 531 + 532 + return sunxi_factors_register(node, data, &clk_lock, reg); 698 533 } 699 534 700 535 ··· 744 561 of_property_read_string(node, "clock-output-names", &clk_name); 745 562 746 563 clk = clk_register_mux(NULL, clk_name, parents, i, 747 - CLK_SET_RATE_NO_REPARENT, reg, 564 + CLK_SET_RATE_PARENT, reg, 748 565 data->shift, SUNXI_MUX_GATE_WIDTH, 749 566 0, &clk_lock); 750 567 ··· 1400 1217 1401 1218 static const char *sun6i_critical_clocks[] __initdata = { 1402 1219 "cpu", 1403 - "ahb1_sdram", 1404 1220 }; 1405 1221 1406 1222 static void __init sun6i_init_clocks(struct device_node *node)
+1
drivers/clk/tegra/Makefile
··· 15 15 obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += clk-tegra30.o 16 16 obj-$(CONFIG_ARCH_TEGRA_114_SOC) += clk-tegra114.o 17 17 obj-$(CONFIG_ARCH_TEGRA_124_SOC) += clk-tegra124.o 18 + obj-$(CONFIG_ARCH_TEGRA_132_SOC) += clk-tegra124.o
-2
drivers/clk/tegra/clk-id.h
··· 64 64 tegra_clk_disp2, 65 65 tegra_clk_dp2, 66 66 tegra_clk_dpaux, 67 - tegra_clk_dsia, 68 67 tegra_clk_dsialp, 69 68 tegra_clk_dsia_mux, 70 - tegra_clk_dsib, 71 69 tegra_clk_dsiblp, 72 70 tegra_clk_dsib_mux, 73 71 tegra_clk_dtv,
+7 -7
drivers/clk/tegra/clk-periph.c
··· 28 28 const struct clk_ops *mux_ops = periph->mux_ops; 29 29 struct clk_hw *mux_hw = &periph->mux.hw; 30 30 31 - mux_hw->clk = hw->clk; 31 + __clk_hw_set_clk(mux_hw, hw); 32 32 33 33 return mux_ops->get_parent(mux_hw); 34 34 } ··· 39 39 const struct clk_ops *mux_ops = periph->mux_ops; 40 40 struct clk_hw *mux_hw = &periph->mux.hw; 41 41 42 - mux_hw->clk = hw->clk; 42 + __clk_hw_set_clk(mux_hw, hw); 43 43 44 44 return mux_ops->set_parent(mux_hw, index); 45 45 } ··· 51 51 const struct clk_ops *div_ops = periph->div_ops; 52 52 struct clk_hw *div_hw = &periph->divider.hw; 53 53 54 - div_hw->clk = hw->clk; 54 + __clk_hw_set_clk(div_hw, hw); 55 55 56 56 return div_ops->recalc_rate(div_hw, parent_rate); 57 57 } ··· 63 63 const struct clk_ops *div_ops = periph->div_ops; 64 64 struct clk_hw *div_hw = &periph->divider.hw; 65 65 66 - div_hw->clk = hw->clk; 66 + __clk_hw_set_clk(div_hw, hw); 67 67 68 68 return div_ops->round_rate(div_hw, rate, prate); 69 69 } ··· 75 75 const struct clk_ops *div_ops = periph->div_ops; 76 76 struct clk_hw *div_hw = &periph->divider.hw; 77 77 78 - div_hw->clk = hw->clk; 78 + __clk_hw_set_clk(div_hw, hw); 79 79 80 80 return div_ops->set_rate(div_hw, rate, parent_rate); 81 81 } ··· 86 86 const struct clk_ops *gate_ops = periph->gate_ops; 87 87 struct clk_hw *gate_hw = &periph->gate.hw; 88 88 89 - gate_hw->clk = hw->clk; 89 + __clk_hw_set_clk(gate_hw, hw); 90 90 91 91 return gate_ops->is_enabled(gate_hw); 92 92 } ··· 97 97 const struct clk_ops *gate_ops = periph->gate_ops; 98 98 struct clk_hw *gate_hw = &periph->gate.hw; 99 99 100 - gate_hw->clk = hw->clk; 100 + __clk_hw_set_clk(gate_hw, hw); 101 101 102 102 return gate_ops->enable(gate_hw); 103 103 }
+11 -7
drivers/clk/tegra/clk-pll.c
··· 816 816 .enable = clk_plle_enable, 817 817 }; 818 818 819 - #if defined(CONFIG_ARCH_TEGRA_114_SOC) || defined(CONFIG_ARCH_TEGRA_124_SOC) 819 + #if defined(CONFIG_ARCH_TEGRA_114_SOC) || \ 820 + defined(CONFIG_ARCH_TEGRA_124_SOC) || \ 821 + defined(CONFIG_ARCH_TEGRA_132_SOC) 820 822 821 823 static int _pll_fixed_mdiv(struct tegra_clk_pll_params *pll_params, 822 824 unsigned long parent_rate) ··· 1507 1505 return clk; 1508 1506 } 1509 1507 1510 - #if defined(CONFIG_ARCH_TEGRA_114_SOC) || defined(CONFIG_ARCH_TEGRA_124_SOC) 1508 + #if defined(CONFIG_ARCH_TEGRA_114_SOC) || \ 1509 + defined(CONFIG_ARCH_TEGRA_124_SOC) || \ 1510 + defined(CONFIG_ARCH_TEGRA_132_SOC) 1511 1511 static const struct clk_ops tegra_clk_pllxc_ops = { 1512 1512 .is_enabled = clk_pll_is_enabled, 1513 1513 .enable = clk_pll_iddq_enable, ··· 1569 1565 parent = __clk_lookup(parent_name); 1570 1566 if (!parent) { 1571 1567 WARN(1, "parent clk %s of %s must be registered first\n", 1572 - name, parent_name); 1568 + parent_name, name); 1573 1569 return ERR_PTR(-EINVAL); 1574 1570 } 1575 1571 ··· 1669 1665 parent = __clk_lookup(parent_name); 1670 1666 if (!parent) { 1671 1667 WARN(1, "parent clk %s of %s must be registered first\n", 1672 - name, parent_name); 1668 + parent_name, name); 1673 1669 return ERR_PTR(-EINVAL); 1674 1670 } 1675 1671 ··· 1710 1706 parent = __clk_lookup(parent_name); 1711 1707 if (!parent) { 1712 1708 WARN(1, "parent clk %s of %s must be registered first\n", 1713 - name, parent_name); 1709 + parent_name, name); 1714 1710 return ERR_PTR(-EINVAL); 1715 1711 } 1716 1712 ··· 1806 1802 } 1807 1803 #endif 1808 1804 1809 - #ifdef CONFIG_ARCH_TEGRA_124_SOC 1805 + #if defined(CONFIG_ARCH_TEGRA_124_SOC) || defined(CONFIG_ARCH_TEGRA_132_SOC) 1810 1806 static const struct clk_ops tegra_clk_pllss_ops = { 1811 1807 .is_enabled = clk_pll_is_enabled, 1812 1808 .enable = clk_pll_iddq_enable, ··· 1834 1830 parent = __clk_lookup(parent_name); 1835 1831 if (!parent) { 1836 1832 WARN(1, "parent clk %s of %s must be registered first\n", 1837 - name, parent_name); 1833 + parent_name, name); 1838 1834 return ERR_PTR(-EINVAL); 1839 1835 } 1840 1836
+8 -10
drivers/clk/tegra/clk-tegra-periph.c
··· 434 434 MUX("hda", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_HDA, 125, TEGRA_PERIPH_ON_APB, tegra_clk_hda), 435 435 MUX("hda2codec_2x", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_HDA2CODEC_2X, 111, TEGRA_PERIPH_ON_APB, tegra_clk_hda2codec_2x), 436 436 MUX("vfir", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_VFIR, 7, TEGRA_PERIPH_ON_APB, tegra_clk_vfir), 437 - MUX("sdmmc1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC1, 14, 0, tegra_clk_sdmmc1), 438 - MUX("sdmmc2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC2, 9, 0, tegra_clk_sdmmc2), 439 - MUX("sdmmc3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC3, 69, 0, tegra_clk_sdmmc3), 440 - MUX("sdmmc4", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC4, 15, 0, tegra_clk_sdmmc4), 437 + MUX("sdmmc1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC1, 14, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc1), 438 + MUX("sdmmc2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC2, 9, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc2), 439 + MUX("sdmmc3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC3, 69, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc3), 440 + MUX("sdmmc4", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC4, 15, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc4), 441 441 MUX("la", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_LA, 76, TEGRA_PERIPH_ON_APB, tegra_clk_la), 442 442 MUX("trace", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_TRACE, 77, TEGRA_PERIPH_ON_APB, tegra_clk_trace), 443 443 MUX("owr", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_OWR, 71, TEGRA_PERIPH_ON_APB, tegra_clk_owr), ··· 470 470 MUX("adx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX1, 180, TEGRA_PERIPH_ON_APB, tegra_clk_adx1), 471 471 MUX("amx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX1, 185, TEGRA_PERIPH_ON_APB, tegra_clk_amx1), 472 472 MUX("vi_sensor2", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR2, 165, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor2), 473 - MUX8("sdmmc1", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC1, 14, 0, tegra_clk_sdmmc1_8), 474 - MUX8("sdmmc2", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC2, 9, 0, tegra_clk_sdmmc2_8), 475 - MUX8("sdmmc3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC3, 69, 0, tegra_clk_sdmmc3_8), 476 - MUX8("sdmmc4", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC4, 15, 0, tegra_clk_sdmmc4_8), 473 + MUX8("sdmmc1", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC1, 14, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc1_8), 474 + MUX8("sdmmc2", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC2, 9, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc2_8), 475 + MUX8("sdmmc3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC3, 69, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc3_8), 476 + MUX8("sdmmc4", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC4, 15, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc4_8), 477 477 MUX8("sbc1", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC1, 41, TEGRA_PERIPH_ON_APB, tegra_clk_sbc1_8), 478 478 MUX8("sbc2", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC2, 44, TEGRA_PERIPH_ON_APB, tegra_clk_sbc2_8), 479 479 MUX8("sbc3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC3, 46, TEGRA_PERIPH_ON_APB, tegra_clk_sbc3_8), ··· 537 537 GATE("xusb_host", "xusb_host_src", 89, 0, tegra_clk_xusb_host, 0), 538 538 GATE("xusb_ss", "xusb_ss_src", 156, 0, tegra_clk_xusb_ss, 0), 539 539 GATE("xusb_dev", "xusb_dev_src", 95, 0, tegra_clk_xusb_dev, 0), 540 - GATE("dsia", "dsia_mux", 48, 0, tegra_clk_dsia, 0), 541 - GATE("dsib", "dsib_mux", 82, 0, tegra_clk_dsib, 0), 542 540 GATE("emc", "emc_mux", 57, 0, tegra_clk_emc, CLK_IGNORE_UNUSED), 543 541 GATE("sata_cold", "clk_m", 129, TEGRA_PERIPH_ON_APB, tegra_clk_sata_cold, 0), 544 542 GATE("ispb", "clk_m", 3, 0, tegra_clk_ispb, 0),
+8 -2
drivers/clk/tegra/clk-tegra114.c
··· 715 715 [tegra_clk_sbc2_8] = { .dt_id = TEGRA114_CLK_SBC2, .present = true }, 716 716 [tegra_clk_sbc3_8] = { .dt_id = TEGRA114_CLK_SBC3, .present = true }, 717 717 [tegra_clk_i2c5] = { .dt_id = TEGRA114_CLK_I2C5, .present = true }, 718 - [tegra_clk_dsia] = { .dt_id = TEGRA114_CLK_DSIA, .present = true }, 719 718 [tegra_clk_mipi] = { .dt_id = TEGRA114_CLK_MIPI, .present = true }, 720 719 [tegra_clk_hdmi] = { .dt_id = TEGRA114_CLK_HDMI, .present = true }, 721 720 [tegra_clk_csi] = { .dt_id = TEGRA114_CLK_CSI, .present = true }, ··· 738 739 [tegra_clk_dtv] = { .dt_id = TEGRA114_CLK_DTV, .present = true }, 739 740 [tegra_clk_ndspeed] = { .dt_id = TEGRA114_CLK_NDSPEED, .present = true }, 740 741 [tegra_clk_i2cslow] = { .dt_id = TEGRA114_CLK_I2CSLOW, .present = true }, 741 - [tegra_clk_dsib] = { .dt_id = TEGRA114_CLK_DSIB, .present = true }, 742 742 [tegra_clk_tsec] = { .dt_id = TEGRA114_CLK_TSEC, .present = true }, 743 743 [tegra_clk_xusb_host] = { .dt_id = TEGRA114_CLK_XUSB_HOST, .present = true }, 744 744 [tegra_clk_msenc] = { .dt_id = TEGRA114_CLK_MSENC, .present = true }, ··· 1221 1223 CLK_SET_RATE_NO_REPARENT, 1222 1224 clk_base + PLLD2_BASE, 25, 1, 0, &pll_d2_lock); 1223 1225 clks[TEGRA114_CLK_DSIB_MUX] = clk; 1226 + 1227 + clk = tegra_clk_register_periph_gate("dsia", "dsia_mux", 0, clk_base, 1228 + 0, 48, periph_clk_enb_refcnt); 1229 + clks[TEGRA114_CLK_DSIA] = clk; 1230 + 1231 + clk = tegra_clk_register_periph_gate("dsib", "dsib_mux", 0, clk_base, 1232 + 0, 82, periph_clk_enb_refcnt); 1233 + clks[TEGRA114_CLK_DSIB] = clk; 1224 1234 1225 1235 /* emc mux */ 1226 1236 clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm,
+141 -31
drivers/clk/tegra/clk-tegra124.c
··· 1 1 /* 2 - * Copyright (c) 2012, 2013, NVIDIA CORPORATION. All rights reserved. 2 + * Copyright (c) 2012-2014 NVIDIA CORPORATION. All rights reserved. 3 3 * 4 4 * This program is free software; you can redistribute it and/or modify it 5 5 * under the terms and conditions of the GNU General Public License, ··· 27 27 28 28 #include "clk.h" 29 29 #include "clk-id.h" 30 + 31 + /* 32 + * TEGRA124_CAR_BANK_COUNT: the number of peripheral clock register 33 + * banks present in the Tegra124/132 CAR IP block. The banks are 34 + * identified by single letters, e.g.: L, H, U, V, W, X. See 35 + * periph_regs[] in drivers/clk/tegra/clk.c 36 + */ 37 + #define TEGRA124_CAR_BANK_COUNT 6 30 38 31 39 #define CLK_SOURCE_CSITE 0x1d4 32 40 #define CLK_SOURCE_EMC 0x19c ··· 136 128 static unsigned long pll_ref_freq; 137 129 138 130 static DEFINE_SPINLOCK(pll_d_lock); 139 - static DEFINE_SPINLOCK(pll_d2_lock); 140 131 static DEFINE_SPINLOCK(pll_e_lock); 141 132 static DEFINE_SPINLOCK(pll_re_lock); 142 133 static DEFINE_SPINLOCK(pll_u_lock); ··· 151 144 [9] = 48000000, 152 145 [12] = 260000000, 153 146 }; 154 - 155 - static const char *mux_plld_out0_plld2_out0[] = { 156 - "pll_d_out0", "pll_d2_out0", 157 - }; 158 - #define mux_plld_out0_plld2_out0_idx NULL 159 147 160 148 static const char *mux_pllmcp_clkm[] = { 161 149 "pll_m", "pll_c", "pll_p", "clk_m", "pll_m_ud", "pll_c2", "pll_c3", ··· 785 783 [tegra_clk_sbc2] = { .dt_id = TEGRA124_CLK_SBC2, .present = true }, 786 784 [tegra_clk_sbc3] = { .dt_id = TEGRA124_CLK_SBC3, .present = true }, 787 785 [tegra_clk_i2c5] = { .dt_id = TEGRA124_CLK_I2C5, .present = true }, 788 - [tegra_clk_dsia] = { .dt_id = TEGRA124_CLK_DSIA, .present = true }, 789 786 [tegra_clk_mipi] = { .dt_id = TEGRA124_CLK_MIPI, .present = true }, 790 787 [tegra_clk_hdmi] = { .dt_id = TEGRA124_CLK_HDMI, .present = true }, 791 788 [tegra_clk_csi] = { .dt_id = TEGRA124_CLK_CSI, .present = true }, ··· 810 809 [tegra_clk_soc_therm] = { .dt_id = TEGRA124_CLK_SOC_THERM, .present = true }, 811 810 [tegra_clk_dtv] = { .dt_id = TEGRA124_CLK_DTV, .present = true }, 812 811 [tegra_clk_i2cslow] = { .dt_id = TEGRA124_CLK_I2CSLOW, .present = true }, 813 - [tegra_clk_dsib] = { .dt_id = TEGRA124_CLK_DSIB, .present = true }, 814 812 [tegra_clk_tsec] = { .dt_id = TEGRA124_CLK_TSEC, .present = true }, 815 813 [tegra_clk_xusb_host] = { .dt_id = TEGRA124_CLK_XUSB_HOST, .present = true }, 816 814 [tegra_clk_msenc] = { .dt_id = TEGRA124_CLK_MSENC, .present = true }, ··· 949 949 [tegra_clk_clk_out_1_mux] = { .dt_id = TEGRA124_CLK_CLK_OUT_1_MUX, .present = true }, 950 950 [tegra_clk_clk_out_2_mux] = { .dt_id = TEGRA124_CLK_CLK_OUT_2_MUX, .present = true }, 951 951 [tegra_clk_clk_out_3_mux] = { .dt_id = TEGRA124_CLK_CLK_OUT_3_MUX, .present = true }, 952 - [tegra_clk_dsia_mux] = { .dt_id = TEGRA124_CLK_DSIA_MUX, .present = true }, 953 - [tegra_clk_dsib_mux] = { .dt_id = TEGRA124_CLK_DSIB_MUX, .present = true }, 954 952 }; 955 953 956 954 static struct tegra_devclk devclks[] __initdata = { ··· 1110 1112 1, 2); 1111 1113 clks[TEGRA124_CLK_XUSB_SS_DIV2] = clk; 1112 1114 1113 - /* dsia mux */ 1114 - clk = clk_register_mux(NULL, "dsia_mux", mux_plld_out0_plld2_out0, 1115 - ARRAY_SIZE(mux_plld_out0_plld2_out0), 0, 1116 - clk_base + PLLD_BASE, 25, 1, 0, &pll_d_lock); 1117 - clks[TEGRA124_CLK_DSIA_MUX] = clk; 1115 + clk = clk_register_gate(NULL, "plld_dsi", "plld_out0", 0, 1116 + clk_base + PLLD_MISC, 30, 0, &pll_d_lock); 1117 + clks[TEGRA124_CLK_PLLD_DSI] = clk; 1118 1118 1119 - /* dsib mux */ 1120 - clk = clk_register_mux(NULL, "dsib_mux", mux_plld_out0_plld2_out0, 1121 - ARRAY_SIZE(mux_plld_out0_plld2_out0), 0, 1122 - clk_base + PLLD2_BASE, 25, 1, 0, &pll_d2_lock); 1123 - clks[TEGRA124_CLK_DSIB_MUX] = clk; 1119 + clk = tegra_clk_register_periph_gate("dsia", "plld_dsi", 0, clk_base, 1120 + 0, 48, periph_clk_enb_refcnt); 1121 + clks[TEGRA124_CLK_DSIA] = clk; 1122 + 1123 + clk = tegra_clk_register_periph_gate("dsib", "plld_dsi", 0, clk_base, 1124 + 0, 82, periph_clk_enb_refcnt); 1125 + clks[TEGRA124_CLK_DSIB] = clk; 1124 1126 1125 1127 /* emc mux */ 1126 1128 clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm, ··· 1349 1351 {}, 1350 1352 }; 1351 1353 1352 - static struct tegra_clk_init_table init_table[] __initdata = { 1354 + static struct tegra_clk_init_table common_init_table[] __initdata = { 1353 1355 {TEGRA124_CLK_UARTA, TEGRA124_CLK_PLL_P, 408000000, 0}, 1354 1356 {TEGRA124_CLK_UARTB, TEGRA124_CLK_PLL_P, 408000000, 0}, 1355 1357 {TEGRA124_CLK_UARTC, TEGRA124_CLK_PLL_P, 408000000, 0}, ··· 1366 1368 {TEGRA124_CLK_I2S4, TEGRA124_CLK_PLL_A_OUT0, 11289600, 0}, 1367 1369 {TEGRA124_CLK_VDE, TEGRA124_CLK_PLL_P, 0, 0}, 1368 1370 {TEGRA124_CLK_HOST1X, TEGRA124_CLK_PLL_P, 136000000, 1}, 1371 + {TEGRA124_CLK_DSIALP, TEGRA124_CLK_PLL_P, 68000000, 0}, 1372 + {TEGRA124_CLK_DSIBLP, TEGRA124_CLK_PLL_P, 68000000, 0}, 1369 1373 {TEGRA124_CLK_SCLK, TEGRA124_CLK_PLL_P_OUT2, 102000000, 1}, 1370 1374 {TEGRA124_CLK_DFLL_SOC, TEGRA124_CLK_PLL_P, 51000000, 1}, 1371 1375 {TEGRA124_CLK_DFLL_REF, TEGRA124_CLK_PLL_P, 51000000, 1}, ··· 1385 1385 {TEGRA124_CLK_SATA, TEGRA124_CLK_PLL_P, 104000000, 0}, 1386 1386 {TEGRA124_CLK_SATA_OOB, TEGRA124_CLK_PLL_P, 204000000, 0}, 1387 1387 {TEGRA124_CLK_EMC, TEGRA124_CLK_CLK_MAX, 0, 1}, 1388 - {TEGRA124_CLK_CCLK_G, TEGRA124_CLK_CLK_MAX, 0, 1}, 1389 1388 {TEGRA124_CLK_MSELECT, TEGRA124_CLK_CLK_MAX, 0, 1}, 1390 1389 {TEGRA124_CLK_CSITE, TEGRA124_CLK_CLK_MAX, 0, 1}, 1391 1390 {TEGRA124_CLK_TSENSOR, TEGRA124_CLK_CLK_M, 400000, 0}, 1392 - {TEGRA124_CLK_SOC_THERM, TEGRA124_CLK_PLL_P, 51000000, 0}, 1393 1391 /* This MUST be the last entry. */ 1394 1392 {TEGRA124_CLK_CLK_MAX, TEGRA124_CLK_CLK_MAX, 0, 0}, 1395 1393 }; 1396 1394 1395 + static struct tegra_clk_init_table tegra124_init_table[] __initdata = { 1396 + {TEGRA124_CLK_SOC_THERM, TEGRA124_CLK_PLL_P, 51000000, 0}, 1397 + {TEGRA124_CLK_CCLK_G, TEGRA124_CLK_CLK_MAX, 0, 1}, 1398 + /* This MUST be the last entry. */ 1399 + {TEGRA124_CLK_CLK_MAX, TEGRA124_CLK_CLK_MAX, 0, 0}, 1400 + }; 1401 + 1402 + /* Tegra132 requires the SOC_THERM clock to remain active */ 1403 + static struct tegra_clk_init_table tegra132_init_table[] __initdata = { 1404 + {TEGRA124_CLK_SOC_THERM, TEGRA124_CLK_PLL_P, 51000000, 1}, 1405 + /* This MUST be the last entry. */ 1406 + {TEGRA124_CLK_CLK_MAX, TEGRA124_CLK_CLK_MAX, 0, 0}, 1407 + }; 1408 + 1409 + /** 1410 + * tegra124_clock_apply_init_table - initialize clocks on Tegra124 SoCs 1411 + * 1412 + * Program an initial clock rate and enable or disable clocks needed 1413 + * by the rest of the kernel, for Tegra124 SoCs. It is intended to be 1414 + * called by assigning a pointer to it to tegra_clk_apply_init_table - 1415 + * this will be called as an arch_initcall. No return value. 1416 + */ 1397 1417 static void __init tegra124_clock_apply_init_table(void) 1398 1418 { 1399 - tegra_init_from_table(init_table, clks, TEGRA124_CLK_CLK_MAX); 1419 + tegra_init_from_table(common_init_table, clks, TEGRA124_CLK_CLK_MAX); 1420 + tegra_init_from_table(tegra124_init_table, clks, TEGRA124_CLK_CLK_MAX); 1400 1421 } 1401 1422 1402 - static void __init tegra124_clock_init(struct device_node *np) 1423 + /** 1424 + * tegra132_clock_apply_init_table - initialize clocks on Tegra132 SoCs 1425 + * 1426 + * Program an initial clock rate and enable or disable clocks needed 1427 + * by the rest of the kernel, for Tegra132 SoCs. It is intended to be 1428 + * called by assigning a pointer to it to tegra_clk_apply_init_table - 1429 + * this will be called as an arch_initcall. No return value. 1430 + */ 1431 + static void __init tegra132_clock_apply_init_table(void) 1432 + { 1433 + tegra_init_from_table(common_init_table, clks, TEGRA124_CLK_CLK_MAX); 1434 + tegra_init_from_table(tegra132_init_table, clks, TEGRA124_CLK_CLK_MAX); 1435 + } 1436 + 1437 + /** 1438 + * tegra124_132_clock_init_pre - clock initialization preamble for T124/T132 1439 + * @np: struct device_node * of the DT node for the SoC CAR IP block 1440 + * 1441 + * Register most of the clocks controlled by the CAR IP block, along 1442 + * with a few clocks controlled by the PMC IP block. Everything in 1443 + * this function should be common to Tegra124 and Tegra132. XXX The 1444 + * PMC clock initialization should probably be moved to PMC-specific 1445 + * driver code. No return value. 1446 + */ 1447 + static void __init tegra124_132_clock_init_pre(struct device_node *np) 1403 1448 { 1404 1449 struct device_node *node; 1450 + u32 plld_base; 1405 1451 1406 1452 clk_base = of_iomap(np, 0); 1407 1453 if (!clk_base) { 1408 - pr_err("ioremap tegra124 CAR failed\n"); 1454 + pr_err("ioremap tegra124/tegra132 CAR failed\n"); 1409 1455 return; 1410 1456 } 1411 1457 ··· 1469 1423 return; 1470 1424 } 1471 1425 1472 - clks = tegra_clk_init(clk_base, TEGRA124_CLK_CLK_MAX, 6); 1426 + clks = tegra_clk_init(clk_base, TEGRA124_CLK_CLK_MAX, 1427 + TEGRA124_CAR_BANK_COUNT); 1473 1428 if (!clks) 1474 1429 return; 1475 1430 ··· 1484 1437 tegra_audio_clk_init(clk_base, pmc_base, tegra124_clks, &pll_a_params); 1485 1438 tegra_pmc_clk_init(pmc_base, tegra124_clks); 1486 1439 1440 + /* For Tegra124 & Tegra132, PLLD is the only source for DSIA & DSIB */ 1441 + plld_base = clk_readl(clk_base + PLLD_BASE); 1442 + plld_base &= ~BIT(25); 1443 + clk_writel(plld_base, clk_base + PLLD_BASE); 1444 + } 1445 + 1446 + /** 1447 + * tegra124_132_clock_init_post - clock initialization postamble for T124/T132 1448 + * @np: struct device_node * of the DT node for the SoC CAR IP block 1449 + * 1450 + * Register most of the along with a few clocks controlled by the PMC 1451 + * IP block. Everything in this function should be common to Tegra124 1452 + * and Tegra132. This function must be called after 1453 + * tegra124_132_clock_init_pre(), otherwise clk_base and pmc_base will 1454 + * not be set. No return value. 1455 + */ 1456 + static void __init tegra124_132_clock_init_post(struct device_node *np) 1457 + { 1487 1458 tegra_super_clk_gen4_init(clk_base, pmc_base, tegra124_clks, 1488 - &pll_x_params); 1459 + &pll_x_params); 1489 1460 tegra_add_of_provider(np); 1490 1461 tegra_register_devclks(devclks, ARRAY_SIZE(devclks)); 1491 1462 1492 - tegra_clk_apply_init_table = tegra124_clock_apply_init_table; 1493 - 1494 1463 tegra_cpu_car_ops = &tegra124_cpu_car_ops; 1495 1464 } 1465 + 1466 + /** 1467 + * tegra124_clock_init - Tegra124-specific clock initialization 1468 + * @np: struct device_node * of the DT node for the SoC CAR IP block 1469 + * 1470 + * Register most SoC clocks for the Tegra124 system-on-chip. Most of 1471 + * this code is shared between the Tegra124 and Tegra132 SoCs, 1472 + * although some of the initial clock settings and CPU clocks differ. 1473 + * Intended to be called by the OF init code when a DT node with the 1474 + * "nvidia,tegra124-car" string is encountered, and declared with 1475 + * CLK_OF_DECLARE. No return value. 1476 + */ 1477 + static void __init tegra124_clock_init(struct device_node *np) 1478 + { 1479 + tegra124_132_clock_init_pre(np); 1480 + tegra_clk_apply_init_table = tegra124_clock_apply_init_table; 1481 + tegra124_132_clock_init_post(np); 1482 + } 1483 + 1484 + /** 1485 + * tegra132_clock_init - Tegra132-specific clock initialization 1486 + * @np: struct device_node * of the DT node for the SoC CAR IP block 1487 + * 1488 + * Register most SoC clocks for the Tegra132 system-on-chip. Most of 1489 + * this code is shared between the Tegra124 and Tegra132 SoCs, 1490 + * although some of the initial clock settings and CPU clocks differ. 1491 + * Intended to be called by the OF init code when a DT node with the 1492 + * "nvidia,tegra132-car" string is encountered, and declared with 1493 + * CLK_OF_DECLARE. No return value. 1494 + */ 1495 + static void __init tegra132_clock_init(struct device_node *np) 1496 + { 1497 + tegra124_132_clock_init_pre(np); 1498 + 1499 + /* 1500 + * On Tegra132, these clocks are controlled by the 1501 + * CLUSTER_clocks IP block, located in the CPU complex 1502 + */ 1503 + tegra124_clks[tegra_clk_cclk_g].present = false; 1504 + tegra124_clks[tegra_clk_cclk_lp].present = false; 1505 + tegra124_clks[tegra_clk_pll_x].present = false; 1506 + tegra124_clks[tegra_clk_pll_x_out0].present = false; 1507 + 1508 + tegra_clk_apply_init_table = tegra132_clock_apply_init_table; 1509 + tegra124_132_clock_init_post(np); 1510 + } 1496 1511 CLK_OF_DECLARE(tegra124, "nvidia,tegra124-car", tegra124_clock_init); 1512 + CLK_OF_DECLARE(tegra132, "nvidia,tegra132-car", tegra132_clock_init);
+5 -2
drivers/clk/tegra/clk.c
··· 302 302 303 303 tegra_clk_apply_init_table_func tegra_clk_apply_init_table; 304 304 305 - void __init tegra_clocks_apply_init_table(void) 305 + static int __init tegra_clocks_apply_init_table(void) 306 306 { 307 307 if (!tegra_clk_apply_init_table) 308 - return; 308 + return 0; 309 309 310 310 tegra_clk_apply_init_table(); 311 + 312 + return 0; 311 313 } 314 + arch_initcall(tegra_clocks_apply_init_table);
+6 -2
drivers/clk/ti/Makefile
··· 1 - ifneq ($(CONFIG_OF),) 2 1 obj-y += clk.o autoidle.o clockdomain.o 3 2 clk-common = dpll.o composite.o divider.o gate.o \ 4 3 fixed-factor.o mux.o apll.o 5 4 obj-$(CONFIG_SOC_AM33XX) += $(clk-common) clk-33xx.o 5 + obj-$(CONFIG_SOC_TI81XX) += $(clk-common) fapll.o clk-816x.o 6 6 obj-$(CONFIG_ARCH_OMAP2) += $(clk-common) interface.o clk-2xxx.o 7 - obj-$(CONFIG_ARCH_OMAP3) += $(clk-common) interface.o clk-3xxx.o 7 + obj-$(CONFIG_ARCH_OMAP3) += $(clk-common) interface.o \ 8 + clk-3xxx.o 8 9 obj-$(CONFIG_ARCH_OMAP4) += $(clk-common) clk-44xx.o 9 10 obj-$(CONFIG_SOC_OMAP5) += $(clk-common) clk-54xx.o 10 11 obj-$(CONFIG_SOC_DRA7XX) += $(clk-common) clk-7xx.o \ 11 12 clk-dra7-atl.o 12 13 obj-$(CONFIG_SOC_AM43XX) += $(clk-common) clk-43xx.o 14 + 15 + ifdef CONFIG_ATAGS 16 + obj-$(CONFIG_ARCH_OMAP3) += clk-3xxx-legacy.o 13 17 endif
+4653
drivers/clk/ti/clk-3xxx-legacy.c
··· 1 + /* 2 + * OMAP3 Legacy clock data 3 + * 4 + * Copyright (C) 2014 Texas Instruments, Inc 5 + * Tero Kristo (t-kristo@ti.com) 6 + * 7 + * This program is free software; you can redistribute it and/or 8 + * modify it under the terms of the GNU General Public License as 9 + * published by the Free Software Foundation version 2. 10 + * 11 + * This program is distributed "as is" WITHOUT ANY WARRANTY of any 12 + * kind, whether express or implied; without even the implied warranty 13 + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + * GNU General Public License for more details. 15 + */ 16 + 17 + #include <linux/kernel.h> 18 + #include <linux/clk-provider.h> 19 + #include <linux/clk/ti.h> 20 + 21 + #include "clock.h" 22 + 23 + static struct ti_clk_fixed virt_12m_ck_data = { 24 + .frequency = 12000000, 25 + }; 26 + 27 + static struct ti_clk virt_12m_ck = { 28 + .name = "virt_12m_ck", 29 + .type = TI_CLK_FIXED, 30 + .data = &virt_12m_ck_data, 31 + }; 32 + 33 + static struct ti_clk_fixed virt_13m_ck_data = { 34 + .frequency = 13000000, 35 + }; 36 + 37 + static struct ti_clk virt_13m_ck = { 38 + .name = "virt_13m_ck", 39 + .type = TI_CLK_FIXED, 40 + .data = &virt_13m_ck_data, 41 + }; 42 + 43 + static struct ti_clk_fixed virt_19200000_ck_data = { 44 + .frequency = 19200000, 45 + }; 46 + 47 + static struct ti_clk virt_19200000_ck = { 48 + .name = "virt_19200000_ck", 49 + .type = TI_CLK_FIXED, 50 + .data = &virt_19200000_ck_data, 51 + }; 52 + 53 + static struct ti_clk_fixed virt_26000000_ck_data = { 54 + .frequency = 26000000, 55 + }; 56 + 57 + static struct ti_clk virt_26000000_ck = { 58 + .name = "virt_26000000_ck", 59 + .type = TI_CLK_FIXED, 60 + .data = &virt_26000000_ck_data, 61 + }; 62 + 63 + static struct ti_clk_fixed virt_38_4m_ck_data = { 64 + .frequency = 38400000, 65 + }; 66 + 67 + static struct ti_clk virt_38_4m_ck = { 68 + .name = "virt_38_4m_ck", 69 + .type = TI_CLK_FIXED, 70 + .data = &virt_38_4m_ck_data, 71 + }; 72 + 73 + static struct ti_clk_fixed virt_16_8m_ck_data = { 74 + .frequency = 16800000, 75 + }; 76 + 77 + static struct ti_clk virt_16_8m_ck = { 78 + .name = "virt_16_8m_ck", 79 + .type = TI_CLK_FIXED, 80 + .data = &virt_16_8m_ck_data, 81 + }; 82 + 83 + static const char *osc_sys_ck_parents[] = { 84 + "virt_12m_ck", 85 + "virt_13m_ck", 86 + "virt_19200000_ck", 87 + "virt_26000000_ck", 88 + "virt_38_4m_ck", 89 + "virt_16_8m_ck", 90 + }; 91 + 92 + static struct ti_clk_mux osc_sys_ck_data = { 93 + .num_parents = ARRAY_SIZE(osc_sys_ck_parents), 94 + .reg = 0xd40, 95 + .module = TI_CLKM_PRM, 96 + .parents = osc_sys_ck_parents, 97 + }; 98 + 99 + static struct ti_clk osc_sys_ck = { 100 + .name = "osc_sys_ck", 101 + .type = TI_CLK_MUX, 102 + .data = &osc_sys_ck_data, 103 + }; 104 + 105 + static struct ti_clk_divider sys_ck_data = { 106 + .parent = "osc_sys_ck", 107 + .bit_shift = 6, 108 + .max_div = 3, 109 + .reg = 0x1270, 110 + .module = TI_CLKM_PRM, 111 + .flags = CLKF_INDEX_STARTS_AT_ONE, 112 + }; 113 + 114 + static struct ti_clk sys_ck = { 115 + .name = "sys_ck", 116 + .type = TI_CLK_DIVIDER, 117 + .data = &sys_ck_data, 118 + }; 119 + 120 + static const char *dpll3_ck_parents[] = { 121 + "sys_ck", 122 + "sys_ck", 123 + }; 124 + 125 + static struct ti_clk_dpll dpll3_ck_data = { 126 + .num_parents = ARRAY_SIZE(dpll3_ck_parents), 127 + .control_reg = 0xd00, 128 + .idlest_reg = 0xd20, 129 + .mult_div1_reg = 0xd40, 130 + .autoidle_reg = 0xd30, 131 + .module = TI_CLKM_CM, 132 + .parents = dpll3_ck_parents, 133 + .flags = CLKF_CORE, 134 + .freqsel_mask = 0xf0, 135 + .div1_mask = 0x7f00, 136 + .idlest_mask = 0x1, 137 + .auto_recal_bit = 0x3, 138 + .max_divider = 0x80, 139 + .min_divider = 0x1, 140 + .recal_en_bit = 0x5, 141 + .max_multiplier = 0x7ff, 142 + .enable_mask = 0x7, 143 + .mult_mask = 0x7ff0000, 144 + .recal_st_bit = 0x5, 145 + .autoidle_mask = 0x7, 146 + }; 147 + 148 + static struct ti_clk dpll3_ck = { 149 + .name = "dpll3_ck", 150 + .clkdm_name = "dpll3_clkdm", 151 + .type = TI_CLK_DPLL, 152 + .data = &dpll3_ck_data, 153 + }; 154 + 155 + static struct ti_clk_divider dpll3_m2_ck_data = { 156 + .parent = "dpll3_ck", 157 + .bit_shift = 27, 158 + .max_div = 31, 159 + .reg = 0xd40, 160 + .module = TI_CLKM_CM, 161 + .flags = CLKF_INDEX_STARTS_AT_ONE, 162 + }; 163 + 164 + static struct ti_clk dpll3_m2_ck = { 165 + .name = "dpll3_m2_ck", 166 + .type = TI_CLK_DIVIDER, 167 + .data = &dpll3_m2_ck_data, 168 + }; 169 + 170 + static struct ti_clk_fixed_factor core_ck_data = { 171 + .parent = "dpll3_m2_ck", 172 + .div = 1, 173 + .mult = 1, 174 + }; 175 + 176 + static struct ti_clk core_ck = { 177 + .name = "core_ck", 178 + .type = TI_CLK_FIXED_FACTOR, 179 + .data = &core_ck_data, 180 + }; 181 + 182 + static struct ti_clk_divider l3_ick_data = { 183 + .parent = "core_ck", 184 + .max_div = 3, 185 + .reg = 0xa40, 186 + .module = TI_CLKM_CM, 187 + .flags = CLKF_INDEX_STARTS_AT_ONE, 188 + }; 189 + 190 + static struct ti_clk l3_ick = { 191 + .name = "l3_ick", 192 + .type = TI_CLK_DIVIDER, 193 + .data = &l3_ick_data, 194 + }; 195 + 196 + static struct ti_clk_fixed_factor security_l3_ick_data = { 197 + .parent = "l3_ick", 198 + .div = 1, 199 + .mult = 1, 200 + }; 201 + 202 + static struct ti_clk security_l3_ick = { 203 + .name = "security_l3_ick", 204 + .type = TI_CLK_FIXED_FACTOR, 205 + .data = &security_l3_ick_data, 206 + }; 207 + 208 + static struct ti_clk_fixed_factor wkup_l4_ick_data = { 209 + .parent = "sys_ck", 210 + .div = 1, 211 + .mult = 1, 212 + }; 213 + 214 + static struct ti_clk wkup_l4_ick = { 215 + .name = "wkup_l4_ick", 216 + .type = TI_CLK_FIXED_FACTOR, 217 + .data = &wkup_l4_ick_data, 218 + }; 219 + 220 + static struct ti_clk_gate usim_ick_data = { 221 + .parent = "wkup_l4_ick", 222 + .bit_shift = 9, 223 + .reg = 0xc10, 224 + .module = TI_CLKM_CM, 225 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 226 + }; 227 + 228 + static struct ti_clk usim_ick = { 229 + .name = "usim_ick", 230 + .clkdm_name = "wkup_clkdm", 231 + .type = TI_CLK_GATE, 232 + .data = &usim_ick_data, 233 + }; 234 + 235 + static struct ti_clk_gate dss2_alwon_fck_data = { 236 + .parent = "sys_ck", 237 + .bit_shift = 1, 238 + .reg = 0xe00, 239 + .module = TI_CLKM_CM, 240 + }; 241 + 242 + static struct ti_clk dss2_alwon_fck = { 243 + .name = "dss2_alwon_fck", 244 + .clkdm_name = "dss_clkdm", 245 + .type = TI_CLK_GATE, 246 + .data = &dss2_alwon_fck_data, 247 + }; 248 + 249 + static struct ti_clk_divider l4_ick_data = { 250 + .parent = "l3_ick", 251 + .bit_shift = 2, 252 + .max_div = 3, 253 + .reg = 0xa40, 254 + .module = TI_CLKM_CM, 255 + .flags = CLKF_INDEX_STARTS_AT_ONE, 256 + }; 257 + 258 + static struct ti_clk l4_ick = { 259 + .name = "l4_ick", 260 + .type = TI_CLK_DIVIDER, 261 + .data = &l4_ick_data, 262 + }; 263 + 264 + static struct ti_clk_fixed_factor core_l4_ick_data = { 265 + .parent = "l4_ick", 266 + .div = 1, 267 + .mult = 1, 268 + }; 269 + 270 + static struct ti_clk core_l4_ick = { 271 + .name = "core_l4_ick", 272 + .type = TI_CLK_FIXED_FACTOR, 273 + .data = &core_l4_ick_data, 274 + }; 275 + 276 + static struct ti_clk_gate mmchs2_ick_data = { 277 + .parent = "core_l4_ick", 278 + .bit_shift = 25, 279 + .reg = 0xa10, 280 + .module = TI_CLKM_CM, 281 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 282 + }; 283 + 284 + static struct ti_clk mmchs2_ick = { 285 + .name = "mmchs2_ick", 286 + .clkdm_name = "core_l4_clkdm", 287 + .type = TI_CLK_GATE, 288 + .data = &mmchs2_ick_data, 289 + }; 290 + 291 + static const char *dpll4_ck_parents[] = { 292 + "sys_ck", 293 + "sys_ck", 294 + }; 295 + 296 + static struct ti_clk_dpll dpll4_ck_data = { 297 + .num_parents = ARRAY_SIZE(dpll4_ck_parents), 298 + .control_reg = 0xd00, 299 + .idlest_reg = 0xd20, 300 + .mult_div1_reg = 0xd44, 301 + .autoidle_reg = 0xd30, 302 + .module = TI_CLKM_CM, 303 + .parents = dpll4_ck_parents, 304 + .flags = CLKF_PER, 305 + .freqsel_mask = 0xf00000, 306 + .modes = 0x82, 307 + .div1_mask = 0x7f, 308 + .idlest_mask = 0x2, 309 + .auto_recal_bit = 0x13, 310 + .max_divider = 0x80, 311 + .min_divider = 0x1, 312 + .recal_en_bit = 0x6, 313 + .max_multiplier = 0x7ff, 314 + .enable_mask = 0x70000, 315 + .mult_mask = 0x7ff00, 316 + .recal_st_bit = 0x6, 317 + .autoidle_mask = 0x38, 318 + }; 319 + 320 + static struct ti_clk dpll4_ck = { 321 + .name = "dpll4_ck", 322 + .clkdm_name = "dpll4_clkdm", 323 + .type = TI_CLK_DPLL, 324 + .data = &dpll4_ck_data, 325 + }; 326 + 327 + static struct ti_clk_divider dpll4_m2_ck_data = { 328 + .parent = "dpll4_ck", 329 + .max_div = 63, 330 + .reg = 0xd48, 331 + .module = TI_CLKM_CM, 332 + .flags = CLKF_INDEX_STARTS_AT_ONE, 333 + }; 334 + 335 + static struct ti_clk dpll4_m2_ck = { 336 + .name = "dpll4_m2_ck", 337 + .type = TI_CLK_DIVIDER, 338 + .data = &dpll4_m2_ck_data, 339 + }; 340 + 341 + static struct ti_clk_fixed_factor dpll4_m2x2_mul_ck_data = { 342 + .parent = "dpll4_m2_ck", 343 + .div = 1, 344 + .mult = 2, 345 + }; 346 + 347 + static struct ti_clk dpll4_m2x2_mul_ck = { 348 + .name = "dpll4_m2x2_mul_ck", 349 + .type = TI_CLK_FIXED_FACTOR, 350 + .data = &dpll4_m2x2_mul_ck_data, 351 + }; 352 + 353 + static struct ti_clk_gate dpll4_m2x2_ck_data = { 354 + .parent = "dpll4_m2x2_mul_ck", 355 + .bit_shift = 0x1b, 356 + .reg = 0xd00, 357 + .module = TI_CLKM_CM, 358 + .flags = CLKF_SET_BIT_TO_DISABLE, 359 + }; 360 + 361 + static struct ti_clk dpll4_m2x2_ck = { 362 + .name = "dpll4_m2x2_ck", 363 + .type = TI_CLK_GATE, 364 + .data = &dpll4_m2x2_ck_data, 365 + }; 366 + 367 + static struct ti_clk_fixed_factor omap_96m_alwon_fck_data = { 368 + .parent = "dpll4_m2x2_ck", 369 + .div = 1, 370 + .mult = 1, 371 + }; 372 + 373 + static struct ti_clk omap_96m_alwon_fck = { 374 + .name = "omap_96m_alwon_fck", 375 + .type = TI_CLK_FIXED_FACTOR, 376 + .data = &omap_96m_alwon_fck_data, 377 + }; 378 + 379 + static struct ti_clk_fixed_factor cm_96m_fck_data = { 380 + .parent = "omap_96m_alwon_fck", 381 + .div = 1, 382 + .mult = 1, 383 + }; 384 + 385 + static struct ti_clk cm_96m_fck = { 386 + .name = "cm_96m_fck", 387 + .type = TI_CLK_FIXED_FACTOR, 388 + .data = &cm_96m_fck_data, 389 + }; 390 + 391 + static const char *omap_96m_fck_parents[] = { 392 + "cm_96m_fck", 393 + "sys_ck", 394 + }; 395 + 396 + static struct ti_clk_mux omap_96m_fck_data = { 397 + .bit_shift = 6, 398 + .num_parents = ARRAY_SIZE(omap_96m_fck_parents), 399 + .reg = 0xd40, 400 + .module = TI_CLKM_CM, 401 + .parents = omap_96m_fck_parents, 402 + }; 403 + 404 + static struct ti_clk omap_96m_fck = { 405 + .name = "omap_96m_fck", 406 + .type = TI_CLK_MUX, 407 + .data = &omap_96m_fck_data, 408 + }; 409 + 410 + static struct ti_clk_fixed_factor core_96m_fck_data = { 411 + .parent = "omap_96m_fck", 412 + .div = 1, 413 + .mult = 1, 414 + }; 415 + 416 + static struct ti_clk core_96m_fck = { 417 + .name = "core_96m_fck", 418 + .type = TI_CLK_FIXED_FACTOR, 419 + .data = &core_96m_fck_data, 420 + }; 421 + 422 + static struct ti_clk_gate mspro_fck_data = { 423 + .parent = "core_96m_fck", 424 + .bit_shift = 23, 425 + .reg = 0xa00, 426 + .module = TI_CLKM_CM, 427 + .flags = CLKF_WAIT, 428 + }; 429 + 430 + static struct ti_clk mspro_fck = { 431 + .name = "mspro_fck", 432 + .clkdm_name = "core_l4_clkdm", 433 + .type = TI_CLK_GATE, 434 + .data = &mspro_fck_data, 435 + }; 436 + 437 + static struct ti_clk_gate dss_ick_3430es2_data = { 438 + .parent = "l4_ick", 439 + .bit_shift = 0, 440 + .reg = 0xe10, 441 + .module = TI_CLKM_CM, 442 + .flags = CLKF_DSS | CLKF_OMAP3 | CLKF_INTERFACE, 443 + }; 444 + 445 + static struct ti_clk dss_ick_3430es2 = { 446 + .name = "dss_ick", 447 + .clkdm_name = "dss_clkdm", 448 + .type = TI_CLK_GATE, 449 + .data = &dss_ick_3430es2_data, 450 + }; 451 + 452 + static struct ti_clk_gate uart4_ick_am35xx_data = { 453 + .parent = "core_l4_ick", 454 + .bit_shift = 23, 455 + .reg = 0xa10, 456 + .module = TI_CLKM_CM, 457 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 458 + }; 459 + 460 + static struct ti_clk uart4_ick_am35xx = { 461 + .name = "uart4_ick_am35xx", 462 + .clkdm_name = "core_l4_clkdm", 463 + .type = TI_CLK_GATE, 464 + .data = &uart4_ick_am35xx_data, 465 + }; 466 + 467 + static struct ti_clk_fixed_factor security_l4_ick2_data = { 468 + .parent = "l4_ick", 469 + .div = 1, 470 + .mult = 1, 471 + }; 472 + 473 + static struct ti_clk security_l4_ick2 = { 474 + .name = "security_l4_ick2", 475 + .type = TI_CLK_FIXED_FACTOR, 476 + .data = &security_l4_ick2_data, 477 + }; 478 + 479 + static struct ti_clk_gate aes1_ick_data = { 480 + .parent = "security_l4_ick2", 481 + .bit_shift = 3, 482 + .reg = 0xa14, 483 + .module = TI_CLKM_CM, 484 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 485 + }; 486 + 487 + static struct ti_clk aes1_ick = { 488 + .name = "aes1_ick", 489 + .type = TI_CLK_GATE, 490 + .data = &aes1_ick_data, 491 + }; 492 + 493 + static const char *dpll5_ck_parents[] = { 494 + "sys_ck", 495 + "sys_ck", 496 + }; 497 + 498 + static struct ti_clk_dpll dpll5_ck_data = { 499 + .num_parents = ARRAY_SIZE(dpll5_ck_parents), 500 + .control_reg = 0xd04, 501 + .idlest_reg = 0xd24, 502 + .mult_div1_reg = 0xd4c, 503 + .autoidle_reg = 0xd34, 504 + .module = TI_CLKM_CM, 505 + .parents = dpll5_ck_parents, 506 + .freqsel_mask = 0xf0, 507 + .modes = 0x82, 508 + .div1_mask = 0x7f, 509 + .idlest_mask = 0x1, 510 + .auto_recal_bit = 0x3, 511 + .max_divider = 0x80, 512 + .min_divider = 0x1, 513 + .recal_en_bit = 0x19, 514 + .max_multiplier = 0x7ff, 515 + .enable_mask = 0x7, 516 + .mult_mask = 0x7ff00, 517 + .recal_st_bit = 0x19, 518 + .autoidle_mask = 0x7, 519 + }; 520 + 521 + static struct ti_clk dpll5_ck = { 522 + .name = "dpll5_ck", 523 + .clkdm_name = "dpll5_clkdm", 524 + .type = TI_CLK_DPLL, 525 + .data = &dpll5_ck_data, 526 + }; 527 + 528 + static struct ti_clk_divider dpll5_m2_ck_data = { 529 + .parent = "dpll5_ck", 530 + .max_div = 31, 531 + .reg = 0xd50, 532 + .module = TI_CLKM_CM, 533 + .flags = CLKF_INDEX_STARTS_AT_ONE, 534 + }; 535 + 536 + static struct ti_clk dpll5_m2_ck = { 537 + .name = "dpll5_m2_ck", 538 + .type = TI_CLK_DIVIDER, 539 + .data = &dpll5_m2_ck_data, 540 + }; 541 + 542 + static struct ti_clk_gate usbhost_120m_fck_data = { 543 + .parent = "dpll5_m2_ck", 544 + .bit_shift = 1, 545 + .reg = 0x1400, 546 + .module = TI_CLKM_CM, 547 + }; 548 + 549 + static struct ti_clk usbhost_120m_fck = { 550 + .name = "usbhost_120m_fck", 551 + .clkdm_name = "usbhost_clkdm", 552 + .type = TI_CLK_GATE, 553 + .data = &usbhost_120m_fck_data, 554 + }; 555 + 556 + static struct ti_clk_fixed_factor cm_96m_d2_fck_data = { 557 + .parent = "cm_96m_fck", 558 + .div = 2, 559 + .mult = 1, 560 + }; 561 + 562 + static struct ti_clk cm_96m_d2_fck = { 563 + .name = "cm_96m_d2_fck", 564 + .type = TI_CLK_FIXED_FACTOR, 565 + .data = &cm_96m_d2_fck_data, 566 + }; 567 + 568 + static struct ti_clk_fixed sys_altclk_data = { 569 + .frequency = 0x0, 570 + }; 571 + 572 + static struct ti_clk sys_altclk = { 573 + .name = "sys_altclk", 574 + .type = TI_CLK_FIXED, 575 + .data = &sys_altclk_data, 576 + }; 577 + 578 + static const char *omap_48m_fck_parents[] = { 579 + "cm_96m_d2_fck", 580 + "sys_altclk", 581 + }; 582 + 583 + static struct ti_clk_mux omap_48m_fck_data = { 584 + .bit_shift = 3, 585 + .num_parents = ARRAY_SIZE(omap_48m_fck_parents), 586 + .reg = 0xd40, 587 + .module = TI_CLKM_CM, 588 + .parents = omap_48m_fck_parents, 589 + }; 590 + 591 + static struct ti_clk omap_48m_fck = { 592 + .name = "omap_48m_fck", 593 + .type = TI_CLK_MUX, 594 + .data = &omap_48m_fck_data, 595 + }; 596 + 597 + static struct ti_clk_fixed_factor core_48m_fck_data = { 598 + .parent = "omap_48m_fck", 599 + .div = 1, 600 + .mult = 1, 601 + }; 602 + 603 + static struct ti_clk core_48m_fck = { 604 + .name = "core_48m_fck", 605 + .type = TI_CLK_FIXED_FACTOR, 606 + .data = &core_48m_fck_data, 607 + }; 608 + 609 + static struct ti_clk_fixed mcbsp_clks_data = { 610 + .frequency = 0x0, 611 + }; 612 + 613 + static struct ti_clk mcbsp_clks = { 614 + .name = "mcbsp_clks", 615 + .type = TI_CLK_FIXED, 616 + .data = &mcbsp_clks_data, 617 + }; 618 + 619 + static struct ti_clk_gate mcbsp2_gate_fck_data = { 620 + .parent = "mcbsp_clks", 621 + .bit_shift = 0, 622 + .reg = 0x1000, 623 + .module = TI_CLKM_CM, 624 + }; 625 + 626 + static struct ti_clk_fixed_factor per_96m_fck_data = { 627 + .parent = "omap_96m_alwon_fck", 628 + .div = 1, 629 + .mult = 1, 630 + }; 631 + 632 + static struct ti_clk per_96m_fck = { 633 + .name = "per_96m_fck", 634 + .type = TI_CLK_FIXED_FACTOR, 635 + .data = &per_96m_fck_data, 636 + }; 637 + 638 + static const char *mcbsp2_mux_fck_parents[] = { 639 + "per_96m_fck", 640 + "mcbsp_clks", 641 + }; 642 + 643 + static struct ti_clk_mux mcbsp2_mux_fck_data = { 644 + .bit_shift = 6, 645 + .num_parents = ARRAY_SIZE(mcbsp2_mux_fck_parents), 646 + .reg = 0x274, 647 + .module = TI_CLKM_SCRM, 648 + .parents = mcbsp2_mux_fck_parents, 649 + }; 650 + 651 + static struct ti_clk_composite mcbsp2_fck_data = { 652 + .mux = &mcbsp2_mux_fck_data, 653 + .gate = &mcbsp2_gate_fck_data, 654 + }; 655 + 656 + static struct ti_clk mcbsp2_fck = { 657 + .name = "mcbsp2_fck", 658 + .type = TI_CLK_COMPOSITE, 659 + .data = &mcbsp2_fck_data, 660 + }; 661 + 662 + static struct ti_clk_fixed_factor dpll3_m2x2_ck_data = { 663 + .parent = "dpll3_m2_ck", 664 + .div = 1, 665 + .mult = 2, 666 + }; 667 + 668 + static struct ti_clk dpll3_m2x2_ck = { 669 + .name = "dpll3_m2x2_ck", 670 + .type = TI_CLK_FIXED_FACTOR, 671 + .data = &dpll3_m2x2_ck_data, 672 + }; 673 + 674 + static struct ti_clk_fixed_factor corex2_fck_data = { 675 + .parent = "dpll3_m2x2_ck", 676 + .div = 1, 677 + .mult = 1, 678 + }; 679 + 680 + static struct ti_clk corex2_fck = { 681 + .name = "corex2_fck", 682 + .type = TI_CLK_FIXED_FACTOR, 683 + .data = &corex2_fck_data, 684 + }; 685 + 686 + static struct ti_clk_gate ssi_ssr_gate_fck_3430es1_data = { 687 + .parent = "corex2_fck", 688 + .bit_shift = 0, 689 + .reg = 0xa00, 690 + .module = TI_CLKM_CM, 691 + .flags = CLKF_NO_WAIT, 692 + }; 693 + 694 + static int ssi_ssr_div_fck_3430es1_divs[] = { 695 + 0, 696 + 1, 697 + 2, 698 + 3, 699 + 4, 700 + 0, 701 + 6, 702 + 0, 703 + 8, 704 + }; 705 + 706 + static struct ti_clk_divider ssi_ssr_div_fck_3430es1_data = { 707 + .num_dividers = ARRAY_SIZE(ssi_ssr_div_fck_3430es1_divs), 708 + .parent = "corex2_fck", 709 + .bit_shift = 8, 710 + .dividers = ssi_ssr_div_fck_3430es1_divs, 711 + .reg = 0xa40, 712 + .module = TI_CLKM_CM, 713 + }; 714 + 715 + static struct ti_clk_composite ssi_ssr_fck_3430es1_data = { 716 + .gate = &ssi_ssr_gate_fck_3430es1_data, 717 + .divider = &ssi_ssr_div_fck_3430es1_data, 718 + }; 719 + 720 + static struct ti_clk ssi_ssr_fck_3430es1 = { 721 + .name = "ssi_ssr_fck", 722 + .type = TI_CLK_COMPOSITE, 723 + .data = &ssi_ssr_fck_3430es1_data, 724 + }; 725 + 726 + static struct ti_clk_fixed_factor ssi_sst_fck_3430es1_data = { 727 + .parent = "ssi_ssr_fck", 728 + .div = 2, 729 + .mult = 1, 730 + }; 731 + 732 + static struct ti_clk ssi_sst_fck_3430es1 = { 733 + .name = "ssi_sst_fck", 734 + .type = TI_CLK_FIXED_FACTOR, 735 + .data = &ssi_sst_fck_3430es1_data, 736 + }; 737 + 738 + static struct ti_clk_fixed omap_32k_fck_data = { 739 + .frequency = 32768, 740 + }; 741 + 742 + static struct ti_clk omap_32k_fck = { 743 + .name = "omap_32k_fck", 744 + .type = TI_CLK_FIXED, 745 + .data = &omap_32k_fck_data, 746 + }; 747 + 748 + static struct ti_clk_fixed_factor per_32k_alwon_fck_data = { 749 + .parent = "omap_32k_fck", 750 + .div = 1, 751 + .mult = 1, 752 + }; 753 + 754 + static struct ti_clk per_32k_alwon_fck = { 755 + .name = "per_32k_alwon_fck", 756 + .type = TI_CLK_FIXED_FACTOR, 757 + .data = &per_32k_alwon_fck_data, 758 + }; 759 + 760 + static struct ti_clk_gate gpio5_dbck_data = { 761 + .parent = "per_32k_alwon_fck", 762 + .bit_shift = 16, 763 + .reg = 0x1000, 764 + .module = TI_CLKM_CM, 765 + }; 766 + 767 + static struct ti_clk gpio5_dbck = { 768 + .name = "gpio5_dbck", 769 + .clkdm_name = "per_clkdm", 770 + .type = TI_CLK_GATE, 771 + .data = &gpio5_dbck_data, 772 + }; 773 + 774 + static struct ti_clk_gate gpt1_ick_data = { 775 + .parent = "wkup_l4_ick", 776 + .bit_shift = 0, 777 + .reg = 0xc10, 778 + .module = TI_CLKM_CM, 779 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 780 + }; 781 + 782 + static struct ti_clk gpt1_ick = { 783 + .name = "gpt1_ick", 784 + .clkdm_name = "wkup_clkdm", 785 + .type = TI_CLK_GATE, 786 + .data = &gpt1_ick_data, 787 + }; 788 + 789 + static struct ti_clk_gate mcspi3_fck_data = { 790 + .parent = "core_48m_fck", 791 + .bit_shift = 20, 792 + .reg = 0xa00, 793 + .module = TI_CLKM_CM, 794 + .flags = CLKF_WAIT, 795 + }; 796 + 797 + static struct ti_clk mcspi3_fck = { 798 + .name = "mcspi3_fck", 799 + .clkdm_name = "core_l4_clkdm", 800 + .type = TI_CLK_GATE, 801 + .data = &mcspi3_fck_data, 802 + }; 803 + 804 + static struct ti_clk_gate gpt2_gate_fck_data = { 805 + .parent = "sys_ck", 806 + .bit_shift = 3, 807 + .reg = 0x1000, 808 + .module = TI_CLKM_CM, 809 + }; 810 + 811 + static const char *gpt2_mux_fck_parents[] = { 812 + "omap_32k_fck", 813 + "sys_ck", 814 + }; 815 + 816 + static struct ti_clk_mux gpt2_mux_fck_data = { 817 + .num_parents = ARRAY_SIZE(gpt2_mux_fck_parents), 818 + .reg = 0x1040, 819 + .module = TI_CLKM_CM, 820 + .parents = gpt2_mux_fck_parents, 821 + }; 822 + 823 + static struct ti_clk_composite gpt2_fck_data = { 824 + .mux = &gpt2_mux_fck_data, 825 + .gate = &gpt2_gate_fck_data, 826 + }; 827 + 828 + static struct ti_clk gpt2_fck = { 829 + .name = "gpt2_fck", 830 + .type = TI_CLK_COMPOSITE, 831 + .data = &gpt2_fck_data, 832 + }; 833 + 834 + static struct ti_clk_gate gpt10_ick_data = { 835 + .parent = "core_l4_ick", 836 + .bit_shift = 11, 837 + .reg = 0xa10, 838 + .module = TI_CLKM_CM, 839 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 840 + }; 841 + 842 + static struct ti_clk gpt10_ick = { 843 + .name = "gpt10_ick", 844 + .clkdm_name = "core_l4_clkdm", 845 + .type = TI_CLK_GATE, 846 + .data = &gpt10_ick_data, 847 + }; 848 + 849 + static struct ti_clk_gate uart2_fck_data = { 850 + .parent = "core_48m_fck", 851 + .bit_shift = 14, 852 + .reg = 0xa00, 853 + .module = TI_CLKM_CM, 854 + .flags = CLKF_WAIT, 855 + }; 856 + 857 + static struct ti_clk uart2_fck = { 858 + .name = "uart2_fck", 859 + .clkdm_name = "core_l4_clkdm", 860 + .type = TI_CLK_GATE, 861 + .data = &uart2_fck_data, 862 + }; 863 + 864 + static struct ti_clk_fixed_factor sr_l4_ick_data = { 865 + .parent = "l4_ick", 866 + .div = 1, 867 + .mult = 1, 868 + }; 869 + 870 + static struct ti_clk sr_l4_ick = { 871 + .name = "sr_l4_ick", 872 + .type = TI_CLK_FIXED_FACTOR, 873 + .data = &sr_l4_ick_data, 874 + }; 875 + 876 + static struct ti_clk_fixed_factor omap_96m_d8_fck_data = { 877 + .parent = "omap_96m_fck", 878 + .div = 8, 879 + .mult = 1, 880 + }; 881 + 882 + static struct ti_clk omap_96m_d8_fck = { 883 + .name = "omap_96m_d8_fck", 884 + .type = TI_CLK_FIXED_FACTOR, 885 + .data = &omap_96m_d8_fck_data, 886 + }; 887 + 888 + static struct ti_clk_divider dpll4_m5_ck_data = { 889 + .parent = "dpll4_ck", 890 + .max_div = 63, 891 + .reg = 0xf40, 892 + .module = TI_CLKM_CM, 893 + .flags = CLKF_INDEX_STARTS_AT_ONE, 894 + }; 895 + 896 + static struct ti_clk dpll4_m5_ck = { 897 + .name = "dpll4_m5_ck", 898 + .type = TI_CLK_DIVIDER, 899 + .data = &dpll4_m5_ck_data, 900 + }; 901 + 902 + static struct ti_clk_fixed_factor dpll4_m5x2_mul_ck_data = { 903 + .parent = "dpll4_m5_ck", 904 + .div = 1, 905 + .mult = 2, 906 + .flags = CLKF_SET_RATE_PARENT, 907 + }; 908 + 909 + static struct ti_clk dpll4_m5x2_mul_ck = { 910 + .name = "dpll4_m5x2_mul_ck", 911 + .type = TI_CLK_FIXED_FACTOR, 912 + .data = &dpll4_m5x2_mul_ck_data, 913 + }; 914 + 915 + static struct ti_clk_gate dpll4_m5x2_ck_data = { 916 + .parent = "dpll4_m5x2_mul_ck", 917 + .bit_shift = 0x1e, 918 + .reg = 0xd00, 919 + .module = TI_CLKM_CM, 920 + .flags = CLKF_SET_BIT_TO_DISABLE, 921 + }; 922 + 923 + static struct ti_clk dpll4_m5x2_ck = { 924 + .name = "dpll4_m5x2_ck", 925 + .type = TI_CLK_GATE, 926 + .data = &dpll4_m5x2_ck_data, 927 + }; 928 + 929 + static struct ti_clk_gate cam_mclk_data = { 930 + .parent = "dpll4_m5x2_ck", 931 + .bit_shift = 0, 932 + .reg = 0xf00, 933 + .module = TI_CLKM_CM, 934 + .flags = CLKF_SET_RATE_PARENT, 935 + }; 936 + 937 + static struct ti_clk cam_mclk = { 938 + .name = "cam_mclk", 939 + .type = TI_CLK_GATE, 940 + .data = &cam_mclk_data, 941 + }; 942 + 943 + static struct ti_clk_gate mcbsp3_gate_fck_data = { 944 + .parent = "mcbsp_clks", 945 + .bit_shift = 1, 946 + .reg = 0x1000, 947 + .module = TI_CLKM_CM, 948 + }; 949 + 950 + static const char *mcbsp3_mux_fck_parents[] = { 951 + "per_96m_fck", 952 + "mcbsp_clks", 953 + }; 954 + 955 + static struct ti_clk_mux mcbsp3_mux_fck_data = { 956 + .num_parents = ARRAY_SIZE(mcbsp3_mux_fck_parents), 957 + .reg = 0x2d8, 958 + .module = TI_CLKM_SCRM, 959 + .parents = mcbsp3_mux_fck_parents, 960 + }; 961 + 962 + static struct ti_clk_composite mcbsp3_fck_data = { 963 + .mux = &mcbsp3_mux_fck_data, 964 + .gate = &mcbsp3_gate_fck_data, 965 + }; 966 + 967 + static struct ti_clk mcbsp3_fck = { 968 + .name = "mcbsp3_fck", 969 + .type = TI_CLK_COMPOSITE, 970 + .data = &mcbsp3_fck_data, 971 + }; 972 + 973 + static struct ti_clk_gate csi2_96m_fck_data = { 974 + .parent = "core_96m_fck", 975 + .bit_shift = 1, 976 + .reg = 0xf00, 977 + .module = TI_CLKM_CM, 978 + }; 979 + 980 + static struct ti_clk csi2_96m_fck = { 981 + .name = "csi2_96m_fck", 982 + .clkdm_name = "cam_clkdm", 983 + .type = TI_CLK_GATE, 984 + .data = &csi2_96m_fck_data, 985 + }; 986 + 987 + static struct ti_clk_gate gpt9_gate_fck_data = { 988 + .parent = "sys_ck", 989 + .bit_shift = 10, 990 + .reg = 0x1000, 991 + .module = TI_CLKM_CM, 992 + }; 993 + 994 + static const char *gpt9_mux_fck_parents[] = { 995 + "omap_32k_fck", 996 + "sys_ck", 997 + }; 998 + 999 + static struct ti_clk_mux gpt9_mux_fck_data = { 1000 + .bit_shift = 7, 1001 + .num_parents = ARRAY_SIZE(gpt9_mux_fck_parents), 1002 + .reg = 0x1040, 1003 + .module = TI_CLKM_CM, 1004 + .parents = gpt9_mux_fck_parents, 1005 + }; 1006 + 1007 + static struct ti_clk_composite gpt9_fck_data = { 1008 + .mux = &gpt9_mux_fck_data, 1009 + .gate = &gpt9_gate_fck_data, 1010 + }; 1011 + 1012 + static struct ti_clk gpt9_fck = { 1013 + .name = "gpt9_fck", 1014 + .type = TI_CLK_COMPOSITE, 1015 + .data = &gpt9_fck_data, 1016 + }; 1017 + 1018 + static struct ti_clk_divider dpll3_m3_ck_data = { 1019 + .parent = "dpll3_ck", 1020 + .bit_shift = 16, 1021 + .max_div = 31, 1022 + .reg = 0x1140, 1023 + .module = TI_CLKM_CM, 1024 + .flags = CLKF_INDEX_STARTS_AT_ONE, 1025 + }; 1026 + 1027 + static struct ti_clk dpll3_m3_ck = { 1028 + .name = "dpll3_m3_ck", 1029 + .type = TI_CLK_DIVIDER, 1030 + .data = &dpll3_m3_ck_data, 1031 + }; 1032 + 1033 + static struct ti_clk_fixed_factor dpll3_m3x2_mul_ck_data = { 1034 + .parent = "dpll3_m3_ck", 1035 + .div = 1, 1036 + .mult = 2, 1037 + }; 1038 + 1039 + static struct ti_clk dpll3_m3x2_mul_ck = { 1040 + .name = "dpll3_m3x2_mul_ck", 1041 + .type = TI_CLK_FIXED_FACTOR, 1042 + .data = &dpll3_m3x2_mul_ck_data, 1043 + }; 1044 + 1045 + static struct ti_clk_gate sr2_fck_data = { 1046 + .parent = "sys_ck", 1047 + .bit_shift = 7, 1048 + .reg = 0xc00, 1049 + .module = TI_CLKM_CM, 1050 + .flags = CLKF_WAIT, 1051 + }; 1052 + 1053 + static struct ti_clk sr2_fck = { 1054 + .name = "sr2_fck", 1055 + .clkdm_name = "wkup_clkdm", 1056 + .type = TI_CLK_GATE, 1057 + .data = &sr2_fck_data, 1058 + }; 1059 + 1060 + static struct ti_clk_fixed pclk_ck_data = { 1061 + .frequency = 27000000, 1062 + }; 1063 + 1064 + static struct ti_clk pclk_ck = { 1065 + .name = "pclk_ck", 1066 + .type = TI_CLK_FIXED, 1067 + .data = &pclk_ck_data, 1068 + }; 1069 + 1070 + static struct ti_clk_gate wdt2_ick_data = { 1071 + .parent = "wkup_l4_ick", 1072 + .bit_shift = 5, 1073 + .reg = 0xc10, 1074 + .module = TI_CLKM_CM, 1075 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 1076 + }; 1077 + 1078 + static struct ti_clk wdt2_ick = { 1079 + .name = "wdt2_ick", 1080 + .clkdm_name = "wkup_clkdm", 1081 + .type = TI_CLK_GATE, 1082 + .data = &wdt2_ick_data, 1083 + }; 1084 + 1085 + static struct ti_clk_fixed_factor core_l3_ick_data = { 1086 + .parent = "l3_ick", 1087 + .div = 1, 1088 + .mult = 1, 1089 + }; 1090 + 1091 + static struct ti_clk core_l3_ick = { 1092 + .name = "core_l3_ick", 1093 + .type = TI_CLK_FIXED_FACTOR, 1094 + .data = &core_l3_ick_data, 1095 + }; 1096 + 1097 + static struct ti_clk_gate mcspi4_fck_data = { 1098 + .parent = "core_48m_fck", 1099 + .bit_shift = 21, 1100 + .reg = 0xa00, 1101 + .module = TI_CLKM_CM, 1102 + .flags = CLKF_WAIT, 1103 + }; 1104 + 1105 + static struct ti_clk mcspi4_fck = { 1106 + .name = "mcspi4_fck", 1107 + .clkdm_name = "core_l4_clkdm", 1108 + .type = TI_CLK_GATE, 1109 + .data = &mcspi4_fck_data, 1110 + }; 1111 + 1112 + static struct ti_clk_fixed_factor per_48m_fck_data = { 1113 + .parent = "omap_48m_fck", 1114 + .div = 1, 1115 + .mult = 1, 1116 + }; 1117 + 1118 + static struct ti_clk per_48m_fck = { 1119 + .name = "per_48m_fck", 1120 + .type = TI_CLK_FIXED_FACTOR, 1121 + .data = &per_48m_fck_data, 1122 + }; 1123 + 1124 + static struct ti_clk_gate uart4_fck_data = { 1125 + .parent = "per_48m_fck", 1126 + .bit_shift = 18, 1127 + .reg = 0x1000, 1128 + .module = TI_CLKM_CM, 1129 + .flags = CLKF_WAIT, 1130 + }; 1131 + 1132 + static struct ti_clk uart4_fck = { 1133 + .name = "uart4_fck", 1134 + .clkdm_name = "per_clkdm", 1135 + .type = TI_CLK_GATE, 1136 + .data = &uart4_fck_data, 1137 + }; 1138 + 1139 + static struct ti_clk_fixed_factor omap_96m_d10_fck_data = { 1140 + .parent = "omap_96m_fck", 1141 + .div = 10, 1142 + .mult = 1, 1143 + }; 1144 + 1145 + static struct ti_clk omap_96m_d10_fck = { 1146 + .name = "omap_96m_d10_fck", 1147 + .type = TI_CLK_FIXED_FACTOR, 1148 + .data = &omap_96m_d10_fck_data, 1149 + }; 1150 + 1151 + static struct ti_clk_gate usim_gate_fck_data = { 1152 + .parent = "omap_96m_fck", 1153 + .bit_shift = 9, 1154 + .reg = 0xc00, 1155 + .module = TI_CLKM_CM, 1156 + }; 1157 + 1158 + static struct ti_clk_fixed_factor per_l4_ick_data = { 1159 + .parent = "l4_ick", 1160 + .div = 1, 1161 + .mult = 1, 1162 + }; 1163 + 1164 + static struct ti_clk per_l4_ick = { 1165 + .name = "per_l4_ick", 1166 + .type = TI_CLK_FIXED_FACTOR, 1167 + .data = &per_l4_ick_data, 1168 + }; 1169 + 1170 + static struct ti_clk_gate gpt5_ick_data = { 1171 + .parent = "per_l4_ick", 1172 + .bit_shift = 6, 1173 + .reg = 0x1010, 1174 + .module = TI_CLKM_CM, 1175 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 1176 + }; 1177 + 1178 + static struct ti_clk gpt5_ick = { 1179 + .name = "gpt5_ick", 1180 + .clkdm_name = "per_clkdm", 1181 + .type = TI_CLK_GATE, 1182 + .data = &gpt5_ick_data, 1183 + }; 1184 + 1185 + static struct ti_clk_gate mcspi2_ick_data = { 1186 + .parent = "core_l4_ick", 1187 + .bit_shift = 19, 1188 + .reg = 0xa10, 1189 + .module = TI_CLKM_CM, 1190 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 1191 + }; 1192 + 1193 + static struct ti_clk mcspi2_ick = { 1194 + .name = "mcspi2_ick", 1195 + .clkdm_name = "core_l4_clkdm", 1196 + .type = TI_CLK_GATE, 1197 + .data = &mcspi2_ick_data, 1198 + }; 1199 + 1200 + static struct ti_clk_fixed_factor ssi_l4_ick_data = { 1201 + .parent = "l4_ick", 1202 + .div = 1, 1203 + .mult = 1, 1204 + }; 1205 + 1206 + static struct ti_clk ssi_l4_ick = { 1207 + .name = "ssi_l4_ick", 1208 + .clkdm_name = "core_l4_clkdm", 1209 + .type = TI_CLK_FIXED_FACTOR, 1210 + .data = &ssi_l4_ick_data, 1211 + }; 1212 + 1213 + static struct ti_clk_gate ssi_ick_3430es1_data = { 1214 + .parent = "ssi_l4_ick", 1215 + .bit_shift = 0, 1216 + .reg = 0xa10, 1217 + .module = TI_CLKM_CM, 1218 + .flags = CLKF_OMAP3 | CLKF_NO_WAIT | CLKF_INTERFACE, 1219 + }; 1220 + 1221 + static struct ti_clk ssi_ick_3430es1 = { 1222 + .name = "ssi_ick", 1223 + .clkdm_name = "core_l4_clkdm", 1224 + .type = TI_CLK_GATE, 1225 + .data = &ssi_ick_3430es1_data, 1226 + }; 1227 + 1228 + static struct ti_clk_gate i2c2_fck_data = { 1229 + .parent = "core_96m_fck", 1230 + .bit_shift = 16, 1231 + .reg = 0xa00, 1232 + .module = TI_CLKM_CM, 1233 + .flags = CLKF_WAIT, 1234 + }; 1235 + 1236 + static struct ti_clk i2c2_fck = { 1237 + .name = "i2c2_fck", 1238 + .clkdm_name = "core_l4_clkdm", 1239 + .type = TI_CLK_GATE, 1240 + .data = &i2c2_fck_data, 1241 + }; 1242 + 1243 + static struct ti_clk_divider dpll1_fck_data = { 1244 + .parent = "core_ck", 1245 + .bit_shift = 19, 1246 + .max_div = 7, 1247 + .reg = 0x940, 1248 + .module = TI_CLKM_CM, 1249 + .flags = CLKF_INDEX_STARTS_AT_ONE, 1250 + }; 1251 + 1252 + static struct ti_clk dpll1_fck = { 1253 + .name = "dpll1_fck", 1254 + .type = TI_CLK_DIVIDER, 1255 + .data = &dpll1_fck_data, 1256 + }; 1257 + 1258 + static const char *dpll1_ck_parents[] = { 1259 + "sys_ck", 1260 + "dpll1_fck", 1261 + }; 1262 + 1263 + static struct ti_clk_dpll dpll1_ck_data = { 1264 + .num_parents = ARRAY_SIZE(dpll1_ck_parents), 1265 + .control_reg = 0x904, 1266 + .idlest_reg = 0x924, 1267 + .mult_div1_reg = 0x940, 1268 + .autoidle_reg = 0x934, 1269 + .module = TI_CLKM_CM, 1270 + .parents = dpll1_ck_parents, 1271 + .freqsel_mask = 0xf0, 1272 + .modes = 0xa0, 1273 + .div1_mask = 0x7f, 1274 + .idlest_mask = 0x1, 1275 + .auto_recal_bit = 0x3, 1276 + .max_divider = 0x80, 1277 + .min_divider = 0x1, 1278 + .recal_en_bit = 0x7, 1279 + .max_multiplier = 0x7ff, 1280 + .enable_mask = 0x7, 1281 + .mult_mask = 0x7ff00, 1282 + .recal_st_bit = 0x7, 1283 + .autoidle_mask = 0x7, 1284 + }; 1285 + 1286 + static struct ti_clk dpll1_ck = { 1287 + .name = "dpll1_ck", 1288 + .clkdm_name = "dpll1_clkdm", 1289 + .type = TI_CLK_DPLL, 1290 + .data = &dpll1_ck_data, 1291 + }; 1292 + 1293 + static struct ti_clk_fixed secure_32k_fck_data = { 1294 + .frequency = 32768, 1295 + }; 1296 + 1297 + static struct ti_clk secure_32k_fck = { 1298 + .name = "secure_32k_fck", 1299 + .type = TI_CLK_FIXED, 1300 + .data = &secure_32k_fck_data, 1301 + }; 1302 + 1303 + static struct ti_clk_gate gpio5_ick_data = { 1304 + .parent = "per_l4_ick", 1305 + .bit_shift = 16, 1306 + .reg = 0x1010, 1307 + .module = TI_CLKM_CM, 1308 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 1309 + }; 1310 + 1311 + static struct ti_clk gpio5_ick = { 1312 + .name = "gpio5_ick", 1313 + .clkdm_name = "per_clkdm", 1314 + .type = TI_CLK_GATE, 1315 + .data = &gpio5_ick_data, 1316 + }; 1317 + 1318 + static struct ti_clk_divider dpll4_m4_ck_data = { 1319 + .parent = "dpll4_ck", 1320 + .max_div = 32, 1321 + .reg = 0xe40, 1322 + .module = TI_CLKM_CM, 1323 + .flags = CLKF_INDEX_STARTS_AT_ONE, 1324 + }; 1325 + 1326 + static struct ti_clk dpll4_m4_ck = { 1327 + .name = "dpll4_m4_ck", 1328 + .type = TI_CLK_DIVIDER, 1329 + .data = &dpll4_m4_ck_data, 1330 + }; 1331 + 1332 + static struct ti_clk_fixed_factor dpll4_m4x2_mul_ck_data = { 1333 + .parent = "dpll4_m4_ck", 1334 + .div = 1, 1335 + .mult = 2, 1336 + .flags = CLKF_SET_RATE_PARENT, 1337 + }; 1338 + 1339 + static struct ti_clk dpll4_m4x2_mul_ck = { 1340 + .name = "dpll4_m4x2_mul_ck", 1341 + .type = TI_CLK_FIXED_FACTOR, 1342 + .data = &dpll4_m4x2_mul_ck_data, 1343 + }; 1344 + 1345 + static struct ti_clk_gate dpll4_m4x2_ck_data = { 1346 + .parent = "dpll4_m4x2_mul_ck", 1347 + .bit_shift = 0x1d, 1348 + .reg = 0xd00, 1349 + .module = TI_CLKM_CM, 1350 + .flags = CLKF_SET_RATE_PARENT | CLKF_SET_BIT_TO_DISABLE, 1351 + }; 1352 + 1353 + static struct ti_clk dpll4_m4x2_ck = { 1354 + .name = "dpll4_m4x2_ck", 1355 + .type = TI_CLK_GATE, 1356 + .data = &dpll4_m4x2_ck_data, 1357 + }; 1358 + 1359 + static struct ti_clk_gate dss1_alwon_fck_3430es2_data = { 1360 + .parent = "dpll4_m4x2_ck", 1361 + .bit_shift = 0, 1362 + .reg = 0xe00, 1363 + .module = TI_CLKM_CM, 1364 + .flags = CLKF_DSS | CLKF_SET_RATE_PARENT, 1365 + }; 1366 + 1367 + static struct ti_clk dss1_alwon_fck_3430es2 = { 1368 + .name = "dss1_alwon_fck", 1369 + .clkdm_name = "dss_clkdm", 1370 + .type = TI_CLK_GATE, 1371 + .data = &dss1_alwon_fck_3430es2_data, 1372 + }; 1373 + 1374 + static struct ti_clk_gate uart3_ick_data = { 1375 + .parent = "per_l4_ick", 1376 + .bit_shift = 11, 1377 + .reg = 0x1010, 1378 + .module = TI_CLKM_CM, 1379 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 1380 + }; 1381 + 1382 + static struct ti_clk uart3_ick = { 1383 + .name = "uart3_ick", 1384 + .clkdm_name = "per_clkdm", 1385 + .type = TI_CLK_GATE, 1386 + .data = &uart3_ick_data, 1387 + }; 1388 + 1389 + static struct ti_clk_divider dpll4_m3_ck_data = { 1390 + .parent = "dpll4_ck", 1391 + .bit_shift = 8, 1392 + .max_div = 32, 1393 + .reg = 0xe40, 1394 + .module = TI_CLKM_CM, 1395 + .flags = CLKF_INDEX_STARTS_AT_ONE, 1396 + }; 1397 + 1398 + static struct ti_clk dpll4_m3_ck = { 1399 + .name = "dpll4_m3_ck", 1400 + .type = TI_CLK_DIVIDER, 1401 + .data = &dpll4_m3_ck_data, 1402 + }; 1403 + 1404 + static struct ti_clk_gate mcbsp3_ick_data = { 1405 + .parent = "per_l4_ick", 1406 + .bit_shift = 1, 1407 + .reg = 0x1010, 1408 + .module = TI_CLKM_CM, 1409 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 1410 + }; 1411 + 1412 + static struct ti_clk mcbsp3_ick = { 1413 + .name = "mcbsp3_ick", 1414 + .clkdm_name = "per_clkdm", 1415 + .type = TI_CLK_GATE, 1416 + .data = &mcbsp3_ick_data, 1417 + }; 1418 + 1419 + static struct ti_clk_gate gpio3_dbck_data = { 1420 + .parent = "per_32k_alwon_fck", 1421 + .bit_shift = 14, 1422 + .reg = 0x1000, 1423 + .module = TI_CLKM_CM, 1424 + }; 1425 + 1426 + static struct ti_clk gpio3_dbck = { 1427 + .name = "gpio3_dbck", 1428 + .clkdm_name = "per_clkdm", 1429 + .type = TI_CLK_GATE, 1430 + .data = &gpio3_dbck_data, 1431 + }; 1432 + 1433 + static struct ti_clk_gate fac_ick_data = { 1434 + .parent = "core_l4_ick", 1435 + .bit_shift = 8, 1436 + .reg = 0xa10, 1437 + .module = TI_CLKM_CM, 1438 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 1439 + }; 1440 + 1441 + static struct ti_clk fac_ick = { 1442 + .name = "fac_ick", 1443 + .clkdm_name = "core_l4_clkdm", 1444 + .type = TI_CLK_GATE, 1445 + .data = &fac_ick_data, 1446 + }; 1447 + 1448 + static struct ti_clk_gate clkout2_src_gate_ck_data = { 1449 + .parent = "core_ck", 1450 + .bit_shift = 7, 1451 + .reg = 0xd70, 1452 + .module = TI_CLKM_CM, 1453 + .flags = CLKF_NO_WAIT, 1454 + }; 1455 + 1456 + static struct ti_clk_fixed_factor dpll4_m3x2_mul_ck_data = { 1457 + .parent = "dpll4_m3_ck", 1458 + .div = 1, 1459 + .mult = 2, 1460 + }; 1461 + 1462 + static struct ti_clk dpll4_m3x2_mul_ck = { 1463 + .name = "dpll4_m3x2_mul_ck", 1464 + .type = TI_CLK_FIXED_FACTOR, 1465 + .data = &dpll4_m3x2_mul_ck_data, 1466 + }; 1467 + 1468 + static struct ti_clk_gate dpll4_m3x2_ck_data = { 1469 + .parent = "dpll4_m3x2_mul_ck", 1470 + .bit_shift = 0x1c, 1471 + .reg = 0xd00, 1472 + .module = TI_CLKM_CM, 1473 + .flags = CLKF_SET_BIT_TO_DISABLE, 1474 + }; 1475 + 1476 + static struct ti_clk dpll4_m3x2_ck = { 1477 + .name = "dpll4_m3x2_ck", 1478 + .type = TI_CLK_GATE, 1479 + .data = &dpll4_m3x2_ck_data, 1480 + }; 1481 + 1482 + static const char *omap_54m_fck_parents[] = { 1483 + "dpll4_m3x2_ck", 1484 + "sys_altclk", 1485 + }; 1486 + 1487 + static struct ti_clk_mux omap_54m_fck_data = { 1488 + .bit_shift = 5, 1489 + .num_parents = ARRAY_SIZE(omap_54m_fck_parents), 1490 + .reg = 0xd40, 1491 + .module = TI_CLKM_CM, 1492 + .parents = omap_54m_fck_parents, 1493 + }; 1494 + 1495 + static struct ti_clk omap_54m_fck = { 1496 + .name = "omap_54m_fck", 1497 + .type = TI_CLK_MUX, 1498 + .data = &omap_54m_fck_data, 1499 + }; 1500 + 1501 + static const char *clkout2_src_mux_ck_parents[] = { 1502 + "core_ck", 1503 + "sys_ck", 1504 + "cm_96m_fck", 1505 + "omap_54m_fck", 1506 + }; 1507 + 1508 + static struct ti_clk_mux clkout2_src_mux_ck_data = { 1509 + .num_parents = ARRAY_SIZE(clkout2_src_mux_ck_parents), 1510 + .reg = 0xd70, 1511 + .module = TI_CLKM_CM, 1512 + .parents = clkout2_src_mux_ck_parents, 1513 + }; 1514 + 1515 + static struct ti_clk_composite clkout2_src_ck_data = { 1516 + .mux = &clkout2_src_mux_ck_data, 1517 + .gate = &clkout2_src_gate_ck_data, 1518 + }; 1519 + 1520 + static struct ti_clk clkout2_src_ck = { 1521 + .name = "clkout2_src_ck", 1522 + .type = TI_CLK_COMPOSITE, 1523 + .data = &clkout2_src_ck_data, 1524 + }; 1525 + 1526 + static struct ti_clk_gate i2c1_fck_data = { 1527 + .parent = "core_96m_fck", 1528 + .bit_shift = 15, 1529 + .reg = 0xa00, 1530 + .module = TI_CLKM_CM, 1531 + .flags = CLKF_WAIT, 1532 + }; 1533 + 1534 + static struct ti_clk i2c1_fck = { 1535 + .name = "i2c1_fck", 1536 + .clkdm_name = "core_l4_clkdm", 1537 + .type = TI_CLK_GATE, 1538 + .data = &i2c1_fck_data, 1539 + }; 1540 + 1541 + static struct ti_clk_gate wdt3_fck_data = { 1542 + .parent = "per_32k_alwon_fck", 1543 + .bit_shift = 12, 1544 + .reg = 0x1000, 1545 + .module = TI_CLKM_CM, 1546 + .flags = CLKF_WAIT, 1547 + }; 1548 + 1549 + static struct ti_clk wdt3_fck = { 1550 + .name = "wdt3_fck", 1551 + .clkdm_name = "per_clkdm", 1552 + .type = TI_CLK_GATE, 1553 + .data = &wdt3_fck_data, 1554 + }; 1555 + 1556 + static struct ti_clk_gate gpt7_gate_fck_data = { 1557 + .parent = "sys_ck", 1558 + .bit_shift = 8, 1559 + .reg = 0x1000, 1560 + .module = TI_CLKM_CM, 1561 + }; 1562 + 1563 + static const char *gpt7_mux_fck_parents[] = { 1564 + "omap_32k_fck", 1565 + "sys_ck", 1566 + }; 1567 + 1568 + static struct ti_clk_mux gpt7_mux_fck_data = { 1569 + .bit_shift = 5, 1570 + .num_parents = ARRAY_SIZE(gpt7_mux_fck_parents), 1571 + .reg = 0x1040, 1572 + .module = TI_CLKM_CM, 1573 + .parents = gpt7_mux_fck_parents, 1574 + }; 1575 + 1576 + static struct ti_clk_composite gpt7_fck_data = { 1577 + .mux = &gpt7_mux_fck_data, 1578 + .gate = &gpt7_gate_fck_data, 1579 + }; 1580 + 1581 + static struct ti_clk gpt7_fck = { 1582 + .name = "gpt7_fck", 1583 + .type = TI_CLK_COMPOSITE, 1584 + .data = &gpt7_fck_data, 1585 + }; 1586 + 1587 + static struct ti_clk_gate usb_l4_gate_ick_data = { 1588 + .parent = "l4_ick", 1589 + .bit_shift = 5, 1590 + .reg = 0xa10, 1591 + .module = TI_CLKM_CM, 1592 + .flags = CLKF_INTERFACE, 1593 + }; 1594 + 1595 + static struct ti_clk_divider usb_l4_div_ick_data = { 1596 + .parent = "l4_ick", 1597 + .bit_shift = 4, 1598 + .max_div = 1, 1599 + .reg = 0xa40, 1600 + .module = TI_CLKM_CM, 1601 + .flags = CLKF_INDEX_STARTS_AT_ONE, 1602 + }; 1603 + 1604 + static struct ti_clk_composite usb_l4_ick_data = { 1605 + .gate = &usb_l4_gate_ick_data, 1606 + .divider = &usb_l4_div_ick_data, 1607 + }; 1608 + 1609 + static struct ti_clk usb_l4_ick = { 1610 + .name = "usb_l4_ick", 1611 + .type = TI_CLK_COMPOSITE, 1612 + .data = &usb_l4_ick_data, 1613 + }; 1614 + 1615 + static struct ti_clk_gate uart4_ick_data = { 1616 + .parent = "per_l4_ick", 1617 + .bit_shift = 18, 1618 + .reg = 0x1010, 1619 + .module = TI_CLKM_CM, 1620 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 1621 + }; 1622 + 1623 + static struct ti_clk uart4_ick = { 1624 + .name = "uart4_ick", 1625 + .clkdm_name = "per_clkdm", 1626 + .type = TI_CLK_GATE, 1627 + .data = &uart4_ick_data, 1628 + }; 1629 + 1630 + static struct ti_clk_fixed dummy_ck_data = { 1631 + .frequency = 0, 1632 + }; 1633 + 1634 + static struct ti_clk dummy_ck = { 1635 + .name = "dummy_ck", 1636 + .type = TI_CLK_FIXED, 1637 + .data = &dummy_ck_data, 1638 + }; 1639 + 1640 + static const char *gpt3_mux_fck_parents[] = { 1641 + "omap_32k_fck", 1642 + "sys_ck", 1643 + }; 1644 + 1645 + static struct ti_clk_mux gpt3_mux_fck_data = { 1646 + .bit_shift = 1, 1647 + .num_parents = ARRAY_SIZE(gpt3_mux_fck_parents), 1648 + .reg = 0x1040, 1649 + .module = TI_CLKM_CM, 1650 + .parents = gpt3_mux_fck_parents, 1651 + }; 1652 + 1653 + static struct ti_clk_gate gpt9_ick_data = { 1654 + .parent = "per_l4_ick", 1655 + .bit_shift = 10, 1656 + .reg = 0x1010, 1657 + .module = TI_CLKM_CM, 1658 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 1659 + }; 1660 + 1661 + static struct ti_clk gpt9_ick = { 1662 + .name = "gpt9_ick", 1663 + .clkdm_name = "per_clkdm", 1664 + .type = TI_CLK_GATE, 1665 + .data = &gpt9_ick_data, 1666 + }; 1667 + 1668 + static struct ti_clk_gate gpt10_gate_fck_data = { 1669 + .parent = "sys_ck", 1670 + .bit_shift = 11, 1671 + .reg = 0xa00, 1672 + .module = TI_CLKM_CM, 1673 + }; 1674 + 1675 + static struct ti_clk_gate dss_ick_3430es1_data = { 1676 + .parent = "l4_ick", 1677 + .bit_shift = 0, 1678 + .reg = 0xe10, 1679 + .module = TI_CLKM_CM, 1680 + .flags = CLKF_OMAP3 | CLKF_NO_WAIT | CLKF_INTERFACE, 1681 + }; 1682 + 1683 + static struct ti_clk dss_ick_3430es1 = { 1684 + .name = "dss_ick", 1685 + .clkdm_name = "dss_clkdm", 1686 + .type = TI_CLK_GATE, 1687 + .data = &dss_ick_3430es1_data, 1688 + }; 1689 + 1690 + static struct ti_clk_gate gpt11_ick_data = { 1691 + .parent = "core_l4_ick", 1692 + .bit_shift = 12, 1693 + .reg = 0xa10, 1694 + .module = TI_CLKM_CM, 1695 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 1696 + }; 1697 + 1698 + static struct ti_clk gpt11_ick = { 1699 + .name = "gpt11_ick", 1700 + .clkdm_name = "core_l4_clkdm", 1701 + .type = TI_CLK_GATE, 1702 + .data = &gpt11_ick_data, 1703 + }; 1704 + 1705 + static struct ti_clk_divider dpll2_fck_data = { 1706 + .parent = "core_ck", 1707 + .bit_shift = 19, 1708 + .max_div = 7, 1709 + .reg = 0x40, 1710 + .module = TI_CLKM_CM, 1711 + .flags = CLKF_INDEX_STARTS_AT_ONE, 1712 + }; 1713 + 1714 + static struct ti_clk dpll2_fck = { 1715 + .name = "dpll2_fck", 1716 + .type = TI_CLK_DIVIDER, 1717 + .data = &dpll2_fck_data, 1718 + }; 1719 + 1720 + static struct ti_clk_gate uart1_fck_data = { 1721 + .parent = "core_48m_fck", 1722 + .bit_shift = 13, 1723 + .reg = 0xa00, 1724 + .module = TI_CLKM_CM, 1725 + .flags = CLKF_WAIT, 1726 + }; 1727 + 1728 + static struct ti_clk uart1_fck = { 1729 + .name = "uart1_fck", 1730 + .clkdm_name = "core_l4_clkdm", 1731 + .type = TI_CLK_GATE, 1732 + .data = &uart1_fck_data, 1733 + }; 1734 + 1735 + static struct ti_clk_gate hsotgusb_ick_3430es1_data = { 1736 + .parent = "core_l3_ick", 1737 + .bit_shift = 4, 1738 + .reg = 0xa10, 1739 + .module = TI_CLKM_CM, 1740 + .flags = CLKF_OMAP3 | CLKF_NO_WAIT | CLKF_INTERFACE, 1741 + }; 1742 + 1743 + static struct ti_clk hsotgusb_ick_3430es1 = { 1744 + .name = "hsotgusb_ick_3430es1", 1745 + .clkdm_name = "core_l3_clkdm", 1746 + .type = TI_CLK_GATE, 1747 + .data = &hsotgusb_ick_3430es1_data, 1748 + }; 1749 + 1750 + static struct ti_clk_gate gpio2_ick_data = { 1751 + .parent = "per_l4_ick", 1752 + .bit_shift = 13, 1753 + .reg = 0x1010, 1754 + .module = TI_CLKM_CM, 1755 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 1756 + }; 1757 + 1758 + static struct ti_clk gpio2_ick = { 1759 + .name = "gpio2_ick", 1760 + .clkdm_name = "per_clkdm", 1761 + .type = TI_CLK_GATE, 1762 + .data = &gpio2_ick_data, 1763 + }; 1764 + 1765 + static struct ti_clk_gate mmchs1_ick_data = { 1766 + .parent = "core_l4_ick", 1767 + .bit_shift = 24, 1768 + .reg = 0xa10, 1769 + .module = TI_CLKM_CM, 1770 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 1771 + }; 1772 + 1773 + static struct ti_clk mmchs1_ick = { 1774 + .name = "mmchs1_ick", 1775 + .clkdm_name = "core_l4_clkdm", 1776 + .type = TI_CLK_GATE, 1777 + .data = &mmchs1_ick_data, 1778 + }; 1779 + 1780 + static struct ti_clk_gate modem_fck_data = { 1781 + .parent = "sys_ck", 1782 + .bit_shift = 31, 1783 + .reg = 0xa00, 1784 + .module = TI_CLKM_CM, 1785 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 1786 + }; 1787 + 1788 + static struct ti_clk modem_fck = { 1789 + .name = "modem_fck", 1790 + .clkdm_name = "d2d_clkdm", 1791 + .type = TI_CLK_GATE, 1792 + .data = &modem_fck_data, 1793 + }; 1794 + 1795 + static struct ti_clk_gate mcbsp4_ick_data = { 1796 + .parent = "per_l4_ick", 1797 + .bit_shift = 2, 1798 + .reg = 0x1010, 1799 + .module = TI_CLKM_CM, 1800 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 1801 + }; 1802 + 1803 + static struct ti_clk mcbsp4_ick = { 1804 + .name = "mcbsp4_ick", 1805 + .clkdm_name = "per_clkdm", 1806 + .type = TI_CLK_GATE, 1807 + .data = &mcbsp4_ick_data, 1808 + }; 1809 + 1810 + static struct ti_clk_gate gpio1_ick_data = { 1811 + .parent = "wkup_l4_ick", 1812 + .bit_shift = 3, 1813 + .reg = 0xc10, 1814 + .module = TI_CLKM_CM, 1815 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 1816 + }; 1817 + 1818 + static struct ti_clk gpio1_ick = { 1819 + .name = "gpio1_ick", 1820 + .clkdm_name = "wkup_clkdm", 1821 + .type = TI_CLK_GATE, 1822 + .data = &gpio1_ick_data, 1823 + }; 1824 + 1825 + static const char *gpt6_mux_fck_parents[] = { 1826 + "omap_32k_fck", 1827 + "sys_ck", 1828 + }; 1829 + 1830 + static struct ti_clk_mux gpt6_mux_fck_data = { 1831 + .bit_shift = 4, 1832 + .num_parents = ARRAY_SIZE(gpt6_mux_fck_parents), 1833 + .reg = 0x1040, 1834 + .module = TI_CLKM_CM, 1835 + .parents = gpt6_mux_fck_parents, 1836 + }; 1837 + 1838 + static struct ti_clk_fixed_factor dpll1_x2_ck_data = { 1839 + .parent = "dpll1_ck", 1840 + .div = 1, 1841 + .mult = 2, 1842 + }; 1843 + 1844 + static struct ti_clk dpll1_x2_ck = { 1845 + .name = "dpll1_x2_ck", 1846 + .type = TI_CLK_FIXED_FACTOR, 1847 + .data = &dpll1_x2_ck_data, 1848 + }; 1849 + 1850 + static struct ti_clk_divider dpll1_x2m2_ck_data = { 1851 + .parent = "dpll1_x2_ck", 1852 + .max_div = 31, 1853 + .reg = 0x944, 1854 + .module = TI_CLKM_CM, 1855 + .flags = CLKF_INDEX_STARTS_AT_ONE, 1856 + }; 1857 + 1858 + static struct ti_clk dpll1_x2m2_ck = { 1859 + .name = "dpll1_x2m2_ck", 1860 + .type = TI_CLK_DIVIDER, 1861 + .data = &dpll1_x2m2_ck_data, 1862 + }; 1863 + 1864 + static struct ti_clk_fixed_factor mpu_ck_data = { 1865 + .parent = "dpll1_x2m2_ck", 1866 + .div = 1, 1867 + .mult = 1, 1868 + }; 1869 + 1870 + static struct ti_clk mpu_ck = { 1871 + .name = "mpu_ck", 1872 + .type = TI_CLK_FIXED_FACTOR, 1873 + .data = &mpu_ck_data, 1874 + }; 1875 + 1876 + static struct ti_clk_divider arm_fck_data = { 1877 + .parent = "mpu_ck", 1878 + .max_div = 2, 1879 + .reg = 0x924, 1880 + .module = TI_CLKM_CM, 1881 + }; 1882 + 1883 + static struct ti_clk arm_fck = { 1884 + .name = "arm_fck", 1885 + .type = TI_CLK_DIVIDER, 1886 + .data = &arm_fck_data, 1887 + }; 1888 + 1889 + static struct ti_clk_fixed_factor core_d3_ck_data = { 1890 + .parent = "core_ck", 1891 + .div = 3, 1892 + .mult = 1, 1893 + }; 1894 + 1895 + static struct ti_clk core_d3_ck = { 1896 + .name = "core_d3_ck", 1897 + .type = TI_CLK_FIXED_FACTOR, 1898 + .data = &core_d3_ck_data, 1899 + }; 1900 + 1901 + static struct ti_clk_gate gpt11_gate_fck_data = { 1902 + .parent = "sys_ck", 1903 + .bit_shift = 12, 1904 + .reg = 0xa00, 1905 + .module = TI_CLKM_CM, 1906 + }; 1907 + 1908 + static const char *gpt11_mux_fck_parents[] = { 1909 + "omap_32k_fck", 1910 + "sys_ck", 1911 + }; 1912 + 1913 + static struct ti_clk_mux gpt11_mux_fck_data = { 1914 + .bit_shift = 7, 1915 + .num_parents = ARRAY_SIZE(gpt11_mux_fck_parents), 1916 + .reg = 0xa40, 1917 + .module = TI_CLKM_CM, 1918 + .parents = gpt11_mux_fck_parents, 1919 + }; 1920 + 1921 + static struct ti_clk_composite gpt11_fck_data = { 1922 + .mux = &gpt11_mux_fck_data, 1923 + .gate = &gpt11_gate_fck_data, 1924 + }; 1925 + 1926 + static struct ti_clk gpt11_fck = { 1927 + .name = "gpt11_fck", 1928 + .type = TI_CLK_COMPOSITE, 1929 + .data = &gpt11_fck_data, 1930 + }; 1931 + 1932 + static struct ti_clk_fixed_factor core_d6_ck_data = { 1933 + .parent = "core_ck", 1934 + .div = 6, 1935 + .mult = 1, 1936 + }; 1937 + 1938 + static struct ti_clk core_d6_ck = { 1939 + .name = "core_d6_ck", 1940 + .type = TI_CLK_FIXED_FACTOR, 1941 + .data = &core_d6_ck_data, 1942 + }; 1943 + 1944 + static struct ti_clk_gate uart4_fck_am35xx_data = { 1945 + .parent = "core_48m_fck", 1946 + .bit_shift = 23, 1947 + .reg = 0xa00, 1948 + .module = TI_CLKM_CM, 1949 + .flags = CLKF_WAIT, 1950 + }; 1951 + 1952 + static struct ti_clk uart4_fck_am35xx = { 1953 + .name = "uart4_fck_am35xx", 1954 + .clkdm_name = "core_l4_clkdm", 1955 + .type = TI_CLK_GATE, 1956 + .data = &uart4_fck_am35xx_data, 1957 + }; 1958 + 1959 + static struct ti_clk_gate dpll3_m3x2_ck_data = { 1960 + .parent = "dpll3_m3x2_mul_ck", 1961 + .bit_shift = 0xc, 1962 + .reg = 0xd00, 1963 + .module = TI_CLKM_CM, 1964 + .flags = CLKF_SET_BIT_TO_DISABLE, 1965 + }; 1966 + 1967 + static struct ti_clk dpll3_m3x2_ck = { 1968 + .name = "dpll3_m3x2_ck", 1969 + .type = TI_CLK_GATE, 1970 + .data = &dpll3_m3x2_ck_data, 1971 + }; 1972 + 1973 + static struct ti_clk_fixed_factor emu_core_alwon_ck_data = { 1974 + .parent = "dpll3_m3x2_ck", 1975 + .div = 1, 1976 + .mult = 1, 1977 + }; 1978 + 1979 + static struct ti_clk emu_core_alwon_ck = { 1980 + .name = "emu_core_alwon_ck", 1981 + .type = TI_CLK_FIXED_FACTOR, 1982 + .data = &emu_core_alwon_ck_data, 1983 + }; 1984 + 1985 + static struct ti_clk_divider dpll4_m6_ck_data = { 1986 + .parent = "dpll4_ck", 1987 + .bit_shift = 24, 1988 + .max_div = 63, 1989 + .reg = 0x1140, 1990 + .module = TI_CLKM_CM, 1991 + .flags = CLKF_INDEX_STARTS_AT_ONE, 1992 + }; 1993 + 1994 + static struct ti_clk dpll4_m6_ck = { 1995 + .name = "dpll4_m6_ck", 1996 + .type = TI_CLK_DIVIDER, 1997 + .data = &dpll4_m6_ck_data, 1998 + }; 1999 + 2000 + static struct ti_clk_fixed_factor dpll4_m6x2_mul_ck_data = { 2001 + .parent = "dpll4_m6_ck", 2002 + .div = 1, 2003 + .mult = 2, 2004 + }; 2005 + 2006 + static struct ti_clk dpll4_m6x2_mul_ck = { 2007 + .name = "dpll4_m6x2_mul_ck", 2008 + .type = TI_CLK_FIXED_FACTOR, 2009 + .data = &dpll4_m6x2_mul_ck_data, 2010 + }; 2011 + 2012 + static struct ti_clk_gate dpll4_m6x2_ck_data = { 2013 + .parent = "dpll4_m6x2_mul_ck", 2014 + .bit_shift = 0x1f, 2015 + .reg = 0xd00, 2016 + .module = TI_CLKM_CM, 2017 + .flags = CLKF_SET_BIT_TO_DISABLE, 2018 + }; 2019 + 2020 + static struct ti_clk dpll4_m6x2_ck = { 2021 + .name = "dpll4_m6x2_ck", 2022 + .type = TI_CLK_GATE, 2023 + .data = &dpll4_m6x2_ck_data, 2024 + }; 2025 + 2026 + static struct ti_clk_fixed_factor emu_per_alwon_ck_data = { 2027 + .parent = "dpll4_m6x2_ck", 2028 + .div = 1, 2029 + .mult = 1, 2030 + }; 2031 + 2032 + static struct ti_clk emu_per_alwon_ck = { 2033 + .name = "emu_per_alwon_ck", 2034 + .type = TI_CLK_FIXED_FACTOR, 2035 + .data = &emu_per_alwon_ck_data, 2036 + }; 2037 + 2038 + static struct ti_clk_fixed_factor emu_mpu_alwon_ck_data = { 2039 + .parent = "mpu_ck", 2040 + .div = 1, 2041 + .mult = 1, 2042 + }; 2043 + 2044 + static struct ti_clk emu_mpu_alwon_ck = { 2045 + .name = "emu_mpu_alwon_ck", 2046 + .type = TI_CLK_FIXED_FACTOR, 2047 + .data = &emu_mpu_alwon_ck_data, 2048 + }; 2049 + 2050 + static const char *emu_src_mux_ck_parents[] = { 2051 + "sys_ck", 2052 + "emu_core_alwon_ck", 2053 + "emu_per_alwon_ck", 2054 + "emu_mpu_alwon_ck", 2055 + }; 2056 + 2057 + static struct ti_clk_mux emu_src_mux_ck_data = { 2058 + .num_parents = ARRAY_SIZE(emu_src_mux_ck_parents), 2059 + .reg = 0x1140, 2060 + .module = TI_CLKM_CM, 2061 + .parents = emu_src_mux_ck_parents, 2062 + }; 2063 + 2064 + static struct ti_clk emu_src_mux_ck = { 2065 + .name = "emu_src_mux_ck", 2066 + .type = TI_CLK_MUX, 2067 + .data = &emu_src_mux_ck_data, 2068 + }; 2069 + 2070 + static struct ti_clk_gate emu_src_ck_data = { 2071 + .parent = "emu_src_mux_ck", 2072 + .flags = CLKF_CLKDM, 2073 + }; 2074 + 2075 + static struct ti_clk emu_src_ck = { 2076 + .name = "emu_src_ck", 2077 + .clkdm_name = "emu_clkdm", 2078 + .type = TI_CLK_GATE, 2079 + .data = &emu_src_ck_data, 2080 + }; 2081 + 2082 + static struct ti_clk_divider atclk_fck_data = { 2083 + .parent = "emu_src_ck", 2084 + .bit_shift = 4, 2085 + .max_div = 3, 2086 + .reg = 0x1140, 2087 + .module = TI_CLKM_CM, 2088 + .flags = CLKF_INDEX_STARTS_AT_ONE, 2089 + }; 2090 + 2091 + static struct ti_clk atclk_fck = { 2092 + .name = "atclk_fck", 2093 + .type = TI_CLK_DIVIDER, 2094 + .data = &atclk_fck_data, 2095 + }; 2096 + 2097 + static struct ti_clk_gate ipss_ick_data = { 2098 + .parent = "core_l3_ick", 2099 + .bit_shift = 4, 2100 + .reg = 0xa10, 2101 + .module = TI_CLKM_CM, 2102 + .flags = CLKF_AM35XX | CLKF_INTERFACE, 2103 + }; 2104 + 2105 + static struct ti_clk ipss_ick = { 2106 + .name = "ipss_ick", 2107 + .clkdm_name = "core_l3_clkdm", 2108 + .type = TI_CLK_GATE, 2109 + .data = &ipss_ick_data, 2110 + }; 2111 + 2112 + static struct ti_clk_gate emac_ick_data = { 2113 + .parent = "ipss_ick", 2114 + .bit_shift = 1, 2115 + .reg = 0x59c, 2116 + .module = TI_CLKM_SCRM, 2117 + .flags = CLKF_AM35XX, 2118 + }; 2119 + 2120 + static struct ti_clk emac_ick = { 2121 + .name = "emac_ick", 2122 + .clkdm_name = "core_l3_clkdm", 2123 + .type = TI_CLK_GATE, 2124 + .data = &emac_ick_data, 2125 + }; 2126 + 2127 + static struct ti_clk_gate vpfe_ick_data = { 2128 + .parent = "ipss_ick", 2129 + .bit_shift = 2, 2130 + .reg = 0x59c, 2131 + .module = TI_CLKM_SCRM, 2132 + .flags = CLKF_AM35XX, 2133 + }; 2134 + 2135 + static struct ti_clk vpfe_ick = { 2136 + .name = "vpfe_ick", 2137 + .clkdm_name = "core_l3_clkdm", 2138 + .type = TI_CLK_GATE, 2139 + .data = &vpfe_ick_data, 2140 + }; 2141 + 2142 + static const char *dpll2_ck_parents[] = { 2143 + "sys_ck", 2144 + "dpll2_fck", 2145 + }; 2146 + 2147 + static struct ti_clk_dpll dpll2_ck_data = { 2148 + .num_parents = ARRAY_SIZE(dpll2_ck_parents), 2149 + .control_reg = 0x4, 2150 + .idlest_reg = 0x24, 2151 + .mult_div1_reg = 0x40, 2152 + .autoidle_reg = 0x34, 2153 + .module = TI_CLKM_CM, 2154 + .parents = dpll2_ck_parents, 2155 + .freqsel_mask = 0xf0, 2156 + .modes = 0xa2, 2157 + .div1_mask = 0x7f, 2158 + .idlest_mask = 0x1, 2159 + .auto_recal_bit = 0x3, 2160 + .max_divider = 0x80, 2161 + .min_divider = 0x1, 2162 + .recal_en_bit = 0x8, 2163 + .max_multiplier = 0x7ff, 2164 + .enable_mask = 0x7, 2165 + .mult_mask = 0x7ff00, 2166 + .recal_st_bit = 0x8, 2167 + .autoidle_mask = 0x7, 2168 + }; 2169 + 2170 + static struct ti_clk dpll2_ck = { 2171 + .name = "dpll2_ck", 2172 + .clkdm_name = "dpll2_clkdm", 2173 + .type = TI_CLK_DPLL, 2174 + .data = &dpll2_ck_data, 2175 + }; 2176 + 2177 + static struct ti_clk_divider dpll2_m2_ck_data = { 2178 + .parent = "dpll2_ck", 2179 + .max_div = 31, 2180 + .reg = 0x44, 2181 + .module = TI_CLKM_CM, 2182 + .flags = CLKF_INDEX_STARTS_AT_ONE, 2183 + }; 2184 + 2185 + static struct ti_clk dpll2_m2_ck = { 2186 + .name = "dpll2_m2_ck", 2187 + .type = TI_CLK_DIVIDER, 2188 + .data = &dpll2_m2_ck_data, 2189 + }; 2190 + 2191 + static const char *mcbsp4_mux_fck_parents[] = { 2192 + "per_96m_fck", 2193 + "mcbsp_clks", 2194 + }; 2195 + 2196 + static struct ti_clk_mux mcbsp4_mux_fck_data = { 2197 + .bit_shift = 2, 2198 + .num_parents = ARRAY_SIZE(mcbsp4_mux_fck_parents), 2199 + .reg = 0x2d8, 2200 + .module = TI_CLKM_SCRM, 2201 + .parents = mcbsp4_mux_fck_parents, 2202 + }; 2203 + 2204 + static const char *mcbsp1_mux_fck_parents[] = { 2205 + "core_96m_fck", 2206 + "mcbsp_clks", 2207 + }; 2208 + 2209 + static struct ti_clk_mux mcbsp1_mux_fck_data = { 2210 + .bit_shift = 2, 2211 + .num_parents = ARRAY_SIZE(mcbsp1_mux_fck_parents), 2212 + .reg = 0x274, 2213 + .module = TI_CLKM_SCRM, 2214 + .parents = mcbsp1_mux_fck_parents, 2215 + }; 2216 + 2217 + static struct ti_clk_gate gpt8_gate_fck_data = { 2218 + .parent = "sys_ck", 2219 + .bit_shift = 9, 2220 + .reg = 0x1000, 2221 + .module = TI_CLKM_CM, 2222 + }; 2223 + 2224 + static struct ti_clk_gate gpt8_ick_data = { 2225 + .parent = "per_l4_ick", 2226 + .bit_shift = 9, 2227 + .reg = 0x1010, 2228 + .module = TI_CLKM_CM, 2229 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 2230 + }; 2231 + 2232 + static struct ti_clk gpt8_ick = { 2233 + .name = "gpt8_ick", 2234 + .clkdm_name = "per_clkdm", 2235 + .type = TI_CLK_GATE, 2236 + .data = &gpt8_ick_data, 2237 + }; 2238 + 2239 + static const char *gpt10_mux_fck_parents[] = { 2240 + "omap_32k_fck", 2241 + "sys_ck", 2242 + }; 2243 + 2244 + static struct ti_clk_mux gpt10_mux_fck_data = { 2245 + .bit_shift = 6, 2246 + .num_parents = ARRAY_SIZE(gpt10_mux_fck_parents), 2247 + .reg = 0xa40, 2248 + .module = TI_CLKM_CM, 2249 + .parents = gpt10_mux_fck_parents, 2250 + }; 2251 + 2252 + static struct ti_clk_gate mmchs3_ick_data = { 2253 + .parent = "core_l4_ick", 2254 + .bit_shift = 30, 2255 + .reg = 0xa10, 2256 + .module = TI_CLKM_CM, 2257 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 2258 + }; 2259 + 2260 + static struct ti_clk mmchs3_ick = { 2261 + .name = "mmchs3_ick", 2262 + .clkdm_name = "core_l4_clkdm", 2263 + .type = TI_CLK_GATE, 2264 + .data = &mmchs3_ick_data, 2265 + }; 2266 + 2267 + static struct ti_clk_gate gpio3_ick_data = { 2268 + .parent = "per_l4_ick", 2269 + .bit_shift = 14, 2270 + .reg = 0x1010, 2271 + .module = TI_CLKM_CM, 2272 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 2273 + }; 2274 + 2275 + static struct ti_clk gpio3_ick = { 2276 + .name = "gpio3_ick", 2277 + .clkdm_name = "per_clkdm", 2278 + .type = TI_CLK_GATE, 2279 + .data = &gpio3_ick_data, 2280 + }; 2281 + 2282 + static const char *traceclk_src_fck_parents[] = { 2283 + "sys_ck", 2284 + "emu_core_alwon_ck", 2285 + "emu_per_alwon_ck", 2286 + "emu_mpu_alwon_ck", 2287 + }; 2288 + 2289 + static struct ti_clk_mux traceclk_src_fck_data = { 2290 + .bit_shift = 2, 2291 + .num_parents = ARRAY_SIZE(traceclk_src_fck_parents), 2292 + .reg = 0x1140, 2293 + .module = TI_CLKM_CM, 2294 + .parents = traceclk_src_fck_parents, 2295 + }; 2296 + 2297 + static struct ti_clk traceclk_src_fck = { 2298 + .name = "traceclk_src_fck", 2299 + .type = TI_CLK_MUX, 2300 + .data = &traceclk_src_fck_data, 2301 + }; 2302 + 2303 + static struct ti_clk_divider traceclk_fck_data = { 2304 + .parent = "traceclk_src_fck", 2305 + .bit_shift = 11, 2306 + .max_div = 7, 2307 + .reg = 0x1140, 2308 + .module = TI_CLKM_CM, 2309 + .flags = CLKF_INDEX_STARTS_AT_ONE, 2310 + }; 2311 + 2312 + static struct ti_clk traceclk_fck = { 2313 + .name = "traceclk_fck", 2314 + .type = TI_CLK_DIVIDER, 2315 + .data = &traceclk_fck_data, 2316 + }; 2317 + 2318 + static struct ti_clk_gate mcbsp5_gate_fck_data = { 2319 + .parent = "mcbsp_clks", 2320 + .bit_shift = 10, 2321 + .reg = 0xa00, 2322 + .module = TI_CLKM_CM, 2323 + }; 2324 + 2325 + static struct ti_clk_gate sad2d_ick_data = { 2326 + .parent = "l3_ick", 2327 + .bit_shift = 3, 2328 + .reg = 0xa10, 2329 + .module = TI_CLKM_CM, 2330 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 2331 + }; 2332 + 2333 + static struct ti_clk sad2d_ick = { 2334 + .name = "sad2d_ick", 2335 + .clkdm_name = "d2d_clkdm", 2336 + .type = TI_CLK_GATE, 2337 + .data = &sad2d_ick_data, 2338 + }; 2339 + 2340 + static const char *gpt1_mux_fck_parents[] = { 2341 + "omap_32k_fck", 2342 + "sys_ck", 2343 + }; 2344 + 2345 + static struct ti_clk_mux gpt1_mux_fck_data = { 2346 + .num_parents = ARRAY_SIZE(gpt1_mux_fck_parents), 2347 + .reg = 0xc40, 2348 + .module = TI_CLKM_CM, 2349 + .parents = gpt1_mux_fck_parents, 2350 + }; 2351 + 2352 + static struct ti_clk_gate hecc_ck_data = { 2353 + .parent = "sys_ck", 2354 + .bit_shift = 3, 2355 + .reg = 0x59c, 2356 + .module = TI_CLKM_SCRM, 2357 + .flags = CLKF_AM35XX, 2358 + }; 2359 + 2360 + static struct ti_clk hecc_ck = { 2361 + .name = "hecc_ck", 2362 + .clkdm_name = "core_l3_clkdm", 2363 + .type = TI_CLK_GATE, 2364 + .data = &hecc_ck_data, 2365 + }; 2366 + 2367 + static struct ti_clk_gate gpt1_gate_fck_data = { 2368 + .parent = "sys_ck", 2369 + .bit_shift = 0, 2370 + .reg = 0xc00, 2371 + .module = TI_CLKM_CM, 2372 + }; 2373 + 2374 + static struct ti_clk_composite gpt1_fck_data = { 2375 + .mux = &gpt1_mux_fck_data, 2376 + .gate = &gpt1_gate_fck_data, 2377 + }; 2378 + 2379 + static struct ti_clk gpt1_fck = { 2380 + .name = "gpt1_fck", 2381 + .type = TI_CLK_COMPOSITE, 2382 + .data = &gpt1_fck_data, 2383 + }; 2384 + 2385 + static struct ti_clk_gate dpll4_m2x2_ck_omap36xx_data = { 2386 + .parent = "dpll4_m2x2_mul_ck", 2387 + .bit_shift = 0x1b, 2388 + .reg = 0xd00, 2389 + .module = TI_CLKM_CM, 2390 + .flags = CLKF_HSDIV | CLKF_SET_BIT_TO_DISABLE, 2391 + }; 2392 + 2393 + static struct ti_clk dpll4_m2x2_ck_omap36xx = { 2394 + .name = "dpll4_m2x2_ck", 2395 + .type = TI_CLK_GATE, 2396 + .data = &dpll4_m2x2_ck_omap36xx_data, 2397 + .patch = &dpll4_m2x2_ck, 2398 + }; 2399 + 2400 + static struct ti_clk_divider gfx_l3_fck_data = { 2401 + .parent = "l3_ick", 2402 + .max_div = 7, 2403 + .reg = 0xb40, 2404 + .module = TI_CLKM_CM, 2405 + .flags = CLKF_INDEX_STARTS_AT_ONE, 2406 + }; 2407 + 2408 + static struct ti_clk gfx_l3_fck = { 2409 + .name = "gfx_l3_fck", 2410 + .type = TI_CLK_DIVIDER, 2411 + .data = &gfx_l3_fck_data, 2412 + }; 2413 + 2414 + static struct ti_clk_gate gfx_cg1_ck_data = { 2415 + .parent = "gfx_l3_fck", 2416 + .bit_shift = 1, 2417 + .reg = 0xb00, 2418 + .module = TI_CLKM_CM, 2419 + .flags = CLKF_WAIT, 2420 + }; 2421 + 2422 + static struct ti_clk gfx_cg1_ck = { 2423 + .name = "gfx_cg1_ck", 2424 + .clkdm_name = "gfx_3430es1_clkdm", 2425 + .type = TI_CLK_GATE, 2426 + .data = &gfx_cg1_ck_data, 2427 + }; 2428 + 2429 + static struct ti_clk_gate mailboxes_ick_data = { 2430 + .parent = "core_l4_ick", 2431 + .bit_shift = 7, 2432 + .reg = 0xa10, 2433 + .module = TI_CLKM_CM, 2434 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 2435 + }; 2436 + 2437 + static struct ti_clk mailboxes_ick = { 2438 + .name = "mailboxes_ick", 2439 + .clkdm_name = "core_l4_clkdm", 2440 + .type = TI_CLK_GATE, 2441 + .data = &mailboxes_ick_data, 2442 + }; 2443 + 2444 + static struct ti_clk_gate sha11_ick_data = { 2445 + .parent = "security_l4_ick2", 2446 + .bit_shift = 1, 2447 + .reg = 0xa14, 2448 + .module = TI_CLKM_CM, 2449 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 2450 + }; 2451 + 2452 + static struct ti_clk sha11_ick = { 2453 + .name = "sha11_ick", 2454 + .type = TI_CLK_GATE, 2455 + .data = &sha11_ick_data, 2456 + }; 2457 + 2458 + static struct ti_clk_gate hsotgusb_ick_am35xx_data = { 2459 + .parent = "ipss_ick", 2460 + .bit_shift = 0, 2461 + .reg = 0x59c, 2462 + .module = TI_CLKM_SCRM, 2463 + .flags = CLKF_AM35XX, 2464 + }; 2465 + 2466 + static struct ti_clk hsotgusb_ick_am35xx = { 2467 + .name = "hsotgusb_ick_am35xx", 2468 + .clkdm_name = "core_l3_clkdm", 2469 + .type = TI_CLK_GATE, 2470 + .data = &hsotgusb_ick_am35xx_data, 2471 + }; 2472 + 2473 + static struct ti_clk_gate mmchs3_fck_data = { 2474 + .parent = "core_96m_fck", 2475 + .bit_shift = 30, 2476 + .reg = 0xa00, 2477 + .module = TI_CLKM_CM, 2478 + .flags = CLKF_WAIT, 2479 + }; 2480 + 2481 + static struct ti_clk mmchs3_fck = { 2482 + .name = "mmchs3_fck", 2483 + .clkdm_name = "core_l4_clkdm", 2484 + .type = TI_CLK_GATE, 2485 + .data = &mmchs3_fck_data, 2486 + }; 2487 + 2488 + static struct ti_clk_divider pclk_fck_data = { 2489 + .parent = "emu_src_ck", 2490 + .bit_shift = 8, 2491 + .max_div = 7, 2492 + .reg = 0x1140, 2493 + .module = TI_CLKM_CM, 2494 + .flags = CLKF_INDEX_STARTS_AT_ONE, 2495 + }; 2496 + 2497 + static struct ti_clk pclk_fck = { 2498 + .name = "pclk_fck", 2499 + .type = TI_CLK_DIVIDER, 2500 + .data = &pclk_fck_data, 2501 + }; 2502 + 2503 + static const char *dpll4_ck_omap36xx_parents[] = { 2504 + "sys_ck", 2505 + "sys_ck", 2506 + }; 2507 + 2508 + static struct ti_clk_dpll dpll4_ck_omap36xx_data = { 2509 + .num_parents = ARRAY_SIZE(dpll4_ck_omap36xx_parents), 2510 + .control_reg = 0xd00, 2511 + .idlest_reg = 0xd20, 2512 + .mult_div1_reg = 0xd44, 2513 + .autoidle_reg = 0xd30, 2514 + .module = TI_CLKM_CM, 2515 + .parents = dpll4_ck_omap36xx_parents, 2516 + .modes = 0x82, 2517 + .div1_mask = 0x7f, 2518 + .idlest_mask = 0x2, 2519 + .auto_recal_bit = 0x13, 2520 + .max_divider = 0x80, 2521 + .min_divider = 0x1, 2522 + .recal_en_bit = 0x6, 2523 + .max_multiplier = 0xfff, 2524 + .enable_mask = 0x70000, 2525 + .mult_mask = 0xfff00, 2526 + .recal_st_bit = 0x6, 2527 + .autoidle_mask = 0x38, 2528 + .sddiv_mask = 0xff000000, 2529 + .dco_mask = 0xe00000, 2530 + .flags = CLKF_PER | CLKF_J_TYPE, 2531 + }; 2532 + 2533 + static struct ti_clk dpll4_ck_omap36xx = { 2534 + .name = "dpll4_ck", 2535 + .type = TI_CLK_DPLL, 2536 + .data = &dpll4_ck_omap36xx_data, 2537 + .patch = &dpll4_ck, 2538 + }; 2539 + 2540 + static struct ti_clk_gate uart3_fck_data = { 2541 + .parent = "per_48m_fck", 2542 + .bit_shift = 11, 2543 + .reg = 0x1000, 2544 + .module = TI_CLKM_CM, 2545 + .flags = CLKF_WAIT, 2546 + }; 2547 + 2548 + static struct ti_clk uart3_fck = { 2549 + .name = "uart3_fck", 2550 + .clkdm_name = "per_clkdm", 2551 + .type = TI_CLK_GATE, 2552 + .data = &uart3_fck_data, 2553 + }; 2554 + 2555 + static struct ti_clk_fixed_factor wkup_32k_fck_data = { 2556 + .parent = "omap_32k_fck", 2557 + .div = 1, 2558 + .mult = 1, 2559 + }; 2560 + 2561 + static struct ti_clk wkup_32k_fck = { 2562 + .name = "wkup_32k_fck", 2563 + .type = TI_CLK_FIXED_FACTOR, 2564 + .data = &wkup_32k_fck_data, 2565 + }; 2566 + 2567 + static struct ti_clk_gate sys_clkout1_data = { 2568 + .parent = "osc_sys_ck", 2569 + .bit_shift = 7, 2570 + .reg = 0xd70, 2571 + .module = TI_CLKM_PRM, 2572 + }; 2573 + 2574 + static struct ti_clk sys_clkout1 = { 2575 + .name = "sys_clkout1", 2576 + .type = TI_CLK_GATE, 2577 + .data = &sys_clkout1_data, 2578 + }; 2579 + 2580 + static struct ti_clk_fixed_factor gpmc_fck_data = { 2581 + .parent = "core_l3_ick", 2582 + .div = 1, 2583 + .mult = 1, 2584 + }; 2585 + 2586 + static struct ti_clk gpmc_fck = { 2587 + .name = "gpmc_fck", 2588 + .type = TI_CLK_FIXED_FACTOR, 2589 + .data = &gpmc_fck_data, 2590 + }; 2591 + 2592 + static struct ti_clk_fixed_factor dpll5_m2_d20_ck_data = { 2593 + .parent = "dpll5_m2_ck", 2594 + .div = 20, 2595 + .mult = 1, 2596 + }; 2597 + 2598 + static struct ti_clk dpll5_m2_d20_ck = { 2599 + .name = "dpll5_m2_d20_ck", 2600 + .type = TI_CLK_FIXED_FACTOR, 2601 + .data = &dpll5_m2_d20_ck_data, 2602 + }; 2603 + 2604 + static struct ti_clk_gate dpll4_m5x2_ck_omap36xx_data = { 2605 + .parent = "dpll4_m5x2_mul_ck", 2606 + .bit_shift = 0x1e, 2607 + .reg = 0xd00, 2608 + .module = TI_CLKM_CM, 2609 + .flags = CLKF_HSDIV | CLKF_SET_RATE_PARENT | CLKF_SET_BIT_TO_DISABLE, 2610 + }; 2611 + 2612 + static struct ti_clk dpll4_m5x2_ck_omap36xx = { 2613 + .name = "dpll4_m5x2_ck", 2614 + .type = TI_CLK_GATE, 2615 + .data = &dpll4_m5x2_ck_omap36xx_data, 2616 + .patch = &dpll4_m5x2_ck, 2617 + }; 2618 + 2619 + static struct ti_clk_gate ssi_ssr_gate_fck_3430es2_data = { 2620 + .parent = "corex2_fck", 2621 + .bit_shift = 0, 2622 + .reg = 0xa00, 2623 + .module = TI_CLKM_CM, 2624 + .flags = CLKF_NO_WAIT, 2625 + }; 2626 + 2627 + static struct ti_clk_gate uart1_ick_data = { 2628 + .parent = "core_l4_ick", 2629 + .bit_shift = 13, 2630 + .reg = 0xa10, 2631 + .module = TI_CLKM_CM, 2632 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 2633 + }; 2634 + 2635 + static struct ti_clk uart1_ick = { 2636 + .name = "uart1_ick", 2637 + .clkdm_name = "core_l4_clkdm", 2638 + .type = TI_CLK_GATE, 2639 + .data = &uart1_ick_data, 2640 + }; 2641 + 2642 + static struct ti_clk_gate iva2_ck_data = { 2643 + .parent = "dpll2_m2_ck", 2644 + .bit_shift = 0, 2645 + .reg = 0x0, 2646 + .module = TI_CLKM_CM, 2647 + .flags = CLKF_WAIT, 2648 + }; 2649 + 2650 + static struct ti_clk iva2_ck = { 2651 + .name = "iva2_ck", 2652 + .clkdm_name = "iva2_clkdm", 2653 + .type = TI_CLK_GATE, 2654 + .data = &iva2_ck_data, 2655 + }; 2656 + 2657 + static struct ti_clk_gate pka_ick_data = { 2658 + .parent = "security_l3_ick", 2659 + .bit_shift = 4, 2660 + .reg = 0xa14, 2661 + .module = TI_CLKM_CM, 2662 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 2663 + }; 2664 + 2665 + static struct ti_clk pka_ick = { 2666 + .name = "pka_ick", 2667 + .type = TI_CLK_GATE, 2668 + .data = &pka_ick_data, 2669 + }; 2670 + 2671 + static struct ti_clk_gate gpt12_ick_data = { 2672 + .parent = "wkup_l4_ick", 2673 + .bit_shift = 1, 2674 + .reg = 0xc10, 2675 + .module = TI_CLKM_CM, 2676 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 2677 + }; 2678 + 2679 + static struct ti_clk gpt12_ick = { 2680 + .name = "gpt12_ick", 2681 + .clkdm_name = "wkup_clkdm", 2682 + .type = TI_CLK_GATE, 2683 + .data = &gpt12_ick_data, 2684 + }; 2685 + 2686 + static const char *mcbsp5_mux_fck_parents[] = { 2687 + "core_96m_fck", 2688 + "mcbsp_clks", 2689 + }; 2690 + 2691 + static struct ti_clk_mux mcbsp5_mux_fck_data = { 2692 + .bit_shift = 4, 2693 + .num_parents = ARRAY_SIZE(mcbsp5_mux_fck_parents), 2694 + .reg = 0x2d8, 2695 + .module = TI_CLKM_SCRM, 2696 + .parents = mcbsp5_mux_fck_parents, 2697 + }; 2698 + 2699 + static struct ti_clk_composite mcbsp5_fck_data = { 2700 + .mux = &mcbsp5_mux_fck_data, 2701 + .gate = &mcbsp5_gate_fck_data, 2702 + }; 2703 + 2704 + static struct ti_clk mcbsp5_fck = { 2705 + .name = "mcbsp5_fck", 2706 + .type = TI_CLK_COMPOSITE, 2707 + .data = &mcbsp5_fck_data, 2708 + }; 2709 + 2710 + static struct ti_clk_gate usbhost_48m_fck_data = { 2711 + .parent = "omap_48m_fck", 2712 + .bit_shift = 0, 2713 + .reg = 0x1400, 2714 + .module = TI_CLKM_CM, 2715 + .flags = CLKF_DSS, 2716 + }; 2717 + 2718 + static struct ti_clk usbhost_48m_fck = { 2719 + .name = "usbhost_48m_fck", 2720 + .clkdm_name = "usbhost_clkdm", 2721 + .type = TI_CLK_GATE, 2722 + .data = &usbhost_48m_fck_data, 2723 + }; 2724 + 2725 + static struct ti_clk_gate des1_ick_data = { 2726 + .parent = "security_l4_ick2", 2727 + .bit_shift = 0, 2728 + .reg = 0xa14, 2729 + .module = TI_CLKM_CM, 2730 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 2731 + }; 2732 + 2733 + static struct ti_clk des1_ick = { 2734 + .name = "des1_ick", 2735 + .type = TI_CLK_GATE, 2736 + .data = &des1_ick_data, 2737 + }; 2738 + 2739 + static struct ti_clk_gate sgx_gate_fck_data = { 2740 + .parent = "core_ck", 2741 + .bit_shift = 1, 2742 + .reg = 0xb00, 2743 + .module = TI_CLKM_CM, 2744 + }; 2745 + 2746 + static struct ti_clk_fixed_factor core_d4_ck_data = { 2747 + .parent = "core_ck", 2748 + .div = 4, 2749 + .mult = 1, 2750 + }; 2751 + 2752 + static struct ti_clk core_d4_ck = { 2753 + .name = "core_d4_ck", 2754 + .type = TI_CLK_FIXED_FACTOR, 2755 + .data = &core_d4_ck_data, 2756 + }; 2757 + 2758 + static struct ti_clk_fixed_factor omap_192m_alwon_fck_data = { 2759 + .parent = "dpll4_m2x2_ck", 2760 + .div = 1, 2761 + .mult = 1, 2762 + }; 2763 + 2764 + static struct ti_clk omap_192m_alwon_fck = { 2765 + .name = "omap_192m_alwon_fck", 2766 + .type = TI_CLK_FIXED_FACTOR, 2767 + .data = &omap_192m_alwon_fck_data, 2768 + }; 2769 + 2770 + static struct ti_clk_fixed_factor core_d2_ck_data = { 2771 + .parent = "core_ck", 2772 + .div = 2, 2773 + .mult = 1, 2774 + }; 2775 + 2776 + static struct ti_clk core_d2_ck = { 2777 + .name = "core_d2_ck", 2778 + .type = TI_CLK_FIXED_FACTOR, 2779 + .data = &core_d2_ck_data, 2780 + }; 2781 + 2782 + static struct ti_clk_fixed_factor corex2_d3_fck_data = { 2783 + .parent = "corex2_fck", 2784 + .div = 3, 2785 + .mult = 1, 2786 + }; 2787 + 2788 + static struct ti_clk corex2_d3_fck = { 2789 + .name = "corex2_d3_fck", 2790 + .type = TI_CLK_FIXED_FACTOR, 2791 + .data = &corex2_d3_fck_data, 2792 + }; 2793 + 2794 + static struct ti_clk_fixed_factor corex2_d5_fck_data = { 2795 + .parent = "corex2_fck", 2796 + .div = 5, 2797 + .mult = 1, 2798 + }; 2799 + 2800 + static struct ti_clk corex2_d5_fck = { 2801 + .name = "corex2_d5_fck", 2802 + .type = TI_CLK_FIXED_FACTOR, 2803 + .data = &corex2_d5_fck_data, 2804 + }; 2805 + 2806 + static const char *sgx_mux_fck_parents[] = { 2807 + "core_d3_ck", 2808 + "core_d4_ck", 2809 + "core_d6_ck", 2810 + "cm_96m_fck", 2811 + "omap_192m_alwon_fck", 2812 + "core_d2_ck", 2813 + "corex2_d3_fck", 2814 + "corex2_d5_fck", 2815 + }; 2816 + 2817 + static struct ti_clk_mux sgx_mux_fck_data = { 2818 + .num_parents = ARRAY_SIZE(sgx_mux_fck_parents), 2819 + .reg = 0xb40, 2820 + .module = TI_CLKM_CM, 2821 + .parents = sgx_mux_fck_parents, 2822 + }; 2823 + 2824 + static struct ti_clk_composite sgx_fck_data = { 2825 + .mux = &sgx_mux_fck_data, 2826 + .gate = &sgx_gate_fck_data, 2827 + }; 2828 + 2829 + static struct ti_clk sgx_fck = { 2830 + .name = "sgx_fck", 2831 + .type = TI_CLK_COMPOSITE, 2832 + .data = &sgx_fck_data, 2833 + }; 2834 + 2835 + static struct ti_clk_gate mcspi1_fck_data = { 2836 + .parent = "core_48m_fck", 2837 + .bit_shift = 18, 2838 + .reg = 0xa00, 2839 + .module = TI_CLKM_CM, 2840 + .flags = CLKF_WAIT, 2841 + }; 2842 + 2843 + static struct ti_clk mcspi1_fck = { 2844 + .name = "mcspi1_fck", 2845 + .clkdm_name = "core_l4_clkdm", 2846 + .type = TI_CLK_GATE, 2847 + .data = &mcspi1_fck_data, 2848 + }; 2849 + 2850 + static struct ti_clk_gate mmchs2_fck_data = { 2851 + .parent = "core_96m_fck", 2852 + .bit_shift = 25, 2853 + .reg = 0xa00, 2854 + .module = TI_CLKM_CM, 2855 + .flags = CLKF_WAIT, 2856 + }; 2857 + 2858 + static struct ti_clk mmchs2_fck = { 2859 + .name = "mmchs2_fck", 2860 + .clkdm_name = "core_l4_clkdm", 2861 + .type = TI_CLK_GATE, 2862 + .data = &mmchs2_fck_data, 2863 + }; 2864 + 2865 + static struct ti_clk_gate mcspi2_fck_data = { 2866 + .parent = "core_48m_fck", 2867 + .bit_shift = 19, 2868 + .reg = 0xa00, 2869 + .module = TI_CLKM_CM, 2870 + .flags = CLKF_WAIT, 2871 + }; 2872 + 2873 + static struct ti_clk mcspi2_fck = { 2874 + .name = "mcspi2_fck", 2875 + .clkdm_name = "core_l4_clkdm", 2876 + .type = TI_CLK_GATE, 2877 + .data = &mcspi2_fck_data, 2878 + }; 2879 + 2880 + static struct ti_clk_gate vpfe_fck_data = { 2881 + .parent = "pclk_ck", 2882 + .bit_shift = 10, 2883 + .reg = 0x59c, 2884 + .module = TI_CLKM_SCRM, 2885 + }; 2886 + 2887 + static struct ti_clk vpfe_fck = { 2888 + .name = "vpfe_fck", 2889 + .type = TI_CLK_GATE, 2890 + .data = &vpfe_fck_data, 2891 + }; 2892 + 2893 + static struct ti_clk_gate gpt4_gate_fck_data = { 2894 + .parent = "sys_ck", 2895 + .bit_shift = 5, 2896 + .reg = 0x1000, 2897 + .module = TI_CLKM_CM, 2898 + }; 2899 + 2900 + static struct ti_clk_gate mcbsp1_gate_fck_data = { 2901 + .parent = "mcbsp_clks", 2902 + .bit_shift = 9, 2903 + .reg = 0xa00, 2904 + .module = TI_CLKM_CM, 2905 + }; 2906 + 2907 + static struct ti_clk_gate gpt5_gate_fck_data = { 2908 + .parent = "sys_ck", 2909 + .bit_shift = 6, 2910 + .reg = 0x1000, 2911 + .module = TI_CLKM_CM, 2912 + }; 2913 + 2914 + static const char *gpt5_mux_fck_parents[] = { 2915 + "omap_32k_fck", 2916 + "sys_ck", 2917 + }; 2918 + 2919 + static struct ti_clk_mux gpt5_mux_fck_data = { 2920 + .bit_shift = 3, 2921 + .num_parents = ARRAY_SIZE(gpt5_mux_fck_parents), 2922 + .reg = 0x1040, 2923 + .module = TI_CLKM_CM, 2924 + .parents = gpt5_mux_fck_parents, 2925 + }; 2926 + 2927 + static struct ti_clk_composite gpt5_fck_data = { 2928 + .mux = &gpt5_mux_fck_data, 2929 + .gate = &gpt5_gate_fck_data, 2930 + }; 2931 + 2932 + static struct ti_clk gpt5_fck = { 2933 + .name = "gpt5_fck", 2934 + .type = TI_CLK_COMPOSITE, 2935 + .data = &gpt5_fck_data, 2936 + }; 2937 + 2938 + static struct ti_clk_gate ts_fck_data = { 2939 + .parent = "omap_32k_fck", 2940 + .bit_shift = 1, 2941 + .reg = 0xa08, 2942 + .module = TI_CLKM_CM, 2943 + }; 2944 + 2945 + static struct ti_clk ts_fck = { 2946 + .name = "ts_fck", 2947 + .clkdm_name = "core_l4_clkdm", 2948 + .type = TI_CLK_GATE, 2949 + .data = &ts_fck_data, 2950 + }; 2951 + 2952 + static struct ti_clk_fixed_factor wdt1_fck_data = { 2953 + .parent = "secure_32k_fck", 2954 + .div = 1, 2955 + .mult = 1, 2956 + }; 2957 + 2958 + static struct ti_clk wdt1_fck = { 2959 + .name = "wdt1_fck", 2960 + .type = TI_CLK_FIXED_FACTOR, 2961 + .data = &wdt1_fck_data, 2962 + }; 2963 + 2964 + static struct ti_clk_gate dpll4_m6x2_ck_omap36xx_data = { 2965 + .parent = "dpll4_m6x2_mul_ck", 2966 + .bit_shift = 0x1f, 2967 + .reg = 0xd00, 2968 + .module = TI_CLKM_CM, 2969 + .flags = CLKF_HSDIV | CLKF_SET_BIT_TO_DISABLE, 2970 + }; 2971 + 2972 + static struct ti_clk dpll4_m6x2_ck_omap36xx = { 2973 + .name = "dpll4_m6x2_ck", 2974 + .type = TI_CLK_GATE, 2975 + .data = &dpll4_m6x2_ck_omap36xx_data, 2976 + .patch = &dpll4_m6x2_ck, 2977 + }; 2978 + 2979 + static const char *gpt4_mux_fck_parents[] = { 2980 + "omap_32k_fck", 2981 + "sys_ck", 2982 + }; 2983 + 2984 + static struct ti_clk_mux gpt4_mux_fck_data = { 2985 + .bit_shift = 2, 2986 + .num_parents = ARRAY_SIZE(gpt4_mux_fck_parents), 2987 + .reg = 0x1040, 2988 + .module = TI_CLKM_CM, 2989 + .parents = gpt4_mux_fck_parents, 2990 + }; 2991 + 2992 + static struct ti_clk_gate usbhost_ick_data = { 2993 + .parent = "l4_ick", 2994 + .bit_shift = 0, 2995 + .reg = 0x1410, 2996 + .module = TI_CLKM_CM, 2997 + .flags = CLKF_DSS | CLKF_OMAP3 | CLKF_INTERFACE, 2998 + }; 2999 + 3000 + static struct ti_clk usbhost_ick = { 3001 + .name = "usbhost_ick", 3002 + .clkdm_name = "usbhost_clkdm", 3003 + .type = TI_CLK_GATE, 3004 + .data = &usbhost_ick_data, 3005 + }; 3006 + 3007 + static struct ti_clk_gate mcbsp2_ick_data = { 3008 + .parent = "per_l4_ick", 3009 + .bit_shift = 0, 3010 + .reg = 0x1010, 3011 + .module = TI_CLKM_CM, 3012 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3013 + }; 3014 + 3015 + static struct ti_clk mcbsp2_ick = { 3016 + .name = "mcbsp2_ick", 3017 + .clkdm_name = "per_clkdm", 3018 + .type = TI_CLK_GATE, 3019 + .data = &mcbsp2_ick_data, 3020 + }; 3021 + 3022 + static struct ti_clk_gate omapctrl_ick_data = { 3023 + .parent = "core_l4_ick", 3024 + .bit_shift = 6, 3025 + .reg = 0xa10, 3026 + .module = TI_CLKM_CM, 3027 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3028 + }; 3029 + 3030 + static struct ti_clk omapctrl_ick = { 3031 + .name = "omapctrl_ick", 3032 + .clkdm_name = "core_l4_clkdm", 3033 + .type = TI_CLK_GATE, 3034 + .data = &omapctrl_ick_data, 3035 + }; 3036 + 3037 + static struct ti_clk_fixed_factor omap_96m_d4_fck_data = { 3038 + .parent = "omap_96m_fck", 3039 + .div = 4, 3040 + .mult = 1, 3041 + }; 3042 + 3043 + static struct ti_clk omap_96m_d4_fck = { 3044 + .name = "omap_96m_d4_fck", 3045 + .type = TI_CLK_FIXED_FACTOR, 3046 + .data = &omap_96m_d4_fck_data, 3047 + }; 3048 + 3049 + static struct ti_clk_gate gpt6_ick_data = { 3050 + .parent = "per_l4_ick", 3051 + .bit_shift = 7, 3052 + .reg = 0x1010, 3053 + .module = TI_CLKM_CM, 3054 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3055 + }; 3056 + 3057 + static struct ti_clk gpt6_ick = { 3058 + .name = "gpt6_ick", 3059 + .clkdm_name = "per_clkdm", 3060 + .type = TI_CLK_GATE, 3061 + .data = &gpt6_ick_data, 3062 + }; 3063 + 3064 + static struct ti_clk_gate dpll3_m3x2_ck_omap36xx_data = { 3065 + .parent = "dpll3_m3x2_mul_ck", 3066 + .bit_shift = 0xc, 3067 + .reg = 0xd00, 3068 + .module = TI_CLKM_CM, 3069 + .flags = CLKF_HSDIV | CLKF_SET_BIT_TO_DISABLE, 3070 + }; 3071 + 3072 + static struct ti_clk dpll3_m3x2_ck_omap36xx = { 3073 + .name = "dpll3_m3x2_ck", 3074 + .type = TI_CLK_GATE, 3075 + .data = &dpll3_m3x2_ck_omap36xx_data, 3076 + .patch = &dpll3_m3x2_ck, 3077 + }; 3078 + 3079 + static struct ti_clk_gate i2c3_ick_data = { 3080 + .parent = "core_l4_ick", 3081 + .bit_shift = 17, 3082 + .reg = 0xa10, 3083 + .module = TI_CLKM_CM, 3084 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3085 + }; 3086 + 3087 + static struct ti_clk i2c3_ick = { 3088 + .name = "i2c3_ick", 3089 + .clkdm_name = "core_l4_clkdm", 3090 + .type = TI_CLK_GATE, 3091 + .data = &i2c3_ick_data, 3092 + }; 3093 + 3094 + static struct ti_clk_gate gpio6_ick_data = { 3095 + .parent = "per_l4_ick", 3096 + .bit_shift = 17, 3097 + .reg = 0x1010, 3098 + .module = TI_CLKM_CM, 3099 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3100 + }; 3101 + 3102 + static struct ti_clk gpio6_ick = { 3103 + .name = "gpio6_ick", 3104 + .clkdm_name = "per_clkdm", 3105 + .type = TI_CLK_GATE, 3106 + .data = &gpio6_ick_data, 3107 + }; 3108 + 3109 + static struct ti_clk_gate mspro_ick_data = { 3110 + .parent = "core_l4_ick", 3111 + .bit_shift = 23, 3112 + .reg = 0xa10, 3113 + .module = TI_CLKM_CM, 3114 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3115 + }; 3116 + 3117 + static struct ti_clk mspro_ick = { 3118 + .name = "mspro_ick", 3119 + .clkdm_name = "core_l4_clkdm", 3120 + .type = TI_CLK_GATE, 3121 + .data = &mspro_ick_data, 3122 + }; 3123 + 3124 + static struct ti_clk_composite mcbsp1_fck_data = { 3125 + .mux = &mcbsp1_mux_fck_data, 3126 + .gate = &mcbsp1_gate_fck_data, 3127 + }; 3128 + 3129 + static struct ti_clk mcbsp1_fck = { 3130 + .name = "mcbsp1_fck", 3131 + .type = TI_CLK_COMPOSITE, 3132 + .data = &mcbsp1_fck_data, 3133 + }; 3134 + 3135 + static struct ti_clk_gate gpt3_gate_fck_data = { 3136 + .parent = "sys_ck", 3137 + .bit_shift = 4, 3138 + .reg = 0x1000, 3139 + .module = TI_CLKM_CM, 3140 + }; 3141 + 3142 + static struct ti_clk_fixed rmii_ck_data = { 3143 + .frequency = 50000000, 3144 + }; 3145 + 3146 + static struct ti_clk rmii_ck = { 3147 + .name = "rmii_ck", 3148 + .type = TI_CLK_FIXED, 3149 + .data = &rmii_ck_data, 3150 + }; 3151 + 3152 + static struct ti_clk_gate gpt6_gate_fck_data = { 3153 + .parent = "sys_ck", 3154 + .bit_shift = 7, 3155 + .reg = 0x1000, 3156 + .module = TI_CLKM_CM, 3157 + }; 3158 + 3159 + static struct ti_clk_composite gpt6_fck_data = { 3160 + .mux = &gpt6_mux_fck_data, 3161 + .gate = &gpt6_gate_fck_data, 3162 + }; 3163 + 3164 + static struct ti_clk gpt6_fck = { 3165 + .name = "gpt6_fck", 3166 + .type = TI_CLK_COMPOSITE, 3167 + .data = &gpt6_fck_data, 3168 + }; 3169 + 3170 + static struct ti_clk_fixed_factor dpll5_m2_d4_ck_data = { 3171 + .parent = "dpll5_m2_ck", 3172 + .div = 4, 3173 + .mult = 1, 3174 + }; 3175 + 3176 + static struct ti_clk dpll5_m2_d4_ck = { 3177 + .name = "dpll5_m2_d4_ck", 3178 + .type = TI_CLK_FIXED_FACTOR, 3179 + .data = &dpll5_m2_d4_ck_data, 3180 + }; 3181 + 3182 + static struct ti_clk_fixed_factor sys_d2_ck_data = { 3183 + .parent = "sys_ck", 3184 + .div = 2, 3185 + .mult = 1, 3186 + }; 3187 + 3188 + static struct ti_clk sys_d2_ck = { 3189 + .name = "sys_d2_ck", 3190 + .type = TI_CLK_FIXED_FACTOR, 3191 + .data = &sys_d2_ck_data, 3192 + }; 3193 + 3194 + static struct ti_clk_fixed_factor omap_96m_d2_fck_data = { 3195 + .parent = "omap_96m_fck", 3196 + .div = 2, 3197 + .mult = 1, 3198 + }; 3199 + 3200 + static struct ti_clk omap_96m_d2_fck = { 3201 + .name = "omap_96m_d2_fck", 3202 + .type = TI_CLK_FIXED_FACTOR, 3203 + .data = &omap_96m_d2_fck_data, 3204 + }; 3205 + 3206 + static struct ti_clk_fixed_factor dpll5_m2_d8_ck_data = { 3207 + .parent = "dpll5_m2_ck", 3208 + .div = 8, 3209 + .mult = 1, 3210 + }; 3211 + 3212 + static struct ti_clk dpll5_m2_d8_ck = { 3213 + .name = "dpll5_m2_d8_ck", 3214 + .type = TI_CLK_FIXED_FACTOR, 3215 + .data = &dpll5_m2_d8_ck_data, 3216 + }; 3217 + 3218 + static struct ti_clk_fixed_factor dpll5_m2_d16_ck_data = { 3219 + .parent = "dpll5_m2_ck", 3220 + .div = 16, 3221 + .mult = 1, 3222 + }; 3223 + 3224 + static struct ti_clk dpll5_m2_d16_ck = { 3225 + .name = "dpll5_m2_d16_ck", 3226 + .type = TI_CLK_FIXED_FACTOR, 3227 + .data = &dpll5_m2_d16_ck_data, 3228 + }; 3229 + 3230 + static const char *usim_mux_fck_parents[] = { 3231 + "sys_ck", 3232 + "sys_d2_ck", 3233 + "omap_96m_d2_fck", 3234 + "omap_96m_d4_fck", 3235 + "omap_96m_d8_fck", 3236 + "omap_96m_d10_fck", 3237 + "dpll5_m2_d4_ck", 3238 + "dpll5_m2_d8_ck", 3239 + "dpll5_m2_d16_ck", 3240 + "dpll5_m2_d20_ck", 3241 + }; 3242 + 3243 + static struct ti_clk_mux usim_mux_fck_data = { 3244 + .bit_shift = 3, 3245 + .num_parents = ARRAY_SIZE(usim_mux_fck_parents), 3246 + .reg = 0xc40, 3247 + .module = TI_CLKM_CM, 3248 + .parents = usim_mux_fck_parents, 3249 + .flags = CLKF_INDEX_STARTS_AT_ONE, 3250 + }; 3251 + 3252 + static struct ti_clk_composite usim_fck_data = { 3253 + .mux = &usim_mux_fck_data, 3254 + .gate = &usim_gate_fck_data, 3255 + }; 3256 + 3257 + static struct ti_clk usim_fck = { 3258 + .name = "usim_fck", 3259 + .type = TI_CLK_COMPOSITE, 3260 + .data = &usim_fck_data, 3261 + }; 3262 + 3263 + static int ssi_ssr_div_fck_3430es2_divs[] = { 3264 + 0, 3265 + 1, 3266 + 2, 3267 + 3, 3268 + 4, 3269 + 0, 3270 + 6, 3271 + 0, 3272 + 8, 3273 + }; 3274 + 3275 + static struct ti_clk_divider ssi_ssr_div_fck_3430es2_data = { 3276 + .num_dividers = ARRAY_SIZE(ssi_ssr_div_fck_3430es2_divs), 3277 + .parent = "corex2_fck", 3278 + .bit_shift = 8, 3279 + .dividers = ssi_ssr_div_fck_3430es2_divs, 3280 + .reg = 0xa40, 3281 + .module = TI_CLKM_CM, 3282 + }; 3283 + 3284 + static struct ti_clk_composite ssi_ssr_fck_3430es2_data = { 3285 + .gate = &ssi_ssr_gate_fck_3430es2_data, 3286 + .divider = &ssi_ssr_div_fck_3430es2_data, 3287 + }; 3288 + 3289 + static struct ti_clk ssi_ssr_fck_3430es2 = { 3290 + .name = "ssi_ssr_fck", 3291 + .type = TI_CLK_COMPOSITE, 3292 + .data = &ssi_ssr_fck_3430es2_data, 3293 + }; 3294 + 3295 + static struct ti_clk_gate dss1_alwon_fck_3430es1_data = { 3296 + .parent = "dpll4_m4x2_ck", 3297 + .bit_shift = 0, 3298 + .reg = 0xe00, 3299 + .module = TI_CLKM_CM, 3300 + .flags = CLKF_SET_RATE_PARENT, 3301 + }; 3302 + 3303 + static struct ti_clk dss1_alwon_fck_3430es1 = { 3304 + .name = "dss1_alwon_fck", 3305 + .clkdm_name = "dss_clkdm", 3306 + .type = TI_CLK_GATE, 3307 + .data = &dss1_alwon_fck_3430es1_data, 3308 + }; 3309 + 3310 + static struct ti_clk_gate gpt3_ick_data = { 3311 + .parent = "per_l4_ick", 3312 + .bit_shift = 4, 3313 + .reg = 0x1010, 3314 + .module = TI_CLKM_CM, 3315 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3316 + }; 3317 + 3318 + static struct ti_clk gpt3_ick = { 3319 + .name = "gpt3_ick", 3320 + .clkdm_name = "per_clkdm", 3321 + .type = TI_CLK_GATE, 3322 + .data = &gpt3_ick_data, 3323 + }; 3324 + 3325 + static struct ti_clk_fixed_factor omap_12m_fck_data = { 3326 + .parent = "omap_48m_fck", 3327 + .div = 4, 3328 + .mult = 1, 3329 + }; 3330 + 3331 + static struct ti_clk omap_12m_fck = { 3332 + .name = "omap_12m_fck", 3333 + .type = TI_CLK_FIXED_FACTOR, 3334 + .data = &omap_12m_fck_data, 3335 + }; 3336 + 3337 + static struct ti_clk_fixed_factor core_12m_fck_data = { 3338 + .parent = "omap_12m_fck", 3339 + .div = 1, 3340 + .mult = 1, 3341 + }; 3342 + 3343 + static struct ti_clk core_12m_fck = { 3344 + .name = "core_12m_fck", 3345 + .type = TI_CLK_FIXED_FACTOR, 3346 + .data = &core_12m_fck_data, 3347 + }; 3348 + 3349 + static struct ti_clk_gate hdq_fck_data = { 3350 + .parent = "core_12m_fck", 3351 + .bit_shift = 22, 3352 + .reg = 0xa00, 3353 + .module = TI_CLKM_CM, 3354 + .flags = CLKF_WAIT, 3355 + }; 3356 + 3357 + static struct ti_clk hdq_fck = { 3358 + .name = "hdq_fck", 3359 + .clkdm_name = "core_l4_clkdm", 3360 + .type = TI_CLK_GATE, 3361 + .data = &hdq_fck_data, 3362 + }; 3363 + 3364 + static struct ti_clk_gate usbtll_fck_data = { 3365 + .parent = "dpll5_m2_ck", 3366 + .bit_shift = 2, 3367 + .reg = 0xa08, 3368 + .module = TI_CLKM_CM, 3369 + .flags = CLKF_WAIT, 3370 + }; 3371 + 3372 + static struct ti_clk usbtll_fck = { 3373 + .name = "usbtll_fck", 3374 + .clkdm_name = "core_l4_clkdm", 3375 + .type = TI_CLK_GATE, 3376 + .data = &usbtll_fck_data, 3377 + }; 3378 + 3379 + static struct ti_clk_gate hsotgusb_fck_am35xx_data = { 3380 + .parent = "sys_ck", 3381 + .bit_shift = 8, 3382 + .reg = 0x59c, 3383 + .module = TI_CLKM_SCRM, 3384 + }; 3385 + 3386 + static struct ti_clk hsotgusb_fck_am35xx = { 3387 + .name = "hsotgusb_fck_am35xx", 3388 + .clkdm_name = "core_l3_clkdm", 3389 + .type = TI_CLK_GATE, 3390 + .data = &hsotgusb_fck_am35xx_data, 3391 + }; 3392 + 3393 + static struct ti_clk_gate hsotgusb_ick_3430es2_data = { 3394 + .parent = "core_l3_ick", 3395 + .bit_shift = 4, 3396 + .reg = 0xa10, 3397 + .module = TI_CLKM_CM, 3398 + .flags = CLKF_HSOTGUSB | CLKF_OMAP3 | CLKF_INTERFACE, 3399 + }; 3400 + 3401 + static struct ti_clk hsotgusb_ick_3430es2 = { 3402 + .name = "hsotgusb_ick_3430es2", 3403 + .clkdm_name = "core_l3_clkdm", 3404 + .type = TI_CLK_GATE, 3405 + .data = &hsotgusb_ick_3430es2_data, 3406 + }; 3407 + 3408 + static struct ti_clk_gate gfx_l3_ck_data = { 3409 + .parent = "l3_ick", 3410 + .bit_shift = 0, 3411 + .reg = 0xb10, 3412 + .module = TI_CLKM_CM, 3413 + .flags = CLKF_WAIT, 3414 + }; 3415 + 3416 + static struct ti_clk gfx_l3_ck = { 3417 + .name = "gfx_l3_ck", 3418 + .clkdm_name = "gfx_3430es1_clkdm", 3419 + .type = TI_CLK_GATE, 3420 + .data = &gfx_l3_ck_data, 3421 + }; 3422 + 3423 + static struct ti_clk_fixed_factor gfx_l3_ick_data = { 3424 + .parent = "gfx_l3_ck", 3425 + .div = 1, 3426 + .mult = 1, 3427 + }; 3428 + 3429 + static struct ti_clk gfx_l3_ick = { 3430 + .name = "gfx_l3_ick", 3431 + .type = TI_CLK_FIXED_FACTOR, 3432 + .data = &gfx_l3_ick_data, 3433 + }; 3434 + 3435 + static struct ti_clk_gate mcbsp1_ick_data = { 3436 + .parent = "core_l4_ick", 3437 + .bit_shift = 9, 3438 + .reg = 0xa10, 3439 + .module = TI_CLKM_CM, 3440 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3441 + }; 3442 + 3443 + static struct ti_clk mcbsp1_ick = { 3444 + .name = "mcbsp1_ick", 3445 + .clkdm_name = "core_l4_clkdm", 3446 + .type = TI_CLK_GATE, 3447 + .data = &mcbsp1_ick_data, 3448 + }; 3449 + 3450 + static struct ti_clk_fixed_factor gpt12_fck_data = { 3451 + .parent = "secure_32k_fck", 3452 + .div = 1, 3453 + .mult = 1, 3454 + }; 3455 + 3456 + static struct ti_clk gpt12_fck = { 3457 + .name = "gpt12_fck", 3458 + .type = TI_CLK_FIXED_FACTOR, 3459 + .data = &gpt12_fck_data, 3460 + }; 3461 + 3462 + static struct ti_clk_gate gfx_cg2_ck_data = { 3463 + .parent = "gfx_l3_fck", 3464 + .bit_shift = 2, 3465 + .reg = 0xb00, 3466 + .module = TI_CLKM_CM, 3467 + .flags = CLKF_WAIT, 3468 + }; 3469 + 3470 + static struct ti_clk gfx_cg2_ck = { 3471 + .name = "gfx_cg2_ck", 3472 + .clkdm_name = "gfx_3430es1_clkdm", 3473 + .type = TI_CLK_GATE, 3474 + .data = &gfx_cg2_ck_data, 3475 + }; 3476 + 3477 + static struct ti_clk_gate i2c2_ick_data = { 3478 + .parent = "core_l4_ick", 3479 + .bit_shift = 16, 3480 + .reg = 0xa10, 3481 + .module = TI_CLKM_CM, 3482 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3483 + }; 3484 + 3485 + static struct ti_clk i2c2_ick = { 3486 + .name = "i2c2_ick", 3487 + .clkdm_name = "core_l4_clkdm", 3488 + .type = TI_CLK_GATE, 3489 + .data = &i2c2_ick_data, 3490 + }; 3491 + 3492 + static struct ti_clk_gate gpio4_dbck_data = { 3493 + .parent = "per_32k_alwon_fck", 3494 + .bit_shift = 15, 3495 + .reg = 0x1000, 3496 + .module = TI_CLKM_CM, 3497 + }; 3498 + 3499 + static struct ti_clk gpio4_dbck = { 3500 + .name = "gpio4_dbck", 3501 + .clkdm_name = "per_clkdm", 3502 + .type = TI_CLK_GATE, 3503 + .data = &gpio4_dbck_data, 3504 + }; 3505 + 3506 + static struct ti_clk_gate i2c3_fck_data = { 3507 + .parent = "core_96m_fck", 3508 + .bit_shift = 17, 3509 + .reg = 0xa00, 3510 + .module = TI_CLKM_CM, 3511 + .flags = CLKF_WAIT, 3512 + }; 3513 + 3514 + static struct ti_clk i2c3_fck = { 3515 + .name = "i2c3_fck", 3516 + .clkdm_name = "core_l4_clkdm", 3517 + .type = TI_CLK_GATE, 3518 + .data = &i2c3_fck_data, 3519 + }; 3520 + 3521 + static struct ti_clk_composite gpt3_fck_data = { 3522 + .mux = &gpt3_mux_fck_data, 3523 + .gate = &gpt3_gate_fck_data, 3524 + }; 3525 + 3526 + static struct ti_clk gpt3_fck = { 3527 + .name = "gpt3_fck", 3528 + .type = TI_CLK_COMPOSITE, 3529 + .data = &gpt3_fck_data, 3530 + }; 3531 + 3532 + static struct ti_clk_gate i2c1_ick_data = { 3533 + .parent = "core_l4_ick", 3534 + .bit_shift = 15, 3535 + .reg = 0xa10, 3536 + .module = TI_CLKM_CM, 3537 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3538 + }; 3539 + 3540 + static struct ti_clk i2c1_ick = { 3541 + .name = "i2c1_ick", 3542 + .clkdm_name = "core_l4_clkdm", 3543 + .type = TI_CLK_GATE, 3544 + .data = &i2c1_ick_data, 3545 + }; 3546 + 3547 + static struct ti_clk_gate omap_32ksync_ick_data = { 3548 + .parent = "wkup_l4_ick", 3549 + .bit_shift = 2, 3550 + .reg = 0xc10, 3551 + .module = TI_CLKM_CM, 3552 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3553 + }; 3554 + 3555 + static struct ti_clk omap_32ksync_ick = { 3556 + .name = "omap_32ksync_ick", 3557 + .clkdm_name = "wkup_clkdm", 3558 + .type = TI_CLK_GATE, 3559 + .data = &omap_32ksync_ick_data, 3560 + }; 3561 + 3562 + static struct ti_clk_gate aes2_ick_data = { 3563 + .parent = "core_l4_ick", 3564 + .bit_shift = 28, 3565 + .reg = 0xa10, 3566 + .module = TI_CLKM_CM, 3567 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3568 + }; 3569 + 3570 + static struct ti_clk aes2_ick = { 3571 + .name = "aes2_ick", 3572 + .clkdm_name = "core_l4_clkdm", 3573 + .type = TI_CLK_GATE, 3574 + .data = &aes2_ick_data, 3575 + }; 3576 + 3577 + static const char *gpt8_mux_fck_parents[] = { 3578 + "omap_32k_fck", 3579 + "sys_ck", 3580 + }; 3581 + 3582 + static struct ti_clk_mux gpt8_mux_fck_data = { 3583 + .bit_shift = 6, 3584 + .num_parents = ARRAY_SIZE(gpt8_mux_fck_parents), 3585 + .reg = 0x1040, 3586 + .module = TI_CLKM_CM, 3587 + .parents = gpt8_mux_fck_parents, 3588 + }; 3589 + 3590 + static struct ti_clk_composite gpt8_fck_data = { 3591 + .mux = &gpt8_mux_fck_data, 3592 + .gate = &gpt8_gate_fck_data, 3593 + }; 3594 + 3595 + static struct ti_clk gpt8_fck = { 3596 + .name = "gpt8_fck", 3597 + .type = TI_CLK_COMPOSITE, 3598 + .data = &gpt8_fck_data, 3599 + }; 3600 + 3601 + static struct ti_clk_gate mcbsp4_gate_fck_data = { 3602 + .parent = "mcbsp_clks", 3603 + .bit_shift = 2, 3604 + .reg = 0x1000, 3605 + .module = TI_CLKM_CM, 3606 + }; 3607 + 3608 + static struct ti_clk_composite mcbsp4_fck_data = { 3609 + .mux = &mcbsp4_mux_fck_data, 3610 + .gate = &mcbsp4_gate_fck_data, 3611 + }; 3612 + 3613 + static struct ti_clk mcbsp4_fck = { 3614 + .name = "mcbsp4_fck", 3615 + .type = TI_CLK_COMPOSITE, 3616 + .data = &mcbsp4_fck_data, 3617 + }; 3618 + 3619 + static struct ti_clk_gate gpio2_dbck_data = { 3620 + .parent = "per_32k_alwon_fck", 3621 + .bit_shift = 13, 3622 + .reg = 0x1000, 3623 + .module = TI_CLKM_CM, 3624 + }; 3625 + 3626 + static struct ti_clk gpio2_dbck = { 3627 + .name = "gpio2_dbck", 3628 + .clkdm_name = "per_clkdm", 3629 + .type = TI_CLK_GATE, 3630 + .data = &gpio2_dbck_data, 3631 + }; 3632 + 3633 + static struct ti_clk_gate usbtll_ick_data = { 3634 + .parent = "core_l4_ick", 3635 + .bit_shift = 2, 3636 + .reg = 0xa18, 3637 + .module = TI_CLKM_CM, 3638 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3639 + }; 3640 + 3641 + static struct ti_clk usbtll_ick = { 3642 + .name = "usbtll_ick", 3643 + .clkdm_name = "core_l4_clkdm", 3644 + .type = TI_CLK_GATE, 3645 + .data = &usbtll_ick_data, 3646 + }; 3647 + 3648 + static struct ti_clk_gate mcspi4_ick_data = { 3649 + .parent = "core_l4_ick", 3650 + .bit_shift = 21, 3651 + .reg = 0xa10, 3652 + .module = TI_CLKM_CM, 3653 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3654 + }; 3655 + 3656 + static struct ti_clk mcspi4_ick = { 3657 + .name = "mcspi4_ick", 3658 + .clkdm_name = "core_l4_clkdm", 3659 + .type = TI_CLK_GATE, 3660 + .data = &mcspi4_ick_data, 3661 + }; 3662 + 3663 + static struct ti_clk_gate dss_96m_fck_data = { 3664 + .parent = "omap_96m_fck", 3665 + .bit_shift = 2, 3666 + .reg = 0xe00, 3667 + .module = TI_CLKM_CM, 3668 + }; 3669 + 3670 + static struct ti_clk dss_96m_fck = { 3671 + .name = "dss_96m_fck", 3672 + .clkdm_name = "dss_clkdm", 3673 + .type = TI_CLK_GATE, 3674 + .data = &dss_96m_fck_data, 3675 + }; 3676 + 3677 + static struct ti_clk_divider rm_ick_data = { 3678 + .parent = "l4_ick", 3679 + .bit_shift = 1, 3680 + .max_div = 3, 3681 + .reg = 0xc40, 3682 + .module = TI_CLKM_CM, 3683 + .flags = CLKF_INDEX_STARTS_AT_ONE, 3684 + }; 3685 + 3686 + static struct ti_clk rm_ick = { 3687 + .name = "rm_ick", 3688 + .type = TI_CLK_DIVIDER, 3689 + .data = &rm_ick_data, 3690 + }; 3691 + 3692 + static struct ti_clk_gate hdq_ick_data = { 3693 + .parent = "core_l4_ick", 3694 + .bit_shift = 22, 3695 + .reg = 0xa10, 3696 + .module = TI_CLKM_CM, 3697 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3698 + }; 3699 + 3700 + static struct ti_clk hdq_ick = { 3701 + .name = "hdq_ick", 3702 + .clkdm_name = "core_l4_clkdm", 3703 + .type = TI_CLK_GATE, 3704 + .data = &hdq_ick_data, 3705 + }; 3706 + 3707 + static struct ti_clk_fixed_factor dpll3_x2_ck_data = { 3708 + .parent = "dpll3_ck", 3709 + .div = 1, 3710 + .mult = 2, 3711 + }; 3712 + 3713 + static struct ti_clk dpll3_x2_ck = { 3714 + .name = "dpll3_x2_ck", 3715 + .type = TI_CLK_FIXED_FACTOR, 3716 + .data = &dpll3_x2_ck_data, 3717 + }; 3718 + 3719 + static struct ti_clk_gate mad2d_ick_data = { 3720 + .parent = "l3_ick", 3721 + .bit_shift = 3, 3722 + .reg = 0xa18, 3723 + .module = TI_CLKM_CM, 3724 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3725 + }; 3726 + 3727 + static struct ti_clk mad2d_ick = { 3728 + .name = "mad2d_ick", 3729 + .clkdm_name = "d2d_clkdm", 3730 + .type = TI_CLK_GATE, 3731 + .data = &mad2d_ick_data, 3732 + }; 3733 + 3734 + static struct ti_clk_gate fshostusb_fck_data = { 3735 + .parent = "core_48m_fck", 3736 + .bit_shift = 5, 3737 + .reg = 0xa00, 3738 + .module = TI_CLKM_CM, 3739 + .flags = CLKF_WAIT, 3740 + }; 3741 + 3742 + static struct ti_clk fshostusb_fck = { 3743 + .name = "fshostusb_fck", 3744 + .clkdm_name = "core_l4_clkdm", 3745 + .type = TI_CLK_GATE, 3746 + .data = &fshostusb_fck_data, 3747 + }; 3748 + 3749 + static struct ti_clk_gate sr1_fck_data = { 3750 + .parent = "sys_ck", 3751 + .bit_shift = 6, 3752 + .reg = 0xc00, 3753 + .module = TI_CLKM_CM, 3754 + .flags = CLKF_WAIT, 3755 + }; 3756 + 3757 + static struct ti_clk sr1_fck = { 3758 + .name = "sr1_fck", 3759 + .clkdm_name = "wkup_clkdm", 3760 + .type = TI_CLK_GATE, 3761 + .data = &sr1_fck_data, 3762 + }; 3763 + 3764 + static struct ti_clk_gate des2_ick_data = { 3765 + .parent = "core_l4_ick", 3766 + .bit_shift = 26, 3767 + .reg = 0xa10, 3768 + .module = TI_CLKM_CM, 3769 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3770 + }; 3771 + 3772 + static struct ti_clk des2_ick = { 3773 + .name = "des2_ick", 3774 + .clkdm_name = "core_l4_clkdm", 3775 + .type = TI_CLK_GATE, 3776 + .data = &des2_ick_data, 3777 + }; 3778 + 3779 + static struct ti_clk_gate sdrc_ick_data = { 3780 + .parent = "core_l3_ick", 3781 + .bit_shift = 1, 3782 + .reg = 0xa10, 3783 + .module = TI_CLKM_CM, 3784 + .flags = CLKF_WAIT, 3785 + }; 3786 + 3787 + static struct ti_clk sdrc_ick = { 3788 + .name = "sdrc_ick", 3789 + .clkdm_name = "core_l3_clkdm", 3790 + .type = TI_CLK_GATE, 3791 + .data = &sdrc_ick_data, 3792 + }; 3793 + 3794 + static struct ti_clk_composite gpt4_fck_data = { 3795 + .mux = &gpt4_mux_fck_data, 3796 + .gate = &gpt4_gate_fck_data, 3797 + }; 3798 + 3799 + static struct ti_clk gpt4_fck = { 3800 + .name = "gpt4_fck", 3801 + .type = TI_CLK_COMPOSITE, 3802 + .data = &gpt4_fck_data, 3803 + }; 3804 + 3805 + static struct ti_clk_gate dpll4_m3x2_ck_omap36xx_data = { 3806 + .parent = "dpll4_m3x2_mul_ck", 3807 + .bit_shift = 0x1c, 3808 + .reg = 0xd00, 3809 + .module = TI_CLKM_CM, 3810 + .flags = CLKF_HSDIV | CLKF_SET_BIT_TO_DISABLE, 3811 + }; 3812 + 3813 + static struct ti_clk dpll4_m3x2_ck_omap36xx = { 3814 + .name = "dpll4_m3x2_ck", 3815 + .type = TI_CLK_GATE, 3816 + .data = &dpll4_m3x2_ck_omap36xx_data, 3817 + .patch = &dpll4_m3x2_ck, 3818 + }; 3819 + 3820 + static struct ti_clk_gate cpefuse_fck_data = { 3821 + .parent = "sys_ck", 3822 + .bit_shift = 0, 3823 + .reg = 0xa08, 3824 + .module = TI_CLKM_CM, 3825 + }; 3826 + 3827 + static struct ti_clk cpefuse_fck = { 3828 + .name = "cpefuse_fck", 3829 + .clkdm_name = "core_l4_clkdm", 3830 + .type = TI_CLK_GATE, 3831 + .data = &cpefuse_fck_data, 3832 + }; 3833 + 3834 + static struct ti_clk_gate mcspi3_ick_data = { 3835 + .parent = "core_l4_ick", 3836 + .bit_shift = 20, 3837 + .reg = 0xa10, 3838 + .module = TI_CLKM_CM, 3839 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3840 + }; 3841 + 3842 + static struct ti_clk mcspi3_ick = { 3843 + .name = "mcspi3_ick", 3844 + .clkdm_name = "core_l4_clkdm", 3845 + .type = TI_CLK_GATE, 3846 + .data = &mcspi3_ick_data, 3847 + }; 3848 + 3849 + static struct ti_clk_fixed_factor ssi_sst_fck_3430es2_data = { 3850 + .parent = "ssi_ssr_fck", 3851 + .div = 2, 3852 + .mult = 1, 3853 + }; 3854 + 3855 + static struct ti_clk ssi_sst_fck_3430es2 = { 3856 + .name = "ssi_sst_fck", 3857 + .type = TI_CLK_FIXED_FACTOR, 3858 + .data = &ssi_sst_fck_3430es2_data, 3859 + }; 3860 + 3861 + static struct ti_clk_gate gpio1_dbck_data = { 3862 + .parent = "wkup_32k_fck", 3863 + .bit_shift = 3, 3864 + .reg = 0xc00, 3865 + .module = TI_CLKM_CM, 3866 + }; 3867 + 3868 + static struct ti_clk gpio1_dbck = { 3869 + .name = "gpio1_dbck", 3870 + .clkdm_name = "wkup_clkdm", 3871 + .type = TI_CLK_GATE, 3872 + .data = &gpio1_dbck_data, 3873 + }; 3874 + 3875 + static struct ti_clk_gate gpt4_ick_data = { 3876 + .parent = "per_l4_ick", 3877 + .bit_shift = 5, 3878 + .reg = 0x1010, 3879 + .module = TI_CLKM_CM, 3880 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3881 + }; 3882 + 3883 + static struct ti_clk gpt4_ick = { 3884 + .name = "gpt4_ick", 3885 + .clkdm_name = "per_clkdm", 3886 + .type = TI_CLK_GATE, 3887 + .data = &gpt4_ick_data, 3888 + }; 3889 + 3890 + static struct ti_clk_gate gpt2_ick_data = { 3891 + .parent = "per_l4_ick", 3892 + .bit_shift = 3, 3893 + .reg = 0x1010, 3894 + .module = TI_CLKM_CM, 3895 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3896 + }; 3897 + 3898 + static struct ti_clk gpt2_ick = { 3899 + .name = "gpt2_ick", 3900 + .clkdm_name = "per_clkdm", 3901 + .type = TI_CLK_GATE, 3902 + .data = &gpt2_ick_data, 3903 + }; 3904 + 3905 + static struct ti_clk_gate mmchs1_fck_data = { 3906 + .parent = "core_96m_fck", 3907 + .bit_shift = 24, 3908 + .reg = 0xa00, 3909 + .module = TI_CLKM_CM, 3910 + .flags = CLKF_WAIT, 3911 + }; 3912 + 3913 + static struct ti_clk mmchs1_fck = { 3914 + .name = "mmchs1_fck", 3915 + .clkdm_name = "core_l4_clkdm", 3916 + .type = TI_CLK_GATE, 3917 + .data = &mmchs1_fck_data, 3918 + }; 3919 + 3920 + static struct ti_clk_fixed dummy_apb_pclk_data = { 3921 + .frequency = 0x0, 3922 + }; 3923 + 3924 + static struct ti_clk dummy_apb_pclk = { 3925 + .name = "dummy_apb_pclk", 3926 + .type = TI_CLK_FIXED, 3927 + .data = &dummy_apb_pclk_data, 3928 + }; 3929 + 3930 + static struct ti_clk_gate gpio6_dbck_data = { 3931 + .parent = "per_32k_alwon_fck", 3932 + .bit_shift = 17, 3933 + .reg = 0x1000, 3934 + .module = TI_CLKM_CM, 3935 + }; 3936 + 3937 + static struct ti_clk gpio6_dbck = { 3938 + .name = "gpio6_dbck", 3939 + .clkdm_name = "per_clkdm", 3940 + .type = TI_CLK_GATE, 3941 + .data = &gpio6_dbck_data, 3942 + }; 3943 + 3944 + static struct ti_clk_gate uart2_ick_data = { 3945 + .parent = "core_l4_ick", 3946 + .bit_shift = 14, 3947 + .reg = 0xa10, 3948 + .module = TI_CLKM_CM, 3949 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3950 + }; 3951 + 3952 + static struct ti_clk uart2_ick = { 3953 + .name = "uart2_ick", 3954 + .clkdm_name = "core_l4_clkdm", 3955 + .type = TI_CLK_GATE, 3956 + .data = &uart2_ick_data, 3957 + }; 3958 + 3959 + static struct ti_clk_fixed_factor dpll4_x2_ck_data = { 3960 + .parent = "dpll4_ck", 3961 + .div = 1, 3962 + .mult = 2, 3963 + }; 3964 + 3965 + static struct ti_clk dpll4_x2_ck = { 3966 + .name = "dpll4_x2_ck", 3967 + .type = TI_CLK_FIXED_FACTOR, 3968 + .data = &dpll4_x2_ck_data, 3969 + }; 3970 + 3971 + static struct ti_clk_gate gpt7_ick_data = { 3972 + .parent = "per_l4_ick", 3973 + .bit_shift = 8, 3974 + .reg = 0x1010, 3975 + .module = TI_CLKM_CM, 3976 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 3977 + }; 3978 + 3979 + static struct ti_clk gpt7_ick = { 3980 + .name = "gpt7_ick", 3981 + .clkdm_name = "per_clkdm", 3982 + .type = TI_CLK_GATE, 3983 + .data = &gpt7_ick_data, 3984 + }; 3985 + 3986 + static struct ti_clk_gate dss_tv_fck_data = { 3987 + .parent = "omap_54m_fck", 3988 + .bit_shift = 2, 3989 + .reg = 0xe00, 3990 + .module = TI_CLKM_CM, 3991 + }; 3992 + 3993 + static struct ti_clk dss_tv_fck = { 3994 + .name = "dss_tv_fck", 3995 + .clkdm_name = "dss_clkdm", 3996 + .type = TI_CLK_GATE, 3997 + .data = &dss_tv_fck_data, 3998 + }; 3999 + 4000 + static struct ti_clk_gate mcbsp5_ick_data = { 4001 + .parent = "core_l4_ick", 4002 + .bit_shift = 10, 4003 + .reg = 0xa10, 4004 + .module = TI_CLKM_CM, 4005 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 4006 + }; 4007 + 4008 + static struct ti_clk mcbsp5_ick = { 4009 + .name = "mcbsp5_ick", 4010 + .clkdm_name = "core_l4_clkdm", 4011 + .type = TI_CLK_GATE, 4012 + .data = &mcbsp5_ick_data, 4013 + }; 4014 + 4015 + static struct ti_clk_gate mcspi1_ick_data = { 4016 + .parent = "core_l4_ick", 4017 + .bit_shift = 18, 4018 + .reg = 0xa10, 4019 + .module = TI_CLKM_CM, 4020 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 4021 + }; 4022 + 4023 + static struct ti_clk mcspi1_ick = { 4024 + .name = "mcspi1_ick", 4025 + .clkdm_name = "core_l4_clkdm", 4026 + .type = TI_CLK_GATE, 4027 + .data = &mcspi1_ick_data, 4028 + }; 4029 + 4030 + static struct ti_clk_gate d2d_26m_fck_data = { 4031 + .parent = "sys_ck", 4032 + .bit_shift = 3, 4033 + .reg = 0xa00, 4034 + .module = TI_CLKM_CM, 4035 + .flags = CLKF_WAIT, 4036 + }; 4037 + 4038 + static struct ti_clk d2d_26m_fck = { 4039 + .name = "d2d_26m_fck", 4040 + .clkdm_name = "d2d_clkdm", 4041 + .type = TI_CLK_GATE, 4042 + .data = &d2d_26m_fck_data, 4043 + }; 4044 + 4045 + static struct ti_clk_gate wdt3_ick_data = { 4046 + .parent = "per_l4_ick", 4047 + .bit_shift = 12, 4048 + .reg = 0x1010, 4049 + .module = TI_CLKM_CM, 4050 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 4051 + }; 4052 + 4053 + static struct ti_clk wdt3_ick = { 4054 + .name = "wdt3_ick", 4055 + .clkdm_name = "per_clkdm", 4056 + .type = TI_CLK_GATE, 4057 + .data = &wdt3_ick_data, 4058 + }; 4059 + 4060 + static struct ti_clk_divider pclkx2_fck_data = { 4061 + .parent = "emu_src_ck", 4062 + .bit_shift = 6, 4063 + .max_div = 3, 4064 + .reg = 0x1140, 4065 + .module = TI_CLKM_CM, 4066 + .flags = CLKF_INDEX_STARTS_AT_ONE, 4067 + }; 4068 + 4069 + static struct ti_clk pclkx2_fck = { 4070 + .name = "pclkx2_fck", 4071 + .type = TI_CLK_DIVIDER, 4072 + .data = &pclkx2_fck_data, 4073 + }; 4074 + 4075 + static struct ti_clk_gate sha12_ick_data = { 4076 + .parent = "core_l4_ick", 4077 + .bit_shift = 27, 4078 + .reg = 0xa10, 4079 + .module = TI_CLKM_CM, 4080 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 4081 + }; 4082 + 4083 + static struct ti_clk sha12_ick = { 4084 + .name = "sha12_ick", 4085 + .clkdm_name = "core_l4_clkdm", 4086 + .type = TI_CLK_GATE, 4087 + .data = &sha12_ick_data, 4088 + }; 4089 + 4090 + static struct ti_clk_gate emac_fck_data = { 4091 + .parent = "rmii_ck", 4092 + .bit_shift = 9, 4093 + .reg = 0x59c, 4094 + .module = TI_CLKM_SCRM, 4095 + }; 4096 + 4097 + static struct ti_clk emac_fck = { 4098 + .name = "emac_fck", 4099 + .type = TI_CLK_GATE, 4100 + .data = &emac_fck_data, 4101 + }; 4102 + 4103 + static struct ti_clk_composite gpt10_fck_data = { 4104 + .mux = &gpt10_mux_fck_data, 4105 + .gate = &gpt10_gate_fck_data, 4106 + }; 4107 + 4108 + static struct ti_clk gpt10_fck = { 4109 + .name = "gpt10_fck", 4110 + .type = TI_CLK_COMPOSITE, 4111 + .data = &gpt10_fck_data, 4112 + }; 4113 + 4114 + static struct ti_clk_gate wdt2_fck_data = { 4115 + .parent = "wkup_32k_fck", 4116 + .bit_shift = 5, 4117 + .reg = 0xc00, 4118 + .module = TI_CLKM_CM, 4119 + .flags = CLKF_WAIT, 4120 + }; 4121 + 4122 + static struct ti_clk wdt2_fck = { 4123 + .name = "wdt2_fck", 4124 + .clkdm_name = "wkup_clkdm", 4125 + .type = TI_CLK_GATE, 4126 + .data = &wdt2_fck_data, 4127 + }; 4128 + 4129 + static struct ti_clk_gate cam_ick_data = { 4130 + .parent = "l4_ick", 4131 + .bit_shift = 0, 4132 + .reg = 0xf10, 4133 + .module = TI_CLKM_CM, 4134 + .flags = CLKF_OMAP3 | CLKF_NO_WAIT | CLKF_INTERFACE, 4135 + }; 4136 + 4137 + static struct ti_clk cam_ick = { 4138 + .name = "cam_ick", 4139 + .clkdm_name = "cam_clkdm", 4140 + .type = TI_CLK_GATE, 4141 + .data = &cam_ick_data, 4142 + }; 4143 + 4144 + static struct ti_clk_gate ssi_ick_3430es2_data = { 4145 + .parent = "ssi_l4_ick", 4146 + .bit_shift = 0, 4147 + .reg = 0xa10, 4148 + .module = TI_CLKM_CM, 4149 + .flags = CLKF_SSI | CLKF_OMAP3 | CLKF_INTERFACE, 4150 + }; 4151 + 4152 + static struct ti_clk ssi_ick_3430es2 = { 4153 + .name = "ssi_ick", 4154 + .clkdm_name = "core_l4_clkdm", 4155 + .type = TI_CLK_GATE, 4156 + .data = &ssi_ick_3430es2_data, 4157 + }; 4158 + 4159 + static struct ti_clk_gate gpio4_ick_data = { 4160 + .parent = "per_l4_ick", 4161 + .bit_shift = 15, 4162 + .reg = 0x1010, 4163 + .module = TI_CLKM_CM, 4164 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 4165 + }; 4166 + 4167 + static struct ti_clk gpio4_ick = { 4168 + .name = "gpio4_ick", 4169 + .clkdm_name = "per_clkdm", 4170 + .type = TI_CLK_GATE, 4171 + .data = &gpio4_ick_data, 4172 + }; 4173 + 4174 + static struct ti_clk_gate wdt1_ick_data = { 4175 + .parent = "wkup_l4_ick", 4176 + .bit_shift = 4, 4177 + .reg = 0xc10, 4178 + .module = TI_CLKM_CM, 4179 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 4180 + }; 4181 + 4182 + static struct ti_clk wdt1_ick = { 4183 + .name = "wdt1_ick", 4184 + .clkdm_name = "wkup_clkdm", 4185 + .type = TI_CLK_GATE, 4186 + .data = &wdt1_ick_data, 4187 + }; 4188 + 4189 + static struct ti_clk_gate rng_ick_data = { 4190 + .parent = "security_l4_ick2", 4191 + .bit_shift = 2, 4192 + .reg = 0xa14, 4193 + .module = TI_CLKM_CM, 4194 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 4195 + }; 4196 + 4197 + static struct ti_clk rng_ick = { 4198 + .name = "rng_ick", 4199 + .type = TI_CLK_GATE, 4200 + .data = &rng_ick_data, 4201 + }; 4202 + 4203 + static struct ti_clk_gate icr_ick_data = { 4204 + .parent = "core_l4_ick", 4205 + .bit_shift = 29, 4206 + .reg = 0xa10, 4207 + .module = TI_CLKM_CM, 4208 + .flags = CLKF_OMAP3 | CLKF_INTERFACE, 4209 + }; 4210 + 4211 + static struct ti_clk icr_ick = { 4212 + .name = "icr_ick", 4213 + .clkdm_name = "core_l4_clkdm", 4214 + .type = TI_CLK_GATE, 4215 + .data = &icr_ick_data, 4216 + }; 4217 + 4218 + static struct ti_clk_gate sgx_ick_data = { 4219 + .parent = "l3_ick", 4220 + .bit_shift = 0, 4221 + .reg = 0xb10, 4222 + .module = TI_CLKM_CM, 4223 + .flags = CLKF_WAIT, 4224 + }; 4225 + 4226 + static struct ti_clk sgx_ick = { 4227 + .name = "sgx_ick", 4228 + .clkdm_name = "sgx_clkdm", 4229 + .type = TI_CLK_GATE, 4230 + .data = &sgx_ick_data, 4231 + }; 4232 + 4233 + static struct ti_clk_divider sys_clkout2_data = { 4234 + .parent = "clkout2_src_ck", 4235 + .bit_shift = 3, 4236 + .max_div = 64, 4237 + .reg = 0xd70, 4238 + .module = TI_CLKM_CM, 4239 + .flags = CLKF_INDEX_POWER_OF_TWO, 4240 + }; 4241 + 4242 + static struct ti_clk sys_clkout2 = { 4243 + .name = "sys_clkout2", 4244 + .type = TI_CLK_DIVIDER, 4245 + .data = &sys_clkout2_data, 4246 + }; 4247 + 4248 + static struct ti_clk_alias omap34xx_omap36xx_clks[] = { 4249 + CLK(NULL, "security_l4_ick2", &security_l4_ick2), 4250 + CLK(NULL, "aes1_ick", &aes1_ick), 4251 + CLK("omap_rng", "ick", &rng_ick), 4252 + CLK("omap3-rom-rng", "ick", &rng_ick), 4253 + CLK(NULL, "sha11_ick", &sha11_ick), 4254 + CLK(NULL, "des1_ick", &des1_ick), 4255 + CLK(NULL, "cam_mclk", &cam_mclk), 4256 + CLK(NULL, "cam_ick", &cam_ick), 4257 + CLK(NULL, "csi2_96m_fck", &csi2_96m_fck), 4258 + CLK(NULL, "security_l3_ick", &security_l3_ick), 4259 + CLK(NULL, "pka_ick", &pka_ick), 4260 + CLK(NULL, "icr_ick", &icr_ick), 4261 + CLK(NULL, "des2_ick", &des2_ick), 4262 + CLK(NULL, "mspro_ick", &mspro_ick), 4263 + CLK(NULL, "mailboxes_ick", &mailboxes_ick), 4264 + CLK(NULL, "ssi_l4_ick", &ssi_l4_ick), 4265 + CLK(NULL, "sr1_fck", &sr1_fck), 4266 + CLK(NULL, "sr2_fck", &sr2_fck), 4267 + CLK(NULL, "sr_l4_ick", &sr_l4_ick), 4268 + CLK(NULL, "dpll2_fck", &dpll2_fck), 4269 + CLK(NULL, "dpll2_ck", &dpll2_ck), 4270 + CLK(NULL, "dpll2_m2_ck", &dpll2_m2_ck), 4271 + CLK(NULL, "iva2_ck", &iva2_ck), 4272 + CLK(NULL, "modem_fck", &modem_fck), 4273 + CLK(NULL, "sad2d_ick", &sad2d_ick), 4274 + CLK(NULL, "mad2d_ick", &mad2d_ick), 4275 + CLK(NULL, "mspro_fck", &mspro_fck), 4276 + { NULL }, 4277 + }; 4278 + 4279 + static struct ti_clk_alias omap36xx_omap3430es2plus_clks[] = { 4280 + CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es2), 4281 + CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es2), 4282 + CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es2), 4283 + CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es2), 4284 + CLK(NULL, "ssi_ick", &ssi_ick_3430es2), 4285 + CLK(NULL, "sys_d2_ck", &sys_d2_ck), 4286 + CLK(NULL, "omap_96m_d2_fck", &omap_96m_d2_fck), 4287 + CLK(NULL, "omap_96m_d4_fck", &omap_96m_d4_fck), 4288 + CLK(NULL, "omap_96m_d8_fck", &omap_96m_d8_fck), 4289 + CLK(NULL, "omap_96m_d10_fck", &omap_96m_d10_fck), 4290 + CLK(NULL, "dpll5_m2_d4_ck", &dpll5_m2_d4_ck), 4291 + CLK(NULL, "dpll5_m2_d8_ck", &dpll5_m2_d8_ck), 4292 + CLK(NULL, "dpll5_m2_d16_ck", &dpll5_m2_d16_ck), 4293 + CLK(NULL, "dpll5_m2_d20_ck", &dpll5_m2_d20_ck), 4294 + CLK(NULL, "usim_fck", &usim_fck), 4295 + CLK(NULL, "usim_ick", &usim_ick), 4296 + { NULL }, 4297 + }; 4298 + 4299 + static struct ti_clk_alias omap3xxx_clks[] = { 4300 + CLK(NULL, "apb_pclk", &dummy_apb_pclk), 4301 + CLK(NULL, "omap_32k_fck", &omap_32k_fck), 4302 + CLK(NULL, "virt_12m_ck", &virt_12m_ck), 4303 + CLK(NULL, "virt_13m_ck", &virt_13m_ck), 4304 + CLK(NULL, "virt_19200000_ck", &virt_19200000_ck), 4305 + CLK(NULL, "virt_26000000_ck", &virt_26000000_ck), 4306 + CLK(NULL, "virt_38_4m_ck", &virt_38_4m_ck), 4307 + CLK(NULL, "virt_16_8m_ck", &virt_16_8m_ck), 4308 + CLK(NULL, "osc_sys_ck", &osc_sys_ck), 4309 + CLK("twl", "fck", &osc_sys_ck), 4310 + CLK(NULL, "sys_ck", &sys_ck), 4311 + CLK(NULL, "timer_sys_ck", &sys_ck), 4312 + CLK(NULL, "dpll4_ck", &dpll4_ck), 4313 + CLK(NULL, "dpll4_m2_ck", &dpll4_m2_ck), 4314 + CLK(NULL, "dpll4_m2x2_mul_ck", &dpll4_m2x2_mul_ck), 4315 + CLK(NULL, "dpll4_m2x2_ck", &dpll4_m2x2_ck), 4316 + CLK(NULL, "omap_96m_alwon_fck", &omap_96m_alwon_fck), 4317 + CLK(NULL, "dpll3_ck", &dpll3_ck), 4318 + CLK(NULL, "dpll3_m3_ck", &dpll3_m3_ck), 4319 + CLK(NULL, "dpll3_m3x2_mul_ck", &dpll3_m3x2_mul_ck), 4320 + CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck), 4321 + CLK("etb", "emu_core_alwon_ck", &emu_core_alwon_ck), 4322 + CLK(NULL, "sys_altclk", &sys_altclk), 4323 + CLK(NULL, "mcbsp_clks", &mcbsp_clks), 4324 + CLK(NULL, "sys_clkout1", &sys_clkout1), 4325 + CLK(NULL, "dpll3_m2_ck", &dpll3_m2_ck), 4326 + CLK(NULL, "core_ck", &core_ck), 4327 + CLK(NULL, "dpll1_fck", &dpll1_fck), 4328 + CLK(NULL, "dpll1_ck", &dpll1_ck), 4329 + CLK(NULL, "cpufreq_ck", &dpll1_ck), 4330 + CLK(NULL, "dpll1_x2_ck", &dpll1_x2_ck), 4331 + CLK(NULL, "dpll1_x2m2_ck", &dpll1_x2m2_ck), 4332 + CLK(NULL, "dpll3_x2_ck", &dpll3_x2_ck), 4333 + CLK(NULL, "dpll3_m2x2_ck", &dpll3_m2x2_ck), 4334 + CLK(NULL, "dpll4_x2_ck", &dpll4_x2_ck), 4335 + CLK(NULL, "cm_96m_fck", &cm_96m_fck), 4336 + CLK(NULL, "omap_96m_fck", &omap_96m_fck), 4337 + CLK(NULL, "dpll4_m3_ck", &dpll4_m3_ck), 4338 + CLK(NULL, "dpll4_m3x2_mul_ck", &dpll4_m3x2_mul_ck), 4339 + CLK(NULL, "dpll4_m3x2_ck", &dpll4_m3x2_ck), 4340 + CLK(NULL, "omap_54m_fck", &omap_54m_fck), 4341 + CLK(NULL, "cm_96m_d2_fck", &cm_96m_d2_fck), 4342 + CLK(NULL, "omap_48m_fck", &omap_48m_fck), 4343 + CLK(NULL, "omap_12m_fck", &omap_12m_fck), 4344 + CLK(NULL, "dpll4_m4_ck", &dpll4_m4_ck), 4345 + CLK(NULL, "dpll4_m4x2_mul_ck", &dpll4_m4x2_mul_ck), 4346 + CLK(NULL, "dpll4_m4x2_ck", &dpll4_m4x2_ck), 4347 + CLK(NULL, "dpll4_m5_ck", &dpll4_m5_ck), 4348 + CLK(NULL, "dpll4_m5x2_mul_ck", &dpll4_m5x2_mul_ck), 4349 + CLK(NULL, "dpll4_m5x2_ck", &dpll4_m5x2_ck), 4350 + CLK(NULL, "dpll4_m6_ck", &dpll4_m6_ck), 4351 + CLK(NULL, "dpll4_m6x2_mul_ck", &dpll4_m6x2_mul_ck), 4352 + CLK(NULL, "dpll4_m6x2_ck", &dpll4_m6x2_ck), 4353 + CLK("etb", "emu_per_alwon_ck", &emu_per_alwon_ck), 4354 + CLK(NULL, "clkout2_src_ck", &clkout2_src_ck), 4355 + CLK(NULL, "sys_clkout2", &sys_clkout2), 4356 + CLK(NULL, "corex2_fck", &corex2_fck), 4357 + CLK(NULL, "mpu_ck", &mpu_ck), 4358 + CLK(NULL, "arm_fck", &arm_fck), 4359 + CLK("etb", "emu_mpu_alwon_ck", &emu_mpu_alwon_ck), 4360 + CLK(NULL, "l3_ick", &l3_ick), 4361 + CLK(NULL, "l4_ick", &l4_ick), 4362 + CLK(NULL, "rm_ick", &rm_ick), 4363 + CLK(NULL, "timer_32k_ck", &omap_32k_fck), 4364 + CLK(NULL, "gpt10_fck", &gpt10_fck), 4365 + CLK(NULL, "gpt11_fck", &gpt11_fck), 4366 + CLK(NULL, "core_96m_fck", &core_96m_fck), 4367 + CLK(NULL, "mmchs2_fck", &mmchs2_fck), 4368 + CLK(NULL, "mmchs1_fck", &mmchs1_fck), 4369 + CLK(NULL, "i2c3_fck", &i2c3_fck), 4370 + CLK(NULL, "i2c2_fck", &i2c2_fck), 4371 + CLK(NULL, "i2c1_fck", &i2c1_fck), 4372 + CLK(NULL, "mcbsp5_fck", &mcbsp5_fck), 4373 + CLK(NULL, "mcbsp1_fck", &mcbsp1_fck), 4374 + CLK(NULL, "core_48m_fck", &core_48m_fck), 4375 + CLK(NULL, "mcspi4_fck", &mcspi4_fck), 4376 + CLK(NULL, "mcspi3_fck", &mcspi3_fck), 4377 + CLK(NULL, "mcspi2_fck", &mcspi2_fck), 4378 + CLK(NULL, "mcspi1_fck", &mcspi1_fck), 4379 + CLK(NULL, "uart2_fck", &uart2_fck), 4380 + CLK(NULL, "uart1_fck", &uart1_fck), 4381 + CLK(NULL, "core_12m_fck", &core_12m_fck), 4382 + CLK("omap_hdq.0", "fck", &hdq_fck), 4383 + CLK(NULL, "hdq_fck", &hdq_fck), 4384 + CLK(NULL, "core_l3_ick", &core_l3_ick), 4385 + CLK(NULL, "sdrc_ick", &sdrc_ick), 4386 + CLK(NULL, "gpmc_fck", &gpmc_fck), 4387 + CLK(NULL, "core_l4_ick", &core_l4_ick), 4388 + CLK("omap_hsmmc.1", "ick", &mmchs2_ick), 4389 + CLK("omap_hsmmc.0", "ick", &mmchs1_ick), 4390 + CLK(NULL, "mmchs2_ick", &mmchs2_ick), 4391 + CLK(NULL, "mmchs1_ick", &mmchs1_ick), 4392 + CLK("omap_hdq.0", "ick", &hdq_ick), 4393 + CLK(NULL, "hdq_ick", &hdq_ick), 4394 + CLK("omap2_mcspi.4", "ick", &mcspi4_ick), 4395 + CLK("omap2_mcspi.3", "ick", &mcspi3_ick), 4396 + CLK("omap2_mcspi.2", "ick", &mcspi2_ick), 4397 + CLK("omap2_mcspi.1", "ick", &mcspi1_ick), 4398 + CLK(NULL, "mcspi4_ick", &mcspi4_ick), 4399 + CLK(NULL, "mcspi3_ick", &mcspi3_ick), 4400 + CLK(NULL, "mcspi2_ick", &mcspi2_ick), 4401 + CLK(NULL, "mcspi1_ick", &mcspi1_ick), 4402 + CLK("omap_i2c.3", "ick", &i2c3_ick), 4403 + CLK("omap_i2c.2", "ick", &i2c2_ick), 4404 + CLK("omap_i2c.1", "ick", &i2c1_ick), 4405 + CLK(NULL, "i2c3_ick", &i2c3_ick), 4406 + CLK(NULL, "i2c2_ick", &i2c2_ick), 4407 + CLK(NULL, "i2c1_ick", &i2c1_ick), 4408 + CLK(NULL, "uart2_ick", &uart2_ick), 4409 + CLK(NULL, "uart1_ick", &uart1_ick), 4410 + CLK(NULL, "gpt11_ick", &gpt11_ick), 4411 + CLK(NULL, "gpt10_ick", &gpt10_ick), 4412 + CLK("omap-mcbsp.5", "ick", &mcbsp5_ick), 4413 + CLK("omap-mcbsp.1", "ick", &mcbsp1_ick), 4414 + CLK(NULL, "mcbsp5_ick", &mcbsp5_ick), 4415 + CLK(NULL, "mcbsp1_ick", &mcbsp1_ick), 4416 + CLK(NULL, "omapctrl_ick", &omapctrl_ick), 4417 + CLK(NULL, "dss_tv_fck", &dss_tv_fck), 4418 + CLK(NULL, "dss_96m_fck", &dss_96m_fck), 4419 + CLK(NULL, "dss2_alwon_fck", &dss2_alwon_fck), 4420 + CLK(NULL, "init_60m_fclk", &dummy_ck), 4421 + CLK(NULL, "gpt1_fck", &gpt1_fck), 4422 + CLK(NULL, "aes2_ick", &aes2_ick), 4423 + CLK(NULL, "wkup_32k_fck", &wkup_32k_fck), 4424 + CLK(NULL, "gpio1_dbck", &gpio1_dbck), 4425 + CLK(NULL, "sha12_ick", &sha12_ick), 4426 + CLK(NULL, "wdt2_fck", &wdt2_fck), 4427 + CLK(NULL, "wkup_l4_ick", &wkup_l4_ick), 4428 + CLK("omap_wdt", "ick", &wdt2_ick), 4429 + CLK(NULL, "wdt2_ick", &wdt2_ick), 4430 + CLK(NULL, "wdt1_ick", &wdt1_ick), 4431 + CLK(NULL, "gpio1_ick", &gpio1_ick), 4432 + CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick), 4433 + CLK(NULL, "gpt12_ick", &gpt12_ick), 4434 + CLK(NULL, "gpt1_ick", &gpt1_ick), 4435 + CLK(NULL, "per_96m_fck", &per_96m_fck), 4436 + CLK(NULL, "per_48m_fck", &per_48m_fck), 4437 + CLK(NULL, "uart3_fck", &uart3_fck), 4438 + CLK(NULL, "gpt2_fck", &gpt2_fck), 4439 + CLK(NULL, "gpt3_fck", &gpt3_fck), 4440 + CLK(NULL, "gpt4_fck", &gpt4_fck), 4441 + CLK(NULL, "gpt5_fck", &gpt5_fck), 4442 + CLK(NULL, "gpt6_fck", &gpt6_fck), 4443 + CLK(NULL, "gpt7_fck", &gpt7_fck), 4444 + CLK(NULL, "gpt8_fck", &gpt8_fck), 4445 + CLK(NULL, "gpt9_fck", &gpt9_fck), 4446 + CLK(NULL, "per_32k_alwon_fck", &per_32k_alwon_fck), 4447 + CLK(NULL, "gpio6_dbck", &gpio6_dbck), 4448 + CLK(NULL, "gpio5_dbck", &gpio5_dbck), 4449 + CLK(NULL, "gpio4_dbck", &gpio4_dbck), 4450 + CLK(NULL, "gpio3_dbck", &gpio3_dbck), 4451 + CLK(NULL, "gpio2_dbck", &gpio2_dbck), 4452 + CLK(NULL, "wdt3_fck", &wdt3_fck), 4453 + CLK(NULL, "per_l4_ick", &per_l4_ick), 4454 + CLK(NULL, "gpio6_ick", &gpio6_ick), 4455 + CLK(NULL, "gpio5_ick", &gpio5_ick), 4456 + CLK(NULL, "gpio4_ick", &gpio4_ick), 4457 + CLK(NULL, "gpio3_ick", &gpio3_ick), 4458 + CLK(NULL, "gpio2_ick", &gpio2_ick), 4459 + CLK(NULL, "wdt3_ick", &wdt3_ick), 4460 + CLK(NULL, "uart3_ick", &uart3_ick), 4461 + CLK(NULL, "uart4_ick", &uart4_ick), 4462 + CLK(NULL, "gpt9_ick", &gpt9_ick), 4463 + CLK(NULL, "gpt8_ick", &gpt8_ick), 4464 + CLK(NULL, "gpt7_ick", &gpt7_ick), 4465 + CLK(NULL, "gpt6_ick", &gpt6_ick), 4466 + CLK(NULL, "gpt5_ick", &gpt5_ick), 4467 + CLK(NULL, "gpt4_ick", &gpt4_ick), 4468 + CLK(NULL, "gpt3_ick", &gpt3_ick), 4469 + CLK(NULL, "gpt2_ick", &gpt2_ick), 4470 + CLK("omap-mcbsp.2", "ick", &mcbsp2_ick), 4471 + CLK("omap-mcbsp.3", "ick", &mcbsp3_ick), 4472 + CLK("omap-mcbsp.4", "ick", &mcbsp4_ick), 4473 + CLK(NULL, "mcbsp4_ick", &mcbsp2_ick), 4474 + CLK(NULL, "mcbsp3_ick", &mcbsp3_ick), 4475 + CLK(NULL, "mcbsp2_ick", &mcbsp4_ick), 4476 + CLK(NULL, "mcbsp2_fck", &mcbsp2_fck), 4477 + CLK(NULL, "mcbsp3_fck", &mcbsp3_fck), 4478 + CLK(NULL, "mcbsp4_fck", &mcbsp4_fck), 4479 + CLK(NULL, "emu_src_mux_ck", &emu_src_mux_ck), 4480 + CLK("etb", "emu_src_ck", &emu_src_ck), 4481 + CLK(NULL, "emu_src_mux_ck", &emu_src_mux_ck), 4482 + CLK(NULL, "emu_src_ck", &emu_src_ck), 4483 + CLK(NULL, "pclk_fck", &pclk_fck), 4484 + CLK(NULL, "pclkx2_fck", &pclkx2_fck), 4485 + CLK(NULL, "atclk_fck", &atclk_fck), 4486 + CLK(NULL, "traceclk_src_fck", &traceclk_src_fck), 4487 + CLK(NULL, "traceclk_fck", &traceclk_fck), 4488 + CLK(NULL, "secure_32k_fck", &secure_32k_fck), 4489 + CLK(NULL, "gpt12_fck", &gpt12_fck), 4490 + CLK(NULL, "wdt1_fck", &wdt1_fck), 4491 + { NULL }, 4492 + }; 4493 + 4494 + static struct ti_clk_alias omap36xx_am35xx_omap3430es2plus_clks[] = { 4495 + CLK(NULL, "dpll5_ck", &dpll5_ck), 4496 + CLK(NULL, "dpll5_m2_ck", &dpll5_m2_ck), 4497 + CLK(NULL, "core_d3_ck", &core_d3_ck), 4498 + CLK(NULL, "core_d4_ck", &core_d4_ck), 4499 + CLK(NULL, "core_d6_ck", &core_d6_ck), 4500 + CLK(NULL, "omap_192m_alwon_fck", &omap_192m_alwon_fck), 4501 + CLK(NULL, "core_d2_ck", &core_d2_ck), 4502 + CLK(NULL, "corex2_d3_fck", &corex2_d3_fck), 4503 + CLK(NULL, "corex2_d5_fck", &corex2_d5_fck), 4504 + CLK(NULL, "sgx_fck", &sgx_fck), 4505 + CLK(NULL, "sgx_ick", &sgx_ick), 4506 + CLK(NULL, "cpefuse_fck", &cpefuse_fck), 4507 + CLK(NULL, "ts_fck", &ts_fck), 4508 + CLK(NULL, "usbtll_fck", &usbtll_fck), 4509 + CLK(NULL, "usbtll_ick", &usbtll_ick), 4510 + CLK("omap_hsmmc.2", "ick", &mmchs3_ick), 4511 + CLK(NULL, "mmchs3_ick", &mmchs3_ick), 4512 + CLK(NULL, "mmchs3_fck", &mmchs3_fck), 4513 + CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es2), 4514 + CLK("omapdss_dss", "ick", &dss_ick_3430es2), 4515 + CLK(NULL, "dss_ick", &dss_ick_3430es2), 4516 + CLK(NULL, "usbhost_120m_fck", &usbhost_120m_fck), 4517 + CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck), 4518 + CLK(NULL, "usbhost_ick", &usbhost_ick), 4519 + { NULL }, 4520 + }; 4521 + 4522 + static struct ti_clk_alias omap3430es1_clks[] = { 4523 + CLK(NULL, "gfx_l3_ck", &gfx_l3_ck), 4524 + CLK(NULL, "gfx_l3_fck", &gfx_l3_fck), 4525 + CLK(NULL, "gfx_l3_ick", &gfx_l3_ick), 4526 + CLK(NULL, "gfx_cg1_ck", &gfx_cg1_ck), 4527 + CLK(NULL, "gfx_cg2_ck", &gfx_cg2_ck), 4528 + CLK(NULL, "d2d_26m_fck", &d2d_26m_fck), 4529 + CLK(NULL, "fshostusb_fck", &fshostusb_fck), 4530 + CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es1), 4531 + CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es1), 4532 + CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es1), 4533 + CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es1), 4534 + CLK(NULL, "fac_ick", &fac_ick), 4535 + CLK(NULL, "ssi_ick", &ssi_ick_3430es1), 4536 + CLK(NULL, "usb_l4_ick", &usb_l4_ick), 4537 + CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es1), 4538 + CLK("omapdss_dss", "ick", &dss_ick_3430es1), 4539 + CLK(NULL, "dss_ick", &dss_ick_3430es1), 4540 + { NULL }, 4541 + }; 4542 + 4543 + static struct ti_clk_alias omap36xx_clks[] = { 4544 + CLK(NULL, "uart4_fck", &uart4_fck), 4545 + { NULL }, 4546 + }; 4547 + 4548 + static struct ti_clk_alias am35xx_clks[] = { 4549 + CLK(NULL, "ipss_ick", &ipss_ick), 4550 + CLK(NULL, "rmii_ck", &rmii_ck), 4551 + CLK(NULL, "pclk_ck", &pclk_ck), 4552 + CLK(NULL, "emac_ick", &emac_ick), 4553 + CLK(NULL, "emac_fck", &emac_fck), 4554 + CLK("davinci_emac.0", NULL, &emac_ick), 4555 + CLK("davinci_mdio.0", NULL, &emac_fck), 4556 + CLK("vpfe-capture", "master", &vpfe_ick), 4557 + CLK("vpfe-capture", "slave", &vpfe_fck), 4558 + CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_am35xx), 4559 + CLK(NULL, "hsotgusb_fck", &hsotgusb_fck_am35xx), 4560 + CLK(NULL, "hecc_ck", &hecc_ck), 4561 + CLK(NULL, "uart4_ick", &uart4_ick_am35xx), 4562 + CLK(NULL, "uart4_fck", &uart4_fck_am35xx), 4563 + { NULL }, 4564 + }; 4565 + 4566 + static struct ti_clk *omap36xx_clk_patches[] = { 4567 + &dpll4_m3x2_ck_omap36xx, 4568 + &dpll3_m3x2_ck_omap36xx, 4569 + &dpll4_m6x2_ck_omap36xx, 4570 + &dpll4_m2x2_ck_omap36xx, 4571 + &dpll4_m5x2_ck_omap36xx, 4572 + &dpll4_ck_omap36xx, 4573 + NULL, 4574 + }; 4575 + 4576 + static const char *enable_init_clks[] = { 4577 + "sdrc_ick", 4578 + "gpmc_fck", 4579 + "omapctrl_ick", 4580 + }; 4581 + 4582 + static void __init omap3_clk_legacy_common_init(void) 4583 + { 4584 + omap2_clk_disable_autoidle_all(); 4585 + 4586 + omap2_clk_enable_init_clocks(enable_init_clks, 4587 + ARRAY_SIZE(enable_init_clks)); 4588 + 4589 + pr_info("Clocking rate (Crystal/Core/MPU): %ld.%01ld/%ld/%ld MHz\n", 4590 + (clk_get_rate(osc_sys_ck.clk) / 1000000), 4591 + (clk_get_rate(osc_sys_ck.clk) / 100000) % 10, 4592 + (clk_get_rate(core_ck.clk) / 1000000), 4593 + (clk_get_rate(arm_fck.clk) / 1000000)); 4594 + } 4595 + 4596 + int __init omap3430es1_clk_legacy_init(void) 4597 + { 4598 + int r; 4599 + 4600 + r = ti_clk_register_legacy_clks(omap3430es1_clks); 4601 + r |= ti_clk_register_legacy_clks(omap34xx_omap36xx_clks); 4602 + r |= ti_clk_register_legacy_clks(omap3xxx_clks); 4603 + 4604 + omap3_clk_legacy_common_init(); 4605 + 4606 + return r; 4607 + } 4608 + 4609 + int __init omap3430_clk_legacy_init(void) 4610 + { 4611 + int r; 4612 + 4613 + r = ti_clk_register_legacy_clks(omap34xx_omap36xx_clks); 4614 + r |= ti_clk_register_legacy_clks(omap36xx_omap3430es2plus_clks); 4615 + r |= ti_clk_register_legacy_clks(omap36xx_am35xx_omap3430es2plus_clks); 4616 + r |= ti_clk_register_legacy_clks(omap3xxx_clks); 4617 + 4618 + omap3_clk_legacy_common_init(); 4619 + omap3_clk_lock_dpll5(); 4620 + 4621 + return r; 4622 + } 4623 + 4624 + int __init omap36xx_clk_legacy_init(void) 4625 + { 4626 + int r; 4627 + 4628 + ti_clk_patch_legacy_clks(omap36xx_clk_patches); 4629 + r = ti_clk_register_legacy_clks(omap36xx_clks); 4630 + r |= ti_clk_register_legacy_clks(omap36xx_omap3430es2plus_clks); 4631 + r |= ti_clk_register_legacy_clks(omap34xx_omap36xx_clks); 4632 + r |= ti_clk_register_legacy_clks(omap36xx_am35xx_omap3430es2plus_clks); 4633 + r |= ti_clk_register_legacy_clks(omap3xxx_clks); 4634 + 4635 + omap3_clk_legacy_common_init(); 4636 + omap3_clk_lock_dpll5(); 4637 + 4638 + return r; 4639 + } 4640 + 4641 + int __init am35xx_clk_legacy_init(void) 4642 + { 4643 + int r; 4644 + 4645 + r = ti_clk_register_legacy_clks(am35xx_clks); 4646 + r |= ti_clk_register_legacy_clks(omap36xx_am35xx_omap3430es2plus_clks); 4647 + r |= ti_clk_register_legacy_clks(omap3xxx_clks); 4648 + 4649 + omap3_clk_legacy_common_init(); 4650 + omap3_clk_lock_dpll5(); 4651 + 4652 + return r; 4653 + }
+1 -7
drivers/clk/ti/clk-3xxx.c
··· 327 327 OMAP3_SOC_OMAP3430_ES1, 328 328 OMAP3_SOC_OMAP3430_ES2_PLUS, 329 329 OMAP3_SOC_OMAP3630, 330 - OMAP3_SOC_TI81XX, 331 330 }; 332 331 333 332 static int __init omap3xxx_dt_clk_init(int soc_type) ··· 369 370 (clk_get_rate(clk_get_sys(NULL, "core_ck")) / 1000000), 370 371 (clk_get_rate(clk_get_sys(NULL, "arm_fck")) / 1000000)); 371 372 372 - if (soc_type != OMAP3_SOC_TI81XX && soc_type != OMAP3_SOC_OMAP3430_ES1) 373 + if (soc_type != OMAP3_SOC_OMAP3430_ES1) 373 374 omap3_clk_lock_dpll5(); 374 375 375 376 return 0; ··· 388 389 int __init am35xx_dt_clk_init(void) 389 390 { 390 391 return omap3xxx_dt_clk_init(OMAP3_SOC_AM35XX); 391 - } 392 - 393 - int __init ti81xx_dt_clk_init(void) 394 - { 395 - return omap3xxx_dt_clk_init(OMAP3_SOC_TI81XX); 396 392 }
+1 -1
drivers/clk/ti/clk-44xx.c
··· 12 12 13 13 #include <linux/kernel.h> 14 14 #include <linux/list.h> 15 - #include <linux/clk-private.h> 15 + #include <linux/clk.h> 16 16 #include <linux/clkdev.h> 17 17 #include <linux/clk/ti.h> 18 18
+1 -1
drivers/clk/ti/clk-54xx.c
··· 12 12 13 13 #include <linux/kernel.h> 14 14 #include <linux/list.h> 15 - #include <linux/clk-private.h> 15 + #include <linux/clk.h> 16 16 #include <linux/clkdev.h> 17 17 #include <linux/io.h> 18 18 #include <linux/clk/ti.h>
+1 -1
drivers/clk/ti/clk-7xx.c
··· 12 12 13 13 #include <linux/kernel.h> 14 14 #include <linux/list.h> 15 - #include <linux/clk-private.h> 15 + #include <linux/clk.h> 16 16 #include <linux/clkdev.h> 17 17 #include <linux/clk/ti.h> 18 18
+53
drivers/clk/ti/clk-816x.c
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or 3 + * modify it under the terms of the GNU General Public License as 4 + * published by the Free Software Foundation version 2. 5 + * 6 + * This program is distributed "as is" WITHOUT ANY WARRANTY of any 7 + * kind, whether express or implied; without even the implied warranty 8 + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 + * GNU General Public License for more details. 10 + */ 11 + 12 + #include <linux/kernel.h> 13 + #include <linux/list.h> 14 + #include <linux/clk-provider.h> 15 + #include <linux/clk/ti.h> 16 + 17 + static struct ti_dt_clk dm816x_clks[] = { 18 + DT_CLK(NULL, "sys_clkin", "sys_clkin_ck"), 19 + DT_CLK(NULL, "timer_sys_ck", "sys_clkin_ck"), 20 + DT_CLK(NULL, "sys_32k_ck", "sys_32k_ck"), 21 + DT_CLK(NULL, "mpu_ck", "mpu_ck"), 22 + DT_CLK(NULL, "timer1_fck", "timer1_fck"), 23 + DT_CLK(NULL, "timer2_fck", "timer2_fck"), 24 + DT_CLK(NULL, "timer3_fck", "timer3_fck"), 25 + DT_CLK(NULL, "timer4_fck", "timer4_fck"), 26 + DT_CLK(NULL, "timer5_fck", "timer5_fck"), 27 + DT_CLK(NULL, "timer6_fck", "timer6_fck"), 28 + DT_CLK(NULL, "timer7_fck", "timer7_fck"), 29 + DT_CLK(NULL, "sysclk4_ck", "sysclk4_ck"), 30 + DT_CLK(NULL, "sysclk5_ck", "sysclk5_ck"), 31 + DT_CLK(NULL, "sysclk6_ck", "sysclk6_ck"), 32 + DT_CLK(NULL, "sysclk10_ck", "sysclk10_ck"), 33 + DT_CLK(NULL, "sysclk18_ck", "sysclk18_ck"), 34 + DT_CLK(NULL, "sysclk24_ck", "sysclk24_ck"), 35 + DT_CLK("4a100000.ethernet", "sysclk24_ck", "sysclk24_ck"), 36 + { .node_name = NULL }, 37 + }; 38 + 39 + static const char *enable_init_clks[] = { 40 + "ddr_pll_clk1", 41 + "ddr_pll_clk2", 42 + "ddr_pll_clk3", 43 + }; 44 + 45 + int __init ti81xx_dt_clk_init(void) 46 + { 47 + ti_dt_clocks_register(dm816x_clks); 48 + omap2_clk_disable_autoidle_all(); 49 + omap2_clk_enable_init_clocks(enable_init_clks, 50 + ARRAY_SIZE(enable_init_clks)); 51 + 52 + return 0; 53 + }
+127
drivers/clk/ti/clk.c
··· 22 22 #include <linux/of_address.h> 23 23 #include <linux/list.h> 24 24 25 + #include "clock.h" 26 + 25 27 #undef pr_fmt 26 28 #define pr_fmt(fmt) "%s: " fmt, __func__ 27 29 ··· 185 183 retries--; 186 184 } 187 185 } 186 + 187 + #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_ATAGS) 188 + void __init ti_clk_patch_legacy_clks(struct ti_clk **patch) 189 + { 190 + while (*patch) { 191 + memcpy((*patch)->patch, *patch, sizeof(**patch)); 192 + patch++; 193 + } 194 + } 195 + 196 + struct clk __init *ti_clk_register_clk(struct ti_clk *setup) 197 + { 198 + struct clk *clk; 199 + struct ti_clk_fixed *fixed; 200 + struct ti_clk_fixed_factor *fixed_factor; 201 + struct clk_hw *clk_hw; 202 + 203 + if (setup->clk) 204 + return setup->clk; 205 + 206 + switch (setup->type) { 207 + case TI_CLK_FIXED: 208 + fixed = setup->data; 209 + 210 + clk = clk_register_fixed_rate(NULL, setup->name, NULL, 211 + CLK_IS_ROOT, fixed->frequency); 212 + break; 213 + case TI_CLK_MUX: 214 + clk = ti_clk_register_mux(setup); 215 + break; 216 + case TI_CLK_DIVIDER: 217 + clk = ti_clk_register_divider(setup); 218 + break; 219 + case TI_CLK_COMPOSITE: 220 + clk = ti_clk_register_composite(setup); 221 + break; 222 + case TI_CLK_FIXED_FACTOR: 223 + fixed_factor = setup->data; 224 + 225 + clk = clk_register_fixed_factor(NULL, setup->name, 226 + fixed_factor->parent, 227 + 0, fixed_factor->mult, 228 + fixed_factor->div); 229 + break; 230 + case TI_CLK_GATE: 231 + clk = ti_clk_register_gate(setup); 232 + break; 233 + case TI_CLK_DPLL: 234 + clk = ti_clk_register_dpll(setup); 235 + break; 236 + default: 237 + pr_err("bad type for %s!\n", setup->name); 238 + clk = ERR_PTR(-EINVAL); 239 + } 240 + 241 + if (!IS_ERR(clk)) { 242 + setup->clk = clk; 243 + if (setup->clkdm_name) { 244 + if (__clk_get_flags(clk) & CLK_IS_BASIC) { 245 + pr_warn("can't setup clkdm for basic clk %s\n", 246 + setup->name); 247 + } else { 248 + clk_hw = __clk_get_hw(clk); 249 + to_clk_hw_omap(clk_hw)->clkdm_name = 250 + setup->clkdm_name; 251 + omap2_init_clk_clkdm(clk_hw); 252 + } 253 + } 254 + } 255 + 256 + return clk; 257 + } 258 + 259 + int __init ti_clk_register_legacy_clks(struct ti_clk_alias *clks) 260 + { 261 + struct clk *clk; 262 + bool retry; 263 + struct ti_clk_alias *retry_clk; 264 + struct ti_clk_alias *tmp; 265 + 266 + while (clks->clk) { 267 + clk = ti_clk_register_clk(clks->clk); 268 + if (IS_ERR(clk)) { 269 + if (PTR_ERR(clk) == -EAGAIN) { 270 + list_add(&clks->link, &retry_list); 271 + } else { 272 + pr_err("register for %s failed: %ld\n", 273 + clks->clk->name, PTR_ERR(clk)); 274 + return PTR_ERR(clk); 275 + } 276 + } else { 277 + clks->lk.clk = clk; 278 + clkdev_add(&clks->lk); 279 + } 280 + clks++; 281 + } 282 + 283 + retry = true; 284 + 285 + while (!list_empty(&retry_list) && retry) { 286 + retry = false; 287 + list_for_each_entry_safe(retry_clk, tmp, &retry_list, link) { 288 + pr_debug("retry-init: %s\n", retry_clk->clk->name); 289 + clk = ti_clk_register_clk(retry_clk->clk); 290 + if (IS_ERR(clk)) { 291 + if (PTR_ERR(clk) == -EAGAIN) { 292 + continue; 293 + } else { 294 + pr_err("register for %s failed: %ld\n", 295 + retry_clk->clk->name, 296 + PTR_ERR(clk)); 297 + return PTR_ERR(clk); 298 + } 299 + } else { 300 + retry = true; 301 + retry_clk->lk.clk = clk; 302 + clkdev_add(&retry_clk->lk); 303 + list_del(&retry_clk->link); 304 + } 305 + } 306 + } 307 + 308 + return 0; 309 + } 310 + #endif
+172
drivers/clk/ti/clock.h
··· 1 + /* 2 + * TI Clock driver internal definitions 3 + * 4 + * Copyright (C) 2014 Texas Instruments, Inc 5 + * Tero Kristo (t-kristo@ti.com) 6 + * 7 + * This program is free software; you can redistribute it and/or 8 + * modify it under the terms of the GNU General Public License as 9 + * published by the Free Software Foundation version 2. 10 + * 11 + * This program is distributed "as is" WITHOUT ANY WARRANTY of any 12 + * kind, whether express or implied; without even the implied warranty 13 + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + * GNU General Public License for more details. 15 + */ 16 + #ifndef __DRIVERS_CLK_TI_CLOCK__ 17 + #define __DRIVERS_CLK_TI_CLOCK__ 18 + 19 + enum { 20 + TI_CLK_FIXED, 21 + TI_CLK_MUX, 22 + TI_CLK_DIVIDER, 23 + TI_CLK_COMPOSITE, 24 + TI_CLK_FIXED_FACTOR, 25 + TI_CLK_GATE, 26 + TI_CLK_DPLL, 27 + }; 28 + 29 + /* Global flags */ 30 + #define CLKF_INDEX_POWER_OF_TWO (1 << 0) 31 + #define CLKF_INDEX_STARTS_AT_ONE (1 << 1) 32 + #define CLKF_SET_RATE_PARENT (1 << 2) 33 + #define CLKF_OMAP3 (1 << 3) 34 + #define CLKF_AM35XX (1 << 4) 35 + 36 + /* Gate flags */ 37 + #define CLKF_SET_BIT_TO_DISABLE (1 << 5) 38 + #define CLKF_INTERFACE (1 << 6) 39 + #define CLKF_SSI (1 << 7) 40 + #define CLKF_DSS (1 << 8) 41 + #define CLKF_HSOTGUSB (1 << 9) 42 + #define CLKF_WAIT (1 << 10) 43 + #define CLKF_NO_WAIT (1 << 11) 44 + #define CLKF_HSDIV (1 << 12) 45 + #define CLKF_CLKDM (1 << 13) 46 + 47 + /* DPLL flags */ 48 + #define CLKF_LOW_POWER_STOP (1 << 5) 49 + #define CLKF_LOCK (1 << 6) 50 + #define CLKF_LOW_POWER_BYPASS (1 << 7) 51 + #define CLKF_PER (1 << 8) 52 + #define CLKF_CORE (1 << 9) 53 + #define CLKF_J_TYPE (1 << 10) 54 + 55 + #define CLK(dev, con, ck) \ 56 + { \ 57 + .lk = { \ 58 + .dev_id = dev, \ 59 + .con_id = con, \ 60 + }, \ 61 + .clk = ck, \ 62 + } 63 + 64 + struct ti_clk { 65 + const char *name; 66 + const char *clkdm_name; 67 + int type; 68 + void *data; 69 + struct ti_clk *patch; 70 + struct clk *clk; 71 + }; 72 + 73 + struct ti_clk_alias { 74 + struct ti_clk *clk; 75 + struct clk_lookup lk; 76 + struct list_head link; 77 + }; 78 + 79 + struct ti_clk_fixed { 80 + u32 frequency; 81 + u16 flags; 82 + }; 83 + 84 + struct ti_clk_mux { 85 + u8 bit_shift; 86 + int num_parents; 87 + u16 reg; 88 + u8 module; 89 + const char **parents; 90 + u16 flags; 91 + }; 92 + 93 + struct ti_clk_divider { 94 + const char *parent; 95 + u8 bit_shift; 96 + u16 max_div; 97 + u16 reg; 98 + u8 module; 99 + int *dividers; 100 + int num_dividers; 101 + u16 flags; 102 + }; 103 + 104 + struct ti_clk_fixed_factor { 105 + const char *parent; 106 + u16 div; 107 + u16 mult; 108 + u16 flags; 109 + }; 110 + 111 + struct ti_clk_gate { 112 + const char *parent; 113 + u8 bit_shift; 114 + u16 reg; 115 + u8 module; 116 + u16 flags; 117 + }; 118 + 119 + struct ti_clk_composite { 120 + struct ti_clk_divider *divider; 121 + struct ti_clk_mux *mux; 122 + struct ti_clk_gate *gate; 123 + u16 flags; 124 + }; 125 + 126 + struct ti_clk_clkdm_gate { 127 + const char *parent; 128 + u16 flags; 129 + }; 130 + 131 + struct ti_clk_dpll { 132 + int num_parents; 133 + u16 control_reg; 134 + u16 idlest_reg; 135 + u16 autoidle_reg; 136 + u16 mult_div1_reg; 137 + u8 module; 138 + const char **parents; 139 + u16 flags; 140 + u8 modes; 141 + u32 mult_mask; 142 + u32 div1_mask; 143 + u32 enable_mask; 144 + u32 autoidle_mask; 145 + u32 freqsel_mask; 146 + u32 idlest_mask; 147 + u32 dco_mask; 148 + u32 sddiv_mask; 149 + u16 max_multiplier; 150 + u16 max_divider; 151 + u8 min_divider; 152 + u8 auto_recal_bit; 153 + u8 recal_en_bit; 154 + u8 recal_st_bit; 155 + }; 156 + 157 + struct clk *ti_clk_register_gate(struct ti_clk *setup); 158 + struct clk *ti_clk_register_interface(struct ti_clk *setup); 159 + struct clk *ti_clk_register_mux(struct ti_clk *setup); 160 + struct clk *ti_clk_register_divider(struct ti_clk *setup); 161 + struct clk *ti_clk_register_composite(struct ti_clk *setup); 162 + struct clk *ti_clk_register_dpll(struct ti_clk *setup); 163 + 164 + struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup); 165 + struct clk_hw *ti_clk_build_component_gate(struct ti_clk_gate *setup); 166 + struct clk_hw *ti_clk_build_component_mux(struct ti_clk_mux *setup); 167 + 168 + void ti_clk_patch_legacy_clks(struct ti_clk **patch); 169 + struct clk *ti_clk_register_clk(struct ti_clk *setup); 170 + int ti_clk_register_legacy_clks(struct ti_clk_alias *clks); 171 + 172 + #endif
+44 -4
drivers/clk/ti/composite.c
··· 23 23 #include <linux/clk/ti.h> 24 24 #include <linux/list.h> 25 25 26 + #include "clock.h" 27 + 26 28 #undef pr_fmt 27 29 #define pr_fmt(fmt) "%s: " fmt, __func__ 28 30 ··· 118 116 119 117 #define to_clk_hw_comp(_hw) container_of(_hw, struct clk_hw_omap_comp, hw) 120 118 121 - static void __init ti_clk_register_composite(struct clk_hw *hw, 122 - struct device_node *node) 119 + #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_ATAGS) 120 + struct clk *ti_clk_register_composite(struct ti_clk *setup) 121 + { 122 + struct ti_clk_composite *comp; 123 + struct clk_hw *gate; 124 + struct clk_hw *mux; 125 + struct clk_hw *div; 126 + int num_parents = 1; 127 + const char **parent_names = NULL; 128 + struct clk *clk; 129 + 130 + comp = setup->data; 131 + 132 + div = ti_clk_build_component_div(comp->divider); 133 + gate = ti_clk_build_component_gate(comp->gate); 134 + mux = ti_clk_build_component_mux(comp->mux); 135 + 136 + if (div) 137 + parent_names = &comp->divider->parent; 138 + 139 + if (gate) 140 + parent_names = &comp->gate->parent; 141 + 142 + if (mux) { 143 + num_parents = comp->mux->num_parents; 144 + parent_names = comp->mux->parents; 145 + } 146 + 147 + clk = clk_register_composite(NULL, setup->name, 148 + parent_names, num_parents, mux, 149 + &ti_clk_mux_ops, div, 150 + &ti_composite_divider_ops, gate, 151 + &ti_composite_gate_ops, 0); 152 + 153 + return clk; 154 + } 155 + #endif 156 + 157 + static void __init _register_composite(struct clk_hw *hw, 158 + struct device_node *node) 123 159 { 124 160 struct clk *clk; 125 161 struct clk_hw_omap_comp *cclk = to_clk_hw_comp(hw); ··· 176 136 pr_debug("component %s not ready for %s, retry\n", 177 137 cclk->comp_nodes[i]->name, node->name); 178 138 if (!ti_clk_retry_init(node, hw, 179 - ti_clk_register_composite)) 139 + _register_composite)) 180 140 return; 181 141 182 142 goto cleanup; ··· 256 216 for (i = 0; i < num_clks; i++) 257 217 cclk->comp_nodes[i] = _get_component_node(node, i); 258 218 259 - ti_clk_register_composite(&cclk->hw, node); 219 + _register_composite(&cclk->hw, node); 260 220 } 261 221 CLK_OF_DECLARE(ti_composite_clock, "ti,composite-clock", 262 222 of_ti_composite_clk_setup);
+131 -1
drivers/clk/ti/divider.c
··· 21 21 #include <linux/of.h> 22 22 #include <linux/of_address.h> 23 23 #include <linux/clk/ti.h> 24 + #include "clock.h" 24 25 25 26 #undef pr_fmt 26 27 #define pr_fmt(fmt) "%s: " fmt, __func__ ··· 302 301 } 303 302 304 303 static struct clk_div_table * 304 + _get_div_table_from_setup(struct ti_clk_divider *setup, u8 *width) 305 + { 306 + int valid_div = 0; 307 + struct clk_div_table *table; 308 + int i; 309 + int div; 310 + u32 val; 311 + u8 flags; 312 + 313 + if (!setup->num_dividers) { 314 + /* Clk divider table not provided, determine min/max divs */ 315 + flags = setup->flags; 316 + 317 + if (flags & CLKF_INDEX_STARTS_AT_ONE) 318 + val = 1; 319 + else 320 + val = 0; 321 + 322 + div = 1; 323 + 324 + while (div < setup->max_div) { 325 + if (flags & CLKF_INDEX_POWER_OF_TWO) 326 + div <<= 1; 327 + else 328 + div++; 329 + val++; 330 + } 331 + 332 + *width = fls(val); 333 + 334 + return NULL; 335 + } 336 + 337 + for (i = 0; i < setup->num_dividers; i++) 338 + if (setup->dividers[i]) 339 + valid_div++; 340 + 341 + table = kzalloc(sizeof(*table) * (valid_div + 1), GFP_KERNEL); 342 + if (!table) 343 + return ERR_PTR(-ENOMEM); 344 + 345 + valid_div = 0; 346 + *width = 0; 347 + 348 + for (i = 0; i < setup->num_dividers; i++) 349 + if (setup->dividers[i]) { 350 + table[valid_div].div = setup->dividers[i]; 351 + table[valid_div].val = i; 352 + valid_div++; 353 + *width = i; 354 + } 355 + 356 + *width = fls(*width); 357 + 358 + return table; 359 + } 360 + 361 + struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup) 362 + { 363 + struct clk_divider *div; 364 + struct clk_omap_reg *reg; 365 + 366 + if (!setup) 367 + return NULL; 368 + 369 + div = kzalloc(sizeof(*div), GFP_KERNEL); 370 + if (!div) 371 + return ERR_PTR(-ENOMEM); 372 + 373 + reg = (struct clk_omap_reg *)&div->reg; 374 + reg->index = setup->module; 375 + reg->offset = setup->reg; 376 + 377 + if (setup->flags & CLKF_INDEX_STARTS_AT_ONE) 378 + div->flags |= CLK_DIVIDER_ONE_BASED; 379 + 380 + if (setup->flags & CLKF_INDEX_POWER_OF_TWO) 381 + div->flags |= CLK_DIVIDER_POWER_OF_TWO; 382 + 383 + div->table = _get_div_table_from_setup(setup, &div->width); 384 + 385 + div->shift = setup->bit_shift; 386 + 387 + return &div->hw; 388 + } 389 + 390 + struct clk *ti_clk_register_divider(struct ti_clk *setup) 391 + { 392 + struct ti_clk_divider *div; 393 + struct clk_omap_reg *reg_setup; 394 + u32 reg; 395 + u8 width; 396 + u32 flags = 0; 397 + u8 div_flags = 0; 398 + struct clk_div_table *table; 399 + struct clk *clk; 400 + 401 + div = setup->data; 402 + 403 + reg_setup = (struct clk_omap_reg *)&reg; 404 + 405 + reg_setup->index = div->module; 406 + reg_setup->offset = div->reg; 407 + 408 + if (div->flags & CLKF_INDEX_STARTS_AT_ONE) 409 + div_flags |= CLK_DIVIDER_ONE_BASED; 410 + 411 + if (div->flags & CLKF_INDEX_POWER_OF_TWO) 412 + div_flags |= CLK_DIVIDER_POWER_OF_TWO; 413 + 414 + if (div->flags & CLKF_SET_RATE_PARENT) 415 + flags |= CLK_SET_RATE_PARENT; 416 + 417 + table = _get_div_table_from_setup(div, &width); 418 + if (IS_ERR(table)) 419 + return (struct clk *)table; 420 + 421 + clk = _register_divider(NULL, setup->name, div->parent, 422 + flags, (void __iomem *)reg, div->bit_shift, 423 + width, div_flags, table, NULL); 424 + 425 + if (IS_ERR(clk)) 426 + kfree(table); 427 + 428 + return clk; 429 + } 430 + 431 + static struct clk_div_table * 305 432 __init ti_clk_get_div_table(struct device_node *node) 306 433 { 307 434 struct clk_div_table *table; ··· 584 455 goto cleanup; 585 456 586 457 clk = _register_divider(NULL, node->name, parent_name, flags, reg, 587 - shift, width, clk_divider_flags, table, NULL); 458 + shift, width, clk_divider_flags, table, 459 + NULL); 588 460 589 461 if (!IS_ERR(clk)) { 590 462 of_clk_add_provider(node, of_clk_src_simple_get, clk);
+110 -11
drivers/clk/ti/dpll.c
··· 21 21 #include <linux/of.h> 22 22 #include <linux/of_address.h> 23 23 #include <linux/clk/ti.h> 24 + #include "clock.h" 24 25 25 26 #undef pr_fmt 26 27 #define pr_fmt(fmt) "%s: " fmt, __func__ ··· 131 130 }; 132 131 133 132 /** 134 - * ti_clk_register_dpll - low level registration of a DPLL clock 133 + * _register_dpll - low level registration of a DPLL clock 135 134 * @hw: hardware clock definition for the clock 136 135 * @node: device node for the clock 137 136 * ··· 139 138 * clk-bypass is missing), the clock is added to retry list and 140 139 * the initialization is retried on later stage. 141 140 */ 142 - static void __init ti_clk_register_dpll(struct clk_hw *hw, 143 - struct device_node *node) 141 + static void __init _register_dpll(struct clk_hw *hw, 142 + struct device_node *node) 144 143 { 145 144 struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw); 146 145 struct dpll_data *dd = clk_hw->dpll_data; ··· 152 151 if (IS_ERR(dd->clk_ref) || IS_ERR(dd->clk_bypass)) { 153 152 pr_debug("clk-ref or clk-bypass missing for %s, retry later\n", 154 153 node->name); 155 - if (!ti_clk_retry_init(node, hw, ti_clk_register_dpll)) 154 + if (!ti_clk_retry_init(node, hw, _register_dpll)) 156 155 return; 157 156 158 157 goto cleanup; ··· 176 175 kfree(clk_hw); 177 176 } 178 177 178 + #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_ATAGS) 179 + void __iomem *_get_reg(u8 module, u16 offset) 180 + { 181 + u32 reg; 182 + struct clk_omap_reg *reg_setup; 183 + 184 + reg_setup = (struct clk_omap_reg *)&reg; 185 + 186 + reg_setup->index = module; 187 + reg_setup->offset = offset; 188 + 189 + return (void __iomem *)reg; 190 + } 191 + 192 + struct clk *ti_clk_register_dpll(struct ti_clk *setup) 193 + { 194 + struct clk_hw_omap *clk_hw; 195 + struct clk_init_data init = { NULL }; 196 + struct dpll_data *dd; 197 + struct clk *clk; 198 + struct ti_clk_dpll *dpll; 199 + const struct clk_ops *ops = &omap3_dpll_ck_ops; 200 + struct clk *clk_ref; 201 + struct clk *clk_bypass; 202 + 203 + dpll = setup->data; 204 + 205 + if (dpll->num_parents < 2) 206 + return ERR_PTR(-EINVAL); 207 + 208 + clk_ref = clk_get_sys(NULL, dpll->parents[0]); 209 + clk_bypass = clk_get_sys(NULL, dpll->parents[1]); 210 + 211 + if (IS_ERR_OR_NULL(clk_ref) || IS_ERR_OR_NULL(clk_bypass)) 212 + return ERR_PTR(-EAGAIN); 213 + 214 + dd = kzalloc(sizeof(*dd), GFP_KERNEL); 215 + clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); 216 + if (!dd || !clk_hw) { 217 + clk = ERR_PTR(-ENOMEM); 218 + goto cleanup; 219 + } 220 + 221 + clk_hw->dpll_data = dd; 222 + clk_hw->ops = &clkhwops_omap3_dpll; 223 + clk_hw->hw.init = &init; 224 + clk_hw->flags = MEMMAP_ADDRESSING; 225 + 226 + init.name = setup->name; 227 + init.ops = ops; 228 + 229 + init.num_parents = dpll->num_parents; 230 + init.parent_names = dpll->parents; 231 + 232 + dd->control_reg = _get_reg(dpll->module, dpll->control_reg); 233 + dd->idlest_reg = _get_reg(dpll->module, dpll->idlest_reg); 234 + dd->mult_div1_reg = _get_reg(dpll->module, dpll->mult_div1_reg); 235 + dd->autoidle_reg = _get_reg(dpll->module, dpll->autoidle_reg); 236 + 237 + dd->modes = dpll->modes; 238 + dd->div1_mask = dpll->div1_mask; 239 + dd->idlest_mask = dpll->idlest_mask; 240 + dd->mult_mask = dpll->mult_mask; 241 + dd->autoidle_mask = dpll->autoidle_mask; 242 + dd->enable_mask = dpll->enable_mask; 243 + dd->sddiv_mask = dpll->sddiv_mask; 244 + dd->dco_mask = dpll->dco_mask; 245 + dd->max_divider = dpll->max_divider; 246 + dd->min_divider = dpll->min_divider; 247 + dd->max_multiplier = dpll->max_multiplier; 248 + dd->auto_recal_bit = dpll->auto_recal_bit; 249 + dd->recal_en_bit = dpll->recal_en_bit; 250 + dd->recal_st_bit = dpll->recal_st_bit; 251 + 252 + dd->clk_ref = clk_ref; 253 + dd->clk_bypass = clk_bypass; 254 + 255 + if (dpll->flags & CLKF_CORE) 256 + ops = &omap3_dpll_core_ck_ops; 257 + 258 + if (dpll->flags & CLKF_PER) 259 + ops = &omap3_dpll_per_ck_ops; 260 + 261 + if (dpll->flags & CLKF_J_TYPE) 262 + dd->flags |= DPLL_J_TYPE; 263 + 264 + clk = clk_register(NULL, &clk_hw->hw); 265 + 266 + if (!IS_ERR(clk)) 267 + return clk; 268 + 269 + cleanup: 270 + kfree(dd); 271 + kfree(clk_hw); 272 + return clk; 273 + } 274 + #endif 275 + 179 276 #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \ 180 277 defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM33XX) || \ 181 278 defined(CONFIG_SOC_AM43XX) 182 279 /** 183 - * ti_clk_register_dpll_x2 - Registers a DPLLx2 clock 280 + * _register_dpll_x2 - Registers a DPLLx2 clock 184 281 * @node: device node for this clock 185 282 * @ops: clk_ops for this clock 186 283 * @hw_ops: clk_hw_ops for this clock 187 284 * 188 285 * Initializes a DPLL x 2 clock from device tree data. 189 286 */ 190 - static void ti_clk_register_dpll_x2(struct device_node *node, 191 - const struct clk_ops *ops, 192 - const struct clk_hw_omap_ops *hw_ops) 287 + static void _register_dpll_x2(struct device_node *node, 288 + const struct clk_ops *ops, 289 + const struct clk_hw_omap_ops *hw_ops) 193 290 { 194 291 struct clk *clk; 195 292 struct clk_init_data init = { NULL }; ··· 417 318 if (dpll_mode) 418 319 dd->modes = dpll_mode; 419 320 420 - ti_clk_register_dpll(&clk_hw->hw, node); 321 + _register_dpll(&clk_hw->hw, node); 421 322 return; 422 323 423 324 cleanup: ··· 431 332 defined(CONFIG_SOC_DRA7XX) 432 333 static void __init of_ti_omap4_dpll_x2_setup(struct device_node *node) 433 334 { 434 - ti_clk_register_dpll_x2(node, &dpll_x2_ck_ops, &clkhwops_omap4_dpllmx); 335 + _register_dpll_x2(node, &dpll_x2_ck_ops, &clkhwops_omap4_dpllmx); 435 336 } 436 337 CLK_OF_DECLARE(ti_omap4_dpll_x2_clock, "ti,omap4-dpll-x2-clock", 437 338 of_ti_omap4_dpll_x2_setup); ··· 440 341 #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX) 441 342 static void __init of_ti_am3_dpll_x2_setup(struct device_node *node) 442 343 { 443 - ti_clk_register_dpll_x2(node, &dpll_x2_ck_ops, NULL); 344 + _register_dpll_x2(node, &dpll_x2_ck_ops, NULL); 444 345 } 445 346 CLK_OF_DECLARE(ti_am3_dpll_x2_clock, "ti,am3-dpll-x2-clock", 446 347 of_ti_am3_dpll_x2_setup);
+410
drivers/clk/ti/fapll.c
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or 3 + * modify it under the terms of the GNU General Public License as 4 + * published by the Free Software Foundation version 2. 5 + * 6 + * This program is distributed "as is" WITHOUT ANY WARRANTY of any 7 + * kind, whether express or implied; without even the implied warranty 8 + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 + * GNU General Public License for more details. 10 + */ 11 + 12 + #include <linux/clk-provider.h> 13 + #include <linux/delay.h> 14 + #include <linux/slab.h> 15 + #include <linux/err.h> 16 + #include <linux/of.h> 17 + #include <linux/of_address.h> 18 + #include <linux/clk/ti.h> 19 + #include <asm/div64.h> 20 + 21 + /* FAPLL Control Register PLL_CTRL */ 22 + #define FAPLL_MAIN_LOCK BIT(7) 23 + #define FAPLL_MAIN_PLLEN BIT(3) 24 + #define FAPLL_MAIN_BP BIT(2) 25 + #define FAPLL_MAIN_LOC_CTL BIT(0) 26 + 27 + /* FAPLL powerdown register PWD */ 28 + #define FAPLL_PWD_OFFSET 4 29 + 30 + #define MAX_FAPLL_OUTPUTS 7 31 + #define FAPLL_MAX_RETRIES 1000 32 + 33 + #define to_fapll(_hw) container_of(_hw, struct fapll_data, hw) 34 + #define to_synth(_hw) container_of(_hw, struct fapll_synth, hw) 35 + 36 + /* The bypass bit is inverted on the ddr_pll.. */ 37 + #define fapll_is_ddr_pll(va) (((u32)(va) & 0xffff) == 0x0440) 38 + 39 + /* 40 + * The audio_pll_clk1 input is hard wired to the 27MHz bypass clock, 41 + * and the audio_pll_clk1 synthesizer is hardwared to 32KiHz output. 42 + */ 43 + #define is_ddr_pll_clk1(va) (((u32)(va) & 0xffff) == 0x044c) 44 + #define is_audio_pll_clk1(va) (((u32)(va) & 0xffff) == 0x04a8) 45 + 46 + /* Synthesizer divider register */ 47 + #define SYNTH_LDMDIV1 BIT(8) 48 + 49 + /* Synthesizer frequency register */ 50 + #define SYNTH_LDFREQ BIT(31) 51 + 52 + struct fapll_data { 53 + struct clk_hw hw; 54 + void __iomem *base; 55 + const char *name; 56 + struct clk *clk_ref; 57 + struct clk *clk_bypass; 58 + struct clk_onecell_data outputs; 59 + bool bypass_bit_inverted; 60 + }; 61 + 62 + struct fapll_synth { 63 + struct clk_hw hw; 64 + struct fapll_data *fd; 65 + int index; 66 + void __iomem *freq; 67 + void __iomem *div; 68 + const char *name; 69 + struct clk *clk_pll; 70 + }; 71 + 72 + static bool ti_fapll_clock_is_bypass(struct fapll_data *fd) 73 + { 74 + u32 v = readl_relaxed(fd->base); 75 + 76 + if (fd->bypass_bit_inverted) 77 + return !(v & FAPLL_MAIN_BP); 78 + else 79 + return !!(v & FAPLL_MAIN_BP); 80 + } 81 + 82 + static int ti_fapll_enable(struct clk_hw *hw) 83 + { 84 + struct fapll_data *fd = to_fapll(hw); 85 + u32 v = readl_relaxed(fd->base); 86 + 87 + v |= (1 << FAPLL_MAIN_PLLEN); 88 + writel_relaxed(v, fd->base); 89 + 90 + return 0; 91 + } 92 + 93 + static void ti_fapll_disable(struct clk_hw *hw) 94 + { 95 + struct fapll_data *fd = to_fapll(hw); 96 + u32 v = readl_relaxed(fd->base); 97 + 98 + v &= ~(1 << FAPLL_MAIN_PLLEN); 99 + writel_relaxed(v, fd->base); 100 + } 101 + 102 + static int ti_fapll_is_enabled(struct clk_hw *hw) 103 + { 104 + struct fapll_data *fd = to_fapll(hw); 105 + u32 v = readl_relaxed(fd->base); 106 + 107 + return v & (1 << FAPLL_MAIN_PLLEN); 108 + } 109 + 110 + static unsigned long ti_fapll_recalc_rate(struct clk_hw *hw, 111 + unsigned long parent_rate) 112 + { 113 + struct fapll_data *fd = to_fapll(hw); 114 + u32 fapll_n, fapll_p, v; 115 + long long rate; 116 + 117 + if (ti_fapll_clock_is_bypass(fd)) 118 + return parent_rate; 119 + 120 + rate = parent_rate; 121 + 122 + /* PLL pre-divider is P and multiplier is N */ 123 + v = readl_relaxed(fd->base); 124 + fapll_p = (v >> 8) & 0xff; 125 + if (fapll_p) 126 + do_div(rate, fapll_p); 127 + fapll_n = v >> 16; 128 + if (fapll_n) 129 + rate *= fapll_n; 130 + 131 + return rate; 132 + } 133 + 134 + static u8 ti_fapll_get_parent(struct clk_hw *hw) 135 + { 136 + struct fapll_data *fd = to_fapll(hw); 137 + 138 + if (ti_fapll_clock_is_bypass(fd)) 139 + return 1; 140 + 141 + return 0; 142 + } 143 + 144 + static struct clk_ops ti_fapll_ops = { 145 + .enable = ti_fapll_enable, 146 + .disable = ti_fapll_disable, 147 + .is_enabled = ti_fapll_is_enabled, 148 + .recalc_rate = ti_fapll_recalc_rate, 149 + .get_parent = ti_fapll_get_parent, 150 + }; 151 + 152 + static int ti_fapll_synth_enable(struct clk_hw *hw) 153 + { 154 + struct fapll_synth *synth = to_synth(hw); 155 + u32 v = readl_relaxed(synth->fd->base + FAPLL_PWD_OFFSET); 156 + 157 + v &= ~(1 << synth->index); 158 + writel_relaxed(v, synth->fd->base + FAPLL_PWD_OFFSET); 159 + 160 + return 0; 161 + } 162 + 163 + static void ti_fapll_synth_disable(struct clk_hw *hw) 164 + { 165 + struct fapll_synth *synth = to_synth(hw); 166 + u32 v = readl_relaxed(synth->fd->base + FAPLL_PWD_OFFSET); 167 + 168 + v |= 1 << synth->index; 169 + writel_relaxed(v, synth->fd->base + FAPLL_PWD_OFFSET); 170 + } 171 + 172 + static int ti_fapll_synth_is_enabled(struct clk_hw *hw) 173 + { 174 + struct fapll_synth *synth = to_synth(hw); 175 + u32 v = readl_relaxed(synth->fd->base + FAPLL_PWD_OFFSET); 176 + 177 + return !(v & (1 << synth->index)); 178 + } 179 + 180 + /* 181 + * See dm816x TRM chapter 1.10.3 Flying Adder PLL fore more info 182 + */ 183 + static unsigned long ti_fapll_synth_recalc_rate(struct clk_hw *hw, 184 + unsigned long parent_rate) 185 + { 186 + struct fapll_synth *synth = to_synth(hw); 187 + u32 synth_div_m; 188 + long long rate; 189 + 190 + /* The audio_pll_clk1 is hardwired to produce 32.768KiHz clock */ 191 + if (!synth->div) 192 + return 32768; 193 + 194 + /* 195 + * PLL in bypass sets the synths in bypass mode too. The PLL rate 196 + * can be also be set to 27MHz, so we can't use parent_rate to 197 + * check for bypass mode. 198 + */ 199 + if (ti_fapll_clock_is_bypass(synth->fd)) 200 + return parent_rate; 201 + 202 + rate = parent_rate; 203 + 204 + /* 205 + * Synth frequency integer and fractional divider. 206 + * Note that the phase output K is 8, so the result needs 207 + * to be multiplied by 8. 208 + */ 209 + if (synth->freq) { 210 + u32 v, synth_int_div, synth_frac_div, synth_div_freq; 211 + 212 + v = readl_relaxed(synth->freq); 213 + synth_int_div = (v >> 24) & 0xf; 214 + synth_frac_div = v & 0xffffff; 215 + synth_div_freq = (synth_int_div * 10000000) + synth_frac_div; 216 + rate *= 10000000; 217 + do_div(rate, synth_div_freq); 218 + rate *= 8; 219 + } 220 + 221 + /* Synth ost-divider M */ 222 + synth_div_m = readl_relaxed(synth->div) & 0xff; 223 + do_div(rate, synth_div_m); 224 + 225 + return rate; 226 + } 227 + 228 + static struct clk_ops ti_fapll_synt_ops = { 229 + .enable = ti_fapll_synth_enable, 230 + .disable = ti_fapll_synth_disable, 231 + .is_enabled = ti_fapll_synth_is_enabled, 232 + .recalc_rate = ti_fapll_synth_recalc_rate, 233 + }; 234 + 235 + static struct clk * __init ti_fapll_synth_setup(struct fapll_data *fd, 236 + void __iomem *freq, 237 + void __iomem *div, 238 + int index, 239 + const char *name, 240 + const char *parent, 241 + struct clk *pll_clk) 242 + { 243 + struct clk_init_data *init; 244 + struct fapll_synth *synth; 245 + 246 + init = kzalloc(sizeof(*init), GFP_KERNEL); 247 + if (!init) 248 + return ERR_PTR(-ENOMEM); 249 + 250 + init->ops = &ti_fapll_synt_ops; 251 + init->name = name; 252 + init->parent_names = &parent; 253 + init->num_parents = 1; 254 + 255 + synth = kzalloc(sizeof(*synth), GFP_KERNEL); 256 + if (!synth) 257 + goto free; 258 + 259 + synth->fd = fd; 260 + synth->index = index; 261 + synth->freq = freq; 262 + synth->div = div; 263 + synth->name = name; 264 + synth->hw.init = init; 265 + synth->clk_pll = pll_clk; 266 + 267 + return clk_register(NULL, &synth->hw); 268 + 269 + free: 270 + kfree(synth); 271 + kfree(init); 272 + 273 + return ERR_PTR(-ENOMEM); 274 + } 275 + 276 + static void __init ti_fapll_setup(struct device_node *node) 277 + { 278 + struct fapll_data *fd; 279 + struct clk_init_data *init = NULL; 280 + const char *parent_name[2]; 281 + struct clk *pll_clk; 282 + int i; 283 + 284 + fd = kzalloc(sizeof(*fd), GFP_KERNEL); 285 + if (!fd) 286 + return; 287 + 288 + fd->outputs.clks = kzalloc(sizeof(struct clk *) * 289 + MAX_FAPLL_OUTPUTS + 1, 290 + GFP_KERNEL); 291 + if (!fd->outputs.clks) 292 + goto free; 293 + 294 + init = kzalloc(sizeof(*init), GFP_KERNEL); 295 + if (!init) 296 + goto free; 297 + 298 + init->ops = &ti_fapll_ops; 299 + init->name = node->name; 300 + 301 + init->num_parents = of_clk_get_parent_count(node); 302 + if (init->num_parents != 2) { 303 + pr_err("%s must have two parents\n", node->name); 304 + goto free; 305 + } 306 + 307 + parent_name[0] = of_clk_get_parent_name(node, 0); 308 + parent_name[1] = of_clk_get_parent_name(node, 1); 309 + init->parent_names = parent_name; 310 + 311 + fd->clk_ref = of_clk_get(node, 0); 312 + if (IS_ERR(fd->clk_ref)) { 313 + pr_err("%s could not get clk_ref\n", node->name); 314 + goto free; 315 + } 316 + 317 + fd->clk_bypass = of_clk_get(node, 1); 318 + if (IS_ERR(fd->clk_bypass)) { 319 + pr_err("%s could not get clk_bypass\n", node->name); 320 + goto free; 321 + } 322 + 323 + fd->base = of_iomap(node, 0); 324 + if (!fd->base) { 325 + pr_err("%s could not get IO base\n", node->name); 326 + goto free; 327 + } 328 + 329 + if (fapll_is_ddr_pll(fd->base)) 330 + fd->bypass_bit_inverted = true; 331 + 332 + fd->name = node->name; 333 + fd->hw.init = init; 334 + 335 + /* Register the parent PLL */ 336 + pll_clk = clk_register(NULL, &fd->hw); 337 + if (IS_ERR(pll_clk)) 338 + goto unmap; 339 + 340 + fd->outputs.clks[0] = pll_clk; 341 + fd->outputs.clk_num++; 342 + 343 + /* 344 + * Set up the child synthesizers starting at index 1 as the 345 + * PLL output is at index 0. We need to check the clock-indices 346 + * for numbering in case there are holes in the synth mapping, 347 + * and then probe the synth register to see if it has a FREQ 348 + * register available. 349 + */ 350 + for (i = 0; i < MAX_FAPLL_OUTPUTS; i++) { 351 + const char *output_name; 352 + void __iomem *freq, *div; 353 + struct clk *synth_clk; 354 + int output_instance; 355 + u32 v; 356 + 357 + if (of_property_read_string_index(node, "clock-output-names", 358 + i, &output_name)) 359 + continue; 360 + 361 + if (of_property_read_u32_index(node, "clock-indices", i, 362 + &output_instance)) 363 + output_instance = i; 364 + 365 + freq = fd->base + (output_instance * 8); 366 + div = freq + 4; 367 + 368 + /* Check for hardwired audio_pll_clk1 */ 369 + if (is_audio_pll_clk1(freq)) { 370 + freq = 0; 371 + div = 0; 372 + } else { 373 + /* Does the synthesizer have a FREQ register? */ 374 + v = readl_relaxed(freq); 375 + if (!v) 376 + freq = 0; 377 + } 378 + synth_clk = ti_fapll_synth_setup(fd, freq, div, output_instance, 379 + output_name, node->name, 380 + pll_clk); 381 + if (IS_ERR(synth_clk)) 382 + continue; 383 + 384 + fd->outputs.clks[output_instance] = synth_clk; 385 + fd->outputs.clk_num++; 386 + 387 + clk_register_clkdev(synth_clk, output_name, NULL); 388 + } 389 + 390 + /* Register the child synthesizers as the FAPLL outputs */ 391 + of_clk_add_provider(node, of_clk_src_onecell_get, &fd->outputs); 392 + /* Add clock alias for the outputs */ 393 + 394 + kfree(init); 395 + 396 + return; 397 + 398 + unmap: 399 + iounmap(fd->base); 400 + free: 401 + if (fd->clk_bypass) 402 + clk_put(fd->clk_bypass); 403 + if (fd->clk_ref) 404 + clk_put(fd->clk_ref); 405 + kfree(fd->outputs.clks); 406 + kfree(fd); 407 + kfree(init); 408 + } 409 + 410 + CLK_OF_DECLARE(ti_fapll_clock, "ti,dm816-fapll-clock", ti_fapll_setup);
+136 -33
drivers/clk/ti/gate.c
··· 22 22 #include <linux/of_address.h> 23 23 #include <linux/clk/ti.h> 24 24 25 + #include "clock.h" 26 + 25 27 #define to_clk_divider(_hw) container_of(_hw, struct clk_divider, hw) 26 28 27 29 #undef pr_fmt ··· 92 90 return ret; 93 91 } 94 92 93 + static struct clk *_register_gate(struct device *dev, const char *name, 94 + const char *parent_name, unsigned long flags, 95 + void __iomem *reg, u8 bit_idx, 96 + u8 clk_gate_flags, const struct clk_ops *ops, 97 + const struct clk_hw_omap_ops *hw_ops) 98 + { 99 + struct clk_init_data init = { NULL }; 100 + struct clk_hw_omap *clk_hw; 101 + struct clk *clk; 102 + 103 + clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); 104 + if (!clk_hw) 105 + return ERR_PTR(-ENOMEM); 106 + 107 + clk_hw->hw.init = &init; 108 + 109 + init.name = name; 110 + init.ops = ops; 111 + 112 + clk_hw->enable_reg = reg; 113 + clk_hw->enable_bit = bit_idx; 114 + clk_hw->ops = hw_ops; 115 + 116 + clk_hw->flags = MEMMAP_ADDRESSING | clk_gate_flags; 117 + 118 + init.parent_names = &parent_name; 119 + init.num_parents = 1; 120 + 121 + init.flags = flags; 122 + 123 + clk = clk_register(NULL, &clk_hw->hw); 124 + 125 + if (IS_ERR(clk)) 126 + kfree(clk_hw); 127 + 128 + return clk; 129 + } 130 + 131 + #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_ATAGS) 132 + struct clk *ti_clk_register_gate(struct ti_clk *setup) 133 + { 134 + const struct clk_ops *ops = &omap_gate_clk_ops; 135 + const struct clk_hw_omap_ops *hw_ops = NULL; 136 + u32 reg; 137 + struct clk_omap_reg *reg_setup; 138 + u32 flags = 0; 139 + u8 clk_gate_flags = 0; 140 + struct ti_clk_gate *gate; 141 + 142 + gate = setup->data; 143 + 144 + if (gate->flags & CLKF_INTERFACE) 145 + return ti_clk_register_interface(setup); 146 + 147 + reg_setup = (struct clk_omap_reg *)&reg; 148 + 149 + if (gate->flags & CLKF_SET_RATE_PARENT) 150 + flags |= CLK_SET_RATE_PARENT; 151 + 152 + if (gate->flags & CLKF_SET_BIT_TO_DISABLE) 153 + clk_gate_flags |= INVERT_ENABLE; 154 + 155 + if (gate->flags & CLKF_HSDIV) { 156 + ops = &omap_gate_clk_hsdiv_restore_ops; 157 + hw_ops = &clkhwops_wait; 158 + } 159 + 160 + if (gate->flags & CLKF_DSS) 161 + hw_ops = &clkhwops_omap3430es2_dss_usbhost_wait; 162 + 163 + if (gate->flags & CLKF_WAIT) 164 + hw_ops = &clkhwops_wait; 165 + 166 + if (gate->flags & CLKF_CLKDM) 167 + ops = &omap_gate_clkdm_clk_ops; 168 + 169 + if (gate->flags & CLKF_AM35XX) 170 + hw_ops = &clkhwops_am35xx_ipss_module_wait; 171 + 172 + reg_setup->index = gate->module; 173 + reg_setup->offset = gate->reg; 174 + 175 + return _register_gate(NULL, setup->name, gate->parent, flags, 176 + (void __iomem *)reg, gate->bit_shift, 177 + clk_gate_flags, ops, hw_ops); 178 + } 179 + 180 + struct clk_hw *ti_clk_build_component_gate(struct ti_clk_gate *setup) 181 + { 182 + struct clk_hw_omap *gate; 183 + struct clk_omap_reg *reg; 184 + const struct clk_hw_omap_ops *ops = &clkhwops_wait; 185 + 186 + if (!setup) 187 + return NULL; 188 + 189 + gate = kzalloc(sizeof(*gate), GFP_KERNEL); 190 + if (!gate) 191 + return ERR_PTR(-ENOMEM); 192 + 193 + reg = (struct clk_omap_reg *)&gate->enable_reg; 194 + reg->index = setup->module; 195 + reg->offset = setup->reg; 196 + 197 + gate->enable_bit = setup->bit_shift; 198 + 199 + if (setup->flags & CLKF_NO_WAIT) 200 + ops = NULL; 201 + 202 + if (setup->flags & CLKF_INTERFACE) 203 + ops = &clkhwops_iclk_wait; 204 + 205 + gate->ops = ops; 206 + gate->flags = MEMMAP_ADDRESSING; 207 + 208 + return &gate->hw; 209 + } 210 + #endif 211 + 95 212 static void __init _of_ti_gate_clk_setup(struct device_node *node, 96 213 const struct clk_ops *ops, 97 214 const struct clk_hw_omap_ops *hw_ops) 98 215 { 99 216 struct clk *clk; 100 - struct clk_init_data init = { NULL }; 101 - struct clk_hw_omap *clk_hw; 102 - const char *clk_name = node->name; 103 217 const char *parent_name; 218 + void __iomem *reg = NULL; 219 + u8 enable_bit = 0; 104 220 u32 val; 105 - 106 - clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); 107 - if (!clk_hw) 108 - return; 109 - 110 - clk_hw->hw.init = &init; 111 - 112 - init.name = clk_name; 113 - init.ops = ops; 221 + u32 flags = 0; 222 + u8 clk_gate_flags = 0; 114 223 115 224 if (ops != &omap_gate_clkdm_clk_ops) { 116 - clk_hw->enable_reg = ti_clk_get_reg_addr(node, 0); 117 - if (!clk_hw->enable_reg) 118 - goto cleanup; 225 + reg = ti_clk_get_reg_addr(node, 0); 226 + if (!reg) 227 + return; 119 228 120 229 if (!of_property_read_u32(node, "ti,bit-shift", &val)) 121 - clk_hw->enable_bit = val; 230 + enable_bit = val; 122 231 } 123 232 124 - clk_hw->ops = hw_ops; 125 - 126 - clk_hw->flags = MEMMAP_ADDRESSING; 127 - 128 233 if (of_clk_get_parent_count(node) != 1) { 129 - pr_err("%s must have 1 parent\n", clk_name); 130 - goto cleanup; 234 + pr_err("%s must have 1 parent\n", node->name); 235 + return; 131 236 } 132 237 133 238 parent_name = of_clk_get_parent_name(node, 0); 134 - init.parent_names = &parent_name; 135 - init.num_parents = 1; 136 239 137 240 if (of_property_read_bool(node, "ti,set-rate-parent")) 138 - init.flags |= CLK_SET_RATE_PARENT; 241 + flags |= CLK_SET_RATE_PARENT; 139 242 140 243 if (of_property_read_bool(node, "ti,set-bit-to-disable")) 141 - clk_hw->flags |= INVERT_ENABLE; 244 + clk_gate_flags |= INVERT_ENABLE; 142 245 143 - clk = clk_register(NULL, &clk_hw->hw); 246 + clk = _register_gate(NULL, node->name, parent_name, flags, reg, 247 + enable_bit, clk_gate_flags, ops, hw_ops); 144 248 145 - if (!IS_ERR(clk)) { 249 + if (!IS_ERR(clk)) 146 250 of_clk_add_provider(node, of_clk_src_simple_get, clk); 147 - return; 148 - } 149 - 150 - cleanup: 151 - kfree(clk_hw); 152 251 } 153 252 154 253 static void __init
+74 -24
drivers/clk/ti/interface.c
··· 20 20 #include <linux/of.h> 21 21 #include <linux/of_address.h> 22 22 #include <linux/clk/ti.h> 23 + #include "clock.h" 23 24 24 25 #undef pr_fmt 25 26 #define pr_fmt(fmt) "%s: " fmt, __func__ ··· 32 31 .is_enabled = &omap2_dflt_clk_is_enabled, 33 32 }; 34 33 35 - static void __init _of_ti_interface_clk_setup(struct device_node *node, 36 - const struct clk_hw_omap_ops *ops) 34 + static struct clk *_register_interface(struct device *dev, const char *name, 35 + const char *parent_name, 36 + void __iomem *reg, u8 bit_idx, 37 + const struct clk_hw_omap_ops *ops) 37 38 { 38 - struct clk *clk; 39 39 struct clk_init_data init = { NULL }; 40 40 struct clk_hw_omap *clk_hw; 41 - const char *parent_name; 42 - u32 val; 41 + struct clk *clk; 43 42 44 43 clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); 45 44 if (!clk_hw) 46 - return; 45 + return ERR_PTR(-ENOMEM); 47 46 48 47 clk_hw->hw.init = &init; 49 48 clk_hw->ops = ops; 50 49 clk_hw->flags = MEMMAP_ADDRESSING; 50 + clk_hw->enable_reg = reg; 51 + clk_hw->enable_bit = bit_idx; 51 52 52 - clk_hw->enable_reg = ti_clk_get_reg_addr(node, 0); 53 - if (!clk_hw->enable_reg) 54 - goto cleanup; 55 - 56 - if (!of_property_read_u32(node, "ti,bit-shift", &val)) 57 - clk_hw->enable_bit = val; 58 - 59 - init.name = node->name; 53 + init.name = name; 60 54 init.ops = &ti_interface_clk_ops; 61 55 init.flags = 0; 62 - 63 - parent_name = of_clk_get_parent_name(node, 0); 64 - if (!parent_name) { 65 - pr_err("%s must have a parent\n", node->name); 66 - goto cleanup; 67 - } 68 56 69 57 init.num_parents = 1; 70 58 init.parent_names = &parent_name; 71 59 72 60 clk = clk_register(NULL, &clk_hw->hw); 73 61 74 - if (!IS_ERR(clk)) { 75 - of_clk_add_provider(node, of_clk_src_simple_get, clk); 62 + if (IS_ERR(clk)) 63 + kfree(clk_hw); 64 + else 76 65 omap2_init_clk_hw_omap_clocks(clk); 66 + 67 + return clk; 68 + } 69 + 70 + #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_ATAGS) 71 + struct clk *ti_clk_register_interface(struct ti_clk *setup) 72 + { 73 + const struct clk_hw_omap_ops *ops = &clkhwops_iclk_wait; 74 + u32 reg; 75 + struct clk_omap_reg *reg_setup; 76 + struct ti_clk_gate *gate; 77 + 78 + gate = setup->data; 79 + reg_setup = (struct clk_omap_reg *)&reg; 80 + reg_setup->index = gate->module; 81 + reg_setup->offset = gate->reg; 82 + 83 + if (gate->flags & CLKF_NO_WAIT) 84 + ops = &clkhwops_iclk; 85 + 86 + if (gate->flags & CLKF_HSOTGUSB) 87 + ops = &clkhwops_omap3430es2_iclk_hsotgusb_wait; 88 + 89 + if (gate->flags & CLKF_DSS) 90 + ops = &clkhwops_omap3430es2_iclk_dss_usbhost_wait; 91 + 92 + if (gate->flags & CLKF_SSI) 93 + ops = &clkhwops_omap3430es2_iclk_ssi_wait; 94 + 95 + if (gate->flags & CLKF_AM35XX) 96 + ops = &clkhwops_am35xx_ipss_wait; 97 + 98 + return _register_interface(NULL, setup->name, gate->parent, 99 + (void __iomem *)reg, gate->bit_shift, ops); 100 + } 101 + #endif 102 + 103 + static void __init _of_ti_interface_clk_setup(struct device_node *node, 104 + const struct clk_hw_omap_ops *ops) 105 + { 106 + struct clk *clk; 107 + const char *parent_name; 108 + void __iomem *reg; 109 + u8 enable_bit = 0; 110 + u32 val; 111 + 112 + reg = ti_clk_get_reg_addr(node, 0); 113 + if (!reg) 114 + return; 115 + 116 + if (!of_property_read_u32(node, "ti,bit-shift", &val)) 117 + enable_bit = val; 118 + 119 + parent_name = of_clk_get_parent_name(node, 0); 120 + if (!parent_name) { 121 + pr_err("%s must have a parent\n", node->name); 77 122 return; 78 123 } 79 124 80 - cleanup: 81 - kfree(clk_hw); 125 + clk = _register_interface(NULL, node->name, parent_name, reg, 126 + enable_bit, ops); 127 + 128 + if (!IS_ERR(clk)) 129 + of_clk_add_provider(node, of_clk_src_simple_get, clk); 82 130 } 83 131 84 132 static void __init of_ti_interface_clk_setup(struct device_node *node)
+68 -2
drivers/clk/ti/mux.c
··· 21 21 #include <linux/of.h> 22 22 #include <linux/of_address.h> 23 23 #include <linux/clk/ti.h> 24 + #include "clock.h" 24 25 25 26 #undef pr_fmt 26 27 #define pr_fmt(fmt) "%s: " fmt, __func__ ··· 145 144 return clk; 146 145 } 147 146 147 + struct clk *ti_clk_register_mux(struct ti_clk *setup) 148 + { 149 + struct ti_clk_mux *mux; 150 + u32 flags; 151 + u8 mux_flags = 0; 152 + struct clk_omap_reg *reg_setup; 153 + u32 reg; 154 + u32 mask; 155 + 156 + reg_setup = (struct clk_omap_reg *)&reg; 157 + 158 + mux = setup->data; 159 + flags = CLK_SET_RATE_NO_REPARENT; 160 + 161 + mask = mux->num_parents; 162 + if (!(mux->flags & CLKF_INDEX_STARTS_AT_ONE)) 163 + mask--; 164 + 165 + mask = (1 << fls(mask)) - 1; 166 + reg_setup->index = mux->module; 167 + reg_setup->offset = mux->reg; 168 + 169 + if (mux->flags & CLKF_INDEX_STARTS_AT_ONE) 170 + mux_flags |= CLK_MUX_INDEX_ONE; 171 + 172 + if (mux->flags & CLKF_SET_RATE_PARENT) 173 + flags |= CLK_SET_RATE_PARENT; 174 + 175 + return _register_mux(NULL, setup->name, mux->parents, mux->num_parents, 176 + flags, (void __iomem *)reg, mux->bit_shift, mask, 177 + mux_flags, NULL, NULL); 178 + } 179 + 148 180 /** 149 181 * of_mux_clk_setup - Setup function for simple mux rate clock 150 182 * @node: DT node for the clock ··· 228 194 229 195 mask = (1 << fls(mask)) - 1; 230 196 231 - clk = _register_mux(NULL, node->name, parent_names, num_parents, flags, 232 - reg, shift, mask, clk_mux_flags, NULL, NULL); 197 + clk = _register_mux(NULL, node->name, parent_names, num_parents, 198 + flags, reg, shift, mask, clk_mux_flags, NULL, 199 + NULL); 233 200 234 201 if (!IS_ERR(clk)) 235 202 of_clk_add_provider(node, of_clk_src_simple_get, clk); ··· 239 204 kfree(parent_names); 240 205 } 241 206 CLK_OF_DECLARE(mux_clk, "ti,mux-clock", of_mux_clk_setup); 207 + 208 + struct clk_hw *ti_clk_build_component_mux(struct ti_clk_mux *setup) 209 + { 210 + struct clk_mux *mux; 211 + struct clk_omap_reg *reg; 212 + int num_parents; 213 + 214 + if (!setup) 215 + return NULL; 216 + 217 + mux = kzalloc(sizeof(*mux), GFP_KERNEL); 218 + if (!mux) 219 + return ERR_PTR(-ENOMEM); 220 + 221 + reg = (struct clk_omap_reg *)&mux->reg; 222 + 223 + mux->shift = setup->bit_shift; 224 + 225 + reg->index = setup->module; 226 + reg->offset = setup->reg; 227 + 228 + if (setup->flags & CLKF_INDEX_STARTS_AT_ONE) 229 + mux->flags |= CLK_MUX_INDEX_ONE; 230 + 231 + num_parents = setup->num_parents; 232 + 233 + mux->mask = num_parents - 1; 234 + mux->mask = (1 << fls(mux->mask)) - 1; 235 + 236 + return &mux->hw; 237 + } 242 238 243 239 static void __init of_ti_composite_mux_clk_setup(struct device_node *node) 244 240 {
-1
drivers/clk/ux500/clk-prcc.c
··· 8 8 */ 9 9 10 10 #include <linux/clk-provider.h> 11 - #include <linux/clk-private.h> 12 11 #include <linux/slab.h> 13 12 #include <linux/io.h> 14 13 #include <linux/err.h>
-1
drivers/clk/ux500/clk-prcmu.c
··· 8 8 */ 9 9 10 10 #include <linux/clk-provider.h> 11 - #include <linux/clk-private.h> 12 11 #include <linux/mfd/dbx500-prcmu.h> 13 12 #include <linux/slab.h> 14 13 #include <linux/io.h>
+1
drivers/clk/zynq/clkc.c
··· 303 303 clks[cpu_2x] = clk_register_gate(NULL, clk_output_name[cpu_2x], 304 304 "cpu_2x_div", CLK_IGNORE_UNUSED, SLCR_ARM_CLK_CTRL, 305 305 26, 0, &armclk_lock); 306 + clk_prepare_enable(clks[cpu_2x]); 306 307 307 308 clk = clk_register_fixed_factor(NULL, "cpu_1x_div", "cpu_div", 0, 1, 308 309 4 + 2 * tmp);
+1 -1
drivers/cpufreq/Kconfig.powerpc
··· 26 26 config PPC_CORENET_CPUFREQ 27 27 tristate "CPU frequency scaling driver for Freescale E500MC SoCs" 28 28 depends on PPC_E500MC && OF && COMMON_CLK 29 - select CLK_PPC_CORENET 29 + select CLK_QORIQ 30 30 help 31 31 This adds the CPUFreq driver support for Freescale e500mc, 32 32 e5500 and e6500 series SoCs which are capable of changing
+48 -15
drivers/mmc/host/sunxi-mmc.c
··· 21 21 #include <linux/err.h> 22 22 23 23 #include <linux/clk.h> 24 - #include <linux/clk/sunxi.h> 25 - 26 24 #include <linux/gpio.h> 27 25 #include <linux/platform_device.h> 28 26 #include <linux/spinlock.h> ··· 227 229 /* clock management */ 228 230 struct clk *clk_ahb; 229 231 struct clk *clk_mmc; 232 + struct clk *clk_sample; 233 + struct clk *clk_output; 230 234 231 235 /* irq */ 232 236 spinlock_t lock; ··· 653 653 654 654 /* determine delays */ 655 655 if (rate <= 400000) { 656 - oclk_dly = 0; 657 - sclk_dly = 7; 656 + oclk_dly = 180; 657 + sclk_dly = 42; 658 658 } else if (rate <= 25000000) { 659 - oclk_dly = 0; 660 - sclk_dly = 5; 659 + oclk_dly = 180; 660 + sclk_dly = 75; 661 661 } else if (rate <= 50000000) { 662 662 if (ios->timing == MMC_TIMING_UHS_DDR50) { 663 - oclk_dly = 2; 664 - sclk_dly = 4; 663 + oclk_dly = 60; 664 + sclk_dly = 120; 665 665 } else { 666 - oclk_dly = 3; 667 - sclk_dly = 5; 666 + oclk_dly = 90; 667 + sclk_dly = 150; 668 668 } 669 + } else if (rate <= 100000000) { 670 + oclk_dly = 6; 671 + sclk_dly = 24; 672 + } else if (rate <= 200000000) { 673 + oclk_dly = 3; 674 + sclk_dly = 12; 669 675 } else { 670 - /* rate > 50000000 */ 671 - oclk_dly = 2; 672 - sclk_dly = 4; 676 + return -EINVAL; 673 677 } 674 678 675 - clk_sunxi_mmc_phase_control(host->clk_mmc, sclk_dly, oclk_dly); 679 + clk_set_phase(host->clk_sample, sclk_dly); 680 + clk_set_phase(host->clk_output, oclk_dly); 676 681 677 682 return sunxi_mmc_oclk_onoff(host, 1); 678 683 } ··· 918 913 return PTR_ERR(host->clk_mmc); 919 914 } 920 915 916 + host->clk_output = devm_clk_get(&pdev->dev, "output"); 917 + if (IS_ERR(host->clk_output)) { 918 + dev_err(&pdev->dev, "Could not get output clock\n"); 919 + return PTR_ERR(host->clk_output); 920 + } 921 + 922 + host->clk_sample = devm_clk_get(&pdev->dev, "sample"); 923 + if (IS_ERR(host->clk_sample)) { 924 + dev_err(&pdev->dev, "Could not get sample clock\n"); 925 + return PTR_ERR(host->clk_sample); 926 + } 927 + 921 928 host->reset = devm_reset_control_get(&pdev->dev, "ahb"); 922 929 923 930 ret = clk_prepare_enable(host->clk_ahb); ··· 944 927 goto error_disable_clk_ahb; 945 928 } 946 929 930 + ret = clk_prepare_enable(host->clk_output); 931 + if (ret) { 932 + dev_err(&pdev->dev, "Enable output clk err %d\n", ret); 933 + goto error_disable_clk_mmc; 934 + } 935 + 936 + ret = clk_prepare_enable(host->clk_sample); 937 + if (ret) { 938 + dev_err(&pdev->dev, "Enable sample clk err %d\n", ret); 939 + goto error_disable_clk_output; 940 + } 941 + 947 942 if (!IS_ERR(host->reset)) { 948 943 ret = reset_control_deassert(host->reset); 949 944 if (ret) { 950 945 dev_err(&pdev->dev, "reset err %d\n", ret); 951 - goto error_disable_clk_mmc; 946 + goto error_disable_clk_sample; 952 947 } 953 948 } 954 949 ··· 979 950 error_assert_reset: 980 951 if (!IS_ERR(host->reset)) 981 952 reset_control_assert(host->reset); 953 + error_disable_clk_sample: 954 + clk_disable_unprepare(host->clk_sample); 955 + error_disable_clk_output: 956 + clk_disable_unprepare(host->clk_output); 982 957 error_disable_clk_mmc: 983 958 clk_disable_unprepare(host->clk_mmc); 984 959 error_disable_clk_ahb:
+97
include/dt-bindings/clock/alphascale,asm9260.h
··· 1 + /* 2 + * Copyright 2014 Oleksij Rempel <linux@rempel-privat.de> 3 + * 4 + * This software is licensed under the terms of the GNU General Public 5 + * License version 2, as published by the Free Software Foundation, and 6 + * may be copied, distributed, and modified under those terms. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + */ 13 + 14 + #ifndef _DT_BINDINGS_CLK_ASM9260_H 15 + #define _DT_BINDINGS_CLK_ASM9260_H 16 + 17 + /* ahb gate */ 18 + #define CLKID_AHB_ROM 0 19 + #define CLKID_AHB_RAM 1 20 + #define CLKID_AHB_GPIO 2 21 + #define CLKID_AHB_MAC 3 22 + #define CLKID_AHB_EMI 4 23 + #define CLKID_AHB_USB0 5 24 + #define CLKID_AHB_USB1 6 25 + #define CLKID_AHB_DMA0 7 26 + #define CLKID_AHB_DMA1 8 27 + #define CLKID_AHB_UART0 9 28 + #define CLKID_AHB_UART1 10 29 + #define CLKID_AHB_UART2 11 30 + #define CLKID_AHB_UART3 12 31 + #define CLKID_AHB_UART4 13 32 + #define CLKID_AHB_UART5 14 33 + #define CLKID_AHB_UART6 15 34 + #define CLKID_AHB_UART7 16 35 + #define CLKID_AHB_UART8 17 36 + #define CLKID_AHB_UART9 18 37 + #define CLKID_AHB_I2S0 19 38 + #define CLKID_AHB_I2C0 20 39 + #define CLKID_AHB_I2C1 21 40 + #define CLKID_AHB_SSP0 22 41 + #define CLKID_AHB_IOCONFIG 23 42 + #define CLKID_AHB_WDT 24 43 + #define CLKID_AHB_CAN0 25 44 + #define CLKID_AHB_CAN1 26 45 + #define CLKID_AHB_MPWM 27 46 + #define CLKID_AHB_SPI0 28 47 + #define CLKID_AHB_SPI1 29 48 + #define CLKID_AHB_QEI 30 49 + #define CLKID_AHB_QUADSPI0 31 50 + #define CLKID_AHB_CAMIF 32 51 + #define CLKID_AHB_LCDIF 33 52 + #define CLKID_AHB_TIMER0 34 53 + #define CLKID_AHB_TIMER1 35 54 + #define CLKID_AHB_TIMER2 36 55 + #define CLKID_AHB_TIMER3 37 56 + #define CLKID_AHB_IRQ 38 57 + #define CLKID_AHB_RTC 39 58 + #define CLKID_AHB_NAND 40 59 + #define CLKID_AHB_ADC0 41 60 + #define CLKID_AHB_LED 42 61 + #define CLKID_AHB_DAC0 43 62 + #define CLKID_AHB_LCD 44 63 + #define CLKID_AHB_I2S1 45 64 + #define CLKID_AHB_MAC1 46 65 + 66 + /* devider */ 67 + #define CLKID_SYS_CPU 47 68 + #define CLKID_SYS_AHB 48 69 + #define CLKID_SYS_I2S0M 49 70 + #define CLKID_SYS_I2S0S 50 71 + #define CLKID_SYS_I2S1M 51 72 + #define CLKID_SYS_I2S1S 52 73 + #define CLKID_SYS_UART0 53 74 + #define CLKID_SYS_UART1 54 75 + #define CLKID_SYS_UART2 55 76 + #define CLKID_SYS_UART3 56 77 + #define CLKID_SYS_UART4 56 78 + #define CLKID_SYS_UART5 57 79 + #define CLKID_SYS_UART6 58 80 + #define CLKID_SYS_UART7 59 81 + #define CLKID_SYS_UART8 60 82 + #define CLKID_SYS_UART9 61 83 + #define CLKID_SYS_SPI0 62 84 + #define CLKID_SYS_SPI1 63 85 + #define CLKID_SYS_QUADSPI 64 86 + #define CLKID_SYS_SSP0 65 87 + #define CLKID_SYS_NAND 66 88 + #define CLKID_SYS_TRACE 67 89 + #define CLKID_SYS_CAMM 68 90 + #define CLKID_SYS_WDT 69 91 + #define CLKID_SYS_CLKOUT 70 92 + #define CLKID_SYS_MAC 71 93 + #define CLKID_SYS_LCD 72 94 + #define CLKID_SYS_ADCANA 73 95 + 96 + #define MAX_CLKS 74 97 + #endif
+6 -1
include/dt-bindings/clock/exynos4.h
··· 262 262 #define CLK_DIV_MCUISP1 453 /* Exynos4x12 only */ 263 263 #define CLK_DIV_ACLK200 454 /* Exynos4x12 only */ 264 264 #define CLK_DIV_ACLK400_MCUISP 455 /* Exynos4x12 only */ 265 + #define CLK_DIV_ACP 456 266 + #define CLK_DIV_DMC 457 267 + #define CLK_DIV_C2C 458 /* Exynos4x12 only */ 268 + #define CLK_DIV_GDL 459 269 + #define CLK_DIV_GDR 460 265 270 266 271 /* must be greater than maximal clock id */ 267 - #define CLK_NR_CLKS 456 272 + #define CLK_NR_CLKS 461 268 273 269 274 #endif /* _DT_BINDINGS_CLOCK_EXYNOS_4_H */
+84 -4
include/dt-bindings/clock/exynos7-clk.h
··· 17 17 #define DOUT_SCLK_CC_PLL 4 18 18 #define DOUT_SCLK_MFC_PLL 5 19 19 #define DOUT_ACLK_CCORE_133 6 20 - #define TOPC_NR_CLK 7 20 + #define DOUT_ACLK_MSCL_532 7 21 + #define ACLK_MSCL_532 8 22 + #define DOUT_SCLK_AUD_PLL 9 23 + #define FOUT_AUD_PLL 10 24 + #define TOPC_NR_CLK 11 21 25 22 26 /* TOP0 */ 23 27 #define DOUT_ACLK_PERIC1 1 ··· 30 26 #define CLK_SCLK_UART1 4 31 27 #define CLK_SCLK_UART2 5 32 28 #define CLK_SCLK_UART3 6 33 - #define TOP0_NR_CLK 7 29 + #define CLK_SCLK_SPI0 7 30 + #define CLK_SCLK_SPI1 8 31 + #define CLK_SCLK_SPI2 9 32 + #define CLK_SCLK_SPI3 10 33 + #define CLK_SCLK_SPI4 11 34 + #define CLK_SCLK_SPDIF 12 35 + #define CLK_SCLK_PCM1 13 36 + #define CLK_SCLK_I2S1 14 37 + #define TOP0_NR_CLK 15 34 38 35 39 /* TOP1 */ 36 40 #define DOUT_ACLK_FSYS1_200 1 ··· 82 70 #define PCLK_HSI2C6 9 83 71 #define PCLK_HSI2C7 10 84 72 #define PCLK_HSI2C8 11 85 - #define PERIC1_NR_CLK 12 73 + #define PCLK_SPI0 12 74 + #define PCLK_SPI1 13 75 + #define PCLK_SPI2 14 76 + #define PCLK_SPI3 15 77 + #define PCLK_SPI4 16 78 + #define SCLK_SPI0 17 79 + #define SCLK_SPI1 18 80 + #define SCLK_SPI2 19 81 + #define SCLK_SPI3 20 82 + #define SCLK_SPI4 21 83 + #define PCLK_I2S1 22 84 + #define PCLK_PCM1 23 85 + #define PCLK_SPDIF 24 86 + #define SCLK_I2S1 25 87 + #define SCLK_PCM1 26 88 + #define SCLK_SPDIF 27 89 + #define PERIC1_NR_CLK 28 86 90 87 91 /* PERIS */ 88 92 #define PCLK_CHIPID 1 ··· 110 82 111 83 /* FSYS0 */ 112 84 #define ACLK_MMC2 1 113 - #define FSYS0_NR_CLK 2 85 + #define ACLK_AXIUS_USBDRD30X_FSYS0X 2 86 + #define ACLK_USBDRD300 3 87 + #define SCLK_USBDRD300_SUSPENDCLK 4 88 + #define SCLK_USBDRD300_REFCLK 5 89 + #define PHYCLK_USBDRD300_UDRD30_PIPE_PCLK_USER 6 90 + #define PHYCLK_USBDRD300_UDRD30_PHYCLK_USER 7 91 + #define OSCCLK_PHY_CLKOUT_USB30_PHY 8 92 + #define ACLK_PDMA0 9 93 + #define ACLK_PDMA1 10 94 + #define FSYS0_NR_CLK 11 114 95 115 96 /* FSYS1 */ 116 97 #define ACLK_MMC1 1 117 98 #define ACLK_MMC0 2 118 99 #define FSYS1_NR_CLK 3 119 100 101 + /* MSCL */ 102 + #define USERMUX_ACLK_MSCL_532 1 103 + #define DOUT_PCLK_MSCL 2 104 + #define ACLK_MSCL_0 3 105 + #define ACLK_MSCL_1 4 106 + #define ACLK_JPEG 5 107 + #define ACLK_G2D 6 108 + #define ACLK_LH_ASYNC_SI_MSCL_0 7 109 + #define ACLK_LH_ASYNC_SI_MSCL_1 8 110 + #define ACLK_AXI2ACEL_BRIDGE 9 111 + #define ACLK_XIU_MSCLX_0 10 112 + #define ACLK_XIU_MSCLX_1 11 113 + #define ACLK_QE_MSCL_0 12 114 + #define ACLK_QE_MSCL_1 13 115 + #define ACLK_QE_JPEG 14 116 + #define ACLK_QE_G2D 15 117 + #define ACLK_PPMU_MSCL_0 16 118 + #define ACLK_PPMU_MSCL_1 17 119 + #define ACLK_MSCLNP_133 18 120 + #define ACLK_AHB2APB_MSCL0P 19 121 + #define ACLK_AHB2APB_MSCL1P 20 122 + 123 + #define PCLK_MSCL_0 21 124 + #define PCLK_MSCL_1 22 125 + #define PCLK_JPEG 23 126 + #define PCLK_G2D 24 127 + #define PCLK_QE_MSCL_0 25 128 + #define PCLK_QE_MSCL_1 26 129 + #define PCLK_QE_JPEG 27 130 + #define PCLK_QE_G2D 28 131 + #define PCLK_PPMU_MSCL_0 29 132 + #define PCLK_PPMU_MSCL_1 30 133 + #define PCLK_AXI2ACEL_BRIDGE 31 134 + #define PCLK_PMU_MSCL 32 135 + #define MSCL_NR_CLK 33 136 + 137 + /* AUD */ 138 + #define SCLK_I2S 1 139 + #define SCLK_PCM 2 140 + #define PCLK_I2S 3 141 + #define PCLK_PCM 4 142 + #define ACLK_ADMA 5 143 + #define AUD_NR_CLK 6 120 144 #endif /* _DT_BINDINGS_CLOCK_EXYNOS7_H */
-1
include/dt-bindings/clock/qcom,gcc-ipq806x.h
··· 238 238 #define PLL0_VOTE 221 239 239 #define PLL3 222 240 240 #define PLL3_VOTE 223 241 - #define PLL4 224 242 241 #define PLL4_VOTE 225 243 242 #define PLL8 226 244 243 #define PLL8_VOTE 227
+30
include/dt-bindings/clock/qcom,lcc-ipq806x.h
··· 1 + /* 2 + * Copyright (c) 2014, The Linux Foundation. All rights reserved. 3 + * 4 + * This software is licensed under the terms of the GNU General Public 5 + * License version 2, as published by the Free Software Foundation, and 6 + * may be copied, distributed, and modified under those terms. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + */ 13 + 14 + #ifndef _DT_BINDINGS_CLK_LCC_IPQ806X_H 15 + #define _DT_BINDINGS_CLK_LCC_IPQ806X_H 16 + 17 + #define PLL4 0 18 + #define MI2S_OSR_SRC 1 19 + #define MI2S_OSR_CLK 2 20 + #define MI2S_DIV_CLK 3 21 + #define MI2S_BIT_DIV_CLK 4 22 + #define MI2S_BIT_CLK 5 23 + #define PCM_SRC 6 24 + #define PCM_CLK_OUT 7 25 + #define PCM_CLK 8 26 + #define SPDIF_SRC 9 27 + #define SPDIF_CLK 10 28 + #define AHBIX_CLK 11 29 + 30 + #endif
+50
include/dt-bindings/clock/qcom,lcc-msm8960.h
··· 1 + /* 2 + * Copyright (c) 2014, The Linux Foundation. All rights reserved. 3 + * 4 + * This software is licensed under the terms of the GNU General Public 5 + * License version 2, as published by the Free Software Foundation, and 6 + * may be copied, distributed, and modified under those terms. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + */ 13 + 14 + #ifndef _DT_BINDINGS_CLK_LCC_MSM8960_H 15 + #define _DT_BINDINGS_CLK_LCC_MSM8960_H 16 + 17 + #define PLL4 0 18 + #define MI2S_OSR_SRC 1 19 + #define MI2S_OSR_CLK 2 20 + #define MI2S_DIV_CLK 3 21 + #define MI2S_BIT_DIV_CLK 4 22 + #define MI2S_BIT_CLK 5 23 + #define PCM_SRC 6 24 + #define PCM_CLK_OUT 7 25 + #define PCM_CLK 8 26 + #define SLIMBUS_SRC 9 27 + #define AUDIO_SLIMBUS_CLK 10 28 + #define SPS_SLIMBUS_CLK 11 29 + #define CODEC_I2S_MIC_OSR_SRC 12 30 + #define CODEC_I2S_MIC_OSR_CLK 13 31 + #define CODEC_I2S_MIC_DIV_CLK 14 32 + #define CODEC_I2S_MIC_BIT_DIV_CLK 15 33 + #define CODEC_I2S_MIC_BIT_CLK 16 34 + #define SPARE_I2S_MIC_OSR_SRC 17 35 + #define SPARE_I2S_MIC_OSR_CLK 18 36 + #define SPARE_I2S_MIC_DIV_CLK 19 37 + #define SPARE_I2S_MIC_BIT_DIV_CLK 20 38 + #define SPARE_I2S_MIC_BIT_CLK 21 39 + #define CODEC_I2S_SPKR_OSR_SRC 22 40 + #define CODEC_I2S_SPKR_OSR_CLK 23 41 + #define CODEC_I2S_SPKR_DIV_CLK 24 42 + #define CODEC_I2S_SPKR_BIT_DIV_CLK 25 43 + #define CODEC_I2S_SPKR_BIT_CLK 26 44 + #define SPARE_I2S_SPKR_OSR_SRC 27 45 + #define SPARE_I2S_SPKR_OSR_CLK 28 46 + #define SPARE_I2S_SPKR_DIV_CLK 29 47 + #define SPARE_I2S_SPKR_BIT_DIV_CLK 30 48 + #define SPARE_I2S_SPKR_BIT_CLK 31 49 + 50 + #endif
+345
include/dt-bindings/clock/tegra124-car-common.h
··· 1 + /* 2 + * This header provides constants for binding nvidia,tegra124-car or 3 + * nvidia,tegra132-car. 4 + * 5 + * The first 192 clocks are numbered to match the bits in the CAR's CLK_OUT_ENB 6 + * registers. These IDs often match those in the CAR's RST_DEVICES registers, 7 + * but not in all cases. Some bits in CLK_OUT_ENB affect multiple clocks. In 8 + * this case, those clocks are assigned IDs above 185 in order to highlight 9 + * this issue. Implementations that interpret these clock IDs as bit values 10 + * within the CLK_OUT_ENB or RST_DEVICES registers should be careful to 11 + * explicitly handle these special cases. 12 + * 13 + * The balance of the clocks controlled by the CAR are assigned IDs of 185 and 14 + * above. 15 + */ 16 + 17 + #ifndef _DT_BINDINGS_CLOCK_TEGRA124_CAR_COMMON_H 18 + #define _DT_BINDINGS_CLOCK_TEGRA124_CAR_COMMON_H 19 + 20 + /* 0 */ 21 + /* 1 */ 22 + /* 2 */ 23 + #define TEGRA124_CLK_ISPB 3 24 + #define TEGRA124_CLK_RTC 4 25 + #define TEGRA124_CLK_TIMER 5 26 + #define TEGRA124_CLK_UARTA 6 27 + /* 7 (register bit affects uartb and vfir) */ 28 + /* 8 */ 29 + #define TEGRA124_CLK_SDMMC2 9 30 + /* 10 (register bit affects spdif_in and spdif_out) */ 31 + #define TEGRA124_CLK_I2S1 11 32 + #define TEGRA124_CLK_I2C1 12 33 + /* 13 */ 34 + #define TEGRA124_CLK_SDMMC1 14 35 + #define TEGRA124_CLK_SDMMC4 15 36 + /* 16 */ 37 + #define TEGRA124_CLK_PWM 17 38 + #define TEGRA124_CLK_I2S2 18 39 + /* 20 (register bit affects vi and vi_sensor) */ 40 + /* 21 */ 41 + #define TEGRA124_CLK_USBD 22 42 + #define TEGRA124_CLK_ISP 23 43 + /* 26 */ 44 + /* 25 */ 45 + #define TEGRA124_CLK_DISP2 26 46 + #define TEGRA124_CLK_DISP1 27 47 + #define TEGRA124_CLK_HOST1X 28 48 + #define TEGRA124_CLK_VCP 29 49 + #define TEGRA124_CLK_I2S0 30 50 + /* 31 */ 51 + 52 + #define TEGRA124_CLK_MC 32 53 + /* 33 */ 54 + #define TEGRA124_CLK_APBDMA 34 55 + /* 35 */ 56 + #define TEGRA124_CLK_KBC 36 57 + /* 37 */ 58 + /* 38 */ 59 + /* 39 (register bit affects fuse and fuse_burn) */ 60 + #define TEGRA124_CLK_KFUSE 40 61 + #define TEGRA124_CLK_SBC1 41 62 + #define TEGRA124_CLK_NOR 42 63 + /* 43 */ 64 + #define TEGRA124_CLK_SBC2 44 65 + /* 45 */ 66 + #define TEGRA124_CLK_SBC3 46 67 + #define TEGRA124_CLK_I2C5 47 68 + #define TEGRA124_CLK_DSIA 48 69 + /* 49 */ 70 + #define TEGRA124_CLK_MIPI 50 71 + #define TEGRA124_CLK_HDMI 51 72 + #define TEGRA124_CLK_CSI 52 73 + /* 53 */ 74 + #define TEGRA124_CLK_I2C2 54 75 + #define TEGRA124_CLK_UARTC 55 76 + #define TEGRA124_CLK_MIPI_CAL 56 77 + #define TEGRA124_CLK_EMC 57 78 + #define TEGRA124_CLK_USB2 58 79 + #define TEGRA124_CLK_USB3 59 80 + /* 60 */ 81 + #define TEGRA124_CLK_VDE 61 82 + #define TEGRA124_CLK_BSEA 62 83 + #define TEGRA124_CLK_BSEV 63 84 + 85 + /* 64 */ 86 + #define TEGRA124_CLK_UARTD 65 87 + /* 66 */ 88 + #define TEGRA124_CLK_I2C3 67 89 + #define TEGRA124_CLK_SBC4 68 90 + #define TEGRA124_CLK_SDMMC3 69 91 + #define TEGRA124_CLK_PCIE 70 92 + #define TEGRA124_CLK_OWR 71 93 + #define TEGRA124_CLK_AFI 72 94 + #define TEGRA124_CLK_CSITE 73 95 + /* 74 */ 96 + /* 75 */ 97 + #define TEGRA124_CLK_LA 76 98 + #define TEGRA124_CLK_TRACE 77 99 + #define TEGRA124_CLK_SOC_THERM 78 100 + #define TEGRA124_CLK_DTV 79 101 + /* 80 */ 102 + #define TEGRA124_CLK_I2CSLOW 81 103 + #define TEGRA124_CLK_DSIB 82 104 + #define TEGRA124_CLK_TSEC 83 105 + /* 84 */ 106 + /* 85 */ 107 + /* 86 */ 108 + /* 87 */ 109 + /* 88 */ 110 + #define TEGRA124_CLK_XUSB_HOST 89 111 + /* 90 */ 112 + #define TEGRA124_CLK_MSENC 91 113 + #define TEGRA124_CLK_CSUS 92 114 + /* 93 */ 115 + /* 94 */ 116 + /* 95 (bit affects xusb_dev and xusb_dev_src) */ 117 + 118 + /* 96 */ 119 + /* 97 */ 120 + /* 98 */ 121 + #define TEGRA124_CLK_MSELECT 99 122 + #define TEGRA124_CLK_TSENSOR 100 123 + #define TEGRA124_CLK_I2S3 101 124 + #define TEGRA124_CLK_I2S4 102 125 + #define TEGRA124_CLK_I2C4 103 126 + #define TEGRA124_CLK_SBC5 104 127 + #define TEGRA124_CLK_SBC6 105 128 + #define TEGRA124_CLK_D_AUDIO 106 129 + #define TEGRA124_CLK_APBIF 107 130 + #define TEGRA124_CLK_DAM0 108 131 + #define TEGRA124_CLK_DAM1 109 132 + #define TEGRA124_CLK_DAM2 110 133 + #define TEGRA124_CLK_HDA2CODEC_2X 111 134 + /* 112 */ 135 + #define TEGRA124_CLK_AUDIO0_2X 113 136 + #define TEGRA124_CLK_AUDIO1_2X 114 137 + #define TEGRA124_CLK_AUDIO2_2X 115 138 + #define TEGRA124_CLK_AUDIO3_2X 116 139 + #define TEGRA124_CLK_AUDIO4_2X 117 140 + #define TEGRA124_CLK_SPDIF_2X 118 141 + #define TEGRA124_CLK_ACTMON 119 142 + #define TEGRA124_CLK_EXTERN1 120 143 + #define TEGRA124_CLK_EXTERN2 121 144 + #define TEGRA124_CLK_EXTERN3 122 145 + #define TEGRA124_CLK_SATA_OOB 123 146 + #define TEGRA124_CLK_SATA 124 147 + #define TEGRA124_CLK_HDA 125 148 + /* 126 */ 149 + #define TEGRA124_CLK_SE 127 150 + 151 + #define TEGRA124_CLK_HDA2HDMI 128 152 + #define TEGRA124_CLK_SATA_COLD 129 153 + /* 130 */ 154 + /* 131 */ 155 + /* 132 */ 156 + /* 133 */ 157 + /* 134 */ 158 + /* 135 */ 159 + /* 136 */ 160 + /* 137 */ 161 + /* 138 */ 162 + /* 139 */ 163 + /* 140 */ 164 + /* 141 */ 165 + /* 142 */ 166 + /* 143 (bit affects xusb_falcon_src, xusb_fs_src, */ 167 + /* xusb_host_src and xusb_ss_src) */ 168 + #define TEGRA124_CLK_CILAB 144 169 + #define TEGRA124_CLK_CILCD 145 170 + #define TEGRA124_CLK_CILE 146 171 + #define TEGRA124_CLK_DSIALP 147 172 + #define TEGRA124_CLK_DSIBLP 148 173 + #define TEGRA124_CLK_ENTROPY 149 174 + #define TEGRA124_CLK_DDS 150 175 + /* 151 */ 176 + #define TEGRA124_CLK_DP2 152 177 + #define TEGRA124_CLK_AMX 153 178 + #define TEGRA124_CLK_ADX 154 179 + /* 155 (bit affects dfll_ref and dfll_soc) */ 180 + #define TEGRA124_CLK_XUSB_SS 156 181 + /* 157 */ 182 + /* 158 */ 183 + /* 159 */ 184 + 185 + /* 160 */ 186 + /* 161 */ 187 + /* 162 */ 188 + /* 163 */ 189 + /* 164 */ 190 + /* 165 */ 191 + #define TEGRA124_CLK_I2C6 166 192 + /* 167 */ 193 + /* 168 */ 194 + /* 169 */ 195 + /* 170 */ 196 + #define TEGRA124_CLK_VIM2_CLK 171 197 + /* 172 */ 198 + /* 173 */ 199 + /* 174 */ 200 + /* 175 */ 201 + #define TEGRA124_CLK_HDMI_AUDIO 176 202 + #define TEGRA124_CLK_CLK72MHZ 177 203 + #define TEGRA124_CLK_VIC03 178 204 + /* 179 */ 205 + #define TEGRA124_CLK_ADX1 180 206 + #define TEGRA124_CLK_DPAUX 181 207 + #define TEGRA124_CLK_SOR0 182 208 + /* 183 */ 209 + #define TEGRA124_CLK_GPU 184 210 + #define TEGRA124_CLK_AMX1 185 211 + /* 186 */ 212 + /* 187 */ 213 + /* 188 */ 214 + /* 189 */ 215 + /* 190 */ 216 + /* 191 */ 217 + #define TEGRA124_CLK_UARTB 192 218 + #define TEGRA124_CLK_VFIR 193 219 + #define TEGRA124_CLK_SPDIF_IN 194 220 + #define TEGRA124_CLK_SPDIF_OUT 195 221 + #define TEGRA124_CLK_VI 196 222 + #define TEGRA124_CLK_VI_SENSOR 197 223 + #define TEGRA124_CLK_FUSE 198 224 + #define TEGRA124_CLK_FUSE_BURN 199 225 + #define TEGRA124_CLK_CLK_32K 200 226 + #define TEGRA124_CLK_CLK_M 201 227 + #define TEGRA124_CLK_CLK_M_DIV2 202 228 + #define TEGRA124_CLK_CLK_M_DIV4 203 229 + #define TEGRA124_CLK_PLL_REF 204 230 + #define TEGRA124_CLK_PLL_C 205 231 + #define TEGRA124_CLK_PLL_C_OUT1 206 232 + #define TEGRA124_CLK_PLL_C2 207 233 + #define TEGRA124_CLK_PLL_C3 208 234 + #define TEGRA124_CLK_PLL_M 209 235 + #define TEGRA124_CLK_PLL_M_OUT1 210 236 + #define TEGRA124_CLK_PLL_P 211 237 + #define TEGRA124_CLK_PLL_P_OUT1 212 238 + #define TEGRA124_CLK_PLL_P_OUT2 213 239 + #define TEGRA124_CLK_PLL_P_OUT3 214 240 + #define TEGRA124_CLK_PLL_P_OUT4 215 241 + #define TEGRA124_CLK_PLL_A 216 242 + #define TEGRA124_CLK_PLL_A_OUT0 217 243 + #define TEGRA124_CLK_PLL_D 218 244 + #define TEGRA124_CLK_PLL_D_OUT0 219 245 + #define TEGRA124_CLK_PLL_D2 220 246 + #define TEGRA124_CLK_PLL_D2_OUT0 221 247 + #define TEGRA124_CLK_PLL_U 222 248 + #define TEGRA124_CLK_PLL_U_480M 223 249 + 250 + #define TEGRA124_CLK_PLL_U_60M 224 251 + #define TEGRA124_CLK_PLL_U_48M 225 252 + #define TEGRA124_CLK_PLL_U_12M 226 253 + /* 227 */ 254 + /* 228 */ 255 + #define TEGRA124_CLK_PLL_RE_VCO 229 256 + #define TEGRA124_CLK_PLL_RE_OUT 230 257 + #define TEGRA124_CLK_PLL_E 231 258 + #define TEGRA124_CLK_SPDIF_IN_SYNC 232 259 + #define TEGRA124_CLK_I2S0_SYNC 233 260 + #define TEGRA124_CLK_I2S1_SYNC 234 261 + #define TEGRA124_CLK_I2S2_SYNC 235 262 + #define TEGRA124_CLK_I2S3_SYNC 236 263 + #define TEGRA124_CLK_I2S4_SYNC 237 264 + #define TEGRA124_CLK_VIMCLK_SYNC 238 265 + #define TEGRA124_CLK_AUDIO0 239 266 + #define TEGRA124_CLK_AUDIO1 240 267 + #define TEGRA124_CLK_AUDIO2 241 268 + #define TEGRA124_CLK_AUDIO3 242 269 + #define TEGRA124_CLK_AUDIO4 243 270 + #define TEGRA124_CLK_SPDIF 244 271 + #define TEGRA124_CLK_CLK_OUT_1 245 272 + #define TEGRA124_CLK_CLK_OUT_2 246 273 + #define TEGRA124_CLK_CLK_OUT_3 247 274 + #define TEGRA124_CLK_BLINK 248 275 + /* 249 */ 276 + /* 250 */ 277 + /* 251 */ 278 + #define TEGRA124_CLK_XUSB_HOST_SRC 252 279 + #define TEGRA124_CLK_XUSB_FALCON_SRC 253 280 + #define TEGRA124_CLK_XUSB_FS_SRC 254 281 + #define TEGRA124_CLK_XUSB_SS_SRC 255 282 + 283 + #define TEGRA124_CLK_XUSB_DEV_SRC 256 284 + #define TEGRA124_CLK_XUSB_DEV 257 285 + #define TEGRA124_CLK_XUSB_HS_SRC 258 286 + #define TEGRA124_CLK_SCLK 259 287 + #define TEGRA124_CLK_HCLK 260 288 + #define TEGRA124_CLK_PCLK 261 289 + /* 262 */ 290 + /* 263 */ 291 + #define TEGRA124_CLK_DFLL_REF 264 292 + #define TEGRA124_CLK_DFLL_SOC 265 293 + #define TEGRA124_CLK_VI_SENSOR2 266 294 + #define TEGRA124_CLK_PLL_P_OUT5 267 295 + #define TEGRA124_CLK_CML0 268 296 + #define TEGRA124_CLK_CML1 269 297 + #define TEGRA124_CLK_PLL_C4 270 298 + #define TEGRA124_CLK_PLL_DP 271 299 + #define TEGRA124_CLK_PLL_E_MUX 272 300 + #define TEGRA124_CLK_PLLD_DSI 273 301 + /* 274 */ 302 + /* 275 */ 303 + /* 276 */ 304 + /* 277 */ 305 + /* 278 */ 306 + /* 279 */ 307 + /* 280 */ 308 + /* 281 */ 309 + /* 282 */ 310 + /* 283 */ 311 + /* 284 */ 312 + /* 285 */ 313 + /* 286 */ 314 + /* 287 */ 315 + 316 + /* 288 */ 317 + /* 289 */ 318 + /* 290 */ 319 + /* 291 */ 320 + /* 292 */ 321 + /* 293 */ 322 + /* 294 */ 323 + /* 295 */ 324 + /* 296 */ 325 + /* 297 */ 326 + /* 298 */ 327 + /* 299 */ 328 + #define TEGRA124_CLK_AUDIO0_MUX 300 329 + #define TEGRA124_CLK_AUDIO1_MUX 301 330 + #define TEGRA124_CLK_AUDIO2_MUX 302 331 + #define TEGRA124_CLK_AUDIO3_MUX 303 332 + #define TEGRA124_CLK_AUDIO4_MUX 304 333 + #define TEGRA124_CLK_SPDIF_MUX 305 334 + #define TEGRA124_CLK_CLK_OUT_1_MUX 306 335 + #define TEGRA124_CLK_CLK_OUT_2_MUX 307 336 + #define TEGRA124_CLK_CLK_OUT_3_MUX 308 337 + /* 309 */ 338 + /* 310 */ 339 + #define TEGRA124_CLK_SOR0_LVDS 311 340 + #define TEGRA124_CLK_XUSB_SS_DIV2 312 341 + 342 + #define TEGRA124_CLK_PLL_M_UD 313 343 + #define TEGRA124_CLK_PLL_C_UD 314 344 + 345 + #endif /* _DT_BINDINGS_CLOCK_TEGRA124_CAR_COMMON_H */
+9 -336
include/dt-bindings/clock/tegra124-car.h
··· 1 1 /* 2 - * This header provides constants for binding nvidia,tegra124-car. 3 - * 4 - * The first 192 clocks are numbered to match the bits in the CAR's CLK_OUT_ENB 5 - * registers. These IDs often match those in the CAR's RST_DEVICES registers, 6 - * but not in all cases. Some bits in CLK_OUT_ENB affect multiple clocks. In 7 - * this case, those clocks are assigned IDs above 185 in order to highlight 8 - * this issue. Implementations that interpret these clock IDs as bit values 9 - * within the CLK_OUT_ENB or RST_DEVICES registers should be careful to 10 - * explicitly handle these special cases. 11 - * 12 - * The balance of the clocks controlled by the CAR are assigned IDs of 185 and 13 - * above. 2 + * This header provides Tegra124-specific constants for binding 3 + * nvidia,tegra124-car. 14 4 */ 5 + 6 + #include <dt-bindings/clock/tegra124-car-common.h> 15 7 16 8 #ifndef _DT_BINDINGS_CLOCK_TEGRA124_CAR_H 17 9 #define _DT_BINDINGS_CLOCK_TEGRA124_CAR_H 18 10 19 - /* 0 */ 20 - /* 1 */ 21 - /* 2 */ 22 - #define TEGRA124_CLK_ISPB 3 23 - #define TEGRA124_CLK_RTC 4 24 - #define TEGRA124_CLK_TIMER 5 25 - #define TEGRA124_CLK_UARTA 6 26 - /* 7 (register bit affects uartb and vfir) */ 27 - /* 8 */ 28 - #define TEGRA124_CLK_SDMMC2 9 29 - /* 10 (register bit affects spdif_in and spdif_out) */ 30 - #define TEGRA124_CLK_I2S1 11 31 - #define TEGRA124_CLK_I2C1 12 32 - /* 13 */ 33 - #define TEGRA124_CLK_SDMMC1 14 34 - #define TEGRA124_CLK_SDMMC4 15 35 - /* 16 */ 36 - #define TEGRA124_CLK_PWM 17 37 - #define TEGRA124_CLK_I2S2 18 38 - /* 20 (register bit affects vi and vi_sensor) */ 39 - /* 21 */ 40 - #define TEGRA124_CLK_USBD 22 41 - #define TEGRA124_CLK_ISP 23 42 - /* 26 */ 43 - /* 25 */ 44 - #define TEGRA124_CLK_DISP2 26 45 - #define TEGRA124_CLK_DISP1 27 46 - #define TEGRA124_CLK_HOST1X 28 47 - #define TEGRA124_CLK_VCP 29 48 - #define TEGRA124_CLK_I2S0 30 49 - /* 31 */ 11 + #define TEGRA124_CLK_PLL_X 227 12 + #define TEGRA124_CLK_PLL_X_OUT0 228 50 13 51 - #define TEGRA124_CLK_MC 32 52 - /* 33 */ 53 - #define TEGRA124_CLK_APBDMA 34 54 - /* 35 */ 55 - #define TEGRA124_CLK_KBC 36 56 - /* 37 */ 57 - /* 38 */ 58 - /* 39 (register bit affects fuse and fuse_burn) */ 59 - #define TEGRA124_CLK_KFUSE 40 60 - #define TEGRA124_CLK_SBC1 41 61 - #define TEGRA124_CLK_NOR 42 62 - /* 43 */ 63 - #define TEGRA124_CLK_SBC2 44 64 - /* 45 */ 65 - #define TEGRA124_CLK_SBC3 46 66 - #define TEGRA124_CLK_I2C5 47 67 - #define TEGRA124_CLK_DSIA 48 68 - /* 49 */ 69 - #define TEGRA124_CLK_MIPI 50 70 - #define TEGRA124_CLK_HDMI 51 71 - #define TEGRA124_CLK_CSI 52 72 - /* 53 */ 73 - #define TEGRA124_CLK_I2C2 54 74 - #define TEGRA124_CLK_UARTC 55 75 - #define TEGRA124_CLK_MIPI_CAL 56 76 - #define TEGRA124_CLK_EMC 57 77 - #define TEGRA124_CLK_USB2 58 78 - #define TEGRA124_CLK_USB3 59 79 - /* 60 */ 80 - #define TEGRA124_CLK_VDE 61 81 - #define TEGRA124_CLK_BSEA 62 82 - #define TEGRA124_CLK_BSEV 63 14 + #define TEGRA124_CLK_CCLK_G 262 15 + #define TEGRA124_CLK_CCLK_LP 263 83 16 84 - /* 64 */ 85 - #define TEGRA124_CLK_UARTD 65 86 - /* 66 */ 87 - #define TEGRA124_CLK_I2C3 67 88 - #define TEGRA124_CLK_SBC4 68 89 - #define TEGRA124_CLK_SDMMC3 69 90 - #define TEGRA124_CLK_PCIE 70 91 - #define TEGRA124_CLK_OWR 71 92 - #define TEGRA124_CLK_AFI 72 93 - #define TEGRA124_CLK_CSITE 73 94 - /* 74 */ 95 - /* 75 */ 96 - #define TEGRA124_CLK_LA 76 97 - #define TEGRA124_CLK_TRACE 77 98 - #define TEGRA124_CLK_SOC_THERM 78 99 - #define TEGRA124_CLK_DTV 79 100 - /* 80 */ 101 - #define TEGRA124_CLK_I2CSLOW 81 102 - #define TEGRA124_CLK_DSIB 82 103 - #define TEGRA124_CLK_TSEC 83 104 - /* 84 */ 105 - /* 85 */ 106 - /* 86 */ 107 - /* 87 */ 108 - /* 88 */ 109 - #define TEGRA124_CLK_XUSB_HOST 89 110 - /* 90 */ 111 - #define TEGRA124_CLK_MSENC 91 112 - #define TEGRA124_CLK_CSUS 92 113 - /* 93 */ 114 - /* 94 */ 115 - /* 95 (bit affects xusb_dev and xusb_dev_src) */ 116 - 117 - /* 96 */ 118 - /* 97 */ 119 - /* 98 */ 120 - #define TEGRA124_CLK_MSELECT 99 121 - #define TEGRA124_CLK_TSENSOR 100 122 - #define TEGRA124_CLK_I2S3 101 123 - #define TEGRA124_CLK_I2S4 102 124 - #define TEGRA124_CLK_I2C4 103 125 - #define TEGRA124_CLK_SBC5 104 126 - #define TEGRA124_CLK_SBC6 105 127 - #define TEGRA124_CLK_D_AUDIO 106 128 - #define TEGRA124_CLK_APBIF 107 129 - #define TEGRA124_CLK_DAM0 108 130 - #define TEGRA124_CLK_DAM1 109 131 - #define TEGRA124_CLK_DAM2 110 132 - #define TEGRA124_CLK_HDA2CODEC_2X 111 133 - /* 112 */ 134 - #define TEGRA124_CLK_AUDIO0_2X 113 135 - #define TEGRA124_CLK_AUDIO1_2X 114 136 - #define TEGRA124_CLK_AUDIO2_2X 115 137 - #define TEGRA124_CLK_AUDIO3_2X 116 138 - #define TEGRA124_CLK_AUDIO4_2X 117 139 - #define TEGRA124_CLK_SPDIF_2X 118 140 - #define TEGRA124_CLK_ACTMON 119 141 - #define TEGRA124_CLK_EXTERN1 120 142 - #define TEGRA124_CLK_EXTERN2 121 143 - #define TEGRA124_CLK_EXTERN3 122 144 - #define TEGRA124_CLK_SATA_OOB 123 145 - #define TEGRA124_CLK_SATA 124 146 - #define TEGRA124_CLK_HDA 125 147 - /* 126 */ 148 - #define TEGRA124_CLK_SE 127 149 - 150 - #define TEGRA124_CLK_HDA2HDMI 128 151 - #define TEGRA124_CLK_SATA_COLD 129 152 - /* 130 */ 153 - /* 131 */ 154 - /* 132 */ 155 - /* 133 */ 156 - /* 134 */ 157 - /* 135 */ 158 - /* 136 */ 159 - /* 137 */ 160 - /* 138 */ 161 - /* 139 */ 162 - /* 140 */ 163 - /* 141 */ 164 - /* 142 */ 165 - /* 143 (bit affects xusb_falcon_src, xusb_fs_src, */ 166 - /* xusb_host_src and xusb_ss_src) */ 167 - #define TEGRA124_CLK_CILAB 144 168 - #define TEGRA124_CLK_CILCD 145 169 - #define TEGRA124_CLK_CILE 146 170 - #define TEGRA124_CLK_DSIALP 147 171 - #define TEGRA124_CLK_DSIBLP 148 172 - #define TEGRA124_CLK_ENTROPY 149 173 - #define TEGRA124_CLK_DDS 150 174 - /* 151 */ 175 - #define TEGRA124_CLK_DP2 152 176 - #define TEGRA124_CLK_AMX 153 177 - #define TEGRA124_CLK_ADX 154 178 - /* 155 (bit affects dfll_ref and dfll_soc) */ 179 - #define TEGRA124_CLK_XUSB_SS 156 180 - /* 157 */ 181 - /* 158 */ 182 - /* 159 */ 183 - 184 - /* 160 */ 185 - /* 161 */ 186 - /* 162 */ 187 - /* 163 */ 188 - /* 164 */ 189 - /* 165 */ 190 - #define TEGRA124_CLK_I2C6 166 191 - /* 167 */ 192 - /* 168 */ 193 - /* 169 */ 194 - /* 170 */ 195 - #define TEGRA124_CLK_VIM2_CLK 171 196 - /* 172 */ 197 - /* 173 */ 198 - /* 174 */ 199 - /* 175 */ 200 - #define TEGRA124_CLK_HDMI_AUDIO 176 201 - #define TEGRA124_CLK_CLK72MHZ 177 202 - #define TEGRA124_CLK_VIC03 178 203 - /* 179 */ 204 - #define TEGRA124_CLK_ADX1 180 205 - #define TEGRA124_CLK_DPAUX 181 206 - #define TEGRA124_CLK_SOR0 182 207 - /* 183 */ 208 - #define TEGRA124_CLK_GPU 184 209 - #define TEGRA124_CLK_AMX1 185 210 - /* 186 */ 211 - /* 187 */ 212 - /* 188 */ 213 - /* 189 */ 214 - /* 190 */ 215 - /* 191 */ 216 - #define TEGRA124_CLK_UARTB 192 217 - #define TEGRA124_CLK_VFIR 193 218 - #define TEGRA124_CLK_SPDIF_IN 194 219 - #define TEGRA124_CLK_SPDIF_OUT 195 220 - #define TEGRA124_CLK_VI 196 221 - #define TEGRA124_CLK_VI_SENSOR 197 222 - #define TEGRA124_CLK_FUSE 198 223 - #define TEGRA124_CLK_FUSE_BURN 199 224 - #define TEGRA124_CLK_CLK_32K 200 225 - #define TEGRA124_CLK_CLK_M 201 226 - #define TEGRA124_CLK_CLK_M_DIV2 202 227 - #define TEGRA124_CLK_CLK_M_DIV4 203 228 - #define TEGRA124_CLK_PLL_REF 204 229 - #define TEGRA124_CLK_PLL_C 205 230 - #define TEGRA124_CLK_PLL_C_OUT1 206 231 - #define TEGRA124_CLK_PLL_C2 207 232 - #define TEGRA124_CLK_PLL_C3 208 233 - #define TEGRA124_CLK_PLL_M 209 234 - #define TEGRA124_CLK_PLL_M_OUT1 210 235 - #define TEGRA124_CLK_PLL_P 211 236 - #define TEGRA124_CLK_PLL_P_OUT1 212 237 - #define TEGRA124_CLK_PLL_P_OUT2 213 238 - #define TEGRA124_CLK_PLL_P_OUT3 214 239 - #define TEGRA124_CLK_PLL_P_OUT4 215 240 - #define TEGRA124_CLK_PLL_A 216 241 - #define TEGRA124_CLK_PLL_A_OUT0 217 242 - #define TEGRA124_CLK_PLL_D 218 243 - #define TEGRA124_CLK_PLL_D_OUT0 219 244 - #define TEGRA124_CLK_PLL_D2 220 245 - #define TEGRA124_CLK_PLL_D2_OUT0 221 246 - #define TEGRA124_CLK_PLL_U 222 247 - #define TEGRA124_CLK_PLL_U_480M 223 248 - 249 - #define TEGRA124_CLK_PLL_U_60M 224 250 - #define TEGRA124_CLK_PLL_U_48M 225 251 - #define TEGRA124_CLK_PLL_U_12M 226 252 - #define TEGRA124_CLK_PLL_X 227 253 - #define TEGRA124_CLK_PLL_X_OUT0 228 254 - #define TEGRA124_CLK_PLL_RE_VCO 229 255 - #define TEGRA124_CLK_PLL_RE_OUT 230 256 - #define TEGRA124_CLK_PLL_E 231 257 - #define TEGRA124_CLK_SPDIF_IN_SYNC 232 258 - #define TEGRA124_CLK_I2S0_SYNC 233 259 - #define TEGRA124_CLK_I2S1_SYNC 234 260 - #define TEGRA124_CLK_I2S2_SYNC 235 261 - #define TEGRA124_CLK_I2S3_SYNC 236 262 - #define TEGRA124_CLK_I2S4_SYNC 237 263 - #define TEGRA124_CLK_VIMCLK_SYNC 238 264 - #define TEGRA124_CLK_AUDIO0 239 265 - #define TEGRA124_CLK_AUDIO1 240 266 - #define TEGRA124_CLK_AUDIO2 241 267 - #define TEGRA124_CLK_AUDIO3 242 268 - #define TEGRA124_CLK_AUDIO4 243 269 - #define TEGRA124_CLK_SPDIF 244 270 - #define TEGRA124_CLK_CLK_OUT_1 245 271 - #define TEGRA124_CLK_CLK_OUT_2 246 272 - #define TEGRA124_CLK_CLK_OUT_3 247 273 - #define TEGRA124_CLK_BLINK 248 274 - /* 249 */ 275 - /* 250 */ 276 - /* 251 */ 277 - #define TEGRA124_CLK_XUSB_HOST_SRC 252 278 - #define TEGRA124_CLK_XUSB_FALCON_SRC 253 279 - #define TEGRA124_CLK_XUSB_FS_SRC 254 280 - #define TEGRA124_CLK_XUSB_SS_SRC 255 281 - 282 - #define TEGRA124_CLK_XUSB_DEV_SRC 256 283 - #define TEGRA124_CLK_XUSB_DEV 257 284 - #define TEGRA124_CLK_XUSB_HS_SRC 258 285 - #define TEGRA124_CLK_SCLK 259 286 - #define TEGRA124_CLK_HCLK 260 287 - #define TEGRA124_CLK_PCLK 261 288 - #define TEGRA124_CLK_CCLK_G 262 289 - #define TEGRA124_CLK_CCLK_LP 263 290 - #define TEGRA124_CLK_DFLL_REF 264 291 - #define TEGRA124_CLK_DFLL_SOC 265 292 - #define TEGRA124_CLK_VI_SENSOR2 266 293 - #define TEGRA124_CLK_PLL_P_OUT5 267 294 - #define TEGRA124_CLK_CML0 268 295 - #define TEGRA124_CLK_CML1 269 296 - #define TEGRA124_CLK_PLL_C4 270 297 - #define TEGRA124_CLK_PLL_DP 271 298 - #define TEGRA124_CLK_PLL_E_MUX 272 299 - /* 273 */ 300 - /* 274 */ 301 - /* 275 */ 302 - /* 276 */ 303 - /* 277 */ 304 - /* 278 */ 305 - /* 279 */ 306 - /* 280 */ 307 - /* 281 */ 308 - /* 282 */ 309 - /* 283 */ 310 - /* 284 */ 311 - /* 285 */ 312 - /* 286 */ 313 - /* 287 */ 314 - 315 - /* 288 */ 316 - /* 289 */ 317 - /* 290 */ 318 - /* 291 */ 319 - /* 292 */ 320 - /* 293 */ 321 - /* 294 */ 322 - /* 295 */ 323 - /* 296 */ 324 - /* 297 */ 325 - /* 298 */ 326 - /* 299 */ 327 - #define TEGRA124_CLK_AUDIO0_MUX 300 328 - #define TEGRA124_CLK_AUDIO1_MUX 301 329 - #define TEGRA124_CLK_AUDIO2_MUX 302 330 - #define TEGRA124_CLK_AUDIO3_MUX 303 331 - #define TEGRA124_CLK_AUDIO4_MUX 304 332 - #define TEGRA124_CLK_SPDIF_MUX 305 333 - #define TEGRA124_CLK_CLK_OUT_1_MUX 306 334 - #define TEGRA124_CLK_CLK_OUT_2_MUX 307 335 - #define TEGRA124_CLK_CLK_OUT_3_MUX 308 336 - #define TEGRA124_CLK_DSIA_MUX 309 337 - #define TEGRA124_CLK_DSIB_MUX 310 338 - #define TEGRA124_CLK_SOR0_LVDS 311 339 - #define TEGRA124_CLK_XUSB_SS_DIV2 312 340 - 341 - #define TEGRA124_CLK_PLL_M_UD 313 342 - #define TEGRA124_CLK_PLL_C_UD 314 343 - 344 - #define TEGRA124_CLK_CLK_MAX 315 17 + #define TEGRA124_CLK_CLK_MAX 315 345 18 346 19 #endif /* _DT_BINDINGS_CLOCK_TEGRA124_CAR_H */
-220
include/linux/clk-private.h
··· 1 - /* 2 - * linux/include/linux/clk-private.h 3 - * 4 - * Copyright (c) 2010-2011 Jeremy Kerr <jeremy.kerr@canonical.com> 5 - * Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org> 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License version 2 as 9 - * published by the Free Software Foundation. 10 - */ 11 - #ifndef __LINUX_CLK_PRIVATE_H 12 - #define __LINUX_CLK_PRIVATE_H 13 - 14 - #include <linux/clk-provider.h> 15 - #include <linux/kref.h> 16 - #include <linux/list.h> 17 - 18 - /* 19 - * WARNING: Do not include clk-private.h from any file that implements struct 20 - * clk_ops. Doing so is a layering violation! 21 - * 22 - * This header exists only to allow for statically initialized clock data. Any 23 - * static clock data must be defined in a separate file from the logic that 24 - * implements the clock operations for that same data. 25 - */ 26 - 27 - #ifdef CONFIG_COMMON_CLK 28 - 29 - struct module; 30 - 31 - struct clk { 32 - const char *name; 33 - const struct clk_ops *ops; 34 - struct clk_hw *hw; 35 - struct module *owner; 36 - struct clk *parent; 37 - const char **parent_names; 38 - struct clk **parents; 39 - u8 num_parents; 40 - u8 new_parent_index; 41 - unsigned long rate; 42 - unsigned long new_rate; 43 - struct clk *new_parent; 44 - struct clk *new_child; 45 - unsigned long flags; 46 - unsigned int enable_count; 47 - unsigned int prepare_count; 48 - unsigned long accuracy; 49 - int phase; 50 - struct hlist_head children; 51 - struct hlist_node child_node; 52 - struct hlist_node debug_node; 53 - unsigned int notifier_count; 54 - #ifdef CONFIG_DEBUG_FS 55 - struct dentry *dentry; 56 - #endif 57 - struct kref ref; 58 - }; 59 - 60 - /* 61 - * DOC: Basic clock implementations common to many platforms 62 - * 63 - * Each basic clock hardware type is comprised of a structure describing the 64 - * clock hardware, implementations of the relevant callbacks in struct clk_ops, 65 - * unique flags for that hardware type, a registration function and an 66 - * alternative macro for static initialization 67 - */ 68 - 69 - #define DEFINE_CLK(_name, _ops, _flags, _parent_names, \ 70 - _parents) \ 71 - static struct clk _name = { \ 72 - .name = #_name, \ 73 - .ops = &_ops, \ 74 - .hw = &_name##_hw.hw, \ 75 - .parent_names = _parent_names, \ 76 - .num_parents = ARRAY_SIZE(_parent_names), \ 77 - .parents = _parents, \ 78 - .flags = _flags | CLK_IS_BASIC, \ 79 - } 80 - 81 - #define DEFINE_CLK_FIXED_RATE(_name, _flags, _rate, \ 82 - _fixed_rate_flags) \ 83 - static struct clk _name; \ 84 - static const char *_name##_parent_names[] = {}; \ 85 - static struct clk_fixed_rate _name##_hw = { \ 86 - .hw = { \ 87 - .clk = &_name, \ 88 - }, \ 89 - .fixed_rate = _rate, \ 90 - .flags = _fixed_rate_flags, \ 91 - }; \ 92 - DEFINE_CLK(_name, clk_fixed_rate_ops, _flags, \ 93 - _name##_parent_names, NULL); 94 - 95 - #define DEFINE_CLK_GATE(_name, _parent_name, _parent_ptr, \ 96 - _flags, _reg, _bit_idx, \ 97 - _gate_flags, _lock) \ 98 - static struct clk _name; \ 99 - static const char *_name##_parent_names[] = { \ 100 - _parent_name, \ 101 - }; \ 102 - static struct clk *_name##_parents[] = { \ 103 - _parent_ptr, \ 104 - }; \ 105 - static struct clk_gate _name##_hw = { \ 106 - .hw = { \ 107 - .clk = &_name, \ 108 - }, \ 109 - .reg = _reg, \ 110 - .bit_idx = _bit_idx, \ 111 - .flags = _gate_flags, \ 112 - .lock = _lock, \ 113 - }; \ 114 - DEFINE_CLK(_name, clk_gate_ops, _flags, \ 115 - _name##_parent_names, _name##_parents); 116 - 117 - #define _DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \ 118 - _flags, _reg, _shift, _width, \ 119 - _divider_flags, _table, _lock) \ 120 - static struct clk _name; \ 121 - static const char *_name##_parent_names[] = { \ 122 - _parent_name, \ 123 - }; \ 124 - static struct clk *_name##_parents[] = { \ 125 - _parent_ptr, \ 126 - }; \ 127 - static struct clk_divider _name##_hw = { \ 128 - .hw = { \ 129 - .clk = &_name, \ 130 - }, \ 131 - .reg = _reg, \ 132 - .shift = _shift, \ 133 - .width = _width, \ 134 - .flags = _divider_flags, \ 135 - .table = _table, \ 136 - .lock = _lock, \ 137 - }; \ 138 - DEFINE_CLK(_name, clk_divider_ops, _flags, \ 139 - _name##_parent_names, _name##_parents); 140 - 141 - #define DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \ 142 - _flags, _reg, _shift, _width, \ 143 - _divider_flags, _lock) \ 144 - _DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \ 145 - _flags, _reg, _shift, _width, \ 146 - _divider_flags, NULL, _lock) 147 - 148 - #define DEFINE_CLK_DIVIDER_TABLE(_name, _parent_name, \ 149 - _parent_ptr, _flags, _reg, \ 150 - _shift, _width, _divider_flags, \ 151 - _table, _lock) \ 152 - _DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \ 153 - _flags, _reg, _shift, _width, \ 154 - _divider_flags, _table, _lock) \ 155 - 156 - #define DEFINE_CLK_MUX(_name, _parent_names, _parents, _flags, \ 157 - _reg, _shift, _width, \ 158 - _mux_flags, _lock) \ 159 - static struct clk _name; \ 160 - static struct clk_mux _name##_hw = { \ 161 - .hw = { \ 162 - .clk = &_name, \ 163 - }, \ 164 - .reg = _reg, \ 165 - .shift = _shift, \ 166 - .mask = BIT(_width) - 1, \ 167 - .flags = _mux_flags, \ 168 - .lock = _lock, \ 169 - }; \ 170 - DEFINE_CLK(_name, clk_mux_ops, _flags, _parent_names, \ 171 - _parents); 172 - 173 - #define DEFINE_CLK_FIXED_FACTOR(_name, _parent_name, \ 174 - _parent_ptr, _flags, \ 175 - _mult, _div) \ 176 - static struct clk _name; \ 177 - static const char *_name##_parent_names[] = { \ 178 - _parent_name, \ 179 - }; \ 180 - static struct clk *_name##_parents[] = { \ 181 - _parent_ptr, \ 182 - }; \ 183 - static struct clk_fixed_factor _name##_hw = { \ 184 - .hw = { \ 185 - .clk = &_name, \ 186 - }, \ 187 - .mult = _mult, \ 188 - .div = _div, \ 189 - }; \ 190 - DEFINE_CLK(_name, clk_fixed_factor_ops, _flags, \ 191 - _name##_parent_names, _name##_parents); 192 - 193 - /** 194 - * __clk_init - initialize the data structures in a struct clk 195 - * @dev: device initializing this clk, placeholder for now 196 - * @clk: clk being initialized 197 - * 198 - * Initializes the lists in struct clk, queries the hardware for the 199 - * parent and rate and sets them both. 200 - * 201 - * Any struct clk passed into __clk_init must have the following members 202 - * populated: 203 - * .name 204 - * .ops 205 - * .hw 206 - * .parent_names 207 - * .num_parents 208 - * .flags 209 - * 210 - * It is not necessary to call clk_register if __clk_init is used directly with 211 - * statically initialized clock data. 212 - * 213 - * Returns 0 on success, otherwise an error code. 214 - */ 215 - int __clk_init(struct device *dev, struct clk *clk); 216 - 217 - struct clk *__clk_register(struct device *dev, struct clk_hw *hw); 218 - 219 - #endif /* CONFIG_COMMON_CLK */ 220 - #endif /* CLK_PRIVATE_H */
+49 -9
include/linux/clk-provider.h
··· 33 33 #define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */ 34 34 35 35 struct clk_hw; 36 + struct clk_core; 36 37 struct dentry; 37 38 38 39 /** ··· 175 174 unsigned long parent_rate); 176 175 long (*round_rate)(struct clk_hw *hw, unsigned long rate, 177 176 unsigned long *parent_rate); 178 - long (*determine_rate)(struct clk_hw *hw, unsigned long rate, 179 - unsigned long *best_parent_rate, 180 - struct clk_hw **best_parent_hw); 177 + long (*determine_rate)(struct clk_hw *hw, 178 + unsigned long rate, 179 + unsigned long min_rate, 180 + unsigned long max_rate, 181 + unsigned long *best_parent_rate, 182 + struct clk_hw **best_parent_hw); 181 183 int (*set_parent)(struct clk_hw *hw, u8 index); 182 184 u8 (*get_parent)(struct clk_hw *hw); 183 185 int (*set_rate)(struct clk_hw *hw, unsigned long rate, ··· 220 216 * clk_foo and then referenced by the struct clk instance that uses struct 221 217 * clk_foo's clk_ops 222 218 * 223 - * @clk: pointer to the struct clk instance that points back to this struct 224 - * clk_hw instance 219 + * @core: pointer to the struct clk_core instance that points back to this 220 + * struct clk_hw instance 221 + * 222 + * @clk: pointer to the per-user struct clk instance that can be used to call 223 + * into the clk API 225 224 * 226 225 * @init: pointer to struct clk_init_data that contains the init data shared 227 226 * with the common clock framework. 228 227 */ 229 228 struct clk_hw { 229 + struct clk_core *core; 230 230 struct clk *clk; 231 231 const struct clk_init_data *init; 232 232 }; ··· 302 294 const char *parent_name, unsigned long flags, 303 295 void __iomem *reg, u8 bit_idx, 304 296 u8 clk_gate_flags, spinlock_t *lock); 297 + void clk_unregister_gate(struct clk *clk); 305 298 306 299 struct clk_div_table { 307 300 unsigned int val; ··· 361 352 #define CLK_DIVIDER_READ_ONLY BIT(5) 362 353 363 354 extern const struct clk_ops clk_divider_ops; 355 + 356 + unsigned long divider_recalc_rate(struct clk_hw *hw, unsigned long parent_rate, 357 + unsigned int val, const struct clk_div_table *table, 358 + unsigned long flags); 359 + long divider_round_rate(struct clk_hw *hw, unsigned long rate, 360 + unsigned long *prate, const struct clk_div_table *table, 361 + u8 width, unsigned long flags); 362 + int divider_get_val(unsigned long rate, unsigned long parent_rate, 363 + const struct clk_div_table *table, u8 width, 364 + unsigned long flags); 365 + 364 366 struct clk *clk_register_divider(struct device *dev, const char *name, 365 367 const char *parent_name, unsigned long flags, 366 368 void __iomem *reg, u8 shift, u8 width, ··· 381 361 void __iomem *reg, u8 shift, u8 width, 382 362 u8 clk_divider_flags, const struct clk_div_table *table, 383 363 spinlock_t *lock); 364 + void clk_unregister_divider(struct clk *clk); 384 365 385 366 /** 386 367 * struct clk_mux - multiplexer clock ··· 403 382 * register, and mask of mux bits are in higher 16-bit of this register. 404 383 * While setting the mux bits, higher 16-bit should also be updated to 405 384 * indicate changing mux bits. 385 + * CLK_MUX_ROUND_CLOSEST - Use the parent rate that is closest to the desired 386 + * frequency. 406 387 */ 407 388 struct clk_mux { 408 389 struct clk_hw hw; ··· 419 396 #define CLK_MUX_INDEX_ONE BIT(0) 420 397 #define CLK_MUX_INDEX_BIT BIT(1) 421 398 #define CLK_MUX_HIWORD_MASK BIT(2) 422 - #define CLK_MUX_READ_ONLY BIT(3) /* mux setting cannot be changed */ 399 + #define CLK_MUX_READ_ONLY BIT(3) /* mux can't be changed */ 400 + #define CLK_MUX_ROUND_CLOSEST BIT(4) 423 401 424 402 extern const struct clk_ops clk_mux_ops; 425 403 extern const struct clk_ops clk_mux_ro_ops; ··· 434 410 const char **parent_names, u8 num_parents, unsigned long flags, 435 411 void __iomem *reg, u8 shift, u32 mask, 436 412 u8 clk_mux_flags, u32 *table, spinlock_t *lock); 413 + 414 + void clk_unregister_mux(struct clk *clk); 437 415 438 416 void of_fixed_factor_clk_setup(struct device_node *node); 439 417 ··· 576 550 bool __clk_is_enabled(struct clk *clk); 577 551 struct clk *__clk_lookup(const char *name); 578 552 long __clk_mux_determine_rate(struct clk_hw *hw, unsigned long rate, 553 + unsigned long min_rate, 554 + unsigned long max_rate, 579 555 unsigned long *best_parent_rate, 580 556 struct clk_hw **best_parent_p); 557 + unsigned long __clk_determine_rate(struct clk_hw *core, 558 + unsigned long rate, 559 + unsigned long min_rate, 560 + unsigned long max_rate); 561 + long __clk_mux_determine_rate_closest(struct clk_hw *hw, unsigned long rate, 562 + unsigned long min_rate, 563 + unsigned long max_rate, 564 + unsigned long *best_parent_rate, 565 + struct clk_hw **best_parent_p); 566 + 567 + static inline void __clk_hw_set_clk(struct clk_hw *dst, struct clk_hw *src) 568 + { 569 + dst->clk = src->clk; 570 + dst->core = src->core; 571 + } 581 572 582 573 /* 583 574 * FIXME clock api without lock protection 584 575 */ 585 - int __clk_prepare(struct clk *clk); 586 - void __clk_unprepare(struct clk *clk); 587 - void __clk_reparent(struct clk *clk, struct clk *new_parent); 588 576 unsigned long __clk_round_rate(struct clk *clk, unsigned long rate); 589 577 590 578 struct of_device_id;
+45
include/linux/clk.h
··· 302 302 int clk_set_rate(struct clk *clk, unsigned long rate); 303 303 304 304 /** 305 + * clk_has_parent - check if a clock is a possible parent for another 306 + * @clk: clock source 307 + * @parent: parent clock source 308 + * 309 + * This function can be used in drivers that need to check that a clock can be 310 + * the parent of another without actually changing the parent. 311 + * 312 + * Returns true if @parent is a possible parent for @clk, false otherwise. 313 + */ 314 + bool clk_has_parent(struct clk *clk, struct clk *parent); 315 + 316 + /** 317 + * clk_set_rate_range - set a rate range for a clock source 318 + * @clk: clock source 319 + * @min: desired minimum clock rate in Hz, inclusive 320 + * @max: desired maximum clock rate in Hz, inclusive 321 + * 322 + * Returns success (0) or negative errno. 323 + */ 324 + int clk_set_rate_range(struct clk *clk, unsigned long min, unsigned long max); 325 + 326 + /** 327 + * clk_set_min_rate - set a minimum clock rate for a clock source 328 + * @clk: clock source 329 + * @rate: desired minimum clock rate in Hz, inclusive 330 + * 331 + * Returns success (0) or negative errno. 332 + */ 333 + int clk_set_min_rate(struct clk *clk, unsigned long rate); 334 + 335 + /** 336 + * clk_set_max_rate - set a maximum clock rate for a clock source 337 + * @clk: clock source 338 + * @rate: desired maximum clock rate in Hz, inclusive 339 + * 340 + * Returns success (0) or negative errno. 341 + */ 342 + int clk_set_max_rate(struct clk *clk, unsigned long rate); 343 + 344 + /** 305 345 * clk_set_parent - set the parent clock source for this clock 306 346 * @clk: clock source 307 347 * @parent: parent clock source ··· 412 372 static inline long clk_round_rate(struct clk *clk, unsigned long rate) 413 373 { 414 374 return 0; 375 + } 376 + 377 + static inline bool clk_has_parent(struct clk *clk, struct clk *parent) 378 + { 379 + return true; 415 380 } 416 381 417 382 static inline int clk_set_parent(struct clk *clk, struct clk *parent)
-22
include/linux/clk/sunxi.h
··· 1 - /* 2 - * Copyright 2013 - Hans de Goede <hdegoede@redhat.com> 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 __LINUX_CLK_SUNXI_H_ 16 - #define __LINUX_CLK_SUNXI_H_ 17 - 18 - #include <linux/clk.h> 19 - 20 - void clk_sunxi_mmc_phase_control(struct clk *clk, u8 sample, u8 output); 21 - 22 - #endif
-2
include/linux/clk/tegra.h
··· 120 120 } 121 121 #endif 122 122 123 - void tegra_clocks_apply_init_table(void); 124 - 125 123 #endif /* __LINUX_CLK_TEGRA_H_ */
+25
include/linux/clk/ti.h
··· 15 15 #ifndef __LINUX_CLK_TI_H__ 16 16 #define __LINUX_CLK_TI_H__ 17 17 18 + #include <linux/clk-provider.h> 18 19 #include <linux/clkdev.h> 19 20 20 21 /** ··· 218 217 /* Maximum number of clock memmaps */ 219 218 #define CLK_MAX_MEMMAPS 4 220 219 220 + /* Static memmap indices */ 221 + enum { 222 + TI_CLKM_CM = 0, 223 + TI_CLKM_PRM, 224 + TI_CLKM_SCRM, 225 + }; 226 + 221 227 typedef void (*ti_of_clk_init_cb_t)(struct clk_hw *, struct device_node *); 222 228 223 229 /** ··· 271 263 u8 index); 272 264 long omap3_noncore_dpll_determine_rate(struct clk_hw *hw, 273 265 unsigned long rate, 266 + unsigned long min_rate, 267 + unsigned long max_rate, 274 268 unsigned long *best_parent_rate, 275 269 struct clk_hw **best_parent_clk); 276 270 unsigned long omap4_dpll_regm4xen_recalc(struct clk_hw *hw, ··· 282 272 unsigned long *parent_rate); 283 273 long omap4_dpll_regm4xen_determine_rate(struct clk_hw *hw, 284 274 unsigned long rate, 275 + unsigned long min_rate, 276 + unsigned long max_rate, 285 277 unsigned long *best_parent_rate, 286 278 struct clk_hw **best_parent_clk); 287 279 u8 omap2_init_dpll_parent(struct clk_hw *hw); ··· 359 347 extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait; 360 348 extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_dss_usbhost_wait; 361 349 extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait; 350 + 351 + #ifdef CONFIG_ATAGS 352 + int omap3430_clk_legacy_init(void); 353 + int omap3430es1_clk_legacy_init(void); 354 + int omap36xx_clk_legacy_init(void); 355 + int am35xx_clk_legacy_init(void); 356 + #else 357 + static inline int omap3430_clk_legacy_init(void) { return -ENXIO; } 358 + static inline int omap3430es1_clk_legacy_init(void) { return -ENXIO; } 359 + static inline int omap36xx_clk_legacy_init(void) { return -ENXIO; } 360 + static inline int am35xx_clk_legacy_init(void) { return -ENXIO; } 361 + #endif 362 + 362 363 363 364 #endif