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

Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux

Pull clk updates from Stephen Boyd:
"This round of clk driver and framework updates is heavy on the driver
update side. The two main highlights in the core framework are the
addition of an bulk clk_get API that handles optional clks and an
extra debugfs file that tells the developer about the current parent
of a clk.

The driver updates are dominated by i.MX in the diffstat, but that is
mostly because that SoC has started converting to the clk_hw style of
clk registration. The next big update is in the Amlogic meson clk
driver that gained some support for audio, cpu, and temperature clks
while fixing some PLL issues. Finally, the biggest thing that stands
out is the conversion of a large part of the Allwinner sunxi-ng driver
to the new clk parent scheme that uses less strings and more pointer
comparisons to match clk parents and children up.

In general, it looks like we have a lot of little fixes and tweaks
here and there to clk data along with the normal addition of a handful
of new drivers and a couple new core framework features.

Core:
- Add a 'clk_parent' file in clk debugfs
- Add a clk_bulk_get_optional() API (with devm too)

New Drivers:
- Support gated clk controller on MIPS based BCM63XX SoCs
- Support SiLabs Si5341 and Si5340 chips
- Support for CPU clks on Raspberry Pi devices
- Audsys clock driver for MediaTek MT8516 SoCs

Updates:
- Convert a large portion of the Allwinner sunxi-ng driver to new clk parent scheme
- Small frequency support for SiLabs Si544 chips
- Slow clk support for AT91 SAM9X60 SoCs
- Remove dead code in various clk drivers (-Wunused)
- Support for Marvell 98DX1135 SoCs
- Get duty cycle of generic pwm clks
- Improvement in mmc phase calculation and cleanup of some rate defintions
- Switch i.MX6 and i.MX7 clock drivers to clk_hw based APIs
- Add GPIO, SNVS and GIC clocks for i.MX8 drivers
- Mark imx6sx/ul/ull/sll MMDC_P1_IPG and imx8mm DRAM_APB as critical clock
- Correct imx7ulp nic1_bus_clk and imx8mm audio_pll2_clk clock setting
- Add clks for new Exynos5422 Dynamic Memory Controller driver
- Clock definition for Exynos4412 Mali
- Add CMM (Color Management Module) clocks on Renesas R-Car H3, M3-N, E3, and D3
- Add TPU (Timer Pulse Unit / PWM) clocks on Renesas RZ/G2M
- Support for 32 bit clock IDs in TI's sci-clks for J721e SoCs
- TI clock probing done from DT by default instead of firmware
- Fix Amlogic Meson mpll fractional part and spread sprectrum issues
- Add Amlogic meson8 audio clocks
- Add Amlogic g12a temperature sensors clocks
- Add Amlogic g12a and g12b cpu clocks
- Add TPU (Timer Pulse Unit / PWM) clocks on Renesas R-Car H3, M3-W, and M3-N
- Add CMM (Color Management Module) clocks on Renesas R-Car M3-W
- Add Clock Domain support on Renesas RZ/N1"

* tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: (190 commits)
clk: consoldiate the __clk_get_hw() declarations
clk: sprd: Add check for return value of sprd_clk_regmap_init()
clk: lochnagar: Update DT binding doc to include the primary SPDIF MCLK
clk: Add Si5341/Si5340 driver
dt-bindings: clock: Add silabs,si5341
clk: clk-si544: Implement small frequency change support
clk: add BCM63XX gated clock controller driver
devicetree: document the BCM63XX gated clock bindings
clk: at91: sckc: use dedicated functions to unregister clock
clk: at91: sckc: improve error path for sama5d4 sck registration
clk: at91: sckc: remove unnecessary line
clk: at91: sckc: improve error path for sam9x5 sck register
clk: at91: sckc: add support to free slow clock osclillator
clk: at91: sckc: add support to free slow rc oscillator
clk: at91: sckc: add support to free slow oscillator
clk: rockchip: export HDMIPHY clock on rk3228
clk: rockchip: add watchdog pclk on rk3328
clk: rockchip: add clock id for hdmi_phy special clock on rk3228
clk: rockchip: add clock id for watchdog pclk on rk3328
clk: at91: sckc: add support for SAM9X60
...

+7679 -3163
+1
Documentation/devicetree/bindings/arm/mediatek/mediatek,audsys.txt
··· 10 10 - "mediatek,mt7622-audsys", "syscon" 11 11 - "mediatek,mt7623-audsys", "mediatek,mt2701-audsys", "syscon" 12 12 - "mediatek,mt8183-audiosys", "syscon" 13 + - "mediatek,mt8516-audsys", "syscon" 13 14 - #clock-cells: Must be 1 14 15 15 16 The AUDSYS controller uses the common clk binding from
+141
Documentation/devicetree/bindings/clock/allwinner,sun4i-a10-ccu.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/phy/allwinner,sun4i-a10-ccu.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Allwinner Clock Control Unit Device Tree Bindings 8 + 9 + maintainers: 10 + - Chen-Yu Tsai <wens@csie.org> 11 + - Maxime Ripard <maxime.ripard@bootlin.com> 12 + 13 + properties: 14 + "#clock-cells": 15 + const: 1 16 + 17 + "#reset-cells": 18 + const: 1 19 + 20 + compatible: 21 + enum: 22 + - allwinner,sun4i-a10-ccu 23 + - allwinner,sun5i-a10s-ccu 24 + - allwinner,sun5i-a13-ccu 25 + - allwinner,sun6i-a31-ccu 26 + - allwinner,sun7i-a20-ccu 27 + - allwinner,sun8i-a23-ccu 28 + - allwinner,sun8i-a33-ccu 29 + - allwinner,sun8i-a83t-ccu 30 + - allwinner,sun8i-a83t-r-ccu 31 + - allwinner,sun8i-h3-ccu 32 + - allwinner,sun8i-h3-r-ccu 33 + - allwinner,sun8i-r40-ccu 34 + - allwinner,sun8i-v3s-ccu 35 + - allwinner,sun9i-a80-ccu 36 + - allwinner,sun50i-a64-ccu 37 + - allwinner,sun50i-a64-r-ccu 38 + - allwinner,sun50i-h5-ccu 39 + - allwinner,sun50i-h6-ccu 40 + - allwinner,sun50i-h6-r-ccu 41 + - allwinner,suniv-f1c100s-ccu 42 + - nextthing,gr8-ccu 43 + 44 + reg: 45 + maxItems: 1 46 + 47 + clocks: 48 + minItems: 2 49 + maxItems: 4 50 + items: 51 + - description: High Frequency Oscillator (usually at 24MHz) 52 + - description: Low Frequency Oscillator (usually at 32kHz) 53 + - description: Internal Oscillator 54 + - description: Peripherals PLL 55 + 56 + clock-names: 57 + minItems: 2 58 + maxItems: 4 59 + items: 60 + - const: hosc 61 + - const: losc 62 + - const: iosc 63 + - const: pll-periph 64 + 65 + required: 66 + - "#clock-cells" 67 + - "#reset-cells" 68 + - compatible 69 + - reg 70 + - clocks 71 + - clock-names 72 + 73 + if: 74 + properties: 75 + compatible: 76 + enum: 77 + - allwinner,sun8i-a83t-r-ccu 78 + - allwinner,sun8i-h3-r-ccu 79 + - allwinner,sun50i-a64-r-ccu 80 + - allwinner,sun50i-h6-r-ccu 81 + 82 + then: 83 + properties: 84 + clocks: 85 + minItems: 4 86 + maxItems: 4 87 + 88 + clock-names: 89 + minItems: 4 90 + maxItems: 4 91 + 92 + else: 93 + if: 94 + properties: 95 + compatible: 96 + const: allwinner,sun50i-h6-ccu 97 + 98 + then: 99 + properties: 100 + clocks: 101 + minItems: 3 102 + maxItems: 3 103 + 104 + clock-names: 105 + minItems: 3 106 + maxItems: 3 107 + 108 + else: 109 + properties: 110 + clocks: 111 + minItems: 2 112 + maxItems: 2 113 + 114 + clock-names: 115 + minItems: 2 116 + maxItems: 2 117 + 118 + additionalProperties: false 119 + 120 + examples: 121 + - | 122 + ccu: clock@1c20000 { 123 + compatible = "allwinner,sun8i-h3-ccu"; 124 + reg = <0x01c20000 0x400>; 125 + clocks = <&osc24M>, <&osc32k>; 126 + clock-names = "hosc", "losc"; 127 + #clock-cells = <1>; 128 + #reset-cells = <1>; 129 + }; 130 + 131 + - | 132 + r_ccu: clock@1f01400 { 133 + compatible = "allwinner,sun50i-a64-r-ccu"; 134 + reg = <0x01f01400 0x100>; 135 + clocks = <&osc24M>, <&osc32k>, <&iosc>, <&ccu 11>; 136 + clock-names = "hosc", "losc", "iosc", "pll-periph"; 137 + #clock-cells = <1>; 138 + #reset-cells = <1>; 139 + }; 140 + 141 + ...
+1
Documentation/devicetree/bindings/clock/amlogic,gxbb-clkc.txt
··· 10 10 "amlogic,gxl-clkc" for GXL and GXM SoC, 11 11 "amlogic,axg-clkc" for AXG SoC. 12 12 "amlogic,g12a-clkc" for G12A SoC. 13 + "amlogic,g12b-clkc" for G12B SoC. 13 14 - clocks : list of clock phandle, one for each entry clock-names. 14 15 - clock-names : should contain the following: 15 16 * "xtal": the platform xtal
+4 -3
Documentation/devicetree/bindings/clock/at91-clock.txt
··· 9 9 Required properties: 10 10 - compatible : shall be one of the following: 11 11 "atmel,at91sam9x5-sckc", 12 - "atmel,sama5d3-sckc" or 13 - "atmel,sama5d4-sckc": 12 + "atmel,sama5d3-sckc", 13 + "atmel,sama5d4-sckc" or 14 + "microchip,sam9x60-sckc": 14 15 at91 SCKC (Slow Clock Controller) 15 - - #clock-cells : shall be 0. 16 + - #clock-cells : shall be 1 for "microchip,sam9x60-sckc" otherwise shall be 0. 16 17 - clocks : shall be the input parent clock phandle for the clock. 17 18 18 19 Optional properties:
+22
Documentation/devicetree/bindings/clock/brcm,bcm63xx-clocks.txt
··· 1 + Gated Clock Controller Bindings for MIPS based BCM63XX SoCs 2 + 3 + Required properties: 4 + - compatible: must be one of: 5 + "brcm,bcm3368-clocks" 6 + "brcm,bcm6328-clocks" 7 + "brcm,bcm6358-clocks" 8 + "brcm,bcm6362-clocks" 9 + "brcm,bcm6368-clocks" 10 + "brcm,bcm63268-clocks" 11 + 12 + - reg: Address and length of the register set 13 + - #clock-cells: must be <1> 14 + 15 + 16 + Example: 17 + 18 + clkctl: clock-controller@10000004 { 19 + compatible = "brcm,bcm6328-clocks"; 20 + reg = <0x10000004 0x4>; 21 + #clock-cells = <1>; 22 + };
+1
Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt
··· 40 40 input audio clocks from host system. 41 41 - ln-psia1-mclk, ln-psia2-mclk : Optional input audio clocks from 42 42 external connector. 43 + - ln-spdif-mclk : Optional input audio clock from SPDIF. 43 44 - ln-spdif-clkout : Optional input audio clock from SPDIF. 44 45 - ln-adat-mclk : Optional input audio clock from ADAT. 45 46 - ln-pmic-32k : On board fixed clock.
+1
Documentation/devicetree/bindings/clock/mvebu-core-clock.txt
··· 59 59 "marvell,dove-core-clock" - for Dove SoC core clocks 60 60 "marvell,kirkwood-core-clock" - for Kirkwood SoC (except mv88f6180) 61 61 "marvell,mv88f6180-core-clock" - for Kirkwood MV88f6180 SoC 62 + "marvell,mv98dx1135-core-clock" - for Kirkwood 98dx1135 SoC 62 63 "marvell,mv88f5181-core-clock" - for Orion MV88F5181 SoC 63 64 "marvell,mv88f5182-core-clock" - for Orion MV88F5182 SoC 64 65 "marvell,mv88f5281-core-clock" - for Orion MV88F5281 SoC
+3 -1
Documentation/devicetree/bindings/clock/qcom,gpucc.txt
··· 2 2 -------------------------------------------------- 3 3 4 4 Required properties : 5 - - compatible : shall contain "qcom,sdm845-gpucc" 5 + - compatible : shall contain "qcom,sdm845-gpucc" or "qcom,msm8998-gpucc" 6 6 - reg : shall contain base register location and length 7 7 - #clock-cells : from common clock binding, shall contain 1 8 8 - #reset-cells : from common reset binding, shall contain 1 9 9 - #power-domain-cells : from generic power domain binding, shall contain 1 10 10 - clocks : shall contain the XO clock 11 + shall contain the gpll0 out main clock (msm8998) 11 12 - clock-names : shall be "xo" 13 + shall be "gpll0" (msm8998) 12 14 13 15 Example: 14 16 gpucc: clock-controller@5090000 {
+5 -2
Documentation/devicetree/bindings/clock/renesas,r9a06g032-sysctrl.txt
··· 13 13 - external (optional) RGMII_REFCLK 14 14 - clock-names: Must be: 15 15 clock-names = "mclk", "rtc", "jtag", "rgmii_ref_ext"; 16 + - #power-domain-cells: Must be 0 16 17 17 18 Examples 18 19 -------- ··· 28 27 clocks = <&ext_mclk>, <&ext_rtc_clk>, 29 28 <&ext_jtag_clk>, <&ext_rgmii_ref>; 30 29 clock-names = "mclk", "rtc", "jtag", "rgmii_ref_ext"; 30 + #power-domain-cells = <0>; 31 31 }; 32 32 33 33 - Other nodes can use the clocks provided by SYSCTRL as in: ··· 40 38 interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>; 41 39 reg-shift = <2>; 42 40 reg-io-width = <4>; 43 - clocks = <&sysctrl R9A06G032_CLK_UART0>; 44 - clock-names = "baudclk"; 41 + clocks = <&sysctrl R9A06G032_CLK_UART0>, <&sysctrl R9A06G032_HCLK_UART0>; 42 + clock-names = "baudclk", "apb_pclk"; 43 + power-domains = <&sysctrl>; 45 44 };
+162
Documentation/devicetree/bindings/clock/silabs,si5341.txt
··· 1 + Binding for Silicon Labs Si5341 and Si5340 programmable i2c clock generator. 2 + 3 + Reference 4 + [1] Si5341 Data Sheet 5 + https://www.silabs.com/documents/public/data-sheets/Si5341-40-D-DataSheet.pdf 6 + [2] Si5341 Reference Manual 7 + https://www.silabs.com/documents/public/reference-manuals/Si5341-40-D-RM.pdf 8 + 9 + The Si5341 and Si5340 are programmable i2c clock generators with up to 10 output 10 + clocks. The chip contains a PLL that sources 5 (or 4) multisynth clocks, which 11 + in turn can be directed to any of the 10 (or 4) outputs through a divider. 12 + The internal structure of the clock generators can be found in [2]. 13 + 14 + The driver can be used in "as is" mode, reading the current settings from the 15 + chip at boot, in case you have a (pre-)programmed device. If the PLL is not 16 + configured when the driver probes, it assumes the driver must fully initialize 17 + it. 18 + 19 + The device type, speed grade and revision are determined runtime by probing. 20 + 21 + The driver currently only supports XTAL input mode, and does not support any 22 + fancy input configurations. They can still be programmed into the chip and 23 + the driver will leave them "as is". 24 + 25 + ==I2C device node== 26 + 27 + Required properties: 28 + - compatible: shall be one of the following: 29 + "silabs,si5340" - Si5340 A/B/C/D 30 + "silabs,si5341" - Si5341 A/B/C/D 31 + - reg: i2c device address, usually 0x74 32 + - #clock-cells: from common clock binding; shall be set to 2. 33 + The first value is "0" for outputs, "1" for synthesizers. 34 + The second value is the output or synthesizer index. 35 + - clocks: from common clock binding; list of parent clock handles, 36 + corresponding to inputs. Use a fixed clock for the "xtal" input. 37 + At least one must be present. 38 + - clock-names: One of: "xtal", "in0", "in1", "in2" 39 + - vdd-supply: Regulator node for VDD 40 + 41 + Optional properties: 42 + - vdda-supply: Regulator node for VDDA 43 + - vdds-supply: Regulator node for VDDS 44 + - silabs,pll-m-num, silabs,pll-m-den: Numerator and denominator for PLL 45 + feedback divider. Must be such that the PLL output is in the valid range. For 46 + example, to create 14GHz from a 48MHz xtal, use m-num=14000 and m-den=48. Only 47 + the fraction matters, using 3500 and 12 will deliver the exact same result. 48 + If these are not specified, and the PLL is not yet programmed when the driver 49 + probes, the PLL will be set to 14GHz. 50 + - silabs,reprogram: When present, the driver will always assume the device must 51 + be initialized, and always performs the soft-reset routine. Since this will 52 + temporarily stop all output clocks, don't do this if the chip is generating 53 + the CPU clock for example. 54 + - interrupts: Interrupt for INTRb pin. 55 + - #address-cells: shall be set to 1. 56 + - #size-cells: shall be set to 0. 57 + 58 + 59 + == Child nodes: Outputs == 60 + 61 + The child nodes list the output clocks. 62 + 63 + Each of the clock outputs can be overwritten individually by using a child node. 64 + If a child node for a clock output is not set, the configuration remains 65 + unchanged. 66 + 67 + Required child node properties: 68 + - reg: number of clock output. 69 + 70 + Optional child node properties: 71 + - vdd-supply: Regulator node for VDD for this output. The driver selects default 72 + values for common-mode and amplitude based on the voltage. 73 + - silabs,format: Output format, one of: 74 + 1 = differential (defaults to LVDS levels) 75 + 2 = low-power (defaults to HCSL levels) 76 + 4 = LVCMOS 77 + - silabs,common-mode: Manually override output common mode, see [2] for values 78 + - silabs,amplitude: Manually override output amplitude, see [2] for values 79 + - silabs,synth-master: boolean. If present, this output is allowed to change the 80 + multisynth frequency dynamically. 81 + - silabs,silabs,disable-high: boolean. If set, the clock output is driven HIGH 82 + when disabled, otherwise it's driven LOW. 83 + 84 + ==Example== 85 + 86 + /* 48MHz reference crystal */ 87 + ref48: ref48M { 88 + compatible = "fixed-clock"; 89 + #clock-cells = <0>; 90 + clock-frequency = <48000000>; 91 + }; 92 + 93 + i2c-master-node { 94 + /* Programmable clock (for logic) */ 95 + si5341: clock-generator@74 { 96 + reg = <0x74>; 97 + compatible = "silabs,si5341"; 98 + #clock-cells = <2>; 99 + #address-cells = <1>; 100 + #size-cells = <0>; 101 + clocks = <&ref48>; 102 + clock-names = "xtal"; 103 + 104 + silabs,pll-m-num = <14000>; /* PLL at 14.0 GHz */ 105 + silabs,pll-m-den = <48>; 106 + silabs,reprogram; /* Chips are not programmed, always reset */ 107 + 108 + out@0 { 109 + reg = <0>; 110 + silabs,format = <1>; /* LVDS 3v3 */ 111 + silabs,common-mode = <3>; 112 + silabs,amplitude = <3>; 113 + silabs,synth-master; 114 + }; 115 + 116 + /* 117 + * Output 6 configuration: 118 + * LVDS 1v8 119 + */ 120 + out@6 { 121 + reg = <6>; 122 + silabs,format = <1>; /* LVDS 1v8 */ 123 + silabs,common-mode = <13>; 124 + silabs,amplitude = <3>; 125 + }; 126 + 127 + /* 128 + * Output 8 configuration: 129 + * HCSL 3v3 130 + */ 131 + out@8 { 132 + reg = <8>; 133 + silabs,format = <2>; 134 + silabs,common-mode = <11>; 135 + silabs,amplitude = <3>; 136 + }; 137 + }; 138 + }; 139 + 140 + some-video-node { 141 + /* Standard clock bindings */ 142 + clock-names = "pixel"; 143 + clocks = <&si5341 0 7>; /* Output 7 */ 144 + 145 + /* Set output 7 to use syntesizer 3 as its parent */ 146 + assigned-clocks = <&si5341 0 7>, <&si5341 1 3>; 147 + assigned-clock-parents = <&si5341 1 3>; 148 + /* Set output 7 to 148.5 MHz using a synth frequency of 594 MHz */ 149 + assigned-clock-rates = <148500000>, <594000000>; 150 + }; 151 + 152 + some-audio-node { 153 + clock-names = "i2s-clk"; 154 + clocks = <&si5341 0 0>; 155 + /* 156 + * since output 0 is a synth-master, the synth will be automatically set 157 + * to an appropriate frequency when the audio driver requests another 158 + * frequency. We give control over synth 2 to this output here. 159 + */ 160 + assigned-clocks = <&si5341 0 0>; 161 + assigned-clock-parents = <&si5341 1 2>; 162 + };
-62
Documentation/devicetree/bindings/clock/sunxi-ccu.txt
··· 1 - Allwinner Clock Control Unit Binding 2 - ------------------------------------ 3 - 4 - Required properties : 5 - - compatible: must contain one of the following compatibles: 6 - - "allwinner,sun4i-a10-ccu" 7 - - "allwinner,sun5i-a10s-ccu" 8 - - "allwinner,sun5i-a13-ccu" 9 - - "allwinner,sun6i-a31-ccu" 10 - - "allwinner,sun7i-a20-ccu" 11 - - "allwinner,sun8i-a23-ccu" 12 - - "allwinner,sun8i-a33-ccu" 13 - - "allwinner,sun8i-a83t-ccu" 14 - - "allwinner,sun8i-a83t-r-ccu" 15 - - "allwinner,sun8i-h3-ccu" 16 - - "allwinner,sun8i-h3-r-ccu" 17 - + - "allwinner,sun8i-r40-ccu" 18 - - "allwinner,sun8i-v3s-ccu" 19 - - "allwinner,sun9i-a80-ccu" 20 - - "allwinner,sun50i-a64-ccu" 21 - - "allwinner,sun50i-a64-r-ccu" 22 - - "allwinner,sun50i-h5-ccu" 23 - - "allwinner,sun50i-h6-ccu" 24 - - "allwinner,sun50i-h6-r-ccu" 25 - - "allwinner,suniv-f1c100s-ccu" 26 - - "nextthing,gr8-ccu" 27 - 28 - - reg: Must contain the registers base address and length 29 - - clocks: phandle to the oscillators feeding the CCU. Two are needed: 30 - - "hosc": the high frequency oscillator (usually at 24MHz) 31 - - "losc": the low frequency oscillator (usually at 32kHz) 32 - On the A83T, this is the internal 16MHz oscillator divided by 512 33 - - clock-names: Must contain the clock names described just above 34 - - #clock-cells : must contain 1 35 - - #reset-cells : must contain 1 36 - 37 - For the main CCU on H6, one more clock is needed: 38 - - "iosc": the SoC's internal frequency oscillator 39 - 40 - For the PRCM CCUs on A83T/H3/A64/H6, two more clocks are needed: 41 - - "pll-periph": the SoC's peripheral PLL from the main CCU 42 - - "iosc": the SoC's internal frequency oscillator 43 - 44 - Example for generic CCU: 45 - ccu: clock@1c20000 { 46 - compatible = "allwinner,sun8i-h3-ccu"; 47 - reg = <0x01c20000 0x400>; 48 - clocks = <&osc24M>, <&osc32k>; 49 - clock-names = "hosc", "losc"; 50 - #clock-cells = <1>; 51 - #reset-cells = <1>; 52 - }; 53 - 54 - Example for PRCM CCU: 55 - r_ccu: clock@1f01400 { 56 - compatible = "allwinner,sun50i-a64-r-ccu"; 57 - reg = <0x01f01400 0x100>; 58 - clocks = <&osc24M>, <&osc32k>, <&iosc>, <&ccu CLK_PLL_PERIPH0>; 59 - clock-names = "hosc", "losc", "iosc", "pll-periph"; 60 - #clock-cells = <1>; 61 - #reset-cells = <1>; 62 - };
+4
Documentation/driver-api/driver-model/devres.rst
··· 246 246 devm_clk_get() 247 247 devm_clk_get_optional() 248 248 devm_clk_put() 249 + devm_clk_bulk_get() 250 + devm_clk_bulk_get_all() 251 + devm_clk_bulk_get_optional() 252 + devm_get_clk_from_childl() 249 253 devm_clk_hw_register() 250 254 devm_of_clk_add_hw_provider() 251 255 devm_clk_hw_register_clkdev()
-22
arch/mips/include/asm/mach-jz4740/clock.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 - /* 3 - * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de> 4 - */ 5 - 6 - #ifndef __ASM_JZ4740_CLOCK_H__ 7 - #define __ASM_JZ4740_CLOCK_H__ 8 - 9 - enum jz4740_wait_mode { 10 - JZ4740_WAIT_MODE_IDLE, 11 - JZ4740_WAIT_MODE_SLEEP, 12 - }; 13 - 14 - void jz4740_clock_set_wait_mode(enum jz4740_wait_mode mode); 15 - 16 - void jz4740_clock_suspend(void); 17 - void jz4740_clock_resume(void); 18 - 19 - void jz4740_clock_udc_enable_auto_suspend(void); 20 - void jz4740_clock_udc_disable_auto_suspend(void); 21 - 22 - #endif
-2
arch/mips/jz4740/board-qi_lb60.c
··· 37 37 38 38 #include <asm/mach-jz4740/platform.h> 39 39 40 - #include "clock.h" 41 - 42 40 /* GPIOs */ 43 41 #define QI_LB60_GPIO_KEYOUT(x) (JZ_GPIO_PORTC(10) + (x)) 44 42 #define QI_LB60_GPIO_KEYIN(x) (JZ_GPIO_PORTD(18) + (x))
-2
arch/mips/jz4740/platform.c
··· 21 21 #include <linux/serial_core.h> 22 22 #include <linux/serial_8250.h> 23 23 24 - #include "clock.h" 25 - 26 24 /* USB Device Controller */ 27 25 struct platform_device jz4740_udc_xceiv_device = { 28 26 .name = "usb_phy_generic",
-8
arch/mips/jz4740/pm.c
··· 9 9 #include <linux/delay.h> 10 10 #include <linux/suspend.h> 11 11 12 - #include <asm/mach-jz4740/clock.h> 13 - 14 12 static int jz4740_pm_enter(suspend_state_t state) 15 13 { 16 - jz4740_clock_suspend(); 17 - 18 - jz4740_clock_set_wait_mode(JZ4740_WAIT_MODE_SLEEP); 19 - 20 14 __asm__(".set\tmips3\n\t" 21 15 "wait\n\t" 22 16 ".set\tmips0"); 23 17 24 - jz4740_clock_set_wait_mode(JZ4740_WAIT_MODE_IDLE); 25 18 26 - jz4740_clock_resume(); 27 19 28 20 return 0; 29 21 }
-3
arch/mips/jz4740/time.c
··· 13 13 #include <linux/clockchips.h> 14 14 #include <linux/sched_clock.h> 15 15 16 - #include <asm/mach-jz4740/clock.h> 17 16 #include <asm/mach-jz4740/irq.h> 18 17 #include <asm/mach-jz4740/timer.h> 19 18 #include <asm/time.h> 20 - 21 - #include "clock.h" 22 19 23 20 #define TIMER_CLOCKEVENT 0 24 21 #define TIMER_CLOCKSOURCE 1
+12 -1
drivers/clk/Kconfig
··· 90 90 This driver uses SCPI Message Protocol to interact with the 91 91 firmware providing all the clock controls. 92 92 93 + config COMMON_CLK_SI5341 94 + tristate "Clock driver for SiLabs 5341 and 5340 A/B/C/D devices" 95 + depends on I2C 96 + select REGMAP_I2C 97 + help 98 + This driver supports Silicon Labs Si5341 and Si5340 programmable clock 99 + generators. Not all features of these chips are currently supported 100 + by the driver, in particular it only supports XTAL input. The chip can 101 + be pre-programmed to support other configurations and features not yet 102 + implemented in the driver. 103 + 93 104 config COMMON_CLK_SI5351 94 105 tristate "Clock driver for SiLabs 5351A/B/C" 95 106 depends on I2C ··· 225 214 226 215 config COMMON_CLK_XGENE 227 216 bool "Clock driver for APM XGene SoC" 228 - default y 217 + default ARCH_XGENE 229 218 depends on ARM64 || COMPILE_TEST 230 219 ---help--- 231 220 Sypport for the APM X-Gene SoC reference, PLL, and device clocks.
+1
drivers/clk/Makefile
··· 49 49 obj-$(CONFIG_COMMON_CLK_S2MPS11) += clk-s2mps11.o 50 50 obj-$(CONFIG_COMMON_CLK_SCMI) += clk-scmi.o 51 51 obj-$(CONFIG_COMMON_CLK_SCPI) += clk-scpi.o 52 + obj-$(CONFIG_COMMON_CLK_SI5341) += clk-si5341.o 52 53 obj-$(CONFIG_COMMON_CLK_SI5351) += clk-si5351.o 53 54 obj-$(CONFIG_COMMON_CLK_SI514) += clk-si514.o 54 55 obj-$(CONFIG_COMMON_CLK_SI544) += clk-si544.o
+212 -65
drivers/clk/at91/sckc.c
··· 18 18 SLOW_CLOCK_FREQ) 19 19 20 20 #define AT91_SCKC_CR 0x00 21 - #define AT91_SCKC_RCEN (1 << 0) 22 - #define AT91_SCKC_OSC32EN (1 << 1) 23 - #define AT91_SCKC_OSC32BYP (1 << 2) 24 - #define AT91_SCKC_OSCSEL (1 << 3) 21 + 22 + struct clk_slow_bits { 23 + u32 cr_rcen; 24 + u32 cr_osc32en; 25 + u32 cr_osc32byp; 26 + u32 cr_oscsel; 27 + }; 25 28 26 29 struct clk_slow_osc { 27 30 struct clk_hw hw; 28 31 void __iomem *sckcr; 32 + const struct clk_slow_bits *bits; 29 33 unsigned long startup_usec; 30 34 }; 31 35 ··· 38 34 struct clk_sama5d4_slow_osc { 39 35 struct clk_hw hw; 40 36 void __iomem *sckcr; 37 + const struct clk_slow_bits *bits; 41 38 unsigned long startup_usec; 42 39 bool prepared; 43 40 }; ··· 48 43 struct clk_slow_rc_osc { 49 44 struct clk_hw hw; 50 45 void __iomem *sckcr; 46 + const struct clk_slow_bits *bits; 51 47 unsigned long frequency; 52 48 unsigned long accuracy; 53 49 unsigned long startup_usec; ··· 59 53 struct clk_sam9x5_slow { 60 54 struct clk_hw hw; 61 55 void __iomem *sckcr; 56 + const struct clk_slow_bits *bits; 62 57 u8 parent; 63 58 }; 64 59 ··· 71 64 void __iomem *sckcr = osc->sckcr; 72 65 u32 tmp = readl(sckcr); 73 66 74 - if (tmp & (AT91_SCKC_OSC32BYP | AT91_SCKC_OSC32EN)) 67 + if (tmp & (osc->bits->cr_osc32byp | osc->bits->cr_osc32en)) 75 68 return 0; 76 69 77 - writel(tmp | AT91_SCKC_OSC32EN, sckcr); 70 + writel(tmp | osc->bits->cr_osc32en, sckcr); 78 71 79 72 usleep_range(osc->startup_usec, osc->startup_usec + 1); 80 73 ··· 87 80 void __iomem *sckcr = osc->sckcr; 88 81 u32 tmp = readl(sckcr); 89 82 90 - if (tmp & AT91_SCKC_OSC32BYP) 83 + if (tmp & osc->bits->cr_osc32byp) 91 84 return; 92 85 93 - writel(tmp & ~AT91_SCKC_OSC32EN, sckcr); 86 + writel(tmp & ~osc->bits->cr_osc32en, sckcr); 94 87 } 95 88 96 89 static int clk_slow_osc_is_prepared(struct clk_hw *hw) ··· 99 92 void __iomem *sckcr = osc->sckcr; 100 93 u32 tmp = readl(sckcr); 101 94 102 - if (tmp & AT91_SCKC_OSC32BYP) 95 + if (tmp & osc->bits->cr_osc32byp) 103 96 return 1; 104 97 105 - return !!(tmp & AT91_SCKC_OSC32EN); 98 + return !!(tmp & osc->bits->cr_osc32en); 106 99 } 107 100 108 101 static const struct clk_ops slow_osc_ops = { ··· 116 109 const char *name, 117 110 const char *parent_name, 118 111 unsigned long startup, 119 - bool bypass) 112 + bool bypass, 113 + const struct clk_slow_bits *bits) 120 114 { 121 115 struct clk_slow_osc *osc; 122 116 struct clk_hw *hw; ··· 140 132 osc->hw.init = &init; 141 133 osc->sckcr = sckcr; 142 134 osc->startup_usec = startup; 135 + osc->bits = bits; 143 136 144 137 if (bypass) 145 - writel((readl(sckcr) & ~AT91_SCKC_OSC32EN) | AT91_SCKC_OSC32BYP, 146 - sckcr); 138 + writel((readl(sckcr) & ~osc->bits->cr_osc32en) | 139 + osc->bits->cr_osc32byp, sckcr); 147 140 148 141 hw = &osc->hw; 149 142 ret = clk_hw_register(NULL, &osc->hw); ··· 154 145 } 155 146 156 147 return hw; 148 + } 149 + 150 + static void at91_clk_unregister_slow_osc(struct clk_hw *hw) 151 + { 152 + struct clk_slow_osc *osc = to_clk_slow_osc(hw); 153 + 154 + clk_hw_unregister(hw); 155 + kfree(osc); 157 156 } 158 157 159 158 static unsigned long clk_slow_rc_osc_recalc_rate(struct clk_hw *hw, ··· 185 168 struct clk_slow_rc_osc *osc = to_clk_slow_rc_osc(hw); 186 169 void __iomem *sckcr = osc->sckcr; 187 170 188 - writel(readl(sckcr) | AT91_SCKC_RCEN, sckcr); 171 + writel(readl(sckcr) | osc->bits->cr_rcen, sckcr); 189 172 190 173 usleep_range(osc->startup_usec, osc->startup_usec + 1); 191 174 ··· 197 180 struct clk_slow_rc_osc *osc = to_clk_slow_rc_osc(hw); 198 181 void __iomem *sckcr = osc->sckcr; 199 182 200 - writel(readl(sckcr) & ~AT91_SCKC_RCEN, sckcr); 183 + writel(readl(sckcr) & ~osc->bits->cr_rcen, sckcr); 201 184 } 202 185 203 186 static int clk_slow_rc_osc_is_prepared(struct clk_hw *hw) 204 187 { 205 188 struct clk_slow_rc_osc *osc = to_clk_slow_rc_osc(hw); 206 189 207 - return !!(readl(osc->sckcr) & AT91_SCKC_RCEN); 190 + return !!(readl(osc->sckcr) & osc->bits->cr_rcen); 208 191 } 209 192 210 193 static const struct clk_ops slow_rc_osc_ops = { ··· 220 203 const char *name, 221 204 unsigned long frequency, 222 205 unsigned long accuracy, 223 - unsigned long startup) 206 + unsigned long startup, 207 + const struct clk_slow_bits *bits) 224 208 { 225 209 struct clk_slow_rc_osc *osc; 226 210 struct clk_hw *hw; ··· 243 225 244 226 osc->hw.init = &init; 245 227 osc->sckcr = sckcr; 228 + osc->bits = bits; 246 229 osc->frequency = frequency; 247 230 osc->accuracy = accuracy; 248 231 osc->startup_usec = startup; ··· 258 239 return hw; 259 240 } 260 241 242 + static void at91_clk_unregister_slow_rc_osc(struct clk_hw *hw) 243 + { 244 + struct clk_slow_rc_osc *osc = to_clk_slow_rc_osc(hw); 245 + 246 + clk_hw_unregister(hw); 247 + kfree(osc); 248 + } 249 + 261 250 static int clk_sam9x5_slow_set_parent(struct clk_hw *hw, u8 index) 262 251 { 263 252 struct clk_sam9x5_slow *slowck = to_clk_sam9x5_slow(hw); ··· 277 250 278 251 tmp = readl(sckcr); 279 252 280 - if ((!index && !(tmp & AT91_SCKC_OSCSEL)) || 281 - (index && (tmp & AT91_SCKC_OSCSEL))) 253 + if ((!index && !(tmp & slowck->bits->cr_oscsel)) || 254 + (index && (tmp & slowck->bits->cr_oscsel))) 282 255 return 0; 283 256 284 257 if (index) 285 - tmp |= AT91_SCKC_OSCSEL; 258 + tmp |= slowck->bits->cr_oscsel; 286 259 else 287 - tmp &= ~AT91_SCKC_OSCSEL; 260 + tmp &= ~slowck->bits->cr_oscsel; 288 261 289 262 writel(tmp, sckcr); 290 263 ··· 297 270 { 298 271 struct clk_sam9x5_slow *slowck = to_clk_sam9x5_slow(hw); 299 272 300 - return !!(readl(slowck->sckcr) & AT91_SCKC_OSCSEL); 273 + return !!(readl(slowck->sckcr) & slowck->bits->cr_oscsel); 301 274 } 302 275 303 276 static const struct clk_ops sam9x5_slow_ops = { ··· 309 282 at91_clk_register_sam9x5_slow(void __iomem *sckcr, 310 283 const char *name, 311 284 const char **parent_names, 312 - int num_parents) 285 + int num_parents, 286 + const struct clk_slow_bits *bits) 313 287 { 314 288 struct clk_sam9x5_slow *slowck; 315 289 struct clk_hw *hw; ··· 332 304 333 305 slowck->hw.init = &init; 334 306 slowck->sckcr = sckcr; 335 - slowck->parent = !!(readl(sckcr) & AT91_SCKC_OSCSEL); 307 + slowck->bits = bits; 308 + slowck->parent = !!(readl(sckcr) & slowck->bits->cr_oscsel); 336 309 337 310 hw = &slowck->hw; 338 311 ret = clk_hw_register(NULL, &slowck->hw); ··· 345 316 return hw; 346 317 } 347 318 319 + static void at91_clk_unregister_sam9x5_slow(struct clk_hw *hw) 320 + { 321 + struct clk_sam9x5_slow *slowck = to_clk_sam9x5_slow(hw); 322 + 323 + clk_hw_unregister(hw); 324 + kfree(slowck); 325 + } 326 + 348 327 static void __init at91sam9x5_sckc_register(struct device_node *np, 349 - unsigned int rc_osc_startup_us) 328 + unsigned int rc_osc_startup_us, 329 + const struct clk_slow_bits *bits) 350 330 { 351 331 const char *parent_names[2] = { "slow_rc_osc", "slow_osc" }; 352 332 void __iomem *regbase = of_iomap(np, 0); 353 333 struct device_node *child = NULL; 354 334 const char *xtal_name; 355 - struct clk_hw *hw; 335 + struct clk_hw *slow_rc, *slow_osc, *slowck; 356 336 bool bypass; 337 + int ret; 357 338 358 339 if (!regbase) 359 340 return; 360 341 361 - hw = at91_clk_register_slow_rc_osc(regbase, parent_names[0], 32768, 362 - 50000000, rc_osc_startup_us); 363 - if (IS_ERR(hw)) 342 + slow_rc = at91_clk_register_slow_rc_osc(regbase, parent_names[0], 343 + 32768, 50000000, 344 + rc_osc_startup_us, bits); 345 + if (IS_ERR(slow_rc)) 364 346 return; 365 347 366 348 xtal_name = of_clk_get_parent_name(np, 0); ··· 379 339 /* DT backward compatibility */ 380 340 child = of_get_compatible_child(np, "atmel,at91sam9x5-clk-slow-osc"); 381 341 if (!child) 382 - return; 342 + goto unregister_slow_rc; 383 343 384 344 xtal_name = of_clk_get_parent_name(child, 0); 385 345 bypass = of_property_read_bool(child, "atmel,osc-bypass"); ··· 390 350 } 391 351 392 352 if (!xtal_name) 393 - return; 353 + goto unregister_slow_rc; 394 354 395 - hw = at91_clk_register_slow_osc(regbase, parent_names[1], xtal_name, 396 - 1200000, bypass); 397 - if (IS_ERR(hw)) 398 - return; 355 + slow_osc = at91_clk_register_slow_osc(regbase, parent_names[1], 356 + xtal_name, 1200000, bypass, bits); 357 + if (IS_ERR(slow_osc)) 358 + goto unregister_slow_rc; 399 359 400 - hw = at91_clk_register_sam9x5_slow(regbase, "slowck", parent_names, 2); 401 - if (IS_ERR(hw)) 402 - return; 403 - 404 - of_clk_add_hw_provider(np, of_clk_hw_simple_get, hw); 360 + slowck = at91_clk_register_sam9x5_slow(regbase, "slowck", parent_names, 361 + 2, bits); 362 + if (IS_ERR(slowck)) 363 + goto unregister_slow_osc; 405 364 406 365 /* DT backward compatibility */ 407 366 if (child) 408 - of_clk_add_hw_provider(child, of_clk_hw_simple_get, hw); 367 + ret = of_clk_add_hw_provider(child, of_clk_hw_simple_get, 368 + slowck); 369 + else 370 + ret = of_clk_add_hw_provider(np, of_clk_hw_simple_get, slowck); 371 + 372 + if (WARN_ON(ret)) 373 + goto unregister_slowck; 374 + 375 + return; 376 + 377 + unregister_slowck: 378 + at91_clk_unregister_sam9x5_slow(slowck); 379 + unregister_slow_osc: 380 + at91_clk_unregister_slow_osc(slow_osc); 381 + unregister_slow_rc: 382 + at91_clk_unregister_slow_rc_osc(slow_rc); 409 383 } 384 + 385 + static const struct clk_slow_bits at91sam9x5_bits = { 386 + .cr_rcen = BIT(0), 387 + .cr_osc32en = BIT(1), 388 + .cr_osc32byp = BIT(2), 389 + .cr_oscsel = BIT(3), 390 + }; 410 391 411 392 static void __init of_at91sam9x5_sckc_setup(struct device_node *np) 412 393 { 413 - at91sam9x5_sckc_register(np, 75); 394 + at91sam9x5_sckc_register(np, 75, &at91sam9x5_bits); 414 395 } 415 396 CLK_OF_DECLARE(at91sam9x5_clk_sckc, "atmel,at91sam9x5-sckc", 416 397 of_at91sam9x5_sckc_setup); 417 398 418 399 static void __init of_sama5d3_sckc_setup(struct device_node *np) 419 400 { 420 - at91sam9x5_sckc_register(np, 500); 401 + at91sam9x5_sckc_register(np, 500, &at91sam9x5_bits); 421 402 } 422 403 CLK_OF_DECLARE(sama5d3_clk_sckc, "atmel,sama5d3-sckc", 423 404 of_sama5d3_sckc_setup); 405 + 406 + static const struct clk_slow_bits at91sam9x60_bits = { 407 + .cr_osc32en = BIT(1), 408 + .cr_osc32byp = BIT(2), 409 + .cr_oscsel = BIT(24), 410 + }; 411 + 412 + static void __init of_sam9x60_sckc_setup(struct device_node *np) 413 + { 414 + void __iomem *regbase = of_iomap(np, 0); 415 + struct clk_hw_onecell_data *clk_data; 416 + struct clk_hw *slow_rc, *slow_osc; 417 + const char *xtal_name; 418 + const char *parent_names[2] = { "slow_rc_osc", "slow_osc" }; 419 + bool bypass; 420 + int ret; 421 + 422 + if (!regbase) 423 + return; 424 + 425 + slow_rc = clk_hw_register_fixed_rate(NULL, parent_names[0], NULL, 0, 426 + 32768); 427 + if (IS_ERR(slow_rc)) 428 + return; 429 + 430 + xtal_name = of_clk_get_parent_name(np, 0); 431 + if (!xtal_name) 432 + goto unregister_slow_rc; 433 + 434 + bypass = of_property_read_bool(np, "atmel,osc-bypass"); 435 + slow_osc = at91_clk_register_slow_osc(regbase, parent_names[1], 436 + xtal_name, 5000000, bypass, 437 + &at91sam9x60_bits); 438 + if (IS_ERR(slow_osc)) 439 + goto unregister_slow_rc; 440 + 441 + clk_data = kzalloc(sizeof(*clk_data) + (2 * sizeof(struct clk_hw *)), 442 + GFP_KERNEL); 443 + if (!clk_data) 444 + goto unregister_slow_osc; 445 + 446 + /* MD_SLCK and TD_SLCK. */ 447 + clk_data->num = 2; 448 + clk_data->hws[0] = clk_hw_register_fixed_rate(NULL, "md_slck", 449 + parent_names[0], 450 + 0, 32768); 451 + if (IS_ERR(clk_data->hws[0])) 452 + goto clk_data_free; 453 + 454 + clk_data->hws[1] = at91_clk_register_sam9x5_slow(regbase, "td_slck", 455 + parent_names, 2, 456 + &at91sam9x60_bits); 457 + if (IS_ERR(clk_data->hws[1])) 458 + goto unregister_md_slck; 459 + 460 + ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data); 461 + if (WARN_ON(ret)) 462 + goto unregister_td_slck; 463 + 464 + return; 465 + 466 + unregister_td_slck: 467 + at91_clk_unregister_sam9x5_slow(clk_data->hws[1]); 468 + unregister_md_slck: 469 + clk_hw_unregister(clk_data->hws[0]); 470 + clk_data_free: 471 + kfree(clk_data); 472 + unregister_slow_osc: 473 + at91_clk_unregister_slow_osc(slow_osc); 474 + unregister_slow_rc: 475 + clk_hw_unregister(slow_rc); 476 + } 477 + CLK_OF_DECLARE(sam9x60_clk_sckc, "microchip,sam9x60-sckc", 478 + of_sam9x60_sckc_setup); 424 479 425 480 static int clk_sama5d4_slow_osc_prepare(struct clk_hw *hw) 426 481 { ··· 528 393 * Assume that if it has already been selected (for example by the 529 394 * bootloader), enough time has aready passed. 530 395 */ 531 - if ((readl(osc->sckcr) & AT91_SCKC_OSCSEL)) { 396 + if ((readl(osc->sckcr) & osc->bits->cr_oscsel)) { 532 397 osc->prepared = true; 533 398 return 0; 534 399 } ··· 551 416 .is_prepared = clk_sama5d4_slow_osc_is_prepared, 552 417 }; 553 418 419 + static const struct clk_slow_bits at91sama5d4_bits = { 420 + .cr_oscsel = BIT(3), 421 + }; 422 + 554 423 static void __init of_sama5d4_sckc_setup(struct device_node *np) 555 424 { 556 425 void __iomem *regbase = of_iomap(np, 0); 557 - struct clk_hw *hw; 426 + struct clk_hw *slow_rc, *slowck; 558 427 struct clk_sama5d4_slow_osc *osc; 559 428 struct clk_init_data init; 560 429 const char *xtal_name; 561 430 const char *parent_names[2] = { "slow_rc_osc", "slow_osc" }; 562 - bool bypass; 563 431 int ret; 564 432 565 433 if (!regbase) 566 434 return; 567 435 568 - hw = clk_hw_register_fixed_rate_with_accuracy(NULL, parent_names[0], 569 - NULL, 0, 32768, 570 - 250000000); 571 - if (IS_ERR(hw)) 436 + slow_rc = clk_hw_register_fixed_rate_with_accuracy(NULL, 437 + parent_names[0], 438 + NULL, 0, 32768, 439 + 250000000); 440 + if (IS_ERR(slow_rc)) 572 441 return; 573 442 574 443 xtal_name = of_clk_get_parent_name(np, 0); 575 444 576 - bypass = of_property_read_bool(np, "atmel,osc-bypass"); 577 - 578 445 osc = kzalloc(sizeof(*osc), GFP_KERNEL); 579 446 if (!osc) 580 - return; 447 + goto unregister_slow_rc; 581 448 582 449 init.name = parent_names[1]; 583 450 init.ops = &sama5d4_slow_osc_ops; ··· 590 453 osc->hw.init = &init; 591 454 osc->sckcr = regbase; 592 455 osc->startup_usec = 1200000; 456 + osc->bits = &at91sama5d4_bits; 593 457 594 - if (bypass) 595 - writel((readl(regbase) | AT91_SCKC_OSC32BYP), regbase); 596 - 597 - hw = &osc->hw; 598 458 ret = clk_hw_register(NULL, &osc->hw); 599 - if (ret) { 600 - kfree(osc); 601 - return; 602 - } 459 + if (ret) 460 + goto free_slow_osc_data; 603 461 604 - hw = at91_clk_register_sam9x5_slow(regbase, "slowck", parent_names, 2); 605 - if (IS_ERR(hw)) 606 - return; 462 + slowck = at91_clk_register_sam9x5_slow(regbase, "slowck", 463 + parent_names, 2, 464 + &at91sama5d4_bits); 465 + if (IS_ERR(slowck)) 466 + goto unregister_slow_osc; 607 467 608 - of_clk_add_hw_provider(np, of_clk_hw_simple_get, hw); 468 + ret = of_clk_add_hw_provider(np, of_clk_hw_simple_get, slowck); 469 + if (WARN_ON(ret)) 470 + goto unregister_slowck; 471 + 472 + return; 473 + 474 + unregister_slowck: 475 + at91_clk_unregister_sam9x5_slow(slowck); 476 + unregister_slow_osc: 477 + clk_hw_unregister(&osc->hw); 478 + free_slow_osc_data: 479 + kfree(osc); 480 + unregister_slow_rc: 481 + clk_hw_unregister(slow_rc); 609 482 } 610 483 CLK_OF_DECLARE(sama5d4_clk_sckc, "atmel,sama5d4-sckc", 611 484 of_sama5d4_sckc_setup);
+24
drivers/clk/bcm/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 + config CLK_BCM2835 3 + bool "Broadcom BCM2835 clock support" 4 + depends on ARCH_BCM2835 || ARCH_BRCMSTB || COMPILE_TEST 5 + depends on COMMON_CLK 6 + default ARCH_BCM2835 || ARCH_BRCMSTB 7 + help 8 + Enable common clock framework support for Broadcom BCM2835 9 + SoCs. 10 + 2 11 config CLK_BCM_63XX 3 12 bool "Broadcom BCM63xx clock support" 4 13 depends on ARCH_BCM_63XX || COMPILE_TEST ··· 16 7 help 17 8 Enable common clock framework support for Broadcom BCM63xx DSL SoCs 18 9 based on the ARM architecture 10 + 11 + config CLK_BCM_63XX_GATE 12 + bool "Broadcom BCM63xx gated clock support" 13 + depends on BMIPS_GENERIC || COMPILE_TEST 14 + default BMIPS_GENERIC 15 + help 16 + Enable common clock framework support for Broadcom BCM63xx DSL SoCs 17 + based on the MIPS architecture 19 18 20 19 config CLK_BCM_KONA 21 20 bool "Broadcom Kona CCU clock support" ··· 81 64 default ARCH_BCM_IPROC 82 65 help 83 66 Enable common clock framework support for the Broadcom Stingray SoC 67 + 68 + config CLK_RASPBERRYPI 69 + tristate "Raspberry Pi firmware based clock support" 70 + depends on RASPBERRYPI_FIRMWARE || (COMPILE_TEST && !RASPBERRYPI_FIRMWARE) 71 + help 72 + Enable common clock framework support for Raspberry Pi's firmware 73 + dependent clocks
+4 -2
drivers/clk/bcm/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 obj-$(CONFIG_CLK_BCM_63XX) += clk-bcm63xx.o 3 + obj-$(CONFIG_CLK_BCM_63XX_GATE) += clk-bcm63xx-gate.o 3 4 obj-$(CONFIG_CLK_BCM_KONA) += clk-kona.o 4 5 obj-$(CONFIG_CLK_BCM_KONA) += clk-kona-setup.o 5 6 obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o 6 7 obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o 7 8 obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-asiu.o 8 - obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o 9 - obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835-aux.o 9 + obj-$(CONFIG_CLK_BCM2835) += clk-bcm2835.o 10 + obj-$(CONFIG_CLK_BCM2835) += clk-bcm2835-aux.o 11 + obj-$(CONFIG_CLK_RASPBERRYPI) += clk-raspberrypi.o 10 12 obj-$(CONFIG_ARCH_BCM_53573) += clk-bcm53573-ilp.o 11 13 obj-$(CONFIG_CLK_BCM_CYGNUS) += clk-cygnus.o 12 14 obj-$(CONFIG_CLK_BCM_HR2) += clk-hr2.o
+4 -24
drivers/clk/bcm/clk-bcm2835.c
··· 1651 1651 .fixed_divider = 1, 1652 1652 .flags = CLK_SET_RATE_PARENT), 1653 1653 1654 - /* PLLB is used for the ARM's clock. */ 1655 - [BCM2835_PLLB] = REGISTER_PLL( 1656 - .name = "pllb", 1657 - .cm_ctrl_reg = CM_PLLB, 1658 - .a2w_ctrl_reg = A2W_PLLB_CTRL, 1659 - .frac_reg = A2W_PLLB_FRAC, 1660 - .ana_reg_base = A2W_PLLB_ANA0, 1661 - .reference_enable_mask = A2W_XOSC_CTRL_PLLB_ENABLE, 1662 - .lock_mask = CM_LOCK_FLOCKB, 1663 - 1664 - .ana = &bcm2835_ana_default, 1665 - 1666 - .min_rate = 600000000u, 1667 - .max_rate = 3000000000u, 1668 - .max_fb_rate = BCM2835_MAX_FB_RATE), 1669 - [BCM2835_PLLB_ARM] = REGISTER_PLL_DIV( 1670 - .name = "pllb_arm", 1671 - .source_pll = "pllb", 1672 - .cm_reg = CM_PLLB, 1673 - .a2w_reg = A2W_PLLB_ARM, 1674 - .load_mask = CM_PLLB_LOADARM, 1675 - .hold_mask = CM_PLLB_HOLDARM, 1676 - .fixed_divider = 1, 1677 - .flags = CLK_SET_RATE_PARENT), 1654 + /* 1655 + * PLLB is used for the ARM's clock. Controlled by firmware, see 1656 + * clk-raspberrypi.c. 1657 + */ 1678 1658 1679 1659 /* 1680 1660 * PLLC is the core PLL, used to drive the core VPU clock.
+238
drivers/clk/bcm/clk-bcm63xx-gate.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/clk-provider.h> 4 + #include <linux/init.h> 5 + #include <linux/of.h> 6 + #include <linux/of_device.h> 7 + #include <linux/platform_device.h> 8 + 9 + struct clk_bcm63xx_table_entry { 10 + const char * const name; 11 + u8 bit; 12 + unsigned long flags; 13 + }; 14 + 15 + struct clk_bcm63xx_hw { 16 + void __iomem *regs; 17 + spinlock_t lock; 18 + 19 + struct clk_hw_onecell_data data; 20 + }; 21 + 22 + static const struct clk_bcm63xx_table_entry bcm3368_clocks[] = { 23 + { .name = "mac", .bit = 3, }, 24 + { .name = "tc", .bit = 5, }, 25 + { .name = "us_top", .bit = 6, }, 26 + { .name = "ds_top", .bit = 7, }, 27 + { .name = "acm", .bit = 8, }, 28 + { .name = "spi", .bit = 9, }, 29 + { .name = "usbs", .bit = 10, }, 30 + { .name = "bmu", .bit = 11, }, 31 + { .name = "pcm", .bit = 12, }, 32 + { .name = "ntp", .bit = 13, }, 33 + { .name = "acp_b", .bit = 14, }, 34 + { .name = "acp_a", .bit = 15, }, 35 + { .name = "emusb", .bit = 17, }, 36 + { .name = "enet0", .bit = 18, }, 37 + { .name = "enet1", .bit = 19, }, 38 + { .name = "usbsu", .bit = 20, }, 39 + { .name = "ephy", .bit = 21, }, 40 + { }, 41 + }; 42 + 43 + static const struct clk_bcm63xx_table_entry bcm6328_clocks[] = { 44 + { .name = "phy_mips", .bit = 0, }, 45 + { .name = "adsl_qproc", .bit = 1, }, 46 + { .name = "adsl_afe", .bit = 2, }, 47 + { .name = "adsl", .bit = 3, }, 48 + { .name = "mips", .bit = 4, .flags = CLK_IS_CRITICAL, }, 49 + { .name = "sar", .bit = 5, }, 50 + { .name = "pcm", .bit = 6, }, 51 + { .name = "usbd", .bit = 7, }, 52 + { .name = "usbh", .bit = 8, }, 53 + { .name = "hsspi", .bit = 9, }, 54 + { .name = "pcie", .bit = 10, }, 55 + { .name = "robosw", .bit = 11, }, 56 + { }, 57 + }; 58 + 59 + static const struct clk_bcm63xx_table_entry bcm6358_clocks[] = { 60 + { .name = "enet", .bit = 4, }, 61 + { .name = "adslphy", .bit = 5, }, 62 + { .name = "pcm", .bit = 8, }, 63 + { .name = "spi", .bit = 9, }, 64 + { .name = "usbs", .bit = 10, }, 65 + { .name = "sar", .bit = 11, }, 66 + { .name = "emusb", .bit = 17, }, 67 + { .name = "enet0", .bit = 18, }, 68 + { .name = "enet1", .bit = 19, }, 69 + { .name = "usbsu", .bit = 20, }, 70 + { .name = "ephy", .bit = 21, }, 71 + { }, 72 + }; 73 + 74 + static const struct clk_bcm63xx_table_entry bcm6362_clocks[] = { 75 + { .name = "adsl_qproc", .bit = 1, }, 76 + { .name = "adsl_afe", .bit = 2, }, 77 + { .name = "adsl", .bit = 3, }, 78 + { .name = "mips", .bit = 4, .flags = CLK_IS_CRITICAL, }, 79 + { .name = "wlan_ocp", .bit = 5, }, 80 + { .name = "swpkt_usb", .bit = 7, }, 81 + { .name = "swpkt_sar", .bit = 8, }, 82 + { .name = "sar", .bit = 9, }, 83 + { .name = "robosw", .bit = 10, }, 84 + { .name = "pcm", .bit = 11, }, 85 + { .name = "usbd", .bit = 12, }, 86 + { .name = "usbh", .bit = 13, }, 87 + { .name = "ipsec", .bit = 14, }, 88 + { .name = "spi", .bit = 15, }, 89 + { .name = "hsspi", .bit = 16, }, 90 + { .name = "pcie", .bit = 17, }, 91 + { .name = "fap", .bit = 18, }, 92 + { .name = "phymips", .bit = 19, }, 93 + { .name = "nand", .bit = 20, }, 94 + { }, 95 + }; 96 + 97 + static const struct clk_bcm63xx_table_entry bcm6368_clocks[] = { 98 + { .name = "vdsl_qproc", .bit = 2, }, 99 + { .name = "vdsl_afe", .bit = 3, }, 100 + { .name = "vdsl_bonding", .bit = 4, }, 101 + { .name = "vdsl", .bit = 5, }, 102 + { .name = "phymips", .bit = 6, }, 103 + { .name = "swpkt_usb", .bit = 7, }, 104 + { .name = "swpkt_sar", .bit = 8, }, 105 + { .name = "spi", .bit = 9, }, 106 + { .name = "usbd", .bit = 10, }, 107 + { .name = "sar", .bit = 11, }, 108 + { .name = "robosw", .bit = 12, }, 109 + { .name = "utopia", .bit = 13, }, 110 + { .name = "pcm", .bit = 14, }, 111 + { .name = "usbh", .bit = 15, }, 112 + { .name = "disable_gless", .bit = 16, }, 113 + { .name = "nand", .bit = 17, }, 114 + { .name = "ipsec", .bit = 18, }, 115 + { }, 116 + }; 117 + 118 + static const struct clk_bcm63xx_table_entry bcm63268_clocks[] = { 119 + { .name = "disable_gless", .bit = 0, }, 120 + { .name = "vdsl_qproc", .bit = 1, }, 121 + { .name = "vdsl_afe", .bit = 2, }, 122 + { .name = "vdsl", .bit = 3, }, 123 + { .name = "mips", .bit = 4, .flags = CLK_IS_CRITICAL, }, 124 + { .name = "wlan_ocp", .bit = 5, }, 125 + { .name = "dect", .bit = 6, }, 126 + { .name = "fap0", .bit = 7, }, 127 + { .name = "fap1", .bit = 8, }, 128 + { .name = "sar", .bit = 9, }, 129 + { .name = "robosw", .bit = 10, }, 130 + { .name = "pcm", .bit = 11, }, 131 + { .name = "usbd", .bit = 12, }, 132 + { .name = "usbh", .bit = 13, }, 133 + { .name = "ipsec", .bit = 14, }, 134 + { .name = "spi", .bit = 15, }, 135 + { .name = "hsspi", .bit = 16, }, 136 + { .name = "pcie", .bit = 17, }, 137 + { .name = "phymips", .bit = 18, }, 138 + { .name = "gmac", .bit = 19, }, 139 + { .name = "nand", .bit = 20, }, 140 + { .name = "tbus", .bit = 27, }, 141 + { .name = "robosw250", .bit = 31, }, 142 + { }, 143 + }; 144 + 145 + static int clk_bcm63xx_probe(struct platform_device *pdev) 146 + { 147 + const struct clk_bcm63xx_table_entry *entry, *table; 148 + struct clk_bcm63xx_hw *hw; 149 + struct resource *r; 150 + u8 maxbit = 0; 151 + int i, ret; 152 + 153 + table = of_device_get_match_data(&pdev->dev); 154 + if (!table) 155 + return -EINVAL; 156 + 157 + for (entry = table; entry->name; entry++) 158 + maxbit = max_t(u8, maxbit, entry->bit); 159 + 160 + hw = devm_kzalloc(&pdev->dev, struct_size(hw, data.hws, maxbit), 161 + GFP_KERNEL); 162 + if (!hw) 163 + return -ENOMEM; 164 + 165 + platform_set_drvdata(pdev, hw); 166 + 167 + spin_lock_init(&hw->lock); 168 + 169 + hw->data.num = maxbit; 170 + for (i = 0; i < maxbit; i++) 171 + hw->data.hws[i] = ERR_PTR(-ENODEV); 172 + 173 + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 174 + hw->regs = devm_ioremap_resource(&pdev->dev, r); 175 + if (IS_ERR(hw->regs)) 176 + return PTR_ERR(hw->regs); 177 + 178 + for (entry = table; entry->name; entry++) { 179 + struct clk_hw *clk; 180 + 181 + clk = clk_hw_register_gate(&pdev->dev, entry->name, NULL, 182 + entry->flags, hw->regs, entry->bit, 183 + CLK_GATE_BIG_ENDIAN, &hw->lock); 184 + if (IS_ERR(clk)) { 185 + ret = PTR_ERR(clk); 186 + goto out_err; 187 + } 188 + 189 + hw->data.hws[entry->bit] = clk; 190 + } 191 + 192 + ret = of_clk_add_hw_provider(pdev->dev.of_node, of_clk_hw_onecell_get, 193 + &hw->data); 194 + if (!ret) 195 + return 0; 196 + out_err: 197 + for (i = 0; i < hw->data.num; i++) { 198 + if (!IS_ERR(hw->data.hws[i])) 199 + clk_hw_unregister_gate(hw->data.hws[i]); 200 + } 201 + 202 + return ret; 203 + } 204 + 205 + static int clk_bcm63xx_remove(struct platform_device *pdev) 206 + { 207 + struct clk_bcm63xx_hw *hw = platform_get_drvdata(pdev); 208 + int i; 209 + 210 + of_clk_del_provider(pdev->dev.of_node); 211 + 212 + for (i = 0; i < hw->data.num; i++) { 213 + if (!IS_ERR(hw->data.hws[i])) 214 + clk_hw_unregister_gate(hw->data.hws[i]); 215 + } 216 + 217 + return 0; 218 + } 219 + 220 + static const struct of_device_id clk_bcm63xx_dt_ids[] = { 221 + { .compatible = "brcm,bcm3368-clocks", .data = &bcm3368_clocks, }, 222 + { .compatible = "brcm,bcm6328-clocks", .data = &bcm6328_clocks, }, 223 + { .compatible = "brcm,bcm6358-clocks", .data = &bcm6358_clocks, }, 224 + { .compatible = "brcm,bcm6362-clocks", .data = &bcm6362_clocks, }, 225 + { .compatible = "brcm,bcm6368-clocks", .data = &bcm6368_clocks, }, 226 + { .compatible = "brcm,bcm63268-clocks", .data = &bcm63268_clocks, }, 227 + { } 228 + }; 229 + 230 + static struct platform_driver clk_bcm63xx = { 231 + .probe = clk_bcm63xx_probe, 232 + .remove = clk_bcm63xx_remove, 233 + .driver = { 234 + .name = "bcm63xx-clock", 235 + .of_match_table = clk_bcm63xx_dt_ids, 236 + }, 237 + }; 238 + builtin_platform_driver(clk_bcm63xx);
+315
drivers/clk/bcm/clk-raspberrypi.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * Raspberry Pi driver for firmware controlled clocks 4 + * 5 + * Even though clk-bcm2835 provides an interface to the hardware registers for 6 + * the system clocks we've had to factor out 'pllb' as the firmware 'owns' it. 7 + * We're not allowed to change it directly as we might race with the 8 + * over-temperature and under-voltage protections provided by the firmware. 9 + * 10 + * Copyright (C) 2019 Nicolas Saenz Julienne <nsaenzjulienne@suse.de> 11 + */ 12 + 13 + #include <linux/clkdev.h> 14 + #include <linux/clk-provider.h> 15 + #include <linux/io.h> 16 + #include <linux/module.h> 17 + #include <linux/platform_device.h> 18 + 19 + #include <soc/bcm2835/raspberrypi-firmware.h> 20 + 21 + #define RPI_FIRMWARE_ARM_CLK_ID 0x00000003 22 + 23 + #define RPI_FIRMWARE_STATE_ENABLE_BIT BIT(0) 24 + #define RPI_FIRMWARE_STATE_WAIT_BIT BIT(1) 25 + 26 + /* 27 + * Even though the firmware interface alters 'pllb' the frequencies are 28 + * provided as per 'pllb_arm'. We need to scale before passing them trough. 29 + */ 30 + #define RPI_FIRMWARE_PLLB_ARM_DIV_RATE 2 31 + 32 + #define A2W_PLL_FRAC_BITS 20 33 + 34 + struct raspberrypi_clk { 35 + struct device *dev; 36 + struct rpi_firmware *firmware; 37 + struct platform_device *cpufreq; 38 + 39 + unsigned long min_rate; 40 + unsigned long max_rate; 41 + 42 + struct clk_hw pllb; 43 + struct clk_hw *pllb_arm; 44 + struct clk_lookup *pllb_arm_lookup; 45 + }; 46 + 47 + /* 48 + * Structure of the message passed to Raspberry Pi's firmware in order to 49 + * change clock rates. The 'disable_turbo' option is only available to the ARM 50 + * clock (pllb) which we enable by default as turbo mode will alter multiple 51 + * clocks at once. 52 + * 53 + * Even though we're able to access the clock registers directly we're bound to 54 + * use the firmware interface as the firmware ultimately takes care of 55 + * mitigating overheating/undervoltage situations and we would be changing 56 + * frequencies behind his back. 57 + * 58 + * For more information on the firmware interface check: 59 + * https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface 60 + */ 61 + struct raspberrypi_firmware_prop { 62 + __le32 id; 63 + __le32 val; 64 + __le32 disable_turbo; 65 + } __packed; 66 + 67 + static int raspberrypi_clock_property(struct rpi_firmware *firmware, u32 tag, 68 + u32 clk, u32 *val) 69 + { 70 + struct raspberrypi_firmware_prop msg = { 71 + .id = cpu_to_le32(clk), 72 + .val = cpu_to_le32(*val), 73 + .disable_turbo = cpu_to_le32(1), 74 + }; 75 + int ret; 76 + 77 + ret = rpi_firmware_property(firmware, tag, &msg, sizeof(msg)); 78 + if (ret) 79 + return ret; 80 + 81 + *val = le32_to_cpu(msg.val); 82 + 83 + return 0; 84 + } 85 + 86 + static int raspberrypi_fw_pll_is_on(struct clk_hw *hw) 87 + { 88 + struct raspberrypi_clk *rpi = container_of(hw, struct raspberrypi_clk, 89 + pllb); 90 + u32 val = 0; 91 + int ret; 92 + 93 + ret = raspberrypi_clock_property(rpi->firmware, 94 + RPI_FIRMWARE_GET_CLOCK_STATE, 95 + RPI_FIRMWARE_ARM_CLK_ID, &val); 96 + if (ret) 97 + return 0; 98 + 99 + return !!(val & RPI_FIRMWARE_STATE_ENABLE_BIT); 100 + } 101 + 102 + 103 + static unsigned long raspberrypi_fw_pll_get_rate(struct clk_hw *hw, 104 + unsigned long parent_rate) 105 + { 106 + struct raspberrypi_clk *rpi = container_of(hw, struct raspberrypi_clk, 107 + pllb); 108 + u32 val = 0; 109 + int ret; 110 + 111 + ret = raspberrypi_clock_property(rpi->firmware, 112 + RPI_FIRMWARE_GET_CLOCK_RATE, 113 + RPI_FIRMWARE_ARM_CLK_ID, 114 + &val); 115 + if (ret) 116 + return ret; 117 + 118 + return val * RPI_FIRMWARE_PLLB_ARM_DIV_RATE; 119 + } 120 + 121 + static int raspberrypi_fw_pll_set_rate(struct clk_hw *hw, unsigned long rate, 122 + unsigned long parent_rate) 123 + { 124 + struct raspberrypi_clk *rpi = container_of(hw, struct raspberrypi_clk, 125 + pllb); 126 + u32 new_rate = rate / RPI_FIRMWARE_PLLB_ARM_DIV_RATE; 127 + int ret; 128 + 129 + ret = raspberrypi_clock_property(rpi->firmware, 130 + RPI_FIRMWARE_SET_CLOCK_RATE, 131 + RPI_FIRMWARE_ARM_CLK_ID, 132 + &new_rate); 133 + if (ret) 134 + dev_err_ratelimited(rpi->dev, "Failed to change %s frequency: %d", 135 + clk_hw_get_name(hw), ret); 136 + 137 + return ret; 138 + } 139 + 140 + /* 141 + * Sadly there is no firmware rate rounding interface. We borrowed it from 142 + * clk-bcm2835. 143 + */ 144 + static int raspberrypi_pll_determine_rate(struct clk_hw *hw, 145 + struct clk_rate_request *req) 146 + { 147 + struct raspberrypi_clk *rpi = container_of(hw, struct raspberrypi_clk, 148 + pllb); 149 + u64 div, final_rate; 150 + u32 ndiv, fdiv; 151 + 152 + /* We can't use req->rate directly as it would overflow */ 153 + final_rate = clamp(req->rate, rpi->min_rate, rpi->max_rate); 154 + 155 + div = (u64)final_rate << A2W_PLL_FRAC_BITS; 156 + do_div(div, req->best_parent_rate); 157 + 158 + ndiv = div >> A2W_PLL_FRAC_BITS; 159 + fdiv = div & ((1 << A2W_PLL_FRAC_BITS) - 1); 160 + 161 + final_rate = ((u64)req->best_parent_rate * 162 + ((ndiv << A2W_PLL_FRAC_BITS) + fdiv)); 163 + 164 + req->rate = final_rate >> A2W_PLL_FRAC_BITS; 165 + 166 + return 0; 167 + } 168 + 169 + static const struct clk_ops raspberrypi_firmware_pll_clk_ops = { 170 + .is_prepared = raspberrypi_fw_pll_is_on, 171 + .recalc_rate = raspberrypi_fw_pll_get_rate, 172 + .set_rate = raspberrypi_fw_pll_set_rate, 173 + .determine_rate = raspberrypi_pll_determine_rate, 174 + }; 175 + 176 + static int raspberrypi_register_pllb(struct raspberrypi_clk *rpi) 177 + { 178 + u32 min_rate = 0, max_rate = 0; 179 + struct clk_init_data init; 180 + int ret; 181 + 182 + memset(&init, 0, sizeof(init)); 183 + 184 + /* All of the PLLs derive from the external oscillator. */ 185 + init.parent_names = (const char *[]){ "osc" }; 186 + init.num_parents = 1; 187 + init.name = "pllb"; 188 + init.ops = &raspberrypi_firmware_pll_clk_ops; 189 + init.flags = CLK_GET_RATE_NOCACHE | CLK_IGNORE_UNUSED; 190 + 191 + /* Get min & max rates set by the firmware */ 192 + ret = raspberrypi_clock_property(rpi->firmware, 193 + RPI_FIRMWARE_GET_MIN_CLOCK_RATE, 194 + RPI_FIRMWARE_ARM_CLK_ID, 195 + &min_rate); 196 + if (ret) { 197 + dev_err(rpi->dev, "Failed to get %s min freq: %d\n", 198 + init.name, ret); 199 + return ret; 200 + } 201 + 202 + ret = raspberrypi_clock_property(rpi->firmware, 203 + RPI_FIRMWARE_GET_MAX_CLOCK_RATE, 204 + RPI_FIRMWARE_ARM_CLK_ID, 205 + &max_rate); 206 + if (ret) { 207 + dev_err(rpi->dev, "Failed to get %s max freq: %d\n", 208 + init.name, ret); 209 + return ret; 210 + } 211 + 212 + if (!min_rate || !max_rate) { 213 + dev_err(rpi->dev, "Unexpected frequency range: min %u, max %u\n", 214 + min_rate, max_rate); 215 + return -EINVAL; 216 + } 217 + 218 + dev_info(rpi->dev, "CPU frequency range: min %u, max %u\n", 219 + min_rate, max_rate); 220 + 221 + rpi->min_rate = min_rate * RPI_FIRMWARE_PLLB_ARM_DIV_RATE; 222 + rpi->max_rate = max_rate * RPI_FIRMWARE_PLLB_ARM_DIV_RATE; 223 + 224 + rpi->pllb.init = &init; 225 + 226 + return devm_clk_hw_register(rpi->dev, &rpi->pllb); 227 + } 228 + 229 + static int raspberrypi_register_pllb_arm(struct raspberrypi_clk *rpi) 230 + { 231 + rpi->pllb_arm = clk_hw_register_fixed_factor(rpi->dev, 232 + "pllb_arm", "pllb", 233 + CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE, 234 + 1, 2); 235 + if (IS_ERR(rpi->pllb_arm)) { 236 + dev_err(rpi->dev, "Failed to initialize pllb_arm\n"); 237 + return PTR_ERR(rpi->pllb_arm); 238 + } 239 + 240 + rpi->pllb_arm_lookup = clkdev_hw_create(rpi->pllb_arm, NULL, "cpu0"); 241 + if (!rpi->pllb_arm_lookup) { 242 + dev_err(rpi->dev, "Failed to initialize pllb_arm_lookup\n"); 243 + clk_hw_unregister_fixed_factor(rpi->pllb_arm); 244 + return -ENOMEM; 245 + } 246 + 247 + return 0; 248 + } 249 + 250 + static int raspberrypi_clk_probe(struct platform_device *pdev) 251 + { 252 + struct device_node *firmware_node; 253 + struct device *dev = &pdev->dev; 254 + struct rpi_firmware *firmware; 255 + struct raspberrypi_clk *rpi; 256 + int ret; 257 + 258 + firmware_node = of_find_compatible_node(NULL, NULL, 259 + "raspberrypi,bcm2835-firmware"); 260 + if (!firmware_node) { 261 + dev_err(dev, "Missing firmware node\n"); 262 + return -ENOENT; 263 + } 264 + 265 + firmware = rpi_firmware_get(firmware_node); 266 + of_node_put(firmware_node); 267 + if (!firmware) 268 + return -EPROBE_DEFER; 269 + 270 + rpi = devm_kzalloc(dev, sizeof(*rpi), GFP_KERNEL); 271 + if (!rpi) 272 + return -ENOMEM; 273 + 274 + rpi->dev = dev; 275 + rpi->firmware = firmware; 276 + platform_set_drvdata(pdev, rpi); 277 + 278 + ret = raspberrypi_register_pllb(rpi); 279 + if (ret) { 280 + dev_err(dev, "Failed to initialize pllb, %d\n", ret); 281 + return ret; 282 + } 283 + 284 + ret = raspberrypi_register_pllb_arm(rpi); 285 + if (ret) 286 + return ret; 287 + 288 + rpi->cpufreq = platform_device_register_data(dev, "raspberrypi-cpufreq", 289 + -1, NULL, 0); 290 + 291 + return 0; 292 + } 293 + 294 + static int raspberrypi_clk_remove(struct platform_device *pdev) 295 + { 296 + struct raspberrypi_clk *rpi = platform_get_drvdata(pdev); 297 + 298 + platform_device_unregister(rpi->cpufreq); 299 + 300 + return 0; 301 + } 302 + 303 + static struct platform_driver raspberrypi_clk_driver = { 304 + .driver = { 305 + .name = "raspberrypi-clk", 306 + }, 307 + .probe = raspberrypi_clk_probe, 308 + .remove = raspberrypi_clk_remove, 309 + }; 310 + module_platform_driver(raspberrypi_clk_driver); 311 + 312 + MODULE_AUTHOR("Nicolas Saenz Julienne <nsaenzjulienne@suse.de>"); 313 + MODULE_DESCRIPTION("Raspberry Pi firmware clock driver"); 314 + MODULE_LICENSE("GPL"); 315 + MODULE_ALIAS("platform:raspberrypi-clk");
+20 -3
drivers/clk/clk-bulk.c
··· 75 75 } 76 76 EXPORT_SYMBOL_GPL(clk_bulk_put); 77 77 78 - int __must_check clk_bulk_get(struct device *dev, int num_clks, 79 - struct clk_bulk_data *clks) 78 + static int __clk_bulk_get(struct device *dev, int num_clks, 79 + struct clk_bulk_data *clks, bool optional) 80 80 { 81 81 int ret; 82 82 int i; ··· 88 88 clks[i].clk = clk_get(dev, clks[i].id); 89 89 if (IS_ERR(clks[i].clk)) { 90 90 ret = PTR_ERR(clks[i].clk); 91 + clks[i].clk = NULL; 92 + 93 + if (ret == -ENOENT && optional) 94 + continue; 95 + 91 96 if (ret != -EPROBE_DEFER) 92 97 dev_err(dev, "Failed to get clk '%s': %d\n", 93 98 clks[i].id, ret); 94 - clks[i].clk = NULL; 95 99 goto err; 96 100 } 97 101 } ··· 107 103 108 104 return ret; 109 105 } 106 + 107 + int __must_check clk_bulk_get(struct device *dev, int num_clks, 108 + struct clk_bulk_data *clks) 109 + { 110 + return __clk_bulk_get(dev, num_clks, clks, false); 111 + } 110 112 EXPORT_SYMBOL(clk_bulk_get); 113 + 114 + int __must_check clk_bulk_get_optional(struct device *dev, int num_clks, 115 + struct clk_bulk_data *clks) 116 + { 117 + return __clk_bulk_get(dev, num_clks, clks, true); 118 + } 119 + EXPORT_SYMBOL_GPL(clk_bulk_get_optional); 111 120 112 121 void clk_bulk_put_all(int num_clks, struct clk_bulk_data *clks) 113 122 {
+1 -1
drivers/clk/clk-cdce706.c
··· 630 630 static int cdce706_probe(struct i2c_client *client, 631 631 const struct i2c_device_id *id) 632 632 { 633 - struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); 633 + struct i2c_adapter *adapter = client->adapter; 634 634 struct cdce706_dev_data *cdce; 635 635 int ret; 636 636
+19 -3
drivers/clk/clk-devres.c
··· 52 52 clk_bulk_put(devres->num_clks, devres->clks); 53 53 } 54 54 55 - int __must_check devm_clk_bulk_get(struct device *dev, int num_clks, 56 - struct clk_bulk_data *clks) 55 + static int __devm_clk_bulk_get(struct device *dev, int num_clks, 56 + struct clk_bulk_data *clks, bool optional) 57 57 { 58 58 struct clk_bulk_devres *devres; 59 59 int ret; ··· 63 63 if (!devres) 64 64 return -ENOMEM; 65 65 66 - ret = clk_bulk_get(dev, num_clks, clks); 66 + if (optional) 67 + ret = clk_bulk_get_optional(dev, num_clks, clks); 68 + else 69 + ret = clk_bulk_get(dev, num_clks, clks); 67 70 if (!ret) { 68 71 devres->clks = clks; 69 72 devres->num_clks = num_clks; ··· 77 74 78 75 return ret; 79 76 } 77 + 78 + int __must_check devm_clk_bulk_get(struct device *dev, int num_clks, 79 + struct clk_bulk_data *clks) 80 + { 81 + return __devm_clk_bulk_get(dev, num_clks, clks, false); 82 + } 80 83 EXPORT_SYMBOL_GPL(devm_clk_bulk_get); 84 + 85 + int __must_check devm_clk_bulk_get_optional(struct device *dev, int num_clks, 86 + struct clk_bulk_data *clks) 87 + { 88 + return __devm_clk_bulk_get(dev, num_clks, clks, true); 89 + } 90 + EXPORT_SYMBOL_GPL(devm_clk_bulk_get_optional); 81 91 82 92 int __must_check devm_clk_bulk_get_all(struct device *dev, 83 93 struct clk_bulk_data **clks)
+86 -119
drivers/clk/clk-lochnagar.c
··· 16 16 #include <linux/platform_device.h> 17 17 #include <linux/regmap.h> 18 18 19 - #include <linux/mfd/lochnagar.h> 20 19 #include <linux/mfd/lochnagar1_regs.h> 21 20 #include <linux/mfd/lochnagar2_regs.h> 22 21 ··· 39 40 struct lochnagar_clk_priv { 40 41 struct device *dev; 41 42 struct regmap *regmap; 42 - enum lochnagar_type type; 43 - 44 - const char **parents; 45 - unsigned int nparents; 46 43 47 44 struct lochnagar_clk lclks[LOCHNAGAR_NUM_CLOCKS]; 48 45 }; 49 46 50 - static const char * const lochnagar1_clk_parents[] = { 51 - "ln-none", 52 - "ln-spdif-mclk", 53 - "ln-psia1-mclk", 54 - "ln-psia2-mclk", 55 - "ln-cdc-clkout", 56 - "ln-dsp-clkout", 57 - "ln-pmic-32k", 58 - "ln-gf-mclk1", 59 - "ln-gf-mclk3", 60 - "ln-gf-mclk2", 61 - "ln-gf-mclk4", 47 + #define LN_PARENT(NAME) { .name = NAME, .fw_name = NAME } 48 + 49 + static const struct clk_parent_data lochnagar1_clk_parents[] = { 50 + LN_PARENT("ln-none"), 51 + LN_PARENT("ln-spdif-mclk"), 52 + LN_PARENT("ln-psia1-mclk"), 53 + LN_PARENT("ln-psia2-mclk"), 54 + LN_PARENT("ln-cdc-clkout"), 55 + LN_PARENT("ln-dsp-clkout"), 56 + LN_PARENT("ln-pmic-32k"), 57 + LN_PARENT("ln-gf-mclk1"), 58 + LN_PARENT("ln-gf-mclk3"), 59 + LN_PARENT("ln-gf-mclk2"), 60 + LN_PARENT("ln-gf-mclk4"), 62 61 }; 63 62 64 - static const char * const lochnagar2_clk_parents[] = { 65 - "ln-none", 66 - "ln-cdc-clkout", 67 - "ln-dsp-clkout", 68 - "ln-pmic-32k", 69 - "ln-spdif-mclk", 70 - "ln-clk-12m", 71 - "ln-clk-11m", 72 - "ln-clk-24m", 73 - "ln-clk-22m", 74 - "ln-clk-8m", 75 - "ln-usb-clk-24m", 76 - "ln-gf-mclk1", 77 - "ln-gf-mclk3", 78 - "ln-gf-mclk2", 79 - "ln-psia1-mclk", 80 - "ln-psia2-mclk", 81 - "ln-spdif-clkout", 82 - "ln-adat-mclk", 83 - "ln-usb-clk-12m", 63 + static const struct clk_parent_data lochnagar2_clk_parents[] = { 64 + LN_PARENT("ln-none"), 65 + LN_PARENT("ln-cdc-clkout"), 66 + LN_PARENT("ln-dsp-clkout"), 67 + LN_PARENT("ln-pmic-32k"), 68 + LN_PARENT("ln-spdif-mclk"), 69 + LN_PARENT("ln-clk-12m"), 70 + LN_PARENT("ln-clk-11m"), 71 + LN_PARENT("ln-clk-24m"), 72 + LN_PARENT("ln-clk-22m"), 73 + LN_PARENT("ln-clk-8m"), 74 + LN_PARENT("ln-usb-clk-24m"), 75 + LN_PARENT("ln-gf-mclk1"), 76 + LN_PARENT("ln-gf-mclk3"), 77 + LN_PARENT("ln-gf-mclk2"), 78 + LN_PARENT("ln-psia1-mclk"), 79 + LN_PARENT("ln-psia2-mclk"), 80 + LN_PARENT("ln-spdif-clkout"), 81 + LN_PARENT("ln-adat-mclk"), 82 + LN_PARENT("ln-usb-clk-12m"), 84 83 }; 85 84 86 85 #define LN1_CLK(ID, NAME, REG) \ ··· 117 120 LN2_CLK(SPDIF_MCLK, "ln-spdif-mclk"), 118 121 LN2_CLK(ADAT_MCLK, "ln-adat-mclk"), 119 122 LN2_CLK(SOUNDCARD_MCLK, "ln-soundcard-mclk"), 123 + }; 124 + 125 + struct lochnagar_config { 126 + const struct clk_parent_data *parents; 127 + int nparents; 128 + const struct lochnagar_clk *clks; 129 + }; 130 + 131 + static const struct lochnagar_config lochnagar1_conf = { 132 + .parents = lochnagar1_clk_parents, 133 + .nparents = ARRAY_SIZE(lochnagar1_clk_parents), 134 + .clks = lochnagar1_clks, 135 + }; 136 + 137 + static const struct lochnagar_config lochnagar2_conf = { 138 + .parents = lochnagar2_clk_parents, 139 + .nparents = ARRAY_SIZE(lochnagar2_clk_parents), 140 + .clks = lochnagar2_clks, 120 141 }; 121 142 122 143 static inline struct lochnagar_clk *lochnagar_hw_to_lclk(struct clk_hw *hw) ··· 198 183 if (ret < 0) { 199 184 dev_dbg(priv->dev, "Failed to read parent of %s: %d\n", 200 185 lclk->name, ret); 201 - return priv->nparents; 186 + return hw->init->num_parents; 202 187 } 203 188 204 189 val &= lclk->src_mask; ··· 212 197 .set_parent = lochnagar_clk_set_parent, 213 198 .get_parent = lochnagar_clk_get_parent, 214 199 }; 215 - 216 - static int lochnagar_init_parents(struct lochnagar_clk_priv *priv) 217 - { 218 - struct device_node *np = priv->dev->of_node; 219 - int i, j; 220 - 221 - switch (priv->type) { 222 - case LOCHNAGAR1: 223 - memcpy(priv->lclks, lochnagar1_clks, sizeof(lochnagar1_clks)); 224 - 225 - priv->nparents = ARRAY_SIZE(lochnagar1_clk_parents); 226 - priv->parents = devm_kmemdup(priv->dev, lochnagar1_clk_parents, 227 - sizeof(lochnagar1_clk_parents), 228 - GFP_KERNEL); 229 - break; 230 - case LOCHNAGAR2: 231 - memcpy(priv->lclks, lochnagar2_clks, sizeof(lochnagar2_clks)); 232 - 233 - priv->nparents = ARRAY_SIZE(lochnagar2_clk_parents); 234 - priv->parents = devm_kmemdup(priv->dev, lochnagar2_clk_parents, 235 - sizeof(lochnagar2_clk_parents), 236 - GFP_KERNEL); 237 - break; 238 - default: 239 - dev_err(priv->dev, "Unknown Lochnagar type: %d\n", priv->type); 240 - return -EINVAL; 241 - } 242 - 243 - if (!priv->parents) 244 - return -ENOMEM; 245 - 246 - for (i = 0; i < priv->nparents; i++) { 247 - j = of_property_match_string(np, "clock-names", 248 - priv->parents[i]); 249 - if (j >= 0) 250 - priv->parents[i] = of_clk_get_parent_name(np, j); 251 - } 252 - 253 - return 0; 254 - } 255 200 256 201 static struct clk_hw * 257 202 lochnagar_of_clk_hw_get(struct of_phandle_args *clkspec, void *data) ··· 227 252 return &priv->lclks[idx].hw; 228 253 } 229 254 230 - static int lochnagar_init_clks(struct lochnagar_clk_priv *priv) 255 + static const struct of_device_id lochnagar_of_match[] = { 256 + { .compatible = "cirrus,lochnagar1-clk", .data = &lochnagar1_conf }, 257 + { .compatible = "cirrus,lochnagar2-clk", .data = &lochnagar2_conf }, 258 + {} 259 + }; 260 + MODULE_DEVICE_TABLE(of, lochnagar_of_match); 261 + 262 + static int lochnagar_clk_probe(struct platform_device *pdev) 231 263 { 232 264 struct clk_init_data clk_init = { 233 265 .ops = &lochnagar_clk_ops, 234 - .parent_names = priv->parents, 235 - .num_parents = priv->nparents, 236 266 }; 267 + struct device *dev = &pdev->dev; 268 + struct lochnagar_clk_priv *priv; 269 + const struct of_device_id *of_id; 237 270 struct lochnagar_clk *lclk; 271 + struct lochnagar_config *conf; 238 272 int ret, i; 273 + 274 + of_id = of_match_device(lochnagar_of_match, dev); 275 + if (!of_id) 276 + return -EINVAL; 277 + 278 + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 279 + if (!priv) 280 + return -ENOMEM; 281 + 282 + priv->dev = dev; 283 + priv->regmap = dev_get_regmap(dev->parent, NULL); 284 + conf = (struct lochnagar_config *)of_id->data; 285 + 286 + memcpy(priv->lclks, conf->clks, sizeof(priv->lclks)); 287 + 288 + clk_init.parent_data = conf->parents; 289 + clk_init.num_parents = conf->nparents; 239 290 240 291 for (i = 0; i < ARRAY_SIZE(priv->lclks); i++) { 241 292 lclk = &priv->lclks[i]; ··· 274 273 lclk->priv = priv; 275 274 lclk->hw.init = &clk_init; 276 275 277 - ret = devm_clk_hw_register(priv->dev, &lclk->hw); 276 + ret = devm_clk_hw_register(dev, &lclk->hw); 278 277 if (ret) { 279 - dev_err(priv->dev, "Failed to register %s: %d\n", 278 + dev_err(dev, "Failed to register %s: %d\n", 280 279 lclk->name, ret); 281 280 return ret; 282 281 } 283 282 } 284 283 285 - ret = devm_of_clk_add_hw_provider(priv->dev, lochnagar_of_clk_hw_get, 286 - priv); 284 + ret = devm_of_clk_add_hw_provider(dev, lochnagar_of_clk_hw_get, priv); 287 285 if (ret < 0) 288 - dev_err(priv->dev, "Failed to register provider: %d\n", ret); 286 + dev_err(dev, "Failed to register provider: %d\n", ret); 289 287 290 288 return ret; 291 - } 292 - 293 - static const struct of_device_id lochnagar_of_match[] = { 294 - { .compatible = "cirrus,lochnagar1-clk", .data = (void *)LOCHNAGAR1 }, 295 - { .compatible = "cirrus,lochnagar2-clk", .data = (void *)LOCHNAGAR2 }, 296 - {} 297 - }; 298 - MODULE_DEVICE_TABLE(of, lochnagar_of_match); 299 - 300 - static int lochnagar_clk_probe(struct platform_device *pdev) 301 - { 302 - struct device *dev = &pdev->dev; 303 - struct lochnagar_clk_priv *priv; 304 - const struct of_device_id *of_id; 305 - int ret; 306 - 307 - of_id = of_match_device(lochnagar_of_match, dev); 308 - if (!of_id) 309 - return -EINVAL; 310 - 311 - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 312 - if (!priv) 313 - return -ENOMEM; 314 - 315 - priv->dev = dev; 316 - priv->regmap = dev_get_regmap(dev->parent, NULL); 317 - priv->type = (enum lochnagar_type)of_id->data; 318 - 319 - ret = lochnagar_init_parents(priv); 320 - if (ret) 321 - return ret; 322 - 323 - return lochnagar_init_clks(priv); 324 289 } 325 290 326 291 static struct platform_driver lochnagar_clk_driver = {
+14
drivers/clk/clk-pwm.c
··· 44 44 return clk_pwm->fixed_rate; 45 45 } 46 46 47 + static int clk_pwm_get_duty_cycle(struct clk_hw *hw, struct clk_duty *duty) 48 + { 49 + struct clk_pwm *clk_pwm = to_clk_pwm(hw); 50 + struct pwm_state state; 51 + 52 + pwm_get_state(clk_pwm->pwm, &state); 53 + 54 + duty->num = state.duty_cycle; 55 + duty->den = state.period; 56 + 57 + return 0; 58 + } 59 + 47 60 static const struct clk_ops clk_pwm_ops = { 48 61 .prepare = clk_pwm_prepare, 49 62 .unprepare = clk_pwm_unprepare, 50 63 .recalc_rate = clk_pwm_recalc_rate, 64 + .get_duty_cycle = clk_pwm_get_duty_cycle, 51 65 }; 52 66 53 67 static int clk_pwm_probe(struct platform_device *pdev)
+12
drivers/clk/clk-qoriq.c
··· 635 635 .flags = CG_VER3 | CG_LITTLE_ENDIAN, 636 636 }, 637 637 { 638 + .compat = "fsl,lx2160a-clockgen", 639 + .cmux_groups = { 640 + &clockgen2_cmux_cga12, &clockgen2_cmux_cgb 641 + }, 642 + .cmux_to_group = { 643 + 0, 0, 0, 0, 1, 1, 1, 1, -1 644 + }, 645 + .pll_mask = 0x37, 646 + .flags = CG_VER3 | CG_LITTLE_ENDIAN, 647 + }, 648 + { 638 649 .compat = "fsl,p2041-clockgen", 639 650 .guts_compat = "fsl,qoriq-device-config-1.0", 640 651 .init_periph = p2041_init_periph, ··· 1504 1493 CLK_OF_DECLARE(qoriq_clockgen_ls1046a, "fsl,ls1046a-clockgen", clockgen_init); 1505 1494 CLK_OF_DECLARE(qoriq_clockgen_ls1088a, "fsl,ls1088a-clockgen", clockgen_init); 1506 1495 CLK_OF_DECLARE(qoriq_clockgen_ls2080a, "fsl,ls2080a-clockgen", clockgen_init); 1496 + CLK_OF_DECLARE(qoriq_clockgen_lx2160a, "fsl,lx2160a-clockgen", clockgen_init); 1507 1497 CLK_OF_DECLARE(qoriq_clockgen_p2041, "fsl,p2041-clockgen", clockgen_init); 1508 1498 CLK_OF_DECLARE(qoriq_clockgen_p3041, "fsl,p3041-clockgen", clockgen_init); 1509 1499 CLK_OF_DECLARE(qoriq_clockgen_p4080, "fsl,p4080-clockgen", clockgen_init);
+1346
drivers/clk/clk-si5341.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Driver for Silicon Labs Si5341/Si5340 Clock generator 4 + * Copyright (C) 2019 Topic Embedded Products 5 + * Author: Mike Looijmans <mike.looijmans@topic.nl> 6 + */ 7 + 8 + #include <linux/clk.h> 9 + #include <linux/clk-provider.h> 10 + #include <linux/delay.h> 11 + #include <linux/gcd.h> 12 + #include <linux/math64.h> 13 + #include <linux/i2c.h> 14 + #include <linux/module.h> 15 + #include <linux/regmap.h> 16 + #include <linux/slab.h> 17 + #include <asm/unaligned.h> 18 + 19 + #define SI5341_MAX_NUM_OUTPUTS 10 20 + #define SI5340_MAX_NUM_OUTPUTS 4 21 + 22 + #define SI5341_NUM_SYNTH 5 23 + #define SI5340_NUM_SYNTH 4 24 + 25 + /* Range of the synthesizer fractional divider */ 26 + #define SI5341_SYNTH_N_MIN 10 27 + #define SI5341_SYNTH_N_MAX 4095 28 + 29 + /* The chip can get its input clock from 3 input pins or an XTAL */ 30 + 31 + /* There is one PLL running at 13500–14256 MHz */ 32 + #define SI5341_PLL_VCO_MIN 13500000000ull 33 + #define SI5341_PLL_VCO_MAX 14256000000ull 34 + 35 + /* The 5 frequency synthesizers obtain their input from the PLL */ 36 + struct clk_si5341_synth { 37 + struct clk_hw hw; 38 + struct clk_si5341 *data; 39 + u8 index; 40 + }; 41 + #define to_clk_si5341_synth(_hw) \ 42 + container_of(_hw, struct clk_si5341_synth, hw) 43 + 44 + /* The output stages can be connected to any synth (full mux) */ 45 + struct clk_si5341_output { 46 + struct clk_hw hw; 47 + struct clk_si5341 *data; 48 + u8 index; 49 + }; 50 + #define to_clk_si5341_output(_hw) \ 51 + container_of(_hw, struct clk_si5341_output, hw) 52 + 53 + struct clk_si5341 { 54 + struct clk_hw hw; 55 + struct regmap *regmap; 56 + struct i2c_client *i2c_client; 57 + struct clk_si5341_synth synth[SI5341_NUM_SYNTH]; 58 + struct clk_si5341_output clk[SI5341_MAX_NUM_OUTPUTS]; 59 + struct clk *pxtal; 60 + const char *pxtal_name; 61 + const u16 *reg_output_offset; 62 + const u16 *reg_rdiv_offset; 63 + u64 freq_vco; /* 13500–14256 MHz */ 64 + u8 num_outputs; 65 + u8 num_synth; 66 + }; 67 + #define to_clk_si5341(_hw) container_of(_hw, struct clk_si5341, hw) 68 + 69 + struct clk_si5341_output_config { 70 + u8 out_format_drv_bits; 71 + u8 out_cm_ampl_bits; 72 + bool synth_master; 73 + bool always_on; 74 + }; 75 + 76 + #define SI5341_PAGE 0x0001 77 + #define SI5341_PN_BASE 0x0002 78 + #define SI5341_DEVICE_REV 0x0005 79 + #define SI5341_STATUS 0x000C 80 + #define SI5341_SOFT_RST 0x001C 81 + 82 + /* Input dividers (48-bit) */ 83 + #define SI5341_IN_PDIV(x) (0x0208 + ((x) * 10)) 84 + #define SI5341_IN_PSET(x) (0x020E + ((x) * 10)) 85 + 86 + /* PLL configuration */ 87 + #define SI5341_PLL_M_NUM 0x0235 88 + #define SI5341_PLL_M_DEN 0x023B 89 + 90 + /* Output configuration */ 91 + #define SI5341_OUT_CONFIG(output) \ 92 + ((output)->data->reg_output_offset[(output)->index]) 93 + #define SI5341_OUT_FORMAT(output) (SI5341_OUT_CONFIG(output) + 1) 94 + #define SI5341_OUT_CM(output) (SI5341_OUT_CONFIG(output) + 2) 95 + #define SI5341_OUT_MUX_SEL(output) (SI5341_OUT_CONFIG(output) + 3) 96 + #define SI5341_OUT_R_REG(output) \ 97 + ((output)->data->reg_rdiv_offset[(output)->index]) 98 + 99 + /* Synthesize N divider */ 100 + #define SI5341_SYNTH_N_NUM(x) (0x0302 + ((x) * 11)) 101 + #define SI5341_SYNTH_N_DEN(x) (0x0308 + ((x) * 11)) 102 + #define SI5341_SYNTH_N_UPD(x) (0x030C + ((x) * 11)) 103 + 104 + /* Synthesizer output enable, phase bypass, power mode */ 105 + #define SI5341_SYNTH_N_CLK_TO_OUTX_EN 0x0A03 106 + #define SI5341_SYNTH_N_PIBYP 0x0A04 107 + #define SI5341_SYNTH_N_PDNB 0x0A05 108 + #define SI5341_SYNTH_N_CLK_DIS 0x0B4A 109 + 110 + #define SI5341_REGISTER_MAX 0xBFF 111 + 112 + /* SI5341_OUT_CONFIG bits */ 113 + #define SI5341_OUT_CFG_PDN BIT(0) 114 + #define SI5341_OUT_CFG_OE BIT(1) 115 + #define SI5341_OUT_CFG_RDIV_FORCE2 BIT(2) 116 + 117 + /* Static configuration (to be moved to firmware) */ 118 + struct si5341_reg_default { 119 + u16 address; 120 + u8 value; 121 + }; 122 + 123 + /* Output configuration registers 0..9 are not quite logically organized */ 124 + static const u16 si5341_reg_output_offset[] = { 125 + 0x0108, 126 + 0x010D, 127 + 0x0112, 128 + 0x0117, 129 + 0x011C, 130 + 0x0121, 131 + 0x0126, 132 + 0x012B, 133 + 0x0130, 134 + 0x013A, 135 + }; 136 + 137 + static const u16 si5340_reg_output_offset[] = { 138 + 0x0112, 139 + 0x0117, 140 + 0x0126, 141 + 0x012B, 142 + }; 143 + 144 + /* The location of the R divider registers */ 145 + static const u16 si5341_reg_rdiv_offset[] = { 146 + 0x024A, 147 + 0x024D, 148 + 0x0250, 149 + 0x0253, 150 + 0x0256, 151 + 0x0259, 152 + 0x025C, 153 + 0x025F, 154 + 0x0262, 155 + 0x0268, 156 + }; 157 + static const u16 si5340_reg_rdiv_offset[] = { 158 + 0x0250, 159 + 0x0253, 160 + 0x025C, 161 + 0x025F, 162 + }; 163 + 164 + /* 165 + * Programming sequence from ClockBuilder, settings to initialize the system 166 + * using only the XTAL input, without pre-divider. 167 + * This also contains settings that aren't mentioned anywhere in the datasheet. 168 + * The "known" settings like synth and output configuration are done later. 169 + */ 170 + static const struct si5341_reg_default si5341_reg_defaults[] = { 171 + { 0x0017, 0x3A }, /* INT mask (disable interrupts) */ 172 + { 0x0018, 0xFF }, /* INT mask */ 173 + { 0x0021, 0x0F }, /* Select XTAL as input */ 174 + { 0x0022, 0x00 }, /* Not in datasheet */ 175 + { 0x002B, 0x02 }, /* SPI config */ 176 + { 0x002C, 0x20 }, /* LOS enable for XTAL */ 177 + { 0x002D, 0x00 }, /* LOS timing */ 178 + { 0x002E, 0x00 }, 179 + { 0x002F, 0x00 }, 180 + { 0x0030, 0x00 }, 181 + { 0x0031, 0x00 }, 182 + { 0x0032, 0x00 }, 183 + { 0x0033, 0x00 }, 184 + { 0x0034, 0x00 }, 185 + { 0x0035, 0x00 }, 186 + { 0x0036, 0x00 }, 187 + { 0x0037, 0x00 }, 188 + { 0x0038, 0x00 }, /* LOS setting (thresholds) */ 189 + { 0x0039, 0x00 }, 190 + { 0x003A, 0x00 }, 191 + { 0x003B, 0x00 }, 192 + { 0x003C, 0x00 }, 193 + { 0x003D, 0x00 }, /* LOS setting (thresholds) end */ 194 + { 0x0041, 0x00 }, /* LOS0_DIV_SEL */ 195 + { 0x0042, 0x00 }, /* LOS1_DIV_SEL */ 196 + { 0x0043, 0x00 }, /* LOS2_DIV_SEL */ 197 + { 0x0044, 0x00 }, /* LOS3_DIV_SEL */ 198 + { 0x009E, 0x00 }, /* Not in datasheet */ 199 + { 0x0102, 0x01 }, /* Enable outputs */ 200 + { 0x013F, 0x00 }, /* Not in datasheet */ 201 + { 0x0140, 0x00 }, /* Not in datasheet */ 202 + { 0x0141, 0x40 }, /* OUT LOS */ 203 + { 0x0202, 0x00 }, /* XAXB_FREQ_OFFSET (=0)*/ 204 + { 0x0203, 0x00 }, 205 + { 0x0204, 0x00 }, 206 + { 0x0205, 0x00 }, 207 + { 0x0206, 0x00 }, /* PXAXB (2^x) */ 208 + { 0x0208, 0x00 }, /* Px divider setting (usually 0) */ 209 + { 0x0209, 0x00 }, 210 + { 0x020A, 0x00 }, 211 + { 0x020B, 0x00 }, 212 + { 0x020C, 0x00 }, 213 + { 0x020D, 0x00 }, 214 + { 0x020E, 0x00 }, 215 + { 0x020F, 0x00 }, 216 + { 0x0210, 0x00 }, 217 + { 0x0211, 0x00 }, 218 + { 0x0212, 0x00 }, 219 + { 0x0213, 0x00 }, 220 + { 0x0214, 0x00 }, 221 + { 0x0215, 0x00 }, 222 + { 0x0216, 0x00 }, 223 + { 0x0217, 0x00 }, 224 + { 0x0218, 0x00 }, 225 + { 0x0219, 0x00 }, 226 + { 0x021A, 0x00 }, 227 + { 0x021B, 0x00 }, 228 + { 0x021C, 0x00 }, 229 + { 0x021D, 0x00 }, 230 + { 0x021E, 0x00 }, 231 + { 0x021F, 0x00 }, 232 + { 0x0220, 0x00 }, 233 + { 0x0221, 0x00 }, 234 + { 0x0222, 0x00 }, 235 + { 0x0223, 0x00 }, 236 + { 0x0224, 0x00 }, 237 + { 0x0225, 0x00 }, 238 + { 0x0226, 0x00 }, 239 + { 0x0227, 0x00 }, 240 + { 0x0228, 0x00 }, 241 + { 0x0229, 0x00 }, 242 + { 0x022A, 0x00 }, 243 + { 0x022B, 0x00 }, 244 + { 0x022C, 0x00 }, 245 + { 0x022D, 0x00 }, 246 + { 0x022E, 0x00 }, 247 + { 0x022F, 0x00 }, /* Px divider setting (usually 0) end */ 248 + { 0x026B, 0x00 }, /* DESIGN_ID (ASCII string) */ 249 + { 0x026C, 0x00 }, 250 + { 0x026D, 0x00 }, 251 + { 0x026E, 0x00 }, 252 + { 0x026F, 0x00 }, 253 + { 0x0270, 0x00 }, 254 + { 0x0271, 0x00 }, 255 + { 0x0272, 0x00 }, /* DESIGN_ID (ASCII string) end */ 256 + { 0x0339, 0x1F }, /* N_FSTEP_MSK */ 257 + { 0x033B, 0x00 }, /* Nx_FSTEPW (Frequency step) */ 258 + { 0x033C, 0x00 }, 259 + { 0x033D, 0x00 }, 260 + { 0x033E, 0x00 }, 261 + { 0x033F, 0x00 }, 262 + { 0x0340, 0x00 }, 263 + { 0x0341, 0x00 }, 264 + { 0x0342, 0x00 }, 265 + { 0x0343, 0x00 }, 266 + { 0x0344, 0x00 }, 267 + { 0x0345, 0x00 }, 268 + { 0x0346, 0x00 }, 269 + { 0x0347, 0x00 }, 270 + { 0x0348, 0x00 }, 271 + { 0x0349, 0x00 }, 272 + { 0x034A, 0x00 }, 273 + { 0x034B, 0x00 }, 274 + { 0x034C, 0x00 }, 275 + { 0x034D, 0x00 }, 276 + { 0x034E, 0x00 }, 277 + { 0x034F, 0x00 }, 278 + { 0x0350, 0x00 }, 279 + { 0x0351, 0x00 }, 280 + { 0x0352, 0x00 }, 281 + { 0x0353, 0x00 }, 282 + { 0x0354, 0x00 }, 283 + { 0x0355, 0x00 }, 284 + { 0x0356, 0x00 }, 285 + { 0x0357, 0x00 }, 286 + { 0x0358, 0x00 }, /* Nx_FSTEPW (Frequency step) end */ 287 + { 0x0359, 0x00 }, /* Nx_DELAY */ 288 + { 0x035A, 0x00 }, 289 + { 0x035B, 0x00 }, 290 + { 0x035C, 0x00 }, 291 + { 0x035D, 0x00 }, 292 + { 0x035E, 0x00 }, 293 + { 0x035F, 0x00 }, 294 + { 0x0360, 0x00 }, 295 + { 0x0361, 0x00 }, 296 + { 0x0362, 0x00 }, /* Nx_DELAY end */ 297 + { 0x0802, 0x00 }, /* Not in datasheet */ 298 + { 0x0803, 0x00 }, /* Not in datasheet */ 299 + { 0x0804, 0x00 }, /* Not in datasheet */ 300 + { 0x090E, 0x02 }, /* XAXB_EXTCLK_EN=0 XAXB_PDNB=1 (use XTAL) */ 301 + { 0x091C, 0x04 }, /* ZDM_EN=4 (Normal mode) */ 302 + { 0x0943, 0x00 }, /* IO_VDD_SEL=0 (0=1v8, use 1=3v3) */ 303 + { 0x0949, 0x00 }, /* IN_EN (disable input clocks) */ 304 + { 0x094A, 0x00 }, /* INx_TO_PFD_EN (disabled) */ 305 + { 0x0A02, 0x00 }, /* Not in datasheet */ 306 + { 0x0B44, 0x0F }, /* PDIV_ENB (datasheet does not mention what it is) */ 307 + }; 308 + 309 + /* Read and interpret a 44-bit followed by a 32-bit value in the regmap */ 310 + static int si5341_decode_44_32(struct regmap *regmap, unsigned int reg, 311 + u64 *val1, u32 *val2) 312 + { 313 + int err; 314 + u8 r[10]; 315 + 316 + err = regmap_bulk_read(regmap, reg, r, 10); 317 + if (err < 0) 318 + return err; 319 + 320 + *val1 = ((u64)((r[5] & 0x0f) << 8 | r[4]) << 32) | 321 + (get_unaligned_le32(r)); 322 + *val2 = get_unaligned_le32(&r[6]); 323 + 324 + return 0; 325 + } 326 + 327 + static int si5341_encode_44_32(struct regmap *regmap, unsigned int reg, 328 + u64 n_num, u32 n_den) 329 + { 330 + u8 r[10]; 331 + 332 + /* Shift left as far as possible without overflowing */ 333 + while (!(n_num & BIT_ULL(43)) && !(n_den & BIT(31))) { 334 + n_num <<= 1; 335 + n_den <<= 1; 336 + } 337 + 338 + /* 44 bits (6 bytes) numerator */ 339 + put_unaligned_le32(n_num, r); 340 + r[4] = (n_num >> 32) & 0xff; 341 + r[5] = (n_num >> 40) & 0x0f; 342 + /* 32 bits denominator */ 343 + put_unaligned_le32(n_den, &r[6]); 344 + 345 + /* Program the fraction */ 346 + return regmap_bulk_write(regmap, reg, r, sizeof(r)); 347 + } 348 + 349 + /* VCO, we assume it runs at a constant frequency */ 350 + static unsigned long si5341_clk_recalc_rate(struct clk_hw *hw, 351 + unsigned long parent_rate) 352 + { 353 + struct clk_si5341 *data = to_clk_si5341(hw); 354 + int err; 355 + u64 res; 356 + u64 m_num; 357 + u32 m_den; 358 + unsigned int shift; 359 + 360 + /* Assume that PDIV is not being used, just read the PLL setting */ 361 + err = si5341_decode_44_32(data->regmap, SI5341_PLL_M_NUM, 362 + &m_num, &m_den); 363 + if (err < 0) 364 + return 0; 365 + 366 + if (!m_num || !m_den) 367 + return 0; 368 + 369 + /* 370 + * Though m_num is 64-bit, only the upper bits are actually used. While 371 + * calculating m_num and m_den, they are shifted as far as possible to 372 + * the left. To avoid 96-bit division here, we just shift them back so 373 + * we can do with just 64 bits. 374 + */ 375 + shift = 0; 376 + res = m_num; 377 + while (res & 0xffff00000000ULL) { 378 + ++shift; 379 + res >>= 1; 380 + } 381 + res *= parent_rate; 382 + do_div(res, (m_den >> shift)); 383 + 384 + /* We cannot return the actual frequency in 32 bit, store it locally */ 385 + data->freq_vco = res; 386 + 387 + /* Report kHz since the value is out of range */ 388 + do_div(res, 1000); 389 + 390 + return (unsigned long)res; 391 + } 392 + 393 + static const struct clk_ops si5341_clk_ops = { 394 + .recalc_rate = si5341_clk_recalc_rate, 395 + }; 396 + 397 + /* Synthesizers, there are 5 synthesizers that connect to any of the outputs */ 398 + 399 + /* The synthesizer is on if all power and enable bits are set */ 400 + static int si5341_synth_clk_is_on(struct clk_hw *hw) 401 + { 402 + struct clk_si5341_synth *synth = to_clk_si5341_synth(hw); 403 + int err; 404 + u32 val; 405 + u8 index = synth->index; 406 + 407 + err = regmap_read(synth->data->regmap, 408 + SI5341_SYNTH_N_CLK_TO_OUTX_EN, &val); 409 + if (err < 0) 410 + return 0; 411 + 412 + if (!(val & BIT(index))) 413 + return 0; 414 + 415 + err = regmap_read(synth->data->regmap, SI5341_SYNTH_N_PDNB, &val); 416 + if (err < 0) 417 + return 0; 418 + 419 + if (!(val & BIT(index))) 420 + return 0; 421 + 422 + /* This bit must be 0 for the synthesizer to receive clock input */ 423 + err = regmap_read(synth->data->regmap, SI5341_SYNTH_N_CLK_DIS, &val); 424 + if (err < 0) 425 + return 0; 426 + 427 + return !(val & BIT(index)); 428 + } 429 + 430 + static void si5341_synth_clk_unprepare(struct clk_hw *hw) 431 + { 432 + struct clk_si5341_synth *synth = to_clk_si5341_synth(hw); 433 + u8 index = synth->index; /* In range 0..5 */ 434 + u8 mask = BIT(index); 435 + 436 + /* Disable output */ 437 + regmap_update_bits(synth->data->regmap, 438 + SI5341_SYNTH_N_CLK_TO_OUTX_EN, mask, 0); 439 + /* Power down */ 440 + regmap_update_bits(synth->data->regmap, 441 + SI5341_SYNTH_N_PDNB, mask, 0); 442 + /* Disable clock input to synth (set to 1 to disable) */ 443 + regmap_update_bits(synth->data->regmap, 444 + SI5341_SYNTH_N_CLK_DIS, mask, mask); 445 + } 446 + 447 + static int si5341_synth_clk_prepare(struct clk_hw *hw) 448 + { 449 + struct clk_si5341_synth *synth = to_clk_si5341_synth(hw); 450 + int err; 451 + u8 index = synth->index; 452 + u8 mask = BIT(index); 453 + 454 + /* Power up */ 455 + err = regmap_update_bits(synth->data->regmap, 456 + SI5341_SYNTH_N_PDNB, mask, mask); 457 + if (err < 0) 458 + return err; 459 + 460 + /* Enable clock input to synth (set bit to 0 to enable) */ 461 + err = regmap_update_bits(synth->data->regmap, 462 + SI5341_SYNTH_N_CLK_DIS, mask, 0); 463 + if (err < 0) 464 + return err; 465 + 466 + /* Enable output */ 467 + return regmap_update_bits(synth->data->regmap, 468 + SI5341_SYNTH_N_CLK_TO_OUTX_EN, mask, mask); 469 + } 470 + 471 + /* Synth clock frequency: Fvco * n_den / n_den, with Fvco in 13500-14256 MHz */ 472 + static unsigned long si5341_synth_clk_recalc_rate(struct clk_hw *hw, 473 + unsigned long parent_rate) 474 + { 475 + struct clk_si5341_synth *synth = to_clk_si5341_synth(hw); 476 + u64 f; 477 + u64 n_num; 478 + u32 n_den; 479 + int err; 480 + 481 + err = si5341_decode_44_32(synth->data->regmap, 482 + SI5341_SYNTH_N_NUM(synth->index), &n_num, &n_den); 483 + if (err < 0) 484 + return err; 485 + 486 + /* 487 + * n_num and n_den are shifted left as much as possible, so to prevent 488 + * overflow in 64-bit math, we shift n_den 4 bits to the right 489 + */ 490 + f = synth->data->freq_vco; 491 + f *= n_den >> 4; 492 + 493 + /* Now we need to to 64-bit division: f/n_num */ 494 + /* And compensate for the 4 bits we dropped */ 495 + f = div64_u64(f, (n_num >> 4)); 496 + 497 + return f; 498 + } 499 + 500 + static long si5341_synth_clk_round_rate(struct clk_hw *hw, unsigned long rate, 501 + unsigned long *parent_rate) 502 + { 503 + struct clk_si5341_synth *synth = to_clk_si5341_synth(hw); 504 + u64 f; 505 + 506 + /* The synthesizer accuracy is such that anything in range will work */ 507 + f = synth->data->freq_vco; 508 + do_div(f, SI5341_SYNTH_N_MAX); 509 + if (rate < f) 510 + return f; 511 + 512 + f = synth->data->freq_vco; 513 + do_div(f, SI5341_SYNTH_N_MIN); 514 + if (rate > f) 515 + return f; 516 + 517 + return rate; 518 + } 519 + 520 + static int si5341_synth_program(struct clk_si5341_synth *synth, 521 + u64 n_num, u32 n_den, bool is_integer) 522 + { 523 + int err; 524 + u8 index = synth->index; 525 + 526 + err = si5341_encode_44_32(synth->data->regmap, 527 + SI5341_SYNTH_N_NUM(index), n_num, n_den); 528 + 529 + err = regmap_update_bits(synth->data->regmap, 530 + SI5341_SYNTH_N_PIBYP, BIT(index), is_integer ? BIT(index) : 0); 531 + if (err < 0) 532 + return err; 533 + 534 + return regmap_write(synth->data->regmap, 535 + SI5341_SYNTH_N_UPD(index), 0x01); 536 + } 537 + 538 + 539 + static int si5341_synth_clk_set_rate(struct clk_hw *hw, unsigned long rate, 540 + unsigned long parent_rate) 541 + { 542 + struct clk_si5341_synth *synth = to_clk_si5341_synth(hw); 543 + u64 n_num; 544 + u32 n_den; 545 + u32 r; 546 + u32 g; 547 + bool is_integer; 548 + 549 + n_num = synth->data->freq_vco; 550 + n_den = rate; 551 + 552 + /* see if there's an integer solution */ 553 + r = do_div(n_num, rate); 554 + is_integer = (r == 0); 555 + if (is_integer) { 556 + /* Integer divider equal to n_num */ 557 + n_den = 1; 558 + } else { 559 + /* Calculate a fractional solution */ 560 + g = gcd(r, rate); 561 + n_den = rate / g; 562 + n_num *= n_den; 563 + n_num += r / g; 564 + } 565 + 566 + dev_dbg(&synth->data->i2c_client->dev, 567 + "%s(%u): n=0x%llx d=0x%x %s\n", __func__, 568 + synth->index, n_num, n_den, 569 + is_integer ? "int" : "frac"); 570 + 571 + return si5341_synth_program(synth, n_num, n_den, is_integer); 572 + } 573 + 574 + static const struct clk_ops si5341_synth_clk_ops = { 575 + .is_prepared = si5341_synth_clk_is_on, 576 + .prepare = si5341_synth_clk_prepare, 577 + .unprepare = si5341_synth_clk_unprepare, 578 + .recalc_rate = si5341_synth_clk_recalc_rate, 579 + .round_rate = si5341_synth_clk_round_rate, 580 + .set_rate = si5341_synth_clk_set_rate, 581 + }; 582 + 583 + static int si5341_output_clk_is_on(struct clk_hw *hw) 584 + { 585 + struct clk_si5341_output *output = to_clk_si5341_output(hw); 586 + int err; 587 + u32 val; 588 + 589 + err = regmap_read(output->data->regmap, 590 + SI5341_OUT_CONFIG(output), &val); 591 + if (err < 0) 592 + return err; 593 + 594 + /* Bit 0=PDN, 1=OE so only a value of 0x2 enables the output */ 595 + return (val & 0x03) == SI5341_OUT_CFG_OE; 596 + } 597 + 598 + /* Disables and then powers down the output */ 599 + static void si5341_output_clk_unprepare(struct clk_hw *hw) 600 + { 601 + struct clk_si5341_output *output = to_clk_si5341_output(hw); 602 + 603 + regmap_update_bits(output->data->regmap, 604 + SI5341_OUT_CONFIG(output), 605 + SI5341_OUT_CFG_OE, 0); 606 + regmap_update_bits(output->data->regmap, 607 + SI5341_OUT_CONFIG(output), 608 + SI5341_OUT_CFG_PDN, SI5341_OUT_CFG_PDN); 609 + } 610 + 611 + /* Powers up and then enables the output */ 612 + static int si5341_output_clk_prepare(struct clk_hw *hw) 613 + { 614 + struct clk_si5341_output *output = to_clk_si5341_output(hw); 615 + int err; 616 + 617 + err = regmap_update_bits(output->data->regmap, 618 + SI5341_OUT_CONFIG(output), 619 + SI5341_OUT_CFG_PDN, 0); 620 + if (err < 0) 621 + return err; 622 + 623 + return regmap_update_bits(output->data->regmap, 624 + SI5341_OUT_CONFIG(output), 625 + SI5341_OUT_CFG_OE, SI5341_OUT_CFG_OE); 626 + } 627 + 628 + static unsigned long si5341_output_clk_recalc_rate(struct clk_hw *hw, 629 + unsigned long parent_rate) 630 + { 631 + struct clk_si5341_output *output = to_clk_si5341_output(hw); 632 + int err; 633 + u32 val; 634 + u32 r_divider; 635 + u8 r[3]; 636 + 637 + err = regmap_bulk_read(output->data->regmap, 638 + SI5341_OUT_R_REG(output), r, 3); 639 + if (err < 0) 640 + return err; 641 + 642 + /* Calculate value as 24-bit integer*/ 643 + r_divider = r[2] << 16 | r[1] << 8 | r[0]; 644 + 645 + /* If Rx_REG is zero, the divider is disabled, so return a "0" rate */ 646 + if (!r_divider) 647 + return 0; 648 + 649 + /* Divider is 2*(Rx_REG+1) */ 650 + r_divider += 1; 651 + r_divider <<= 1; 652 + 653 + err = regmap_read(output->data->regmap, 654 + SI5341_OUT_CONFIG(output), &val); 655 + if (err < 0) 656 + return err; 657 + 658 + if (val & SI5341_OUT_CFG_RDIV_FORCE2) 659 + r_divider = 2; 660 + 661 + return parent_rate / r_divider; 662 + } 663 + 664 + static long si5341_output_clk_round_rate(struct clk_hw *hw, unsigned long rate, 665 + unsigned long *parent_rate) 666 + { 667 + unsigned long r; 668 + 669 + r = *parent_rate >> 1; 670 + 671 + /* If rate is an even divisor, no changes to parent required */ 672 + if (r && !(r % rate)) 673 + return (long)rate; 674 + 675 + if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) { 676 + if (rate > 200000000) { 677 + /* minimum r-divider is 2 */ 678 + r = 2; 679 + } else { 680 + /* Take a parent frequency near 400 MHz */ 681 + r = (400000000u / rate) & ~1; 682 + } 683 + *parent_rate = r * rate; 684 + } else { 685 + /* We cannot change our parent's rate, report what we can do */ 686 + r /= rate; 687 + rate = *parent_rate / (r << 1); 688 + } 689 + 690 + return rate; 691 + } 692 + 693 + static int si5341_output_clk_set_rate(struct clk_hw *hw, unsigned long rate, 694 + unsigned long parent_rate) 695 + { 696 + struct clk_si5341_output *output = to_clk_si5341_output(hw); 697 + /* Frequency divider is (r_div + 1) * 2 */ 698 + u32 r_div = (parent_rate / rate) >> 1; 699 + int err; 700 + u8 r[3]; 701 + 702 + if (r_div <= 1) 703 + r_div = 0; 704 + else if (r_div >= BIT(24)) 705 + r_div = BIT(24) - 1; 706 + else 707 + --r_div; 708 + 709 + /* For a value of "2", we set the "OUT0_RDIV_FORCE2" bit */ 710 + err = regmap_update_bits(output->data->regmap, 711 + SI5341_OUT_CONFIG(output), 712 + SI5341_OUT_CFG_RDIV_FORCE2, 713 + (r_div == 0) ? SI5341_OUT_CFG_RDIV_FORCE2 : 0); 714 + if (err < 0) 715 + return err; 716 + 717 + /* Always write Rx_REG, because a zero value disables the divider */ 718 + r[0] = r_div ? (r_div & 0xff) : 1; 719 + r[1] = (r_div >> 8) & 0xff; 720 + r[2] = (r_div >> 16) & 0xff; 721 + err = regmap_bulk_write(output->data->regmap, 722 + SI5341_OUT_R_REG(output), r, 3); 723 + 724 + return 0; 725 + } 726 + 727 + static int si5341_output_reparent(struct clk_si5341_output *output, u8 index) 728 + { 729 + return regmap_update_bits(output->data->regmap, 730 + SI5341_OUT_MUX_SEL(output), 0x07, index); 731 + } 732 + 733 + static int si5341_output_set_parent(struct clk_hw *hw, u8 index) 734 + { 735 + struct clk_si5341_output *output = to_clk_si5341_output(hw); 736 + 737 + if (index >= output->data->num_synth) 738 + return -EINVAL; 739 + 740 + return si5341_output_reparent(output, index); 741 + } 742 + 743 + static u8 si5341_output_get_parent(struct clk_hw *hw) 744 + { 745 + struct clk_si5341_output *output = to_clk_si5341_output(hw); 746 + int err; 747 + u32 val; 748 + 749 + err = regmap_read(output->data->regmap, 750 + SI5341_OUT_MUX_SEL(output), &val); 751 + 752 + return val & 0x7; 753 + } 754 + 755 + static const struct clk_ops si5341_output_clk_ops = { 756 + .is_prepared = si5341_output_clk_is_on, 757 + .prepare = si5341_output_clk_prepare, 758 + .unprepare = si5341_output_clk_unprepare, 759 + .recalc_rate = si5341_output_clk_recalc_rate, 760 + .round_rate = si5341_output_clk_round_rate, 761 + .set_rate = si5341_output_clk_set_rate, 762 + .set_parent = si5341_output_set_parent, 763 + .get_parent = si5341_output_get_parent, 764 + }; 765 + 766 + /* 767 + * The chip can be bought in a pre-programmed version, or one can program the 768 + * NVM in the chip to boot up in a preset mode. This routine tries to determine 769 + * if that's the case, or if we need to reset and program everything from 770 + * scratch. Returns negative error, or true/false. 771 + */ 772 + static int si5341_is_programmed_already(struct clk_si5341 *data) 773 + { 774 + int err; 775 + u8 r[4]; 776 + 777 + /* Read the PLL divider value, it must have a non-zero value */ 778 + err = regmap_bulk_read(data->regmap, SI5341_PLL_M_DEN, 779 + r, ARRAY_SIZE(r)); 780 + if (err < 0) 781 + return err; 782 + 783 + return !!get_unaligned_le32(r); 784 + } 785 + 786 + static struct clk_hw * 787 + of_clk_si5341_get(struct of_phandle_args *clkspec, void *_data) 788 + { 789 + struct clk_si5341 *data = _data; 790 + unsigned int idx = clkspec->args[1]; 791 + unsigned int group = clkspec->args[0]; 792 + 793 + switch (group) { 794 + case 0: 795 + if (idx >= data->num_outputs) { 796 + dev_err(&data->i2c_client->dev, 797 + "invalid output index %u\n", idx); 798 + return ERR_PTR(-EINVAL); 799 + } 800 + return &data->clk[idx].hw; 801 + case 1: 802 + if (idx >= data->num_synth) { 803 + dev_err(&data->i2c_client->dev, 804 + "invalid synthesizer index %u\n", idx); 805 + return ERR_PTR(-EINVAL); 806 + } 807 + return &data->synth[idx].hw; 808 + case 2: 809 + if (idx > 0) { 810 + dev_err(&data->i2c_client->dev, 811 + "invalid PLL index %u\n", idx); 812 + return ERR_PTR(-EINVAL); 813 + } 814 + return &data->hw; 815 + default: 816 + dev_err(&data->i2c_client->dev, "invalid group %u\n", group); 817 + return ERR_PTR(-EINVAL); 818 + } 819 + } 820 + 821 + static int si5341_probe_chip_id(struct clk_si5341 *data) 822 + { 823 + int err; 824 + u8 reg[4]; 825 + u16 model; 826 + 827 + err = regmap_bulk_read(data->regmap, SI5341_PN_BASE, reg, 828 + ARRAY_SIZE(reg)); 829 + if (err < 0) { 830 + dev_err(&data->i2c_client->dev, "Failed to read chip ID\n"); 831 + return err; 832 + } 833 + 834 + model = get_unaligned_le16(reg); 835 + 836 + dev_info(&data->i2c_client->dev, "Chip: %x Grade: %u Rev: %u\n", 837 + model, reg[2], reg[3]); 838 + 839 + switch (model) { 840 + case 0x5340: 841 + data->num_outputs = SI5340_MAX_NUM_OUTPUTS; 842 + data->num_synth = SI5340_NUM_SYNTH; 843 + data->reg_output_offset = si5340_reg_output_offset; 844 + data->reg_rdiv_offset = si5340_reg_rdiv_offset; 845 + break; 846 + case 0x5341: 847 + data->num_outputs = SI5341_MAX_NUM_OUTPUTS; 848 + data->num_synth = SI5341_NUM_SYNTH; 849 + data->reg_output_offset = si5341_reg_output_offset; 850 + data->reg_rdiv_offset = si5341_reg_rdiv_offset; 851 + break; 852 + default: 853 + dev_err(&data->i2c_client->dev, "Model '%x' not supported\n", 854 + model); 855 + return -EINVAL; 856 + } 857 + 858 + return 0; 859 + } 860 + 861 + /* Read active settings into the regmap cache for later reference */ 862 + static int si5341_read_settings(struct clk_si5341 *data) 863 + { 864 + int err; 865 + u8 i; 866 + u8 r[10]; 867 + 868 + err = regmap_bulk_read(data->regmap, SI5341_PLL_M_NUM, r, 10); 869 + if (err < 0) 870 + return err; 871 + 872 + err = regmap_bulk_read(data->regmap, 873 + SI5341_SYNTH_N_CLK_TO_OUTX_EN, r, 3); 874 + if (err < 0) 875 + return err; 876 + 877 + err = regmap_bulk_read(data->regmap, 878 + SI5341_SYNTH_N_CLK_DIS, r, 1); 879 + if (err < 0) 880 + return err; 881 + 882 + for (i = 0; i < data->num_synth; ++i) { 883 + err = regmap_bulk_read(data->regmap, 884 + SI5341_SYNTH_N_NUM(i), r, 10); 885 + if (err < 0) 886 + return err; 887 + } 888 + 889 + for (i = 0; i < data->num_outputs; ++i) { 890 + err = regmap_bulk_read(data->regmap, 891 + data->reg_output_offset[i], r, 4); 892 + if (err < 0) 893 + return err; 894 + 895 + err = regmap_bulk_read(data->regmap, 896 + data->reg_rdiv_offset[i], r, 3); 897 + if (err < 0) 898 + return err; 899 + } 900 + 901 + return 0; 902 + } 903 + 904 + static int si5341_write_multiple(struct clk_si5341 *data, 905 + const struct si5341_reg_default *values, unsigned int num_values) 906 + { 907 + unsigned int i; 908 + int res; 909 + 910 + for (i = 0; i < num_values; ++i) { 911 + res = regmap_write(data->regmap, 912 + values[i].address, values[i].value); 913 + if (res < 0) { 914 + dev_err(&data->i2c_client->dev, 915 + "Failed to write %#x:%#x\n", 916 + values[i].address, values[i].value); 917 + return res; 918 + } 919 + } 920 + 921 + return 0; 922 + } 923 + 924 + static const struct si5341_reg_default si5341_preamble[] = { 925 + { 0x0B25, 0x00 }, 926 + { 0x0502, 0x01 }, 927 + { 0x0505, 0x03 }, 928 + { 0x0957, 0x1F }, 929 + { 0x0B4E, 0x1A }, 930 + }; 931 + 932 + static int si5341_send_preamble(struct clk_si5341 *data) 933 + { 934 + int res; 935 + u32 revision; 936 + 937 + /* For revision 2 and up, the values are slightly different */ 938 + res = regmap_read(data->regmap, SI5341_DEVICE_REV, &revision); 939 + if (res < 0) 940 + return res; 941 + 942 + /* Write "preamble" as specified by datasheet */ 943 + res = regmap_write(data->regmap, 0xB24, revision < 2 ? 0xD8 : 0xC0); 944 + if (res < 0) 945 + return res; 946 + res = si5341_write_multiple(data, 947 + si5341_preamble, ARRAY_SIZE(si5341_preamble)); 948 + if (res < 0) 949 + return res; 950 + 951 + /* Datasheet specifies a 300ms wait after sending the preamble */ 952 + msleep(300); 953 + 954 + return 0; 955 + } 956 + 957 + /* Perform a soft reset and write post-amble */ 958 + static int si5341_finalize_defaults(struct clk_si5341 *data) 959 + { 960 + int res; 961 + u32 revision; 962 + 963 + res = regmap_read(data->regmap, SI5341_DEVICE_REV, &revision); 964 + if (res < 0) 965 + return res; 966 + 967 + dev_dbg(&data->i2c_client->dev, "%s rev=%u\n", __func__, revision); 968 + 969 + res = regmap_write(data->regmap, SI5341_SOFT_RST, 0x01); 970 + if (res < 0) 971 + return res; 972 + 973 + /* Datasheet does not explain these nameless registers */ 974 + res = regmap_write(data->regmap, 0xB24, revision < 2 ? 0xDB : 0xC3); 975 + if (res < 0) 976 + return res; 977 + res = regmap_write(data->regmap, 0x0B25, 0x02); 978 + if (res < 0) 979 + return res; 980 + 981 + return 0; 982 + } 983 + 984 + 985 + static const struct regmap_range si5341_regmap_volatile_range[] = { 986 + regmap_reg_range(0x000C, 0x0012), /* Status */ 987 + regmap_reg_range(0x001C, 0x001E), /* reset, finc/fdec */ 988 + regmap_reg_range(0x00E2, 0x00FE), /* NVM, interrupts, device ready */ 989 + /* Update bits for synth config */ 990 + regmap_reg_range(SI5341_SYNTH_N_UPD(0), SI5341_SYNTH_N_UPD(0)), 991 + regmap_reg_range(SI5341_SYNTH_N_UPD(1), SI5341_SYNTH_N_UPD(1)), 992 + regmap_reg_range(SI5341_SYNTH_N_UPD(2), SI5341_SYNTH_N_UPD(2)), 993 + regmap_reg_range(SI5341_SYNTH_N_UPD(3), SI5341_SYNTH_N_UPD(3)), 994 + regmap_reg_range(SI5341_SYNTH_N_UPD(4), SI5341_SYNTH_N_UPD(4)), 995 + }; 996 + 997 + static const struct regmap_access_table si5341_regmap_volatile = { 998 + .yes_ranges = si5341_regmap_volatile_range, 999 + .n_yes_ranges = ARRAY_SIZE(si5341_regmap_volatile_range), 1000 + }; 1001 + 1002 + /* Pages 0, 1, 2, 3, 9, A, B are valid, so there are 12 pages */ 1003 + static const struct regmap_range_cfg si5341_regmap_ranges[] = { 1004 + { 1005 + .range_min = 0, 1006 + .range_max = SI5341_REGISTER_MAX, 1007 + .selector_reg = SI5341_PAGE, 1008 + .selector_mask = 0xff, 1009 + .selector_shift = 0, 1010 + .window_start = 0, 1011 + .window_len = 256, 1012 + }, 1013 + }; 1014 + 1015 + static const struct regmap_config si5341_regmap_config = { 1016 + .reg_bits = 8, 1017 + .val_bits = 8, 1018 + .cache_type = REGCACHE_RBTREE, 1019 + .ranges = si5341_regmap_ranges, 1020 + .num_ranges = ARRAY_SIZE(si5341_regmap_ranges), 1021 + .max_register = SI5341_REGISTER_MAX, 1022 + .volatile_table = &si5341_regmap_volatile, 1023 + }; 1024 + 1025 + static int si5341_dt_parse_dt(struct i2c_client *client, 1026 + struct clk_si5341_output_config *config) 1027 + { 1028 + struct device_node *child; 1029 + struct device_node *np = client->dev.of_node; 1030 + u32 num; 1031 + u32 val; 1032 + 1033 + memset(config, 0, sizeof(struct clk_si5341_output_config) * 1034 + SI5341_MAX_NUM_OUTPUTS); 1035 + 1036 + for_each_child_of_node(np, child) { 1037 + if (of_property_read_u32(child, "reg", &num)) { 1038 + dev_err(&client->dev, "missing reg property of %s\n", 1039 + child->name); 1040 + goto put_child; 1041 + } 1042 + 1043 + if (num >= SI5341_MAX_NUM_OUTPUTS) { 1044 + dev_err(&client->dev, "invalid clkout %d\n", num); 1045 + goto put_child; 1046 + } 1047 + 1048 + if (!of_property_read_u32(child, "silabs,format", &val)) { 1049 + /* Set cm and ampl conservatively to 3v3 settings */ 1050 + switch (val) { 1051 + case 1: /* normal differential */ 1052 + config[num].out_cm_ampl_bits = 0x33; 1053 + break; 1054 + case 2: /* low-power differential */ 1055 + config[num].out_cm_ampl_bits = 0x13; 1056 + break; 1057 + case 4: /* LVCMOS */ 1058 + config[num].out_cm_ampl_bits = 0x33; 1059 + /* Set SI recommended impedance for LVCMOS */ 1060 + config[num].out_format_drv_bits |= 0xc0; 1061 + break; 1062 + default: 1063 + dev_err(&client->dev, 1064 + "invalid silabs,format %u for %u\n", 1065 + val, num); 1066 + goto put_child; 1067 + } 1068 + config[num].out_format_drv_bits &= ~0x07; 1069 + config[num].out_format_drv_bits |= val & 0x07; 1070 + /* Always enable the SYNC feature */ 1071 + config[num].out_format_drv_bits |= 0x08; 1072 + } 1073 + 1074 + if (!of_property_read_u32(child, "silabs,common-mode", &val)) { 1075 + if (val > 0xf) { 1076 + dev_err(&client->dev, 1077 + "invalid silabs,common-mode %u\n", 1078 + val); 1079 + goto put_child; 1080 + } 1081 + config[num].out_cm_ampl_bits &= 0xf0; 1082 + config[num].out_cm_ampl_bits |= val & 0x0f; 1083 + } 1084 + 1085 + if (!of_property_read_u32(child, "silabs,amplitude", &val)) { 1086 + if (val > 0xf) { 1087 + dev_err(&client->dev, 1088 + "invalid silabs,amplitude %u\n", 1089 + val); 1090 + goto put_child; 1091 + } 1092 + config[num].out_cm_ampl_bits &= 0x0f; 1093 + config[num].out_cm_ampl_bits |= (val << 4) & 0xf0; 1094 + } 1095 + 1096 + if (of_property_read_bool(child, "silabs,disable-high")) 1097 + config[num].out_format_drv_bits |= 0x10; 1098 + 1099 + config[num].synth_master = 1100 + of_property_read_bool(child, "silabs,synth-master"); 1101 + 1102 + config[num].always_on = 1103 + of_property_read_bool(child, "always-on"); 1104 + } 1105 + 1106 + return 0; 1107 + 1108 + put_child: 1109 + of_node_put(child); 1110 + return -EINVAL; 1111 + } 1112 + 1113 + /* 1114 + * If not pre-configured, calculate and set the PLL configuration manually. 1115 + * For low-jitter performance, the PLL should be set such that the synthesizers 1116 + * only need integer division. 1117 + * Without any user guidance, we'll set the PLL to 14GHz, which still allows 1118 + * the chip to generate any frequency on its outputs, but jitter performance 1119 + * may be sub-optimal. 1120 + */ 1121 + static int si5341_initialize_pll(struct clk_si5341 *data) 1122 + { 1123 + struct device_node *np = data->i2c_client->dev.of_node; 1124 + u32 m_num = 0; 1125 + u32 m_den = 0; 1126 + 1127 + if (of_property_read_u32(np, "silabs,pll-m-num", &m_num)) { 1128 + dev_err(&data->i2c_client->dev, 1129 + "PLL configuration requires silabs,pll-m-num\n"); 1130 + } 1131 + if (of_property_read_u32(np, "silabs,pll-m-den", &m_den)) { 1132 + dev_err(&data->i2c_client->dev, 1133 + "PLL configuration requires silabs,pll-m-den\n"); 1134 + } 1135 + 1136 + if (!m_num || !m_den) { 1137 + dev_err(&data->i2c_client->dev, 1138 + "PLL configuration invalid, assume 14GHz\n"); 1139 + m_den = clk_get_rate(data->pxtal) / 10; 1140 + m_num = 1400000000; 1141 + } 1142 + 1143 + return si5341_encode_44_32(data->regmap, 1144 + SI5341_PLL_M_NUM, m_num, m_den); 1145 + } 1146 + 1147 + static int si5341_probe(struct i2c_client *client, 1148 + const struct i2c_device_id *id) 1149 + { 1150 + struct clk_si5341 *data; 1151 + struct clk_init_data init; 1152 + const char *root_clock_name; 1153 + const char *synth_clock_names[SI5341_NUM_SYNTH]; 1154 + int err; 1155 + unsigned int i; 1156 + struct clk_si5341_output_config config[SI5341_MAX_NUM_OUTPUTS]; 1157 + bool initialization_required; 1158 + 1159 + data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); 1160 + if (!data) 1161 + return -ENOMEM; 1162 + 1163 + data->i2c_client = client; 1164 + 1165 + data->pxtal = devm_clk_get(&client->dev, "xtal"); 1166 + if (IS_ERR(data->pxtal)) { 1167 + if (PTR_ERR(data->pxtal) == -EPROBE_DEFER) 1168 + return -EPROBE_DEFER; 1169 + 1170 + dev_err(&client->dev, "Missing xtal clock input\n"); 1171 + } 1172 + 1173 + err = si5341_dt_parse_dt(client, config); 1174 + if (err) 1175 + return err; 1176 + 1177 + if (of_property_read_string(client->dev.of_node, "clock-output-names", 1178 + &init.name)) 1179 + init.name = client->dev.of_node->name; 1180 + root_clock_name = init.name; 1181 + 1182 + data->regmap = devm_regmap_init_i2c(client, &si5341_regmap_config); 1183 + if (IS_ERR(data->regmap)) 1184 + return PTR_ERR(data->regmap); 1185 + 1186 + i2c_set_clientdata(client, data); 1187 + 1188 + err = si5341_probe_chip_id(data); 1189 + if (err < 0) 1190 + return err; 1191 + 1192 + /* "Activate" the xtal (usually a fixed clock) */ 1193 + clk_prepare_enable(data->pxtal); 1194 + 1195 + if (of_property_read_bool(client->dev.of_node, "silabs,reprogram")) { 1196 + initialization_required = true; 1197 + } else { 1198 + err = si5341_is_programmed_already(data); 1199 + if (err < 0) 1200 + return err; 1201 + 1202 + initialization_required = !err; 1203 + } 1204 + 1205 + if (initialization_required) { 1206 + /* Populate the regmap cache in preparation for "cache only" */ 1207 + err = si5341_read_settings(data); 1208 + if (err < 0) 1209 + return err; 1210 + 1211 + err = si5341_send_preamble(data); 1212 + if (err < 0) 1213 + return err; 1214 + 1215 + /* 1216 + * We intend to send all 'final' register values in a single 1217 + * transaction. So cache all register writes until we're done 1218 + * configuring. 1219 + */ 1220 + regcache_cache_only(data->regmap, true); 1221 + 1222 + /* Write the configuration pairs from the firmware blob */ 1223 + err = si5341_write_multiple(data, si5341_reg_defaults, 1224 + ARRAY_SIZE(si5341_reg_defaults)); 1225 + if (err < 0) 1226 + return err; 1227 + 1228 + /* PLL configuration is required */ 1229 + err = si5341_initialize_pll(data); 1230 + if (err < 0) 1231 + return err; 1232 + } 1233 + 1234 + /* Register the PLL */ 1235 + data->pxtal_name = __clk_get_name(data->pxtal); 1236 + init.parent_names = &data->pxtal_name; 1237 + init.num_parents = 1; /* For now, only XTAL input supported */ 1238 + init.ops = &si5341_clk_ops; 1239 + init.flags = 0; 1240 + data->hw.init = &init; 1241 + 1242 + err = devm_clk_hw_register(&client->dev, &data->hw); 1243 + if (err) { 1244 + dev_err(&client->dev, "clock registration failed\n"); 1245 + return err; 1246 + } 1247 + 1248 + init.num_parents = 1; 1249 + init.parent_names = &root_clock_name; 1250 + init.ops = &si5341_synth_clk_ops; 1251 + for (i = 0; i < data->num_synth; ++i) { 1252 + synth_clock_names[i] = devm_kasprintf(&client->dev, GFP_KERNEL, 1253 + "%s.N%u", client->dev.of_node->name, i); 1254 + init.name = synth_clock_names[i]; 1255 + data->synth[i].index = i; 1256 + data->synth[i].data = data; 1257 + data->synth[i].hw.init = &init; 1258 + err = devm_clk_hw_register(&client->dev, &data->synth[i].hw); 1259 + if (err) { 1260 + dev_err(&client->dev, 1261 + "synth N%u registration failed\n", i); 1262 + } 1263 + } 1264 + 1265 + init.num_parents = data->num_synth; 1266 + init.parent_names = synth_clock_names; 1267 + init.ops = &si5341_output_clk_ops; 1268 + for (i = 0; i < data->num_outputs; ++i) { 1269 + init.name = kasprintf(GFP_KERNEL, "%s.%d", 1270 + client->dev.of_node->name, i); 1271 + init.flags = config[i].synth_master ? CLK_SET_RATE_PARENT : 0; 1272 + data->clk[i].index = i; 1273 + data->clk[i].data = data; 1274 + data->clk[i].hw.init = &init; 1275 + if (config[i].out_format_drv_bits & 0x07) { 1276 + regmap_write(data->regmap, 1277 + SI5341_OUT_FORMAT(&data->clk[i]), 1278 + config[i].out_format_drv_bits); 1279 + regmap_write(data->regmap, 1280 + SI5341_OUT_CM(&data->clk[i]), 1281 + config[i].out_cm_ampl_bits); 1282 + } 1283 + err = devm_clk_hw_register(&client->dev, &data->clk[i].hw); 1284 + kfree(init.name); /* clock framework made a copy of the name */ 1285 + if (err) { 1286 + dev_err(&client->dev, 1287 + "output %u registration failed\n", i); 1288 + return err; 1289 + } 1290 + if (config[i].always_on) 1291 + clk_prepare(data->clk[i].hw.clk); 1292 + } 1293 + 1294 + err = of_clk_add_hw_provider(client->dev.of_node, of_clk_si5341_get, 1295 + data); 1296 + if (err) { 1297 + dev_err(&client->dev, "unable to add clk provider\n"); 1298 + return err; 1299 + } 1300 + 1301 + if (initialization_required) { 1302 + /* Synchronize */ 1303 + regcache_cache_only(data->regmap, false); 1304 + err = regcache_sync(data->regmap); 1305 + if (err < 0) 1306 + return err; 1307 + 1308 + err = si5341_finalize_defaults(data); 1309 + if (err < 0) 1310 + return err; 1311 + } 1312 + 1313 + /* Free the names, clk framework makes copies */ 1314 + for (i = 0; i < data->num_synth; ++i) 1315 + devm_kfree(&client->dev, (void *)synth_clock_names[i]); 1316 + 1317 + return 0; 1318 + } 1319 + 1320 + static const struct i2c_device_id si5341_id[] = { 1321 + { "si5340", 0 }, 1322 + { "si5341", 1 }, 1323 + { } 1324 + }; 1325 + MODULE_DEVICE_TABLE(i2c, si5341_id); 1326 + 1327 + static const struct of_device_id clk_si5341_of_match[] = { 1328 + { .compatible = "silabs,si5340" }, 1329 + { .compatible = "silabs,si5341" }, 1330 + { } 1331 + }; 1332 + MODULE_DEVICE_TABLE(of, clk_si5341_of_match); 1333 + 1334 + static struct i2c_driver si5341_driver = { 1335 + .driver = { 1336 + .name = "si5341", 1337 + .of_match_table = clk_si5341_of_match, 1338 + }, 1339 + .probe = si5341_probe, 1340 + .id_table = si5341_id, 1341 + }; 1342 + module_i2c_driver(si5341_driver); 1343 + 1344 + MODULE_AUTHOR("Mike Looijmans <mike.looijmans@topic.nl>"); 1345 + MODULE_DESCRIPTION("Si5341 driver"); 1346 + MODULE_LICENSE("GPL");
+93 -11
drivers/clk/clk-si544.c
··· 7 7 8 8 #include <linux/clk-provider.h> 9 9 #include <linux/delay.h> 10 + #include <linux/math64.h> 10 11 #include <linux/module.h> 11 12 #include <linux/i2c.h> 12 13 #include <linux/regmap.h> ··· 51 50 /* Lowest frequency synthesizeable using only the HS divider */ 52 51 #define MIN_HSDIV_FREQ (FVCO_MIN / HS_DIV_MAX) 53 52 53 + /* Range and interpretation of the adjustment value */ 54 + #define DELTA_M_MAX 8161512 55 + #define DELTA_M_FRAC_NUM 19 56 + #define DELTA_M_FRAC_DEN 20000 57 + 54 58 enum si544_speed_grade { 55 59 si544a, 56 60 si544b, ··· 77 71 * @hs_div: 1st divider, 5..2046, must be even when >33 78 72 * @ls_div_bits: 2nd divider, as 2^x, range 0..5 79 73 * If ls_div_bits is non-zero, hs_div must be even 74 + * @delta_m: Frequency shift for small -950..+950 ppm changes, 24 bit 80 75 */ 81 76 struct clk_si544_muldiv { 82 77 u32 fb_div_frac; 83 78 u16 fb_div_int; 84 79 u16 hs_div; 85 80 u8 ls_div_bits; 81 + s32 delta_m; 86 82 }; 87 83 88 84 /* Enables or disables the output driver */ ··· 142 134 settings->fb_div_int = reg[4] | (reg[5] & 0x07) << 8; 143 135 settings->fb_div_frac = reg[0] | reg[1] << 8 | reg[2] << 16 | 144 136 reg[3] << 24; 137 + 138 + err = regmap_bulk_read(data->regmap, SI544_REG_ADPLL_DELTA_M0, reg, 3); 139 + if (err) 140 + return err; 141 + 142 + /* Interpret as 24-bit signed number */ 143 + settings->delta_m = reg[0] << 8 | reg[1] << 16 | reg[2] << 24; 144 + settings->delta_m >>= 8; 145 + 145 146 return 0; 147 + } 148 + 149 + static int si544_set_delta_m(struct clk_si544 *data, s32 delta_m) 150 + { 151 + u8 reg[3]; 152 + 153 + reg[0] = delta_m; 154 + reg[1] = delta_m >> 8; 155 + reg[2] = delta_m >> 16; 156 + 157 + return regmap_bulk_write(data->regmap, SI544_REG_ADPLL_DELTA_M0, 158 + reg, 3); 146 159 } 147 160 148 161 static int si544_set_muldiv(struct clk_si544 *data, ··· 267 238 do_div(vco, FXO); 268 239 settings->fb_div_frac = vco; 269 240 241 + /* Reset the frequency adjustment */ 242 + settings->delta_m = 0; 243 + 270 244 return 0; 271 245 } 272 246 273 247 /* Calculate resulting frequency given the register settings */ 274 - static unsigned long si544_calc_rate(struct clk_si544_muldiv *settings) 248 + static unsigned long si544_calc_center_rate( 249 + const struct clk_si544_muldiv *settings) 275 250 { 276 251 u32 d = settings->hs_div * BIT(settings->ls_div_bits); 277 252 u64 vco; ··· 292 259 do_div(vco, d); 293 260 294 261 return vco; 262 + } 263 + 264 + static unsigned long si544_calc_rate(const struct clk_si544_muldiv *settings) 265 + { 266 + unsigned long rate = si544_calc_center_rate(settings); 267 + s64 delta = (s64)rate * (DELTA_M_FRAC_NUM * settings->delta_m); 268 + 269 + /* 270 + * The clock adjustment is much smaller than 1 Hz, round to the 271 + * nearest multiple. Apparently div64_s64 rounds towards zero, hence 272 + * check the sign and adjust into the proper direction. 273 + */ 274 + if (settings->delta_m < 0) 275 + delta -= ((s64)DELTA_M_MAX * DELTA_M_FRAC_DEN) / 2; 276 + else 277 + delta += ((s64)DELTA_M_MAX * DELTA_M_FRAC_DEN) / 2; 278 + delta = div64_s64(delta, ((s64)DELTA_M_MAX * DELTA_M_FRAC_DEN)); 279 + 280 + return rate + delta; 295 281 } 296 282 297 283 static unsigned long si544_recalc_rate(struct clk_hw *hw, ··· 331 279 unsigned long *parent_rate) 332 280 { 333 281 struct clk_si544 *data = to_clk_si544(hw); 334 - struct clk_si544_muldiv settings; 335 - int err; 336 282 337 283 if (!is_valid_frequency(data, rate)) 338 284 return -EINVAL; 339 285 340 - err = si544_calc_muldiv(&settings, rate); 341 - if (err) 342 - return err; 343 - 344 - return si544_calc_rate(&settings); 286 + /* The accuracy is less than 1 Hz, so any rate is possible */ 287 + return rate; 345 288 } 346 289 347 - /* 348 - * Update output frequency for "big" frequency changes 349 - */ 290 + /* Calculates the maximum "small" change, 950 * rate / 1000000 */ 291 + static unsigned long si544_max_delta(unsigned long rate) 292 + { 293 + u64 num = rate; 294 + 295 + num *= DELTA_M_FRAC_NUM; 296 + do_div(num, DELTA_M_FRAC_DEN); 297 + 298 + return num; 299 + } 300 + 301 + static s32 si544_calc_delta(s32 delta, s32 max_delta) 302 + { 303 + s64 n = (s64)delta * DELTA_M_MAX; 304 + 305 + return div_s64(n, max_delta); 306 + } 307 + 350 308 static int si544_set_rate(struct clk_hw *hw, unsigned long rate, 351 309 unsigned long parent_rate) 352 310 { 353 311 struct clk_si544 *data = to_clk_si544(hw); 354 312 struct clk_si544_muldiv settings; 313 + unsigned long center; 314 + long max_delta; 315 + long delta; 355 316 unsigned int old_oe_state; 356 317 int err; 357 318 358 319 if (!is_valid_frequency(data, rate)) 359 320 return -EINVAL; 360 321 322 + /* Try using the frequency adjustment feature for a <= 950ppm change */ 323 + err = si544_get_muldiv(data, &settings); 324 + if (err) 325 + return err; 326 + 327 + center = si544_calc_center_rate(&settings); 328 + max_delta = si544_max_delta(center); 329 + delta = rate - center; 330 + 331 + if (abs(delta) <= max_delta) 332 + return si544_set_delta_m(data, 333 + si544_calc_delta(delta, max_delta)); 334 + 335 + /* Too big for the delta adjustment, need to reprogram */ 361 336 err = si544_calc_muldiv(&settings, rate); 362 337 if (err) 363 338 return err; ··· 400 321 if (err < 0) 401 322 return err; 402 323 324 + err = si544_set_delta_m(data, settings.delta_m); 325 + if (err < 0) 326 + return err; 403 327 404 328 err = si544_set_muldiv(data, &settings); 405 329 if (err < 0)
+55 -8
drivers/clk/clk.c
··· 1324 1324 1325 1325 static bool clk_core_can_round(struct clk_core * const core) 1326 1326 { 1327 - if (core->ops->determine_rate || core->ops->round_rate) 1328 - return true; 1329 - 1330 - return false; 1327 + return core->ops->determine_rate || core->ops->round_rate; 1331 1328 } 1332 1329 1333 1330 static int clk_core_round_rate_nolock(struct clk_core *core, ··· 2191 2194 EXPORT_SYMBOL_GPL(clk_set_rate); 2192 2195 2193 2196 /** 2194 - * clk_set_rate_exclusive - specify a new rate get exclusive control 2197 + * clk_set_rate_exclusive - specify a new rate and get exclusive control 2195 2198 * @clk: the clk whose rate is being changed 2196 2199 * @rate: the new rate for clk 2197 2200 * ··· 2199 2202 * within a critical section 2200 2203 * 2201 2204 * This can be used initially to ensure that at least 1 consumer is 2202 - * statisfied when several consumers are competing for exclusivity over the 2205 + * satisfied when several consumers are competing for exclusivity over the 2203 2206 * same clock provider. 2204 2207 * 2205 2208 * The exclusivity is not applied if setting the rate failed. ··· 2994 2997 } 2995 2998 DEFINE_SHOW_ATTRIBUTE(clk_flags); 2996 2999 3000 + static void possible_parent_show(struct seq_file *s, struct clk_core *core, 3001 + unsigned int i, char terminator) 3002 + { 3003 + struct clk_core *parent; 3004 + 3005 + /* 3006 + * Go through the following options to fetch a parent's name. 3007 + * 3008 + * 1. Fetch the registered parent clock and use its name 3009 + * 2. Use the global (fallback) name if specified 3010 + * 3. Use the local fw_name if provided 3011 + * 4. Fetch parent clock's clock-output-name if DT index was set 3012 + * 3013 + * This may still fail in some cases, such as when the parent is 3014 + * specified directly via a struct clk_hw pointer, but it isn't 3015 + * registered (yet). 3016 + */ 3017 + parent = clk_core_get_parent_by_index(core, i); 3018 + if (parent) 3019 + seq_printf(s, "%s", parent->name); 3020 + else if (core->parents[i].name) 3021 + seq_printf(s, "%s", core->parents[i].name); 3022 + else if (core->parents[i].fw_name) 3023 + seq_printf(s, "<%s>(fw)", core->parents[i].fw_name); 3024 + else if (core->parents[i].index >= 0) 3025 + seq_printf(s, "%s", 3026 + of_clk_get_parent_name(core->of_node, 3027 + core->parents[i].index)); 3028 + else 3029 + seq_puts(s, "(missing)"); 3030 + 3031 + seq_putc(s, terminator); 3032 + } 3033 + 2997 3034 static int possible_parents_show(struct seq_file *s, void *data) 2998 3035 { 2999 3036 struct clk_core *core = s->private; 3000 3037 int i; 3001 3038 3002 3039 for (i = 0; i < core->num_parents - 1; i++) 3003 - seq_printf(s, "%s ", core->parents[i].name); 3040 + possible_parent_show(s, core, i, ' '); 3004 3041 3005 - seq_printf(s, "%s\n", core->parents[i].name); 3042 + possible_parent_show(s, core, i, '\n'); 3006 3043 3007 3044 return 0; 3008 3045 } 3009 3046 DEFINE_SHOW_ATTRIBUTE(possible_parents); 3047 + 3048 + static int current_parent_show(struct seq_file *s, void *data) 3049 + { 3050 + struct clk_core *core = s->private; 3051 + 3052 + if (core->parent) 3053 + seq_printf(s, "%s\n", core->parent->name); 3054 + 3055 + return 0; 3056 + } 3057 + DEFINE_SHOW_ATTRIBUTE(current_parent); 3010 3058 3011 3059 static int clk_duty_cycle_show(struct seq_file *s, void *data) 3012 3060 { ··· 3084 3042 debugfs_create_u32("clk_notifier_count", 0444, root, &core->notifier_count); 3085 3043 debugfs_create_file("clk_duty_cycle", 0444, root, core, 3086 3044 &clk_duty_cycle_fops); 3045 + 3046 + if (core->num_parents > 0) 3047 + debugfs_create_file("clk_parent", 0444, root, core, 3048 + &current_parent_fops); 3087 3049 3088 3050 if (core->num_parents > 1) 3089 3051 debugfs_create_file("clk_possible_parents", 0444, root, core, ··· 4084 4038 void *data; 4085 4039 }; 4086 4040 4041 + extern struct of_device_id __clk_of_table; 4087 4042 static const struct of_device_id __clk_of_table_sentinel 4088 4043 __used __section(__clk_of_table_end); 4089 4044
-4
drivers/clk/clk.h
··· 33 33 { 34 34 return (struct clk *)hw; 35 35 } 36 - static struct clk_hw *__clk_get_hw(struct clk *clk) 37 - { 38 - return (struct clk_hw *)clk; 39 - } 40 36 static inline void __clk_put(struct clk *clk) { } 41 37 42 38 #endif
+22 -12
drivers/clk/imx/clk-busy.c
··· 72 72 .set_rate = clk_busy_divider_set_rate, 73 73 }; 74 74 75 - struct clk *imx_clk_busy_divider(const char *name, const char *parent_name, 75 + struct clk_hw *imx_clk_hw_busy_divider(const char *name, const char *parent_name, 76 76 void __iomem *reg, u8 shift, u8 width, 77 77 void __iomem *busy_reg, u8 busy_shift) 78 78 { 79 79 struct clk_busy_divider *busy; 80 - struct clk *clk; 80 + struct clk_hw *hw; 81 81 struct clk_init_data init; 82 + int ret; 82 83 83 84 busy = kzalloc(sizeof(*busy), GFP_KERNEL); 84 85 if (!busy) ··· 102 101 103 102 busy->div.hw.init = &init; 104 103 105 - clk = clk_register(NULL, &busy->div.hw); 106 - if (IS_ERR(clk)) 107 - kfree(busy); 104 + hw = &busy->div.hw; 108 105 109 - return clk; 106 + ret = clk_hw_register(NULL, hw); 107 + if (ret) { 108 + kfree(busy); 109 + return ERR_PTR(ret); 110 + } 111 + 112 + return hw; 110 113 } 111 114 112 115 struct clk_busy_mux { ··· 151 146 .set_parent = clk_busy_mux_set_parent, 152 147 }; 153 148 154 - struct clk *imx_clk_busy_mux(const char *name, void __iomem *reg, u8 shift, 149 + struct clk_hw *imx_clk_hw_busy_mux(const char *name, void __iomem *reg, u8 shift, 155 150 u8 width, void __iomem *busy_reg, u8 busy_shift, 156 151 const char * const *parent_names, int num_parents) 157 152 { 158 153 struct clk_busy_mux *busy; 159 - struct clk *clk; 154 + struct clk_hw *hw; 160 155 struct clk_init_data init; 156 + int ret; 161 157 162 158 busy = kzalloc(sizeof(*busy), GFP_KERNEL); 163 159 if (!busy) ··· 181 175 182 176 busy->mux.hw.init = &init; 183 177 184 - clk = clk_register(NULL, &busy->mux.hw); 185 - if (IS_ERR(clk)) 186 - kfree(busy); 178 + hw = &busy->mux.hw; 187 179 188 - return clk; 180 + ret = clk_hw_register(NULL, hw); 181 + if (ret) { 182 + kfree(busy); 183 + return ERR_PTR(ret); 184 + } 185 + 186 + return hw; 189 187 }
+9 -5
drivers/clk/imx/clk-cpu.c
··· 69 69 .set_rate = clk_cpu_set_rate, 70 70 }; 71 71 72 - struct clk *imx_clk_cpu(const char *name, const char *parent_name, 72 + struct clk_hw *imx_clk_hw_cpu(const char *name, const char *parent_name, 73 73 struct clk *div, struct clk *mux, struct clk *pll, 74 74 struct clk *step) 75 75 { 76 76 struct clk_cpu *cpu; 77 - struct clk *clk; 77 + struct clk_hw *hw; 78 78 struct clk_init_data init; 79 + int ret; 79 80 80 81 cpu = kzalloc(sizeof(*cpu), GFP_KERNEL); 81 82 if (!cpu) ··· 94 93 init.num_parents = 1; 95 94 96 95 cpu->hw.init = &init; 96 + hw = &cpu->hw; 97 97 98 - clk = clk_register(NULL, &cpu->hw); 99 - if (IS_ERR(clk)) 98 + ret = clk_hw_register(NULL, hw); 99 + if (ret) { 100 100 kfree(cpu); 101 + return ERR_PTR(ret); 102 + } 101 103 102 - return clk; 104 + return hw; 103 105 }
+11 -6
drivers/clk/imx/clk-fixup-div.c
··· 85 85 .set_rate = clk_fixup_div_set_rate, 86 86 }; 87 87 88 - struct clk *imx_clk_fixup_divider(const char *name, const char *parent, 88 + struct clk_hw *imx_clk_hw_fixup_divider(const char *name, const char *parent, 89 89 void __iomem *reg, u8 shift, u8 width, 90 90 void (*fixup)(u32 *val)) 91 91 { 92 92 struct clk_fixup_div *fixup_div; 93 - struct clk *clk; 93 + struct clk_hw *hw; 94 94 struct clk_init_data init; 95 + int ret; 95 96 96 97 if (!fixup) 97 98 return ERR_PTR(-EINVAL); ··· 115 114 fixup_div->ops = &clk_divider_ops; 116 115 fixup_div->fixup = fixup; 117 116 118 - clk = clk_register(NULL, &fixup_div->divider.hw); 119 - if (IS_ERR(clk)) 120 - kfree(fixup_div); 117 + hw = &fixup_div->divider.hw; 121 118 122 - return clk; 119 + ret = clk_hw_register(NULL, hw); 120 + if (ret) { 121 + kfree(fixup_div); 122 + return ERR_PTR(ret); 123 + } 124 + 125 + return hw; 123 126 }
+11 -6
drivers/clk/imx/clk-fixup-mux.c
··· 63 63 .set_parent = clk_fixup_mux_set_parent, 64 64 }; 65 65 66 - struct clk *imx_clk_fixup_mux(const char *name, void __iomem *reg, 66 + struct clk_hw *imx_clk_hw_fixup_mux(const char *name, void __iomem *reg, 67 67 u8 shift, u8 width, const char * const *parents, 68 68 int num_parents, void (*fixup)(u32 *val)) 69 69 { 70 70 struct clk_fixup_mux *fixup_mux; 71 - struct clk *clk; 71 + struct clk_hw *hw; 72 72 struct clk_init_data init; 73 + int ret; 73 74 74 75 if (!fixup) 75 76 return ERR_PTR(-EINVAL); ··· 93 92 fixup_mux->ops = &clk_mux_ops; 94 93 fixup_mux->fixup = fixup; 95 94 96 - clk = clk_register(NULL, &fixup_mux->mux.hw); 97 - if (IS_ERR(clk)) 98 - kfree(fixup_mux); 95 + hw = &fixup_mux->mux.hw; 99 96 100 - return clk; 97 + ret = clk_hw_register(NULL, hw); 98 + if (ret) { 99 + kfree(fixup_mux); 100 + return ERR_PTR(ret); 101 + } 102 + 103 + return hw; 101 104 }
+11 -6
drivers/clk/imx/clk-gate-exclusive.c
··· 55 55 .is_enabled = clk_gate_exclusive_is_enabled, 56 56 }; 57 57 58 - struct clk *imx_clk_gate_exclusive(const char *name, const char *parent, 58 + struct clk_hw *imx_clk_hw_gate_exclusive(const char *name, const char *parent, 59 59 void __iomem *reg, u8 shift, u32 exclusive_mask) 60 60 { 61 61 struct clk_gate_exclusive *exgate; 62 62 struct clk_gate *gate; 63 - struct clk *clk; 63 + struct clk_hw *hw; 64 64 struct clk_init_data init; 65 + int ret; 65 66 66 67 if (exclusive_mask == 0) 67 68 return ERR_PTR(-EINVAL); ··· 84 83 gate->hw.init = &init; 85 84 exgate->exclusive_mask = exclusive_mask; 86 85 87 - clk = clk_register(NULL, &gate->hw); 88 - if (IS_ERR(clk)) 89 - kfree(exgate); 86 + hw = &gate->hw; 90 87 91 - return clk; 88 + ret = clk_hw_register(NULL, hw); 89 + if (ret) { 90 + kfree(gate); 91 + return ERR_PTR(ret); 92 + } 93 + 94 + return hw; 92 95 }
+9 -5
drivers/clk/imx/clk-gate2.c
··· 122 122 .is_enabled = clk_gate2_is_enabled, 123 123 }; 124 124 125 - struct clk *clk_register_gate2(struct device *dev, const char *name, 125 + struct clk_hw *clk_hw_register_gate2(struct device *dev, const char *name, 126 126 const char *parent_name, unsigned long flags, 127 127 void __iomem *reg, u8 bit_idx, u8 cgr_val, 128 128 u8 clk_gate2_flags, spinlock_t *lock, 129 129 unsigned int *share_count) 130 130 { 131 131 struct clk_gate2 *gate; 132 - struct clk *clk; 132 + struct clk_hw *hw; 133 133 struct clk_init_data init; 134 + int ret; 134 135 135 136 gate = kzalloc(sizeof(struct clk_gate2), GFP_KERNEL); 136 137 if (!gate) ··· 152 151 init.num_parents = parent_name ? 1 : 0; 153 152 154 153 gate->hw.init = &init; 154 + hw = &gate->hw; 155 155 156 - clk = clk_register(dev, &gate->hw); 157 - if (IS_ERR(clk)) 156 + ret = clk_hw_register(NULL, hw); 157 + if (ret) { 158 158 kfree(gate); 159 + return ERR_PTR(ret); 160 + } 159 161 160 - return clk; 162 + return hw; 161 163 }
+393 -385
drivers/clk/imx/clk-imx6q.c
··· 8 8 #include <linux/types.h> 9 9 #include <linux/clk.h> 10 10 #include <linux/clkdev.h> 11 + #include <linux/clk-provider.h> 11 12 #include <linux/err.h> 12 13 #include <linux/io.h> 13 14 #include <linux/of.h> ··· 88 87 static const char *pll6_bypass_sels[] = { "pll6", "pll6_bypass_src", }; 89 88 static const char *pll7_bypass_sels[] = { "pll7", "pll7_bypass_src", }; 90 89 91 - static struct clk *clk[IMX6QDL_CLK_END]; 92 - static struct clk_onecell_data clk_data; 90 + static struct clk_hw **hws; 91 + static struct clk_hw_onecell_data *clk_hw_data; 93 92 94 93 static struct clk_div_table clk_enet_ref_table[] = { 95 94 { .val = 0, .div = 20, }, ··· 139 138 return of_machine_is_compatible("fsl,imx6dl"); 140 139 } 141 140 142 - static struct clk ** const uart_clks[] __initconst = { 143 - &clk[IMX6QDL_CLK_UART_IPG], 144 - &clk[IMX6QDL_CLK_UART_SERIAL], 145 - NULL 141 + static const int uart_clk_ids[] __initconst = { 142 + IMX6QDL_CLK_UART_IPG, 143 + IMX6QDL_CLK_UART_SERIAL, 146 144 }; 145 + 146 + static struct clk **uart_clks[ARRAY_SIZE(uart_clk_ids) + 1] __initdata; 147 147 148 148 static int ldb_di_sel_by_clock_id(int clock_id) 149 149 { ··· 256 254 return false; 257 255 } 258 256 259 - #define CCM_CCDR 0x04 260 257 #define CCM_CCSR 0x0c 261 258 #define CCM_CS2CDR 0x2c 262 259 263 - #define CCDR_MMDC_CH1_MASK BIT(16) 264 260 #define CCSR_PLL3_SW_CLK_SEL BIT(0) 265 261 266 262 #define CS2CDR_LDB_DI0_CLK_SEL_SHIFT 9 267 263 #define CS2CDR_LDB_DI1_CLK_SEL_SHIFT 12 268 - 269 - static void __init imx6q_mmdc_ch1_mask_handshake(void __iomem *ccm_base) 270 - { 271 - unsigned int reg; 272 - 273 - reg = readl_relaxed(ccm_base + CCM_CCDR); 274 - reg |= CCDR_MMDC_CH1_MASK; 275 - writel_relaxed(reg, ccm_base + CCM_CCDR); 276 - } 277 264 278 265 /* 279 266 * The only way to disable the MMDC_CH1 clock is to move it to pll3_sw_clk ··· 273 282 { 274 283 unsigned int reg; 275 284 276 - clk_set_parent(clk[IMX6QDL_CLK_PERIPH2_CLK2_SEL], 277 - clk[IMX6QDL_CLK_PLL3_USB_OTG]); 278 - 279 - /* 280 - * Handshake with mmdc_ch1 module must be masked when changing 281 - * periph2_clk_sel. 282 - */ 283 - clk_set_parent(clk[IMX6QDL_CLK_PERIPH2], clk[IMX6QDL_CLK_PERIPH2_CLK2]); 285 + clk_set_parent(hws[IMX6QDL_CLK_PERIPH2_CLK2_SEL]->clk, 286 + hws[IMX6QDL_CLK_PLL3_USB_OTG]->clk); 284 287 285 288 /* Disable pll3_sw_clk by selecting the bypass clock source */ 286 289 reg = readl_relaxed(ccm_base + CCM_CCSR); ··· 290 305 reg = readl_relaxed(ccm_base + CCM_CCSR); 291 306 reg &= ~CCSR_PLL3_SW_CLK_SEL; 292 307 writel_relaxed(reg, ccm_base + CCM_CCSR); 293 - 294 - clk_set_parent(clk[IMX6QDL_CLK_PERIPH2], clk[IMX6QDL_CLK_PERIPH2_PRE]); 295 308 } 296 309 297 310 /* ··· 348 365 349 366 /* Only switch to or from pll2_pfd2_396m if it is disabled */ 350 367 if ((sel[i][0] == 2 || sel[i][3] == 2) && 351 - (clk_get_parent(clk[IMX6QDL_CLK_PERIPH_PRE]) == 352 - clk[IMX6QDL_CLK_PLL2_PFD2_396M])) { 368 + (clk_get_parent(hws[IMX6QDL_CLK_PERIPH_PRE]->clk) == 369 + hws[IMX6QDL_CLK_PLL2_PFD2_396M]->clk)) { 353 370 pr_err("ccm: ldb_di%d_sel: couldn't disable pll2_pfd2_396m\n", 354 371 i); 355 372 sel[i][3] = sel[i][2] = sel[i][1] = sel[i][0]; ··· 401 418 /* Make sure PLL2 PFDs 0-2 are gated */ 402 419 reg = readl_relaxed(anatop_base + CCM_ANALOG_PFD_528); 403 420 /* Cannot gate PFD2 if pll2_pfd2_396m is the parent of MMDC clock */ 404 - if (clk_get_parent(clk[IMX6QDL_CLK_PERIPH_PRE]) == 405 - clk[IMX6QDL_CLK_PLL2_PFD2_396M]) 421 + if (clk_get_parent(hws[IMX6QDL_CLK_PERIPH_PRE]->clk) == 422 + hws[IMX6QDL_CLK_PLL2_PFD2_396M]->clk) 406 423 reg |= PFD0_CLKGATE | PFD1_CLKGATE; 407 424 else 408 425 reg |= PFD0_CLKGATE | PFD1_CLKGATE | PFD2_CLKGATE; ··· 419 436 writel_relaxed(reg, anatop_base + CCM_ANALOG_PLL_VIDEO); 420 437 } 421 438 439 + static struct clk_hw * __init imx6q_obtain_fixed_clk_hw(struct device_node *np, 440 + const char *name, 441 + unsigned long rate) 442 + { 443 + struct clk *clk = of_clk_get_by_name(np, name); 444 + struct clk_hw *hw; 445 + 446 + if (IS_ERR(clk)) 447 + hw = imx_obtain_fixed_clock_hw(name, rate); 448 + else 449 + hw = __clk_get_hw(clk); 450 + 451 + return hw; 452 + } 453 + 422 454 static void __init imx6q_clocks_init(struct device_node *ccm_node) 423 455 { 424 456 struct device_node *np; 425 457 void __iomem *anatop_base, *base; 426 458 int ret; 459 + int i; 427 460 428 - clk[IMX6QDL_CLK_DUMMY] = imx_clk_fixed("dummy", 0); 429 - clk[IMX6QDL_CLK_CKIL] = of_clk_get_by_name(ccm_node, "ckil"); 430 - if (IS_ERR(clk[IMX6QDL_CLK_CKIL])) 431 - clk[IMX6QDL_CLK_CKIL] = imx_obtain_fixed_clock("ckil", 0); 432 - clk[IMX6QDL_CLK_CKIH] = of_clk_get_by_name(ccm_node, "ckih1"); 433 - if (IS_ERR(clk[IMX6QDL_CLK_CKIH])) 434 - clk[IMX6QDL_CLK_CKIH] = imx_obtain_fixed_clock("ckih1", 0); 435 - clk[IMX6QDL_CLK_OSC] = of_clk_get_by_name(ccm_node, "osc"); 436 - if (IS_ERR(clk[IMX6QDL_CLK_OSC])) 437 - clk[IMX6QDL_CLK_OSC] = imx_obtain_fixed_clock("osc", 0); 461 + clk_hw_data = kzalloc(struct_size(clk_hw_data, hws, 462 + IMX6QDL_CLK_END), GFP_KERNEL); 463 + if (WARN_ON(!clk_hw_data)) 464 + return; 465 + 466 + clk_hw_data->num = IMX6QDL_CLK_END; 467 + hws = clk_hw_data->hws; 468 + 469 + hws[IMX6QDL_CLK_DUMMY] = imx_clk_hw_fixed("dummy", 0); 470 + 471 + hws[IMX6QDL_CLK_CKIL] = imx6q_obtain_fixed_clk_hw(ccm_node, "ckil", 0); 472 + hws[IMX6QDL_CLK_CKIH] = imx6q_obtain_fixed_clk_hw(ccm_node, "ckih1", 0); 473 + hws[IMX6QDL_CLK_OSC] = imx6q_obtain_fixed_clk_hw(ccm_node, "osc", 0); 438 474 439 475 /* Clock source from external clock via CLK1/2 PADs */ 440 - clk[IMX6QDL_CLK_ANACLK1] = of_clk_get_by_name(ccm_node, "anaclk1"); 441 - if (IS_ERR(clk[IMX6QDL_CLK_ANACLK1])) 442 - clk[IMX6QDL_CLK_ANACLK1] = imx_obtain_fixed_clock("anaclk1", 0); 443 - 444 - clk[IMX6QDL_CLK_ANACLK2] = of_clk_get_by_name(ccm_node, "anaclk2"); 445 - if (IS_ERR(clk[IMX6QDL_CLK_ANACLK2])) 446 - clk[IMX6QDL_CLK_ANACLK2] = imx_obtain_fixed_clock("anaclk2", 0); 476 + hws[IMX6QDL_CLK_ANACLK1] = imx6q_obtain_fixed_clk_hw(ccm_node, "anaclk1", 0); 477 + hws[IMX6QDL_CLK_ANACLK2] = imx6q_obtain_fixed_clk_hw(ccm_node, "anaclk2", 0); 447 478 448 479 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop"); 449 480 anatop_base = base = of_iomap(np, 0); ··· 472 475 video_div_table[3].div = 1; 473 476 } 474 477 475 - clk[IMX6QDL_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", base + 0x00, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 476 - clk[IMX6QDL_PLL2_BYPASS_SRC] = imx_clk_mux("pll2_bypass_src", base + 0x30, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 477 - clk[IMX6QDL_PLL3_BYPASS_SRC] = imx_clk_mux("pll3_bypass_src", base + 0x10, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 478 - clk[IMX6QDL_PLL4_BYPASS_SRC] = imx_clk_mux("pll4_bypass_src", base + 0x70, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 479 - clk[IMX6QDL_PLL5_BYPASS_SRC] = imx_clk_mux("pll5_bypass_src", base + 0xa0, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 480 - clk[IMX6QDL_PLL6_BYPASS_SRC] = imx_clk_mux("pll6_bypass_src", base + 0xe0, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 481 - clk[IMX6QDL_PLL7_BYPASS_SRC] = imx_clk_mux("pll7_bypass_src", base + 0x20, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 478 + hws[IMX6QDL_PLL1_BYPASS_SRC] = imx_clk_hw_mux("pll1_bypass_src", base + 0x00, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 479 + hws[IMX6QDL_PLL2_BYPASS_SRC] = imx_clk_hw_mux("pll2_bypass_src", base + 0x30, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 480 + hws[IMX6QDL_PLL3_BYPASS_SRC] = imx_clk_hw_mux("pll3_bypass_src", base + 0x10, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 481 + hws[IMX6QDL_PLL4_BYPASS_SRC] = imx_clk_hw_mux("pll4_bypass_src", base + 0x70, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 482 + hws[IMX6QDL_PLL5_BYPASS_SRC] = imx_clk_hw_mux("pll5_bypass_src", base + 0xa0, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 483 + hws[IMX6QDL_PLL6_BYPASS_SRC] = imx_clk_hw_mux("pll6_bypass_src", base + 0xe0, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 484 + hws[IMX6QDL_PLL7_BYPASS_SRC] = imx_clk_hw_mux("pll7_bypass_src", base + 0x20, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 482 485 483 486 /* type name parent_name base div_mask */ 484 - clk[IMX6QDL_CLK_PLL1] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1", "osc", base + 0x00, 0x7f); 485 - clk[IMX6QDL_CLK_PLL2] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2", "osc", base + 0x30, 0x1); 486 - clk[IMX6QDL_CLK_PLL3] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3", "osc", base + 0x10, 0x3); 487 - clk[IMX6QDL_CLK_PLL4] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4", "osc", base + 0x70, 0x7f); 488 - clk[IMX6QDL_CLK_PLL5] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5", "osc", base + 0xa0, 0x7f); 489 - clk[IMX6QDL_CLK_PLL6] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll6", "osc", base + 0xe0, 0x3); 490 - clk[IMX6QDL_CLK_PLL7] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7", "osc", base + 0x20, 0x3); 487 + hws[IMX6QDL_CLK_PLL1] = imx_clk_hw_pllv3(IMX_PLLV3_SYS, "pll1", "osc", base + 0x00, 0x7f); 488 + hws[IMX6QDL_CLK_PLL2] = imx_clk_hw_pllv3(IMX_PLLV3_GENERIC, "pll2", "osc", base + 0x30, 0x1); 489 + hws[IMX6QDL_CLK_PLL3] = imx_clk_hw_pllv3(IMX_PLLV3_USB, "pll3", "osc", base + 0x10, 0x3); 490 + hws[IMX6QDL_CLK_PLL4] = imx_clk_hw_pllv3(IMX_PLLV3_AV, "pll4", "osc", base + 0x70, 0x7f); 491 + hws[IMX6QDL_CLK_PLL5] = imx_clk_hw_pllv3(IMX_PLLV3_AV, "pll5", "osc", base + 0xa0, 0x7f); 492 + hws[IMX6QDL_CLK_PLL6] = imx_clk_hw_pllv3(IMX_PLLV3_ENET, "pll6", "osc", base + 0xe0, 0x3); 493 + hws[IMX6QDL_CLK_PLL7] = imx_clk_hw_pllv3(IMX_PLLV3_USB, "pll7", "osc", base + 0x20, 0x3); 491 494 492 - clk[IMX6QDL_PLL1_BYPASS] = imx_clk_mux_flags("pll1_bypass", base + 0x00, 16, 1, pll1_bypass_sels, ARRAY_SIZE(pll1_bypass_sels), CLK_SET_RATE_PARENT); 493 - clk[IMX6QDL_PLL2_BYPASS] = imx_clk_mux_flags("pll2_bypass", base + 0x30, 16, 1, pll2_bypass_sels, ARRAY_SIZE(pll2_bypass_sels), CLK_SET_RATE_PARENT); 494 - clk[IMX6QDL_PLL3_BYPASS] = imx_clk_mux_flags("pll3_bypass", base + 0x10, 16, 1, pll3_bypass_sels, ARRAY_SIZE(pll3_bypass_sels), CLK_SET_RATE_PARENT); 495 - clk[IMX6QDL_PLL4_BYPASS] = imx_clk_mux_flags("pll4_bypass", base + 0x70, 16, 1, pll4_bypass_sels, ARRAY_SIZE(pll4_bypass_sels), CLK_SET_RATE_PARENT); 496 - clk[IMX6QDL_PLL5_BYPASS] = imx_clk_mux_flags("pll5_bypass", base + 0xa0, 16, 1, pll5_bypass_sels, ARRAY_SIZE(pll5_bypass_sels), CLK_SET_RATE_PARENT); 497 - clk[IMX6QDL_PLL6_BYPASS] = imx_clk_mux_flags("pll6_bypass", base + 0xe0, 16, 1, pll6_bypass_sels, ARRAY_SIZE(pll6_bypass_sels), CLK_SET_RATE_PARENT); 498 - clk[IMX6QDL_PLL7_BYPASS] = imx_clk_mux_flags("pll7_bypass", base + 0x20, 16, 1, pll7_bypass_sels, ARRAY_SIZE(pll7_bypass_sels), CLK_SET_RATE_PARENT); 495 + hws[IMX6QDL_PLL1_BYPASS] = imx_clk_hw_mux_flags("pll1_bypass", base + 0x00, 16, 1, pll1_bypass_sels, ARRAY_SIZE(pll1_bypass_sels), CLK_SET_RATE_PARENT); 496 + hws[IMX6QDL_PLL2_BYPASS] = imx_clk_hw_mux_flags("pll2_bypass", base + 0x30, 16, 1, pll2_bypass_sels, ARRAY_SIZE(pll2_bypass_sels), CLK_SET_RATE_PARENT); 497 + hws[IMX6QDL_PLL3_BYPASS] = imx_clk_hw_mux_flags("pll3_bypass", base + 0x10, 16, 1, pll3_bypass_sels, ARRAY_SIZE(pll3_bypass_sels), CLK_SET_RATE_PARENT); 498 + hws[IMX6QDL_PLL4_BYPASS] = imx_clk_hw_mux_flags("pll4_bypass", base + 0x70, 16, 1, pll4_bypass_sels, ARRAY_SIZE(pll4_bypass_sels), CLK_SET_RATE_PARENT); 499 + hws[IMX6QDL_PLL5_BYPASS] = imx_clk_hw_mux_flags("pll5_bypass", base + 0xa0, 16, 1, pll5_bypass_sels, ARRAY_SIZE(pll5_bypass_sels), CLK_SET_RATE_PARENT); 500 + hws[IMX6QDL_PLL6_BYPASS] = imx_clk_hw_mux_flags("pll6_bypass", base + 0xe0, 16, 1, pll6_bypass_sels, ARRAY_SIZE(pll6_bypass_sels), CLK_SET_RATE_PARENT); 501 + hws[IMX6QDL_PLL7_BYPASS] = imx_clk_hw_mux_flags("pll7_bypass", base + 0x20, 16, 1, pll7_bypass_sels, ARRAY_SIZE(pll7_bypass_sels), CLK_SET_RATE_PARENT); 499 502 500 503 /* Do not bypass PLLs initially */ 501 - clk_set_parent(clk[IMX6QDL_PLL1_BYPASS], clk[IMX6QDL_CLK_PLL1]); 502 - clk_set_parent(clk[IMX6QDL_PLL2_BYPASS], clk[IMX6QDL_CLK_PLL2]); 503 - clk_set_parent(clk[IMX6QDL_PLL3_BYPASS], clk[IMX6QDL_CLK_PLL3]); 504 - clk_set_parent(clk[IMX6QDL_PLL4_BYPASS], clk[IMX6QDL_CLK_PLL4]); 505 - clk_set_parent(clk[IMX6QDL_PLL5_BYPASS], clk[IMX6QDL_CLK_PLL5]); 506 - clk_set_parent(clk[IMX6QDL_PLL6_BYPASS], clk[IMX6QDL_CLK_PLL6]); 507 - clk_set_parent(clk[IMX6QDL_PLL7_BYPASS], clk[IMX6QDL_CLK_PLL7]); 504 + clk_set_parent(hws[IMX6QDL_PLL1_BYPASS]->clk, hws[IMX6QDL_CLK_PLL1]->clk); 505 + clk_set_parent(hws[IMX6QDL_PLL2_BYPASS]->clk, hws[IMX6QDL_CLK_PLL2]->clk); 506 + clk_set_parent(hws[IMX6QDL_PLL3_BYPASS]->clk, hws[IMX6QDL_CLK_PLL3]->clk); 507 + clk_set_parent(hws[IMX6QDL_PLL4_BYPASS]->clk, hws[IMX6QDL_CLK_PLL4]->clk); 508 + clk_set_parent(hws[IMX6QDL_PLL5_BYPASS]->clk, hws[IMX6QDL_CLK_PLL5]->clk); 509 + clk_set_parent(hws[IMX6QDL_PLL6_BYPASS]->clk, hws[IMX6QDL_CLK_PLL6]->clk); 510 + clk_set_parent(hws[IMX6QDL_PLL7_BYPASS]->clk, hws[IMX6QDL_CLK_PLL7]->clk); 508 511 509 - clk[IMX6QDL_CLK_PLL1_SYS] = imx_clk_gate("pll1_sys", "pll1_bypass", base + 0x00, 13); 510 - clk[IMX6QDL_CLK_PLL2_BUS] = imx_clk_gate("pll2_bus", "pll2_bypass", base + 0x30, 13); 511 - clk[IMX6QDL_CLK_PLL3_USB_OTG] = imx_clk_gate("pll3_usb_otg", "pll3_bypass", base + 0x10, 13); 512 - clk[IMX6QDL_CLK_PLL4_AUDIO] = imx_clk_gate("pll4_audio", "pll4_bypass", base + 0x70, 13); 513 - clk[IMX6QDL_CLK_PLL5_VIDEO] = imx_clk_gate("pll5_video", "pll5_bypass", base + 0xa0, 13); 514 - clk[IMX6QDL_CLK_PLL6_ENET] = imx_clk_gate("pll6_enet", "pll6_bypass", base + 0xe0, 13); 515 - clk[IMX6QDL_CLK_PLL7_USB_HOST] = imx_clk_gate("pll7_usb_host", "pll7_bypass", base + 0x20, 13); 512 + hws[IMX6QDL_CLK_PLL1_SYS] = imx_clk_hw_gate("pll1_sys", "pll1_bypass", base + 0x00, 13); 513 + hws[IMX6QDL_CLK_PLL2_BUS] = imx_clk_hw_gate("pll2_bus", "pll2_bypass", base + 0x30, 13); 514 + hws[IMX6QDL_CLK_PLL3_USB_OTG] = imx_clk_hw_gate("pll3_usb_otg", "pll3_bypass", base + 0x10, 13); 515 + hws[IMX6QDL_CLK_PLL4_AUDIO] = imx_clk_hw_gate("pll4_audio", "pll4_bypass", base + 0x70, 13); 516 + hws[IMX6QDL_CLK_PLL5_VIDEO] = imx_clk_hw_gate("pll5_video", "pll5_bypass", base + 0xa0, 13); 517 + hws[IMX6QDL_CLK_PLL6_ENET] = imx_clk_hw_gate("pll6_enet", "pll6_bypass", base + 0xe0, 13); 518 + hws[IMX6QDL_CLK_PLL7_USB_HOST] = imx_clk_hw_gate("pll7_usb_host", "pll7_bypass", base + 0x20, 13); 516 519 517 520 /* 518 521 * Bit 20 is the reserved and read-only bit, we do this only for: ··· 520 523 * - Keep refcount when do usbphy clk_enable/disable, in that case, 521 524 * the clk framework may need to enable/disable usbphy's parent 522 525 */ 523 - clk[IMX6QDL_CLK_USBPHY1] = imx_clk_gate("usbphy1", "pll3_usb_otg", base + 0x10, 20); 524 - clk[IMX6QDL_CLK_USBPHY2] = imx_clk_gate("usbphy2", "pll7_usb_host", base + 0x20, 20); 526 + hws[IMX6QDL_CLK_USBPHY1] = imx_clk_hw_gate("usbphy1", "pll3_usb_otg", base + 0x10, 20); 527 + hws[IMX6QDL_CLK_USBPHY2] = imx_clk_hw_gate("usbphy2", "pll7_usb_host", base + 0x20, 20); 525 528 526 529 /* 527 530 * usbphy*_gate needs to be on after system boots up, and software 528 531 * never needs to control it anymore. 529 532 */ 530 - clk[IMX6QDL_CLK_USBPHY1_GATE] = imx_clk_gate("usbphy1_gate", "dummy", base + 0x10, 6); 531 - clk[IMX6QDL_CLK_USBPHY2_GATE] = imx_clk_gate("usbphy2_gate", "dummy", base + 0x20, 6); 533 + hws[IMX6QDL_CLK_USBPHY1_GATE] = imx_clk_hw_gate("usbphy1_gate", "dummy", base + 0x10, 6); 534 + hws[IMX6QDL_CLK_USBPHY2_GATE] = imx_clk_hw_gate("usbphy2_gate", "dummy", base + 0x20, 6); 532 535 533 536 /* 534 537 * The ENET PLL is special in that is has multiple outputs with ··· 542 545 * 543 546 */ 544 547 if (!pll6_bypassed(ccm_node)) { 545 - clk[IMX6QDL_CLK_SATA_REF] = imx_clk_fixed_factor("sata_ref", "pll6_enet", 1, 5); 546 - clk[IMX6QDL_CLK_PCIE_REF] = imx_clk_fixed_factor("pcie_ref", "pll6_enet", 1, 4); 547 - clk[IMX6QDL_CLK_ENET_REF] = clk_register_divider_table(NULL, "enet_ref", "pll6_enet", 0, 548 + hws[IMX6QDL_CLK_SATA_REF] = imx_clk_hw_fixed_factor("sata_ref", "pll6_enet", 1, 5); 549 + hws[IMX6QDL_CLK_PCIE_REF] = imx_clk_hw_fixed_factor("pcie_ref", "pll6_enet", 1, 4); 550 + hws[IMX6QDL_CLK_ENET_REF] = clk_hw_register_divider_table(NULL, "enet_ref", "pll6_enet", 0, 548 551 base + 0xe0, 0, 2, 0, clk_enet_ref_table, 549 552 &imx_ccm_lock); 550 553 } else { 551 - clk[IMX6QDL_CLK_SATA_REF] = imx_clk_fixed_factor("sata_ref", "pll6_enet", 1, 1); 552 - clk[IMX6QDL_CLK_PCIE_REF] = imx_clk_fixed_factor("pcie_ref", "pll6_enet", 1, 1); 553 - clk[IMX6QDL_CLK_ENET_REF] = imx_clk_fixed_factor("enet_ref", "pll6_enet", 1, 1); 554 + hws[IMX6QDL_CLK_SATA_REF] = imx_clk_hw_fixed_factor("sata_ref", "pll6_enet", 1, 1); 555 + hws[IMX6QDL_CLK_PCIE_REF] = imx_clk_hw_fixed_factor("pcie_ref", "pll6_enet", 1, 1); 556 + hws[IMX6QDL_CLK_ENET_REF] = imx_clk_hw_fixed_factor("enet_ref", "pll6_enet", 1, 1); 554 557 } 555 558 556 - clk[IMX6QDL_CLK_SATA_REF_100M] = imx_clk_gate("sata_ref_100m", "sata_ref", base + 0xe0, 20); 557 - clk[IMX6QDL_CLK_PCIE_REF_125M] = imx_clk_gate("pcie_ref_125m", "pcie_ref", base + 0xe0, 19); 559 + hws[IMX6QDL_CLK_SATA_REF_100M] = imx_clk_hw_gate("sata_ref_100m", "sata_ref", base + 0xe0, 20); 560 + hws[IMX6QDL_CLK_PCIE_REF_125M] = imx_clk_hw_gate("pcie_ref_125m", "pcie_ref", base + 0xe0, 19); 558 561 559 - clk[IMX6QDL_CLK_LVDS1_SEL] = imx_clk_mux("lvds1_sel", base + 0x160, 0, 5, lvds_sels, ARRAY_SIZE(lvds_sels)); 560 - clk[IMX6QDL_CLK_LVDS2_SEL] = imx_clk_mux("lvds2_sel", base + 0x160, 5, 5, lvds_sels, ARRAY_SIZE(lvds_sels)); 562 + hws[IMX6QDL_CLK_LVDS1_SEL] = imx_clk_hw_mux("lvds1_sel", base + 0x160, 0, 5, lvds_sels, ARRAY_SIZE(lvds_sels)); 563 + hws[IMX6QDL_CLK_LVDS2_SEL] = imx_clk_hw_mux("lvds2_sel", base + 0x160, 5, 5, lvds_sels, ARRAY_SIZE(lvds_sels)); 561 564 562 565 /* 563 566 * lvds1_gate and lvds2_gate are pseudo-gates. Both can be ··· 569 572 * it. 570 573 */ 571 574 writel(readl(base + 0x160) & ~0x3c00, base + 0x160); 572 - clk[IMX6QDL_CLK_LVDS1_GATE] = imx_clk_gate_exclusive("lvds1_gate", "lvds1_sel", base + 0x160, 10, BIT(12)); 573 - clk[IMX6QDL_CLK_LVDS2_GATE] = imx_clk_gate_exclusive("lvds2_gate", "lvds2_sel", base + 0x160, 11, BIT(13)); 575 + hws[IMX6QDL_CLK_LVDS1_GATE] = imx_clk_hw_gate_exclusive("lvds1_gate", "lvds1_sel", base + 0x160, 10, BIT(12)); 576 + hws[IMX6QDL_CLK_LVDS2_GATE] = imx_clk_hw_gate_exclusive("lvds2_gate", "lvds2_sel", base + 0x160, 11, BIT(13)); 574 577 575 - clk[IMX6QDL_CLK_LVDS1_IN] = imx_clk_gate_exclusive("lvds1_in", "anaclk1", base + 0x160, 12, BIT(10)); 576 - clk[IMX6QDL_CLK_LVDS2_IN] = imx_clk_gate_exclusive("lvds2_in", "anaclk2", base + 0x160, 13, BIT(11)); 578 + hws[IMX6QDL_CLK_LVDS1_IN] = imx_clk_hw_gate_exclusive("lvds1_in", "anaclk1", base + 0x160, 12, BIT(10)); 579 + hws[IMX6QDL_CLK_LVDS2_IN] = imx_clk_hw_gate_exclusive("lvds2_in", "anaclk2", base + 0x160, 13, BIT(11)); 577 580 578 581 /* name parent_name reg idx */ 579 - clk[IMX6QDL_CLK_PLL2_PFD0_352M] = imx_clk_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0); 580 - clk[IMX6QDL_CLK_PLL2_PFD1_594M] = imx_clk_pfd("pll2_pfd1_594m", "pll2_bus", base + 0x100, 1); 581 - clk[IMX6QDL_CLK_PLL2_PFD2_396M] = imx_clk_pfd("pll2_pfd2_396m", "pll2_bus", base + 0x100, 2); 582 - clk[IMX6QDL_CLK_PLL3_PFD0_720M] = imx_clk_pfd("pll3_pfd0_720m", "pll3_usb_otg", base + 0xf0, 0); 583 - clk[IMX6QDL_CLK_PLL3_PFD1_540M] = imx_clk_pfd("pll3_pfd1_540m", "pll3_usb_otg", base + 0xf0, 1); 584 - clk[IMX6QDL_CLK_PLL3_PFD2_508M] = imx_clk_pfd("pll3_pfd2_508m", "pll3_usb_otg", base + 0xf0, 2); 585 - clk[IMX6QDL_CLK_PLL3_PFD3_454M] = imx_clk_pfd("pll3_pfd3_454m", "pll3_usb_otg", base + 0xf0, 3); 582 + hws[IMX6QDL_CLK_PLL2_PFD0_352M] = imx_clk_hw_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0); 583 + hws[IMX6QDL_CLK_PLL2_PFD1_594M] = imx_clk_hw_pfd("pll2_pfd1_594m", "pll2_bus", base + 0x100, 1); 584 + hws[IMX6QDL_CLK_PLL2_PFD2_396M] = imx_clk_hw_pfd("pll2_pfd2_396m", "pll2_bus", base + 0x100, 2); 585 + hws[IMX6QDL_CLK_PLL3_PFD0_720M] = imx_clk_hw_pfd("pll3_pfd0_720m", "pll3_usb_otg", base + 0xf0, 0); 586 + hws[IMX6QDL_CLK_PLL3_PFD1_540M] = imx_clk_hw_pfd("pll3_pfd1_540m", "pll3_usb_otg", base + 0xf0, 1); 587 + hws[IMX6QDL_CLK_PLL3_PFD2_508M] = imx_clk_hw_pfd("pll3_pfd2_508m", "pll3_usb_otg", base + 0xf0, 2); 588 + hws[IMX6QDL_CLK_PLL3_PFD3_454M] = imx_clk_hw_pfd("pll3_pfd3_454m", "pll3_usb_otg", base + 0xf0, 3); 586 589 587 590 /* name parent_name mult div */ 588 - clk[IMX6QDL_CLK_PLL2_198M] = imx_clk_fixed_factor("pll2_198m", "pll2_pfd2_396m", 1, 2); 589 - clk[IMX6QDL_CLK_PLL3_120M] = imx_clk_fixed_factor("pll3_120m", "pll3_usb_otg", 1, 4); 590 - clk[IMX6QDL_CLK_PLL3_80M] = imx_clk_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6); 591 - clk[IMX6QDL_CLK_PLL3_60M] = imx_clk_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8); 592 - clk[IMX6QDL_CLK_TWD] = imx_clk_fixed_factor("twd", "arm", 1, 2); 593 - clk[IMX6QDL_CLK_GPT_3M] = imx_clk_fixed_factor("gpt_3m", "osc", 1, 8); 594 - clk[IMX6QDL_CLK_VIDEO_27M] = imx_clk_fixed_factor("video_27m", "pll3_pfd1_540m", 1, 20); 591 + hws[IMX6QDL_CLK_PLL2_198M] = imx_clk_hw_fixed_factor("pll2_198m", "pll2_pfd2_396m", 1, 2); 592 + hws[IMX6QDL_CLK_PLL3_120M] = imx_clk_hw_fixed_factor("pll3_120m", "pll3_usb_otg", 1, 4); 593 + hws[IMX6QDL_CLK_PLL3_80M] = imx_clk_hw_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6); 594 + hws[IMX6QDL_CLK_PLL3_60M] = imx_clk_hw_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8); 595 + hws[IMX6QDL_CLK_TWD] = imx_clk_hw_fixed_factor("twd", "arm", 1, 2); 596 + hws[IMX6QDL_CLK_GPT_3M] = imx_clk_hw_fixed_factor("gpt_3m", "osc", 1, 8); 597 + hws[IMX6QDL_CLK_VIDEO_27M] = imx_clk_hw_fixed_factor("video_27m", "pll3_pfd1_540m", 1, 20); 595 598 if (clk_on_imx6dl() || clk_on_imx6qp()) { 596 - clk[IMX6QDL_CLK_GPU2D_AXI] = imx_clk_fixed_factor("gpu2d_axi", "mmdc_ch0_axi_podf", 1, 1); 597 - clk[IMX6QDL_CLK_GPU3D_AXI] = imx_clk_fixed_factor("gpu3d_axi", "mmdc_ch0_axi_podf", 1, 1); 599 + hws[IMX6QDL_CLK_GPU2D_AXI] = imx_clk_hw_fixed_factor("gpu2d_axi", "mmdc_ch0_axi_podf", 1, 1); 600 + hws[IMX6QDL_CLK_GPU3D_AXI] = imx_clk_hw_fixed_factor("gpu3d_axi", "mmdc_ch0_axi_podf", 1, 1); 598 601 } 599 602 600 - clk[IMX6QDL_CLK_PLL4_POST_DIV] = clk_register_divider_table(NULL, "pll4_post_div", "pll4_audio", CLK_SET_RATE_PARENT, base + 0x70, 19, 2, 0, post_div_table, &imx_ccm_lock); 601 - clk[IMX6QDL_CLK_PLL4_AUDIO_DIV] = clk_register_divider(NULL, "pll4_audio_div", "pll4_post_div", CLK_SET_RATE_PARENT, base + 0x170, 15, 1, 0, &imx_ccm_lock); 602 - clk[IMX6QDL_CLK_PLL5_POST_DIV] = clk_register_divider_table(NULL, "pll5_post_div", "pll5_video", CLK_SET_RATE_PARENT, base + 0xa0, 19, 2, 0, post_div_table, &imx_ccm_lock); 603 - clk[IMX6QDL_CLK_PLL5_VIDEO_DIV] = clk_register_divider_table(NULL, "pll5_video_div", "pll5_post_div", CLK_SET_RATE_PARENT, base + 0x170, 30, 2, 0, video_div_table, &imx_ccm_lock); 603 + hws[IMX6QDL_CLK_PLL4_POST_DIV] = clk_hw_register_divider_table(NULL, "pll4_post_div", "pll4_audio", CLK_SET_RATE_PARENT, base + 0x70, 19, 2, 0, post_div_table, &imx_ccm_lock); 604 + hws[IMX6QDL_CLK_PLL4_AUDIO_DIV] = clk_hw_register_divider(NULL, "pll4_audio_div", "pll4_post_div", CLK_SET_RATE_PARENT, base + 0x170, 15, 1, 0, &imx_ccm_lock); 605 + hws[IMX6QDL_CLK_PLL5_POST_DIV] = clk_hw_register_divider_table(NULL, "pll5_post_div", "pll5_video", CLK_SET_RATE_PARENT, base + 0xa0, 19, 2, 0, post_div_table, &imx_ccm_lock); 606 + hws[IMX6QDL_CLK_PLL5_VIDEO_DIV] = clk_hw_register_divider_table(NULL, "pll5_video_div", "pll5_post_div", CLK_SET_RATE_PARENT, base + 0x170, 30, 2, 0, video_div_table, &imx_ccm_lock); 604 607 605 608 np = ccm_node; 606 609 base = of_iomap(np, 0); 607 610 WARN_ON(!base); 608 611 609 612 /* name reg shift width parent_names num_parents */ 610 - clk[IMX6QDL_CLK_STEP] = imx_clk_mux("step", base + 0xc, 8, 1, step_sels, ARRAY_SIZE(step_sels)); 611 - clk[IMX6QDL_CLK_PLL1_SW] = imx_clk_mux("pll1_sw", base + 0xc, 2, 1, pll1_sw_sels, ARRAY_SIZE(pll1_sw_sels)); 612 - clk[IMX6QDL_CLK_PERIPH_PRE] = imx_clk_mux("periph_pre", base + 0x18, 18, 2, periph_pre_sels, ARRAY_SIZE(periph_pre_sels)); 613 - clk[IMX6QDL_CLK_PERIPH2_PRE] = imx_clk_mux("periph2_pre", base + 0x18, 21, 2, periph_pre_sels, ARRAY_SIZE(periph_pre_sels)); 614 - clk[IMX6QDL_CLK_PERIPH_CLK2_SEL] = imx_clk_mux("periph_clk2_sel", base + 0x18, 12, 2, periph_clk2_sels, ARRAY_SIZE(periph_clk2_sels)); 615 - clk[IMX6QDL_CLK_PERIPH2_CLK2_SEL] = imx_clk_mux("periph2_clk2_sel", base + 0x18, 20, 1, periph2_clk2_sels, ARRAY_SIZE(periph2_clk2_sels)); 616 - clk[IMX6QDL_CLK_AXI_SEL] = imx_clk_mux("axi_sel", base + 0x14, 6, 2, axi_sels, ARRAY_SIZE(axi_sels)); 617 - clk[IMX6QDL_CLK_ESAI_SEL] = imx_clk_mux("esai_sel", base + 0x20, 19, 2, audio_sels, ARRAY_SIZE(audio_sels)); 618 - clk[IMX6QDL_CLK_ASRC_SEL] = imx_clk_mux("asrc_sel", base + 0x30, 7, 2, audio_sels, ARRAY_SIZE(audio_sels)); 619 - clk[IMX6QDL_CLK_SPDIF_SEL] = imx_clk_mux("spdif_sel", base + 0x30, 20, 2, audio_sels, ARRAY_SIZE(audio_sels)); 613 + hws[IMX6QDL_CLK_STEP] = imx_clk_hw_mux("step", base + 0xc, 8, 1, step_sels, ARRAY_SIZE(step_sels)); 614 + hws[IMX6QDL_CLK_PLL1_SW] = imx_clk_hw_mux("pll1_sw", base + 0xc, 2, 1, pll1_sw_sels, ARRAY_SIZE(pll1_sw_sels)); 615 + hws[IMX6QDL_CLK_PERIPH_PRE] = imx_clk_hw_mux("periph_pre", base + 0x18, 18, 2, periph_pre_sels, ARRAY_SIZE(periph_pre_sels)); 616 + hws[IMX6QDL_CLK_PERIPH2_PRE] = imx_clk_hw_mux("periph2_pre", base + 0x18, 21, 2, periph_pre_sels, ARRAY_SIZE(periph_pre_sels)); 617 + hws[IMX6QDL_CLK_PERIPH_CLK2_SEL] = imx_clk_hw_mux("periph_clk2_sel", base + 0x18, 12, 2, periph_clk2_sels, ARRAY_SIZE(periph_clk2_sels)); 618 + hws[IMX6QDL_CLK_PERIPH2_CLK2_SEL] = imx_clk_hw_mux("periph2_clk2_sel", base + 0x18, 20, 1, periph2_clk2_sels, ARRAY_SIZE(periph2_clk2_sels)); 619 + hws[IMX6QDL_CLK_AXI_SEL] = imx_clk_hw_mux("axi_sel", base + 0x14, 6, 2, axi_sels, ARRAY_SIZE(axi_sels)); 620 + hws[IMX6QDL_CLK_ESAI_SEL] = imx_clk_hw_mux("esai_sel", base + 0x20, 19, 2, audio_sels, ARRAY_SIZE(audio_sels)); 621 + hws[IMX6QDL_CLK_ASRC_SEL] = imx_clk_hw_mux("asrc_sel", base + 0x30, 7, 2, audio_sels, ARRAY_SIZE(audio_sels)); 622 + hws[IMX6QDL_CLK_SPDIF_SEL] = imx_clk_hw_mux("spdif_sel", base + 0x30, 20, 2, audio_sels, ARRAY_SIZE(audio_sels)); 620 623 if (clk_on_imx6q()) { 621 - clk[IMX6QDL_CLK_GPU2D_AXI] = imx_clk_mux("gpu2d_axi", base + 0x18, 0, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels)); 622 - clk[IMX6QDL_CLK_GPU3D_AXI] = imx_clk_mux("gpu3d_axi", base + 0x18, 1, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels)); 624 + hws[IMX6QDL_CLK_GPU2D_AXI] = imx_clk_hw_mux("gpu2d_axi", base + 0x18, 0, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels)); 625 + hws[IMX6QDL_CLK_GPU3D_AXI] = imx_clk_hw_mux("gpu3d_axi", base + 0x18, 1, 1, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels)); 623 626 } 624 627 if (clk_on_imx6qp()) { 625 - clk[IMX6QDL_CLK_CAN_SEL] = imx_clk_mux("can_sel", base + 0x20, 8, 2, can_sels, ARRAY_SIZE(can_sels)); 626 - clk[IMX6QDL_CLK_ECSPI_SEL] = imx_clk_mux("ecspi_sel", base + 0x38, 18, 1, ecspi_sels, ARRAY_SIZE(ecspi_sels)); 627 - clk[IMX6QDL_CLK_IPG_PER_SEL] = imx_clk_mux("ipg_per_sel", base + 0x1c, 6, 1, ipg_per_sels, ARRAY_SIZE(ipg_per_sels)); 628 - clk[IMX6QDL_CLK_UART_SEL] = imx_clk_mux("uart_sel", base + 0x24, 6, 1, uart_sels, ARRAY_SIZE(uart_sels)); 629 - clk[IMX6QDL_CLK_GPU2D_CORE_SEL] = imx_clk_mux("gpu2d_core_sel", base + 0x18, 16, 2, gpu2d_core_sels_2, ARRAY_SIZE(gpu2d_core_sels_2)); 628 + hws[IMX6QDL_CLK_CAN_SEL] = imx_clk_hw_mux("can_sel", base + 0x20, 8, 2, can_sels, ARRAY_SIZE(can_sels)); 629 + hws[IMX6QDL_CLK_ECSPI_SEL] = imx_clk_hw_mux("ecspi_sel", base + 0x38, 18, 1, ecspi_sels, ARRAY_SIZE(ecspi_sels)); 630 + hws[IMX6QDL_CLK_IPG_PER_SEL] = imx_clk_hw_mux("ipg_per_sel", base + 0x1c, 6, 1, ipg_per_sels, ARRAY_SIZE(ipg_per_sels)); 631 + hws[IMX6QDL_CLK_UART_SEL] = imx_clk_hw_mux("uart_sel", base + 0x24, 6, 1, uart_sels, ARRAY_SIZE(uart_sels)); 632 + hws[IMX6QDL_CLK_GPU2D_CORE_SEL] = imx_clk_hw_mux("gpu2d_core_sel", base + 0x18, 16, 2, gpu2d_core_sels_2, ARRAY_SIZE(gpu2d_core_sels_2)); 630 633 } else if (clk_on_imx6dl()) { 631 - clk[IMX6QDL_CLK_MLB_SEL] = imx_clk_mux("mlb_sel", base + 0x18, 16, 2, gpu2d_core_sels, ARRAY_SIZE(gpu2d_core_sels)); 634 + hws[IMX6QDL_CLK_MLB_SEL] = imx_clk_hw_mux("mlb_sel", base + 0x18, 16, 2, gpu2d_core_sels, ARRAY_SIZE(gpu2d_core_sels)); 632 635 } else { 633 - clk[IMX6QDL_CLK_GPU2D_CORE_SEL] = imx_clk_mux("gpu2d_core_sel", base + 0x18, 16, 2, gpu2d_core_sels, ARRAY_SIZE(gpu2d_core_sels)); 636 + hws[IMX6QDL_CLK_GPU2D_CORE_SEL] = imx_clk_hw_mux("gpu2d_core_sel", base + 0x18, 16, 2, gpu2d_core_sels, ARRAY_SIZE(gpu2d_core_sels)); 634 637 } 635 - clk[IMX6QDL_CLK_GPU3D_CORE_SEL] = imx_clk_mux("gpu3d_core_sel", base + 0x18, 4, 2, gpu3d_core_sels, ARRAY_SIZE(gpu3d_core_sels)); 638 + hws[IMX6QDL_CLK_GPU3D_CORE_SEL] = imx_clk_hw_mux("gpu3d_core_sel", base + 0x18, 4, 2, gpu3d_core_sels, ARRAY_SIZE(gpu3d_core_sels)); 636 639 if (clk_on_imx6dl()) 637 - clk[IMX6QDL_CLK_GPU2D_CORE_SEL] = imx_clk_mux("gpu2d_core_sel", base + 0x18, 8, 2, gpu3d_shader_sels, ARRAY_SIZE(gpu3d_shader_sels)); 640 + hws[IMX6QDL_CLK_GPU2D_CORE_SEL] = imx_clk_hw_mux("gpu2d_core_sel", base + 0x18, 8, 2, gpu3d_shader_sels, ARRAY_SIZE(gpu3d_shader_sels)); 638 641 else 639 - clk[IMX6QDL_CLK_GPU3D_SHADER_SEL] = imx_clk_mux("gpu3d_shader_sel", base + 0x18, 8, 2, gpu3d_shader_sels, ARRAY_SIZE(gpu3d_shader_sels)); 640 - clk[IMX6QDL_CLK_IPU1_SEL] = imx_clk_mux("ipu1_sel", base + 0x3c, 9, 2, ipu_sels, ARRAY_SIZE(ipu_sels)); 641 - clk[IMX6QDL_CLK_IPU2_SEL] = imx_clk_mux("ipu2_sel", base + 0x3c, 14, 2, ipu_sels, ARRAY_SIZE(ipu_sels)); 642 + hws[IMX6QDL_CLK_GPU3D_SHADER_SEL] = imx_clk_hw_mux("gpu3d_shader_sel", base + 0x18, 8, 2, gpu3d_shader_sels, ARRAY_SIZE(gpu3d_shader_sels)); 643 + hws[IMX6QDL_CLK_IPU1_SEL] = imx_clk_hw_mux("ipu1_sel", base + 0x3c, 9, 2, ipu_sels, ARRAY_SIZE(ipu_sels)); 644 + hws[IMX6QDL_CLK_IPU2_SEL] = imx_clk_hw_mux("ipu2_sel", base + 0x3c, 14, 2, ipu_sels, ARRAY_SIZE(ipu_sels)); 642 645 643 646 disable_anatop_clocks(anatop_base); 644 647 645 - imx6q_mmdc_ch1_mask_handshake(base); 648 + imx_mmdc_mask_handshake(base, 1); 646 649 647 650 if (clk_on_imx6qp()) { 648 - clk[IMX6QDL_CLK_LDB_DI0_SEL] = imx_clk_mux_flags("ldb_di0_sel", base + 0x2c, 9, 3, ldb_di_sels, ARRAY_SIZE(ldb_di_sels), CLK_SET_RATE_PARENT); 649 - clk[IMX6QDL_CLK_LDB_DI1_SEL] = imx_clk_mux_flags("ldb_di1_sel", base + 0x2c, 12, 3, ldb_di_sels, ARRAY_SIZE(ldb_di_sels), CLK_SET_RATE_PARENT); 651 + hws[IMX6QDL_CLK_LDB_DI0_SEL] = imx_clk_hw_mux_flags("ldb_di0_sel", base + 0x2c, 9, 3, ldb_di_sels, ARRAY_SIZE(ldb_di_sels), CLK_SET_RATE_PARENT); 652 + hws[IMX6QDL_CLK_LDB_DI1_SEL] = imx_clk_hw_mux_flags("ldb_di1_sel", base + 0x2c, 12, 3, ldb_di_sels, ARRAY_SIZE(ldb_di_sels), CLK_SET_RATE_PARENT); 650 653 } else { 651 654 /* 652 655 * The LDB_DI0/1_SEL muxes are registered read-only due to a hardware ··· 655 658 */ 656 659 init_ldb_clks(np, base); 657 660 658 - clk[IMX6QDL_CLK_LDB_DI0_SEL] = imx_clk_mux_ldb("ldb_di0_sel", base + 0x2c, 9, 3, ldb_di_sels, ARRAY_SIZE(ldb_di_sels)); 659 - clk[IMX6QDL_CLK_LDB_DI1_SEL] = imx_clk_mux_ldb("ldb_di1_sel", base + 0x2c, 12, 3, ldb_di_sels, ARRAY_SIZE(ldb_di_sels)); 661 + hws[IMX6QDL_CLK_LDB_DI0_SEL] = imx_clk_hw_mux_ldb("ldb_di0_sel", base + 0x2c, 9, 3, ldb_di_sels, ARRAY_SIZE(ldb_di_sels)); 662 + hws[IMX6QDL_CLK_LDB_DI1_SEL] = imx_clk_hw_mux_ldb("ldb_di1_sel", base + 0x2c, 12, 3, ldb_di_sels, ARRAY_SIZE(ldb_di_sels)); 660 663 } 661 - clk[IMX6QDL_CLK_IPU1_DI0_PRE_SEL] = imx_clk_mux_flags("ipu1_di0_pre_sel", base + 0x34, 6, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT); 662 - clk[IMX6QDL_CLK_IPU1_DI1_PRE_SEL] = imx_clk_mux_flags("ipu1_di1_pre_sel", base + 0x34, 15, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT); 663 - clk[IMX6QDL_CLK_IPU2_DI0_PRE_SEL] = imx_clk_mux_flags("ipu2_di0_pre_sel", base + 0x38, 6, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT); 664 - clk[IMX6QDL_CLK_IPU2_DI1_PRE_SEL] = imx_clk_mux_flags("ipu2_di1_pre_sel", base + 0x38, 15, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT); 665 - clk[IMX6QDL_CLK_HSI_TX_SEL] = imx_clk_mux("hsi_tx_sel", base + 0x30, 28, 1, hsi_tx_sels, ARRAY_SIZE(hsi_tx_sels)); 666 - clk[IMX6QDL_CLK_PCIE_AXI_SEL] = imx_clk_mux("pcie_axi_sel", base + 0x18, 10, 1, pcie_axi_sels, ARRAY_SIZE(pcie_axi_sels)); 664 + 665 + hws[IMX6QDL_CLK_IPU1_DI0_PRE_SEL] = imx_clk_hw_mux_flags("ipu1_di0_pre_sel", base + 0x34, 6, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT); 666 + hws[IMX6QDL_CLK_IPU1_DI1_PRE_SEL] = imx_clk_hw_mux_flags("ipu1_di1_pre_sel", base + 0x34, 15, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT); 667 + hws[IMX6QDL_CLK_IPU2_DI0_PRE_SEL] = imx_clk_hw_mux_flags("ipu2_di0_pre_sel", base + 0x38, 6, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT); 668 + hws[IMX6QDL_CLK_IPU2_DI1_PRE_SEL] = imx_clk_hw_mux_flags("ipu2_di1_pre_sel", base + 0x38, 15, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT); 669 + hws[IMX6QDL_CLK_HSI_TX_SEL] = imx_clk_hw_mux("hsi_tx_sel", base + 0x30, 28, 1, hsi_tx_sels, ARRAY_SIZE(hsi_tx_sels)); 670 + hws[IMX6QDL_CLK_PCIE_AXI_SEL] = imx_clk_hw_mux("pcie_axi_sel", base + 0x18, 10, 1, pcie_axi_sels, ARRAY_SIZE(pcie_axi_sels)); 671 + 667 672 if (clk_on_imx6qp()) { 668 - clk[IMX6QDL_CLK_IPU1_DI0_SEL] = imx_clk_mux_flags("ipu1_di0_sel", base + 0x34, 0, 3, ipu1_di0_sels_2, ARRAY_SIZE(ipu1_di0_sels_2), CLK_SET_RATE_PARENT); 669 - clk[IMX6QDL_CLK_IPU1_DI1_SEL] = imx_clk_mux_flags("ipu1_di1_sel", base + 0x34, 9, 3, ipu1_di1_sels_2, ARRAY_SIZE(ipu1_di1_sels_2), CLK_SET_RATE_PARENT); 670 - clk[IMX6QDL_CLK_IPU2_DI0_SEL] = imx_clk_mux_flags("ipu2_di0_sel", base + 0x38, 0, 3, ipu2_di0_sels_2, ARRAY_SIZE(ipu2_di0_sels_2), CLK_SET_RATE_PARENT); 671 - clk[IMX6QDL_CLK_IPU2_DI1_SEL] = imx_clk_mux_flags("ipu2_di1_sel", base + 0x38, 9, 3, ipu2_di1_sels_2, ARRAY_SIZE(ipu2_di1_sels_2), CLK_SET_RATE_PARENT); 672 - clk[IMX6QDL_CLK_SSI1_SEL] = imx_clk_mux("ssi1_sel", base + 0x1c, 10, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); 673 - clk[IMX6QDL_CLK_SSI2_SEL] = imx_clk_mux("ssi2_sel", base + 0x1c, 12, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); 674 - clk[IMX6QDL_CLK_SSI3_SEL] = imx_clk_mux("ssi3_sel", base + 0x1c, 14, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); 675 - clk[IMX6QDL_CLK_USDHC1_SEL] = imx_clk_mux("usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 676 - clk[IMX6QDL_CLK_USDHC2_SEL] = imx_clk_mux("usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 677 - clk[IMX6QDL_CLK_USDHC3_SEL] = imx_clk_mux("usdhc3_sel", base + 0x1c, 18, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 678 - clk[IMX6QDL_CLK_USDHC4_SEL] = imx_clk_mux("usdhc4_sel", base + 0x1c, 19, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 679 - clk[IMX6QDL_CLK_ENFC_SEL] = imx_clk_mux("enfc_sel", base + 0x2c, 15, 3, enfc_sels_2, ARRAY_SIZE(enfc_sels_2)); 680 - clk[IMX6QDL_CLK_EIM_SEL] = imx_clk_mux("eim_sel", base + 0x1c, 27, 2, eim_sels, ARRAY_SIZE(eim_sels)); 681 - clk[IMX6QDL_CLK_EIM_SLOW_SEL] = imx_clk_mux("eim_slow_sel", base + 0x1c, 29, 2, eim_slow_sels, ARRAY_SIZE(eim_slow_sels)); 682 - clk[IMX6QDL_CLK_PRE_AXI] = imx_clk_mux("pre_axi", base + 0x18, 1, 1, pre_axi_sels, ARRAY_SIZE(pre_axi_sels)); 673 + hws[IMX6QDL_CLK_IPU1_DI0_SEL] = imx_clk_hw_mux_flags("ipu1_di0_sel", base + 0x34, 0, 3, ipu1_di0_sels_2, ARRAY_SIZE(ipu1_di0_sels_2), CLK_SET_RATE_PARENT); 674 + hws[IMX6QDL_CLK_IPU1_DI1_SEL] = imx_clk_hw_mux_flags("ipu1_di1_sel", base + 0x34, 9, 3, ipu1_di1_sels_2, ARRAY_SIZE(ipu1_di1_sels_2), CLK_SET_RATE_PARENT); 675 + hws[IMX6QDL_CLK_IPU2_DI0_SEL] = imx_clk_hw_mux_flags("ipu2_di0_sel", base + 0x38, 0, 3, ipu2_di0_sels_2, ARRAY_SIZE(ipu2_di0_sels_2), CLK_SET_RATE_PARENT); 676 + hws[IMX6QDL_CLK_IPU2_DI1_SEL] = imx_clk_hw_mux_flags("ipu2_di1_sel", base + 0x38, 9, 3, ipu2_di1_sels_2, ARRAY_SIZE(ipu2_di1_sels_2), CLK_SET_RATE_PARENT); 677 + hws[IMX6QDL_CLK_SSI1_SEL] = imx_clk_hw_mux("ssi1_sel", base + 0x1c, 10, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); 678 + hws[IMX6QDL_CLK_SSI2_SEL] = imx_clk_hw_mux("ssi2_sel", base + 0x1c, 12, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); 679 + hws[IMX6QDL_CLK_SSI3_SEL] = imx_clk_hw_mux("ssi3_sel", base + 0x1c, 14, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); 680 + hws[IMX6QDL_CLK_USDHC1_SEL] = imx_clk_hw_mux("usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 681 + hws[IMX6QDL_CLK_USDHC2_SEL] = imx_clk_hw_mux("usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 682 + hws[IMX6QDL_CLK_USDHC3_SEL] = imx_clk_hw_mux("usdhc3_sel", base + 0x1c, 18, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 683 + hws[IMX6QDL_CLK_USDHC4_SEL] = imx_clk_hw_mux("usdhc4_sel", base + 0x1c, 19, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 684 + hws[IMX6QDL_CLK_ENFC_SEL] = imx_clk_hw_mux("enfc_sel", base + 0x2c, 15, 3, enfc_sels_2, ARRAY_SIZE(enfc_sels_2)); 685 + hws[IMX6QDL_CLK_EIM_SEL] = imx_clk_hw_mux("eim_sel", base + 0x1c, 27, 2, eim_sels, ARRAY_SIZE(eim_sels)); 686 + hws[IMX6QDL_CLK_EIM_SLOW_SEL] = imx_clk_hw_mux("eim_slow_sel", base + 0x1c, 29, 2, eim_slow_sels, ARRAY_SIZE(eim_slow_sels)); 687 + hws[IMX6QDL_CLK_PRE_AXI] = imx_clk_hw_mux("pre_axi", base + 0x18, 1, 1, pre_axi_sels, ARRAY_SIZE(pre_axi_sels)); 683 688 } else { 684 - clk[IMX6QDL_CLK_IPU1_DI0_SEL] = imx_clk_mux_flags("ipu1_di0_sel", base + 0x34, 0, 3, ipu1_di0_sels, ARRAY_SIZE(ipu1_di0_sels), CLK_SET_RATE_PARENT); 685 - clk[IMX6QDL_CLK_IPU1_DI1_SEL] = imx_clk_mux_flags("ipu1_di1_sel", base + 0x34, 9, 3, ipu1_di1_sels, ARRAY_SIZE(ipu1_di1_sels), CLK_SET_RATE_PARENT); 686 - clk[IMX6QDL_CLK_IPU2_DI0_SEL] = imx_clk_mux_flags("ipu2_di0_sel", base + 0x38, 0, 3, ipu2_di0_sels, ARRAY_SIZE(ipu2_di0_sels), CLK_SET_RATE_PARENT); 687 - clk[IMX6QDL_CLK_IPU2_DI1_SEL] = imx_clk_mux_flags("ipu2_di1_sel", base + 0x38, 9, 3, ipu2_di1_sels, ARRAY_SIZE(ipu2_di1_sels), CLK_SET_RATE_PARENT); 688 - clk[IMX6QDL_CLK_SSI1_SEL] = imx_clk_fixup_mux("ssi1_sel", base + 0x1c, 10, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup); 689 - clk[IMX6QDL_CLK_SSI2_SEL] = imx_clk_fixup_mux("ssi2_sel", base + 0x1c, 12, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup); 690 - clk[IMX6QDL_CLK_SSI3_SEL] = imx_clk_fixup_mux("ssi3_sel", base + 0x1c, 14, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup); 691 - clk[IMX6QDL_CLK_USDHC1_SEL] = imx_clk_fixup_mux("usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 692 - clk[IMX6QDL_CLK_USDHC2_SEL] = imx_clk_fixup_mux("usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 693 - clk[IMX6QDL_CLK_USDHC3_SEL] = imx_clk_fixup_mux("usdhc3_sel", base + 0x1c, 18, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 694 - clk[IMX6QDL_CLK_USDHC4_SEL] = imx_clk_fixup_mux("usdhc4_sel", base + 0x1c, 19, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 695 - clk[IMX6QDL_CLK_ENFC_SEL] = imx_clk_mux("enfc_sel", base + 0x2c, 16, 2, enfc_sels, ARRAY_SIZE(enfc_sels)); 696 - clk[IMX6QDL_CLK_EIM_SEL] = imx_clk_fixup_mux("eim_sel", base + 0x1c, 27, 2, eim_sels, ARRAY_SIZE(eim_sels), imx_cscmr1_fixup); 697 - clk[IMX6QDL_CLK_EIM_SLOW_SEL] = imx_clk_fixup_mux("eim_slow_sel", base + 0x1c, 29, 2, eim_slow_sels, ARRAY_SIZE(eim_slow_sels), imx_cscmr1_fixup); 689 + hws[IMX6QDL_CLK_IPU1_DI0_SEL] = imx_clk_hw_mux_flags("ipu1_di0_sel", base + 0x34, 0, 3, ipu1_di0_sels, ARRAY_SIZE(ipu1_di0_sels), CLK_SET_RATE_PARENT); 690 + hws[IMX6QDL_CLK_IPU1_DI1_SEL] = imx_clk_hw_mux_flags("ipu1_di1_sel", base + 0x34, 9, 3, ipu1_di1_sels, ARRAY_SIZE(ipu1_di1_sels), CLK_SET_RATE_PARENT); 691 + hws[IMX6QDL_CLK_IPU2_DI0_SEL] = imx_clk_hw_mux_flags("ipu2_di0_sel", base + 0x38, 0, 3, ipu2_di0_sels, ARRAY_SIZE(ipu2_di0_sels), CLK_SET_RATE_PARENT); 692 + hws[IMX6QDL_CLK_IPU2_DI1_SEL] = imx_clk_hw_mux_flags("ipu2_di1_sel", base + 0x38, 9, 3, ipu2_di1_sels, ARRAY_SIZE(ipu2_di1_sels), CLK_SET_RATE_PARENT); 693 + hws[IMX6QDL_CLK_SSI1_SEL] = imx_clk_hw_fixup_mux("ssi1_sel", base + 0x1c, 10, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup); 694 + hws[IMX6QDL_CLK_SSI2_SEL] = imx_clk_hw_fixup_mux("ssi2_sel", base + 0x1c, 12, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup); 695 + hws[IMX6QDL_CLK_SSI3_SEL] = imx_clk_hw_fixup_mux("ssi3_sel", base + 0x1c, 14, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup); 696 + hws[IMX6QDL_CLK_USDHC1_SEL] = imx_clk_hw_fixup_mux("usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 697 + hws[IMX6QDL_CLK_USDHC2_SEL] = imx_clk_hw_fixup_mux("usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 698 + hws[IMX6QDL_CLK_USDHC3_SEL] = imx_clk_hw_fixup_mux("usdhc3_sel", base + 0x1c, 18, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 699 + hws[IMX6QDL_CLK_USDHC4_SEL] = imx_clk_hw_fixup_mux("usdhc4_sel", base + 0x1c, 19, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 700 + hws[IMX6QDL_CLK_ENFC_SEL] = imx_clk_hw_mux("enfc_sel", base + 0x2c, 16, 2, enfc_sels, ARRAY_SIZE(enfc_sels)); 701 + hws[IMX6QDL_CLK_EIM_SEL] = imx_clk_hw_fixup_mux("eim_sel", base + 0x1c, 27, 2, eim_sels, ARRAY_SIZE(eim_sels), imx_cscmr1_fixup); 702 + hws[IMX6QDL_CLK_EIM_SLOW_SEL] = imx_clk_hw_fixup_mux("eim_slow_sel", base + 0x1c, 29, 2, eim_slow_sels, ARRAY_SIZE(eim_slow_sels), imx_cscmr1_fixup); 698 703 } 699 - clk[IMX6QDL_CLK_VDO_AXI_SEL] = imx_clk_mux("vdo_axi_sel", base + 0x18, 11, 1, vdo_axi_sels, ARRAY_SIZE(vdo_axi_sels)); 700 - clk[IMX6QDL_CLK_VPU_AXI_SEL] = imx_clk_mux("vpu_axi_sel", base + 0x18, 14, 2, vpu_axi_sels, ARRAY_SIZE(vpu_axi_sels)); 701 - clk[IMX6QDL_CLK_CKO1_SEL] = imx_clk_mux("cko1_sel", base + 0x60, 0, 4, cko1_sels, ARRAY_SIZE(cko1_sels)); 702 - clk[IMX6QDL_CLK_CKO2_SEL] = imx_clk_mux("cko2_sel", base + 0x60, 16, 5, cko2_sels, ARRAY_SIZE(cko2_sels)); 703 - clk[IMX6QDL_CLK_CKO] = imx_clk_mux("cko", base + 0x60, 8, 1, cko_sels, ARRAY_SIZE(cko_sels)); 704 + 705 + hws[IMX6QDL_CLK_VDO_AXI_SEL] = imx_clk_hw_mux("vdo_axi_sel", base + 0x18, 11, 1, vdo_axi_sels, ARRAY_SIZE(vdo_axi_sels)); 706 + hws[IMX6QDL_CLK_VPU_AXI_SEL] = imx_clk_hw_mux("vpu_axi_sel", base + 0x18, 14, 2, vpu_axi_sels, ARRAY_SIZE(vpu_axi_sels)); 707 + hws[IMX6QDL_CLK_CKO1_SEL] = imx_clk_hw_mux("cko1_sel", base + 0x60, 0, 4, cko1_sels, ARRAY_SIZE(cko1_sels)); 708 + hws[IMX6QDL_CLK_CKO2_SEL] = imx_clk_hw_mux("cko2_sel", base + 0x60, 16, 5, cko2_sels, ARRAY_SIZE(cko2_sels)); 709 + hws[IMX6QDL_CLK_CKO] = imx_clk_hw_mux("cko", base + 0x60, 8, 1, cko_sels, ARRAY_SIZE(cko_sels)); 704 710 705 711 /* name reg shift width busy: reg, shift parent_names num_parents */ 706 - clk[IMX6QDL_CLK_PERIPH] = imx_clk_busy_mux("periph", base + 0x14, 25, 1, base + 0x48, 5, periph_sels, ARRAY_SIZE(periph_sels)); 707 - clk[IMX6QDL_CLK_PERIPH2] = imx_clk_busy_mux("periph2", base + 0x14, 26, 1, base + 0x48, 3, periph2_sels, ARRAY_SIZE(periph2_sels)); 712 + hws[IMX6QDL_CLK_PERIPH] = imx_clk_hw_busy_mux("periph", base + 0x14, 25, 1, base + 0x48, 5, periph_sels, ARRAY_SIZE(periph_sels)); 713 + hws[IMX6QDL_CLK_PERIPH2] = imx_clk_hw_busy_mux("periph2", base + 0x14, 26, 1, base + 0x48, 3, periph2_sels, ARRAY_SIZE(periph2_sels)); 708 714 709 715 /* name parent_name reg shift width */ 710 - clk[IMX6QDL_CLK_PERIPH_CLK2] = imx_clk_divider("periph_clk2", "periph_clk2_sel", base + 0x14, 27, 3); 711 - clk[IMX6QDL_CLK_PERIPH2_CLK2] = imx_clk_divider("periph2_clk2", "periph2_clk2_sel", base + 0x14, 0, 3); 712 - clk[IMX6QDL_CLK_IPG] = imx_clk_divider("ipg", "ahb", base + 0x14, 8, 2); 713 - clk[IMX6QDL_CLK_ESAI_PRED] = imx_clk_divider("esai_pred", "esai_sel", base + 0x28, 9, 3); 714 - clk[IMX6QDL_CLK_ESAI_PODF] = imx_clk_divider("esai_podf", "esai_pred", base + 0x28, 25, 3); 715 - clk[IMX6QDL_CLK_ASRC_PRED] = imx_clk_divider("asrc_pred", "asrc_sel", base + 0x30, 12, 3); 716 - clk[IMX6QDL_CLK_ASRC_PODF] = imx_clk_divider("asrc_podf", "asrc_pred", base + 0x30, 9, 3); 717 - clk[IMX6QDL_CLK_SPDIF_PRED] = imx_clk_divider("spdif_pred", "spdif_sel", base + 0x30, 25, 3); 718 - clk[IMX6QDL_CLK_SPDIF_PODF] = imx_clk_divider("spdif_podf", "spdif_pred", base + 0x30, 22, 3); 716 + hws[IMX6QDL_CLK_PERIPH_CLK2] = imx_clk_hw_divider("periph_clk2", "periph_clk2_sel", base + 0x14, 27, 3); 717 + hws[IMX6QDL_CLK_PERIPH2_CLK2] = imx_clk_hw_divider("periph2_clk2", "periph2_clk2_sel", base + 0x14, 0, 3); 718 + hws[IMX6QDL_CLK_IPG] = imx_clk_hw_divider("ipg", "ahb", base + 0x14, 8, 2); 719 + hws[IMX6QDL_CLK_ESAI_PRED] = imx_clk_hw_divider("esai_pred", "esai_sel", base + 0x28, 9, 3); 720 + hws[IMX6QDL_CLK_ESAI_PODF] = imx_clk_hw_divider("esai_podf", "esai_pred", base + 0x28, 25, 3); 721 + hws[IMX6QDL_CLK_ASRC_PRED] = imx_clk_hw_divider("asrc_pred", "asrc_sel", base + 0x30, 12, 3); 722 + hws[IMX6QDL_CLK_ASRC_PODF] = imx_clk_hw_divider("asrc_podf", "asrc_pred", base + 0x30, 9, 3); 723 + hws[IMX6QDL_CLK_SPDIF_PRED] = imx_clk_hw_divider("spdif_pred", "spdif_sel", base + 0x30, 25, 3); 724 + hws[IMX6QDL_CLK_SPDIF_PODF] = imx_clk_hw_divider("spdif_podf", "spdif_pred", base + 0x30, 22, 3); 725 + 719 726 if (clk_on_imx6qp()) { 720 - clk[IMX6QDL_CLK_IPG_PER] = imx_clk_divider("ipg_per", "ipg_per_sel", base + 0x1c, 0, 6); 721 - clk[IMX6QDL_CLK_ECSPI_ROOT] = imx_clk_divider("ecspi_root", "ecspi_sel", base + 0x38, 19, 6); 722 - clk[IMX6QDL_CLK_CAN_ROOT] = imx_clk_divider("can_root", "can_sel", base + 0x20, 2, 6); 723 - clk[IMX6QDL_CLK_UART_SERIAL_PODF] = imx_clk_divider("uart_serial_podf", "uart_sel", base + 0x24, 0, 6); 724 - clk[IMX6QDL_CLK_LDB_DI0_DIV_3_5] = imx_clk_fixed_factor("ldb_di0_div_3_5", "ldb_di0", 2, 7); 725 - clk[IMX6QDL_CLK_LDB_DI1_DIV_3_5] = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1", 2, 7); 727 + hws[IMX6QDL_CLK_IPG_PER] = imx_clk_hw_divider("ipg_per", "ipg_per_sel", base + 0x1c, 0, 6); 728 + hws[IMX6QDL_CLK_ECSPI_ROOT] = imx_clk_hw_divider("ecspi_root", "ecspi_sel", base + 0x38, 19, 6); 729 + hws[IMX6QDL_CLK_CAN_ROOT] = imx_clk_hw_divider("can_root", "can_sel", base + 0x20, 2, 6); 730 + hws[IMX6QDL_CLK_UART_SERIAL_PODF] = imx_clk_hw_divider("uart_serial_podf", "uart_sel", base + 0x24, 0, 6); 731 + hws[IMX6QDL_CLK_LDB_DI0_DIV_3_5] = imx_clk_hw_fixed_factor("ldb_di0_div_3_5", "ldb_di0", 2, 7); 732 + hws[IMX6QDL_CLK_LDB_DI1_DIV_3_5] = imx_clk_hw_fixed_factor("ldb_di1_div_3_5", "ldb_di1", 2, 7); 726 733 } else { 727 - clk[IMX6QDL_CLK_ECSPI_ROOT] = imx_clk_divider("ecspi_root", "pll3_60m", base + 0x38, 19, 6); 728 - clk[IMX6QDL_CLK_CAN_ROOT] = imx_clk_divider("can_root", "pll3_60m", base + 0x20, 2, 6); 729 - clk[IMX6QDL_CLK_IPG_PER] = imx_clk_fixup_divider("ipg_per", "ipg", base + 0x1c, 0, 6, imx_cscmr1_fixup); 730 - clk[IMX6QDL_CLK_UART_SERIAL_PODF] = imx_clk_divider("uart_serial_podf", "pll3_80m", base + 0x24, 0, 6); 731 - clk[IMX6QDL_CLK_LDB_DI0_DIV_3_5] = imx_clk_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7); 732 - clk[IMX6QDL_CLK_LDB_DI1_DIV_3_5] = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1_sel", 2, 7); 734 + hws[IMX6QDL_CLK_ECSPI_ROOT] = imx_clk_hw_divider("ecspi_root", "pll3_60m", base + 0x38, 19, 6); 735 + hws[IMX6QDL_CLK_CAN_ROOT] = imx_clk_hw_divider("can_root", "pll3_60m", base + 0x20, 2, 6); 736 + hws[IMX6QDL_CLK_IPG_PER] = imx_clk_hw_fixup_divider("ipg_per", "ipg", base + 0x1c, 0, 6, imx_cscmr1_fixup); 737 + hws[IMX6QDL_CLK_UART_SERIAL_PODF] = imx_clk_hw_divider("uart_serial_podf", "pll3_80m", base + 0x24, 0, 6); 738 + hws[IMX6QDL_CLK_LDB_DI0_DIV_3_5] = imx_clk_hw_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7); 739 + hws[IMX6QDL_CLK_LDB_DI1_DIV_3_5] = imx_clk_hw_fixed_factor("ldb_di1_div_3_5", "ldb_di1_sel", 2, 7); 733 740 } 741 + 734 742 if (clk_on_imx6dl()) 735 - clk[IMX6QDL_CLK_MLB_PODF] = imx_clk_divider("mlb_podf", "mlb_sel", base + 0x18, 23, 3); 743 + hws[IMX6QDL_CLK_MLB_PODF] = imx_clk_hw_divider("mlb_podf", "mlb_sel", base + 0x18, 23, 3); 736 744 else 737 - clk[IMX6QDL_CLK_GPU2D_CORE_PODF] = imx_clk_divider("gpu2d_core_podf", "gpu2d_core_sel", base + 0x18, 23, 3); 738 - clk[IMX6QDL_CLK_GPU3D_CORE_PODF] = imx_clk_divider("gpu3d_core_podf", "gpu3d_core_sel", base + 0x18, 26, 3); 745 + hws[IMX6QDL_CLK_GPU2D_CORE_PODF] = imx_clk_hw_divider("gpu2d_core_podf", "gpu2d_core_sel", base + 0x18, 23, 3); 746 + hws[IMX6QDL_CLK_GPU3D_CORE_PODF] = imx_clk_hw_divider("gpu3d_core_podf", "gpu3d_core_sel", base + 0x18, 26, 3); 739 747 if (clk_on_imx6dl()) 740 - clk[IMX6QDL_CLK_GPU2D_CORE_PODF] = imx_clk_divider("gpu2d_core_podf", "gpu2d_core_sel", base + 0x18, 29, 3); 748 + hws[IMX6QDL_CLK_GPU2D_CORE_PODF] = imx_clk_hw_divider("gpu2d_core_podf", "gpu2d_core_sel", base + 0x18, 29, 3); 741 749 else 742 - clk[IMX6QDL_CLK_GPU3D_SHADER] = imx_clk_divider("gpu3d_shader", "gpu3d_shader_sel", base + 0x18, 29, 3); 743 - clk[IMX6QDL_CLK_IPU1_PODF] = imx_clk_divider("ipu1_podf", "ipu1_sel", base + 0x3c, 11, 3); 744 - clk[IMX6QDL_CLK_IPU2_PODF] = imx_clk_divider("ipu2_podf", "ipu2_sel", base + 0x3c, 16, 3); 745 - clk[IMX6QDL_CLK_LDB_DI0_PODF] = imx_clk_divider_flags("ldb_di0_podf", "ldb_di0_div_3_5", base + 0x20, 10, 1, 0); 746 - clk[IMX6QDL_CLK_LDB_DI1_PODF] = imx_clk_divider_flags("ldb_di1_podf", "ldb_di1_div_3_5", base + 0x20, 11, 1, 0); 747 - clk[IMX6QDL_CLK_IPU1_DI0_PRE] = imx_clk_divider("ipu1_di0_pre", "ipu1_di0_pre_sel", base + 0x34, 3, 3); 748 - clk[IMX6QDL_CLK_IPU1_DI1_PRE] = imx_clk_divider("ipu1_di1_pre", "ipu1_di1_pre_sel", base + 0x34, 12, 3); 749 - clk[IMX6QDL_CLK_IPU2_DI0_PRE] = imx_clk_divider("ipu2_di0_pre", "ipu2_di0_pre_sel", base + 0x38, 3, 3); 750 - clk[IMX6QDL_CLK_IPU2_DI1_PRE] = imx_clk_divider("ipu2_di1_pre", "ipu2_di1_pre_sel", base + 0x38, 12, 3); 751 - clk[IMX6QDL_CLK_HSI_TX_PODF] = imx_clk_divider("hsi_tx_podf", "hsi_tx_sel", base + 0x30, 29, 3); 752 - clk[IMX6QDL_CLK_SSI1_PRED] = imx_clk_divider("ssi1_pred", "ssi1_sel", base + 0x28, 6, 3); 753 - clk[IMX6QDL_CLK_SSI1_PODF] = imx_clk_divider("ssi1_podf", "ssi1_pred", base + 0x28, 0, 6); 754 - clk[IMX6QDL_CLK_SSI2_PRED] = imx_clk_divider("ssi2_pred", "ssi2_sel", base + 0x2c, 6, 3); 755 - clk[IMX6QDL_CLK_SSI2_PODF] = imx_clk_divider("ssi2_podf", "ssi2_pred", base + 0x2c, 0, 6); 756 - clk[IMX6QDL_CLK_SSI3_PRED] = imx_clk_divider("ssi3_pred", "ssi3_sel", base + 0x28, 22, 3); 757 - clk[IMX6QDL_CLK_SSI3_PODF] = imx_clk_divider("ssi3_podf", "ssi3_pred", base + 0x28, 16, 6); 758 - clk[IMX6QDL_CLK_USDHC1_PODF] = imx_clk_divider("usdhc1_podf", "usdhc1_sel", base + 0x24, 11, 3); 759 - clk[IMX6QDL_CLK_USDHC2_PODF] = imx_clk_divider("usdhc2_podf", "usdhc2_sel", base + 0x24, 16, 3); 760 - clk[IMX6QDL_CLK_USDHC3_PODF] = imx_clk_divider("usdhc3_podf", "usdhc3_sel", base + 0x24, 19, 3); 761 - clk[IMX6QDL_CLK_USDHC4_PODF] = imx_clk_divider("usdhc4_podf", "usdhc4_sel", base + 0x24, 22, 3); 762 - clk[IMX6QDL_CLK_ENFC_PRED] = imx_clk_divider("enfc_pred", "enfc_sel", base + 0x2c, 18, 3); 763 - clk[IMX6QDL_CLK_ENFC_PODF] = imx_clk_divider("enfc_podf", "enfc_pred", base + 0x2c, 21, 6); 750 + hws[IMX6QDL_CLK_GPU3D_SHADER] = imx_clk_hw_divider("gpu3d_shader", "gpu3d_shader_sel", base + 0x18, 29, 3); 751 + hws[IMX6QDL_CLK_IPU1_PODF] = imx_clk_hw_divider("ipu1_podf", "ipu1_sel", base + 0x3c, 11, 3); 752 + hws[IMX6QDL_CLK_IPU2_PODF] = imx_clk_hw_divider("ipu2_podf", "ipu2_sel", base + 0x3c, 16, 3); 753 + hws[IMX6QDL_CLK_LDB_DI0_PODF] = imx_clk_hw_divider_flags("ldb_di0_podf", "ldb_di0_div_3_5", base + 0x20, 10, 1, 0); 754 + hws[IMX6QDL_CLK_LDB_DI1_PODF] = imx_clk_hw_divider_flags("ldb_di1_podf", "ldb_di1_div_3_5", base + 0x20, 11, 1, 0); 755 + hws[IMX6QDL_CLK_IPU1_DI0_PRE] = imx_clk_hw_divider("ipu1_di0_pre", "ipu1_di0_pre_sel", base + 0x34, 3, 3); 756 + hws[IMX6QDL_CLK_IPU1_DI1_PRE] = imx_clk_hw_divider("ipu1_di1_pre", "ipu1_di1_pre_sel", base + 0x34, 12, 3); 757 + hws[IMX6QDL_CLK_IPU2_DI0_PRE] = imx_clk_hw_divider("ipu2_di0_pre", "ipu2_di0_pre_sel", base + 0x38, 3, 3); 758 + hws[IMX6QDL_CLK_IPU2_DI1_PRE] = imx_clk_hw_divider("ipu2_di1_pre", "ipu2_di1_pre_sel", base + 0x38, 12, 3); 759 + hws[IMX6QDL_CLK_HSI_TX_PODF] = imx_clk_hw_divider("hsi_tx_podf", "hsi_tx_sel", base + 0x30, 29, 3); 760 + hws[IMX6QDL_CLK_SSI1_PRED] = imx_clk_hw_divider("ssi1_pred", "ssi1_sel", base + 0x28, 6, 3); 761 + hws[IMX6QDL_CLK_SSI1_PODF] = imx_clk_hw_divider("ssi1_podf", "ssi1_pred", base + 0x28, 0, 6); 762 + hws[IMX6QDL_CLK_SSI2_PRED] = imx_clk_hw_divider("ssi2_pred", "ssi2_sel", base + 0x2c, 6, 3); 763 + hws[IMX6QDL_CLK_SSI2_PODF] = imx_clk_hw_divider("ssi2_podf", "ssi2_pred", base + 0x2c, 0, 6); 764 + hws[IMX6QDL_CLK_SSI3_PRED] = imx_clk_hw_divider("ssi3_pred", "ssi3_sel", base + 0x28, 22, 3); 765 + hws[IMX6QDL_CLK_SSI3_PODF] = imx_clk_hw_divider("ssi3_podf", "ssi3_pred", base + 0x28, 16, 6); 766 + hws[IMX6QDL_CLK_USDHC1_PODF] = imx_clk_hw_divider("usdhc1_podf", "usdhc1_sel", base + 0x24, 11, 3); 767 + hws[IMX6QDL_CLK_USDHC2_PODF] = imx_clk_hw_divider("usdhc2_podf", "usdhc2_sel", base + 0x24, 16, 3); 768 + hws[IMX6QDL_CLK_USDHC3_PODF] = imx_clk_hw_divider("usdhc3_podf", "usdhc3_sel", base + 0x24, 19, 3); 769 + hws[IMX6QDL_CLK_USDHC4_PODF] = imx_clk_hw_divider("usdhc4_podf", "usdhc4_sel", base + 0x24, 22, 3); 770 + hws[IMX6QDL_CLK_ENFC_PRED] = imx_clk_hw_divider("enfc_pred", "enfc_sel", base + 0x2c, 18, 3); 771 + hws[IMX6QDL_CLK_ENFC_PODF] = imx_clk_hw_divider("enfc_podf", "enfc_pred", base + 0x2c, 21, 6); 764 772 if (clk_on_imx6qp()) { 765 - clk[IMX6QDL_CLK_EIM_PODF] = imx_clk_divider("eim_podf", "eim_sel", base + 0x1c, 20, 3); 766 - clk[IMX6QDL_CLK_EIM_SLOW_PODF] = imx_clk_divider("eim_slow_podf", "eim_slow_sel", base + 0x1c, 23, 3); 773 + hws[IMX6QDL_CLK_EIM_PODF] = imx_clk_hw_divider("eim_podf", "eim_sel", base + 0x1c, 20, 3); 774 + hws[IMX6QDL_CLK_EIM_SLOW_PODF] = imx_clk_hw_divider("eim_slow_podf", "eim_slow_sel", base + 0x1c, 23, 3); 767 775 } else { 768 - clk[IMX6QDL_CLK_EIM_PODF] = imx_clk_fixup_divider("eim_podf", "eim_sel", base + 0x1c, 20, 3, imx_cscmr1_fixup); 769 - clk[IMX6QDL_CLK_EIM_SLOW_PODF] = imx_clk_fixup_divider("eim_slow_podf", "eim_slow_sel", base + 0x1c, 23, 3, imx_cscmr1_fixup); 776 + hws[IMX6QDL_CLK_EIM_PODF] = imx_clk_hw_fixup_divider("eim_podf", "eim_sel", base + 0x1c, 20, 3, imx_cscmr1_fixup); 777 + hws[IMX6QDL_CLK_EIM_SLOW_PODF] = imx_clk_hw_fixup_divider("eim_slow_podf", "eim_slow_sel", base + 0x1c, 23, 3, imx_cscmr1_fixup); 770 778 } 771 - clk[IMX6QDL_CLK_VPU_AXI_PODF] = imx_clk_divider("vpu_axi_podf", "vpu_axi_sel", base + 0x24, 25, 3); 772 - clk[IMX6QDL_CLK_CKO1_PODF] = imx_clk_divider("cko1_podf", "cko1_sel", base + 0x60, 4, 3); 773 - clk[IMX6QDL_CLK_CKO2_PODF] = imx_clk_divider("cko2_podf", "cko2_sel", base + 0x60, 21, 3); 779 + 780 + hws[IMX6QDL_CLK_VPU_AXI_PODF] = imx_clk_hw_divider("vpu_axi_podf", "vpu_axi_sel", base + 0x24, 25, 3); 781 + hws[IMX6QDL_CLK_CKO1_PODF] = imx_clk_hw_divider("cko1_podf", "cko1_sel", base + 0x60, 4, 3); 782 + hws[IMX6QDL_CLK_CKO2_PODF] = imx_clk_hw_divider("cko2_podf", "cko2_sel", base + 0x60, 21, 3); 774 783 775 784 /* name parent_name reg shift width busy: reg, shift */ 776 - clk[IMX6QDL_CLK_AXI] = imx_clk_busy_divider("axi", "axi_sel", base + 0x14, 16, 3, base + 0x48, 0); 777 - clk[IMX6QDL_CLK_MMDC_CH0_AXI_PODF] = imx_clk_busy_divider("mmdc_ch0_axi_podf", "periph", base + 0x14, 19, 3, base + 0x48, 4); 785 + hws[IMX6QDL_CLK_AXI] = imx_clk_hw_busy_divider("axi", "axi_sel", base + 0x14, 16, 3, base + 0x48, 0); 786 + hws[IMX6QDL_CLK_MMDC_CH0_AXI_PODF] = imx_clk_hw_busy_divider("mmdc_ch0_axi_podf", "periph", base + 0x14, 19, 3, base + 0x48, 4); 778 787 if (clk_on_imx6qp()) { 779 - clk[IMX6QDL_CLK_MMDC_CH1_AXI_CG] = imx_clk_gate("mmdc_ch1_axi_cg", "periph2", base + 0x4, 18); 780 - clk[IMX6QDL_CLK_MMDC_CH1_AXI_PODF] = imx_clk_busy_divider("mmdc_ch1_axi_podf", "mmdc_ch1_axi_cg", base + 0x14, 3, 3, base + 0x48, 2); 788 + hws[IMX6QDL_CLK_MMDC_CH1_AXI_CG] = imx_clk_hw_gate("mmdc_ch1_axi_cg", "periph2", base + 0x4, 18); 789 + hws[IMX6QDL_CLK_MMDC_CH1_AXI_PODF] = imx_clk_hw_busy_divider("mmdc_ch1_axi_podf", "mmdc_ch1_axi_cg", base + 0x14, 3, 3, base + 0x48, 2); 781 790 } else { 782 - clk[IMX6QDL_CLK_MMDC_CH1_AXI_PODF] = imx_clk_busy_divider("mmdc_ch1_axi_podf", "periph2", base + 0x14, 3, 3, base + 0x48, 2); 791 + hws[IMX6QDL_CLK_MMDC_CH1_AXI_PODF] = imx_clk_hw_busy_divider("mmdc_ch1_axi_podf", "periph2", base + 0x14, 3, 3, base + 0x48, 2); 783 792 } 784 - clk[IMX6QDL_CLK_ARM] = imx_clk_busy_divider("arm", "pll1_sw", base + 0x10, 0, 3, base + 0x48, 16); 785 - clk[IMX6QDL_CLK_AHB] = imx_clk_busy_divider("ahb", "periph", base + 0x14, 10, 3, base + 0x48, 1); 793 + hws[IMX6QDL_CLK_ARM] = imx_clk_hw_busy_divider("arm", "pll1_sw", base + 0x10, 0, 3, base + 0x48, 16); 794 + hws[IMX6QDL_CLK_AHB] = imx_clk_hw_busy_divider("ahb", "periph", base + 0x14, 10, 3, base + 0x48, 1); 786 795 787 796 /* name parent_name reg shift */ 788 - clk[IMX6QDL_CLK_APBH_DMA] = imx_clk_gate2("apbh_dma", "usdhc3", base + 0x68, 4); 789 - clk[IMX6QDL_CLK_ASRC] = imx_clk_gate2_shared("asrc", "asrc_podf", base + 0x68, 6, &share_count_asrc); 790 - clk[IMX6QDL_CLK_ASRC_IPG] = imx_clk_gate2_shared("asrc_ipg", "ahb", base + 0x68, 6, &share_count_asrc); 791 - clk[IMX6QDL_CLK_ASRC_MEM] = imx_clk_gate2_shared("asrc_mem", "ahb", base + 0x68, 6, &share_count_asrc); 792 - clk[IMX6QDL_CLK_CAAM_MEM] = imx_clk_gate2("caam_mem", "ahb", base + 0x68, 8); 793 - clk[IMX6QDL_CLK_CAAM_ACLK] = imx_clk_gate2("caam_aclk", "ahb", base + 0x68, 10); 794 - clk[IMX6QDL_CLK_CAAM_IPG] = imx_clk_gate2("caam_ipg", "ipg", base + 0x68, 12); 795 - clk[IMX6QDL_CLK_CAN1_IPG] = imx_clk_gate2("can1_ipg", "ipg", base + 0x68, 14); 796 - clk[IMX6QDL_CLK_CAN1_SERIAL] = imx_clk_gate2("can1_serial", "can_root", base + 0x68, 16); 797 - clk[IMX6QDL_CLK_CAN2_IPG] = imx_clk_gate2("can2_ipg", "ipg", base + 0x68, 18); 798 - clk[IMX6QDL_CLK_CAN2_SERIAL] = imx_clk_gate2("can2_serial", "can_root", base + 0x68, 20); 799 - clk[IMX6QDL_CLK_DCIC1] = imx_clk_gate2("dcic1", "ipu1_podf", base + 0x68, 24); 800 - clk[IMX6QDL_CLK_DCIC2] = imx_clk_gate2("dcic2", "ipu2_podf", base + 0x68, 26); 801 - clk[IMX6QDL_CLK_ECSPI1] = imx_clk_gate2("ecspi1", "ecspi_root", base + 0x6c, 0); 802 - clk[IMX6QDL_CLK_ECSPI2] = imx_clk_gate2("ecspi2", "ecspi_root", base + 0x6c, 2); 803 - clk[IMX6QDL_CLK_ECSPI3] = imx_clk_gate2("ecspi3", "ecspi_root", base + 0x6c, 4); 804 - clk[IMX6QDL_CLK_ECSPI4] = imx_clk_gate2("ecspi4", "ecspi_root", base + 0x6c, 6); 797 + hws[IMX6QDL_CLK_APBH_DMA] = imx_clk_hw_gate2("apbh_dma", "usdhc3", base + 0x68, 4); 798 + hws[IMX6QDL_CLK_ASRC] = imx_clk_hw_gate2_shared("asrc", "asrc_podf", base + 0x68, 6, &share_count_asrc); 799 + hws[IMX6QDL_CLK_ASRC_IPG] = imx_clk_hw_gate2_shared("asrc_ipg", "ahb", base + 0x68, 6, &share_count_asrc); 800 + hws[IMX6QDL_CLK_ASRC_MEM] = imx_clk_hw_gate2_shared("asrc_mem", "ahb", base + 0x68, 6, &share_count_asrc); 801 + hws[IMX6QDL_CLK_CAAM_MEM] = imx_clk_hw_gate2("caam_mem", "ahb", base + 0x68, 8); 802 + hws[IMX6QDL_CLK_CAAM_ACLK] = imx_clk_hw_gate2("caam_aclk", "ahb", base + 0x68, 10); 803 + hws[IMX6QDL_CLK_CAAM_IPG] = imx_clk_hw_gate2("caam_ipg", "ipg", base + 0x68, 12); 804 + hws[IMX6QDL_CLK_CAN1_IPG] = imx_clk_hw_gate2("can1_ipg", "ipg", base + 0x68, 14); 805 + hws[IMX6QDL_CLK_CAN1_SERIAL] = imx_clk_hw_gate2("can1_serial", "can_root", base + 0x68, 16); 806 + hws[IMX6QDL_CLK_CAN2_IPG] = imx_clk_hw_gate2("can2_ipg", "ipg", base + 0x68, 18); 807 + hws[IMX6QDL_CLK_CAN2_SERIAL] = imx_clk_hw_gate2("can2_serial", "can_root", base + 0x68, 20); 808 + hws[IMX6QDL_CLK_DCIC1] = imx_clk_hw_gate2("dcic1", "ipu1_podf", base + 0x68, 24); 809 + hws[IMX6QDL_CLK_DCIC2] = imx_clk_hw_gate2("dcic2", "ipu2_podf", base + 0x68, 26); 810 + hws[IMX6QDL_CLK_ECSPI1] = imx_clk_hw_gate2("ecspi1", "ecspi_root", base + 0x6c, 0); 811 + hws[IMX6QDL_CLK_ECSPI2] = imx_clk_hw_gate2("ecspi2", "ecspi_root", base + 0x6c, 2); 812 + hws[IMX6QDL_CLK_ECSPI3] = imx_clk_hw_gate2("ecspi3", "ecspi_root", base + 0x6c, 4); 813 + hws[IMX6QDL_CLK_ECSPI4] = imx_clk_hw_gate2("ecspi4", "ecspi_root", base + 0x6c, 6); 805 814 if (clk_on_imx6dl()) 806 - clk[IMX6DL_CLK_I2C4] = imx_clk_gate2("i2c4", "ipg_per", base + 0x6c, 8); 815 + hws[IMX6DL_CLK_I2C4] = imx_clk_hw_gate2("i2c4", "ipg_per", base + 0x6c, 8); 807 816 else 808 - clk[IMX6Q_CLK_ECSPI5] = imx_clk_gate2("ecspi5", "ecspi_root", base + 0x6c, 8); 809 - clk[IMX6QDL_CLK_ENET] = imx_clk_gate2("enet", "ipg", base + 0x6c, 10); 810 - clk[IMX6QDL_CLK_EPIT1] = imx_clk_gate2("epit1", "ipg", base + 0x6c, 12); 811 - clk[IMX6QDL_CLK_EPIT2] = imx_clk_gate2("epit2", "ipg", base + 0x6c, 14); 812 - clk[IMX6QDL_CLK_ESAI_EXTAL] = imx_clk_gate2_shared("esai_extal", "esai_podf", base + 0x6c, 16, &share_count_esai); 813 - clk[IMX6QDL_CLK_ESAI_IPG] = imx_clk_gate2_shared("esai_ipg", "ahb", base + 0x6c, 16, &share_count_esai); 814 - clk[IMX6QDL_CLK_ESAI_MEM] = imx_clk_gate2_shared("esai_mem", "ahb", base + 0x6c, 16, &share_count_esai); 815 - clk[IMX6QDL_CLK_GPT_IPG] = imx_clk_gate2("gpt_ipg", "ipg", base + 0x6c, 20); 816 - clk[IMX6QDL_CLK_GPT_IPG_PER] = imx_clk_gate2("gpt_ipg_per", "ipg_per", base + 0x6c, 22); 817 - clk[IMX6QDL_CLK_GPU2D_CORE] = imx_clk_gate2("gpu2d_core", "gpu2d_core_podf", base + 0x6c, 24); 818 - clk[IMX6QDL_CLK_GPU3D_CORE] = imx_clk_gate2("gpu3d_core", "gpu3d_core_podf", base + 0x6c, 26); 819 - clk[IMX6QDL_CLK_HDMI_IAHB] = imx_clk_gate2("hdmi_iahb", "ahb", base + 0x70, 0); 820 - clk[IMX6QDL_CLK_HDMI_ISFR] = imx_clk_gate2("hdmi_isfr", "mipi_core_cfg", base + 0x70, 4); 821 - clk[IMX6QDL_CLK_I2C1] = imx_clk_gate2("i2c1", "ipg_per", base + 0x70, 6); 822 - clk[IMX6QDL_CLK_I2C2] = imx_clk_gate2("i2c2", "ipg_per", base + 0x70, 8); 823 - clk[IMX6QDL_CLK_I2C3] = imx_clk_gate2("i2c3", "ipg_per", base + 0x70, 10); 824 - clk[IMX6QDL_CLK_IIM] = imx_clk_gate2("iim", "ipg", base + 0x70, 12); 825 - clk[IMX6QDL_CLK_ENFC] = imx_clk_gate2("enfc", "enfc_podf", base + 0x70, 14); 826 - clk[IMX6QDL_CLK_VDOA] = imx_clk_gate2("vdoa", "vdo_axi", base + 0x70, 26); 827 - clk[IMX6QDL_CLK_IPU1] = imx_clk_gate2("ipu1", "ipu1_podf", base + 0x74, 0); 828 - clk[IMX6QDL_CLK_IPU1_DI0] = imx_clk_gate2("ipu1_di0", "ipu1_di0_sel", base + 0x74, 2); 829 - clk[IMX6QDL_CLK_IPU1_DI1] = imx_clk_gate2("ipu1_di1", "ipu1_di1_sel", base + 0x74, 4); 830 - clk[IMX6QDL_CLK_IPU2] = imx_clk_gate2("ipu2", "ipu2_podf", base + 0x74, 6); 831 - clk[IMX6QDL_CLK_IPU2_DI0] = imx_clk_gate2("ipu2_di0", "ipu2_di0_sel", base + 0x74, 8); 817 + hws[IMX6Q_CLK_ECSPI5] = imx_clk_hw_gate2("ecspi5", "ecspi_root", base + 0x6c, 8); 818 + hws[IMX6QDL_CLK_ENET] = imx_clk_hw_gate2("enet", "ipg", base + 0x6c, 10); 819 + hws[IMX6QDL_CLK_EPIT1] = imx_clk_hw_gate2("epit1", "ipg", base + 0x6c, 12); 820 + hws[IMX6QDL_CLK_EPIT2] = imx_clk_hw_gate2("epit2", "ipg", base + 0x6c, 14); 821 + hws[IMX6QDL_CLK_ESAI_EXTAL] = imx_clk_hw_gate2_shared("esai_extal", "esai_podf", base + 0x6c, 16, &share_count_esai); 822 + hws[IMX6QDL_CLK_ESAI_IPG] = imx_clk_hw_gate2_shared("esai_ipg", "ahb", base + 0x6c, 16, &share_count_esai); 823 + hws[IMX6QDL_CLK_ESAI_MEM] = imx_clk_hw_gate2_shared("esai_mem", "ahb", base + 0x6c, 16, &share_count_esai); 824 + hws[IMX6QDL_CLK_GPT_IPG] = imx_clk_hw_gate2("gpt_ipg", "ipg", base + 0x6c, 20); 825 + hws[IMX6QDL_CLK_GPT_IPG_PER] = imx_clk_hw_gate2("gpt_ipg_per", "ipg_per", base + 0x6c, 22); 826 + hws[IMX6QDL_CLK_GPU2D_CORE] = imx_clk_hw_gate2("gpu2d_core", "gpu2d_core_podf", base + 0x6c, 24); 827 + hws[IMX6QDL_CLK_GPU3D_CORE] = imx_clk_hw_gate2("gpu3d_core", "gpu3d_core_podf", base + 0x6c, 26); 828 + hws[IMX6QDL_CLK_HDMI_IAHB] = imx_clk_hw_gate2("hdmi_iahb", "ahb", base + 0x70, 0); 829 + hws[IMX6QDL_CLK_HDMI_ISFR] = imx_clk_hw_gate2("hdmi_isfr", "mipi_core_cfg", base + 0x70, 4); 830 + hws[IMX6QDL_CLK_I2C1] = imx_clk_hw_gate2("i2c1", "ipg_per", base + 0x70, 6); 831 + hws[IMX6QDL_CLK_I2C2] = imx_clk_hw_gate2("i2c2", "ipg_per", base + 0x70, 8); 832 + hws[IMX6QDL_CLK_I2C3] = imx_clk_hw_gate2("i2c3", "ipg_per", base + 0x70, 10); 833 + hws[IMX6QDL_CLK_IIM] = imx_clk_hw_gate2("iim", "ipg", base + 0x70, 12); 834 + hws[IMX6QDL_CLK_ENFC] = imx_clk_hw_gate2("enfc", "enfc_podf", base + 0x70, 14); 835 + hws[IMX6QDL_CLK_VDOA] = imx_clk_hw_gate2("vdoa", "vdo_axi", base + 0x70, 26); 836 + hws[IMX6QDL_CLK_IPU1] = imx_clk_hw_gate2("ipu1", "ipu1_podf", base + 0x74, 0); 837 + hws[IMX6QDL_CLK_IPU1_DI0] = imx_clk_hw_gate2("ipu1_di0", "ipu1_di0_sel", base + 0x74, 2); 838 + hws[IMX6QDL_CLK_IPU1_DI1] = imx_clk_hw_gate2("ipu1_di1", "ipu1_di1_sel", base + 0x74, 4); 839 + hws[IMX6QDL_CLK_IPU2] = imx_clk_hw_gate2("ipu2", "ipu2_podf", base + 0x74, 6); 840 + hws[IMX6QDL_CLK_IPU2_DI0] = imx_clk_hw_gate2("ipu2_di0", "ipu2_di0_sel", base + 0x74, 8); 832 841 if (clk_on_imx6qp()) { 833 - clk[IMX6QDL_CLK_LDB_DI0] = imx_clk_gate2("ldb_di0", "ldb_di0_sel", base + 0x74, 12); 834 - clk[IMX6QDL_CLK_LDB_DI1] = imx_clk_gate2("ldb_di1", "ldb_di1_sel", base + 0x74, 14); 842 + hws[IMX6QDL_CLK_LDB_DI0] = imx_clk_hw_gate2("ldb_di0", "ldb_di0_sel", base + 0x74, 12); 843 + hws[IMX6QDL_CLK_LDB_DI1] = imx_clk_hw_gate2("ldb_di1", "ldb_di1_sel", base + 0x74, 14); 835 844 } else { 836 - clk[IMX6QDL_CLK_LDB_DI0] = imx_clk_gate2("ldb_di0", "ldb_di0_podf", base + 0x74, 12); 837 - clk[IMX6QDL_CLK_LDB_DI1] = imx_clk_gate2("ldb_di1", "ldb_di1_podf", base + 0x74, 14); 845 + hws[IMX6QDL_CLK_LDB_DI0] = imx_clk_hw_gate2("ldb_di0", "ldb_di0_podf", base + 0x74, 12); 846 + hws[IMX6QDL_CLK_LDB_DI1] = imx_clk_hw_gate2("ldb_di1", "ldb_di1_podf", base + 0x74, 14); 838 847 } 839 - clk[IMX6QDL_CLK_IPU2_DI1] = imx_clk_gate2("ipu2_di1", "ipu2_di1_sel", base + 0x74, 10); 840 - clk[IMX6QDL_CLK_HSI_TX] = imx_clk_gate2_shared("hsi_tx", "hsi_tx_podf", base + 0x74, 16, &share_count_mipi_core_cfg); 841 - clk[IMX6QDL_CLK_MIPI_CORE_CFG] = imx_clk_gate2_shared("mipi_core_cfg", "video_27m", base + 0x74, 16, &share_count_mipi_core_cfg); 842 - clk[IMX6QDL_CLK_MIPI_IPG] = imx_clk_gate2_shared("mipi_ipg", "ipg", base + 0x74, 16, &share_count_mipi_core_cfg); 848 + hws[IMX6QDL_CLK_IPU2_DI1] = imx_clk_hw_gate2("ipu2_di1", "ipu2_di1_sel", base + 0x74, 10); 849 + hws[IMX6QDL_CLK_HSI_TX] = imx_clk_hw_gate2_shared("hsi_tx", "hsi_tx_podf", base + 0x74, 16, &share_count_mipi_core_cfg); 850 + hws[IMX6QDL_CLK_MIPI_CORE_CFG] = imx_clk_hw_gate2_shared("mipi_core_cfg", "video_27m", base + 0x74, 16, &share_count_mipi_core_cfg); 851 + hws[IMX6QDL_CLK_MIPI_IPG] = imx_clk_hw_gate2_shared("mipi_ipg", "ipg", base + 0x74, 16, &share_count_mipi_core_cfg); 852 + 843 853 if (clk_on_imx6dl()) 844 854 /* 845 855 * The multiplexer and divider of the imx6q clock gpu2d get 846 856 * redefined/reused as mlb_sys_sel and mlb_sys_clk_podf on imx6dl. 847 857 */ 848 - clk[IMX6QDL_CLK_MLB] = imx_clk_gate2("mlb", "mlb_podf", base + 0x74, 18); 858 + hws[IMX6QDL_CLK_MLB] = imx_clk_hw_gate2("mlb", "mlb_podf", base + 0x74, 18); 849 859 else 850 - clk[IMX6QDL_CLK_MLB] = imx_clk_gate2("mlb", "axi", base + 0x74, 18); 851 - clk[IMX6QDL_CLK_MMDC_CH0_AXI] = imx_clk_gate2_flags("mmdc_ch0_axi", "mmdc_ch0_axi_podf", base + 0x74, 20, CLK_IS_CRITICAL); 852 - clk[IMX6QDL_CLK_MMDC_CH1_AXI] = imx_clk_gate2("mmdc_ch1_axi", "mmdc_ch1_axi_podf", base + 0x74, 22); 853 - clk[IMX6QDL_CLK_MMDC_P0_IPG] = imx_clk_gate2_flags("mmdc_p0_ipg", "ipg", base + 0x74, 24, CLK_IS_CRITICAL); 854 - clk[IMX6QDL_CLK_OCRAM] = imx_clk_gate2("ocram", "ahb", base + 0x74, 28); 855 - clk[IMX6QDL_CLK_OPENVG_AXI] = imx_clk_gate2("openvg_axi", "axi", base + 0x74, 30); 856 - clk[IMX6QDL_CLK_PCIE_AXI] = imx_clk_gate2("pcie_axi", "pcie_axi_sel", base + 0x78, 0); 857 - clk[IMX6QDL_CLK_PER1_BCH] = imx_clk_gate2("per1_bch", "usdhc3", base + 0x78, 12); 858 - clk[IMX6QDL_CLK_PWM1] = imx_clk_gate2("pwm1", "ipg_per", base + 0x78, 16); 859 - clk[IMX6QDL_CLK_PWM2] = imx_clk_gate2("pwm2", "ipg_per", base + 0x78, 18); 860 - clk[IMX6QDL_CLK_PWM3] = imx_clk_gate2("pwm3", "ipg_per", base + 0x78, 20); 861 - clk[IMX6QDL_CLK_PWM4] = imx_clk_gate2("pwm4", "ipg_per", base + 0x78, 22); 862 - clk[IMX6QDL_CLK_GPMI_BCH_APB] = imx_clk_gate2("gpmi_bch_apb", "usdhc3", base + 0x78, 24); 863 - clk[IMX6QDL_CLK_GPMI_BCH] = imx_clk_gate2("gpmi_bch", "usdhc4", base + 0x78, 26); 864 - clk[IMX6QDL_CLK_GPMI_IO] = imx_clk_gate2("gpmi_io", "enfc", base + 0x78, 28); 865 - clk[IMX6QDL_CLK_GPMI_APB] = imx_clk_gate2("gpmi_apb", "usdhc3", base + 0x78, 30); 866 - clk[IMX6QDL_CLK_ROM] = imx_clk_gate2_flags("rom", "ahb", base + 0x7c, 0, CLK_IS_CRITICAL); 867 - clk[IMX6QDL_CLK_SATA] = imx_clk_gate2("sata", "ahb", base + 0x7c, 4); 868 - clk[IMX6QDL_CLK_SDMA] = imx_clk_gate2("sdma", "ahb", base + 0x7c, 6); 869 - clk[IMX6QDL_CLK_SPBA] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12); 870 - clk[IMX6QDL_CLK_SPDIF] = imx_clk_gate2_shared("spdif", "spdif_podf", base + 0x7c, 14, &share_count_spdif); 871 - clk[IMX6QDL_CLK_SPDIF_GCLK] = imx_clk_gate2_shared("spdif_gclk", "ipg", base + 0x7c, 14, &share_count_spdif); 872 - clk[IMX6QDL_CLK_SSI1_IPG] = imx_clk_gate2_shared("ssi1_ipg", "ipg", base + 0x7c, 18, &share_count_ssi1); 873 - clk[IMX6QDL_CLK_SSI2_IPG] = imx_clk_gate2_shared("ssi2_ipg", "ipg", base + 0x7c, 20, &share_count_ssi2); 874 - clk[IMX6QDL_CLK_SSI3_IPG] = imx_clk_gate2_shared("ssi3_ipg", "ipg", base + 0x7c, 22, &share_count_ssi3); 875 - clk[IMX6QDL_CLK_SSI1] = imx_clk_gate2_shared("ssi1", "ssi1_podf", base + 0x7c, 18, &share_count_ssi1); 876 - clk[IMX6QDL_CLK_SSI2] = imx_clk_gate2_shared("ssi2", "ssi2_podf", base + 0x7c, 20, &share_count_ssi2); 877 - clk[IMX6QDL_CLK_SSI3] = imx_clk_gate2_shared("ssi3", "ssi3_podf", base + 0x7c, 22, &share_count_ssi3); 878 - clk[IMX6QDL_CLK_UART_IPG] = imx_clk_gate2("uart_ipg", "ipg", base + 0x7c, 24); 879 - clk[IMX6QDL_CLK_UART_SERIAL] = imx_clk_gate2("uart_serial", "uart_serial_podf", base + 0x7c, 26); 880 - clk[IMX6QDL_CLK_USBOH3] = imx_clk_gate2("usboh3", "ipg", base + 0x80, 0); 881 - clk[IMX6QDL_CLK_USDHC1] = imx_clk_gate2("usdhc1", "usdhc1_podf", base + 0x80, 2); 882 - clk[IMX6QDL_CLK_USDHC2] = imx_clk_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4); 883 - clk[IMX6QDL_CLK_USDHC3] = imx_clk_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6); 884 - clk[IMX6QDL_CLK_USDHC4] = imx_clk_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8); 885 - clk[IMX6QDL_CLK_EIM_SLOW] = imx_clk_gate2("eim_slow", "eim_slow_podf", base + 0x80, 10); 886 - clk[IMX6QDL_CLK_VDO_AXI] = imx_clk_gate2("vdo_axi", "vdo_axi_sel", base + 0x80, 12); 887 - clk[IMX6QDL_CLK_VPU_AXI] = imx_clk_gate2("vpu_axi", "vpu_axi_podf", base + 0x80, 14); 860 + hws[IMX6QDL_CLK_MLB] = imx_clk_hw_gate2("mlb", "axi", base + 0x74, 18); 861 + hws[IMX6QDL_CLK_MMDC_CH0_AXI] = imx_clk_hw_gate2_flags("mmdc_ch0_axi", "mmdc_ch0_axi_podf", base + 0x74, 20, CLK_IS_CRITICAL); 862 + hws[IMX6QDL_CLK_MMDC_CH1_AXI] = imx_clk_hw_gate2("mmdc_ch1_axi", "mmdc_ch1_axi_podf", base + 0x74, 22); 863 + hws[IMX6QDL_CLK_MMDC_P0_IPG] = imx_clk_hw_gate2_flags("mmdc_p0_ipg", "ipg", base + 0x74, 24, CLK_IS_CRITICAL); 864 + hws[IMX6QDL_CLK_OCRAM] = imx_clk_hw_gate2("ocram", "ahb", base + 0x74, 28); 865 + hws[IMX6QDL_CLK_OPENVG_AXI] = imx_clk_hw_gate2("openvg_axi", "axi", base + 0x74, 30); 866 + hws[IMX6QDL_CLK_PCIE_AXI] = imx_clk_hw_gate2("pcie_axi", "pcie_axi_sel", base + 0x78, 0); 867 + hws[IMX6QDL_CLK_PER1_BCH] = imx_clk_hw_gate2("per1_bch", "usdhc3", base + 0x78, 12); 868 + hws[IMX6QDL_CLK_PWM1] = imx_clk_hw_gate2("pwm1", "ipg_per", base + 0x78, 16); 869 + hws[IMX6QDL_CLK_PWM2] = imx_clk_hw_gate2("pwm2", "ipg_per", base + 0x78, 18); 870 + hws[IMX6QDL_CLK_PWM3] = imx_clk_hw_gate2("pwm3", "ipg_per", base + 0x78, 20); 871 + hws[IMX6QDL_CLK_PWM4] = imx_clk_hw_gate2("pwm4", "ipg_per", base + 0x78, 22); 872 + hws[IMX6QDL_CLK_GPMI_BCH_APB] = imx_clk_hw_gate2("gpmi_bch_apb", "usdhc3", base + 0x78, 24); 873 + hws[IMX6QDL_CLK_GPMI_BCH] = imx_clk_hw_gate2("gpmi_bch", "usdhc4", base + 0x78, 26); 874 + hws[IMX6QDL_CLK_GPMI_IO] = imx_clk_hw_gate2("gpmi_io", "enfc", base + 0x78, 28); 875 + hws[IMX6QDL_CLK_GPMI_APB] = imx_clk_hw_gate2("gpmi_apb", "usdhc3", base + 0x78, 30); 876 + hws[IMX6QDL_CLK_ROM] = imx_clk_hw_gate2_flags("rom", "ahb", base + 0x7c, 0, CLK_IS_CRITICAL); 877 + hws[IMX6QDL_CLK_SATA] = imx_clk_hw_gate2("sata", "ahb", base + 0x7c, 4); 878 + hws[IMX6QDL_CLK_SDMA] = imx_clk_hw_gate2("sdma", "ahb", base + 0x7c, 6); 879 + hws[IMX6QDL_CLK_SPBA] = imx_clk_hw_gate2("spba", "ipg", base + 0x7c, 12); 880 + hws[IMX6QDL_CLK_SPDIF] = imx_clk_hw_gate2_shared("spdif", "spdif_podf", base + 0x7c, 14, &share_count_spdif); 881 + hws[IMX6QDL_CLK_SPDIF_GCLK] = imx_clk_hw_gate2_shared("spdif_gclk", "ipg", base + 0x7c, 14, &share_count_spdif); 882 + hws[IMX6QDL_CLK_SSI1_IPG] = imx_clk_hw_gate2_shared("ssi1_ipg", "ipg", base + 0x7c, 18, &share_count_ssi1); 883 + hws[IMX6QDL_CLK_SSI2_IPG] = imx_clk_hw_gate2_shared("ssi2_ipg", "ipg", base + 0x7c, 20, &share_count_ssi2); 884 + hws[IMX6QDL_CLK_SSI3_IPG] = imx_clk_hw_gate2_shared("ssi3_ipg", "ipg", base + 0x7c, 22, &share_count_ssi3); 885 + hws[IMX6QDL_CLK_SSI1] = imx_clk_hw_gate2_shared("ssi1", "ssi1_podf", base + 0x7c, 18, &share_count_ssi1); 886 + hws[IMX6QDL_CLK_SSI2] = imx_clk_hw_gate2_shared("ssi2", "ssi2_podf", base + 0x7c, 20, &share_count_ssi2); 887 + hws[IMX6QDL_CLK_SSI3] = imx_clk_hw_gate2_shared("ssi3", "ssi3_podf", base + 0x7c, 22, &share_count_ssi3); 888 + hws[IMX6QDL_CLK_UART_IPG] = imx_clk_hw_gate2("uart_ipg", "ipg", base + 0x7c, 24); 889 + hws[IMX6QDL_CLK_UART_SERIAL] = imx_clk_hw_gate2("uart_serial", "uart_serial_podf", base + 0x7c, 26); 890 + hws[IMX6QDL_CLK_USBOH3] = imx_clk_hw_gate2("usboh3", "ipg", base + 0x80, 0); 891 + hws[IMX6QDL_CLK_USDHC1] = imx_clk_hw_gate2("usdhc1", "usdhc1_podf", base + 0x80, 2); 892 + hws[IMX6QDL_CLK_USDHC2] = imx_clk_hw_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4); 893 + hws[IMX6QDL_CLK_USDHC3] = imx_clk_hw_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6); 894 + hws[IMX6QDL_CLK_USDHC4] = imx_clk_hw_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8); 895 + hws[IMX6QDL_CLK_EIM_SLOW] = imx_clk_hw_gate2("eim_slow", "eim_slow_podf", base + 0x80, 10); 896 + hws[IMX6QDL_CLK_VDO_AXI] = imx_clk_hw_gate2("vdo_axi", "vdo_axi_sel", base + 0x80, 12); 897 + hws[IMX6QDL_CLK_VPU_AXI] = imx_clk_hw_gate2("vpu_axi", "vpu_axi_podf", base + 0x80, 14); 888 898 if (clk_on_imx6qp()) { 889 - clk[IMX6QDL_CLK_PRE0] = imx_clk_gate2("pre0", "pre_axi", base + 0x80, 16); 890 - clk[IMX6QDL_CLK_PRE1] = imx_clk_gate2("pre1", "pre_axi", base + 0x80, 18); 891 - clk[IMX6QDL_CLK_PRE2] = imx_clk_gate2("pre2", "pre_axi", base + 0x80, 20); 892 - clk[IMX6QDL_CLK_PRE3] = imx_clk_gate2("pre3", "pre_axi", base + 0x80, 22); 893 - clk[IMX6QDL_CLK_PRG0_AXI] = imx_clk_gate2_shared("prg0_axi", "ipu1_podf", base + 0x80, 24, &share_count_prg0); 894 - clk[IMX6QDL_CLK_PRG1_AXI] = imx_clk_gate2_shared("prg1_axi", "ipu2_podf", base + 0x80, 26, &share_count_prg1); 895 - clk[IMX6QDL_CLK_PRG0_APB] = imx_clk_gate2_shared("prg0_apb", "ipg", base + 0x80, 24, &share_count_prg0); 896 - clk[IMX6QDL_CLK_PRG1_APB] = imx_clk_gate2_shared("prg1_apb", "ipg", base + 0x80, 26, &share_count_prg1); 899 + hws[IMX6QDL_CLK_PRE0] = imx_clk_hw_gate2("pre0", "pre_axi", base + 0x80, 16); 900 + hws[IMX6QDL_CLK_PRE1] = imx_clk_hw_gate2("pre1", "pre_axi", base + 0x80, 18); 901 + hws[IMX6QDL_CLK_PRE2] = imx_clk_hw_gate2("pre2", "pre_axi", base + 0x80, 20); 902 + hws[IMX6QDL_CLK_PRE3] = imx_clk_hw_gate2("pre3", "pre_axi", base + 0x80, 22); 903 + hws[IMX6QDL_CLK_PRG0_AXI] = imx_clk_hw_gate2_shared("prg0_axi", "ipu1_podf", base + 0x80, 24, &share_count_prg0); 904 + hws[IMX6QDL_CLK_PRG1_AXI] = imx_clk_hw_gate2_shared("prg1_axi", "ipu2_podf", base + 0x80, 26, &share_count_prg1); 905 + hws[IMX6QDL_CLK_PRG0_APB] = imx_clk_hw_gate2_shared("prg0_apb", "ipg", base + 0x80, 24, &share_count_prg0); 906 + hws[IMX6QDL_CLK_PRG1_APB] = imx_clk_hw_gate2_shared("prg1_apb", "ipg", base + 0x80, 26, &share_count_prg1); 897 907 } 898 - clk[IMX6QDL_CLK_CKO1] = imx_clk_gate("cko1", "cko1_podf", base + 0x60, 7); 899 - clk[IMX6QDL_CLK_CKO2] = imx_clk_gate("cko2", "cko2_podf", base + 0x60, 24); 908 + hws[IMX6QDL_CLK_CKO1] = imx_clk_hw_gate("cko1", "cko1_podf", base + 0x60, 7); 909 + hws[IMX6QDL_CLK_CKO2] = imx_clk_hw_gate("cko2", "cko2_podf", base + 0x60, 24); 900 910 901 911 /* 902 912 * The gpt_3m clock is not available on i.MX6Q TO1.0. Let's point it 903 913 * to clock gpt_ipg_per to ease the gpt driver code. 904 914 */ 905 915 if (clk_on_imx6q() && imx_get_soc_revision() == IMX_CHIP_REVISION_1_0) 906 - clk[IMX6QDL_CLK_GPT_3M] = clk[IMX6QDL_CLK_GPT_IPG_PER]; 916 + hws[IMX6QDL_CLK_GPT_3M] = hws[IMX6QDL_CLK_GPT_IPG_PER]; 907 917 908 - imx_check_clocks(clk, ARRAY_SIZE(clk)); 918 + imx_check_clk_hws(hws, IMX6QDL_CLK_END); 909 919 910 - clk_data.clks = clk; 911 - clk_data.clk_num = ARRAY_SIZE(clk); 912 - of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 920 + of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data); 913 921 914 - clk_register_clkdev(clk[IMX6QDL_CLK_ENET_REF], "enet_ref", NULL); 922 + clk_hw_register_clkdev(hws[IMX6QDL_CLK_ENET_REF], "enet_ref", NULL); 915 923 916 - clk_set_rate(clk[IMX6QDL_CLK_PLL3_PFD1_540M], 540000000); 924 + clk_set_rate(hws[IMX6QDL_CLK_PLL3_PFD1_540M]->clk, 540000000); 917 925 if (clk_on_imx6dl()) 918 - clk_set_parent(clk[IMX6QDL_CLK_IPU1_SEL], clk[IMX6QDL_CLK_PLL3_PFD1_540M]); 926 + clk_set_parent(hws[IMX6QDL_CLK_IPU1_SEL]->clk, hws[IMX6QDL_CLK_PLL3_PFD1_540M]->clk); 919 927 920 - clk_set_parent(clk[IMX6QDL_CLK_IPU1_DI0_PRE_SEL], clk[IMX6QDL_CLK_PLL5_VIDEO_DIV]); 921 - clk_set_parent(clk[IMX6QDL_CLK_IPU1_DI1_PRE_SEL], clk[IMX6QDL_CLK_PLL5_VIDEO_DIV]); 922 - clk_set_parent(clk[IMX6QDL_CLK_IPU2_DI0_PRE_SEL], clk[IMX6QDL_CLK_PLL5_VIDEO_DIV]); 923 - clk_set_parent(clk[IMX6QDL_CLK_IPU2_DI1_PRE_SEL], clk[IMX6QDL_CLK_PLL5_VIDEO_DIV]); 924 - clk_set_parent(clk[IMX6QDL_CLK_IPU1_DI0_SEL], clk[IMX6QDL_CLK_IPU1_DI0_PRE]); 925 - clk_set_parent(clk[IMX6QDL_CLK_IPU1_DI1_SEL], clk[IMX6QDL_CLK_IPU1_DI1_PRE]); 926 - clk_set_parent(clk[IMX6QDL_CLK_IPU2_DI0_SEL], clk[IMX6QDL_CLK_IPU2_DI0_PRE]); 927 - clk_set_parent(clk[IMX6QDL_CLK_IPU2_DI1_SEL], clk[IMX6QDL_CLK_IPU2_DI1_PRE]); 928 + clk_set_parent(hws[IMX6QDL_CLK_IPU1_DI0_PRE_SEL]->clk, hws[IMX6QDL_CLK_PLL5_VIDEO_DIV]->clk); 929 + clk_set_parent(hws[IMX6QDL_CLK_IPU1_DI1_PRE_SEL]->clk, hws[IMX6QDL_CLK_PLL5_VIDEO_DIV]->clk); 930 + clk_set_parent(hws[IMX6QDL_CLK_IPU2_DI0_PRE_SEL]->clk, hws[IMX6QDL_CLK_PLL5_VIDEO_DIV]->clk); 931 + clk_set_parent(hws[IMX6QDL_CLK_IPU2_DI1_PRE_SEL]->clk, hws[IMX6QDL_CLK_PLL5_VIDEO_DIV]->clk); 932 + clk_set_parent(hws[IMX6QDL_CLK_IPU1_DI0_SEL]->clk, hws[IMX6QDL_CLK_IPU1_DI0_PRE]->clk); 933 + clk_set_parent(hws[IMX6QDL_CLK_IPU1_DI1_SEL]->clk, hws[IMX6QDL_CLK_IPU1_DI1_PRE]->clk); 934 + clk_set_parent(hws[IMX6QDL_CLK_IPU2_DI0_SEL]->clk, hws[IMX6QDL_CLK_IPU2_DI0_PRE]->clk); 935 + clk_set_parent(hws[IMX6QDL_CLK_IPU2_DI1_SEL]->clk, hws[IMX6QDL_CLK_IPU2_DI1_PRE]->clk); 928 936 929 937 /* 930 938 * The gpmi needs 100MHz frequency in the EDO/Sync mode, 931 939 * We can not get the 100MHz from the pll2_pfd0_352m. 932 940 * So choose pll2_pfd2_396m as enfc_sel's parent. 933 941 */ 934 - clk_set_parent(clk[IMX6QDL_CLK_ENFC_SEL], clk[IMX6QDL_CLK_PLL2_PFD2_396M]); 942 + clk_set_parent(hws[IMX6QDL_CLK_ENFC_SEL]->clk, hws[IMX6QDL_CLK_PLL2_PFD2_396M]->clk); 935 943 936 944 if (IS_ENABLED(CONFIG_USB_MXS_PHY)) { 937 - clk_prepare_enable(clk[IMX6QDL_CLK_USBPHY1_GATE]); 938 - clk_prepare_enable(clk[IMX6QDL_CLK_USBPHY2_GATE]); 945 + clk_prepare_enable(hws[IMX6QDL_CLK_USBPHY1_GATE]->clk); 946 + clk_prepare_enable(hws[IMX6QDL_CLK_USBPHY2_GATE]->clk); 939 947 } 940 948 941 949 /* 942 950 * Let's initially set up CLKO with OSC24M, since this configuration 943 951 * is widely used by imx6q board designs to clock audio codec. 944 952 */ 945 - ret = clk_set_parent(clk[IMX6QDL_CLK_CKO2_SEL], clk[IMX6QDL_CLK_OSC]); 953 + ret = clk_set_parent(hws[IMX6QDL_CLK_CKO2_SEL]->clk, hws[IMX6QDL_CLK_OSC]->clk); 946 954 if (!ret) 947 - ret = clk_set_parent(clk[IMX6QDL_CLK_CKO], clk[IMX6QDL_CLK_CKO2]); 955 + ret = clk_set_parent(hws[IMX6QDL_CLK_CKO]->clk, hws[IMX6QDL_CLK_CKO2]->clk); 948 956 if (ret) 949 957 pr_warn("failed to set up CLKO: %d\n", ret); 950 958 951 959 /* Audio-related clocks configuration */ 952 - clk_set_parent(clk[IMX6QDL_CLK_SPDIF_SEL], clk[IMX6QDL_CLK_PLL3_PFD3_454M]); 960 + clk_set_parent(hws[IMX6QDL_CLK_SPDIF_SEL]->clk, hws[IMX6QDL_CLK_PLL3_PFD3_454M]->clk); 953 961 954 962 /* All existing boards with PCIe use LVDS1 */ 955 963 if (IS_ENABLED(CONFIG_PCI_IMX6)) 956 - clk_set_parent(clk[IMX6QDL_CLK_LVDS1_SEL], clk[IMX6QDL_CLK_SATA_REF_100M]); 964 + clk_set_parent(hws[IMX6QDL_CLK_LVDS1_SEL]->clk, hws[IMX6QDL_CLK_SATA_REF_100M]->clk); 957 965 958 966 /* 959 967 * Initialize the GPU clock muxes, so that the maximum specified clock 960 968 * rates for the respective SoC are not exceeded. 961 969 */ 962 970 if (clk_on_imx6dl()) { 963 - clk_set_parent(clk[IMX6QDL_CLK_GPU3D_CORE_SEL], 964 - clk[IMX6QDL_CLK_PLL2_PFD1_594M]); 965 - clk_set_parent(clk[IMX6QDL_CLK_GPU2D_CORE_SEL], 966 - clk[IMX6QDL_CLK_PLL2_PFD1_594M]); 971 + clk_set_parent(hws[IMX6QDL_CLK_GPU3D_CORE_SEL]->clk, 972 + hws[IMX6QDL_CLK_PLL2_PFD1_594M]->clk); 973 + clk_set_parent(hws[IMX6QDL_CLK_GPU2D_CORE_SEL]->clk, 974 + hws[IMX6QDL_CLK_PLL2_PFD1_594M]->clk); 967 975 } else if (clk_on_imx6q()) { 968 - clk_set_parent(clk[IMX6QDL_CLK_GPU3D_CORE_SEL], 969 - clk[IMX6QDL_CLK_MMDC_CH0_AXI]); 970 - clk_set_parent(clk[IMX6QDL_CLK_GPU3D_SHADER_SEL], 971 - clk[IMX6QDL_CLK_PLL2_PFD1_594M]); 972 - clk_set_parent(clk[IMX6QDL_CLK_GPU2D_CORE_SEL], 973 - clk[IMX6QDL_CLK_PLL3_USB_OTG]); 976 + clk_set_parent(hws[IMX6QDL_CLK_GPU3D_CORE_SEL]->clk, 977 + hws[IMX6QDL_CLK_MMDC_CH0_AXI]->clk); 978 + clk_set_parent(hws[IMX6QDL_CLK_GPU3D_SHADER_SEL]->clk, 979 + hws[IMX6QDL_CLK_PLL2_PFD1_594M]->clk); 980 + clk_set_parent(hws[IMX6QDL_CLK_GPU2D_CORE_SEL]->clk, 981 + hws[IMX6QDL_CLK_PLL3_USB_OTG]->clk); 982 + } 983 + 984 + for (i = 0; i < ARRAY_SIZE(uart_clk_ids); i++) { 985 + int index = uart_clk_ids[i]; 986 + 987 + uart_clks[i] = &hws[index]->clk; 974 988 } 975 989 976 990 imx_register_uart_clocks(uart_clks);
+207 -196
drivers/clk/imx/clk-imx6sl.c
··· 13 13 14 14 #include "clk.h" 15 15 16 - #define CCDR 0x4 17 - #define BM_CCM_CCDR_MMDC_CH0_MASK (1 << 17) 18 16 #define CCSR 0xc 19 17 #define BM_CCSR_PLL1_SW_CLK_SEL (1 << 2) 20 18 #define CACRR 0x10 ··· 95 97 static unsigned int share_count_ssi3; 96 98 static unsigned int share_count_spdif; 97 99 98 - static struct clk *clks[IMX6SL_CLK_END]; 99 - static struct clk_onecell_data clk_data; 100 + static struct clk_hw **hws; 101 + static struct clk_hw_onecell_data *clk_hw_data; 100 102 static void __iomem *ccm_base; 101 103 static void __iomem *anatop_base; 102 104 ··· 177 179 imx6sl_enable_pll_arm(false); 178 180 } 179 181 180 - static struct clk ** const uart_clks[] __initconst = { 181 - &clks[IMX6SL_CLK_UART], 182 - &clks[IMX6SL_CLK_UART_SERIAL], 183 - NULL 182 + static const int uart_clk_ids[] __initconst = { 183 + IMX6SL_CLK_UART, 184 + IMX6SL_CLK_UART_SERIAL, 184 185 }; 186 + 187 + static struct clk **uart_clks[ARRAY_SIZE(uart_clk_ids) + 1] __initdata; 185 188 186 189 static void __init imx6sl_clocks_init(struct device_node *ccm_node) 187 190 { 188 191 struct device_node *np; 189 192 void __iomem *base; 190 193 int ret; 194 + int i; 191 195 192 - clks[IMX6SL_CLK_DUMMY] = imx_clk_fixed("dummy", 0); 193 - clks[IMX6SL_CLK_CKIL] = imx_obtain_fixed_clock("ckil", 0); 194 - clks[IMX6SL_CLK_OSC] = imx_obtain_fixed_clock("osc", 0); 196 + clk_hw_data = kzalloc(struct_size(clk_hw_data, hws, 197 + IMX6SL_CLK_END), GFP_KERNEL); 198 + if (WARN_ON(!clk_hw_data)) 199 + return; 200 + 201 + clk_hw_data->num = IMX6SL_CLK_END; 202 + hws = clk_hw_data->hws; 203 + 204 + hws[IMX6SL_CLK_DUMMY] = imx_clk_hw_fixed("dummy", 0); 205 + hws[IMX6SL_CLK_CKIL] = imx_obtain_fixed_clock_hw("ckil", 0); 206 + hws[IMX6SL_CLK_OSC] = imx_obtain_fixed_clock_hw("osc", 0); 195 207 /* Clock source from external clock via CLK1 PAD */ 196 - clks[IMX6SL_CLK_ANACLK1] = imx_obtain_fixed_clock("anaclk1", 0); 208 + hws[IMX6SL_CLK_ANACLK1] = imx_obtain_fixed_clock_hw("anaclk1", 0); 197 209 198 210 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sl-anatop"); 199 211 base = of_iomap(np, 0); 200 212 WARN_ON(!base); 201 213 anatop_base = base; 202 214 203 - clks[IMX6SL_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", base + 0x00, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 204 - clks[IMX6SL_PLL2_BYPASS_SRC] = imx_clk_mux("pll2_bypass_src", base + 0x30, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 205 - clks[IMX6SL_PLL3_BYPASS_SRC] = imx_clk_mux("pll3_bypass_src", base + 0x10, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 206 - clks[IMX6SL_PLL4_BYPASS_SRC] = imx_clk_mux("pll4_bypass_src", base + 0x70, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 207 - clks[IMX6SL_PLL5_BYPASS_SRC] = imx_clk_mux("pll5_bypass_src", base + 0xa0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 208 - clks[IMX6SL_PLL6_BYPASS_SRC] = imx_clk_mux("pll6_bypass_src", base + 0xe0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 209 - clks[IMX6SL_PLL7_BYPASS_SRC] = imx_clk_mux("pll7_bypass_src", base + 0x20, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 215 + hws[IMX6SL_PLL1_BYPASS_SRC] = imx_clk_hw_mux("pll1_bypass_src", base + 0x00, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 216 + hws[IMX6SL_PLL2_BYPASS_SRC] = imx_clk_hw_mux("pll2_bypass_src", base + 0x30, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 217 + hws[IMX6SL_PLL3_BYPASS_SRC] = imx_clk_hw_mux("pll3_bypass_src", base + 0x10, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 218 + hws[IMX6SL_PLL4_BYPASS_SRC] = imx_clk_hw_mux("pll4_bypass_src", base + 0x70, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 219 + hws[IMX6SL_PLL5_BYPASS_SRC] = imx_clk_hw_mux("pll5_bypass_src", base + 0xa0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 220 + hws[IMX6SL_PLL6_BYPASS_SRC] = imx_clk_hw_mux("pll6_bypass_src", base + 0xe0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 221 + hws[IMX6SL_PLL7_BYPASS_SRC] = imx_clk_hw_mux("pll7_bypass_src", base + 0x20, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 210 222 211 223 /* type name parent_name base div_mask */ 212 - clks[IMX6SL_CLK_PLL1] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1", "osc", base + 0x00, 0x7f); 213 - clks[IMX6SL_CLK_PLL2] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2", "osc", base + 0x30, 0x1); 214 - clks[IMX6SL_CLK_PLL3] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3", "osc", base + 0x10, 0x3); 215 - clks[IMX6SL_CLK_PLL4] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4", "osc", base + 0x70, 0x7f); 216 - clks[IMX6SL_CLK_PLL5] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5", "osc", base + 0xa0, 0x7f); 217 - clks[IMX6SL_CLK_PLL6] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll6", "osc", base + 0xe0, 0x3); 218 - clks[IMX6SL_CLK_PLL7] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7", "osc", base + 0x20, 0x3); 224 + hws[IMX6SL_CLK_PLL1] = imx_clk_hw_pllv3(IMX_PLLV3_SYS, "pll1", "osc", base + 0x00, 0x7f); 225 + hws[IMX6SL_CLK_PLL2] = imx_clk_hw_pllv3(IMX_PLLV3_GENERIC, "pll2", "osc", base + 0x30, 0x1); 226 + hws[IMX6SL_CLK_PLL3] = imx_clk_hw_pllv3(IMX_PLLV3_USB, "pll3", "osc", base + 0x10, 0x3); 227 + hws[IMX6SL_CLK_PLL4] = imx_clk_hw_pllv3(IMX_PLLV3_AV, "pll4", "osc", base + 0x70, 0x7f); 228 + hws[IMX6SL_CLK_PLL5] = imx_clk_hw_pllv3(IMX_PLLV3_AV, "pll5", "osc", base + 0xa0, 0x7f); 229 + hws[IMX6SL_CLK_PLL6] = imx_clk_hw_pllv3(IMX_PLLV3_ENET, "pll6", "osc", base + 0xe0, 0x3); 230 + hws[IMX6SL_CLK_PLL7] = imx_clk_hw_pllv3(IMX_PLLV3_USB, "pll7", "osc", base + 0x20, 0x3); 219 231 220 - clks[IMX6SL_PLL1_BYPASS] = imx_clk_mux_flags("pll1_bypass", base + 0x00, 16, 1, pll1_bypass_sels, ARRAY_SIZE(pll1_bypass_sels), CLK_SET_RATE_PARENT); 221 - clks[IMX6SL_PLL2_BYPASS] = imx_clk_mux_flags("pll2_bypass", base + 0x30, 16, 1, pll2_bypass_sels, ARRAY_SIZE(pll2_bypass_sels), CLK_SET_RATE_PARENT); 222 - clks[IMX6SL_PLL3_BYPASS] = imx_clk_mux_flags("pll3_bypass", base + 0x10, 16, 1, pll3_bypass_sels, ARRAY_SIZE(pll3_bypass_sels), CLK_SET_RATE_PARENT); 223 - clks[IMX6SL_PLL4_BYPASS] = imx_clk_mux_flags("pll4_bypass", base + 0x70, 16, 1, pll4_bypass_sels, ARRAY_SIZE(pll4_bypass_sels), CLK_SET_RATE_PARENT); 224 - clks[IMX6SL_PLL5_BYPASS] = imx_clk_mux_flags("pll5_bypass", base + 0xa0, 16, 1, pll5_bypass_sels, ARRAY_SIZE(pll5_bypass_sels), CLK_SET_RATE_PARENT); 225 - clks[IMX6SL_PLL6_BYPASS] = imx_clk_mux_flags("pll6_bypass", base + 0xe0, 16, 1, pll6_bypass_sels, ARRAY_SIZE(pll6_bypass_sels), CLK_SET_RATE_PARENT); 226 - clks[IMX6SL_PLL7_BYPASS] = imx_clk_mux_flags("pll7_bypass", base + 0x20, 16, 1, pll7_bypass_sels, ARRAY_SIZE(pll7_bypass_sels), CLK_SET_RATE_PARENT); 232 + hws[IMX6SL_PLL1_BYPASS] = imx_clk_hw_mux_flags("pll1_bypass", base + 0x00, 16, 1, pll1_bypass_sels, ARRAY_SIZE(pll1_bypass_sels), CLK_SET_RATE_PARENT); 233 + hws[IMX6SL_PLL2_BYPASS] = imx_clk_hw_mux_flags("pll2_bypass", base + 0x30, 16, 1, pll2_bypass_sels, ARRAY_SIZE(pll2_bypass_sels), CLK_SET_RATE_PARENT); 234 + hws[IMX6SL_PLL3_BYPASS] = imx_clk_hw_mux_flags("pll3_bypass", base + 0x10, 16, 1, pll3_bypass_sels, ARRAY_SIZE(pll3_bypass_sels), CLK_SET_RATE_PARENT); 235 + hws[IMX6SL_PLL4_BYPASS] = imx_clk_hw_mux_flags("pll4_bypass", base + 0x70, 16, 1, pll4_bypass_sels, ARRAY_SIZE(pll4_bypass_sels), CLK_SET_RATE_PARENT); 236 + hws[IMX6SL_PLL5_BYPASS] = imx_clk_hw_mux_flags("pll5_bypass", base + 0xa0, 16, 1, pll5_bypass_sels, ARRAY_SIZE(pll5_bypass_sels), CLK_SET_RATE_PARENT); 237 + hws[IMX6SL_PLL6_BYPASS] = imx_clk_hw_mux_flags("pll6_bypass", base + 0xe0, 16, 1, pll6_bypass_sels, ARRAY_SIZE(pll6_bypass_sels), CLK_SET_RATE_PARENT); 238 + hws[IMX6SL_PLL7_BYPASS] = imx_clk_hw_mux_flags("pll7_bypass", base + 0x20, 16, 1, pll7_bypass_sels, ARRAY_SIZE(pll7_bypass_sels), CLK_SET_RATE_PARENT); 227 239 228 240 /* Do not bypass PLLs initially */ 229 - clk_set_parent(clks[IMX6SL_PLL1_BYPASS], clks[IMX6SL_CLK_PLL1]); 230 - clk_set_parent(clks[IMX6SL_PLL2_BYPASS], clks[IMX6SL_CLK_PLL2]); 231 - clk_set_parent(clks[IMX6SL_PLL3_BYPASS], clks[IMX6SL_CLK_PLL3]); 232 - clk_set_parent(clks[IMX6SL_PLL4_BYPASS], clks[IMX6SL_CLK_PLL4]); 233 - clk_set_parent(clks[IMX6SL_PLL5_BYPASS], clks[IMX6SL_CLK_PLL5]); 234 - clk_set_parent(clks[IMX6SL_PLL6_BYPASS], clks[IMX6SL_CLK_PLL6]); 235 - clk_set_parent(clks[IMX6SL_PLL7_BYPASS], clks[IMX6SL_CLK_PLL7]); 241 + clk_set_parent(hws[IMX6SL_PLL1_BYPASS]->clk, hws[IMX6SL_CLK_PLL1]->clk); 242 + clk_set_parent(hws[IMX6SL_PLL2_BYPASS]->clk, hws[IMX6SL_CLK_PLL2]->clk); 243 + clk_set_parent(hws[IMX6SL_PLL3_BYPASS]->clk, hws[IMX6SL_CLK_PLL3]->clk); 244 + clk_set_parent(hws[IMX6SL_PLL4_BYPASS]->clk, hws[IMX6SL_CLK_PLL4]->clk); 245 + clk_set_parent(hws[IMX6SL_PLL5_BYPASS]->clk, hws[IMX6SL_CLK_PLL5]->clk); 246 + clk_set_parent(hws[IMX6SL_PLL6_BYPASS]->clk, hws[IMX6SL_CLK_PLL6]->clk); 247 + clk_set_parent(hws[IMX6SL_PLL7_BYPASS]->clk, hws[IMX6SL_CLK_PLL7]->clk); 236 248 237 - clks[IMX6SL_CLK_PLL1_SYS] = imx_clk_gate("pll1_sys", "pll1_bypass", base + 0x00, 13); 238 - clks[IMX6SL_CLK_PLL2_BUS] = imx_clk_gate("pll2_bus", "pll2_bypass", base + 0x30, 13); 239 - clks[IMX6SL_CLK_PLL3_USB_OTG] = imx_clk_gate("pll3_usb_otg", "pll3_bypass", base + 0x10, 13); 240 - clks[IMX6SL_CLK_PLL4_AUDIO] = imx_clk_gate("pll4_audio", "pll4_bypass", base + 0x70, 13); 241 - clks[IMX6SL_CLK_PLL5_VIDEO] = imx_clk_gate("pll5_video", "pll5_bypass", base + 0xa0, 13); 242 - clks[IMX6SL_CLK_PLL6_ENET] = imx_clk_gate("pll6_enet", "pll6_bypass", base + 0xe0, 13); 243 - clks[IMX6SL_CLK_PLL7_USB_HOST] = imx_clk_gate("pll7_usb_host", "pll7_bypass", base + 0x20, 13); 249 + hws[IMX6SL_CLK_PLL1_SYS] = imx_clk_hw_gate("pll1_sys", "pll1_bypass", base + 0x00, 13); 250 + hws[IMX6SL_CLK_PLL2_BUS] = imx_clk_hw_gate("pll2_bus", "pll2_bypass", base + 0x30, 13); 251 + hws[IMX6SL_CLK_PLL3_USB_OTG] = imx_clk_hw_gate("pll3_usb_otg", "pll3_bypass", base + 0x10, 13); 252 + hws[IMX6SL_CLK_PLL4_AUDIO] = imx_clk_hw_gate("pll4_audio", "pll4_bypass", base + 0x70, 13); 253 + hws[IMX6SL_CLK_PLL5_VIDEO] = imx_clk_hw_gate("pll5_video", "pll5_bypass", base + 0xa0, 13); 254 + hws[IMX6SL_CLK_PLL6_ENET] = imx_clk_hw_gate("pll6_enet", "pll6_bypass", base + 0xe0, 13); 255 + hws[IMX6SL_CLK_PLL7_USB_HOST] = imx_clk_hw_gate("pll7_usb_host", "pll7_bypass", base + 0x20, 13); 244 256 245 - clks[IMX6SL_CLK_LVDS1_SEL] = imx_clk_mux("lvds1_sel", base + 0x160, 0, 5, lvds_sels, ARRAY_SIZE(lvds_sels)); 246 - clks[IMX6SL_CLK_LVDS1_OUT] = imx_clk_gate_exclusive("lvds1_out", "lvds1_sel", base + 0x160, 10, BIT(12)); 247 - clks[IMX6SL_CLK_LVDS1_IN] = imx_clk_gate_exclusive("lvds1_in", "anaclk1", base + 0x160, 12, BIT(10)); 257 + hws[IMX6SL_CLK_LVDS1_SEL] = imx_clk_hw_mux("lvds1_sel", base + 0x160, 0, 5, lvds_sels, ARRAY_SIZE(lvds_sels)); 258 + hws[IMX6SL_CLK_LVDS1_OUT] = imx_clk_hw_gate_exclusive("lvds1_out", "lvds1_sel", base + 0x160, 10, BIT(12)); 259 + hws[IMX6SL_CLK_LVDS1_IN] = imx_clk_hw_gate_exclusive("lvds1_in", "anaclk1", base + 0x160, 12, BIT(10)); 248 260 249 261 /* 250 262 * usbphy1 and usbphy2 are implemented as dummy gates using reserve ··· 263 255 * turned on during boot, and software will not need to control it 264 256 * anymore after that. 265 257 */ 266 - clks[IMX6SL_CLK_USBPHY1] = imx_clk_gate("usbphy1", "pll3_usb_otg", base + 0x10, 20); 267 - clks[IMX6SL_CLK_USBPHY2] = imx_clk_gate("usbphy2", "pll7_usb_host", base + 0x20, 20); 268 - clks[IMX6SL_CLK_USBPHY1_GATE] = imx_clk_gate("usbphy1_gate", "dummy", base + 0x10, 6); 269 - clks[IMX6SL_CLK_USBPHY2_GATE] = imx_clk_gate("usbphy2_gate", "dummy", base + 0x20, 6); 258 + hws[IMX6SL_CLK_USBPHY1] = imx_clk_hw_gate("usbphy1", "pll3_usb_otg", base + 0x10, 20); 259 + hws[IMX6SL_CLK_USBPHY2] = imx_clk_hw_gate("usbphy2", "pll7_usb_host", base + 0x20, 20); 260 + hws[IMX6SL_CLK_USBPHY1_GATE] = imx_clk_hw_gate("usbphy1_gate", "dummy", base + 0x10, 6); 261 + hws[IMX6SL_CLK_USBPHY2_GATE] = imx_clk_hw_gate("usbphy2_gate", "dummy", base + 0x20, 6); 270 262 271 263 /* dev name parent_name flags reg shift width div: flags, div_table lock */ 272 - clks[IMX6SL_CLK_PLL4_POST_DIV] = clk_register_divider_table(NULL, "pll4_post_div", "pll4_audio", CLK_SET_RATE_PARENT, base + 0x70, 19, 2, 0, post_div_table, &imx_ccm_lock); 273 - clks[IMX6SL_CLK_PLL4_AUDIO_DIV] = clk_register_divider(NULL, "pll4_audio_div", "pll4_post_div", CLK_SET_RATE_PARENT, base + 0x170, 15, 1, 0, &imx_ccm_lock); 274 - clks[IMX6SL_CLK_PLL5_POST_DIV] = clk_register_divider_table(NULL, "pll5_post_div", "pll5_video", CLK_SET_RATE_PARENT, base + 0xa0, 19, 2, 0, post_div_table, &imx_ccm_lock); 275 - clks[IMX6SL_CLK_PLL5_VIDEO_DIV] = clk_register_divider_table(NULL, "pll5_video_div", "pll5_post_div", CLK_SET_RATE_PARENT, base + 0x170, 30, 2, 0, video_div_table, &imx_ccm_lock); 276 - clks[IMX6SL_CLK_ENET_REF] = clk_register_divider_table(NULL, "enet_ref", "pll6_enet", 0, base + 0xe0, 0, 2, 0, clk_enet_ref_table, &imx_ccm_lock); 264 + hws[IMX6SL_CLK_PLL4_POST_DIV] = clk_hw_register_divider_table(NULL, "pll4_post_div", "pll4_audio", CLK_SET_RATE_PARENT, base + 0x70, 19, 2, 0, post_div_table, &imx_ccm_lock); 265 + hws[IMX6SL_CLK_PLL4_AUDIO_DIV] = clk_hw_register_divider(NULL, "pll4_audio_div", "pll4_post_div", CLK_SET_RATE_PARENT, base + 0x170, 15, 1, 0, &imx_ccm_lock); 266 + hws[IMX6SL_CLK_PLL5_POST_DIV] = clk_hw_register_divider_table(NULL, "pll5_post_div", "pll5_video", CLK_SET_RATE_PARENT, base + 0xa0, 19, 2, 0, post_div_table, &imx_ccm_lock); 267 + hws[IMX6SL_CLK_PLL5_VIDEO_DIV] = clk_hw_register_divider_table(NULL, "pll5_video_div", "pll5_post_div", CLK_SET_RATE_PARENT, base + 0x170, 30, 2, 0, video_div_table, &imx_ccm_lock); 268 + hws[IMX6SL_CLK_ENET_REF] = clk_hw_register_divider_table(NULL, "enet_ref", "pll6_enet", 0, base + 0xe0, 0, 2, 0, clk_enet_ref_table, &imx_ccm_lock); 277 269 278 270 /* name parent_name reg idx */ 279 - clks[IMX6SL_CLK_PLL2_PFD0] = imx_clk_pfd("pll2_pfd0", "pll2_bus", base + 0x100, 0); 280 - clks[IMX6SL_CLK_PLL2_PFD1] = imx_clk_pfd("pll2_pfd1", "pll2_bus", base + 0x100, 1); 281 - clks[IMX6SL_CLK_PLL2_PFD2] = imx_clk_pfd("pll2_pfd2", "pll2_bus", base + 0x100, 2); 282 - clks[IMX6SL_CLK_PLL3_PFD0] = imx_clk_pfd("pll3_pfd0", "pll3_usb_otg", base + 0xf0, 0); 283 - clks[IMX6SL_CLK_PLL3_PFD1] = imx_clk_pfd("pll3_pfd1", "pll3_usb_otg", base + 0xf0, 1); 284 - clks[IMX6SL_CLK_PLL3_PFD2] = imx_clk_pfd("pll3_pfd2", "pll3_usb_otg", base + 0xf0, 2); 285 - clks[IMX6SL_CLK_PLL3_PFD3] = imx_clk_pfd("pll3_pfd3", "pll3_usb_otg", base + 0xf0, 3); 271 + hws[IMX6SL_CLK_PLL2_PFD0] = imx_clk_hw_pfd("pll2_pfd0", "pll2_bus", base + 0x100, 0); 272 + hws[IMX6SL_CLK_PLL2_PFD1] = imx_clk_hw_pfd("pll2_pfd1", "pll2_bus", base + 0x100, 1); 273 + hws[IMX6SL_CLK_PLL2_PFD2] = imx_clk_hw_pfd("pll2_pfd2", "pll2_bus", base + 0x100, 2); 274 + hws[IMX6SL_CLK_PLL3_PFD0] = imx_clk_hw_pfd("pll3_pfd0", "pll3_usb_otg", base + 0xf0, 0); 275 + hws[IMX6SL_CLK_PLL3_PFD1] = imx_clk_hw_pfd("pll3_pfd1", "pll3_usb_otg", base + 0xf0, 1); 276 + hws[IMX6SL_CLK_PLL3_PFD2] = imx_clk_hw_pfd("pll3_pfd2", "pll3_usb_otg", base + 0xf0, 2); 277 + hws[IMX6SL_CLK_PLL3_PFD3] = imx_clk_hw_pfd("pll3_pfd3", "pll3_usb_otg", base + 0xf0, 3); 286 278 287 279 /* name parent_name mult div */ 288 - clks[IMX6SL_CLK_PLL2_198M] = imx_clk_fixed_factor("pll2_198m", "pll2_pfd2", 1, 2); 289 - clks[IMX6SL_CLK_PLL3_120M] = imx_clk_fixed_factor("pll3_120m", "pll3_usb_otg", 1, 4); 290 - clks[IMX6SL_CLK_PLL3_80M] = imx_clk_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6); 291 - clks[IMX6SL_CLK_PLL3_60M] = imx_clk_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8); 280 + hws[IMX6SL_CLK_PLL2_198M] = imx_clk_hw_fixed_factor("pll2_198m", "pll2_pfd2", 1, 2); 281 + hws[IMX6SL_CLK_PLL3_120M] = imx_clk_hw_fixed_factor("pll3_120m", "pll3_usb_otg", 1, 4); 282 + hws[IMX6SL_CLK_PLL3_80M] = imx_clk_hw_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6); 283 + hws[IMX6SL_CLK_PLL3_60M] = imx_clk_hw_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8); 292 284 293 285 np = ccm_node; 294 286 base = of_iomap(np, 0); ··· 296 288 ccm_base = base; 297 289 298 290 /* name reg shift width parent_names num_parents */ 299 - clks[IMX6SL_CLK_STEP] = imx_clk_mux("step", base + 0xc, 8, 1, step_sels, ARRAY_SIZE(step_sels)); 300 - clks[IMX6SL_CLK_PLL1_SW] = imx_clk_mux("pll1_sw", base + 0xc, 2, 1, pll1_sw_sels, ARRAY_SIZE(pll1_sw_sels)); 301 - clks[IMX6SL_CLK_OCRAM_ALT_SEL] = imx_clk_mux("ocram_alt_sel", base + 0x14, 7, 1, ocram_alt_sels, ARRAY_SIZE(ocram_alt_sels)); 302 - clks[IMX6SL_CLK_OCRAM_SEL] = imx_clk_mux("ocram_sel", base + 0x14, 6, 1, ocram_sels, ARRAY_SIZE(ocram_sels)); 303 - clks[IMX6SL_CLK_PRE_PERIPH2_SEL] = imx_clk_mux("pre_periph2_sel", base + 0x18, 21, 2, pre_periph_sels, ARRAY_SIZE(pre_periph_sels)); 304 - clks[IMX6SL_CLK_PRE_PERIPH_SEL] = imx_clk_mux("pre_periph_sel", base + 0x18, 18, 2, pre_periph_sels, ARRAY_SIZE(pre_periph_sels)); 305 - clks[IMX6SL_CLK_PERIPH2_CLK2_SEL] = imx_clk_mux("periph2_clk2_sel", base + 0x18, 20, 1, periph2_clk2_sels, ARRAY_SIZE(periph2_clk2_sels)); 306 - clks[IMX6SL_CLK_PERIPH_CLK2_SEL] = imx_clk_mux("periph_clk2_sel", base + 0x18, 12, 2, periph_clk2_sels, ARRAY_SIZE(periph_clk2_sels)); 307 - clks[IMX6SL_CLK_CSI_SEL] = imx_clk_mux("csi_sel", base + 0x3c, 9, 2, csi_sels, ARRAY_SIZE(csi_sels)); 308 - clks[IMX6SL_CLK_LCDIF_AXI_SEL] = imx_clk_mux("lcdif_axi_sel", base + 0x3c, 14, 2, lcdif_axi_sels, ARRAY_SIZE(lcdif_axi_sels)); 309 - clks[IMX6SL_CLK_USDHC1_SEL] = imx_clk_fixup_mux("usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 310 - clks[IMX6SL_CLK_USDHC2_SEL] = imx_clk_fixup_mux("usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 311 - clks[IMX6SL_CLK_USDHC3_SEL] = imx_clk_fixup_mux("usdhc3_sel", base + 0x1c, 18, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 312 - clks[IMX6SL_CLK_USDHC4_SEL] = imx_clk_fixup_mux("usdhc4_sel", base + 0x1c, 19, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 313 - clks[IMX6SL_CLK_SSI1_SEL] = imx_clk_fixup_mux("ssi1_sel", base + 0x1c, 10, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup); 314 - clks[IMX6SL_CLK_SSI2_SEL] = imx_clk_fixup_mux("ssi2_sel", base + 0x1c, 12, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup); 315 - clks[IMX6SL_CLK_SSI3_SEL] = imx_clk_fixup_mux("ssi3_sel", base + 0x1c, 14, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup); 316 - clks[IMX6SL_CLK_PERCLK_SEL] = imx_clk_fixup_mux("perclk_sel", base + 0x1c, 6, 1, perclk_sels, ARRAY_SIZE(perclk_sels), imx_cscmr1_fixup); 317 - clks[IMX6SL_CLK_PXP_AXI_SEL] = imx_clk_mux("pxp_axi_sel", base + 0x34, 6, 3, pxp_axi_sels, ARRAY_SIZE(pxp_axi_sels)); 318 - clks[IMX6SL_CLK_EPDC_AXI_SEL] = imx_clk_mux("epdc_axi_sel", base + 0x34, 15, 3, epdc_axi_sels, ARRAY_SIZE(epdc_axi_sels)); 319 - clks[IMX6SL_CLK_GPU2D_OVG_SEL] = imx_clk_mux("gpu2d_ovg_sel", base + 0x18, 4, 2, gpu2d_ovg_sels, ARRAY_SIZE(gpu2d_ovg_sels)); 320 - clks[IMX6SL_CLK_GPU2D_SEL] = imx_clk_mux("gpu2d_sel", base + 0x18, 8, 2, gpu2d_sels, ARRAY_SIZE(gpu2d_sels)); 321 - clks[IMX6SL_CLK_LCDIF_PIX_SEL] = imx_clk_mux("lcdif_pix_sel", base + 0x38, 6, 3, lcdif_pix_sels, ARRAY_SIZE(lcdif_pix_sels)); 322 - clks[IMX6SL_CLK_EPDC_PIX_SEL] = imx_clk_mux("epdc_pix_sel", base + 0x38, 15, 3, epdc_pix_sels, ARRAY_SIZE(epdc_pix_sels)); 323 - clks[IMX6SL_CLK_SPDIF0_SEL] = imx_clk_mux("spdif0_sel", base + 0x30, 20, 2, audio_sels, ARRAY_SIZE(audio_sels)); 324 - clks[IMX6SL_CLK_SPDIF1_SEL] = imx_clk_mux("spdif1_sel", base + 0x30, 7, 2, audio_sels, ARRAY_SIZE(audio_sels)); 325 - clks[IMX6SL_CLK_EXTERN_AUDIO_SEL] = imx_clk_mux("extern_audio_sel", base + 0x20, 19, 2, audio_sels, ARRAY_SIZE(audio_sels)); 326 - clks[IMX6SL_CLK_ECSPI_SEL] = imx_clk_mux("ecspi_sel", base + 0x38, 18, 1, ecspi_sels, ARRAY_SIZE(ecspi_sels)); 327 - clks[IMX6SL_CLK_UART_SEL] = imx_clk_mux("uart_sel", base + 0x24, 6, 1, uart_sels, ARRAY_SIZE(uart_sels)); 291 + hws[IMX6SL_CLK_STEP] = imx_clk_hw_mux("step", base + 0xc, 8, 1, step_sels, ARRAY_SIZE(step_sels)); 292 + hws[IMX6SL_CLK_PLL1_SW] = imx_clk_hw_mux("pll1_sw", base + 0xc, 2, 1, pll1_sw_sels, ARRAY_SIZE(pll1_sw_sels)); 293 + hws[IMX6SL_CLK_OCRAM_ALT_SEL] = imx_clk_hw_mux("ocram_alt_sel", base + 0x14, 7, 1, ocram_alt_sels, ARRAY_SIZE(ocram_alt_sels)); 294 + hws[IMX6SL_CLK_OCRAM_SEL] = imx_clk_hw_mux("ocram_sel", base + 0x14, 6, 1, ocram_sels, ARRAY_SIZE(ocram_sels)); 295 + hws[IMX6SL_CLK_PRE_PERIPH2_SEL] = imx_clk_hw_mux("pre_periph2_sel", base + 0x18, 21, 2, pre_periph_sels, ARRAY_SIZE(pre_periph_sels)); 296 + hws[IMX6SL_CLK_PRE_PERIPH_SEL] = imx_clk_hw_mux("pre_periph_sel", base + 0x18, 18, 2, pre_periph_sels, ARRAY_SIZE(pre_periph_sels)); 297 + hws[IMX6SL_CLK_PERIPH2_CLK2_SEL] = imx_clk_hw_mux("periph2_clk2_sel", base + 0x18, 20, 1, periph2_clk2_sels, ARRAY_SIZE(periph2_clk2_sels)); 298 + hws[IMX6SL_CLK_PERIPH_CLK2_SEL] = imx_clk_hw_mux("periph_clk2_sel", base + 0x18, 12, 2, periph_clk2_sels, ARRAY_SIZE(periph_clk2_sels)); 299 + hws[IMX6SL_CLK_CSI_SEL] = imx_clk_hw_mux("csi_sel", base + 0x3c, 9, 2, csi_sels, ARRAY_SIZE(csi_sels)); 300 + hws[IMX6SL_CLK_LCDIF_AXI_SEL] = imx_clk_hw_mux("lcdif_axi_sel", base + 0x3c, 14, 2, lcdif_axi_sels, ARRAY_SIZE(lcdif_axi_sels)); 301 + hws[IMX6SL_CLK_USDHC1_SEL] = imx_clk_hw_fixup_mux("usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 302 + hws[IMX6SL_CLK_USDHC2_SEL] = imx_clk_hw_fixup_mux("usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 303 + hws[IMX6SL_CLK_USDHC3_SEL] = imx_clk_hw_fixup_mux("usdhc3_sel", base + 0x1c, 18, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 304 + hws[IMX6SL_CLK_USDHC4_SEL] = imx_clk_hw_fixup_mux("usdhc4_sel", base + 0x1c, 19, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels), imx_cscmr1_fixup); 305 + hws[IMX6SL_CLK_SSI1_SEL] = imx_clk_hw_fixup_mux("ssi1_sel", base + 0x1c, 10, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup); 306 + hws[IMX6SL_CLK_SSI2_SEL] = imx_clk_hw_fixup_mux("ssi2_sel", base + 0x1c, 12, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup); 307 + hws[IMX6SL_CLK_SSI3_SEL] = imx_clk_hw_fixup_mux("ssi3_sel", base + 0x1c, 14, 2, ssi_sels, ARRAY_SIZE(ssi_sels), imx_cscmr1_fixup); 308 + hws[IMX6SL_CLK_PERCLK_SEL] = imx_clk_hw_fixup_mux("perclk_sel", base + 0x1c, 6, 1, perclk_sels, ARRAY_SIZE(perclk_sels), imx_cscmr1_fixup); 309 + hws[IMX6SL_CLK_PXP_AXI_SEL] = imx_clk_hw_mux("pxp_axi_sel", base + 0x34, 6, 3, pxp_axi_sels, ARRAY_SIZE(pxp_axi_sels)); 310 + hws[IMX6SL_CLK_EPDC_AXI_SEL] = imx_clk_hw_mux("epdc_axi_sel", base + 0x34, 15, 3, epdc_axi_sels, ARRAY_SIZE(epdc_axi_sels)); 311 + hws[IMX6SL_CLK_GPU2D_OVG_SEL] = imx_clk_hw_mux("gpu2d_ovg_sel", base + 0x18, 4, 2, gpu2d_ovg_sels, ARRAY_SIZE(gpu2d_ovg_sels)); 312 + hws[IMX6SL_CLK_GPU2D_SEL] = imx_clk_hw_mux("gpu2d_sel", base + 0x18, 8, 2, gpu2d_sels, ARRAY_SIZE(gpu2d_sels)); 313 + hws[IMX6SL_CLK_LCDIF_PIX_SEL] = imx_clk_hw_mux("lcdif_pix_sel", base + 0x38, 6, 3, lcdif_pix_sels, ARRAY_SIZE(lcdif_pix_sels)); 314 + hws[IMX6SL_CLK_EPDC_PIX_SEL] = imx_clk_hw_mux("epdc_pix_sel", base + 0x38, 15, 3, epdc_pix_sels, ARRAY_SIZE(epdc_pix_sels)); 315 + hws[IMX6SL_CLK_SPDIF0_SEL] = imx_clk_hw_mux("spdif0_sel", base + 0x30, 20, 2, audio_sels, ARRAY_SIZE(audio_sels)); 316 + hws[IMX6SL_CLK_SPDIF1_SEL] = imx_clk_hw_mux("spdif1_sel", base + 0x30, 7, 2, audio_sels, ARRAY_SIZE(audio_sels)); 317 + hws[IMX6SL_CLK_EXTERN_AUDIO_SEL] = imx_clk_hw_mux("extern_audio_sel", base + 0x20, 19, 2, audio_sels, ARRAY_SIZE(audio_sels)); 318 + hws[IMX6SL_CLK_ECSPI_SEL] = imx_clk_hw_mux("ecspi_sel", base + 0x38, 18, 1, ecspi_sels, ARRAY_SIZE(ecspi_sels)); 319 + hws[IMX6SL_CLK_UART_SEL] = imx_clk_hw_mux("uart_sel", base + 0x24, 6, 1, uart_sels, ARRAY_SIZE(uart_sels)); 328 320 329 321 /* name reg shift width busy: reg, shift parent_names num_parents */ 330 - clks[IMX6SL_CLK_PERIPH] = imx_clk_busy_mux("periph", base + 0x14, 25, 1, base + 0x48, 5, periph_sels, ARRAY_SIZE(periph_sels)); 331 - clks[IMX6SL_CLK_PERIPH2] = imx_clk_busy_mux("periph2", base + 0x14, 26, 1, base + 0x48, 3, periph2_sels, ARRAY_SIZE(periph2_sels)); 322 + hws[IMX6SL_CLK_PERIPH] = imx_clk_hw_busy_mux("periph", base + 0x14, 25, 1, base + 0x48, 5, periph_sels, ARRAY_SIZE(periph_sels)); 323 + hws[IMX6SL_CLK_PERIPH2] = imx_clk_hw_busy_mux("periph2", base + 0x14, 26, 1, base + 0x48, 3, periph2_sels, ARRAY_SIZE(periph2_sels)); 332 324 333 325 /* name parent_name reg shift width */ 334 - clks[IMX6SL_CLK_OCRAM_PODF] = imx_clk_busy_divider("ocram_podf", "ocram_sel", base + 0x14, 16, 3, base + 0x48, 0); 335 - clks[IMX6SL_CLK_PERIPH_CLK2_PODF] = imx_clk_divider("periph_clk2_podf", "periph_clk2_sel", base + 0x14, 27, 3); 336 - clks[IMX6SL_CLK_PERIPH2_CLK2_PODF] = imx_clk_divider("periph2_clk2_podf", "periph2_clk2_sel", base + 0x14, 0, 3); 337 - clks[IMX6SL_CLK_IPG] = imx_clk_divider("ipg", "ahb", base + 0x14, 8, 2); 338 - clks[IMX6SL_CLK_CSI_PODF] = imx_clk_divider("csi_podf", "csi_sel", base + 0x3c, 11, 3); 339 - clks[IMX6SL_CLK_LCDIF_AXI_PODF] = imx_clk_divider("lcdif_axi_podf", "lcdif_axi_sel", base + 0x3c, 16, 3); 340 - clks[IMX6SL_CLK_USDHC1_PODF] = imx_clk_divider("usdhc1_podf", "usdhc1_sel", base + 0x24, 11, 3); 341 - clks[IMX6SL_CLK_USDHC2_PODF] = imx_clk_divider("usdhc2_podf", "usdhc2_sel", base + 0x24, 16, 3); 342 - clks[IMX6SL_CLK_USDHC3_PODF] = imx_clk_divider("usdhc3_podf", "usdhc3_sel", base + 0x24, 19, 3); 343 - clks[IMX6SL_CLK_USDHC4_PODF] = imx_clk_divider("usdhc4_podf", "usdhc4_sel", base + 0x24, 22, 3); 344 - clks[IMX6SL_CLK_SSI1_PRED] = imx_clk_divider("ssi1_pred", "ssi1_sel", base + 0x28, 6, 3); 345 - clks[IMX6SL_CLK_SSI1_PODF] = imx_clk_divider("ssi1_podf", "ssi1_pred", base + 0x28, 0, 6); 346 - clks[IMX6SL_CLK_SSI2_PRED] = imx_clk_divider("ssi2_pred", "ssi2_sel", base + 0x2c, 6, 3); 347 - clks[IMX6SL_CLK_SSI2_PODF] = imx_clk_divider("ssi2_podf", "ssi2_pred", base + 0x2c, 0, 6); 348 - clks[IMX6SL_CLK_SSI3_PRED] = imx_clk_divider("ssi3_pred", "ssi3_sel", base + 0x28, 22, 3); 349 - clks[IMX6SL_CLK_SSI3_PODF] = imx_clk_divider("ssi3_podf", "ssi3_pred", base + 0x28, 16, 6); 350 - clks[IMX6SL_CLK_PERCLK] = imx_clk_fixup_divider("perclk", "perclk_sel", base + 0x1c, 0, 6, imx_cscmr1_fixup); 351 - clks[IMX6SL_CLK_PXP_AXI_PODF] = imx_clk_divider("pxp_axi_podf", "pxp_axi_sel", base + 0x34, 3, 3); 352 - clks[IMX6SL_CLK_EPDC_AXI_PODF] = imx_clk_divider("epdc_axi_podf", "epdc_axi_sel", base + 0x34, 12, 3); 353 - clks[IMX6SL_CLK_GPU2D_OVG_PODF] = imx_clk_divider("gpu2d_ovg_podf", "gpu2d_ovg_sel", base + 0x18, 26, 3); 354 - clks[IMX6SL_CLK_GPU2D_PODF] = imx_clk_divider("gpu2d_podf", "gpu2d_sel", base + 0x18, 29, 3); 355 - clks[IMX6SL_CLK_LCDIF_PIX_PRED] = imx_clk_divider("lcdif_pix_pred", "lcdif_pix_sel", base + 0x38, 3, 3); 356 - clks[IMX6SL_CLK_EPDC_PIX_PRED] = imx_clk_divider("epdc_pix_pred", "epdc_pix_sel", base + 0x38, 12, 3); 357 - clks[IMX6SL_CLK_LCDIF_PIX_PODF] = imx_clk_fixup_divider("lcdif_pix_podf", "lcdif_pix_pred", base + 0x1c, 20, 3, imx_cscmr1_fixup); 358 - clks[IMX6SL_CLK_EPDC_PIX_PODF] = imx_clk_divider("epdc_pix_podf", "epdc_pix_pred", base + 0x18, 23, 3); 359 - clks[IMX6SL_CLK_SPDIF0_PRED] = imx_clk_divider("spdif0_pred", "spdif0_sel", base + 0x30, 25, 3); 360 - clks[IMX6SL_CLK_SPDIF0_PODF] = imx_clk_divider("spdif0_podf", "spdif0_pred", base + 0x30, 22, 3); 361 - clks[IMX6SL_CLK_SPDIF1_PRED] = imx_clk_divider("spdif1_pred", "spdif1_sel", base + 0x30, 12, 3); 362 - clks[IMX6SL_CLK_SPDIF1_PODF] = imx_clk_divider("spdif1_podf", "spdif1_pred", base + 0x30, 9, 3); 363 - clks[IMX6SL_CLK_EXTERN_AUDIO_PRED] = imx_clk_divider("extern_audio_pred", "extern_audio_sel", base + 0x28, 9, 3); 364 - clks[IMX6SL_CLK_EXTERN_AUDIO_PODF] = imx_clk_divider("extern_audio_podf", "extern_audio_pred", base + 0x28, 25, 3); 365 - clks[IMX6SL_CLK_ECSPI_ROOT] = imx_clk_divider("ecspi_root", "ecspi_sel", base + 0x38, 19, 6); 366 - clks[IMX6SL_CLK_UART_ROOT] = imx_clk_divider("uart_root", "uart_sel", base + 0x24, 0, 6); 326 + hws[IMX6SL_CLK_OCRAM_PODF] = imx_clk_hw_busy_divider("ocram_podf", "ocram_sel", base + 0x14, 16, 3, base + 0x48, 0); 327 + hws[IMX6SL_CLK_PERIPH_CLK2_PODF] = imx_clk_hw_divider("periph_clk2_podf", "periph_clk2_sel", base + 0x14, 27, 3); 328 + hws[IMX6SL_CLK_PERIPH2_CLK2_PODF] = imx_clk_hw_divider("periph2_clk2_podf", "periph2_clk2_sel", base + 0x14, 0, 3); 329 + hws[IMX6SL_CLK_IPG] = imx_clk_hw_divider("ipg", "ahb", base + 0x14, 8, 2); 330 + hws[IMX6SL_CLK_CSI_PODF] = imx_clk_hw_divider("csi_podf", "csi_sel", base + 0x3c, 11, 3); 331 + hws[IMX6SL_CLK_LCDIF_AXI_PODF] = imx_clk_hw_divider("lcdif_axi_podf", "lcdif_axi_sel", base + 0x3c, 16, 3); 332 + hws[IMX6SL_CLK_USDHC1_PODF] = imx_clk_hw_divider("usdhc1_podf", "usdhc1_sel", base + 0x24, 11, 3); 333 + hws[IMX6SL_CLK_USDHC2_PODF] = imx_clk_hw_divider("usdhc2_podf", "usdhc2_sel", base + 0x24, 16, 3); 334 + hws[IMX6SL_CLK_USDHC3_PODF] = imx_clk_hw_divider("usdhc3_podf", "usdhc3_sel", base + 0x24, 19, 3); 335 + hws[IMX6SL_CLK_USDHC4_PODF] = imx_clk_hw_divider("usdhc4_podf", "usdhc4_sel", base + 0x24, 22, 3); 336 + hws[IMX6SL_CLK_SSI1_PRED] = imx_clk_hw_divider("ssi1_pred", "ssi1_sel", base + 0x28, 6, 3); 337 + hws[IMX6SL_CLK_SSI1_PODF] = imx_clk_hw_divider("ssi1_podf", "ssi1_pred", base + 0x28, 0, 6); 338 + hws[IMX6SL_CLK_SSI2_PRED] = imx_clk_hw_divider("ssi2_pred", "ssi2_sel", base + 0x2c, 6, 3); 339 + hws[IMX6SL_CLK_SSI2_PODF] = imx_clk_hw_divider("ssi2_podf", "ssi2_pred", base + 0x2c, 0, 6); 340 + hws[IMX6SL_CLK_SSI3_PRED] = imx_clk_hw_divider("ssi3_pred", "ssi3_sel", base + 0x28, 22, 3); 341 + hws[IMX6SL_CLK_SSI3_PODF] = imx_clk_hw_divider("ssi3_podf", "ssi3_pred", base + 0x28, 16, 6); 342 + hws[IMX6SL_CLK_PERCLK] = imx_clk_hw_fixup_divider("perclk", "perclk_sel", base + 0x1c, 0, 6, imx_cscmr1_fixup); 343 + hws[IMX6SL_CLK_PXP_AXI_PODF] = imx_clk_hw_divider("pxp_axi_podf", "pxp_axi_sel", base + 0x34, 3, 3); 344 + hws[IMX6SL_CLK_EPDC_AXI_PODF] = imx_clk_hw_divider("epdc_axi_podf", "epdc_axi_sel", base + 0x34, 12, 3); 345 + hws[IMX6SL_CLK_GPU2D_OVG_PODF] = imx_clk_hw_divider("gpu2d_ovg_podf", "gpu2d_ovg_sel", base + 0x18, 26, 3); 346 + hws[IMX6SL_CLK_GPU2D_PODF] = imx_clk_hw_divider("gpu2d_podf", "gpu2d_sel", base + 0x18, 29, 3); 347 + hws[IMX6SL_CLK_LCDIF_PIX_PRED] = imx_clk_hw_divider("lcdif_pix_pred", "lcdif_pix_sel", base + 0x38, 3, 3); 348 + hws[IMX6SL_CLK_EPDC_PIX_PRED] = imx_clk_hw_divider("epdc_pix_pred", "epdc_pix_sel", base + 0x38, 12, 3); 349 + hws[IMX6SL_CLK_LCDIF_PIX_PODF] = imx_clk_hw_fixup_divider("lcdif_pix_podf", "lcdif_pix_pred", base + 0x1c, 20, 3, imx_cscmr1_fixup); 350 + hws[IMX6SL_CLK_EPDC_PIX_PODF] = imx_clk_hw_divider("epdc_pix_podf", "epdc_pix_pred", base + 0x18, 23, 3); 351 + hws[IMX6SL_CLK_SPDIF0_PRED] = imx_clk_hw_divider("spdif0_pred", "spdif0_sel", base + 0x30, 25, 3); 352 + hws[IMX6SL_CLK_SPDIF0_PODF] = imx_clk_hw_divider("spdif0_podf", "spdif0_pred", base + 0x30, 22, 3); 353 + hws[IMX6SL_CLK_SPDIF1_PRED] = imx_clk_hw_divider("spdif1_pred", "spdif1_sel", base + 0x30, 12, 3); 354 + hws[IMX6SL_CLK_SPDIF1_PODF] = imx_clk_hw_divider("spdif1_podf", "spdif1_pred", base + 0x30, 9, 3); 355 + hws[IMX6SL_CLK_EXTERN_AUDIO_PRED] = imx_clk_hw_divider("extern_audio_pred", "extern_audio_sel", base + 0x28, 9, 3); 356 + hws[IMX6SL_CLK_EXTERN_AUDIO_PODF] = imx_clk_hw_divider("extern_audio_podf", "extern_audio_pred", base + 0x28, 25, 3); 357 + hws[IMX6SL_CLK_ECSPI_ROOT] = imx_clk_hw_divider("ecspi_root", "ecspi_sel", base + 0x38, 19, 6); 358 + hws[IMX6SL_CLK_UART_ROOT] = imx_clk_hw_divider("uart_root", "uart_sel", base + 0x24, 0, 6); 367 359 368 360 /* name parent_name reg shift width busy: reg, shift */ 369 - clks[IMX6SL_CLK_AHB] = imx_clk_busy_divider("ahb", "periph", base + 0x14, 10, 3, base + 0x48, 1); 370 - clks[IMX6SL_CLK_MMDC_ROOT] = imx_clk_busy_divider("mmdc", "periph2", base + 0x14, 3, 3, base + 0x48, 2); 371 - clks[IMX6SL_CLK_ARM] = imx_clk_busy_divider("arm", "pll1_sw", base + 0x10, 0, 3, base + 0x48, 16); 361 + hws[IMX6SL_CLK_AHB] = imx_clk_hw_busy_divider("ahb", "periph", base + 0x14, 10, 3, base + 0x48, 1); 362 + hws[IMX6SL_CLK_MMDC_ROOT] = imx_clk_hw_busy_divider("mmdc", "periph2", base + 0x14, 3, 3, base + 0x48, 2); 363 + hws[IMX6SL_CLK_ARM] = imx_clk_hw_busy_divider("arm", "pll1_sw", base + 0x10, 0, 3, base + 0x48, 16); 372 364 373 365 /* name parent_name reg shift */ 374 - clks[IMX6SL_CLK_ECSPI1] = imx_clk_gate2("ecspi1", "ecspi_root", base + 0x6c, 0); 375 - clks[IMX6SL_CLK_ECSPI2] = imx_clk_gate2("ecspi2", "ecspi_root", base + 0x6c, 2); 376 - clks[IMX6SL_CLK_ECSPI3] = imx_clk_gate2("ecspi3", "ecspi_root", base + 0x6c, 4); 377 - clks[IMX6SL_CLK_ECSPI4] = imx_clk_gate2("ecspi4", "ecspi_root", base + 0x6c, 6); 378 - clks[IMX6SL_CLK_ENET] = imx_clk_gate2("enet", "ipg", base + 0x6c, 10); 379 - clks[IMX6SL_CLK_EPIT1] = imx_clk_gate2("epit1", "perclk", base + 0x6c, 12); 380 - clks[IMX6SL_CLK_EPIT2] = imx_clk_gate2("epit2", "perclk", base + 0x6c, 14); 381 - clks[IMX6SL_CLK_EXTERN_AUDIO] = imx_clk_gate2("extern_audio", "extern_audio_podf", base + 0x6c, 16); 382 - clks[IMX6SL_CLK_GPT] = imx_clk_gate2("gpt", "perclk", base + 0x6c, 20); 383 - clks[IMX6SL_CLK_GPT_SERIAL] = imx_clk_gate2("gpt_serial", "perclk", base + 0x6c, 22); 384 - clks[IMX6SL_CLK_GPU2D_OVG] = imx_clk_gate2("gpu2d_ovg", "gpu2d_ovg_podf", base + 0x6c, 26); 385 - clks[IMX6SL_CLK_I2C1] = imx_clk_gate2("i2c1", "perclk", base + 0x70, 6); 386 - clks[IMX6SL_CLK_I2C2] = imx_clk_gate2("i2c2", "perclk", base + 0x70, 8); 387 - clks[IMX6SL_CLK_I2C3] = imx_clk_gate2("i2c3", "perclk", base + 0x70, 10); 388 - clks[IMX6SL_CLK_OCOTP] = imx_clk_gate2("ocotp", "ipg", base + 0x70, 12); 389 - clks[IMX6SL_CLK_CSI] = imx_clk_gate2("csi", "csi_podf", base + 0x74, 0); 390 - clks[IMX6SL_CLK_PXP_AXI] = imx_clk_gate2("pxp_axi", "pxp_axi_podf", base + 0x74, 2); 391 - clks[IMX6SL_CLK_EPDC_AXI] = imx_clk_gate2("epdc_axi", "epdc_axi_podf", base + 0x74, 4); 392 - clks[IMX6SL_CLK_LCDIF_AXI] = imx_clk_gate2("lcdif_axi", "lcdif_axi_podf", base + 0x74, 6); 393 - clks[IMX6SL_CLK_LCDIF_PIX] = imx_clk_gate2("lcdif_pix", "lcdif_pix_podf", base + 0x74, 8); 394 - clks[IMX6SL_CLK_EPDC_PIX] = imx_clk_gate2("epdc_pix", "epdc_pix_podf", base + 0x74, 10); 395 - clks[IMX6SL_CLK_MMDC_P0_IPG] = imx_clk_gate2_flags("mmdc_p0_ipg", "ipg", base + 0x74, 24, CLK_IS_CRITICAL); 396 - clks[IMX6SL_CLK_MMDC_P1_IPG] = imx_clk_gate2("mmdc_p1_ipg", "ipg", base + 0x74, 26); 397 - clks[IMX6SL_CLK_OCRAM] = imx_clk_gate2("ocram", "ocram_podf", base + 0x74, 28); 398 - clks[IMX6SL_CLK_PWM1] = imx_clk_gate2("pwm1", "perclk", base + 0x78, 16); 399 - clks[IMX6SL_CLK_PWM2] = imx_clk_gate2("pwm2", "perclk", base + 0x78, 18); 400 - clks[IMX6SL_CLK_PWM3] = imx_clk_gate2("pwm3", "perclk", base + 0x78, 20); 401 - clks[IMX6SL_CLK_PWM4] = imx_clk_gate2("pwm4", "perclk", base + 0x78, 22); 402 - clks[IMX6SL_CLK_SDMA] = imx_clk_gate2("sdma", "ipg", base + 0x7c, 6); 403 - clks[IMX6SL_CLK_SPBA] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12); 404 - clks[IMX6SL_CLK_SPDIF] = imx_clk_gate2_shared("spdif", "spdif0_podf", base + 0x7c, 14, &share_count_spdif); 405 - clks[IMX6SL_CLK_SPDIF_GCLK] = imx_clk_gate2_shared("spdif_gclk", "ipg", base + 0x7c, 14, &share_count_spdif); 406 - clks[IMX6SL_CLK_SSI1_IPG] = imx_clk_gate2_shared("ssi1_ipg", "ipg", base + 0x7c, 18, &share_count_ssi1); 407 - clks[IMX6SL_CLK_SSI2_IPG] = imx_clk_gate2_shared("ssi2_ipg", "ipg", base + 0x7c, 20, &share_count_ssi2); 408 - clks[IMX6SL_CLK_SSI3_IPG] = imx_clk_gate2_shared("ssi3_ipg", "ipg", base + 0x7c, 22, &share_count_ssi3); 409 - clks[IMX6SL_CLK_SSI1] = imx_clk_gate2_shared("ssi1", "ssi1_podf", base + 0x7c, 18, &share_count_ssi1); 410 - clks[IMX6SL_CLK_SSI2] = imx_clk_gate2_shared("ssi2", "ssi2_podf", base + 0x7c, 20, &share_count_ssi2); 411 - clks[IMX6SL_CLK_SSI3] = imx_clk_gate2_shared("ssi3", "ssi3_podf", base + 0x7c, 22, &share_count_ssi3); 412 - clks[IMX6SL_CLK_UART] = imx_clk_gate2("uart", "ipg", base + 0x7c, 24); 413 - clks[IMX6SL_CLK_UART_SERIAL] = imx_clk_gate2("uart_serial", "uart_root", base + 0x7c, 26); 414 - clks[IMX6SL_CLK_USBOH3] = imx_clk_gate2("usboh3", "ipg", base + 0x80, 0); 415 - clks[IMX6SL_CLK_USDHC1] = imx_clk_gate2("usdhc1", "usdhc1_podf", base + 0x80, 2); 416 - clks[IMX6SL_CLK_USDHC2] = imx_clk_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4); 417 - clks[IMX6SL_CLK_USDHC3] = imx_clk_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6); 418 - clks[IMX6SL_CLK_USDHC4] = imx_clk_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8); 366 + hws[IMX6SL_CLK_ECSPI1] = imx_clk_hw_gate2("ecspi1", "ecspi_root", base + 0x6c, 0); 367 + hws[IMX6SL_CLK_ECSPI2] = imx_clk_hw_gate2("ecspi2", "ecspi_root", base + 0x6c, 2); 368 + hws[IMX6SL_CLK_ECSPI3] = imx_clk_hw_gate2("ecspi3", "ecspi_root", base + 0x6c, 4); 369 + hws[IMX6SL_CLK_ECSPI4] = imx_clk_hw_gate2("ecspi4", "ecspi_root", base + 0x6c, 6); 370 + hws[IMX6SL_CLK_ENET] = imx_clk_hw_gate2("enet", "ipg", base + 0x6c, 10); 371 + hws[IMX6SL_CLK_EPIT1] = imx_clk_hw_gate2("epit1", "perclk", base + 0x6c, 12); 372 + hws[IMX6SL_CLK_EPIT2] = imx_clk_hw_gate2("epit2", "perclk", base + 0x6c, 14); 373 + hws[IMX6SL_CLK_EXTERN_AUDIO] = imx_clk_hw_gate2("extern_audio", "extern_audio_podf", base + 0x6c, 16); 374 + hws[IMX6SL_CLK_GPT] = imx_clk_hw_gate2("gpt", "perclk", base + 0x6c, 20); 375 + hws[IMX6SL_CLK_GPT_SERIAL] = imx_clk_hw_gate2("gpt_serial", "perclk", base + 0x6c, 22); 376 + hws[IMX6SL_CLK_GPU2D_OVG] = imx_clk_hw_gate2("gpu2d_ovg", "gpu2d_ovg_podf", base + 0x6c, 26); 377 + hws[IMX6SL_CLK_I2C1] = imx_clk_hw_gate2("i2c1", "perclk", base + 0x70, 6); 378 + hws[IMX6SL_CLK_I2C2] = imx_clk_hw_gate2("i2c2", "perclk", base + 0x70, 8); 379 + hws[IMX6SL_CLK_I2C3] = imx_clk_hw_gate2("i2c3", "perclk", base + 0x70, 10); 380 + hws[IMX6SL_CLK_OCOTP] = imx_clk_hw_gate2("ocotp", "ipg", base + 0x70, 12); 381 + hws[IMX6SL_CLK_CSI] = imx_clk_hw_gate2("csi", "csi_podf", base + 0x74, 0); 382 + hws[IMX6SL_CLK_PXP_AXI] = imx_clk_hw_gate2("pxp_axi", "pxp_axi_podf", base + 0x74, 2); 383 + hws[IMX6SL_CLK_EPDC_AXI] = imx_clk_hw_gate2("epdc_axi", "epdc_axi_podf", base + 0x74, 4); 384 + hws[IMX6SL_CLK_LCDIF_AXI] = imx_clk_hw_gate2("lcdif_axi", "lcdif_axi_podf", base + 0x74, 6); 385 + hws[IMX6SL_CLK_LCDIF_PIX] = imx_clk_hw_gate2("lcdif_pix", "lcdif_pix_podf", base + 0x74, 8); 386 + hws[IMX6SL_CLK_EPDC_PIX] = imx_clk_hw_gate2("epdc_pix", "epdc_pix_podf", base + 0x74, 10); 387 + hws[IMX6SL_CLK_MMDC_P0_IPG] = imx_clk_hw_gate2_flags("mmdc_p0_ipg", "ipg", base + 0x74, 24, CLK_IS_CRITICAL); 388 + hws[IMX6SL_CLK_MMDC_P1_IPG] = imx_clk_hw_gate2("mmdc_p1_ipg", "ipg", base + 0x74, 26); 389 + hws[IMX6SL_CLK_OCRAM] = imx_clk_hw_gate2("ocram", "ocram_podf", base + 0x74, 28); 390 + hws[IMX6SL_CLK_PWM1] = imx_clk_hw_gate2("pwm1", "perclk", base + 0x78, 16); 391 + hws[IMX6SL_CLK_PWM2] = imx_clk_hw_gate2("pwm2", "perclk", base + 0x78, 18); 392 + hws[IMX6SL_CLK_PWM3] = imx_clk_hw_gate2("pwm3", "perclk", base + 0x78, 20); 393 + hws[IMX6SL_CLK_PWM4] = imx_clk_hw_gate2("pwm4", "perclk", base + 0x78, 22); 394 + hws[IMX6SL_CLK_SDMA] = imx_clk_hw_gate2("sdma", "ipg", base + 0x7c, 6); 395 + hws[IMX6SL_CLK_SPBA] = imx_clk_hw_gate2("spba", "ipg", base + 0x7c, 12); 396 + hws[IMX6SL_CLK_SPDIF] = imx_clk_hw_gate2_shared("spdif", "spdif0_podf", base + 0x7c, 14, &share_count_spdif); 397 + hws[IMX6SL_CLK_SPDIF_GCLK] = imx_clk_hw_gate2_shared("spdif_gclk", "ipg", base + 0x7c, 14, &share_count_spdif); 398 + hws[IMX6SL_CLK_SSI1_IPG] = imx_clk_hw_gate2_shared("ssi1_ipg", "ipg", base + 0x7c, 18, &share_count_ssi1); 399 + hws[IMX6SL_CLK_SSI2_IPG] = imx_clk_hw_gate2_shared("ssi2_ipg", "ipg", base + 0x7c, 20, &share_count_ssi2); 400 + hws[IMX6SL_CLK_SSI3_IPG] = imx_clk_hw_gate2_shared("ssi3_ipg", "ipg", base + 0x7c, 22, &share_count_ssi3); 401 + hws[IMX6SL_CLK_SSI1] = imx_clk_hw_gate2_shared("ssi1", "ssi1_podf", base + 0x7c, 18, &share_count_ssi1); 402 + hws[IMX6SL_CLK_SSI2] = imx_clk_hw_gate2_shared("ssi2", "ssi2_podf", base + 0x7c, 20, &share_count_ssi2); 403 + hws[IMX6SL_CLK_SSI3] = imx_clk_hw_gate2_shared("ssi3", "ssi3_podf", base + 0x7c, 22, &share_count_ssi3); 404 + hws[IMX6SL_CLK_UART] = imx_clk_hw_gate2("uart", "ipg", base + 0x7c, 24); 405 + hws[IMX6SL_CLK_UART_SERIAL] = imx_clk_hw_gate2("uart_serial", "uart_root", base + 0x7c, 26); 406 + hws[IMX6SL_CLK_USBOH3] = imx_clk_hw_gate2("usboh3", "ipg", base + 0x80, 0); 407 + hws[IMX6SL_CLK_USDHC1] = imx_clk_hw_gate2("usdhc1", "usdhc1_podf", base + 0x80, 2); 408 + hws[IMX6SL_CLK_USDHC2] = imx_clk_hw_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4); 409 + hws[IMX6SL_CLK_USDHC3] = imx_clk_hw_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6); 410 + hws[IMX6SL_CLK_USDHC4] = imx_clk_hw_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8); 419 411 420 412 /* Ensure the MMDC CH0 handshake is bypassed */ 421 - writel_relaxed(readl_relaxed(base + CCDR) | 422 - BM_CCM_CCDR_MMDC_CH0_MASK, base + CCDR); 413 + imx_mmdc_mask_handshake(base, 0); 423 414 424 - imx_check_clocks(clks, ARRAY_SIZE(clks)); 415 + imx_check_clk_hws(hws, IMX6SL_CLK_END); 425 416 426 - clk_data.clks = clks; 427 - clk_data.clk_num = ARRAY_SIZE(clks); 428 - of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 417 + of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data); 429 418 430 419 /* Ensure the AHB clk is at 132MHz. */ 431 - ret = clk_set_rate(clks[IMX6SL_CLK_AHB], 132000000); 420 + ret = clk_set_rate(hws[IMX6SL_CLK_AHB]->clk, 132000000); 432 421 if (ret) 433 422 pr_warn("%s: failed to set AHB clock rate %d!\n", 434 423 __func__, ret); 435 424 436 425 if (IS_ENABLED(CONFIG_USB_MXS_PHY)) { 437 - clk_prepare_enable(clks[IMX6SL_CLK_USBPHY1_GATE]); 438 - clk_prepare_enable(clks[IMX6SL_CLK_USBPHY2_GATE]); 426 + clk_prepare_enable(hws[IMX6SL_CLK_USBPHY1_GATE]->clk); 427 + clk_prepare_enable(hws[IMX6SL_CLK_USBPHY2_GATE]->clk); 439 428 } 440 429 441 430 /* Audio-related clocks configuration */ 442 - clk_set_parent(clks[IMX6SL_CLK_SPDIF0_SEL], clks[IMX6SL_CLK_PLL3_PFD3]); 431 + clk_set_parent(hws[IMX6SL_CLK_SPDIF0_SEL]->clk, hws[IMX6SL_CLK_PLL3_PFD3]->clk); 443 432 444 433 /* set PLL5 video as lcdif pix parent clock */ 445 - clk_set_parent(clks[IMX6SL_CLK_LCDIF_PIX_SEL], 446 - clks[IMX6SL_CLK_PLL5_VIDEO_DIV]); 434 + clk_set_parent(hws[IMX6SL_CLK_LCDIF_PIX_SEL]->clk, 435 + hws[IMX6SL_CLK_PLL5_VIDEO_DIV]->clk); 447 436 448 - clk_set_parent(clks[IMX6SL_CLK_LCDIF_AXI_SEL], 449 - clks[IMX6SL_CLK_PLL2_PFD2]); 437 + clk_set_parent(hws[IMX6SL_CLK_LCDIF_AXI_SEL]->clk, 438 + hws[IMX6SL_CLK_PLL2_PFD2]->clk); 439 + 440 + for (i = 0; i < ARRAY_SIZE(uart_clk_ids); i++) { 441 + int index = uart_clk_ids[i]; 442 + 443 + uart_clks[i] = &hws[index]->clk; 444 + } 450 445 451 446 imx_register_uart_clocks(uart_clks); 452 447 }
+215 -201
drivers/clk/imx/clk-imx6sll.c
··· 7 7 #include <dt-bindings/clock/imx6sll-clock.h> 8 8 #include <linux/clk.h> 9 9 #include <linux/clkdev.h> 10 + #include <linux/clk-provider.h> 10 11 #include <linux/err.h> 11 12 #include <linux/init.h> 12 13 #include <linux/io.h> ··· 17 16 #include "clk.h" 18 17 19 18 #define CCM_ANALOG_PLL_BYPASS (0x1 << 16) 20 - #define BM_CCM_CCDR_MMDC_CH0_MASK (0x2 << 16) 21 19 #define xPLL_CLR(offset) (offset + 0x8) 22 20 23 21 static const char *pll_bypass_src_sels[] = { "osc", "dummy", }; ··· 53 53 static const char *epdc_pre_sels[] = { "pll2_bus", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0_352m", "pll2_pfd2_396m", "pll3_pfd2_508m", }; 54 54 static const char *epdc_sels[] = { "epdc_podf", "ipp_di0", "ipp_di1", "ldb_di0", "ldb_di1", }; 55 55 56 - static struct clk *clks[IMX6SLL_CLK_END]; 57 - static struct clk_onecell_data clk_data; 56 + static struct clk_hw **hws; 57 + static struct clk_hw_onecell_data *clk_hw_data; 58 58 59 59 static const struct clk_div_table post_div_table[] = { 60 60 { .val = 2, .div = 1, }, ··· 76 76 static u32 share_count_ssi2; 77 77 static u32 share_count_ssi3; 78 78 79 - static struct clk ** const uart_clks[] __initconst = { 80 - &clks[IMX6SLL_CLK_UART1_IPG], 81 - &clks[IMX6SLL_CLK_UART1_SERIAL], 82 - &clks[IMX6SLL_CLK_UART2_IPG], 83 - &clks[IMX6SLL_CLK_UART2_SERIAL], 84 - &clks[IMX6SLL_CLK_UART3_IPG], 85 - &clks[IMX6SLL_CLK_UART3_SERIAL], 86 - &clks[IMX6SLL_CLK_UART4_IPG], 87 - &clks[IMX6SLL_CLK_UART4_SERIAL], 88 - &clks[IMX6SLL_CLK_UART5_IPG], 89 - &clks[IMX6SLL_CLK_UART5_SERIAL], 90 - NULL 79 + static const int uart_clk_ids[] __initconst = { 80 + IMX6SLL_CLK_UART1_IPG, 81 + IMX6SLL_CLK_UART1_SERIAL, 82 + IMX6SLL_CLK_UART2_IPG, 83 + IMX6SLL_CLK_UART2_SERIAL, 84 + IMX6SLL_CLK_UART3_IPG, 85 + IMX6SLL_CLK_UART3_SERIAL, 86 + IMX6SLL_CLK_UART4_IPG, 87 + IMX6SLL_CLK_UART4_SERIAL, 88 + IMX6SLL_CLK_UART5_IPG, 89 + IMX6SLL_CLK_UART5_SERIAL, 91 90 }; 91 + 92 + static struct clk **uart_clks[ARRAY_SIZE(uart_clk_ids) + 1] __initdata; 92 93 93 94 static void __init imx6sll_clocks_init(struct device_node *ccm_node) 94 95 { 95 96 struct device_node *np; 96 97 void __iomem *base; 98 + int i; 97 99 98 - clks[IMX6SLL_CLK_DUMMY] = imx_clk_fixed("dummy", 0); 100 + clk_hw_data = kzalloc(struct_size(clk_hw_data, hws, 101 + IMX6SLL_CLK_END), GFP_KERNEL); 102 + if (WARN_ON(!clk_hw_data)) 103 + return; 99 104 100 - clks[IMX6SLL_CLK_CKIL] = of_clk_get_by_name(ccm_node, "ckil"); 101 - clks[IMX6SLL_CLK_OSC] = of_clk_get_by_name(ccm_node, "osc"); 105 + clk_hw_data->num = IMX6SLL_CLK_END; 106 + hws = clk_hw_data->hws; 107 + 108 + hws[IMX6SLL_CLK_DUMMY] = imx_clk_hw_fixed("dummy", 0); 109 + 110 + hws[IMX6SLL_CLK_CKIL] = __clk_get_hw(of_clk_get_by_name(ccm_node, "ckil")); 111 + hws[IMX6SLL_CLK_OSC] = __clk_get_hw(of_clk_get_by_name(ccm_node, "osc")); 102 112 103 113 /* ipp_di clock is external input */ 104 - clks[IMX6SLL_CLK_IPP_DI0] = of_clk_get_by_name(ccm_node, "ipp_di0"); 105 - clks[IMX6SLL_CLK_IPP_DI1] = of_clk_get_by_name(ccm_node, "ipp_di1"); 114 + hws[IMX6SLL_CLK_IPP_DI0] = __clk_get_hw(of_clk_get_by_name(ccm_node, "ipp_di0")); 115 + hws[IMX6SLL_CLK_IPP_DI1] = __clk_get_hw(of_clk_get_by_name(ccm_node, "ipp_di1")); 106 116 107 117 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sll-anatop"); 108 118 base = of_iomap(np, 0); ··· 128 118 writel_relaxed(CCM_ANALOG_PLL_BYPASS, base + xPLL_CLR(0xa0)); 129 119 writel_relaxed(CCM_ANALOG_PLL_BYPASS, base + xPLL_CLR(0xe0)); 130 120 131 - clks[IMX6SLL_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", base + 0x00, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 132 - clks[IMX6SLL_PLL2_BYPASS_SRC] = imx_clk_mux("pll2_bypass_src", base + 0x30, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 133 - clks[IMX6SLL_PLL3_BYPASS_SRC] = imx_clk_mux("pll3_bypass_src", base + 0x10, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 134 - clks[IMX6SLL_PLL4_BYPASS_SRC] = imx_clk_mux("pll4_bypass_src", base + 0x70, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 135 - clks[IMX6SLL_PLL5_BYPASS_SRC] = imx_clk_mux("pll5_bypass_src", base + 0xa0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 136 - clks[IMX6SLL_PLL6_BYPASS_SRC] = imx_clk_mux("pll6_bypass_src", base + 0xe0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 137 - clks[IMX6SLL_PLL7_BYPASS_SRC] = imx_clk_mux("pll7_bypass_src", base + 0x20, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 121 + hws[IMX6SLL_PLL1_BYPASS_SRC] = imx_clk_hw_mux("pll1_bypass_src", base + 0x00, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 122 + hws[IMX6SLL_PLL2_BYPASS_SRC] = imx_clk_hw_mux("pll2_bypass_src", base + 0x30, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 123 + hws[IMX6SLL_PLL3_BYPASS_SRC] = imx_clk_hw_mux("pll3_bypass_src", base + 0x10, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 124 + hws[IMX6SLL_PLL4_BYPASS_SRC] = imx_clk_hw_mux("pll4_bypass_src", base + 0x70, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 125 + hws[IMX6SLL_PLL5_BYPASS_SRC] = imx_clk_hw_mux("pll5_bypass_src", base + 0xa0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 126 + hws[IMX6SLL_PLL6_BYPASS_SRC] = imx_clk_hw_mux("pll6_bypass_src", base + 0xe0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 127 + hws[IMX6SLL_PLL7_BYPASS_SRC] = imx_clk_hw_mux("pll7_bypass_src", base + 0x20, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 138 128 139 - clks[IMX6SLL_CLK_PLL1] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1", "pll1_bypass_src", base + 0x00, 0x7f); 140 - clks[IMX6SLL_CLK_PLL2] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2", "pll2_bypass_src", base + 0x30, 0x1); 141 - clks[IMX6SLL_CLK_PLL3] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3", "pll3_bypass_src", base + 0x10, 0x3); 142 - clks[IMX6SLL_CLK_PLL4] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4", "pll4_bypass_src", base + 0x70, 0x7f); 143 - clks[IMX6SLL_CLK_PLL5] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5", "pll5_bypass_src", base + 0xa0, 0x7f); 144 - clks[IMX6SLL_CLK_PLL6] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll6", "pll6_bypass_src", base + 0xe0, 0x3); 145 - clks[IMX6SLL_CLK_PLL7] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7", "pll7_bypass_src", base + 0x20, 0x3); 129 + hws[IMX6SLL_CLK_PLL1] = imx_clk_hw_pllv3(IMX_PLLV3_SYS, "pll1", "pll1_bypass_src", base + 0x00, 0x7f); 130 + hws[IMX6SLL_CLK_PLL2] = imx_clk_hw_pllv3(IMX_PLLV3_GENERIC, "pll2", "pll2_bypass_src", base + 0x30, 0x1); 131 + hws[IMX6SLL_CLK_PLL3] = imx_clk_hw_pllv3(IMX_PLLV3_USB, "pll3", "pll3_bypass_src", base + 0x10, 0x3); 132 + hws[IMX6SLL_CLK_PLL4] = imx_clk_hw_pllv3(IMX_PLLV3_AV, "pll4", "pll4_bypass_src", base + 0x70, 0x7f); 133 + hws[IMX6SLL_CLK_PLL5] = imx_clk_hw_pllv3(IMX_PLLV3_AV, "pll5", "pll5_bypass_src", base + 0xa0, 0x7f); 134 + hws[IMX6SLL_CLK_PLL6] = imx_clk_hw_pllv3(IMX_PLLV3_ENET, "pll6", "pll6_bypass_src", base + 0xe0, 0x3); 135 + hws[IMX6SLL_CLK_PLL7] = imx_clk_hw_pllv3(IMX_PLLV3_USB, "pll7", "pll7_bypass_src", base + 0x20, 0x3); 146 136 147 - clks[IMX6SLL_PLL1_BYPASS] = imx_clk_mux_flags("pll1_bypass", base + 0x00, 16, 1, pll1_bypass_sels, ARRAY_SIZE(pll1_bypass_sels), CLK_SET_RATE_PARENT); 148 - clks[IMX6SLL_PLL2_BYPASS] = imx_clk_mux_flags("pll2_bypass", base + 0x30, 16, 1, pll2_bypass_sels, ARRAY_SIZE(pll2_bypass_sels), CLK_SET_RATE_PARENT); 149 - clks[IMX6SLL_PLL3_BYPASS] = imx_clk_mux_flags("pll3_bypass", base + 0x10, 16, 1, pll3_bypass_sels, ARRAY_SIZE(pll3_bypass_sels), CLK_SET_RATE_PARENT); 150 - clks[IMX6SLL_PLL4_BYPASS] = imx_clk_mux_flags("pll4_bypass", base + 0x70, 16, 1, pll4_bypass_sels, ARRAY_SIZE(pll4_bypass_sels), CLK_SET_RATE_PARENT); 151 - clks[IMX6SLL_PLL5_BYPASS] = imx_clk_mux_flags("pll5_bypass", base + 0xa0, 16, 1, pll5_bypass_sels, ARRAY_SIZE(pll5_bypass_sels), CLK_SET_RATE_PARENT); 152 - clks[IMX6SLL_PLL6_BYPASS] = imx_clk_mux_flags("pll6_bypass", base + 0xe0, 16, 1, pll6_bypass_sels, ARRAY_SIZE(pll6_bypass_sels), CLK_SET_RATE_PARENT); 153 - clks[IMX6SLL_PLL7_BYPASS] = imx_clk_mux_flags("pll7_bypass", base + 0x20, 16, 1, pll7_bypass_sels, ARRAY_SIZE(pll7_bypass_sels), CLK_SET_RATE_PARENT); 137 + hws[IMX6SLL_PLL1_BYPASS] = imx_clk_hw_mux_flags("pll1_bypass", base + 0x00, 16, 1, pll1_bypass_sels, ARRAY_SIZE(pll1_bypass_sels), CLK_SET_RATE_PARENT); 138 + hws[IMX6SLL_PLL2_BYPASS] = imx_clk_hw_mux_flags("pll2_bypass", base + 0x30, 16, 1, pll2_bypass_sels, ARRAY_SIZE(pll2_bypass_sels), CLK_SET_RATE_PARENT); 139 + hws[IMX6SLL_PLL3_BYPASS] = imx_clk_hw_mux_flags("pll3_bypass", base + 0x10, 16, 1, pll3_bypass_sels, ARRAY_SIZE(pll3_bypass_sels), CLK_SET_RATE_PARENT); 140 + hws[IMX6SLL_PLL4_BYPASS] = imx_clk_hw_mux_flags("pll4_bypass", base + 0x70, 16, 1, pll4_bypass_sels, ARRAY_SIZE(pll4_bypass_sels), CLK_SET_RATE_PARENT); 141 + hws[IMX6SLL_PLL5_BYPASS] = imx_clk_hw_mux_flags("pll5_bypass", base + 0xa0, 16, 1, pll5_bypass_sels, ARRAY_SIZE(pll5_bypass_sels), CLK_SET_RATE_PARENT); 142 + hws[IMX6SLL_PLL6_BYPASS] = imx_clk_hw_mux_flags("pll6_bypass", base + 0xe0, 16, 1, pll6_bypass_sels, ARRAY_SIZE(pll6_bypass_sels), CLK_SET_RATE_PARENT); 143 + hws[IMX6SLL_PLL7_BYPASS] = imx_clk_hw_mux_flags("pll7_bypass", base + 0x20, 16, 1, pll7_bypass_sels, ARRAY_SIZE(pll7_bypass_sels), CLK_SET_RATE_PARENT); 154 144 155 - clks[IMX6SLL_CLK_PLL1_SYS] = imx_clk_fixed_factor("pll1_sys", "pll1_bypass", 1, 1); 156 - clks[IMX6SLL_CLK_PLL2_BUS] = imx_clk_gate("pll2_bus", "pll2_bypass", base + 0x30, 13); 157 - clks[IMX6SLL_CLK_PLL3_USB_OTG] = imx_clk_gate("pll3_usb_otg", "pll3_bypass", base + 0x10, 13); 158 - clks[IMX6SLL_CLK_PLL4_AUDIO] = imx_clk_gate("pll4_audio", "pll4_bypass", base + 0x70, 13); 159 - clks[IMX6SLL_CLK_PLL5_VIDEO] = imx_clk_gate("pll5_video", "pll5_bypass", base + 0xa0, 13); 160 - clks[IMX6SLL_CLK_PLL6_ENET] = imx_clk_gate("pll6_enet", "pll6_bypass", base + 0xe0, 13); 161 - clks[IMX6SLL_CLK_PLL7_USB_HOST] = imx_clk_gate("pll7_usb_host", "pll7_bypass", base + 0x20, 13); 145 + hws[IMX6SLL_CLK_PLL1_SYS] = imx_clk_hw_fixed_factor("pll1_sys", "pll1_bypass", 1, 1); 146 + hws[IMX6SLL_CLK_PLL2_BUS] = imx_clk_hw_gate("pll2_bus", "pll2_bypass", base + 0x30, 13); 147 + hws[IMX6SLL_CLK_PLL3_USB_OTG] = imx_clk_hw_gate("pll3_usb_otg", "pll3_bypass", base + 0x10, 13); 148 + hws[IMX6SLL_CLK_PLL4_AUDIO] = imx_clk_hw_gate("pll4_audio", "pll4_bypass", base + 0x70, 13); 149 + hws[IMX6SLL_CLK_PLL5_VIDEO] = imx_clk_hw_gate("pll5_video", "pll5_bypass", base + 0xa0, 13); 150 + hws[IMX6SLL_CLK_PLL6_ENET] = imx_clk_hw_gate("pll6_enet", "pll6_bypass", base + 0xe0, 13); 151 + hws[IMX6SLL_CLK_PLL7_USB_HOST] = imx_clk_hw_gate("pll7_usb_host", "pll7_bypass", base + 0x20, 13); 162 152 163 153 /* 164 154 * Bit 20 is the reserved and read-only bit, we do this only for: ··· 166 156 * - Keep refcount when do usbphy clk_enable/disable, in that case, 167 157 * the clk framework many need to enable/disable usbphy's parent 168 158 */ 169 - clks[IMX6SLL_CLK_USBPHY1] = imx_clk_gate("usbphy1", "pll3_usb_otg", base + 0x10, 20); 170 - clks[IMX6SLL_CLK_USBPHY2] = imx_clk_gate("usbphy2", "pll7_usb_host", base + 0x20, 20); 159 + hws[IMX6SLL_CLK_USBPHY1] = imx_clk_hw_gate("usbphy1", "pll3_usb_otg", base + 0x10, 20); 160 + hws[IMX6SLL_CLK_USBPHY2] = imx_clk_hw_gate("usbphy2", "pll7_usb_host", base + 0x20, 20); 171 161 172 162 /* 173 163 * usbphy*_gate needs to be on after system boots up, and software 174 164 * never needs to control it anymore. 175 165 */ 176 166 if (IS_ENABLED(CONFIG_USB_MXS_PHY)) { 177 - clks[IMX6SLL_CLK_USBPHY1_GATE] = imx_clk_gate_flags("usbphy1_gate", "dummy", base + 0x10, 6, CLK_IS_CRITICAL); 178 - clks[IMX6SLL_CLK_USBPHY2_GATE] = imx_clk_gate_flags("usbphy2_gate", "dummy", base + 0x20, 6, CLK_IS_CRITICAL); 167 + hws[IMX6SLL_CLK_USBPHY1_GATE] = imx_clk_hw_gate_flags("usbphy1_gate", "dummy", base + 0x10, 6, CLK_IS_CRITICAL); 168 + hws[IMX6SLL_CLK_USBPHY2_GATE] = imx_clk_hw_gate_flags("usbphy2_gate", "dummy", base + 0x20, 6, CLK_IS_CRITICAL); 179 169 } 180 170 181 171 /* name parent_name reg idx */ 182 - clks[IMX6SLL_CLK_PLL2_PFD0] = imx_clk_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0); 183 - clks[IMX6SLL_CLK_PLL2_PFD1] = imx_clk_pfd("pll2_pfd1_594m", "pll2_bus", base + 0x100, 1); 184 - clks[IMX6SLL_CLK_PLL2_PFD2] = imx_clk_pfd("pll2_pfd2_396m", "pll2_bus", base + 0x100, 2); 185 - clks[IMX6SLL_CLK_PLL2_PFD3] = imx_clk_pfd("pll2_pfd3_594m", "pll2_bus", base + 0x100, 3); 186 - clks[IMX6SLL_CLK_PLL3_PFD0] = imx_clk_pfd("pll3_pfd0_720m", "pll3_usb_otg", base + 0xf0, 0); 187 - clks[IMX6SLL_CLK_PLL3_PFD1] = imx_clk_pfd("pll3_pfd1_540m", "pll3_usb_otg", base + 0xf0, 1); 188 - clks[IMX6SLL_CLK_PLL3_PFD2] = imx_clk_pfd("pll3_pfd2_508m", "pll3_usb_otg", base + 0xf0, 2); 189 - clks[IMX6SLL_CLK_PLL3_PFD3] = imx_clk_pfd("pll3_pfd3_454m", "pll3_usb_otg", base + 0xf0, 3); 172 + hws[IMX6SLL_CLK_PLL2_PFD0] = imx_clk_hw_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0); 173 + hws[IMX6SLL_CLK_PLL2_PFD1] = imx_clk_hw_pfd("pll2_pfd1_594m", "pll2_bus", base + 0x100, 1); 174 + hws[IMX6SLL_CLK_PLL2_PFD2] = imx_clk_hw_pfd("pll2_pfd2_396m", "pll2_bus", base + 0x100, 2); 175 + hws[IMX6SLL_CLK_PLL2_PFD3] = imx_clk_hw_pfd("pll2_pfd3_594m", "pll2_bus", base + 0x100, 3); 176 + hws[IMX6SLL_CLK_PLL3_PFD0] = imx_clk_hw_pfd("pll3_pfd0_720m", "pll3_usb_otg", base + 0xf0, 0); 177 + hws[IMX6SLL_CLK_PLL3_PFD1] = imx_clk_hw_pfd("pll3_pfd1_540m", "pll3_usb_otg", base + 0xf0, 1); 178 + hws[IMX6SLL_CLK_PLL3_PFD2] = imx_clk_hw_pfd("pll3_pfd2_508m", "pll3_usb_otg", base + 0xf0, 2); 179 + hws[IMX6SLL_CLK_PLL3_PFD3] = imx_clk_hw_pfd("pll3_pfd3_454m", "pll3_usb_otg", base + 0xf0, 3); 190 180 191 - clks[IMX6SLL_CLK_PLL4_POST_DIV] = clk_register_divider_table(NULL, "pll4_post_div", "pll4_audio", 181 + hws[IMX6SLL_CLK_PLL4_POST_DIV] = clk_hw_register_divider_table(NULL, "pll4_post_div", "pll4_audio", 192 182 CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, base + 0x70, 19, 2, 0, post_div_table, &imx_ccm_lock); 193 - clks[IMX6SLL_CLK_PLL4_AUDIO_DIV] = clk_register_divider(NULL, "pll4_audio_div", "pll4_post_div", 183 + hws[IMX6SLL_CLK_PLL4_AUDIO_DIV] = clk_hw_register_divider(NULL, "pll4_audio_div", "pll4_post_div", 194 184 CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, base + 0x170, 15, 1, 0, &imx_ccm_lock); 195 - clks[IMX6SLL_CLK_PLL5_POST_DIV] = clk_register_divider_table(NULL, "pll5_post_div", "pll5_video", 185 + hws[IMX6SLL_CLK_PLL5_POST_DIV] = clk_hw_register_divider_table(NULL, "pll5_post_div", "pll5_video", 196 186 CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, base + 0xa0, 19, 2, 0, post_div_table, &imx_ccm_lock); 197 - clks[IMX6SLL_CLK_PLL5_VIDEO_DIV] = clk_register_divider_table(NULL, "pll5_video_div", "pll5_post_div", 187 + hws[IMX6SLL_CLK_PLL5_VIDEO_DIV] = clk_hw_register_divider_table(NULL, "pll5_video_div", "pll5_post_div", 198 188 CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, base + 0x170, 30, 2, 0, video_div_table, &imx_ccm_lock); 199 189 200 190 /* name parent_name mult div */ 201 - clks[IMX6SLL_CLK_PLL2_198M] = imx_clk_fixed_factor("pll2_198m", "pll2_pfd2_396m", 1, 2); 202 - clks[IMX6SLL_CLK_PLL3_120M] = imx_clk_fixed_factor("pll3_120m", "pll3_usb_otg", 1, 4); 203 - clks[IMX6SLL_CLK_PLL3_80M] = imx_clk_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6); 204 - clks[IMX6SLL_CLK_PLL3_60M] = imx_clk_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8); 191 + hws[IMX6SLL_CLK_PLL2_198M] = imx_clk_hw_fixed_factor("pll2_198m", "pll2_pfd2_396m", 1, 2); 192 + hws[IMX6SLL_CLK_PLL3_120M] = imx_clk_hw_fixed_factor("pll3_120m", "pll3_usb_otg", 1, 4); 193 + hws[IMX6SLL_CLK_PLL3_80M] = imx_clk_hw_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6); 194 + hws[IMX6SLL_CLK_PLL3_60M] = imx_clk_hw_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8); 205 195 206 196 np = ccm_node; 207 197 base = of_iomap(np, 0); 208 198 WARN_ON(!base); 209 199 210 - clks[IMX6SLL_CLK_STEP] = imx_clk_mux("step", base + 0x0c, 8, 1, step_sels, ARRAY_SIZE(step_sels)); 211 - clks[IMX6SLL_CLK_PLL1_SW] = imx_clk_mux_flags("pll1_sw", base + 0x0c, 2, 1, pll1_sw_sels, ARRAY_SIZE(pll1_sw_sels), 0); 212 - clks[IMX6SLL_CLK_AXI_ALT_SEL] = imx_clk_mux("axi_alt_sel", base + 0x14, 7, 1, axi_alt_sels, ARRAY_SIZE(axi_alt_sels)); 213 - clks[IMX6SLL_CLK_AXI_SEL] = imx_clk_mux_flags("axi_sel", base + 0x14, 6, 1, axi_sels, ARRAY_SIZE(axi_sels), 0); 214 - clks[IMX6SLL_CLK_PERIPH_PRE] = imx_clk_mux("periph_pre", base + 0x18, 18, 2, periph_pre_sels, ARRAY_SIZE(periph_pre_sels)); 215 - clks[IMX6SLL_CLK_PERIPH2_PRE] = imx_clk_mux("periph2_pre", base + 0x18, 21, 2, periph2_pre_sels, ARRAY_SIZE(periph2_pre_sels)); 216 - clks[IMX6SLL_CLK_PERIPH_CLK2_SEL] = imx_clk_mux("periph_clk2_sel", base + 0x18, 12, 2, periph_clk2_sels, ARRAY_SIZE(periph_clk2_sels)); 217 - clks[IMX6SLL_CLK_PERIPH2_CLK2_SEL] = imx_clk_mux("periph2_clk2_sel", base + 0x18, 20, 1, periph2_clk2_sels, ARRAY_SIZE(periph2_clk2_sels)); 218 - clks[IMX6SLL_CLK_USDHC1_SEL] = imx_clk_mux("usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 219 - clks[IMX6SLL_CLK_USDHC2_SEL] = imx_clk_mux("usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 220 - clks[IMX6SLL_CLK_USDHC3_SEL] = imx_clk_mux("usdhc3_sel", base + 0x1c, 18, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 221 - clks[IMX6SLL_CLK_SSI1_SEL] = imx_clk_mux("ssi1_sel", base + 0x1c, 10, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); 222 - clks[IMX6SLL_CLK_SSI2_SEL] = imx_clk_mux("ssi2_sel", base + 0x1c, 12, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); 223 - clks[IMX6SLL_CLK_SSI3_SEL] = imx_clk_mux("ssi3_sel", base + 0x1c, 14, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); 224 - clks[IMX6SLL_CLK_PERCLK_SEL] = imx_clk_mux("perclk_sel", base + 0x1c, 6, 1, perclk_sels, ARRAY_SIZE(perclk_sels)); 225 - clks[IMX6SLL_CLK_UART_SEL] = imx_clk_mux("uart_sel", base + 0x24, 6, 1, uart_sels, ARRAY_SIZE(uart_sels)); 226 - clks[IMX6SLL_CLK_SPDIF_SEL] = imx_clk_mux("spdif_sel", base + 0x30, 20, 2, spdif_sels, ARRAY_SIZE(spdif_sels)); 227 - clks[IMX6SLL_CLK_EXTERN_AUDIO_SEL] = imx_clk_mux("extern_audio_sel", base + 0x30, 7, 2, spdif_sels, ARRAY_SIZE(spdif_sels)); 228 - clks[IMX6SLL_CLK_EPDC_PRE_SEL] = imx_clk_mux("epdc_pre_sel", base + 0x34, 15, 3, epdc_pre_sels, ARRAY_SIZE(epdc_pre_sels)); 229 - clks[IMX6SLL_CLK_EPDC_SEL] = imx_clk_mux("epdc_sel", base + 0x34, 9, 3, epdc_sels, ARRAY_SIZE(epdc_sels)); 230 - clks[IMX6SLL_CLK_ECSPI_SEL] = imx_clk_mux("ecspi_sel", base + 0x38, 18, 1, ecspi_sels, ARRAY_SIZE(ecspi_sels)); 231 - clks[IMX6SLL_CLK_LCDIF_PRE_SEL] = imx_clk_mux("lcdif_pre_sel", base + 0x38, 15, 3, lcdif_pre_sels, ARRAY_SIZE(lcdif_pre_sels)); 232 - clks[IMX6SLL_CLK_LCDIF_SEL] = imx_clk_mux("lcdif_sel", base + 0x38, 9, 3, lcdif_sels, ARRAY_SIZE(lcdif_sels)); 200 + hws[IMX6SLL_CLK_STEP] = imx_clk_hw_mux("step", base + 0x0c, 8, 1, step_sels, ARRAY_SIZE(step_sels)); 201 + hws[IMX6SLL_CLK_PLL1_SW] = imx_clk_hw_mux_flags("pll1_sw", base + 0x0c, 2, 1, pll1_sw_sels, ARRAY_SIZE(pll1_sw_sels), 0); 202 + hws[IMX6SLL_CLK_AXI_ALT_SEL] = imx_clk_hw_mux("axi_alt_sel", base + 0x14, 7, 1, axi_alt_sels, ARRAY_SIZE(axi_alt_sels)); 203 + hws[IMX6SLL_CLK_AXI_SEL] = imx_clk_hw_mux_flags("axi_sel", base + 0x14, 6, 1, axi_sels, ARRAY_SIZE(axi_sels), 0); 204 + hws[IMX6SLL_CLK_PERIPH_PRE] = imx_clk_hw_mux("periph_pre", base + 0x18, 18, 2, periph_pre_sels, ARRAY_SIZE(periph_pre_sels)); 205 + hws[IMX6SLL_CLK_PERIPH2_PRE] = imx_clk_hw_mux("periph2_pre", base + 0x18, 21, 2, periph2_pre_sels, ARRAY_SIZE(periph2_pre_sels)); 206 + hws[IMX6SLL_CLK_PERIPH_CLK2_SEL] = imx_clk_hw_mux("periph_clk2_sel", base + 0x18, 12, 2, periph_clk2_sels, ARRAY_SIZE(periph_clk2_sels)); 207 + hws[IMX6SLL_CLK_PERIPH2_CLK2_SEL] = imx_clk_hw_mux("periph2_clk2_sel", base + 0x18, 20, 1, periph2_clk2_sels, ARRAY_SIZE(periph2_clk2_sels)); 208 + hws[IMX6SLL_CLK_USDHC1_SEL] = imx_clk_hw_mux("usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 209 + hws[IMX6SLL_CLK_USDHC2_SEL] = imx_clk_hw_mux("usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 210 + hws[IMX6SLL_CLK_USDHC3_SEL] = imx_clk_hw_mux("usdhc3_sel", base + 0x1c, 18, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 211 + hws[IMX6SLL_CLK_SSI1_SEL] = imx_clk_hw_mux("ssi1_sel", base + 0x1c, 10, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); 212 + hws[IMX6SLL_CLK_SSI2_SEL] = imx_clk_hw_mux("ssi2_sel", base + 0x1c, 12, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); 213 + hws[IMX6SLL_CLK_SSI3_SEL] = imx_clk_hw_mux("ssi3_sel", base + 0x1c, 14, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); 214 + hws[IMX6SLL_CLK_PERCLK_SEL] = imx_clk_hw_mux("perclk_sel", base + 0x1c, 6, 1, perclk_sels, ARRAY_SIZE(perclk_sels)); 215 + hws[IMX6SLL_CLK_UART_SEL] = imx_clk_hw_mux("uart_sel", base + 0x24, 6, 1, uart_sels, ARRAY_SIZE(uart_sels)); 216 + hws[IMX6SLL_CLK_SPDIF_SEL] = imx_clk_hw_mux("spdif_sel", base + 0x30, 20, 2, spdif_sels, ARRAY_SIZE(spdif_sels)); 217 + hws[IMX6SLL_CLK_EXTERN_AUDIO_SEL] = imx_clk_hw_mux("extern_audio_sel", base + 0x30, 7, 2, spdif_sels, ARRAY_SIZE(spdif_sels)); 218 + hws[IMX6SLL_CLK_EPDC_PRE_SEL] = imx_clk_hw_mux("epdc_pre_sel", base + 0x34, 15, 3, epdc_pre_sels, ARRAY_SIZE(epdc_pre_sels)); 219 + hws[IMX6SLL_CLK_EPDC_SEL] = imx_clk_hw_mux("epdc_sel", base + 0x34, 9, 3, epdc_sels, ARRAY_SIZE(epdc_sels)); 220 + hws[IMX6SLL_CLK_ECSPI_SEL] = imx_clk_hw_mux("ecspi_sel", base + 0x38, 18, 1, ecspi_sels, ARRAY_SIZE(ecspi_sels)); 221 + hws[IMX6SLL_CLK_LCDIF_PRE_SEL] = imx_clk_hw_mux("lcdif_pre_sel", base + 0x38, 15, 3, lcdif_pre_sels, ARRAY_SIZE(lcdif_pre_sels)); 222 + hws[IMX6SLL_CLK_LCDIF_SEL] = imx_clk_hw_mux("lcdif_sel", base + 0x38, 9, 3, lcdif_sels, ARRAY_SIZE(lcdif_sels)); 233 223 234 - clks[IMX6SLL_CLK_PERIPH] = imx_clk_busy_mux("periph", base + 0x14, 25, 1, base + 0x48, 5, periph_sels, ARRAY_SIZE(periph_sels)); 235 - clks[IMX6SLL_CLK_PERIPH2] = imx_clk_busy_mux("periph2", base + 0x14, 26, 1, base + 0x48, 3, periph2_sels, ARRAY_SIZE(periph2_sels)); 224 + hws[IMX6SLL_CLK_PERIPH] = imx_clk_hw_busy_mux("periph", base + 0x14, 25, 1, base + 0x48, 5, periph_sels, ARRAY_SIZE(periph_sels)); 225 + hws[IMX6SLL_CLK_PERIPH2] = imx_clk_hw_busy_mux("periph2", base + 0x14, 26, 1, base + 0x48, 3, periph2_sels, ARRAY_SIZE(periph2_sels)); 236 226 237 - clks[IMX6SLL_CLK_PERIPH_CLK2] = imx_clk_divider("periph_clk2", "periph_clk2_sel", base + 0x14, 27, 3); 238 - clks[IMX6SLL_CLK_PERIPH2_CLK2] = imx_clk_divider("periph2_clk2", "periph2_clk2_sel", base + 0x14, 0, 3); 239 - clks[IMX6SLL_CLK_IPG] = imx_clk_divider("ipg", "ahb", base + 0x14, 8, 2); 240 - clks[IMX6SLL_CLK_LCDIF_PODF] = imx_clk_divider("lcdif_podf", "lcdif_pred", base + 0x18, 23, 3); 241 - clks[IMX6SLL_CLK_PERCLK] = imx_clk_divider("perclk", "perclk_sel", base + 0x1c, 0, 6); 242 - clks[IMX6SLL_CLK_USDHC3_PODF] = imx_clk_divider("usdhc3_podf", "usdhc3_sel", base + 0x24, 19, 3); 243 - clks[IMX6SLL_CLK_USDHC2_PODF] = imx_clk_divider("usdhc2_podf", "usdhc2_sel", base + 0x24, 16, 3); 244 - clks[IMX6SLL_CLK_USDHC1_PODF] = imx_clk_divider("usdhc1_podf", "usdhc1_sel", base + 0x24, 11, 3); 245 - clks[IMX6SLL_CLK_UART_PODF] = imx_clk_divider("uart_podf", "uart_sel", base + 0x24, 0, 6); 246 - clks[IMX6SLL_CLK_SSI3_PRED] = imx_clk_divider("ssi3_pred", "ssi3_sel", base + 0x28, 22, 3); 247 - clks[IMX6SLL_CLK_SSI3_PODF] = imx_clk_divider("ssi3_podf", "ssi3_pred", base + 0x28, 16, 6); 248 - clks[IMX6SLL_CLK_SSI1_PRED] = imx_clk_divider("ssi1_pred", "ssi1_sel", base + 0x28, 6, 3); 249 - clks[IMX6SLL_CLK_SSI1_PODF] = imx_clk_divider("ssi1_podf", "ssi1_pred", base + 0x28, 0, 6); 250 - clks[IMX6SLL_CLK_SSI2_PRED] = imx_clk_divider("ssi2_pred", "ssi2_sel", base + 0x2c, 6, 3); 251 - clks[IMX6SLL_CLK_SSI2_PODF] = imx_clk_divider("ssi2_podf", "ssi2_pred", base + 0x2c, 0, 6); 252 - clks[IMX6SLL_CLK_SPDIF_PRED] = imx_clk_divider("spdif_pred", "spdif_sel", base + 0x30, 25, 3); 253 - clks[IMX6SLL_CLK_SPDIF_PODF] = imx_clk_divider("spdif_podf", "spdif_pred", base + 0x30, 22, 3); 254 - clks[IMX6SLL_CLK_EXTERN_AUDIO_PRED] = imx_clk_divider("extern_audio_pred", "extern_audio_sel", base + 0x30, 12, 3); 255 - clks[IMX6SLL_CLK_EXTERN_AUDIO_PODF] = imx_clk_divider("extern_audio_podf", "extern_audio_pred", base + 0x30, 9, 3); 256 - clks[IMX6SLL_CLK_EPDC_PODF] = imx_clk_divider("epdc_podf", "epdc_pre_sel", base + 0x34, 12, 3); 257 - clks[IMX6SLL_CLK_ECSPI_PODF] = imx_clk_divider("ecspi_podf", "ecspi_sel", base + 0x38, 19, 6); 258 - clks[IMX6SLL_CLK_LCDIF_PRED] = imx_clk_divider("lcdif_pred", "lcdif_pre_sel", base + 0x38, 12, 3); 227 + hws[IMX6SLL_CLK_PERIPH_CLK2] = imx_clk_hw_divider("periph_clk2", "periph_clk2_sel", base + 0x14, 27, 3); 228 + hws[IMX6SLL_CLK_PERIPH2_CLK2] = imx_clk_hw_divider("periph2_clk2", "periph2_clk2_sel", base + 0x14, 0, 3); 229 + hws[IMX6SLL_CLK_IPG] = imx_clk_hw_divider("ipg", "ahb", base + 0x14, 8, 2); 230 + hws[IMX6SLL_CLK_LCDIF_PODF] = imx_clk_hw_divider("lcdif_podf", "lcdif_pred", base + 0x18, 23, 3); 231 + hws[IMX6SLL_CLK_PERCLK] = imx_clk_hw_divider("perclk", "perclk_sel", base + 0x1c, 0, 6); 232 + hws[IMX6SLL_CLK_USDHC3_PODF] = imx_clk_hw_divider("usdhc3_podf", "usdhc3_sel", base + 0x24, 19, 3); 233 + hws[IMX6SLL_CLK_USDHC2_PODF] = imx_clk_hw_divider("usdhc2_podf", "usdhc2_sel", base + 0x24, 16, 3); 234 + hws[IMX6SLL_CLK_USDHC1_PODF] = imx_clk_hw_divider("usdhc1_podf", "usdhc1_sel", base + 0x24, 11, 3); 235 + hws[IMX6SLL_CLK_UART_PODF] = imx_clk_hw_divider("uart_podf", "uart_sel", base + 0x24, 0, 6); 236 + hws[IMX6SLL_CLK_SSI3_PRED] = imx_clk_hw_divider("ssi3_pred", "ssi3_sel", base + 0x28, 22, 3); 237 + hws[IMX6SLL_CLK_SSI3_PODF] = imx_clk_hw_divider("ssi3_podf", "ssi3_pred", base + 0x28, 16, 6); 238 + hws[IMX6SLL_CLK_SSI1_PRED] = imx_clk_hw_divider("ssi1_pred", "ssi1_sel", base + 0x28, 6, 3); 239 + hws[IMX6SLL_CLK_SSI1_PODF] = imx_clk_hw_divider("ssi1_podf", "ssi1_pred", base + 0x28, 0, 6); 240 + hws[IMX6SLL_CLK_SSI2_PRED] = imx_clk_hw_divider("ssi2_pred", "ssi2_sel", base + 0x2c, 6, 3); 241 + hws[IMX6SLL_CLK_SSI2_PODF] = imx_clk_hw_divider("ssi2_podf", "ssi2_pred", base + 0x2c, 0, 6); 242 + hws[IMX6SLL_CLK_SPDIF_PRED] = imx_clk_hw_divider("spdif_pred", "spdif_sel", base + 0x30, 25, 3); 243 + hws[IMX6SLL_CLK_SPDIF_PODF] = imx_clk_hw_divider("spdif_podf", "spdif_pred", base + 0x30, 22, 3); 244 + hws[IMX6SLL_CLK_EXTERN_AUDIO_PRED] = imx_clk_hw_divider("extern_audio_pred", "extern_audio_sel", base + 0x30, 12, 3); 245 + hws[IMX6SLL_CLK_EXTERN_AUDIO_PODF] = imx_clk_hw_divider("extern_audio_podf", "extern_audio_pred", base + 0x30, 9, 3); 246 + hws[IMX6SLL_CLK_EPDC_PODF] = imx_clk_hw_divider("epdc_podf", "epdc_pre_sel", base + 0x34, 12, 3); 247 + hws[IMX6SLL_CLK_ECSPI_PODF] = imx_clk_hw_divider("ecspi_podf", "ecspi_sel", base + 0x38, 19, 6); 248 + hws[IMX6SLL_CLK_LCDIF_PRED] = imx_clk_hw_divider("lcdif_pred", "lcdif_pre_sel", base + 0x38, 12, 3); 259 249 260 - clks[IMX6SLL_CLK_ARM] = imx_clk_busy_divider("arm", "pll1_sw", base + 0x10, 0, 3, base + 0x48, 16); 261 - clks[IMX6SLL_CLK_MMDC_PODF] = imx_clk_busy_divider("mmdc_podf", "periph2", base + 0x14, 3, 3, base + 0x48, 2); 262 - clks[IMX6SLL_CLK_AXI_PODF] = imx_clk_busy_divider("axi", "axi_sel", base + 0x14, 16, 3, base + 0x48, 0); 263 - clks[IMX6SLL_CLK_AHB] = imx_clk_busy_divider("ahb", "periph", base + 0x14, 10, 3, base + 0x48, 1); 250 + hws[IMX6SLL_CLK_ARM] = imx_clk_hw_busy_divider("arm", "pll1_sw", base + 0x10, 0, 3, base + 0x48, 16); 251 + hws[IMX6SLL_CLK_MMDC_PODF] = imx_clk_hw_busy_divider("mmdc_podf", "periph2", base + 0x14, 3, 3, base + 0x48, 2); 252 + hws[IMX6SLL_CLK_AXI_PODF] = imx_clk_hw_busy_divider("axi", "axi_sel", base + 0x14, 16, 3, base + 0x48, 0); 253 + hws[IMX6SLL_CLK_AHB] = imx_clk_hw_busy_divider("ahb", "periph", base + 0x14, 10, 3, base + 0x48, 1); 264 254 265 - clks[IMX6SLL_CLK_LDB_DI0_DIV_3_5] = imx_clk_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7); 266 - clks[IMX6SLL_CLK_LDB_DI0_DIV_7] = imx_clk_fixed_factor("ldb_di0_div_7", "ldb_di0_sel", 1, 7); 267 - clks[IMX6SLL_CLK_LDB_DI1_DIV_3_5] = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1_sel", 2, 7); 268 - clks[IMX6SLL_CLK_LDB_DI1_DIV_7] = imx_clk_fixed_factor("ldb_di1_div_7", "ldb_di1_sel", 1, 7); 255 + hws[IMX6SLL_CLK_LDB_DI0_DIV_3_5] = imx_clk_hw_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7); 256 + hws[IMX6SLL_CLK_LDB_DI0_DIV_7] = imx_clk_hw_fixed_factor("ldb_di0_div_7", "ldb_di0_sel", 1, 7); 257 + hws[IMX6SLL_CLK_LDB_DI1_DIV_3_5] = imx_clk_hw_fixed_factor("ldb_di1_div_3_5", "ldb_di1_sel", 2, 7); 258 + hws[IMX6SLL_CLK_LDB_DI1_DIV_7] = imx_clk_hw_fixed_factor("ldb_di1_div_7", "ldb_di1_sel", 1, 7); 269 259 270 - clks[IMX6SLL_CLK_LDB_DI0_SEL] = imx_clk_mux("ldb_di0_sel", base + 0x2c, 9, 3, ldb_di0_sels, ARRAY_SIZE(ldb_di0_sels)); 271 - clks[IMX6SLL_CLK_LDB_DI1_SEL] = imx_clk_mux("ldb_di1_sel", base + 0x1c, 7, 3, ldb_di1_sels, ARRAY_SIZE(ldb_di1_sels)); 272 - clks[IMX6SLL_CLK_LDB_DI0_DIV_SEL] = imx_clk_mux("ldb_di0_div_sel", base + 0x20, 10, 1, ldb_di0_div_sels, ARRAY_SIZE(ldb_di0_div_sels)); 273 - clks[IMX6SLL_CLK_LDB_DI1_DIV_SEL] = imx_clk_mux("ldb_di1_div_sel", base + 0x20, 10, 1, ldb_di1_div_sels, ARRAY_SIZE(ldb_di1_div_sels)); 260 + hws[IMX6SLL_CLK_LDB_DI0_SEL] = imx_clk_hw_mux("ldb_di0_sel", base + 0x2c, 9, 3, ldb_di0_sels, ARRAY_SIZE(ldb_di0_sels)); 261 + hws[IMX6SLL_CLK_LDB_DI1_SEL] = imx_clk_hw_mux("ldb_di1_sel", base + 0x1c, 7, 3, ldb_di1_sels, ARRAY_SIZE(ldb_di1_sels)); 262 + hws[IMX6SLL_CLK_LDB_DI0_DIV_SEL] = imx_clk_hw_mux("ldb_di0_div_sel", base + 0x20, 10, 1, ldb_di0_div_sels, ARRAY_SIZE(ldb_di0_div_sels)); 263 + hws[IMX6SLL_CLK_LDB_DI1_DIV_SEL] = imx_clk_hw_mux("ldb_di1_div_sel", base + 0x20, 10, 1, ldb_di1_div_sels, ARRAY_SIZE(ldb_di1_div_sels)); 274 264 275 265 /* CCGR0 */ 276 - clks[IMX6SLL_CLK_AIPSTZ1] = imx_clk_gate2_flags("aips_tz1", "ahb", base + 0x68, 0, CLK_IS_CRITICAL); 277 - clks[IMX6SLL_CLK_AIPSTZ2] = imx_clk_gate2_flags("aips_tz2", "ahb", base + 0x68, 2, CLK_IS_CRITICAL); 278 - clks[IMX6SLL_CLK_DCP] = imx_clk_gate2("dcp", "ahb", base + 0x68, 10); 279 - clks[IMX6SLL_CLK_UART2_IPG] = imx_clk_gate2("uart2_ipg", "ipg", base + 0x68, 28); 280 - clks[IMX6SLL_CLK_UART2_SERIAL] = imx_clk_gate2("uart2_serial", "uart_podf", base + 0x68, 28); 281 - clks[IMX6SLL_CLK_GPIO2] = imx_clk_gate2("gpio2", "ipg", base + 0x68, 30); 266 + hws[IMX6SLL_CLK_AIPSTZ1] = imx_clk_hw_gate2_flags("aips_tz1", "ahb", base + 0x68, 0, CLK_IS_CRITICAL); 267 + hws[IMX6SLL_CLK_AIPSTZ2] = imx_clk_hw_gate2_flags("aips_tz2", "ahb", base + 0x68, 2, CLK_IS_CRITICAL); 268 + hws[IMX6SLL_CLK_DCP] = imx_clk_hw_gate2("dcp", "ahb", base + 0x68, 10); 269 + hws[IMX6SLL_CLK_UART2_IPG] = imx_clk_hw_gate2("uart2_ipg", "ipg", base + 0x68, 28); 270 + hws[IMX6SLL_CLK_UART2_SERIAL] = imx_clk_hw_gate2("uart2_serial", "uart_podf", base + 0x68, 28); 271 + hws[IMX6SLL_CLK_GPIO2] = imx_clk_hw_gate2("gpio2", "ipg", base + 0x68, 30); 282 272 283 273 /* CCGR1 */ 284 - clks[IMX6SLL_CLK_ECSPI1] = imx_clk_gate2("ecspi1", "ecspi_podf", base + 0x6c, 0); 285 - clks[IMX6SLL_CLK_ECSPI2] = imx_clk_gate2("ecspi2", "ecspi_podf", base + 0x6c, 2); 286 - clks[IMX6SLL_CLK_ECSPI3] = imx_clk_gate2("ecspi3", "ecspi_podf", base + 0x6c, 4); 287 - clks[IMX6SLL_CLK_ECSPI4] = imx_clk_gate2("ecspi4", "ecspi_podf", base + 0x6c, 6); 288 - clks[IMX6SLL_CLK_UART3_IPG] = imx_clk_gate2("uart3_ipg", "ipg", base + 0x6c, 10); 289 - clks[IMX6SLL_CLK_UART3_SERIAL] = imx_clk_gate2("uart3_serial", "uart_podf", base + 0x6c, 10); 290 - clks[IMX6SLL_CLK_EPIT1] = imx_clk_gate2("epit1", "perclk", base + 0x6c, 12); 291 - clks[IMX6SLL_CLK_EPIT2] = imx_clk_gate2("epit2", "perclk", base + 0x6c, 14); 292 - clks[IMX6SLL_CLK_GPT_BUS] = imx_clk_gate2("gpt1_bus", "perclk", base + 0x6c, 20); 293 - clks[IMX6SLL_CLK_GPT_SERIAL] = imx_clk_gate2("gpt1_serial", "perclk", base + 0x6c, 22); 294 - clks[IMX6SLL_CLK_UART4_IPG] = imx_clk_gate2("uart4_ipg", "ipg", base + 0x6c, 24); 295 - clks[IMX6SLL_CLK_UART4_SERIAL] = imx_clk_gate2("uart4_serial", "uart_podf", base + 0x6c, 24); 296 - clks[IMX6SLL_CLK_GPIO1] = imx_clk_gate2("gpio1", "ipg", base + 0x6c, 26); 297 - clks[IMX6SLL_CLK_GPIO5] = imx_clk_gate2("gpio5", "ipg", base + 0x6c, 30); 274 + hws[IMX6SLL_CLK_ECSPI1] = imx_clk_hw_gate2("ecspi1", "ecspi_podf", base + 0x6c, 0); 275 + hws[IMX6SLL_CLK_ECSPI2] = imx_clk_hw_gate2("ecspi2", "ecspi_podf", base + 0x6c, 2); 276 + hws[IMX6SLL_CLK_ECSPI3] = imx_clk_hw_gate2("ecspi3", "ecspi_podf", base + 0x6c, 4); 277 + hws[IMX6SLL_CLK_ECSPI4] = imx_clk_hw_gate2("ecspi4", "ecspi_podf", base + 0x6c, 6); 278 + hws[IMX6SLL_CLK_UART3_IPG] = imx_clk_hw_gate2("uart3_ipg", "ipg", base + 0x6c, 10); 279 + hws[IMX6SLL_CLK_UART3_SERIAL] = imx_clk_hw_gate2("uart3_serial", "uart_podf", base + 0x6c, 10); 280 + hws[IMX6SLL_CLK_EPIT1] = imx_clk_hw_gate2("epit1", "perclk", base + 0x6c, 12); 281 + hws[IMX6SLL_CLK_EPIT2] = imx_clk_hw_gate2("epit2", "perclk", base + 0x6c, 14); 282 + hws[IMX6SLL_CLK_GPT_BUS] = imx_clk_hw_gate2("gpt1_bus", "perclk", base + 0x6c, 20); 283 + hws[IMX6SLL_CLK_GPT_SERIAL] = imx_clk_hw_gate2("gpt1_serial", "perclk", base + 0x6c, 22); 284 + hws[IMX6SLL_CLK_UART4_IPG] = imx_clk_hw_gate2("uart4_ipg", "ipg", base + 0x6c, 24); 285 + hws[IMX6SLL_CLK_UART4_SERIAL] = imx_clk_hw_gate2("uart4_serial", "uart_podf", base + 0x6c, 24); 286 + hws[IMX6SLL_CLK_GPIO1] = imx_clk_hw_gate2("gpio1", "ipg", base + 0x6c, 26); 287 + hws[IMX6SLL_CLK_GPIO5] = imx_clk_hw_gate2("gpio5", "ipg", base + 0x6c, 30); 298 288 299 289 /* CCGR2 */ 300 - clks[IMX6SLL_CLK_GPIO6] = imx_clk_gate2("gpio6", "ipg", base + 0x70, 0); 301 - clks[IMX6SLL_CLK_CSI] = imx_clk_gate2("csi", "axi", base + 0x70, 2); 302 - clks[IMX6SLL_CLK_I2C1] = imx_clk_gate2("i2c1", "perclk", base + 0x70, 6); 303 - clks[IMX6SLL_CLK_I2C2] = imx_clk_gate2("i2c2", "perclk", base + 0x70, 8); 304 - clks[IMX6SLL_CLK_I2C3] = imx_clk_gate2("i2c3", "perclk", base + 0x70, 10); 305 - clks[IMX6SLL_CLK_OCOTP] = imx_clk_gate2("ocotp", "ipg", base + 0x70, 12); 306 - clks[IMX6SLL_CLK_GPIO3] = imx_clk_gate2("gpio3", "ipg", base + 0x70, 26); 307 - clks[IMX6SLL_CLK_LCDIF_APB] = imx_clk_gate2("lcdif_apb", "axi", base + 0x70, 28); 308 - clks[IMX6SLL_CLK_PXP] = imx_clk_gate2("pxp", "axi", base + 0x70, 30); 290 + hws[IMX6SLL_CLK_GPIO6] = imx_clk_hw_gate2("gpio6", "ipg", base + 0x70, 0); 291 + hws[IMX6SLL_CLK_CSI] = imx_clk_hw_gate2("csi", "axi", base + 0x70, 2); 292 + hws[IMX6SLL_CLK_I2C1] = imx_clk_hw_gate2("i2c1", "perclk", base + 0x70, 6); 293 + hws[IMX6SLL_CLK_I2C2] = imx_clk_hw_gate2("i2c2", "perclk", base + 0x70, 8); 294 + hws[IMX6SLL_CLK_I2C3] = imx_clk_hw_gate2("i2c3", "perclk", base + 0x70, 10); 295 + hws[IMX6SLL_CLK_OCOTP] = imx_clk_hw_gate2("ocotp", "ipg", base + 0x70, 12); 296 + hws[IMX6SLL_CLK_GPIO3] = imx_clk_hw_gate2("gpio3", "ipg", base + 0x70, 26); 297 + hws[IMX6SLL_CLK_LCDIF_APB] = imx_clk_hw_gate2("lcdif_apb", "axi", base + 0x70, 28); 298 + hws[IMX6SLL_CLK_PXP] = imx_clk_hw_gate2("pxp", "axi", base + 0x70, 30); 309 299 310 300 /* CCGR3 */ 311 - clks[IMX6SLL_CLK_UART5_IPG] = imx_clk_gate2("uart5_ipg", "ipg", base + 0x74, 2); 312 - clks[IMX6SLL_CLK_UART5_SERIAL] = imx_clk_gate2("uart5_serial", "uart_podf", base + 0x74, 2); 313 - clks[IMX6SLL_CLK_EPDC_AXI] = imx_clk_gate2("epdc_aclk", "axi", base + 0x74, 4); 314 - clks[IMX6SLL_CLK_EPDC_PIX] = imx_clk_gate2("epdc_pix", "epdc_podf", base + 0x74, 4); 315 - clks[IMX6SLL_CLK_LCDIF_PIX] = imx_clk_gate2("lcdif_pix", "lcdif_podf", base + 0x74, 10); 316 - clks[IMX6SLL_CLK_GPIO4] = imx_clk_gate2("gpio4", "ipg", base + 0x74, 12); 317 - clks[IMX6SLL_CLK_WDOG1] = imx_clk_gate2("wdog1", "ipg", base + 0x74, 16); 318 - clks[IMX6SLL_CLK_MMDC_P0_FAST] = imx_clk_gate_flags("mmdc_p0_fast", "mmdc_podf", base + 0x74, 20, CLK_IS_CRITICAL); 319 - clks[IMX6SLL_CLK_MMDC_P0_IPG] = imx_clk_gate2_flags("mmdc_p0_ipg", "ipg", base + 0x74, 24, CLK_IS_CRITICAL); 320 - clks[IMX6SLL_CLK_MMDC_P1_IPG] = imx_clk_gate2("mmdc_p1_ipg", "ipg", base + 0x74, 26); 321 - clks[IMX6SLL_CLK_OCRAM] = imx_clk_gate_flags("ocram","ahb", base + 0x74, 28, CLK_IS_CRITICAL); 301 + hws[IMX6SLL_CLK_UART5_IPG] = imx_clk_hw_gate2("uart5_ipg", "ipg", base + 0x74, 2); 302 + hws[IMX6SLL_CLK_UART5_SERIAL] = imx_clk_hw_gate2("uart5_serial", "uart_podf", base + 0x74, 2); 303 + hws[IMX6SLL_CLK_EPDC_AXI] = imx_clk_hw_gate2("epdc_aclk", "axi", base + 0x74, 4); 304 + hws[IMX6SLL_CLK_EPDC_PIX] = imx_clk_hw_gate2("epdc_pix", "epdc_podf", base + 0x74, 4); 305 + hws[IMX6SLL_CLK_LCDIF_PIX] = imx_clk_hw_gate2("lcdif_pix", "lcdif_podf", base + 0x74, 10); 306 + hws[IMX6SLL_CLK_GPIO4] = imx_clk_hw_gate2("gpio4", "ipg", base + 0x74, 12); 307 + hws[IMX6SLL_CLK_WDOG1] = imx_clk_hw_gate2("wdog1", "ipg", base + 0x74, 16); 308 + hws[IMX6SLL_CLK_MMDC_P0_FAST] = imx_clk_hw_gate_flags("mmdc_p0_fast", "mmdc_podf", base + 0x74, 20, CLK_IS_CRITICAL); 309 + hws[IMX6SLL_CLK_MMDC_P0_IPG] = imx_clk_hw_gate2_flags("mmdc_p0_ipg", "ipg", base + 0x74, 24, CLK_IS_CRITICAL); 310 + hws[IMX6SLL_CLK_MMDC_P1_IPG] = imx_clk_hw_gate2_flags("mmdc_p1_ipg", "ipg", base + 0x74, 26, CLK_IS_CRITICAL); 311 + hws[IMX6SLL_CLK_OCRAM] = imx_clk_hw_gate_flags("ocram", "ahb", base + 0x74, 28, CLK_IS_CRITICAL); 322 312 323 313 /* CCGR4 */ 324 - clks[IMX6SLL_CLK_PWM1] = imx_clk_gate2("pwm1", "perclk", base + 0x78, 16); 325 - clks[IMX6SLL_CLK_PWM2] = imx_clk_gate2("pwm2", "perclk", base + 0x78, 18); 326 - clks[IMX6SLL_CLK_PWM3] = imx_clk_gate2("pwm3", "perclk", base + 0x78, 20); 327 - clks[IMX6SLL_CLK_PWM4] = imx_clk_gate2("pwm4", "perclk", base + 0x78, 22); 314 + hws[IMX6SLL_CLK_PWM1] = imx_clk_hw_gate2("pwm1", "perclk", base + 0x78, 16); 315 + hws[IMX6SLL_CLK_PWM2] = imx_clk_hw_gate2("pwm2", "perclk", base + 0x78, 18); 316 + hws[IMX6SLL_CLK_PWM3] = imx_clk_hw_gate2("pwm3", "perclk", base + 0x78, 20); 317 + hws[IMX6SLL_CLK_PWM4] = imx_clk_hw_gate2("pwm4", "perclk", base + 0x78, 22); 328 318 329 319 /* CCGR5 */ 330 - clks[IMX6SLL_CLK_ROM] = imx_clk_gate2_flags("rom", "ahb", base + 0x7c, 0, CLK_IS_CRITICAL); 331 - clks[IMX6SLL_CLK_SDMA] = imx_clk_gate2("sdma", "ahb", base + 0x7c, 6); 332 - clks[IMX6SLL_CLK_WDOG2] = imx_clk_gate2("wdog2", "ipg", base + 0x7c, 10); 333 - clks[IMX6SLL_CLK_SPBA] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12); 334 - clks[IMX6SLL_CLK_EXTERN_AUDIO] = imx_clk_gate2_shared("extern_audio", "extern_audio_podf", base + 0x7c, 14, &share_count_audio); 335 - clks[IMX6SLL_CLK_SPDIF] = imx_clk_gate2_shared("spdif", "spdif_podf", base + 0x7c, 14, &share_count_audio); 336 - clks[IMX6SLL_CLK_SPDIF_GCLK] = imx_clk_gate2_shared("spdif_gclk", "ipg", base + 0x7c, 14, &share_count_audio); 337 - clks[IMX6SLL_CLK_SSI1] = imx_clk_gate2_shared("ssi1", "ssi1_podf", base + 0x7c, 18, &share_count_ssi1); 338 - clks[IMX6SLL_CLK_SSI1_IPG] = imx_clk_gate2_shared("ssi1_ipg", "ipg", base + 0x7c, 18, &share_count_ssi1); 339 - clks[IMX6SLL_CLK_SSI2] = imx_clk_gate2_shared("ssi2", "ssi2_podf", base + 0x7c, 20, &share_count_ssi2); 340 - clks[IMX6SLL_CLK_SSI2_IPG] = imx_clk_gate2_shared("ssi2_ipg", "ipg", base + 0x7c, 20, &share_count_ssi2); 341 - clks[IMX6SLL_CLK_SSI3] = imx_clk_gate2_shared("ssi3", "ssi3_podf", base + 0x7c, 22, &share_count_ssi3); 342 - clks[IMX6SLL_CLK_SSI3_IPG] = imx_clk_gate2_shared("ssi3_ipg", "ipg", base + 0x7c, 22, &share_count_ssi3); 343 - clks[IMX6SLL_CLK_UART1_IPG] = imx_clk_gate2("uart1_ipg", "ipg", base + 0x7c, 24); 344 - clks[IMX6SLL_CLK_UART1_SERIAL] = imx_clk_gate2("uart1_serial", "uart_podf", base + 0x7c, 24); 320 + hws[IMX6SLL_CLK_ROM] = imx_clk_hw_gate2_flags("rom", "ahb", base + 0x7c, 0, CLK_IS_CRITICAL); 321 + hws[IMX6SLL_CLK_SDMA] = imx_clk_hw_gate2("sdma", "ahb", base + 0x7c, 6); 322 + hws[IMX6SLL_CLK_WDOG2] = imx_clk_hw_gate2("wdog2", "ipg", base + 0x7c, 10); 323 + hws[IMX6SLL_CLK_SPBA] = imx_clk_hw_gate2("spba", "ipg", base + 0x7c, 12); 324 + hws[IMX6SLL_CLK_EXTERN_AUDIO] = imx_clk_hw_gate2_shared("extern_audio", "extern_audio_podf", base + 0x7c, 14, &share_count_audio); 325 + hws[IMX6SLL_CLK_SPDIF] = imx_clk_hw_gate2_shared("spdif", "spdif_podf", base + 0x7c, 14, &share_count_audio); 326 + hws[IMX6SLL_CLK_SPDIF_GCLK] = imx_clk_hw_gate2_shared("spdif_gclk", "ipg", base + 0x7c, 14, &share_count_audio); 327 + hws[IMX6SLL_CLK_SSI1] = imx_clk_hw_gate2_shared("ssi1", "ssi1_podf", base + 0x7c, 18, &share_count_ssi1); 328 + hws[IMX6SLL_CLK_SSI1_IPG] = imx_clk_hw_gate2_shared("ssi1_ipg", "ipg", base + 0x7c, 18, &share_count_ssi1); 329 + hws[IMX6SLL_CLK_SSI2] = imx_clk_hw_gate2_shared("ssi2", "ssi2_podf", base + 0x7c, 20, &share_count_ssi2); 330 + hws[IMX6SLL_CLK_SSI2_IPG] = imx_clk_hw_gate2_shared("ssi2_ipg", "ipg", base + 0x7c, 20, &share_count_ssi2); 331 + hws[IMX6SLL_CLK_SSI3] = imx_clk_hw_gate2_shared("ssi3", "ssi3_podf", base + 0x7c, 22, &share_count_ssi3); 332 + hws[IMX6SLL_CLK_SSI3_IPG] = imx_clk_hw_gate2_shared("ssi3_ipg", "ipg", base + 0x7c, 22, &share_count_ssi3); 333 + hws[IMX6SLL_CLK_UART1_IPG] = imx_clk_hw_gate2("uart1_ipg", "ipg", base + 0x7c, 24); 334 + hws[IMX6SLL_CLK_UART1_SERIAL] = imx_clk_hw_gate2("uart1_serial", "uart_podf", base + 0x7c, 24); 345 335 346 336 /* CCGR6 */ 347 - clks[IMX6SLL_CLK_USBOH3] = imx_clk_gate2("usboh3", "ipg", base + 0x80, 0); 348 - clks[IMX6SLL_CLK_USDHC1] = imx_clk_gate2("usdhc1", "usdhc1_podf", base + 0x80, 2); 349 - clks[IMX6SLL_CLK_USDHC2] = imx_clk_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4); 350 - clks[IMX6SLL_CLK_USDHC3] = imx_clk_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6); 337 + hws[IMX6SLL_CLK_USBOH3] = imx_clk_hw_gate2("usboh3", "ipg", base + 0x80, 0); 338 + hws[IMX6SLL_CLK_USDHC1] = imx_clk_hw_gate2("usdhc1", "usdhc1_podf", base + 0x80, 2); 339 + hws[IMX6SLL_CLK_USDHC2] = imx_clk_hw_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4); 340 + hws[IMX6SLL_CLK_USDHC3] = imx_clk_hw_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6); 351 341 352 342 /* mask handshake of mmdc */ 353 - writel_relaxed(BM_CCM_CCDR_MMDC_CH0_MASK, base + 0x4); 343 + imx_mmdc_mask_handshake(base, 0); 354 344 355 - imx_check_clocks(clks, ARRAY_SIZE(clks)); 345 + imx_check_clk_hws(hws, IMX6SLL_CLK_END); 356 346 357 - clk_data.clks = clks; 358 - clk_data.clk_num = ARRAY_SIZE(clks); 359 - of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 347 + of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data); 348 + 349 + for (i = 0; i < ARRAY_SIZE(uart_clk_ids); i++) { 350 + int index = uart_clk_ids[i]; 351 + 352 + uart_clks[i] = &hws[index]->clk; 353 + } 360 354 361 355 imx_register_uart_clocks(uart_clks); 362 356 363 357 /* Lower the AHB clock rate before changing the clock source. */ 364 - clk_set_rate(clks[IMX6SLL_CLK_AHB], 99000000); 358 + clk_set_rate(hws[IMX6SLL_CLK_AHB]->clk, 99000000); 365 359 366 360 /* Change periph_pre clock to pll2_bus to adjust AXI rate to 264MHz */ 367 - clk_set_parent(clks[IMX6SLL_CLK_PERIPH_CLK2_SEL], clks[IMX6SLL_CLK_PLL3_USB_OTG]); 368 - clk_set_parent(clks[IMX6SLL_CLK_PERIPH], clks[IMX6SLL_CLK_PERIPH_CLK2]); 369 - clk_set_parent(clks[IMX6SLL_CLK_PERIPH_PRE], clks[IMX6SLL_CLK_PLL2_BUS]); 370 - clk_set_parent(clks[IMX6SLL_CLK_PERIPH], clks[IMX6SLL_CLK_PERIPH_PRE]); 361 + clk_set_parent(hws[IMX6SLL_CLK_PERIPH_CLK2_SEL]->clk, hws[IMX6SLL_CLK_PLL3_USB_OTG]->clk); 362 + clk_set_parent(hws[IMX6SLL_CLK_PERIPH]->clk, hws[IMX6SLL_CLK_PERIPH_CLK2]->clk); 363 + clk_set_parent(hws[IMX6SLL_CLK_PERIPH_PRE]->clk, hws[IMX6SLL_CLK_PLL2_BUS]->clk); 364 + clk_set_parent(hws[IMX6SLL_CLK_PERIPH]->clk, hws[IMX6SLL_CLK_PERIPH_PRE]->clk); 371 365 372 - clk_set_rate(clks[IMX6SLL_CLK_AHB], 132000000); 366 + clk_set_rate(hws[IMX6SLL_CLK_AHB]->clk, 132000000); 373 367 } 374 368 CLK_OF_DECLARE_DRIVER(imx6sll, "fsl,imx6sll-ccm", imx6sll_clocks_init);
+330 -320
drivers/clk/imx/clk-imx6sx.c
··· 6 6 #include <dt-bindings/clock/imx6sx-clock.h> 7 7 #include <linux/clk.h> 8 8 #include <linux/clkdev.h> 9 + #include <linux/clk-provider.h> 9 10 #include <linux/err.h> 10 11 #include <linux/init.h> 11 12 #include <linux/io.h> ··· 16 15 #include <linux/types.h> 17 16 18 17 #include "clk.h" 19 - 20 - #define CCDR 0x4 21 - #define BM_CCM_CCDR_MMDC_CH0_MASK (0x2 << 16) 22 18 23 19 static const char *step_sels[] = { "osc", "pll2_pfd2_396m", }; 24 20 static const char *pll1_sw_sels[] = { "pll1_sys", "step", }; ··· 81 83 static const char *pll6_bypass_sels[] = { "pll6", "pll6_bypass_src", }; 82 84 static const char *pll7_bypass_sels[] = { "pll7", "pll7_bypass_src", }; 83 85 84 - static struct clk *clks[IMX6SX_CLK_CLK_END]; 85 - static struct clk_onecell_data clk_data; 86 + static struct clk_hw **hws; 87 + static struct clk_hw_onecell_data *clk_hw_data; 86 88 87 89 static const struct clk_div_table clk_enet_ref_table[] = { 88 90 { .val = 0, .div = 20, }, ··· 116 118 static u32 share_count_sai1; 117 119 static u32 share_count_sai2; 118 120 119 - static struct clk ** const uart_clks[] __initconst = { 120 - &clks[IMX6SX_CLK_UART_IPG], 121 - &clks[IMX6SX_CLK_UART_SERIAL], 122 - NULL 121 + static const int uart_clk_ids[] __initconst = { 122 + IMX6SX_CLK_UART_IPG, 123 + IMX6SX_CLK_UART_SERIAL, 123 124 }; 125 + 126 + static struct clk **uart_clks[ARRAY_SIZE(uart_clk_ids) + 1] __initdata; 124 127 125 128 static void __init imx6sx_clocks_init(struct device_node *ccm_node) 126 129 { 127 130 struct device_node *np; 128 131 void __iomem *base; 132 + int i; 129 133 130 - clks[IMX6SX_CLK_DUMMY] = imx_clk_fixed("dummy", 0); 134 + clk_hw_data = kzalloc(struct_size(clk_hw_data, hws, 135 + IMX6SX_CLK_CLK_END), GFP_KERNEL); 136 + if (WARN_ON(!clk_hw_data)) 137 + return; 131 138 132 - clks[IMX6SX_CLK_CKIL] = of_clk_get_by_name(ccm_node, "ckil"); 133 - clks[IMX6SX_CLK_OSC] = of_clk_get_by_name(ccm_node, "osc"); 139 + clk_hw_data->num = IMX6SX_CLK_CLK_END; 140 + hws = clk_hw_data->hws; 141 + 142 + hws[IMX6SX_CLK_DUMMY] = imx_clk_hw_fixed("dummy", 0); 143 + 144 + hws[IMX6SX_CLK_CKIL] = __clk_get_hw(of_clk_get_by_name(ccm_node, "ckil")); 145 + hws[IMX6SX_CLK_OSC] = __clk_get_hw(of_clk_get_by_name(ccm_node, "osc")); 134 146 135 147 /* ipp_di clock is external input */ 136 - clks[IMX6SX_CLK_IPP_DI0] = of_clk_get_by_name(ccm_node, "ipp_di0"); 137 - clks[IMX6SX_CLK_IPP_DI1] = of_clk_get_by_name(ccm_node, "ipp_di1"); 148 + hws[IMX6SX_CLK_IPP_DI0] = __clk_get_hw(of_clk_get_by_name(ccm_node, "ipp_di0")); 149 + hws[IMX6SX_CLK_IPP_DI1] = __clk_get_hw(of_clk_get_by_name(ccm_node, "ipp_di1")); 138 150 139 151 /* Clock source from external clock via CLK1/2 PAD */ 140 - clks[IMX6SX_CLK_ANACLK1] = of_clk_get_by_name(ccm_node, "anaclk1"); 141 - clks[IMX6SX_CLK_ANACLK2] = of_clk_get_by_name(ccm_node, "anaclk2"); 152 + hws[IMX6SX_CLK_ANACLK1] = __clk_get_hw(of_clk_get_by_name(ccm_node, "anaclk1")); 153 + hws[IMX6SX_CLK_ANACLK2] = __clk_get_hw(of_clk_get_by_name(ccm_node, "anaclk2")); 142 154 143 155 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sx-anatop"); 144 156 base = of_iomap(np, 0); 145 157 WARN_ON(!base); 146 158 of_node_put(np); 147 159 148 - clks[IMX6SX_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", base + 0x00, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 149 - clks[IMX6SX_PLL2_BYPASS_SRC] = imx_clk_mux("pll2_bypass_src", base + 0x30, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 150 - clks[IMX6SX_PLL3_BYPASS_SRC] = imx_clk_mux("pll3_bypass_src", base + 0x10, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 151 - clks[IMX6SX_PLL4_BYPASS_SRC] = imx_clk_mux("pll4_bypass_src", base + 0x70, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 152 - clks[IMX6SX_PLL5_BYPASS_SRC] = imx_clk_mux("pll5_bypass_src", base + 0xa0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 153 - clks[IMX6SX_PLL6_BYPASS_SRC] = imx_clk_mux("pll6_bypass_src", base + 0xe0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 154 - clks[IMX6SX_PLL7_BYPASS_SRC] = imx_clk_mux("pll7_bypass_src", base + 0x20, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 160 + hws[IMX6SX_PLL1_BYPASS_SRC] = imx_clk_hw_mux("pll1_bypass_src", base + 0x00, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 161 + hws[IMX6SX_PLL2_BYPASS_SRC] = imx_clk_hw_mux("pll2_bypass_src", base + 0x30, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 162 + hws[IMX6SX_PLL3_BYPASS_SRC] = imx_clk_hw_mux("pll3_bypass_src", base + 0x10, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 163 + hws[IMX6SX_PLL4_BYPASS_SRC] = imx_clk_hw_mux("pll4_bypass_src", base + 0x70, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 164 + hws[IMX6SX_PLL5_BYPASS_SRC] = imx_clk_hw_mux("pll5_bypass_src", base + 0xa0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 165 + hws[IMX6SX_PLL6_BYPASS_SRC] = imx_clk_hw_mux("pll6_bypass_src", base + 0xe0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 166 + hws[IMX6SX_PLL7_BYPASS_SRC] = imx_clk_hw_mux("pll7_bypass_src", base + 0x20, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 155 167 156 168 /* type name parent_name base div_mask */ 157 - clks[IMX6SX_CLK_PLL1] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1", "osc", base + 0x00, 0x7f); 158 - clks[IMX6SX_CLK_PLL2] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2", "osc", base + 0x30, 0x1); 159 - clks[IMX6SX_CLK_PLL3] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3", "osc", base + 0x10, 0x3); 160 - clks[IMX6SX_CLK_PLL4] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4", "osc", base + 0x70, 0x7f); 161 - clks[IMX6SX_CLK_PLL5] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5", "osc", base + 0xa0, 0x7f); 162 - clks[IMX6SX_CLK_PLL6] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll6", "osc", base + 0xe0, 0x3); 163 - clks[IMX6SX_CLK_PLL7] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7", "osc", base + 0x20, 0x3); 169 + hws[IMX6SX_CLK_PLL1] = imx_clk_hw_pllv3(IMX_PLLV3_SYS, "pll1", "osc", base + 0x00, 0x7f); 170 + hws[IMX6SX_CLK_PLL2] = imx_clk_hw_pllv3(IMX_PLLV3_GENERIC, "pll2", "osc", base + 0x30, 0x1); 171 + hws[IMX6SX_CLK_PLL3] = imx_clk_hw_pllv3(IMX_PLLV3_USB, "pll3", "osc", base + 0x10, 0x3); 172 + hws[IMX6SX_CLK_PLL4] = imx_clk_hw_pllv3(IMX_PLLV3_AV, "pll4", "osc", base + 0x70, 0x7f); 173 + hws[IMX6SX_CLK_PLL5] = imx_clk_hw_pllv3(IMX_PLLV3_AV, "pll5", "osc", base + 0xa0, 0x7f); 174 + hws[IMX6SX_CLK_PLL6] = imx_clk_hw_pllv3(IMX_PLLV3_ENET, "pll6", "osc", base + 0xe0, 0x3); 175 + hws[IMX6SX_CLK_PLL7] = imx_clk_hw_pllv3(IMX_PLLV3_USB, "pll7", "osc", base + 0x20, 0x3); 164 176 165 - clks[IMX6SX_PLL1_BYPASS] = imx_clk_mux_flags("pll1_bypass", base + 0x00, 16, 1, pll1_bypass_sels, ARRAY_SIZE(pll1_bypass_sels), CLK_SET_RATE_PARENT); 166 - clks[IMX6SX_PLL2_BYPASS] = imx_clk_mux_flags("pll2_bypass", base + 0x30, 16, 1, pll2_bypass_sels, ARRAY_SIZE(pll2_bypass_sels), CLK_SET_RATE_PARENT); 167 - clks[IMX6SX_PLL3_BYPASS] = imx_clk_mux_flags("pll3_bypass", base + 0x10, 16, 1, pll3_bypass_sels, ARRAY_SIZE(pll3_bypass_sels), CLK_SET_RATE_PARENT); 168 - clks[IMX6SX_PLL4_BYPASS] = imx_clk_mux_flags("pll4_bypass", base + 0x70, 16, 1, pll4_bypass_sels, ARRAY_SIZE(pll4_bypass_sels), CLK_SET_RATE_PARENT); 169 - clks[IMX6SX_PLL5_BYPASS] = imx_clk_mux_flags("pll5_bypass", base + 0xa0, 16, 1, pll5_bypass_sels, ARRAY_SIZE(pll5_bypass_sels), CLK_SET_RATE_PARENT); 170 - clks[IMX6SX_PLL6_BYPASS] = imx_clk_mux_flags("pll6_bypass", base + 0xe0, 16, 1, pll6_bypass_sels, ARRAY_SIZE(pll6_bypass_sels), CLK_SET_RATE_PARENT); 171 - clks[IMX6SX_PLL7_BYPASS] = imx_clk_mux_flags("pll7_bypass", base + 0x20, 16, 1, pll7_bypass_sels, ARRAY_SIZE(pll7_bypass_sels), CLK_SET_RATE_PARENT); 177 + hws[IMX6SX_PLL1_BYPASS] = imx_clk_hw_mux_flags("pll1_bypass", base + 0x00, 16, 1, pll1_bypass_sels, ARRAY_SIZE(pll1_bypass_sels), CLK_SET_RATE_PARENT); 178 + hws[IMX6SX_PLL2_BYPASS] = imx_clk_hw_mux_flags("pll2_bypass", base + 0x30, 16, 1, pll2_bypass_sels, ARRAY_SIZE(pll2_bypass_sels), CLK_SET_RATE_PARENT); 179 + hws[IMX6SX_PLL3_BYPASS] = imx_clk_hw_mux_flags("pll3_bypass", base + 0x10, 16, 1, pll3_bypass_sels, ARRAY_SIZE(pll3_bypass_sels), CLK_SET_RATE_PARENT); 180 + hws[IMX6SX_PLL4_BYPASS] = imx_clk_hw_mux_flags("pll4_bypass", base + 0x70, 16, 1, pll4_bypass_sels, ARRAY_SIZE(pll4_bypass_sels), CLK_SET_RATE_PARENT); 181 + hws[IMX6SX_PLL5_BYPASS] = imx_clk_hw_mux_flags("pll5_bypass", base + 0xa0, 16, 1, pll5_bypass_sels, ARRAY_SIZE(pll5_bypass_sels), CLK_SET_RATE_PARENT); 182 + hws[IMX6SX_PLL6_BYPASS] = imx_clk_hw_mux_flags("pll6_bypass", base + 0xe0, 16, 1, pll6_bypass_sels, ARRAY_SIZE(pll6_bypass_sels), CLK_SET_RATE_PARENT); 183 + hws[IMX6SX_PLL7_BYPASS] = imx_clk_hw_mux_flags("pll7_bypass", base + 0x20, 16, 1, pll7_bypass_sels, ARRAY_SIZE(pll7_bypass_sels), CLK_SET_RATE_PARENT); 172 184 173 185 /* Do not bypass PLLs initially */ 174 - clk_set_parent(clks[IMX6SX_PLL1_BYPASS], clks[IMX6SX_CLK_PLL1]); 175 - clk_set_parent(clks[IMX6SX_PLL2_BYPASS], clks[IMX6SX_CLK_PLL2]); 176 - clk_set_parent(clks[IMX6SX_PLL3_BYPASS], clks[IMX6SX_CLK_PLL3]); 177 - clk_set_parent(clks[IMX6SX_PLL4_BYPASS], clks[IMX6SX_CLK_PLL4]); 178 - clk_set_parent(clks[IMX6SX_PLL5_BYPASS], clks[IMX6SX_CLK_PLL5]); 179 - clk_set_parent(clks[IMX6SX_PLL6_BYPASS], clks[IMX6SX_CLK_PLL6]); 180 - clk_set_parent(clks[IMX6SX_PLL7_BYPASS], clks[IMX6SX_CLK_PLL7]); 186 + clk_set_parent(hws[IMX6SX_PLL1_BYPASS]->clk, hws[IMX6SX_CLK_PLL1]->clk); 187 + clk_set_parent(hws[IMX6SX_PLL2_BYPASS]->clk, hws[IMX6SX_CLK_PLL2]->clk); 188 + clk_set_parent(hws[IMX6SX_PLL3_BYPASS]->clk, hws[IMX6SX_CLK_PLL3]->clk); 189 + clk_set_parent(hws[IMX6SX_PLL4_BYPASS]->clk, hws[IMX6SX_CLK_PLL4]->clk); 190 + clk_set_parent(hws[IMX6SX_PLL5_BYPASS]->clk, hws[IMX6SX_CLK_PLL5]->clk); 191 + clk_set_parent(hws[IMX6SX_PLL6_BYPASS]->clk, hws[IMX6SX_CLK_PLL6]->clk); 192 + clk_set_parent(hws[IMX6SX_PLL7_BYPASS]->clk, hws[IMX6SX_CLK_PLL7]->clk); 181 193 182 - clks[IMX6SX_CLK_PLL1_SYS] = imx_clk_gate("pll1_sys", "pll1_bypass", base + 0x00, 13); 183 - clks[IMX6SX_CLK_PLL2_BUS] = imx_clk_gate("pll2_bus", "pll2_bypass", base + 0x30, 13); 184 - clks[IMX6SX_CLK_PLL3_USB_OTG] = imx_clk_gate("pll3_usb_otg", "pll3_bypass", base + 0x10, 13); 185 - clks[IMX6SX_CLK_PLL4_AUDIO] = imx_clk_gate("pll4_audio", "pll4_bypass", base + 0x70, 13); 186 - clks[IMX6SX_CLK_PLL5_VIDEO] = imx_clk_gate("pll5_video", "pll5_bypass", base + 0xa0, 13); 187 - clks[IMX6SX_CLK_PLL6_ENET] = imx_clk_gate("pll6_enet", "pll6_bypass", base + 0xe0, 13); 188 - clks[IMX6SX_CLK_PLL7_USB_HOST] = imx_clk_gate("pll7_usb_host", "pll7_bypass", base + 0x20, 13); 194 + hws[IMX6SX_CLK_PLL1_SYS] = imx_clk_hw_gate("pll1_sys", "pll1_bypass", base + 0x00, 13); 195 + hws[IMX6SX_CLK_PLL2_BUS] = imx_clk_hw_gate("pll2_bus", "pll2_bypass", base + 0x30, 13); 196 + hws[IMX6SX_CLK_PLL3_USB_OTG] = imx_clk_hw_gate("pll3_usb_otg", "pll3_bypass", base + 0x10, 13); 197 + hws[IMX6SX_CLK_PLL4_AUDIO] = imx_clk_hw_gate("pll4_audio", "pll4_bypass", base + 0x70, 13); 198 + hws[IMX6SX_CLK_PLL5_VIDEO] = imx_clk_hw_gate("pll5_video", "pll5_bypass", base + 0xa0, 13); 199 + hws[IMX6SX_CLK_PLL6_ENET] = imx_clk_hw_gate("pll6_enet", "pll6_bypass", base + 0xe0, 13); 200 + hws[IMX6SX_CLK_PLL7_USB_HOST] = imx_clk_hw_gate("pll7_usb_host", "pll7_bypass", base + 0x20, 13); 189 201 190 202 /* 191 203 * Bit 20 is the reserved and read-only bit, we do this only for: ··· 203 195 * - Keep refcount when do usbphy clk_enable/disable, in that case, 204 196 * the clk framework may need to enable/disable usbphy's parent 205 197 */ 206 - clks[IMX6SX_CLK_USBPHY1] = imx_clk_gate("usbphy1", "pll3_usb_otg", base + 0x10, 20); 207 - clks[IMX6SX_CLK_USBPHY2] = imx_clk_gate("usbphy2", "pll7_usb_host", base + 0x20, 20); 198 + hws[IMX6SX_CLK_USBPHY1] = imx_clk_hw_gate("usbphy1", "pll3_usb_otg", base + 0x10, 20); 199 + hws[IMX6SX_CLK_USBPHY2] = imx_clk_hw_gate("usbphy2", "pll7_usb_host", base + 0x20, 20); 208 200 209 201 /* 210 202 * usbphy*_gate needs to be on after system boots up, and software 211 203 * never needs to control it anymore. 212 204 */ 213 - clks[IMX6SX_CLK_USBPHY1_GATE] = imx_clk_gate("usbphy1_gate", "dummy", base + 0x10, 6); 214 - clks[IMX6SX_CLK_USBPHY2_GATE] = imx_clk_gate("usbphy2_gate", "dummy", base + 0x20, 6); 205 + hws[IMX6SX_CLK_USBPHY1_GATE] = imx_clk_hw_gate("usbphy1_gate", "dummy", base + 0x10, 6); 206 + hws[IMX6SX_CLK_USBPHY2_GATE] = imx_clk_hw_gate("usbphy2_gate", "dummy", base + 0x20, 6); 215 207 216 208 /* FIXME 100MHz is used for pcie ref for all imx6 pcie, excepted imx6q */ 217 - clks[IMX6SX_CLK_PCIE_REF] = imx_clk_fixed_factor("pcie_ref", "pll6_enet", 1, 5); 218 - clks[IMX6SX_CLK_PCIE_REF_125M] = imx_clk_gate("pcie_ref_125m", "pcie_ref", base + 0xe0, 19); 209 + hws[IMX6SX_CLK_PCIE_REF] = imx_clk_hw_fixed_factor("pcie_ref", "pll6_enet", 1, 5); 210 + hws[IMX6SX_CLK_PCIE_REF_125M] = imx_clk_hw_gate("pcie_ref_125m", "pcie_ref", base + 0xe0, 19); 219 211 220 - clks[IMX6SX_CLK_LVDS1_OUT] = imx_clk_gate_exclusive("lvds1_out", "lvds1_sel", base + 0x160, 10, BIT(12)); 221 - clks[IMX6SX_CLK_LVDS2_OUT] = imx_clk_gate_exclusive("lvds2_out", "lvds2_sel", base + 0x160, 11, BIT(13)); 222 - clks[IMX6SX_CLK_LVDS1_IN] = imx_clk_gate_exclusive("lvds1_in", "anaclk1", base + 0x160, 12, BIT(10)); 223 - clks[IMX6SX_CLK_LVDS2_IN] = imx_clk_gate_exclusive("lvds2_in", "anaclk2", base + 0x160, 13, BIT(11)); 212 + hws[IMX6SX_CLK_LVDS1_OUT] = imx_clk_hw_gate_exclusive("lvds1_out", "lvds1_sel", base + 0x160, 10, BIT(12)); 213 + hws[IMX6SX_CLK_LVDS2_OUT] = imx_clk_hw_gate_exclusive("lvds2_out", "lvds2_sel", base + 0x160, 11, BIT(13)); 214 + hws[IMX6SX_CLK_LVDS1_IN] = imx_clk_hw_gate_exclusive("lvds1_in", "anaclk1", base + 0x160, 12, BIT(10)); 215 + hws[IMX6SX_CLK_LVDS2_IN] = imx_clk_hw_gate_exclusive("lvds2_in", "anaclk2", base + 0x160, 13, BIT(11)); 224 216 225 - clks[IMX6SX_CLK_ENET_REF] = clk_register_divider_table(NULL, "enet_ref", "pll6_enet", 0, 217 + hws[IMX6SX_CLK_ENET_REF] = clk_hw_register_divider_table(NULL, "enet_ref", "pll6_enet", 0, 226 218 base + 0xe0, 0, 2, 0, clk_enet_ref_table, 227 219 &imx_ccm_lock); 228 - clks[IMX6SX_CLK_ENET2_REF] = clk_register_divider_table(NULL, "enet2_ref", "pll6_enet", 0, 220 + hws[IMX6SX_CLK_ENET2_REF] = clk_hw_register_divider_table(NULL, "enet2_ref", "pll6_enet", 0, 229 221 base + 0xe0, 2, 2, 0, clk_enet_ref_table, 230 222 &imx_ccm_lock); 231 - clks[IMX6SX_CLK_ENET2_REF_125M] = imx_clk_gate("enet2_ref_125m", "enet2_ref", base + 0xe0, 20); 223 + hws[IMX6SX_CLK_ENET2_REF_125M] = imx_clk_hw_gate("enet2_ref_125m", "enet2_ref", base + 0xe0, 20); 232 224 233 - clks[IMX6SX_CLK_ENET_PTP_REF] = imx_clk_fixed_factor("enet_ptp_ref", "pll6_enet", 1, 20); 234 - clks[IMX6SX_CLK_ENET_PTP] = imx_clk_gate("enet_ptp_25m", "enet_ptp_ref", base + 0xe0, 21); 225 + hws[IMX6SX_CLK_ENET_PTP_REF] = imx_clk_hw_fixed_factor("enet_ptp_ref", "pll6_enet", 1, 20); 226 + hws[IMX6SX_CLK_ENET_PTP] = imx_clk_hw_gate("enet_ptp_25m", "enet_ptp_ref", base + 0xe0, 21); 235 227 236 228 /* name parent_name reg idx */ 237 - clks[IMX6SX_CLK_PLL2_PFD0] = imx_clk_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0); 238 - clks[IMX6SX_CLK_PLL2_PFD1] = imx_clk_pfd("pll2_pfd1_594m", "pll2_bus", base + 0x100, 1); 239 - clks[IMX6SX_CLK_PLL2_PFD2] = imx_clk_pfd("pll2_pfd2_396m", "pll2_bus", base + 0x100, 2); 240 - clks[IMX6SX_CLK_PLL2_PFD3] = imx_clk_pfd("pll2_pfd3_594m", "pll2_bus", base + 0x100, 3); 241 - clks[IMX6SX_CLK_PLL3_PFD0] = imx_clk_pfd("pll3_pfd0_720m", "pll3_usb_otg", base + 0xf0, 0); 242 - clks[IMX6SX_CLK_PLL3_PFD1] = imx_clk_pfd("pll3_pfd1_540m", "pll3_usb_otg", base + 0xf0, 1); 243 - clks[IMX6SX_CLK_PLL3_PFD2] = imx_clk_pfd("pll3_pfd2_508m", "pll3_usb_otg", base + 0xf0, 2); 244 - clks[IMX6SX_CLK_PLL3_PFD3] = imx_clk_pfd("pll3_pfd3_454m", "pll3_usb_otg", base + 0xf0, 3); 229 + hws[IMX6SX_CLK_PLL2_PFD0] = imx_clk_hw_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0); 230 + hws[IMX6SX_CLK_PLL2_PFD1] = imx_clk_hw_pfd("pll2_pfd1_594m", "pll2_bus", base + 0x100, 1); 231 + hws[IMX6SX_CLK_PLL2_PFD2] = imx_clk_hw_pfd("pll2_pfd2_396m", "pll2_bus", base + 0x100, 2); 232 + hws[IMX6SX_CLK_PLL2_PFD3] = imx_clk_hw_pfd("pll2_pfd3_594m", "pll2_bus", base + 0x100, 3); 233 + hws[IMX6SX_CLK_PLL3_PFD0] = imx_clk_hw_pfd("pll3_pfd0_720m", "pll3_usb_otg", base + 0xf0, 0); 234 + hws[IMX6SX_CLK_PLL3_PFD1] = imx_clk_hw_pfd("pll3_pfd1_540m", "pll3_usb_otg", base + 0xf0, 1); 235 + hws[IMX6SX_CLK_PLL3_PFD2] = imx_clk_hw_pfd("pll3_pfd2_508m", "pll3_usb_otg", base + 0xf0, 2); 236 + hws[IMX6SX_CLK_PLL3_PFD3] = imx_clk_hw_pfd("pll3_pfd3_454m", "pll3_usb_otg", base + 0xf0, 3); 245 237 246 238 /* name parent_name mult div */ 247 - clks[IMX6SX_CLK_PLL2_198M] = imx_clk_fixed_factor("pll2_198m", "pll2_pfd2_396m", 1, 2); 248 - clks[IMX6SX_CLK_PLL3_120M] = imx_clk_fixed_factor("pll3_120m", "pll3_usb_otg", 1, 4); 249 - clks[IMX6SX_CLK_PLL3_80M] = imx_clk_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6); 250 - clks[IMX6SX_CLK_PLL3_60M] = imx_clk_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8); 251 - clks[IMX6SX_CLK_TWD] = imx_clk_fixed_factor("twd", "arm", 1, 2); 252 - clks[IMX6SX_CLK_GPT_3M] = imx_clk_fixed_factor("gpt_3m", "osc", 1, 8); 239 + hws[IMX6SX_CLK_PLL2_198M] = imx_clk_hw_fixed_factor("pll2_198m", "pll2_pfd2_396m", 1, 2); 240 + hws[IMX6SX_CLK_PLL3_120M] = imx_clk_hw_fixed_factor("pll3_120m", "pll3_usb_otg", 1, 4); 241 + hws[IMX6SX_CLK_PLL3_80M] = imx_clk_hw_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6); 242 + hws[IMX6SX_CLK_PLL3_60M] = imx_clk_hw_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8); 243 + hws[IMX6SX_CLK_TWD] = imx_clk_hw_fixed_factor("twd", "arm", 1, 2); 244 + hws[IMX6SX_CLK_GPT_3M] = imx_clk_hw_fixed_factor("gpt_3m", "osc", 1, 8); 253 245 254 - clks[IMX6SX_CLK_PLL4_POST_DIV] = clk_register_divider_table(NULL, "pll4_post_div", "pll4_audio", 246 + hws[IMX6SX_CLK_PLL4_POST_DIV] = clk_hw_register_divider_table(NULL, "pll4_post_div", "pll4_audio", 255 247 CLK_SET_RATE_PARENT, base + 0x70, 19, 2, 0, post_div_table, &imx_ccm_lock); 256 - clks[IMX6SX_CLK_PLL4_AUDIO_DIV] = clk_register_divider(NULL, "pll4_audio_div", "pll4_post_div", 248 + hws[IMX6SX_CLK_PLL4_AUDIO_DIV] = clk_hw_register_divider(NULL, "pll4_audio_div", "pll4_post_div", 257 249 CLK_SET_RATE_PARENT, base + 0x170, 15, 1, 0, &imx_ccm_lock); 258 - clks[IMX6SX_CLK_PLL5_POST_DIV] = clk_register_divider_table(NULL, "pll5_post_div", "pll5_video", 250 + hws[IMX6SX_CLK_PLL5_POST_DIV] = clk_hw_register_divider_table(NULL, "pll5_post_div", "pll5_video", 259 251 CLK_SET_RATE_PARENT, base + 0xa0, 19, 2, 0, post_div_table, &imx_ccm_lock); 260 - clks[IMX6SX_CLK_PLL5_VIDEO_DIV] = clk_register_divider_table(NULL, "pll5_video_div", "pll5_post_div", 252 + hws[IMX6SX_CLK_PLL5_VIDEO_DIV] = clk_hw_register_divider_table(NULL, "pll5_video_div", "pll5_post_div", 261 253 CLK_SET_RATE_PARENT, base + 0x170, 30, 2, 0, video_div_table, &imx_ccm_lock); 262 254 263 255 /* name reg shift width parent_names num_parents */ 264 - clks[IMX6SX_CLK_LVDS1_SEL] = imx_clk_mux("lvds1_sel", base + 0x160, 0, 5, lvds_sels, ARRAY_SIZE(lvds_sels)); 265 - clks[IMX6SX_CLK_LVDS2_SEL] = imx_clk_mux("lvds2_sel", base + 0x160, 5, 5, lvds_sels, ARRAY_SIZE(lvds_sels)); 256 + hws[IMX6SX_CLK_LVDS1_SEL] = imx_clk_hw_mux("lvds1_sel", base + 0x160, 0, 5, lvds_sels, ARRAY_SIZE(lvds_sels)); 257 + hws[IMX6SX_CLK_LVDS2_SEL] = imx_clk_hw_mux("lvds2_sel", base + 0x160, 5, 5, lvds_sels, ARRAY_SIZE(lvds_sels)); 266 258 267 259 np = ccm_node; 268 260 base = of_iomap(np, 0); 269 261 WARN_ON(!base); 270 262 271 263 /* name reg shift width parent_names num_parents */ 272 - clks[IMX6SX_CLK_STEP] = imx_clk_mux("step", base + 0xc, 8, 1, step_sels, ARRAY_SIZE(step_sels)); 273 - clks[IMX6SX_CLK_PLL1_SW] = imx_clk_mux("pll1_sw", base + 0xc, 2, 1, pll1_sw_sels, ARRAY_SIZE(pll1_sw_sels)); 274 - clks[IMX6SX_CLK_OCRAM_SEL] = imx_clk_mux("ocram_sel", base + 0x14, 6, 2, ocram_sels, ARRAY_SIZE(ocram_sels)); 275 - clks[IMX6SX_CLK_PERIPH_PRE] = imx_clk_mux("periph_pre", base + 0x18, 18, 2, periph_pre_sels, ARRAY_SIZE(periph_pre_sels)); 276 - clks[IMX6SX_CLK_PERIPH2_PRE] = imx_clk_mux("periph2_pre", base + 0x18, 21, 2, periph2_pre_sels, ARRAY_SIZE(periph2_pre_sels)); 277 - clks[IMX6SX_CLK_PERIPH_CLK2_SEL] = imx_clk_mux("periph_clk2_sel", base + 0x18, 12, 2, periph_clk2_sels, ARRAY_SIZE(periph_clk2_sels)); 278 - clks[IMX6SX_CLK_PERIPH2_CLK2_SEL] = imx_clk_mux("periph2_clk2_sel", base + 0x18, 20, 1, periph2_clk2_sels, ARRAY_SIZE(periph2_clk2_sels)); 279 - clks[IMX6SX_CLK_PCIE_AXI_SEL] = imx_clk_mux("pcie_axi_sel", base + 0x18, 10, 1, pcie_axi_sels, ARRAY_SIZE(pcie_axi_sels)); 280 - clks[IMX6SX_CLK_GPU_AXI_SEL] = imx_clk_mux("gpu_axi_sel", base + 0x18, 8, 2, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels)); 281 - clks[IMX6SX_CLK_GPU_CORE_SEL] = imx_clk_mux("gpu_core_sel", base + 0x18, 4, 2, gpu_core_sels, ARRAY_SIZE(gpu_core_sels)); 282 - clks[IMX6SX_CLK_EIM_SLOW_SEL] = imx_clk_mux("eim_slow_sel", base + 0x1c, 29, 2, eim_slow_sels, ARRAY_SIZE(eim_slow_sels)); 283 - clks[IMX6SX_CLK_USDHC1_SEL] = imx_clk_mux("usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 284 - clks[IMX6SX_CLK_USDHC2_SEL] = imx_clk_mux("usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 285 - clks[IMX6SX_CLK_USDHC3_SEL] = imx_clk_mux("usdhc3_sel", base + 0x1c, 18, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 286 - clks[IMX6SX_CLK_USDHC4_SEL] = imx_clk_mux("usdhc4_sel", base + 0x1c, 19, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 287 - clks[IMX6SX_CLK_SSI3_SEL] = imx_clk_mux("ssi3_sel", base + 0x1c, 14, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); 288 - clks[IMX6SX_CLK_SSI2_SEL] = imx_clk_mux("ssi2_sel", base + 0x1c, 12, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); 289 - clks[IMX6SX_CLK_SSI1_SEL] = imx_clk_mux("ssi1_sel", base + 0x1c, 10, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); 290 - clks[IMX6SX_CLK_QSPI1_SEL] = imx_clk_mux_flags("qspi1_sel", base + 0x1c, 7, 3, qspi1_sels, ARRAY_SIZE(qspi1_sels), CLK_SET_RATE_PARENT); 291 - clks[IMX6SX_CLK_PERCLK_SEL] = imx_clk_mux("perclk_sel", base + 0x1c, 6, 1, perclk_sels, ARRAY_SIZE(perclk_sels)); 292 - clks[IMX6SX_CLK_VID_SEL] = imx_clk_mux("vid_sel", base + 0x20, 21, 3, vid_sels, ARRAY_SIZE(vid_sels)); 293 - clks[IMX6SX_CLK_ESAI_SEL] = imx_clk_mux("esai_sel", base + 0x20, 19, 2, audio_sels, ARRAY_SIZE(audio_sels)); 294 - clks[IMX6SX_CLK_CAN_SEL] = imx_clk_mux("can_sel", base + 0x20, 8, 2, can_sels, ARRAY_SIZE(can_sels)); 295 - clks[IMX6SX_CLK_UART_SEL] = imx_clk_mux("uart_sel", base + 0x24, 6, 1, uart_sels, ARRAY_SIZE(uart_sels)); 296 - clks[IMX6SX_CLK_QSPI2_SEL] = imx_clk_mux_flags("qspi2_sel", base + 0x2c, 15, 3, qspi2_sels, ARRAY_SIZE(qspi2_sels), CLK_SET_RATE_PARENT); 297 - clks[IMX6SX_CLK_SPDIF_SEL] = imx_clk_mux("spdif_sel", base + 0x30, 20, 2, audio_sels, ARRAY_SIZE(audio_sels)); 298 - clks[IMX6SX_CLK_AUDIO_SEL] = imx_clk_mux("audio_sel", base + 0x30, 7, 2, audio_sels, ARRAY_SIZE(audio_sels)); 299 - clks[IMX6SX_CLK_ENET_PRE_SEL] = imx_clk_mux("enet_pre_sel", base + 0x34, 15, 3, enet_pre_sels, ARRAY_SIZE(enet_pre_sels)); 300 - clks[IMX6SX_CLK_ENET_SEL] = imx_clk_mux("enet_sel", base + 0x34, 9, 3, enet_sels, ARRAY_SIZE(enet_sels)); 301 - clks[IMX6SX_CLK_M4_PRE_SEL] = imx_clk_mux("m4_pre_sel", base + 0x34, 6, 3, m4_pre_sels, ARRAY_SIZE(m4_pre_sels)); 302 - clks[IMX6SX_CLK_M4_SEL] = imx_clk_mux("m4_sel", base + 0x34, 0, 3, m4_sels, ARRAY_SIZE(m4_sels)); 303 - clks[IMX6SX_CLK_ECSPI_SEL] = imx_clk_mux("ecspi_sel", base + 0x38, 18, 1, ecspi_sels, ARRAY_SIZE(ecspi_sels)); 304 - clks[IMX6SX_CLK_LCDIF2_PRE_SEL] = imx_clk_mux("lcdif2_pre_sel", base + 0x38, 6, 3, lcdif2_pre_sels, ARRAY_SIZE(lcdif2_pre_sels)); 305 - clks[IMX6SX_CLK_LCDIF2_SEL] = imx_clk_mux("lcdif2_sel", base + 0x38, 0, 3, lcdif2_sels, ARRAY_SIZE(lcdif2_sels)); 306 - clks[IMX6SX_CLK_DISPLAY_SEL] = imx_clk_mux("display_sel", base + 0x3c, 14, 2, display_sels, ARRAY_SIZE(display_sels)); 307 - clks[IMX6SX_CLK_CSI_SEL] = imx_clk_mux("csi_sel", base + 0x3c, 9, 2, csi_sels, ARRAY_SIZE(csi_sels)); 308 - clks[IMX6SX_CLK_CKO1_SEL] = imx_clk_mux("cko1_sel", base + 0x60, 0, 4, cko1_sels, ARRAY_SIZE(cko1_sels)); 309 - clks[IMX6SX_CLK_CKO2_SEL] = imx_clk_mux("cko2_sel", base + 0x60, 16, 5, cko2_sels, ARRAY_SIZE(cko2_sels)); 310 - clks[IMX6SX_CLK_CKO] = imx_clk_mux("cko", base + 0x60, 8, 1, cko_sels, ARRAY_SIZE(cko_sels)); 264 + hws[IMX6SX_CLK_STEP] = imx_clk_hw_mux("step", base + 0xc, 8, 1, step_sels, ARRAY_SIZE(step_sels)); 265 + hws[IMX6SX_CLK_PLL1_SW] = imx_clk_hw_mux("pll1_sw", base + 0xc, 2, 1, pll1_sw_sels, ARRAY_SIZE(pll1_sw_sels)); 266 + hws[IMX6SX_CLK_OCRAM_SEL] = imx_clk_hw_mux("ocram_sel", base + 0x14, 6, 2, ocram_sels, ARRAY_SIZE(ocram_sels)); 267 + hws[IMX6SX_CLK_PERIPH_PRE] = imx_clk_hw_mux("periph_pre", base + 0x18, 18, 2, periph_pre_sels, ARRAY_SIZE(periph_pre_sels)); 268 + hws[IMX6SX_CLK_PERIPH2_PRE] = imx_clk_hw_mux("periph2_pre", base + 0x18, 21, 2, periph2_pre_sels, ARRAY_SIZE(periph2_pre_sels)); 269 + hws[IMX6SX_CLK_PERIPH_CLK2_SEL] = imx_clk_hw_mux("periph_clk2_sel", base + 0x18, 12, 2, periph_clk2_sels, ARRAY_SIZE(periph_clk2_sels)); 270 + hws[IMX6SX_CLK_PERIPH2_CLK2_SEL] = imx_clk_hw_mux("periph2_clk2_sel", base + 0x18, 20, 1, periph2_clk2_sels, ARRAY_SIZE(periph2_clk2_sels)); 271 + hws[IMX6SX_CLK_PCIE_AXI_SEL] = imx_clk_hw_mux("pcie_axi_sel", base + 0x18, 10, 1, pcie_axi_sels, ARRAY_SIZE(pcie_axi_sels)); 272 + hws[IMX6SX_CLK_GPU_AXI_SEL] = imx_clk_hw_mux("gpu_axi_sel", base + 0x18, 8, 2, gpu_axi_sels, ARRAY_SIZE(gpu_axi_sels)); 273 + hws[IMX6SX_CLK_GPU_CORE_SEL] = imx_clk_hw_mux("gpu_core_sel", base + 0x18, 4, 2, gpu_core_sels, ARRAY_SIZE(gpu_core_sels)); 274 + hws[IMX6SX_CLK_EIM_SLOW_SEL] = imx_clk_hw_mux("eim_slow_sel", base + 0x1c, 29, 2, eim_slow_sels, ARRAY_SIZE(eim_slow_sels)); 275 + hws[IMX6SX_CLK_USDHC1_SEL] = imx_clk_hw_mux("usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 276 + hws[IMX6SX_CLK_USDHC2_SEL] = imx_clk_hw_mux("usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 277 + hws[IMX6SX_CLK_USDHC3_SEL] = imx_clk_hw_mux("usdhc3_sel", base + 0x1c, 18, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 278 + hws[IMX6SX_CLK_USDHC4_SEL] = imx_clk_hw_mux("usdhc4_sel", base + 0x1c, 19, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 279 + hws[IMX6SX_CLK_SSI3_SEL] = imx_clk_hw_mux("ssi3_sel", base + 0x1c, 14, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); 280 + hws[IMX6SX_CLK_SSI2_SEL] = imx_clk_hw_mux("ssi2_sel", base + 0x1c, 12, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); 281 + hws[IMX6SX_CLK_SSI1_SEL] = imx_clk_hw_mux("ssi1_sel", base + 0x1c, 10, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); 282 + hws[IMX6SX_CLK_QSPI1_SEL] = imx_clk_hw_mux_flags("qspi1_sel", base + 0x1c, 7, 3, qspi1_sels, ARRAY_SIZE(qspi1_sels), CLK_SET_RATE_PARENT); 283 + hws[IMX6SX_CLK_PERCLK_SEL] = imx_clk_hw_mux("perclk_sel", base + 0x1c, 6, 1, perclk_sels, ARRAY_SIZE(perclk_sels)); 284 + hws[IMX6SX_CLK_VID_SEL] = imx_clk_hw_mux("vid_sel", base + 0x20, 21, 3, vid_sels, ARRAY_SIZE(vid_sels)); 285 + hws[IMX6SX_CLK_ESAI_SEL] = imx_clk_hw_mux("esai_sel", base + 0x20, 19, 2, audio_sels, ARRAY_SIZE(audio_sels)); 286 + hws[IMX6SX_CLK_CAN_SEL] = imx_clk_hw_mux("can_sel", base + 0x20, 8, 2, can_sels, ARRAY_SIZE(can_sels)); 287 + hws[IMX6SX_CLK_UART_SEL] = imx_clk_hw_mux("uart_sel", base + 0x24, 6, 1, uart_sels, ARRAY_SIZE(uart_sels)); 288 + hws[IMX6SX_CLK_QSPI2_SEL] = imx_clk_hw_mux_flags("qspi2_sel", base + 0x2c, 15, 3, qspi2_sels, ARRAY_SIZE(qspi2_sels), CLK_SET_RATE_PARENT); 289 + hws[IMX6SX_CLK_SPDIF_SEL] = imx_clk_hw_mux("spdif_sel", base + 0x30, 20, 2, audio_sels, ARRAY_SIZE(audio_sels)); 290 + hws[IMX6SX_CLK_AUDIO_SEL] = imx_clk_hw_mux("audio_sel", base + 0x30, 7, 2, audio_sels, ARRAY_SIZE(audio_sels)); 291 + hws[IMX6SX_CLK_ENET_PRE_SEL] = imx_clk_hw_mux("enet_pre_sel", base + 0x34, 15, 3, enet_pre_sels, ARRAY_SIZE(enet_pre_sels)); 292 + hws[IMX6SX_CLK_ENET_SEL] = imx_clk_hw_mux("enet_sel", base + 0x34, 9, 3, enet_sels, ARRAY_SIZE(enet_sels)); 293 + hws[IMX6SX_CLK_M4_PRE_SEL] = imx_clk_hw_mux("m4_pre_sel", base + 0x34, 6, 3, m4_pre_sels, ARRAY_SIZE(m4_pre_sels)); 294 + hws[IMX6SX_CLK_M4_SEL] = imx_clk_hw_mux("m4_sel", base + 0x34, 0, 3, m4_sels, ARRAY_SIZE(m4_sels)); 295 + hws[IMX6SX_CLK_ECSPI_SEL] = imx_clk_hw_mux("ecspi_sel", base + 0x38, 18, 1, ecspi_sels, ARRAY_SIZE(ecspi_sels)); 296 + hws[IMX6SX_CLK_LCDIF2_PRE_SEL] = imx_clk_hw_mux("lcdif2_pre_sel", base + 0x38, 6, 3, lcdif2_pre_sels, ARRAY_SIZE(lcdif2_pre_sels)); 297 + hws[IMX6SX_CLK_LCDIF2_SEL] = imx_clk_hw_mux("lcdif2_sel", base + 0x38, 0, 3, lcdif2_sels, ARRAY_SIZE(lcdif2_sels)); 298 + hws[IMX6SX_CLK_DISPLAY_SEL] = imx_clk_hw_mux("display_sel", base + 0x3c, 14, 2, display_sels, ARRAY_SIZE(display_sels)); 299 + hws[IMX6SX_CLK_CSI_SEL] = imx_clk_hw_mux("csi_sel", base + 0x3c, 9, 2, csi_sels, ARRAY_SIZE(csi_sels)); 300 + hws[IMX6SX_CLK_CKO1_SEL] = imx_clk_hw_mux("cko1_sel", base + 0x60, 0, 4, cko1_sels, ARRAY_SIZE(cko1_sels)); 301 + hws[IMX6SX_CLK_CKO2_SEL] = imx_clk_hw_mux("cko2_sel", base + 0x60, 16, 5, cko2_sels, ARRAY_SIZE(cko2_sels)); 302 + hws[IMX6SX_CLK_CKO] = imx_clk_hw_mux("cko", base + 0x60, 8, 1, cko_sels, ARRAY_SIZE(cko_sels)); 311 303 312 - clks[IMX6SX_CLK_LDB_DI1_DIV_SEL] = imx_clk_mux_flags("ldb_di1_div_sel", base + 0x20, 11, 1, ldb_di1_div_sels, ARRAY_SIZE(ldb_di1_div_sels), CLK_SET_RATE_PARENT); 313 - clks[IMX6SX_CLK_LDB_DI0_DIV_SEL] = imx_clk_mux_flags("ldb_di0_div_sel", base + 0x20, 10, 1, ldb_di0_div_sels, ARRAY_SIZE(ldb_di0_div_sels), CLK_SET_RATE_PARENT); 314 - clks[IMX6SX_CLK_LDB_DI1_SEL] = imx_clk_mux_flags("ldb_di1_sel", base + 0x2c, 12, 3, ldb_di1_sels, ARRAY_SIZE(ldb_di1_sels), CLK_SET_RATE_PARENT); 315 - clks[IMX6SX_CLK_LDB_DI0_SEL] = imx_clk_mux_flags("ldb_di0_sel", base + 0x2c, 9, 3, ldb_di0_sels, ARRAY_SIZE(ldb_di0_sels), CLK_SET_RATE_PARENT); 316 - clks[IMX6SX_CLK_LCDIF1_PRE_SEL] = imx_clk_mux_flags("lcdif1_pre_sel", base + 0x38, 15, 3, lcdif1_pre_sels, ARRAY_SIZE(lcdif1_pre_sels), CLK_SET_RATE_PARENT); 317 - clks[IMX6SX_CLK_LCDIF1_SEL] = imx_clk_mux_flags("lcdif1_sel", base + 0x38, 9, 3, lcdif1_sels, ARRAY_SIZE(lcdif1_sels), CLK_SET_RATE_PARENT); 304 + hws[IMX6SX_CLK_LDB_DI1_DIV_SEL] = imx_clk_hw_mux_flags("ldb_di1_div_sel", base + 0x20, 11, 1, ldb_di1_div_sels, ARRAY_SIZE(ldb_di1_div_sels), CLK_SET_RATE_PARENT); 305 + hws[IMX6SX_CLK_LDB_DI0_DIV_SEL] = imx_clk_hw_mux_flags("ldb_di0_div_sel", base + 0x20, 10, 1, ldb_di0_div_sels, ARRAY_SIZE(ldb_di0_div_sels), CLK_SET_RATE_PARENT); 306 + hws[IMX6SX_CLK_LDB_DI1_SEL] = imx_clk_hw_mux_flags("ldb_di1_sel", base + 0x2c, 12, 3, ldb_di1_sels, ARRAY_SIZE(ldb_di1_sels), CLK_SET_RATE_PARENT); 307 + hws[IMX6SX_CLK_LDB_DI0_SEL] = imx_clk_hw_mux_flags("ldb_di0_sel", base + 0x2c, 9, 3, ldb_di0_sels, ARRAY_SIZE(ldb_di0_sels), CLK_SET_RATE_PARENT); 308 + hws[IMX6SX_CLK_LCDIF1_PRE_SEL] = imx_clk_hw_mux_flags("lcdif1_pre_sel", base + 0x38, 15, 3, lcdif1_pre_sels, ARRAY_SIZE(lcdif1_pre_sels), CLK_SET_RATE_PARENT); 309 + hws[IMX6SX_CLK_LCDIF1_SEL] = imx_clk_hw_mux_flags("lcdif1_sel", base + 0x38, 9, 3, lcdif1_sels, ARRAY_SIZE(lcdif1_sels), CLK_SET_RATE_PARENT); 318 310 319 311 /* name parent_name reg shift width */ 320 - clks[IMX6SX_CLK_PERIPH_CLK2] = imx_clk_divider("periph_clk2", "periph_clk2_sel", base + 0x14, 27, 3); 321 - clks[IMX6SX_CLK_PERIPH2_CLK2] = imx_clk_divider("periph2_clk2", "periph2_clk2_sel", base + 0x14, 0, 3); 322 - clks[IMX6SX_CLK_IPG] = imx_clk_divider("ipg", "ahb", base + 0x14, 8, 2); 323 - clks[IMX6SX_CLK_GPU_CORE_PODF] = imx_clk_divider("gpu_core_podf", "gpu_core_sel", base + 0x18, 29, 3); 324 - clks[IMX6SX_CLK_GPU_AXI_PODF] = imx_clk_divider("gpu_axi_podf", "gpu_axi_sel", base + 0x18, 26, 3); 325 - clks[IMX6SX_CLK_LCDIF1_PODF] = imx_clk_divider("lcdif1_podf", "lcdif1_pred", base + 0x18, 23, 3); 326 - clks[IMX6SX_CLK_QSPI1_PODF] = imx_clk_divider("qspi1_podf", "qspi1_sel", base + 0x1c, 26, 3); 327 - clks[IMX6SX_CLK_EIM_SLOW_PODF] = imx_clk_divider("eim_slow_podf", "eim_slow_sel", base + 0x1c, 23, 3); 328 - clks[IMX6SX_CLK_LCDIF2_PODF] = imx_clk_divider("lcdif2_podf", "lcdif2_pred", base + 0x1c, 20, 3); 329 - clks[IMX6SX_CLK_PERCLK] = imx_clk_divider_flags("perclk", "perclk_sel", base + 0x1c, 0, 6, CLK_IS_CRITICAL); 330 - clks[IMX6SX_CLK_VID_PODF] = imx_clk_divider("vid_podf", "vid_sel", base + 0x20, 24, 2); 331 - clks[IMX6SX_CLK_CAN_PODF] = imx_clk_divider("can_podf", "can_sel", base + 0x20, 2, 6); 332 - clks[IMX6SX_CLK_USDHC4_PODF] = imx_clk_divider("usdhc4_podf", "usdhc4_sel", base + 0x24, 22, 3); 333 - clks[IMX6SX_CLK_USDHC3_PODF] = imx_clk_divider("usdhc3_podf", "usdhc3_sel", base + 0x24, 19, 3); 334 - clks[IMX6SX_CLK_USDHC2_PODF] = imx_clk_divider("usdhc2_podf", "usdhc2_sel", base + 0x24, 16, 3); 335 - clks[IMX6SX_CLK_USDHC1_PODF] = imx_clk_divider("usdhc1_podf", "usdhc1_sel", base + 0x24, 11, 3); 336 - clks[IMX6SX_CLK_UART_PODF] = imx_clk_divider("uart_podf", "uart_sel", base + 0x24, 0, 6); 337 - clks[IMX6SX_CLK_ESAI_PRED] = imx_clk_divider("esai_pred", "esai_sel", base + 0x28, 9, 3); 338 - clks[IMX6SX_CLK_ESAI_PODF] = imx_clk_divider("esai_podf", "esai_pred", base + 0x28, 25, 3); 339 - clks[IMX6SX_CLK_SSI3_PRED] = imx_clk_divider("ssi3_pred", "ssi3_sel", base + 0x28, 22, 3); 340 - clks[IMX6SX_CLK_SSI3_PODF] = imx_clk_divider("ssi3_podf", "ssi3_pred", base + 0x28, 16, 6); 341 - clks[IMX6SX_CLK_SSI1_PRED] = imx_clk_divider("ssi1_pred", "ssi1_sel", base + 0x28, 6, 3); 342 - clks[IMX6SX_CLK_SSI1_PODF] = imx_clk_divider("ssi1_podf", "ssi1_pred", base + 0x28, 0, 6); 343 - clks[IMX6SX_CLK_QSPI2_PRED] = imx_clk_divider("qspi2_pred", "qspi2_sel", base + 0x2c, 18, 3); 344 - clks[IMX6SX_CLK_QSPI2_PODF] = imx_clk_divider("qspi2_podf", "qspi2_pred", base + 0x2c, 21, 6); 345 - clks[IMX6SX_CLK_SSI2_PRED] = imx_clk_divider("ssi2_pred", "ssi2_sel", base + 0x2c, 6, 3); 346 - clks[IMX6SX_CLK_SSI2_PODF] = imx_clk_divider("ssi2_podf", "ssi2_pred", base + 0x2c, 0, 6); 347 - clks[IMX6SX_CLK_SPDIF_PRED] = imx_clk_divider("spdif_pred", "spdif_sel", base + 0x30, 25, 3); 348 - clks[IMX6SX_CLK_SPDIF_PODF] = imx_clk_divider("spdif_podf", "spdif_pred", base + 0x30, 22, 3); 349 - clks[IMX6SX_CLK_AUDIO_PRED] = imx_clk_divider("audio_pred", "audio_sel", base + 0x30, 12, 3); 350 - clks[IMX6SX_CLK_AUDIO_PODF] = imx_clk_divider("audio_podf", "audio_pred", base + 0x30, 9, 3); 351 - clks[IMX6SX_CLK_ENET_PODF] = imx_clk_divider("enet_podf", "enet_pre_sel", base + 0x34, 12, 3); 352 - clks[IMX6SX_CLK_M4_PODF] = imx_clk_divider("m4_podf", "m4_sel", base + 0x34, 3, 3); 353 - clks[IMX6SX_CLK_ECSPI_PODF] = imx_clk_divider("ecspi_podf", "ecspi_sel", base + 0x38, 19, 6); 354 - clks[IMX6SX_CLK_LCDIF1_PRED] = imx_clk_divider("lcdif1_pred", "lcdif1_pre_sel", base + 0x38, 12, 3); 355 - clks[IMX6SX_CLK_LCDIF2_PRED] = imx_clk_divider("lcdif2_pred", "lcdif2_pre_sel", base + 0x38, 3, 3); 356 - clks[IMX6SX_CLK_DISPLAY_PODF] = imx_clk_divider("display_podf", "display_sel", base + 0x3c, 16, 3); 357 - clks[IMX6SX_CLK_CSI_PODF] = imx_clk_divider("csi_podf", "csi_sel", base + 0x3c, 11, 3); 358 - clks[IMX6SX_CLK_CKO1_PODF] = imx_clk_divider("cko1_podf", "cko1_sel", base + 0x60, 4, 3); 359 - clks[IMX6SX_CLK_CKO2_PODF] = imx_clk_divider("cko2_podf", "cko2_sel", base + 0x60, 21, 3); 312 + hws[IMX6SX_CLK_PERIPH_CLK2] = imx_clk_hw_divider("periph_clk2", "periph_clk2_sel", base + 0x14, 27, 3); 313 + hws[IMX6SX_CLK_PERIPH2_CLK2] = imx_clk_hw_divider("periph2_clk2", "periph2_clk2_sel", base + 0x14, 0, 3); 314 + hws[IMX6SX_CLK_IPG] = imx_clk_hw_divider("ipg", "ahb", base + 0x14, 8, 2); 315 + hws[IMX6SX_CLK_GPU_CORE_PODF] = imx_clk_hw_divider("gpu_core_podf", "gpu_core_sel", base + 0x18, 29, 3); 316 + hws[IMX6SX_CLK_GPU_AXI_PODF] = imx_clk_hw_divider("gpu_axi_podf", "gpu_axi_sel", base + 0x18, 26, 3); 317 + hws[IMX6SX_CLK_LCDIF1_PODF] = imx_clk_hw_divider("lcdif1_podf", "lcdif1_pred", base + 0x18, 23, 3); 318 + hws[IMX6SX_CLK_QSPI1_PODF] = imx_clk_hw_divider("qspi1_podf", "qspi1_sel", base + 0x1c, 26, 3); 319 + hws[IMX6SX_CLK_EIM_SLOW_PODF] = imx_clk_hw_divider("eim_slow_podf", "eim_slow_sel", base + 0x1c, 23, 3); 320 + hws[IMX6SX_CLK_LCDIF2_PODF] = imx_clk_hw_divider("lcdif2_podf", "lcdif2_pred", base + 0x1c, 20, 3); 321 + hws[IMX6SX_CLK_PERCLK] = imx_clk_hw_divider_flags("perclk", "perclk_sel", base + 0x1c, 0, 6, CLK_IS_CRITICAL); 322 + hws[IMX6SX_CLK_VID_PODF] = imx_clk_hw_divider("vid_podf", "vid_sel", base + 0x20, 24, 2); 323 + hws[IMX6SX_CLK_CAN_PODF] = imx_clk_hw_divider("can_podf", "can_sel", base + 0x20, 2, 6); 324 + hws[IMX6SX_CLK_USDHC4_PODF] = imx_clk_hw_divider("usdhc4_podf", "usdhc4_sel", base + 0x24, 22, 3); 325 + hws[IMX6SX_CLK_USDHC3_PODF] = imx_clk_hw_divider("usdhc3_podf", "usdhc3_sel", base + 0x24, 19, 3); 326 + hws[IMX6SX_CLK_USDHC2_PODF] = imx_clk_hw_divider("usdhc2_podf", "usdhc2_sel", base + 0x24, 16, 3); 327 + hws[IMX6SX_CLK_USDHC1_PODF] = imx_clk_hw_divider("usdhc1_podf", "usdhc1_sel", base + 0x24, 11, 3); 328 + hws[IMX6SX_CLK_UART_PODF] = imx_clk_hw_divider("uart_podf", "uart_sel", base + 0x24, 0, 6); 329 + hws[IMX6SX_CLK_ESAI_PRED] = imx_clk_hw_divider("esai_pred", "esai_sel", base + 0x28, 9, 3); 330 + hws[IMX6SX_CLK_ESAI_PODF] = imx_clk_hw_divider("esai_podf", "esai_pred", base + 0x28, 25, 3); 331 + hws[IMX6SX_CLK_SSI3_PRED] = imx_clk_hw_divider("ssi3_pred", "ssi3_sel", base + 0x28, 22, 3); 332 + hws[IMX6SX_CLK_SSI3_PODF] = imx_clk_hw_divider("ssi3_podf", "ssi3_pred", base + 0x28, 16, 6); 333 + hws[IMX6SX_CLK_SSI1_PRED] = imx_clk_hw_divider("ssi1_pred", "ssi1_sel", base + 0x28, 6, 3); 334 + hws[IMX6SX_CLK_SSI1_PODF] = imx_clk_hw_divider("ssi1_podf", "ssi1_pred", base + 0x28, 0, 6); 335 + hws[IMX6SX_CLK_QSPI2_PRED] = imx_clk_hw_divider("qspi2_pred", "qspi2_sel", base + 0x2c, 18, 3); 336 + hws[IMX6SX_CLK_QSPI2_PODF] = imx_clk_hw_divider("qspi2_podf", "qspi2_pred", base + 0x2c, 21, 6); 337 + hws[IMX6SX_CLK_SSI2_PRED] = imx_clk_hw_divider("ssi2_pred", "ssi2_sel", base + 0x2c, 6, 3); 338 + hws[IMX6SX_CLK_SSI2_PODF] = imx_clk_hw_divider("ssi2_podf", "ssi2_pred", base + 0x2c, 0, 6); 339 + hws[IMX6SX_CLK_SPDIF_PRED] = imx_clk_hw_divider("spdif_pred", "spdif_sel", base + 0x30, 25, 3); 340 + hws[IMX6SX_CLK_SPDIF_PODF] = imx_clk_hw_divider("spdif_podf", "spdif_pred", base + 0x30, 22, 3); 341 + hws[IMX6SX_CLK_AUDIO_PRED] = imx_clk_hw_divider("audio_pred", "audio_sel", base + 0x30, 12, 3); 342 + hws[IMX6SX_CLK_AUDIO_PODF] = imx_clk_hw_divider("audio_podf", "audio_pred", base + 0x30, 9, 3); 343 + hws[IMX6SX_CLK_ENET_PODF] = imx_clk_hw_divider("enet_podf", "enet_pre_sel", base + 0x34, 12, 3); 344 + hws[IMX6SX_CLK_M4_PODF] = imx_clk_hw_divider("m4_podf", "m4_sel", base + 0x34, 3, 3); 345 + hws[IMX6SX_CLK_ECSPI_PODF] = imx_clk_hw_divider("ecspi_podf", "ecspi_sel", base + 0x38, 19, 6); 346 + hws[IMX6SX_CLK_LCDIF1_PRED] = imx_clk_hw_divider("lcdif1_pred", "lcdif1_pre_sel", base + 0x38, 12, 3); 347 + hws[IMX6SX_CLK_LCDIF2_PRED] = imx_clk_hw_divider("lcdif2_pred", "lcdif2_pre_sel", base + 0x38, 3, 3); 348 + hws[IMX6SX_CLK_DISPLAY_PODF] = imx_clk_hw_divider("display_podf", "display_sel", base + 0x3c, 16, 3); 349 + hws[IMX6SX_CLK_CSI_PODF] = imx_clk_hw_divider("csi_podf", "csi_sel", base + 0x3c, 11, 3); 350 + hws[IMX6SX_CLK_CKO1_PODF] = imx_clk_hw_divider("cko1_podf", "cko1_sel", base + 0x60, 4, 3); 351 + hws[IMX6SX_CLK_CKO2_PODF] = imx_clk_hw_divider("cko2_podf", "cko2_sel", base + 0x60, 21, 3); 360 352 361 - clks[IMX6SX_CLK_LDB_DI0_DIV_3_5] = imx_clk_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7); 362 - clks[IMX6SX_CLK_LDB_DI0_DIV_7] = imx_clk_fixed_factor("ldb_di0_div_7", "ldb_di0_sel", 1, 7); 363 - clks[IMX6SX_CLK_LDB_DI1_DIV_3_5] = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1_sel", 2, 7); 364 - clks[IMX6SX_CLK_LDB_DI1_DIV_7] = imx_clk_fixed_factor("ldb_di1_div_7", "ldb_di1_sel", 1, 7); 353 + hws[IMX6SX_CLK_LDB_DI0_DIV_3_5] = imx_clk_hw_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7); 354 + hws[IMX6SX_CLK_LDB_DI0_DIV_7] = imx_clk_hw_fixed_factor("ldb_di0_div_7", "ldb_di0_sel", 1, 7); 355 + hws[IMX6SX_CLK_LDB_DI1_DIV_3_5] = imx_clk_hw_fixed_factor("ldb_di1_div_3_5", "ldb_di1_sel", 2, 7); 356 + hws[IMX6SX_CLK_LDB_DI1_DIV_7] = imx_clk_hw_fixed_factor("ldb_di1_div_7", "ldb_di1_sel", 1, 7); 365 357 366 358 /* name reg shift width busy: reg, shift parent_names num_parents */ 367 - clks[IMX6SX_CLK_PERIPH] = imx_clk_busy_mux("periph", base + 0x14, 25, 1, base + 0x48, 5, periph_sels, ARRAY_SIZE(periph_sels)); 368 - clks[IMX6SX_CLK_PERIPH2] = imx_clk_busy_mux("periph2", base + 0x14, 26, 1, base + 0x48, 3, periph2_sels, ARRAY_SIZE(periph2_sels)); 359 + hws[IMX6SX_CLK_PERIPH] = imx_clk_hw_busy_mux("periph", base + 0x14, 25, 1, base + 0x48, 5, periph_sels, ARRAY_SIZE(periph_sels)); 360 + hws[IMX6SX_CLK_PERIPH2] = imx_clk_hw_busy_mux("periph2", base + 0x14, 26, 1, base + 0x48, 3, periph2_sels, ARRAY_SIZE(periph2_sels)); 369 361 /* name parent_name reg shift width busy: reg, shift */ 370 - clks[IMX6SX_CLK_OCRAM_PODF] = imx_clk_busy_divider("ocram_podf", "ocram_sel", base + 0x14, 16, 3, base + 0x48, 0); 371 - clks[IMX6SX_CLK_AHB] = imx_clk_busy_divider("ahb", "periph", base + 0x14, 10, 3, base + 0x48, 1); 372 - clks[IMX6SX_CLK_MMDC_PODF] = imx_clk_busy_divider("mmdc_podf", "periph2", base + 0x14, 3, 3, base + 0x48, 2); 373 - clks[IMX6SX_CLK_ARM] = imx_clk_busy_divider("arm", "pll1_sw", base + 0x10, 0, 3, base + 0x48, 16); 362 + hws[IMX6SX_CLK_OCRAM_PODF] = imx_clk_hw_busy_divider("ocram_podf", "ocram_sel", base + 0x14, 16, 3, base + 0x48, 0); 363 + hws[IMX6SX_CLK_AHB] = imx_clk_hw_busy_divider("ahb", "periph", base + 0x14, 10, 3, base + 0x48, 1); 364 + hws[IMX6SX_CLK_MMDC_PODF] = imx_clk_hw_busy_divider("mmdc_podf", "periph2", base + 0x14, 3, 3, base + 0x48, 2); 365 + hws[IMX6SX_CLK_ARM] = imx_clk_hw_busy_divider("arm", "pll1_sw", base + 0x10, 0, 3, base + 0x48, 16); 374 366 375 367 /* name parent_name reg shift */ 376 368 /* CCGR0 */ 377 - clks[IMX6SX_CLK_AIPS_TZ1] = imx_clk_gate2_flags("aips_tz1", "ahb", base + 0x68, 0, CLK_IS_CRITICAL); 378 - clks[IMX6SX_CLK_AIPS_TZ2] = imx_clk_gate2_flags("aips_tz2", "ahb", base + 0x68, 2, CLK_IS_CRITICAL); 379 - clks[IMX6SX_CLK_APBH_DMA] = imx_clk_gate2("apbh_dma", "usdhc3", base + 0x68, 4); 380 - clks[IMX6SX_CLK_ASRC_MEM] = imx_clk_gate2_shared("asrc_mem", "ahb", base + 0x68, 6, &share_count_asrc); 381 - clks[IMX6SX_CLK_ASRC_IPG] = imx_clk_gate2_shared("asrc_ipg", "ahb", base + 0x68, 6, &share_count_asrc); 382 - clks[IMX6SX_CLK_CAAM_MEM] = imx_clk_gate2("caam_mem", "ahb", base + 0x68, 8); 383 - clks[IMX6SX_CLK_CAAM_ACLK] = imx_clk_gate2("caam_aclk", "ahb", base + 0x68, 10); 384 - clks[IMX6SX_CLK_CAAM_IPG] = imx_clk_gate2("caam_ipg", "ipg", base + 0x68, 12); 385 - clks[IMX6SX_CLK_CAN1_IPG] = imx_clk_gate2("can1_ipg", "ipg", base + 0x68, 14); 386 - clks[IMX6SX_CLK_CAN1_SERIAL] = imx_clk_gate2("can1_serial", "can_podf", base + 0x68, 16); 387 - clks[IMX6SX_CLK_CAN2_IPG] = imx_clk_gate2("can2_ipg", "ipg", base + 0x68, 18); 388 - clks[IMX6SX_CLK_CAN2_SERIAL] = imx_clk_gate2("can2_serial", "can_podf", base + 0x68, 20); 389 - clks[IMX6SX_CLK_DCIC1] = imx_clk_gate2("dcic1", "display_podf", base + 0x68, 24); 390 - clks[IMX6SX_CLK_DCIC2] = imx_clk_gate2("dcic2", "display_podf", base + 0x68, 26); 391 - clks[IMX6SX_CLK_AIPS_TZ3] = imx_clk_gate2_flags("aips_tz3", "ahb", base + 0x68, 30, CLK_IS_CRITICAL); 369 + hws[IMX6SX_CLK_AIPS_TZ1] = imx_clk_hw_gate2_flags("aips_tz1", "ahb", base + 0x68, 0, CLK_IS_CRITICAL); 370 + hws[IMX6SX_CLK_AIPS_TZ2] = imx_clk_hw_gate2_flags("aips_tz2", "ahb", base + 0x68, 2, CLK_IS_CRITICAL); 371 + hws[IMX6SX_CLK_APBH_DMA] = imx_clk_hw_gate2("apbh_dma", "usdhc3", base + 0x68, 4); 372 + hws[IMX6SX_CLK_ASRC_MEM] = imx_clk_hw_gate2_shared("asrc_mem", "ahb", base + 0x68, 6, &share_count_asrc); 373 + hws[IMX6SX_CLK_ASRC_IPG] = imx_clk_hw_gate2_shared("asrc_ipg", "ahb", base + 0x68, 6, &share_count_asrc); 374 + hws[IMX6SX_CLK_CAAM_MEM] = imx_clk_hw_gate2("caam_mem", "ahb", base + 0x68, 8); 375 + hws[IMX6SX_CLK_CAAM_ACLK] = imx_clk_hw_gate2("caam_aclk", "ahb", base + 0x68, 10); 376 + hws[IMX6SX_CLK_CAAM_IPG] = imx_clk_hw_gate2("caam_ipg", "ipg", base + 0x68, 12); 377 + hws[IMX6SX_CLK_CAN1_IPG] = imx_clk_hw_gate2("can1_ipg", "ipg", base + 0x68, 14); 378 + hws[IMX6SX_CLK_CAN1_SERIAL] = imx_clk_hw_gate2("can1_serial", "can_podf", base + 0x68, 16); 379 + hws[IMX6SX_CLK_CAN2_IPG] = imx_clk_hw_gate2("can2_ipg", "ipg", base + 0x68, 18); 380 + hws[IMX6SX_CLK_CAN2_SERIAL] = imx_clk_hw_gate2("can2_serial", "can_podf", base + 0x68, 20); 381 + hws[IMX6SX_CLK_DCIC1] = imx_clk_hw_gate2("dcic1", "display_podf", base + 0x68, 24); 382 + hws[IMX6SX_CLK_DCIC2] = imx_clk_hw_gate2("dcic2", "display_podf", base + 0x68, 26); 383 + hws[IMX6SX_CLK_AIPS_TZ3] = imx_clk_hw_gate2_flags("aips_tz3", "ahb", base + 0x68, 30, CLK_IS_CRITICAL); 392 384 393 385 /* CCGR1 */ 394 - clks[IMX6SX_CLK_ECSPI1] = imx_clk_gate2("ecspi1", "ecspi_podf", base + 0x6c, 0); 395 - clks[IMX6SX_CLK_ECSPI2] = imx_clk_gate2("ecspi2", "ecspi_podf", base + 0x6c, 2); 396 - clks[IMX6SX_CLK_ECSPI3] = imx_clk_gate2("ecspi3", "ecspi_podf", base + 0x6c, 4); 397 - clks[IMX6SX_CLK_ECSPI4] = imx_clk_gate2("ecspi4", "ecspi_podf", base + 0x6c, 6); 398 - clks[IMX6SX_CLK_ECSPI5] = imx_clk_gate2("ecspi5", "ecspi_podf", base + 0x6c, 8); 399 - clks[IMX6SX_CLK_EPIT1] = imx_clk_gate2("epit1", "perclk", base + 0x6c, 12); 400 - clks[IMX6SX_CLK_EPIT2] = imx_clk_gate2("epit2", "perclk", base + 0x6c, 14); 401 - clks[IMX6SX_CLK_ESAI_EXTAL] = imx_clk_gate2_shared("esai_extal", "esai_podf", base + 0x6c, 16, &share_count_esai); 402 - clks[IMX6SX_CLK_ESAI_IPG] = imx_clk_gate2_shared("esai_ipg", "ahb", base + 0x6c, 16, &share_count_esai); 403 - clks[IMX6SX_CLK_ESAI_MEM] = imx_clk_gate2_shared("esai_mem", "ahb", base + 0x6c, 16, &share_count_esai); 404 - clks[IMX6SX_CLK_WAKEUP] = imx_clk_gate2_flags("wakeup", "ipg", base + 0x6c, 18, CLK_IS_CRITICAL); 405 - clks[IMX6SX_CLK_GPT_BUS] = imx_clk_gate2("gpt_bus", "perclk", base + 0x6c, 20); 406 - clks[IMX6SX_CLK_GPT_SERIAL] = imx_clk_gate2("gpt_serial", "perclk", base + 0x6c, 22); 407 - clks[IMX6SX_CLK_GPU] = imx_clk_gate2("gpu", "gpu_core_podf", base + 0x6c, 26); 408 - clks[IMX6SX_CLK_OCRAM_S] = imx_clk_gate2("ocram_s", "ahb", base + 0x6c, 28); 409 - clks[IMX6SX_CLK_CANFD] = imx_clk_gate2("canfd", "can_podf", base + 0x6c, 30); 386 + hws[IMX6SX_CLK_ECSPI1] = imx_clk_hw_gate2("ecspi1", "ecspi_podf", base + 0x6c, 0); 387 + hws[IMX6SX_CLK_ECSPI2] = imx_clk_hw_gate2("ecspi2", "ecspi_podf", base + 0x6c, 2); 388 + hws[IMX6SX_CLK_ECSPI3] = imx_clk_hw_gate2("ecspi3", "ecspi_podf", base + 0x6c, 4); 389 + hws[IMX6SX_CLK_ECSPI4] = imx_clk_hw_gate2("ecspi4", "ecspi_podf", base + 0x6c, 6); 390 + hws[IMX6SX_CLK_ECSPI5] = imx_clk_hw_gate2("ecspi5", "ecspi_podf", base + 0x6c, 8); 391 + hws[IMX6SX_CLK_EPIT1] = imx_clk_hw_gate2("epit1", "perclk", base + 0x6c, 12); 392 + hws[IMX6SX_CLK_EPIT2] = imx_clk_hw_gate2("epit2", "perclk", base + 0x6c, 14); 393 + hws[IMX6SX_CLK_ESAI_EXTAL] = imx_clk_hw_gate2_shared("esai_extal", "esai_podf", base + 0x6c, 16, &share_count_esai); 394 + hws[IMX6SX_CLK_ESAI_IPG] = imx_clk_hw_gate2_shared("esai_ipg", "ahb", base + 0x6c, 16, &share_count_esai); 395 + hws[IMX6SX_CLK_ESAI_MEM] = imx_clk_hw_gate2_shared("esai_mem", "ahb", base + 0x6c, 16, &share_count_esai); 396 + hws[IMX6SX_CLK_WAKEUP] = imx_clk_hw_gate2_flags("wakeup", "ipg", base + 0x6c, 18, CLK_IS_CRITICAL); 397 + hws[IMX6SX_CLK_GPT_BUS] = imx_clk_hw_gate2("gpt_bus", "perclk", base + 0x6c, 20); 398 + hws[IMX6SX_CLK_GPT_SERIAL] = imx_clk_hw_gate2("gpt_serial", "perclk", base + 0x6c, 22); 399 + hws[IMX6SX_CLK_GPU] = imx_clk_hw_gate2("gpu", "gpu_core_podf", base + 0x6c, 26); 400 + hws[IMX6SX_CLK_OCRAM_S] = imx_clk_hw_gate2("ocram_s", "ahb", base + 0x6c, 28); 401 + hws[IMX6SX_CLK_CANFD] = imx_clk_hw_gate2("canfd", "can_podf", base + 0x6c, 30); 410 402 411 403 /* CCGR2 */ 412 - clks[IMX6SX_CLK_CSI] = imx_clk_gate2("csi", "csi_podf", base + 0x70, 2); 413 - clks[IMX6SX_CLK_I2C1] = imx_clk_gate2("i2c1", "perclk", base + 0x70, 6); 414 - clks[IMX6SX_CLK_I2C2] = imx_clk_gate2("i2c2", "perclk", base + 0x70, 8); 415 - clks[IMX6SX_CLK_I2C3] = imx_clk_gate2("i2c3", "perclk", base + 0x70, 10); 416 - clks[IMX6SX_CLK_OCOTP] = imx_clk_gate2("ocotp", "ipg", base + 0x70, 12); 417 - clks[IMX6SX_CLK_IOMUXC] = imx_clk_gate2("iomuxc", "lcdif1_podf", base + 0x70, 14); 418 - clks[IMX6SX_CLK_IPMUX1] = imx_clk_gate2_flags("ipmux1", "ahb", base + 0x70, 16, CLK_IS_CRITICAL); 419 - clks[IMX6SX_CLK_IPMUX2] = imx_clk_gate2_flags("ipmux2", "ahb", base + 0x70, 18, CLK_IS_CRITICAL); 420 - clks[IMX6SX_CLK_IPMUX3] = imx_clk_gate2_flags("ipmux3", "ahb", base + 0x70, 20, CLK_IS_CRITICAL); 421 - clks[IMX6SX_CLK_TZASC1] = imx_clk_gate2_flags("tzasc1", "mmdc_podf", base + 0x70, 22, CLK_IS_CRITICAL); 422 - clks[IMX6SX_CLK_LCDIF_APB] = imx_clk_gate2("lcdif_apb", "display_podf", base + 0x70, 28); 423 - clks[IMX6SX_CLK_PXP_AXI] = imx_clk_gate2("pxp_axi", "display_podf", base + 0x70, 30); 404 + hws[IMX6SX_CLK_CSI] = imx_clk_hw_gate2("csi", "csi_podf", base + 0x70, 2); 405 + hws[IMX6SX_CLK_I2C1] = imx_clk_hw_gate2("i2c1", "perclk", base + 0x70, 6); 406 + hws[IMX6SX_CLK_I2C2] = imx_clk_hw_gate2("i2c2", "perclk", base + 0x70, 8); 407 + hws[IMX6SX_CLK_I2C3] = imx_clk_hw_gate2("i2c3", "perclk", base + 0x70, 10); 408 + hws[IMX6SX_CLK_OCOTP] = imx_clk_hw_gate2("ocotp", "ipg", base + 0x70, 12); 409 + hws[IMX6SX_CLK_IOMUXC] = imx_clk_hw_gate2("iomuxc", "lcdif1_podf", base + 0x70, 14); 410 + hws[IMX6SX_CLK_IPMUX1] = imx_clk_hw_gate2_flags("ipmux1", "ahb", base + 0x70, 16, CLK_IS_CRITICAL); 411 + hws[IMX6SX_CLK_IPMUX2] = imx_clk_hw_gate2_flags("ipmux2", "ahb", base + 0x70, 18, CLK_IS_CRITICAL); 412 + hws[IMX6SX_CLK_IPMUX3] = imx_clk_hw_gate2_flags("ipmux3", "ahb", base + 0x70, 20, CLK_IS_CRITICAL); 413 + hws[IMX6SX_CLK_TZASC1] = imx_clk_hw_gate2_flags("tzasc1", "mmdc_podf", base + 0x70, 22, CLK_IS_CRITICAL); 414 + hws[IMX6SX_CLK_LCDIF_APB] = imx_clk_hw_gate2("lcdif_apb", "display_podf", base + 0x70, 28); 415 + hws[IMX6SX_CLK_PXP_AXI] = imx_clk_hw_gate2("pxp_axi", "display_podf", base + 0x70, 30); 424 416 425 417 /* CCGR3 */ 426 - clks[IMX6SX_CLK_M4] = imx_clk_gate2("m4", "m4_podf", base + 0x74, 2); 427 - clks[IMX6SX_CLK_ENET] = imx_clk_gate2("enet", "ipg", base + 0x74, 4); 428 - clks[IMX6SX_CLK_ENET_AHB] = imx_clk_gate2("enet_ahb", "enet_sel", base + 0x74, 4); 429 - clks[IMX6SX_CLK_DISPLAY_AXI] = imx_clk_gate2("display_axi", "display_podf", base + 0x74, 6); 430 - clks[IMX6SX_CLK_LCDIF2_PIX] = imx_clk_gate2("lcdif2_pix", "lcdif2_sel", base + 0x74, 8); 431 - clks[IMX6SX_CLK_LCDIF1_PIX] = imx_clk_gate2("lcdif1_pix", "lcdif1_sel", base + 0x74, 10); 432 - clks[IMX6SX_CLK_LDB_DI0] = imx_clk_gate2("ldb_di0", "ldb_di0_div_sel", base + 0x74, 12); 433 - clks[IMX6SX_CLK_QSPI1] = imx_clk_gate2("qspi1", "qspi1_podf", base + 0x74, 14); 434 - clks[IMX6SX_CLK_MLB] = imx_clk_gate2("mlb", "ahb", base + 0x74, 18); 435 - clks[IMX6SX_CLK_MMDC_P0_FAST] = imx_clk_gate2_flags("mmdc_p0_fast", "mmdc_podf", base + 0x74, 20, CLK_IS_CRITICAL); 436 - clks[IMX6SX_CLK_MMDC_P0_IPG] = imx_clk_gate2_flags("mmdc_p0_ipg", "ipg", base + 0x74, 24, CLK_IS_CRITICAL); 437 - clks[IMX6SX_CLK_MMDC_P1_IPG] = imx_clk_gate2("mmdc_p1_ipg", "ipg", base + 0x74, 26); 438 - clks[IMX6SX_CLK_OCRAM] = imx_clk_gate2_flags("ocram", "ocram_podf", base + 0x74, 28, CLK_IS_CRITICAL); 418 + hws[IMX6SX_CLK_M4] = imx_clk_hw_gate2("m4", "m4_podf", base + 0x74, 2); 419 + hws[IMX6SX_CLK_ENET] = imx_clk_hw_gate2("enet", "ipg", base + 0x74, 4); 420 + hws[IMX6SX_CLK_ENET_AHB] = imx_clk_hw_gate2("enet_ahb", "enet_sel", base + 0x74, 4); 421 + hws[IMX6SX_CLK_DISPLAY_AXI] = imx_clk_hw_gate2("display_axi", "display_podf", base + 0x74, 6); 422 + hws[IMX6SX_CLK_LCDIF2_PIX] = imx_clk_hw_gate2("lcdif2_pix", "lcdif2_sel", base + 0x74, 8); 423 + hws[IMX6SX_CLK_LCDIF1_PIX] = imx_clk_hw_gate2("lcdif1_pix", "lcdif1_sel", base + 0x74, 10); 424 + hws[IMX6SX_CLK_LDB_DI0] = imx_clk_hw_gate2("ldb_di0", "ldb_di0_div_sel", base + 0x74, 12); 425 + hws[IMX6SX_CLK_QSPI1] = imx_clk_hw_gate2("qspi1", "qspi1_podf", base + 0x74, 14); 426 + hws[IMX6SX_CLK_MLB] = imx_clk_hw_gate2("mlb", "ahb", base + 0x74, 18); 427 + hws[IMX6SX_CLK_MMDC_P0_FAST] = imx_clk_hw_gate2_flags("mmdc_p0_fast", "mmdc_podf", base + 0x74, 20, CLK_IS_CRITICAL); 428 + hws[IMX6SX_CLK_MMDC_P0_IPG] = imx_clk_hw_gate2_flags("mmdc_p0_ipg", "ipg", base + 0x74, 24, CLK_IS_CRITICAL); 429 + hws[IMX6SX_CLK_MMDC_P1_IPG] = imx_clk_hw_gate2_flags("mmdc_p1_ipg", "ipg", base + 0x74, 26, CLK_IS_CRITICAL); 430 + hws[IMX6SX_CLK_OCRAM] = imx_clk_hw_gate2_flags("ocram", "ocram_podf", base + 0x74, 28, CLK_IS_CRITICAL); 439 431 440 432 /* CCGR4 */ 441 - clks[IMX6SX_CLK_PCIE_AXI] = imx_clk_gate2("pcie_axi", "display_podf", base + 0x78, 0); 442 - clks[IMX6SX_CLK_QSPI2] = imx_clk_gate2("qspi2", "qspi2_podf", base + 0x78, 10); 443 - clks[IMX6SX_CLK_PER1_BCH] = imx_clk_gate2("per1_bch", "usdhc3", base + 0x78, 12); 444 - clks[IMX6SX_CLK_PER2_MAIN] = imx_clk_gate2_flags("per2_main", "ahb", base + 0x78, 14, CLK_IS_CRITICAL); 445 - clks[IMX6SX_CLK_PWM1] = imx_clk_gate2("pwm1", "perclk", base + 0x78, 16); 446 - clks[IMX6SX_CLK_PWM2] = imx_clk_gate2("pwm2", "perclk", base + 0x78, 18); 447 - clks[IMX6SX_CLK_PWM3] = imx_clk_gate2("pwm3", "perclk", base + 0x78, 20); 448 - clks[IMX6SX_CLK_PWM4] = imx_clk_gate2("pwm4", "perclk", base + 0x78, 22); 449 - clks[IMX6SX_CLK_GPMI_BCH_APB] = imx_clk_gate2("gpmi_bch_apb", "usdhc3", base + 0x78, 24); 450 - clks[IMX6SX_CLK_GPMI_BCH] = imx_clk_gate2("gpmi_bch", "usdhc4", base + 0x78, 26); 451 - clks[IMX6SX_CLK_GPMI_IO] = imx_clk_gate2("gpmi_io", "qspi2_podf", base + 0x78, 28); 452 - clks[IMX6SX_CLK_GPMI_APB] = imx_clk_gate2("gpmi_apb", "usdhc3", base + 0x78, 30); 433 + hws[IMX6SX_CLK_PCIE_AXI] = imx_clk_hw_gate2("pcie_axi", "display_podf", base + 0x78, 0); 434 + hws[IMX6SX_CLK_QSPI2] = imx_clk_hw_gate2("qspi2", "qspi2_podf", base + 0x78, 10); 435 + hws[IMX6SX_CLK_PER1_BCH] = imx_clk_hw_gate2("per1_bch", "usdhc3", base + 0x78, 12); 436 + hws[IMX6SX_CLK_PER2_MAIN] = imx_clk_hw_gate2_flags("per2_main", "ahb", base + 0x78, 14, CLK_IS_CRITICAL); 437 + hws[IMX6SX_CLK_PWM1] = imx_clk_hw_gate2("pwm1", "perclk", base + 0x78, 16); 438 + hws[IMX6SX_CLK_PWM2] = imx_clk_hw_gate2("pwm2", "perclk", base + 0x78, 18); 439 + hws[IMX6SX_CLK_PWM3] = imx_clk_hw_gate2("pwm3", "perclk", base + 0x78, 20); 440 + hws[IMX6SX_CLK_PWM4] = imx_clk_hw_gate2("pwm4", "perclk", base + 0x78, 22); 441 + hws[IMX6SX_CLK_GPMI_BCH_APB] = imx_clk_hw_gate2("gpmi_bch_apb", "usdhc3", base + 0x78, 24); 442 + hws[IMX6SX_CLK_GPMI_BCH] = imx_clk_hw_gate2("gpmi_bch", "usdhc4", base + 0x78, 26); 443 + hws[IMX6SX_CLK_GPMI_IO] = imx_clk_hw_gate2("gpmi_io", "qspi2_podf", base + 0x78, 28); 444 + hws[IMX6SX_CLK_GPMI_APB] = imx_clk_hw_gate2("gpmi_apb", "usdhc3", base + 0x78, 30); 453 445 454 446 /* CCGR5 */ 455 - clks[IMX6SX_CLK_ROM] = imx_clk_gate2_flags("rom", "ahb", base + 0x7c, 0, CLK_IS_CRITICAL); 456 - clks[IMX6SX_CLK_SDMA] = imx_clk_gate2("sdma", "ahb", base + 0x7c, 6); 457 - clks[IMX6SX_CLK_SPBA] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12); 458 - clks[IMX6SX_CLK_AUDIO] = imx_clk_gate2_shared("audio", "audio_podf", base + 0x7c, 14, &share_count_audio); 459 - clks[IMX6SX_CLK_SPDIF] = imx_clk_gate2_shared("spdif", "spdif_podf", base + 0x7c, 14, &share_count_audio); 460 - clks[IMX6SX_CLK_SPDIF_GCLK] = imx_clk_gate2_shared("spdif_gclk", "ipg", base + 0x7c, 14, &share_count_audio); 461 - clks[IMX6SX_CLK_SSI1_IPG] = imx_clk_gate2_shared("ssi1_ipg", "ipg", base + 0x7c, 18, &share_count_ssi1); 462 - clks[IMX6SX_CLK_SSI2_IPG] = imx_clk_gate2_shared("ssi2_ipg", "ipg", base + 0x7c, 20, &share_count_ssi2); 463 - clks[IMX6SX_CLK_SSI3_IPG] = imx_clk_gate2_shared("ssi3_ipg", "ipg", base + 0x7c, 22, &share_count_ssi3); 464 - clks[IMX6SX_CLK_SSI1] = imx_clk_gate2_shared("ssi1", "ssi1_podf", base + 0x7c, 18, &share_count_ssi1); 465 - clks[IMX6SX_CLK_SSI2] = imx_clk_gate2_shared("ssi2", "ssi2_podf", base + 0x7c, 20, &share_count_ssi2); 466 - clks[IMX6SX_CLK_SSI3] = imx_clk_gate2_shared("ssi3", "ssi3_podf", base + 0x7c, 22, &share_count_ssi3); 467 - clks[IMX6SX_CLK_UART_IPG] = imx_clk_gate2("uart_ipg", "ipg", base + 0x7c, 24); 468 - clks[IMX6SX_CLK_UART_SERIAL] = imx_clk_gate2("uart_serial", "uart_podf", base + 0x7c, 26); 469 - clks[IMX6SX_CLK_SAI1_IPG] = imx_clk_gate2_shared("sai1_ipg", "ipg", base + 0x7c, 28, &share_count_sai1); 470 - clks[IMX6SX_CLK_SAI2_IPG] = imx_clk_gate2_shared("sai2_ipg", "ipg", base + 0x7c, 30, &share_count_sai2); 471 - clks[IMX6SX_CLK_SAI1] = imx_clk_gate2_shared("sai1", "ssi1_podf", base + 0x7c, 28, &share_count_sai1); 472 - clks[IMX6SX_CLK_SAI2] = imx_clk_gate2_shared("sai2", "ssi2_podf", base + 0x7c, 30, &share_count_sai2); 447 + hws[IMX6SX_CLK_ROM] = imx_clk_hw_gate2_flags("rom", "ahb", base + 0x7c, 0, CLK_IS_CRITICAL); 448 + hws[IMX6SX_CLK_SDMA] = imx_clk_hw_gate2("sdma", "ahb", base + 0x7c, 6); 449 + hws[IMX6SX_CLK_SPBA] = imx_clk_hw_gate2("spba", "ipg", base + 0x7c, 12); 450 + hws[IMX6SX_CLK_AUDIO] = imx_clk_hw_gate2_shared("audio", "audio_podf", base + 0x7c, 14, &share_count_audio); 451 + hws[IMX6SX_CLK_SPDIF] = imx_clk_hw_gate2_shared("spdif", "spdif_podf", base + 0x7c, 14, &share_count_audio); 452 + hws[IMX6SX_CLK_SPDIF_GCLK] = imx_clk_hw_gate2_shared("spdif_gclk", "ipg", base + 0x7c, 14, &share_count_audio); 453 + hws[IMX6SX_CLK_SSI1_IPG] = imx_clk_hw_gate2_shared("ssi1_ipg", "ipg", base + 0x7c, 18, &share_count_ssi1); 454 + hws[IMX6SX_CLK_SSI2_IPG] = imx_clk_hw_gate2_shared("ssi2_ipg", "ipg", base + 0x7c, 20, &share_count_ssi2); 455 + hws[IMX6SX_CLK_SSI3_IPG] = imx_clk_hw_gate2_shared("ssi3_ipg", "ipg", base + 0x7c, 22, &share_count_ssi3); 456 + hws[IMX6SX_CLK_SSI1] = imx_clk_hw_gate2_shared("ssi1", "ssi1_podf", base + 0x7c, 18, &share_count_ssi1); 457 + hws[IMX6SX_CLK_SSI2] = imx_clk_hw_gate2_shared("ssi2", "ssi2_podf", base + 0x7c, 20, &share_count_ssi2); 458 + hws[IMX6SX_CLK_SSI3] = imx_clk_hw_gate2_shared("ssi3", "ssi3_podf", base + 0x7c, 22, &share_count_ssi3); 459 + hws[IMX6SX_CLK_UART_IPG] = imx_clk_hw_gate2("uart_ipg", "ipg", base + 0x7c, 24); 460 + hws[IMX6SX_CLK_UART_SERIAL] = imx_clk_hw_gate2("uart_serial", "uart_podf", base + 0x7c, 26); 461 + hws[IMX6SX_CLK_SAI1_IPG] = imx_clk_hw_gate2_shared("sai1_ipg", "ipg", base + 0x7c, 28, &share_count_sai1); 462 + hws[IMX6SX_CLK_SAI2_IPG] = imx_clk_hw_gate2_shared("sai2_ipg", "ipg", base + 0x7c, 30, &share_count_sai2); 463 + hws[IMX6SX_CLK_SAI1] = imx_clk_hw_gate2_shared("sai1", "ssi1_podf", base + 0x7c, 28, &share_count_sai1); 464 + hws[IMX6SX_CLK_SAI2] = imx_clk_hw_gate2_shared("sai2", "ssi2_podf", base + 0x7c, 30, &share_count_sai2); 473 465 474 466 /* CCGR6 */ 475 - clks[IMX6SX_CLK_USBOH3] = imx_clk_gate2("usboh3", "ipg", base + 0x80, 0); 476 - clks[IMX6SX_CLK_USDHC1] = imx_clk_gate2("usdhc1", "usdhc1_podf", base + 0x80, 2); 477 - clks[IMX6SX_CLK_USDHC2] = imx_clk_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4); 478 - clks[IMX6SX_CLK_USDHC3] = imx_clk_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6); 479 - clks[IMX6SX_CLK_USDHC4] = imx_clk_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8); 480 - clks[IMX6SX_CLK_EIM_SLOW] = imx_clk_gate2("eim_slow", "eim_slow_podf", base + 0x80, 10); 481 - clks[IMX6SX_CLK_PWM8] = imx_clk_gate2("pwm8", "perclk", base + 0x80, 16); 482 - clks[IMX6SX_CLK_VADC] = imx_clk_gate2("vadc", "vid_podf", base + 0x80, 20); 483 - clks[IMX6SX_CLK_GIS] = imx_clk_gate2("gis", "display_podf", base + 0x80, 22); 484 - clks[IMX6SX_CLK_I2C4] = imx_clk_gate2("i2c4", "perclk", base + 0x80, 24); 485 - clks[IMX6SX_CLK_PWM5] = imx_clk_gate2("pwm5", "perclk", base + 0x80, 26); 486 - clks[IMX6SX_CLK_PWM6] = imx_clk_gate2("pwm6", "perclk", base + 0x80, 28); 487 - clks[IMX6SX_CLK_PWM7] = imx_clk_gate2("pwm7", "perclk", base + 0x80, 30); 467 + hws[IMX6SX_CLK_USBOH3] = imx_clk_hw_gate2("usboh3", "ipg", base + 0x80, 0); 468 + hws[IMX6SX_CLK_USDHC1] = imx_clk_hw_gate2("usdhc1", "usdhc1_podf", base + 0x80, 2); 469 + hws[IMX6SX_CLK_USDHC2] = imx_clk_hw_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4); 470 + hws[IMX6SX_CLK_USDHC3] = imx_clk_hw_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6); 471 + hws[IMX6SX_CLK_USDHC4] = imx_clk_hw_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8); 472 + hws[IMX6SX_CLK_EIM_SLOW] = imx_clk_hw_gate2("eim_slow", "eim_slow_podf", base + 0x80, 10); 473 + hws[IMX6SX_CLK_PWM8] = imx_clk_hw_gate2("pwm8", "perclk", base + 0x80, 16); 474 + hws[IMX6SX_CLK_VADC] = imx_clk_hw_gate2("vadc", "vid_podf", base + 0x80, 20); 475 + hws[IMX6SX_CLK_GIS] = imx_clk_hw_gate2("gis", "display_podf", base + 0x80, 22); 476 + hws[IMX6SX_CLK_I2C4] = imx_clk_hw_gate2("i2c4", "perclk", base + 0x80, 24); 477 + hws[IMX6SX_CLK_PWM5] = imx_clk_hw_gate2("pwm5", "perclk", base + 0x80, 26); 478 + hws[IMX6SX_CLK_PWM6] = imx_clk_hw_gate2("pwm6", "perclk", base + 0x80, 28); 479 + hws[IMX6SX_CLK_PWM7] = imx_clk_hw_gate2("pwm7", "perclk", base + 0x80, 30); 488 480 489 - clks[IMX6SX_CLK_CKO1] = imx_clk_gate("cko1", "cko1_podf", base + 0x60, 7); 490 - clks[IMX6SX_CLK_CKO2] = imx_clk_gate("cko2", "cko2_podf", base + 0x60, 24); 481 + hws[IMX6SX_CLK_CKO1] = imx_clk_hw_gate("cko1", "cko1_podf", base + 0x60, 7); 482 + hws[IMX6SX_CLK_CKO2] = imx_clk_hw_gate("cko2", "cko2_podf", base + 0x60, 24); 491 483 492 484 /* mask handshake of mmdc */ 493 - writel_relaxed(BM_CCM_CCDR_MMDC_CH0_MASK, base + CCDR); 485 + imx_mmdc_mask_handshake(base, 0); 494 486 495 - imx_check_clocks(clks, ARRAY_SIZE(clks)); 487 + imx_check_clk_hws(hws, IMX6SX_CLK_CLK_END); 496 488 497 - clk_data.clks = clks; 498 - clk_data.clk_num = ARRAY_SIZE(clks); 499 - of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 489 + of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data); 500 490 501 491 if (IS_ENABLED(CONFIG_USB_MXS_PHY)) { 502 - clk_prepare_enable(clks[IMX6SX_CLK_USBPHY1_GATE]); 503 - clk_prepare_enable(clks[IMX6SX_CLK_USBPHY2_GATE]); 492 + clk_prepare_enable(hws[IMX6SX_CLK_USBPHY1_GATE]->clk); 493 + clk_prepare_enable(hws[IMX6SX_CLK_USBPHY2_GATE]->clk); 504 494 } 505 495 506 496 /* Set the default 132MHz for EIM module */ 507 - clk_set_parent(clks[IMX6SX_CLK_EIM_SLOW_SEL], clks[IMX6SX_CLK_PLL2_PFD2]); 508 - clk_set_rate(clks[IMX6SX_CLK_EIM_SLOW], 132000000); 497 + clk_set_parent(hws[IMX6SX_CLK_EIM_SLOW_SEL]->clk, hws[IMX6SX_CLK_PLL2_PFD2]->clk); 498 + clk_set_rate(hws[IMX6SX_CLK_EIM_SLOW]->clk, 132000000); 509 499 510 500 /* set parent clock for LCDIF1 pixel clock */ 511 - clk_set_parent(clks[IMX6SX_CLK_LCDIF1_PRE_SEL], clks[IMX6SX_CLK_PLL5_VIDEO_DIV]); 512 - clk_set_parent(clks[IMX6SX_CLK_LCDIF1_SEL], clks[IMX6SX_CLK_LCDIF1_PODF]); 501 + clk_set_parent(hws[IMX6SX_CLK_LCDIF1_PRE_SEL]->clk, hws[IMX6SX_CLK_PLL5_VIDEO_DIV]->clk); 502 + clk_set_parent(hws[IMX6SX_CLK_LCDIF1_SEL]->clk, hws[IMX6SX_CLK_LCDIF1_PODF]->clk); 513 503 514 504 /* Set the parent clks of PCIe lvds1 and pcie_axi to be pcie ref, axi */ 515 - if (clk_set_parent(clks[IMX6SX_CLK_LVDS1_SEL], clks[IMX6SX_CLK_PCIE_REF_125M])) 505 + if (clk_set_parent(hws[IMX6SX_CLK_LVDS1_SEL]->clk, hws[IMX6SX_CLK_PCIE_REF_125M]->clk)) 516 506 pr_err("Failed to set pcie bus parent clk.\n"); 517 - if (clk_set_parent(clks[IMX6SX_CLK_PCIE_AXI_SEL], clks[IMX6SX_CLK_AXI])) 518 - pr_err("Failed to set pcie parent clk.\n"); 519 507 520 508 /* 521 509 * Init enet system AHB clock, set to 200MHz 522 510 * pll2_pfd2_396m-> ENET_PODF-> ENET_AHB 523 511 */ 524 - clk_set_parent(clks[IMX6SX_CLK_ENET_PRE_SEL], clks[IMX6SX_CLK_PLL2_PFD2]); 525 - clk_set_parent(clks[IMX6SX_CLK_ENET_SEL], clks[IMX6SX_CLK_ENET_PODF]); 526 - clk_set_rate(clks[IMX6SX_CLK_ENET_PODF], 200000000); 527 - clk_set_rate(clks[IMX6SX_CLK_ENET_REF], 125000000); 528 - clk_set_rate(clks[IMX6SX_CLK_ENET2_REF], 125000000); 512 + clk_set_parent(hws[IMX6SX_CLK_ENET_PRE_SEL]->clk, hws[IMX6SX_CLK_PLL2_PFD2]->clk); 513 + clk_set_parent(hws[IMX6SX_CLK_ENET_SEL]->clk, hws[IMX6SX_CLK_ENET_PODF]->clk); 514 + clk_set_rate(hws[IMX6SX_CLK_ENET_PODF]->clk, 200000000); 515 + clk_set_rate(hws[IMX6SX_CLK_ENET_REF]->clk, 125000000); 516 + clk_set_rate(hws[IMX6SX_CLK_ENET2_REF]->clk, 125000000); 529 517 530 518 /* Audio clocks */ 531 - clk_set_rate(clks[IMX6SX_CLK_PLL4_AUDIO_DIV], 393216000); 519 + clk_set_rate(hws[IMX6SX_CLK_PLL4_AUDIO_DIV]->clk, 393216000); 532 520 533 - clk_set_parent(clks[IMX6SX_CLK_SPDIF_SEL], clks[IMX6SX_CLK_PLL4_AUDIO_DIV]); 534 - clk_set_rate(clks[IMX6SX_CLK_SPDIF_PODF], 98304000); 521 + clk_set_parent(hws[IMX6SX_CLK_SPDIF_SEL]->clk, hws[IMX6SX_CLK_PLL4_AUDIO_DIV]->clk); 522 + clk_set_rate(hws[IMX6SX_CLK_SPDIF_PODF]->clk, 98304000); 535 523 536 - clk_set_parent(clks[IMX6SX_CLK_AUDIO_SEL], clks[IMX6SX_CLK_PLL3_USB_OTG]); 537 - clk_set_rate(clks[IMX6SX_CLK_AUDIO_PODF], 24000000); 524 + clk_set_parent(hws[IMX6SX_CLK_AUDIO_SEL]->clk, hws[IMX6SX_CLK_PLL3_USB_OTG]->clk); 525 + clk_set_rate(hws[IMX6SX_CLK_AUDIO_PODF]->clk, 24000000); 538 526 539 - clk_set_parent(clks[IMX6SX_CLK_SSI1_SEL], clks[IMX6SX_CLK_PLL4_AUDIO_DIV]); 540 - clk_set_parent(clks[IMX6SX_CLK_SSI2_SEL], clks[IMX6SX_CLK_PLL4_AUDIO_DIV]); 541 - clk_set_parent(clks[IMX6SX_CLK_SSI3_SEL], clks[IMX6SX_CLK_PLL4_AUDIO_DIV]); 542 - clk_set_rate(clks[IMX6SX_CLK_SSI1_PODF], 24576000); 543 - clk_set_rate(clks[IMX6SX_CLK_SSI2_PODF], 24576000); 544 - clk_set_rate(clks[IMX6SX_CLK_SSI3_PODF], 24576000); 527 + clk_set_parent(hws[IMX6SX_CLK_SSI1_SEL]->clk, hws[IMX6SX_CLK_PLL4_AUDIO_DIV]->clk); 528 + clk_set_parent(hws[IMX6SX_CLK_SSI2_SEL]->clk, hws[IMX6SX_CLK_PLL4_AUDIO_DIV]->clk); 529 + clk_set_parent(hws[IMX6SX_CLK_SSI3_SEL]->clk, hws[IMX6SX_CLK_PLL4_AUDIO_DIV]->clk); 530 + clk_set_rate(hws[IMX6SX_CLK_SSI1_PODF]->clk, 24576000); 531 + clk_set_rate(hws[IMX6SX_CLK_SSI2_PODF]->clk, 24576000); 532 + clk_set_rate(hws[IMX6SX_CLK_SSI3_PODF]->clk, 24576000); 545 533 546 - clk_set_parent(clks[IMX6SX_CLK_ESAI_SEL], clks[IMX6SX_CLK_PLL4_AUDIO_DIV]); 547 - clk_set_rate(clks[IMX6SX_CLK_ESAI_PODF], 24576000); 534 + clk_set_parent(hws[IMX6SX_CLK_ESAI_SEL]->clk, hws[IMX6SX_CLK_PLL4_AUDIO_DIV]->clk); 535 + clk_set_rate(hws[IMX6SX_CLK_ESAI_PODF]->clk, 24576000); 548 536 549 537 /* Set parent clock for vadc */ 550 - clk_set_parent(clks[IMX6SX_CLK_VID_SEL], clks[IMX6SX_CLK_PLL3_USB_OTG]); 538 + clk_set_parent(hws[IMX6SX_CLK_VID_SEL]->clk, hws[IMX6SX_CLK_PLL3_USB_OTG]->clk); 551 539 552 540 /* default parent of can_sel clock is invalid, manually set it here */ 553 - clk_set_parent(clks[IMX6SX_CLK_CAN_SEL], clks[IMX6SX_CLK_PLL3_60M]); 541 + clk_set_parent(hws[IMX6SX_CLK_CAN_SEL]->clk, hws[IMX6SX_CLK_PLL3_60M]->clk); 554 542 555 543 /* Update gpu clock from default 528M to 720M */ 556 - clk_set_parent(clks[IMX6SX_CLK_GPU_CORE_SEL], clks[IMX6SX_CLK_PLL3_PFD0]); 557 - clk_set_parent(clks[IMX6SX_CLK_GPU_AXI_SEL], clks[IMX6SX_CLK_PLL3_PFD0]); 544 + clk_set_parent(hws[IMX6SX_CLK_GPU_CORE_SEL]->clk, hws[IMX6SX_CLK_PLL3_PFD0]->clk); 545 + clk_set_parent(hws[IMX6SX_CLK_GPU_AXI_SEL]->clk, hws[IMX6SX_CLK_PLL3_PFD0]->clk); 558 546 559 - clk_set_parent(clks[IMX6SX_CLK_QSPI1_SEL], clks[IMX6SX_CLK_PLL2_BUS]); 560 - clk_set_parent(clks[IMX6SX_CLK_QSPI2_SEL], clks[IMX6SX_CLK_PLL2_BUS]); 547 + clk_set_parent(hws[IMX6SX_CLK_QSPI1_SEL]->clk, hws[IMX6SX_CLK_PLL2_BUS]->clk); 548 + clk_set_parent(hws[IMX6SX_CLK_QSPI2_SEL]->clk, hws[IMX6SX_CLK_PLL2_BUS]->clk); 549 + 550 + for (i = 0; i < ARRAY_SIZE(uart_clk_ids); i++) { 551 + int index = uart_clk_ids[i]; 552 + 553 + uart_clks[i] = &hws[index]->clk; 554 + } 561 555 562 556 imx_register_uart_clocks(uart_clks); 563 557 }
+283 -279
drivers/clk/imx/clk-imx6ul.c
··· 6 6 #include <dt-bindings/clock/imx6ul-clock.h> 7 7 #include <linux/clk.h> 8 8 #include <linux/clkdev.h> 9 + #include <linux/clk-provider.h> 9 10 #include <linux/err.h> 10 11 #include <linux/init.h> 11 12 #include <linux/io.h> ··· 16 15 #include <linux/types.h> 17 16 18 17 #include "clk.h" 19 - 20 - #define BM_CCM_CCDR_MMDC_CH0_MASK (0x2 << 16) 21 - #define CCDR 0x4 22 18 23 19 static const char *pll_bypass_src_sels[] = { "osc", "dummy", }; 24 20 static const char *pll1_bypass_sels[] = { "pll1", "pll1_bypass_src", }; ··· 68 70 "dummy", "dummy", "dummy", "dummy", "uart_serial", "spdif", "dummy", "dummy", }; 69 71 static const char *cko_sels[] = { "cko1", "cko2", }; 70 72 71 - static struct clk *clks[IMX6UL_CLK_END]; 72 - static struct clk_onecell_data clk_data; 73 + static struct clk_hw **hws; 74 + static struct clk_hw_onecell_data *clk_hw_data; 73 75 74 76 static const struct clk_div_table clk_enet_ref_table[] = { 75 77 { .val = 0, .div = 20, }, ··· 116 118 struct device_node *np; 117 119 void __iomem *base; 118 120 119 - clks[IMX6UL_CLK_DUMMY] = imx_clk_fixed("dummy", 0); 121 + clk_hw_data = kzalloc(struct_size(clk_hw_data, hws, 122 + IMX6UL_CLK_END), GFP_KERNEL); 123 + if (WARN_ON(!clk_hw_data)) 124 + return; 120 125 121 - clks[IMX6UL_CLK_CKIL] = of_clk_get_by_name(ccm_node, "ckil"); 122 - clks[IMX6UL_CLK_OSC] = of_clk_get_by_name(ccm_node, "osc"); 126 + clk_hw_data->num = IMX6UL_CLK_END; 127 + hws = clk_hw_data->hws; 128 + 129 + hws[IMX6UL_CLK_DUMMY] = imx_clk_hw_fixed("dummy", 0); 130 + 131 + hws[IMX6UL_CLK_CKIL] = __clk_get_hw(of_clk_get_by_name(ccm_node, "ckil")); 132 + hws[IMX6UL_CLK_OSC] = __clk_get_hw(of_clk_get_by_name(ccm_node, "osc")); 123 133 124 134 /* ipp_di clock is external input */ 125 - clks[IMX6UL_CLK_IPP_DI0] = of_clk_get_by_name(ccm_node, "ipp_di0"); 126 - clks[IMX6UL_CLK_IPP_DI1] = of_clk_get_by_name(ccm_node, "ipp_di1"); 135 + hws[IMX6UL_CLK_IPP_DI0] = __clk_get_hw(of_clk_get_by_name(ccm_node, "ipp_di0")); 136 + hws[IMX6UL_CLK_IPP_DI1] = __clk_get_hw(of_clk_get_by_name(ccm_node, "ipp_di1")); 127 137 128 138 np = of_find_compatible_node(NULL, NULL, "fsl,imx6ul-anatop"); 129 139 base = of_iomap(np, 0); 130 140 of_node_put(np); 131 141 WARN_ON(!base); 132 142 133 - clks[IMX6UL_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", base + 0x00, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 134 - clks[IMX6UL_PLL2_BYPASS_SRC] = imx_clk_mux("pll2_bypass_src", base + 0x30, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 135 - clks[IMX6UL_PLL3_BYPASS_SRC] = imx_clk_mux("pll3_bypass_src", base + 0x10, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 136 - clks[IMX6UL_PLL4_BYPASS_SRC] = imx_clk_mux("pll4_bypass_src", base + 0x70, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 137 - clks[IMX6UL_PLL5_BYPASS_SRC] = imx_clk_mux("pll5_bypass_src", base + 0xa0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 138 - clks[IMX6UL_PLL6_BYPASS_SRC] = imx_clk_mux("pll6_bypass_src", base + 0xe0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 139 - clks[IMX6UL_PLL7_BYPASS_SRC] = imx_clk_mux("pll7_bypass_src", base + 0x20, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 143 + hws[IMX6UL_PLL1_BYPASS_SRC] = imx_clk_hw_mux("pll1_bypass_src", base + 0x00, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 144 + hws[IMX6UL_PLL2_BYPASS_SRC] = imx_clk_hw_mux("pll2_bypass_src", base + 0x30, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 145 + hws[IMX6UL_PLL3_BYPASS_SRC] = imx_clk_hw_mux("pll3_bypass_src", base + 0x10, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 146 + hws[IMX6UL_PLL4_BYPASS_SRC] = imx_clk_hw_mux("pll4_bypass_src", base + 0x70, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 147 + hws[IMX6UL_PLL5_BYPASS_SRC] = imx_clk_hw_mux("pll5_bypass_src", base + 0xa0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 148 + hws[IMX6UL_PLL6_BYPASS_SRC] = imx_clk_hw_mux("pll6_bypass_src", base + 0xe0, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 149 + hws[IMX6UL_PLL7_BYPASS_SRC] = imx_clk_hw_mux("pll7_bypass_src", base + 0x20, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 140 150 141 - clks[IMX6UL_CLK_PLL1] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1", "osc", base + 0x00, 0x7f); 142 - clks[IMX6UL_CLK_PLL2] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2", "osc", base + 0x30, 0x1); 143 - clks[IMX6UL_CLK_PLL3] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3", "osc", base + 0x10, 0x3); 144 - clks[IMX6UL_CLK_PLL4] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4", "osc", base + 0x70, 0x7f); 145 - clks[IMX6UL_CLK_PLL5] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5", "osc", base + 0xa0, 0x7f); 146 - clks[IMX6UL_CLK_PLL6] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll6", "osc", base + 0xe0, 0x3); 147 - clks[IMX6UL_CLK_PLL7] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7", "osc", base + 0x20, 0x3); 151 + hws[IMX6UL_CLK_PLL1] = imx_clk_hw_pllv3(IMX_PLLV3_SYS, "pll1", "osc", base + 0x00, 0x7f); 152 + hws[IMX6UL_CLK_PLL2] = imx_clk_hw_pllv3(IMX_PLLV3_GENERIC, "pll2", "osc", base + 0x30, 0x1); 153 + hws[IMX6UL_CLK_PLL3] = imx_clk_hw_pllv3(IMX_PLLV3_USB, "pll3", "osc", base + 0x10, 0x3); 154 + hws[IMX6UL_CLK_PLL4] = imx_clk_hw_pllv3(IMX_PLLV3_AV, "pll4", "osc", base + 0x70, 0x7f); 155 + hws[IMX6UL_CLK_PLL5] = imx_clk_hw_pllv3(IMX_PLLV3_AV, "pll5", "osc", base + 0xa0, 0x7f); 156 + hws[IMX6UL_CLK_PLL6] = imx_clk_hw_pllv3(IMX_PLLV3_ENET, "pll6", "osc", base + 0xe0, 0x3); 157 + hws[IMX6UL_CLK_PLL7] = imx_clk_hw_pllv3(IMX_PLLV3_USB, "pll7", "osc", base + 0x20, 0x3); 148 158 149 - clks[IMX6UL_PLL1_BYPASS] = imx_clk_mux_flags("pll1_bypass", base + 0x00, 16, 1, pll1_bypass_sels, ARRAY_SIZE(pll1_bypass_sels), CLK_SET_RATE_PARENT); 150 - clks[IMX6UL_PLL2_BYPASS] = imx_clk_mux_flags("pll2_bypass", base + 0x30, 16, 1, pll2_bypass_sels, ARRAY_SIZE(pll2_bypass_sels), CLK_SET_RATE_PARENT); 151 - clks[IMX6UL_PLL3_BYPASS] = imx_clk_mux_flags("pll3_bypass", base + 0x10, 16, 1, pll3_bypass_sels, ARRAY_SIZE(pll3_bypass_sels), CLK_SET_RATE_PARENT); 152 - clks[IMX6UL_PLL4_BYPASS] = imx_clk_mux_flags("pll4_bypass", base + 0x70, 16, 1, pll4_bypass_sels, ARRAY_SIZE(pll4_bypass_sels), CLK_SET_RATE_PARENT); 153 - clks[IMX6UL_PLL5_BYPASS] = imx_clk_mux_flags("pll5_bypass", base + 0xa0, 16, 1, pll5_bypass_sels, ARRAY_SIZE(pll5_bypass_sels), CLK_SET_RATE_PARENT); 154 - clks[IMX6UL_PLL6_BYPASS] = imx_clk_mux_flags("pll6_bypass", base + 0xe0, 16, 1, pll6_bypass_sels, ARRAY_SIZE(pll6_bypass_sels), CLK_SET_RATE_PARENT); 155 - clks[IMX6UL_PLL7_BYPASS] = imx_clk_mux_flags("pll7_bypass", base + 0x20, 16, 1, pll7_bypass_sels, ARRAY_SIZE(pll7_bypass_sels), CLK_SET_RATE_PARENT); 156 - clks[IMX6UL_CLK_CSI_SEL] = imx_clk_mux_flags("csi_sel", base + 0x3c, 9, 2, csi_sels, ARRAY_SIZE(csi_sels), CLK_SET_RATE_PARENT); 159 + hws[IMX6UL_PLL1_BYPASS] = imx_clk_hw_mux_flags("pll1_bypass", base + 0x00, 16, 1, pll1_bypass_sels, ARRAY_SIZE(pll1_bypass_sels), CLK_SET_RATE_PARENT); 160 + hws[IMX6UL_PLL2_BYPASS] = imx_clk_hw_mux_flags("pll2_bypass", base + 0x30, 16, 1, pll2_bypass_sels, ARRAY_SIZE(pll2_bypass_sels), CLK_SET_RATE_PARENT); 161 + hws[IMX6UL_PLL3_BYPASS] = imx_clk_hw_mux_flags("pll3_bypass", base + 0x10, 16, 1, pll3_bypass_sels, ARRAY_SIZE(pll3_bypass_sels), CLK_SET_RATE_PARENT); 162 + hws[IMX6UL_PLL4_BYPASS] = imx_clk_hw_mux_flags("pll4_bypass", base + 0x70, 16, 1, pll4_bypass_sels, ARRAY_SIZE(pll4_bypass_sels), CLK_SET_RATE_PARENT); 163 + hws[IMX6UL_PLL5_BYPASS] = imx_clk_hw_mux_flags("pll5_bypass", base + 0xa0, 16, 1, pll5_bypass_sels, ARRAY_SIZE(pll5_bypass_sels), CLK_SET_RATE_PARENT); 164 + hws[IMX6UL_PLL6_BYPASS] = imx_clk_hw_mux_flags("pll6_bypass", base + 0xe0, 16, 1, pll6_bypass_sels, ARRAY_SIZE(pll6_bypass_sels), CLK_SET_RATE_PARENT); 165 + hws[IMX6UL_PLL7_BYPASS] = imx_clk_hw_mux_flags("pll7_bypass", base + 0x20, 16, 1, pll7_bypass_sels, ARRAY_SIZE(pll7_bypass_sels), CLK_SET_RATE_PARENT); 166 + hws[IMX6UL_CLK_CSI_SEL] = imx_clk_hw_mux_flags("csi_sel", base + 0x3c, 9, 2, csi_sels, ARRAY_SIZE(csi_sels), CLK_SET_RATE_PARENT); 157 167 158 168 /* Do not bypass PLLs initially */ 159 - clk_set_parent(clks[IMX6UL_PLL1_BYPASS], clks[IMX6UL_CLK_PLL1]); 160 - clk_set_parent(clks[IMX6UL_PLL2_BYPASS], clks[IMX6UL_CLK_PLL2]); 161 - clk_set_parent(clks[IMX6UL_PLL3_BYPASS], clks[IMX6UL_CLK_PLL3]); 162 - clk_set_parent(clks[IMX6UL_PLL4_BYPASS], clks[IMX6UL_CLK_PLL4]); 163 - clk_set_parent(clks[IMX6UL_PLL5_BYPASS], clks[IMX6UL_CLK_PLL5]); 164 - clk_set_parent(clks[IMX6UL_PLL6_BYPASS], clks[IMX6UL_CLK_PLL6]); 165 - clk_set_parent(clks[IMX6UL_PLL7_BYPASS], clks[IMX6UL_CLK_PLL7]); 169 + clk_set_parent(hws[IMX6UL_PLL1_BYPASS]->clk, hws[IMX6UL_CLK_PLL1]->clk); 170 + clk_set_parent(hws[IMX6UL_PLL2_BYPASS]->clk, hws[IMX6UL_CLK_PLL2]->clk); 171 + clk_set_parent(hws[IMX6UL_PLL3_BYPASS]->clk, hws[IMX6UL_CLK_PLL3]->clk); 172 + clk_set_parent(hws[IMX6UL_PLL4_BYPASS]->clk, hws[IMX6UL_CLK_PLL4]->clk); 173 + clk_set_parent(hws[IMX6UL_PLL5_BYPASS]->clk, hws[IMX6UL_CLK_PLL5]->clk); 174 + clk_set_parent(hws[IMX6UL_PLL6_BYPASS]->clk, hws[IMX6UL_CLK_PLL6]->clk); 175 + clk_set_parent(hws[IMX6UL_PLL7_BYPASS]->clk, hws[IMX6UL_CLK_PLL7]->clk); 166 176 167 - clks[IMX6UL_CLK_PLL1_SYS] = imx_clk_fixed_factor("pll1_sys", "pll1_bypass", 1, 1); 168 - clks[IMX6UL_CLK_PLL2_BUS] = imx_clk_gate("pll2_bus", "pll2_bypass", base + 0x30, 13); 169 - clks[IMX6UL_CLK_PLL3_USB_OTG] = imx_clk_gate("pll3_usb_otg", "pll3_bypass", base + 0x10, 13); 170 - clks[IMX6UL_CLK_PLL4_AUDIO] = imx_clk_gate("pll4_audio", "pll4_bypass", base + 0x70, 13); 171 - clks[IMX6UL_CLK_PLL5_VIDEO] = imx_clk_gate("pll5_video", "pll5_bypass", base + 0xa0, 13); 172 - clks[IMX6UL_CLK_PLL6_ENET] = imx_clk_gate("pll6_enet", "pll6_bypass", base + 0xe0, 13); 173 - clks[IMX6UL_CLK_PLL7_USB_HOST] = imx_clk_gate("pll7_usb_host", "pll7_bypass", base + 0x20, 13); 177 + hws[IMX6UL_CLK_PLL1_SYS] = imx_clk_hw_fixed_factor("pll1_sys", "pll1_bypass", 1, 1); 178 + hws[IMX6UL_CLK_PLL2_BUS] = imx_clk_hw_gate("pll2_bus", "pll2_bypass", base + 0x30, 13); 179 + hws[IMX6UL_CLK_PLL3_USB_OTG] = imx_clk_hw_gate("pll3_usb_otg", "pll3_bypass", base + 0x10, 13); 180 + hws[IMX6UL_CLK_PLL4_AUDIO] = imx_clk_hw_gate("pll4_audio", "pll4_bypass", base + 0x70, 13); 181 + hws[IMX6UL_CLK_PLL5_VIDEO] = imx_clk_hw_gate("pll5_video", "pll5_bypass", base + 0xa0, 13); 182 + hws[IMX6UL_CLK_PLL6_ENET] = imx_clk_hw_gate("pll6_enet", "pll6_bypass", base + 0xe0, 13); 183 + hws[IMX6UL_CLK_PLL7_USB_HOST] = imx_clk_hw_gate("pll7_usb_host", "pll7_bypass", base + 0x20, 13); 174 184 175 185 /* 176 186 * Bit 20 is the reserved and read-only bit, we do this only for: ··· 186 180 * - Keep refcount when do usbphy clk_enable/disable, in that case, 187 181 * the clk framework many need to enable/disable usbphy's parent 188 182 */ 189 - clks[IMX6UL_CLK_USBPHY1] = imx_clk_gate("usbphy1", "pll3_usb_otg", base + 0x10, 20); 190 - clks[IMX6UL_CLK_USBPHY2] = imx_clk_gate("usbphy2", "pll7_usb_host", base + 0x20, 20); 183 + hws[IMX6UL_CLK_USBPHY1] = imx_clk_hw_gate("usbphy1", "pll3_usb_otg", base + 0x10, 20); 184 + hws[IMX6UL_CLK_USBPHY2] = imx_clk_hw_gate("usbphy2", "pll7_usb_host", base + 0x20, 20); 191 185 192 186 /* 193 187 * usbphy*_gate needs to be on after system boots up, and software 194 188 * never needs to control it anymore. 195 189 */ 196 - clks[IMX6UL_CLK_USBPHY1_GATE] = imx_clk_gate("usbphy1_gate", "dummy", base + 0x10, 6); 197 - clks[IMX6UL_CLK_USBPHY2_GATE] = imx_clk_gate("usbphy2_gate", "dummy", base + 0x20, 6); 190 + hws[IMX6UL_CLK_USBPHY1_GATE] = imx_clk_hw_gate("usbphy1_gate", "dummy", base + 0x10, 6); 191 + hws[IMX6UL_CLK_USBPHY2_GATE] = imx_clk_hw_gate("usbphy2_gate", "dummy", base + 0x20, 6); 198 192 199 193 /* name parent_name reg idx */ 200 - clks[IMX6UL_CLK_PLL2_PFD0] = imx_clk_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0); 201 - clks[IMX6UL_CLK_PLL2_PFD1] = imx_clk_pfd("pll2_pfd1_594m", "pll2_bus", base + 0x100, 1); 202 - clks[IMX6UL_CLK_PLL2_PFD2] = imx_clk_pfd("pll2_pfd2_396m", "pll2_bus", base + 0x100, 2); 203 - clks[IMX6UL_CLK_PLL2_PFD3] = imx_clk_pfd("pll2_pfd3_594m", "pll2_bus", base + 0x100, 3); 204 - clks[IMX6UL_CLK_PLL3_PFD0] = imx_clk_pfd("pll3_pfd0_720m", "pll3_usb_otg", base + 0xf0, 0); 205 - clks[IMX6UL_CLK_PLL3_PFD1] = imx_clk_pfd("pll3_pfd1_540m", "pll3_usb_otg", base + 0xf0, 1); 206 - clks[IMX6UL_CLK_PLL3_PFD2] = imx_clk_pfd("pll3_pfd2_508m", "pll3_usb_otg", base + 0xf0, 2); 207 - clks[IMX6UL_CLK_PLL3_PFD3] = imx_clk_pfd("pll3_pfd3_454m", "pll3_usb_otg", base + 0xf0, 3); 194 + hws[IMX6UL_CLK_PLL2_PFD0] = imx_clk_hw_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0); 195 + hws[IMX6UL_CLK_PLL2_PFD1] = imx_clk_hw_pfd("pll2_pfd1_594m", "pll2_bus", base + 0x100, 1); 196 + hws[IMX6UL_CLK_PLL2_PFD2] = imx_clk_hw_pfd("pll2_pfd2_396m", "pll2_bus", base + 0x100, 2); 197 + hws[IMX6UL_CLK_PLL2_PFD3] = imx_clk_hw_pfd("pll2_pfd3_594m", "pll2_bus", base + 0x100, 3); 198 + hws[IMX6UL_CLK_PLL3_PFD0] = imx_clk_hw_pfd("pll3_pfd0_720m", "pll3_usb_otg", base + 0xf0, 0); 199 + hws[IMX6UL_CLK_PLL3_PFD1] = imx_clk_hw_pfd("pll3_pfd1_540m", "pll3_usb_otg", base + 0xf0, 1); 200 + hws[IMX6UL_CLK_PLL3_PFD2] = imx_clk_hw_pfd("pll3_pfd2_508m", "pll3_usb_otg", base + 0xf0, 2); 201 + hws[IMX6UL_CLK_PLL3_PFD3] = imx_clk_hw_pfd("pll3_pfd3_454m", "pll3_usb_otg", base + 0xf0, 3); 208 202 209 - clks[IMX6UL_CLK_ENET_REF] = clk_register_divider_table(NULL, "enet_ref", "pll6_enet", 0, 203 + hws[IMX6UL_CLK_ENET_REF] = clk_hw_register_divider_table(NULL, "enet_ref", "pll6_enet", 0, 210 204 base + 0xe0, 0, 2, 0, clk_enet_ref_table, &imx_ccm_lock); 211 - clks[IMX6UL_CLK_ENET2_REF] = clk_register_divider_table(NULL, "enet2_ref", "pll6_enet", 0, 205 + hws[IMX6UL_CLK_ENET2_REF] = clk_hw_register_divider_table(NULL, "enet2_ref", "pll6_enet", 0, 212 206 base + 0xe0, 2, 2, 0, clk_enet_ref_table, &imx_ccm_lock); 213 207 214 - clks[IMX6UL_CLK_ENET2_REF_125M] = imx_clk_gate("enet_ref_125m", "enet2_ref", base + 0xe0, 20); 215 - clks[IMX6UL_CLK_ENET_PTP_REF] = imx_clk_fixed_factor("enet_ptp_ref", "pll6_enet", 1, 20); 216 - clks[IMX6UL_CLK_ENET_PTP] = imx_clk_gate("enet_ptp", "enet_ptp_ref", base + 0xe0, 21); 208 + hws[IMX6UL_CLK_ENET2_REF_125M] = imx_clk_hw_gate("enet_ref_125m", "enet2_ref", base + 0xe0, 20); 209 + hws[IMX6UL_CLK_ENET_PTP_REF] = imx_clk_hw_fixed_factor("enet_ptp_ref", "pll6_enet", 1, 20); 210 + hws[IMX6UL_CLK_ENET_PTP] = imx_clk_hw_gate("enet_ptp", "enet_ptp_ref", base + 0xe0, 21); 217 211 218 - clks[IMX6UL_CLK_PLL4_POST_DIV] = clk_register_divider_table(NULL, "pll4_post_div", "pll4_audio", 212 + hws[IMX6UL_CLK_PLL4_POST_DIV] = clk_hw_register_divider_table(NULL, "pll4_post_div", "pll4_audio", 219 213 CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, base + 0x70, 19, 2, 0, post_div_table, &imx_ccm_lock); 220 - clks[IMX6UL_CLK_PLL4_AUDIO_DIV] = clk_register_divider(NULL, "pll4_audio_div", "pll4_post_div", 214 + hws[IMX6UL_CLK_PLL4_AUDIO_DIV] = clk_hw_register_divider(NULL, "pll4_audio_div", "pll4_post_div", 221 215 CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, base + 0x170, 15, 1, 0, &imx_ccm_lock); 222 - clks[IMX6UL_CLK_PLL5_POST_DIV] = clk_register_divider_table(NULL, "pll5_post_div", "pll5_video", 216 + hws[IMX6UL_CLK_PLL5_POST_DIV] = clk_hw_register_divider_table(NULL, "pll5_post_div", "pll5_video", 223 217 CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, base + 0xa0, 19, 2, 0, post_div_table, &imx_ccm_lock); 224 - clks[IMX6UL_CLK_PLL5_VIDEO_DIV] = clk_register_divider_table(NULL, "pll5_video_div", "pll5_post_div", 218 + hws[IMX6UL_CLK_PLL5_VIDEO_DIV] = clk_hw_register_divider_table(NULL, "pll5_video_div", "pll5_post_div", 225 219 CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, base + 0x170, 30, 2, 0, video_div_table, &imx_ccm_lock); 226 220 227 221 /* name parent_name mult div */ 228 - clks[IMX6UL_CLK_PLL2_198M] = imx_clk_fixed_factor("pll2_198m", "pll2_pfd2_396m", 1, 2); 229 - clks[IMX6UL_CLK_PLL3_80M] = imx_clk_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6); 230 - clks[IMX6UL_CLK_PLL3_60M] = imx_clk_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8); 231 - clks[IMX6UL_CLK_GPT_3M] = imx_clk_fixed_factor("gpt_3m", "osc", 1, 8); 222 + hws[IMX6UL_CLK_PLL2_198M] = imx_clk_hw_fixed_factor("pll2_198m", "pll2_pfd2_396m", 1, 2); 223 + hws[IMX6UL_CLK_PLL3_80M] = imx_clk_hw_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6); 224 + hws[IMX6UL_CLK_PLL3_60M] = imx_clk_hw_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8); 225 + hws[IMX6UL_CLK_GPT_3M] = imx_clk_hw_fixed_factor("gpt_3m", "osc", 1, 8); 232 226 233 227 np = ccm_node; 234 228 base = of_iomap(np, 0); 235 229 WARN_ON(!base); 236 230 237 - clks[IMX6UL_CA7_SECONDARY_SEL] = imx_clk_mux("ca7_secondary_sel", base + 0xc, 3, 1, ca7_secondary_sels, ARRAY_SIZE(ca7_secondary_sels)); 238 - clks[IMX6UL_CLK_STEP] = imx_clk_mux("step", base + 0x0c, 8, 1, step_sels, ARRAY_SIZE(step_sels)); 239 - clks[IMX6UL_CLK_PLL1_SW] = imx_clk_mux_flags("pll1_sw", base + 0x0c, 2, 1, pll1_sw_sels, ARRAY_SIZE(pll1_sw_sels), 0); 240 - clks[IMX6UL_CLK_AXI_ALT_SEL] = imx_clk_mux("axi_alt_sel", base + 0x14, 7, 1, axi_alt_sels, ARRAY_SIZE(axi_alt_sels)); 241 - clks[IMX6UL_CLK_AXI_SEL] = imx_clk_mux_flags("axi_sel", base + 0x14, 6, 1, axi_sels, ARRAY_SIZE(axi_sels), 0); 242 - clks[IMX6UL_CLK_PERIPH_PRE] = imx_clk_mux("periph_pre", base + 0x18, 18, 2, periph_pre_sels, ARRAY_SIZE(periph_pre_sels)); 243 - clks[IMX6UL_CLK_PERIPH2_PRE] = imx_clk_mux("periph2_pre", base + 0x18, 21, 2, periph2_pre_sels, ARRAY_SIZE(periph2_pre_sels)); 244 - clks[IMX6UL_CLK_PERIPH_CLK2_SEL] = imx_clk_mux("periph_clk2_sel", base + 0x18, 12, 2, periph_clk2_sels, ARRAY_SIZE(periph_clk2_sels)); 245 - clks[IMX6UL_CLK_PERIPH2_CLK2_SEL] = imx_clk_mux("periph2_clk2_sel", base + 0x18, 20, 1, periph2_clk2_sels, ARRAY_SIZE(periph2_clk2_sels)); 246 - clks[IMX6UL_CLK_EIM_SLOW_SEL] = imx_clk_mux("eim_slow_sel", base + 0x1c, 29, 2, eim_slow_sels, ARRAY_SIZE(eim_slow_sels)); 247 - clks[IMX6UL_CLK_GPMI_SEL] = imx_clk_mux("gpmi_sel", base + 0x1c, 19, 1, gpmi_sels, ARRAY_SIZE(gpmi_sels)); 248 - clks[IMX6UL_CLK_BCH_SEL] = imx_clk_mux("bch_sel", base + 0x1c, 18, 1, bch_sels, ARRAY_SIZE(bch_sels)); 249 - clks[IMX6UL_CLK_USDHC2_SEL] = imx_clk_mux("usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 250 - clks[IMX6UL_CLK_USDHC1_SEL] = imx_clk_mux("usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 251 - clks[IMX6UL_CLK_SAI3_SEL] = imx_clk_mux("sai3_sel", base + 0x1c, 14, 2, sai_sels, ARRAY_SIZE(sai_sels)); 252 - clks[IMX6UL_CLK_SAI2_SEL] = imx_clk_mux("sai2_sel", base + 0x1c, 12, 2, sai_sels, ARRAY_SIZE(sai_sels)); 253 - clks[IMX6UL_CLK_SAI1_SEL] = imx_clk_mux("sai1_sel", base + 0x1c, 10, 2, sai_sels, ARRAY_SIZE(sai_sels)); 254 - clks[IMX6UL_CLK_QSPI1_SEL] = imx_clk_mux("qspi1_sel", base + 0x1c, 7, 3, qspi1_sels, ARRAY_SIZE(qspi1_sels)); 255 - clks[IMX6UL_CLK_PERCLK_SEL] = imx_clk_mux("perclk_sel", base + 0x1c, 6, 1, perclk_sels, ARRAY_SIZE(perclk_sels)); 256 - clks[IMX6UL_CLK_CAN_SEL] = imx_clk_mux("can_sel", base + 0x20, 8, 2, can_sels, ARRAY_SIZE(can_sels)); 231 + hws[IMX6UL_CA7_SECONDARY_SEL] = imx_clk_hw_mux("ca7_secondary_sel", base + 0xc, 3, 1, ca7_secondary_sels, ARRAY_SIZE(ca7_secondary_sels)); 232 + hws[IMX6UL_CLK_STEP] = imx_clk_hw_mux("step", base + 0x0c, 8, 1, step_sels, ARRAY_SIZE(step_sels)); 233 + hws[IMX6UL_CLK_PLL1_SW] = imx_clk_hw_mux_flags("pll1_sw", base + 0x0c, 2, 1, pll1_sw_sels, ARRAY_SIZE(pll1_sw_sels), 0); 234 + hws[IMX6UL_CLK_AXI_ALT_SEL] = imx_clk_hw_mux("axi_alt_sel", base + 0x14, 7, 1, axi_alt_sels, ARRAY_SIZE(axi_alt_sels)); 235 + hws[IMX6UL_CLK_AXI_SEL] = imx_clk_hw_mux_flags("axi_sel", base + 0x14, 6, 1, axi_sels, ARRAY_SIZE(axi_sels), 0); 236 + hws[IMX6UL_CLK_PERIPH_PRE] = imx_clk_hw_mux("periph_pre", base + 0x18, 18, 2, periph_pre_sels, ARRAY_SIZE(periph_pre_sels)); 237 + hws[IMX6UL_CLK_PERIPH2_PRE] = imx_clk_hw_mux("periph2_pre", base + 0x18, 21, 2, periph2_pre_sels, ARRAY_SIZE(periph2_pre_sels)); 238 + hws[IMX6UL_CLK_PERIPH_CLK2_SEL] = imx_clk_hw_mux("periph_clk2_sel", base + 0x18, 12, 2, periph_clk2_sels, ARRAY_SIZE(periph_clk2_sels)); 239 + hws[IMX6UL_CLK_PERIPH2_CLK2_SEL] = imx_clk_hw_mux("periph2_clk2_sel", base + 0x18, 20, 1, periph2_clk2_sels, ARRAY_SIZE(periph2_clk2_sels)); 240 + hws[IMX6UL_CLK_EIM_SLOW_SEL] = imx_clk_hw_mux("eim_slow_sel", base + 0x1c, 29, 2, eim_slow_sels, ARRAY_SIZE(eim_slow_sels)); 241 + hws[IMX6UL_CLK_GPMI_SEL] = imx_clk_hw_mux("gpmi_sel", base + 0x1c, 19, 1, gpmi_sels, ARRAY_SIZE(gpmi_sels)); 242 + hws[IMX6UL_CLK_BCH_SEL] = imx_clk_hw_mux("bch_sel", base + 0x1c, 18, 1, bch_sels, ARRAY_SIZE(bch_sels)); 243 + hws[IMX6UL_CLK_USDHC2_SEL] = imx_clk_hw_mux("usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 244 + hws[IMX6UL_CLK_USDHC1_SEL] = imx_clk_hw_mux("usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels)); 245 + hws[IMX6UL_CLK_SAI3_SEL] = imx_clk_hw_mux("sai3_sel", base + 0x1c, 14, 2, sai_sels, ARRAY_SIZE(sai_sels)); 246 + hws[IMX6UL_CLK_SAI2_SEL] = imx_clk_hw_mux("sai2_sel", base + 0x1c, 12, 2, sai_sels, ARRAY_SIZE(sai_sels)); 247 + hws[IMX6UL_CLK_SAI1_SEL] = imx_clk_hw_mux("sai1_sel", base + 0x1c, 10, 2, sai_sels, ARRAY_SIZE(sai_sels)); 248 + hws[IMX6UL_CLK_QSPI1_SEL] = imx_clk_hw_mux("qspi1_sel", base + 0x1c, 7, 3, qspi1_sels, ARRAY_SIZE(qspi1_sels)); 249 + hws[IMX6UL_CLK_PERCLK_SEL] = imx_clk_hw_mux("perclk_sel", base + 0x1c, 6, 1, perclk_sels, ARRAY_SIZE(perclk_sels)); 250 + hws[IMX6UL_CLK_CAN_SEL] = imx_clk_hw_mux("can_sel", base + 0x20, 8, 2, can_sels, ARRAY_SIZE(can_sels)); 257 251 if (clk_on_imx6ull()) 258 - clks[IMX6ULL_CLK_ESAI_SEL] = imx_clk_mux("esai_sel", base + 0x20, 19, 2, esai_sels, ARRAY_SIZE(esai_sels)); 259 - clks[IMX6UL_CLK_UART_SEL] = imx_clk_mux("uart_sel", base + 0x24, 6, 1, uart_sels, ARRAY_SIZE(uart_sels)); 260 - clks[IMX6UL_CLK_ENFC_SEL] = imx_clk_mux("enfc_sel", base + 0x2c, 15, 3, enfc_sels, ARRAY_SIZE(enfc_sels)); 261 - clks[IMX6UL_CLK_LDB_DI0_SEL] = imx_clk_mux("ldb_di0_sel", base + 0x2c, 9, 3, ldb_di0_sels, ARRAY_SIZE(ldb_di0_sels)); 262 - clks[IMX6UL_CLK_SPDIF_SEL] = imx_clk_mux("spdif_sel", base + 0x30, 20, 2, spdif_sels, ARRAY_SIZE(spdif_sels)); 252 + hws[IMX6ULL_CLK_ESAI_SEL] = imx_clk_hw_mux("esai_sel", base + 0x20, 19, 2, esai_sels, ARRAY_SIZE(esai_sels)); 253 + hws[IMX6UL_CLK_UART_SEL] = imx_clk_hw_mux("uart_sel", base + 0x24, 6, 1, uart_sels, ARRAY_SIZE(uart_sels)); 254 + hws[IMX6UL_CLK_ENFC_SEL] = imx_clk_hw_mux("enfc_sel", base + 0x2c, 15, 3, enfc_sels, ARRAY_SIZE(enfc_sels)); 255 + hws[IMX6UL_CLK_LDB_DI0_SEL] = imx_clk_hw_mux("ldb_di0_sel", base + 0x2c, 9, 3, ldb_di0_sels, ARRAY_SIZE(ldb_di0_sels)); 256 + hws[IMX6UL_CLK_SPDIF_SEL] = imx_clk_hw_mux("spdif_sel", base + 0x30, 20, 2, spdif_sels, ARRAY_SIZE(spdif_sels)); 263 257 if (clk_on_imx6ul()) { 264 - clks[IMX6UL_CLK_SIM_PRE_SEL] = imx_clk_mux("sim_pre_sel", base + 0x34, 15, 3, sim_pre_sels, ARRAY_SIZE(sim_pre_sels)); 265 - clks[IMX6UL_CLK_SIM_SEL] = imx_clk_mux("sim_sel", base + 0x34, 9, 3, sim_sels, ARRAY_SIZE(sim_sels)); 258 + hws[IMX6UL_CLK_SIM_PRE_SEL] = imx_clk_hw_mux("sim_pre_sel", base + 0x34, 15, 3, sim_pre_sels, ARRAY_SIZE(sim_pre_sels)); 259 + hws[IMX6UL_CLK_SIM_SEL] = imx_clk_hw_mux("sim_sel", base + 0x34, 9, 3, sim_sels, ARRAY_SIZE(sim_sels)); 266 260 } else if (clk_on_imx6ull()) { 267 - clks[IMX6ULL_CLK_EPDC_PRE_SEL] = imx_clk_mux("epdc_pre_sel", base + 0x34, 15, 3, epdc_pre_sels, ARRAY_SIZE(epdc_pre_sels)); 268 - clks[IMX6ULL_CLK_EPDC_SEL] = imx_clk_mux("epdc_sel", base + 0x34, 9, 3, epdc_sels, ARRAY_SIZE(epdc_sels)); 261 + hws[IMX6ULL_CLK_EPDC_PRE_SEL] = imx_clk_hw_mux("epdc_pre_sel", base + 0x34, 15, 3, epdc_pre_sels, ARRAY_SIZE(epdc_pre_sels)); 262 + hws[IMX6ULL_CLK_EPDC_SEL] = imx_clk_hw_mux("epdc_sel", base + 0x34, 9, 3, epdc_sels, ARRAY_SIZE(epdc_sels)); 269 263 } 270 - clks[IMX6UL_CLK_ECSPI_SEL] = imx_clk_mux("ecspi_sel", base + 0x38, 18, 1, ecspi_sels, ARRAY_SIZE(ecspi_sels)); 271 - clks[IMX6UL_CLK_LCDIF_PRE_SEL] = imx_clk_mux_flags("lcdif_pre_sel", base + 0x38, 15, 3, lcdif_pre_sels, ARRAY_SIZE(lcdif_pre_sels), CLK_SET_RATE_PARENT); 272 - clks[IMX6UL_CLK_LCDIF_SEL] = imx_clk_mux("lcdif_sel", base + 0x38, 9, 3, lcdif_sels, ARRAY_SIZE(lcdif_sels)); 264 + hws[IMX6UL_CLK_ECSPI_SEL] = imx_clk_hw_mux("ecspi_sel", base + 0x38, 18, 1, ecspi_sels, ARRAY_SIZE(ecspi_sels)); 265 + hws[IMX6UL_CLK_LCDIF_PRE_SEL] = imx_clk_hw_mux_flags("lcdif_pre_sel", base + 0x38, 15, 3, lcdif_pre_sels, ARRAY_SIZE(lcdif_pre_sels), CLK_SET_RATE_PARENT); 266 + hws[IMX6UL_CLK_LCDIF_SEL] = imx_clk_hw_mux("lcdif_sel", base + 0x38, 9, 3, lcdif_sels, ARRAY_SIZE(lcdif_sels)); 273 267 274 - clks[IMX6UL_CLK_LDB_DI0_DIV_SEL] = imx_clk_mux("ldb_di0", base + 0x20, 10, 1, ldb_di0_div_sels, ARRAY_SIZE(ldb_di0_div_sels)); 275 - clks[IMX6UL_CLK_LDB_DI1_DIV_SEL] = imx_clk_mux("ldb_di1", base + 0x20, 11, 1, ldb_di1_div_sels, ARRAY_SIZE(ldb_di1_div_sels)); 268 + hws[IMX6UL_CLK_LDB_DI0_DIV_SEL] = imx_clk_hw_mux("ldb_di0", base + 0x20, 10, 1, ldb_di0_div_sels, ARRAY_SIZE(ldb_di0_div_sels)); 269 + hws[IMX6UL_CLK_LDB_DI1_DIV_SEL] = imx_clk_hw_mux("ldb_di1", base + 0x20, 11, 1, ldb_di1_div_sels, ARRAY_SIZE(ldb_di1_div_sels)); 276 270 277 - clks[IMX6UL_CLK_CKO1_SEL] = imx_clk_mux("cko1_sel", base + 0x60, 0, 4, cko1_sels, ARRAY_SIZE(cko1_sels)); 278 - clks[IMX6UL_CLK_CKO2_SEL] = imx_clk_mux("cko2_sel", base + 0x60, 16, 5, cko2_sels, ARRAY_SIZE(cko2_sels)); 279 - clks[IMX6UL_CLK_CKO] = imx_clk_mux("cko", base + 0x60, 8, 1, cko_sels, ARRAY_SIZE(cko_sels)); 271 + hws[IMX6UL_CLK_CKO1_SEL] = imx_clk_hw_mux("cko1_sel", base + 0x60, 0, 4, cko1_sels, ARRAY_SIZE(cko1_sels)); 272 + hws[IMX6UL_CLK_CKO2_SEL] = imx_clk_hw_mux("cko2_sel", base + 0x60, 16, 5, cko2_sels, ARRAY_SIZE(cko2_sels)); 273 + hws[IMX6UL_CLK_CKO] = imx_clk_hw_mux("cko", base + 0x60, 8, 1, cko_sels, ARRAY_SIZE(cko_sels)); 280 274 281 - clks[IMX6UL_CLK_LDB_DI0_DIV_3_5] = imx_clk_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7); 282 - clks[IMX6UL_CLK_LDB_DI0_DIV_7] = imx_clk_fixed_factor("ldb_di0_div_7", "ldb_di0_sel", 1, 7); 283 - clks[IMX6UL_CLK_LDB_DI1_DIV_3_5] = imx_clk_fixed_factor("ldb_di1_div_3_5", "qspi1_sel", 2, 7); 284 - clks[IMX6UL_CLK_LDB_DI1_DIV_7] = imx_clk_fixed_factor("ldb_di1_div_7", "qspi1_sel", 1, 7); 275 + hws[IMX6UL_CLK_LDB_DI0_DIV_3_5] = imx_clk_hw_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7); 276 + hws[IMX6UL_CLK_LDB_DI0_DIV_7] = imx_clk_hw_fixed_factor("ldb_di0_div_7", "ldb_di0_sel", 1, 7); 277 + hws[IMX6UL_CLK_LDB_DI1_DIV_3_5] = imx_clk_hw_fixed_factor("ldb_di1_div_3_5", "qspi1_sel", 2, 7); 278 + hws[IMX6UL_CLK_LDB_DI1_DIV_7] = imx_clk_hw_fixed_factor("ldb_di1_div_7", "qspi1_sel", 1, 7); 285 279 286 - clks[IMX6UL_CLK_PERIPH] = imx_clk_busy_mux("periph", base + 0x14, 25, 1, base + 0x48, 5, periph_sels, ARRAY_SIZE(periph_sels)); 287 - clks[IMX6UL_CLK_PERIPH2] = imx_clk_busy_mux("periph2", base + 0x14, 26, 1, base + 0x48, 3, periph2_sels, ARRAY_SIZE(periph2_sels)); 280 + hws[IMX6UL_CLK_PERIPH] = imx_clk_hw_busy_mux("periph", base + 0x14, 25, 1, base + 0x48, 5, periph_sels, ARRAY_SIZE(periph_sels)); 281 + hws[IMX6UL_CLK_PERIPH2] = imx_clk_hw_busy_mux("periph2", base + 0x14, 26, 1, base + 0x48, 3, periph2_sels, ARRAY_SIZE(periph2_sels)); 288 282 289 - clks[IMX6UL_CLK_PERIPH_CLK2] = imx_clk_divider("periph_clk2", "periph_clk2_sel", base + 0x14, 27, 3); 290 - clks[IMX6UL_CLK_PERIPH2_CLK2] = imx_clk_divider("periph2_clk2", "periph2_clk2_sel", base + 0x14, 0, 3); 291 - clks[IMX6UL_CLK_IPG] = imx_clk_divider("ipg", "ahb", base + 0x14, 8, 2); 292 - clks[IMX6UL_CLK_LCDIF_PODF] = imx_clk_divider("lcdif_podf", "lcdif_pred", base + 0x18, 23, 3); 293 - clks[IMX6UL_CLK_QSPI1_PDOF] = imx_clk_divider("qspi1_podf", "qspi1_sel", base + 0x1c, 26, 3); 294 - clks[IMX6UL_CLK_EIM_SLOW_PODF] = imx_clk_divider("eim_slow_podf", "eim_slow_sel", base + 0x1c, 23, 3); 295 - clks[IMX6UL_CLK_PERCLK] = imx_clk_divider("perclk", "perclk_sel", base + 0x1c, 0, 6); 296 - clks[IMX6UL_CLK_CAN_PODF] = imx_clk_divider("can_podf", "can_sel", base + 0x20, 2, 6); 297 - clks[IMX6UL_CLK_GPMI_PODF] = imx_clk_divider("gpmi_podf", "gpmi_sel", base + 0x24, 22, 3); 298 - clks[IMX6UL_CLK_BCH_PODF] = imx_clk_divider("bch_podf", "bch_sel", base + 0x24, 19, 3); 299 - clks[IMX6UL_CLK_USDHC2_PODF] = imx_clk_divider("usdhc2_podf", "usdhc2_sel", base + 0x24, 16, 3); 300 - clks[IMX6UL_CLK_USDHC1_PODF] = imx_clk_divider("usdhc1_podf", "usdhc1_sel", base + 0x24, 11, 3); 301 - clks[IMX6UL_CLK_UART_PODF] = imx_clk_divider("uart_podf", "uart_sel", base + 0x24, 0, 6); 302 - clks[IMX6UL_CLK_SAI3_PRED] = imx_clk_divider("sai3_pred", "sai3_sel", base + 0x28, 22, 3); 303 - clks[IMX6UL_CLK_SAI3_PODF] = imx_clk_divider("sai3_podf", "sai3_pred", base + 0x28, 16, 6); 304 - clks[IMX6UL_CLK_SAI1_PRED] = imx_clk_divider("sai1_pred", "sai1_sel", base + 0x28, 6, 3); 305 - clks[IMX6UL_CLK_SAI1_PODF] = imx_clk_divider("sai1_podf", "sai1_pred", base + 0x28, 0, 6); 283 + hws[IMX6UL_CLK_PERIPH_CLK2] = imx_clk_hw_divider("periph_clk2", "periph_clk2_sel", base + 0x14, 27, 3); 284 + hws[IMX6UL_CLK_PERIPH2_CLK2] = imx_clk_hw_divider("periph2_clk2", "periph2_clk2_sel", base + 0x14, 0, 3); 285 + hws[IMX6UL_CLK_IPG] = imx_clk_hw_divider("ipg", "ahb", base + 0x14, 8, 2); 286 + hws[IMX6UL_CLK_LCDIF_PODF] = imx_clk_hw_divider("lcdif_podf", "lcdif_pred", base + 0x18, 23, 3); 287 + hws[IMX6UL_CLK_QSPI1_PDOF] = imx_clk_hw_divider("qspi1_podf", "qspi1_sel", base + 0x1c, 26, 3); 288 + hws[IMX6UL_CLK_EIM_SLOW_PODF] = imx_clk_hw_divider("eim_slow_podf", "eim_slow_sel", base + 0x1c, 23, 3); 289 + hws[IMX6UL_CLK_PERCLK] = imx_clk_hw_divider("perclk", "perclk_sel", base + 0x1c, 0, 6); 290 + hws[IMX6UL_CLK_CAN_PODF] = imx_clk_hw_divider("can_podf", "can_sel", base + 0x20, 2, 6); 291 + hws[IMX6UL_CLK_GPMI_PODF] = imx_clk_hw_divider("gpmi_podf", "gpmi_sel", base + 0x24, 22, 3); 292 + hws[IMX6UL_CLK_BCH_PODF] = imx_clk_hw_divider("bch_podf", "bch_sel", base + 0x24, 19, 3); 293 + hws[IMX6UL_CLK_USDHC2_PODF] = imx_clk_hw_divider("usdhc2_podf", "usdhc2_sel", base + 0x24, 16, 3); 294 + hws[IMX6UL_CLK_USDHC1_PODF] = imx_clk_hw_divider("usdhc1_podf", "usdhc1_sel", base + 0x24, 11, 3); 295 + hws[IMX6UL_CLK_UART_PODF] = imx_clk_hw_divider("uart_podf", "uart_sel", base + 0x24, 0, 6); 296 + hws[IMX6UL_CLK_SAI3_PRED] = imx_clk_hw_divider("sai3_pred", "sai3_sel", base + 0x28, 22, 3); 297 + hws[IMX6UL_CLK_SAI3_PODF] = imx_clk_hw_divider("sai3_podf", "sai3_pred", base + 0x28, 16, 6); 298 + hws[IMX6UL_CLK_SAI1_PRED] = imx_clk_hw_divider("sai1_pred", "sai1_sel", base + 0x28, 6, 3); 299 + hws[IMX6UL_CLK_SAI1_PODF] = imx_clk_hw_divider("sai1_podf", "sai1_pred", base + 0x28, 0, 6); 306 300 if (clk_on_imx6ull()) { 307 - clks[IMX6ULL_CLK_ESAI_PRED] = imx_clk_divider("esai_pred", "esai_sel", base + 0x28, 9, 3); 308 - clks[IMX6ULL_CLK_ESAI_PODF] = imx_clk_divider("esai_podf", "esai_pred", base + 0x28, 25, 3); 301 + hws[IMX6ULL_CLK_ESAI_PRED] = imx_clk_hw_divider("esai_pred", "esai_sel", base + 0x28, 9, 3); 302 + hws[IMX6ULL_CLK_ESAI_PODF] = imx_clk_hw_divider("esai_podf", "esai_pred", base + 0x28, 25, 3); 309 303 } 310 - clks[IMX6UL_CLK_ENFC_PRED] = imx_clk_divider("enfc_pred", "enfc_sel", base + 0x2c, 18, 3); 311 - clks[IMX6UL_CLK_ENFC_PODF] = imx_clk_divider("enfc_podf", "enfc_pred", base + 0x2c, 21, 6); 312 - clks[IMX6UL_CLK_SAI2_PRED] = imx_clk_divider("sai2_pred", "sai2_sel", base + 0x2c, 6, 3); 313 - clks[IMX6UL_CLK_SAI2_PODF] = imx_clk_divider("sai2_podf", "sai2_pred", base + 0x2c, 0, 6); 314 - clks[IMX6UL_CLK_SPDIF_PRED] = imx_clk_divider("spdif_pred", "spdif_sel", base + 0x30, 25, 3); 315 - clks[IMX6UL_CLK_SPDIF_PODF] = imx_clk_divider("spdif_podf", "spdif_pred", base + 0x30, 22, 3); 304 + hws[IMX6UL_CLK_ENFC_PRED] = imx_clk_hw_divider("enfc_pred", "enfc_sel", base + 0x2c, 18, 3); 305 + hws[IMX6UL_CLK_ENFC_PODF] = imx_clk_hw_divider("enfc_podf", "enfc_pred", base + 0x2c, 21, 6); 306 + hws[IMX6UL_CLK_SAI2_PRED] = imx_clk_hw_divider("sai2_pred", "sai2_sel", base + 0x2c, 6, 3); 307 + hws[IMX6UL_CLK_SAI2_PODF] = imx_clk_hw_divider("sai2_podf", "sai2_pred", base + 0x2c, 0, 6); 308 + hws[IMX6UL_CLK_SPDIF_PRED] = imx_clk_hw_divider("spdif_pred", "spdif_sel", base + 0x30, 25, 3); 309 + hws[IMX6UL_CLK_SPDIF_PODF] = imx_clk_hw_divider("spdif_podf", "spdif_pred", base + 0x30, 22, 3); 316 310 if (clk_on_imx6ul()) 317 - clks[IMX6UL_CLK_SIM_PODF] = imx_clk_divider("sim_podf", "sim_pre_sel", base + 0x34, 12, 3); 311 + hws[IMX6UL_CLK_SIM_PODF] = imx_clk_hw_divider("sim_podf", "sim_pre_sel", base + 0x34, 12, 3); 318 312 else if (clk_on_imx6ull()) 319 - clks[IMX6ULL_CLK_EPDC_PODF] = imx_clk_divider("epdc_podf", "epdc_pre_sel", base + 0x34, 12, 3); 320 - clks[IMX6UL_CLK_ECSPI_PODF] = imx_clk_divider("ecspi_podf", "ecspi_sel", base + 0x38, 19, 6); 321 - clks[IMX6UL_CLK_LCDIF_PRED] = imx_clk_divider("lcdif_pred", "lcdif_pre_sel", base + 0x38, 12, 3); 322 - clks[IMX6UL_CLK_CSI_PODF] = imx_clk_divider("csi_podf", "csi_sel", base + 0x3c, 11, 3); 313 + hws[IMX6ULL_CLK_EPDC_PODF] = imx_clk_hw_divider("epdc_podf", "epdc_pre_sel", base + 0x34, 12, 3); 314 + hws[IMX6UL_CLK_ECSPI_PODF] = imx_clk_hw_divider("ecspi_podf", "ecspi_sel", base + 0x38, 19, 6); 315 + hws[IMX6UL_CLK_LCDIF_PRED] = imx_clk_hw_divider("lcdif_pred", "lcdif_pre_sel", base + 0x38, 12, 3); 316 + hws[IMX6UL_CLK_CSI_PODF] = imx_clk_hw_divider("csi_podf", "csi_sel", base + 0x3c, 11, 3); 323 317 324 - clks[IMX6UL_CLK_CKO1_PODF] = imx_clk_divider("cko1_podf", "cko1_sel", base + 0x60, 4, 3); 325 - clks[IMX6UL_CLK_CKO2_PODF] = imx_clk_divider("cko2_podf", "cko2_sel", base + 0x60, 21, 3); 318 + hws[IMX6UL_CLK_CKO1_PODF] = imx_clk_hw_divider("cko1_podf", "cko1_sel", base + 0x60, 4, 3); 319 + hws[IMX6UL_CLK_CKO2_PODF] = imx_clk_hw_divider("cko2_podf", "cko2_sel", base + 0x60, 21, 3); 326 320 327 - clks[IMX6UL_CLK_ARM] = imx_clk_busy_divider("arm", "pll1_sw", base + 0x10, 0, 3, base + 0x48, 16); 328 - clks[IMX6UL_CLK_MMDC_PODF] = imx_clk_busy_divider("mmdc_podf", "periph2", base + 0x14, 3, 3, base + 0x48, 2); 329 - clks[IMX6UL_CLK_AXI_PODF] = imx_clk_busy_divider("axi_podf", "axi_sel", base + 0x14, 16, 3, base + 0x48, 0); 330 - clks[IMX6UL_CLK_AHB] = imx_clk_busy_divider("ahb", "periph", base + 0x14, 10, 3, base + 0x48, 1); 321 + hws[IMX6UL_CLK_ARM] = imx_clk_hw_busy_divider("arm", "pll1_sw", base + 0x10, 0, 3, base + 0x48, 16); 322 + hws[IMX6UL_CLK_MMDC_PODF] = imx_clk_hw_busy_divider("mmdc_podf", "periph2", base + 0x14, 3, 3, base + 0x48, 2); 323 + hws[IMX6UL_CLK_AXI_PODF] = imx_clk_hw_busy_divider("axi_podf", "axi_sel", base + 0x14, 16, 3, base + 0x48, 0); 324 + hws[IMX6UL_CLK_AHB] = imx_clk_hw_busy_divider("ahb", "periph", base + 0x14, 10, 3, base + 0x48, 1); 331 325 332 326 /* CCGR0 */ 333 - clks[IMX6UL_CLK_AIPSTZ1] = imx_clk_gate2_flags("aips_tz1", "ahb", base + 0x68, 0, CLK_IS_CRITICAL); 334 - clks[IMX6UL_CLK_AIPSTZ2] = imx_clk_gate2_flags("aips_tz2", "ahb", base + 0x68, 2, CLK_IS_CRITICAL); 335 - clks[IMX6UL_CLK_APBHDMA] = imx_clk_gate2("apbh_dma", "bch_podf", base + 0x68, 4); 336 - clks[IMX6UL_CLK_ASRC_IPG] = imx_clk_gate2_shared("asrc_ipg", "ahb", base + 0x68, 6, &share_count_asrc); 337 - clks[IMX6UL_CLK_ASRC_MEM] = imx_clk_gate2_shared("asrc_mem", "ahb", base + 0x68, 6, &share_count_asrc); 327 + hws[IMX6UL_CLK_AIPSTZ1] = imx_clk_hw_gate2_flags("aips_tz1", "ahb", base + 0x68, 0, CLK_IS_CRITICAL); 328 + hws[IMX6UL_CLK_AIPSTZ2] = imx_clk_hw_gate2_flags("aips_tz2", "ahb", base + 0x68, 2, CLK_IS_CRITICAL); 329 + hws[IMX6UL_CLK_APBHDMA] = imx_clk_hw_gate2("apbh_dma", "bch_podf", base + 0x68, 4); 330 + hws[IMX6UL_CLK_ASRC_IPG] = imx_clk_hw_gate2_shared("asrc_ipg", "ahb", base + 0x68, 6, &share_count_asrc); 331 + hws[IMX6UL_CLK_ASRC_MEM] = imx_clk_hw_gate2_shared("asrc_mem", "ahb", base + 0x68, 6, &share_count_asrc); 338 332 if (clk_on_imx6ul()) { 339 - clks[IMX6UL_CLK_CAAM_MEM] = imx_clk_gate2("caam_mem", "ahb", base + 0x68, 8); 340 - clks[IMX6UL_CLK_CAAM_ACLK] = imx_clk_gate2("caam_aclk", "ahb", base + 0x68, 10); 341 - clks[IMX6UL_CLK_CAAM_IPG] = imx_clk_gate2("caam_ipg", "ipg", base + 0x68, 12); 333 + hws[IMX6UL_CLK_CAAM_MEM] = imx_clk_hw_gate2("caam_mem", "ahb", base + 0x68, 8); 334 + hws[IMX6UL_CLK_CAAM_ACLK] = imx_clk_hw_gate2("caam_aclk", "ahb", base + 0x68, 10); 335 + hws[IMX6UL_CLK_CAAM_IPG] = imx_clk_hw_gate2("caam_ipg", "ipg", base + 0x68, 12); 342 336 } else if (clk_on_imx6ull()) { 343 - clks[IMX6ULL_CLK_DCP_CLK] = imx_clk_gate2("dcp", "ahb", base + 0x68, 10); 344 - clks[IMX6UL_CLK_ENET] = imx_clk_gate2("enet", "ipg", base + 0x68, 12); 345 - clks[IMX6UL_CLK_ENET_AHB] = imx_clk_gate2("enet_ahb", "ahb", base + 0x68, 12); 337 + hws[IMX6ULL_CLK_DCP_CLK] = imx_clk_hw_gate2("dcp", "ahb", base + 0x68, 10); 338 + hws[IMX6UL_CLK_ENET] = imx_clk_hw_gate2("enet", "ipg", base + 0x68, 12); 339 + hws[IMX6UL_CLK_ENET_AHB] = imx_clk_hw_gate2("enet_ahb", "ahb", base + 0x68, 12); 346 340 } 347 - clks[IMX6UL_CLK_CAN1_IPG] = imx_clk_gate2("can1_ipg", "ipg", base + 0x68, 14); 348 - clks[IMX6UL_CLK_CAN1_SERIAL] = imx_clk_gate2("can1_serial", "can_podf", base + 0x68, 16); 349 - clks[IMX6UL_CLK_CAN2_IPG] = imx_clk_gate2("can2_ipg", "ipg", base + 0x68, 18); 350 - clks[IMX6UL_CLK_CAN2_SERIAL] = imx_clk_gate2("can2_serial", "can_podf", base + 0x68, 20); 351 - clks[IMX6UL_CLK_GPT2_BUS] = imx_clk_gate2("gpt2_bus", "perclk", base + 0x68, 24); 352 - clks[IMX6UL_CLK_GPT2_SERIAL] = imx_clk_gate2("gpt2_serial", "perclk", base + 0x68, 26); 353 - clks[IMX6UL_CLK_UART2_IPG] = imx_clk_gate2("uart2_ipg", "ipg", base + 0x68, 28); 354 - clks[IMX6UL_CLK_UART2_SERIAL] = imx_clk_gate2("uart2_serial", "uart_podf", base + 0x68, 28); 341 + hws[IMX6UL_CLK_CAN1_IPG] = imx_clk_hw_gate2("can1_ipg", "ipg", base + 0x68, 14); 342 + hws[IMX6UL_CLK_CAN1_SERIAL] = imx_clk_hw_gate2("can1_serial", "can_podf", base + 0x68, 16); 343 + hws[IMX6UL_CLK_CAN2_IPG] = imx_clk_hw_gate2("can2_ipg", "ipg", base + 0x68, 18); 344 + hws[IMX6UL_CLK_CAN2_SERIAL] = imx_clk_hw_gate2("can2_serial", "can_podf", base + 0x68, 20); 345 + hws[IMX6UL_CLK_GPT2_BUS] = imx_clk_hw_gate2("gpt2_bus", "perclk", base + 0x68, 24); 346 + hws[IMX6UL_CLK_GPT2_SERIAL] = imx_clk_hw_gate2("gpt2_serial", "perclk", base + 0x68, 26); 347 + hws[IMX6UL_CLK_UART2_IPG] = imx_clk_hw_gate2("uart2_ipg", "ipg", base + 0x68, 28); 348 + hws[IMX6UL_CLK_UART2_SERIAL] = imx_clk_hw_gate2("uart2_serial", "uart_podf", base + 0x68, 28); 355 349 if (clk_on_imx6ull()) 356 - clks[IMX6UL_CLK_AIPSTZ3] = imx_clk_gate2("aips_tz3", "ahb", base + 0x80, 18); 357 - clks[IMX6UL_CLK_GPIO2] = imx_clk_gate2("gpio2", "ipg", base + 0x68, 30); 350 + hws[IMX6UL_CLK_AIPSTZ3] = imx_clk_hw_gate2("aips_tz3", "ahb", base + 0x80, 18); 351 + hws[IMX6UL_CLK_GPIO2] = imx_clk_hw_gate2("gpio2", "ipg", base + 0x68, 30); 358 352 359 353 /* CCGR1 */ 360 - clks[IMX6UL_CLK_ECSPI1] = imx_clk_gate2("ecspi1", "ecspi_podf", base + 0x6c, 0); 361 - clks[IMX6UL_CLK_ECSPI2] = imx_clk_gate2("ecspi2", "ecspi_podf", base + 0x6c, 2); 362 - clks[IMX6UL_CLK_ECSPI3] = imx_clk_gate2("ecspi3", "ecspi_podf", base + 0x6c, 4); 363 - clks[IMX6UL_CLK_ECSPI4] = imx_clk_gate2("ecspi4", "ecspi_podf", base + 0x6c, 6); 364 - clks[IMX6UL_CLK_ADC2] = imx_clk_gate2("adc2", "ipg", base + 0x6c, 8); 365 - clks[IMX6UL_CLK_UART3_IPG] = imx_clk_gate2("uart3_ipg", "ipg", base + 0x6c, 10); 366 - clks[IMX6UL_CLK_UART3_SERIAL] = imx_clk_gate2("uart3_serial", "uart_podf", base + 0x6c, 10); 367 - clks[IMX6UL_CLK_EPIT1] = imx_clk_gate2("epit1", "perclk", base + 0x6c, 12); 368 - clks[IMX6UL_CLK_EPIT2] = imx_clk_gate2("epit2", "perclk", base + 0x6c, 14); 369 - clks[IMX6UL_CLK_ADC1] = imx_clk_gate2("adc1", "ipg", base + 0x6c, 16); 370 - clks[IMX6UL_CLK_GPT1_BUS] = imx_clk_gate2("gpt1_bus", "perclk", base + 0x6c, 20); 371 - clks[IMX6UL_CLK_GPT1_SERIAL] = imx_clk_gate2("gpt1_serial", "perclk", base + 0x6c, 22); 372 - clks[IMX6UL_CLK_UART4_IPG] = imx_clk_gate2("uart4_ipg", "ipg", base + 0x6c, 24); 373 - clks[IMX6UL_CLK_UART4_SERIAL] = imx_clk_gate2("uart4_serial", "uart_podf", base + 0x6c, 24); 374 - clks[IMX6UL_CLK_GPIO1] = imx_clk_gate2("gpio1", "ipg", base + 0x6c, 26); 375 - clks[IMX6UL_CLK_GPIO5] = imx_clk_gate2("gpio5", "ipg", base + 0x6c, 30); 354 + hws[IMX6UL_CLK_ECSPI1] = imx_clk_hw_gate2("ecspi1", "ecspi_podf", base + 0x6c, 0); 355 + hws[IMX6UL_CLK_ECSPI2] = imx_clk_hw_gate2("ecspi2", "ecspi_podf", base + 0x6c, 2); 356 + hws[IMX6UL_CLK_ECSPI3] = imx_clk_hw_gate2("ecspi3", "ecspi_podf", base + 0x6c, 4); 357 + hws[IMX6UL_CLK_ECSPI4] = imx_clk_hw_gate2("ecspi4", "ecspi_podf", base + 0x6c, 6); 358 + hws[IMX6UL_CLK_ADC2] = imx_clk_hw_gate2("adc2", "ipg", base + 0x6c, 8); 359 + hws[IMX6UL_CLK_UART3_IPG] = imx_clk_hw_gate2("uart3_ipg", "ipg", base + 0x6c, 10); 360 + hws[IMX6UL_CLK_UART3_SERIAL] = imx_clk_hw_gate2("uart3_serial", "uart_podf", base + 0x6c, 10); 361 + hws[IMX6UL_CLK_EPIT1] = imx_clk_hw_gate2("epit1", "perclk", base + 0x6c, 12); 362 + hws[IMX6UL_CLK_EPIT2] = imx_clk_hw_gate2("epit2", "perclk", base + 0x6c, 14); 363 + hws[IMX6UL_CLK_ADC1] = imx_clk_hw_gate2("adc1", "ipg", base + 0x6c, 16); 364 + hws[IMX6UL_CLK_GPT1_BUS] = imx_clk_hw_gate2("gpt1_bus", "perclk", base + 0x6c, 20); 365 + hws[IMX6UL_CLK_GPT1_SERIAL] = imx_clk_hw_gate2("gpt1_serial", "perclk", base + 0x6c, 22); 366 + hws[IMX6UL_CLK_UART4_IPG] = imx_clk_hw_gate2("uart4_ipg", "ipg", base + 0x6c, 24); 367 + hws[IMX6UL_CLK_UART4_SERIAL] = imx_clk_hw_gate2("uart4_serial", "uart_podf", base + 0x6c, 24); 368 + hws[IMX6UL_CLK_GPIO1] = imx_clk_hw_gate2("gpio1", "ipg", base + 0x6c, 26); 369 + hws[IMX6UL_CLK_GPIO5] = imx_clk_hw_gate2("gpio5", "ipg", base + 0x6c, 30); 376 370 377 371 /* CCGR2 */ 378 372 if (clk_on_imx6ull()) { 379 - clks[IMX6ULL_CLK_ESAI_EXTAL] = imx_clk_gate2_shared("esai_extal", "esai_podf", base + 0x70, 0, &share_count_esai); 380 - clks[IMX6ULL_CLK_ESAI_IPG] = imx_clk_gate2_shared("esai_ipg", "ahb", base + 0x70, 0, &share_count_esai); 381 - clks[IMX6ULL_CLK_ESAI_MEM] = imx_clk_gate2_shared("esai_mem", "ahb", base + 0x70, 0, &share_count_esai); 373 + hws[IMX6ULL_CLK_ESAI_EXTAL] = imx_clk_hw_gate2_shared("esai_extal", "esai_podf", base + 0x70, 0, &share_count_esai); 374 + hws[IMX6ULL_CLK_ESAI_IPG] = imx_clk_hw_gate2_shared("esai_ipg", "ahb", base + 0x70, 0, &share_count_esai); 375 + hws[IMX6ULL_CLK_ESAI_MEM] = imx_clk_hw_gate2_shared("esai_mem", "ahb", base + 0x70, 0, &share_count_esai); 382 376 } 383 - clks[IMX6UL_CLK_CSI] = imx_clk_gate2("csi", "csi_podf", base + 0x70, 2); 384 - clks[IMX6UL_CLK_I2C1] = imx_clk_gate2("i2c1", "perclk", base + 0x70, 6); 385 - clks[IMX6UL_CLK_I2C2] = imx_clk_gate2("i2c2", "perclk", base + 0x70, 8); 386 - clks[IMX6UL_CLK_I2C3] = imx_clk_gate2("i2c3", "perclk", base + 0x70, 10); 387 - clks[IMX6UL_CLK_OCOTP] = imx_clk_gate2("ocotp", "ipg", base + 0x70, 12); 388 - clks[IMX6UL_CLK_IOMUXC] = imx_clk_gate2("iomuxc", "lcdif_podf", base + 0x70, 14); 389 - clks[IMX6UL_CLK_GPIO3] = imx_clk_gate2("gpio3", "ipg", base + 0x70, 26); 390 - clks[IMX6UL_CLK_LCDIF_APB] = imx_clk_gate2("lcdif_apb", "axi", base + 0x70, 28); 391 - clks[IMX6UL_CLK_PXP] = imx_clk_gate2("pxp", "axi", base + 0x70, 30); 377 + hws[IMX6UL_CLK_CSI] = imx_clk_hw_gate2("csi", "csi_podf", base + 0x70, 2); 378 + hws[IMX6UL_CLK_I2C1] = imx_clk_hw_gate2("i2c1", "perclk", base + 0x70, 6); 379 + hws[IMX6UL_CLK_I2C2] = imx_clk_hw_gate2("i2c2", "perclk", base + 0x70, 8); 380 + hws[IMX6UL_CLK_I2C3] = imx_clk_hw_gate2("i2c3", "perclk", base + 0x70, 10); 381 + hws[IMX6UL_CLK_OCOTP] = imx_clk_hw_gate2("ocotp", "ipg", base + 0x70, 12); 382 + hws[IMX6UL_CLK_IOMUXC] = imx_clk_hw_gate2("iomuxc", "lcdif_podf", base + 0x70, 14); 383 + hws[IMX6UL_CLK_GPIO3] = imx_clk_hw_gate2("gpio3", "ipg", base + 0x70, 26); 384 + hws[IMX6UL_CLK_LCDIF_APB] = imx_clk_hw_gate2("lcdif_apb", "axi", base + 0x70, 28); 385 + hws[IMX6UL_CLK_PXP] = imx_clk_hw_gate2("pxp", "axi", base + 0x70, 30); 392 386 393 387 /* CCGR3 */ 394 - clks[IMX6UL_CLK_UART5_IPG] = imx_clk_gate2("uart5_ipg", "ipg", base + 0x74, 2); 395 - clks[IMX6UL_CLK_UART5_SERIAL] = imx_clk_gate2("uart5_serial", "uart_podf", base + 0x74, 2); 388 + hws[IMX6UL_CLK_UART5_IPG] = imx_clk_hw_gate2("uart5_ipg", "ipg", base + 0x74, 2); 389 + hws[IMX6UL_CLK_UART5_SERIAL] = imx_clk_hw_gate2("uart5_serial", "uart_podf", base + 0x74, 2); 396 390 if (clk_on_imx6ul()) { 397 - clks[IMX6UL_CLK_ENET] = imx_clk_gate2("enet", "ipg", base + 0x74, 4); 398 - clks[IMX6UL_CLK_ENET_AHB] = imx_clk_gate2("enet_ahb", "ahb", base + 0x74, 4); 391 + hws[IMX6UL_CLK_ENET] = imx_clk_hw_gate2("enet", "ipg", base + 0x74, 4); 392 + hws[IMX6UL_CLK_ENET_AHB] = imx_clk_hw_gate2("enet_ahb", "ahb", base + 0x74, 4); 399 393 } else if (clk_on_imx6ull()) { 400 - clks[IMX6ULL_CLK_EPDC_ACLK] = imx_clk_gate2("epdc_aclk", "axi", base + 0x74, 4); 401 - clks[IMX6ULL_CLK_EPDC_PIX] = imx_clk_gate2("epdc_pix", "epdc_podf", base + 0x74, 4); 394 + hws[IMX6ULL_CLK_EPDC_ACLK] = imx_clk_hw_gate2("epdc_aclk", "axi", base + 0x74, 4); 395 + hws[IMX6ULL_CLK_EPDC_PIX] = imx_clk_hw_gate2("epdc_pix", "epdc_podf", base + 0x74, 4); 402 396 } 403 - clks[IMX6UL_CLK_UART6_IPG] = imx_clk_gate2("uart6_ipg", "ipg", base + 0x74, 6); 404 - clks[IMX6UL_CLK_UART6_SERIAL] = imx_clk_gate2("uart6_serial", "uart_podf", base + 0x74, 6); 405 - clks[IMX6UL_CLK_LCDIF_PIX] = imx_clk_gate2("lcdif_pix", "lcdif_podf", base + 0x74, 10); 406 - clks[IMX6UL_CLK_GPIO4] = imx_clk_gate2("gpio4", "ipg", base + 0x74, 12); 407 - clks[IMX6UL_CLK_QSPI] = imx_clk_gate2("qspi1", "qspi1_podf", base + 0x74, 14); 408 - clks[IMX6UL_CLK_WDOG1] = imx_clk_gate2("wdog1", "ipg", base + 0x74, 16); 409 - clks[IMX6UL_CLK_MMDC_P0_FAST] = imx_clk_gate_flags("mmdc_p0_fast", "mmdc_podf", base + 0x74, 20, CLK_IS_CRITICAL); 410 - clks[IMX6UL_CLK_MMDC_P0_IPG] = imx_clk_gate2_flags("mmdc_p0_ipg", "ipg", base + 0x74, 24, CLK_IS_CRITICAL); 411 - clks[IMX6UL_CLK_MMDC_P1_IPG] = imx_clk_gate2("mmdc_p1_ipg", "ipg", base + 0x74, 26); 412 - clks[IMX6UL_CLK_AXI] = imx_clk_gate_flags("axi", "axi_podf", base + 0x74, 28, CLK_IS_CRITICAL); 397 + hws[IMX6UL_CLK_UART6_IPG] = imx_clk_hw_gate2("uart6_ipg", "ipg", base + 0x74, 6); 398 + hws[IMX6UL_CLK_UART6_SERIAL] = imx_clk_hw_gate2("uart6_serial", "uart_podf", base + 0x74, 6); 399 + hws[IMX6UL_CLK_LCDIF_PIX] = imx_clk_hw_gate2("lcdif_pix", "lcdif_podf", base + 0x74, 10); 400 + hws[IMX6UL_CLK_GPIO4] = imx_clk_hw_gate2("gpio4", "ipg", base + 0x74, 12); 401 + hws[IMX6UL_CLK_QSPI] = imx_clk_hw_gate2("qspi1", "qspi1_podf", base + 0x74, 14); 402 + hws[IMX6UL_CLK_WDOG1] = imx_clk_hw_gate2("wdog1", "ipg", base + 0x74, 16); 403 + hws[IMX6UL_CLK_MMDC_P0_FAST] = imx_clk_hw_gate_flags("mmdc_p0_fast", "mmdc_podf", base + 0x74, 20, CLK_IS_CRITICAL); 404 + hws[IMX6UL_CLK_MMDC_P0_IPG] = imx_clk_hw_gate2_flags("mmdc_p0_ipg", "ipg", base + 0x74, 24, CLK_IS_CRITICAL); 405 + hws[IMX6UL_CLK_MMDC_P1_IPG] = imx_clk_hw_gate2_flags("mmdc_p1_ipg", "ipg", base + 0x74, 26, CLK_IS_CRITICAL); 406 + hws[IMX6UL_CLK_AXI] = imx_clk_hw_gate_flags("axi", "axi_podf", base + 0x74, 28, CLK_IS_CRITICAL); 413 407 414 408 /* CCGR4 */ 415 - clks[IMX6UL_CLK_PER_BCH] = imx_clk_gate2("per_bch", "bch_podf", base + 0x78, 12); 416 - clks[IMX6UL_CLK_PWM1] = imx_clk_gate2("pwm1", "perclk", base + 0x78, 16); 417 - clks[IMX6UL_CLK_PWM2] = imx_clk_gate2("pwm2", "perclk", base + 0x78, 18); 418 - clks[IMX6UL_CLK_PWM3] = imx_clk_gate2("pwm3", "perclk", base + 0x78, 20); 419 - clks[IMX6UL_CLK_PWM4] = imx_clk_gate2("pwm4", "perclk", base + 0x78, 22); 420 - clks[IMX6UL_CLK_GPMI_BCH_APB] = imx_clk_gate2("gpmi_bch_apb", "bch_podf", base + 0x78, 24); 421 - clks[IMX6UL_CLK_GPMI_BCH] = imx_clk_gate2("gpmi_bch", "gpmi_podf", base + 0x78, 26); 422 - clks[IMX6UL_CLK_GPMI_IO] = imx_clk_gate2("gpmi_io", "enfc_podf", base + 0x78, 28); 423 - clks[IMX6UL_CLK_GPMI_APB] = imx_clk_gate2("gpmi_apb", "bch_podf", base + 0x78, 30); 409 + hws[IMX6UL_CLK_PER_BCH] = imx_clk_hw_gate2("per_bch", "bch_podf", base + 0x78, 12); 410 + hws[IMX6UL_CLK_PWM1] = imx_clk_hw_gate2("pwm1", "perclk", base + 0x78, 16); 411 + hws[IMX6UL_CLK_PWM2] = imx_clk_hw_gate2("pwm2", "perclk", base + 0x78, 18); 412 + hws[IMX6UL_CLK_PWM3] = imx_clk_hw_gate2("pwm3", "perclk", base + 0x78, 20); 413 + hws[IMX6UL_CLK_PWM4] = imx_clk_hw_gate2("pwm4", "perclk", base + 0x78, 22); 414 + hws[IMX6UL_CLK_GPMI_BCH_APB] = imx_clk_hw_gate2("gpmi_bch_apb", "bch_podf", base + 0x78, 24); 415 + hws[IMX6UL_CLK_GPMI_BCH] = imx_clk_hw_gate2("gpmi_bch", "gpmi_podf", base + 0x78, 26); 416 + hws[IMX6UL_CLK_GPMI_IO] = imx_clk_hw_gate2("gpmi_io", "enfc_podf", base + 0x78, 28); 417 + hws[IMX6UL_CLK_GPMI_APB] = imx_clk_hw_gate2("gpmi_apb", "bch_podf", base + 0x78, 30); 424 418 425 419 /* CCGR5 */ 426 - clks[IMX6UL_CLK_ROM] = imx_clk_gate2_flags("rom", "ahb", base + 0x7c, 0, CLK_IS_CRITICAL); 427 - clks[IMX6UL_CLK_SDMA] = imx_clk_gate2("sdma", "ahb", base + 0x7c, 6); 428 - clks[IMX6UL_CLK_KPP] = imx_clk_gate2("kpp", "ipg", base + 0x7c, 8); 429 - clks[IMX6UL_CLK_WDOG2] = imx_clk_gate2("wdog2", "ipg", base + 0x7c, 10); 430 - clks[IMX6UL_CLK_SPBA] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12); 431 - clks[IMX6UL_CLK_SPDIF] = imx_clk_gate2_shared("spdif", "spdif_podf", base + 0x7c, 14, &share_count_audio); 432 - clks[IMX6UL_CLK_SPDIF_GCLK] = imx_clk_gate2_shared("spdif_gclk", "ipg", base + 0x7c, 14, &share_count_audio); 433 - clks[IMX6UL_CLK_SAI3] = imx_clk_gate2_shared("sai3", "sai3_podf", base + 0x7c, 22, &share_count_sai3); 434 - clks[IMX6UL_CLK_SAI3_IPG] = imx_clk_gate2_shared("sai3_ipg", "ipg", base + 0x7c, 22, &share_count_sai3); 435 - clks[IMX6UL_CLK_UART1_IPG] = imx_clk_gate2("uart1_ipg", "ipg", base + 0x7c, 24); 436 - clks[IMX6UL_CLK_UART1_SERIAL] = imx_clk_gate2("uart1_serial", "uart_podf", base + 0x7c, 24); 437 - clks[IMX6UL_CLK_UART7_IPG] = imx_clk_gate2("uart7_ipg", "ipg", base + 0x7c, 26); 438 - clks[IMX6UL_CLK_UART7_SERIAL] = imx_clk_gate2("uart7_serial", "uart_podf", base + 0x7c, 26); 439 - clks[IMX6UL_CLK_SAI1] = imx_clk_gate2_shared("sai1", "sai1_podf", base + 0x7c, 28, &share_count_sai1); 440 - clks[IMX6UL_CLK_SAI1_IPG] = imx_clk_gate2_shared("sai1_ipg", "ipg", base + 0x7c, 28, &share_count_sai1); 441 - clks[IMX6UL_CLK_SAI2] = imx_clk_gate2_shared("sai2", "sai2_podf", base + 0x7c, 30, &share_count_sai2); 442 - clks[IMX6UL_CLK_SAI2_IPG] = imx_clk_gate2_shared("sai2_ipg", "ipg", base + 0x7c, 30, &share_count_sai2); 420 + hws[IMX6UL_CLK_ROM] = imx_clk_hw_gate2_flags("rom", "ahb", base + 0x7c, 0, CLK_IS_CRITICAL); 421 + hws[IMX6UL_CLK_SDMA] = imx_clk_hw_gate2("sdma", "ahb", base + 0x7c, 6); 422 + hws[IMX6UL_CLK_KPP] = imx_clk_hw_gate2("kpp", "ipg", base + 0x7c, 8); 423 + hws[IMX6UL_CLK_WDOG2] = imx_clk_hw_gate2("wdog2", "ipg", base + 0x7c, 10); 424 + hws[IMX6UL_CLK_SPBA] = imx_clk_hw_gate2("spba", "ipg", base + 0x7c, 12); 425 + hws[IMX6UL_CLK_SPDIF] = imx_clk_hw_gate2_shared("spdif", "spdif_podf", base + 0x7c, 14, &share_count_audio); 426 + hws[IMX6UL_CLK_SPDIF_GCLK] = imx_clk_hw_gate2_shared("spdif_gclk", "ipg", base + 0x7c, 14, &share_count_audio); 427 + hws[IMX6UL_CLK_SAI3] = imx_clk_hw_gate2_shared("sai3", "sai3_podf", base + 0x7c, 22, &share_count_sai3); 428 + hws[IMX6UL_CLK_SAI3_IPG] = imx_clk_hw_gate2_shared("sai3_ipg", "ipg", base + 0x7c, 22, &share_count_sai3); 429 + hws[IMX6UL_CLK_UART1_IPG] = imx_clk_hw_gate2("uart1_ipg", "ipg", base + 0x7c, 24); 430 + hws[IMX6UL_CLK_UART1_SERIAL] = imx_clk_hw_gate2("uart1_serial", "uart_podf", base + 0x7c, 24); 431 + hws[IMX6UL_CLK_UART7_IPG] = imx_clk_hw_gate2("uart7_ipg", "ipg", base + 0x7c, 26); 432 + hws[IMX6UL_CLK_UART7_SERIAL] = imx_clk_hw_gate2("uart7_serial", "uart_podf", base + 0x7c, 26); 433 + hws[IMX6UL_CLK_SAI1] = imx_clk_hw_gate2_shared("sai1", "sai1_podf", base + 0x7c, 28, &share_count_sai1); 434 + hws[IMX6UL_CLK_SAI1_IPG] = imx_clk_hw_gate2_shared("sai1_ipg", "ipg", base + 0x7c, 28, &share_count_sai1); 435 + hws[IMX6UL_CLK_SAI2] = imx_clk_hw_gate2_shared("sai2", "sai2_podf", base + 0x7c, 30, &share_count_sai2); 436 + hws[IMX6UL_CLK_SAI2_IPG] = imx_clk_hw_gate2_shared("sai2_ipg", "ipg", base + 0x7c, 30, &share_count_sai2); 443 437 444 438 /* CCGR6 */ 445 - clks[IMX6UL_CLK_USBOH3] = imx_clk_gate2("usboh3", "ipg", base + 0x80, 0); 446 - clks[IMX6UL_CLK_USDHC1] = imx_clk_gate2("usdhc1", "usdhc1_podf", base + 0x80, 2); 447 - clks[IMX6UL_CLK_USDHC2] = imx_clk_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4); 439 + hws[IMX6UL_CLK_USBOH3] = imx_clk_hw_gate2("usboh3", "ipg", base + 0x80, 0); 440 + hws[IMX6UL_CLK_USDHC1] = imx_clk_hw_gate2("usdhc1", "usdhc1_podf", base + 0x80, 2); 441 + hws[IMX6UL_CLK_USDHC2] = imx_clk_hw_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4); 448 442 if (clk_on_imx6ul()) { 449 - clks[IMX6UL_CLK_SIM1] = imx_clk_gate2("sim1", "sim_sel", base + 0x80, 6); 450 - clks[IMX6UL_CLK_SIM2] = imx_clk_gate2("sim2", "sim_sel", base + 0x80, 8); 443 + hws[IMX6UL_CLK_SIM1] = imx_clk_hw_gate2("sim1", "sim_sel", base + 0x80, 6); 444 + hws[IMX6UL_CLK_SIM2] = imx_clk_hw_gate2("sim2", "sim_sel", base + 0x80, 8); 451 445 } 452 - clks[IMX6UL_CLK_EIM] = imx_clk_gate2("eim", "eim_slow_podf", base + 0x80, 10); 453 - clks[IMX6UL_CLK_PWM8] = imx_clk_gate2("pwm8", "perclk", base + 0x80, 16); 454 - clks[IMX6UL_CLK_UART8_IPG] = imx_clk_gate2("uart8_ipg", "ipg", base + 0x80, 14); 455 - clks[IMX6UL_CLK_UART8_SERIAL] = imx_clk_gate2("uart8_serial", "uart_podf", base + 0x80, 14); 456 - clks[IMX6UL_CLK_WDOG3] = imx_clk_gate2("wdog3", "ipg", base + 0x80, 20); 457 - clks[IMX6UL_CLK_I2C4] = imx_clk_gate2("i2c4", "perclk", base + 0x80, 24); 458 - clks[IMX6UL_CLK_PWM5] = imx_clk_gate2("pwm5", "perclk", base + 0x80, 26); 459 - clks[IMX6UL_CLK_PWM6] = imx_clk_gate2("pwm6", "perclk", base + 0x80, 28); 460 - clks[IMX6UL_CLK_PWM7] = imx_clk_gate2("pwm7", "perclk", base + 0x80, 30); 446 + hws[IMX6UL_CLK_EIM] = imx_clk_hw_gate2("eim", "eim_slow_podf", base + 0x80, 10); 447 + hws[IMX6UL_CLK_PWM8] = imx_clk_hw_gate2("pwm8", "perclk", base + 0x80, 16); 448 + hws[IMX6UL_CLK_UART8_IPG] = imx_clk_hw_gate2("uart8_ipg", "ipg", base + 0x80, 14); 449 + hws[IMX6UL_CLK_UART8_SERIAL] = imx_clk_hw_gate2("uart8_serial", "uart_podf", base + 0x80, 14); 450 + hws[IMX6UL_CLK_WDOG3] = imx_clk_hw_gate2("wdog3", "ipg", base + 0x80, 20); 451 + hws[IMX6UL_CLK_I2C4] = imx_clk_hw_gate2("i2c4", "perclk", base + 0x80, 24); 452 + hws[IMX6UL_CLK_PWM5] = imx_clk_hw_gate2("pwm5", "perclk", base + 0x80, 26); 453 + hws[IMX6UL_CLK_PWM6] = imx_clk_hw_gate2("pwm6", "perclk", base + 0x80, 28); 454 + hws[IMX6UL_CLK_PWM7] = imx_clk_hw_gate2("pwm7", "perclk", base + 0x80, 30); 461 455 462 456 /* CCOSR */ 463 - clks[IMX6UL_CLK_CKO1] = imx_clk_gate("cko1", "cko1_podf", base + 0x60, 7); 464 - clks[IMX6UL_CLK_CKO2] = imx_clk_gate("cko2", "cko2_podf", base + 0x60, 24); 457 + hws[IMX6UL_CLK_CKO1] = imx_clk_hw_gate("cko1", "cko1_podf", base + 0x60, 7); 458 + hws[IMX6UL_CLK_CKO2] = imx_clk_hw_gate("cko2", "cko2_podf", base + 0x60, 24); 465 459 466 460 /* mask handshake of mmdc */ 467 - writel_relaxed(BM_CCM_CCDR_MMDC_CH0_MASK, base + CCDR); 461 + imx_mmdc_mask_handshake(base, 0); 468 462 469 - imx_check_clocks(clks, ARRAY_SIZE(clks)); 463 + imx_check_clk_hws(hws, IMX6UL_CLK_END); 470 464 471 - clk_data.clks = clks; 472 - clk_data.clk_num = ARRAY_SIZE(clks); 473 - of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 465 + of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data); 474 466 475 467 /* 476 468 * Lower the AHB clock rate before changing the parent clock source, ··· 477 473 * AXI clock rate, so we need to lower AHB rate first to make sure at 478 474 * any time, AHB rate is <= 133MHz. 479 475 */ 480 - clk_set_rate(clks[IMX6UL_CLK_AHB], 99000000); 476 + clk_set_rate(hws[IMX6UL_CLK_AHB]->clk, 99000000); 481 477 482 478 /* Change periph_pre clock to pll2_bus to adjust AXI rate to 264MHz */ 483 - clk_set_parent(clks[IMX6UL_CLK_PERIPH_CLK2_SEL], clks[IMX6UL_CLK_OSC]); 484 - clk_set_parent(clks[IMX6UL_CLK_PERIPH], clks[IMX6UL_CLK_PERIPH_CLK2]); 485 - clk_set_parent(clks[IMX6UL_CLK_PERIPH_PRE], clks[IMX6UL_CLK_PLL2_BUS]); 486 - clk_set_parent(clks[IMX6UL_CLK_PERIPH], clks[IMX6UL_CLK_PERIPH_PRE]); 479 + clk_set_parent(hws[IMX6UL_CLK_PERIPH_CLK2_SEL]->clk, hws[IMX6UL_CLK_OSC]->clk); 480 + clk_set_parent(hws[IMX6UL_CLK_PERIPH]->clk, hws[IMX6UL_CLK_PERIPH_CLK2]->clk); 481 + clk_set_parent(hws[IMX6UL_CLK_PERIPH_PRE]->clk, hws[IMX6UL_CLK_PLL2_BUS]->clk); 482 + clk_set_parent(hws[IMX6UL_CLK_PERIPH]->clk, hws[IMX6UL_CLK_PERIPH_PRE]->clk); 487 483 488 484 /* Make sure AHB rate is 132MHz */ 489 - clk_set_rate(clks[IMX6UL_CLK_AHB], 132000000); 485 + clk_set_rate(hws[IMX6UL_CLK_AHB]->clk, 132000000); 490 486 491 487 /* set perclk to from OSC */ 492 - clk_set_parent(clks[IMX6UL_CLK_PERCLK_SEL], clks[IMX6UL_CLK_OSC]); 488 + clk_set_parent(hws[IMX6UL_CLK_PERCLK_SEL]->clk, hws[IMX6UL_CLK_OSC]->clk); 493 489 494 - clk_set_rate(clks[IMX6UL_CLK_ENET_REF], 50000000); 495 - clk_set_rate(clks[IMX6UL_CLK_ENET2_REF], 50000000); 496 - clk_set_rate(clks[IMX6UL_CLK_CSI], 24000000); 490 + clk_set_rate(hws[IMX6UL_CLK_ENET_REF]->clk, 50000000); 491 + clk_set_rate(hws[IMX6UL_CLK_ENET2_REF]->clk, 50000000); 492 + clk_set_rate(hws[IMX6UL_CLK_CSI]->clk, 24000000); 497 493 498 494 if (clk_on_imx6ull()) 499 - clk_prepare_enable(clks[IMX6UL_CLK_AIPSTZ3]); 495 + clk_prepare_enable(hws[IMX6UL_CLK_AIPSTZ3]->clk); 500 496 501 497 if (IS_ENABLED(CONFIG_USB_MXS_PHY)) { 502 - clk_prepare_enable(clks[IMX6UL_CLK_USBPHY1_GATE]); 503 - clk_prepare_enable(clks[IMX6UL_CLK_USBPHY2_GATE]); 498 + clk_prepare_enable(hws[IMX6UL_CLK_USBPHY1_GATE]->clk); 499 + clk_prepare_enable(hws[IMX6UL_CLK_USBPHY2_GATE]->clk); 504 500 } 505 501 506 - clk_set_parent(clks[IMX6UL_CLK_CAN_SEL], clks[IMX6UL_CLK_PLL3_60M]); 502 + clk_set_parent(hws[IMX6UL_CLK_CAN_SEL]->clk, hws[IMX6UL_CLK_PLL3_60M]->clk); 507 503 if (clk_on_imx6ul()) 508 - clk_set_parent(clks[IMX6UL_CLK_SIM_PRE_SEL], clks[IMX6UL_CLK_PLL3_USB_OTG]); 504 + clk_set_parent(hws[IMX6UL_CLK_SIM_PRE_SEL]->clk, hws[IMX6UL_CLK_PLL3_USB_OTG]->clk); 509 505 else if (clk_on_imx6ull()) 510 - clk_set_parent(clks[IMX6ULL_CLK_EPDC_PRE_SEL], clks[IMX6UL_CLK_PLL3_PFD2]); 506 + clk_set_parent(hws[IMX6ULL_CLK_EPDC_PRE_SEL]->clk, hws[IMX6UL_CLK_PLL3_PFD2]->clk); 511 507 512 - clk_set_parent(clks[IMX6UL_CLK_ENFC_SEL], clks[IMX6UL_CLK_PLL2_PFD2]); 508 + clk_set_parent(hws[IMX6UL_CLK_ENFC_SEL]->clk, hws[IMX6UL_CLK_PLL2_PFD2]->clk); 513 509 } 514 510 515 511 CLK_OF_DECLARE(imx6ul, "fsl,imx6ul-ccm", imx6ul_clocks_init);
+477 -461
drivers/clk/imx/clk-imx7d.c
··· 6 6 #include <dt-bindings/clock/imx7d-clock.h> 7 7 #include <linux/clk.h> 8 8 #include <linux/clkdev.h> 9 + #include <linux/clk-provider.h> 9 10 #include <linux/err.h> 10 11 #include <linux/init.h> 11 12 #include <linux/io.h> ··· 40 39 { } 41 40 }; 42 41 43 - static struct clk *clks[IMX7D_CLK_END]; 44 42 static const char *arm_a7_sel[] = { "osc", "pll_arm_main_clk", 45 43 "pll_enet_500m_clk", "pll_dram_main_clk", 46 44 "pll_sys_main_clk", "pll_sys_pfd0_392m_clk", "pll_audio_post_div", ··· 373 373 static const char *pll_audio_bypass_sel[] = { "pll_audio_main", "pll_audio_main_src", }; 374 374 static const char *pll_video_bypass_sel[] = { "pll_video_main", "pll_video_main_src", }; 375 375 376 - static struct clk_onecell_data clk_data; 376 + static struct clk_hw **hws; 377 + static struct clk_hw_onecell_data *clk_hw_data; 377 378 378 - static struct clk ** const uart_clks[] __initconst = { 379 - &clks[IMX7D_UART1_ROOT_CLK], 380 - &clks[IMX7D_UART2_ROOT_CLK], 381 - &clks[IMX7D_UART3_ROOT_CLK], 382 - &clks[IMX7D_UART4_ROOT_CLK], 383 - &clks[IMX7D_UART5_ROOT_CLK], 384 - &clks[IMX7D_UART6_ROOT_CLK], 385 - &clks[IMX7D_UART7_ROOT_CLK], 386 - NULL 379 + static const int uart_clk_ids[] __initconst = { 380 + IMX7D_UART1_ROOT_CLK, 381 + IMX7D_UART2_ROOT_CLK, 382 + IMX7D_UART3_ROOT_CLK, 383 + IMX7D_UART4_ROOT_CLK, 384 + IMX7D_UART5_ROOT_CLK, 385 + IMX7D_UART6_ROOT_CLK, 386 + IMX7D_UART7_ROOT_CLK, 387 387 }; 388 + 389 + static struct clk **uart_clks[ARRAY_SIZE(uart_clk_ids) + 1] __initdata; 388 390 389 391 static void __init imx7d_clocks_init(struct device_node *ccm_node) 390 392 { 391 393 struct device_node *np; 392 394 void __iomem *base; 395 + int i; 393 396 394 - clks[IMX7D_CLK_DUMMY] = imx_clk_fixed("dummy", 0); 395 - clks[IMX7D_OSC_24M_CLK] = of_clk_get_by_name(ccm_node, "osc"); 396 - clks[IMX7D_CKIL] = of_clk_get_by_name(ccm_node, "ckil"); 397 + clk_hw_data = kzalloc(struct_size(clk_hw_data, hws, 398 + IMX7D_CLK_END), GFP_KERNEL); 399 + if (WARN_ON(!clk_hw_data)) 400 + return; 401 + 402 + clk_hw_data->num = IMX7D_CLK_END; 403 + hws = clk_hw_data->hws; 404 + 405 + hws[IMX7D_CLK_DUMMY] = imx_clk_hw_fixed("dummy", 0); 406 + hws[IMX7D_OSC_24M_CLK] = __clk_get_hw(of_clk_get_by_name(ccm_node, "osc")); 407 + hws[IMX7D_CKIL] = __clk_get_hw(of_clk_get_by_name(ccm_node, "ckil")); 397 408 398 409 np = of_find_compatible_node(NULL, NULL, "fsl,imx7d-anatop"); 399 410 base = of_iomap(np, 0); 400 411 WARN_ON(!base); 401 412 of_node_put(np); 402 413 403 - clks[IMX7D_PLL_ARM_MAIN_SRC] = imx_clk_mux("pll_arm_main_src", base + 0x60, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); 404 - clks[IMX7D_PLL_DRAM_MAIN_SRC] = imx_clk_mux("pll_dram_main_src", base + 0x70, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); 405 - clks[IMX7D_PLL_SYS_MAIN_SRC] = imx_clk_mux("pll_sys_main_src", base + 0xb0, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); 406 - clks[IMX7D_PLL_ENET_MAIN_SRC] = imx_clk_mux("pll_enet_main_src", base + 0xe0, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); 407 - clks[IMX7D_PLL_AUDIO_MAIN_SRC] = imx_clk_mux("pll_audio_main_src", base + 0xf0, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); 408 - clks[IMX7D_PLL_VIDEO_MAIN_SRC] = imx_clk_mux("pll_video_main_src", base + 0x130, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); 414 + hws[IMX7D_PLL_ARM_MAIN_SRC] = imx_clk_hw_mux("pll_arm_main_src", base + 0x60, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); 415 + hws[IMX7D_PLL_DRAM_MAIN_SRC] = imx_clk_hw_mux("pll_dram_main_src", base + 0x70, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); 416 + hws[IMX7D_PLL_SYS_MAIN_SRC] = imx_clk_hw_mux("pll_sys_main_src", base + 0xb0, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); 417 + hws[IMX7D_PLL_ENET_MAIN_SRC] = imx_clk_hw_mux("pll_enet_main_src", base + 0xe0, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); 418 + hws[IMX7D_PLL_AUDIO_MAIN_SRC] = imx_clk_hw_mux("pll_audio_main_src", base + 0xf0, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); 419 + hws[IMX7D_PLL_VIDEO_MAIN_SRC] = imx_clk_hw_mux("pll_video_main_src", base + 0x130, 14, 2, pll_bypass_src_sel, ARRAY_SIZE(pll_bypass_src_sel)); 409 420 410 - clks[IMX7D_PLL_ARM_MAIN] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll_arm_main", "osc", base + 0x60, 0x7f); 411 - clks[IMX7D_PLL_DRAM_MAIN] = imx_clk_pllv3(IMX_PLLV3_DDR_IMX7, "pll_dram_main", "osc", base + 0x70, 0x7f); 412 - clks[IMX7D_PLL_SYS_MAIN] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll_sys_main", "osc", base + 0xb0, 0x1); 413 - clks[IMX7D_PLL_ENET_MAIN] = imx_clk_pllv3(IMX_PLLV3_ENET_IMX7, "pll_enet_main", "osc", base + 0xe0, 0x0); 414 - clks[IMX7D_PLL_AUDIO_MAIN] = imx_clk_pllv3(IMX_PLLV3_AV_IMX7, "pll_audio_main", "osc", base + 0xf0, 0x7f); 415 - clks[IMX7D_PLL_VIDEO_MAIN] = imx_clk_pllv3(IMX_PLLV3_AV_IMX7, "pll_video_main", "osc", base + 0x130, 0x7f); 421 + hws[IMX7D_PLL_ARM_MAIN] = imx_clk_hw_pllv3(IMX_PLLV3_SYS, "pll_arm_main", "osc", base + 0x60, 0x7f); 422 + hws[IMX7D_PLL_DRAM_MAIN] = imx_clk_hw_pllv3(IMX_PLLV3_DDR_IMX7, "pll_dram_main", "osc", base + 0x70, 0x7f); 423 + hws[IMX7D_PLL_SYS_MAIN] = imx_clk_hw_pllv3(IMX_PLLV3_GENERIC, "pll_sys_main", "osc", base + 0xb0, 0x1); 424 + hws[IMX7D_PLL_ENET_MAIN] = imx_clk_hw_pllv3(IMX_PLLV3_ENET_IMX7, "pll_enet_main", "osc", base + 0xe0, 0x0); 425 + hws[IMX7D_PLL_AUDIO_MAIN] = imx_clk_hw_pllv3(IMX_PLLV3_AV_IMX7, "pll_audio_main", "osc", base + 0xf0, 0x7f); 426 + hws[IMX7D_PLL_VIDEO_MAIN] = imx_clk_hw_pllv3(IMX_PLLV3_AV_IMX7, "pll_video_main", "osc", base + 0x130, 0x7f); 416 427 417 - clks[IMX7D_PLL_ARM_MAIN_BYPASS] = imx_clk_mux_flags("pll_arm_main_bypass", base + 0x60, 16, 1, pll_arm_bypass_sel, ARRAY_SIZE(pll_arm_bypass_sel), CLK_SET_RATE_PARENT); 418 - clks[IMX7D_PLL_DRAM_MAIN_BYPASS] = imx_clk_mux_flags("pll_dram_main_bypass", base + 0x70, 16, 1, pll_dram_bypass_sel, ARRAY_SIZE(pll_dram_bypass_sel), CLK_SET_RATE_PARENT); 419 - clks[IMX7D_PLL_SYS_MAIN_BYPASS] = imx_clk_mux_flags("pll_sys_main_bypass", base + 0xb0, 16, 1, pll_sys_bypass_sel, ARRAY_SIZE(pll_sys_bypass_sel), CLK_SET_RATE_PARENT); 420 - clks[IMX7D_PLL_ENET_MAIN_BYPASS] = imx_clk_mux_flags("pll_enet_main_bypass", base + 0xe0, 16, 1, pll_enet_bypass_sel, ARRAY_SIZE(pll_enet_bypass_sel), CLK_SET_RATE_PARENT); 421 - clks[IMX7D_PLL_AUDIO_MAIN_BYPASS] = imx_clk_mux_flags("pll_audio_main_bypass", base + 0xf0, 16, 1, pll_audio_bypass_sel, ARRAY_SIZE(pll_audio_bypass_sel), CLK_SET_RATE_PARENT); 422 - clks[IMX7D_PLL_VIDEO_MAIN_BYPASS] = imx_clk_mux_flags("pll_video_main_bypass", base + 0x130, 16, 1, pll_video_bypass_sel, ARRAY_SIZE(pll_video_bypass_sel), CLK_SET_RATE_PARENT); 428 + hws[IMX7D_PLL_ARM_MAIN_BYPASS] = imx_clk_hw_mux_flags("pll_arm_main_bypass", base + 0x60, 16, 1, pll_arm_bypass_sel, ARRAY_SIZE(pll_arm_bypass_sel), CLK_SET_RATE_PARENT); 429 + hws[IMX7D_PLL_DRAM_MAIN_BYPASS] = imx_clk_hw_mux_flags("pll_dram_main_bypass", base + 0x70, 16, 1, pll_dram_bypass_sel, ARRAY_SIZE(pll_dram_bypass_sel), CLK_SET_RATE_PARENT); 430 + hws[IMX7D_PLL_SYS_MAIN_BYPASS] = imx_clk_hw_mux_flags("pll_sys_main_bypass", base + 0xb0, 16, 1, pll_sys_bypass_sel, ARRAY_SIZE(pll_sys_bypass_sel), CLK_SET_RATE_PARENT); 431 + hws[IMX7D_PLL_ENET_MAIN_BYPASS] = imx_clk_hw_mux_flags("pll_enet_main_bypass", base + 0xe0, 16, 1, pll_enet_bypass_sel, ARRAY_SIZE(pll_enet_bypass_sel), CLK_SET_RATE_PARENT); 432 + hws[IMX7D_PLL_AUDIO_MAIN_BYPASS] = imx_clk_hw_mux_flags("pll_audio_main_bypass", base + 0xf0, 16, 1, pll_audio_bypass_sel, ARRAY_SIZE(pll_audio_bypass_sel), CLK_SET_RATE_PARENT); 433 + hws[IMX7D_PLL_VIDEO_MAIN_BYPASS] = imx_clk_hw_mux_flags("pll_video_main_bypass", base + 0x130, 16, 1, pll_video_bypass_sel, ARRAY_SIZE(pll_video_bypass_sel), CLK_SET_RATE_PARENT); 423 434 424 - clks[IMX7D_PLL_ARM_MAIN_CLK] = imx_clk_gate("pll_arm_main_clk", "pll_arm_main_bypass", base + 0x60, 13); 425 - clks[IMX7D_PLL_DRAM_MAIN_CLK] = imx_clk_gate("pll_dram_main_clk", "pll_dram_test_div", base + 0x70, 13); 426 - clks[IMX7D_PLL_SYS_MAIN_CLK] = imx_clk_gate("pll_sys_main_clk", "pll_sys_main_bypass", base + 0xb0, 13); 427 - clks[IMX7D_PLL_AUDIO_MAIN_CLK] = imx_clk_gate("pll_audio_main_clk", "pll_audio_main_bypass", base + 0xf0, 13); 428 - clks[IMX7D_PLL_VIDEO_MAIN_CLK] = imx_clk_gate("pll_video_main_clk", "pll_video_main_bypass", base + 0x130, 13); 435 + hws[IMX7D_PLL_ARM_MAIN_CLK] = imx_clk_hw_gate("pll_arm_main_clk", "pll_arm_main_bypass", base + 0x60, 13); 436 + hws[IMX7D_PLL_DRAM_MAIN_CLK] = imx_clk_hw_gate("pll_dram_main_clk", "pll_dram_test_div", base + 0x70, 13); 437 + hws[IMX7D_PLL_SYS_MAIN_CLK] = imx_clk_hw_gate("pll_sys_main_clk", "pll_sys_main_bypass", base + 0xb0, 13); 438 + hws[IMX7D_PLL_AUDIO_MAIN_CLK] = imx_clk_hw_gate("pll_audio_main_clk", "pll_audio_main_bypass", base + 0xf0, 13); 439 + hws[IMX7D_PLL_VIDEO_MAIN_CLK] = imx_clk_hw_gate("pll_video_main_clk", "pll_video_main_bypass", base + 0x130, 13); 429 440 430 - clks[IMX7D_PLL_DRAM_TEST_DIV] = clk_register_divider_table(NULL, "pll_dram_test_div", "pll_dram_main_bypass", 441 + hws[IMX7D_PLL_DRAM_TEST_DIV] = clk_hw_register_divider_table(NULL, "pll_dram_test_div", "pll_dram_main_bypass", 431 442 CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, base + 0x70, 21, 2, 0, test_div_table, &imx_ccm_lock); 432 - clks[IMX7D_PLL_AUDIO_TEST_DIV] = clk_register_divider_table(NULL, "pll_audio_test_div", "pll_audio_main_clk", 443 + hws[IMX7D_PLL_AUDIO_TEST_DIV] = clk_hw_register_divider_table(NULL, "pll_audio_test_div", "pll_audio_main_clk", 433 444 CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, base + 0xf0, 19, 2, 0, test_div_table, &imx_ccm_lock); 434 - clks[IMX7D_PLL_AUDIO_POST_DIV] = clk_register_divider_table(NULL, "pll_audio_post_div", "pll_audio_test_div", 445 + hws[IMX7D_PLL_AUDIO_POST_DIV] = clk_hw_register_divider_table(NULL, "pll_audio_post_div", "pll_audio_test_div", 435 446 CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, base + 0xf0, 22, 2, 0, post_div_table, &imx_ccm_lock); 436 - clks[IMX7D_PLL_VIDEO_TEST_DIV] = clk_register_divider_table(NULL, "pll_video_test_div", "pll_video_main_clk", 447 + hws[IMX7D_PLL_VIDEO_TEST_DIV] = clk_hw_register_divider_table(NULL, "pll_video_test_div", "pll_video_main_clk", 437 448 CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, base + 0x130, 19, 2, 0, test_div_table, &imx_ccm_lock); 438 - clks[IMX7D_PLL_VIDEO_POST_DIV] = clk_register_divider_table(NULL, "pll_video_post_div", "pll_video_test_div", 449 + hws[IMX7D_PLL_VIDEO_POST_DIV] = clk_hw_register_divider_table(NULL, "pll_video_post_div", "pll_video_test_div", 439 450 CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, base + 0x130, 22, 2, 0, post_div_table, &imx_ccm_lock); 440 451 441 - clks[IMX7D_PLL_SYS_PFD0_392M_CLK] = imx_clk_pfd("pll_sys_pfd0_392m_clk", "pll_sys_main_clk", base + 0xc0, 0); 442 - clks[IMX7D_PLL_SYS_PFD1_332M_CLK] = imx_clk_pfd("pll_sys_pfd1_332m_clk", "pll_sys_main_clk", base + 0xc0, 1); 443 - clks[IMX7D_PLL_SYS_PFD2_270M_CLK] = imx_clk_pfd("pll_sys_pfd2_270m_clk", "pll_sys_main_clk", base + 0xc0, 2); 452 + hws[IMX7D_PLL_SYS_PFD0_392M_CLK] = imx_clk_hw_pfd("pll_sys_pfd0_392m_clk", "pll_sys_main_clk", base + 0xc0, 0); 453 + hws[IMX7D_PLL_SYS_PFD1_332M_CLK] = imx_clk_hw_pfd("pll_sys_pfd1_332m_clk", "pll_sys_main_clk", base + 0xc0, 1); 454 + hws[IMX7D_PLL_SYS_PFD2_270M_CLK] = imx_clk_hw_pfd("pll_sys_pfd2_270m_clk", "pll_sys_main_clk", base + 0xc0, 2); 444 455 445 - clks[IMX7D_PLL_SYS_PFD3_CLK] = imx_clk_pfd("pll_sys_pfd3_clk", "pll_sys_main_clk", base + 0xc0, 3); 446 - clks[IMX7D_PLL_SYS_PFD4_CLK] = imx_clk_pfd("pll_sys_pfd4_clk", "pll_sys_main_clk", base + 0xd0, 0); 447 - clks[IMX7D_PLL_SYS_PFD5_CLK] = imx_clk_pfd("pll_sys_pfd5_clk", "pll_sys_main_clk", base + 0xd0, 1); 448 - clks[IMX7D_PLL_SYS_PFD6_CLK] = imx_clk_pfd("pll_sys_pfd6_clk", "pll_sys_main_clk", base + 0xd0, 2); 449 - clks[IMX7D_PLL_SYS_PFD7_CLK] = imx_clk_pfd("pll_sys_pfd7_clk", "pll_sys_main_clk", base + 0xd0, 3); 456 + hws[IMX7D_PLL_SYS_PFD3_CLK] = imx_clk_hw_pfd("pll_sys_pfd3_clk", "pll_sys_main_clk", base + 0xc0, 3); 457 + hws[IMX7D_PLL_SYS_PFD4_CLK] = imx_clk_hw_pfd("pll_sys_pfd4_clk", "pll_sys_main_clk", base + 0xd0, 0); 458 + hws[IMX7D_PLL_SYS_PFD5_CLK] = imx_clk_hw_pfd("pll_sys_pfd5_clk", "pll_sys_main_clk", base + 0xd0, 1); 459 + hws[IMX7D_PLL_SYS_PFD6_CLK] = imx_clk_hw_pfd("pll_sys_pfd6_clk", "pll_sys_main_clk", base + 0xd0, 2); 460 + hws[IMX7D_PLL_SYS_PFD7_CLK] = imx_clk_hw_pfd("pll_sys_pfd7_clk", "pll_sys_main_clk", base + 0xd0, 3); 450 461 451 - clks[IMX7D_PLL_SYS_MAIN_480M] = imx_clk_fixed_factor("pll_sys_main_480m", "pll_sys_main_clk", 1, 1); 452 - clks[IMX7D_PLL_SYS_MAIN_240M] = imx_clk_fixed_factor("pll_sys_main_240m", "pll_sys_main_clk", 1, 2); 453 - clks[IMX7D_PLL_SYS_MAIN_120M] = imx_clk_fixed_factor("pll_sys_main_120m", "pll_sys_main_clk", 1, 4); 454 - clks[IMX7D_PLL_DRAM_MAIN_533M] = imx_clk_fixed_factor("pll_dram_533m", "pll_dram_main_clk", 1, 2); 462 + hws[IMX7D_PLL_SYS_MAIN_480M] = imx_clk_hw_fixed_factor("pll_sys_main_480m", "pll_sys_main_clk", 1, 1); 463 + hws[IMX7D_PLL_SYS_MAIN_240M] = imx_clk_hw_fixed_factor("pll_sys_main_240m", "pll_sys_main_clk", 1, 2); 464 + hws[IMX7D_PLL_SYS_MAIN_120M] = imx_clk_hw_fixed_factor("pll_sys_main_120m", "pll_sys_main_clk", 1, 4); 465 + hws[IMX7D_PLL_DRAM_MAIN_533M] = imx_clk_hw_fixed_factor("pll_dram_533m", "pll_dram_main_clk", 1, 2); 455 466 456 - clks[IMX7D_PLL_SYS_MAIN_480M_CLK] = imx_clk_gate_dis_flags("pll_sys_main_480m_clk", "pll_sys_main_480m", base + 0xb0, 4, CLK_IS_CRITICAL); 457 - clks[IMX7D_PLL_SYS_MAIN_240M_CLK] = imx_clk_gate_dis("pll_sys_main_240m_clk", "pll_sys_main_240m", base + 0xb0, 5); 458 - clks[IMX7D_PLL_SYS_MAIN_120M_CLK] = imx_clk_gate_dis("pll_sys_main_120m_clk", "pll_sys_main_120m", base + 0xb0, 6); 459 - clks[IMX7D_PLL_DRAM_MAIN_533M_CLK] = imx_clk_gate("pll_dram_533m_clk", "pll_dram_533m", base + 0x70, 12); 467 + hws[IMX7D_PLL_SYS_MAIN_480M_CLK] = imx_clk_hw_gate_dis_flags("pll_sys_main_480m_clk", "pll_sys_main_480m", base + 0xb0, 4, CLK_IS_CRITICAL); 468 + hws[IMX7D_PLL_SYS_MAIN_240M_CLK] = imx_clk_hw_gate_dis("pll_sys_main_240m_clk", "pll_sys_main_240m", base + 0xb0, 5); 469 + hws[IMX7D_PLL_SYS_MAIN_120M_CLK] = imx_clk_hw_gate_dis("pll_sys_main_120m_clk", "pll_sys_main_120m", base + 0xb0, 6); 470 + hws[IMX7D_PLL_DRAM_MAIN_533M_CLK] = imx_clk_hw_gate("pll_dram_533m_clk", "pll_dram_533m", base + 0x70, 12); 460 471 461 - clks[IMX7D_PLL_SYS_PFD0_196M] = imx_clk_fixed_factor("pll_sys_pfd0_196m", "pll_sys_pfd0_392m_clk", 1, 2); 462 - clks[IMX7D_PLL_SYS_PFD1_166M] = imx_clk_fixed_factor("pll_sys_pfd1_166m", "pll_sys_pfd1_332m_clk", 1, 2); 463 - clks[IMX7D_PLL_SYS_PFD2_135M] = imx_clk_fixed_factor("pll_sys_pfd2_135m", "pll_sys_pfd2_270m_clk", 1, 2); 472 + hws[IMX7D_PLL_SYS_PFD0_196M] = imx_clk_hw_fixed_factor("pll_sys_pfd0_196m", "pll_sys_pfd0_392m_clk", 1, 2); 473 + hws[IMX7D_PLL_SYS_PFD1_166M] = imx_clk_hw_fixed_factor("pll_sys_pfd1_166m", "pll_sys_pfd1_332m_clk", 1, 2); 474 + hws[IMX7D_PLL_SYS_PFD2_135M] = imx_clk_hw_fixed_factor("pll_sys_pfd2_135m", "pll_sys_pfd2_270m_clk", 1, 2); 464 475 465 - clks[IMX7D_PLL_SYS_PFD0_196M_CLK] = imx_clk_gate_dis("pll_sys_pfd0_196m_clk", "pll_sys_pfd0_196m", base + 0xb0, 26); 466 - clks[IMX7D_PLL_SYS_PFD1_166M_CLK] = imx_clk_gate_dis("pll_sys_pfd1_166m_clk", "pll_sys_pfd1_166m", base + 0xb0, 27); 467 - clks[IMX7D_PLL_SYS_PFD2_135M_CLK] = imx_clk_gate_dis("pll_sys_pfd2_135m_clk", "pll_sys_pfd2_135m", base + 0xb0, 28); 476 + hws[IMX7D_PLL_SYS_PFD0_196M_CLK] = imx_clk_hw_gate_dis("pll_sys_pfd0_196m_clk", "pll_sys_pfd0_196m", base + 0xb0, 26); 477 + hws[IMX7D_PLL_SYS_PFD1_166M_CLK] = imx_clk_hw_gate_dis("pll_sys_pfd1_166m_clk", "pll_sys_pfd1_166m", base + 0xb0, 27); 478 + hws[IMX7D_PLL_SYS_PFD2_135M_CLK] = imx_clk_hw_gate_dis("pll_sys_pfd2_135m_clk", "pll_sys_pfd2_135m", base + 0xb0, 28); 468 479 469 - clks[IMX7D_PLL_ENET_MAIN_CLK] = imx_clk_fixed_factor("pll_enet_main_clk", "pll_enet_main_bypass", 1, 1); 470 - clks[IMX7D_PLL_ENET_MAIN_500M] = imx_clk_fixed_factor("pll_enet_500m", "pll_enet_main_clk", 1, 2); 471 - clks[IMX7D_PLL_ENET_MAIN_250M] = imx_clk_fixed_factor("pll_enet_250m", "pll_enet_main_clk", 1, 4); 472 - clks[IMX7D_PLL_ENET_MAIN_125M] = imx_clk_fixed_factor("pll_enet_125m", "pll_enet_main_clk", 1, 8); 473 - clks[IMX7D_PLL_ENET_MAIN_100M] = imx_clk_fixed_factor("pll_enet_100m", "pll_enet_main_clk", 1, 10); 474 - clks[IMX7D_PLL_ENET_MAIN_50M] = imx_clk_fixed_factor("pll_enet_50m", "pll_enet_main_clk", 1, 20); 475 - clks[IMX7D_PLL_ENET_MAIN_40M] = imx_clk_fixed_factor("pll_enet_40m", "pll_enet_main_clk", 1, 25); 476 - clks[IMX7D_PLL_ENET_MAIN_25M] = imx_clk_fixed_factor("pll_enet_25m", "pll_enet_main_clk", 1, 40); 480 + hws[IMX7D_PLL_ENET_MAIN_CLK] = imx_clk_hw_fixed_factor("pll_enet_main_clk", "pll_enet_main_bypass", 1, 1); 481 + hws[IMX7D_PLL_ENET_MAIN_500M] = imx_clk_hw_fixed_factor("pll_enet_500m", "pll_enet_main_clk", 1, 2); 482 + hws[IMX7D_PLL_ENET_MAIN_250M] = imx_clk_hw_fixed_factor("pll_enet_250m", "pll_enet_main_clk", 1, 4); 483 + hws[IMX7D_PLL_ENET_MAIN_125M] = imx_clk_hw_fixed_factor("pll_enet_125m", "pll_enet_main_clk", 1, 8); 484 + hws[IMX7D_PLL_ENET_MAIN_100M] = imx_clk_hw_fixed_factor("pll_enet_100m", "pll_enet_main_clk", 1, 10); 485 + hws[IMX7D_PLL_ENET_MAIN_50M] = imx_clk_hw_fixed_factor("pll_enet_50m", "pll_enet_main_clk", 1, 20); 486 + hws[IMX7D_PLL_ENET_MAIN_40M] = imx_clk_hw_fixed_factor("pll_enet_40m", "pll_enet_main_clk", 1, 25); 487 + hws[IMX7D_PLL_ENET_MAIN_25M] = imx_clk_hw_fixed_factor("pll_enet_25m", "pll_enet_main_clk", 1, 40); 477 488 478 - clks[IMX7D_PLL_ENET_MAIN_500M_CLK] = imx_clk_gate("pll_enet_500m_clk", "pll_enet_500m", base + 0xe0, 12); 479 - clks[IMX7D_PLL_ENET_MAIN_250M_CLK] = imx_clk_gate("pll_enet_250m_clk", "pll_enet_250m", base + 0xe0, 11); 480 - clks[IMX7D_PLL_ENET_MAIN_125M_CLK] = imx_clk_gate("pll_enet_125m_clk", "pll_enet_125m", base + 0xe0, 10); 481 - clks[IMX7D_PLL_ENET_MAIN_100M_CLK] = imx_clk_gate("pll_enet_100m_clk", "pll_enet_100m", base + 0xe0, 9); 482 - clks[IMX7D_PLL_ENET_MAIN_50M_CLK] = imx_clk_gate("pll_enet_50m_clk", "pll_enet_50m", base + 0xe0, 8); 483 - clks[IMX7D_PLL_ENET_MAIN_40M_CLK] = imx_clk_gate("pll_enet_40m_clk", "pll_enet_40m", base + 0xe0, 7); 484 - clks[IMX7D_PLL_ENET_MAIN_25M_CLK] = imx_clk_gate("pll_enet_25m_clk", "pll_enet_25m", base + 0xe0, 6); 489 + hws[IMX7D_PLL_ENET_MAIN_500M_CLK] = imx_clk_hw_gate("pll_enet_500m_clk", "pll_enet_500m", base + 0xe0, 12); 490 + hws[IMX7D_PLL_ENET_MAIN_250M_CLK] = imx_clk_hw_gate("pll_enet_250m_clk", "pll_enet_250m", base + 0xe0, 11); 491 + hws[IMX7D_PLL_ENET_MAIN_125M_CLK] = imx_clk_hw_gate("pll_enet_125m_clk", "pll_enet_125m", base + 0xe0, 10); 492 + hws[IMX7D_PLL_ENET_MAIN_100M_CLK] = imx_clk_hw_gate("pll_enet_100m_clk", "pll_enet_100m", base + 0xe0, 9); 493 + hws[IMX7D_PLL_ENET_MAIN_50M_CLK] = imx_clk_hw_gate("pll_enet_50m_clk", "pll_enet_50m", base + 0xe0, 8); 494 + hws[IMX7D_PLL_ENET_MAIN_40M_CLK] = imx_clk_hw_gate("pll_enet_40m_clk", "pll_enet_40m", base + 0xe0, 7); 495 + hws[IMX7D_PLL_ENET_MAIN_25M_CLK] = imx_clk_hw_gate("pll_enet_25m_clk", "pll_enet_25m", base + 0xe0, 6); 485 496 486 - clks[IMX7D_LVDS1_OUT_SEL] = imx_clk_mux("lvds1_sel", base + 0x170, 0, 5, lvds1_sel, ARRAY_SIZE(lvds1_sel)); 487 - clks[IMX7D_LVDS1_OUT_CLK] = imx_clk_gate_exclusive("lvds1_out", "lvds1_sel", base + 0x170, 5, BIT(6)); 497 + hws[IMX7D_LVDS1_OUT_SEL] = imx_clk_hw_mux("lvds1_sel", base + 0x170, 0, 5, lvds1_sel, ARRAY_SIZE(lvds1_sel)); 498 + hws[IMX7D_LVDS1_OUT_CLK] = imx_clk_hw_gate_exclusive("lvds1_out", "lvds1_sel", base + 0x170, 5, BIT(6)); 488 499 489 500 np = ccm_node; 490 501 base = of_iomap(np, 0); 491 502 WARN_ON(!base); 492 503 493 - clks[IMX7D_ARM_A7_ROOT_SRC] = imx_clk_mux2("arm_a7_src", base + 0x8000, 24, 3, arm_a7_sel, ARRAY_SIZE(arm_a7_sel)); 494 - clks[IMX7D_ARM_M4_ROOT_SRC] = imx_clk_mux2("arm_m4_src", base + 0x8080, 24, 3, arm_m4_sel, ARRAY_SIZE(arm_m4_sel)); 495 - clks[IMX7D_MAIN_AXI_ROOT_SRC] = imx_clk_mux2("axi_src", base + 0x8800, 24, 3, axi_sel, ARRAY_SIZE(axi_sel)); 496 - clks[IMX7D_DISP_AXI_ROOT_SRC] = imx_clk_mux2("disp_axi_src", base + 0x8880, 24, 3, disp_axi_sel, ARRAY_SIZE(disp_axi_sel)); 497 - clks[IMX7D_ENET_AXI_ROOT_SRC] = imx_clk_mux2("enet_axi_src", base + 0x8900, 24, 3, enet_axi_sel, ARRAY_SIZE(enet_axi_sel)); 498 - clks[IMX7D_NAND_USDHC_BUS_ROOT_SRC] = imx_clk_mux2("nand_usdhc_src", base + 0x8980, 24, 3, nand_usdhc_bus_sel, ARRAY_SIZE(nand_usdhc_bus_sel)); 499 - clks[IMX7D_AHB_CHANNEL_ROOT_SRC] = imx_clk_mux2("ahb_src", base + 0x9000, 24, 3, ahb_channel_sel, ARRAY_SIZE(ahb_channel_sel)); 500 - clks[IMX7D_DRAM_PHYM_ROOT_SRC] = imx_clk_mux2("dram_phym_src", base + 0x9800, 24, 1, dram_phym_sel, ARRAY_SIZE(dram_phym_sel)); 501 - clks[IMX7D_DRAM_ROOT_SRC] = imx_clk_mux2("dram_src", base + 0x9880, 24, 1, dram_sel, ARRAY_SIZE(dram_sel)); 502 - clks[IMX7D_DRAM_PHYM_ALT_ROOT_SRC] = imx_clk_mux2("dram_phym_alt_src", base + 0xa000, 24, 3, dram_phym_alt_sel, ARRAY_SIZE(dram_phym_alt_sel)); 503 - clks[IMX7D_DRAM_ALT_ROOT_SRC] = imx_clk_mux2("dram_alt_src", base + 0xa080, 24, 3, dram_alt_sel, ARRAY_SIZE(dram_alt_sel)); 504 - clks[IMX7D_USB_HSIC_ROOT_SRC] = imx_clk_mux2("usb_hsic_src", base + 0xa100, 24, 3, usb_hsic_sel, ARRAY_SIZE(usb_hsic_sel)); 505 - clks[IMX7D_PCIE_CTRL_ROOT_SRC] = imx_clk_mux2("pcie_ctrl_src", base + 0xa180, 24, 3, pcie_ctrl_sel, ARRAY_SIZE(pcie_ctrl_sel)); 506 - clks[IMX7D_PCIE_PHY_ROOT_SRC] = imx_clk_mux2("pcie_phy_src", base + 0xa200, 24, 3, pcie_phy_sel, ARRAY_SIZE(pcie_phy_sel)); 507 - clks[IMX7D_EPDC_PIXEL_ROOT_SRC] = imx_clk_mux2("epdc_pixel_src", base + 0xa280, 24, 3, epdc_pixel_sel, ARRAY_SIZE(epdc_pixel_sel)); 508 - clks[IMX7D_LCDIF_PIXEL_ROOT_SRC] = imx_clk_mux2("lcdif_pixel_src", base + 0xa300, 24, 3, lcdif_pixel_sel, ARRAY_SIZE(lcdif_pixel_sel)); 509 - clks[IMX7D_MIPI_DSI_ROOT_SRC] = imx_clk_mux2("mipi_dsi_src", base + 0xa380, 24, 3, mipi_dsi_sel, ARRAY_SIZE(mipi_dsi_sel)); 510 - clks[IMX7D_MIPI_CSI_ROOT_SRC] = imx_clk_mux2("mipi_csi_src", base + 0xa400, 24, 3, mipi_csi_sel, ARRAY_SIZE(mipi_csi_sel)); 511 - clks[IMX7D_MIPI_DPHY_ROOT_SRC] = imx_clk_mux2("mipi_dphy_src", base + 0xa480, 24, 3, mipi_dphy_sel, ARRAY_SIZE(mipi_dphy_sel)); 512 - clks[IMX7D_SAI1_ROOT_SRC] = imx_clk_mux2("sai1_src", base + 0xa500, 24, 3, sai1_sel, ARRAY_SIZE(sai1_sel)); 513 - clks[IMX7D_SAI2_ROOT_SRC] = imx_clk_mux2("sai2_src", base + 0xa580, 24, 3, sai2_sel, ARRAY_SIZE(sai2_sel)); 514 - clks[IMX7D_SAI3_ROOT_SRC] = imx_clk_mux2("sai3_src", base + 0xa600, 24, 3, sai3_sel, ARRAY_SIZE(sai3_sel)); 515 - clks[IMX7D_SPDIF_ROOT_SRC] = imx_clk_mux2("spdif_src", base + 0xa680, 24, 3, spdif_sel, ARRAY_SIZE(spdif_sel)); 516 - clks[IMX7D_ENET1_REF_ROOT_SRC] = imx_clk_mux2("enet1_ref_src", base + 0xa700, 24, 3, enet1_ref_sel, ARRAY_SIZE(enet1_ref_sel)); 517 - clks[IMX7D_ENET1_TIME_ROOT_SRC] = imx_clk_mux2("enet1_time_src", base + 0xa780, 24, 3, enet1_time_sel, ARRAY_SIZE(enet1_time_sel)); 518 - clks[IMX7D_ENET2_REF_ROOT_SRC] = imx_clk_mux2("enet2_ref_src", base + 0xa800, 24, 3, enet2_ref_sel, ARRAY_SIZE(enet2_ref_sel)); 519 - clks[IMX7D_ENET2_TIME_ROOT_SRC] = imx_clk_mux2("enet2_time_src", base + 0xa880, 24, 3, enet2_time_sel, ARRAY_SIZE(enet2_time_sel)); 520 - clks[IMX7D_ENET_PHY_REF_ROOT_SRC] = imx_clk_mux2("enet_phy_ref_src", base + 0xa900, 24, 3, enet_phy_ref_sel, ARRAY_SIZE(enet_phy_ref_sel)); 521 - clks[IMX7D_EIM_ROOT_SRC] = imx_clk_mux2("eim_src", base + 0xa980, 24, 3, eim_sel, ARRAY_SIZE(eim_sel)); 522 - clks[IMX7D_NAND_ROOT_SRC] = imx_clk_mux2("nand_src", base + 0xaa00, 24, 3, nand_sel, ARRAY_SIZE(nand_sel)); 523 - clks[IMX7D_QSPI_ROOT_SRC] = imx_clk_mux2("qspi_src", base + 0xaa80, 24, 3, qspi_sel, ARRAY_SIZE(qspi_sel)); 524 - clks[IMX7D_USDHC1_ROOT_SRC] = imx_clk_mux2("usdhc1_src", base + 0xab00, 24, 3, usdhc1_sel, ARRAY_SIZE(usdhc1_sel)); 525 - clks[IMX7D_USDHC2_ROOT_SRC] = imx_clk_mux2("usdhc2_src", base + 0xab80, 24, 3, usdhc2_sel, ARRAY_SIZE(usdhc2_sel)); 526 - clks[IMX7D_USDHC3_ROOT_SRC] = imx_clk_mux2("usdhc3_src", base + 0xac00, 24, 3, usdhc3_sel, ARRAY_SIZE(usdhc3_sel)); 527 - clks[IMX7D_CAN1_ROOT_SRC] = imx_clk_mux2("can1_src", base + 0xac80, 24, 3, can1_sel, ARRAY_SIZE(can1_sel)); 528 - clks[IMX7D_CAN2_ROOT_SRC] = imx_clk_mux2("can2_src", base + 0xad00, 24, 3, can2_sel, ARRAY_SIZE(can2_sel)); 529 - clks[IMX7D_I2C1_ROOT_SRC] = imx_clk_mux2("i2c1_src", base + 0xad80, 24, 3, i2c1_sel, ARRAY_SIZE(i2c1_sel)); 530 - clks[IMX7D_I2C2_ROOT_SRC] = imx_clk_mux2("i2c2_src", base + 0xae00, 24, 3, i2c2_sel, ARRAY_SIZE(i2c2_sel)); 531 - clks[IMX7D_I2C3_ROOT_SRC] = imx_clk_mux2("i2c3_src", base + 0xae80, 24, 3, i2c3_sel, ARRAY_SIZE(i2c3_sel)); 532 - clks[IMX7D_I2C4_ROOT_SRC] = imx_clk_mux2("i2c4_src", base + 0xaf00, 24, 3, i2c4_sel, ARRAY_SIZE(i2c4_sel)); 533 - clks[IMX7D_UART1_ROOT_SRC] = imx_clk_mux2("uart1_src", base + 0xaf80, 24, 3, uart1_sel, ARRAY_SIZE(uart1_sel)); 534 - clks[IMX7D_UART2_ROOT_SRC] = imx_clk_mux2("uart2_src", base + 0xb000, 24, 3, uart2_sel, ARRAY_SIZE(uart2_sel)); 535 - clks[IMX7D_UART3_ROOT_SRC] = imx_clk_mux2("uart3_src", base + 0xb080, 24, 3, uart3_sel, ARRAY_SIZE(uart3_sel)); 536 - clks[IMX7D_UART4_ROOT_SRC] = imx_clk_mux2("uart4_src", base + 0xb100, 24, 3, uart4_sel, ARRAY_SIZE(uart4_sel)); 537 - clks[IMX7D_UART5_ROOT_SRC] = imx_clk_mux2("uart5_src", base + 0xb180, 24, 3, uart5_sel, ARRAY_SIZE(uart5_sel)); 538 - clks[IMX7D_UART6_ROOT_SRC] = imx_clk_mux2("uart6_src", base + 0xb200, 24, 3, uart6_sel, ARRAY_SIZE(uart6_sel)); 539 - clks[IMX7D_UART7_ROOT_SRC] = imx_clk_mux2("uart7_src", base + 0xb280, 24, 3, uart7_sel, ARRAY_SIZE(uart7_sel)); 540 - clks[IMX7D_ECSPI1_ROOT_SRC] = imx_clk_mux2("ecspi1_src", base + 0xb300, 24, 3, ecspi1_sel, ARRAY_SIZE(ecspi1_sel)); 541 - clks[IMX7D_ECSPI2_ROOT_SRC] = imx_clk_mux2("ecspi2_src", base + 0xb380, 24, 3, ecspi2_sel, ARRAY_SIZE(ecspi2_sel)); 542 - clks[IMX7D_ECSPI3_ROOT_SRC] = imx_clk_mux2("ecspi3_src", base + 0xb400, 24, 3, ecspi3_sel, ARRAY_SIZE(ecspi3_sel)); 543 - clks[IMX7D_ECSPI4_ROOT_SRC] = imx_clk_mux2("ecspi4_src", base + 0xb480, 24, 3, ecspi4_sel, ARRAY_SIZE(ecspi4_sel)); 544 - clks[IMX7D_PWM1_ROOT_SRC] = imx_clk_mux2("pwm1_src", base + 0xb500, 24, 3, pwm1_sel, ARRAY_SIZE(pwm1_sel)); 545 - clks[IMX7D_PWM2_ROOT_SRC] = imx_clk_mux2("pwm2_src", base + 0xb580, 24, 3, pwm2_sel, ARRAY_SIZE(pwm2_sel)); 546 - clks[IMX7D_PWM3_ROOT_SRC] = imx_clk_mux2("pwm3_src", base + 0xb600, 24, 3, pwm3_sel, ARRAY_SIZE(pwm3_sel)); 547 - clks[IMX7D_PWM4_ROOT_SRC] = imx_clk_mux2("pwm4_src", base + 0xb680, 24, 3, pwm4_sel, ARRAY_SIZE(pwm4_sel)); 548 - clks[IMX7D_FLEXTIMER1_ROOT_SRC] = imx_clk_mux2("flextimer1_src", base + 0xb700, 24, 3, flextimer1_sel, ARRAY_SIZE(flextimer1_sel)); 549 - clks[IMX7D_FLEXTIMER2_ROOT_SRC] = imx_clk_mux2("flextimer2_src", base + 0xb780, 24, 3, flextimer2_sel, ARRAY_SIZE(flextimer2_sel)); 550 - clks[IMX7D_SIM1_ROOT_SRC] = imx_clk_mux2("sim1_src", base + 0xb800, 24, 3, sim1_sel, ARRAY_SIZE(sim1_sel)); 551 - clks[IMX7D_SIM2_ROOT_SRC] = imx_clk_mux2("sim2_src", base + 0xb880, 24, 3, sim2_sel, ARRAY_SIZE(sim2_sel)); 552 - clks[IMX7D_GPT1_ROOT_SRC] = imx_clk_mux2("gpt1_src", base + 0xb900, 24, 3, gpt1_sel, ARRAY_SIZE(gpt1_sel)); 553 - clks[IMX7D_GPT2_ROOT_SRC] = imx_clk_mux2("gpt2_src", base + 0xb980, 24, 3, gpt2_sel, ARRAY_SIZE(gpt2_sel)); 554 - clks[IMX7D_GPT3_ROOT_SRC] = imx_clk_mux2("gpt3_src", base + 0xba00, 24, 3, gpt3_sel, ARRAY_SIZE(gpt3_sel)); 555 - clks[IMX7D_GPT4_ROOT_SRC] = imx_clk_mux2("gpt4_src", base + 0xba80, 24, 3, gpt4_sel, ARRAY_SIZE(gpt4_sel)); 556 - clks[IMX7D_TRACE_ROOT_SRC] = imx_clk_mux2("trace_src", base + 0xbb00, 24, 3, trace_sel, ARRAY_SIZE(trace_sel)); 557 - clks[IMX7D_WDOG_ROOT_SRC] = imx_clk_mux2("wdog_src", base + 0xbb80, 24, 3, wdog_sel, ARRAY_SIZE(wdog_sel)); 558 - clks[IMX7D_CSI_MCLK_ROOT_SRC] = imx_clk_mux2("csi_mclk_src", base + 0xbc00, 24, 3, csi_mclk_sel, ARRAY_SIZE(csi_mclk_sel)); 559 - clks[IMX7D_AUDIO_MCLK_ROOT_SRC] = imx_clk_mux2("audio_mclk_src", base + 0xbc80, 24, 3, audio_mclk_sel, ARRAY_SIZE(audio_mclk_sel)); 560 - clks[IMX7D_WRCLK_ROOT_SRC] = imx_clk_mux2("wrclk_src", base + 0xbd00, 24, 3, wrclk_sel, ARRAY_SIZE(wrclk_sel)); 561 - clks[IMX7D_CLKO1_ROOT_SRC] = imx_clk_mux2("clko1_src", base + 0xbd80, 24, 3, clko1_sel, ARRAY_SIZE(clko1_sel)); 562 - clks[IMX7D_CLKO2_ROOT_SRC] = imx_clk_mux2("clko2_src", base + 0xbe00, 24, 3, clko2_sel, ARRAY_SIZE(clko2_sel)); 504 + hws[IMX7D_ARM_A7_ROOT_SRC] = imx_clk_hw_mux2("arm_a7_src", base + 0x8000, 24, 3, arm_a7_sel, ARRAY_SIZE(arm_a7_sel)); 505 + hws[IMX7D_ARM_M4_ROOT_SRC] = imx_clk_hw_mux2("arm_m4_src", base + 0x8080, 24, 3, arm_m4_sel, ARRAY_SIZE(arm_m4_sel)); 506 + hws[IMX7D_MAIN_AXI_ROOT_SRC] = imx_clk_hw_mux2("axi_src", base + 0x8800, 24, 3, axi_sel, ARRAY_SIZE(axi_sel)); 507 + hws[IMX7D_DISP_AXI_ROOT_SRC] = imx_clk_hw_mux2("disp_axi_src", base + 0x8880, 24, 3, disp_axi_sel, ARRAY_SIZE(disp_axi_sel)); 508 + hws[IMX7D_ENET_AXI_ROOT_SRC] = imx_clk_hw_mux2("enet_axi_src", base + 0x8900, 24, 3, enet_axi_sel, ARRAY_SIZE(enet_axi_sel)); 509 + hws[IMX7D_NAND_USDHC_BUS_ROOT_SRC] = imx_clk_hw_mux2("nand_usdhc_src", base + 0x8980, 24, 3, nand_usdhc_bus_sel, ARRAY_SIZE(nand_usdhc_bus_sel)); 510 + hws[IMX7D_AHB_CHANNEL_ROOT_SRC] = imx_clk_hw_mux2("ahb_src", base + 0x9000, 24, 3, ahb_channel_sel, ARRAY_SIZE(ahb_channel_sel)); 511 + hws[IMX7D_DRAM_PHYM_ROOT_SRC] = imx_clk_hw_mux2("dram_phym_src", base + 0x9800, 24, 1, dram_phym_sel, ARRAY_SIZE(dram_phym_sel)); 512 + hws[IMX7D_DRAM_ROOT_SRC] = imx_clk_hw_mux2("dram_src", base + 0x9880, 24, 1, dram_sel, ARRAY_SIZE(dram_sel)); 513 + hws[IMX7D_DRAM_PHYM_ALT_ROOT_SRC] = imx_clk_hw_mux2("dram_phym_alt_src", base + 0xa000, 24, 3, dram_phym_alt_sel, ARRAY_SIZE(dram_phym_alt_sel)); 514 + hws[IMX7D_DRAM_ALT_ROOT_SRC] = imx_clk_hw_mux2("dram_alt_src", base + 0xa080, 24, 3, dram_alt_sel, ARRAY_SIZE(dram_alt_sel)); 515 + hws[IMX7D_USB_HSIC_ROOT_SRC] = imx_clk_hw_mux2("usb_hsic_src", base + 0xa100, 24, 3, usb_hsic_sel, ARRAY_SIZE(usb_hsic_sel)); 516 + hws[IMX7D_PCIE_CTRL_ROOT_SRC] = imx_clk_hw_mux2("pcie_ctrl_src", base + 0xa180, 24, 3, pcie_ctrl_sel, ARRAY_SIZE(pcie_ctrl_sel)); 517 + hws[IMX7D_PCIE_PHY_ROOT_SRC] = imx_clk_hw_mux2("pcie_phy_src", base + 0xa200, 24, 3, pcie_phy_sel, ARRAY_SIZE(pcie_phy_sel)); 518 + hws[IMX7D_EPDC_PIXEL_ROOT_SRC] = imx_clk_hw_mux2("epdc_pixel_src", base + 0xa280, 24, 3, epdc_pixel_sel, ARRAY_SIZE(epdc_pixel_sel)); 519 + hws[IMX7D_LCDIF_PIXEL_ROOT_SRC] = imx_clk_hw_mux2("lcdif_pixel_src", base + 0xa300, 24, 3, lcdif_pixel_sel, ARRAY_SIZE(lcdif_pixel_sel)); 520 + hws[IMX7D_MIPI_DSI_ROOT_SRC] = imx_clk_hw_mux2("mipi_dsi_src", base + 0xa380, 24, 3, mipi_dsi_sel, ARRAY_SIZE(mipi_dsi_sel)); 521 + hws[IMX7D_MIPI_CSI_ROOT_SRC] = imx_clk_hw_mux2("mipi_csi_src", base + 0xa400, 24, 3, mipi_csi_sel, ARRAY_SIZE(mipi_csi_sel)); 522 + hws[IMX7D_MIPI_DPHY_ROOT_SRC] = imx_clk_hw_mux2("mipi_dphy_src", base + 0xa480, 24, 3, mipi_dphy_sel, ARRAY_SIZE(mipi_dphy_sel)); 523 + hws[IMX7D_SAI1_ROOT_SRC] = imx_clk_hw_mux2("sai1_src", base + 0xa500, 24, 3, sai1_sel, ARRAY_SIZE(sai1_sel)); 524 + hws[IMX7D_SAI2_ROOT_SRC] = imx_clk_hw_mux2("sai2_src", base + 0xa580, 24, 3, sai2_sel, ARRAY_SIZE(sai2_sel)); 525 + hws[IMX7D_SAI3_ROOT_SRC] = imx_clk_hw_mux2("sai3_src", base + 0xa600, 24, 3, sai3_sel, ARRAY_SIZE(sai3_sel)); 526 + hws[IMX7D_SPDIF_ROOT_SRC] = imx_clk_hw_mux2("spdif_src", base + 0xa680, 24, 3, spdif_sel, ARRAY_SIZE(spdif_sel)); 527 + hws[IMX7D_ENET1_REF_ROOT_SRC] = imx_clk_hw_mux2("enet1_ref_src", base + 0xa700, 24, 3, enet1_ref_sel, ARRAY_SIZE(enet1_ref_sel)); 528 + hws[IMX7D_ENET1_TIME_ROOT_SRC] = imx_clk_hw_mux2("enet1_time_src", base + 0xa780, 24, 3, enet1_time_sel, ARRAY_SIZE(enet1_time_sel)); 529 + hws[IMX7D_ENET2_REF_ROOT_SRC] = imx_clk_hw_mux2("enet2_ref_src", base + 0xa800, 24, 3, enet2_ref_sel, ARRAY_SIZE(enet2_ref_sel)); 530 + hws[IMX7D_ENET2_TIME_ROOT_SRC] = imx_clk_hw_mux2("enet2_time_src", base + 0xa880, 24, 3, enet2_time_sel, ARRAY_SIZE(enet2_time_sel)); 531 + hws[IMX7D_ENET_PHY_REF_ROOT_SRC] = imx_clk_hw_mux2("enet_phy_ref_src", base + 0xa900, 24, 3, enet_phy_ref_sel, ARRAY_SIZE(enet_phy_ref_sel)); 532 + hws[IMX7D_EIM_ROOT_SRC] = imx_clk_hw_mux2("eim_src", base + 0xa980, 24, 3, eim_sel, ARRAY_SIZE(eim_sel)); 533 + hws[IMX7D_NAND_ROOT_SRC] = imx_clk_hw_mux2("nand_src", base + 0xaa00, 24, 3, nand_sel, ARRAY_SIZE(nand_sel)); 534 + hws[IMX7D_QSPI_ROOT_SRC] = imx_clk_hw_mux2("qspi_src", base + 0xaa80, 24, 3, qspi_sel, ARRAY_SIZE(qspi_sel)); 535 + hws[IMX7D_USDHC1_ROOT_SRC] = imx_clk_hw_mux2("usdhc1_src", base + 0xab00, 24, 3, usdhc1_sel, ARRAY_SIZE(usdhc1_sel)); 536 + hws[IMX7D_USDHC2_ROOT_SRC] = imx_clk_hw_mux2("usdhc2_src", base + 0xab80, 24, 3, usdhc2_sel, ARRAY_SIZE(usdhc2_sel)); 537 + hws[IMX7D_USDHC3_ROOT_SRC] = imx_clk_hw_mux2("usdhc3_src", base + 0xac00, 24, 3, usdhc3_sel, ARRAY_SIZE(usdhc3_sel)); 538 + hws[IMX7D_CAN1_ROOT_SRC] = imx_clk_hw_mux2("can1_src", base + 0xac80, 24, 3, can1_sel, ARRAY_SIZE(can1_sel)); 539 + hws[IMX7D_CAN2_ROOT_SRC] = imx_clk_hw_mux2("can2_src", base + 0xad00, 24, 3, can2_sel, ARRAY_SIZE(can2_sel)); 540 + hws[IMX7D_I2C1_ROOT_SRC] = imx_clk_hw_mux2("i2c1_src", base + 0xad80, 24, 3, i2c1_sel, ARRAY_SIZE(i2c1_sel)); 541 + hws[IMX7D_I2C2_ROOT_SRC] = imx_clk_hw_mux2("i2c2_src", base + 0xae00, 24, 3, i2c2_sel, ARRAY_SIZE(i2c2_sel)); 542 + hws[IMX7D_I2C3_ROOT_SRC] = imx_clk_hw_mux2("i2c3_src", base + 0xae80, 24, 3, i2c3_sel, ARRAY_SIZE(i2c3_sel)); 543 + hws[IMX7D_I2C4_ROOT_SRC] = imx_clk_hw_mux2("i2c4_src", base + 0xaf00, 24, 3, i2c4_sel, ARRAY_SIZE(i2c4_sel)); 544 + hws[IMX7D_UART1_ROOT_SRC] = imx_clk_hw_mux2("uart1_src", base + 0xaf80, 24, 3, uart1_sel, ARRAY_SIZE(uart1_sel)); 545 + hws[IMX7D_UART2_ROOT_SRC] = imx_clk_hw_mux2("uart2_src", base + 0xb000, 24, 3, uart2_sel, ARRAY_SIZE(uart2_sel)); 546 + hws[IMX7D_UART3_ROOT_SRC] = imx_clk_hw_mux2("uart3_src", base + 0xb080, 24, 3, uart3_sel, ARRAY_SIZE(uart3_sel)); 547 + hws[IMX7D_UART4_ROOT_SRC] = imx_clk_hw_mux2("uart4_src", base + 0xb100, 24, 3, uart4_sel, ARRAY_SIZE(uart4_sel)); 548 + hws[IMX7D_UART5_ROOT_SRC] = imx_clk_hw_mux2("uart5_src", base + 0xb180, 24, 3, uart5_sel, ARRAY_SIZE(uart5_sel)); 549 + hws[IMX7D_UART6_ROOT_SRC] = imx_clk_hw_mux2("uart6_src", base + 0xb200, 24, 3, uart6_sel, ARRAY_SIZE(uart6_sel)); 550 + hws[IMX7D_UART7_ROOT_SRC] = imx_clk_hw_mux2("uart7_src", base + 0xb280, 24, 3, uart7_sel, ARRAY_SIZE(uart7_sel)); 551 + hws[IMX7D_ECSPI1_ROOT_SRC] = imx_clk_hw_mux2("ecspi1_src", base + 0xb300, 24, 3, ecspi1_sel, ARRAY_SIZE(ecspi1_sel)); 552 + hws[IMX7D_ECSPI2_ROOT_SRC] = imx_clk_hw_mux2("ecspi2_src", base + 0xb380, 24, 3, ecspi2_sel, ARRAY_SIZE(ecspi2_sel)); 553 + hws[IMX7D_ECSPI3_ROOT_SRC] = imx_clk_hw_mux2("ecspi3_src", base + 0xb400, 24, 3, ecspi3_sel, ARRAY_SIZE(ecspi3_sel)); 554 + hws[IMX7D_ECSPI4_ROOT_SRC] = imx_clk_hw_mux2("ecspi4_src", base + 0xb480, 24, 3, ecspi4_sel, ARRAY_SIZE(ecspi4_sel)); 555 + hws[IMX7D_PWM1_ROOT_SRC] = imx_clk_hw_mux2("pwm1_src", base + 0xb500, 24, 3, pwm1_sel, ARRAY_SIZE(pwm1_sel)); 556 + hws[IMX7D_PWM2_ROOT_SRC] = imx_clk_hw_mux2("pwm2_src", base + 0xb580, 24, 3, pwm2_sel, ARRAY_SIZE(pwm2_sel)); 557 + hws[IMX7D_PWM3_ROOT_SRC] = imx_clk_hw_mux2("pwm3_src", base + 0xb600, 24, 3, pwm3_sel, ARRAY_SIZE(pwm3_sel)); 558 + hws[IMX7D_PWM4_ROOT_SRC] = imx_clk_hw_mux2("pwm4_src", base + 0xb680, 24, 3, pwm4_sel, ARRAY_SIZE(pwm4_sel)); 559 + hws[IMX7D_FLEXTIMER1_ROOT_SRC] = imx_clk_hw_mux2("flextimer1_src", base + 0xb700, 24, 3, flextimer1_sel, ARRAY_SIZE(flextimer1_sel)); 560 + hws[IMX7D_FLEXTIMER2_ROOT_SRC] = imx_clk_hw_mux2("flextimer2_src", base + 0xb780, 24, 3, flextimer2_sel, ARRAY_SIZE(flextimer2_sel)); 561 + hws[IMX7D_SIM1_ROOT_SRC] = imx_clk_hw_mux2("sim1_src", base + 0xb800, 24, 3, sim1_sel, ARRAY_SIZE(sim1_sel)); 562 + hws[IMX7D_SIM2_ROOT_SRC] = imx_clk_hw_mux2("sim2_src", base + 0xb880, 24, 3, sim2_sel, ARRAY_SIZE(sim2_sel)); 563 + hws[IMX7D_GPT1_ROOT_SRC] = imx_clk_hw_mux2("gpt1_src", base + 0xb900, 24, 3, gpt1_sel, ARRAY_SIZE(gpt1_sel)); 564 + hws[IMX7D_GPT2_ROOT_SRC] = imx_clk_hw_mux2("gpt2_src", base + 0xb980, 24, 3, gpt2_sel, ARRAY_SIZE(gpt2_sel)); 565 + hws[IMX7D_GPT3_ROOT_SRC] = imx_clk_hw_mux2("gpt3_src", base + 0xba00, 24, 3, gpt3_sel, ARRAY_SIZE(gpt3_sel)); 566 + hws[IMX7D_GPT4_ROOT_SRC] = imx_clk_hw_mux2("gpt4_src", base + 0xba80, 24, 3, gpt4_sel, ARRAY_SIZE(gpt4_sel)); 567 + hws[IMX7D_TRACE_ROOT_SRC] = imx_clk_hw_mux2("trace_src", base + 0xbb00, 24, 3, trace_sel, ARRAY_SIZE(trace_sel)); 568 + hws[IMX7D_WDOG_ROOT_SRC] = imx_clk_hw_mux2("wdog_src", base + 0xbb80, 24, 3, wdog_sel, ARRAY_SIZE(wdog_sel)); 569 + hws[IMX7D_CSI_MCLK_ROOT_SRC] = imx_clk_hw_mux2("csi_mclk_src", base + 0xbc00, 24, 3, csi_mclk_sel, ARRAY_SIZE(csi_mclk_sel)); 570 + hws[IMX7D_AUDIO_MCLK_ROOT_SRC] = imx_clk_hw_mux2("audio_mclk_src", base + 0xbc80, 24, 3, audio_mclk_sel, ARRAY_SIZE(audio_mclk_sel)); 571 + hws[IMX7D_WRCLK_ROOT_SRC] = imx_clk_hw_mux2("wrclk_src", base + 0xbd00, 24, 3, wrclk_sel, ARRAY_SIZE(wrclk_sel)); 572 + hws[IMX7D_CLKO1_ROOT_SRC] = imx_clk_hw_mux2("clko1_src", base + 0xbd80, 24, 3, clko1_sel, ARRAY_SIZE(clko1_sel)); 573 + hws[IMX7D_CLKO2_ROOT_SRC] = imx_clk_hw_mux2("clko2_src", base + 0xbe00, 24, 3, clko2_sel, ARRAY_SIZE(clko2_sel)); 563 574 564 - clks[IMX7D_ARM_A7_ROOT_CG] = imx_clk_gate3("arm_a7_cg", "arm_a7_src", base + 0x8000, 28); 565 - clks[IMX7D_ARM_M4_ROOT_CG] = imx_clk_gate3("arm_m4_cg", "arm_m4_src", base + 0x8080, 28); 566 - clks[IMX7D_MAIN_AXI_ROOT_CG] = imx_clk_gate3("axi_cg", "axi_src", base + 0x8800, 28); 567 - clks[IMX7D_DISP_AXI_ROOT_CG] = imx_clk_gate3("disp_axi_cg", "disp_axi_src", base + 0x8880, 28); 568 - clks[IMX7D_ENET_AXI_ROOT_CG] = imx_clk_gate3("enet_axi_cg", "enet_axi_src", base + 0x8900, 28); 569 - clks[IMX7D_NAND_USDHC_BUS_ROOT_CG] = imx_clk_gate3("nand_usdhc_cg", "nand_usdhc_src", base + 0x8980, 28); 570 - clks[IMX7D_AHB_CHANNEL_ROOT_CG] = imx_clk_gate3("ahb_cg", "ahb_src", base + 0x9000, 28); 571 - clks[IMX7D_DRAM_PHYM_ROOT_CG] = imx_clk_gate3("dram_phym_cg", "dram_phym_src", base + 0x9800, 28); 572 - clks[IMX7D_DRAM_ROOT_CG] = imx_clk_gate3("dram_cg", "dram_src", base + 0x9880, 28); 573 - clks[IMX7D_DRAM_PHYM_ALT_ROOT_CG] = imx_clk_gate3("dram_phym_alt_cg", "dram_phym_alt_src", base + 0xa000, 28); 574 - clks[IMX7D_DRAM_ALT_ROOT_CG] = imx_clk_gate3("dram_alt_cg", "dram_alt_src", base + 0xa080, 28); 575 - clks[IMX7D_USB_HSIC_ROOT_CG] = imx_clk_gate3("usb_hsic_cg", "usb_hsic_src", base + 0xa100, 28); 576 - clks[IMX7D_PCIE_CTRL_ROOT_CG] = imx_clk_gate3("pcie_ctrl_cg", "pcie_ctrl_src", base + 0xa180, 28); 577 - clks[IMX7D_PCIE_PHY_ROOT_CG] = imx_clk_gate3("pcie_phy_cg", "pcie_phy_src", base + 0xa200, 28); 578 - clks[IMX7D_EPDC_PIXEL_ROOT_CG] = imx_clk_gate3("epdc_pixel_cg", "epdc_pixel_src", base + 0xa280, 28); 579 - clks[IMX7D_LCDIF_PIXEL_ROOT_CG] = imx_clk_gate3("lcdif_pixel_cg", "lcdif_pixel_src", base + 0xa300, 28); 580 - clks[IMX7D_MIPI_DSI_ROOT_CG] = imx_clk_gate3("mipi_dsi_cg", "mipi_dsi_src", base + 0xa380, 28); 581 - clks[IMX7D_MIPI_CSI_ROOT_CG] = imx_clk_gate3("mipi_csi_cg", "mipi_csi_src", base + 0xa400, 28); 582 - clks[IMX7D_MIPI_DPHY_ROOT_CG] = imx_clk_gate3("mipi_dphy_cg", "mipi_dphy_src", base + 0xa480, 28); 583 - clks[IMX7D_SAI1_ROOT_CG] = imx_clk_gate3("sai1_cg", "sai1_src", base + 0xa500, 28); 584 - clks[IMX7D_SAI2_ROOT_CG] = imx_clk_gate3("sai2_cg", "sai2_src", base + 0xa580, 28); 585 - clks[IMX7D_SAI3_ROOT_CG] = imx_clk_gate3("sai3_cg", "sai3_src", base + 0xa600, 28); 586 - clks[IMX7D_SPDIF_ROOT_CG] = imx_clk_gate3("spdif_cg", "spdif_src", base + 0xa680, 28); 587 - clks[IMX7D_ENET1_REF_ROOT_CG] = imx_clk_gate3("enet1_ref_cg", "enet1_ref_src", base + 0xa700, 28); 588 - clks[IMX7D_ENET1_TIME_ROOT_CG] = imx_clk_gate3("enet1_time_cg", "enet1_time_src", base + 0xa780, 28); 589 - clks[IMX7D_ENET2_REF_ROOT_CG] = imx_clk_gate3("enet2_ref_cg", "enet2_ref_src", base + 0xa800, 28); 590 - clks[IMX7D_ENET2_TIME_ROOT_CG] = imx_clk_gate3("enet2_time_cg", "enet2_time_src", base + 0xa880, 28); 591 - clks[IMX7D_ENET_PHY_REF_ROOT_CG] = imx_clk_gate3("enet_phy_ref_cg", "enet_phy_ref_src", base + 0xa900, 28); 592 - clks[IMX7D_EIM_ROOT_CG] = imx_clk_gate3("eim_cg", "eim_src", base + 0xa980, 28); 593 - clks[IMX7D_NAND_ROOT_CG] = imx_clk_gate3("nand_cg", "nand_src", base + 0xaa00, 28); 594 - clks[IMX7D_QSPI_ROOT_CG] = imx_clk_gate3("qspi_cg", "qspi_src", base + 0xaa80, 28); 595 - clks[IMX7D_USDHC1_ROOT_CG] = imx_clk_gate3("usdhc1_cg", "usdhc1_src", base + 0xab00, 28); 596 - clks[IMX7D_USDHC2_ROOT_CG] = imx_clk_gate3("usdhc2_cg", "usdhc2_src", base + 0xab80, 28); 597 - clks[IMX7D_USDHC3_ROOT_CG] = imx_clk_gate3("usdhc3_cg", "usdhc3_src", base + 0xac00, 28); 598 - clks[IMX7D_CAN1_ROOT_CG] = imx_clk_gate3("can1_cg", "can1_src", base + 0xac80, 28); 599 - clks[IMX7D_CAN2_ROOT_CG] = imx_clk_gate3("can2_cg", "can2_src", base + 0xad00, 28); 600 - clks[IMX7D_I2C1_ROOT_CG] = imx_clk_gate3("i2c1_cg", "i2c1_src", base + 0xad80, 28); 601 - clks[IMX7D_I2C2_ROOT_CG] = imx_clk_gate3("i2c2_cg", "i2c2_src", base + 0xae00, 28); 602 - clks[IMX7D_I2C3_ROOT_CG] = imx_clk_gate3("i2c3_cg", "i2c3_src", base + 0xae80, 28); 603 - clks[IMX7D_I2C4_ROOT_CG] = imx_clk_gate3("i2c4_cg", "i2c4_src", base + 0xaf00, 28); 604 - clks[IMX7D_UART1_ROOT_CG] = imx_clk_gate3("uart1_cg", "uart1_src", base + 0xaf80, 28); 605 - clks[IMX7D_UART2_ROOT_CG] = imx_clk_gate3("uart2_cg", "uart2_src", base + 0xb000, 28); 606 - clks[IMX7D_UART3_ROOT_CG] = imx_clk_gate3("uart3_cg", "uart3_src", base + 0xb080, 28); 607 - clks[IMX7D_UART4_ROOT_CG] = imx_clk_gate3("uart4_cg", "uart4_src", base + 0xb100, 28); 608 - clks[IMX7D_UART5_ROOT_CG] = imx_clk_gate3("uart5_cg", "uart5_src", base + 0xb180, 28); 609 - clks[IMX7D_UART6_ROOT_CG] = imx_clk_gate3("uart6_cg", "uart6_src", base + 0xb200, 28); 610 - clks[IMX7D_UART7_ROOT_CG] = imx_clk_gate3("uart7_cg", "uart7_src", base + 0xb280, 28); 611 - clks[IMX7D_ECSPI1_ROOT_CG] = imx_clk_gate3("ecspi1_cg", "ecspi1_src", base + 0xb300, 28); 612 - clks[IMX7D_ECSPI2_ROOT_CG] = imx_clk_gate3("ecspi2_cg", "ecspi2_src", base + 0xb380, 28); 613 - clks[IMX7D_ECSPI3_ROOT_CG] = imx_clk_gate3("ecspi3_cg", "ecspi3_src", base + 0xb400, 28); 614 - clks[IMX7D_ECSPI4_ROOT_CG] = imx_clk_gate3("ecspi4_cg", "ecspi4_src", base + 0xb480, 28); 615 - clks[IMX7D_PWM1_ROOT_CG] = imx_clk_gate3("pwm1_cg", "pwm1_src", base + 0xb500, 28); 616 - clks[IMX7D_PWM2_ROOT_CG] = imx_clk_gate3("pwm2_cg", "pwm2_src", base + 0xb580, 28); 617 - clks[IMX7D_PWM3_ROOT_CG] = imx_clk_gate3("pwm3_cg", "pwm3_src", base + 0xb600, 28); 618 - clks[IMX7D_PWM4_ROOT_CG] = imx_clk_gate3("pwm4_cg", "pwm4_src", base + 0xb680, 28); 619 - clks[IMX7D_FLEXTIMER1_ROOT_CG] = imx_clk_gate3("flextimer1_cg", "flextimer1_src", base + 0xb700, 28); 620 - clks[IMX7D_FLEXTIMER2_ROOT_CG] = imx_clk_gate3("flextimer2_cg", "flextimer2_src", base + 0xb780, 28); 621 - clks[IMX7D_SIM1_ROOT_CG] = imx_clk_gate3("sim1_cg", "sim1_src", base + 0xb800, 28); 622 - clks[IMX7D_SIM2_ROOT_CG] = imx_clk_gate3("sim2_cg", "sim2_src", base + 0xb880, 28); 623 - clks[IMX7D_GPT1_ROOT_CG] = imx_clk_gate3("gpt1_cg", "gpt1_src", base + 0xb900, 28); 624 - clks[IMX7D_GPT2_ROOT_CG] = imx_clk_gate3("gpt2_cg", "gpt2_src", base + 0xb980, 28); 625 - clks[IMX7D_GPT3_ROOT_CG] = imx_clk_gate3("gpt3_cg", "gpt3_src", base + 0xbA00, 28); 626 - clks[IMX7D_GPT4_ROOT_CG] = imx_clk_gate3("gpt4_cg", "gpt4_src", base + 0xbA80, 28); 627 - clks[IMX7D_TRACE_ROOT_CG] = imx_clk_gate3("trace_cg", "trace_src", base + 0xbb00, 28); 628 - clks[IMX7D_WDOG_ROOT_CG] = imx_clk_gate3("wdog_cg", "wdog_src", base + 0xbb80, 28); 629 - clks[IMX7D_CSI_MCLK_ROOT_CG] = imx_clk_gate3("csi_mclk_cg", "csi_mclk_src", base + 0xbc00, 28); 630 - clks[IMX7D_AUDIO_MCLK_ROOT_CG] = imx_clk_gate3("audio_mclk_cg", "audio_mclk_src", base + 0xbc80, 28); 631 - clks[IMX7D_WRCLK_ROOT_CG] = imx_clk_gate3("wrclk_cg", "wrclk_src", base + 0xbd00, 28); 632 - clks[IMX7D_CLKO1_ROOT_CG] = imx_clk_gate3("clko1_cg", "clko1_src", base + 0xbd80, 28); 633 - clks[IMX7D_CLKO2_ROOT_CG] = imx_clk_gate3("clko2_cg", "clko2_src", base + 0xbe00, 28); 575 + hws[IMX7D_ARM_A7_ROOT_CG] = imx_clk_hw_gate3("arm_a7_cg", "arm_a7_src", base + 0x8000, 28); 576 + hws[IMX7D_ARM_M4_ROOT_CG] = imx_clk_hw_gate3("arm_m4_cg", "arm_m4_src", base + 0x8080, 28); 577 + hws[IMX7D_MAIN_AXI_ROOT_CG] = imx_clk_hw_gate3("axi_cg", "axi_src", base + 0x8800, 28); 578 + hws[IMX7D_DISP_AXI_ROOT_CG] = imx_clk_hw_gate3("disp_axi_cg", "disp_axi_src", base + 0x8880, 28); 579 + hws[IMX7D_ENET_AXI_ROOT_CG] = imx_clk_hw_gate3("enet_axi_cg", "enet_axi_src", base + 0x8900, 28); 580 + hws[IMX7D_NAND_USDHC_BUS_ROOT_CG] = imx_clk_hw_gate3("nand_usdhc_cg", "nand_usdhc_src", base + 0x8980, 28); 581 + hws[IMX7D_AHB_CHANNEL_ROOT_CG] = imx_clk_hw_gate3("ahb_cg", "ahb_src", base + 0x9000, 28); 582 + hws[IMX7D_DRAM_PHYM_ROOT_CG] = imx_clk_hw_gate3("dram_phym_cg", "dram_phym_src", base + 0x9800, 28); 583 + hws[IMX7D_DRAM_ROOT_CG] = imx_clk_hw_gate3("dram_cg", "dram_src", base + 0x9880, 28); 584 + hws[IMX7D_DRAM_PHYM_ALT_ROOT_CG] = imx_clk_hw_gate3("dram_phym_alt_cg", "dram_phym_alt_src", base + 0xa000, 28); 585 + hws[IMX7D_DRAM_ALT_ROOT_CG] = imx_clk_hw_gate3("dram_alt_cg", "dram_alt_src", base + 0xa080, 28); 586 + hws[IMX7D_USB_HSIC_ROOT_CG] = imx_clk_hw_gate3("usb_hsic_cg", "usb_hsic_src", base + 0xa100, 28); 587 + hws[IMX7D_PCIE_CTRL_ROOT_CG] = imx_clk_hw_gate3("pcie_ctrl_cg", "pcie_ctrl_src", base + 0xa180, 28); 588 + hws[IMX7D_PCIE_PHY_ROOT_CG] = imx_clk_hw_gate3("pcie_phy_cg", "pcie_phy_src", base + 0xa200, 28); 589 + hws[IMX7D_EPDC_PIXEL_ROOT_CG] = imx_clk_hw_gate3("epdc_pixel_cg", "epdc_pixel_src", base + 0xa280, 28); 590 + hws[IMX7D_LCDIF_PIXEL_ROOT_CG] = imx_clk_hw_gate3("lcdif_pixel_cg", "lcdif_pixel_src", base + 0xa300, 28); 591 + hws[IMX7D_MIPI_DSI_ROOT_CG] = imx_clk_hw_gate3("mipi_dsi_cg", "mipi_dsi_src", base + 0xa380, 28); 592 + hws[IMX7D_MIPI_CSI_ROOT_CG] = imx_clk_hw_gate3("mipi_csi_cg", "mipi_csi_src", base + 0xa400, 28); 593 + hws[IMX7D_MIPI_DPHY_ROOT_CG] = imx_clk_hw_gate3("mipi_dphy_cg", "mipi_dphy_src", base + 0xa480, 28); 594 + hws[IMX7D_SAI1_ROOT_CG] = imx_clk_hw_gate3("sai1_cg", "sai1_src", base + 0xa500, 28); 595 + hws[IMX7D_SAI2_ROOT_CG] = imx_clk_hw_gate3("sai2_cg", "sai2_src", base + 0xa580, 28); 596 + hws[IMX7D_SAI3_ROOT_CG] = imx_clk_hw_gate3("sai3_cg", "sai3_src", base + 0xa600, 28); 597 + hws[IMX7D_SPDIF_ROOT_CG] = imx_clk_hw_gate3("spdif_cg", "spdif_src", base + 0xa680, 28); 598 + hws[IMX7D_ENET1_REF_ROOT_CG] = imx_clk_hw_gate3("enet1_ref_cg", "enet1_ref_src", base + 0xa700, 28); 599 + hws[IMX7D_ENET1_TIME_ROOT_CG] = imx_clk_hw_gate3("enet1_time_cg", "enet1_time_src", base + 0xa780, 28); 600 + hws[IMX7D_ENET2_REF_ROOT_CG] = imx_clk_hw_gate3("enet2_ref_cg", "enet2_ref_src", base + 0xa800, 28); 601 + hws[IMX7D_ENET2_TIME_ROOT_CG] = imx_clk_hw_gate3("enet2_time_cg", "enet2_time_src", base + 0xa880, 28); 602 + hws[IMX7D_ENET_PHY_REF_ROOT_CG] = imx_clk_hw_gate3("enet_phy_ref_cg", "enet_phy_ref_src", base + 0xa900, 28); 603 + hws[IMX7D_EIM_ROOT_CG] = imx_clk_hw_gate3("eim_cg", "eim_src", base + 0xa980, 28); 604 + hws[IMX7D_NAND_ROOT_CG] = imx_clk_hw_gate3("nand_cg", "nand_src", base + 0xaa00, 28); 605 + hws[IMX7D_QSPI_ROOT_CG] = imx_clk_hw_gate3("qspi_cg", "qspi_src", base + 0xaa80, 28); 606 + hws[IMX7D_USDHC1_ROOT_CG] = imx_clk_hw_gate3("usdhc1_cg", "usdhc1_src", base + 0xab00, 28); 607 + hws[IMX7D_USDHC2_ROOT_CG] = imx_clk_hw_gate3("usdhc2_cg", "usdhc2_src", base + 0xab80, 28); 608 + hws[IMX7D_USDHC3_ROOT_CG] = imx_clk_hw_gate3("usdhc3_cg", "usdhc3_src", base + 0xac00, 28); 609 + hws[IMX7D_CAN1_ROOT_CG] = imx_clk_hw_gate3("can1_cg", "can1_src", base + 0xac80, 28); 610 + hws[IMX7D_CAN2_ROOT_CG] = imx_clk_hw_gate3("can2_cg", "can2_src", base + 0xad00, 28); 611 + hws[IMX7D_I2C1_ROOT_CG] = imx_clk_hw_gate3("i2c1_cg", "i2c1_src", base + 0xad80, 28); 612 + hws[IMX7D_I2C2_ROOT_CG] = imx_clk_hw_gate3("i2c2_cg", "i2c2_src", base + 0xae00, 28); 613 + hws[IMX7D_I2C3_ROOT_CG] = imx_clk_hw_gate3("i2c3_cg", "i2c3_src", base + 0xae80, 28); 614 + hws[IMX7D_I2C4_ROOT_CG] = imx_clk_hw_gate3("i2c4_cg", "i2c4_src", base + 0xaf00, 28); 615 + hws[IMX7D_UART1_ROOT_CG] = imx_clk_hw_gate3("uart1_cg", "uart1_src", base + 0xaf80, 28); 616 + hws[IMX7D_UART2_ROOT_CG] = imx_clk_hw_gate3("uart2_cg", "uart2_src", base + 0xb000, 28); 617 + hws[IMX7D_UART3_ROOT_CG] = imx_clk_hw_gate3("uart3_cg", "uart3_src", base + 0xb080, 28); 618 + hws[IMX7D_UART4_ROOT_CG] = imx_clk_hw_gate3("uart4_cg", "uart4_src", base + 0xb100, 28); 619 + hws[IMX7D_UART5_ROOT_CG] = imx_clk_hw_gate3("uart5_cg", "uart5_src", base + 0xb180, 28); 620 + hws[IMX7D_UART6_ROOT_CG] = imx_clk_hw_gate3("uart6_cg", "uart6_src", base + 0xb200, 28); 621 + hws[IMX7D_UART7_ROOT_CG] = imx_clk_hw_gate3("uart7_cg", "uart7_src", base + 0xb280, 28); 622 + hws[IMX7D_ECSPI1_ROOT_CG] = imx_clk_hw_gate3("ecspi1_cg", "ecspi1_src", base + 0xb300, 28); 623 + hws[IMX7D_ECSPI2_ROOT_CG] = imx_clk_hw_gate3("ecspi2_cg", "ecspi2_src", base + 0xb380, 28); 624 + hws[IMX7D_ECSPI3_ROOT_CG] = imx_clk_hw_gate3("ecspi3_cg", "ecspi3_src", base + 0xb400, 28); 625 + hws[IMX7D_ECSPI4_ROOT_CG] = imx_clk_hw_gate3("ecspi4_cg", "ecspi4_src", base + 0xb480, 28); 626 + hws[IMX7D_PWM1_ROOT_CG] = imx_clk_hw_gate3("pwm1_cg", "pwm1_src", base + 0xb500, 28); 627 + hws[IMX7D_PWM2_ROOT_CG] = imx_clk_hw_gate3("pwm2_cg", "pwm2_src", base + 0xb580, 28); 628 + hws[IMX7D_PWM3_ROOT_CG] = imx_clk_hw_gate3("pwm3_cg", "pwm3_src", base + 0xb600, 28); 629 + hws[IMX7D_PWM4_ROOT_CG] = imx_clk_hw_gate3("pwm4_cg", "pwm4_src", base + 0xb680, 28); 630 + hws[IMX7D_FLEXTIMER1_ROOT_CG] = imx_clk_hw_gate3("flextimer1_cg", "flextimer1_src", base + 0xb700, 28); 631 + hws[IMX7D_FLEXTIMER2_ROOT_CG] = imx_clk_hw_gate3("flextimer2_cg", "flextimer2_src", base + 0xb780, 28); 632 + hws[IMX7D_SIM1_ROOT_CG] = imx_clk_hw_gate3("sim1_cg", "sim1_src", base + 0xb800, 28); 633 + hws[IMX7D_SIM2_ROOT_CG] = imx_clk_hw_gate3("sim2_cg", "sim2_src", base + 0xb880, 28); 634 + hws[IMX7D_GPT1_ROOT_CG] = imx_clk_hw_gate3("gpt1_cg", "gpt1_src", base + 0xb900, 28); 635 + hws[IMX7D_GPT2_ROOT_CG] = imx_clk_hw_gate3("gpt2_cg", "gpt2_src", base + 0xb980, 28); 636 + hws[IMX7D_GPT3_ROOT_CG] = imx_clk_hw_gate3("gpt3_cg", "gpt3_src", base + 0xbA00, 28); 637 + hws[IMX7D_GPT4_ROOT_CG] = imx_clk_hw_gate3("gpt4_cg", "gpt4_src", base + 0xbA80, 28); 638 + hws[IMX7D_TRACE_ROOT_CG] = imx_clk_hw_gate3("trace_cg", "trace_src", base + 0xbb00, 28); 639 + hws[IMX7D_WDOG_ROOT_CG] = imx_clk_hw_gate3("wdog_cg", "wdog_src", base + 0xbb80, 28); 640 + hws[IMX7D_CSI_MCLK_ROOT_CG] = imx_clk_hw_gate3("csi_mclk_cg", "csi_mclk_src", base + 0xbc00, 28); 641 + hws[IMX7D_AUDIO_MCLK_ROOT_CG] = imx_clk_hw_gate3("audio_mclk_cg", "audio_mclk_src", base + 0xbc80, 28); 642 + hws[IMX7D_WRCLK_ROOT_CG] = imx_clk_hw_gate3("wrclk_cg", "wrclk_src", base + 0xbd00, 28); 643 + hws[IMX7D_CLKO1_ROOT_CG] = imx_clk_hw_gate3("clko1_cg", "clko1_src", base + 0xbd80, 28); 644 + hws[IMX7D_CLKO2_ROOT_CG] = imx_clk_hw_gate3("clko2_cg", "clko2_src", base + 0xbe00, 28); 634 645 635 - clks[IMX7D_MAIN_AXI_ROOT_PRE_DIV] = imx_clk_divider2("axi_pre_div", "axi_cg", base + 0x8800, 16, 3); 636 - clks[IMX7D_DISP_AXI_ROOT_PRE_DIV] = imx_clk_divider2("disp_axi_pre_div", "disp_axi_cg", base + 0x8880, 16, 3); 637 - clks[IMX7D_ENET_AXI_ROOT_PRE_DIV] = imx_clk_divider2("enet_axi_pre_div", "enet_axi_cg", base + 0x8900, 16, 3); 638 - clks[IMX7D_NAND_USDHC_BUS_ROOT_PRE_DIV] = imx_clk_divider2("nand_usdhc_pre_div", "nand_usdhc_cg", base + 0x8980, 16, 3); 639 - clks[IMX7D_AHB_CHANNEL_ROOT_PRE_DIV] = imx_clk_divider2("ahb_pre_div", "ahb_cg", base + 0x9000, 16, 3); 640 - clks[IMX7D_DRAM_PHYM_ALT_ROOT_PRE_DIV] = imx_clk_divider2("dram_phym_alt_pre_div", "dram_phym_alt_cg", base + 0xa000, 16, 3); 641 - clks[IMX7D_DRAM_ALT_ROOT_PRE_DIV] = imx_clk_divider2("dram_alt_pre_div", "dram_alt_cg", base + 0xa080, 16, 3); 642 - clks[IMX7D_USB_HSIC_ROOT_PRE_DIV] = imx_clk_divider2("usb_hsic_pre_div", "usb_hsic_cg", base + 0xa100, 16, 3); 643 - clks[IMX7D_PCIE_CTRL_ROOT_PRE_DIV] = imx_clk_divider2("pcie_ctrl_pre_div", "pcie_ctrl_cg", base + 0xa180, 16, 3); 644 - clks[IMX7D_PCIE_PHY_ROOT_PRE_DIV] = imx_clk_divider2("pcie_phy_pre_div", "pcie_phy_cg", base + 0xa200, 16, 3); 645 - clks[IMX7D_EPDC_PIXEL_ROOT_PRE_DIV] = imx_clk_divider2("epdc_pixel_pre_div", "epdc_pixel_cg", base + 0xa280, 16, 3); 646 - clks[IMX7D_LCDIF_PIXEL_ROOT_PRE_DIV] = imx_clk_divider2("lcdif_pixel_pre_div", "lcdif_pixel_cg", base + 0xa300, 16, 3); 647 - clks[IMX7D_MIPI_DSI_ROOT_PRE_DIV] = imx_clk_divider2("mipi_dsi_pre_div", "mipi_dsi_cg", base + 0xa380, 16, 3); 648 - clks[IMX7D_MIPI_CSI_ROOT_PRE_DIV] = imx_clk_divider2("mipi_csi_pre_div", "mipi_csi_cg", base + 0xa400, 16, 3); 649 - clks[IMX7D_MIPI_DPHY_ROOT_PRE_DIV] = imx_clk_divider2("mipi_dphy_pre_div", "mipi_dphy_cg", base + 0xa480, 16, 3); 650 - clks[IMX7D_SAI1_ROOT_PRE_DIV] = imx_clk_divider2("sai1_pre_div", "sai1_cg", base + 0xa500, 16, 3); 651 - clks[IMX7D_SAI2_ROOT_PRE_DIV] = imx_clk_divider2("sai2_pre_div", "sai2_cg", base + 0xa580, 16, 3); 652 - clks[IMX7D_SAI3_ROOT_PRE_DIV] = imx_clk_divider2("sai3_pre_div", "sai3_cg", base + 0xa600, 16, 3); 653 - clks[IMX7D_SPDIF_ROOT_PRE_DIV] = imx_clk_divider2("spdif_pre_div", "spdif_cg", base + 0xa680, 16, 3); 654 - clks[IMX7D_ENET1_REF_ROOT_PRE_DIV] = imx_clk_divider2("enet1_ref_pre_div", "enet1_ref_cg", base + 0xa700, 16, 3); 655 - clks[IMX7D_ENET1_TIME_ROOT_PRE_DIV] = imx_clk_divider2("enet1_time_pre_div", "enet1_time_cg", base + 0xa780, 16, 3); 656 - clks[IMX7D_ENET2_REF_ROOT_PRE_DIV] = imx_clk_divider2("enet2_ref_pre_div", "enet2_ref_cg", base + 0xa800, 16, 3); 657 - clks[IMX7D_ENET2_TIME_ROOT_PRE_DIV] = imx_clk_divider2("enet2_time_pre_div", "enet2_time_cg", base + 0xa880, 16, 3); 658 - clks[IMX7D_ENET_PHY_REF_ROOT_PRE_DIV] = imx_clk_divider2("enet_phy_ref_pre_div", "enet_phy_ref_cg", base + 0xa900, 16, 3); 659 - clks[IMX7D_EIM_ROOT_PRE_DIV] = imx_clk_divider2("eim_pre_div", "eim_cg", base + 0xa980, 16, 3); 660 - clks[IMX7D_NAND_ROOT_PRE_DIV] = imx_clk_divider2("nand_pre_div", "nand_cg", base + 0xaa00, 16, 3); 661 - clks[IMX7D_QSPI_ROOT_PRE_DIV] = imx_clk_divider2("qspi_pre_div", "qspi_cg", base + 0xaa80, 16, 3); 662 - clks[IMX7D_USDHC1_ROOT_PRE_DIV] = imx_clk_divider2("usdhc1_pre_div", "usdhc1_cg", base + 0xab00, 16, 3); 663 - clks[IMX7D_USDHC2_ROOT_PRE_DIV] = imx_clk_divider2("usdhc2_pre_div", "usdhc2_cg", base + 0xab80, 16, 3); 664 - clks[IMX7D_USDHC3_ROOT_PRE_DIV] = imx_clk_divider2("usdhc3_pre_div", "usdhc3_cg", base + 0xac00, 16, 3); 665 - clks[IMX7D_CAN1_ROOT_PRE_DIV] = imx_clk_divider2("can1_pre_div", "can1_cg", base + 0xac80, 16, 3); 666 - clks[IMX7D_CAN2_ROOT_PRE_DIV] = imx_clk_divider2("can2_pre_div", "can2_cg", base + 0xad00, 16, 3); 667 - clks[IMX7D_I2C1_ROOT_PRE_DIV] = imx_clk_divider2("i2c1_pre_div", "i2c1_cg", base + 0xad80, 16, 3); 668 - clks[IMX7D_I2C2_ROOT_PRE_DIV] = imx_clk_divider2("i2c2_pre_div", "i2c2_cg", base + 0xae00, 16, 3); 669 - clks[IMX7D_I2C3_ROOT_PRE_DIV] = imx_clk_divider2("i2c3_pre_div", "i2c3_cg", base + 0xae80, 16, 3); 670 - clks[IMX7D_I2C4_ROOT_PRE_DIV] = imx_clk_divider2("i2c4_pre_div", "i2c4_cg", base + 0xaf00, 16, 3); 671 - clks[IMX7D_UART1_ROOT_PRE_DIV] = imx_clk_divider2("uart1_pre_div", "uart1_cg", base + 0xaf80, 16, 3); 672 - clks[IMX7D_UART2_ROOT_PRE_DIV] = imx_clk_divider2("uart2_pre_div", "uart2_cg", base + 0xb000, 16, 3); 673 - clks[IMX7D_UART3_ROOT_PRE_DIV] = imx_clk_divider2("uart3_pre_div", "uart3_cg", base + 0xb080, 16, 3); 674 - clks[IMX7D_UART4_ROOT_PRE_DIV] = imx_clk_divider2("uart4_pre_div", "uart4_cg", base + 0xb100, 16, 3); 675 - clks[IMX7D_UART5_ROOT_PRE_DIV] = imx_clk_divider2("uart5_pre_div", "uart5_cg", base + 0xb180, 16, 3); 676 - clks[IMX7D_UART6_ROOT_PRE_DIV] = imx_clk_divider2("uart6_pre_div", "uart6_cg", base + 0xb200, 16, 3); 677 - clks[IMX7D_UART7_ROOT_PRE_DIV] = imx_clk_divider2("uart7_pre_div", "uart7_cg", base + 0xb280, 16, 3); 678 - clks[IMX7D_ECSPI1_ROOT_PRE_DIV] = imx_clk_divider2("ecspi1_pre_div", "ecspi1_cg", base + 0xb300, 16, 3); 679 - clks[IMX7D_ECSPI2_ROOT_PRE_DIV] = imx_clk_divider2("ecspi2_pre_div", "ecspi2_cg", base + 0xb380, 16, 3); 680 - clks[IMX7D_ECSPI3_ROOT_PRE_DIV] = imx_clk_divider2("ecspi3_pre_div", "ecspi3_cg", base + 0xb400, 16, 3); 681 - clks[IMX7D_ECSPI4_ROOT_PRE_DIV] = imx_clk_divider2("ecspi4_pre_div", "ecspi4_cg", base + 0xb480, 16, 3); 682 - clks[IMX7D_PWM1_ROOT_PRE_DIV] = imx_clk_divider2("pwm1_pre_div", "pwm1_cg", base + 0xb500, 16, 3); 683 - clks[IMX7D_PWM2_ROOT_PRE_DIV] = imx_clk_divider2("pwm2_pre_div", "pwm2_cg", base + 0xb580, 16, 3); 684 - clks[IMX7D_PWM3_ROOT_PRE_DIV] = imx_clk_divider2("pwm3_pre_div", "pwm3_cg", base + 0xb600, 16, 3); 685 - clks[IMX7D_PWM4_ROOT_PRE_DIV] = imx_clk_divider2("pwm4_pre_div", "pwm4_cg", base + 0xb680, 16, 3); 686 - clks[IMX7D_FLEXTIMER1_ROOT_PRE_DIV] = imx_clk_divider2("flextimer1_pre_div", "flextimer1_cg", base + 0xb700, 16, 3); 687 - clks[IMX7D_FLEXTIMER2_ROOT_PRE_DIV] = imx_clk_divider2("flextimer2_pre_div", "flextimer2_cg", base + 0xb780, 16, 3); 688 - clks[IMX7D_SIM1_ROOT_PRE_DIV] = imx_clk_divider2("sim1_pre_div", "sim1_cg", base + 0xb800, 16, 3); 689 - clks[IMX7D_SIM2_ROOT_PRE_DIV] = imx_clk_divider2("sim2_pre_div", "sim2_cg", base + 0xb880, 16, 3); 690 - clks[IMX7D_GPT1_ROOT_PRE_DIV] = imx_clk_divider2("gpt1_pre_div", "gpt1_cg", base + 0xb900, 16, 3); 691 - clks[IMX7D_GPT2_ROOT_PRE_DIV] = imx_clk_divider2("gpt2_pre_div", "gpt2_cg", base + 0xb980, 16, 3); 692 - clks[IMX7D_GPT3_ROOT_PRE_DIV] = imx_clk_divider2("gpt3_pre_div", "gpt3_cg", base + 0xba00, 16, 3); 693 - clks[IMX7D_GPT4_ROOT_PRE_DIV] = imx_clk_divider2("gpt4_pre_div", "gpt4_cg", base + 0xba80, 16, 3); 694 - clks[IMX7D_TRACE_ROOT_PRE_DIV] = imx_clk_divider2("trace_pre_div", "trace_cg", base + 0xbb00, 16, 3); 695 - clks[IMX7D_WDOG_ROOT_PRE_DIV] = imx_clk_divider2("wdog_pre_div", "wdog_cg", base + 0xbb80, 16, 3); 696 - clks[IMX7D_CSI_MCLK_ROOT_PRE_DIV] = imx_clk_divider2("csi_mclk_pre_div", "csi_mclk_cg", base + 0xbc00, 16, 3); 697 - clks[IMX7D_AUDIO_MCLK_ROOT_PRE_DIV] = imx_clk_divider2("audio_mclk_pre_div", "audio_mclk_cg", base + 0xbc80, 16, 3); 698 - clks[IMX7D_WRCLK_ROOT_PRE_DIV] = imx_clk_divider2("wrclk_pre_div", "wrclk_cg", base + 0xbd00, 16, 3); 699 - clks[IMX7D_CLKO1_ROOT_PRE_DIV] = imx_clk_divider2("clko1_pre_div", "clko1_cg", base + 0xbd80, 16, 3); 700 - clks[IMX7D_CLKO2_ROOT_PRE_DIV] = imx_clk_divider2("clko2_pre_div", "clko2_cg", base + 0xbe00, 16, 3); 646 + hws[IMX7D_MAIN_AXI_ROOT_PRE_DIV] = imx_clk_hw_divider2("axi_pre_div", "axi_cg", base + 0x8800, 16, 3); 647 + hws[IMX7D_DISP_AXI_ROOT_PRE_DIV] = imx_clk_hw_divider2("disp_axi_pre_div", "disp_axi_cg", base + 0x8880, 16, 3); 648 + hws[IMX7D_ENET_AXI_ROOT_PRE_DIV] = imx_clk_hw_divider2("enet_axi_pre_div", "enet_axi_cg", base + 0x8900, 16, 3); 649 + hws[IMX7D_NAND_USDHC_BUS_ROOT_PRE_DIV] = imx_clk_hw_divider2("nand_usdhc_pre_div", "nand_usdhc_cg", base + 0x8980, 16, 3); 650 + hws[IMX7D_AHB_CHANNEL_ROOT_PRE_DIV] = imx_clk_hw_divider2("ahb_pre_div", "ahb_cg", base + 0x9000, 16, 3); 651 + hws[IMX7D_DRAM_PHYM_ALT_ROOT_PRE_DIV] = imx_clk_hw_divider2("dram_phym_alt_pre_div", "dram_phym_alt_cg", base + 0xa000, 16, 3); 652 + hws[IMX7D_DRAM_ALT_ROOT_PRE_DIV] = imx_clk_hw_divider2("dram_alt_pre_div", "dram_alt_cg", base + 0xa080, 16, 3); 653 + hws[IMX7D_USB_HSIC_ROOT_PRE_DIV] = imx_clk_hw_divider2("usb_hsic_pre_div", "usb_hsic_cg", base + 0xa100, 16, 3); 654 + hws[IMX7D_PCIE_CTRL_ROOT_PRE_DIV] = imx_clk_hw_divider2("pcie_ctrl_pre_div", "pcie_ctrl_cg", base + 0xa180, 16, 3); 655 + hws[IMX7D_PCIE_PHY_ROOT_PRE_DIV] = imx_clk_hw_divider2("pcie_phy_pre_div", "pcie_phy_cg", base + 0xa200, 16, 3); 656 + hws[IMX7D_EPDC_PIXEL_ROOT_PRE_DIV] = imx_clk_hw_divider2("epdc_pixel_pre_div", "epdc_pixel_cg", base + 0xa280, 16, 3); 657 + hws[IMX7D_LCDIF_PIXEL_ROOT_PRE_DIV] = imx_clk_hw_divider2("lcdif_pixel_pre_div", "lcdif_pixel_cg", base + 0xa300, 16, 3); 658 + hws[IMX7D_MIPI_DSI_ROOT_PRE_DIV] = imx_clk_hw_divider2("mipi_dsi_pre_div", "mipi_dsi_cg", base + 0xa380, 16, 3); 659 + hws[IMX7D_MIPI_CSI_ROOT_PRE_DIV] = imx_clk_hw_divider2("mipi_csi_pre_div", "mipi_csi_cg", base + 0xa400, 16, 3); 660 + hws[IMX7D_MIPI_DPHY_ROOT_PRE_DIV] = imx_clk_hw_divider2("mipi_dphy_pre_div", "mipi_dphy_cg", base + 0xa480, 16, 3); 661 + hws[IMX7D_SAI1_ROOT_PRE_DIV] = imx_clk_hw_divider2("sai1_pre_div", "sai1_cg", base + 0xa500, 16, 3); 662 + hws[IMX7D_SAI2_ROOT_PRE_DIV] = imx_clk_hw_divider2("sai2_pre_div", "sai2_cg", base + 0xa580, 16, 3); 663 + hws[IMX7D_SAI3_ROOT_PRE_DIV] = imx_clk_hw_divider2("sai3_pre_div", "sai3_cg", base + 0xa600, 16, 3); 664 + hws[IMX7D_SPDIF_ROOT_PRE_DIV] = imx_clk_hw_divider2("spdif_pre_div", "spdif_cg", base + 0xa680, 16, 3); 665 + hws[IMX7D_ENET1_REF_ROOT_PRE_DIV] = imx_clk_hw_divider2("enet1_ref_pre_div", "enet1_ref_cg", base + 0xa700, 16, 3); 666 + hws[IMX7D_ENET1_TIME_ROOT_PRE_DIV] = imx_clk_hw_divider2("enet1_time_pre_div", "enet1_time_cg", base + 0xa780, 16, 3); 667 + hws[IMX7D_ENET2_REF_ROOT_PRE_DIV] = imx_clk_hw_divider2("enet2_ref_pre_div", "enet2_ref_cg", base + 0xa800, 16, 3); 668 + hws[IMX7D_ENET2_TIME_ROOT_PRE_DIV] = imx_clk_hw_divider2("enet2_time_pre_div", "enet2_time_cg", base + 0xa880, 16, 3); 669 + hws[IMX7D_ENET_PHY_REF_ROOT_PRE_DIV] = imx_clk_hw_divider2("enet_phy_ref_pre_div", "enet_phy_ref_cg", base + 0xa900, 16, 3); 670 + hws[IMX7D_EIM_ROOT_PRE_DIV] = imx_clk_hw_divider2("eim_pre_div", "eim_cg", base + 0xa980, 16, 3); 671 + hws[IMX7D_NAND_ROOT_PRE_DIV] = imx_clk_hw_divider2("nand_pre_div", "nand_cg", base + 0xaa00, 16, 3); 672 + hws[IMX7D_QSPI_ROOT_PRE_DIV] = imx_clk_hw_divider2("qspi_pre_div", "qspi_cg", base + 0xaa80, 16, 3); 673 + hws[IMX7D_USDHC1_ROOT_PRE_DIV] = imx_clk_hw_divider2("usdhc1_pre_div", "usdhc1_cg", base + 0xab00, 16, 3); 674 + hws[IMX7D_USDHC2_ROOT_PRE_DIV] = imx_clk_hw_divider2("usdhc2_pre_div", "usdhc2_cg", base + 0xab80, 16, 3); 675 + hws[IMX7D_USDHC3_ROOT_PRE_DIV] = imx_clk_hw_divider2("usdhc3_pre_div", "usdhc3_cg", base + 0xac00, 16, 3); 676 + hws[IMX7D_CAN1_ROOT_PRE_DIV] = imx_clk_hw_divider2("can1_pre_div", "can1_cg", base + 0xac80, 16, 3); 677 + hws[IMX7D_CAN2_ROOT_PRE_DIV] = imx_clk_hw_divider2("can2_pre_div", "can2_cg", base + 0xad00, 16, 3); 678 + hws[IMX7D_I2C1_ROOT_PRE_DIV] = imx_clk_hw_divider2("i2c1_pre_div", "i2c1_cg", base + 0xad80, 16, 3); 679 + hws[IMX7D_I2C2_ROOT_PRE_DIV] = imx_clk_hw_divider2("i2c2_pre_div", "i2c2_cg", base + 0xae00, 16, 3); 680 + hws[IMX7D_I2C3_ROOT_PRE_DIV] = imx_clk_hw_divider2("i2c3_pre_div", "i2c3_cg", base + 0xae80, 16, 3); 681 + hws[IMX7D_I2C4_ROOT_PRE_DIV] = imx_clk_hw_divider2("i2c4_pre_div", "i2c4_cg", base + 0xaf00, 16, 3); 682 + hws[IMX7D_UART1_ROOT_PRE_DIV] = imx_clk_hw_divider2("uart1_pre_div", "uart1_cg", base + 0xaf80, 16, 3); 683 + hws[IMX7D_UART2_ROOT_PRE_DIV] = imx_clk_hw_divider2("uart2_pre_div", "uart2_cg", base + 0xb000, 16, 3); 684 + hws[IMX7D_UART3_ROOT_PRE_DIV] = imx_clk_hw_divider2("uart3_pre_div", "uart3_cg", base + 0xb080, 16, 3); 685 + hws[IMX7D_UART4_ROOT_PRE_DIV] = imx_clk_hw_divider2("uart4_pre_div", "uart4_cg", base + 0xb100, 16, 3); 686 + hws[IMX7D_UART5_ROOT_PRE_DIV] = imx_clk_hw_divider2("uart5_pre_div", "uart5_cg", base + 0xb180, 16, 3); 687 + hws[IMX7D_UART6_ROOT_PRE_DIV] = imx_clk_hw_divider2("uart6_pre_div", "uart6_cg", base + 0xb200, 16, 3); 688 + hws[IMX7D_UART7_ROOT_PRE_DIV] = imx_clk_hw_divider2("uart7_pre_div", "uart7_cg", base + 0xb280, 16, 3); 689 + hws[IMX7D_ECSPI1_ROOT_PRE_DIV] = imx_clk_hw_divider2("ecspi1_pre_div", "ecspi1_cg", base + 0xb300, 16, 3); 690 + hws[IMX7D_ECSPI2_ROOT_PRE_DIV] = imx_clk_hw_divider2("ecspi2_pre_div", "ecspi2_cg", base + 0xb380, 16, 3); 691 + hws[IMX7D_ECSPI3_ROOT_PRE_DIV] = imx_clk_hw_divider2("ecspi3_pre_div", "ecspi3_cg", base + 0xb400, 16, 3); 692 + hws[IMX7D_ECSPI4_ROOT_PRE_DIV] = imx_clk_hw_divider2("ecspi4_pre_div", "ecspi4_cg", base + 0xb480, 16, 3); 693 + hws[IMX7D_PWM1_ROOT_PRE_DIV] = imx_clk_hw_divider2("pwm1_pre_div", "pwm1_cg", base + 0xb500, 16, 3); 694 + hws[IMX7D_PWM2_ROOT_PRE_DIV] = imx_clk_hw_divider2("pwm2_pre_div", "pwm2_cg", base + 0xb580, 16, 3); 695 + hws[IMX7D_PWM3_ROOT_PRE_DIV] = imx_clk_hw_divider2("pwm3_pre_div", "pwm3_cg", base + 0xb600, 16, 3); 696 + hws[IMX7D_PWM4_ROOT_PRE_DIV] = imx_clk_hw_divider2("pwm4_pre_div", "pwm4_cg", base + 0xb680, 16, 3); 697 + hws[IMX7D_FLEXTIMER1_ROOT_PRE_DIV] = imx_clk_hw_divider2("flextimer1_pre_div", "flextimer1_cg", base + 0xb700, 16, 3); 698 + hws[IMX7D_FLEXTIMER2_ROOT_PRE_DIV] = imx_clk_hw_divider2("flextimer2_pre_div", "flextimer2_cg", base + 0xb780, 16, 3); 699 + hws[IMX7D_SIM1_ROOT_PRE_DIV] = imx_clk_hw_divider2("sim1_pre_div", "sim1_cg", base + 0xb800, 16, 3); 700 + hws[IMX7D_SIM2_ROOT_PRE_DIV] = imx_clk_hw_divider2("sim2_pre_div", "sim2_cg", base + 0xb880, 16, 3); 701 + hws[IMX7D_GPT1_ROOT_PRE_DIV] = imx_clk_hw_divider2("gpt1_pre_div", "gpt1_cg", base + 0xb900, 16, 3); 702 + hws[IMX7D_GPT2_ROOT_PRE_DIV] = imx_clk_hw_divider2("gpt2_pre_div", "gpt2_cg", base + 0xb980, 16, 3); 703 + hws[IMX7D_GPT3_ROOT_PRE_DIV] = imx_clk_hw_divider2("gpt3_pre_div", "gpt3_cg", base + 0xba00, 16, 3); 704 + hws[IMX7D_GPT4_ROOT_PRE_DIV] = imx_clk_hw_divider2("gpt4_pre_div", "gpt4_cg", base + 0xba80, 16, 3); 705 + hws[IMX7D_TRACE_ROOT_PRE_DIV] = imx_clk_hw_divider2("trace_pre_div", "trace_cg", base + 0xbb00, 16, 3); 706 + hws[IMX7D_WDOG_ROOT_PRE_DIV] = imx_clk_hw_divider2("wdog_pre_div", "wdog_cg", base + 0xbb80, 16, 3); 707 + hws[IMX7D_CSI_MCLK_ROOT_PRE_DIV] = imx_clk_hw_divider2("csi_mclk_pre_div", "csi_mclk_cg", base + 0xbc00, 16, 3); 708 + hws[IMX7D_AUDIO_MCLK_ROOT_PRE_DIV] = imx_clk_hw_divider2("audio_mclk_pre_div", "audio_mclk_cg", base + 0xbc80, 16, 3); 709 + hws[IMX7D_WRCLK_ROOT_PRE_DIV] = imx_clk_hw_divider2("wrclk_pre_div", "wrclk_cg", base + 0xbd00, 16, 3); 710 + hws[IMX7D_CLKO1_ROOT_PRE_DIV] = imx_clk_hw_divider2("clko1_pre_div", "clko1_cg", base + 0xbd80, 16, 3); 711 + hws[IMX7D_CLKO2_ROOT_PRE_DIV] = imx_clk_hw_divider2("clko2_pre_div", "clko2_cg", base + 0xbe00, 16, 3); 701 712 702 - clks[IMX7D_ARM_A7_ROOT_DIV] = imx_clk_divider2("arm_a7_div", "arm_a7_cg", base + 0x8000, 0, 3); 703 - clks[IMX7D_ARM_M4_ROOT_DIV] = imx_clk_divider2("arm_m4_div", "arm_m4_cg", base + 0x8080, 0, 3); 704 - clks[IMX7D_MAIN_AXI_ROOT_DIV] = imx_clk_divider2("axi_post_div", "axi_pre_div", base + 0x8800, 0, 6); 705 - clks[IMX7D_DISP_AXI_ROOT_DIV] = imx_clk_divider2("disp_axi_post_div", "disp_axi_pre_div", base + 0x8880, 0, 6); 706 - clks[IMX7D_ENET_AXI_ROOT_DIV] = imx_clk_divider2("enet_axi_post_div", "enet_axi_pre_div", base + 0x8900, 0, 6); 707 - clks[IMX7D_NAND_USDHC_BUS_ROOT_CLK] = imx_clk_divider2("nand_usdhc_root_clk", "nand_usdhc_pre_div", base + 0x8980, 0, 6); 708 - clks[IMX7D_AHB_CHANNEL_ROOT_DIV] = imx_clk_divider2("ahb_root_clk", "ahb_pre_div", base + 0x9000, 0, 6); 709 - clks[IMX7D_IPG_ROOT_CLK] = imx_clk_divider_flags("ipg_root_clk", "ahb_root_clk", base + 0x9080, 0, 2, CLK_IS_CRITICAL | CLK_OPS_PARENT_ENABLE | CLK_SET_RATE_PARENT); 710 - clks[IMX7D_DRAM_ROOT_DIV] = imx_clk_divider2("dram_post_div", "dram_cg", base + 0x9880, 0, 3); 711 - clks[IMX7D_DRAM_PHYM_ALT_ROOT_DIV] = imx_clk_divider2("dram_phym_alt_post_div", "dram_phym_alt_pre_div", base + 0xa000, 0, 3); 712 - clks[IMX7D_DRAM_ALT_ROOT_DIV] = imx_clk_divider2("dram_alt_post_div", "dram_alt_pre_div", base + 0xa080, 0, 3); 713 - clks[IMX7D_USB_HSIC_ROOT_DIV] = imx_clk_divider2("usb_hsic_post_div", "usb_hsic_pre_div", base + 0xa100, 0, 6); 714 - clks[IMX7D_PCIE_CTRL_ROOT_DIV] = imx_clk_divider2("pcie_ctrl_post_div", "pcie_ctrl_pre_div", base + 0xa180, 0, 6); 715 - clks[IMX7D_PCIE_PHY_ROOT_DIV] = imx_clk_divider2("pcie_phy_post_div", "pcie_phy_pre_div", base + 0xa200, 0, 6); 716 - clks[IMX7D_EPDC_PIXEL_ROOT_DIV] = imx_clk_divider2("epdc_pixel_post_div", "epdc_pixel_pre_div", base + 0xa280, 0, 6); 717 - clks[IMX7D_LCDIF_PIXEL_ROOT_DIV] = imx_clk_divider2("lcdif_pixel_post_div", "lcdif_pixel_pre_div", base + 0xa300, 0, 6); 718 - clks[IMX7D_MIPI_DSI_ROOT_DIV] = imx_clk_divider2("mipi_dsi_post_div", "mipi_dsi_pre_div", base + 0xa380, 0, 6); 719 - clks[IMX7D_MIPI_CSI_ROOT_DIV] = imx_clk_divider2("mipi_csi_post_div", "mipi_csi_pre_div", base + 0xa400, 0, 6); 720 - clks[IMX7D_MIPI_DPHY_ROOT_DIV] = imx_clk_divider2("mipi_dphy_post_div", "mipi_dphy_pre_div", base + 0xa480, 0, 6); 721 - clks[IMX7D_SAI1_ROOT_DIV] = imx_clk_divider2("sai1_post_div", "sai1_pre_div", base + 0xa500, 0, 6); 722 - clks[IMX7D_SAI2_ROOT_DIV] = imx_clk_divider2("sai2_post_div", "sai2_pre_div", base + 0xa580, 0, 6); 723 - clks[IMX7D_SAI3_ROOT_DIV] = imx_clk_divider2("sai3_post_div", "sai3_pre_div", base + 0xa600, 0, 6); 724 - clks[IMX7D_SPDIF_ROOT_DIV] = imx_clk_divider2("spdif_post_div", "spdif_pre_div", base + 0xa680, 0, 6); 725 - clks[IMX7D_ENET1_REF_ROOT_DIV] = imx_clk_divider2("enet1_ref_post_div", "enet1_ref_pre_div", base + 0xa700, 0, 6); 726 - clks[IMX7D_ENET1_TIME_ROOT_DIV] = imx_clk_divider2("enet1_time_post_div", "enet1_time_pre_div", base + 0xa780, 0, 6); 727 - clks[IMX7D_ENET2_REF_ROOT_DIV] = imx_clk_divider2("enet2_ref_post_div", "enet2_ref_pre_div", base + 0xa800, 0, 6); 728 - clks[IMX7D_ENET2_TIME_ROOT_DIV] = imx_clk_divider2("enet2_time_post_div", "enet2_time_pre_div", base + 0xa880, 0, 6); 729 - clks[IMX7D_ENET_PHY_REF_ROOT_CLK] = imx_clk_divider2("enet_phy_ref_root_clk", "enet_phy_ref_pre_div", base + 0xa900, 0, 6); 730 - clks[IMX7D_EIM_ROOT_DIV] = imx_clk_divider2("eim_post_div", "eim_pre_div", base + 0xa980, 0, 6); 731 - clks[IMX7D_NAND_ROOT_CLK] = imx_clk_divider2("nand_root_clk", "nand_pre_div", base + 0xaa00, 0, 6); 732 - clks[IMX7D_QSPI_ROOT_DIV] = imx_clk_divider2("qspi_post_div", "qspi_pre_div", base + 0xaa80, 0, 6); 733 - clks[IMX7D_USDHC1_ROOT_DIV] = imx_clk_divider2("usdhc1_post_div", "usdhc1_pre_div", base + 0xab00, 0, 6); 734 - clks[IMX7D_USDHC2_ROOT_DIV] = imx_clk_divider2("usdhc2_post_div", "usdhc2_pre_div", base + 0xab80, 0, 6); 735 - clks[IMX7D_USDHC3_ROOT_DIV] = imx_clk_divider2("usdhc3_post_div", "usdhc3_pre_div", base + 0xac00, 0, 6); 736 - clks[IMX7D_CAN1_ROOT_DIV] = imx_clk_divider2("can1_post_div", "can1_pre_div", base + 0xac80, 0, 6); 737 - clks[IMX7D_CAN2_ROOT_DIV] = imx_clk_divider2("can2_post_div", "can2_pre_div", base + 0xad00, 0, 6); 738 - clks[IMX7D_I2C1_ROOT_DIV] = imx_clk_divider2("i2c1_post_div", "i2c1_pre_div", base + 0xad80, 0, 6); 739 - clks[IMX7D_I2C2_ROOT_DIV] = imx_clk_divider2("i2c2_post_div", "i2c2_pre_div", base + 0xae00, 0, 6); 740 - clks[IMX7D_I2C3_ROOT_DIV] = imx_clk_divider2("i2c3_post_div", "i2c3_pre_div", base + 0xae80, 0, 6); 741 - clks[IMX7D_I2C4_ROOT_DIV] = imx_clk_divider2("i2c4_post_div", "i2c4_pre_div", base + 0xaf00, 0, 6); 742 - clks[IMX7D_UART1_ROOT_DIV] = imx_clk_divider2("uart1_post_div", "uart1_pre_div", base + 0xaf80, 0, 6); 743 - clks[IMX7D_UART2_ROOT_DIV] = imx_clk_divider2("uart2_post_div", "uart2_pre_div", base + 0xb000, 0, 6); 744 - clks[IMX7D_UART3_ROOT_DIV] = imx_clk_divider2("uart3_post_div", "uart3_pre_div", base + 0xb080, 0, 6); 745 - clks[IMX7D_UART4_ROOT_DIV] = imx_clk_divider2("uart4_post_div", "uart4_pre_div", base + 0xb100, 0, 6); 746 - clks[IMX7D_UART5_ROOT_DIV] = imx_clk_divider2("uart5_post_div", "uart5_pre_div", base + 0xb180, 0, 6); 747 - clks[IMX7D_UART6_ROOT_DIV] = imx_clk_divider2("uart6_post_div", "uart6_pre_div", base + 0xb200, 0, 6); 748 - clks[IMX7D_UART7_ROOT_DIV] = imx_clk_divider2("uart7_post_div", "uart7_pre_div", base + 0xb280, 0, 6); 749 - clks[IMX7D_ECSPI1_ROOT_DIV] = imx_clk_divider2("ecspi1_post_div", "ecspi1_pre_div", base + 0xb300, 0, 6); 750 - clks[IMX7D_ECSPI2_ROOT_DIV] = imx_clk_divider2("ecspi2_post_div", "ecspi2_pre_div", base + 0xb380, 0, 6); 751 - clks[IMX7D_ECSPI3_ROOT_DIV] = imx_clk_divider2("ecspi3_post_div", "ecspi3_pre_div", base + 0xb400, 0, 6); 752 - clks[IMX7D_ECSPI4_ROOT_DIV] = imx_clk_divider2("ecspi4_post_div", "ecspi4_pre_div", base + 0xb480, 0, 6); 753 - clks[IMX7D_PWM1_ROOT_DIV] = imx_clk_divider2("pwm1_post_div", "pwm1_pre_div", base + 0xb500, 0, 6); 754 - clks[IMX7D_PWM2_ROOT_DIV] = imx_clk_divider2("pwm2_post_div", "pwm2_pre_div", base + 0xb580, 0, 6); 755 - clks[IMX7D_PWM3_ROOT_DIV] = imx_clk_divider2("pwm3_post_div", "pwm3_pre_div", base + 0xb600, 0, 6); 756 - clks[IMX7D_PWM4_ROOT_DIV] = imx_clk_divider2("pwm4_post_div", "pwm4_pre_div", base + 0xb680, 0, 6); 757 - clks[IMX7D_FLEXTIMER1_ROOT_DIV] = imx_clk_divider2("flextimer1_post_div", "flextimer1_pre_div", base + 0xb700, 0, 6); 758 - clks[IMX7D_FLEXTIMER2_ROOT_DIV] = imx_clk_divider2("flextimer2_post_div", "flextimer2_pre_div", base + 0xb780, 0, 6); 759 - clks[IMX7D_SIM1_ROOT_DIV] = imx_clk_divider2("sim1_post_div", "sim1_pre_div", base + 0xb800, 0, 6); 760 - clks[IMX7D_SIM2_ROOT_DIV] = imx_clk_divider2("sim2_post_div", "sim2_pre_div", base + 0xb880, 0, 6); 761 - clks[IMX7D_GPT1_ROOT_DIV] = imx_clk_divider2("gpt1_post_div", "gpt1_pre_div", base + 0xb900, 0, 6); 762 - clks[IMX7D_GPT2_ROOT_DIV] = imx_clk_divider2("gpt2_post_div", "gpt2_pre_div", base + 0xb980, 0, 6); 763 - clks[IMX7D_GPT3_ROOT_DIV] = imx_clk_divider2("gpt3_post_div", "gpt3_pre_div", base + 0xba00, 0, 6); 764 - clks[IMX7D_GPT4_ROOT_DIV] = imx_clk_divider2("gpt4_post_div", "gpt4_pre_div", base + 0xba80, 0, 6); 765 - clks[IMX7D_TRACE_ROOT_DIV] = imx_clk_divider2("trace_post_div", "trace_pre_div", base + 0xbb00, 0, 6); 766 - clks[IMX7D_WDOG_ROOT_DIV] = imx_clk_divider2("wdog_post_div", "wdog_pre_div", base + 0xbb80, 0, 6); 767 - clks[IMX7D_CSI_MCLK_ROOT_DIV] = imx_clk_divider2("csi_mclk_post_div", "csi_mclk_pre_div", base + 0xbc00, 0, 6); 768 - clks[IMX7D_AUDIO_MCLK_ROOT_DIV] = imx_clk_divider2("audio_mclk_post_div", "audio_mclk_pre_div", base + 0xbc80, 0, 6); 769 - clks[IMX7D_WRCLK_ROOT_DIV] = imx_clk_divider2("wrclk_post_div", "wrclk_pre_div", base + 0xbd00, 0, 6); 770 - clks[IMX7D_CLKO1_ROOT_DIV] = imx_clk_divider2("clko1_post_div", "clko1_pre_div", base + 0xbd80, 0, 6); 771 - clks[IMX7D_CLKO2_ROOT_DIV] = imx_clk_divider2("clko2_post_div", "clko2_pre_div", base + 0xbe00, 0, 6); 713 + hws[IMX7D_ARM_A7_ROOT_DIV] = imx_clk_hw_divider2("arm_a7_div", "arm_a7_cg", base + 0x8000, 0, 3); 714 + hws[IMX7D_ARM_M4_ROOT_DIV] = imx_clk_hw_divider2("arm_m4_div", "arm_m4_cg", base + 0x8080, 0, 3); 715 + hws[IMX7D_MAIN_AXI_ROOT_DIV] = imx_clk_hw_divider2("axi_post_div", "axi_pre_div", base + 0x8800, 0, 6); 716 + hws[IMX7D_DISP_AXI_ROOT_DIV] = imx_clk_hw_divider2("disp_axi_post_div", "disp_axi_pre_div", base + 0x8880, 0, 6); 717 + hws[IMX7D_ENET_AXI_ROOT_DIV] = imx_clk_hw_divider2("enet_axi_post_div", "enet_axi_pre_div", base + 0x8900, 0, 6); 718 + hws[IMX7D_NAND_USDHC_BUS_ROOT_CLK] = imx_clk_hw_divider2("nand_usdhc_root_clk", "nand_usdhc_pre_div", base + 0x8980, 0, 6); 719 + hws[IMX7D_AHB_CHANNEL_ROOT_DIV] = imx_clk_hw_divider2("ahb_root_clk", "ahb_pre_div", base + 0x9000, 0, 6); 720 + hws[IMX7D_IPG_ROOT_CLK] = imx_clk_hw_divider_flags("ipg_root_clk", "ahb_root_clk", base + 0x9080, 0, 2, CLK_IS_CRITICAL | CLK_OPS_PARENT_ENABLE | CLK_SET_RATE_PARENT); 721 + hws[IMX7D_DRAM_ROOT_DIV] = imx_clk_hw_divider2("dram_post_div", "dram_cg", base + 0x9880, 0, 3); 722 + hws[IMX7D_DRAM_PHYM_ALT_ROOT_DIV] = imx_clk_hw_divider2("dram_phym_alt_post_div", "dram_phym_alt_pre_div", base + 0xa000, 0, 3); 723 + hws[IMX7D_DRAM_ALT_ROOT_DIV] = imx_clk_hw_divider2("dram_alt_post_div", "dram_alt_pre_div", base + 0xa080, 0, 3); 724 + hws[IMX7D_USB_HSIC_ROOT_DIV] = imx_clk_hw_divider2("usb_hsic_post_div", "usb_hsic_pre_div", base + 0xa100, 0, 6); 725 + hws[IMX7D_PCIE_CTRL_ROOT_DIV] = imx_clk_hw_divider2("pcie_ctrl_post_div", "pcie_ctrl_pre_div", base + 0xa180, 0, 6); 726 + hws[IMX7D_PCIE_PHY_ROOT_DIV] = imx_clk_hw_divider2("pcie_phy_post_div", "pcie_phy_pre_div", base + 0xa200, 0, 6); 727 + hws[IMX7D_EPDC_PIXEL_ROOT_DIV] = imx_clk_hw_divider2("epdc_pixel_post_div", "epdc_pixel_pre_div", base + 0xa280, 0, 6); 728 + hws[IMX7D_LCDIF_PIXEL_ROOT_DIV] = imx_clk_hw_divider2("lcdif_pixel_post_div", "lcdif_pixel_pre_div", base + 0xa300, 0, 6); 729 + hws[IMX7D_MIPI_DSI_ROOT_DIV] = imx_clk_hw_divider2("mipi_dsi_post_div", "mipi_dsi_pre_div", base + 0xa380, 0, 6); 730 + hws[IMX7D_MIPI_CSI_ROOT_DIV] = imx_clk_hw_divider2("mipi_csi_post_div", "mipi_csi_pre_div", base + 0xa400, 0, 6); 731 + hws[IMX7D_MIPI_DPHY_ROOT_DIV] = imx_clk_hw_divider2("mipi_dphy_post_div", "mipi_dphy_pre_div", base + 0xa480, 0, 6); 732 + hws[IMX7D_SAI1_ROOT_DIV] = imx_clk_hw_divider2("sai1_post_div", "sai1_pre_div", base + 0xa500, 0, 6); 733 + hws[IMX7D_SAI2_ROOT_DIV] = imx_clk_hw_divider2("sai2_post_div", "sai2_pre_div", base + 0xa580, 0, 6); 734 + hws[IMX7D_SAI3_ROOT_DIV] = imx_clk_hw_divider2("sai3_post_div", "sai3_pre_div", base + 0xa600, 0, 6); 735 + hws[IMX7D_SPDIF_ROOT_DIV] = imx_clk_hw_divider2("spdif_post_div", "spdif_pre_div", base + 0xa680, 0, 6); 736 + hws[IMX7D_ENET1_REF_ROOT_DIV] = imx_clk_hw_divider2("enet1_ref_post_div", "enet1_ref_pre_div", base + 0xa700, 0, 6); 737 + hws[IMX7D_ENET1_TIME_ROOT_DIV] = imx_clk_hw_divider2("enet1_time_post_div", "enet1_time_pre_div", base + 0xa780, 0, 6); 738 + hws[IMX7D_ENET2_REF_ROOT_DIV] = imx_clk_hw_divider2("enet2_ref_post_div", "enet2_ref_pre_div", base + 0xa800, 0, 6); 739 + hws[IMX7D_ENET2_TIME_ROOT_DIV] = imx_clk_hw_divider2("enet2_time_post_div", "enet2_time_pre_div", base + 0xa880, 0, 6); 740 + hws[IMX7D_ENET_PHY_REF_ROOT_CLK] = imx_clk_hw_divider2("enet_phy_ref_root_clk", "enet_phy_ref_pre_div", base + 0xa900, 0, 6); 741 + hws[IMX7D_EIM_ROOT_DIV] = imx_clk_hw_divider2("eim_post_div", "eim_pre_div", base + 0xa980, 0, 6); 742 + hws[IMX7D_NAND_ROOT_CLK] = imx_clk_hw_divider2("nand_root_clk", "nand_pre_div", base + 0xaa00, 0, 6); 743 + hws[IMX7D_QSPI_ROOT_DIV] = imx_clk_hw_divider2("qspi_post_div", "qspi_pre_div", base + 0xaa80, 0, 6); 744 + hws[IMX7D_USDHC1_ROOT_DIV] = imx_clk_hw_divider2("usdhc1_post_div", "usdhc1_pre_div", base + 0xab00, 0, 6); 745 + hws[IMX7D_USDHC2_ROOT_DIV] = imx_clk_hw_divider2("usdhc2_post_div", "usdhc2_pre_div", base + 0xab80, 0, 6); 746 + hws[IMX7D_USDHC3_ROOT_DIV] = imx_clk_hw_divider2("usdhc3_post_div", "usdhc3_pre_div", base + 0xac00, 0, 6); 747 + hws[IMX7D_CAN1_ROOT_DIV] = imx_clk_hw_divider2("can1_post_div", "can1_pre_div", base + 0xac80, 0, 6); 748 + hws[IMX7D_CAN2_ROOT_DIV] = imx_clk_hw_divider2("can2_post_div", "can2_pre_div", base + 0xad00, 0, 6); 749 + hws[IMX7D_I2C1_ROOT_DIV] = imx_clk_hw_divider2("i2c1_post_div", "i2c1_pre_div", base + 0xad80, 0, 6); 750 + hws[IMX7D_I2C2_ROOT_DIV] = imx_clk_hw_divider2("i2c2_post_div", "i2c2_pre_div", base + 0xae00, 0, 6); 751 + hws[IMX7D_I2C3_ROOT_DIV] = imx_clk_hw_divider2("i2c3_post_div", "i2c3_pre_div", base + 0xae80, 0, 6); 752 + hws[IMX7D_I2C4_ROOT_DIV] = imx_clk_hw_divider2("i2c4_post_div", "i2c4_pre_div", base + 0xaf00, 0, 6); 753 + hws[IMX7D_UART1_ROOT_DIV] = imx_clk_hw_divider2("uart1_post_div", "uart1_pre_div", base + 0xaf80, 0, 6); 754 + hws[IMX7D_UART2_ROOT_DIV] = imx_clk_hw_divider2("uart2_post_div", "uart2_pre_div", base + 0xb000, 0, 6); 755 + hws[IMX7D_UART3_ROOT_DIV] = imx_clk_hw_divider2("uart3_post_div", "uart3_pre_div", base + 0xb080, 0, 6); 756 + hws[IMX7D_UART4_ROOT_DIV] = imx_clk_hw_divider2("uart4_post_div", "uart4_pre_div", base + 0xb100, 0, 6); 757 + hws[IMX7D_UART5_ROOT_DIV] = imx_clk_hw_divider2("uart5_post_div", "uart5_pre_div", base + 0xb180, 0, 6); 758 + hws[IMX7D_UART6_ROOT_DIV] = imx_clk_hw_divider2("uart6_post_div", "uart6_pre_div", base + 0xb200, 0, 6); 759 + hws[IMX7D_UART7_ROOT_DIV] = imx_clk_hw_divider2("uart7_post_div", "uart7_pre_div", base + 0xb280, 0, 6); 760 + hws[IMX7D_ECSPI1_ROOT_DIV] = imx_clk_hw_divider2("ecspi1_post_div", "ecspi1_pre_div", base + 0xb300, 0, 6); 761 + hws[IMX7D_ECSPI2_ROOT_DIV] = imx_clk_hw_divider2("ecspi2_post_div", "ecspi2_pre_div", base + 0xb380, 0, 6); 762 + hws[IMX7D_ECSPI3_ROOT_DIV] = imx_clk_hw_divider2("ecspi3_post_div", "ecspi3_pre_div", base + 0xb400, 0, 6); 763 + hws[IMX7D_ECSPI4_ROOT_DIV] = imx_clk_hw_divider2("ecspi4_post_div", "ecspi4_pre_div", base + 0xb480, 0, 6); 764 + hws[IMX7D_PWM1_ROOT_DIV] = imx_clk_hw_divider2("pwm1_post_div", "pwm1_pre_div", base + 0xb500, 0, 6); 765 + hws[IMX7D_PWM2_ROOT_DIV] = imx_clk_hw_divider2("pwm2_post_div", "pwm2_pre_div", base + 0xb580, 0, 6); 766 + hws[IMX7D_PWM3_ROOT_DIV] = imx_clk_hw_divider2("pwm3_post_div", "pwm3_pre_div", base + 0xb600, 0, 6); 767 + hws[IMX7D_PWM4_ROOT_DIV] = imx_clk_hw_divider2("pwm4_post_div", "pwm4_pre_div", base + 0xb680, 0, 6); 768 + hws[IMX7D_FLEXTIMER1_ROOT_DIV] = imx_clk_hw_divider2("flextimer1_post_div", "flextimer1_pre_div", base + 0xb700, 0, 6); 769 + hws[IMX7D_FLEXTIMER2_ROOT_DIV] = imx_clk_hw_divider2("flextimer2_post_div", "flextimer2_pre_div", base + 0xb780, 0, 6); 770 + hws[IMX7D_SIM1_ROOT_DIV] = imx_clk_hw_divider2("sim1_post_div", "sim1_pre_div", base + 0xb800, 0, 6); 771 + hws[IMX7D_SIM2_ROOT_DIV] = imx_clk_hw_divider2("sim2_post_div", "sim2_pre_div", base + 0xb880, 0, 6); 772 + hws[IMX7D_GPT1_ROOT_DIV] = imx_clk_hw_divider2("gpt1_post_div", "gpt1_pre_div", base + 0xb900, 0, 6); 773 + hws[IMX7D_GPT2_ROOT_DIV] = imx_clk_hw_divider2("gpt2_post_div", "gpt2_pre_div", base + 0xb980, 0, 6); 774 + hws[IMX7D_GPT3_ROOT_DIV] = imx_clk_hw_divider2("gpt3_post_div", "gpt3_pre_div", base + 0xba00, 0, 6); 775 + hws[IMX7D_GPT4_ROOT_DIV] = imx_clk_hw_divider2("gpt4_post_div", "gpt4_pre_div", base + 0xba80, 0, 6); 776 + hws[IMX7D_TRACE_ROOT_DIV] = imx_clk_hw_divider2("trace_post_div", "trace_pre_div", base + 0xbb00, 0, 6); 777 + hws[IMX7D_WDOG_ROOT_DIV] = imx_clk_hw_divider2("wdog_post_div", "wdog_pre_div", base + 0xbb80, 0, 6); 778 + hws[IMX7D_CSI_MCLK_ROOT_DIV] = imx_clk_hw_divider2("csi_mclk_post_div", "csi_mclk_pre_div", base + 0xbc00, 0, 6); 779 + hws[IMX7D_AUDIO_MCLK_ROOT_DIV] = imx_clk_hw_divider2("audio_mclk_post_div", "audio_mclk_pre_div", base + 0xbc80, 0, 6); 780 + hws[IMX7D_WRCLK_ROOT_DIV] = imx_clk_hw_divider2("wrclk_post_div", "wrclk_pre_div", base + 0xbd00, 0, 6); 781 + hws[IMX7D_CLKO1_ROOT_DIV] = imx_clk_hw_divider2("clko1_post_div", "clko1_pre_div", base + 0xbd80, 0, 6); 782 + hws[IMX7D_CLKO2_ROOT_DIV] = imx_clk_hw_divider2("clko2_post_div", "clko2_pre_div", base + 0xbe00, 0, 6); 772 783 773 - clks[IMX7D_ARM_A7_ROOT_CLK] = imx_clk_gate2_flags("arm_a7_root_clk", "arm_a7_div", base + 0x4000, 0, CLK_OPS_PARENT_ENABLE); 774 - clks[IMX7D_ARM_M4_ROOT_CLK] = imx_clk_gate4("arm_m4_root_clk", "arm_m4_div", base + 0x4010, 0); 775 - clks[IMX7D_MAIN_AXI_ROOT_CLK] = imx_clk_gate2_flags("main_axi_root_clk", "axi_post_div", base + 0x4040, 0, CLK_IS_CRITICAL | CLK_OPS_PARENT_ENABLE); 776 - clks[IMX7D_DISP_AXI_ROOT_CLK] = imx_clk_gate4("disp_axi_root_clk", "disp_axi_post_div", base + 0x4050, 0); 777 - clks[IMX7D_ENET_AXI_ROOT_CLK] = imx_clk_gate4("enet_axi_root_clk", "enet_axi_post_div", base + 0x4060, 0); 778 - clks[IMX7D_OCRAM_CLK] = imx_clk_gate4("ocram_clk", "main_axi_root_clk", base + 0x4110, 0); 779 - clks[IMX7D_OCRAM_S_CLK] = imx_clk_gate4("ocram_s_clk", "ahb_root_clk", base + 0x4120, 0); 780 - clks[IMX7D_DRAM_ROOT_CLK] = imx_clk_gate2_flags("dram_root_clk", "dram_post_div", base + 0x4130, 0, CLK_IS_CRITICAL | CLK_OPS_PARENT_ENABLE); 781 - clks[IMX7D_DRAM_PHYM_ROOT_CLK] = imx_clk_gate2_flags("dram_phym_root_clk", "dram_phym_cg", base + 0x4130, 0, CLK_IS_CRITICAL | CLK_OPS_PARENT_ENABLE); 782 - clks[IMX7D_DRAM_PHYM_ALT_ROOT_CLK] = imx_clk_gate2_flags("dram_phym_alt_root_clk", "dram_phym_alt_post_div", base + 0x4130, 0, CLK_IS_CRITICAL | CLK_OPS_PARENT_ENABLE); 783 - clks[IMX7D_DRAM_ALT_ROOT_CLK] = imx_clk_gate2_flags("dram_alt_root_clk", "dram_alt_post_div", base + 0x4130, 0, CLK_IS_CRITICAL | CLK_OPS_PARENT_ENABLE); 784 - clks[IMX7D_OCOTP_CLK] = imx_clk_gate4("ocotp_clk", "ipg_root_clk", base + 0x4230, 0); 785 - clks[IMX7D_SNVS_CLK] = imx_clk_gate4("snvs_clk", "ipg_root_clk", base + 0x4250, 0); 786 - clks[IMX7D_MU_ROOT_CLK] = imx_clk_gate4("mu_root_clk", "ipg_root_clk", base + 0x4270, 0); 787 - clks[IMX7D_CAAM_CLK] = imx_clk_gate4("caam_clk", "ipg_root_clk", base + 0x4240, 0); 788 - clks[IMX7D_USB_HSIC_ROOT_CLK] = imx_clk_gate4("usb_hsic_root_clk", "usb_hsic_post_div", base + 0x4690, 0); 789 - clks[IMX7D_SDMA_CORE_CLK] = imx_clk_gate4("sdma_root_clk", "ahb_root_clk", base + 0x4480, 0); 790 - clks[IMX7D_PCIE_CTRL_ROOT_CLK] = imx_clk_gate4("pcie_ctrl_root_clk", "pcie_ctrl_post_div", base + 0x4600, 0); 791 - clks[IMX7D_PCIE_PHY_ROOT_CLK] = imx_clk_gate4("pcie_phy_root_clk", "pcie_phy_post_div", base + 0x4600, 0); 792 - clks[IMX7D_EPDC_PIXEL_ROOT_CLK] = imx_clk_gate4("epdc_pixel_root_clk", "epdc_pixel_post_div", base + 0x44a0, 0); 793 - clks[IMX7D_LCDIF_PIXEL_ROOT_CLK] = imx_clk_gate4("lcdif_pixel_root_clk", "lcdif_pixel_post_div", base + 0x44b0, 0); 794 - clks[IMX7D_MIPI_DSI_ROOT_CLK] = imx_clk_gate4("mipi_dsi_root_clk", "mipi_dsi_post_div", base + 0x4650, 0); 795 - clks[IMX7D_MIPI_CSI_ROOT_CLK] = imx_clk_gate4("mipi_csi_root_clk", "mipi_csi_post_div", base + 0x4640, 0); 796 - clks[IMX7D_MIPI_DPHY_ROOT_CLK] = imx_clk_gate4("mipi_dphy_root_clk", "mipi_dphy_post_div", base + 0x4660, 0); 797 - clks[IMX7D_ENET1_IPG_ROOT_CLK] = imx_clk_gate2_shared2("enet1_ipg_root_clk", "enet_axi_post_div", base + 0x4700, 0, &share_count_enet1); 798 - clks[IMX7D_ENET1_TIME_ROOT_CLK] = imx_clk_gate2_shared2("enet1_time_root_clk", "enet1_time_post_div", base + 0x4700, 0, &share_count_enet1); 799 - clks[IMX7D_ENET2_IPG_ROOT_CLK] = imx_clk_gate2_shared2("enet2_ipg_root_clk", "enet_axi_post_div", base + 0x4710, 0, &share_count_enet2); 800 - clks[IMX7D_ENET2_TIME_ROOT_CLK] = imx_clk_gate2_shared2("enet2_time_root_clk", "enet2_time_post_div", base + 0x4710, 0, &share_count_enet2); 801 - clks[IMX7D_SAI1_ROOT_CLK] = imx_clk_gate2_shared2("sai1_root_clk", "sai1_post_div", base + 0x48c0, 0, &share_count_sai1); 802 - clks[IMX7D_SAI1_IPG_CLK] = imx_clk_gate2_shared2("sai1_ipg_clk", "ipg_root_clk", base + 0x48c0, 0, &share_count_sai1); 803 - clks[IMX7D_SAI2_ROOT_CLK] = imx_clk_gate2_shared2("sai2_root_clk", "sai2_post_div", base + 0x48d0, 0, &share_count_sai2); 804 - clks[IMX7D_SAI2_IPG_CLK] = imx_clk_gate2_shared2("sai2_ipg_clk", "ipg_root_clk", base + 0x48d0, 0, &share_count_sai2); 805 - clks[IMX7D_SAI3_ROOT_CLK] = imx_clk_gate2_shared2("sai3_root_clk", "sai3_post_div", base + 0x48e0, 0, &share_count_sai3); 806 - clks[IMX7D_SAI3_IPG_CLK] = imx_clk_gate2_shared2("sai3_ipg_clk", "ipg_root_clk", base + 0x48e0, 0, &share_count_sai3); 807 - clks[IMX7D_SPDIF_ROOT_CLK] = imx_clk_gate4("spdif_root_clk", "spdif_post_div", base + 0x44d0, 0); 808 - clks[IMX7D_EIM_ROOT_CLK] = imx_clk_gate4("eim_root_clk", "eim_post_div", base + 0x4160, 0); 809 - clks[IMX7D_NAND_RAWNAND_CLK] = imx_clk_gate2_shared2("nand_rawnand_clk", "nand_root_clk", base + 0x4140, 0, &share_count_nand); 810 - clks[IMX7D_NAND_USDHC_BUS_RAWNAND_CLK] = imx_clk_gate2_shared2("nand_usdhc_rawnand_clk", "nand_usdhc_root_clk", base + 0x4140, 0, &share_count_nand); 811 - clks[IMX7D_QSPI_ROOT_CLK] = imx_clk_gate4("qspi_root_clk", "qspi_post_div", base + 0x4150, 0); 812 - clks[IMX7D_USDHC1_ROOT_CLK] = imx_clk_gate4("usdhc1_root_clk", "usdhc1_post_div", base + 0x46c0, 0); 813 - clks[IMX7D_USDHC2_ROOT_CLK] = imx_clk_gate4("usdhc2_root_clk", "usdhc2_post_div", base + 0x46d0, 0); 814 - clks[IMX7D_USDHC3_ROOT_CLK] = imx_clk_gate4("usdhc3_root_clk", "usdhc3_post_div", base + 0x46e0, 0); 815 - clks[IMX7D_CAN1_ROOT_CLK] = imx_clk_gate4("can1_root_clk", "can1_post_div", base + 0x4740, 0); 816 - clks[IMX7D_CAN2_ROOT_CLK] = imx_clk_gate4("can2_root_clk", "can2_post_div", base + 0x4750, 0); 817 - clks[IMX7D_I2C1_ROOT_CLK] = imx_clk_gate4("i2c1_root_clk", "i2c1_post_div", base + 0x4880, 0); 818 - clks[IMX7D_I2C2_ROOT_CLK] = imx_clk_gate4("i2c2_root_clk", "i2c2_post_div", base + 0x4890, 0); 819 - clks[IMX7D_I2C3_ROOT_CLK] = imx_clk_gate4("i2c3_root_clk", "i2c3_post_div", base + 0x48a0, 0); 820 - clks[IMX7D_I2C4_ROOT_CLK] = imx_clk_gate4("i2c4_root_clk", "i2c4_post_div", base + 0x48b0, 0); 821 - clks[IMX7D_UART1_ROOT_CLK] = imx_clk_gate4("uart1_root_clk", "uart1_post_div", base + 0x4940, 0); 822 - clks[IMX7D_UART2_ROOT_CLK] = imx_clk_gate4("uart2_root_clk", "uart2_post_div", base + 0x4950, 0); 823 - clks[IMX7D_UART3_ROOT_CLK] = imx_clk_gate4("uart3_root_clk", "uart3_post_div", base + 0x4960, 0); 824 - clks[IMX7D_UART4_ROOT_CLK] = imx_clk_gate4("uart4_root_clk", "uart4_post_div", base + 0x4970, 0); 825 - clks[IMX7D_UART5_ROOT_CLK] = imx_clk_gate4("uart5_root_clk", "uart5_post_div", base + 0x4980, 0); 826 - clks[IMX7D_UART6_ROOT_CLK] = imx_clk_gate4("uart6_root_clk", "uart6_post_div", base + 0x4990, 0); 827 - clks[IMX7D_UART7_ROOT_CLK] = imx_clk_gate4("uart7_root_clk", "uart7_post_div", base + 0x49a0, 0); 828 - clks[IMX7D_ECSPI1_ROOT_CLK] = imx_clk_gate4("ecspi1_root_clk", "ecspi1_post_div", base + 0x4780, 0); 829 - clks[IMX7D_ECSPI2_ROOT_CLK] = imx_clk_gate4("ecspi2_root_clk", "ecspi2_post_div", base + 0x4790, 0); 830 - clks[IMX7D_ECSPI3_ROOT_CLK] = imx_clk_gate4("ecspi3_root_clk", "ecspi3_post_div", base + 0x47a0, 0); 831 - clks[IMX7D_ECSPI4_ROOT_CLK] = imx_clk_gate4("ecspi4_root_clk", "ecspi4_post_div", base + 0x47b0, 0); 832 - clks[IMX7D_PWM1_ROOT_CLK] = imx_clk_gate4("pwm1_root_clk", "pwm1_post_div", base + 0x4840, 0); 833 - clks[IMX7D_PWM2_ROOT_CLK] = imx_clk_gate4("pwm2_root_clk", "pwm2_post_div", base + 0x4850, 0); 834 - clks[IMX7D_PWM3_ROOT_CLK] = imx_clk_gate4("pwm3_root_clk", "pwm3_post_div", base + 0x4860, 0); 835 - clks[IMX7D_PWM4_ROOT_CLK] = imx_clk_gate4("pwm4_root_clk", "pwm4_post_div", base + 0x4870, 0); 836 - clks[IMX7D_FLEXTIMER1_ROOT_CLK] = imx_clk_gate4("flextimer1_root_clk", "flextimer1_post_div", base + 0x4800, 0); 837 - clks[IMX7D_FLEXTIMER2_ROOT_CLK] = imx_clk_gate4("flextimer2_root_clk", "flextimer2_post_div", base + 0x4810, 0); 838 - clks[IMX7D_SIM1_ROOT_CLK] = imx_clk_gate4("sim1_root_clk", "sim1_post_div", base + 0x4900, 0); 839 - clks[IMX7D_SIM2_ROOT_CLK] = imx_clk_gate4("sim2_root_clk", "sim2_post_div", base + 0x4910, 0); 840 - clks[IMX7D_GPT1_ROOT_CLK] = imx_clk_gate4("gpt1_root_clk", "gpt1_post_div", base + 0x47c0, 0); 841 - clks[IMX7D_GPT2_ROOT_CLK] = imx_clk_gate4("gpt2_root_clk", "gpt2_post_div", base + 0x47d0, 0); 842 - clks[IMX7D_GPT3_ROOT_CLK] = imx_clk_gate4("gpt3_root_clk", "gpt3_post_div", base + 0x47e0, 0); 843 - clks[IMX7D_GPT4_ROOT_CLK] = imx_clk_gate4("gpt4_root_clk", "gpt4_post_div", base + 0x47f0, 0); 844 - clks[IMX7D_TRACE_ROOT_CLK] = imx_clk_gate4("trace_root_clk", "trace_post_div", base + 0x4300, 0); 845 - clks[IMX7D_WDOG1_ROOT_CLK] = imx_clk_gate4("wdog1_root_clk", "wdog_post_div", base + 0x49c0, 0); 846 - clks[IMX7D_WDOG2_ROOT_CLK] = imx_clk_gate4("wdog2_root_clk", "wdog_post_div", base + 0x49d0, 0); 847 - clks[IMX7D_WDOG3_ROOT_CLK] = imx_clk_gate4("wdog3_root_clk", "wdog_post_div", base + 0x49e0, 0); 848 - clks[IMX7D_WDOG4_ROOT_CLK] = imx_clk_gate4("wdog4_root_clk", "wdog_post_div", base + 0x49f0, 0); 849 - clks[IMX7D_KPP_ROOT_CLK] = imx_clk_gate4("kpp_root_clk", "ipg_root_clk", base + 0x4aa0, 0); 850 - clks[IMX7D_CSI_MCLK_ROOT_CLK] = imx_clk_gate4("csi_mclk_root_clk", "csi_mclk_post_div", base + 0x4490, 0); 851 - clks[IMX7D_AUDIO_MCLK_ROOT_CLK] = imx_clk_gate4("audio_mclk_root_clk", "audio_mclk_post_div", base + 0x4790, 0); 852 - clks[IMX7D_WRCLK_ROOT_CLK] = imx_clk_gate4("wrclk_root_clk", "wrclk_post_div", base + 0x47a0, 0); 853 - clks[IMX7D_USB_CTRL_CLK] = imx_clk_gate4("usb_ctrl_clk", "ahb_root_clk", base + 0x4680, 0); 854 - clks[IMX7D_USB_PHY1_CLK] = imx_clk_gate4("usb_phy1_clk", "pll_usb1_main_clk", base + 0x46a0, 0); 855 - clks[IMX7D_USB_PHY2_CLK] = imx_clk_gate4("usb_phy2_clk", "pll_usb_main_clk", base + 0x46b0, 0); 856 - clks[IMX7D_ADC_ROOT_CLK] = imx_clk_gate4("adc_root_clk", "ipg_root_clk", base + 0x4200, 0); 784 + hws[IMX7D_ARM_A7_ROOT_CLK] = imx_clk_hw_gate2_flags("arm_a7_root_clk", "arm_a7_div", base + 0x4000, 0, CLK_OPS_PARENT_ENABLE); 785 + hws[IMX7D_ARM_M4_ROOT_CLK] = imx_clk_hw_gate4("arm_m4_root_clk", "arm_m4_div", base + 0x4010, 0); 786 + hws[IMX7D_MAIN_AXI_ROOT_CLK] = imx_clk_hw_gate2_flags("main_axi_root_clk", "axi_post_div", base + 0x4040, 0, CLK_IS_CRITICAL | CLK_OPS_PARENT_ENABLE); 787 + hws[IMX7D_DISP_AXI_ROOT_CLK] = imx_clk_hw_gate4("disp_axi_root_clk", "disp_axi_post_div", base + 0x4050, 0); 788 + hws[IMX7D_ENET_AXI_ROOT_CLK] = imx_clk_hw_gate4("enet_axi_root_clk", "enet_axi_post_div", base + 0x4060, 0); 789 + hws[IMX7D_OCRAM_CLK] = imx_clk_hw_gate4("ocram_clk", "main_axi_root_clk", base + 0x4110, 0); 790 + hws[IMX7D_OCRAM_S_CLK] = imx_clk_hw_gate4("ocram_s_clk", "ahb_root_clk", base + 0x4120, 0); 791 + hws[IMX7D_DRAM_ROOT_CLK] = imx_clk_hw_gate2_flags("dram_root_clk", "dram_post_div", base + 0x4130, 0, CLK_IS_CRITICAL | CLK_OPS_PARENT_ENABLE); 792 + hws[IMX7D_DRAM_PHYM_ROOT_CLK] = imx_clk_hw_gate2_flags("dram_phym_root_clk", "dram_phym_cg", base + 0x4130, 0, CLK_IS_CRITICAL | CLK_OPS_PARENT_ENABLE); 793 + hws[IMX7D_DRAM_PHYM_ALT_ROOT_CLK] = imx_clk_hw_gate2_flags("dram_phym_alt_root_clk", "dram_phym_alt_post_div", base + 0x4130, 0, CLK_IS_CRITICAL | CLK_OPS_PARENT_ENABLE); 794 + hws[IMX7D_DRAM_ALT_ROOT_CLK] = imx_clk_hw_gate2_flags("dram_alt_root_clk", "dram_alt_post_div", base + 0x4130, 0, CLK_IS_CRITICAL | CLK_OPS_PARENT_ENABLE); 795 + hws[IMX7D_OCOTP_CLK] = imx_clk_hw_gate4("ocotp_clk", "ipg_root_clk", base + 0x4230, 0); 796 + hws[IMX7D_SNVS_CLK] = imx_clk_hw_gate4("snvs_clk", "ipg_root_clk", base + 0x4250, 0); 797 + hws[IMX7D_MU_ROOT_CLK] = imx_clk_hw_gate4("mu_root_clk", "ipg_root_clk", base + 0x4270, 0); 798 + hws[IMX7D_CAAM_CLK] = imx_clk_hw_gate4("caam_clk", "ipg_root_clk", base + 0x4240, 0); 799 + hws[IMX7D_USB_HSIC_ROOT_CLK] = imx_clk_hw_gate4("usb_hsic_root_clk", "usb_hsic_post_div", base + 0x4690, 0); 800 + hws[IMX7D_SDMA_CORE_CLK] = imx_clk_hw_gate4("sdma_root_clk", "ahb_root_clk", base + 0x4480, 0); 801 + hws[IMX7D_PCIE_CTRL_ROOT_CLK] = imx_clk_hw_gate4("pcie_ctrl_root_clk", "pcie_ctrl_post_div", base + 0x4600, 0); 802 + hws[IMX7D_PCIE_PHY_ROOT_CLK] = imx_clk_hw_gate4("pcie_phy_root_clk", "pcie_phy_post_div", base + 0x4600, 0); 803 + hws[IMX7D_EPDC_PIXEL_ROOT_CLK] = imx_clk_hw_gate4("epdc_pixel_root_clk", "epdc_pixel_post_div", base + 0x44a0, 0); 804 + hws[IMX7D_LCDIF_PIXEL_ROOT_CLK] = imx_clk_hw_gate4("lcdif_pixel_root_clk", "lcdif_pixel_post_div", base + 0x44b0, 0); 805 + hws[IMX7D_MIPI_DSI_ROOT_CLK] = imx_clk_hw_gate4("mipi_dsi_root_clk", "mipi_dsi_post_div", base + 0x4650, 0); 806 + hws[IMX7D_MIPI_CSI_ROOT_CLK] = imx_clk_hw_gate4("mipi_csi_root_clk", "mipi_csi_post_div", base + 0x4640, 0); 807 + hws[IMX7D_MIPI_DPHY_ROOT_CLK] = imx_clk_hw_gate4("mipi_dphy_root_clk", "mipi_dphy_post_div", base + 0x4660, 0); 808 + hws[IMX7D_ENET1_IPG_ROOT_CLK] = imx_clk_hw_gate2_shared2("enet1_ipg_root_clk", "enet_axi_post_div", base + 0x4700, 0, &share_count_enet1); 809 + hws[IMX7D_ENET1_TIME_ROOT_CLK] = imx_clk_hw_gate2_shared2("enet1_time_root_clk", "enet1_time_post_div", base + 0x4700, 0, &share_count_enet1); 810 + hws[IMX7D_ENET2_IPG_ROOT_CLK] = imx_clk_hw_gate2_shared2("enet2_ipg_root_clk", "enet_axi_post_div", base + 0x4710, 0, &share_count_enet2); 811 + hws[IMX7D_ENET2_TIME_ROOT_CLK] = imx_clk_hw_gate2_shared2("enet2_time_root_clk", "enet2_time_post_div", base + 0x4710, 0, &share_count_enet2); 812 + hws[IMX7D_SAI1_ROOT_CLK] = imx_clk_hw_gate2_shared2("sai1_root_clk", "sai1_post_div", base + 0x48c0, 0, &share_count_sai1); 813 + hws[IMX7D_SAI1_IPG_CLK] = imx_clk_hw_gate2_shared2("sai1_ipg_clk", "ipg_root_clk", base + 0x48c0, 0, &share_count_sai1); 814 + hws[IMX7D_SAI2_ROOT_CLK] = imx_clk_hw_gate2_shared2("sai2_root_clk", "sai2_post_div", base + 0x48d0, 0, &share_count_sai2); 815 + hws[IMX7D_SAI2_IPG_CLK] = imx_clk_hw_gate2_shared2("sai2_ipg_clk", "ipg_root_clk", base + 0x48d0, 0, &share_count_sai2); 816 + hws[IMX7D_SAI3_ROOT_CLK] = imx_clk_hw_gate2_shared2("sai3_root_clk", "sai3_post_div", base + 0x48e0, 0, &share_count_sai3); 817 + hws[IMX7D_SAI3_IPG_CLK] = imx_clk_hw_gate2_shared2("sai3_ipg_clk", "ipg_root_clk", base + 0x48e0, 0, &share_count_sai3); 818 + hws[IMX7D_SPDIF_ROOT_CLK] = imx_clk_hw_gate4("spdif_root_clk", "spdif_post_div", base + 0x44d0, 0); 819 + hws[IMX7D_EIM_ROOT_CLK] = imx_clk_hw_gate4("eim_root_clk", "eim_post_div", base + 0x4160, 0); 820 + hws[IMX7D_NAND_RAWNAND_CLK] = imx_clk_hw_gate2_shared2("nand_rawnand_clk", "nand_root_clk", base + 0x4140, 0, &share_count_nand); 821 + hws[IMX7D_NAND_USDHC_BUS_RAWNAND_CLK] = imx_clk_hw_gate2_shared2("nand_usdhc_rawnand_clk", "nand_usdhc_root_clk", base + 0x4140, 0, &share_count_nand); 822 + hws[IMX7D_QSPI_ROOT_CLK] = imx_clk_hw_gate4("qspi_root_clk", "qspi_post_div", base + 0x4150, 0); 823 + hws[IMX7D_USDHC1_ROOT_CLK] = imx_clk_hw_gate4("usdhc1_root_clk", "usdhc1_post_div", base + 0x46c0, 0); 824 + hws[IMX7D_USDHC2_ROOT_CLK] = imx_clk_hw_gate4("usdhc2_root_clk", "usdhc2_post_div", base + 0x46d0, 0); 825 + hws[IMX7D_USDHC3_ROOT_CLK] = imx_clk_hw_gate4("usdhc3_root_clk", "usdhc3_post_div", base + 0x46e0, 0); 826 + hws[IMX7D_CAN1_ROOT_CLK] = imx_clk_hw_gate4("can1_root_clk", "can1_post_div", base + 0x4740, 0); 827 + hws[IMX7D_CAN2_ROOT_CLK] = imx_clk_hw_gate4("can2_root_clk", "can2_post_div", base + 0x4750, 0); 828 + hws[IMX7D_I2C1_ROOT_CLK] = imx_clk_hw_gate4("i2c1_root_clk", "i2c1_post_div", base + 0x4880, 0); 829 + hws[IMX7D_I2C2_ROOT_CLK] = imx_clk_hw_gate4("i2c2_root_clk", "i2c2_post_div", base + 0x4890, 0); 830 + hws[IMX7D_I2C3_ROOT_CLK] = imx_clk_hw_gate4("i2c3_root_clk", "i2c3_post_div", base + 0x48a0, 0); 831 + hws[IMX7D_I2C4_ROOT_CLK] = imx_clk_hw_gate4("i2c4_root_clk", "i2c4_post_div", base + 0x48b0, 0); 832 + hws[IMX7D_UART1_ROOT_CLK] = imx_clk_hw_gate4("uart1_root_clk", "uart1_post_div", base + 0x4940, 0); 833 + hws[IMX7D_UART2_ROOT_CLK] = imx_clk_hw_gate4("uart2_root_clk", "uart2_post_div", base + 0x4950, 0); 834 + hws[IMX7D_UART3_ROOT_CLK] = imx_clk_hw_gate4("uart3_root_clk", "uart3_post_div", base + 0x4960, 0); 835 + hws[IMX7D_UART4_ROOT_CLK] = imx_clk_hw_gate4("uart4_root_clk", "uart4_post_div", base + 0x4970, 0); 836 + hws[IMX7D_UART5_ROOT_CLK] = imx_clk_hw_gate4("uart5_root_clk", "uart5_post_div", base + 0x4980, 0); 837 + hws[IMX7D_UART6_ROOT_CLK] = imx_clk_hw_gate4("uart6_root_clk", "uart6_post_div", base + 0x4990, 0); 838 + hws[IMX7D_UART7_ROOT_CLK] = imx_clk_hw_gate4("uart7_root_clk", "uart7_post_div", base + 0x49a0, 0); 839 + hws[IMX7D_ECSPI1_ROOT_CLK] = imx_clk_hw_gate4("ecspi1_root_clk", "ecspi1_post_div", base + 0x4780, 0); 840 + hws[IMX7D_ECSPI2_ROOT_CLK] = imx_clk_hw_gate4("ecspi2_root_clk", "ecspi2_post_div", base + 0x4790, 0); 841 + hws[IMX7D_ECSPI3_ROOT_CLK] = imx_clk_hw_gate4("ecspi3_root_clk", "ecspi3_post_div", base + 0x47a0, 0); 842 + hws[IMX7D_ECSPI4_ROOT_CLK] = imx_clk_hw_gate4("ecspi4_root_clk", "ecspi4_post_div", base + 0x47b0, 0); 843 + hws[IMX7D_PWM1_ROOT_CLK] = imx_clk_hw_gate4("pwm1_root_clk", "pwm1_post_div", base + 0x4840, 0); 844 + hws[IMX7D_PWM2_ROOT_CLK] = imx_clk_hw_gate4("pwm2_root_clk", "pwm2_post_div", base + 0x4850, 0); 845 + hws[IMX7D_PWM3_ROOT_CLK] = imx_clk_hw_gate4("pwm3_root_clk", "pwm3_post_div", base + 0x4860, 0); 846 + hws[IMX7D_PWM4_ROOT_CLK] = imx_clk_hw_gate4("pwm4_root_clk", "pwm4_post_div", base + 0x4870, 0); 847 + hws[IMX7D_FLEXTIMER1_ROOT_CLK] = imx_clk_hw_gate4("flextimer1_root_clk", "flextimer1_post_div", base + 0x4800, 0); 848 + hws[IMX7D_FLEXTIMER2_ROOT_CLK] = imx_clk_hw_gate4("flextimer2_root_clk", "flextimer2_post_div", base + 0x4810, 0); 849 + hws[IMX7D_SIM1_ROOT_CLK] = imx_clk_hw_gate4("sim1_root_clk", "sim1_post_div", base + 0x4900, 0); 850 + hws[IMX7D_SIM2_ROOT_CLK] = imx_clk_hw_gate4("sim2_root_clk", "sim2_post_div", base + 0x4910, 0); 851 + hws[IMX7D_GPT1_ROOT_CLK] = imx_clk_hw_gate4("gpt1_root_clk", "gpt1_post_div", base + 0x47c0, 0); 852 + hws[IMX7D_GPT2_ROOT_CLK] = imx_clk_hw_gate4("gpt2_root_clk", "gpt2_post_div", base + 0x47d0, 0); 853 + hws[IMX7D_GPT3_ROOT_CLK] = imx_clk_hw_gate4("gpt3_root_clk", "gpt3_post_div", base + 0x47e0, 0); 854 + hws[IMX7D_GPT4_ROOT_CLK] = imx_clk_hw_gate4("gpt4_root_clk", "gpt4_post_div", base + 0x47f0, 0); 855 + hws[IMX7D_TRACE_ROOT_CLK] = imx_clk_hw_gate4("trace_root_clk", "trace_post_div", base + 0x4300, 0); 856 + hws[IMX7D_WDOG1_ROOT_CLK] = imx_clk_hw_gate4("wdog1_root_clk", "wdog_post_div", base + 0x49c0, 0); 857 + hws[IMX7D_WDOG2_ROOT_CLK] = imx_clk_hw_gate4("wdog2_root_clk", "wdog_post_div", base + 0x49d0, 0); 858 + hws[IMX7D_WDOG3_ROOT_CLK] = imx_clk_hw_gate4("wdog3_root_clk", "wdog_post_div", base + 0x49e0, 0); 859 + hws[IMX7D_WDOG4_ROOT_CLK] = imx_clk_hw_gate4("wdog4_root_clk", "wdog_post_div", base + 0x49f0, 0); 860 + hws[IMX7D_KPP_ROOT_CLK] = imx_clk_hw_gate4("kpp_root_clk", "ipg_root_clk", base + 0x4aa0, 0); 861 + hws[IMX7D_CSI_MCLK_ROOT_CLK] = imx_clk_hw_gate4("csi_mclk_root_clk", "csi_mclk_post_div", base + 0x4490, 0); 862 + hws[IMX7D_AUDIO_MCLK_ROOT_CLK] = imx_clk_hw_gate4("audio_mclk_root_clk", "audio_mclk_post_div", base + 0x4790, 0); 863 + hws[IMX7D_WRCLK_ROOT_CLK] = imx_clk_hw_gate4("wrclk_root_clk", "wrclk_post_div", base + 0x47a0, 0); 864 + hws[IMX7D_USB_CTRL_CLK] = imx_clk_hw_gate4("usb_ctrl_clk", "ahb_root_clk", base + 0x4680, 0); 865 + hws[IMX7D_USB_PHY1_CLK] = imx_clk_hw_gate4("usb_phy1_clk", "pll_usb1_main_clk", base + 0x46a0, 0); 866 + hws[IMX7D_USB_PHY2_CLK] = imx_clk_hw_gate4("usb_phy2_clk", "pll_usb_main_clk", base + 0x46b0, 0); 867 + hws[IMX7D_ADC_ROOT_CLK] = imx_clk_hw_gate4("adc_root_clk", "ipg_root_clk", base + 0x4200, 0); 857 868 858 - clks[IMX7D_GPT_3M_CLK] = imx_clk_fixed_factor("gpt_3m", "osc", 1, 8); 869 + hws[IMX7D_GPT_3M_CLK] = imx_clk_hw_fixed_factor("gpt_3m", "osc", 1, 8); 859 870 860 - clks[IMX7D_CLK_ARM] = imx_clk_cpu("arm", "arm_a7_root_clk", 861 - clks[IMX7D_ARM_A7_ROOT_CLK], 862 - clks[IMX7D_ARM_A7_ROOT_SRC], 863 - clks[IMX7D_PLL_ARM_MAIN_CLK], 864 - clks[IMX7D_PLL_SYS_MAIN_CLK]); 871 + hws[IMX7D_CLK_ARM] = imx_clk_hw_cpu("arm", "arm_a7_root_clk", 872 + hws[IMX7D_ARM_A7_ROOT_CLK]->clk, 873 + hws[IMX7D_ARM_A7_ROOT_SRC]->clk, 874 + hws[IMX7D_PLL_ARM_MAIN_CLK]->clk, 875 + hws[IMX7D_PLL_SYS_MAIN_CLK]->clk); 865 876 866 - imx_check_clocks(clks, ARRAY_SIZE(clks)); 877 + imx_check_clk_hws(hws, IMX7D_CLK_END); 867 878 868 - clk_data.clks = clks; 869 - clk_data.clk_num = ARRAY_SIZE(clks); 870 - of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 879 + of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data); 871 880 872 - clk_set_parent(clks[IMX7D_PLL_ARM_MAIN_BYPASS], clks[IMX7D_PLL_ARM_MAIN]); 873 - clk_set_parent(clks[IMX7D_PLL_DRAM_MAIN_BYPASS], clks[IMX7D_PLL_DRAM_MAIN]); 874 - clk_set_parent(clks[IMX7D_PLL_SYS_MAIN_BYPASS], clks[IMX7D_PLL_SYS_MAIN]); 875 - clk_set_parent(clks[IMX7D_PLL_ENET_MAIN_BYPASS], clks[IMX7D_PLL_ENET_MAIN]); 876 - clk_set_parent(clks[IMX7D_PLL_AUDIO_MAIN_BYPASS], clks[IMX7D_PLL_AUDIO_MAIN]); 877 - clk_set_parent(clks[IMX7D_PLL_VIDEO_MAIN_BYPASS], clks[IMX7D_PLL_VIDEO_MAIN]); 881 + clk_set_parent(hws[IMX7D_PLL_ARM_MAIN_BYPASS]->clk, hws[IMX7D_PLL_ARM_MAIN]->clk); 882 + clk_set_parent(hws[IMX7D_PLL_DRAM_MAIN_BYPASS]->clk, hws[IMX7D_PLL_DRAM_MAIN]->clk); 883 + clk_set_parent(hws[IMX7D_PLL_SYS_MAIN_BYPASS]->clk, hws[IMX7D_PLL_SYS_MAIN]->clk); 884 + clk_set_parent(hws[IMX7D_PLL_ENET_MAIN_BYPASS]->clk, hws[IMX7D_PLL_ENET_MAIN]->clk); 885 + clk_set_parent(hws[IMX7D_PLL_AUDIO_MAIN_BYPASS]->clk, hws[IMX7D_PLL_AUDIO_MAIN]->clk); 886 + clk_set_parent(hws[IMX7D_PLL_VIDEO_MAIN_BYPASS]->clk, hws[IMX7D_PLL_VIDEO_MAIN]->clk); 878 887 879 - clk_set_parent(clks[IMX7D_MIPI_CSI_ROOT_SRC], clks[IMX7D_PLL_SYS_PFD3_CLK]); 888 + clk_set_parent(hws[IMX7D_MIPI_CSI_ROOT_SRC]->clk, hws[IMX7D_PLL_SYS_PFD3_CLK]->clk); 880 889 881 890 /* use old gpt clk setting, gpt1 root clk must be twice as gpt counter freq */ 882 - clk_set_parent(clks[IMX7D_GPT1_ROOT_SRC], clks[IMX7D_OSC_24M_CLK]); 891 + clk_set_parent(hws[IMX7D_GPT1_ROOT_SRC]->clk, hws[IMX7D_OSC_24M_CLK]->clk); 883 892 884 893 /* Set clock rate for USBPHY, the USB_PLL at CCM is from USBOTG2 */ 885 - clks[IMX7D_USB1_MAIN_480M_CLK] = imx_clk_fixed_factor("pll_usb1_main_clk", "osc", 20, 1); 886 - clks[IMX7D_USB_MAIN_480M_CLK] = imx_clk_fixed_factor("pll_usb_main_clk", "osc", 20, 1); 894 + hws[IMX7D_USB1_MAIN_480M_CLK] = imx_clk_hw_fixed_factor("pll_usb1_main_clk", "osc", 20, 1); 895 + hws[IMX7D_USB_MAIN_480M_CLK] = imx_clk_hw_fixed_factor("pll_usb_main_clk", "osc", 20, 1); 896 + 897 + for (i = 0; i < ARRAY_SIZE(uart_clk_ids); i++) { 898 + int index = uart_clk_ids[i]; 899 + 900 + uart_clks[i] = &hws[index]->clk; 901 + } 902 + 887 903 888 904 imx_register_uart_clocks(uart_clks); 889 905
+1 -1
drivers/clk/imx/clk-imx7ulp.c
··· 115 115 116 116 clks[IMX7ULP_CLK_NIC0_DIV] = imx_clk_hw_divider_flags("nic0_clk", "nic_sel", base + 0x40, 24, 4, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); 117 117 clks[IMX7ULP_CLK_NIC1_DIV] = imx_clk_hw_divider_flags("nic1_clk", "nic0_clk", base + 0x40, 16, 4, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); 118 - clks[IMX7ULP_CLK_NIC1_BUS_DIV] = imx_clk_hw_divider_flags("nic1_bus_clk", "nic1_clk", base + 0x40, 4, 4, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); 118 + clks[IMX7ULP_CLK_NIC1_BUS_DIV] = imx_clk_hw_divider_flags("nic1_bus_clk", "nic0_clk", base + 0x40, 4, 4, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); 119 119 120 120 clks[IMX7ULP_CLK_GPU_DIV] = imx_clk_hw_divider("gpu_clk", "nic0_clk", base + 0x40, 20, 4); 121 121
+14 -4
drivers/clk/imx/clk-imx8mm.c
··· 288 288 static const char *imx8mm_usb_phy_sels[] = {"osc_24m", "sys_pll1_100m", "sys_pll1_40m", "sys_pll2_100m", 289 289 "sys_pll2_200m", "clk_ext2", "clk_ext3", "audio_pll2_out", }; 290 290 291 + static const char *imx8mm_gic_sels[] = {"osc_24m", "sys_pll2_200m", "sys_pll1_40m", "sys_pll2_100m", 292 + "sys_pll1_800m", "clk_ext2", "clk_ext4", "audio_pll2_out" }; 293 + 291 294 static const char *imx8mm_ecspi1_sels[] = {"osc_24m", "sys_pll2_200m", "sys_pll1_40m", "sys_pll1_160m", 292 295 "sys_pll1_800m", "sys_pll3_out", "sys_pll2_250m", "audio_pll2_out", }; 293 296 ··· 328 325 "sys_pll2_1000m", "sys_pll3_out", "audio_pll2_out", "video_pll1_out", }; 329 326 330 327 static const char *imx8mm_usdhc3_sels[] = {"osc_24m", "sys_pll1_400m", "sys_pll1_800m", "sys_pll2_500m", 331 - "sys_pll3_out", "sys_pll1_266m", "audio_pll2_clk", "sys_pll1_100m", }; 328 + "sys_pll3_out", "sys_pll1_266m", "audio_pll2_out", "sys_pll1_100m", }; 332 329 333 330 static const char *imx8mm_csi1_core_sels[] = {"osc_24m", "sys_pll1_266m", "sys_pll2_250m", "sys_pll1_800m", 334 331 "sys_pll2_1000m", "sys_pll3_out", "audio_pll2_out", "video_pll1_out", }; ··· 364 361 "sys_pll2_1000m", "sys_pll3_out", "clk_ext3", "audio_pll2_out", }; 365 362 366 363 static const char *imx8mm_vpu_h1_sels[] = {"osc_24m", "vpu_pll_out", "sys_pll1_800m", "sys_pll2_1000m", 367 - "audio_pll2_clk", "sys_pll2_125m", "sys_pll3_clk", "audio_pll1_out", }; 364 + "audio_pll2_out", "sys_pll2_125m", "sys_pll3_clk", "audio_pll1_out", }; 368 365 369 366 static const char *imx8mm_dram_core_sels[] = {"dram_pll_out", "dram_alt_root", }; 370 367 371 - static const char *imx8mm_clko1_sels[] = {"osc_24m", "sys_pll1_800m", "osc_27m", "sys_pll1_200m", "audio_pll2_clk", 368 + static const char *imx8mm_clko1_sels[] = {"osc_24m", "sys_pll1_800m", "osc_27m", "sys_pll1_200m", "audio_pll2_out", 372 369 "vpu_pll", "sys_pll1_80m", }; 373 370 374 371 static struct clk *clks[IMX8MM_CLK_END]; ··· 526 523 527 524 /* IP */ 528 525 clks[IMX8MM_CLK_DRAM_ALT] = imx8m_clk_composite("dram_alt", imx8mm_dram_alt_sels, base + 0xa000); 529 - clks[IMX8MM_CLK_DRAM_APB] = imx8m_clk_composite("dram_apb", imx8mm_dram_apb_sels, base + 0xa080); 526 + clks[IMX8MM_CLK_DRAM_APB] = imx8m_clk_composite_critical("dram_apb", imx8mm_dram_apb_sels, base + 0xa080); 530 527 clks[IMX8MM_CLK_VPU_G1] = imx8m_clk_composite("vpu_g1", imx8mm_vpu_g1_sels, base + 0xa100); 531 528 clks[IMX8MM_CLK_VPU_G2] = imx8m_clk_composite("vpu_g2", imx8mm_vpu_g2_sels, base + 0xa180); 532 529 clks[IMX8MM_CLK_DISP_DTRC] = imx8m_clk_composite("disp_dtrc", imx8mm_disp_dtrc_sels, base + 0xa200); ··· 561 558 clks[IMX8MM_CLK_UART4] = imx8m_clk_composite("uart4", imx8mm_uart4_sels, base + 0xb080); 562 559 clks[IMX8MM_CLK_USB_CORE_REF] = imx8m_clk_composite("usb_core_ref", imx8mm_usb_core_sels, base + 0xb100); 563 560 clks[IMX8MM_CLK_USB_PHY_REF] = imx8m_clk_composite("usb_phy_ref", imx8mm_usb_phy_sels, base + 0xb180); 561 + clks[IMX8MM_CLK_GIC] = imx8m_clk_composite_critical("gic", imx8mm_gic_sels, base + 0xb200); 564 562 clks[IMX8MM_CLK_ECSPI1] = imx8m_clk_composite("ecspi1", imx8mm_ecspi1_sels, base + 0xb280); 565 563 clks[IMX8MM_CLK_ECSPI2] = imx8m_clk_composite("ecspi2", imx8mm_ecspi2_sels, base + 0xb300); 566 564 clks[IMX8MM_CLK_PWM1] = imx8m_clk_composite("pwm1", imx8mm_pwm1_sels, base + 0xb380); ··· 594 590 clks[IMX8MM_CLK_ECSPI2_ROOT] = imx_clk_gate4("ecspi2_root_clk", "ecspi2", base + 0x4080, 0); 595 591 clks[IMX8MM_CLK_ECSPI3_ROOT] = imx_clk_gate4("ecspi3_root_clk", "ecspi3", base + 0x4090, 0); 596 592 clks[IMX8MM_CLK_ENET1_ROOT] = imx_clk_gate4("enet1_root_clk", "enet_axi", base + 0x40a0, 0); 593 + clks[IMX8MM_CLK_GPIO1_ROOT] = imx_clk_gate4("gpio1_root_clk", "ipg_root", base + 0x40b0, 0); 594 + clks[IMX8MM_CLK_GPIO2_ROOT] = imx_clk_gate4("gpio2_root_clk", "ipg_root", base + 0x40c0, 0); 595 + clks[IMX8MM_CLK_GPIO3_ROOT] = imx_clk_gate4("gpio3_root_clk", "ipg_root", base + 0x40d0, 0); 596 + clks[IMX8MM_CLK_GPIO4_ROOT] = imx_clk_gate4("gpio4_root_clk", "ipg_root", base + 0x40e0, 0); 597 + clks[IMX8MM_CLK_GPIO5_ROOT] = imx_clk_gate4("gpio5_root_clk", "ipg_root", base + 0x40f0, 0); 597 598 clks[IMX8MM_CLK_GPT1_ROOT] = imx_clk_gate4("gpt1_root_clk", "gpt1", base + 0x4100, 0); 598 599 clks[IMX8MM_CLK_I2C1_ROOT] = imx_clk_gate4("i2c1_root_clk", "i2c1", base + 0x4170, 0); 599 600 clks[IMX8MM_CLK_I2C2_ROOT] = imx_clk_gate4("i2c2_root_clk", "i2c2", base + 0x4180, 0); ··· 626 617 clks[IMX8MM_CLK_SAI5_IPG] = imx_clk_gate2_shared2("sai5_ipg_clk", "ipg_audio_root", base + 0x4370, 0, &share_count_sai5); 627 618 clks[IMX8MM_CLK_SAI6_ROOT] = imx_clk_gate2_shared2("sai6_root_clk", "sai6", base + 0x4380, 0, &share_count_sai6); 628 619 clks[IMX8MM_CLK_SAI6_IPG] = imx_clk_gate2_shared2("sai6_ipg_clk", "ipg_audio_root", base + 0x4380, 0, &share_count_sai6); 620 + clks[IMX8MM_CLK_SNVS_ROOT] = imx_clk_gate4("snvs_root_clk", "ipg_root", base + 0x4470, 0); 629 621 clks[IMX8MM_CLK_UART1_ROOT] = imx_clk_gate4("uart1_root_clk", "uart1", base + 0x4490, 0); 630 622 clks[IMX8MM_CLK_UART2_ROOT] = imx_clk_gate4("uart2_root_clk", "uart2", base + 0x44a0, 0); 631 623 clks[IMX8MM_CLK_UART3_ROOT] = imx_clk_gate4("uart3_root_clk", "uart3", base + 0x44b0, 0);
+19 -8
drivers/clk/imx/clk-imx8mq.c
··· 192 192 static const char * const imx8mq_usb_phy_sels[] = {"osc_25m", "sys1_pll_100m", "sys1_pll_40m", "sys2_pll_100m", 193 193 "sys2_pll_200m", "clk_ext2", "clk_ext3", "audio_pll2_out", }; 194 194 195 + static const char * const imx8mq_gic_sels[] = {"osc_25m", "sys2_pll_200m", "sys1_pll_40m", "sys2_pll_100m", 196 + "sys2_pll_200m", "clk_ext2", "clk_ext3", "audio_pll2_out" }; 197 + 195 198 static const char * const imx8mq_ecspi1_sels[] = {"osc_25m", "sys2_pll_200m", "sys1_pll_40m", "sys1_pll_160m", 196 199 "sys1_pll_800m", "sys3_pll2_out", "sys2_pll_250m", "audio_pll2_out", }; 197 200 ··· 272 269 273 270 static struct clk_onecell_data clk_data; 274 271 272 + static struct clk ** const uart_clks[] = { 273 + &clks[IMX8MQ_CLK_UART1_ROOT], 274 + &clks[IMX8MQ_CLK_UART2_ROOT], 275 + &clks[IMX8MQ_CLK_UART3_ROOT], 276 + &clks[IMX8MQ_CLK_UART4_ROOT], 277 + NULL 278 + }; 279 + 275 280 static int imx8mq_clocks_probe(struct platform_device *pdev) 276 281 { 277 282 struct device *dev = &pdev->dev; 278 283 struct device_node *np = dev->of_node; 279 284 void __iomem *base; 280 285 int err; 281 - int i; 282 286 283 287 clks[IMX8MQ_CLK_DUMMY] = imx_clk_fixed("dummy", 0); 284 288 clks[IMX8MQ_CLK_32K] = of_clk_get_by_name(np, "ckil"); ··· 368 358 clks[IMX8MQ_SYS2_PLL_1000M] = imx_clk_fixed_factor("sys2_pll_1000m", "sys2_pll_out", 1, 1); 369 359 370 360 np = dev->of_node; 371 - base = of_iomap(np, 0); 372 - if (WARN_ON(!base)) 373 - return -ENOMEM; 361 + base = devm_platform_ioremap_resource(pdev, 0); 362 + if (WARN_ON(IS_ERR(base))) 363 + return PTR_ERR(base); 374 364 375 365 /* CORE */ 376 366 clks[IMX8MQ_CLK_A53_SRC] = imx_clk_mux2("arm_a53_src", base + 0x8000, 24, 3, imx8mq_a53_sels, ARRAY_SIZE(imx8mq_a53_sels)); ··· 452 442 clks[IMX8MQ_CLK_UART4] = imx8m_clk_composite("uart4", imx8mq_uart4_sels, base + 0xb080); 453 443 clks[IMX8MQ_CLK_USB_CORE_REF] = imx8m_clk_composite("usb_core_ref", imx8mq_usb_core_sels, base + 0xb100); 454 444 clks[IMX8MQ_CLK_USB_PHY_REF] = imx8m_clk_composite("usb_phy_ref", imx8mq_usb_phy_sels, base + 0xb180); 445 + clks[IMX8MQ_CLK_GIC] = imx8m_clk_composite_critical("gic", imx8mq_gic_sels, base + 0xb200); 455 446 clks[IMX8MQ_CLK_ECSPI1] = imx8m_clk_composite("ecspi1", imx8mq_ecspi1_sels, base + 0xb280); 456 447 clks[IMX8MQ_CLK_ECSPI2] = imx8m_clk_composite("ecspi2", imx8mq_ecspi2_sels, base + 0xb300); 457 448 clks[IMX8MQ_CLK_PWM1] = imx8m_clk_composite("pwm1", imx8mq_pwm1_sels, base + 0xb380); ··· 518 507 clks[IMX8MQ_CLK_SAI5_IPG] = imx_clk_gate2_shared2("sai5_ipg_clk", "ipg_audio_root", base + 0x4370, 0, &share_count_sai5); 519 508 clks[IMX8MQ_CLK_SAI6_ROOT] = imx_clk_gate2_shared2("sai6_root_clk", "sai6", base + 0x4380, 0, &share_count_sai6); 520 509 clks[IMX8MQ_CLK_SAI6_IPG] = imx_clk_gate2_shared2("sai6_ipg_clk", "ipg_audio_root", base + 0x4380, 0, &share_count_sai6); 510 + clks[IMX8MQ_CLK_SNVS_ROOT] = imx_clk_gate4("snvs_root_clk", "ipg_root", base + 0x4470, 0); 521 511 clks[IMX8MQ_CLK_UART1_ROOT] = imx_clk_gate4("uart1_root_clk", "uart1", base + 0x4490, 0); 522 512 clks[IMX8MQ_CLK_UART2_ROOT] = imx_clk_gate4("uart2_root_clk", "uart2", base + 0x44a0, 0); 523 513 clks[IMX8MQ_CLK_UART3_ROOT] = imx_clk_gate4("uart3_root_clk", "uart3", base + 0x44b0, 0); ··· 555 543 clks[IMX8MQ_ARM_PLL_OUT], 556 544 clks[IMX8MQ_SYS1_PLL_800M]); 557 545 558 - for (i = 0; i < IMX8MQ_CLK_END; i++) 559 - if (IS_ERR(clks[i])) 560 - pr_err("i.MX8mq clk %u register failed with %ld\n", 561 - i, PTR_ERR(clks[i])); 546 + imx_check_clocks(clks, ARRAY_SIZE(clks)); 562 547 563 548 clk_data.clks = clks; 564 549 clk_data.clk_num = ARRAY_SIZE(clks); 565 550 566 551 err = of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 567 552 WARN_ON(err); 553 + 554 + imx_register_uart_clocks(uart_clks); 568 555 569 556 return err; 570 557 }
+9 -5
drivers/clk/imx/clk-pfd.c
··· 121 121 .is_enabled = clk_pfd_is_enabled, 122 122 }; 123 123 124 - struct clk *imx_clk_pfd(const char *name, const char *parent_name, 124 + struct clk_hw *imx_clk_hw_pfd(const char *name, const char *parent_name, 125 125 void __iomem *reg, u8 idx) 126 126 { 127 127 struct clk_pfd *pfd; 128 - struct clk *clk; 128 + struct clk_hw *hw; 129 129 struct clk_init_data init; 130 + int ret; 130 131 131 132 pfd = kzalloc(sizeof(*pfd), GFP_KERNEL); 132 133 if (!pfd) ··· 143 142 init.num_parents = 1; 144 143 145 144 pfd->hw.init = &init; 145 + hw = &pfd->hw; 146 146 147 - clk = clk_register(NULL, &pfd->hw); 148 - if (IS_ERR(clk)) 147 + ret = clk_hw_register(NULL, hw); 148 + if (ret) { 149 149 kfree(pfd); 150 + return ERR_PTR(ret); 151 + } 150 152 151 - return clk; 153 + return hw; 152 154 }
+9 -5
drivers/clk/imx/clk-pllv3.c
··· 410 410 .recalc_rate = clk_pllv3_enet_recalc_rate, 411 411 }; 412 412 413 - struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name, 413 + struct clk_hw *imx_clk_hw_pllv3(enum imx_pllv3_type type, const char *name, 414 414 const char *parent_name, void __iomem *base, 415 415 u32 div_mask) 416 416 { 417 417 struct clk_pllv3 *pll; 418 418 const struct clk_ops *ops; 419 - struct clk *clk; 419 + struct clk_hw *hw; 420 420 struct clk_init_data init; 421 + int ret; 421 422 422 423 pll = kzalloc(sizeof(*pll), GFP_KERNEL); 423 424 if (!pll) ··· 479 478 init.num_parents = 1; 480 479 481 480 pll->hw.init = &init; 481 + hw = &pll->hw; 482 482 483 - clk = clk_register(NULL, &pll->hw); 484 - if (IS_ERR(clk)) 483 + ret = clk_hw_register(NULL, hw); 484 + if (ret) { 485 485 kfree(pll); 486 + return ERR_PTR(ret); 487 + } 486 488 487 - return clk; 489 + return hw; 488 490 }
+31 -4
drivers/clk/imx/clk.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <linux/clk.h> 3 + #include <linux/clk-provider.h> 3 4 #include <linux/err.h> 5 + #include <linux/io.h> 4 6 #include <linux/of.h> 5 7 #include <linux/slab.h> 6 8 #include <linux/spinlock.h> 7 9 #include "clk.h" 8 10 11 + #define CCM_CCDR 0x4 12 + #define CCDR_MMDC_CH0_MASK BIT(17) 13 + #define CCDR_MMDC_CH1_MASK BIT(16) 14 + 9 15 DEFINE_SPINLOCK(imx_ccm_lock); 10 16 11 - void __init imx_check_clocks(struct clk *clks[], unsigned int count) 17 + void __init imx_mmdc_mask_handshake(void __iomem *ccm_base, 18 + unsigned int chn) 19 + { 20 + unsigned int reg; 21 + 22 + reg = readl_relaxed(ccm_base + CCM_CCDR); 23 + reg |= chn == 0 ? CCDR_MMDC_CH0_MASK : CCDR_MMDC_CH1_MASK; 24 + writel_relaxed(reg, ccm_base + CCM_CCDR); 25 + } 26 + 27 + void imx_check_clocks(struct clk *clks[], unsigned int count) 12 28 { 13 29 unsigned i; 14 30 ··· 75 59 return clk; 76 60 } 77 61 62 + struct clk_hw * __init imx_obtain_fixed_clock_hw( 63 + const char *name, unsigned long rate) 64 + { 65 + struct clk *clk; 66 + 67 + clk = imx_obtain_fixed_clock_from_dt(name); 68 + if (IS_ERR(clk)) 69 + clk = imx_clk_fixed(name, rate); 70 + return __clk_get_hw(clk); 71 + } 72 + 78 73 struct clk_hw * __init imx_obtain_fixed_clk_hw(struct device_node *np, 79 74 const char *name) 80 75 { ··· 124 97 return; 125 98 } 126 99 127 - static int imx_keep_uart_clocks __initdata; 128 - static struct clk ** const *imx_uart_clocks __initdata; 100 + static int imx_keep_uart_clocks; 101 + static struct clk ** const *imx_uart_clocks; 129 102 130 103 static int __init imx_keep_uart_clocks_param(char *str) 131 104 { ··· 138 111 __setup_param("earlyprintk", imx_keep_uart_earlyprintk, 139 112 imx_keep_uart_clocks_param, 0); 140 113 141 - void __init imx_register_uart_clocks(struct clk ** const clks[]) 114 + void imx_register_uart_clocks(struct clk ** const clks[]) 142 115 { 143 116 if (imx_keep_uart_clocks) { 144 117 int i;
+108 -35
drivers/clk/imx/clk.h
··· 10 10 void imx_check_clocks(struct clk *clks[], unsigned int count); 11 11 void imx_check_clk_hws(struct clk_hw *clks[], unsigned int count); 12 12 void imx_register_uart_clocks(struct clk ** const clks[]); 13 + void imx_register_uart_clocks_hws(struct clk_hw ** const hws[]); 14 + void imx_mmdc_mask_handshake(void __iomem *ccm_base, unsigned int chn); 13 15 14 16 extern void imx_cscmr1_fixup(u32 *val); 15 17 ··· 50 48 int flags; 51 49 }; 52 50 51 + #define imx_clk_busy_divider(name, parent_name, reg, shift, width, busy_reg, busy_shift) \ 52 + imx_clk_hw_busy_divider(name, parent_name, reg, shift, width, busy_reg, busy_shift)->clk 53 + 54 + #define imx_clk_busy_mux(name, reg, shift, width, busy_reg, busy_shift, parent_names, num_parents) \ 55 + imx_clk_hw_busy_mux(name, reg, shift, width, busy_reg, busy_shift, parent_names, num_parents)->clk 56 + 57 + #define imx_clk_cpu(name, parent_name, div, mux, pll, step) \ 58 + imx_clk_hw_cpu(name, parent_name, div, mux, pll, step)->clk 59 + 60 + #define clk_register_gate2(dev, name, parent_name, flags, reg, bit_idx, \ 61 + cgr_val, clk_gate_flags, lock, share_count) \ 62 + clk_hw_register_gate2(dev, name, parent_name, flags, reg, bit_idx, \ 63 + cgr_val, clk_gate_flags, lock, share_count)->clk 64 + 65 + #define imx_clk_pllv3(type, name, parent_name, base, div_mask) \ 66 + imx_clk_hw_pllv3(type, name, parent_name, base, div_mask)->clk 67 + 68 + #define imx_clk_pfd(name, parent_name, reg, idx) \ 69 + imx_clk_hw_pfd(name, parent_name, reg, idx)->clk 70 + 71 + #define imx_clk_gate_exclusive(name, parent, reg, shift, exclusive_mask) \ 72 + imx_clk_hw_gate_exclusive(name, parent, reg, shift, exclusive_mask)->clk 73 + 74 + #define imx_clk_fixup_divider(name, parent, reg, shift, width, fixup) \ 75 + imx_clk_hw_fixup_divider(name, parent, reg, shift, width, fixup)->clk 76 + 77 + #define imx_clk_fixup_mux(name, reg, shift, width, parents, num_parents, fixup) \ 78 + imx_clk_hw_fixup_mux(name, reg, shift, width, parents, num_parents, fixup)->clk 79 + 80 + #define imx_clk_mux_ldb(name, reg, shift, width, parents, num_parents) \ 81 + imx_clk_hw_mux_ldb(name, reg, shift, width, parents, num_parents)->clk 82 + 83 + #define imx_clk_fixed_factor(name, parent, mult, div) \ 84 + imx_clk_hw_fixed_factor(name, parent, mult, div)->clk 85 + 86 + #define imx_clk_divider2(name, parent, reg, shift, width) \ 87 + imx_clk_hw_divider2(name, parent, reg, shift, width)->clk 88 + 89 + #define imx_clk_gate_dis(name, parent, reg, shift) \ 90 + imx_clk_hw_gate_dis(name, parent, reg, shift)->clk 91 + 92 + #define imx_clk_gate_dis_flags(name, parent, reg, shift, flags) \ 93 + imx_clk_hw_gate_dis_flags(name, parent, reg, shift, flags)->clk 94 + 95 + #define imx_clk_gate_flags(name, parent, reg, shift, flags) \ 96 + imx_clk_hw_gate_flags(name, parent, reg, shift, flags)->clk 97 + 98 + #define imx_clk_gate2(name, parent, reg, shift) \ 99 + imx_clk_hw_gate2(name, parent, reg, shift)->clk 100 + 101 + #define imx_clk_gate2_flags(name, parent, reg, shift, flags) \ 102 + imx_clk_hw_gate2_flags(name, parent, reg, shift, flags)->clk 103 + 104 + #define imx_clk_gate2_shared(name, parent, reg, shift, share_count) \ 105 + imx_clk_hw_gate2_shared(name, parent, reg, shift, share_count)->clk 106 + 107 + #define imx_clk_gate2_shared2(name, parent, reg, shift, share_count) \ 108 + imx_clk_hw_gate2_shared2(name, parent, reg, shift, share_count)->clk 109 + 110 + #define imx_clk_gate3(name, parent, reg, shift) \ 111 + imx_clk_hw_gate3(name, parent, reg, shift)->clk 112 + 113 + #define imx_clk_gate4(name, parent, reg, shift) \ 114 + imx_clk_hw_gate4(name, parent, reg, shift)->clk 115 + 116 + #define imx_clk_mux(name, reg, shift, width, parents, num_parents) \ 117 + imx_clk_hw_mux(name, reg, shift, width, parents, num_parents)->clk 118 + 53 119 struct clk *imx_clk_pll14xx(const char *name, const char *parent_name, 54 120 void __iomem *base, const struct imx_pll14xx_clk *pll_clk); 55 121 ··· 150 80 IMX_PLLV3_AV_IMX7, 151 81 }; 152 82 153 - struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name, 83 + struct clk_hw *imx_clk_hw_pllv3(enum imx_pllv3_type type, const char *name, 154 84 const char *parent_name, void __iomem *base, u32 div_mask); 155 85 156 86 struct clk_hw *imx_clk_pllv4(const char *name, const char *parent_name, 157 87 void __iomem *base); 158 88 159 - struct clk *clk_register_gate2(struct device *dev, const char *name, 89 + struct clk_hw *clk_hw_register_gate2(struct device *dev, const char *name, 160 90 const char *parent_name, unsigned long flags, 161 91 void __iomem *reg, u8 bit_idx, u8 cgr_val, 162 92 u8 clk_gate_flags, spinlock_t *lock, ··· 165 95 struct clk * imx_obtain_fixed_clock( 166 96 const char *name, unsigned long rate); 167 97 98 + struct clk_hw *imx_obtain_fixed_clock_hw( 99 + const char *name, unsigned long rate); 100 + 168 101 struct clk_hw *imx_obtain_fixed_clk_hw(struct device_node *np, 169 102 const char *name); 170 103 171 - struct clk *imx_clk_gate_exclusive(const char *name, const char *parent, 104 + struct clk_hw *imx_clk_hw_gate_exclusive(const char *name, const char *parent, 172 105 void __iomem *reg, u8 shift, u32 exclusive_mask); 173 106 174 - struct clk *imx_clk_pfd(const char *name, const char *parent_name, 107 + struct clk_hw *imx_clk_hw_pfd(const char *name, const char *parent_name, 175 108 void __iomem *reg, u8 idx); 176 109 177 110 struct clk_hw *imx_clk_pfdv2(const char *name, const char *parent_name, 178 111 void __iomem *reg, u8 idx); 179 112 180 - struct clk *imx_clk_busy_divider(const char *name, const char *parent_name, 113 + struct clk_hw *imx_clk_hw_busy_divider(const char *name, const char *parent_name, 181 114 void __iomem *reg, u8 shift, u8 width, 182 115 void __iomem *busy_reg, u8 busy_shift); 183 116 184 - struct clk *imx_clk_busy_mux(const char *name, void __iomem *reg, u8 shift, 117 + struct clk_hw *imx_clk_hw_busy_mux(const char *name, void __iomem *reg, u8 shift, 185 118 u8 width, void __iomem *busy_reg, u8 busy_shift, 186 119 const char * const *parent_names, int num_parents); 187 120 ··· 194 121 bool rate_present, bool gate_present, 195 122 void __iomem *reg); 196 123 197 - struct clk *imx_clk_fixup_divider(const char *name, const char *parent, 124 + struct clk_hw *imx_clk_hw_fixup_divider(const char *name, const char *parent, 198 125 void __iomem *reg, u8 shift, u8 width, 199 126 void (*fixup)(u32 *val)); 200 127 201 - struct clk *imx_clk_fixup_mux(const char *name, void __iomem *reg, 128 + struct clk_hw *imx_clk_hw_fixup_mux(const char *name, void __iomem *reg, 202 129 u8 shift, u8 width, const char * const *parents, 203 130 int num_parents, void (*fixup)(u32 *val)); 204 131 ··· 212 139 return clk_hw_register_fixed_rate(NULL, name, NULL, 0, rate); 213 140 } 214 141 215 - static inline struct clk *imx_clk_mux_ldb(const char *name, void __iomem *reg, 142 + static inline struct clk_hw *imx_clk_hw_mux_ldb(const char *name, void __iomem *reg, 216 143 u8 shift, u8 width, const char * const *parents, 217 144 int num_parents) 218 145 { 219 - return clk_register_mux(NULL, name, parents, num_parents, 146 + return clk_hw_register_mux(NULL, name, parents, num_parents, 220 147 CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT, reg, 221 148 shift, width, CLK_MUX_READ_ONLY, &imx_ccm_lock); 222 149 } 223 150 224 - static inline struct clk *imx_clk_fixed_factor(const char *name, 151 + static inline struct clk_hw *imx_clk_hw_fixed_factor(const char *name, 225 152 const char *parent, unsigned int mult, unsigned int div) 226 153 { 227 - return clk_register_fixed_factor(NULL, name, parent, 154 + return clk_hw_register_fixed_factor(NULL, name, parent, 228 155 CLK_SET_RATE_PARENT, mult, div); 229 156 } 230 157 ··· 261 188 reg, shift, width, 0, &imx_ccm_lock); 262 189 } 263 190 264 - static inline struct clk *imx_clk_divider2(const char *name, const char *parent, 191 + static inline struct clk_hw *imx_clk_hw_divider2(const char *name, const char *parent, 265 192 void __iomem *reg, u8 shift, u8 width) 266 193 { 267 - return clk_register_divider(NULL, name, parent, 194 + return clk_hw_register_divider(NULL, name, parent, 268 195 CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE, 269 196 reg, shift, width, 0, &imx_ccm_lock); 270 197 } ··· 285 212 shift, 0, &imx_ccm_lock); 286 213 } 287 214 288 - static inline struct clk *imx_clk_gate_flags(const char *name, const char *parent, 215 + static inline struct clk_hw *imx_clk_hw_gate_flags(const char *name, const char *parent, 289 216 void __iomem *reg, u8 shift, unsigned long flags) 290 217 { 291 - return clk_register_gate(NULL, name, parent, flags | CLK_SET_RATE_PARENT, reg, 218 + return clk_hw_register_gate(NULL, name, parent, flags | CLK_SET_RATE_PARENT, reg, 292 219 shift, 0, &imx_ccm_lock); 293 220 } 294 221 ··· 299 226 shift, 0, &imx_ccm_lock); 300 227 } 301 228 302 - static inline struct clk *imx_clk_gate_dis(const char *name, const char *parent, 229 + static inline struct clk_hw *imx_clk_hw_gate_dis(const char *name, const char *parent, 303 230 void __iomem *reg, u8 shift) 304 231 { 305 - return clk_register_gate(NULL, name, parent, CLK_SET_RATE_PARENT, reg, 232 + return clk_hw_register_gate(NULL, name, parent, CLK_SET_RATE_PARENT, reg, 306 233 shift, CLK_GATE_SET_TO_DISABLE, &imx_ccm_lock); 307 234 } 308 235 309 - static inline struct clk *imx_clk_gate_dis_flags(const char *name, const char *parent, 236 + static inline struct clk_hw *imx_clk_hw_gate_dis_flags(const char *name, const char *parent, 310 237 void __iomem *reg, u8 shift, unsigned long flags) 311 238 { 312 - return clk_register_gate(NULL, name, parent, flags | CLK_SET_RATE_PARENT, reg, 239 + return clk_hw_register_gate(NULL, name, parent, flags | CLK_SET_RATE_PARENT, reg, 313 240 shift, CLK_GATE_SET_TO_DISABLE, &imx_ccm_lock); 314 241 } 315 242 316 - static inline struct clk *imx_clk_gate2(const char *name, const char *parent, 243 + static inline struct clk_hw *imx_clk_hw_gate2(const char *name, const char *parent, 317 244 void __iomem *reg, u8 shift) 318 245 { 319 - return clk_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT, reg, 246 + return clk_hw_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT, reg, 320 247 shift, 0x3, 0, &imx_ccm_lock, NULL); 321 248 } 322 249 323 - static inline struct clk *imx_clk_gate2_flags(const char *name, const char *parent, 250 + static inline struct clk_hw *imx_clk_hw_gate2_flags(const char *name, const char *parent, 324 251 void __iomem *reg, u8 shift, unsigned long flags) 325 252 { 326 - return clk_register_gate2(NULL, name, parent, flags | CLK_SET_RATE_PARENT, reg, 253 + return clk_hw_register_gate2(NULL, name, parent, flags | CLK_SET_RATE_PARENT, reg, 327 254 shift, 0x3, 0, &imx_ccm_lock, NULL); 328 255 } 329 256 330 - static inline struct clk *imx_clk_gate2_shared(const char *name, 257 + static inline struct clk_hw *imx_clk_hw_gate2_shared(const char *name, 331 258 const char *parent, void __iomem *reg, u8 shift, 332 259 unsigned int *share_count) 333 260 { 334 - return clk_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT, reg, 261 + return clk_hw_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT, reg, 335 262 shift, 0x3, 0, &imx_ccm_lock, share_count); 336 263 } 337 264 338 - static inline struct clk *imx_clk_gate2_shared2(const char *name, 265 + static inline struct clk_hw *imx_clk_hw_gate2_shared2(const char *name, 339 266 const char *parent, void __iomem *reg, u8 shift, 340 267 unsigned int *share_count) 341 268 { 342 - return clk_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT | 269 + return clk_hw_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT | 343 270 CLK_OPS_PARENT_ENABLE, reg, shift, 0x3, 0, 344 271 &imx_ccm_lock, share_count); 345 272 } ··· 351 278 shift, cgr_val, 0, &imx_ccm_lock, NULL); 352 279 } 353 280 354 - static inline struct clk *imx_clk_gate3(const char *name, const char *parent, 281 + static inline struct clk_hw *imx_clk_hw_gate3(const char *name, const char *parent, 355 282 void __iomem *reg, u8 shift) 356 283 { 357 - return clk_register_gate(NULL, name, parent, 284 + return clk_hw_register_gate(NULL, name, parent, 358 285 CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE, 359 286 reg, shift, 0, &imx_ccm_lock); 360 287 } ··· 368 295 reg, shift, 0, &imx_ccm_lock); 369 296 } 370 297 371 - static inline struct clk *imx_clk_gate4(const char *name, const char *parent, 298 + static inline struct clk_hw *imx_clk_hw_gate4(const char *name, const char *parent, 372 299 void __iomem *reg, u8 shift) 373 300 { 374 - return clk_register_gate2(NULL, name, parent, 301 + return clk_hw_register_gate2(NULL, name, parent, 375 302 CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE, 376 303 reg, shift, 0x3, 0, &imx_ccm_lock, NULL); 377 304 } ··· 385 312 reg, shift, 0x3, 0, &imx_ccm_lock, NULL); 386 313 } 387 314 388 - static inline struct clk *imx_clk_mux(const char *name, void __iomem *reg, 315 + static inline struct clk_hw *imx_clk_hw_mux(const char *name, void __iomem *reg, 389 316 u8 shift, u8 width, const char * const *parents, 390 317 int num_parents) 391 318 { 392 - return clk_register_mux(NULL, name, parents, num_parents, 319 + return clk_hw_register_mux(NULL, name, parents, num_parents, 393 320 CLK_SET_RATE_NO_REPARENT, reg, shift, 394 321 width, 0, &imx_ccm_lock); 395 322 } ··· 446 373 reg, shift, width, 0, &imx_ccm_lock); 447 374 } 448 375 449 - struct clk *imx_clk_cpu(const char *name, const char *parent_name, 376 + struct clk_hw *imx_clk_hw_cpu(const char *name, const char *parent_name, 450 377 struct clk *div, struct clk *mux, struct clk *pll, 451 378 struct clk *step); 452 379
+1 -1
drivers/clk/ingenic/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 - obj-$(CONFIG_INGENIC_CGU_COMMON) += cgu.o 2 + obj-$(CONFIG_INGENIC_CGU_COMMON) += cgu.o pm.o 3 3 obj-$(CONFIG_INGENIC_CGU_JZ4740) += jz4740-cgu.o 4 4 obj-$(CONFIG_INGENIC_CGU_JZ4725B) += jz4725b-cgu.o 5 5 obj-$(CONFIG_INGENIC_CGU_JZ4770) += jz4770-cgu.o
+35 -6
drivers/clk/ingenic/cgu.c
··· 375 375 div_reg = readl(cgu->base + clk_info->div.reg); 376 376 div = (div_reg >> clk_info->div.shift) & 377 377 GENMASK(clk_info->div.bits - 1, 0); 378 - div += 1; 379 - div *= clk_info->div.div; 378 + 379 + if (clk_info->div.div_table) 380 + div = clk_info->div.div_table[div]; 381 + else 382 + div = (div + 1) * clk_info->div.div; 380 383 381 384 rate /= div; 382 385 } else if (clk_info->type & CGU_CLK_FIXDIV) { ··· 389 386 return rate; 390 387 } 391 388 389 + static unsigned int 390 + ingenic_clk_calc_hw_div(const struct ingenic_cgu_clk_info *clk_info, 391 + unsigned int div) 392 + { 393 + unsigned int i; 394 + 395 + for (i = 0; i < (1 << clk_info->div.bits) 396 + && clk_info->div.div_table[i]; i++) { 397 + if (clk_info->div.div_table[i] >= div) 398 + return i; 399 + } 400 + 401 + return i - 1; 402 + } 403 + 392 404 static unsigned 393 405 ingenic_clk_calc_div(const struct ingenic_cgu_clk_info *clk_info, 394 406 unsigned long parent_rate, unsigned long req_rate) 395 407 { 396 - unsigned div; 408 + unsigned int div, hw_div; 397 409 398 410 /* calculate the divide */ 399 411 div = DIV_ROUND_UP(parent_rate, req_rate); 400 412 401 - /* and impose hardware constraints */ 413 + if (clk_info->div.div_table) { 414 + hw_div = ingenic_clk_calc_hw_div(clk_info, div); 415 + 416 + return clk_info->div.div_table[hw_div]; 417 + } 418 + 419 + /* Impose hardware constraints */ 402 420 div = min_t(unsigned, div, 1 << clk_info->div.bits); 403 421 div = max_t(unsigned, div, 1); 404 422 ··· 462 438 const struct ingenic_cgu_clk_info *clk_info; 463 439 const unsigned timeout = 100; 464 440 unsigned long rate, flags; 465 - unsigned div, i; 441 + unsigned int hw_div, div, i; 466 442 u32 reg, mask; 467 443 int ret = 0; 468 444 ··· 475 451 if (rate != req_rate) 476 452 return -EINVAL; 477 453 454 + if (clk_info->div.div_table) 455 + hw_div = ingenic_clk_calc_hw_div(clk_info, div); 456 + else 457 + hw_div = ((div / clk_info->div.div) - 1); 458 + 478 459 spin_lock_irqsave(&cgu->lock, flags); 479 460 reg = readl(cgu->base + clk_info->div.reg); 480 461 481 462 /* update the divide */ 482 463 mask = GENMASK(clk_info->div.bits - 1, 0); 483 464 reg &= ~(mask << clk_info->div.shift); 484 - reg |= ((div / clk_info->div.div) - 1) << clk_info->div.shift; 465 + reg |= hw_div << clk_info->div.shift; 485 466 486 467 /* clear the stop bit */ 487 468 if (clk_info->div.stop_bit != -1)
+4
drivers/clk/ingenic/cgu.h
··· 10 10 #define __DRIVERS_CLK_INGENIC_CGU_H__ 11 11 12 12 #include <linux/bitops.h> 13 + #include <linux/clk-provider.h> 13 14 #include <linux/of.h> 14 15 #include <linux/spinlock.h> 15 16 ··· 80 79 * isn't one 81 80 * @busy_bit: the index of the busy bit within reg, or -1 if there isn't one 82 81 * @stop_bit: the index of the stop bit within reg, or -1 if there isn't one 82 + * @div_table: optional table to map the value read from the register to the 83 + * actual divider value 83 84 */ 84 85 struct ingenic_cgu_div_info { 85 86 unsigned reg; ··· 91 88 s8 ce_bit; 92 89 s8 busy_bit; 93 90 s8 stop_bit; 91 + const u8 *div_table; 94 92 }; 95 93 96 94 /**
+35 -6
drivers/clk/ingenic/jz4725b-cgu.c
··· 11 11 #include <linux/of.h> 12 12 #include <dt-bindings/clock/jz4725b-cgu.h> 13 13 #include "cgu.h" 14 + #include "pm.h" 14 15 15 16 /* CGU register offsets */ 16 17 #define CGU_REG_CPCCR 0x00 ··· 32 31 33 32 static const s8 pll_od_encoding[4] = { 34 33 0x0, 0x1, -1, 0x3, 34 + }; 35 + 36 + static const u8 jz4725b_cgu_cpccr_div_table[] = { 37 + 1, 2, 3, 4, 6, 8, 38 + }; 39 + 40 + static const u8 jz4725b_cgu_pll_half_div_table[] = { 41 + 2, 1, 35 42 }; 36 43 37 44 static const struct ingenic_cgu_clk_info jz4725b_cgu_clocks[] = { ··· 75 66 [JZ4725B_CLK_PLL_HALF] = { 76 67 "pll half", CGU_CLK_DIV, 77 68 .parents = { JZ4725B_CLK_PLL, -1, -1, -1 }, 78 - .div = { CGU_REG_CPCCR, 21, 1, 1, -1, -1, -1 }, 69 + .div = { 70 + CGU_REG_CPCCR, 21, 1, 1, -1, -1, -1, 71 + jz4725b_cgu_pll_half_div_table, 72 + }, 79 73 }, 80 74 81 75 [JZ4725B_CLK_CCLK] = { 82 76 "cclk", CGU_CLK_DIV, 83 77 .parents = { JZ4725B_CLK_PLL, -1, -1, -1 }, 84 - .div = { CGU_REG_CPCCR, 0, 1, 4, 22, -1, -1 }, 78 + .div = { 79 + CGU_REG_CPCCR, 0, 1, 4, 22, -1, -1, 80 + jz4725b_cgu_cpccr_div_table, 81 + }, 85 82 }, 86 83 87 84 [JZ4725B_CLK_HCLK] = { 88 85 "hclk", CGU_CLK_DIV, 89 86 .parents = { JZ4725B_CLK_PLL, -1, -1, -1 }, 90 - .div = { CGU_REG_CPCCR, 4, 1, 4, 22, -1, -1 }, 87 + .div = { 88 + CGU_REG_CPCCR, 4, 1, 4, 22, -1, -1, 89 + jz4725b_cgu_cpccr_div_table, 90 + }, 91 91 }, 92 92 93 93 [JZ4725B_CLK_PCLK] = { 94 94 "pclk", CGU_CLK_DIV, 95 95 .parents = { JZ4725B_CLK_PLL, -1, -1, -1 }, 96 - .div = { CGU_REG_CPCCR, 8, 1, 4, 22, -1, -1 }, 96 + .div = { 97 + CGU_REG_CPCCR, 8, 1, 4, 22, -1, -1, 98 + jz4725b_cgu_cpccr_div_table, 99 + }, 97 100 }, 98 101 99 102 [JZ4725B_CLK_MCLK] = { 100 103 "mclk", CGU_CLK_DIV, 101 104 .parents = { JZ4725B_CLK_PLL, -1, -1, -1 }, 102 - .div = { CGU_REG_CPCCR, 12, 1, 4, 22, -1, -1 }, 105 + .div = { 106 + CGU_REG_CPCCR, 12, 1, 4, 22, -1, -1, 107 + jz4725b_cgu_cpccr_div_table, 108 + }, 103 109 }, 104 110 105 111 [JZ4725B_CLK_IPU] = { 106 112 "ipu", CGU_CLK_DIV | CGU_CLK_GATE, 107 113 .parents = { JZ4725B_CLK_PLL, -1, -1, -1 }, 108 - .div = { CGU_REG_CPCCR, 16, 1, 4, 22, -1, -1 }, 114 + .div = { 115 + CGU_REG_CPCCR, 16, 1, 4, 22, -1, -1, 116 + jz4725b_cgu_cpccr_div_table, 117 + }, 109 118 .gate = { CGU_REG_CLKGR, 13 }, 110 119 }, 111 120 ··· 254 227 retval = ingenic_cgu_register_clocks(cgu); 255 228 if (retval) 256 229 pr_err("%s: failed to register CGU Clocks\n", __func__); 230 + 231 + ingenic_cgu_register_syscore_ops(cgu); 257 232 } 258 233 CLK_OF_DECLARE(jz4725b_cgu, "ingenic,jz4725b-cgu", jz4725b_cgu_init);
+27 -78
drivers/clk/ingenic/jz4740-cgu.c
··· 11 11 #include <linux/io.h> 12 12 #include <linux/of.h> 13 13 #include <dt-bindings/clock/jz4740-cgu.h> 14 - #include <asm/mach-jz4740/clock.h> 15 14 #include "cgu.h" 15 + #include "pm.h" 16 16 17 17 /* CGU register offsets */ 18 18 #define CGU_REG_CPCCR 0x00 ··· 47 47 48 48 static const s8 pll_od_encoding[4] = { 49 49 0x0, 0x1, -1, 0x3, 50 + }; 51 + 52 + static const u8 jz4740_cgu_cpccr_div_table[] = { 53 + 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 50 54 }; 51 55 52 56 static const struct ingenic_cgu_clk_info jz4740_cgu_clocks[] = { ··· 92 88 [JZ4740_CLK_CCLK] = { 93 89 "cclk", CGU_CLK_DIV, 94 90 .parents = { JZ4740_CLK_PLL, -1, -1, -1 }, 95 - .div = { CGU_REG_CPCCR, 0, 1, 4, 22, -1, -1 }, 91 + .div = { 92 + CGU_REG_CPCCR, 0, 1, 4, 22, -1, -1, 93 + jz4740_cgu_cpccr_div_table, 94 + }, 96 95 }, 97 96 98 97 [JZ4740_CLK_HCLK] = { 99 98 "hclk", CGU_CLK_DIV, 100 99 .parents = { JZ4740_CLK_PLL, -1, -1, -1 }, 101 - .div = { CGU_REG_CPCCR, 4, 1, 4, 22, -1, -1 }, 100 + .div = { 101 + CGU_REG_CPCCR, 4, 1, 4, 22, -1, -1, 102 + jz4740_cgu_cpccr_div_table, 103 + }, 102 104 }, 103 105 104 106 [JZ4740_CLK_PCLK] = { 105 107 "pclk", CGU_CLK_DIV, 106 108 .parents = { JZ4740_CLK_PLL, -1, -1, -1 }, 107 - .div = { CGU_REG_CPCCR, 8, 1, 4, 22, -1, -1 }, 109 + .div = { 110 + CGU_REG_CPCCR, 8, 1, 4, 22, -1, -1, 111 + jz4740_cgu_cpccr_div_table, 112 + }, 108 113 }, 109 114 110 115 [JZ4740_CLK_MCLK] = { 111 116 "mclk", CGU_CLK_DIV, 112 117 .parents = { JZ4740_CLK_PLL, -1, -1, -1 }, 113 - .div = { CGU_REG_CPCCR, 12, 1, 4, 22, -1, -1 }, 118 + .div = { 119 + CGU_REG_CPCCR, 12, 1, 4, 22, -1, -1, 120 + jz4740_cgu_cpccr_div_table, 121 + }, 114 122 }, 115 123 116 124 [JZ4740_CLK_LCD] = { 117 125 "lcd", CGU_CLK_DIV | CGU_CLK_GATE, 118 126 .parents = { JZ4740_CLK_PLL_HALF, -1, -1, -1 }, 119 - .div = { CGU_REG_CPCCR, 16, 1, 5, 22, -1, -1 }, 127 + .div = { 128 + CGU_REG_CPCCR, 16, 1, 5, 22, -1, -1, 129 + jz4740_cgu_cpccr_div_table, 130 + }, 120 131 .gate = { CGU_REG_CLKGR, 10 }, 121 132 }, 122 133 ··· 238 219 retval = ingenic_cgu_register_clocks(cgu); 239 220 if (retval) 240 221 pr_err("%s: failed to register CGU Clocks\n", __func__); 222 + 223 + ingenic_cgu_register_syscore_ops(cgu); 241 224 } 242 225 CLK_OF_DECLARE(jz4740_cgu, "ingenic,jz4740-cgu", jz4740_cgu_init); 243 - 244 - void jz4740_clock_set_wait_mode(enum jz4740_wait_mode mode) 245 - { 246 - uint32_t lcr = readl(cgu->base + CGU_REG_LCR); 247 - 248 - switch (mode) { 249 - case JZ4740_WAIT_MODE_IDLE: 250 - lcr &= ~LCR_SLEEP; 251 - break; 252 - 253 - case JZ4740_WAIT_MODE_SLEEP: 254 - lcr |= LCR_SLEEP; 255 - break; 256 - } 257 - 258 - writel(lcr, cgu->base + CGU_REG_LCR); 259 - } 260 - 261 - void jz4740_clock_udc_disable_auto_suspend(void) 262 - { 263 - uint32_t clkgr = readl(cgu->base + CGU_REG_CLKGR); 264 - 265 - clkgr &= ~CLKGR_UDC; 266 - writel(clkgr, cgu->base + CGU_REG_CLKGR); 267 - } 268 - EXPORT_SYMBOL_GPL(jz4740_clock_udc_disable_auto_suspend); 269 - 270 - void jz4740_clock_udc_enable_auto_suspend(void) 271 - { 272 - uint32_t clkgr = readl(cgu->base + CGU_REG_CLKGR); 273 - 274 - clkgr |= CLKGR_UDC; 275 - writel(clkgr, cgu->base + CGU_REG_CLKGR); 276 - } 277 - EXPORT_SYMBOL_GPL(jz4740_clock_udc_enable_auto_suspend); 278 - 279 - #define JZ_CLOCK_GATE_UART0 BIT(0) 280 - #define JZ_CLOCK_GATE_TCU BIT(1) 281 - #define JZ_CLOCK_GATE_DMAC BIT(12) 282 - 283 - void jz4740_clock_suspend(void) 284 - { 285 - uint32_t clkgr, cppcr; 286 - 287 - clkgr = readl(cgu->base + CGU_REG_CLKGR); 288 - clkgr |= JZ_CLOCK_GATE_TCU | JZ_CLOCK_GATE_DMAC | JZ_CLOCK_GATE_UART0; 289 - writel(clkgr, cgu->base + CGU_REG_CLKGR); 290 - 291 - cppcr = readl(cgu->base + CGU_REG_CPPCR); 292 - cppcr &= ~BIT(jz4740_cgu_clocks[JZ4740_CLK_PLL].pll.enable_bit); 293 - writel(cppcr, cgu->base + CGU_REG_CPPCR); 294 - } 295 - 296 - void jz4740_clock_resume(void) 297 - { 298 - uint32_t clkgr, cppcr, stable; 299 - 300 - cppcr = readl(cgu->base + CGU_REG_CPPCR); 301 - cppcr |= BIT(jz4740_cgu_clocks[JZ4740_CLK_PLL].pll.enable_bit); 302 - writel(cppcr, cgu->base + CGU_REG_CPPCR); 303 - 304 - stable = BIT(jz4740_cgu_clocks[JZ4740_CLK_PLL].pll.stable_bit); 305 - do { 306 - cppcr = readl(cgu->base + CGU_REG_CPPCR); 307 - } while (!(cppcr & stable)); 308 - 309 - clkgr = readl(cgu->base + CGU_REG_CLKGR); 310 - clkgr &= ~JZ_CLOCK_GATE_TCU; 311 - clkgr &= ~JZ_CLOCK_GATE_DMAC; 312 - clkgr &= ~JZ_CLOCK_GATE_UART0; 313 - writel(clkgr, cgu->base + CGU_REG_CLKGR); 314 - }
+30 -37
drivers/clk/ingenic/jz4770-cgu.c
··· 9 9 #include <linux/delay.h> 10 10 #include <linux/io.h> 11 11 #include <linux/of.h> 12 - #include <linux/syscore_ops.h> 13 12 #include <dt-bindings/clock/jz4770-cgu.h> 14 13 #include "cgu.h" 14 + #include "pm.h" 15 15 16 16 /* 17 17 * CPM registers offset address definition ··· 37 37 #define CGU_REG_MSC1CDR 0xA4 38 38 #define CGU_REG_MSC2CDR 0xA8 39 39 #define CGU_REG_BCHCDR 0xAC 40 - 41 - /* bits within the LCR register */ 42 - #define LCR_LPM BIT(0) /* Low Power Mode */ 43 40 44 41 /* bits within the OPCR register */ 45 42 #define OPCR_SPENDH BIT(5) /* UHC PHY suspend */ ··· 82 85 83 86 static const s8 pll_od_encoding[8] = { 84 87 0x0, 0x1, -1, 0x2, -1, -1, -1, 0x3, 88 + }; 89 + 90 + static const u8 jz4770_cgu_cpccr_div_table[] = { 91 + 1, 2, 3, 4, 6, 8, 12, 85 92 }; 86 93 87 94 static const struct ingenic_cgu_clk_info jz4770_cgu_clocks[] = { ··· 145 144 [JZ4770_CLK_CCLK] = { 146 145 "cclk", CGU_CLK_DIV, 147 146 .parents = { JZ4770_CLK_PLL0, }, 148 - .div = { CGU_REG_CPCCR, 0, 1, 4, 22, -1, -1 }, 147 + .div = { 148 + CGU_REG_CPCCR, 0, 1, 4, 22, -1, -1, 149 + jz4770_cgu_cpccr_div_table, 150 + }, 149 151 }, 150 152 [JZ4770_CLK_H0CLK] = { 151 153 "h0clk", CGU_CLK_DIV, 152 154 .parents = { JZ4770_CLK_PLL0, }, 153 - .div = { CGU_REG_CPCCR, 4, 1, 4, 22, -1, -1 }, 155 + .div = { 156 + CGU_REG_CPCCR, 4, 1, 4, 22, -1, -1, 157 + jz4770_cgu_cpccr_div_table, 158 + }, 154 159 }, 155 160 [JZ4770_CLK_H1CLK] = { 156 161 "h1clk", CGU_CLK_DIV | CGU_CLK_GATE, 157 162 .parents = { JZ4770_CLK_PLL0, }, 158 - .div = { CGU_REG_CPCCR, 24, 1, 4, 22, -1, -1 }, 163 + .div = { 164 + CGU_REG_CPCCR, 24, 1, 4, 22, -1, -1, 165 + jz4770_cgu_cpccr_div_table, 166 + }, 159 167 .gate = { CGU_REG_CLKGR1, 7 }, 160 168 }, 161 169 [JZ4770_CLK_H2CLK] = { 162 170 "h2clk", CGU_CLK_DIV, 163 171 .parents = { JZ4770_CLK_PLL0, }, 164 - .div = { CGU_REG_CPCCR, 16, 1, 4, 22, -1, -1 }, 172 + .div = { 173 + CGU_REG_CPCCR, 16, 1, 4, 22, -1, -1, 174 + jz4770_cgu_cpccr_div_table, 175 + }, 165 176 }, 166 177 [JZ4770_CLK_C1CLK] = { 167 178 "c1clk", CGU_CLK_DIV | CGU_CLK_GATE, 168 179 .parents = { JZ4770_CLK_PLL0, }, 169 - .div = { CGU_REG_CPCCR, 12, 1, 4, 22, -1, -1 }, 180 + .div = { 181 + CGU_REG_CPCCR, 12, 1, 4, 22, -1, -1, 182 + jz4770_cgu_cpccr_div_table, 183 + }, 170 184 .gate = { CGU_REG_OPCR, 31, true }, // disable CCLK stop on idle 171 185 }, 172 186 [JZ4770_CLK_PCLK] = { 173 187 "pclk", CGU_CLK_DIV, 174 188 .parents = { JZ4770_CLK_PLL0, }, 175 - .div = { CGU_REG_CPCCR, 8, 1, 4, 22, -1, -1 }, 189 + .div = { 190 + CGU_REG_CPCCR, 8, 1, 4, 22, -1, -1, 191 + jz4770_cgu_cpccr_div_table, 192 + }, 176 193 }, 177 194 178 195 /* Those divided clocks can connect to PLL0 or PLL1 */ ··· 426 407 }, 427 408 }; 428 409 429 - #if IS_ENABLED(CONFIG_PM_SLEEP) 430 - static int jz4770_cgu_pm_suspend(void) 431 - { 432 - u32 val; 433 - 434 - val = readl(cgu->base + CGU_REG_LCR); 435 - writel(val | LCR_LPM, cgu->base + CGU_REG_LCR); 436 - return 0; 437 - } 438 - 439 - static void jz4770_cgu_pm_resume(void) 440 - { 441 - u32 val; 442 - 443 - val = readl(cgu->base + CGU_REG_LCR); 444 - writel(val & ~LCR_LPM, cgu->base + CGU_REG_LCR); 445 - } 446 - 447 - static struct syscore_ops jz4770_cgu_pm_ops = { 448 - .suspend = jz4770_cgu_pm_suspend, 449 - .resume = jz4770_cgu_pm_resume, 450 - }; 451 - #endif /* CONFIG_PM_SLEEP */ 452 - 453 410 static void __init jz4770_cgu_init(struct device_node *np) 454 411 { 455 412 int retval; ··· 439 444 if (retval) 440 445 pr_err("%s: failed to register CGU Clocks\n", __func__); 441 446 442 - #if IS_ENABLED(CONFIG_PM_SLEEP) 443 - register_syscore_ops(&jz4770_cgu_pm_ops); 444 - #endif 447 + ingenic_cgu_register_syscore_ops(cgu); 445 448 } 446 449 447 450 /* We only probe via devicetree, no need for a platform driver */
+3
drivers/clk/ingenic/jz4780-cgu.c
··· 12 12 #include <linux/of.h> 13 13 #include <dt-bindings/clock/jz4780-cgu.h> 14 14 #include "cgu.h" 15 + #include "pm.h" 15 16 16 17 /* CGU register offsets */ 17 18 #define CGU_REG_CLOCKCONTROL 0x00 ··· 722 721 pr_err("%s: failed to register CGU Clocks\n", __func__); 723 722 return; 724 723 } 724 + 725 + ingenic_cgu_register_syscore_ops(cgu); 725 726 } 726 727 CLK_OF_DECLARE(jz4780_cgu, "ingenic,jz4780-cgu", jz4780_cgu_init);
+45
drivers/clk/ingenic/pm.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (C) 2019 Paul Cercueil <paul@crapouillou.net> 4 + */ 5 + 6 + #include "cgu.h" 7 + #include "pm.h" 8 + 9 + #include <linux/io.h> 10 + #include <linux/syscore_ops.h> 11 + 12 + #define CGU_REG_LCR 0x04 13 + 14 + #define LCR_LOW_POWER_MODE BIT(0) 15 + 16 + static void __iomem * __maybe_unused ingenic_cgu_base; 17 + 18 + static int __maybe_unused ingenic_cgu_pm_suspend(void) 19 + { 20 + u32 val = readl(ingenic_cgu_base + CGU_REG_LCR); 21 + 22 + writel(val | LCR_LOW_POWER_MODE, ingenic_cgu_base + CGU_REG_LCR); 23 + 24 + return 0; 25 + } 26 + 27 + static void __maybe_unused ingenic_cgu_pm_resume(void) 28 + { 29 + u32 val = readl(ingenic_cgu_base + CGU_REG_LCR); 30 + 31 + writel(val & ~LCR_LOW_POWER_MODE, ingenic_cgu_base + CGU_REG_LCR); 32 + } 33 + 34 + static struct syscore_ops __maybe_unused ingenic_cgu_pm_ops = { 35 + .suspend = ingenic_cgu_pm_suspend, 36 + .resume = ingenic_cgu_pm_resume, 37 + }; 38 + 39 + void ingenic_cgu_register_syscore_ops(struct ingenic_cgu *cgu) 40 + { 41 + if (IS_ENABLED(CONFIG_PM_SLEEP)) { 42 + ingenic_cgu_base = cgu->base; 43 + register_syscore_ops(&ingenic_cgu_pm_ops); 44 + } 45 + }
+12
drivers/clk/ingenic/pm.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (C) 2019 Paul Cercueil <paul@crapouillou.net> 4 + */ 5 + #ifndef DRIVERS_CLK_INGENIC_PM_H 6 + #define DRIVERS_CLK_INGENIC_PM_H 7 + 8 + struct ingenic_cgu; 9 + 10 + void ingenic_cgu_register_syscore_ops(struct ingenic_cgu *cgu); 11 + 12 + #endif /* DRIVERS_CLK_INGENIC_PM_H */
+11
drivers/clk/keystone/Kconfig
··· 15 15 This adds the clock driver support over TI System Control Interface. 16 16 If you wish to use clock resources from the PMMC firmware, say Y. 17 17 Otherwise, say N. 18 + 19 + config TI_SCI_CLK_PROBE_FROM_FW 20 + bool "Probe available clocks from firmware" 21 + depends on TI_SCI_CLK 22 + default n 23 + help 24 + Forces the TI SCI clock driver to probe available clocks from the 25 + firmware. By default, only the used clocks are probed from DT. 26 + This is mostly only useful for debugging purposes, and will 27 + increase the boot time of the device. If you want the clocks probed 28 + from firmware, say Y. Otherwise, say N.
+201 -38
drivers/clk/keystone/sci-clk.c
··· 23 23 #include <linux/slab.h> 24 24 #include <linux/soc/ti/ti_sci_protocol.h> 25 25 #include <linux/bsearch.h> 26 + #include <linux/list_sort.h> 26 27 27 28 #define SCI_CLK_SSC_ENABLE BIT(0) 28 29 #define SCI_CLK_ALLOW_FREQ_CHANGE BIT(1) ··· 53 52 * @num_parents: Number of parents for this clock 54 53 * @provider: Master clock provider 55 54 * @flags: Flags for the clock 55 + * @node: Link for handling clocks probed via DT 56 56 */ 57 57 struct sci_clk { 58 58 struct clk_hw hw; 59 59 u16 dev_id; 60 - u8 clk_id; 61 - u8 num_parents; 60 + u32 clk_id; 61 + u32 num_parents; 62 62 struct sci_clk_provider *provider; 63 63 u8 flags; 64 + struct list_head node; 64 65 }; 65 66 66 67 #define to_sci_clk(_hw) container_of(_hw, struct sci_clk, hw) ··· 221 218 static u8 sci_clk_get_parent(struct clk_hw *hw) 222 219 { 223 220 struct sci_clk *clk = to_sci_clk(hw); 224 - u8 parent_id; 221 + u32 parent_id = 0; 225 222 int ret; 226 223 227 224 ret = clk->provider->ops->get_parent(clk->provider->sci, clk->dev_id, 228 - clk->clk_id, &parent_id); 225 + clk->clk_id, (void *)&parent_id); 229 226 if (ret) { 230 227 dev_err(clk->provider->dev, 231 228 "get-parent failed for dev=%d, clk=%d, ret=%d\n", ··· 233 230 return 0; 234 231 } 235 232 236 - return parent_id - clk->clk_id - 1; 233 + parent_id = parent_id - clk->clk_id - 1; 234 + 235 + return (u8)parent_id; 237 236 } 238 237 239 238 /** ··· 285 280 int i; 286 281 int ret = 0; 287 282 288 - name = kasprintf(GFP_KERNEL, "%s:%d:%d", dev_name(provider->dev), 289 - sci_clk->dev_id, sci_clk->clk_id); 283 + name = kasprintf(GFP_KERNEL, "clk:%d:%d", sci_clk->dev_id, 284 + sci_clk->clk_id); 290 285 291 286 init.name = name; 292 287 ··· 311 306 for (i = 0; i < sci_clk->num_parents; i++) { 312 307 char *parent_name; 313 308 314 - parent_name = kasprintf(GFP_KERNEL, "%s:%d:%d", 315 - dev_name(provider->dev), 309 + parent_name = kasprintf(GFP_KERNEL, "clk:%d:%d", 316 310 sci_clk->dev_id, 317 311 sci_clk->clk_id + 1 + i); 318 312 if (!parent_name) { ··· 408 404 }; 409 405 MODULE_DEVICE_TABLE(of, ti_sci_clk_of_match); 410 406 411 - /** 412 - * ti_sci_clk_probe - Probe function for the TI SCI clock driver 413 - * @pdev: platform device pointer to be probed 414 - * 415 - * Probes the TI SCI clock device. Allocates a new clock provider 416 - * and registers this to the common clock framework. Also applies 417 - * any required flags to the identified clocks via clock lists 418 - * supplied from DT. Returns 0 for success, negative error value 419 - * for failure. 420 - */ 421 - static int ti_sci_clk_probe(struct platform_device *pdev) 407 + #ifdef CONFIG_TI_SCI_CLK_PROBE_FROM_FW 408 + static int ti_sci_scan_clocks_from_fw(struct sci_clk_provider *provider) 422 409 { 423 - struct device *dev = &pdev->dev; 424 - struct device_node *np = dev->of_node; 425 - struct sci_clk_provider *provider; 426 - const struct ti_sci_handle *handle; 427 410 int ret; 428 411 int num_clks = 0; 429 412 struct sci_clk **clks = NULL; ··· 419 428 int max_clks = 0; 420 429 int clk_id = 0; 421 430 int dev_id = 0; 422 - u8 num_parents; 431 + u32 num_parents = 0; 423 432 int gap_size = 0; 424 - 425 - handle = devm_ti_sci_get_handle(dev); 426 - if (IS_ERR(handle)) 427 - return PTR_ERR(handle); 428 - 429 - provider = devm_kzalloc(dev, sizeof(*provider), GFP_KERNEL); 430 - if (!provider) 431 - return -ENOMEM; 432 - 433 - provider->sci = handle; 434 - provider->ops = &handle->ops.clk_ops; 435 - provider->dev = dev; 433 + struct device *dev = provider->dev; 436 434 437 435 while (1) { 438 436 ret = provider->ops->get_num_parents(provider->sci, dev_id, 439 - clk_id, &num_parents); 437 + clk_id, 438 + (void *)&num_parents); 440 439 if (ret) { 441 440 gap_size++; 442 441 if (!clk_id) { ··· 482 501 provider->num_clocks = num_clks; 483 502 484 503 devm_kfree(dev, clks); 504 + 505 + return 0; 506 + } 507 + 508 + #else 509 + 510 + static int _cmp_sci_clk_list(void *priv, struct list_head *a, 511 + struct list_head *b) 512 + { 513 + struct sci_clk *ca = container_of(a, struct sci_clk, node); 514 + struct sci_clk *cb = container_of(b, struct sci_clk, node); 515 + 516 + return _cmp_sci_clk(ca, &cb); 517 + } 518 + 519 + static int ti_sci_scan_clocks_from_dt(struct sci_clk_provider *provider) 520 + { 521 + struct device *dev = provider->dev; 522 + struct device_node *np = NULL; 523 + int ret; 524 + int index; 525 + struct of_phandle_args args; 526 + struct list_head clks; 527 + struct sci_clk *sci_clk, *prev; 528 + int num_clks = 0; 529 + int num_parents; 530 + int clk_id; 531 + const char * const clk_names[] = { 532 + "clocks", "assigned-clocks", "assigned-clock-parents", NULL 533 + }; 534 + const char * const *clk_name; 535 + 536 + INIT_LIST_HEAD(&clks); 537 + 538 + clk_name = clk_names; 539 + 540 + while (*clk_name) { 541 + np = of_find_node_with_property(np, *clk_name); 542 + if (!np) { 543 + clk_name++; 544 + break; 545 + } 546 + 547 + if (!of_device_is_available(np)) 548 + continue; 549 + 550 + index = 0; 551 + 552 + do { 553 + ret = of_parse_phandle_with_args(np, *clk_name, 554 + "#clock-cells", index, 555 + &args); 556 + if (ret) 557 + break; 558 + 559 + if (args.args_count == 2 && args.np == dev->of_node) { 560 + sci_clk = devm_kzalloc(dev, sizeof(*sci_clk), 561 + GFP_KERNEL); 562 + if (!sci_clk) 563 + return -ENOMEM; 564 + 565 + sci_clk->dev_id = args.args[0]; 566 + sci_clk->clk_id = args.args[1]; 567 + sci_clk->provider = provider; 568 + provider->ops->get_num_parents(provider->sci, 569 + sci_clk->dev_id, 570 + sci_clk->clk_id, 571 + (void *)&sci_clk->num_parents); 572 + list_add_tail(&sci_clk->node, &clks); 573 + 574 + num_clks++; 575 + 576 + num_parents = sci_clk->num_parents; 577 + if (num_parents == 1) 578 + num_parents = 0; 579 + 580 + /* 581 + * Linux kernel has inherent limitation 582 + * of 255 clock parents at the moment. 583 + * Right now, it is not expected that 584 + * any mux clock from sci-clk driver 585 + * would exceed that limit either, but 586 + * the ABI basically provides that 587 + * possibility. Print out a warning if 588 + * this happens for any clock. 589 + */ 590 + if (num_parents >= 255) { 591 + dev_warn(dev, "too many parents for dev=%d, clk=%d (%d), cropping to 255.\n", 592 + sci_clk->dev_id, 593 + sci_clk->clk_id, num_parents); 594 + num_parents = 255; 595 + } 596 + 597 + clk_id = args.args[1] + 1; 598 + 599 + while (num_parents--) { 600 + sci_clk = devm_kzalloc(dev, 601 + sizeof(*sci_clk), 602 + GFP_KERNEL); 603 + if (!sci_clk) 604 + return -ENOMEM; 605 + sci_clk->dev_id = args.args[0]; 606 + sci_clk->clk_id = clk_id++; 607 + sci_clk->provider = provider; 608 + list_add_tail(&sci_clk->node, &clks); 609 + 610 + num_clks++; 611 + } 612 + } 613 + 614 + index++; 615 + } while (args.np); 616 + } 617 + 618 + list_sort(NULL, &clks, _cmp_sci_clk_list); 619 + 620 + provider->clocks = devm_kmalloc_array(dev, num_clks, sizeof(sci_clk), 621 + GFP_KERNEL); 622 + if (!provider->clocks) 623 + return -ENOMEM; 624 + 625 + num_clks = 0; 626 + prev = NULL; 627 + 628 + list_for_each_entry(sci_clk, &clks, node) { 629 + if (prev && prev->dev_id == sci_clk->dev_id && 630 + prev->clk_id == sci_clk->clk_id) 631 + continue; 632 + 633 + provider->clocks[num_clks++] = sci_clk; 634 + prev = sci_clk; 635 + } 636 + 637 + provider->num_clocks = num_clks; 638 + 639 + return 0; 640 + } 641 + #endif 642 + 643 + /** 644 + * ti_sci_clk_probe - Probe function for the TI SCI clock driver 645 + * @pdev: platform device pointer to be probed 646 + * 647 + * Probes the TI SCI clock device. Allocates a new clock provider 648 + * and registers this to the common clock framework. Also applies 649 + * any required flags to the identified clocks via clock lists 650 + * supplied from DT. Returns 0 for success, negative error value 651 + * for failure. 652 + */ 653 + static int ti_sci_clk_probe(struct platform_device *pdev) 654 + { 655 + struct device *dev = &pdev->dev; 656 + struct device_node *np = dev->of_node; 657 + struct sci_clk_provider *provider; 658 + const struct ti_sci_handle *handle; 659 + int ret; 660 + 661 + handle = devm_ti_sci_get_handle(dev); 662 + if (IS_ERR(handle)) 663 + return PTR_ERR(handle); 664 + 665 + provider = devm_kzalloc(dev, sizeof(*provider), GFP_KERNEL); 666 + if (!provider) 667 + return -ENOMEM; 668 + 669 + provider->sci = handle; 670 + provider->ops = &handle->ops.clk_ops; 671 + provider->dev = dev; 672 + 673 + #ifdef CONFIG_TI_SCI_CLK_PROBE_FROM_FW 674 + ret = ti_sci_scan_clocks_from_fw(provider); 675 + if (ret) { 676 + dev_err(dev, "scan clocks from FW failed: %d\n", ret); 677 + return ret; 678 + } 679 + #else 680 + ret = ti_sci_scan_clocks_from_dt(provider); 681 + if (ret) { 682 + dev_err(dev, "scan clocks from DT failed: %d\n", ret); 683 + return ret; 684 + } 685 + #endif 485 686 486 687 ret = ti_sci_init_clocks(provider); 487 688 if (ret) {
+6
drivers/clk/mediatek/Kconfig
··· 300 300 help 301 301 This driver supports MediaTek MT8516 clocks. 302 302 303 + config COMMON_CLK_MT8516_AUDSYS 304 + bool "Clock driver for MediaTek MT8516 audsys" 305 + depends on COMMON_CLK_MT8516 306 + help 307 + This driver supports MediaTek MT8516 audsys clocks. 308 + 303 309 endmenu
+1
drivers/clk/mediatek/Makefile
··· 45 45 obj-$(CONFIG_COMMON_CLK_MT8183_VDECSYS) += clk-mt8183-vdec.o 46 46 obj-$(CONFIG_COMMON_CLK_MT8183_VENCSYS) += clk-mt8183-venc.o 47 47 obj-$(CONFIG_COMMON_CLK_MT8516) += clk-mt8516.o 48 + obj-$(CONFIG_COMMON_CLK_MT8516_AUDSYS) += clk-mt8516-aud.o
-19
drivers/clk/mediatek/clk-mt8183.c
··· 395 395 "syspll_d5" 396 396 }; 397 397 398 - static const char * const sspm_parents[] = { 399 - "clk26m", 400 - "univpll_d2_d4", 401 - "syspll_d2_d2", 402 - "univpll_d2_d2", 403 - "syspll_d3" 404 - }; 405 - 406 398 static const char * const dpi0_parents[] = { 407 399 "clk26m", 408 400 "tvdpll_d2", ··· 598 606 MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_ATB, "atb_sel", 599 607 atb_parents, 0xa0, 600 608 0xa4, 0xa8, 0, 2, 7, 0x004, 24), 601 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_SSPM, "sspm_sel", 602 - sspm_parents, 0xa0, 603 - 0xa4, 0xa8, 8, 3, 15, 0x004, 25), 604 609 MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_DPI0, "dpi0_sel", 605 610 dpi0_parents, 0xa0, 606 611 0xa4, 0xa8, 16, 4, 23, 0x004, 26), ··· 936 947 "fufs_sel", 13), 937 948 GATE_INFRA2(CLK_INFRA_MD32_BCLK, "infra_md32_bclk", 938 949 "axi_sel", 14), 939 - GATE_INFRA2(CLK_INFRA_SSPM, "infra_sspm", 940 - "sspm_sel", 15), 941 950 GATE_INFRA2(CLK_INFRA_UNIPRO_MBIST, "infra_unipro_mbist", 942 951 "axi_sel", 16), 943 - GATE_INFRA2(CLK_INFRA_SSPM_BUS_HCLK, "infra_sspm_bus_hclk", 944 - "axi_sel", 17), 945 952 GATE_INFRA2(CLK_INFRA_I2C5, "infra_i2c5", 946 953 "i2c_sel", 18), 947 954 GATE_INFRA2(CLK_INFRA_I2C5_ARBITER, "infra_i2c5_arbiter", ··· 971 986 "msdc50_0_sel", 1), 972 987 GATE_INFRA3(CLK_INFRA_MSDC2_SELF, "infra_msdc2_self", 973 988 "msdc50_0_sel", 2), 974 - GATE_INFRA3(CLK_INFRA_SSPM_26M_SELF, "infra_sspm_26m_self", 975 - "f_f26m_ck", 3), 976 - GATE_INFRA3(CLK_INFRA_SSPM_32K_SELF, "infra_sspm_32k_self", 977 - "f_f26m_ck", 4), 978 989 GATE_INFRA3(CLK_INFRA_UFS_AXI, "infra_ufs_axi", 979 990 "axi_sel", 5), 980 991 GATE_INFRA3(CLK_INFRA_I2C6, "infra_i2c6",
+65
drivers/clk/mediatek/clk-mt8516-aud.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (c) 2019 MediaTek Inc. 4 + * Author: James Liao <jamesjj.liao@mediatek.com> 5 + * Fabien Parent <fparent@baylibre.com> 6 + */ 7 + 8 + #include <linux/clk-provider.h> 9 + #include <linux/of.h> 10 + #include <linux/of_address.h> 11 + #include <linux/of_device.h> 12 + #include <linux/platform_device.h> 13 + 14 + #include "clk-mtk.h" 15 + #include "clk-gate.h" 16 + 17 + #include <dt-bindings/clock/mt8516-clk.h> 18 + 19 + static const struct mtk_gate_regs aud_cg_regs = { 20 + .set_ofs = 0x0, 21 + .clr_ofs = 0x0, 22 + .sta_ofs = 0x0, 23 + }; 24 + 25 + #define GATE_AUD(_id, _name, _parent, _shift) { \ 26 + .id = _id, \ 27 + .name = _name, \ 28 + .parent_name = _parent, \ 29 + .regs = &aud_cg_regs, \ 30 + .shift = _shift, \ 31 + .ops = &mtk_clk_gate_ops_no_setclr, \ 32 + } 33 + 34 + static const struct mtk_gate aud_clks[] __initconst = { 35 + GATE_AUD(CLK_AUD_AFE, "aud_afe", "clk26m_ck", 2), 36 + GATE_AUD(CLK_AUD_I2S, "aud_i2s", "i2s_infra_bck", 6), 37 + GATE_AUD(CLK_AUD_22M, "aud_22m", "rg_aud_engen1", 8), 38 + GATE_AUD(CLK_AUD_24M, "aud_24m", "rg_aud_engen2", 9), 39 + GATE_AUD(CLK_AUD_INTDIR, "aud_intdir", "rg_aud_spdif_in", 15), 40 + GATE_AUD(CLK_AUD_APLL2_TUNER, "aud_apll2_tuner", "rg_aud_engen2", 18), 41 + GATE_AUD(CLK_AUD_APLL_TUNER, "aud_apll_tuner", "rg_aud_engen1", 19), 42 + GATE_AUD(CLK_AUD_HDMI, "aud_hdmi", "apll12_div4", 20), 43 + GATE_AUD(CLK_AUD_SPDF, "aud_spdf", "apll12_div6", 21), 44 + GATE_AUD(CLK_AUD_ADC, "aud_adc", "aud_afe", 24), 45 + GATE_AUD(CLK_AUD_DAC, "aud_dac", "aud_afe", 25), 46 + GATE_AUD(CLK_AUD_DAC_PREDIS, "aud_dac_predis", "aud_afe", 26), 47 + GATE_AUD(CLK_AUD_TML, "aud_tml", "aud_afe", 27), 48 + }; 49 + 50 + static void __init mtk_audsys_init(struct device_node *node) 51 + { 52 + struct clk_onecell_data *clk_data; 53 + int r; 54 + 55 + clk_data = mtk_alloc_clk_data(CLK_AUD_NR_CLK); 56 + 57 + mtk_clk_register_gates(node, aud_clks, ARRAY_SIZE(aud_clks), clk_data); 58 + 59 + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); 60 + if (r) 61 + pr_err("%s(): could not register clock provider: %d\n", 62 + __func__, r); 63 + 64 + } 65 + CLK_OF_DECLARE(mtk_audsys, "mediatek,mt8516-audsys", mtk_audsys_init);
-5
drivers/clk/mediatek/clk-mt8516.c
··· 231 231 "nfi1x_ck" 232 232 }; 233 233 234 - static const char * const ddrphycfg_parents[] __initconst = { 235 - "clk26m_ck", 236 - "mainpll_d16" 237 - }; 238 - 239 234 static const char * const usb_78m_parents[] __initconst = { 240 235 "clk_null", 241 236 "clk26m_ck",
+5 -5
drivers/clk/meson/axg.c
··· 469 469 .shift = 16, 470 470 .width = 9, 471 471 }, 472 - .ssen = { 473 - .reg_off = HHI_MPLL_CNTL, 474 - .shift = 25, 475 - .width = 1, 476 - }, 477 472 .misc = { 478 473 .reg_off = HHI_PLL_TOP_MISC, 479 474 .shift = 0, ··· 562 567 .reg_off = HHI_MPLL_CNTL9, 563 568 .shift = 16, 564 569 .width = 9, 570 + }, 571 + .ssen = { 572 + .reg_off = HHI_MPLL_CNTL, 573 + .shift = 25, 574 + .width = 1, 565 575 }, 566 576 .misc = { 567 577 .reg_off = HHI_PLL_TOP_MISC,
+26 -10
drivers/clk/meson/clk-mpll.c
··· 115 115 else 116 116 __acquire(mpll->lock); 117 117 118 - /* Enable and set the fractional part */ 118 + /* Set the fractional part */ 119 119 meson_parm_write(clk->map, &mpll->sdm, sdm); 120 - meson_parm_write(clk->map, &mpll->sdm_en, 1); 121 - 122 - /* Set additional fractional part enable if required */ 123 - if (MESON_PARM_APPLICABLE(&mpll->ssen)) 124 - meson_parm_write(clk->map, &mpll->ssen, 1); 125 120 126 121 /* Set the integer divider part */ 127 122 meson_parm_write(clk->map, &mpll->n2, n2); 128 - 129 - /* Set the magic misc bit if required */ 130 - if (MESON_PARM_APPLICABLE(&mpll->misc)) 131 - meson_parm_write(clk->map, &mpll->misc, 1); 132 123 133 124 if (mpll->lock) 134 125 spin_unlock_irqrestore(mpll->lock, flags); ··· 127 136 __release(mpll->lock); 128 137 129 138 return 0; 139 + } 140 + 141 + static void mpll_init(struct clk_hw *hw) 142 + { 143 + struct clk_regmap *clk = to_clk_regmap(hw); 144 + struct meson_clk_mpll_data *mpll = meson_clk_mpll_data(clk); 145 + 146 + if (mpll->init_count) 147 + regmap_multi_reg_write(clk->map, mpll->init_regs, 148 + mpll->init_count); 149 + 150 + /* Enable the fractional part */ 151 + meson_parm_write(clk->map, &mpll->sdm_en, 1); 152 + 153 + /* Set spread spectrum if possible */ 154 + if (MESON_PARM_APPLICABLE(&mpll->ssen)) { 155 + unsigned int ss = 156 + mpll->flags & CLK_MESON_MPLL_SPREAD_SPECTRUM ? 1 : 0; 157 + meson_parm_write(clk->map, &mpll->ssen, ss); 158 + } 159 + 160 + /* Set the magic misc bit if required */ 161 + if (MESON_PARM_APPLICABLE(&mpll->misc)) 162 + meson_parm_write(clk->map, &mpll->misc, 1); 130 163 } 131 164 132 165 const struct clk_ops meson_clk_mpll_ro_ops = { ··· 163 148 .recalc_rate = mpll_recalc_rate, 164 149 .round_rate = mpll_round_rate, 165 150 .set_rate = mpll_set_rate, 151 + .init = mpll_init, 166 152 }; 167 153 EXPORT_SYMBOL_GPL(meson_clk_mpll_ops); 168 154
+3
drivers/clk/meson/clk-mpll.h
··· 18 18 struct parm n2; 19 19 struct parm ssen; 20 20 struct parm misc; 21 + const struct reg_sequence *init_regs; 22 + unsigned int init_count; 21 23 spinlock_t *lock; 22 24 u8 flags; 23 25 }; 24 26 25 27 #define CLK_MESON_MPLL_ROUND_CLOSEST BIT(0) 28 + #define CLK_MESON_MPLL_SPREAD_SPECTRUM BIT(1) 26 29 27 30 extern const struct clk_ops meson_clk_mpll_ro_ops; 28 31 extern const struct clk_ops meson_clk_mpll_ops;
+834 -1
drivers/clk/meson/g12a.c
··· 150 150 }, 151 151 }; 152 152 153 + static struct clk_regmap g12b_sys1_pll_dco = { 154 + .data = &(struct meson_clk_pll_data){ 155 + .en = { 156 + .reg_off = HHI_SYS1_PLL_CNTL0, 157 + .shift = 28, 158 + .width = 1, 159 + }, 160 + .m = { 161 + .reg_off = HHI_SYS1_PLL_CNTL0, 162 + .shift = 0, 163 + .width = 8, 164 + }, 165 + .n = { 166 + .reg_off = HHI_SYS1_PLL_CNTL0, 167 + .shift = 10, 168 + .width = 5, 169 + }, 170 + .l = { 171 + .reg_off = HHI_SYS1_PLL_CNTL0, 172 + .shift = 31, 173 + .width = 1, 174 + }, 175 + .rst = { 176 + .reg_off = HHI_SYS1_PLL_CNTL0, 177 + .shift = 29, 178 + .width = 1, 179 + }, 180 + }, 181 + .hw.init = &(struct clk_init_data){ 182 + .name = "sys1_pll_dco", 183 + .ops = &meson_clk_pll_ro_ops, 184 + .parent_names = (const char *[]){ IN_PREFIX "xtal" }, 185 + .num_parents = 1, 186 + }, 187 + }; 188 + 189 + static struct clk_regmap g12b_sys1_pll = { 190 + .data = &(struct clk_regmap_div_data){ 191 + .offset = HHI_SYS1_PLL_CNTL0, 192 + .shift = 16, 193 + .width = 3, 194 + .flags = CLK_DIVIDER_POWER_OF_TWO, 195 + }, 196 + .hw.init = &(struct clk_init_data){ 197 + .name = "sys1_pll", 198 + .ops = &clk_regmap_divider_ro_ops, 199 + .parent_names = (const char *[]){ "sys1_pll_dco" }, 200 + .num_parents = 1, 201 + }, 202 + }; 203 + 153 204 static struct clk_regmap g12a_sys_pll_div16_en = { 154 205 .data = &(struct clk_regmap_gate_data){ 155 206 .offset = HHI_SYS_CPU_CLK_CNTL1, ··· 218 167 }, 219 168 }; 220 169 170 + static struct clk_regmap g12b_sys1_pll_div16_en = { 171 + .data = &(struct clk_regmap_gate_data){ 172 + .offset = HHI_SYS_CPUB_CLK_CNTL1, 173 + .bit_idx = 24, 174 + }, 175 + .hw.init = &(struct clk_init_data) { 176 + .name = "sys1_pll_div16_en", 177 + .ops = &clk_regmap_gate_ro_ops, 178 + .parent_names = (const char *[]){ "sys1_pll" }, 179 + .num_parents = 1, 180 + /* 181 + * This clock is used to debug the sys_pll range 182 + * Linux should not change it at runtime 183 + */ 184 + }, 185 + }; 186 + 221 187 static struct clk_fixed_factor g12a_sys_pll_div16 = { 222 188 .mult = 1, 223 189 .div = 16, ··· 242 174 .name = "sys_pll_div16", 243 175 .ops = &clk_fixed_factor_ops, 244 176 .parent_names = (const char *[]){ "sys_pll_div16_en" }, 177 + .num_parents = 1, 178 + }, 179 + }; 180 + 181 + static struct clk_fixed_factor g12b_sys1_pll_div16 = { 182 + .mult = 1, 183 + .div = 16, 184 + .hw.init = &(struct clk_init_data){ 185 + .name = "sys1_pll_div16", 186 + .ops = &clk_fixed_factor_ops, 187 + .parent_names = (const char *[]){ "sys1_pll_div16_en" }, 245 188 .num_parents = 1, 246 189 }, 247 190 }; ··· 385 306 }, 386 307 }; 387 308 309 + /* Datasheet names this field as "Final_mux_sel" */ 310 + static struct clk_regmap g12b_cpu_clk = { 311 + .data = &(struct clk_regmap_mux_data){ 312 + .offset = HHI_SYS_CPU_CLK_CNTL0, 313 + .mask = 0x1, 314 + .shift = 11, 315 + }, 316 + .hw.init = &(struct clk_init_data){ 317 + .name = "cpu_clk", 318 + .ops = &clk_regmap_mux_ro_ops, 319 + .parent_names = (const char *[]){ "cpu_clk_dyn", 320 + "sys1_pll" }, 321 + .num_parents = 2, 322 + }, 323 + }; 324 + 325 + /* Datasheet names this field as "premux0" */ 326 + static struct clk_regmap g12b_cpub_clk_premux0 = { 327 + .data = &(struct clk_regmap_mux_data){ 328 + .offset = HHI_SYS_CPUB_CLK_CNTL, 329 + .mask = 0x3, 330 + .shift = 0, 331 + }, 332 + .hw.init = &(struct clk_init_data){ 333 + .name = "cpub_clk_dyn0_sel", 334 + .ops = &clk_regmap_mux_ro_ops, 335 + .parent_names = (const char *[]){ IN_PREFIX "xtal", 336 + "fclk_div2", 337 + "fclk_div3" }, 338 + .num_parents = 3, 339 + }, 340 + }; 341 + 342 + /* Datasheet names this field as "mux0_divn_tcnt" */ 343 + static struct clk_regmap g12b_cpub_clk_mux0_div = { 344 + .data = &(struct clk_regmap_div_data){ 345 + .offset = HHI_SYS_CPUB_CLK_CNTL, 346 + .shift = 4, 347 + .width = 6, 348 + }, 349 + .hw.init = &(struct clk_init_data){ 350 + .name = "cpub_clk_dyn0_div", 351 + .ops = &clk_regmap_divider_ro_ops, 352 + .parent_names = (const char *[]){ "cpub_clk_dyn0_sel" }, 353 + .num_parents = 1, 354 + }, 355 + }; 356 + 357 + /* Datasheet names this field as "postmux0" */ 358 + static struct clk_regmap g12b_cpub_clk_postmux0 = { 359 + .data = &(struct clk_regmap_mux_data){ 360 + .offset = HHI_SYS_CPUB_CLK_CNTL, 361 + .mask = 0x1, 362 + .shift = 2, 363 + }, 364 + .hw.init = &(struct clk_init_data){ 365 + .name = "cpub_clk_dyn0", 366 + .ops = &clk_regmap_mux_ro_ops, 367 + .parent_names = (const char *[]){ "cpub_clk_dyn0_sel", 368 + "cpub_clk_dyn0_div" }, 369 + .num_parents = 2, 370 + }, 371 + }; 372 + 373 + /* Datasheet names this field as "premux1" */ 374 + static struct clk_regmap g12b_cpub_clk_premux1 = { 375 + .data = &(struct clk_regmap_mux_data){ 376 + .offset = HHI_SYS_CPUB_CLK_CNTL, 377 + .mask = 0x3, 378 + .shift = 16, 379 + }, 380 + .hw.init = &(struct clk_init_data){ 381 + .name = "cpub_clk_dyn1_sel", 382 + .ops = &clk_regmap_mux_ro_ops, 383 + .parent_names = (const char *[]){ IN_PREFIX "xtal", 384 + "fclk_div2", 385 + "fclk_div3" }, 386 + .num_parents = 3, 387 + }, 388 + }; 389 + 390 + /* Datasheet names this field as "Mux1_divn_tcnt" */ 391 + static struct clk_regmap g12b_cpub_clk_mux1_div = { 392 + .data = &(struct clk_regmap_div_data){ 393 + .offset = HHI_SYS_CPUB_CLK_CNTL, 394 + .shift = 20, 395 + .width = 6, 396 + }, 397 + .hw.init = &(struct clk_init_data){ 398 + .name = "cpub_clk_dyn1_div", 399 + .ops = &clk_regmap_divider_ro_ops, 400 + .parent_names = (const char *[]){ "cpub_clk_dyn1_sel" }, 401 + .num_parents = 1, 402 + }, 403 + }; 404 + 405 + /* Datasheet names this field as "postmux1" */ 406 + static struct clk_regmap g12b_cpub_clk_postmux1 = { 407 + .data = &(struct clk_regmap_mux_data){ 408 + .offset = HHI_SYS_CPUB_CLK_CNTL, 409 + .mask = 0x1, 410 + .shift = 18, 411 + }, 412 + .hw.init = &(struct clk_init_data){ 413 + .name = "cpub_clk_dyn1", 414 + .ops = &clk_regmap_mux_ro_ops, 415 + .parent_names = (const char *[]){ "cpub_clk_dyn1_sel", 416 + "cpub_clk_dyn1_div" }, 417 + .num_parents = 2, 418 + }, 419 + }; 420 + 421 + /* Datasheet names this field as "Final_dyn_mux_sel" */ 422 + static struct clk_regmap g12b_cpub_clk_dyn = { 423 + .data = &(struct clk_regmap_mux_data){ 424 + .offset = HHI_SYS_CPUB_CLK_CNTL, 425 + .mask = 0x1, 426 + .shift = 10, 427 + }, 428 + .hw.init = &(struct clk_init_data){ 429 + .name = "cpub_clk_dyn", 430 + .ops = &clk_regmap_mux_ro_ops, 431 + .parent_names = (const char *[]){ "cpub_clk_dyn0", 432 + "cpub_clk_dyn1" }, 433 + .num_parents = 2, 434 + }, 435 + }; 436 + 437 + /* Datasheet names this field as "Final_mux_sel" */ 438 + static struct clk_regmap g12b_cpub_clk = { 439 + .data = &(struct clk_regmap_mux_data){ 440 + .offset = HHI_SYS_CPUB_CLK_CNTL, 441 + .mask = 0x1, 442 + .shift = 11, 443 + }, 444 + .hw.init = &(struct clk_init_data){ 445 + .name = "cpub_clk", 446 + .ops = &clk_regmap_mux_ro_ops, 447 + .parent_names = (const char *[]){ "cpub_clk_dyn", 448 + "sys_pll" }, 449 + .num_parents = 2, 450 + }, 451 + }; 452 + 388 453 static struct clk_regmap g12a_cpu_clk_div16_en = { 389 454 .data = &(struct clk_regmap_gate_data){ 390 455 .offset = HHI_SYS_CPU_CLK_CNTL1, ··· 546 323 }, 547 324 }; 548 325 326 + static struct clk_regmap g12b_cpub_clk_div16_en = { 327 + .data = &(struct clk_regmap_gate_data){ 328 + .offset = HHI_SYS_CPUB_CLK_CNTL1, 329 + .bit_idx = 1, 330 + }, 331 + .hw.init = &(struct clk_init_data) { 332 + .name = "cpub_clk_div16_en", 333 + .ops = &clk_regmap_gate_ro_ops, 334 + .parent_names = (const char *[]){ "cpub_clk" }, 335 + .num_parents = 1, 336 + /* 337 + * This clock is used to debug the cpu_clk range 338 + * Linux should not change it at runtime 339 + */ 340 + }, 341 + }; 342 + 549 343 static struct clk_fixed_factor g12a_cpu_clk_div16 = { 550 344 .mult = 1, 551 345 .div = 16, ··· 570 330 .name = "cpu_clk_div16", 571 331 .ops = &clk_fixed_factor_ops, 572 332 .parent_names = (const char *[]){ "cpu_clk_div16_en" }, 333 + .num_parents = 1, 334 + }, 335 + }; 336 + 337 + static struct clk_fixed_factor g12b_cpub_clk_div16 = { 338 + .mult = 1, 339 + .div = 16, 340 + .hw.init = &(struct clk_init_data){ 341 + .name = "cpub_clk_div16", 342 + .ops = &clk_fixed_factor_ops, 343 + .parent_names = (const char *[]){ "cpub_clk_div16_en" }, 573 344 .num_parents = 1, 574 345 }, 575 346 }; ··· 705 454 .name = "cpu_clk_trace", 706 455 .ops = &clk_regmap_gate_ro_ops, 707 456 .parent_names = (const char *[]){ "cpu_clk_trace_div" }, 457 + .num_parents = 1, 458 + /* 459 + * This clock is set by the ROM monitor code, 460 + * Linux should not change it at runtime 461 + */ 462 + }, 463 + }; 464 + 465 + static struct clk_fixed_factor g12b_cpub_clk_div2 = { 466 + .mult = 1, 467 + .div = 2, 468 + .hw.init = &(struct clk_init_data){ 469 + .name = "cpub_clk_div2", 470 + .ops = &clk_fixed_factor_ops, 471 + .parent_names = (const char *[]){ "cpub_clk" }, 472 + .num_parents = 1, 473 + }, 474 + }; 475 + 476 + static struct clk_fixed_factor g12b_cpub_clk_div3 = { 477 + .mult = 1, 478 + .div = 3, 479 + .hw.init = &(struct clk_init_data){ 480 + .name = "cpub_clk_div3", 481 + .ops = &clk_fixed_factor_ops, 482 + .parent_names = (const char *[]){ "cpub_clk" }, 483 + .num_parents = 1, 484 + }, 485 + }; 486 + 487 + static struct clk_fixed_factor g12b_cpub_clk_div4 = { 488 + .mult = 1, 489 + .div = 4, 490 + .hw.init = &(struct clk_init_data){ 491 + .name = "cpub_clk_div4", 492 + .ops = &clk_fixed_factor_ops, 493 + .parent_names = (const char *[]){ "cpub_clk" }, 494 + .num_parents = 1, 495 + }, 496 + }; 497 + 498 + static struct clk_fixed_factor g12b_cpub_clk_div5 = { 499 + .mult = 1, 500 + .div = 5, 501 + .hw.init = &(struct clk_init_data){ 502 + .name = "cpub_clk_div5", 503 + .ops = &clk_fixed_factor_ops, 504 + .parent_names = (const char *[]){ "cpub_clk" }, 505 + .num_parents = 1, 506 + }, 507 + }; 508 + 509 + static struct clk_fixed_factor g12b_cpub_clk_div6 = { 510 + .mult = 1, 511 + .div = 6, 512 + .hw.init = &(struct clk_init_data){ 513 + .name = "cpub_clk_div6", 514 + .ops = &clk_fixed_factor_ops, 515 + .parent_names = (const char *[]){ "cpub_clk" }, 516 + .num_parents = 1, 517 + }, 518 + }; 519 + 520 + static struct clk_fixed_factor g12b_cpub_clk_div7 = { 521 + .mult = 1, 522 + .div = 7, 523 + .hw.init = &(struct clk_init_data){ 524 + .name = "cpub_clk_div7", 525 + .ops = &clk_fixed_factor_ops, 526 + .parent_names = (const char *[]){ "cpub_clk" }, 527 + .num_parents = 1, 528 + }, 529 + }; 530 + 531 + static struct clk_fixed_factor g12b_cpub_clk_div8 = { 532 + .mult = 1, 533 + .div = 8, 534 + .hw.init = &(struct clk_init_data){ 535 + .name = "cpub_clk_div8", 536 + .ops = &clk_fixed_factor_ops, 537 + .parent_names = (const char *[]){ "cpub_clk" }, 538 + .num_parents = 1, 539 + }, 540 + }; 541 + 542 + static u32 mux_table_cpub[] = { 1, 2, 3, 4, 5, 6, 7 }; 543 + static struct clk_regmap g12b_cpub_clk_apb_sel = { 544 + .data = &(struct clk_regmap_mux_data){ 545 + .offset = HHI_SYS_CPUB_CLK_CNTL1, 546 + .mask = 7, 547 + .shift = 3, 548 + .table = mux_table_cpub, 549 + }, 550 + .hw.init = &(struct clk_init_data){ 551 + .name = "cpub_clk_apb_sel", 552 + .ops = &clk_regmap_mux_ro_ops, 553 + .parent_names = (const char *[]){ "cpub_clk_div2", 554 + "cpub_clk_div3", 555 + "cpub_clk_div4", 556 + "cpub_clk_div5", 557 + "cpub_clk_div6", 558 + "cpub_clk_div7", 559 + "cpub_clk_div8" }, 560 + .num_parents = 7, 561 + }, 562 + }; 563 + 564 + static struct clk_regmap g12b_cpub_clk_apb = { 565 + .data = &(struct clk_regmap_gate_data){ 566 + .offset = HHI_SYS_CPUB_CLK_CNTL1, 567 + .bit_idx = 16, 568 + .flags = CLK_GATE_SET_TO_DISABLE, 569 + }, 570 + .hw.init = &(struct clk_init_data) { 571 + .name = "cpub_clk_apb", 572 + .ops = &clk_regmap_gate_ro_ops, 573 + .parent_names = (const char *[]){ "cpub_clk_apb_sel" }, 574 + .num_parents = 1, 575 + /* 576 + * This clock is set by the ROM monitor code, 577 + * Linux should not change it at runtime 578 + */ 579 + }, 580 + }; 581 + 582 + static struct clk_regmap g12b_cpub_clk_atb_sel = { 583 + .data = &(struct clk_regmap_mux_data){ 584 + .offset = HHI_SYS_CPUB_CLK_CNTL1, 585 + .mask = 7, 586 + .shift = 6, 587 + .table = mux_table_cpub, 588 + }, 589 + .hw.init = &(struct clk_init_data){ 590 + .name = "cpub_clk_atb_sel", 591 + .ops = &clk_regmap_mux_ro_ops, 592 + .parent_names = (const char *[]){ "cpub_clk_div2", 593 + "cpub_clk_div3", 594 + "cpub_clk_div4", 595 + "cpub_clk_div5", 596 + "cpub_clk_div6", 597 + "cpub_clk_div7", 598 + "cpub_clk_div8" }, 599 + .num_parents = 7, 600 + }, 601 + }; 602 + 603 + static struct clk_regmap g12b_cpub_clk_atb = { 604 + .data = &(struct clk_regmap_gate_data){ 605 + .offset = HHI_SYS_CPUB_CLK_CNTL1, 606 + .bit_idx = 17, 607 + .flags = CLK_GATE_SET_TO_DISABLE, 608 + }, 609 + .hw.init = &(struct clk_init_data) { 610 + .name = "cpub_clk_atb", 611 + .ops = &clk_regmap_gate_ro_ops, 612 + .parent_names = (const char *[]){ "cpub_clk_atb_sel" }, 613 + .num_parents = 1, 614 + /* 615 + * This clock is set by the ROM monitor code, 616 + * Linux should not change it at runtime 617 + */ 618 + }, 619 + }; 620 + 621 + static struct clk_regmap g12b_cpub_clk_axi_sel = { 622 + .data = &(struct clk_regmap_mux_data){ 623 + .offset = HHI_SYS_CPUB_CLK_CNTL1, 624 + .mask = 7, 625 + .shift = 9, 626 + .table = mux_table_cpub, 627 + }, 628 + .hw.init = &(struct clk_init_data){ 629 + .name = "cpub_clk_axi_sel", 630 + .ops = &clk_regmap_mux_ro_ops, 631 + .parent_names = (const char *[]){ "cpub_clk_div2", 632 + "cpub_clk_div3", 633 + "cpub_clk_div4", 634 + "cpub_clk_div5", 635 + "cpub_clk_div6", 636 + "cpub_clk_div7", 637 + "cpub_clk_div8" }, 638 + .num_parents = 7, 639 + }, 640 + }; 641 + 642 + static struct clk_regmap g12b_cpub_clk_axi = { 643 + .data = &(struct clk_regmap_gate_data){ 644 + .offset = HHI_SYS_CPUB_CLK_CNTL1, 645 + .bit_idx = 18, 646 + .flags = CLK_GATE_SET_TO_DISABLE, 647 + }, 648 + .hw.init = &(struct clk_init_data) { 649 + .name = "cpub_clk_axi", 650 + .ops = &clk_regmap_gate_ro_ops, 651 + .parent_names = (const char *[]){ "cpub_clk_axi_sel" }, 652 + .num_parents = 1, 653 + /* 654 + * This clock is set by the ROM monitor code, 655 + * Linux should not change it at runtime 656 + */ 657 + }, 658 + }; 659 + 660 + static struct clk_regmap g12b_cpub_clk_trace_sel = { 661 + .data = &(struct clk_regmap_mux_data){ 662 + .offset = HHI_SYS_CPUB_CLK_CNTL1, 663 + .mask = 7, 664 + .shift = 20, 665 + .table = mux_table_cpub, 666 + }, 667 + .hw.init = &(struct clk_init_data){ 668 + .name = "cpub_clk_trace_sel", 669 + .ops = &clk_regmap_mux_ro_ops, 670 + .parent_names = (const char *[]){ "cpub_clk_div2", 671 + "cpub_clk_div3", 672 + "cpub_clk_div4", 673 + "cpub_clk_div5", 674 + "cpub_clk_div6", 675 + "cpub_clk_div7", 676 + "cpub_clk_div8" }, 677 + .num_parents = 7, 678 + }, 679 + }; 680 + 681 + static struct clk_regmap g12b_cpub_clk_trace = { 682 + .data = &(struct clk_regmap_gate_data){ 683 + .offset = HHI_SYS_CPUB_CLK_CNTL1, 684 + .bit_idx = 23, 685 + .flags = CLK_GATE_SET_TO_DISABLE, 686 + }, 687 + .hw.init = &(struct clk_init_data) { 688 + .name = "cpub_clk_trace", 689 + .ops = &clk_regmap_gate_ro_ops, 690 + .parent_names = (const char *[]){ "cpub_clk_trace_sel" }, 708 691 .num_parents = 1, 709 692 /* 710 693 * This clock is set by the ROM monitor code, ··· 1350 865 .ops = &clk_regmap_gate_ops, 1351 866 .parent_names = (const char *[]){ "fclk_div3_div" }, 1352 867 .num_parents = 1, 868 + /* 869 + * This clock is used by the resident firmware and is required 870 + * by the platform to operate correctly. 871 + * Until the following condition are met, we need this clock to 872 + * be marked as critical: 873 + * a) Mark the clock used by a firmware resource, if possible 874 + * b) CCF has a clock hand-off mechanism to make the sure the 875 + * clock stays on until the proper driver comes along 876 + */ 877 + .flags = CLK_IS_CRITICAL, 1353 878 }, 1354 879 }; 1355 880 ··· 1496 1001 }, 1497 1002 }; 1498 1003 1004 + static const struct reg_sequence g12a_mpll0_init_regs[] = { 1005 + { .reg = HHI_MPLL_CNTL2, .def = 0x40000033 }, 1006 + }; 1007 + 1499 1008 static struct clk_regmap g12a_mpll0_div = { 1500 1009 .data = &(struct meson_clk_mpll_data){ 1501 1010 .sdm = { ··· 1523 1024 .width = 1, 1524 1025 }, 1525 1026 .lock = &meson_clk_lock, 1027 + .init_regs = g12a_mpll0_init_regs, 1028 + .init_count = ARRAY_SIZE(g12a_mpll0_init_regs), 1526 1029 }, 1527 1030 .hw.init = &(struct clk_init_data){ 1528 1031 .name = "mpll0_div", ··· 1546 1045 .num_parents = 1, 1547 1046 .flags = CLK_SET_RATE_PARENT, 1548 1047 }, 1048 + }; 1049 + 1050 + static const struct reg_sequence g12a_mpll1_init_regs[] = { 1051 + { .reg = HHI_MPLL_CNTL4, .def = 0x40000033 }, 1549 1052 }; 1550 1053 1551 1054 static struct clk_regmap g12a_mpll1_div = { ··· 1575 1070 .width = 1, 1576 1071 }, 1577 1072 .lock = &meson_clk_lock, 1073 + .init_regs = g12a_mpll1_init_regs, 1074 + .init_count = ARRAY_SIZE(g12a_mpll1_init_regs), 1578 1075 }, 1579 1076 .hw.init = &(struct clk_init_data){ 1580 1077 .name = "mpll1_div", ··· 1598 1091 .num_parents = 1, 1599 1092 .flags = CLK_SET_RATE_PARENT, 1600 1093 }, 1094 + }; 1095 + 1096 + static const struct reg_sequence g12a_mpll2_init_regs[] = { 1097 + { .reg = HHI_MPLL_CNTL6, .def = 0x40000033 }, 1601 1098 }; 1602 1099 1603 1100 static struct clk_regmap g12a_mpll2_div = { ··· 1627 1116 .width = 1, 1628 1117 }, 1629 1118 .lock = &meson_clk_lock, 1119 + .init_regs = g12a_mpll2_init_regs, 1120 + .init_count = ARRAY_SIZE(g12a_mpll2_init_regs), 1630 1121 }, 1631 1122 .hw.init = &(struct clk_init_data){ 1632 1123 .name = "mpll2_div", ··· 1650 1137 .num_parents = 1, 1651 1138 .flags = CLK_SET_RATE_PARENT, 1652 1139 }, 1140 + }; 1141 + 1142 + static const struct reg_sequence g12a_mpll3_init_regs[] = { 1143 + { .reg = HHI_MPLL_CNTL8, .def = 0x40000033 }, 1653 1144 }; 1654 1145 1655 1146 static struct clk_regmap g12a_mpll3_div = { ··· 1679 1162 .width = 1, 1680 1163 }, 1681 1164 .lock = &meson_clk_lock, 1165 + .init_regs = g12a_mpll3_init_regs, 1166 + .init_count = ARRAY_SIZE(g12a_mpll3_init_regs), 1682 1167 }, 1683 1168 .hw.init = &(struct clk_init_data){ 1684 1169 .name = "mpll3_div", ··· 2999 2480 }, 3000 2481 }; 3001 2482 2483 + static struct clk_regmap g12a_ts_div = { 2484 + .data = &(struct clk_regmap_div_data){ 2485 + .offset = HHI_TS_CLK_CNTL, 2486 + .shift = 0, 2487 + .width = 8, 2488 + }, 2489 + .hw.init = &(struct clk_init_data){ 2490 + .name = "ts_div", 2491 + .ops = &clk_regmap_divider_ro_ops, 2492 + .parent_names = (const char *[]){ "xtal" }, 2493 + .num_parents = 1, 2494 + }, 2495 + }; 2496 + 2497 + static struct clk_regmap g12a_ts = { 2498 + .data = &(struct clk_regmap_gate_data){ 2499 + .offset = HHI_TS_CLK_CNTL, 2500 + .bit_idx = 8, 2501 + }, 2502 + .hw.init = &(struct clk_init_data){ 2503 + .name = "ts", 2504 + .ops = &clk_regmap_gate_ops, 2505 + .parent_names = (const char *[]){ "ts_div" }, 2506 + .num_parents = 1, 2507 + }, 2508 + }; 2509 + 3002 2510 /* Everything Else (EE) domain gates */ 3003 2511 static MESON_GATE(g12a_ddr, HHI_GCLK_MPEG0, 0); 3004 2512 static MESON_GATE(g12a_dos, HHI_GCLK_MPEG0, 1); ··· 3315 2769 [CLKID_VDEC_HEVCF_SEL] = &g12a_vdec_hevcf_sel.hw, 3316 2770 [CLKID_VDEC_HEVCF_DIV] = &g12a_vdec_hevcf_div.hw, 3317 2771 [CLKID_VDEC_HEVCF] = &g12a_vdec_hevcf.hw, 2772 + [CLKID_TS_DIV] = &g12a_ts_div.hw, 2773 + [CLKID_TS] = &g12a_ts.hw, 2774 + [NR_CLKS] = NULL, 2775 + }, 2776 + .num = NR_CLKS, 2777 + }; 2778 + 2779 + static struct clk_hw_onecell_data g12b_hw_onecell_data = { 2780 + .hws = { 2781 + [CLKID_SYS_PLL] = &g12a_sys_pll.hw, 2782 + [CLKID_FIXED_PLL] = &g12a_fixed_pll.hw, 2783 + [CLKID_FCLK_DIV2] = &g12a_fclk_div2.hw, 2784 + [CLKID_FCLK_DIV3] = &g12a_fclk_div3.hw, 2785 + [CLKID_FCLK_DIV4] = &g12a_fclk_div4.hw, 2786 + [CLKID_FCLK_DIV5] = &g12a_fclk_div5.hw, 2787 + [CLKID_FCLK_DIV7] = &g12a_fclk_div7.hw, 2788 + [CLKID_FCLK_DIV2P5] = &g12a_fclk_div2p5.hw, 2789 + [CLKID_GP0_PLL] = &g12a_gp0_pll.hw, 2790 + [CLKID_MPEG_SEL] = &g12a_mpeg_clk_sel.hw, 2791 + [CLKID_MPEG_DIV] = &g12a_mpeg_clk_div.hw, 2792 + [CLKID_CLK81] = &g12a_clk81.hw, 2793 + [CLKID_MPLL0] = &g12a_mpll0.hw, 2794 + [CLKID_MPLL1] = &g12a_mpll1.hw, 2795 + [CLKID_MPLL2] = &g12a_mpll2.hw, 2796 + [CLKID_MPLL3] = &g12a_mpll3.hw, 2797 + [CLKID_DDR] = &g12a_ddr.hw, 2798 + [CLKID_DOS] = &g12a_dos.hw, 2799 + [CLKID_AUDIO_LOCKER] = &g12a_audio_locker.hw, 2800 + [CLKID_MIPI_DSI_HOST] = &g12a_mipi_dsi_host.hw, 2801 + [CLKID_ETH_PHY] = &g12a_eth_phy.hw, 2802 + [CLKID_ISA] = &g12a_isa.hw, 2803 + [CLKID_PL301] = &g12a_pl301.hw, 2804 + [CLKID_PERIPHS] = &g12a_periphs.hw, 2805 + [CLKID_SPICC0] = &g12a_spicc_0.hw, 2806 + [CLKID_I2C] = &g12a_i2c.hw, 2807 + [CLKID_SANA] = &g12a_sana.hw, 2808 + [CLKID_SD] = &g12a_sd.hw, 2809 + [CLKID_RNG0] = &g12a_rng0.hw, 2810 + [CLKID_UART0] = &g12a_uart0.hw, 2811 + [CLKID_SPICC1] = &g12a_spicc_1.hw, 2812 + [CLKID_HIU_IFACE] = &g12a_hiu_reg.hw, 2813 + [CLKID_MIPI_DSI_PHY] = &g12a_mipi_dsi_phy.hw, 2814 + [CLKID_ASSIST_MISC] = &g12a_assist_misc.hw, 2815 + [CLKID_SD_EMMC_A] = &g12a_emmc_a.hw, 2816 + [CLKID_SD_EMMC_B] = &g12a_emmc_b.hw, 2817 + [CLKID_SD_EMMC_C] = &g12a_emmc_c.hw, 2818 + [CLKID_AUDIO_CODEC] = &g12a_audio_codec.hw, 2819 + [CLKID_AUDIO] = &g12a_audio.hw, 2820 + [CLKID_ETH] = &g12a_eth_core.hw, 2821 + [CLKID_DEMUX] = &g12a_demux.hw, 2822 + [CLKID_AUDIO_IFIFO] = &g12a_audio_ififo.hw, 2823 + [CLKID_ADC] = &g12a_adc.hw, 2824 + [CLKID_UART1] = &g12a_uart1.hw, 2825 + [CLKID_G2D] = &g12a_g2d.hw, 2826 + [CLKID_RESET] = &g12a_reset.hw, 2827 + [CLKID_PCIE_COMB] = &g12a_pcie_comb.hw, 2828 + [CLKID_PARSER] = &g12a_parser.hw, 2829 + [CLKID_USB] = &g12a_usb_general.hw, 2830 + [CLKID_PCIE_PHY] = &g12a_pcie_phy.hw, 2831 + [CLKID_AHB_ARB0] = &g12a_ahb_arb0.hw, 2832 + [CLKID_AHB_DATA_BUS] = &g12a_ahb_data_bus.hw, 2833 + [CLKID_AHB_CTRL_BUS] = &g12a_ahb_ctrl_bus.hw, 2834 + [CLKID_HTX_HDCP22] = &g12a_htx_hdcp22.hw, 2835 + [CLKID_HTX_PCLK] = &g12a_htx_pclk.hw, 2836 + [CLKID_BT656] = &g12a_bt656.hw, 2837 + [CLKID_USB1_DDR_BRIDGE] = &g12a_usb1_to_ddr.hw, 2838 + [CLKID_MMC_PCLK] = &g12a_mmc_pclk.hw, 2839 + [CLKID_UART2] = &g12a_uart2.hw, 2840 + [CLKID_VPU_INTR] = &g12a_vpu_intr.hw, 2841 + [CLKID_GIC] = &g12a_gic.hw, 2842 + [CLKID_SD_EMMC_A_CLK0_SEL] = &g12a_sd_emmc_a_clk0_sel.hw, 2843 + [CLKID_SD_EMMC_A_CLK0_DIV] = &g12a_sd_emmc_a_clk0_div.hw, 2844 + [CLKID_SD_EMMC_A_CLK0] = &g12a_sd_emmc_a_clk0.hw, 2845 + [CLKID_SD_EMMC_B_CLK0_SEL] = &g12a_sd_emmc_b_clk0_sel.hw, 2846 + [CLKID_SD_EMMC_B_CLK0_DIV] = &g12a_sd_emmc_b_clk0_div.hw, 2847 + [CLKID_SD_EMMC_B_CLK0] = &g12a_sd_emmc_b_clk0.hw, 2848 + [CLKID_SD_EMMC_C_CLK0_SEL] = &g12a_sd_emmc_c_clk0_sel.hw, 2849 + [CLKID_SD_EMMC_C_CLK0_DIV] = &g12a_sd_emmc_c_clk0_div.hw, 2850 + [CLKID_SD_EMMC_C_CLK0] = &g12a_sd_emmc_c_clk0.hw, 2851 + [CLKID_MPLL0_DIV] = &g12a_mpll0_div.hw, 2852 + [CLKID_MPLL1_DIV] = &g12a_mpll1_div.hw, 2853 + [CLKID_MPLL2_DIV] = &g12a_mpll2_div.hw, 2854 + [CLKID_MPLL3_DIV] = &g12a_mpll3_div.hw, 2855 + [CLKID_FCLK_DIV2_DIV] = &g12a_fclk_div2_div.hw, 2856 + [CLKID_FCLK_DIV3_DIV] = &g12a_fclk_div3_div.hw, 2857 + [CLKID_FCLK_DIV4_DIV] = &g12a_fclk_div4_div.hw, 2858 + [CLKID_FCLK_DIV5_DIV] = &g12a_fclk_div5_div.hw, 2859 + [CLKID_FCLK_DIV7_DIV] = &g12a_fclk_div7_div.hw, 2860 + [CLKID_FCLK_DIV2P5_DIV] = &g12a_fclk_div2p5_div.hw, 2861 + [CLKID_HIFI_PLL] = &g12a_hifi_pll.hw, 2862 + [CLKID_VCLK2_VENCI0] = &g12a_vclk2_venci0.hw, 2863 + [CLKID_VCLK2_VENCI1] = &g12a_vclk2_venci1.hw, 2864 + [CLKID_VCLK2_VENCP0] = &g12a_vclk2_vencp0.hw, 2865 + [CLKID_VCLK2_VENCP1] = &g12a_vclk2_vencp1.hw, 2866 + [CLKID_VCLK2_VENCT0] = &g12a_vclk2_venct0.hw, 2867 + [CLKID_VCLK2_VENCT1] = &g12a_vclk2_venct1.hw, 2868 + [CLKID_VCLK2_OTHER] = &g12a_vclk2_other.hw, 2869 + [CLKID_VCLK2_ENCI] = &g12a_vclk2_enci.hw, 2870 + [CLKID_VCLK2_ENCP] = &g12a_vclk2_encp.hw, 2871 + [CLKID_DAC_CLK] = &g12a_dac_clk.hw, 2872 + [CLKID_AOCLK] = &g12a_aoclk_gate.hw, 2873 + [CLKID_IEC958] = &g12a_iec958_gate.hw, 2874 + [CLKID_ENC480P] = &g12a_enc480p.hw, 2875 + [CLKID_RNG1] = &g12a_rng1.hw, 2876 + [CLKID_VCLK2_ENCT] = &g12a_vclk2_enct.hw, 2877 + [CLKID_VCLK2_ENCL] = &g12a_vclk2_encl.hw, 2878 + [CLKID_VCLK2_VENCLMMC] = &g12a_vclk2_venclmmc.hw, 2879 + [CLKID_VCLK2_VENCL] = &g12a_vclk2_vencl.hw, 2880 + [CLKID_VCLK2_OTHER1] = &g12a_vclk2_other1.hw, 2881 + [CLKID_FIXED_PLL_DCO] = &g12a_fixed_pll_dco.hw, 2882 + [CLKID_SYS_PLL_DCO] = &g12a_sys_pll_dco.hw, 2883 + [CLKID_GP0_PLL_DCO] = &g12a_gp0_pll_dco.hw, 2884 + [CLKID_HIFI_PLL_DCO] = &g12a_hifi_pll_dco.hw, 2885 + [CLKID_DMA] = &g12a_dma.hw, 2886 + [CLKID_EFUSE] = &g12a_efuse.hw, 2887 + [CLKID_ROM_BOOT] = &g12a_rom_boot.hw, 2888 + [CLKID_RESET_SEC] = &g12a_reset_sec.hw, 2889 + [CLKID_SEC_AHB_APB3] = &g12a_sec_ahb_apb3.hw, 2890 + [CLKID_MPLL_PREDIV] = &g12a_mpll_prediv.hw, 2891 + [CLKID_VPU_0_SEL] = &g12a_vpu_0_sel.hw, 2892 + [CLKID_VPU_0_DIV] = &g12a_vpu_0_div.hw, 2893 + [CLKID_VPU_0] = &g12a_vpu_0.hw, 2894 + [CLKID_VPU_1_SEL] = &g12a_vpu_1_sel.hw, 2895 + [CLKID_VPU_1_DIV] = &g12a_vpu_1_div.hw, 2896 + [CLKID_VPU_1] = &g12a_vpu_1.hw, 2897 + [CLKID_VPU] = &g12a_vpu.hw, 2898 + [CLKID_VAPB_0_SEL] = &g12a_vapb_0_sel.hw, 2899 + [CLKID_VAPB_0_DIV] = &g12a_vapb_0_div.hw, 2900 + [CLKID_VAPB_0] = &g12a_vapb_0.hw, 2901 + [CLKID_VAPB_1_SEL] = &g12a_vapb_1_sel.hw, 2902 + [CLKID_VAPB_1_DIV] = &g12a_vapb_1_div.hw, 2903 + [CLKID_VAPB_1] = &g12a_vapb_1.hw, 2904 + [CLKID_VAPB_SEL] = &g12a_vapb_sel.hw, 2905 + [CLKID_VAPB] = &g12a_vapb.hw, 2906 + [CLKID_HDMI_PLL_DCO] = &g12a_hdmi_pll_dco.hw, 2907 + [CLKID_HDMI_PLL_OD] = &g12a_hdmi_pll_od.hw, 2908 + [CLKID_HDMI_PLL_OD2] = &g12a_hdmi_pll_od2.hw, 2909 + [CLKID_HDMI_PLL] = &g12a_hdmi_pll.hw, 2910 + [CLKID_VID_PLL] = &g12a_vid_pll_div.hw, 2911 + [CLKID_VID_PLL_SEL] = &g12a_vid_pll_sel.hw, 2912 + [CLKID_VID_PLL_DIV] = &g12a_vid_pll.hw, 2913 + [CLKID_VCLK_SEL] = &g12a_vclk_sel.hw, 2914 + [CLKID_VCLK2_SEL] = &g12a_vclk2_sel.hw, 2915 + [CLKID_VCLK_INPUT] = &g12a_vclk_input.hw, 2916 + [CLKID_VCLK2_INPUT] = &g12a_vclk2_input.hw, 2917 + [CLKID_VCLK_DIV] = &g12a_vclk_div.hw, 2918 + [CLKID_VCLK2_DIV] = &g12a_vclk2_div.hw, 2919 + [CLKID_VCLK] = &g12a_vclk.hw, 2920 + [CLKID_VCLK2] = &g12a_vclk2.hw, 2921 + [CLKID_VCLK_DIV1] = &g12a_vclk_div1.hw, 2922 + [CLKID_VCLK_DIV2_EN] = &g12a_vclk_div2_en.hw, 2923 + [CLKID_VCLK_DIV4_EN] = &g12a_vclk_div4_en.hw, 2924 + [CLKID_VCLK_DIV6_EN] = &g12a_vclk_div6_en.hw, 2925 + [CLKID_VCLK_DIV12_EN] = &g12a_vclk_div12_en.hw, 2926 + [CLKID_VCLK2_DIV1] = &g12a_vclk2_div1.hw, 2927 + [CLKID_VCLK2_DIV2_EN] = &g12a_vclk2_div2_en.hw, 2928 + [CLKID_VCLK2_DIV4_EN] = &g12a_vclk2_div4_en.hw, 2929 + [CLKID_VCLK2_DIV6_EN] = &g12a_vclk2_div6_en.hw, 2930 + [CLKID_VCLK2_DIV12_EN] = &g12a_vclk2_div12_en.hw, 2931 + [CLKID_VCLK_DIV2] = &g12a_vclk_div2.hw, 2932 + [CLKID_VCLK_DIV4] = &g12a_vclk_div4.hw, 2933 + [CLKID_VCLK_DIV6] = &g12a_vclk_div6.hw, 2934 + [CLKID_VCLK_DIV12] = &g12a_vclk_div12.hw, 2935 + [CLKID_VCLK2_DIV2] = &g12a_vclk2_div2.hw, 2936 + [CLKID_VCLK2_DIV4] = &g12a_vclk2_div4.hw, 2937 + [CLKID_VCLK2_DIV6] = &g12a_vclk2_div6.hw, 2938 + [CLKID_VCLK2_DIV12] = &g12a_vclk2_div12.hw, 2939 + [CLKID_CTS_ENCI_SEL] = &g12a_cts_enci_sel.hw, 2940 + [CLKID_CTS_ENCP_SEL] = &g12a_cts_encp_sel.hw, 2941 + [CLKID_CTS_VDAC_SEL] = &g12a_cts_vdac_sel.hw, 2942 + [CLKID_HDMI_TX_SEL] = &g12a_hdmi_tx_sel.hw, 2943 + [CLKID_CTS_ENCI] = &g12a_cts_enci.hw, 2944 + [CLKID_CTS_ENCP] = &g12a_cts_encp.hw, 2945 + [CLKID_CTS_VDAC] = &g12a_cts_vdac.hw, 2946 + [CLKID_HDMI_TX] = &g12a_hdmi_tx.hw, 2947 + [CLKID_HDMI_SEL] = &g12a_hdmi_sel.hw, 2948 + [CLKID_HDMI_DIV] = &g12a_hdmi_div.hw, 2949 + [CLKID_HDMI] = &g12a_hdmi.hw, 2950 + [CLKID_MALI_0_SEL] = &g12a_mali_0_sel.hw, 2951 + [CLKID_MALI_0_DIV] = &g12a_mali_0_div.hw, 2952 + [CLKID_MALI_0] = &g12a_mali_0.hw, 2953 + [CLKID_MALI_1_SEL] = &g12a_mali_1_sel.hw, 2954 + [CLKID_MALI_1_DIV] = &g12a_mali_1_div.hw, 2955 + [CLKID_MALI_1] = &g12a_mali_1.hw, 2956 + [CLKID_MALI] = &g12a_mali.hw, 2957 + [CLKID_MPLL_50M_DIV] = &g12a_mpll_50m_div.hw, 2958 + [CLKID_MPLL_50M] = &g12a_mpll_50m.hw, 2959 + [CLKID_SYS_PLL_DIV16_EN] = &g12a_sys_pll_div16_en.hw, 2960 + [CLKID_SYS_PLL_DIV16] = &g12a_sys_pll_div16.hw, 2961 + [CLKID_CPU_CLK_DYN0_SEL] = &g12a_cpu_clk_premux0.hw, 2962 + [CLKID_CPU_CLK_DYN0_DIV] = &g12a_cpu_clk_mux0_div.hw, 2963 + [CLKID_CPU_CLK_DYN0] = &g12a_cpu_clk_postmux0.hw, 2964 + [CLKID_CPU_CLK_DYN1_SEL] = &g12a_cpu_clk_premux1.hw, 2965 + [CLKID_CPU_CLK_DYN1_DIV] = &g12a_cpu_clk_mux1_div.hw, 2966 + [CLKID_CPU_CLK_DYN1] = &g12a_cpu_clk_postmux1.hw, 2967 + [CLKID_CPU_CLK_DYN] = &g12a_cpu_clk_dyn.hw, 2968 + [CLKID_CPU_CLK] = &g12b_cpu_clk.hw, 2969 + [CLKID_CPU_CLK_DIV16_EN] = &g12a_cpu_clk_div16_en.hw, 2970 + [CLKID_CPU_CLK_DIV16] = &g12a_cpu_clk_div16.hw, 2971 + [CLKID_CPU_CLK_APB_DIV] = &g12a_cpu_clk_apb_div.hw, 2972 + [CLKID_CPU_CLK_APB] = &g12a_cpu_clk_apb.hw, 2973 + [CLKID_CPU_CLK_ATB_DIV] = &g12a_cpu_clk_atb_div.hw, 2974 + [CLKID_CPU_CLK_ATB] = &g12a_cpu_clk_atb.hw, 2975 + [CLKID_CPU_CLK_AXI_DIV] = &g12a_cpu_clk_axi_div.hw, 2976 + [CLKID_CPU_CLK_AXI] = &g12a_cpu_clk_axi.hw, 2977 + [CLKID_CPU_CLK_TRACE_DIV] = &g12a_cpu_clk_trace_div.hw, 2978 + [CLKID_CPU_CLK_TRACE] = &g12a_cpu_clk_trace.hw, 2979 + [CLKID_PCIE_PLL_DCO] = &g12a_pcie_pll_dco.hw, 2980 + [CLKID_PCIE_PLL_DCO_DIV2] = &g12a_pcie_pll_dco_div2.hw, 2981 + [CLKID_PCIE_PLL_OD] = &g12a_pcie_pll_od.hw, 2982 + [CLKID_PCIE_PLL] = &g12a_pcie_pll.hw, 2983 + [CLKID_VDEC_1_SEL] = &g12a_vdec_1_sel.hw, 2984 + [CLKID_VDEC_1_DIV] = &g12a_vdec_1_div.hw, 2985 + [CLKID_VDEC_1] = &g12a_vdec_1.hw, 2986 + [CLKID_VDEC_HEVC_SEL] = &g12a_vdec_hevc_sel.hw, 2987 + [CLKID_VDEC_HEVC_DIV] = &g12a_vdec_hevc_div.hw, 2988 + [CLKID_VDEC_HEVC] = &g12a_vdec_hevc.hw, 2989 + [CLKID_VDEC_HEVCF_SEL] = &g12a_vdec_hevcf_sel.hw, 2990 + [CLKID_VDEC_HEVCF_DIV] = &g12a_vdec_hevcf_div.hw, 2991 + [CLKID_VDEC_HEVCF] = &g12a_vdec_hevcf.hw, 2992 + [CLKID_TS_DIV] = &g12a_ts_div.hw, 2993 + [CLKID_TS] = &g12a_ts.hw, 2994 + [CLKID_SYS1_PLL_DCO] = &g12b_sys1_pll_dco.hw, 2995 + [CLKID_SYS1_PLL] = &g12b_sys1_pll.hw, 2996 + [CLKID_SYS1_PLL_DIV16_EN] = &g12b_sys1_pll_div16_en.hw, 2997 + [CLKID_SYS1_PLL_DIV16] = &g12b_sys1_pll_div16.hw, 2998 + [CLKID_CPUB_CLK_DYN0_SEL] = &g12b_cpub_clk_premux0.hw, 2999 + [CLKID_CPUB_CLK_DYN0_DIV] = &g12b_cpub_clk_mux0_div.hw, 3000 + [CLKID_CPUB_CLK_DYN0] = &g12b_cpub_clk_postmux0.hw, 3001 + [CLKID_CPUB_CLK_DYN1_SEL] = &g12b_cpub_clk_premux1.hw, 3002 + [CLKID_CPUB_CLK_DYN1_DIV] = &g12b_cpub_clk_mux1_div.hw, 3003 + [CLKID_CPUB_CLK_DYN1] = &g12b_cpub_clk_postmux1.hw, 3004 + [CLKID_CPUB_CLK_DYN] = &g12b_cpub_clk_dyn.hw, 3005 + [CLKID_CPUB_CLK] = &g12b_cpub_clk.hw, 3006 + [CLKID_CPUB_CLK_DIV16_EN] = &g12b_cpub_clk_div16_en.hw, 3007 + [CLKID_CPUB_CLK_DIV16] = &g12b_cpub_clk_div16.hw, 3008 + [CLKID_CPUB_CLK_DIV2] = &g12b_cpub_clk_div2.hw, 3009 + [CLKID_CPUB_CLK_DIV3] = &g12b_cpub_clk_div3.hw, 3010 + [CLKID_CPUB_CLK_DIV4] = &g12b_cpub_clk_div4.hw, 3011 + [CLKID_CPUB_CLK_DIV5] = &g12b_cpub_clk_div5.hw, 3012 + [CLKID_CPUB_CLK_DIV6] = &g12b_cpub_clk_div6.hw, 3013 + [CLKID_CPUB_CLK_DIV7] = &g12b_cpub_clk_div7.hw, 3014 + [CLKID_CPUB_CLK_DIV8] = &g12b_cpub_clk_div8.hw, 3015 + [CLKID_CPUB_CLK_APB_SEL] = &g12b_cpub_clk_apb_sel.hw, 3016 + [CLKID_CPUB_CLK_APB] = &g12b_cpub_clk_apb.hw, 3017 + [CLKID_CPUB_CLK_ATB_SEL] = &g12b_cpub_clk_atb_sel.hw, 3018 + [CLKID_CPUB_CLK_ATB] = &g12b_cpub_clk_atb.hw, 3019 + [CLKID_CPUB_CLK_AXI_SEL] = &g12b_cpub_clk_axi_sel.hw, 3020 + [CLKID_CPUB_CLK_AXI] = &g12b_cpub_clk_axi.hw, 3021 + [CLKID_CPUB_CLK_TRACE_SEL] = &g12b_cpub_clk_trace_sel.hw, 3022 + [CLKID_CPUB_CLK_TRACE] = &g12b_cpub_clk_trace.hw, 3318 3023 [NR_CLKS] = NULL, 3319 3024 }, 3320 3025 .num = NR_CLKS, ··· 3763 2966 &g12a_vdec_hevcf_sel, 3764 2967 &g12a_vdec_hevcf_div, 3765 2968 &g12a_vdec_hevcf, 2969 + &g12a_ts_div, 2970 + &g12a_ts, 2971 + &g12b_cpu_clk, 2972 + &g12b_sys1_pll_dco, 2973 + &g12b_sys1_pll, 2974 + &g12b_sys1_pll_div16_en, 2975 + &g12b_cpub_clk_premux0, 2976 + &g12b_cpub_clk_mux0_div, 2977 + &g12b_cpub_clk_postmux0, 2978 + &g12b_cpub_clk_premux1, 2979 + &g12b_cpub_clk_mux1_div, 2980 + &g12b_cpub_clk_postmux1, 2981 + &g12b_cpub_clk_dyn, 2982 + &g12b_cpub_clk, 2983 + &g12b_cpub_clk_div16_en, 2984 + &g12b_cpub_clk_apb_sel, 2985 + &g12b_cpub_clk_apb, 2986 + &g12b_cpub_clk_atb_sel, 2987 + &g12b_cpub_clk_atb, 2988 + &g12b_cpub_clk_axi_sel, 2989 + &g12b_cpub_clk_axi, 2990 + &g12b_cpub_clk_trace_sel, 2991 + &g12b_cpub_clk_trace, 2992 + }; 2993 + 2994 + static const struct reg_sequence g12a_init_regs[] = { 2995 + { .reg = HHI_MPLL_CNTL0, .def = 0x00000543 }, 3766 2996 }; 3767 2997 3768 2998 static const struct meson_eeclkc_data g12a_clkc_data = { 3769 2999 .regmap_clks = g12a_clk_regmaps, 3770 3000 .regmap_clk_num = ARRAY_SIZE(g12a_clk_regmaps), 3771 - .hw_onecell_data = &g12a_hw_onecell_data 3001 + .hw_onecell_data = &g12a_hw_onecell_data, 3002 + .init_regs = g12a_init_regs, 3003 + .init_count = ARRAY_SIZE(g12a_init_regs), 3004 + }; 3005 + 3006 + static const struct meson_eeclkc_data g12b_clkc_data = { 3007 + .regmap_clks = g12a_clk_regmaps, 3008 + .regmap_clk_num = ARRAY_SIZE(g12a_clk_regmaps), 3009 + .hw_onecell_data = &g12b_hw_onecell_data 3772 3010 }; 3773 3011 3774 3012 static const struct of_device_id clkc_match_table[] = { 3775 3013 { .compatible = "amlogic,g12a-clkc", .data = &g12a_clkc_data }, 3014 + { .compatible = "amlogic,g12b-clkc", .data = &g12b_clkc_data }, 3776 3015 {} 3777 3016 }; 3778 3017
+40 -1
drivers/clk/meson/g12a.h
··· 69 69 #define HHI_VDEC4_CLK_CNTL 0x1EC 70 70 #define HHI_HDCP22_CLK_CNTL 0x1F0 71 71 #define HHI_VAPBCLK_CNTL 0x1F4 72 + #define HHI_SYS_CPUB_CLK_CNTL1 0x200 73 + #define HHI_SYS_CPUB_CLK_CNTL 0x208 72 74 #define HHI_VPU_CLKB_CNTL 0x20C 73 75 #define HHI_GEN_CLK_CNTL 0x228 74 76 #define HHI_VDIN_MEAS_CLK_CNTL 0x250 ··· 104 102 #define HHI_HDMI_PLL_CNTL5 0x334 105 103 #define HHI_HDMI_PLL_CNTL6 0x338 106 104 #define HHI_SPICC_CLK_CNTL 0x3dc 105 + #define HHI_SYS1_PLL_CNTL0 0x380 106 + #define HHI_SYS1_PLL_CNTL1 0x384 107 + #define HHI_SYS1_PLL_CNTL2 0x388 108 + #define HHI_SYS1_PLL_CNTL3 0x38c 109 + #define HHI_SYS1_PLL_CNTL4 0x390 110 + #define HHI_SYS1_PLL_CNTL5 0x394 111 + #define HHI_SYS1_PLL_CNTL6 0x398 107 112 108 113 /* 109 114 * CLKID index values ··· 204 195 #define CLKID_VDEC_HEVC_DIV 206 205 196 #define CLKID_VDEC_HEVCF_SEL 208 206 197 #define CLKID_VDEC_HEVCF_DIV 209 198 + #define CLKID_TS_DIV 211 199 + #define CLKID_SYS1_PLL_DCO 213 200 + #define CLKID_SYS1_PLL 214 201 + #define CLKID_SYS1_PLL_DIV16_EN 215 202 + #define CLKID_SYS1_PLL_DIV16 216 203 + #define CLKID_CPUB_CLK_DYN0_SEL 217 204 + #define CLKID_CPUB_CLK_DYN0_DIV 218 205 + #define CLKID_CPUB_CLK_DYN0 219 206 + #define CLKID_CPUB_CLK_DYN1_SEL 220 207 + #define CLKID_CPUB_CLK_DYN1_DIV 221 208 + #define CLKID_CPUB_CLK_DYN1 222 209 + #define CLKID_CPUB_CLK_DYN 223 210 + #define CLKID_CPUB_CLK 224 211 + #define CLKID_CPUB_CLK_DIV16_EN 225 212 + #define CLKID_CPUB_CLK_DIV16 226 213 + #define CLKID_CPUB_CLK_DIV2 227 214 + #define CLKID_CPUB_CLK_DIV3 228 215 + #define CLKID_CPUB_CLK_DIV4 229 216 + #define CLKID_CPUB_CLK_DIV5 230 217 + #define CLKID_CPUB_CLK_DIV6 231 218 + #define CLKID_CPUB_CLK_DIV7 232 219 + #define CLKID_CPUB_CLK_DIV8 233 220 + #define CLKID_CPUB_CLK_APB_SEL 234 221 + #define CLKID_CPUB_CLK_APB 235 222 + #define CLKID_CPUB_CLK_ATB_SEL 236 223 + #define CLKID_CPUB_CLK_ATB 237 224 + #define CLKID_CPUB_CLK_AXI_SEL 238 225 + #define CLKID_CPUB_CLK_AXI 239 226 + #define CLKID_CPUB_CLK_TRACE_SEL 240 227 + #define CLKID_CPUB_CLK_TRACE 241 207 228 208 - #define NR_CLKS 211 229 + #define NR_CLKS 242 209 230 210 231 /* include the CLKIDs that have been made part of the DT binding */ 211 232 #include <dt-bindings/clock/g12a-clkc.h>
-5
drivers/clk/meson/gxbb.c
··· 679 679 .shift = 16, 680 680 .width = 9, 681 681 }, 682 - .ssen = { 683 - .reg_off = HHI_MPLL_CNTL, 684 - .shift = 25, 685 - .width = 1, 686 - }, 687 682 .lock = &meson_clk_lock, 688 683 }, 689 684 .hw.init = &(struct clk_init_data){
+3
drivers/clk/meson/meson-eeclk.c
··· 34 34 return PTR_ERR(map); 35 35 } 36 36 37 + if (data->init_count) 38 + regmap_multi_reg_write(map, data->init_regs, data->init_count); 39 + 37 40 input = meson_clk_hw_register_input(dev, "xtal", IN_PREFIX "xtal", 0); 38 41 if (IS_ERR(input)) { 39 42 ret = PTR_ERR(input);
+2
drivers/clk/meson/meson-eeclk.h
··· 17 17 struct meson_eeclkc_data { 18 18 struct clk_regmap *const *regmap_clks; 19 19 unsigned int regmap_clk_num; 20 + const struct reg_sequence *init_regs; 21 + unsigned int init_count; 20 22 struct clk_hw_onecell_data *hw_onecell_data; 21 23 }; 22 24
+154
drivers/clk/meson/meson8b.c
··· 2153 2153 }, 2154 2154 }; 2155 2155 2156 + /* TODO: the clock at index 0 is "DDR_PLL" which we don't support yet */ 2157 + static const char * const meson8b_cts_amclk_parent_names[] = { 2158 + "mpll0", "mpll1", "mpll2" 2159 + }; 2160 + 2161 + static u32 meson8b_cts_amclk_mux_table[] = { 1, 2, 3 }; 2162 + 2163 + static struct clk_regmap meson8b_cts_amclk_sel = { 2164 + .data = &(struct clk_regmap_mux_data){ 2165 + .offset = HHI_AUD_CLK_CNTL, 2166 + .mask = 0x3, 2167 + .shift = 9, 2168 + .table = meson8b_cts_amclk_mux_table, 2169 + .flags = CLK_MUX_ROUND_CLOSEST, 2170 + }, 2171 + .hw.init = &(struct clk_init_data){ 2172 + .name = "cts_amclk_sel", 2173 + .ops = &clk_regmap_mux_ops, 2174 + .parent_names = meson8b_cts_amclk_parent_names, 2175 + .num_parents = ARRAY_SIZE(meson8b_cts_amclk_parent_names), 2176 + }, 2177 + }; 2178 + 2179 + static struct clk_regmap meson8b_cts_amclk_div = { 2180 + .data = &(struct clk_regmap_div_data) { 2181 + .offset = HHI_AUD_CLK_CNTL, 2182 + .shift = 0, 2183 + .width = 8, 2184 + .flags = CLK_DIVIDER_ROUND_CLOSEST, 2185 + }, 2186 + .hw.init = &(struct clk_init_data){ 2187 + .name = "cts_amclk_div", 2188 + .ops = &clk_regmap_divider_ops, 2189 + .parent_names = (const char *[]){ "cts_amclk_sel" }, 2190 + .num_parents = 1, 2191 + .flags = CLK_SET_RATE_PARENT, 2192 + }, 2193 + }; 2194 + 2195 + static struct clk_regmap meson8b_cts_amclk = { 2196 + .data = &(struct clk_regmap_gate_data){ 2197 + .offset = HHI_AUD_CLK_CNTL, 2198 + .bit_idx = 8, 2199 + }, 2200 + .hw.init = &(struct clk_init_data){ 2201 + .name = "cts_amclk", 2202 + .ops = &clk_regmap_gate_ops, 2203 + .parent_names = (const char *[]){ "cts_amclk_div" }, 2204 + .num_parents = 1, 2205 + .flags = CLK_SET_RATE_PARENT, 2206 + }, 2207 + }; 2208 + 2209 + /* TODO: the clock at index 0 is "DDR_PLL" which we don't support yet */ 2210 + static const char * const meson8b_cts_mclk_i958_parent_names[] = { 2211 + "mpll0", "mpll1", "mpll2" 2212 + }; 2213 + 2214 + static u32 meson8b_cts_mclk_i958_mux_table[] = { 1, 2, 3 }; 2215 + 2216 + static struct clk_regmap meson8b_cts_mclk_i958_sel = { 2217 + .data = &(struct clk_regmap_mux_data){ 2218 + .offset = HHI_AUD_CLK_CNTL2, 2219 + .mask = 0x3, 2220 + .shift = 25, 2221 + .table = meson8b_cts_mclk_i958_mux_table, 2222 + .flags = CLK_MUX_ROUND_CLOSEST, 2223 + }, 2224 + .hw.init = &(struct clk_init_data) { 2225 + .name = "cts_mclk_i958_sel", 2226 + .ops = &clk_regmap_mux_ops, 2227 + .parent_names = meson8b_cts_mclk_i958_parent_names, 2228 + .num_parents = ARRAY_SIZE(meson8b_cts_mclk_i958_parent_names), 2229 + }, 2230 + }; 2231 + 2232 + static struct clk_regmap meson8b_cts_mclk_i958_div = { 2233 + .data = &(struct clk_regmap_div_data){ 2234 + .offset = HHI_AUD_CLK_CNTL2, 2235 + .shift = 16, 2236 + .width = 8, 2237 + .flags = CLK_DIVIDER_ROUND_CLOSEST, 2238 + }, 2239 + .hw.init = &(struct clk_init_data) { 2240 + .name = "cts_mclk_i958_div", 2241 + .ops = &clk_regmap_divider_ops, 2242 + .parent_names = (const char *[]){ "cts_mclk_i958_sel" }, 2243 + .num_parents = 1, 2244 + .flags = CLK_SET_RATE_PARENT, 2245 + }, 2246 + }; 2247 + 2248 + static struct clk_regmap meson8b_cts_mclk_i958 = { 2249 + .data = &(struct clk_regmap_gate_data){ 2250 + .offset = HHI_AUD_CLK_CNTL2, 2251 + .bit_idx = 24, 2252 + }, 2253 + .hw.init = &(struct clk_init_data){ 2254 + .name = "cts_mclk_i958", 2255 + .ops = &clk_regmap_gate_ops, 2256 + .parent_names = (const char *[]){ "cts_mclk_i958_div" }, 2257 + .num_parents = 1, 2258 + .flags = CLK_SET_RATE_PARENT, 2259 + }, 2260 + }; 2261 + 2262 + static struct clk_regmap meson8b_cts_i958 = { 2263 + .data = &(struct clk_regmap_mux_data){ 2264 + .offset = HHI_AUD_CLK_CNTL2, 2265 + .mask = 0x1, 2266 + .shift = 27, 2267 + }, 2268 + .hw.init = &(struct clk_init_data){ 2269 + .name = "cts_i958", 2270 + .ops = &clk_regmap_mux_ops, 2271 + .parent_names = (const char *[]){ "cts_amclk", 2272 + "cts_mclk_i958" }, 2273 + .num_parents = 2, 2274 + /* 2275 + * The parent is specific to origin of the audio data. Let the 2276 + * consumer choose the appropriate parent. 2277 + */ 2278 + .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT, 2279 + }, 2280 + }; 2281 + 2156 2282 /* Everything Else (EE) domain gates */ 2157 2283 2158 2284 static MESON_GATE(meson8b_ddr, HHI_GCLK_MPEG0, 0); ··· 2558 2432 [CLKID_VDEC_HEVC_DIV] = &meson8b_vdec_hevc_div.hw, 2559 2433 [CLKID_VDEC_HEVC_EN] = &meson8b_vdec_hevc_en.hw, 2560 2434 [CLKID_VDEC_HEVC] = &meson8b_vdec_hevc.hw, 2435 + [CLKID_CTS_AMCLK_SEL] = &meson8b_cts_amclk_sel.hw, 2436 + [CLKID_CTS_AMCLK_DIV] = &meson8b_cts_amclk_div.hw, 2437 + [CLKID_CTS_AMCLK] = &meson8b_cts_amclk.hw, 2438 + [CLKID_CTS_MCLK_I958_SEL] = &meson8b_cts_mclk_i958_sel.hw, 2439 + [CLKID_CTS_MCLK_I958_DIV] = &meson8b_cts_mclk_i958_div.hw, 2440 + [CLKID_CTS_MCLK_I958] = &meson8b_cts_mclk_i958.hw, 2441 + [CLKID_CTS_I958] = &meson8b_cts_i958.hw, 2561 2442 [CLK_NR_CLKS] = NULL, 2562 2443 }, 2563 2444 .num = CLK_NR_CLKS, ··· 2774 2641 [CLKID_VDEC_HEVC_DIV] = &meson8b_vdec_hevc_div.hw, 2775 2642 [CLKID_VDEC_HEVC_EN] = &meson8b_vdec_hevc_en.hw, 2776 2643 [CLKID_VDEC_HEVC] = &meson8b_vdec_hevc.hw, 2644 + [CLKID_CTS_AMCLK_SEL] = &meson8b_cts_amclk_sel.hw, 2645 + [CLKID_CTS_AMCLK_DIV] = &meson8b_cts_amclk_div.hw, 2646 + [CLKID_CTS_AMCLK] = &meson8b_cts_amclk.hw, 2647 + [CLKID_CTS_MCLK_I958_SEL] = &meson8b_cts_mclk_i958_sel.hw, 2648 + [CLKID_CTS_MCLK_I958_DIV] = &meson8b_cts_mclk_i958_div.hw, 2649 + [CLKID_CTS_MCLK_I958] = &meson8b_cts_mclk_i958.hw, 2650 + [CLKID_CTS_I958] = &meson8b_cts_i958.hw, 2777 2651 [CLK_NR_CLKS] = NULL, 2778 2652 }, 2779 2653 .num = CLK_NR_CLKS, ··· 2992 2852 [CLKID_VDEC_HEVC_DIV] = &meson8b_vdec_hevc_div.hw, 2993 2853 [CLKID_VDEC_HEVC_EN] = &meson8b_vdec_hevc_en.hw, 2994 2854 [CLKID_VDEC_HEVC] = &meson8b_vdec_hevc.hw, 2855 + [CLKID_CTS_AMCLK_SEL] = &meson8b_cts_amclk_sel.hw, 2856 + [CLKID_CTS_AMCLK_DIV] = &meson8b_cts_amclk_div.hw, 2857 + [CLKID_CTS_AMCLK] = &meson8b_cts_amclk.hw, 2858 + [CLKID_CTS_MCLK_I958_SEL] = &meson8b_cts_mclk_i958_sel.hw, 2859 + [CLKID_CTS_MCLK_I958_DIV] = &meson8b_cts_mclk_i958_div.hw, 2860 + [CLKID_CTS_MCLK_I958] = &meson8b_cts_mclk_i958.hw, 2861 + [CLKID_CTS_I958] = &meson8b_cts_i958.hw, 2995 2862 [CLK_NR_CLKS] = NULL, 2996 2863 }, 2997 2864 .num = CLK_NR_CLKS, ··· 3188 3041 &meson8b_vdec_hevc_div, 3189 3042 &meson8b_vdec_hevc_en, 3190 3043 &meson8b_vdec_hevc, 3044 + &meson8b_cts_amclk, 3045 + &meson8b_cts_amclk_sel, 3046 + &meson8b_cts_amclk_div, 3047 + &meson8b_cts_mclk_i958_sel, 3048 + &meson8b_cts_mclk_i958_div, 3049 + &meson8b_cts_mclk_i958, 3050 + &meson8b_cts_i958, 3191 3051 }; 3192 3052 3193 3053 static const struct meson8b_clk_reset_line {
+7 -1
drivers/clk/meson/meson8b.h
··· 30 30 #define HHI_SYS_CPU_CLK_CNTL1 0x15c /* 0x57 offset in data sheet */ 31 31 #define HHI_VID_CLK_DIV 0x164 /* 0x59 offset in data sheet */ 32 32 #define HHI_MPEG_CLK_CNTL 0x174 /* 0x5d offset in data sheet */ 33 + #define HHI_AUD_CLK_CNTL 0x178 /* 0x5e offset in data sheet */ 33 34 #define HHI_VID_CLK_CNTL 0x17c /* 0x5f offset in data sheet */ 35 + #define HHI_AUD_CLK_CNTL2 0x190 /* 0x64 offset in data sheet */ 34 36 #define HHI_VID_CLK_CNTL2 0x194 /* 0x65 offset in data sheet */ 35 37 #define HHI_VID_DIVIDER_CNTL 0x198 /* 0x66 offset in data sheet */ 36 38 #define HHI_SYS_CPU_CLK_CNTL0 0x19c /* 0x67 offset in data sheet */ ··· 173 171 #define CLKID_VDEC_HEVC_SEL 203 174 172 #define CLKID_VDEC_HEVC_DIV 204 175 173 #define CLKID_VDEC_HEVC_EN 205 174 + #define CLKID_CTS_AMCLK_SEL 207 175 + #define CLKID_CTS_AMCLK_DIV 208 176 + #define CLKID_CTS_MCLK_I958_SEL 210 177 + #define CLKID_CTS_MCLK_I958_DIV 211 176 178 177 - #define CLK_NR_CLKS 207 179 + #define CLK_NR_CLKS 214 178 180 179 181 /* 180 182 * include the CLKID and RESETID that have
+1 -2
drivers/clk/mmp/clk-frac.c
··· 78 78 struct mmp_clk_factor_masks *masks = factor->masks; 79 79 int i; 80 80 unsigned long val; 81 - unsigned long prev_rate, rate = 0; 81 + unsigned long rate = 0; 82 82 unsigned long flags = 0; 83 83 84 84 for (i = 0; i < factor->ftbl_cnt; i++) { 85 - prev_rate = rate; 86 85 rate = (((prate / 10000) * factor->ftbl[i].den) / 87 86 (factor->ftbl[i].num * factor->masks->factor)) * 10000; 88 87 if (rate > drate)
+17
drivers/clk/mvebu/kirkwood.c
··· 185 185 } 186 186 } 187 187 188 + static u32 __init mv98dx1135_get_tclk_freq(void __iomem *sar) 189 + { 190 + return 166666667; 191 + } 192 + 188 193 static const struct coreclk_soc_desc kirkwood_coreclks = { 189 194 .get_tclk_freq = kirkwood_get_tclk_freq, 190 195 .get_cpu_freq = kirkwood_get_cpu_freq, ··· 202 197 .get_tclk_freq = kirkwood_get_tclk_freq, 203 198 .get_cpu_freq = mv88f6180_get_cpu_freq, 204 199 .get_clk_ratio = mv88f6180_get_clk_ratio, 200 + .ratios = kirkwood_coreclk_ratios, 201 + .num_ratios = ARRAY_SIZE(kirkwood_coreclk_ratios), 202 + }; 203 + 204 + static const struct coreclk_soc_desc mv98dx1135_coreclks = { 205 + .get_tclk_freq = mv98dx1135_get_tclk_freq, 206 + .get_cpu_freq = kirkwood_get_cpu_freq, 207 + .get_clk_ratio = kirkwood_get_clk_ratio, 205 208 .ratios = kirkwood_coreclk_ratios, 206 209 .num_ratios = ARRAY_SIZE(kirkwood_coreclk_ratios), 207 210 }; ··· 338 325 339 326 if (of_device_is_compatible(np, "marvell,mv88f6180-core-clock")) 340 327 mvebu_coreclk_setup(np, &mv88f6180_coreclks); 328 + else if (of_device_is_compatible(np, "marvell,mv98dx1135-core-clock")) 329 + mvebu_coreclk_setup(np, &mv98dx1135_coreclks); 341 330 else 342 331 mvebu_coreclk_setup(np, &kirkwood_coreclks); 343 332 ··· 353 338 CLK_OF_DECLARE(kirkwood_clk, "marvell,kirkwood-core-clock", 354 339 kirkwood_clk_init); 355 340 CLK_OF_DECLARE(mv88f6180_clk, "marvell,mv88f6180-core-clock", 341 + kirkwood_clk_init); 342 + CLK_OF_DECLARE(98dx1135_clk, "marvell,mv98dx1135-core-clock", 356 343 kirkwood_clk_init);
-36
drivers/clk/qcom/gcc-msm8996.c
··· 130 130 "gpll0_early_div" 131 131 }; 132 132 133 - static const struct parent_map gcc_xo_gpll0_gpll2_gpll3_gpll0_early_div_map[] = { 134 - { P_XO, 0 }, 135 - { P_GPLL0, 1 }, 136 - { P_GPLL2, 2 }, 137 - { P_GPLL3, 3 }, 138 - { P_GPLL0_EARLY_DIV, 6 } 139 - }; 140 - 141 - static const char * const gcc_xo_gpll0_gpll2_gpll3_gpll0_early_div[] = { 142 - "xo", 143 - "gpll0", 144 - "gpll2", 145 - "gpll3", 146 - "gpll0_early_div" 147 - }; 148 - 149 133 static const struct parent_map gcc_xo_gpll0_gpll1_early_div_gpll1_gpll4_gpll0_early_div_map[] = { 150 134 { P_XO, 0 }, 151 135 { P_GPLL0, 1 }, ··· 165 181 "gpll3", 166 182 "gpll1", 167 183 "gpll2_early", 168 - "gpll0_early_div" 169 - }; 170 - 171 - static const struct parent_map gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll4_gpll0_early_div_map[] = { 172 - { P_XO, 0 }, 173 - { P_GPLL0, 1 }, 174 - { P_GPLL2, 2 }, 175 - { P_GPLL3, 3 }, 176 - { P_GPLL1, 4 }, 177 - { P_GPLL4, 5 }, 178 - { P_GPLL0_EARLY_DIV, 6 } 179 - }; 180 - 181 - static const char * const gcc_xo_gpll0_gpll2_gpll3_gpll1_gpll4_gpll0_early_div[] = { 182 - "xo", 183 - "gpll0", 184 - "gpll2", 185 - "gpll3", 186 - "gpll1", 187 - "gpll4", 188 184 "gpll0_early_div" 189 185 }; 190 186
+7
drivers/clk/qcom/gcc-qcs404.c
··· 2766 2766 [GCC_PCIE_0_PHY_BCR] = { 0x3e004 }, 2767 2767 [GCC_PCIE_0_LINK_DOWN_BCR] = { 0x3e038 }, 2768 2768 [GCC_PCIEPHY_0_PHY_BCR] = { 0x3e03c }, 2769 + [GCC_PCIE_0_AXI_MASTER_STICKY_ARES] = { 0x3e040, 6}, 2770 + [GCC_PCIE_0_AHB_ARES] = { 0x3e040, 5 }, 2771 + [GCC_PCIE_0_AXI_SLAVE_ARES] = { 0x3e040, 4 }, 2772 + [GCC_PCIE_0_AXI_MASTER_ARES] = { 0x3e040, 3 }, 2773 + [GCC_PCIE_0_CORE_STICKY_ARES] = { 0x3e040, 2 }, 2774 + [GCC_PCIE_0_SLEEP_ARES] = { 0x3e040, 1 }, 2775 + [GCC_PCIE_0_PIPE_ARES] = { 0x3e040, 0 }, 2769 2776 [GCC_EMAC_BCR] = { 0x4e000 }, 2770 2777 }; 2771 2778
+3 -1
drivers/clk/qcom/gdsc.c
··· 141 141 udelay(1); 142 142 } 143 143 144 - return gdsc_poll_status(sc, status); 144 + ret = gdsc_poll_status(sc, status); 145 + WARN(ret, "%s status stuck at 'o%s'", sc->pd.name, status ? "ff" : "n"); 146 + return ret; 145 147 } 146 148 147 149 static inline int gdsc_deassert_reset(struct gdsc *sc)
+5 -14
drivers/clk/renesas/clk-div6.c
··· 30 30 * @div: divisor value (1-64) 31 31 * @src_shift: Shift to access the register bits to select the parent clock 32 32 * @src_width: Number of register bits to select the parent clock (may be 0) 33 - * @parents: Array to map from valid parent clocks indices to hardware indices 34 33 * @nb: Notifier block to save/restore clock state for system resume 34 + * @parents: Array to map from valid parent clocks indices to hardware indices 35 35 */ 36 36 struct div6_clock { 37 37 struct clk_hw hw; ··· 39 39 unsigned int div; 40 40 u32 src_shift; 41 41 u32 src_width; 42 - u8 *parents; 43 42 struct notifier_block nb; 43 + u8 parents[]; 44 44 }; 45 45 46 46 #define to_div6_clock(_hw) container_of(_hw, struct div6_clock, hw) ··· 221 221 struct clk *clk; 222 222 unsigned int i; 223 223 224 - clock = kzalloc(sizeof(*clock), GFP_KERNEL); 224 + clock = kzalloc(struct_size(clock, parents, num_parents), GFP_KERNEL); 225 225 if (!clock) 226 226 return ERR_PTR(-ENOMEM); 227 - 228 - clock->parents = kmalloc_array(num_parents, sizeof(*clock->parents), 229 - GFP_KERNEL); 230 - if (!clock->parents) { 231 - clk = ERR_PTR(-ENOMEM); 232 - goto free_clock; 233 - } 234 227 235 228 clock->reg = reg; 236 229 ··· 252 259 pr_err("%s: invalid number of parents for DIV6 clock %s\n", 253 260 __func__, name); 254 261 clk = ERR_PTR(-EINVAL); 255 - goto free_parents; 262 + goto free_clock; 256 263 } 257 264 258 265 /* Filter out invalid parents */ ··· 275 282 276 283 clk = clk_register(NULL, &clock->hw); 277 284 if (IS_ERR(clk)) 278 - goto free_parents; 285 + goto free_clock; 279 286 280 287 if (notifiers) { 281 288 clock->nb.notifier_call = cpg_div6_clock_notifier_call; ··· 284 291 285 292 return clk; 286 293 287 - free_parents: 288 - kfree(clock->parents); 289 294 free_clock: 290 295 kfree(clock); 291 296 return clk;
+8 -12
drivers/clk/renesas/clk-mstp.c
··· 30 30 /** 31 31 * struct mstp_clock_group - MSTP gating clocks group 32 32 * 33 - * @data: clocks in this group 33 + * @data: clock specifier translation for clocks in this group 34 34 * @smstpcr: module stop control register 35 35 * @mstpsr: module stop status register (optional) 36 36 * @lock: protects writes to SMSTPCR 37 37 * @width_8bit: registers are 8-bit, not 32-bit 38 + * @clks: clocks in this group 38 39 */ 39 40 struct mstp_clock_group { 40 41 struct clk_onecell_data data; ··· 43 42 void __iomem *mstpsr; 44 43 spinlock_t lock; 45 44 bool width_8bit; 45 + struct clk *clks[]; 46 46 }; 47 47 48 48 /** ··· 188 186 struct clk **clks; 189 187 unsigned int i; 190 188 191 - group = kzalloc(sizeof(*group), GFP_KERNEL); 192 - clks = kmalloc_array(MSTP_MAX_CLOCKS, sizeof(*clks), GFP_KERNEL); 193 - if (group == NULL || clks == NULL) { 189 + group = kzalloc(struct_size(group, clks, MSTP_MAX_CLOCKS), GFP_KERNEL); 190 + if (group == NULL) { 194 191 kfree(group); 195 - kfree(clks); 196 192 return; 197 193 } 198 194 195 + clks = group->clks; 199 196 spin_lock_init(&group->lock); 200 197 group->data.clks = clks; 201 198 ··· 204 203 if (group->smstpcr == NULL) { 205 204 pr_err("%s: failed to remap SMSTPCR\n", __func__); 206 205 kfree(group); 207 - kfree(clks); 208 206 return; 209 207 } 210 208 ··· 297 297 return PTR_ERR(clk); 298 298 299 299 error = pm_clk_create(dev); 300 - if (error) { 301 - dev_err(dev, "pm_clk_create failed %d\n", error); 300 + if (error) 302 301 goto fail_put; 303 - } 304 302 305 303 error = pm_clk_add_clk(dev, clk); 306 - if (error) { 307 - dev_err(dev, "pm_clk_add_clk %pC failed %d\n", clk, error); 304 + if (error) 308 305 goto fail_destroy; 309 - } 310 306 311 307 return 0; 312 308
+5
drivers/clk/renesas/r8a774a1-cpg-mssr.c
··· 113 113 }; 114 114 115 115 static const struct mssr_mod_clk r8a774a1_mod_clks[] __initconst = { 116 + DEF_MOD("tmu4", 121, R8A774A1_CLK_S0D6), 117 + DEF_MOD("tmu3", 122, R8A774A1_CLK_S3D2), 118 + DEF_MOD("tmu2", 123, R8A774A1_CLK_S3D2), 119 + DEF_MOD("tmu1", 124, R8A774A1_CLK_S3D2), 120 + DEF_MOD("tmu0", 125, R8A774A1_CLK_CP), 116 121 DEF_MOD("fdp1-0", 119, R8A774A1_CLK_S0D1), 117 122 DEF_MOD("scif5", 202, R8A774A1_CLK_S3D4), 118 123 DEF_MOD("scif4", 203, R8A774A1_CLK_S3D4),
+5
drivers/clk/renesas/r8a7795-cpg-mssr.c
··· 138 138 DEF_MOD("cmt2", 301, R8A7795_CLK_R), 139 139 DEF_MOD("cmt1", 302, R8A7795_CLK_R), 140 140 DEF_MOD("cmt0", 303, R8A7795_CLK_R), 141 + DEF_MOD("tpu0", 304, R8A7795_CLK_S3D4), 141 142 DEF_MOD("scif2", 310, R8A7795_CLK_S3D4), 142 143 DEF_MOD("sdif3", 311, R8A7795_CLK_SD3), 143 144 DEF_MOD("sdif2", 312, R8A7795_CLK_SD2), ··· 202 201 DEF_MOD("ehci0", 703, R8A7795_CLK_S3D2), 203 202 DEF_MOD("hsusb", 704, R8A7795_CLK_S3D2), 204 203 DEF_MOD("hsusb3", 705, R8A7795_CLK_S3D2), 204 + DEF_MOD("cmm3", 708, R8A7795_CLK_S2D1), 205 + DEF_MOD("cmm2", 709, R8A7795_CLK_S2D1), 206 + DEF_MOD("cmm1", 710, R8A7795_CLK_S2D1), 207 + DEF_MOD("cmm0", 711, R8A7795_CLK_S2D1), 205 208 DEF_MOD("csi21", 713, R8A7795_CLK_CSI0), /* ES1.x */ 206 209 DEF_MOD("csi20", 714, R8A7795_CLK_CSI0), 207 210 DEF_MOD("csi41", 715, R8A7795_CLK_CSI0),
+4
drivers/clk/renesas/r8a7796-cpg-mssr.c
··· 134 134 DEF_MOD("cmt2", 301, R8A7796_CLK_R), 135 135 DEF_MOD("cmt1", 302, R8A7796_CLK_R), 136 136 DEF_MOD("cmt0", 303, R8A7796_CLK_R), 137 + DEF_MOD("tpu0", 304, R8A7796_CLK_S3D4), 137 138 DEF_MOD("scif2", 310, R8A7796_CLK_S3D4), 138 139 DEF_MOD("sdif3", 311, R8A7796_CLK_SD3), 139 140 DEF_MOD("sdif2", 312, R8A7796_CLK_SD2), ··· 181 180 DEF_MOD("ehci1", 702, R8A7796_CLK_S3D2), 182 181 DEF_MOD("ehci0", 703, R8A7796_CLK_S3D2), 183 182 DEF_MOD("hsusb", 704, R8A7796_CLK_S3D2), 183 + DEF_MOD("cmm2", 709, R8A7796_CLK_S2D1), 184 + DEF_MOD("cmm1", 710, R8A7796_CLK_S2D1), 185 + DEF_MOD("cmm0", 711, R8A7796_CLK_S2D1), 184 186 DEF_MOD("csi20", 714, R8A7796_CLK_CSI0), 185 187 DEF_MOD("csi40", 716, R8A7796_CLK_CSI0), 186 188 DEF_MOD("du2", 722, R8A7796_CLK_S2D1),
+4
drivers/clk/renesas/r8a77965-cpg-mssr.c
··· 132 132 DEF_MOD("cmt2", 301, R8A77965_CLK_R), 133 133 DEF_MOD("cmt1", 302, R8A77965_CLK_R), 134 134 DEF_MOD("cmt0", 303, R8A77965_CLK_R), 135 + DEF_MOD("tpu0", 304, R8A77965_CLK_S3D4), 135 136 DEF_MOD("scif2", 310, R8A77965_CLK_S3D4), 136 137 DEF_MOD("sdif3", 311, R8A77965_CLK_SD3), 137 138 DEF_MOD("sdif2", 312, R8A77965_CLK_SD2), ··· 180 179 DEF_MOD("ehci1", 702, R8A77965_CLK_S3D2), 181 180 DEF_MOD("ehci0", 703, R8A77965_CLK_S3D2), 182 181 DEF_MOD("hsusb", 704, R8A77965_CLK_S3D2), 182 + DEF_MOD("cmm3", 708, R8A77965_CLK_S2D1), 183 + DEF_MOD("cmm1", 710, R8A77965_CLK_S2D1), 184 + DEF_MOD("cmm0", 711, R8A77965_CLK_S2D1), 183 185 DEF_MOD("csi20", 714, R8A77965_CLK_CSI0), 184 186 DEF_MOD("csi40", 716, R8A77965_CLK_CSI0), 185 187 DEF_MOD("du3", 721, R8A77965_CLK_S2D1),
+2
drivers/clk/renesas/r8a77990-cpg-mssr.c
··· 183 183 184 184 DEF_MOD("ehci0", 703, R8A77990_CLK_S3D2), 185 185 DEF_MOD("hsusb", 704, R8A77990_CLK_S3D2), 186 + DEF_MOD("cmm1", 710, R8A77990_CLK_S1D1), 187 + DEF_MOD("cmm0", 711, R8A77990_CLK_S1D1), 186 188 DEF_MOD("csi40", 716, R8A77990_CLK_CSI0), 187 189 DEF_MOD("du1", 723, R8A77990_CLK_S1D1), 188 190 DEF_MOD("du0", 724, R8A77990_CLK_S1D1),
+2
drivers/clk/renesas/r8a77995-cpg-mssr.c
··· 146 146 DEF_MOD("vspbs", 627, R8A77995_CLK_S0D1), 147 147 DEF_MOD("ehci0", 703, R8A77995_CLK_S3D2), 148 148 DEF_MOD("hsusb", 704, R8A77995_CLK_S3D2), 149 + DEF_MOD("cmm1", 710, R8A77995_CLK_S1D1), 150 + DEF_MOD("cmm0", 711, R8A77995_CLK_S1D1), 149 151 DEF_MOD("du1", 723, R8A77995_CLK_S1D1), 150 152 DEF_MOD("du0", 724, R8A77995_CLK_S1D1), 151 153 DEF_MOD("lvds", 727, R8A77995_CLK_S2D1),
+158 -69
drivers/clk/renesas/r9a06g032-clocks.c
··· 17 17 #include <linux/of.h> 18 18 #include <linux/of_address.h> 19 19 #include <linux/platform_device.h> 20 + #include <linux/pm_clock.h> 21 + #include <linux/pm_domain.h> 20 22 #include <linux/slab.h> 21 23 #include <linux/spinlock.h> 22 24 #include <dt-bindings/clock/r9a06g032-sysctrl.h> ··· 31 29 /* This is used to describe a clock for instantiation */ 32 30 struct r9a06g032_clkdesc { 33 31 const char *name; 32 + uint32_t managed: 1; 34 33 uint32_t type: 3; 35 34 uint32_t index: 8; 36 35 uint32_t source : 8; /* source index + 1 (0 == none) */ ··· 64 61 #define D_GATE(_idx, _n, _src, ...) \ 65 62 { .type = K_GATE, .index = R9A06G032_##_idx, \ 66 63 .source = 1 + R9A06G032_##_src, .name = _n, \ 67 - .gate = I_GATE(__VA_ARGS__), } 64 + .gate = I_GATE(__VA_ARGS__) } 65 + #define D_MODULE(_idx, _n, _src, ...) \ 66 + { .type = K_GATE, .index = R9A06G032_##_idx, \ 67 + .source = 1 + R9A06G032_##_src, .name = _n, \ 68 + .managed = 1, .gate = I_GATE(__VA_ARGS__) } 68 69 #define D_ROOT(_idx, _n, _mul, _div) \ 69 70 { .type = K_FFC, .index = R9A06G032_##_idx, .name = _n, \ 70 71 .div = _div, .mul = _mul } ··· 129 122 130 123 #define R9A06G032_CLOCK_COUNT (R9A06G032_UART_GROUP_34567 + 1) 131 124 132 - static const struct r9a06g032_clkdesc r9a06g032_clocks[] __initconst = { 125 + static const struct r9a06g032_clkdesc r9a06g032_clocks[] = { 133 126 D_ROOT(CLKOUT, "clkout", 25, 1), 134 127 D_ROOT(CLK_PLL_USB, "clk_pll_usb", 12, 10), 135 128 D_FFC(CLKOUT_D10, "clkout_d10", CLKOUT, 10), ··· 178 171 D_GATE(CLK_P6_PG2, "clk_p6_pg2", DIV_P6_PG, 0x8a3, 0x8a4, 0x8a5, 0, 0xb61, 0, 0), 179 172 D_GATE(CLK_P6_PG3, "clk_p6_pg3", DIV_P6_PG, 0x8a6, 0x8a7, 0x8a8, 0, 0xb62, 0, 0), 180 173 D_GATE(CLK_P6_PG4, "clk_p6_pg4", DIV_P6_PG, 0x8a9, 0x8aa, 0x8ab, 0, 0xb63, 0, 0), 181 - D_GATE(CLK_PCI_USB, "clk_pci_usb", CLKOUT_D40, 0xe6, 0, 0, 0, 0, 0, 0), 174 + D_MODULE(CLK_PCI_USB, "clk_pci_usb", CLKOUT_D40, 0xe6, 0, 0, 0, 0, 0, 0), 182 175 D_GATE(CLK_QSPI0, "clk_qspi0", DIV_QSPI0, 0x2a4, 0x2a5, 0, 0, 0, 0, 0), 183 176 D_GATE(CLK_QSPI1, "clk_qspi1", DIV_QSPI1, 0x484, 0x485, 0, 0, 0, 0, 0), 184 177 D_GATE(CLK_RGMII_REF, "clk_rgmii_ref", CLKOUT_D8, 0x340, 0, 0, 0, 0, 0, 0), ··· 195 188 D_GATE(CLK_SPI5, "clk_spi5", DIV_P4_PG, 0x822, 0x823, 0, 0, 0, 0, 0), 196 189 D_GATE(CLK_SWITCH, "clk_switch", DIV_SWITCH, 0x982, 0x983, 0, 0, 0, 0, 0), 197 190 D_DIV(DIV_MOTOR, "div_motor", CLKOUT_D5, 84, 2, 8), 198 - D_GATE(HCLK_ECAT125, "hclk_ecat125", CLKOUT_D8, 0x400, 0x401, 0, 0x402, 0, 0x440, 0x441), 199 - D_GATE(HCLK_PINCONFIG, "hclk_pinconfig", CLKOUT_D40, 0x740, 0x741, 0x742, 0, 0xae0, 0, 0), 200 - D_GATE(HCLK_SERCOS, "hclk_sercos", CLKOUT_D10, 0x420, 0x422, 0, 0x421, 0, 0x460, 0x461), 201 - D_GATE(HCLK_SGPIO2, "hclk_sgpio2", DIV_P5_PG, 0x8c3, 0x8c4, 0x8c5, 0, 0xb41, 0, 0), 202 - D_GATE(HCLK_SGPIO3, "hclk_sgpio3", DIV_P5_PG, 0x8c6, 0x8c7, 0x8c8, 0, 0xb42, 0, 0), 203 - D_GATE(HCLK_SGPIO4, "hclk_sgpio4", DIV_P5_PG, 0x8c9, 0x8ca, 0x8cb, 0, 0xb43, 0, 0), 204 - D_GATE(HCLK_TIMER0, "hclk_timer0", CLKOUT_D40, 0x743, 0x744, 0x745, 0, 0xae1, 0, 0), 205 - D_GATE(HCLK_TIMER1, "hclk_timer1", CLKOUT_D40, 0x746, 0x747, 0x748, 0, 0xae2, 0, 0), 206 - D_GATE(HCLK_USBF, "hclk_usbf", CLKOUT_D8, 0xe3, 0, 0, 0xe4, 0, 0x102, 0x103), 207 - D_GATE(HCLK_USBH, "hclk_usbh", CLKOUT_D8, 0xe0, 0xe1, 0, 0xe2, 0, 0x100, 0x101), 208 - D_GATE(HCLK_USBPM, "hclk_usbpm", CLKOUT_D8, 0xe5, 0, 0, 0, 0, 0, 0), 191 + D_MODULE(HCLK_ECAT125, "hclk_ecat125", CLKOUT_D8, 0x400, 0x401, 0, 0x402, 0, 0x440, 0x441), 192 + D_MODULE(HCLK_PINCONFIG, "hclk_pinconfig", CLKOUT_D40, 0x740, 0x741, 0x742, 0, 0xae0, 0, 0), 193 + D_MODULE(HCLK_SERCOS, "hclk_sercos", CLKOUT_D10, 0x420, 0x422, 0, 0x421, 0, 0x460, 0x461), 194 + D_MODULE(HCLK_SGPIO2, "hclk_sgpio2", DIV_P5_PG, 0x8c3, 0x8c4, 0x8c5, 0, 0xb41, 0, 0), 195 + D_MODULE(HCLK_SGPIO3, "hclk_sgpio3", DIV_P5_PG, 0x8c6, 0x8c7, 0x8c8, 0, 0xb42, 0, 0), 196 + D_MODULE(HCLK_SGPIO4, "hclk_sgpio4", DIV_P5_PG, 0x8c9, 0x8ca, 0x8cb, 0, 0xb43, 0, 0), 197 + D_MODULE(HCLK_TIMER0, "hclk_timer0", CLKOUT_D40, 0x743, 0x744, 0x745, 0, 0xae1, 0, 0), 198 + D_MODULE(HCLK_TIMER1, "hclk_timer1", CLKOUT_D40, 0x746, 0x747, 0x748, 0, 0xae2, 0, 0), 199 + D_MODULE(HCLK_USBF, "hclk_usbf", CLKOUT_D8, 0xe3, 0, 0, 0xe4, 0, 0x102, 0x103), 200 + D_MODULE(HCLK_USBH, "hclk_usbh", CLKOUT_D8, 0xe0, 0xe1, 0, 0xe2, 0, 0x100, 0x101), 201 + D_MODULE(HCLK_USBPM, "hclk_usbpm", CLKOUT_D8, 0xe5, 0, 0, 0, 0, 0, 0), 209 202 D_GATE(CLK_48_PG_F, "clk_48_pg_f", CLK_48, 0x78c, 0x78d, 0, 0x78e, 0, 0xb04, 0xb05), 210 203 D_GATE(CLK_48_PG4, "clk_48_pg4", CLK_48, 0x789, 0x78a, 0x78b, 0, 0xb03, 0, 0), 211 204 D_FFC(CLK_DDRPHY_PLLCLK_D4, "clk_ddrphy_pllclk_d4", CLK_DDRPHY_PLLCLK, 4), ··· 215 208 D_FFC(CLK_REF_SYNC_D8, "clk_ref_sync_d8", CLK_REF_SYNC, 8), 216 209 D_FFC(CLK_SERCOS100_D2, "clk_sercos100_d2", CLK_SERCOS100, 2), 217 210 D_DIV(DIV_CA7, "div_ca7", CLK_REF_SYNC, 57, 1, 4, 1, 2, 4), 218 - D_GATE(HCLK_CAN0, "hclk_can0", CLK_48, 0x783, 0x784, 0x785, 0, 0xb01, 0, 0), 219 - D_GATE(HCLK_CAN1, "hclk_can1", CLK_48, 0x786, 0x787, 0x788, 0, 0xb02, 0, 0), 220 - D_GATE(HCLK_DELTASIGMA, "hclk_deltasigma", DIV_MOTOR, 0x1ef, 0x1f0, 0x1f1, 0, 0, 0, 0), 221 - D_GATE(HCLK_PWMPTO, "hclk_pwmpto", DIV_MOTOR, 0x1ec, 0x1ed, 0x1ee, 0, 0, 0, 0), 222 - D_GATE(HCLK_RSV, "hclk_rsv", CLK_48, 0x780, 0x781, 0x782, 0, 0xb00, 0, 0), 223 - D_GATE(HCLK_SGPIO0, "hclk_sgpio0", DIV_MOTOR, 0x1e0, 0x1e1, 0x1e2, 0, 0, 0, 0), 224 - D_GATE(HCLK_SGPIO1, "hclk_sgpio1", DIV_MOTOR, 0x1e3, 0x1e4, 0x1e5, 0, 0, 0, 0), 211 + D_MODULE(HCLK_CAN0, "hclk_can0", CLK_48, 0x783, 0x784, 0x785, 0, 0xb01, 0, 0), 212 + D_MODULE(HCLK_CAN1, "hclk_can1", CLK_48, 0x786, 0x787, 0x788, 0, 0xb02, 0, 0), 213 + D_MODULE(HCLK_DELTASIGMA, "hclk_deltasigma", DIV_MOTOR, 0x1ef, 0x1f0, 0x1f1, 0, 0, 0, 0), 214 + D_MODULE(HCLK_PWMPTO, "hclk_pwmpto", DIV_MOTOR, 0x1ec, 0x1ed, 0x1ee, 0, 0, 0, 0), 215 + D_MODULE(HCLK_RSV, "hclk_rsv", CLK_48, 0x780, 0x781, 0x782, 0, 0xb00, 0, 0), 216 + D_MODULE(HCLK_SGPIO0, "hclk_sgpio0", DIV_MOTOR, 0x1e0, 0x1e1, 0x1e2, 0, 0, 0, 0), 217 + D_MODULE(HCLK_SGPIO1, "hclk_sgpio1", DIV_MOTOR, 0x1e3, 0x1e4, 0x1e5, 0, 0, 0, 0), 225 218 D_DIV(RTOS_MDC, "rtos_mdc", CLK_REF_SYNC, 100, 80, 640, 80, 160, 320, 640), 226 219 D_GATE(CLK_CM3, "clk_cm3", CLK_REF_SYNC_D4, 0xba0, 0xba1, 0, 0xba2, 0, 0xbc0, 0xbc1), 227 220 D_GATE(CLK_DDRC, "clk_ddrc", CLK_DDRPHY_PLLCLK_D4, 0x323, 0x324, 0, 0, 0, 0, 0), ··· 229 222 D_GATE(CLK_HSR50, "clk_hsr50", CLK_HSR100_D2, 0x484, 0x485, 0, 0, 0, 0, 0), 230 223 D_GATE(CLK_HW_RTOS, "clk_hw_rtos", CLK_REF_SYNC_D4, 0xc60, 0xc61, 0, 0, 0, 0, 0), 231 224 D_GATE(CLK_SERCOS50, "clk_sercos50", CLK_SERCOS100_D2, 0x424, 0x423, 0, 0, 0, 0, 0), 232 - D_GATE(HCLK_ADC, "hclk_adc", CLK_REF_SYNC_D8, 0x1af, 0x1b0, 0x1b1, 0, 0, 0, 0), 233 - D_GATE(HCLK_CM3, "hclk_cm3", CLK_REF_SYNC_D4, 0xc20, 0xc21, 0xc22, 0, 0, 0, 0), 234 - D_GATE(HCLK_CRYPTO_EIP150, "hclk_crypto_eip150", CLK_REF_SYNC_D4, 0x123, 0x124, 0x125, 0, 0x142, 0, 0), 235 - D_GATE(HCLK_CRYPTO_EIP93, "hclk_crypto_eip93", CLK_REF_SYNC_D4, 0x120, 0x121, 0, 0x122, 0, 0x140, 0x141), 236 - D_GATE(HCLK_DDRC, "hclk_ddrc", CLK_REF_SYNC_D4, 0x320, 0x322, 0, 0x321, 0, 0x3a0, 0x3a1), 237 - D_GATE(HCLK_DMA0, "hclk_dma0", CLK_REF_SYNC_D4, 0x260, 0x261, 0x262, 0x263, 0x2c0, 0x2c1, 0x2c2), 238 - D_GATE(HCLK_DMA1, "hclk_dma1", CLK_REF_SYNC_D4, 0x264, 0x265, 0x266, 0x267, 0x2c3, 0x2c4, 0x2c5), 239 - D_GATE(HCLK_GMAC0, "hclk_gmac0", CLK_REF_SYNC_D4, 0x360, 0x361, 0x362, 0x363, 0x3c0, 0x3c1, 0x3c2), 240 - D_GATE(HCLK_GMAC1, "hclk_gmac1", CLK_REF_SYNC_D4, 0x380, 0x381, 0x382, 0x383, 0x3e0, 0x3e1, 0x3e2), 241 - D_GATE(HCLK_GPIO0, "hclk_gpio0", CLK_REF_SYNC_D4, 0x212, 0x213, 0x214, 0, 0, 0, 0), 242 - D_GATE(HCLK_GPIO1, "hclk_gpio1", CLK_REF_SYNC_D4, 0x215, 0x216, 0x217, 0, 0, 0, 0), 243 - D_GATE(HCLK_GPIO2, "hclk_gpio2", CLK_REF_SYNC_D4, 0x229, 0x22a, 0x22b, 0, 0, 0, 0), 244 - D_GATE(HCLK_HSR, "hclk_hsr", CLK_HSR100_D2, 0x480, 0x482, 0, 0x481, 0, 0x4c0, 0x4c1), 245 - D_GATE(HCLK_I2C0, "hclk_i2c0", CLK_REF_SYNC_D8, 0x1a9, 0x1aa, 0x1ab, 0, 0, 0, 0), 246 - D_GATE(HCLK_I2C1, "hclk_i2c1", CLK_REF_SYNC_D8, 0x1ac, 0x1ad, 0x1ae, 0, 0, 0, 0), 247 - D_GATE(HCLK_LCD, "hclk_lcd", CLK_REF_SYNC_D4, 0x7a0, 0x7a1, 0x7a2, 0, 0xb20, 0, 0), 248 - D_GATE(HCLK_MSEBI_M, "hclk_msebi_m", CLK_REF_SYNC_D4, 0x164, 0x165, 0x166, 0, 0x183, 0, 0), 249 - D_GATE(HCLK_MSEBI_S, "hclk_msebi_s", CLK_REF_SYNC_D4, 0x160, 0x161, 0x162, 0x163, 0x180, 0x181, 0x182), 250 - D_GATE(HCLK_NAND, "hclk_nand", CLK_REF_SYNC_D4, 0x280, 0x281, 0x282, 0x283, 0x2e0, 0x2e1, 0x2e2), 251 - D_GATE(HCLK_PG_I, "hclk_pg_i", CLK_REF_SYNC_D4, 0x7ac, 0x7ad, 0, 0x7ae, 0, 0xb24, 0xb25), 252 - D_GATE(HCLK_PG19, "hclk_pg19", CLK_REF_SYNC_D4, 0x22c, 0x22d, 0x22e, 0, 0, 0, 0), 253 - D_GATE(HCLK_PG20, "hclk_pg20", CLK_REF_SYNC_D4, 0x22f, 0x230, 0x231, 0, 0, 0, 0), 254 - D_GATE(HCLK_PG3, "hclk_pg3", CLK_REF_SYNC_D4, 0x7a6, 0x7a7, 0x7a8, 0, 0xb22, 0, 0), 255 - D_GATE(HCLK_PG4, "hclk_pg4", CLK_REF_SYNC_D4, 0x7a9, 0x7aa, 0x7ab, 0, 0xb23, 0, 0), 256 - D_GATE(HCLK_QSPI0, "hclk_qspi0", CLK_REF_SYNC_D4, 0x2a0, 0x2a1, 0x2a2, 0x2a3, 0x300, 0x301, 0x302), 257 - D_GATE(HCLK_QSPI1, "hclk_qspi1", CLK_REF_SYNC_D4, 0x480, 0x481, 0x482, 0x483, 0x4c0, 0x4c1, 0x4c2), 258 - D_GATE(HCLK_ROM, "hclk_rom", CLK_REF_SYNC_D4, 0xaa0, 0xaa1, 0xaa2, 0, 0xb80, 0, 0), 259 - D_GATE(HCLK_RTC, "hclk_rtc", CLK_REF_SYNC_D8, 0xa00, 0, 0, 0, 0, 0, 0), 260 - D_GATE(HCLK_SDIO0, "hclk_sdio0", CLK_REF_SYNC_D4, 0x60, 0x61, 0x62, 0x63, 0x80, 0x81, 0x82), 261 - D_GATE(HCLK_SDIO1, "hclk_sdio1", CLK_REF_SYNC_D4, 0x640, 0x641, 0x642, 0x643, 0x660, 0x661, 0x662), 262 - D_GATE(HCLK_SEMAP, "hclk_semap", CLK_REF_SYNC_D4, 0x7a3, 0x7a4, 0x7a5, 0, 0xb21, 0, 0), 263 - D_GATE(HCLK_SPI0, "hclk_spi0", CLK_REF_SYNC_D4, 0x200, 0x201, 0x202, 0, 0, 0, 0), 264 - D_GATE(HCLK_SPI1, "hclk_spi1", CLK_REF_SYNC_D4, 0x203, 0x204, 0x205, 0, 0, 0, 0), 265 - D_GATE(HCLK_SPI2, "hclk_spi2", CLK_REF_SYNC_D4, 0x206, 0x207, 0x208, 0, 0, 0, 0), 266 - D_GATE(HCLK_SPI3, "hclk_spi3", CLK_REF_SYNC_D4, 0x209, 0x20a, 0x20b, 0, 0, 0, 0), 267 - D_GATE(HCLK_SPI4, "hclk_spi4", CLK_REF_SYNC_D4, 0x20c, 0x20d, 0x20e, 0, 0, 0, 0), 268 - D_GATE(HCLK_SPI5, "hclk_spi5", CLK_REF_SYNC_D4, 0x20f, 0x210, 0x211, 0, 0, 0, 0), 269 - D_GATE(HCLK_SWITCH, "hclk_switch", CLK_REF_SYNC_D4, 0x980, 0, 0x981, 0, 0, 0, 0), 270 - D_GATE(HCLK_SWITCH_RG, "hclk_switch_rg", CLK_REF_SYNC_D4, 0xc40, 0xc41, 0xc42, 0, 0, 0, 0), 271 - D_GATE(HCLK_UART0, "hclk_uart0", CLK_REF_SYNC_D8, 0x1a0, 0x1a1, 0x1a2, 0, 0, 0, 0), 272 - D_GATE(HCLK_UART1, "hclk_uart1", CLK_REF_SYNC_D8, 0x1a3, 0x1a4, 0x1a5, 0, 0, 0, 0), 273 - D_GATE(HCLK_UART2, "hclk_uart2", CLK_REF_SYNC_D8, 0x1a6, 0x1a7, 0x1a8, 0, 0, 0, 0), 274 - D_GATE(HCLK_UART3, "hclk_uart3", CLK_REF_SYNC_D4, 0x218, 0x219, 0x21a, 0, 0, 0, 0), 275 - D_GATE(HCLK_UART4, "hclk_uart4", CLK_REF_SYNC_D4, 0x21b, 0x21c, 0x21d, 0, 0, 0, 0), 276 - D_GATE(HCLK_UART5, "hclk_uart5", CLK_REF_SYNC_D4, 0x220, 0x221, 0x222, 0, 0, 0, 0), 277 - D_GATE(HCLK_UART6, "hclk_uart6", CLK_REF_SYNC_D4, 0x223, 0x224, 0x225, 0, 0, 0, 0), 278 - D_GATE(HCLK_UART7, "hclk_uart7", CLK_REF_SYNC_D4, 0x226, 0x227, 0x228, 0, 0, 0, 0), 225 + D_MODULE(HCLK_ADC, "hclk_adc", CLK_REF_SYNC_D8, 0x1af, 0x1b0, 0x1b1, 0, 0, 0, 0), 226 + D_MODULE(HCLK_CM3, "hclk_cm3", CLK_REF_SYNC_D4, 0xc20, 0xc21, 0xc22, 0, 0, 0, 0), 227 + D_MODULE(HCLK_CRYPTO_EIP150, "hclk_crypto_eip150", CLK_REF_SYNC_D4, 0x123, 0x124, 0x125, 0, 0x142, 0, 0), 228 + D_MODULE(HCLK_CRYPTO_EIP93, "hclk_crypto_eip93", CLK_REF_SYNC_D4, 0x120, 0x121, 0, 0x122, 0, 0x140, 0x141), 229 + D_MODULE(HCLK_DDRC, "hclk_ddrc", CLK_REF_SYNC_D4, 0x320, 0x322, 0, 0x321, 0, 0x3a0, 0x3a1), 230 + D_MODULE(HCLK_DMA0, "hclk_dma0", CLK_REF_SYNC_D4, 0x260, 0x261, 0x262, 0x263, 0x2c0, 0x2c1, 0x2c2), 231 + D_MODULE(HCLK_DMA1, "hclk_dma1", CLK_REF_SYNC_D4, 0x264, 0x265, 0x266, 0x267, 0x2c3, 0x2c4, 0x2c5), 232 + D_MODULE(HCLK_GMAC0, "hclk_gmac0", CLK_REF_SYNC_D4, 0x360, 0x361, 0x362, 0x363, 0x3c0, 0x3c1, 0x3c2), 233 + D_MODULE(HCLK_GMAC1, "hclk_gmac1", CLK_REF_SYNC_D4, 0x380, 0x381, 0x382, 0x383, 0x3e0, 0x3e1, 0x3e2), 234 + D_MODULE(HCLK_GPIO0, "hclk_gpio0", CLK_REF_SYNC_D4, 0x212, 0x213, 0x214, 0, 0, 0, 0), 235 + D_MODULE(HCLK_GPIO1, "hclk_gpio1", CLK_REF_SYNC_D4, 0x215, 0x216, 0x217, 0, 0, 0, 0), 236 + D_MODULE(HCLK_GPIO2, "hclk_gpio2", CLK_REF_SYNC_D4, 0x229, 0x22a, 0x22b, 0, 0, 0, 0), 237 + D_MODULE(HCLK_HSR, "hclk_hsr", CLK_HSR100_D2, 0x480, 0x482, 0, 0x481, 0, 0x4c0, 0x4c1), 238 + D_MODULE(HCLK_I2C0, "hclk_i2c0", CLK_REF_SYNC_D8, 0x1a9, 0x1aa, 0x1ab, 0, 0, 0, 0), 239 + D_MODULE(HCLK_I2C1, "hclk_i2c1", CLK_REF_SYNC_D8, 0x1ac, 0x1ad, 0x1ae, 0, 0, 0, 0), 240 + D_MODULE(HCLK_LCD, "hclk_lcd", CLK_REF_SYNC_D4, 0x7a0, 0x7a1, 0x7a2, 0, 0xb20, 0, 0), 241 + D_MODULE(HCLK_MSEBI_M, "hclk_msebi_m", CLK_REF_SYNC_D4, 0x164, 0x165, 0x166, 0, 0x183, 0, 0), 242 + D_MODULE(HCLK_MSEBI_S, "hclk_msebi_s", CLK_REF_SYNC_D4, 0x160, 0x161, 0x162, 0x163, 0x180, 0x181, 0x182), 243 + D_MODULE(HCLK_NAND, "hclk_nand", CLK_REF_SYNC_D4, 0x280, 0x281, 0x282, 0x283, 0x2e0, 0x2e1, 0x2e2), 244 + D_MODULE(HCLK_PG_I, "hclk_pg_i", CLK_REF_SYNC_D4, 0x7ac, 0x7ad, 0, 0x7ae, 0, 0xb24, 0xb25), 245 + D_MODULE(HCLK_PG19, "hclk_pg19", CLK_REF_SYNC_D4, 0x22c, 0x22d, 0x22e, 0, 0, 0, 0), 246 + D_MODULE(HCLK_PG20, "hclk_pg20", CLK_REF_SYNC_D4, 0x22f, 0x230, 0x231, 0, 0, 0, 0), 247 + D_MODULE(HCLK_PG3, "hclk_pg3", CLK_REF_SYNC_D4, 0x7a6, 0x7a7, 0x7a8, 0, 0xb22, 0, 0), 248 + D_MODULE(HCLK_PG4, "hclk_pg4", CLK_REF_SYNC_D4, 0x7a9, 0x7aa, 0x7ab, 0, 0xb23, 0, 0), 249 + D_MODULE(HCLK_QSPI0, "hclk_qspi0", CLK_REF_SYNC_D4, 0x2a0, 0x2a1, 0x2a2, 0x2a3, 0x300, 0x301, 0x302), 250 + D_MODULE(HCLK_QSPI1, "hclk_qspi1", CLK_REF_SYNC_D4, 0x480, 0x481, 0x482, 0x483, 0x4c0, 0x4c1, 0x4c2), 251 + D_MODULE(HCLK_ROM, "hclk_rom", CLK_REF_SYNC_D4, 0xaa0, 0xaa1, 0xaa2, 0, 0xb80, 0, 0), 252 + D_MODULE(HCLK_RTC, "hclk_rtc", CLK_REF_SYNC_D8, 0xa00, 0, 0, 0, 0, 0, 0), 253 + D_MODULE(HCLK_SDIO0, "hclk_sdio0", CLK_REF_SYNC_D4, 0x60, 0x61, 0x62, 0x63, 0x80, 0x81, 0x82), 254 + D_MODULE(HCLK_SDIO1, "hclk_sdio1", CLK_REF_SYNC_D4, 0x640, 0x641, 0x642, 0x643, 0x660, 0x661, 0x662), 255 + D_MODULE(HCLK_SEMAP, "hclk_semap", CLK_REF_SYNC_D4, 0x7a3, 0x7a4, 0x7a5, 0, 0xb21, 0, 0), 256 + D_MODULE(HCLK_SPI0, "hclk_spi0", CLK_REF_SYNC_D4, 0x200, 0x201, 0x202, 0, 0, 0, 0), 257 + D_MODULE(HCLK_SPI1, "hclk_spi1", CLK_REF_SYNC_D4, 0x203, 0x204, 0x205, 0, 0, 0, 0), 258 + D_MODULE(HCLK_SPI2, "hclk_spi2", CLK_REF_SYNC_D4, 0x206, 0x207, 0x208, 0, 0, 0, 0), 259 + D_MODULE(HCLK_SPI3, "hclk_spi3", CLK_REF_SYNC_D4, 0x209, 0x20a, 0x20b, 0, 0, 0, 0), 260 + D_MODULE(HCLK_SPI4, "hclk_spi4", CLK_REF_SYNC_D4, 0x20c, 0x20d, 0x20e, 0, 0, 0, 0), 261 + D_MODULE(HCLK_SPI5, "hclk_spi5", CLK_REF_SYNC_D4, 0x20f, 0x210, 0x211, 0, 0, 0, 0), 262 + D_MODULE(HCLK_SWITCH, "hclk_switch", CLK_REF_SYNC_D4, 0x980, 0, 0x981, 0, 0, 0, 0), 263 + D_MODULE(HCLK_SWITCH_RG, "hclk_switch_rg", CLK_REF_SYNC_D4, 0xc40, 0xc41, 0xc42, 0, 0, 0, 0), 264 + D_MODULE(HCLK_UART0, "hclk_uart0", CLK_REF_SYNC_D8, 0x1a0, 0x1a1, 0x1a2, 0, 0, 0, 0), 265 + D_MODULE(HCLK_UART1, "hclk_uart1", CLK_REF_SYNC_D8, 0x1a3, 0x1a4, 0x1a5, 0, 0, 0, 0), 266 + D_MODULE(HCLK_UART2, "hclk_uart2", CLK_REF_SYNC_D8, 0x1a6, 0x1a7, 0x1a8, 0, 0, 0, 0), 267 + D_MODULE(HCLK_UART3, "hclk_uart3", CLK_REF_SYNC_D4, 0x218, 0x219, 0x21a, 0, 0, 0, 0), 268 + D_MODULE(HCLK_UART4, "hclk_uart4", CLK_REF_SYNC_D4, 0x21b, 0x21c, 0x21d, 0, 0, 0, 0), 269 + D_MODULE(HCLK_UART5, "hclk_uart5", CLK_REF_SYNC_D4, 0x220, 0x221, 0x222, 0, 0, 0, 0), 270 + D_MODULE(HCLK_UART6, "hclk_uart6", CLK_REF_SYNC_D4, 0x223, 0x224, 0x225, 0, 0, 0, 0), 271 + D_MODULE(HCLK_UART7, "hclk_uart7", CLK_REF_SYNC_D4, 0x226, 0x227, 0x228, 0, 0, 0, 0), 279 272 /* 280 273 * These are not hardware clocks, but are needed to handle the special 281 274 * case where we have a 'selector bit' that doesn't just change the ··· 351 344 }; 352 345 353 346 #define to_r9a06g032_gate(_hw) container_of(_hw, struct r9a06g032_clk_gate, hw) 347 + 348 + static int create_add_module_clock(struct of_phandle_args *clkspec, 349 + struct device *dev) 350 + { 351 + struct clk *clk; 352 + int error; 353 + 354 + clk = of_clk_get_from_provider(clkspec); 355 + if (IS_ERR(clk)) 356 + return PTR_ERR(clk); 357 + 358 + error = pm_clk_create(dev); 359 + if (error) { 360 + clk_put(clk); 361 + return error; 362 + } 363 + 364 + error = pm_clk_add_clk(dev, clk); 365 + if (error) { 366 + pm_clk_destroy(dev); 367 + clk_put(clk); 368 + } 369 + 370 + return error; 371 + } 372 + 373 + static int r9a06g032_attach_dev(struct generic_pm_domain *pd, 374 + struct device *dev) 375 + { 376 + struct device_node *np = dev->of_node; 377 + struct of_phandle_args clkspec; 378 + int i = 0; 379 + int error; 380 + int index; 381 + 382 + while (!of_parse_phandle_with_args(np, "clocks", "#clock-cells", i, 383 + &clkspec)) { 384 + if (clkspec.np != pd->dev.of_node) 385 + continue; 386 + 387 + index = clkspec.args[0]; 388 + if (index < R9A06G032_CLOCK_COUNT && 389 + r9a06g032_clocks[index].managed) { 390 + error = create_add_module_clock(&clkspec, dev); 391 + of_node_put(clkspec.np); 392 + if (error) 393 + return error; 394 + } 395 + i++; 396 + } 397 + 398 + return 0; 399 + } 400 + 401 + static void r9a06g032_detach_dev(struct generic_pm_domain *unused, struct device *dev) 402 + { 403 + if (!pm_clk_no_clocks(dev)) 404 + pm_clk_destroy(dev); 405 + } 406 + 407 + static int r9a06g032_add_clk_domain(struct device *dev) 408 + { 409 + struct device_node *np = dev->of_node; 410 + struct generic_pm_domain *pd; 411 + 412 + pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); 413 + if (!pd) 414 + return -ENOMEM; 415 + 416 + pd->name = np->name; 417 + pd->flags = GENPD_FLAG_PM_CLK | GENPD_FLAG_ACTIVE_WAKEUP; 418 + pd->attach_dev = r9a06g032_attach_dev; 419 + pd->detach_dev = r9a06g032_detach_dev; 420 + pm_genpd_init(pd, &pm_domain_always_on_gov, false); 421 + 422 + of_genpd_add_provider_simple(np, pd); 423 + return 0; 424 + } 354 425 355 426 static void 356 427 r9a06g032_clk_gate_set(struct r9a06g032_priv *clocks, ··· 956 871 if (error) 957 872 return error; 958 873 959 - return devm_add_action_or_reset(dev, 874 + error = devm_add_action_or_reset(dev, 960 875 r9a06g032_clocks_del_clk_provider, np); 876 + if (error) 877 + return error; 878 + 879 + return r9a06g032_add_clk_domain(dev); 961 880 } 962 881 963 882 static const struct of_device_id r9a06g032_match[] = {
+12 -25
drivers/clk/renesas/renesas-cpg-mssr.c
··· 112 112 * @dev: CPG/MSSR device 113 113 * @base: CPG/MSSR register block base address 114 114 * @rmw_lock: protects RMW register accesses 115 - * @clks: Array containing all Core and Module Clocks 115 + * @np: Device node in DT for this CPG/MSSR module 116 116 * @num_core_clks: Number of Core Clocks in clks[] 117 117 * @num_mod_clks: Number of Module Clocks in clks[] 118 118 * @last_dt_core_clk: ID of the last Core Clock exported to DT 119 + * @stbyctrl: This device has Standby Control Registers 119 120 * @notifiers: Notifier chain to save/restore clock state for system resume 120 121 * @smstpcr_saved[].mask: Mask of SMSTPCR[] bits under our control 121 122 * @smstpcr_saved[].val: Saved values of SMSTPCR[] 122 - * @stbyctrl: This device has Standby Control Registers 123 + * @clks: Array containing all Core and Module Clocks 123 124 */ 124 125 struct cpg_mssr_priv { 125 126 #ifdef CONFIG_RESET_CONTROLLER ··· 131 130 spinlock_t rmw_lock; 132 131 struct device_node *np; 133 132 134 - struct clk **clks; 135 133 unsigned int num_core_clks; 136 134 unsigned int num_mod_clks; 137 135 unsigned int last_dt_core_clk; ··· 141 141 u32 mask; 142 142 u32 val; 143 143 } smstpcr_saved[ARRAY_SIZE(smstpcr)]; 144 + 145 + struct clk *clks[]; 144 146 }; 145 147 146 148 static struct cpg_mssr_priv *cpg_mssr_priv; ··· 449 447 450 448 struct cpg_mssr_clk_domain { 451 449 struct generic_pm_domain genpd; 452 - struct device_node *np; 453 450 unsigned int num_core_pm_clks; 454 - unsigned int core_pm_clks[0]; 451 + unsigned int core_pm_clks[]; 455 452 }; 456 453 457 454 static struct cpg_mssr_clk_domain *cpg_mssr_clk_domain; ··· 460 459 { 461 460 unsigned int i; 462 461 463 - if (clkspec->np != pd->np || clkspec->args_count != 2) 462 + if (clkspec->np != pd->genpd.dev.of_node || clkspec->args_count != 2) 464 463 return false; 465 464 466 465 switch (clkspec->args[0]) { ··· 511 510 return PTR_ERR(clk); 512 511 513 512 error = pm_clk_create(dev); 514 - if (error) { 515 - dev_err(dev, "pm_clk_create failed %d\n", error); 513 + if (error) 516 514 goto fail_put; 517 - } 518 515 519 516 error = pm_clk_add_clk(dev, clk); 520 - if (error) { 521 - dev_err(dev, "pm_clk_add_clk %pC failed %d\n", clk, error); 517 + if (error) 522 518 goto fail_destroy; 523 - } 524 519 525 520 return 0; 526 521 ··· 546 549 if (!pd) 547 550 return -ENOMEM; 548 551 549 - pd->np = np; 550 552 pd->num_core_pm_clks = num_core_pm_clks; 551 553 memcpy(pd->core_pm_clks, core_pm_clks, pm_size); 552 554 ··· 892 896 const struct cpg_mssr_info *info) 893 897 { 894 898 struct cpg_mssr_priv *priv; 895 - struct clk **clks = NULL; 896 899 unsigned int nclks, i; 897 900 int error; 898 901 ··· 901 906 return error; 902 907 } 903 908 904 - priv = kzalloc(sizeof(*priv), GFP_KERNEL); 909 + nclks = info->num_total_core_clks + info->num_hw_mod_clks; 910 + priv = kzalloc(struct_size(priv, clks, nclks), GFP_KERNEL); 905 911 if (!priv) 906 912 return -ENOMEM; 907 913 ··· 916 920 goto out_err; 917 921 } 918 922 919 - nclks = info->num_total_core_clks + info->num_hw_mod_clks; 920 - clks = kmalloc_array(nclks, sizeof(*clks), GFP_KERNEL); 921 - if (!clks) { 922 - error = -ENOMEM; 923 - goto out_err; 924 - } 925 - 926 923 cpg_mssr_priv = priv; 927 - priv->clks = clks; 928 924 priv->num_core_clks = info->num_total_core_clks; 929 925 priv->num_mod_clks = info->num_hw_mod_clks; 930 926 priv->last_dt_core_clk = info->last_dt_core_clk; ··· 924 936 priv->stbyctrl = info->stbyctrl; 925 937 926 938 for (i = 0; i < nclks; i++) 927 - clks[i] = ERR_PTR(-ENOENT); 939 + priv->clks[i] = ERR_PTR(-ENOENT); 928 940 929 941 error = of_clk_add_provider(np, cpg_mssr_clk_src_twocell_get, priv); 930 942 if (error) ··· 933 945 return 0; 934 946 935 947 out_err: 936 - kfree(clks); 937 948 if (priv->base) 938 949 iounmap(priv->base); 939 950 kfree(priv);
+6 -8
drivers/clk/rockchip/clk-mmc-phase.c
··· 46 46 static int rockchip_mmc_get_phase(struct clk_hw *hw) 47 47 { 48 48 struct rockchip_mmc_clock *mmc_clock = to_mmc_clock(hw); 49 - unsigned long rate = clk_get_rate(hw->clk); 49 + unsigned long rate = clk_hw_get_rate(hw); 50 50 u32 raw_value; 51 51 u16 degrees; 52 52 u32 delay_num = 0; 53 53 54 54 /* See the comment for rockchip_mmc_set_phase below */ 55 - if (!rate) { 56 - pr_err("%s: invalid clk rate\n", __func__); 55 + if (!rate) 57 56 return -EINVAL; 58 - } 59 57 60 58 raw_value = readl(mmc_clock->reg) >> (mmc_clock->shift); 61 59 62 60 degrees = (raw_value & ROCKCHIP_MMC_DEGREE_MASK) * 90; 63 61 64 62 if (raw_value & ROCKCHIP_MMC_DELAY_SEL) { 65 - /* degrees/delaynum * 10000 */ 63 + /* degrees/delaynum * 1000000 */ 66 64 unsigned long factor = (ROCKCHIP_MMC_DELAY_ELEMENT_PSEC / 10) * 67 - 36 * (rate / 1000000); 65 + 36 * (rate / 10000); 68 66 69 67 delay_num = (raw_value & ROCKCHIP_MMC_DELAYNUM_MASK); 70 68 delay_num >>= ROCKCHIP_MMC_DELAYNUM_OFFSET; 71 - degrees += DIV_ROUND_CLOSEST(delay_num * factor, 10000); 69 + degrees += DIV_ROUND_CLOSEST(delay_num * factor, 1000000); 72 70 } 73 71 74 72 return degrees % 360; ··· 75 77 static int rockchip_mmc_set_phase(struct clk_hw *hw, int degrees) 76 78 { 77 79 struct rockchip_mmc_clock *mmc_clock = to_mmc_clock(hw); 78 - unsigned long rate = clk_get_rate(hw->clk); 80 + unsigned long rate = clk_hw_get_rate(hw); 79 81 u8 nineties, remainder; 80 82 u8 delay_num; 81 83 u32 raw_value;
+3 -9
drivers/clk/rockchip/clk-px30.c
··· 794 794 GATE(ACLK_GIC, "aclk_gic", "aclk_bus_pre", CLK_IGNORE_UNUSED, PX30_CLKGATE_CON(13), 12, GFLAGS), 795 795 GATE(ACLK_DCF, "aclk_dcf", "aclk_bus_pre", 0, PX30_CLKGATE_CON(13), 15, GFLAGS), 796 796 797 + /* aclk_dmac is controlled by sgrf_soc_con1[11]. */ 798 + SGRF_GATE(ACLK_DMAC, "aclk_dmac", "aclk_bus_pre"), 799 + 797 800 GATE(0, "hclk_bus_niu", "hclk_bus_pre", CLK_IGNORE_UNUSED, PX30_CLKGATE_CON(13), 9, GFLAGS), 798 801 GATE(0, "hclk_rom", "hclk_bus_pre", CLK_IGNORE_UNUSED, PX30_CLKGATE_CON(13), 14, GFLAGS), 799 802 GATE(HCLK_PDM, "hclk_pdm", "hclk_bus_pre", 0, PX30_CLKGATE_CON(14), 1, GFLAGS), ··· 960 957 { 961 958 struct rockchip_clk_provider *ctx; 962 959 void __iomem *reg_base; 963 - struct clk *clk; 964 960 965 961 reg_base = of_iomap(np, 0); 966 962 if (!reg_base) { ··· 973 971 iounmap(reg_base); 974 972 return; 975 973 } 976 - 977 - /* aclk_dmac is controlled by sgrf_soc_con1[11]. */ 978 - clk = clk_register_fixed_factor(NULL, "aclk_dmac", "aclk_bus_pre", 0, 1, 1); 979 - if (IS_ERR(clk)) 980 - pr_warn("%s: could not register clock aclk_dmac: %ld\n", 981 - __func__, PTR_ERR(clk)); 982 - else 983 - rockchip_clk_add_lookup(ctx, clk, ACLK_DMAC); 984 974 985 975 rockchip_clk_register_plls(ctx, px30_pll_clks, 986 976 ARRAY_SIZE(px30_pll_clks),
+2 -1
drivers/clk/rockchip/clk-rk3228.c
··· 101 101 RK3228_CPUCLK_RATE(1608000000, 1, 7), 102 102 RK3228_CPUCLK_RATE(1512000000, 1, 7), 103 103 RK3228_CPUCLK_RATE(1488000000, 1, 5), 104 + RK3228_CPUCLK_RATE(1464000000, 1, 5), 104 105 RK3228_CPUCLK_RATE(1416000000, 1, 5), 105 106 RK3228_CPUCLK_RATE(1392000000, 1, 5), 106 107 RK3228_CPUCLK_RATE(1296000000, 1, 5), ··· 247 246 RK2928_CLKGATE_CON(4), 0, GFLAGS), 248 247 249 248 /* PD_MISC */ 250 - MUX(0, "hdmiphy", mux_hdmiphy_p, CLK_SET_RATE_PARENT, 249 + MUX(SCLK_HDMI_PHY, "hdmiphy", mux_hdmiphy_p, CLK_SET_RATE_PARENT, 251 250 RK2928_MISC_CON, 13, 1, MFLAGS), 252 251 MUX(0, "usb480m_phy", mux_usb480m_phy_p, CLK_SET_RATE_PARENT, 253 252 RK2928_MISC_CON, 14, 1, MFLAGS),
+3 -10
drivers/clk/rockchip/clk-rk3288.c
··· 113 113 RK3066_PLL_RATE( 160000000, 1, 80, 12), 114 114 RK3066_PLL_RATE( 157500000, 1, 105, 16), 115 115 RK3066_PLL_RATE( 126000000, 1, 84, 16), 116 - RK3066_PLL_RATE( 48000000, 1, 64, 32), 117 116 { /* sentinel */ }, 118 117 }; 119 118 ··· 766 767 GATE(PCLK_GRF, "pclk_grf", "pclk_pd_alive", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(14), 11, GFLAGS), 767 768 GATE(0, "pclk_alive_niu", "pclk_pd_alive", 0, RK3288_CLKGATE_CON(14), 12, GFLAGS), 768 769 770 + /* Watchdog pclk is controlled by RK3288_SGRF_SOC_CON0[1]. */ 771 + SGRF_GATE(PCLK_WDT, "pclk_wdt", "pclk_pd_alive"), 772 + 769 773 /* pclk_pd_pmu gates */ 770 774 GATE(PCLK_PMU, "pclk_pmu", "pclk_pd_pmu", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(17), 0, GFLAGS), 771 775 GATE(0, "pclk_intmem1", "pclk_pd_pmu", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(17), 1, GFLAGS), ··· 917 915 static void __init rk3288_clk_init(struct device_node *np) 918 916 { 919 917 struct rockchip_clk_provider *ctx; 920 - struct clk *clk; 921 918 922 919 rk3288_cru_base = of_iomap(np, 0); 923 920 if (!rk3288_cru_base) { ··· 930 929 iounmap(rk3288_cru_base); 931 930 return; 932 931 } 933 - 934 - /* Watchdog pclk is controlled by RK3288_SGRF_SOC_CON0[1]. */ 935 - clk = clk_register_fixed_factor(NULL, "pclk_wdt", "pclk_pd_alive", 0, 1, 1); 936 - if (IS_ERR(clk)) 937 - pr_warn("%s: could not register clock pclk_wdt: %ld\n", 938 - __func__, PTR_ERR(clk)); 939 - else 940 - rockchip_clk_add_lookup(ctx, clk, PCLK_WDT); 941 932 942 933 rockchip_clk_register_plls(ctx, rk3288_pll_clks, 943 934 ARRAY_SIZE(rk3288_pll_clks),
+3
drivers/clk/rockchip/clk-rk3328.c
··· 791 791 GATE(PCLK_SARADC, "pclk_saradc", "pclk_bus", 0, RK3328_CLKGATE_CON(17), 15, GFLAGS), 792 792 GATE(0, "pclk_pmu", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(28), 3, GFLAGS), 793 793 794 + /* Watchdog pclk is controlled from the secure GRF */ 795 + SGRF_GATE(PCLK_WDT, "pclk_wdt", "pclk_bus"), 796 + 794 797 GATE(PCLK_USB3PHY_OTG, "pclk_usb3phy_otg", "pclk_phy_pre", 0, RK3328_CLKGATE_CON(28), 1, GFLAGS), 795 798 GATE(PCLK_USB3PHY_PIPE, "pclk_usb3phy_pipe", "pclk_phy_pre", 0, RK3328_CLKGATE_CON(28), 2, GFLAGS), 796 799 GATE(PCLK_USB3_GRF, "pclk_usb3_grf", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 2, GFLAGS),
+3 -9
drivers/clk/rockchip/clk-rk3368.c
··· 811 811 GATE(PCLK_GPIO2, "pclk_gpio2", "pclk_pd_alive", 0, RK3368_CLKGATE_CON(22), 2, GFLAGS), 812 812 GATE(PCLK_GPIO1, "pclk_gpio1", "pclk_pd_alive", 0, RK3368_CLKGATE_CON(22), 1, GFLAGS), 813 813 814 + /* Watchdog pclk is controlled by sgrf_soc_con3[7]. */ 815 + SGRF_GATE(PCLK_WDT, "pclk_wdt", "pclk_pd_alive"), 816 + 814 817 /* 815 818 * pclk_vio gates 816 819 * pclk_vio comes from the exactly same source as hclk_vio ··· 865 862 { 866 863 struct rockchip_clk_provider *ctx; 867 864 void __iomem *reg_base; 868 - struct clk *clk; 869 865 870 866 reg_base = of_iomap(np, 0); 871 867 if (!reg_base) { ··· 878 876 iounmap(reg_base); 879 877 return; 880 878 } 881 - 882 - /* Watchdog pclk is controlled by sgrf_soc_con3[7]. */ 883 - clk = clk_register_fixed_factor(NULL, "pclk_wdt", "pclk_pd_alive", 0, 1, 1); 884 - if (IS_ERR(clk)) 885 - pr_warn("%s: could not register clock pclk_wdt: %ld\n", 886 - __func__, PTR_ERR(clk)); 887 - else 888 - rockchip_clk_add_lookup(ctx, clk, PCLK_WDT); 889 879 890 880 rockchip_clk_register_plls(ctx, rk3368_pll_clks, 891 881 ARRAY_SIZE(rk3368_pll_clks),
+3 -9
drivers/clk/rockchip/clk-rk3399.c
··· 1295 1295 GATE(PCLK_PMU_INTR_ARB, "pclk_pmu_intr_arb", "pclk_alive", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(31), 9, GFLAGS), 1296 1296 GATE(PCLK_SGRF, "pclk_sgrf", "pclk_alive", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(31), 10, GFLAGS), 1297 1297 1298 + /* Watchdog pclk is controlled by RK3399 SECURE_GRF_SOC_CON3[8]. */ 1299 + SGRF_GATE(PCLK_WDT, "pclk_wdt", "pclk_alive"), 1300 + 1298 1301 GATE(SCLK_MIPIDPHY_REF, "clk_mipidphy_ref", "xin24m", 0, RK3399_CLKGATE_CON(11), 14, GFLAGS), 1299 1302 GATE(SCLK_DPHY_PLL, "clk_dphy_pll", "clk_mipidphy_ref", CLK_IGNORE_UNUSED, RK3399_CLKGATE_CON(21), 0, GFLAGS), 1300 1303 ··· 1525 1522 { 1526 1523 struct rockchip_clk_provider *ctx; 1527 1524 void __iomem *reg_base; 1528 - struct clk *clk; 1529 1525 1530 1526 reg_base = of_iomap(np, 0); 1531 1527 if (!reg_base) { ··· 1538 1536 iounmap(reg_base); 1539 1537 return; 1540 1538 } 1541 - 1542 - /* Watchdog pclk is controlled by RK3399 SECURE_GRF_SOC_CON3[8]. */ 1543 - clk = clk_register_fixed_factor(NULL, "pclk_wdt", "pclk_alive", 0, 1, 1); 1544 - if (IS_ERR(clk)) 1545 - pr_warn("%s: could not register clock pclk_wdt: %ld\n", 1546 - __func__, PTR_ERR(clk)); 1547 - else 1548 - rockchip_clk_add_lookup(ctx, clk, PCLK_WDT); 1549 1539 1550 1540 rockchip_clk_register_plls(ctx, rk3399_pll_clks, 1551 1541 ARRAY_SIZE(rk3399_pll_clks), -1);
+4
drivers/clk/rockchip/clk.h
··· 811 811 .gate_offset = -1, \ 812 812 } 813 813 814 + /* SGRF clocks are only accessible from secure mode, so not controllable */ 815 + #define SGRF_GATE(_id, cname, pname) \ 816 + FACTOR(_id, cname, pname, 0, 1, 1) 817 + 814 818 struct rockchip_clk_provider *rockchip_clk_init(struct device_node *np, 815 819 void __iomem *base, unsigned long nr_clks); 816 820 void rockchip_clk_of_add_provider(struct device_node *np,
+1
drivers/clk/samsung/clk-exynos4.c
··· 958 958 959 959 /* list of gate clocks supported in exynos4x12 soc */ 960 960 static const struct samsung_gate_clock exynos4x12_gate_clks[] __initconst = { 961 + GATE(CLK_ASYNC_G3D, "async_g3d", "aclk200", GATE_IP_LEFTBUS, 6, 0, 0), 961 962 GATE(CLK_AUDSS, "audss", "sclk_epll", E4X12_GATE_IP_MAUDIO, 0, 0, 0), 962 963 GATE(CLK_MDNIE0, "mdnie0", "aclk160", GATE_IP_LCD0, 2, 0, 0), 963 964 GATE(CLK_ROTATOR, "rotator", "aclk200", E4X12_GATE_IP_IMAGE, 1, 0, 0),
+71 -7
drivers/clk/samsung/clk-exynos5420.c
··· 131 131 #define SRC_CDREX 0x20200 132 132 #define DIV_CDREX0 0x20500 133 133 #define DIV_CDREX1 0x20504 134 + #define GATE_BUS_CDREX0 0x20700 135 + #define GATE_BUS_CDREX1 0x20704 134 136 #define KPLL_LOCK 0x28000 135 137 #define KPLL_CON0 0x28100 136 138 #define SRC_KFC 0x28200 ··· 247 245 DIV_CDREX1, 248 246 SRC_KFC, 249 247 DIV_KFC0, 248 + GATE_BUS_CDREX0, 249 + GATE_BUS_CDREX1, 250 250 }; 251 251 252 252 static const unsigned long exynos5800_clk_regs[] __initconst = { ··· 426 422 PNAME(mout_group14_5800_p) = { "dout_aclk550_cam", "dout_sclk_sw" }; 427 423 PNAME(mout_group15_5800_p) = { "dout_osc_div", "mout_sw_aclk550_cam" }; 428 424 PNAME(mout_group16_5800_p) = { "dout_osc_div", "mout_mau_epll_clk" }; 425 + PNAME(mout_mx_mspll_ccore_phy_p) = { "sclk_bpll", "mout_sclk_dpll", 426 + "mout_sclk_mpll", "ff_dout_spll2", 427 + "mout_sclk_spll", "mout_sclk_epll"}; 429 428 430 429 /* fixed rate clocks generated outside the soc */ 431 430 static struct samsung_fixed_rate_clock ··· 454 447 static const struct samsung_fixed_factor_clock 455 448 exynos5800_fixed_factor_clks[] __initconst = { 456 449 FFACTOR(0, "ff_dout_epll2", "mout_sclk_epll", 1, 2, 0), 457 - FFACTOR(0, "ff_dout_spll2", "mout_sclk_spll", 1, 2, 0), 450 + FFACTOR(CLK_FF_DOUT_SPLL2, "ff_dout_spll2", "mout_sclk_spll", 1, 2, 0), 458 451 }; 459 452 460 453 static const struct samsung_mux_clock exynos5800_mux_clks[] __initconst = { ··· 476 469 MUX(0, "mout_aclk300_disp1", mout_group5_5800_p, SRC_TOP2, 24, 2), 477 470 MUX(0, "mout_aclk300_gscl", mout_group5_5800_p, SRC_TOP2, 28, 2), 478 471 472 + MUX(CLK_MOUT_MX_MSPLL_CCORE_PHY, "mout_mx_mspll_ccore_phy", 473 + mout_mx_mspll_ccore_phy_p, SRC_TOP7, 0, 3), 474 + 479 475 MUX(CLK_MOUT_MX_MSPLL_CCORE, "mout_mx_mspll_ccore", 480 - mout_mx_mspll_ccore_p, SRC_TOP7, 16, 2), 476 + mout_mx_mspll_ccore_p, SRC_TOP7, 16, 3), 481 477 MUX_F(CLK_MOUT_MAU_EPLL, "mout_mau_epll_clk", mout_mau_epll_clk_5800_p, 482 478 SRC_TOP7, 20, 2, CLK_SET_RATE_PARENT, 0), 483 - MUX(0, "sclk_bpll", mout_bpll_p, SRC_TOP7, 24, 1), 479 + MUX(CLK_SCLK_BPLL, "sclk_bpll", mout_bpll_p, SRC_TOP7, 24, 1), 484 480 MUX(0, "mout_epll2", mout_epll2_5800_p, SRC_TOP7, 28, 1), 485 481 486 482 MUX(0, "mout_aclk550_cam", mout_group3_5800_p, SRC_TOP8, 16, 3), ··· 655 645 656 646 MUX(0, "mout_sclk_mpll", mout_mpll_p, SRC_TOP6, 0, 1), 657 647 MUX(CLK_MOUT_VPLL, "mout_sclk_vpll", mout_vpll_p, SRC_TOP6, 4, 1), 658 - MUX(0, "mout_sclk_spll", mout_spll_p, SRC_TOP6, 8, 1), 648 + MUX(CLK_MOUT_SCLK_SPLL, "mout_sclk_spll", mout_spll_p, SRC_TOP6, 8, 1), 659 649 MUX(0, "mout_sclk_ipll", mout_ipll_p, SRC_TOP6, 12, 1), 660 650 MUX(0, "mout_sclk_rpll", mout_rpll_p, SRC_TOP6, 16, 1), 661 651 MUX_F(CLK_MOUT_EPLL, "mout_sclk_epll", mout_epll_p, SRC_TOP6, 20, 1, ··· 813 803 "mout_aclk400_disp1", DIV_TOP2, 4, 3), 814 804 815 805 /* CDREX Block */ 816 - DIV(CLK_DOUT_PCLK_CDREX, "dout_pclk_cdrex", "dout_aclk_cdrex1", 817 - DIV_CDREX0, 28, 3), 806 + /* 807 + * The three clocks below are controlled using the same register and 808 + * bits. They are put into one because there is a need of 809 + * synchronization between the BUS and DREXs (two external memory 810 + * interfaces). 811 + * They are put here to show this HW assumption and for clock 812 + * information summary completeness. 813 + */ 814 + DIV_F(CLK_DOUT_PCLK_CDREX, "dout_pclk_cdrex", "dout_aclk_cdrex1", 815 + DIV_CDREX0, 28, 3, CLK_GET_RATE_NOCACHE, 0), 816 + DIV_F(CLK_DOUT_PCLK_DREX0, "dout_pclk_drex0", "dout_cclk_drex0", 817 + DIV_CDREX0, 28, 3, CLK_GET_RATE_NOCACHE, 0), 818 + DIV_F(CLK_DOUT_PCLK_DREX1, "dout_pclk_drex1", "dout_cclk_drex0", 819 + DIV_CDREX0, 28, 3, CLK_GET_RATE_NOCACHE, 0), 820 + 818 821 DIV_F(CLK_DOUT_SCLK_CDREX, "dout_sclk_cdrex", "mout_mclk_cdrex", 819 822 DIV_CDREX0, 24, 3, CLK_SET_RATE_PARENT, 0), 820 823 DIV(CLK_DOUT_ACLK_CDREX1, "dout_aclk_cdrex1", "dout_clk2x_phy0", ··· 1190 1167 GATE_TOP_SCLK_ISP, 12, CLK_SET_RATE_PARENT, 0), 1191 1168 1192 1169 GATE(CLK_G3D, "g3d", "mout_user_aclk_g3d", GATE_IP_G3D, 9, 0, 0), 1170 + 1171 + /* CDREX */ 1172 + GATE(CLK_CLKM_PHY0, "clkm_phy0", "dout_sclk_cdrex", 1173 + GATE_BUS_CDREX0, 0, 0, 0), 1174 + GATE(CLK_CLKM_PHY1, "clkm_phy1", "dout_sclk_cdrex", 1175 + GATE_BUS_CDREX0, 1, 0, 0), 1176 + GATE(0, "mx_mspll_ccore_phy", "mout_mx_mspll_ccore_phy", 1177 + SRC_MASK_TOP7, 0, CLK_IGNORE_UNUSED, 0), 1178 + 1179 + GATE(CLK_ACLK_PPMU_DREX1_1, "aclk_ppmu_drex1_1", "dout_aclk_cdrex1", 1180 + GATE_BUS_CDREX1, 12, CLK_IGNORE_UNUSED, 0), 1181 + GATE(CLK_ACLK_PPMU_DREX1_0, "aclk_ppmu_drex1_0", "dout_aclk_cdrex1", 1182 + GATE_BUS_CDREX1, 13, CLK_IGNORE_UNUSED, 0), 1183 + GATE(CLK_ACLK_PPMU_DREX0_1, "aclk_ppmu_drex0_1", "dout_aclk_cdrex1", 1184 + GATE_BUS_CDREX1, 14, CLK_IGNORE_UNUSED, 0), 1185 + GATE(CLK_ACLK_PPMU_DREX0_0, "aclk_ppmu_drex0_0", "dout_aclk_cdrex1", 1186 + GATE_BUS_CDREX1, 15, CLK_IGNORE_UNUSED, 0), 1187 + 1188 + GATE(CLK_PCLK_PPMU_DREX1_1, "pclk_ppmu_drex1_1", "dout_pclk_cdrex", 1189 + GATE_BUS_CDREX1, 26, CLK_IGNORE_UNUSED, 0), 1190 + GATE(CLK_PCLK_PPMU_DREX1_0, "pclk_ppmu_drex1_0", "dout_pclk_cdrex", 1191 + GATE_BUS_CDREX1, 27, CLK_IGNORE_UNUSED, 0), 1192 + GATE(CLK_PCLK_PPMU_DREX0_1, "pclk_ppmu_drex0_1", "dout_pclk_cdrex", 1193 + GATE_BUS_CDREX1, 28, CLK_IGNORE_UNUSED, 0), 1194 + GATE(CLK_PCLK_PPMU_DREX0_0, "pclk_ppmu_drex0_0", "dout_pclk_cdrex", 1195 + GATE_BUS_CDREX1, 29, CLK_IGNORE_UNUSED, 0), 1193 1196 }; 1194 1197 1195 1198 static const struct samsung_div_clock exynos5x_disp_div_clks[] __initconst = { ··· 1329 1280 PLL_35XX_RATE(24 * MHZ, 400000000, 200, 3, 2), 1330 1281 PLL_35XX_RATE(24 * MHZ, 300000000, 200, 2, 3), 1331 1282 PLL_35XX_RATE(24 * MHZ, 200000000, 200, 3, 3), 1283 + }; 1284 + 1285 + static const struct samsung_pll_rate_table exynos5422_bpll_rate_table[] = { 1286 + PLL_35XX_RATE(24 * MHZ, 825000000, 275, 4, 1), 1287 + PLL_35XX_RATE(24 * MHZ, 728000000, 182, 3, 1), 1288 + PLL_35XX_RATE(24 * MHZ, 633000000, 211, 4, 1), 1289 + PLL_35XX_RATE(24 * MHZ, 543000000, 181, 2, 2), 1290 + PLL_35XX_RATE(24 * MHZ, 413000000, 413, 6, 2), 1291 + PLL_35XX_RATE(24 * MHZ, 275000000, 275, 3, 3), 1292 + PLL_35XX_RATE(24 * MHZ, 206000000, 206, 3, 3), 1293 + PLL_35XX_RATE(24 * MHZ, 165000000, 110, 2, 3), 1332 1294 }; 1333 1295 1334 1296 static const struct samsung_pll_rate_table exynos5420_epll_24mhz_tbl[] = { ··· 1484 1424 exynos5x_plls[apll].rate_table = exynos5420_pll2550x_24mhz_tbl; 1485 1425 exynos5x_plls[epll].rate_table = exynos5420_epll_24mhz_tbl; 1486 1426 exynos5x_plls[kpll].rate_table = exynos5420_pll2550x_24mhz_tbl; 1487 - exynos5x_plls[bpll].rate_table = exynos5420_pll2550x_24mhz_tbl; 1488 1427 } 1428 + 1429 + if (soc == EXYNOS5420) 1430 + exynos5x_plls[bpll].rate_table = exynos5420_pll2550x_24mhz_tbl; 1431 + else 1432 + exynos5x_plls[bpll].rate_table = exynos5422_bpll_rate_table; 1489 1433 1490 1434 samsung_clk_register_pll(ctx, exynos5x_plls, ARRAY_SIZE(exynos5x_plls), 1491 1435 reg_base);
+2 -2
drivers/clk/samsung/clk-exynos5433.c
··· 5587 5587 data->nr_clk_save = info->nr_clk_regs; 5588 5588 data->clk_suspend = info->suspend_regs; 5589 5589 data->nr_clk_suspend = info->nr_suspend_regs; 5590 - data->nr_pclks = of_count_phandle_with_args(dev->of_node, "clocks", 5591 - "#clock-cells"); 5590 + data->nr_pclks = of_clk_get_parent_count(dev->of_node); 5591 + 5592 5592 if (data->nr_pclks > 0) { 5593 5593 data->pclks = devm_kcalloc(dev, sizeof(struct clk *), 5594 5594 data->nr_pclks, GFP_KERNEL);
+5 -1
drivers/clk/socfpga/clk-s10.c
··· 161 161 8, 0, 0, 0, 0, 0, 0}, 162 162 { STRATIX10_SPI_M_CLK, "spi_m_clk", "l4_mp_clk", NULL, 1, 0, 0xA4, 163 163 9, 0, 0, 0, 0, 0, 0}, 164 - { STRATIX10_NAND_CLK, "nand_clk", "l4_main_clk", NULL, 1, 0, 0xA4, 164 + { STRATIX10_NAND_X_CLK, "nand_x_clk", "l4_mp_clk", NULL, 1, 0, 0xA4, 165 165 10, 0, 0, 0, 0, 0, 0}, 166 + { STRATIX10_NAND_CLK, "nand_clk", "nand_x_clk", NULL, 1, 0, 0xA4, 167 + 10, 0, 0, 0, 0, 0, 4}, 168 + { STRATIX10_NAND_ECC_CLK, "nand_ecc_clk", "nand_x_clk", NULL, 1, 0, 0xA4, 169 + 10, 0, 0, 0, 0, 0, 4}, 166 170 }; 167 171 168 172 static int s10_clk_register_c_perip(const struct stratix10_perip_c_clock *clks,
+7 -2
drivers/clk/sprd/common.c
··· 42 42 void __iomem *base; 43 43 struct device_node *node = pdev->dev.of_node; 44 44 struct regmap *regmap; 45 + struct resource *res; 45 46 46 47 if (of_find_property(node, "sprd,syscon", NULL)) { 47 48 regmap = syscon_regmap_lookup_by_phandle(node, "sprd,syscon"); ··· 51 50 return PTR_ERR(regmap); 52 51 } 53 52 } else { 54 - base = of_iomap(node, 0); 53 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 54 + base = devm_ioremap_resource(&pdev->dev, res); 55 + if (IS_ERR(base)) 56 + return PTR_ERR(base); 57 + 55 58 regmap = devm_regmap_init_mmio(&pdev->dev, base, 56 59 &sprdclk_regmap_config); 57 - if (IS_ERR_OR_NULL(regmap)) { 60 + if (IS_ERR(regmap)) { 58 61 pr_err("failed to init regmap\n"); 59 62 return PTR_ERR(regmap); 60 63 }
+4 -1
drivers/clk/sprd/sc9860-clk.c
··· 2023 2023 { 2024 2024 const struct of_device_id *match; 2025 2025 const struct sprd_clk_desc *desc; 2026 + int ret; 2026 2027 2027 2028 match = of_match_node(sprd_sc9860_clk_ids, pdev->dev.of_node); 2028 2029 if (!match) { ··· 2032 2031 } 2033 2032 2034 2033 desc = match->data; 2035 - sprd_clk_regmap_init(pdev, desc); 2034 + ret = sprd_clk_regmap_init(pdev, desc); 2035 + if (ret) 2036 + return ret; 2036 2037 2037 2038 return sprd_clk_probe(&pdev->dev, desc->hw_clks); 2038 2039 }
+25 -14
drivers/clk/sunxi-ng/ccu-sun4i-a10.c
··· 160 160 }, 161 161 }; 162 162 163 - static CLK_FIXED_FACTOR(pll_periph_clk, "pll-periph", "pll-periph-base", 164 - 2, 1, CLK_SET_RATE_PARENT); 163 + static CLK_FIXED_FACTOR_HW(pll_periph_clk, "pll-periph", 164 + &pll_periph_base_clk.common.hw, 165 + 2, 1, CLK_SET_RATE_PARENT); 165 166 166 167 /* Not documented on A10 */ 167 168 static struct ccu_div pll_periph_sata_clk = { ··· 1029 1028 &out_b_clk.common 1030 1029 }; 1031 1030 1031 + static const struct clk_hw *clk_parent_pll_audio[] = { 1032 + &pll_audio_base_clk.common.hw 1033 + }; 1034 + 1032 1035 /* Post-divider for pll-audio is hardcoded to 1 */ 1033 - static CLK_FIXED_FACTOR(pll_audio_clk, "pll-audio", 1034 - "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT); 1035 - static CLK_FIXED_FACTOR(pll_audio_2x_clk, "pll-audio-2x", 1036 - "pll-audio-base", 2, 1, CLK_SET_RATE_PARENT); 1037 - static CLK_FIXED_FACTOR(pll_audio_4x_clk, "pll-audio-4x", 1038 - "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT); 1039 - static CLK_FIXED_FACTOR(pll_audio_8x_clk, "pll-audio-8x", 1040 - "pll-audio-base", 1, 2, CLK_SET_RATE_PARENT); 1041 - static CLK_FIXED_FACTOR(pll_video0_2x_clk, "pll-video0-2x", 1042 - "pll-video0", 1, 2, CLK_SET_RATE_PARENT); 1043 - static CLK_FIXED_FACTOR(pll_video1_2x_clk, "pll-video1-2x", 1044 - "pll-video1", 1, 2, CLK_SET_RATE_PARENT); 1036 + static CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", 1037 + clk_parent_pll_audio, 1038 + 1, 1, CLK_SET_RATE_PARENT); 1039 + static CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", 1040 + clk_parent_pll_audio, 1041 + 2, 1, CLK_SET_RATE_PARENT); 1042 + static CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x", 1043 + clk_parent_pll_audio, 1044 + 1, 1, CLK_SET_RATE_PARENT); 1045 + static CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x", 1046 + clk_parent_pll_audio, 1047 + 1, 2, CLK_SET_RATE_PARENT); 1048 + static CLK_FIXED_FACTOR_HW(pll_video0_2x_clk, "pll-video0-2x", 1049 + &pll_video0_clk.common.hw, 1050 + 1, 2, CLK_SET_RATE_PARENT); 1051 + static CLK_FIXED_FACTOR_HW(pll_video1_2x_clk, "pll-video1-2x", 1052 + &pll_video1_clk.common.hw, 1053 + 1, 2, CLK_SET_RATE_PARENT); 1045 1054 1046 1055 1047 1056 static struct clk_hw_onecell_data sun4i_a10_hw_clks = {
+26 -15
drivers/clk/sunxi-ng/ccu-sun50i-a64.c
··· 597 597 0x1a0, 0, 3, BIT(31), CLK_SET_RATE_PARENT); 598 598 599 599 /* Fixed Factor clocks */ 600 - static CLK_FIXED_FACTOR(osc12M_clk, "osc12M", "osc24M", 2, 1, 0); 600 + static CLK_FIXED_FACTOR_FW_NAME(osc12M_clk, "osc12M", "hosc", 2, 1, 0); 601 + 602 + static const struct clk_hw *clk_parent_pll_audio[] = { 603 + &pll_audio_base_clk.common.hw 604 + }; 601 605 602 606 /* We hardcode the divider to 1 for now */ 603 - static CLK_FIXED_FACTOR(pll_audio_clk, "pll-audio", 604 - "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT); 605 - static CLK_FIXED_FACTOR(pll_audio_2x_clk, "pll-audio-2x", 606 - "pll-audio-base", 2, 1, CLK_SET_RATE_PARENT); 607 - static CLK_FIXED_FACTOR(pll_audio_4x_clk, "pll-audio-4x", 608 - "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT); 609 - static CLK_FIXED_FACTOR(pll_audio_8x_clk, "pll-audio-8x", 610 - "pll-audio-base", 1, 2, CLK_SET_RATE_PARENT); 611 - static CLK_FIXED_FACTOR(pll_periph0_2x_clk, "pll-periph0-2x", 612 - "pll-periph0", 1, 2, 0); 613 - static CLK_FIXED_FACTOR(pll_periph1_2x_clk, "pll-periph1-2x", 614 - "pll-periph1", 1, 2, 0); 615 - static CLK_FIXED_FACTOR(pll_video0_2x_clk, "pll-video0-2x", 616 - "pll-video0", 1, 2, CLK_SET_RATE_PARENT); 607 + static CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", 608 + clk_parent_pll_audio, 609 + 1, 1, CLK_SET_RATE_PARENT); 610 + static CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", 611 + clk_parent_pll_audio, 612 + 2, 1, CLK_SET_RATE_PARENT); 613 + static CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x", 614 + clk_parent_pll_audio, 615 + 1, 1, CLK_SET_RATE_PARENT); 616 + static CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x", 617 + clk_parent_pll_audio, 618 + 1, 2, CLK_SET_RATE_PARENT); 619 + static CLK_FIXED_FACTOR_HW(pll_periph0_2x_clk, "pll-periph0-2x", 620 + &pll_periph0_clk.common.hw, 621 + 1, 2, 0); 622 + static CLK_FIXED_FACTOR_HW(pll_periph1_2x_clk, "pll-periph1-2x", 623 + &pll_periph1_clk.common.hw, 624 + 1, 2, 0); 625 + static CLK_FIXED_FACTOR_HW(pll_video0_2x_clk, "pll-video0-2x", 626 + &pll_video0_clk.common.hw, 627 + 1, 2, CLK_SET_RATE_PARENT); 617 628 618 629 static struct ccu_common *sun50i_a64_ccu_clks[] = { 619 630 &pll_cpux_clk.common,
+2 -2
drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c
··· 49 49 }, 50 50 }; 51 51 52 - static CLK_FIXED_FACTOR(r_ahb_clk, "r-ahb", "ar100", 1, 1, 0); 52 + static CLK_FIXED_FACTOR_HW(r_ahb_clk, "r-ahb", &ar100_clk.common.hw, 1, 1, 0); 53 53 54 54 static struct ccu_div r_apb1_clk = { 55 55 .div = _SUNXI_CCU_DIV(0, 2), ··· 104 104 static SUNXI_CCU_GATE(r_apb1_ir_clk, "r-apb1-ir", "r-apb1", 105 105 0x1cc, BIT(0), 0); 106 106 static SUNXI_CCU_GATE(r_apb1_w1_clk, "r-apb1-w1", "r-apb1", 107 - 0x1cc, BIT(0), 0); 107 + 0x1ec, BIT(0), 0); 108 108 109 109 /* Information of IR(RX) mod clock is gathered from BSP source code */ 110 110 static const char * const r_mod0_default_parents[] = { "osc32k", "osc24M" };
+41 -22
drivers/clk/sunxi-ng/ccu-sun50i-h6.c
··· 622 622 static SUNXI_CCU_GATE(bus_ehci3_clk, "bus-ehci3", "ahb3", 0xa8c, BIT(7), 0); 623 623 static SUNXI_CCU_GATE(bus_otg_clk, "bus-otg", "ahb3", 0xa8c, BIT(8), 0); 624 624 625 - static CLK_FIXED_FACTOR(pcie_ref_100m_clk, "pcie-ref-100M", 626 - "pll-periph0-4x", 24, 1, 0); 625 + static struct clk_fixed_factor pll_periph0_4x_clk; 626 + static CLK_FIXED_FACTOR_HW(pcie_ref_100m_clk, "pcie-ref-100M", 627 + &pll_periph0_4x_clk.hw, 24, 1, 0); 627 628 static SUNXI_CCU_GATE(pcie_ref_clk, "pcie-ref", "pcie-ref-100M", 628 629 0xab0, BIT(31), 0); 629 630 static SUNXI_CCU_GATE(pcie_ref_out_clk, "pcie-ref-out", "pcie-ref", ··· 746 745 static SUNXI_CCU_GATE(bus_hdcp_clk, "bus-hdcp", "ahb3", 0xc4c, BIT(0), 0); 747 746 748 747 /* Fixed factor clocks */ 749 - static CLK_FIXED_FACTOR(osc12M_clk, "osc12M", "osc24M", 2, 1, 0); 748 + static CLK_FIXED_FACTOR_FW_NAME(osc12M_clk, "osc12M", "hosc", 2, 1, 0); 749 + 750 + static const struct clk_hw *clk_parent_pll_audio[] = { 751 + &pll_audio_base_clk.common.hw 752 + }; 750 753 751 754 /* 752 755 * The divider of pll-audio is fixed to 8 now, as pll-audio-4x has a 753 756 * fixed post-divider 2. 754 757 */ 755 - static CLK_FIXED_FACTOR(pll_audio_clk, "pll-audio", 756 - "pll-audio-base", 8, 1, CLK_SET_RATE_PARENT); 757 - static CLK_FIXED_FACTOR(pll_audio_2x_clk, "pll-audio-2x", 758 - "pll-audio-base", 4, 1, CLK_SET_RATE_PARENT); 759 - static CLK_FIXED_FACTOR(pll_audio_4x_clk, "pll-audio-4x", 760 - "pll-audio-base", 2, 1, CLK_SET_RATE_PARENT); 758 + static CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", 759 + clk_parent_pll_audio, 760 + 8, 1, CLK_SET_RATE_PARENT); 761 + static CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", 762 + clk_parent_pll_audio, 763 + 4, 1, CLK_SET_RATE_PARENT); 764 + static CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x", 765 + clk_parent_pll_audio, 766 + 2, 1, CLK_SET_RATE_PARENT); 761 767 762 - static CLK_FIXED_FACTOR(pll_periph0_4x_clk, "pll-periph0-4x", 763 - "pll-periph0", 1, 4, 0); 764 - static CLK_FIXED_FACTOR(pll_periph0_2x_clk, "pll-periph0-2x", 765 - "pll-periph0", 1, 2, 0); 768 + static const struct clk_hw *pll_periph0_parents[] = { 769 + &pll_periph0_clk.common.hw 770 + }; 771 + static CLK_FIXED_FACTOR_HWS(pll_periph0_4x_clk, "pll-periph0-4x", 772 + pll_periph0_parents, 773 + 1, 4, 0); 774 + static CLK_FIXED_FACTOR_HWS(pll_periph0_2x_clk, "pll-periph0-2x", 775 + pll_periph0_parents, 776 + 1, 2, 0); 766 777 767 - static CLK_FIXED_FACTOR(pll_periph1_4x_clk, "pll-periph1-4x", 768 - "pll-periph1", 1, 4, 0); 769 - static CLK_FIXED_FACTOR(pll_periph1_2x_clk, "pll-periph1-2x", 770 - "pll-periph1", 1, 2, 0); 778 + static const struct clk_hw *pll_periph1_parents[] = { 779 + &pll_periph1_clk.common.hw 780 + }; 781 + static CLK_FIXED_FACTOR_HWS(pll_periph1_4x_clk, "pll-periph1-4x", 782 + pll_periph1_parents, 783 + 1, 4, 0); 784 + static CLK_FIXED_FACTOR_HWS(pll_periph1_2x_clk, "pll-periph1-2x", 785 + pll_periph1_parents, 786 + 1, 2, 0); 771 787 772 - static CLK_FIXED_FACTOR(pll_video0_4x_clk, "pll-video0-4x", 773 - "pll-video0", 1, 4, CLK_SET_RATE_PARENT); 774 - 775 - static CLK_FIXED_FACTOR(pll_video1_4x_clk, "pll-video1-4x", 776 - "pll-video1", 1, 4, CLK_SET_RATE_PARENT); 788 + static CLK_FIXED_FACTOR_HW(pll_video0_4x_clk, "pll-video0-4x", 789 + &pll_video0_clk.common.hw, 790 + 1, 4, CLK_SET_RATE_PARENT); 791 + static CLK_FIXED_FACTOR_HW(pll_video1_4x_clk, "pll-video1-4x", 792 + &pll_video1_clk.common.hw, 793 + 1, 4, CLK_SET_RATE_PARENT); 777 794 778 795 static struct ccu_common *sun50i_h6_ccu_clks[] = { 779 796 &pll_cpux_clk.common,
+22 -12
drivers/clk/sunxi-ng/ccu-sun5i.c
··· 603 603 &iep_clk.common, 604 604 }; 605 605 606 + static const struct clk_hw *clk_parent_pll_audio[] = { 607 + &pll_audio_base_clk.common.hw 608 + }; 609 + 606 610 /* We hardcode the divider to 1 for now */ 607 - static CLK_FIXED_FACTOR(pll_audio_clk, "pll-audio", 608 - "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT); 609 - static CLK_FIXED_FACTOR(pll_audio_2x_clk, "pll-audio-2x", 610 - "pll-audio-base", 2, 1, CLK_SET_RATE_PARENT); 611 - static CLK_FIXED_FACTOR(pll_audio_4x_clk, "pll-audio-4x", 612 - "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT); 613 - static CLK_FIXED_FACTOR(pll_audio_8x_clk, "pll-audio-8x", 614 - "pll-audio-base", 1, 2, CLK_SET_RATE_PARENT); 615 - static CLK_FIXED_FACTOR(pll_video0_2x_clk, "pll-video0-2x", 616 - "pll-video0", 1, 2, CLK_SET_RATE_PARENT); 617 - static CLK_FIXED_FACTOR(pll_video1_2x_clk, "pll-video1-2x", 618 - "pll-video1", 1, 2, CLK_SET_RATE_PARENT); 611 + static CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", 612 + clk_parent_pll_audio, 613 + 1, 1, CLK_SET_RATE_PARENT); 614 + static CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", 615 + clk_parent_pll_audio, 616 + 2, 1, CLK_SET_RATE_PARENT); 617 + static CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x", 618 + clk_parent_pll_audio, 619 + 1, 1, CLK_SET_RATE_PARENT); 620 + static CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x", 621 + clk_parent_pll_audio, 622 + 1, 2, CLK_SET_RATE_PARENT); 623 + static CLK_FIXED_FACTOR_HW(pll_video0_2x_clk, "pll-video0-2x", 624 + &pll_video0_clk.common.hw, 625 + 1, 2, CLK_SET_RATE_PARENT); 626 + static CLK_FIXED_FACTOR_HW(pll_video1_2x_clk, "pll-video1-2x", 627 + &pll_video1_clk.common.hw, 628 + 1, 2, CLK_SET_RATE_PARENT); 619 629 620 630 static struct clk_hw_onecell_data sun5i_a10s_hw_clks = { 621 631 .hws = {
+25 -14
drivers/clk/sunxi-ng/ccu-sun6i-a31.c
··· 955 955 &out_c_clk.common, 956 956 }; 957 957 958 + static const struct clk_hw *clk_parent_pll_audio[] = { 959 + &pll_audio_base_clk.common.hw 960 + }; 961 + 958 962 /* We hardcode the divider to 1 for now */ 959 - static CLK_FIXED_FACTOR(pll_audio_clk, "pll-audio", 960 - "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT); 961 - static CLK_FIXED_FACTOR(pll_audio_2x_clk, "pll-audio-2x", 962 - "pll-audio-base", 2, 1, CLK_SET_RATE_PARENT); 963 - static CLK_FIXED_FACTOR(pll_audio_4x_clk, "pll-audio-4x", 964 - "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT); 965 - static CLK_FIXED_FACTOR(pll_audio_8x_clk, "pll-audio-8x", 966 - "pll-audio-base", 1, 2, CLK_SET_RATE_PARENT); 967 - static CLK_FIXED_FACTOR(pll_periph_2x_clk, "pll-periph-2x", 968 - "pll-periph", 1, 2, 0); 969 - static CLK_FIXED_FACTOR(pll_video0_2x_clk, "pll-video0-2x", 970 - "pll-video0", 1, 2, CLK_SET_RATE_PARENT); 971 - static CLK_FIXED_FACTOR(pll_video1_2x_clk, "pll-video1-2x", 972 - "pll-video1", 1, 2, CLK_SET_RATE_PARENT); 963 + static CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", 964 + clk_parent_pll_audio, 965 + 1, 1, CLK_SET_RATE_PARENT); 966 + static CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", 967 + clk_parent_pll_audio, 968 + 2, 1, CLK_SET_RATE_PARENT); 969 + static CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x", 970 + clk_parent_pll_audio, 971 + 1, 1, CLK_SET_RATE_PARENT); 972 + static CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x", 973 + clk_parent_pll_audio, 974 + 1, 2, CLK_SET_RATE_PARENT); 975 + static CLK_FIXED_FACTOR_HW(pll_periph_2x_clk, "pll-periph-2x", 976 + &pll_periph_clk.common.hw, 977 + 1, 2, 0); 978 + static CLK_FIXED_FACTOR_HW(pll_video0_2x_clk, "pll-video0-2x", 979 + &pll_video0_clk.common.hw, 980 + 1, 2, CLK_SET_RATE_PARENT); 981 + static CLK_FIXED_FACTOR_HW(pll_video1_2x_clk, "pll-video1-2x", 982 + &pll_video1_clk.common.hw, 983 + 1, 2, CLK_SET_RATE_PARENT); 973 984 974 985 static struct clk_hw_onecell_data sun6i_a31_hw_clks = { 975 986 .hws = {
+22 -12
drivers/clk/sunxi-ng/ccu-sun8i-a23.c
··· 543 543 &ats_clk.common, 544 544 }; 545 545 546 + static const struct clk_hw *clk_parent_pll_audio[] = { 547 + &pll_audio_base_clk.common.hw 548 + }; 549 + 546 550 /* We hardcode the divider to 1 for now */ 547 - static CLK_FIXED_FACTOR(pll_audio_clk, "pll-audio", 548 - "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT); 549 - static CLK_FIXED_FACTOR(pll_audio_2x_clk, "pll-audio-2x", 550 - "pll-audio-base", 2, 1, CLK_SET_RATE_PARENT); 551 - static CLK_FIXED_FACTOR(pll_audio_4x_clk, "pll-audio-4x", 552 - "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT); 553 - static CLK_FIXED_FACTOR(pll_audio_8x_clk, "pll-audio-8x", 554 - "pll-audio-base", 1, 2, CLK_SET_RATE_PARENT); 555 - static CLK_FIXED_FACTOR(pll_periph_2x_clk, "pll-periph-2x", 556 - "pll-periph", 1, 2, 0); 557 - static CLK_FIXED_FACTOR(pll_video_2x_clk, "pll-video-2x", 558 - "pll-video", 1, 2, 0); 551 + static CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", 552 + clk_parent_pll_audio, 553 + 1, 1, CLK_SET_RATE_PARENT); 554 + static CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", 555 + clk_parent_pll_audio, 556 + 2, 1, CLK_SET_RATE_PARENT); 557 + static CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x", 558 + clk_parent_pll_audio, 559 + 1, 1, CLK_SET_RATE_PARENT); 560 + static CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x", 561 + clk_parent_pll_audio, 562 + 1, 2, CLK_SET_RATE_PARENT); 563 + static CLK_FIXED_FACTOR_HW(pll_periph_2x_clk, "pll-periph-2x", 564 + &pll_periph_clk.common.hw, 565 + 1, 2, 0); 566 + static CLK_FIXED_FACTOR_HW(pll_video_2x_clk, "pll-video-2x", 567 + &pll_video_clk.common.hw, 568 + 1, 2, 0); 559 569 560 570 static struct clk_hw_onecell_data sun8i_a23_hw_clks = { 561 571 .hws = {
+22 -12
drivers/clk/sunxi-ng/ccu-sun8i-a33.c
··· 580 580 &ats_clk.common, 581 581 }; 582 582 583 + static const struct clk_hw *clk_parent_pll_audio[] = { 584 + &pll_audio_base_clk.common.hw 585 + }; 586 + 583 587 /* We hardcode the divider to 1 for now */ 584 - static CLK_FIXED_FACTOR(pll_audio_clk, "pll-audio", 585 - "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT); 586 - static CLK_FIXED_FACTOR(pll_audio_2x_clk, "pll-audio-2x", 587 - "pll-audio-base", 2, 1, CLK_SET_RATE_PARENT); 588 - static CLK_FIXED_FACTOR(pll_audio_4x_clk, "pll-audio-4x", 589 - "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT); 590 - static CLK_FIXED_FACTOR(pll_audio_8x_clk, "pll-audio-8x", 591 - "pll-audio-base", 1, 2, CLK_SET_RATE_PARENT); 592 - static CLK_FIXED_FACTOR(pll_periph_2x_clk, "pll-periph-2x", 593 - "pll-periph", 1, 2, 0); 594 - static CLK_FIXED_FACTOR(pll_video_2x_clk, "pll-video-2x", 595 - "pll-video", 1, 2, 0); 588 + static CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", 589 + clk_parent_pll_audio, 590 + 1, 1, CLK_SET_RATE_PARENT); 591 + static CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", 592 + clk_parent_pll_audio, 593 + 2, 1, CLK_SET_RATE_PARENT); 594 + static CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x", 595 + clk_parent_pll_audio, 596 + 1, 1, CLK_SET_RATE_PARENT); 597 + static CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x", 598 + clk_parent_pll_audio, 599 + 1, 2, CLK_SET_RATE_PARENT); 600 + static CLK_FIXED_FACTOR_HW(pll_periph_2x_clk, "pll-periph-2x", 601 + &pll_periph_clk.common.hw, 602 + 1, 2, 0); 603 + static CLK_FIXED_FACTOR_HW(pll_video_2x_clk, "pll-video-2x", 604 + &pll_video_clk.common.hw, 605 + 1, 2, 0); 596 606 597 607 static struct clk_hw_onecell_data sun8i_a33_hw_clks = { 598 608 .hws = {
+19 -10
drivers/clk/sunxi-ng/ccu-sun8i-h3.c
··· 717 717 &gpu_clk.common, 718 718 }; 719 719 720 + static const struct clk_hw *clk_parent_pll_audio[] = { 721 + &pll_audio_base_clk.common.hw 722 + }; 723 + 720 724 /* We hardcode the divider to 1 for now */ 721 - static CLK_FIXED_FACTOR(pll_audio_clk, "pll-audio", 722 - "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT); 723 - static CLK_FIXED_FACTOR(pll_audio_2x_clk, "pll-audio-2x", 724 - "pll-audio-base", 2, 1, CLK_SET_RATE_PARENT); 725 - static CLK_FIXED_FACTOR(pll_audio_4x_clk, "pll-audio-4x", 726 - "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT); 727 - static CLK_FIXED_FACTOR(pll_audio_8x_clk, "pll-audio-8x", 728 - "pll-audio-base", 1, 2, CLK_SET_RATE_PARENT); 729 - static CLK_FIXED_FACTOR(pll_periph0_2x_clk, "pll-periph0-2x", 730 - "pll-periph0", 1, 2, 0); 725 + static CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", 726 + clk_parent_pll_audio, 727 + 1, 1, CLK_SET_RATE_PARENT); 728 + static CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", 729 + clk_parent_pll_audio, 730 + 2, 1, CLK_SET_RATE_PARENT); 731 + static CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x", 732 + clk_parent_pll_audio, 733 + 1, 1, CLK_SET_RATE_PARENT); 734 + static CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x", 735 + clk_parent_pll_audio, 736 + 1, 2, CLK_SET_RATE_PARENT); 737 + static CLK_FIXED_FACTOR_HW(pll_periph0_2x_clk, "pll-periph0-2x", 738 + &pll_periph0_clk.common.hw, 739 + 1, 2, 0); 731 740 732 741 static struct clk_hw_onecell_data sun8i_h3_hw_clks = { 733 742 .hws = {
+49 -55
drivers/clk/sunxi-ng/ccu-sun8i-r.c
··· 17 17 18 18 #include "ccu-sun8i-r.h" 19 19 20 - static const char * const ar100_parents[] = { "osc32k", "osc24M", 21 - "pll-periph0", "iosc" }; 22 - static const char * const a83t_ar100_parents[] = { "osc16M-d512", "osc24M", 23 - "pll-periph0", "iosc" }; 20 + static const struct clk_parent_data ar100_parents[] = { 21 + { .fw_name = "losc" }, 22 + { .fw_name = "hosc" }, 23 + { .fw_name = "pll-periph" }, 24 + { .fw_name = "iosc" }, 25 + }; 26 + 24 27 static const struct ccu_mux_var_prediv ar100_predivs[] = { 25 28 { .index = 2, .shift = 8, .width = 5 }, 26 29 }; ··· 42 39 .common = { 43 40 .reg = 0x00, 44 41 .features = CCU_FEATURE_VARIABLE_PREDIV, 45 - .hw.init = CLK_HW_INIT_PARENTS("ar100", 46 - ar100_parents, 47 - &ccu_div_ops, 48 - 0), 42 + .hw.init = CLK_HW_INIT_PARENTS_DATA("ar100", 43 + ar100_parents, 44 + &ccu_div_ops, 45 + 0), 49 46 }, 50 47 }; 51 48 52 - static struct ccu_div a83t_ar100_clk = { 53 - .div = _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO), 54 - 55 - .mux = { 56 - .shift = 16, 57 - .width = 2, 58 - 59 - .var_predivs = ar100_predivs, 60 - .n_var_predivs = ARRAY_SIZE(ar100_predivs), 61 - }, 62 - 63 - .common = { 64 - .reg = 0x00, 65 - .features = CCU_FEATURE_VARIABLE_PREDIV, 66 - .hw.init = CLK_HW_INIT_PARENTS("ar100", 67 - a83t_ar100_parents, 68 - &ccu_div_ops, 69 - 0), 70 - }, 71 - }; 72 - 73 - static CLK_FIXED_FACTOR(ahb0_clk, "ahb0", "ar100", 1, 1, 0); 49 + static CLK_FIXED_FACTOR_HW(ahb0_clk, "ahb0", &ar100_clk.common.hw, 1, 1, 0); 74 50 75 51 static struct ccu_div apb0_clk = { 76 52 .div = _SUNXI_CCU_DIV_FLAGS(0, 2, CLK_DIVIDER_POWER_OF_TWO), 77 53 78 54 .common = { 79 55 .reg = 0x0c, 80 - .hw.init = CLK_HW_INIT("apb0", 81 - "ahb0", 82 - &ccu_div_ops, 83 - 0), 56 + .hw.init = CLK_HW_INIT_HW("apb0", 57 + &ahb0_clk.hw, 58 + &ccu_div_ops, 59 + 0), 84 60 }, 85 61 }; 86 62 87 63 static SUNXI_CCU_M(a83t_apb0_clk, "apb0", "ahb0", 0x0c, 0, 2, 0); 88 64 89 - static SUNXI_CCU_GATE(apb0_pio_clk, "apb0-pio", "apb0", 90 - 0x28, BIT(0), 0); 91 - static SUNXI_CCU_GATE(apb0_ir_clk, "apb0-ir", "apb0", 92 - 0x28, BIT(1), 0); 93 - static SUNXI_CCU_GATE(apb0_timer_clk, "apb0-timer", "apb0", 94 - 0x28, BIT(2), 0); 95 - static SUNXI_CCU_GATE(apb0_rsb_clk, "apb0-rsb", "apb0", 96 - 0x28, BIT(3), 0); 97 - static SUNXI_CCU_GATE(apb0_uart_clk, "apb0-uart", "apb0", 98 - 0x28, BIT(4), 0); 99 - static SUNXI_CCU_GATE(apb0_i2c_clk, "apb0-i2c", "apb0", 100 - 0x28, BIT(6), 0); 101 - static SUNXI_CCU_GATE(apb0_twd_clk, "apb0-twd", "apb0", 102 - 0x28, BIT(7), 0); 65 + /* 66 + * Define the parent as an array that can be reused to save space 67 + * instead of having compound literals for each gate. Also have it 68 + * non-const so we can change it on the A83T. 69 + */ 70 + static const struct clk_hw *apb0_gate_parent[] = { &apb0_clk.common.hw }; 71 + static SUNXI_CCU_GATE_HWS(apb0_pio_clk, "apb0-pio", 72 + apb0_gate_parent, 0x28, BIT(0), 0); 73 + static SUNXI_CCU_GATE_HWS(apb0_ir_clk, "apb0-ir", 74 + apb0_gate_parent, 0x28, BIT(1), 0); 75 + static SUNXI_CCU_GATE_HWS(apb0_timer_clk, "apb0-timer", 76 + apb0_gate_parent, 0x28, BIT(2), 0); 77 + static SUNXI_CCU_GATE_HWS(apb0_rsb_clk, "apb0-rsb", 78 + apb0_gate_parent, 0x28, BIT(3), 0); 79 + static SUNXI_CCU_GATE_HWS(apb0_uart_clk, "apb0-uart", 80 + apb0_gate_parent, 0x28, BIT(4), 0); 81 + static SUNXI_CCU_GATE_HWS(apb0_i2c_clk, "apb0-i2c", 82 + apb0_gate_parent, 0x28, BIT(6), 0); 83 + static SUNXI_CCU_GATE_HWS(apb0_twd_clk, "apb0-twd", 84 + apb0_gate_parent, 0x28, BIT(7), 0); 103 85 104 86 static const char * const r_mod0_default_parents[] = { "osc32k", "osc24M" }; 105 87 static SUNXI_CCU_MP_WITH_MUX_GATE(ir_clk, "ir", ··· 95 107 BIT(31), /* gate */ 96 108 0); 97 109 98 - static const char *const a83t_r_mod0_parents[] = { "osc16M", "osc24M" }; 110 + static const struct clk_parent_data a83t_r_mod0_parents[] = { 111 + { .fw_name = "iosc" }, 112 + { .fw_name = "hosc" }, 113 + }; 99 114 static const struct ccu_mux_fixed_prediv a83t_ir_predivs[] = { 100 115 { .index = 0, .div = 16 }, 101 116 }; ··· 118 127 .common = { 119 128 .reg = 0x54, 120 129 .features = CCU_FEATURE_VARIABLE_PREDIV, 121 - .hw.init = CLK_HW_INIT_PARENTS("ir", 122 - a83t_r_mod0_parents, 123 - &ccu_mp_ops, 124 - 0), 130 + .hw.init = CLK_HW_INIT_PARENTS_DATA("ir", 131 + a83t_r_mod0_parents, 132 + &ccu_mp_ops, 133 + 0), 125 134 }, 126 135 }; 127 136 128 137 static struct ccu_common *sun8i_a83t_r_ccu_clks[] = { 129 - &a83t_ar100_clk.common, 138 + &ar100_clk.common, 130 139 &a83t_apb0_clk.common, 131 140 &apb0_pio_clk.common, 132 141 &apb0_ir_clk.common, ··· 165 174 166 175 static struct clk_hw_onecell_data sun8i_a83t_r_hw_clks = { 167 176 .hws = { 168 - [CLK_AR100] = &a83t_ar100_clk.common.hw, 177 + [CLK_AR100] = &ar100_clk.common.hw, 169 178 [CLK_AHB0] = &ahb0_clk.hw, 170 179 [CLK_APB0] = &a83t_apb0_clk.common.hw, 171 180 [CLK_APB0_PIO] = &apb0_pio_clk.common.hw, ··· 282 291 283 292 static void __init sun8i_a83t_r_ccu_setup(struct device_node *node) 284 293 { 294 + /* Fix apb0 bus gate parents here */ 295 + apb0_gate_parent[0] = &a83t_apb0_clk.common.hw; 296 + 285 297 sunxi_r_ccu_init(node, &sun8i_a83t_r_ccu_desc); 286 298 } 287 299 CLK_OF_DECLARE(sun8i_a83t_r_ccu, "allwinner,sun8i-a83t-r-ccu",
+29 -17
drivers/clk/sunxi-ng/ccu-sun8i-r40.c
··· 944 944 }; 945 945 946 946 /* Fixed Factor clocks */ 947 - static CLK_FIXED_FACTOR(osc12M_clk, "osc12M", "osc24M", 2, 1, 0); 947 + static CLK_FIXED_FACTOR_FW_NAME(osc12M_clk, "osc12M", "hosc", 2, 1, 0); 948 + 949 + static const struct clk_hw *clk_parent_pll_audio[] = { 950 + &pll_audio_base_clk.common.hw 951 + }; 948 952 949 953 /* We hardcode the divider to 4 for now */ 950 - static CLK_FIXED_FACTOR(pll_audio_clk, "pll-audio", 951 - "pll-audio-base", 4, 1, CLK_SET_RATE_PARENT); 952 - static CLK_FIXED_FACTOR(pll_audio_2x_clk, "pll-audio-2x", 953 - "pll-audio-base", 2, 1, CLK_SET_RATE_PARENT); 954 - static CLK_FIXED_FACTOR(pll_audio_4x_clk, "pll-audio-4x", 955 - "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT); 956 - static CLK_FIXED_FACTOR(pll_audio_8x_clk, "pll-audio-8x", 957 - "pll-audio-base", 1, 2, CLK_SET_RATE_PARENT); 958 - static CLK_FIXED_FACTOR(pll_periph0_2x_clk, "pll-periph0-2x", 959 - "pll-periph0", 1, 2, 0); 960 - static CLK_FIXED_FACTOR(pll_periph1_2x_clk, "pll-periph1-2x", 961 - "pll-periph1", 1, 2, 0); 962 - static CLK_FIXED_FACTOR(pll_video0_2x_clk, "pll-video0-2x", 963 - "pll-video0", 1, 2, 0); 964 - static CLK_FIXED_FACTOR(pll_video1_2x_clk, "pll-video1-2x", 965 - "pll-video1", 1, 2, 0); 954 + static CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", 955 + clk_parent_pll_audio, 956 + 4, 1, CLK_SET_RATE_PARENT); 957 + static CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", 958 + clk_parent_pll_audio, 959 + 2, 1, CLK_SET_RATE_PARENT); 960 + static CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x", 961 + clk_parent_pll_audio, 962 + 1, 1, CLK_SET_RATE_PARENT); 963 + static CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x", 964 + clk_parent_pll_audio, 965 + 1, 2, CLK_SET_RATE_PARENT); 966 + static CLK_FIXED_FACTOR_HW(pll_periph0_2x_clk, "pll-periph0-2x", 967 + &pll_periph0_clk.common.hw, 968 + 1, 2, 0); 969 + static CLK_FIXED_FACTOR_HW(pll_periph1_2x_clk, "pll-periph1-2x", 970 + &pll_periph1_clk.common.hw, 971 + 1, 2, 0); 972 + static CLK_FIXED_FACTOR_HW(pll_video0_2x_clk, "pll-video0-2x", 973 + &pll_video0_clk.common.hw, 974 + 1, 2, 0); 975 + static CLK_FIXED_FACTOR_HW(pll_video1_2x_clk, "pll-video1-2x", 976 + &pll_video1_clk.common.hw, 977 + 1, 2, 0); 966 978 967 979 static struct clk_hw_onecell_data sun8i_r40_hw_clks = { 968 980 .hws = {
+19 -10
drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
··· 429 429 &mipi_csi_clk.common, 430 430 }; 431 431 432 + static const struct clk_hw *clk_parent_pll_audio[] = { 433 + &pll_audio_base_clk.common.hw 434 + }; 435 + 432 436 /* We hardcode the divider to 4 for now */ 433 - static CLK_FIXED_FACTOR(pll_audio_clk, "pll-audio", 434 - "pll-audio-base", 4, 1, CLK_SET_RATE_PARENT); 435 - static CLK_FIXED_FACTOR(pll_audio_2x_clk, "pll-audio-2x", 436 - "pll-audio-base", 2, 1, CLK_SET_RATE_PARENT); 437 - static CLK_FIXED_FACTOR(pll_audio_4x_clk, "pll-audio-4x", 438 - "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT); 439 - static CLK_FIXED_FACTOR(pll_audio_8x_clk, "pll-audio-8x", 440 - "pll-audio-base", 1, 2, CLK_SET_RATE_PARENT); 441 - static CLK_FIXED_FACTOR(pll_periph0_2x_clk, "pll-periph0-2x", 442 - "pll-periph0", 1, 2, 0); 437 + static CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", 438 + clk_parent_pll_audio, 439 + 4, 1, CLK_SET_RATE_PARENT); 440 + static CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", 441 + clk_parent_pll_audio, 442 + 2, 1, CLK_SET_RATE_PARENT); 443 + static CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x", 444 + clk_parent_pll_audio, 445 + 1, 1, CLK_SET_RATE_PARENT); 446 + static CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x", 447 + clk_parent_pll_audio, 448 + 1, 2, CLK_SET_RATE_PARENT); 449 + static CLK_FIXED_FACTOR_HW(pll_periph0_2x_clk, "pll-periph0-2x", 450 + &pll_periph0_clk.common.hw, 451 + 1, 2, 0); 443 452 444 453 static struct clk_hw_onecell_data sun8i_v3s_hw_clks = { 445 454 .hws = {
+19 -11
drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c
··· 14 14 15 15 #include "ccu-sun9i-a80-usb.h" 16 16 17 - static SUNXI_CCU_GATE(bus_hci0_clk, "bus-hci0", "bus-usb", 0x0, BIT(1), 0); 18 - static SUNXI_CCU_GATE(usb_ohci0_clk, "usb-ohci0", "osc24M", 0x0, BIT(2), 0); 19 - static SUNXI_CCU_GATE(bus_hci1_clk, "bus-hci1", "bus-usb", 0x0, BIT(3), 0); 20 - static SUNXI_CCU_GATE(bus_hci2_clk, "bus-hci2", "bus-usb", 0x0, BIT(5), 0); 21 - static SUNXI_CCU_GATE(usb_ohci2_clk, "usb-ohci2", "osc24M", 0x0, BIT(6), 0); 17 + static const struct clk_parent_data clk_parent_hosc[] = { 18 + { .fw_name = "hosc" }, 19 + }; 22 20 23 - static SUNXI_CCU_GATE(usb0_phy_clk, "usb0-phy", "osc24M", 0x4, BIT(1), 0); 24 - static SUNXI_CCU_GATE(usb1_hsic_clk, "usb1-hsic", "osc24M", 0x4, BIT(2), 0); 25 - static SUNXI_CCU_GATE(usb1_phy_clk, "usb1-phy", "osc24M", 0x4, BIT(3), 0); 26 - static SUNXI_CCU_GATE(usb2_hsic_clk, "usb2-hsic", "osc24M", 0x4, BIT(4), 0); 27 - static SUNXI_CCU_GATE(usb2_phy_clk, "usb2-phy", "osc24M", 0x4, BIT(5), 0); 28 - static SUNXI_CCU_GATE(usb_hsic_clk, "usb-hsic", "osc24M", 0x4, BIT(10), 0); 21 + static const struct clk_parent_data clk_parent_bus[] = { 22 + { .fw_name = "bus" }, 23 + }; 24 + 25 + static SUNXI_CCU_GATE_DATA(bus_hci0_clk, "bus-hci0", clk_parent_bus, 0x0, BIT(1), 0); 26 + static SUNXI_CCU_GATE_DATA(usb_ohci0_clk, "usb-ohci0", clk_parent_hosc, 0x0, BIT(2), 0); 27 + static SUNXI_CCU_GATE_DATA(bus_hci1_clk, "bus-hci1", clk_parent_bus, 0x0, BIT(3), 0); 28 + static SUNXI_CCU_GATE_DATA(bus_hci2_clk, "bus-hci2", clk_parent_bus, 0x0, BIT(5), 0); 29 + static SUNXI_CCU_GATE_DATA(usb_ohci2_clk, "usb-ohci2", clk_parent_hosc, 0x0, BIT(6), 0); 30 + 31 + static SUNXI_CCU_GATE_DATA(usb0_phy_clk, "usb0-phy", clk_parent_hosc, 0x4, BIT(1), 0); 32 + static SUNXI_CCU_GATE_DATA(usb1_hsic_clk, "usb1-hsic", clk_parent_hosc, 0x4, BIT(2), 0); 33 + static SUNXI_CCU_GATE_DATA(usb1_phy_clk, "usb1-phy", clk_parent_hosc, 0x4, BIT(3), 0); 34 + static SUNXI_CCU_GATE_DATA(usb2_hsic_clk, "usb2-hsic", clk_parent_hosc, 0x4, BIT(4), 0); 35 + static SUNXI_CCU_GATE_DATA(usb2_phy_clk, "usb2-phy", clk_parent_hosc, 0x4, BIT(5), 0); 36 + static SUNXI_CCU_GATE_DATA(usb_hsic_clk, "usb-hsic", clk_parent_hosc, 0x4, BIT(10), 0); 29 37 30 38 static struct ccu_common *sun9i_a80_usb_clks[] = { 31 39 &bus_hci0_clk.common,
+19 -10
drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c
··· 374 374 &avs_clk.common, 375 375 }; 376 376 377 - static CLK_FIXED_FACTOR(pll_audio_clk, "pll-audio", 378 - "pll-audio-base", 4, 1, CLK_SET_RATE_PARENT); 379 - static CLK_FIXED_FACTOR(pll_audio_2x_clk, "pll-audio-2x", 380 - "pll-audio-base", 2, 1, CLK_SET_RATE_PARENT); 381 - static CLK_FIXED_FACTOR(pll_audio_4x_clk, "pll-audio-4x", 382 - "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT); 383 - static CLK_FIXED_FACTOR(pll_audio_8x_clk, "pll-audio-8x", 384 - "pll-audio-base", 1, 2, CLK_SET_RATE_PARENT); 385 - static CLK_FIXED_FACTOR(pll_video_2x_clk, "pll-video-2x", 386 - "pll-video", 1, 2, 0); 377 + static const struct clk_hw *clk_parent_pll_audio[] = { 378 + &pll_audio_base_clk.common.hw 379 + }; 380 + 381 + static CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", 382 + clk_parent_pll_audio, 383 + 4, 1, CLK_SET_RATE_PARENT); 384 + static CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", 385 + clk_parent_pll_audio, 386 + 2, 1, CLK_SET_RATE_PARENT); 387 + static CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x", 388 + clk_parent_pll_audio, 389 + 1, 1, CLK_SET_RATE_PARENT); 390 + static CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x", 391 + clk_parent_pll_audio, 392 + 1, 2, CLK_SET_RATE_PARENT); 393 + static CLK_FIXED_FACTOR_HW(pll_video_2x_clk, "pll-video-2x", 394 + &pll_video_clk.common.hw, 395 + 1, 2, 0); 387 396 388 397 static struct clk_hw_onecell_data suniv_hw_clks = { 389 398 .hws = {
+1 -1
drivers/clk/sunxi-ng/ccu_common.c
··· 101 101 if (!hw) 102 102 continue; 103 103 104 - ret = clk_hw_register(NULL, hw); 104 + ret = of_clk_hw_register(node, hw); 105 105 if (ret) { 106 106 pr_err("Couldn't register clock %d - %s\n", 107 107 i, clk_hw_get_name(hw));
+53
drivers/clk/sunxi-ng/ccu_gate.h
··· 28 28 } \ 29 29 } 30 30 31 + #define SUNXI_CCU_GATE_HW(_struct, _name, _parent, _reg, _gate, _flags) \ 32 + struct ccu_gate _struct = { \ 33 + .enable = _gate, \ 34 + .common = { \ 35 + .reg = _reg, \ 36 + .hw.init = CLK_HW_INIT_HW(_name, \ 37 + _parent, \ 38 + &ccu_gate_ops, \ 39 + _flags), \ 40 + } \ 41 + } 42 + 43 + #define SUNXI_CCU_GATE_FW(_struct, _name, _parent, _reg, _gate, _flags) \ 44 + struct ccu_gate _struct = { \ 45 + .enable = _gate, \ 46 + .common = { \ 47 + .reg = _reg, \ 48 + .hw.init = CLK_HW_INIT_FW_NAME(_name, \ 49 + _parent, \ 50 + &ccu_gate_ops, \ 51 + _flags), \ 52 + } \ 53 + } 54 + 55 + /* 56 + * The following two macros allow the re-use of the data structure 57 + * holding the parent info. 58 + */ 59 + #define SUNXI_CCU_GATE_HWS(_struct, _name, _parent, _reg, _gate, _flags) \ 60 + struct ccu_gate _struct = { \ 61 + .enable = _gate, \ 62 + .common = { \ 63 + .reg = _reg, \ 64 + .hw.init = CLK_HW_INIT_HWS(_name, \ 65 + _parent, \ 66 + &ccu_gate_ops, \ 67 + _flags), \ 68 + } \ 69 + } 70 + 71 + #define SUNXI_CCU_GATE_DATA(_struct, _name, _data, _reg, _gate, _flags) \ 72 + struct ccu_gate _struct = { \ 73 + .enable = _gate, \ 74 + .common = { \ 75 + .reg = _reg, \ 76 + .hw.init = \ 77 + CLK_HW_INIT_PARENTS_DATA(_name, \ 78 + _data, \ 79 + &ccu_gate_ops, \ 80 + _flags), \ 81 + } \ 82 + } 83 + 31 84 static inline struct ccu_gate *hw_to_ccu_gate(struct clk_hw *hw) 32 85 { 33 86 struct ccu_common *common = hw_to_ccu_common(hw);
+2
drivers/clk/sunxi/clk-sunxi.c
··· 980 980 if (endp) { 981 981 derived_name = kstrndup(clk_name, endp - clk_name, 982 982 GFP_KERNEL); 983 + if (!derived_name) 984 + return NULL; 983 985 factors.name = derived_name; 984 986 } else { 985 987 factors.name = clk_name;
+12 -8
drivers/clk/tegra/clk-tegra210.c
··· 984 984 pllre->params->defaults_set = true; 985 985 986 986 if (val & PLL_ENABLE) { 987 - pr_warn("PLL_RE already enabled. Postponing set full defaults\n"); 988 - 989 987 /* 990 988 * PLL is ON: check if defaults already set, then set those 991 989 * that can be updated in flight. ··· 1003 1005 _pll_misc_chk_default(clk_base, pllre->params, 0, val, 1004 1006 ~mask & PLLRE_MISC0_WRITE_MASK); 1005 1007 1006 - /* Enable lock detect */ 1008 + /* The PLL doesn't work if it's in IDDQ. */ 1007 1009 val = readl_relaxed(clk_base + pllre->params->ext_misc_reg[0]); 1010 + if (val & PLLRE_MISC0_IDDQ) 1011 + pr_warn("unexpected IDDQ bit set for enabled clock\n"); 1012 + 1013 + /* Enable lock detect */ 1008 1014 val &= ~mask; 1009 1015 val |= PLLRE_MISC0_DEFAULT_VALUE & mask; 1010 1016 writel_relaxed(val, clk_base + pllre->params->ext_misc_reg[0]); 1011 1017 udelay(1); 1018 + 1019 + if (!pllre->params->defaults_set) 1020 + pr_warn("PLL_RE already enabled. Postponing set full defaults\n"); 1012 1021 1013 1022 return; 1014 1023 } ··· 2209 2204 }; 2210 2205 2211 2206 static struct tegra_clk_pll_freq_table pll_u_freq_table[] = { 2212 - { 12000000, 480000000, 40, 1, 0, 0 }, 2213 - { 13000000, 480000000, 36, 1, 0, 0 }, /* actual: 468.0 MHz */ 2214 - { 38400000, 480000000, 25, 2, 0, 0 }, 2207 + { 12000000, 480000000, 40, 1, 1, 0 }, 2208 + { 13000000, 480000000, 36, 1, 1, 0 }, /* actual: 468.0 MHz */ 2209 + { 38400000, 480000000, 25, 2, 1, 0 }, 2215 2210 { 0, 0, 0, 0, 0, 0 }, 2216 2211 }; 2217 2212 ··· 3337 3332 { TEGRA210_CLK_DFLL_SOC, TEGRA210_CLK_PLL_P, 51000000, 1 }, 3338 3333 { TEGRA210_CLK_DFLL_REF, TEGRA210_CLK_PLL_P, 51000000, 1 }, 3339 3334 { TEGRA210_CLK_SBC4, TEGRA210_CLK_PLL_P, 12000000, 1 }, 3340 - { TEGRA210_CLK_PLL_RE_VCO, TEGRA210_CLK_CLK_MAX, 672000000, 1 }, 3335 + { TEGRA210_CLK_PLL_U_OUT1, TEGRA210_CLK_CLK_MAX, 48000000, 1 }, 3341 3336 { TEGRA210_CLK_XUSB_GATE, TEGRA210_CLK_CLK_MAX, 0, 1 }, 3342 3337 { TEGRA210_CLK_XUSB_SS_SRC, TEGRA210_CLK_PLL_U_480M, 120000000, 0 }, 3343 3338 { TEGRA210_CLK_XUSB_FS_SRC, TEGRA210_CLK_PLL_U_48M, 48000000, 0 }, ··· 3362 3357 { TEGRA210_CLK_PLL_DP, TEGRA210_CLK_CLK_MAX, 270000000, 0 }, 3363 3358 { TEGRA210_CLK_SOC_THERM, TEGRA210_CLK_PLL_P, 51000000, 0 }, 3364 3359 { TEGRA210_CLK_CCLK_G, TEGRA210_CLK_CLK_MAX, 0, 1 }, 3365 - { TEGRA210_CLK_PLL_U_OUT1, TEGRA210_CLK_CLK_MAX, 48000000, 1 }, 3366 3360 { TEGRA210_CLK_PLL_U_OUT2, TEGRA210_CLK_CLK_MAX, 60000000, 1 }, 3367 3361 { TEGRA210_CLK_SPDIF_IN_SYNC, TEGRA210_CLK_CLK_MAX, 24576000, 0 }, 3368 3362 { TEGRA210_CLK_I2S0_SYNC, TEGRA210_CLK_CLK_MAX, 24576000, 0 },
-85
drivers/clk/ti/divider.c
··· 425 425 return 0; 426 426 } 427 427 428 - static const struct clk_div_table * 429 - _get_div_table_from_setup(struct ti_clk_divider *setup, u8 *width) 430 - { 431 - const struct clk_div_table *table = NULL; 432 - 433 - ti_clk_parse_divider_data(setup->dividers, setup->num_dividers, 434 - setup->max_div, setup->flags, width, 435 - &table); 436 - 437 - return table; 438 - } 439 - 440 - struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup) 441 - { 442 - struct clk_omap_divider *div; 443 - struct clk_omap_reg *reg; 444 - int ret; 445 - 446 - if (!setup) 447 - return NULL; 448 - 449 - div = kzalloc(sizeof(*div), GFP_KERNEL); 450 - if (!div) 451 - return ERR_PTR(-ENOMEM); 452 - 453 - reg = (struct clk_omap_reg *)&div->reg; 454 - reg->index = setup->module; 455 - reg->offset = setup->reg; 456 - 457 - if (setup->flags & CLKF_INDEX_STARTS_AT_ONE) 458 - div->flags |= CLK_DIVIDER_ONE_BASED; 459 - 460 - if (setup->flags & CLKF_INDEX_POWER_OF_TWO) 461 - div->flags |= CLK_DIVIDER_POWER_OF_TWO; 462 - 463 - div->table = _get_div_table_from_setup(setup, &div->width); 464 - if (IS_ERR(div->table)) { 465 - ret = PTR_ERR(div->table); 466 - kfree(div); 467 - return ERR_PTR(ret); 468 - } 469 - 470 - 471 - div->shift = setup->bit_shift; 472 - div->latch = -EINVAL; 473 - 474 - return &div->hw; 475 - } 476 - 477 - struct clk *ti_clk_register_divider(struct ti_clk *setup) 478 - { 479 - struct ti_clk_divider *div = setup->data; 480 - struct clk_omap_reg reg = { 481 - .index = div->module, 482 - .offset = div->reg, 483 - }; 484 - u8 width; 485 - u32 flags = 0; 486 - u8 div_flags = 0; 487 - const struct clk_div_table *table; 488 - struct clk *clk; 489 - 490 - if (div->flags & CLKF_INDEX_STARTS_AT_ONE) 491 - div_flags |= CLK_DIVIDER_ONE_BASED; 492 - 493 - if (div->flags & CLKF_INDEX_POWER_OF_TWO) 494 - div_flags |= CLK_DIVIDER_POWER_OF_TWO; 495 - 496 - if (div->flags & CLKF_SET_RATE_PARENT) 497 - flags |= CLK_SET_RATE_PARENT; 498 - 499 - table = _get_div_table_from_setup(div, &width); 500 - if (IS_ERR(table)) 501 - return (struct clk *)table; 502 - 503 - clk = _register_divider(NULL, setup->name, div->parent, 504 - flags, &reg, div->bit_shift, 505 - width, -EINVAL, div_flags, table); 506 - 507 - if (IS_ERR(clk)) 508 - kfree(table); 509 - 510 - return clk; 511 - } 512 - 513 428 static struct clk_div_table * 514 429 __init ti_clk_get_div_table(struct device_node *node) 515 430 {
-30
drivers/clk/ti/gate.c
··· 131 131 return clk; 132 132 } 133 133 134 - struct clk_hw *ti_clk_build_component_gate(struct ti_clk_gate *setup) 135 - { 136 - struct clk_hw_omap *gate; 137 - struct clk_omap_reg *reg; 138 - const struct clk_hw_omap_ops *ops = &clkhwops_wait; 139 - 140 - if (!setup) 141 - return NULL; 142 - 143 - gate = kzalloc(sizeof(*gate), GFP_KERNEL); 144 - if (!gate) 145 - return ERR_PTR(-ENOMEM); 146 - 147 - reg = (struct clk_omap_reg *)&gate->enable_reg; 148 - reg->index = setup->module; 149 - reg->offset = setup->reg; 150 - 151 - gate->enable_bit = setup->bit_shift; 152 - 153 - if (setup->flags & CLKF_NO_WAIT) 154 - ops = NULL; 155 - 156 - if (setup->flags & CLKF_INTERFACE) 157 - ops = &clkhwops_iclk_wait; 158 - 159 - gate->ops = ops; 160 - 161 - return &gate->hw; 162 - } 163 - 164 134 static void __init _of_ti_gate_clk_setup(struct device_node *node, 165 135 const struct clk_ops *ops, 166 136 const struct clk_hw_omap_ops *hw_ops)
-31
drivers/clk/ti/mux.c
··· 164 164 return clk; 165 165 } 166 166 167 - struct clk *ti_clk_register_mux(struct ti_clk *setup) 168 - { 169 - struct ti_clk_mux *mux; 170 - u32 flags; 171 - u8 mux_flags = 0; 172 - struct clk_omap_reg reg; 173 - u32 mask; 174 - 175 - mux = setup->data; 176 - flags = CLK_SET_RATE_NO_REPARENT; 177 - 178 - mask = mux->num_parents; 179 - if (!(mux->flags & CLKF_INDEX_STARTS_AT_ONE)) 180 - mask--; 181 - 182 - mask = (1 << fls(mask)) - 1; 183 - reg.index = mux->module; 184 - reg.offset = mux->reg; 185 - reg.ptr = NULL; 186 - 187 - if (mux->flags & CLKF_INDEX_STARTS_AT_ONE) 188 - mux_flags |= CLK_MUX_INDEX_ONE; 189 - 190 - if (mux->flags & CLKF_SET_RATE_PARENT) 191 - flags |= CLK_SET_RATE_PARENT; 192 - 193 - return _register_mux(NULL, setup->name, mux->parents, mux->num_parents, 194 - flags, &reg, mux->bit_shift, mask, -EINVAL, 195 - mux_flags, NULL); 196 - } 197 - 198 167 /** 199 168 * of_mux_clk_setup - Setup function for simple mux rate clock 200 169 * @node: DT node for the clock
+10
drivers/firmware/raspberrypi.c
··· 20 20 #define MBOX_CHAN_PROPERTY 8 21 21 22 22 static struct platform_device *rpi_hwmon; 23 + static struct platform_device *rpi_clk; 23 24 24 25 struct rpi_firmware { 25 26 struct mbox_client cl; ··· 208 207 -1, NULL, 0); 209 208 } 210 209 210 + static void rpi_register_clk_driver(struct device *dev) 211 + { 212 + rpi_clk = platform_device_register_data(dev, "raspberrypi-clk", 213 + -1, NULL, 0); 214 + } 215 + 211 216 static int rpi_firmware_probe(struct platform_device *pdev) 212 217 { 213 218 struct device *dev = &pdev->dev; ··· 241 234 242 235 rpi_firmware_print_firmware_revision(fw); 243 236 rpi_register_hwmon_driver(dev, fw); 237 + rpi_register_clk_driver(dev); 244 238 245 239 return 0; 246 240 } ··· 262 254 263 255 platform_device_unregister(rpi_hwmon); 264 256 rpi_hwmon = NULL; 257 + platform_device_unregister(rpi_clk); 258 + rpi_clk = NULL; 265 259 mbox_free_channel(fw->chan); 266 260 267 261 return 0;
+89 -35
drivers/firmware/ti_sci.c
··· 916 916 * Return: 0 if all went well, else returns appropriate error value. 917 917 */ 918 918 static int ti_sci_set_clock_state(const struct ti_sci_handle *handle, 919 - u32 dev_id, u8 clk_id, 919 + u32 dev_id, u32 clk_id, 920 920 u32 flags, u8 state) 921 921 { 922 922 struct ti_sci_info *info; ··· 944 944 } 945 945 req = (struct ti_sci_msg_req_set_clock_state *)xfer->xfer_buf; 946 946 req->dev_id = dev_id; 947 - req->clk_id = clk_id; 947 + if (clk_id < 255) { 948 + req->clk_id = clk_id; 949 + } else { 950 + req->clk_id = 255; 951 + req->clk_id_32 = clk_id; 952 + } 948 953 req->request_state = state; 949 954 950 955 ret = ti_sci_do_xfer(info, xfer); ··· 981 976 * Return: 0 if all went well, else returns appropriate error value. 982 977 */ 983 978 static int ti_sci_cmd_get_clock_state(const struct ti_sci_handle *handle, 984 - u32 dev_id, u8 clk_id, 979 + u32 dev_id, u32 clk_id, 985 980 u8 *programmed_state, u8 *current_state) 986 981 { 987 982 struct ti_sci_info *info; ··· 1012 1007 } 1013 1008 req = (struct ti_sci_msg_req_get_clock_state *)xfer->xfer_buf; 1014 1009 req->dev_id = dev_id; 1015 - req->clk_id = clk_id; 1010 + if (clk_id < 255) { 1011 + req->clk_id = clk_id; 1012 + } else { 1013 + req->clk_id = 255; 1014 + req->clk_id_32 = clk_id; 1015 + } 1016 1016 1017 1017 ret = ti_sci_do_xfer(info, xfer); 1018 1018 if (ret) { ··· 1057 1047 * Return: 0 if all went well, else returns appropriate error value. 1058 1048 */ 1059 1049 static int ti_sci_cmd_get_clock(const struct ti_sci_handle *handle, u32 dev_id, 1060 - u8 clk_id, bool needs_ssc, bool can_change_freq, 1061 - bool enable_input_term) 1050 + u32 clk_id, bool needs_ssc, 1051 + bool can_change_freq, bool enable_input_term) 1062 1052 { 1063 1053 u32 flags = 0; 1064 1054 ··· 1083 1073 * Return: 0 if all went well, else returns appropriate error value. 1084 1074 */ 1085 1075 static int ti_sci_cmd_idle_clock(const struct ti_sci_handle *handle, 1086 - u32 dev_id, u8 clk_id) 1076 + u32 dev_id, u32 clk_id) 1087 1077 { 1088 1078 return ti_sci_set_clock_state(handle, dev_id, clk_id, 0, 1089 1079 MSG_CLOCK_SW_STATE_UNREQ); ··· 1102 1092 * Return: 0 if all went well, else returns appropriate error value. 1103 1093 */ 1104 1094 static int ti_sci_cmd_put_clock(const struct ti_sci_handle *handle, 1105 - u32 dev_id, u8 clk_id) 1095 + u32 dev_id, u32 clk_id) 1106 1096 { 1107 1097 return ti_sci_set_clock_state(handle, dev_id, clk_id, 0, 1108 1098 MSG_CLOCK_SW_STATE_AUTO); ··· 1120 1110 * Return: 0 if all went well, else returns appropriate error value. 1121 1111 */ 1122 1112 static int ti_sci_cmd_clk_is_auto(const struct ti_sci_handle *handle, 1123 - u32 dev_id, u8 clk_id, bool *req_state) 1113 + u32 dev_id, u32 clk_id, bool *req_state) 1124 1114 { 1125 1115 u8 state = 0; 1126 1116 int ret; ··· 1149 1139 * Return: 0 if all went well, else returns appropriate error value. 1150 1140 */ 1151 1141 static int ti_sci_cmd_clk_is_on(const struct ti_sci_handle *handle, u32 dev_id, 1152 - u8 clk_id, bool *req_state, bool *curr_state) 1142 + u32 clk_id, bool *req_state, bool *curr_state) 1153 1143 { 1154 1144 u8 c_state = 0, r_state = 0; 1155 1145 int ret; ··· 1182 1172 * Return: 0 if all went well, else returns appropriate error value. 1183 1173 */ 1184 1174 static int ti_sci_cmd_clk_is_off(const struct ti_sci_handle *handle, u32 dev_id, 1185 - u8 clk_id, bool *req_state, bool *curr_state) 1175 + u32 clk_id, bool *req_state, bool *curr_state) 1186 1176 { 1187 1177 u8 c_state = 0, r_state = 0; 1188 1178 int ret; ··· 1214 1204 * Return: 0 if all went well, else returns appropriate error value. 1215 1205 */ 1216 1206 static int ti_sci_cmd_clk_set_parent(const struct ti_sci_handle *handle, 1217 - u32 dev_id, u8 clk_id, u8 parent_id) 1207 + u32 dev_id, u32 clk_id, u32 parent_id) 1218 1208 { 1219 1209 struct ti_sci_info *info; 1220 1210 struct ti_sci_msg_req_set_clock_parent *req; ··· 1241 1231 } 1242 1232 req = (struct ti_sci_msg_req_set_clock_parent *)xfer->xfer_buf; 1243 1233 req->dev_id = dev_id; 1244 - req->clk_id = clk_id; 1245 - req->parent_id = parent_id; 1234 + if (clk_id < 255) { 1235 + req->clk_id = clk_id; 1236 + } else { 1237 + req->clk_id = 255; 1238 + req->clk_id_32 = clk_id; 1239 + } 1240 + if (parent_id < 255) { 1241 + req->parent_id = parent_id; 1242 + } else { 1243 + req->parent_id = 255; 1244 + req->parent_id_32 = parent_id; 1245 + } 1246 1246 1247 1247 ret = ti_sci_do_xfer(info, xfer); 1248 1248 if (ret) { ··· 1282 1262 * Return: 0 if all went well, else returns appropriate error value. 1283 1263 */ 1284 1264 static int ti_sci_cmd_clk_get_parent(const struct ti_sci_handle *handle, 1285 - u32 dev_id, u8 clk_id, u8 *parent_id) 1265 + u32 dev_id, u32 clk_id, u32 *parent_id) 1286 1266 { 1287 1267 struct ti_sci_info *info; 1288 1268 struct ti_sci_msg_req_get_clock_parent *req; ··· 1309 1289 } 1310 1290 req = (struct ti_sci_msg_req_get_clock_parent *)xfer->xfer_buf; 1311 1291 req->dev_id = dev_id; 1312 - req->clk_id = clk_id; 1292 + if (clk_id < 255) { 1293 + req->clk_id = clk_id; 1294 + } else { 1295 + req->clk_id = 255; 1296 + req->clk_id_32 = clk_id; 1297 + } 1313 1298 1314 1299 ret = ti_sci_do_xfer(info, xfer); 1315 1300 if (ret) { ··· 1324 1299 1325 1300 resp = (struct ti_sci_msg_resp_get_clock_parent *)xfer->xfer_buf; 1326 1301 1327 - if (!ti_sci_is_response_ack(resp)) 1302 + if (!ti_sci_is_response_ack(resp)) { 1328 1303 ret = -ENODEV; 1329 - else 1330 - *parent_id = resp->parent_id; 1304 + } else { 1305 + if (resp->parent_id < 255) 1306 + *parent_id = resp->parent_id; 1307 + else 1308 + *parent_id = resp->parent_id_32; 1309 + } 1331 1310 1332 1311 fail: 1333 1312 ti_sci_put_one_xfer(&info->minfo, xfer); ··· 1351 1322 * Return: 0 if all went well, else returns appropriate error value. 1352 1323 */ 1353 1324 static int ti_sci_cmd_clk_get_num_parents(const struct ti_sci_handle *handle, 1354 - u32 dev_id, u8 clk_id, 1355 - u8 *num_parents) 1325 + u32 dev_id, u32 clk_id, 1326 + u32 *num_parents) 1356 1327 { 1357 1328 struct ti_sci_info *info; 1358 1329 struct ti_sci_msg_req_get_clock_num_parents *req; ··· 1379 1350 } 1380 1351 req = (struct ti_sci_msg_req_get_clock_num_parents *)xfer->xfer_buf; 1381 1352 req->dev_id = dev_id; 1382 - req->clk_id = clk_id; 1353 + if (clk_id < 255) { 1354 + req->clk_id = clk_id; 1355 + } else { 1356 + req->clk_id = 255; 1357 + req->clk_id_32 = clk_id; 1358 + } 1383 1359 1384 1360 ret = ti_sci_do_xfer(info, xfer); 1385 1361 if (ret) { ··· 1394 1360 1395 1361 resp = (struct ti_sci_msg_resp_get_clock_num_parents *)xfer->xfer_buf; 1396 1362 1397 - if (!ti_sci_is_response_ack(resp)) 1363 + if (!ti_sci_is_response_ack(resp)) { 1398 1364 ret = -ENODEV; 1399 - else 1400 - *num_parents = resp->num_parents; 1365 + } else { 1366 + if (resp->num_parents < 255) 1367 + *num_parents = resp->num_parents; 1368 + else 1369 + *num_parents = resp->num_parents_32; 1370 + } 1401 1371 1402 1372 fail: 1403 1373 ti_sci_put_one_xfer(&info->minfo, xfer); ··· 1429 1391 * Return: 0 if all went well, else returns appropriate error value. 1430 1392 */ 1431 1393 static int ti_sci_cmd_clk_get_match_freq(const struct ti_sci_handle *handle, 1432 - u32 dev_id, u8 clk_id, u64 min_freq, 1394 + u32 dev_id, u32 clk_id, u64 min_freq, 1433 1395 u64 target_freq, u64 max_freq, 1434 1396 u64 *match_freq) 1435 1397 { ··· 1458 1420 } 1459 1421 req = (struct ti_sci_msg_req_query_clock_freq *)xfer->xfer_buf; 1460 1422 req->dev_id = dev_id; 1461 - req->clk_id = clk_id; 1423 + if (clk_id < 255) { 1424 + req->clk_id = clk_id; 1425 + } else { 1426 + req->clk_id = 255; 1427 + req->clk_id_32 = clk_id; 1428 + } 1462 1429 req->min_freq_hz = min_freq; 1463 1430 req->target_freq_hz = target_freq; 1464 1431 req->max_freq_hz = max_freq; ··· 1506 1463 * Return: 0 if all went well, else returns appropriate error value. 1507 1464 */ 1508 1465 static int ti_sci_cmd_clk_set_freq(const struct ti_sci_handle *handle, 1509 - u32 dev_id, u8 clk_id, u64 min_freq, 1466 + u32 dev_id, u32 clk_id, u64 min_freq, 1510 1467 u64 target_freq, u64 max_freq) 1511 1468 { 1512 1469 struct ti_sci_info *info; ··· 1534 1491 } 1535 1492 req = (struct ti_sci_msg_req_set_clock_freq *)xfer->xfer_buf; 1536 1493 req->dev_id = dev_id; 1537 - req->clk_id = clk_id; 1494 + if (clk_id < 255) { 1495 + req->clk_id = clk_id; 1496 + } else { 1497 + req->clk_id = 255; 1498 + req->clk_id_32 = clk_id; 1499 + } 1538 1500 req->min_freq_hz = min_freq; 1539 1501 req->target_freq_hz = target_freq; 1540 1502 req->max_freq_hz = max_freq; ··· 1572 1524 * Return: 0 if all went well, else returns appropriate error value. 1573 1525 */ 1574 1526 static int ti_sci_cmd_clk_get_freq(const struct ti_sci_handle *handle, 1575 - u32 dev_id, u8 clk_id, u64 *freq) 1527 + u32 dev_id, u32 clk_id, u64 *freq) 1576 1528 { 1577 1529 struct ti_sci_info *info; 1578 1530 struct ti_sci_msg_req_get_clock_freq *req; ··· 1599 1551 } 1600 1552 req = (struct ti_sci_msg_req_get_clock_freq *)xfer->xfer_buf; 1601 1553 req->dev_id = dev_id; 1602 - req->clk_id = clk_id; 1554 + if (clk_id < 255) { 1555 + req->clk_id = clk_id; 1556 + } else { 1557 + req->clk_id = 255; 1558 + req->clk_id_32 = clk_id; 1559 + } 1603 1560 1604 1561 ret = ti_sci_do_xfer(info, xfer); 1605 1562 if (ret) { ··· 2402 2349 if (!res) 2403 2350 return ERR_PTR(-ENOMEM); 2404 2351 2405 - res->sets = of_property_count_elems_of_size(dev_of_node(dev), of_prop, 2406 - sizeof(u32)); 2407 - if (res->sets < 0) { 2352 + ret = of_property_count_elems_of_size(dev_of_node(dev), of_prop, 2353 + sizeof(u32)); 2354 + if (ret < 0) { 2408 2355 dev_err(dev, "%s resource type ids not available\n", of_prop); 2409 - return ERR_PTR(res->sets); 2356 + return ERR_PTR(ret); 2410 2357 } 2358 + res->sets = ret; 2411 2359 2412 2360 res->desc = devm_kcalloc(dev, res->sets, sizeof(*res->desc), 2413 2361 GFP_KERNEL);
+52 -11
drivers/firmware/ti_sci.h
··· 202 202 * @dev_id: Device identifier this request is for 203 203 * @clk_id: Clock identifier for the device for this request. 204 204 * Each device has it's own set of clock inputs. This indexes 205 - * which clock input to modify. 205 + * which clock input to modify. Set to 255 if clock ID is 206 + * greater than or equal to 255. 206 207 * @request_state: Request the state for the clock to be set to. 207 208 * MSG_CLOCK_SW_STATE_UNREQ: The IP does not require this clock, 208 209 * it can be disabled, regardless of the state of the device ··· 214 213 * being required by the device.(default) 215 214 * MSG_CLOCK_SW_STATE_REQ: Configure the clock to be enabled, 216 215 * regardless of the state of the device. 216 + * @clk_id_32: Clock identifier for the device for this request. 217 + * Only to be used if the clock ID is greater than or equal to 218 + * 255. 217 219 * 218 220 * Normally, all required clocks are managed by TISCI entity, this is used 219 221 * only for specific control *IF* required. Auto managed state is ··· 238 234 #define MSG_CLOCK_SW_STATE_AUTO 1 239 235 #define MSG_CLOCK_SW_STATE_REQ 2 240 236 u8 request_state; 237 + u32 clk_id_32; 241 238 } __packed; 242 239 243 240 /** ··· 247 242 * @dev_id: Device identifier this request is for 248 243 * @clk_id: Clock identifier for the device for this request. 249 244 * Each device has it's own set of clock inputs. This indexes 250 - * which clock input to get state of. 245 + * which clock input to get state of. Set to 255 if the clock 246 + * ID is greater than or equal to 255. 247 + * @clk_id_32: Clock identifier for the device for the request. 248 + * Only to be used if the clock ID is greater than or equal to 249 + * 255. 251 250 * 252 251 * Request type is TI_SCI_MSG_GET_CLOCK_STATE, response is state 253 252 * of the clock ··· 260 251 struct ti_sci_msg_hdr hdr; 261 252 u32 dev_id; 262 253 u8 clk_id; 254 + u32 clk_id_32; 263 255 } __packed; 264 256 265 257 /** ··· 288 278 * @dev_id: Device identifier this request is for 289 279 * @clk_id: Clock identifier for the device for this request. 290 280 * Each device has it's own set of clock inputs. This indexes 291 - * which clock input to modify. 281 + * which clock input to modify. Set to 255 if clock ID is 282 + * greater than or equal to 255. 292 283 * @parent_id: The new clock parent is selectable by an index via this 293 - * parameter. 284 + * parameter. Set to 255 if clock ID is greater than or 285 + * equal to 255. 286 + * @clk_id_32: Clock identifier if @clk_id field is 255. 287 + * @parent_id_32: Parent identifier if @parent_id is 255. 294 288 * 295 289 * Request type is TI_SCI_MSG_SET_CLOCK_PARENT, response is generic 296 290 * ACK / NACK message. ··· 304 290 u32 dev_id; 305 291 u8 clk_id; 306 292 u8 parent_id; 293 + u32 clk_id_32; 294 + u32 parent_id_32; 307 295 } __packed; 308 296 309 297 /** ··· 314 298 * @dev_id: Device identifier this request is for 315 299 * @clk_id: Clock identifier for the device for this request. 316 300 * Each device has it's own set of clock inputs. This indexes 317 - * which clock input to get the parent for. 301 + * which clock input to get the parent for. If this field 302 + * contains 255, the actual clock identifier is stored in 303 + * @clk_id_32. 304 + * @clk_id_32: Clock identifier if the @clk_id field contains 255. 318 305 * 319 306 * Request type is TI_SCI_MSG_GET_CLOCK_PARENT, response is parent information 320 307 */ ··· 325 306 struct ti_sci_msg_hdr hdr; 326 307 u32 dev_id; 327 308 u8 clk_id; 309 + u32 clk_id_32; 328 310 } __packed; 329 311 330 312 /** 331 313 * struct ti_sci_msg_resp_get_clock_parent - Response with clock parent 332 314 * @hdr: Generic Header 333 - * @parent_id: The current clock parent 315 + * @parent_id: The current clock parent. If set to 255, the current parent 316 + * ID can be found from the @parent_id_32 field. 317 + * @parent_id_32: Current clock parent if @parent_id field is set to 318 + * 255. 334 319 * 335 320 * Response to TI_SCI_MSG_GET_CLOCK_PARENT. 336 321 */ 337 322 struct ti_sci_msg_resp_get_clock_parent { 338 323 struct ti_sci_msg_hdr hdr; 339 324 u8 parent_id; 325 + u32 parent_id_32; 340 326 } __packed; 341 327 342 328 /** 343 329 * struct ti_sci_msg_req_get_clock_num_parents - Request to get clock parents 344 330 * @hdr: Generic header 345 331 * @dev_id: Device identifier this request is for 346 - * @clk_id: Clock identifier for the device for this request. 332 + * @clk_id: Clock identifier for the device for this request. Set to 333 + * 255 if clock ID is greater than or equal to 255. 334 + * @clk_id_32: Clock identifier if the @clk_id field contains 255. 347 335 * 348 336 * This request provides information about how many clock parent options 349 337 * are available for a given clock to a device. This is typically used ··· 363 337 struct ti_sci_msg_hdr hdr; 364 338 u32 dev_id; 365 339 u8 clk_id; 340 + u32 clk_id_32; 366 341 } __packed; 367 342 368 343 /** 369 344 * struct ti_sci_msg_resp_get_clock_num_parents - Response for get clk parents 370 345 * @hdr: Generic header 371 - * @num_parents: Number of clock parents 346 + * @num_parents: Number of clock parents. If set to 255, the actual 347 + * number of parents is stored into @num_parents_32 348 + * field instead. 349 + * @num_parents_32: Number of clock parents if @num_parents field is 350 + * set to 255. 372 351 * 373 352 * Response to TI_SCI_MSG_GET_NUM_CLOCK_PARENTS 374 353 */ 375 354 struct ti_sci_msg_resp_get_clock_num_parents { 376 355 struct ti_sci_msg_hdr hdr; 377 356 u8 num_parents; 357 + u32 num_parents_32; 378 358 } __packed; 379 359 380 360 /** ··· 395 363 * @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum 396 364 * allowable programmed frequency and does not account for clock 397 365 * tolerances and jitter. 398 - * @clk_id: Clock identifier for the device for this request. 366 + * @clk_id: Clock identifier for the device for this request. Set to 367 + * 255 if clock identifier is greater than or equal to 255. 368 + * @clk_id_32: Clock identifier if @clk_id is set to 255. 399 369 * 400 370 * NOTE: Normally clock frequency management is automatically done by TISCI 401 371 * entity. In case of specific requests, TISCI evaluates capability to achieve ··· 414 380 u64 target_freq_hz; 415 381 u64 max_freq_hz; 416 382 u8 clk_id; 383 + u32 clk_id_32; 417 384 } __packed; 418 385 419 386 /** ··· 442 407 * @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum 443 408 * allowable programmed frequency and does not account for clock 444 409 * tolerances and jitter. 445 - * @clk_id: Clock identifier for the device for this request. 410 + * @clk_id: Clock identifier for the device for this request. Set to 411 + * 255 if clock ID is greater than or equal to 255. 412 + * @clk_id_32: Clock identifier if @clk_id field is set to 255. 446 413 * 447 414 * NOTE: Normally clock frequency management is automatically done by TISCI 448 415 * entity. In case of specific requests, TISCI evaluates capability to achieve ··· 473 436 u64 target_freq_hz; 474 437 u64 max_freq_hz; 475 438 u8 clk_id; 439 + u32 clk_id_32; 476 440 } __packed; 477 441 478 442 /** 479 443 * struct ti_sci_msg_req_get_clock_freq - Request to get the clock frequency 480 444 * @hdr: Generic Header 481 445 * @dev_id: Device identifier this request is for 482 - * @clk_id: Clock identifier for the device for this request. 446 + * @clk_id: Clock identifier for the device for this request. Set to 447 + * 255 if clock ID is greater than or equal to 255. 448 + * @clk_id_32: Clock identifier if @clk_id field is set to 255. 483 449 * 484 450 * NOTE: Normally clock frequency management is automatically done by TISCI 485 451 * entity. In some cases, clock frequencies are configured by host. ··· 494 454 struct ti_sci_msg_hdr hdr; 495 455 u32 dev_id; 496 456 u8 clk_id; 457 + u32 clk_id_32; 497 458 } __packed; 498 459 499 460 /**
+1
include/dt-bindings/clock/exynos4.h
··· 187 187 #define CLK_MIPI_HSI 349 /* Exynos4210 only */ 188 188 #define CLK_PIXELASYNCM0 351 189 189 #define CLK_PIXELASYNCM1 352 190 + #define CLK_ASYNC_G3D 353 /* Exynos4x12 only */ 190 191 #define CLK_PWM_ISP_SCLK 379 /* Exynos4x12 only */ 191 192 #define CLK_SPI0_ISP_SCLK 380 /* Exynos4x12 only */ 192 193 #define CLK_SPI1_ISP_SCLK 381 /* Exynos4x12 only */
+17 -1
include/dt-bindings/clock/exynos5420.h
··· 60 60 #define CLK_MAU_EPLL 159 61 61 #define CLK_SCLK_HSIC_12M 160 62 62 #define CLK_SCLK_MPHY_IXTAL24 161 63 + #define CLK_SCLK_BPLL 162 63 64 64 65 /* gate clocks */ 65 66 #define CLK_UART0 257 ··· 196 195 #define CLK_ACLK432_CAM 518 197 196 #define CLK_ACLK_FL1550_CAM 519 198 197 #define CLK_ACLK550_CAM 520 198 + #define CLK_CLKM_PHY0 521 199 + #define CLK_CLKM_PHY1 522 200 + #define CLK_ACLK_PPMU_DREX0_0 523 201 + #define CLK_ACLK_PPMU_DREX0_1 524 202 + #define CLK_ACLK_PPMU_DREX1_0 525 203 + #define CLK_ACLK_PPMU_DREX1_1 526 204 + #define CLK_PCLK_PPMU_DREX0_0 527 205 + #define CLK_PCLK_PPMU_DREX0_1 528 206 + #define CLK_PCLK_PPMU_DREX1_0 529 207 + #define CLK_PCLK_PPMU_DREX1_1 530 199 208 200 209 /* mux clocks */ 201 210 #define CLK_MOUT_HDMI 640 ··· 228 217 #define CLK_MOUT_EPLL 657 229 218 #define CLK_MOUT_MAU_EPLL 658 230 219 #define CLK_MOUT_USER_MAU_EPLL 659 220 + #define CLK_MOUT_SCLK_SPLL 660 221 + #define CLK_MOUT_MX_MSPLL_CCORE_PHY 661 231 222 232 223 /* divider clocks */ 233 224 #define CLK_DOUT_PIXEL 768 ··· 261 248 #define CLK_DOUT_CCLK_DREX0 794 262 249 #define CLK_DOUT_CLK2X_PHY0 795 263 250 #define CLK_DOUT_PCLK_CORE_MEM 796 251 + #define CLK_FF_DOUT_SPLL2 797 252 + #define CLK_DOUT_PCLK_DREX0 798 253 + #define CLK_DOUT_PCLK_DREX1 799 264 254 265 255 /* must be greater than maximal clock id */ 266 - #define CLK_NR_CLKS 797 256 + #define CLK_NR_CLKS 800 267 257 268 258 #endif /* _DT_BINDINGS_CLOCK_EXYNOS_5420_H */
+1
include/dt-bindings/clock/g12a-clkc.h
··· 136 136 #define CLKID_VDEC_1 204 137 137 #define CLKID_VDEC_HEVC 207 138 138 #define CLKID_VDEC_HEVCF 210 139 + #define CLKID_TS 212 139 140 140 141 #endif /* __G12A_CLKC_H */
+10 -1
include/dt-bindings/clock/imx8mm-clock.h
··· 239 239 240 240 #define IMX8MM_CLK_NAND_USDHC_BUS_RAWNAND_CLK 222 241 241 242 - #define IMX8MM_CLK_END 223 242 + #define IMX8MM_CLK_GPIO1_ROOT 223 243 + #define IMX8MM_CLK_GPIO2_ROOT 224 244 + #define IMX8MM_CLK_GPIO3_ROOT 225 245 + #define IMX8MM_CLK_GPIO4_ROOT 226 246 + #define IMX8MM_CLK_GPIO5_ROOT 227 247 + 248 + #define IMX8MM_CLK_SNVS_ROOT 228 249 + #define IMX8MM_CLK_GIC 229 250 + 251 + #define IMX8MM_CLK_END 230 243 252 244 253 #endif
+4 -1
include/dt-bindings/clock/imx8mq-clock.h
··· 400 400 #define IMX8MQ_CLK_GPIO4_ROOT 262 401 401 #define IMX8MQ_CLK_GPIO5_ROOT 263 402 402 403 - #define IMX8MQ_CLK_END 264 403 + #define IMX8MQ_CLK_SNVS_ROOT 264 404 + #define IMX8MQ_CLK_GIC 265 405 + 406 + #define IMX8MQ_CLK_END 266 404 407 #endif /* __DT_BINDINGS_CLOCK_IMX8MQ_H */
+3
include/dt-bindings/clock/meson8b-clkc.h
··· 112 112 #define CLKID_VDEC_HCODEC 199 113 113 #define CLKID_VDEC_2 202 114 114 #define CLKID_VDEC_HEVC 206 115 + #define CLKID_CTS_AMCLK 209 116 + #define CLKID_CTS_MCLK_I958 212 117 + #define CLKID_CTS_I958 213 115 118 116 119 #endif /* __MESON8B_CLKC_H */
+17
include/dt-bindings/clock/mt8516-clk.h
··· 208 208 #define CLK_TOP_MSDC2_INFRA 176 209 209 #define CLK_TOP_NR_CLK 177 210 210 211 + /* AUDSYS */ 212 + 213 + #define CLK_AUD_AFE 0 214 + #define CLK_AUD_I2S 1 215 + #define CLK_AUD_22M 2 216 + #define CLK_AUD_24M 3 217 + #define CLK_AUD_INTDIR 4 218 + #define CLK_AUD_APLL2_TUNER 5 219 + #define CLK_AUD_APLL_TUNER 6 220 + #define CLK_AUD_HDMI 7 221 + #define CLK_AUD_SPDF 8 222 + #define CLK_AUD_ADC 9 223 + #define CLK_AUD_DAC 10 224 + #define CLK_AUD_DAC_PREDIS 11 225 + #define CLK_AUD_TML 12 226 + #define CLK_AUD_NR_CLK 13 227 + 211 228 #endif /* _DT_BINDINGS_CLK_MT8516_H */
+7
include/dt-bindings/clock/qcom,gcc-qcs404.h
··· 166 166 #define GCC_PCIEPHY_0_PHY_BCR 12 167 167 #define GCC_EMAC_BCR 13 168 168 #define GCC_CDSP_RESTART 14 169 + #define GCC_PCIE_0_AXI_MASTER_STICKY_ARES 15 170 + #define GCC_PCIE_0_AHB_ARES 16 171 + #define GCC_PCIE_0_AXI_SLAVE_ARES 17 172 + #define GCC_PCIE_0_AXI_MASTER_ARES 18 173 + #define GCC_PCIE_0_CORE_STICKY_ARES 19 174 + #define GCC_PCIE_0_SLEEP_ARES 20 175 + #define GCC_PCIE_0_PIPE_ARES 21 169 176 170 177 #endif
+29
include/dt-bindings/clock/qcom,gpucc-msm8998.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (c) 2019, Jeffrey Hugo 4 + */ 5 + 6 + #ifndef _DT_BINDINGS_CLK_MSM_GPUCC_8998_H 7 + #define _DT_BINDINGS_CLK_MSM_GPUCC_8998_H 8 + 9 + #define GPUPLL0 0 10 + #define GPUPLL0_OUT_EVEN 1 11 + #define RBCPR_CLK_SRC 2 12 + #define GFX3D_CLK_SRC 3 13 + #define RBBMTIMER_CLK_SRC 4 14 + #define GFX3D_ISENSE_CLK_SRC 5 15 + #define RBCPR_CLK 6 16 + #define GFX3D_CLK 7 17 + #define RBBMTIMER_CLK 8 18 + #define GFX3D_ISENSE_CLK 9 19 + #define GPUCC_CXO_CLK 10 20 + 21 + #define GPU_CX_BCR 0 22 + #define RBCPR_BCR 1 23 + #define GPU_GX_BCR 2 24 + #define GPU_ISENSE_BCR 3 25 + 26 + #define GPU_CX_GDSC 1 27 + #define GPU_GX_GDSC 2 28 + 29 + #endif
+1
include/dt-bindings/clock/rk3228-cru.h
··· 64 64 #define SCLK_WIFI 141 65 65 #define SCLK_OTGPHY0 142 66 66 #define SCLK_OTGPHY1 143 67 + #define SCLK_HDMI_PHY 144 67 68 68 69 /* dclk gates */ 69 70 #define DCLK_VOP 190
+1
include/dt-bindings/clock/rk3328-cru.h
··· 164 164 #define PCLK_DCF 233 165 165 #define PCLK_SARADC 234 166 166 #define PCLK_ACODECPHY 235 167 + #define PCLK_WDT 236 167 168 168 169 /* hclk gates */ 169 170 #define HCLK_PERI 308
+3 -1
include/dt-bindings/clock/stratix10-clock.h
··· 79 79 #define STRATIX10_USB_CLK 59 80 80 #define STRATIX10_SPI_M_CLK 60 81 81 #define STRATIX10_NAND_CLK 61 82 - #define STRATIX10_NUM_CLKS 62 82 + #define STRATIX10_NAND_X_CLK 62 83 + #define STRATIX10_NAND_ECC_CLK 63 84 + #define STRATIX10_NUM_CLKS 64 83 85 84 86 #endif /* __STRATIX10_CLOCK_H */
+96 -7
include/linux/clk-provider.h
··· 9 9 #include <linux/of.h> 10 10 #include <linux/of_clk.h> 11 11 12 - #ifdef CONFIG_COMMON_CLK 13 - 14 12 /* 15 13 * flags used across common struct clk. these flags should only affect the 16 14 * top-level framework. custom flags for dealing with hardware specifics ··· 805 807 /* helper functions */ 806 808 const char *__clk_get_name(const struct clk *clk); 807 809 const char *clk_hw_get_name(const struct clk_hw *hw); 810 + #ifdef CONFIG_COMMON_CLK 808 811 struct clk_hw *__clk_get_hw(struct clk *clk); 812 + #else 813 + static inline struct clk_hw *__clk_get_hw(struct clk *clk) 814 + { 815 + return (struct clk_hw *)clk; 816 + } 817 + #endif 809 818 unsigned int clk_hw_get_num_parents(const struct clk_hw *hw); 810 819 struct clk_hw *clk_hw_get_parent(const struct clk_hw *hw); 811 820 struct clk_hw *clk_hw_get_parent_by_index(const struct clk_hw *hw, ··· 872 867 */ 873 868 unsigned long clk_hw_round_rate(struct clk_hw *hw, unsigned long rate); 874 869 875 - struct of_device_id; 876 - 877 870 struct clk_onecell_data { 878 871 struct clk **clks; 879 872 unsigned int clk_num; ··· 881 878 unsigned int num; 882 879 struct clk_hw *hws[]; 883 880 }; 884 - 885 - extern struct of_device_id __clk_of_table; 886 881 887 882 #define CLK_OF_DECLARE(name, compat, fn) OF_DECLARE_1(clk, name, compat, fn) 888 883 ··· 905 904 .ops = _ops, \ 906 905 }) 907 906 907 + #define CLK_HW_INIT_HW(_name, _parent, _ops, _flags) \ 908 + (&(struct clk_init_data) { \ 909 + .flags = _flags, \ 910 + .name = _name, \ 911 + .parent_hws = (const struct clk_hw*[]) { _parent }, \ 912 + .num_parents = 1, \ 913 + .ops = _ops, \ 914 + }) 915 + 916 + /* 917 + * This macro is intended for drivers to be able to share the otherwise 918 + * individual struct clk_hw[] compound literals created by the compiler 919 + * when using CLK_HW_INIT_HW. It does NOT support multiple parents. 920 + */ 921 + #define CLK_HW_INIT_HWS(_name, _parent, _ops, _flags) \ 922 + (&(struct clk_init_data) { \ 923 + .flags = _flags, \ 924 + .name = _name, \ 925 + .parent_hws = _parent, \ 926 + .num_parents = 1, \ 927 + .ops = _ops, \ 928 + }) 929 + 930 + #define CLK_HW_INIT_FW_NAME(_name, _parent, _ops, _flags) \ 931 + (&(struct clk_init_data) { \ 932 + .flags = _flags, \ 933 + .name = _name, \ 934 + .parent_data = (const struct clk_parent_data[]) { \ 935 + { .fw_name = _parent }, \ 936 + }, \ 937 + .num_parents = 1, \ 938 + .ops = _ops, \ 939 + }) 940 + 908 941 #define CLK_HW_INIT_PARENTS(_name, _parents, _ops, _flags) \ 909 942 (&(struct clk_init_data) { \ 910 943 .flags = _flags, \ 911 944 .name = _name, \ 912 945 .parent_names = _parents, \ 946 + .num_parents = ARRAY_SIZE(_parents), \ 947 + .ops = _ops, \ 948 + }) 949 + 950 + #define CLK_HW_INIT_PARENTS_HW(_name, _parents, _ops, _flags) \ 951 + (&(struct clk_init_data) { \ 952 + .flags = _flags, \ 953 + .name = _name, \ 954 + .parent_hws = _parents, \ 955 + .num_parents = ARRAY_SIZE(_parents), \ 956 + .ops = _ops, \ 957 + }) 958 + 959 + #define CLK_HW_INIT_PARENTS_DATA(_name, _parents, _ops, _flags) \ 960 + (&(struct clk_init_data) { \ 961 + .flags = _flags, \ 962 + .name = _name, \ 963 + .parent_data = _parents, \ 913 964 .num_parents = ARRAY_SIZE(_parents), \ 914 965 .ops = _ops, \ 915 966 }) ··· 984 931 _parent, \ 985 932 &clk_fixed_factor_ops, \ 986 933 _flags), \ 934 + } 935 + 936 + #define CLK_FIXED_FACTOR_HW(_struct, _name, _parent, \ 937 + _div, _mult, _flags) \ 938 + struct clk_fixed_factor _struct = { \ 939 + .div = _div, \ 940 + .mult = _mult, \ 941 + .hw.init = CLK_HW_INIT_HW(_name, \ 942 + _parent, \ 943 + &clk_fixed_factor_ops, \ 944 + _flags), \ 945 + } 946 + 947 + /* 948 + * This macro allows the driver to reuse the _parent array for multiple 949 + * fixed factor clk declarations. 950 + */ 951 + #define CLK_FIXED_FACTOR_HWS(_struct, _name, _parent, \ 952 + _div, _mult, _flags) \ 953 + struct clk_fixed_factor _struct = { \ 954 + .div = _div, \ 955 + .mult = _mult, \ 956 + .hw.init = CLK_HW_INIT_HWS(_name, \ 957 + _parent, \ 958 + &clk_fixed_factor_ops, \ 959 + _flags), \ 960 + } 961 + 962 + #define CLK_FIXED_FACTOR_FW_NAME(_struct, _name, _parent, \ 963 + _div, _mult, _flags) \ 964 + struct clk_fixed_factor _struct = { \ 965 + .div = _div, \ 966 + .mult = _mult, \ 967 + .hw.init = CLK_HW_INIT_FW_NAME(_name, \ 968 + _parent, \ 969 + &clk_fixed_factor_ops, \ 970 + _flags), \ 987 971 } 988 972 989 973 #ifdef CONFIG_OF ··· 1109 1019 1110 1020 void clk_gate_restore_context(struct clk_hw *hw); 1111 1021 1112 - #endif /* CONFIG_COMMON_CLK */ 1113 1022 #endif /* CLK_PROVIDER_H */
+47
include/linux/clk.h
··· 329 329 */ 330 330 int __must_check clk_bulk_get_all(struct device *dev, 331 331 struct clk_bulk_data **clks); 332 + 333 + /** 334 + * clk_bulk_get_optional - lookup and obtain a number of references to clock producer 335 + * @dev: device for clock "consumer" 336 + * @num_clks: the number of clk_bulk_data 337 + * @clks: the clk_bulk_data table of consumer 338 + * 339 + * Behaves the same as clk_bulk_get() except where there is no clock producer. 340 + * In this case, instead of returning -ENOENT, the function returns 0 and 341 + * NULL for a clk for which a clock producer could not be determined. 342 + */ 343 + int __must_check clk_bulk_get_optional(struct device *dev, int num_clks, 344 + struct clk_bulk_data *clks); 332 345 /** 333 346 * devm_clk_bulk_get - managed get multiple clk consumers 334 347 * @dev: device for clock "consumer" ··· 356 343 */ 357 344 int __must_check devm_clk_bulk_get(struct device *dev, int num_clks, 358 345 struct clk_bulk_data *clks); 346 + /** 347 + * devm_clk_bulk_get_optional - managed get multiple optional consumer clocks 348 + * @dev: device for clock "consumer" 349 + * @clks: pointer to the clk_bulk_data table of consumer 350 + * 351 + * Behaves the same as devm_clk_bulk_get() except where there is no clock 352 + * producer. In this case, instead of returning -ENOENT, the function returns 353 + * NULL for given clk. It is assumed all clocks in clk_bulk_data are optional. 354 + * 355 + * Returns 0 if all clocks specified in clk_bulk_data table are obtained 356 + * successfully or for any clk there was no clk provider available, otherwise 357 + * returns valid IS_ERR() condition containing errno. 358 + * The implementation uses @dev and @clk_bulk_data.id to determine the 359 + * clock consumer, and thereby the clock producer. 360 + * The clock returned is stored in each @clk_bulk_data.clk field. 361 + * 362 + * Drivers must assume that the clock source is not enabled. 363 + * 364 + * clk_bulk_get should not be called from within interrupt context. 365 + */ 366 + int __must_check devm_clk_bulk_get_optional(struct device *dev, int num_clks, 367 + struct clk_bulk_data *clks); 359 368 /** 360 369 * devm_clk_bulk_get_all - managed get multiple clk consumers 361 370 * @dev: device for clock "consumer" ··· 750 715 return 0; 751 716 } 752 717 718 + static inline int __must_check clk_bulk_get_optional(struct device *dev, 719 + int num_clks, struct clk_bulk_data *clks) 720 + { 721 + return 0; 722 + } 723 + 753 724 static inline int __must_check clk_bulk_get_all(struct device *dev, 754 725 struct clk_bulk_data **clks) 755 726 { ··· 775 734 776 735 static inline int __must_check devm_clk_bulk_get(struct device *dev, int num_clks, 777 736 struct clk_bulk_data *clks) 737 + { 738 + return 0; 739 + } 740 + 741 + static inline int __must_check devm_clk_bulk_get_optional(struct device *dev, 742 + int num_clks, struct clk_bulk_data *clks) 778 743 { 779 744 return 0; 780 745 }
+14 -14
include/linux/soc/ti/ti_sci_protocol.h
··· 166 166 * managed by driver for that purpose. 167 167 */ 168 168 struct ti_sci_clk_ops { 169 - int (*get_clock)(const struct ti_sci_handle *handle, u32 did, u8 cid, 169 + int (*get_clock)(const struct ti_sci_handle *handle, u32 did, u32 cid, 170 170 bool needs_ssc, bool can_change_freq, 171 171 bool enable_input_term); 172 - int (*idle_clock)(const struct ti_sci_handle *handle, u32 did, u8 cid); 173 - int (*put_clock)(const struct ti_sci_handle *handle, u32 did, u8 cid); 174 - int (*is_auto)(const struct ti_sci_handle *handle, u32 did, u8 cid, 172 + int (*idle_clock)(const struct ti_sci_handle *handle, u32 did, u32 cid); 173 + int (*put_clock)(const struct ti_sci_handle *handle, u32 did, u32 cid); 174 + int (*is_auto)(const struct ti_sci_handle *handle, u32 did, u32 cid, 175 175 bool *req_state); 176 - int (*is_on)(const struct ti_sci_handle *handle, u32 did, u8 cid, 176 + int (*is_on)(const struct ti_sci_handle *handle, u32 did, u32 cid, 177 177 bool *req_state, bool *current_state); 178 - int (*is_off)(const struct ti_sci_handle *handle, u32 did, u8 cid, 178 + int (*is_off)(const struct ti_sci_handle *handle, u32 did, u32 cid, 179 179 bool *req_state, bool *current_state); 180 - int (*set_parent)(const struct ti_sci_handle *handle, u32 did, u8 cid, 181 - u8 parent_id); 182 - int (*get_parent)(const struct ti_sci_handle *handle, u32 did, u8 cid, 183 - u8 *parent_id); 180 + int (*set_parent)(const struct ti_sci_handle *handle, u32 did, u32 cid, 181 + u32 parent_id); 182 + int (*get_parent)(const struct ti_sci_handle *handle, u32 did, u32 cid, 183 + u32 *parent_id); 184 184 int (*get_num_parents)(const struct ti_sci_handle *handle, u32 did, 185 - u8 cid, u8 *num_parents); 185 + u32 cid, u32 *num_parents); 186 186 int (*get_best_match_freq)(const struct ti_sci_handle *handle, u32 did, 187 - u8 cid, u64 min_freq, u64 target_freq, 187 + u32 cid, u64 min_freq, u64 target_freq, 188 188 u64 max_freq, u64 *match_freq); 189 - int (*set_freq)(const struct ti_sci_handle *handle, u32 did, u8 cid, 189 + int (*set_freq)(const struct ti_sci_handle *handle, u32 did, u32 cid, 190 190 u64 min_freq, u64 target_freq, u64 max_freq); 191 - int (*get_freq)(const struct ti_sci_handle *handle, u32 did, u8 cid, 191 + int (*get_freq)(const struct ti_sci_handle *handle, u32 did, u32 cid, 192 192 u64 *current_freq); 193 193 }; 194 194