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 batch of clk driver updates contains almost no new SoC support.
Instead there's a treewide patch series from Maxime that makes
clk_ops::determine_rate mandatory for muxes.

Beyond that core framework change we have the usual pile of clk driver
updates such as migrating i2c drivers to use .probe() again or
YAMLfication of clk DT bindings so we can validate DTBs.

Overall the SoCs that got the most updates this time around in terms
of diffstat are the Amlogic and Mediatek drivers because they added
new SoC support or fixed up various drivers to have proper data.

In general things look kinda quiet. I suspect the core framework
change may still shake out some problems after the merge window,
mostly because not everyone tests linux-next where that series has
been for some number of weeks. I saw that there's at least one pending
fix for Tegra that needs to be wrapped up into a proper patch. I'll
try to catch those bits before the window closes so that -rc1 is
bootable. More details below.

Core:
- Make clk_ops::determine_rate mandatory for muxes

New Drivers:
- Add amlogic a1 SoC family PLL and peripheral clock controller support

Updates:
- Handle allocation failures from kasprintf() and friends
- Migrate platform clk drivers to .remove_new()
- Migrate i2c clk drivers to .probe() instead of .probe_new()
- Remove CLK_SET_PARENT from all Mediatek MSDC core clocks
- Add infra_ao reset support for Mediatek MT8188 SoCs
- Align driver_data to i2c_device_id tables in some i2c clk drivers
- Use device_get_match_data() in vc5 clk driver
- New Kconfig symbol name (SOC_MICROCHIP_POLARFIRE) for Microchip
FPGA clock drivers
- Use of_property_read_bool() to read "microchip,pic32mzda-sosc"
boolean DT property in clk-pic32mzda
- Convert AT91 clock dt-bindings to YAML
- Remove CLK_SET_RATE_PARENT flag from LDB clocks on i.MX6SX
- Keep i.MX UART clocks enabled during kernel boot if earlycon is set
- Drop imx_unregister_clocks() as there are no users anymore
- Switch to _safe iterator on imx_clk_scu_unregister() to avoid use
after free
- Add determine_rate op to the imx8m composite clock
- Use device managed API for iomap and kzalloc for i.MXRT1050,
i.MX8MN, i.MX8MP and i.MX93 clock controller drivers
- Add missing interrupt DT property for the i.MX8M clock controller
- Re-add support for Exynos4212 clock controller because we are
re-introducing the SoC in the mainline
- Add CONFIG_OF dependency to Samsung clk Kconfig symbols to solve
some objtool warnings
- Preselect PLL MIPI as TCON0 parent for Allwinner A64 SoC
- Convert the Renesas clock drivers to readl_poll_timeout_atomic()
- Add PWM clock on Renesas R-Car V3U
- Fix PLL5 on Renesas RZ/G2L and RZ/V2L"

* tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: (149 commits)
clk: fix typo in clk_hw_register_fixed_rate_parent_data() macro
clk: Fix memory leak in devm_clk_notifier_register()
clk: mvebu: Iterate over possible CPUs instead of DT CPU nodes
clk: mvebu: Use of_get_cpu_hwid() to read CPU ID
MAINTAINERS: Add Marvell mvebu clock drivers
clk: clocking-wizard: check return value of devm_kasprintf()
clk: ti: clkctrl: check return value of kasprintf()
clk: keystone: sci-clk: check return value of kasprintf()
clk: si5341: free unused memory on probe failure
clk: si5341: check return value of {devm_}kasprintf()
clk: si5341: return error if one synth clock registration fails
clk: cdce925: check return value of kasprintf()
clk: vc5: check memory returned by kasprintf()
clk: mediatek: clk-mt8173-apmixedsys: Fix iomap not released issue
clk: mediatek: clk-mt8173-apmixedsys: Fix return value for of_iomap() error
clk: mediatek: clk-mtk: Grab iomem pointer for divider clocks
clk: keystone: syscon-clk: Add support for audio refclk
dt-bindings: clock: Add binding documentation for TI Audio REFCLK
dt-bindings: clock: ehrpwm: Remove unneeded syscon compatible
clk: keystone: syscon-clk: Allow the clock node to not be of type syscon
...

+4645 -841
+73
Documentation/devicetree/bindings/clock/amlogic,a1-peripherals-clkc.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/clock/amlogic,a1-peripherals-clkc.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Amlogic A1 Peripherals Clock Control Unit 8 + 9 + maintainers: 10 + - Neil Armstrong <neil.armstrong@linaro.org> 11 + - Jerome Brunet <jbrunet@baylibre.com> 12 + - Jian Hu <jian.hu@jian.hu.com> 13 + - Dmitry Rokosov <ddrokosov@sberdevices.ru> 14 + 15 + properties: 16 + compatible: 17 + const: amlogic,a1-peripherals-clkc 18 + 19 + '#clock-cells': 20 + const: 1 21 + 22 + reg: 23 + maxItems: 1 24 + 25 + clocks: 26 + items: 27 + - description: input fixed pll div2 28 + - description: input fixed pll div3 29 + - description: input fixed pll div5 30 + - description: input fixed pll div7 31 + - description: input hifi pll 32 + - description: input oscillator (usually at 24MHz) 33 + 34 + clock-names: 35 + items: 36 + - const: fclk_div2 37 + - const: fclk_div3 38 + - const: fclk_div5 39 + - const: fclk_div7 40 + - const: hifi_pll 41 + - const: xtal 42 + 43 + required: 44 + - compatible 45 + - '#clock-cells' 46 + - reg 47 + - clocks 48 + - clock-names 49 + 50 + additionalProperties: false 51 + 52 + examples: 53 + - | 54 + #include <dt-bindings/clock/amlogic,a1-pll-clkc.h> 55 + apb { 56 + #address-cells = <2>; 57 + #size-cells = <2>; 58 + 59 + clock-controller@800 { 60 + compatible = "amlogic,a1-peripherals-clkc"; 61 + reg = <0 0x800 0 0x104>; 62 + #clock-cells = <1>; 63 + clocks = <&clkc_pll CLKID_FCLK_DIV2>, 64 + <&clkc_pll CLKID_FCLK_DIV3>, 65 + <&clkc_pll CLKID_FCLK_DIV5>, 66 + <&clkc_pll CLKID_FCLK_DIV7>, 67 + <&clkc_pll CLKID_HIFI_PLL>, 68 + <&xtal>; 69 + clock-names = "fclk_div2", "fclk_div3", 70 + "fclk_div5", "fclk_div7", 71 + "hifi_pll", "xtal"; 72 + }; 73 + };
+59
Documentation/devicetree/bindings/clock/amlogic,a1-pll-clkc.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/clock/amlogic,a1-pll-clkc.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Amlogic A1 PLL Clock Control Unit 8 + 9 + maintainers: 10 + - Neil Armstrong <neil.armstrong@linaro.org> 11 + - Jerome Brunet <jbrunet@baylibre.com> 12 + - Jian Hu <jian.hu@jian.hu.com> 13 + - Dmitry Rokosov <ddrokosov@sberdevices.ru> 14 + 15 + properties: 16 + compatible: 17 + const: amlogic,a1-pll-clkc 18 + 19 + '#clock-cells': 20 + const: 1 21 + 22 + reg: 23 + maxItems: 1 24 + 25 + clocks: 26 + items: 27 + - description: input fixpll_in 28 + - description: input hifipll_in 29 + 30 + clock-names: 31 + items: 32 + - const: fixpll_in 33 + - const: hifipll_in 34 + 35 + required: 36 + - compatible 37 + - '#clock-cells' 38 + - reg 39 + - clocks 40 + - clock-names 41 + 42 + additionalProperties: false 43 + 44 + examples: 45 + - | 46 + #include <dt-bindings/clock/amlogic,a1-peripherals-clkc.h> 47 + apb { 48 + #address-cells = <2>; 49 + #size-cells = <2>; 50 + 51 + clock-controller@7c80 { 52 + compatible = "amlogic,a1-pll-clkc"; 53 + reg = <0 0x7c80 0 0x18c>; 54 + #clock-cells = <1>; 55 + clocks = <&clkc_periphs CLKID_FIXPLL_IN>, 56 + <&clkc_periphs CLKID_HIFIPLL_IN>; 57 + clock-names = "fixpll_in", "hifipll_in"; 58 + }; 59 + };
-58
Documentation/devicetree/bindings/clock/at91-clock.txt
··· 1 - Device Tree Clock bindings for arch-at91 2 - 3 - This binding uses the common clock binding[1]. 4 - 5 - [1] Documentation/devicetree/bindings/clock/clock-bindings.txt 6 - 7 - Slow Clock controller: 8 - 9 - Required properties: 10 - - compatible : shall be one of the following: 11 - "atmel,at91sam9x5-sckc", 12 - "atmel,sama5d3-sckc", 13 - "atmel,sama5d4-sckc" or 14 - "microchip,sam9x60-sckc": 15 - at91 SCKC (Slow Clock Controller) 16 - - #clock-cells : shall be 1 for "microchip,sam9x60-sckc" otherwise shall be 0. 17 - - clocks : shall be the input parent clock phandle for the clock. 18 - 19 - Optional properties: 20 - - atmel,osc-bypass : boolean property. Set this when a clock signal is directly 21 - provided on XIN. 22 - 23 - For example: 24 - sckc@fffffe50 { 25 - compatible = "atmel,at91sam9x5-sckc"; 26 - reg = <0xfffffe50 0x4>; 27 - clocks = <&slow_xtal>; 28 - #clock-cells = <0>; 29 - }; 30 - 31 - Power Management Controller (PMC): 32 - 33 - Required properties: 34 - - compatible : shall be "atmel,<chip>-pmc", "syscon" or 35 - "microchip,sam9x60-pmc" 36 - <chip> can be: at91rm9200, at91sam9260, at91sam9261, 37 - at91sam9263, at91sam9g45, at91sam9n12, at91sam9rl, at91sam9g15, 38 - at91sam9g25, at91sam9g35, at91sam9x25, at91sam9x35, at91sam9x5, 39 - sama5d2, sama5d3 or sama5d4. 40 - - #clock-cells : from common clock binding; shall be set to 2. The first entry 41 - is the type of the clock (core, system, peripheral or generated) and the 42 - second entry its index as provided by the datasheet 43 - - clocks : Must contain an entry for each entry in clock-names. 44 - - clock-names: Must include the following entries: "slow_clk", "main_xtal" 45 - 46 - Optional properties: 47 - - atmel,osc-bypass : boolean property. Set this when a clock signal is directly 48 - provided on XIN. 49 - 50 - For example: 51 - pmc: pmc@f0018000 { 52 - compatible = "atmel,sama5d4-pmc", "syscon"; 53 - reg = <0xf0018000 0x120>; 54 - interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 55 - #clock-cells = <2>; 56 - clocks = <&clk32k>, <&main_xtal>; 57 - clock-names = "slow_clk", "main_xtal"; 58 - };
+154
Documentation/devicetree/bindings/clock/atmel,at91rm9200-pmc.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/clock/atmel,at91rm9200-pmc.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Atmel Power Management Controller (PMC) 8 + 9 + maintainers: 10 + - Claudiu Beznea <claudiu.beznea@microchip.com> 11 + 12 + description: 13 + The power management controller optimizes power consumption by controlling all 14 + system and user peripheral clocks. The PMC enables/disables the clock inputs 15 + to many of the peripherals and to the processor. 16 + 17 + properties: 18 + compatible: 19 + oneOf: 20 + - items: 21 + - const: atmel,at91sam9g20-pmc 22 + - const: atmel,at91sam9260-pmc 23 + - const: syscon 24 + - items: 25 + - enum: 26 + - atmel,at91sam9g15-pmc 27 + - atmel,at91sam9g25-pmc 28 + - atmel,at91sam9g35-pmc 29 + - atmel,at91sam9x25-pmc 30 + - atmel,at91sam9x35-pmc 31 + - const: atmel,at91sam9x5-pmc 32 + - const: syscon 33 + - items: 34 + - enum: 35 + - atmel,at91rm9200-pmc 36 + - atmel,at91sam9260-pmc 37 + - atmel,at91sam9g45-pmc 38 + - atmel,at91sam9n12-pmc 39 + - atmel,at91sam9rl-pmc 40 + - atmel,at91sam9x5-pmc 41 + - atmel,sama5d2-pmc 42 + - atmel,sama5d3-pmc 43 + - atmel,sama5d4-pmc 44 + - microchip,sam9x60-pmc 45 + - microchip,sama7g5-pmc 46 + - const: syscon 47 + 48 + reg: 49 + maxItems: 1 50 + 51 + interrupts: 52 + maxItems: 1 53 + 54 + "#clock-cells": 55 + description: | 56 + - 1st cell is the clock type, one of PMC_TYPE_CORE, PMC_TYPE_SYSTEM, 57 + PMC_TYPE_PERIPHERAL, PMC_TYPE_GCK, PMC_TYPE_PROGRAMMABLE (as defined 58 + in <dt-bindings/clock/at91.h>) 59 + - 2nd cell is the clock identifier as defined in <dt-bindings/clock/at91.h 60 + (for core clocks) or as defined in datasheet (for system, peripheral, 61 + gck and programmable clocks). 62 + const: 2 63 + 64 + clocks: 65 + minItems: 2 66 + maxItems: 3 67 + 68 + clock-names: 69 + minItems: 2 70 + maxItems: 3 71 + 72 + atmel,osc-bypass: 73 + description: set when a clock signal is directly provided on XIN 74 + type: boolean 75 + 76 + required: 77 + - compatible 78 + - reg 79 + - interrupts 80 + - "#clock-cells" 81 + - clocks 82 + - clock-names 83 + 84 + allOf: 85 + - if: 86 + properties: 87 + compatible: 88 + contains: 89 + enum: 90 + - microchip,sam9x60-pmc 91 + - microchip,sama7g5-pmc 92 + then: 93 + properties: 94 + clocks: 95 + minItems: 3 96 + maxItems: 3 97 + clock-names: 98 + items: 99 + - const: td_slck 100 + - const: md_slck 101 + - const: main_xtal 102 + 103 + - if: 104 + properties: 105 + compatible: 106 + contains: 107 + enum: 108 + - atmel,at91rm9200-pmc 109 + - atmel,at91sam9260-pmc 110 + - atmel,at91sam9g20-pmc 111 + then: 112 + properties: 113 + clocks: 114 + minItems: 2 115 + maxItems: 2 116 + clock-names: 117 + items: 118 + - const: slow_xtal 119 + - const: main_xtal 120 + 121 + - if: 122 + properties: 123 + compatible: 124 + contains: 125 + enum: 126 + - atmel,sama5d2-pmc 127 + - atmel,sama5d3-pmc 128 + - atmel,sama5d4-pmc 129 + then: 130 + properties: 131 + clocks: 132 + minItems: 2 133 + maxItems: 2 134 + clock-names: 135 + items: 136 + - const: slow_clk 137 + - const: main_xtal 138 + 139 + additionalProperties: false 140 + 141 + examples: 142 + - | 143 + #include <dt-bindings/interrupt-controller/irq.h> 144 + 145 + pmc: clock-controller@f0018000 { 146 + compatible = "atmel,sama5d4-pmc", "syscon"; 147 + reg = <0xf0018000 0x120>; 148 + interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 149 + #clock-cells = <2>; 150 + clocks = <&clk32k>, <&main_xtal>; 151 + clock-names = "slow_clk", "main_xtal"; 152 + }; 153 + 154 + ...
+70
Documentation/devicetree/bindings/clock/atmel,at91sam9x5-sckc.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/clock/atmel,at91sam9x5-sckc.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Atmel Slow Clock Controller (SCKC) 8 + 9 + maintainers: 10 + - Claudiu Beznea <claudiu.beznea@microchip.com> 11 + 12 + properties: 13 + compatible: 14 + oneOf: 15 + - enum: 16 + - atmel,at91sam9x5-sckc 17 + - atmel,sama5d3-sckc 18 + - atmel,sama5d4-sckc 19 + - microchip,sam9x60-sckc 20 + - items: 21 + - const: microchip,sama7g5-sckc 22 + - const: microchip,sam9x60-sckc 23 + 24 + reg: 25 + maxItems: 1 26 + 27 + clocks: 28 + maxItems: 1 29 + 30 + "#clock-cells": 31 + enum: [0, 1] 32 + 33 + atmel,osc-bypass: 34 + type: boolean 35 + description: set when a clock signal is directly provided on XIN 36 + 37 + required: 38 + - compatible 39 + - reg 40 + - clocks 41 + - "#clock-cells" 42 + 43 + allOf: 44 + - if: 45 + properties: 46 + compatible: 47 + contains: 48 + enum: 49 + - microchip,sam9x60-sckc 50 + then: 51 + properties: 52 + "#clock-cells": 53 + const: 1 54 + else: 55 + properties: 56 + "#clock-cells": 57 + const: 0 58 + 59 + additionalProperties: false 60 + 61 + examples: 62 + - | 63 + clk32k: clock-controller@fffffe50 { 64 + compatible = "microchip,sam9x60-sckc"; 65 + reg = <0xfffffe50 0x4>; 66 + clocks = <&slow_xtal>; 67 + #clock-cells = <1>; 68 + }; 69 + 70 + ...
+3
Documentation/devicetree/bindings/clock/imx8m-clock.yaml
··· 24 24 reg: 25 25 maxItems: 1 26 26 27 + interrupts: 28 + maxItems: 2 29 + 27 30 clocks: 28 31 minItems: 6 29 32 maxItems: 7
+2 -2
Documentation/devicetree/bindings/clock/ingenic,cgu.yaml
··· 98 98 99 99 patternProperties: 100 100 "^usb-phy@[a-f0-9]+$": 101 - allOf: [ $ref: "../phy/ingenic,phy-usb.yaml#" ] 101 + $ref: /schemas/phy/ingenic,phy-usb.yaml# 102 102 "^mac-phy-ctrl@[a-f0-9]+$": 103 - allOf: [ $ref: "../net/ingenic,mac.yaml#" ] 103 + $ref: /schemas/net/ingenic,mac.yaml# 104 104 105 105 additionalProperties: false 106 106
+1 -1
Documentation/devicetree/bindings/clock/renesas,r9a06g032-sysctrl.yaml
··· 48 48 patternProperties: 49 49 "^dma-router@[a-f0-9]+$": 50 50 type: object 51 - $ref: "../dma/renesas,rzn1-dmamux.yaml#" 51 + $ref: /schemas/dma/renesas,rzn1-dmamux.yaml# 52 52 53 53 required: 54 54 - compatible
+1
Documentation/devicetree/bindings/clock/samsung,exynos-clock.yaml
··· 24 24 - samsung,exynos3250-cmu-dmc 25 25 - samsung,exynos3250-cmu-isp 26 26 - samsung,exynos4210-clock 27 + - samsung,exynos4212-clock 27 28 - samsung,exynos4412-clock 28 29 - samsung,exynos5250-clock 29 30 - items:
+43
Documentation/devicetree/bindings/clock/ti,am62-audio-refclk.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/clock/ti,am62-audio-refclk.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: TI Audio Reference Clock 8 + 9 + maintainers: 10 + - Jai Luthra <j-luthra@ti.com> 11 + 12 + properties: 13 + compatible: 14 + items: 15 + - const: ti,am62-audio-refclk 16 + 17 + reg: 18 + maxItems: 1 19 + 20 + "#clock-cells": 21 + const: 0 22 + 23 + clocks: 24 + maxItems: 1 25 + 26 + required: 27 + - compatible 28 + - reg 29 + - "#clock-cells" 30 + - clocks 31 + 32 + additionalProperties: false 33 + 34 + examples: 35 + - | 36 + audio_refclk0: clock@82e0 { 37 + compatible = "ti,am62-audio-refclk"; 38 + reg = <0x82e0 0x4>; 39 + clocks = <&k3_clks 157 0>; 40 + assigned-clocks = <&k3_clks 157 0>; 41 + assigned-clock-parents = <&k3_clks 157 8>; 42 + #clock-cells = <0>; 43 + };
+2 -3
Documentation/devicetree/bindings/clock/ti,am654-ehrpwm-tbclk.yaml
··· 16 16 - ti,am654-ehrpwm-tbclk 17 17 - ti,am64-epwm-tbclk 18 18 - ti,am62-epwm-tbclk 19 - - const: syscon 20 19 21 20 "#clock-cells": 22 21 const: 1 ··· 32 33 33 34 examples: 34 35 - | 35 - ehrpwm_tbclk: syscon@4140 { 36 - compatible = "ti,am654-ehrpwm-tbclk", "syscon"; 36 + ehrpwm_tbclk: clock@4140 { 37 + compatible = "ti,am654-ehrpwm-tbclk"; 37 38 reg = <0x4140 0x18>; 38 39 #clock-cells = <1>; 39 40 };
+2
MAINTAINERS
··· 1877 1877 S: Maintained 1878 1878 F: Documentation/devicetree/bindings/clock/amlogic* 1879 1879 F: drivers/clk/meson/ 1880 + F: include/dt-bindings/clock/amlogic,a1* 1880 1881 F: include/dt-bindings/clock/gxbb* 1881 1882 F: include/dt-bindings/clock/meson* 1882 1883 ··· 2354 2353 F: arch/arm/mach-mvebu/ 2355 2354 F: arch/arm64/boot/dts/marvell/armada* 2356 2355 F: arch/arm64/boot/dts/marvell/cn913* 2356 + F: drivers/clk/mvebu/ 2357 2357 F: drivers/cpufreq/armada-37xx-cpufreq.c 2358 2358 F: drivers/cpufreq/armada-8k-cpufreq.c 2359 2359 F: drivers/cpufreq/mvebu-cpufreq.c
+24 -11
drivers/clk/actions/owl-composite.c
··· 53 53 return owl_gate_clk_is_enabled(common, &comp->gate_hw); 54 54 } 55 55 56 - static long owl_comp_div_round_rate(struct clk_hw *hw, unsigned long rate, 57 - unsigned long *parent_rate) 56 + static int owl_comp_div_determine_rate(struct clk_hw *hw, 57 + struct clk_rate_request *req) 58 58 { 59 59 struct owl_composite *comp = hw_to_owl_comp(hw); 60 + long rate; 60 61 61 - return owl_divider_helper_round_rate(&comp->common, &comp->rate.div_hw, 62 - rate, parent_rate); 62 + rate = owl_divider_helper_round_rate(&comp->common, &comp->rate.div_hw, 63 + req->rate, &req->best_parent_rate); 64 + if (rate < 0) 65 + return rate; 66 + 67 + req->rate = rate; 68 + return 0; 63 69 } 64 70 65 71 static unsigned long owl_comp_div_recalc_rate(struct clk_hw *hw, ··· 86 80 rate, parent_rate); 87 81 } 88 82 89 - static long owl_comp_fact_round_rate(struct clk_hw *hw, unsigned long rate, 90 - unsigned long *parent_rate) 83 + static int owl_comp_fact_determine_rate(struct clk_hw *hw, 84 + struct clk_rate_request *req) 91 85 { 92 86 struct owl_composite *comp = hw_to_owl_comp(hw); 87 + long rate; 93 88 94 - return owl_factor_helper_round_rate(&comp->common, 95 - &comp->rate.factor_hw, 96 - rate, parent_rate); 89 + rate = owl_factor_helper_round_rate(&comp->common, 90 + &comp->rate.factor_hw, 91 + req->rate, &req->best_parent_rate); 92 + if (rate < 0) 93 + return rate; 94 + 95 + req->rate = rate; 96 + return 0; 97 97 } 98 98 99 99 static unsigned long owl_comp_fact_recalc_rate(struct clk_hw *hw, ··· 164 152 .is_enabled = owl_comp_is_enabled, 165 153 166 154 /* div_ops */ 167 - .round_rate = owl_comp_div_round_rate, 155 + .determine_rate = owl_comp_div_determine_rate, 168 156 .recalc_rate = owl_comp_div_recalc_rate, 169 157 .set_rate = owl_comp_div_set_rate, 170 158 }; ··· 181 169 .is_enabled = owl_comp_is_enabled, 182 170 183 171 /* fact_ops */ 184 - .round_rate = owl_comp_fact_round_rate, 172 + .determine_rate = owl_comp_fact_determine_rate, 185 173 .recalc_rate = owl_comp_fact_recalc_rate, 186 174 .set_rate = owl_comp_fact_set_rate, 187 175 }; ··· 201 189 202 190 const struct clk_ops owl_comp_pass_ops = { 203 191 /* mux_ops */ 192 + .determine_rate = clk_hw_determine_rate_no_reparent, 204 193 .get_parent = owl_comp_get_parent, 205 194 .set_parent = owl_comp_set_parent, 206 195
+1
drivers/clk/at91/clk-main.c
··· 533 533 .prepare = clk_sam9x5_main_prepare, 534 534 .is_prepared = clk_sam9x5_main_is_prepared, 535 535 .recalc_rate = clk_sam9x5_main_recalc_rate, 536 + .determine_rate = clk_hw_determine_rate_no_reparent, 536 537 .set_parent = clk_sam9x5_main_set_parent, 537 538 .get_parent = clk_sam9x5_main_get_parent, 538 539 .save_context = clk_sam9x5_main_save_context,
+17 -12
drivers/clk/at91/clk-smd.c
··· 36 36 return parent_rate / (smddiv + 1); 37 37 } 38 38 39 - static long at91sam9x5_clk_smd_round_rate(struct clk_hw *hw, unsigned long rate, 40 - unsigned long *parent_rate) 39 + static int at91sam9x5_clk_smd_determine_rate(struct clk_hw *hw, 40 + struct clk_rate_request *req) 41 41 { 42 42 unsigned long div; 43 43 unsigned long bestrate; 44 44 unsigned long tmp; 45 45 46 - if (rate >= *parent_rate) 47 - return *parent_rate; 46 + if (req->rate >= req->best_parent_rate) { 47 + req->rate = req->best_parent_rate; 48 + return 0; 49 + } 48 50 49 - div = *parent_rate / rate; 50 - if (div > SMD_MAX_DIV) 51 - return *parent_rate / (SMD_MAX_DIV + 1); 51 + div = req->best_parent_rate / req->rate; 52 + if (div > SMD_MAX_DIV) { 53 + req->rate = req->best_parent_rate / (SMD_MAX_DIV + 1); 54 + return 0; 55 + } 52 56 53 - bestrate = *parent_rate / div; 54 - tmp = *parent_rate / (div + 1); 55 - if (bestrate - rate > rate - tmp) 57 + bestrate = req->best_parent_rate / div; 58 + tmp = req->best_parent_rate / (div + 1); 59 + if (bestrate - req->rate > req->rate - tmp) 56 60 bestrate = tmp; 57 61 58 - return bestrate; 62 + req->rate = bestrate; 63 + return 0; 59 64 } 60 65 61 66 static int at91sam9x5_clk_smd_set_parent(struct clk_hw *hw, u8 index) ··· 103 98 104 99 static const struct clk_ops at91sam9x5_smd_ops = { 105 100 .recalc_rate = at91sam9x5_clk_smd_recalc_rate, 106 - .round_rate = at91sam9x5_clk_smd_round_rate, 101 + .determine_rate = at91sam9x5_clk_smd_determine_rate, 107 102 .get_parent = at91sam9x5_clk_smd_get_parent, 108 103 .set_parent = at91sam9x5_clk_smd_set_parent, 109 104 .set_rate = at91sam9x5_clk_smd_set_rate,
+1
drivers/clk/at91/sckc.c
··· 310 310 } 311 311 312 312 static const struct clk_ops sam9x5_slow_ops = { 313 + .determine_rate = clk_hw_determine_rate_no_reparent, 313 314 .set_parent = clk_sam9x5_slow_set_parent, 314 315 .get_parent = clk_sam9x5_slow_get_parent, 315 316 };
+2 -2
drivers/clk/bcm/clk-raspberrypi.c
··· 356 356 while (clks->id) { 357 357 struct raspberrypi_clk_variant *variant; 358 358 359 - if (clks->id > RPI_FIRMWARE_NUM_CLK_ID) { 359 + if (clks->id >= RPI_FIRMWARE_NUM_CLK_ID) { 360 360 dev_err(rpi->dev, "Unknown clock id: %u (max: %u)\n", 361 - clks->id, RPI_FIRMWARE_NUM_CLK_ID); 361 + clks->id, RPI_FIRMWARE_NUM_CLK_ID - 1); 362 362 return -EINVAL; 363 363 } 364 364
+1
drivers/clk/berlin/berlin2-div.c
··· 210 210 } 211 211 212 212 static const struct clk_ops berlin2_div_rate_ops = { 213 + .determine_rate = clk_hw_determine_rate_no_reparent, 213 214 .recalc_rate = berlin2_div_recalc_rate, 214 215 }; 215 216
+8 -6
drivers/clk/clk-axi-clkgen.c
··· 384 384 return 0; 385 385 } 386 386 387 - static long axi_clkgen_round_rate(struct clk_hw *hw, unsigned long rate, 388 - unsigned long *parent_rate) 387 + static int axi_clkgen_determine_rate(struct clk_hw *hw, 388 + struct clk_rate_request *req) 389 389 { 390 390 struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(hw); 391 391 const struct axi_clkgen_limits *limits = &axi_clkgen->limits; 392 392 unsigned int d, m, dout; 393 393 unsigned long long tmp; 394 394 395 - axi_clkgen_calc_params(limits, *parent_rate, rate, &d, &m, &dout); 395 + axi_clkgen_calc_params(limits, req->best_parent_rate, req->rate, 396 + &d, &m, &dout); 396 397 397 398 if (d == 0 || dout == 0 || m == 0) 398 399 return -EINVAL; 399 400 400 - tmp = (unsigned long long)*parent_rate * m; 401 + tmp = (unsigned long long)req->best_parent_rate * m; 401 402 tmp = DIV_ROUND_CLOSEST_ULL(tmp, dout * d); 402 403 403 - return min_t(unsigned long long, tmp, LONG_MAX); 404 + req->rate = min_t(unsigned long long, tmp, LONG_MAX); 405 + return 0; 404 406 } 405 407 406 408 static unsigned int axi_clkgen_get_div(struct axi_clkgen *axi_clkgen, ··· 497 495 498 496 static const struct clk_ops axi_clkgen_ops = { 499 497 .recalc_rate = axi_clkgen_recalc_rate, 500 - .round_rate = axi_clkgen_round_rate, 498 + .determine_rate = axi_clkgen_determine_rate, 501 499 .set_rate = axi_clkgen_set_rate, 502 500 .enable = axi_clkgen_enable, 503 501 .disable = axi_clkgen_disable,
+18 -14
drivers/clk/clk-cdce706.c
··· 155 155 } 156 156 157 157 static const struct clk_ops cdce706_clkin_ops = { 158 + .determine_rate = clk_hw_determine_rate_no_reparent, 158 159 .set_parent = cdce706_clkin_set_parent, 159 160 .get_parent = cdce706_clkin_get_parent, 160 161 }; ··· 288 287 return 0; 289 288 } 290 289 291 - static long cdce706_divider_round_rate(struct clk_hw *hw, unsigned long rate, 292 - unsigned long *parent_rate) 290 + static int cdce706_divider_determine_rate(struct clk_hw *hw, 291 + struct clk_rate_request *req) 293 292 { 294 293 struct cdce706_hw_data *hwd = to_hw_data(hw); 295 294 struct cdce706_dev_data *cdce = hwd->dev_data; 295 + unsigned long rate = req->rate; 296 296 unsigned long mul, div; 297 297 298 298 dev_dbg(&hwd->dev_data->client->dev, 299 299 "%s, rate: %lu, parent_rate: %lu\n", 300 - __func__, rate, *parent_rate); 300 + __func__, rate, req->best_parent_rate); 301 301 302 - rational_best_approximation(rate, *parent_rate, 302 + rational_best_approximation(rate, req->best_parent_rate, 303 303 1, CDCE706_DIVIDER_DIVIDER_MAX, 304 304 &mul, &div); 305 305 if (!mul) ··· 345 343 346 344 dev_dbg(&hwd->dev_data->client->dev, 347 345 "%s, altering parent rate: %lu -> %lu\n", 348 - __func__, *parent_rate, rate * div); 349 - *parent_rate = rate * div; 346 + __func__, req->best_parent_rate, rate * div); 347 + req->best_parent_rate = rate * div; 350 348 } 351 349 hwd->div = div; 352 350 ··· 354 352 "%s, divider: %d, div: %lu\n", 355 353 __func__, hwd->idx, div); 356 354 357 - return *parent_rate / div; 355 + req->rate = req->best_parent_rate / div; 356 + return 0; 358 357 } 359 358 360 359 static int cdce706_divider_set_rate(struct clk_hw *hw, unsigned long rate, ··· 377 374 .set_parent = cdce706_divider_set_parent, 378 375 .get_parent = cdce706_divider_get_parent, 379 376 .recalc_rate = cdce706_divider_recalc_rate, 380 - .round_rate = cdce706_divider_round_rate, 377 + .determine_rate = cdce706_divider_determine_rate, 381 378 .set_rate = cdce706_divider_set_rate, 382 379 }; 383 380 ··· 423 420 return parent_rate; 424 421 } 425 422 426 - static long cdce706_clkout_round_rate(struct clk_hw *hw, unsigned long rate, 427 - unsigned long *parent_rate) 423 + static int cdce706_clkout_determine_rate(struct clk_hw *hw, 424 + struct clk_rate_request *req) 428 425 { 429 - *parent_rate = rate; 430 - return rate; 426 + req->best_parent_rate = req->rate; 427 + 428 + return 0; 431 429 } 432 430 433 431 static int cdce706_clkout_set_rate(struct clk_hw *hw, unsigned long rate, ··· 443 439 .set_parent = cdce706_clkout_set_parent, 444 440 .get_parent = cdce706_clkout_get_parent, 445 441 .recalc_rate = cdce706_clkout_recalc_rate, 446 - .round_rate = cdce706_clkout_round_rate, 442 + .determine_rate = cdce706_clkout_determine_rate, 447 443 .set_rate = cdce706_clkout_set_rate, 448 444 }; 449 445 ··· 688 684 .name = "cdce706", 689 685 .of_match_table = of_match_ptr(cdce706_dt_match), 690 686 }, 691 - .probe_new = cdce706_probe, 687 + .probe = cdce706_probe, 692 688 .id_table = cdce706_id, 693 689 }; 694 690 module_i2c_driver(cdce706_i2c_driver);
+13 -1
drivers/clk/clk-cdce925.c
··· 701 701 for (i = 0; i < data->chip_info->num_plls; ++i) { 702 702 pll_clk_name[i] = kasprintf(GFP_KERNEL, "%pOFn.pll%d", 703 703 client->dev.of_node, i); 704 + if (!pll_clk_name[i]) { 705 + err = -ENOMEM; 706 + goto error; 707 + } 704 708 init.name = pll_clk_name[i]; 705 709 data->pll[i].chip = data; 706 710 data->pll[i].hw.init = &init; ··· 746 742 init.num_parents = 1; 747 743 init.parent_names = &parent_name; /* Mux Y1 to input */ 748 744 init.name = kasprintf(GFP_KERNEL, "%pOFn.Y1", client->dev.of_node); 745 + if (!init.name) { 746 + err = -ENOMEM; 747 + goto error; 748 + } 749 749 data->clk[0].chip = data; 750 750 data->clk[0].hw.init = &init; 751 751 data->clk[0].index = 0; ··· 768 760 for (i = 1; i < data->chip_info->num_outputs; ++i) { 769 761 init.name = kasprintf(GFP_KERNEL, "%pOFn.Y%d", 770 762 client->dev.of_node, i+1); 763 + if (!init.name) { 764 + err = -ENOMEM; 765 + goto error; 766 + } 771 767 data->clk[i].chip = data; 772 768 data->clk[i].hw.init = &init; 773 769 data->clk[i].index = i; ··· 836 824 .name = "cdce925", 837 825 .of_match_table = of_match_ptr(clk_cdce925_of_match), 838 826 }, 839 - .probe_new = cdce925_probe, 827 + .probe = cdce925_probe, 840 828 .id_table = cdce925_id, 841 829 }; 842 830 module_i2c_driver(cdce925_driver);
+1 -1
drivers/clk/clk-cs2000-cp.c
··· 622 622 .pm = &cs2000_pm_ops, 623 623 .of_match_table = cs2000_of_match, 624 624 }, 625 - .probe_new = cs2000_probe, 625 + .probe = cs2000_probe, 626 626 .remove = cs2000_remove, 627 627 .id_table = cs2000_id, 628 628 };
+3
drivers/clk/clk-k210.c
··· 537 537 .disable = k210_pll_disable, 538 538 .is_enabled = k210_pll_is_enabled, 539 539 .recalc_rate = k210_pll_get_rate, 540 + .determine_rate = clk_hw_determine_rate_no_reparent, 540 541 .set_parent = k210_pll2_set_parent, 541 542 .get_parent = k210_pll2_get_parent, 542 543 }; ··· 636 635 } 637 636 638 637 static const struct clk_ops k210_aclk_ops = { 638 + .determine_rate = clk_hw_determine_rate_no_reparent, 639 639 .set_parent = k210_aclk_set_parent, 640 640 .get_parent = k210_aclk_get_parent, 641 641 .recalc_rate = k210_aclk_get_rate, ··· 776 774 static const struct clk_ops k210_clk_mux_ops = { 777 775 .enable = k210_clk_enable, 778 776 .disable = k210_clk_disable, 777 + .determine_rate = clk_hw_determine_rate_no_reparent, 779 778 .set_parent = k210_clk_set_parent, 780 779 .get_parent = k210_clk_get_parent, 781 780 .recalc_rate = k210_clk_get_rate,
-17
drivers/clk/clk-lan966x.c
··· 103 103 return 0; 104 104 } 105 105 106 - static long lan966x_gck_round_rate(struct clk_hw *hw, unsigned long rate, 107 - unsigned long *parent_rate) 108 - { 109 - unsigned int div; 110 - 111 - if (rate == 0 || *parent_rate == 0) 112 - return -EINVAL; 113 - 114 - if (rate >= *parent_rate) 115 - return *parent_rate; 116 - 117 - div = DIV_ROUND_CLOSEST(*parent_rate, rate); 118 - 119 - return *parent_rate / div; 120 - } 121 - 122 106 static unsigned long lan966x_gck_recalc_rate(struct clk_hw *hw, 123 107 unsigned long parent_rate) 124 108 { ··· 161 177 .enable = lan966x_gck_enable, 162 178 .disable = lan966x_gck_disable, 163 179 .set_rate = lan966x_gck_set_rate, 164 - .round_rate = lan966x_gck_round_rate, 165 180 .recalc_rate = lan966x_gck_recalc_rate, 166 181 .determine_rate = lan966x_gck_determine_rate, 167 182 .set_parent = lan966x_gck_set_parent,
+1
drivers/clk/clk-lmk04832.c
··· 1279 1279 .is_enabled = lmk04832_clkout_is_enabled, 1280 1280 .prepare = lmk04832_clkout_prepare, 1281 1281 .unprepare = lmk04832_clkout_unprepare, 1282 + .determine_rate = __clk_mux_determine_rate, 1282 1283 .set_parent = lmk04832_clkout_set_parent, 1283 1284 .get_parent = lmk04832_clkout_get_parent, 1284 1285 };
+1
drivers/clk/clk-lochnagar.c
··· 209 209 static const struct clk_ops lochnagar_clk_ops = { 210 210 .prepare = lochnagar_clk_prepare, 211 211 .unprepare = lochnagar_clk_unprepare, 212 + .determine_rate = clk_hw_determine_rate_no_reparent, 212 213 .set_parent = lochnagar_clk_set_parent, 213 214 .get_parent = lochnagar_clk_get_parent, 214 215 };
+1 -1
drivers/clk/clk-max9485.c
··· 376 376 .pm = &max9485_pm_ops, 377 377 .of_match_table = max9485_dt_ids, 378 378 }, 379 - .probe_new = max9485_i2c_probe, 379 + .probe = max9485_i2c_probe, 380 380 .id_table = max9485_i2c_ids, 381 381 }; 382 382 module_i2c_driver(max9485_driver);
+1
drivers/clk/clk-qoriq.c
··· 878 878 } 879 879 880 880 static const struct clk_ops cmux_ops = { 881 + .determine_rate = clk_hw_determine_rate_no_reparent, 881 882 .get_parent = mux_get_parent, 882 883 .set_parent = mux_set_parent, 883 884 };
+3 -3
drivers/clk/clk-renesas-pcie.c
··· 392 392 }; 393 393 394 394 static const struct i2c_device_id rs9_id[] = { 395 - { "9fgv0241", .driver_data = RENESAS_9FGV0241 }, 396 - { "9fgv0441", .driver_data = RENESAS_9FGV0441 }, 395 + { "9fgv0241", .driver_data = (kernel_ulong_t)&renesas_9fgv0241_info }, 396 + { "9fgv0441", .driver_data = (kernel_ulong_t)&renesas_9fgv0441_info }, 397 397 { } 398 398 }; 399 399 MODULE_DEVICE_TABLE(i2c, rs9_id); ··· 413 413 .pm = &rs9_pm_ops, 414 414 .of_match_table = clk_rs9_of_match, 415 415 }, 416 - .probe_new = rs9_probe, 416 + .probe = rs9_probe, 417 417 .id_table = rs9_id, 418 418 }; 419 419 module_i2c_driver(rs9_driver);
+1 -1
drivers/clk/clk-si514.c
··· 387 387 .name = "si514", 388 388 .of_match_table = clk_si514_of_match, 389 389 }, 390 - .probe_new = si514_probe, 390 + .probe = si514_probe, 391 391 .id_table = si514_id, 392 392 }; 393 393 module_i2c_driver(si514_driver);
+1 -1
drivers/clk/clk-si521xx.c
··· 385 385 .pm = &si521xx_pm_ops, 386 386 .of_match_table = clk_si521xx_of_match, 387 387 }, 388 - .probe_new = si521xx_probe, 388 + .probe = si521xx_probe, 389 389 .id_table = si521xx_id, 390 390 }; 391 391 module_i2c_driver(si521xx_driver);
+35 -24
drivers/clk/clk-si5341.c
··· 551 551 } 552 552 553 553 static const struct clk_ops si5341_clk_ops = { 554 + .determine_rate = clk_hw_determine_rate_no_reparent, 554 555 .set_parent = si5341_clk_set_parent, 555 556 .get_parent = si5341_clk_get_parent, 556 557 .recalc_rate = si5341_clk_recalc_rate, ··· 828 827 return parent_rate / r_divider; 829 828 } 830 829 831 - static long si5341_output_clk_round_rate(struct clk_hw *hw, unsigned long rate, 832 - unsigned long *parent_rate) 830 + static int si5341_output_clk_determine_rate(struct clk_hw *hw, 831 + struct clk_rate_request *req) 833 832 { 833 + unsigned long rate = req->rate; 834 834 unsigned long r; 835 835 836 836 if (!rate) 837 837 return 0; 838 838 839 - r = *parent_rate >> 1; 839 + r = req->best_parent_rate >> 1; 840 840 841 841 /* If rate is an even divisor, no changes to parent required */ 842 842 if (r && !(r % rate)) 843 - return (long)rate; 843 + return 0; 844 844 845 845 if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) { 846 846 if (rate > 200000000) { ··· 851 849 /* Take a parent frequency near 400 MHz */ 852 850 r = (400000000u / rate) & ~1; 853 851 } 854 - *parent_rate = r * rate; 852 + req->best_parent_rate = r * rate; 855 853 } else { 856 854 /* We cannot change our parent's rate, report what we can do */ 857 855 r /= rate; 858 - rate = *parent_rate / (r << 1); 856 + rate = req->best_parent_rate / (r << 1); 859 857 } 860 858 861 - return rate; 859 + req->rate = rate; 860 + return 0; 862 861 } 863 862 864 863 static int si5341_output_clk_set_rate(struct clk_hw *hw, unsigned long rate, ··· 932 929 .prepare = si5341_output_clk_prepare, 933 930 .unprepare = si5341_output_clk_unprepare, 934 931 .recalc_rate = si5341_output_clk_recalc_rate, 935 - .round_rate = si5341_output_clk_round_rate, 932 + .determine_rate = si5341_output_clk_determine_rate, 936 933 .set_rate = si5341_output_clk_set_rate, 937 934 .set_parent = si5341_output_set_parent, 938 935 .get_parent = si5341_output_get_parent, ··· 1556 1553 struct clk_init_data init; 1557 1554 struct clk *input; 1558 1555 const char *root_clock_name; 1559 - const char *synth_clock_names[SI5341_NUM_SYNTH]; 1556 + const char *synth_clock_names[SI5341_NUM_SYNTH] = { NULL }; 1560 1557 int err; 1561 1558 unsigned int i; 1562 1559 struct clk_si5341_output_config config[SI5341_MAX_NUM_OUTPUTS]; ··· 1700 1697 for (i = 0; i < data->num_synth; ++i) { 1701 1698 synth_clock_names[i] = devm_kasprintf(&client->dev, GFP_KERNEL, 1702 1699 "%s.N%u", client->dev.of_node->name, i); 1700 + if (!synth_clock_names[i]) { 1701 + err = -ENOMEM; 1702 + goto free_clk_names; 1703 + } 1703 1704 init.name = synth_clock_names[i]; 1704 1705 data->synth[i].index = i; 1705 1706 data->synth[i].data = data; ··· 1712 1705 if (err) { 1713 1706 dev_err(&client->dev, 1714 1707 "synth N%u registration failed\n", i); 1708 + goto free_clk_names; 1715 1709 } 1716 1710 } 1717 1711 ··· 1722 1714 for (i = 0; i < data->num_outputs; ++i) { 1723 1715 init.name = kasprintf(GFP_KERNEL, "%s.%d", 1724 1716 client->dev.of_node->name, i); 1717 + if (!init.name) { 1718 + err = -ENOMEM; 1719 + goto free_clk_names; 1720 + } 1725 1721 init.flags = config[i].synth_master ? CLK_SET_RATE_PARENT : 0; 1726 1722 data->clk[i].index = i; 1727 1723 data->clk[i].data = data; ··· 1747 1735 if (err) { 1748 1736 dev_err(&client->dev, 1749 1737 "output %u registration failed\n", i); 1750 - goto cleanup; 1738 + goto free_clk_names; 1751 1739 } 1752 1740 if (config[i].always_on) 1753 1741 clk_prepare(data->clk[i].hw.clk); ··· 1757 1745 data); 1758 1746 if (err) { 1759 1747 dev_err(&client->dev, "unable to add clk provider\n"); 1760 - goto cleanup; 1748 + goto free_clk_names; 1761 1749 } 1762 1750 1763 1751 if (initialization_required) { ··· 1765 1753 regcache_cache_only(data->regmap, false); 1766 1754 err = regcache_sync(data->regmap); 1767 1755 if (err < 0) 1768 - goto cleanup; 1756 + goto free_clk_names; 1769 1757 1770 1758 err = si5341_finalize_defaults(data); 1771 1759 if (err < 0) 1772 - goto cleanup; 1760 + goto free_clk_names; 1773 1761 } 1774 1762 1775 1763 /* wait for device to report input clock present and PLL lock */ ··· 1778 1766 10000, 250000); 1779 1767 if (err) { 1780 1768 dev_err(&client->dev, "Error waiting for input clock or PLL lock\n"); 1781 - goto cleanup; 1769 + goto free_clk_names; 1782 1770 } 1783 1771 1784 1772 /* clear sticky alarm bits from initialization */ 1785 1773 err = regmap_write(data->regmap, SI5341_STATUS_STICKY, 0); 1786 1774 if (err) { 1787 1775 dev_err(&client->dev, "unable to clear sticky status\n"); 1788 - goto cleanup; 1776 + goto free_clk_names; 1789 1777 } 1790 1778 1791 1779 err = sysfs_create_files(&client->dev.kobj, si5341_attributes); 1792 - if (err) { 1780 + if (err) 1793 1781 dev_err(&client->dev, "unable to create sysfs files\n"); 1794 - goto cleanup; 1795 - } 1796 1782 1783 + free_clk_names: 1797 1784 /* Free the names, clk framework makes copies */ 1798 1785 for (i = 0; i < data->num_synth; ++i) 1799 1786 devm_kfree(&client->dev, (void *)synth_clock_names[i]); 1800 1787 1801 - return 0; 1802 - 1803 1788 cleanup: 1804 - for (i = 0; i < SI5341_MAX_NUM_OUTPUTS; ++i) { 1805 - if (data->clk[i].vddo_reg) 1806 - regulator_disable(data->clk[i].vddo_reg); 1789 + if (err) { 1790 + for (i = 0; i < SI5341_MAX_NUM_OUTPUTS; ++i) { 1791 + if (data->clk[i].vddo_reg) 1792 + regulator_disable(data->clk[i].vddo_reg); 1793 + } 1807 1794 } 1808 1795 return err; 1809 1796 } ··· 1845 1834 .name = "si5341", 1846 1835 .of_match_table = clk_si5341_of_match, 1847 1836 }, 1848 - .probe_new = si5341_probe, 1837 + .probe = si5341_probe, 1849 1838 .remove = si5341_remove, 1850 1839 .id_table = si5341_id, 1851 1840 };
+38 -31
drivers/clk/clk-si5351.c
··· 442 442 return (unsigned long)rate; 443 443 } 444 444 445 - static long si5351_pll_round_rate(struct clk_hw *hw, unsigned long rate, 446 - unsigned long *parent_rate) 445 + static int si5351_pll_determine_rate(struct clk_hw *hw, 446 + struct clk_rate_request *req) 447 447 { 448 448 struct si5351_hw_data *hwdata = 449 449 container_of(hw, struct si5351_hw_data, hw); 450 + unsigned long rate = req->rate; 450 451 unsigned long rfrac, denom, a, b, c; 451 452 unsigned long long lltmp; 452 453 ··· 457 456 rate = SI5351_PLL_VCO_MAX; 458 457 459 458 /* determine integer part of feedback equation */ 460 - a = rate / *parent_rate; 459 + a = rate / req->best_parent_rate; 461 460 462 461 if (a < SI5351_PLL_A_MIN) 463 - rate = *parent_rate * SI5351_PLL_A_MIN; 462 + rate = req->best_parent_rate * SI5351_PLL_A_MIN; 464 463 if (a > SI5351_PLL_A_MAX) 465 - rate = *parent_rate * SI5351_PLL_A_MAX; 464 + rate = req->best_parent_rate * SI5351_PLL_A_MAX; 466 465 467 466 /* find best approximation for b/c = fVCO mod fIN */ 468 467 denom = 1000 * 1000; 469 - lltmp = rate % (*parent_rate); 468 + lltmp = rate % (req->best_parent_rate); 470 469 lltmp *= denom; 471 - do_div(lltmp, *parent_rate); 470 + do_div(lltmp, req->best_parent_rate); 472 471 rfrac = (unsigned long)lltmp; 473 472 474 473 b = 0; ··· 485 484 hwdata->params.p1 -= 512; 486 485 487 486 /* recalculate rate by fIN * (a + b/c) */ 488 - lltmp = *parent_rate; 487 + lltmp = req->best_parent_rate; 489 488 lltmp *= b; 490 489 do_div(lltmp, c); 491 490 492 491 rate = (unsigned long)lltmp; 493 - rate += *parent_rate * a; 492 + rate += req->best_parent_rate * a; 494 493 495 494 dev_dbg(&hwdata->drvdata->client->dev, 496 495 "%s - %s: a = %lu, b = %lu, c = %lu, parent_rate = %lu, rate = %lu\n", 497 496 __func__, clk_hw_get_name(hw), a, b, c, 498 - *parent_rate, rate); 497 + req->best_parent_rate, rate); 499 498 500 - return rate; 499 + req->rate = rate; 500 + return 0; 501 501 } 502 502 503 503 static int si5351_pll_set_rate(struct clk_hw *hw, unsigned long rate, ··· 535 533 .set_parent = si5351_pll_set_parent, 536 534 .get_parent = si5351_pll_get_parent, 537 535 .recalc_rate = si5351_pll_recalc_rate, 538 - .round_rate = si5351_pll_round_rate, 536 + .determine_rate = si5351_pll_determine_rate, 539 537 .set_rate = si5351_pll_set_rate, 540 538 }; 541 539 ··· 642 640 return (unsigned long)rate; 643 641 } 644 642 645 - static long si5351_msynth_round_rate(struct clk_hw *hw, unsigned long rate, 646 - unsigned long *parent_rate) 643 + static int si5351_msynth_determine_rate(struct clk_hw *hw, 644 + struct clk_rate_request *req) 647 645 { 648 646 struct si5351_hw_data *hwdata = 649 647 container_of(hw, struct si5351_hw_data, hw); 648 + unsigned long rate = req->rate; 650 649 unsigned long long lltmp; 651 650 unsigned long a, b, c; 652 651 int divby4; ··· 682 679 b = 0; 683 680 c = 1; 684 681 685 - *parent_rate = a * rate; 682 + req->best_parent_rate = a * rate; 686 683 } else if (hwdata->num >= 6) { 687 684 /* determine the closest integer divider */ 688 - a = DIV_ROUND_CLOSEST(*parent_rate, rate); 685 + a = DIV_ROUND_CLOSEST(req->best_parent_rate, rate); 689 686 if (a < SI5351_MULTISYNTH_A_MIN) 690 687 a = SI5351_MULTISYNTH_A_MIN; 691 688 if (a > SI5351_MULTISYNTH67_A_MAX) ··· 703 700 } 704 701 705 702 /* determine integer part of divider equation */ 706 - a = *parent_rate / rate; 703 + a = req->best_parent_rate / rate; 707 704 if (a < SI5351_MULTISYNTH_A_MIN) 708 705 a = SI5351_MULTISYNTH_A_MIN; 709 706 if (a > SI5351_MULTISYNTH_A_MAX) ··· 711 708 712 709 /* find best approximation for b/c = fVCO mod fOUT */ 713 710 denom = 1000 * 1000; 714 - lltmp = (*parent_rate) % rate; 711 + lltmp = req->best_parent_rate % rate; 715 712 lltmp *= denom; 716 713 do_div(lltmp, rate); 717 714 rfrac = (unsigned long)lltmp; ··· 725 722 } 726 723 727 724 /* recalculate rate by fOUT = fIN / (a + b/c) */ 728 - lltmp = *parent_rate; 725 + lltmp = req->best_parent_rate; 729 726 lltmp *= c; 730 727 do_div(lltmp, a * c + b); 731 728 rate = (unsigned long)lltmp; ··· 750 747 dev_dbg(&hwdata->drvdata->client->dev, 751 748 "%s - %s: a = %lu, b = %lu, c = %lu, divby4 = %d, parent_rate = %lu, rate = %lu\n", 752 749 __func__, clk_hw_get_name(hw), a, b, c, divby4, 753 - *parent_rate, rate); 750 + req->best_parent_rate, rate); 754 751 755 - return rate; 752 + req->rate = rate; 753 + 754 + return 0; 756 755 } 757 756 758 757 static int si5351_msynth_set_rate(struct clk_hw *hw, unsigned long rate, ··· 794 789 .set_parent = si5351_msynth_set_parent, 795 790 .get_parent = si5351_msynth_get_parent, 796 791 .recalc_rate = si5351_msynth_recalc_rate, 797 - .round_rate = si5351_msynth_round_rate, 792 + .determine_rate = si5351_msynth_determine_rate, 798 793 .set_rate = si5351_msynth_set_rate, 799 794 }; 800 795 ··· 1037 1032 return parent_rate >> rdiv; 1038 1033 } 1039 1034 1040 - static long si5351_clkout_round_rate(struct clk_hw *hw, unsigned long rate, 1041 - unsigned long *parent_rate) 1035 + static int si5351_clkout_determine_rate(struct clk_hw *hw, 1036 + struct clk_rate_request *req) 1042 1037 { 1043 1038 struct si5351_hw_data *hwdata = 1044 1039 container_of(hw, struct si5351_hw_data, hw); 1040 + unsigned long rate = req->rate; 1045 1041 unsigned char rdiv; 1046 1042 1047 1043 /* clkout6/7 can only handle output freqencies < 150MHz */ ··· 1064 1058 rdiv += 1; 1065 1059 rate *= 2; 1066 1060 } 1067 - *parent_rate = rate; 1061 + req->best_parent_rate = rate; 1068 1062 } else { 1069 1063 unsigned long new_rate, new_err, err; 1070 1064 1071 1065 /* round to closed rdiv */ 1072 1066 rdiv = SI5351_OUTPUT_CLK_DIV_1; 1073 - new_rate = *parent_rate; 1067 + new_rate = req->best_parent_rate; 1074 1068 err = abs(new_rate - rate); 1075 1069 do { 1076 1070 new_rate >>= 1; ··· 1081 1075 err = new_err; 1082 1076 } while (1); 1083 1077 } 1084 - rate = *parent_rate >> rdiv; 1078 + rate = req->best_parent_rate >> rdiv; 1085 1079 1086 1080 dev_dbg(&hwdata->drvdata->client->dev, 1087 1081 "%s - %s: rdiv = %u, parent_rate = %lu, rate = %lu\n", 1088 1082 __func__, clk_hw_get_name(hw), (1 << rdiv), 1089 - *parent_rate, rate); 1083 + req->best_parent_rate, rate); 1090 1084 1091 - return rate; 1085 + req->rate = rate; 1086 + return 0; 1092 1087 } 1093 1088 1094 1089 static int si5351_clkout_set_rate(struct clk_hw *hw, unsigned long rate, ··· 1149 1142 .set_parent = si5351_clkout_set_parent, 1150 1143 .get_parent = si5351_clkout_get_parent, 1151 1144 .recalc_rate = si5351_clkout_recalc_rate, 1152 - .round_rate = si5351_clkout_round_rate, 1145 + .determine_rate = si5351_clkout_determine_rate, 1153 1146 .set_rate = si5351_clkout_set_rate, 1154 1147 }; 1155 1148 ··· 1663 1656 .name = "si5351", 1664 1657 .of_match_table = of_match_ptr(si5351_dt_ids), 1665 1658 }, 1666 - .probe_new = si5351_i2c_probe, 1659 + .probe = si5351_i2c_probe, 1667 1660 .id_table = si5351_i2c_ids, 1668 1661 }; 1669 1662 module_i2c_driver(si5351_driver);
+1 -1
drivers/clk/clk-si544.c
··· 520 520 .name = "si544", 521 521 .of_match_table = clk_si544_of_match, 522 522 }, 523 - .probe_new = si544_probe, 523 + .probe = si544_probe, 524 524 .id_table = si544_id, 525 525 }; 526 526 module_i2c_driver(si544_driver);
+1 -1
drivers/clk/clk-si570.c
··· 510 510 .name = "si570", 511 511 .of_match_table = clk_si570_of_match, 512 512 }, 513 - .probe_new = si570_probe, 513 + .probe = si570_probe, 514 514 .id_table = si570_id, 515 515 }; 516 516 module_i2c_driver(si570_driver);
+1
drivers/clk/clk-stm32f4.c
··· 1045 1045 } 1046 1046 1047 1047 static const struct clk_ops cclk_mux_ops = { 1048 + .determine_rate = clk_hw_determine_rate_no_reparent, 1048 1049 .get_parent = cclk_mux_get_parent, 1049 1050 .set_parent = cclk_mux_set_parent, 1050 1051 };
+42 -10
drivers/clk/clk-versaclock5.c
··· 20 20 #include <linux/module.h> 21 21 #include <linux/of.h> 22 22 #include <linux/of_platform.h> 23 + #include <linux/property.h> 23 24 #include <linux/regmap.h> 24 25 #include <linux/slab.h> 25 26 ··· 282 281 } 283 282 284 283 static const struct clk_ops vc5_mux_ops = { 284 + .determine_rate = clk_hw_determine_rate_no_reparent, 285 285 .set_parent = vc5_mux_set_parent, 286 286 .get_parent = vc5_mux_get_parent, 287 287 }; ··· 727 725 static const struct clk_ops vc5_clk_out_ops = { 728 726 .prepare = vc5_clk_out_prepare, 729 727 .unprepare = vc5_clk_out_unprepare, 728 + .determine_rate = clk_hw_determine_rate_no_reparent, 730 729 .set_parent = vc5_clk_out_set_parent, 731 730 .get_parent = vc5_clk_out_get_parent, 732 731 }; ··· 956 953 957 954 i2c_set_clientdata(client, vc5); 958 955 vc5->client = client; 959 - vc5->chip_info = of_device_get_match_data(&client->dev); 956 + vc5->chip_info = device_get_match_data(&client->dev); 960 957 961 958 vc5->pin_xin = devm_clk_get(&client->dev, "xin"); 962 959 if (PTR_ERR(vc5->pin_xin) == -EPROBE_DEFER) ··· 1031 1028 } 1032 1029 1033 1030 init.name = kasprintf(GFP_KERNEL, "%pOFn.mux", client->dev.of_node); 1031 + if (!init.name) { 1032 + ret = -ENOMEM; 1033 + goto err_clk; 1034 + } 1035 + 1034 1036 init.ops = &vc5_mux_ops; 1035 1037 init.flags = 0; 1036 1038 init.parent_names = parent_names; ··· 1050 1042 memset(&init, 0, sizeof(init)); 1051 1043 init.name = kasprintf(GFP_KERNEL, "%pOFn.dbl", 1052 1044 client->dev.of_node); 1045 + if (!init.name) { 1046 + ret = -ENOMEM; 1047 + goto err_clk; 1048 + } 1053 1049 init.ops = &vc5_dbl_ops; 1054 1050 init.flags = CLK_SET_RATE_PARENT; 1055 1051 init.parent_names = parent_names; ··· 1069 1057 /* Register PFD */ 1070 1058 memset(&init, 0, sizeof(init)); 1071 1059 init.name = kasprintf(GFP_KERNEL, "%pOFn.pfd", client->dev.of_node); 1060 + if (!init.name) { 1061 + ret = -ENOMEM; 1062 + goto err_clk; 1063 + } 1072 1064 init.ops = &vc5_pfd_ops; 1073 1065 init.flags = CLK_SET_RATE_PARENT; 1074 1066 init.parent_names = parent_names; ··· 1090 1074 /* Register PLL */ 1091 1075 memset(&init, 0, sizeof(init)); 1092 1076 init.name = kasprintf(GFP_KERNEL, "%pOFn.pll", client->dev.of_node); 1077 + if (!init.name) { 1078 + ret = -ENOMEM; 1079 + goto err_clk; 1080 + } 1093 1081 init.ops = &vc5_pll_ops; 1094 1082 init.flags = CLK_SET_RATE_PARENT; 1095 1083 init.parent_names = parent_names; ··· 1113 1093 memset(&init, 0, sizeof(init)); 1114 1094 init.name = kasprintf(GFP_KERNEL, "%pOFn.fod%d", 1115 1095 client->dev.of_node, idx); 1096 + if (!init.name) { 1097 + ret = -ENOMEM; 1098 + goto err_clk; 1099 + } 1116 1100 init.ops = &vc5_fod_ops; 1117 1101 init.flags = CLK_SET_RATE_PARENT; 1118 1102 init.parent_names = parent_names; ··· 1135 1111 memset(&init, 0, sizeof(init)); 1136 1112 init.name = kasprintf(GFP_KERNEL, "%pOFn.out0_sel_i2cb", 1137 1113 client->dev.of_node); 1114 + if (!init.name) { 1115 + ret = -ENOMEM; 1116 + goto err_clk; 1117 + } 1138 1118 init.ops = &vc5_clk_out_ops; 1139 1119 init.flags = CLK_SET_RATE_PARENT; 1140 1120 init.parent_names = parent_names; ··· 1165 1137 memset(&init, 0, sizeof(init)); 1166 1138 init.name = kasprintf(GFP_KERNEL, "%pOFn.out%d", 1167 1139 client->dev.of_node, idx + 1); 1140 + if (!init.name) { 1141 + ret = -ENOMEM; 1142 + goto err_clk; 1143 + } 1168 1144 init.ops = &vc5_clk_out_ops; 1169 1145 init.flags = CLK_SET_RATE_PARENT; 1170 1146 init.parent_names = parent_names; ··· 1303 1271 }; 1304 1272 1305 1273 static const struct i2c_device_id vc5_id[] = { 1306 - { "5p49v5923", .driver_data = IDT_VC5_5P49V5923 }, 1307 - { "5p49v5925", .driver_data = IDT_VC5_5P49V5925 }, 1308 - { "5p49v5933", .driver_data = IDT_VC5_5P49V5933 }, 1309 - { "5p49v5935", .driver_data = IDT_VC5_5P49V5935 }, 1310 - { "5p49v60", .driver_data = IDT_VC6_5P49V60 }, 1311 - { "5p49v6901", .driver_data = IDT_VC6_5P49V6901 }, 1312 - { "5p49v6965", .driver_data = IDT_VC6_5P49V6965 }, 1313 - { "5p49v6975", .driver_data = IDT_VC6_5P49V6975 }, 1274 + { "5p49v5923", .driver_data = (kernel_ulong_t)&idt_5p49v5923_info }, 1275 + { "5p49v5925", .driver_data = (kernel_ulong_t)&idt_5p49v5925_info }, 1276 + { "5p49v5933", .driver_data = (kernel_ulong_t)&idt_5p49v5933_info }, 1277 + { "5p49v5935", .driver_data = (kernel_ulong_t)&idt_5p49v5935_info }, 1278 + { "5p49v60", .driver_data = (kernel_ulong_t)&idt_5p49v60_info }, 1279 + { "5p49v6901", .driver_data = (kernel_ulong_t)&idt_5p49v6901_info }, 1280 + { "5p49v6965", .driver_data = (kernel_ulong_t)&idt_5p49v6965_info }, 1281 + { "5p49v6975", .driver_data = (kernel_ulong_t)&idt_5p49v6975_info }, 1314 1282 { } 1315 1283 }; 1316 1284 MODULE_DEVICE_TABLE(i2c, vc5_id); ··· 1336 1304 .pm = &vc5_pm_ops, 1337 1305 .of_match_table = clk_vc5_of_match, 1338 1306 }, 1339 - .probe_new = vc5_probe, 1307 + .probe = vc5_probe, 1340 1308 .remove = vc5_remove, 1341 1309 .id_table = vc5_id, 1342 1310 };
+4 -3
drivers/clk/clk-versaclock7.c
··· 15 15 #include <linux/module.h> 16 16 #include <linux/of.h> 17 17 #include <linux/of_platform.h> 18 + #include <linux/property.h> 18 19 #include <linux/regmap.h> 19 20 #include <linux/swab.h> 20 21 ··· 1109 1108 1110 1109 i2c_set_clientdata(client, vc7); 1111 1110 vc7->client = client; 1112 - vc7->chip_info = of_device_get_match_data(&client->dev); 1111 + vc7->chip_info = device_get_match_data(&client->dev); 1113 1112 1114 1113 vc7->pin_xin = devm_clk_get(&client->dev, "xin"); 1115 1114 if (PTR_ERR(vc7->pin_xin) == -EPROBE_DEFER) { ··· 1283 1282 }; 1284 1283 1285 1284 static const struct i2c_device_id vc7_i2c_id[] = { 1286 - { "rc21008a", VC7_RC21008A }, 1285 + { "rc21008a", .driver_data = (kernel_ulong_t)&vc7_rc21008a_info }, 1287 1286 {} 1288 1287 }; 1289 1288 MODULE_DEVICE_TABLE(i2c, vc7_i2c_id); ··· 1299 1298 .name = "vc7", 1300 1299 .of_match_table = vc7_of_match, 1301 1300 }, 1302 - .probe_new = vc7_probe, 1301 + .probe = vc7_probe, 1303 1302 .remove = vc7_remove, 1304 1303 .id_table = vc7_i2c_id, 1305 1304 };
+1
drivers/clk/clk-wm831x.c
··· 329 329 .is_prepared = wm831x_clkout_is_prepared, 330 330 .prepare = wm831x_clkout_prepare, 331 331 .unprepare = wm831x_clkout_unprepare, 332 + .determine_rate = clk_hw_determine_rate_no_reparent, 332 333 .get_parent = wm831x_clkout_get_parent, 333 334 .set_parent = wm831x_clkout_set_parent, 334 335 };
+79 -32
drivers/clk/clk.c
··· 594 594 req->max_rate = old_req->max_rate; 595 595 } 596 596 597 + static int 598 + clk_core_determine_rate_no_reparent(struct clk_hw *hw, 599 + struct clk_rate_request *req) 600 + { 601 + struct clk_core *core = hw->core; 602 + struct clk_core *parent = core->parent; 603 + unsigned long best; 604 + int ret; 605 + 606 + if (core->flags & CLK_SET_RATE_PARENT) { 607 + struct clk_rate_request parent_req; 608 + 609 + if (!parent) { 610 + req->rate = 0; 611 + return 0; 612 + } 613 + 614 + clk_core_forward_rate_req(core, req, parent, &parent_req, 615 + req->rate); 616 + 617 + trace_clk_rate_request_start(&parent_req); 618 + 619 + ret = clk_core_round_rate_nolock(parent, &parent_req); 620 + if (ret) 621 + return ret; 622 + 623 + trace_clk_rate_request_done(&parent_req); 624 + 625 + best = parent_req.rate; 626 + } else if (parent) { 627 + best = clk_core_get_rate_nolock(parent); 628 + } else { 629 + best = clk_core_get_rate_nolock(core); 630 + } 631 + 632 + req->best_parent_rate = best; 633 + req->rate = best; 634 + 635 + return 0; 636 + } 637 + 597 638 int clk_mux_determine_rate_flags(struct clk_hw *hw, 598 639 struct clk_rate_request *req, 599 640 unsigned long flags) ··· 644 603 unsigned long best = 0; 645 604 646 605 /* if NO_REPARENT flag set, pass through to current parent */ 647 - if (core->flags & CLK_SET_RATE_NO_REPARENT) { 648 - parent = core->parent; 649 - if (core->flags & CLK_SET_RATE_PARENT) { 650 - struct clk_rate_request parent_req; 651 - 652 - if (!parent) { 653 - req->rate = 0; 654 - return 0; 655 - } 656 - 657 - clk_core_forward_rate_req(core, req, parent, &parent_req, req->rate); 658 - 659 - trace_clk_rate_request_start(&parent_req); 660 - 661 - ret = clk_core_round_rate_nolock(parent, &parent_req); 662 - if (ret) 663 - return ret; 664 - 665 - trace_clk_rate_request_done(&parent_req); 666 - 667 - best = parent_req.rate; 668 - } else if (parent) { 669 - best = clk_core_get_rate_nolock(parent); 670 - } else { 671 - best = clk_core_get_rate_nolock(core); 672 - } 673 - 674 - goto out; 675 - } 606 + if (core->flags & CLK_SET_RATE_NO_REPARENT) 607 + return clk_core_determine_rate_no_reparent(hw, req); 676 608 677 609 /* find the parent that can provide the fastest rate <= rate */ 678 610 num_parents = core->num_parents; ··· 684 670 if (!best_parent) 685 671 return -EINVAL; 686 672 687 - out: 688 - if (best_parent) 689 - req->best_parent_hw = best_parent->hw; 673 + req->best_parent_hw = best_parent->hw; 690 674 req->best_parent_rate = best; 691 675 req->rate = best; 692 676 ··· 783 771 return clk_mux_determine_rate_flags(hw, req, CLK_MUX_ROUND_CLOSEST); 784 772 } 785 773 EXPORT_SYMBOL_GPL(__clk_mux_determine_rate_closest); 774 + 775 + /* 776 + * clk_hw_determine_rate_no_reparent - clk_ops::determine_rate implementation for a clk that doesn't reparent 777 + * @hw: mux type clk to determine rate on 778 + * @req: rate request, also used to return preferred frequency 779 + * 780 + * Helper for finding best parent rate to provide a given frequency. 781 + * This can be used directly as a determine_rate callback (e.g. for a 782 + * mux), or from a more complex clock that may combine a mux with other 783 + * operations. 784 + * 785 + * Returns: 0 on success, -EERROR value on error 786 + */ 787 + int clk_hw_determine_rate_no_reparent(struct clk_hw *hw, 788 + struct clk_rate_request *req) 789 + { 790 + return clk_core_determine_rate_no_reparent(hw, req); 791 + } 792 + EXPORT_SYMBOL_GPL(clk_hw_determine_rate_no_reparent); 786 793 787 794 /*** clk api ***/ 788 795 ··· 1580 1549 parent->core, req, 1581 1550 parent_rate); 1582 1551 } 1552 + EXPORT_SYMBOL_GPL(clk_hw_forward_rate_request); 1583 1553 1584 1554 static bool clk_core_can_round(struct clk_core * const core) 1585 1555 { ··· 3777 3745 goto out; 3778 3746 } 3779 3747 3748 + if (core->ops->set_parent && !core->ops->determine_rate) { 3749 + pr_err("%s: %s must implement .set_parent & .determine_rate\n", 3750 + __func__, core->name); 3751 + ret = -EINVAL; 3752 + goto out; 3753 + } 3754 + 3780 3755 if (core->num_parents > 1 && !core->ops->get_parent) { 3781 3756 pr_err("%s: %s must implement .get_parent as it has multi parents\n", 3782 3757 __func__, core->name); ··· 4340 4301 return -ENXIO; 4341 4302 } 4342 4303 4304 + static int clk_nodrv_determine_rate(struct clk_hw *hw, 4305 + struct clk_rate_request *req) 4306 + { 4307 + return -ENXIO; 4308 + } 4309 + 4343 4310 static const struct clk_ops clk_nodrv_ops = { 4344 4311 .enable = clk_nodrv_prepare_enable, 4345 4312 .disable = clk_nodrv_disable_unprepare, 4346 4313 .prepare = clk_nodrv_prepare_enable, 4347 4314 .unprepare = clk_nodrv_disable_unprepare, 4315 + .determine_rate = clk_nodrv_determine_rate, 4348 4316 .set_rate = clk_nodrv_set_rate, 4349 4317 .set_parent = clk_nodrv_set_parent, 4350 4318 }; ··· 4741 4695 if (!ret) { 4742 4696 devres->clk = clk; 4743 4697 devres->nb = nb; 4698 + devres_add(dev, devres); 4744 4699 } else { 4745 4700 devres_free(devres); 4746 4701 }
+175 -5
drivers/clk/clk_test.c
··· 104 104 }; 105 105 106 106 static const struct clk_ops clk_dummy_single_parent_ops = { 107 + /* 108 + * FIXME: Even though we should probably be able to use 109 + * __clk_mux_determine_rate() here, if we use it and call 110 + * clk_round_rate() or clk_set_rate() with a rate lower than 111 + * what all the parents can provide, it will return -EINVAL. 112 + * 113 + * This is due to the fact that it has the undocumented 114 + * behaviour to always pick up the closest rate higher than the 115 + * requested rate. If we get something lower, it thus considers 116 + * that it's not acceptable and will return an error. 117 + * 118 + * It's somewhat inconsistent and creates a weird threshold 119 + * between rates above the parent rate which would be rounded to 120 + * what the parent can provide, but rates below will simply 121 + * return an error. 122 + */ 123 + .determine_rate = __clk_mux_determine_rate_closest, 107 124 .set_parent = clk_dummy_single_set_parent, 108 125 .get_parent = clk_dummy_single_get_parent, 109 126 }; ··· 156 139 .get_parent = clk_multiple_parents_mux_get_parent, 157 140 .set_parent = clk_multiple_parents_mux_set_parent, 158 141 .determine_rate = __clk_mux_determine_rate_closest, 142 + }; 143 + 144 + static const struct clk_ops clk_multiple_parents_no_reparent_mux_ops = { 145 + .determine_rate = clk_hw_determine_rate_no_reparent, 146 + .get_parent = clk_multiple_parents_mux_get_parent, 147 + .set_parent = clk_multiple_parents_mux_set_parent, 159 148 }; 160 149 161 150 static int clk_test_init_with_ops(struct kunit *test, const struct clk_ops *ops) ··· 289 266 struct clk_dummy_context *ctx = test->priv; 290 267 struct clk_hw *hw = &ctx->hw; 291 268 struct clk *clk = clk_hw_get_clk(hw, NULL); 292 - unsigned long rounded_rate, set_rate; 269 + unsigned long set_rate; 270 + long rounded_rate; 293 271 294 272 rounded_rate = clk_round_rate(clk, DUMMY_CLOCK_RATE_1); 295 273 KUNIT_ASSERT_GT(test, rounded_rate, 0); ··· 875 851 struct clk_multiple_parent_ctx *ctx = test->priv; 876 852 struct clk_hw *hw = &ctx->hw; 877 853 struct clk *clk = clk_hw_get_clk(hw, NULL); 878 - unsigned long rate; 854 + long rate; 879 855 int ret; 880 856 881 857 ret = clk_set_rate_range(clk, DUMMY_CLOCK_RATE_1, DUMMY_CLOCK_RATE_2); ··· 1114 1090 struct clk_hw *hw = &ctx->hw; 1115 1091 struct clk *clk = clk_hw_get_clk(hw, NULL); 1116 1092 struct clk *parent; 1117 - unsigned long rate; 1093 + long rate; 1118 1094 int ret; 1119 1095 1120 1096 parent = clk_get_parent(clk); ··· 1144 1120 struct clk_hw *hw = &ctx->hw; 1145 1121 struct clk *clk = clk_hw_get_clk(hw, NULL); 1146 1122 struct clk *parent; 1147 - unsigned long rate; 1123 + long rate; 1148 1124 int ret; 1149 1125 1150 1126 parent = clk_get_parent(clk); ··· 1182 1158 struct clk_hw *hw = &ctx->hw; 1183 1159 struct clk *clk = clk_hw_get_clk(hw, NULL); 1184 1160 struct clk *parent; 1185 - unsigned long rate; 1161 + long rate; 1186 1162 int ret; 1187 1163 1188 1164 parent = clk_get_parent(clk); ··· 2418 2394 .test_cases = clk_mux_notifier_test_cases, 2419 2395 }; 2420 2396 2397 + static int 2398 + clk_mux_no_reparent_test_init(struct kunit *test) 2399 + { 2400 + struct clk_multiple_parent_ctx *ctx; 2401 + const char *parents[2] = { "parent-0", "parent-1"}; 2402 + int ret; 2403 + 2404 + ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); 2405 + if (!ctx) 2406 + return -ENOMEM; 2407 + test->priv = ctx; 2408 + 2409 + ctx->parents_ctx[0].hw.init = CLK_HW_INIT_NO_PARENT("parent-0", 2410 + &clk_dummy_rate_ops, 2411 + 0); 2412 + ctx->parents_ctx[0].rate = DUMMY_CLOCK_RATE_1; 2413 + ret = clk_hw_register(NULL, &ctx->parents_ctx[0].hw); 2414 + if (ret) 2415 + return ret; 2416 + 2417 + ctx->parents_ctx[1].hw.init = CLK_HW_INIT_NO_PARENT("parent-1", 2418 + &clk_dummy_rate_ops, 2419 + 0); 2420 + ctx->parents_ctx[1].rate = DUMMY_CLOCK_RATE_2; 2421 + ret = clk_hw_register(NULL, &ctx->parents_ctx[1].hw); 2422 + if (ret) 2423 + return ret; 2424 + 2425 + ctx->current_parent = 0; 2426 + ctx->hw.init = CLK_HW_INIT_PARENTS("test-mux", parents, 2427 + &clk_multiple_parents_no_reparent_mux_ops, 2428 + 0); 2429 + ret = clk_hw_register(NULL, &ctx->hw); 2430 + if (ret) 2431 + return ret; 2432 + 2433 + return 0; 2434 + } 2435 + 2436 + static void 2437 + clk_mux_no_reparent_test_exit(struct kunit *test) 2438 + { 2439 + struct clk_multiple_parent_ctx *ctx = test->priv; 2440 + 2441 + clk_hw_unregister(&ctx->hw); 2442 + clk_hw_unregister(&ctx->parents_ctx[0].hw); 2443 + clk_hw_unregister(&ctx->parents_ctx[1].hw); 2444 + } 2445 + 2446 + /* 2447 + * Test that if the we have a mux that cannot change parent and we call 2448 + * clk_round_rate() on it with a rate that should cause it to change 2449 + * parent, it won't. 2450 + */ 2451 + static void clk_mux_no_reparent_round_rate(struct kunit *test) 2452 + { 2453 + struct clk_multiple_parent_ctx *ctx = test->priv; 2454 + struct clk_hw *hw = &ctx->hw; 2455 + struct clk *clk = clk_hw_get_clk(hw, NULL); 2456 + struct clk *other_parent, *parent; 2457 + unsigned long other_parent_rate; 2458 + unsigned long parent_rate; 2459 + long rounded_rate; 2460 + 2461 + parent = clk_get_parent(clk); 2462 + KUNIT_ASSERT_PTR_NE(test, parent, NULL); 2463 + 2464 + parent_rate = clk_get_rate(parent); 2465 + KUNIT_ASSERT_GT(test, parent_rate, 0); 2466 + 2467 + other_parent = clk_hw_get_clk(&ctx->parents_ctx[1].hw, NULL); 2468 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, other_parent); 2469 + KUNIT_ASSERT_FALSE(test, clk_is_match(parent, other_parent)); 2470 + 2471 + other_parent_rate = clk_get_rate(other_parent); 2472 + KUNIT_ASSERT_GT(test, other_parent_rate, 0); 2473 + clk_put(other_parent); 2474 + 2475 + rounded_rate = clk_round_rate(clk, other_parent_rate); 2476 + KUNIT_ASSERT_GT(test, rounded_rate, 0); 2477 + KUNIT_EXPECT_EQ(test, rounded_rate, parent_rate); 2478 + 2479 + clk_put(clk); 2480 + } 2481 + 2482 + /* 2483 + * Test that if the we have a mux that cannot change parent and we call 2484 + * clk_set_rate() on it with a rate that should cause it to change 2485 + * parent, it won't. 2486 + */ 2487 + static void clk_mux_no_reparent_set_rate(struct kunit *test) 2488 + { 2489 + struct clk_multiple_parent_ctx *ctx = test->priv; 2490 + struct clk_hw *hw = &ctx->hw; 2491 + struct clk *clk = clk_hw_get_clk(hw, NULL); 2492 + struct clk *other_parent, *parent; 2493 + unsigned long other_parent_rate; 2494 + unsigned long parent_rate; 2495 + unsigned long rate; 2496 + int ret; 2497 + 2498 + parent = clk_get_parent(clk); 2499 + KUNIT_ASSERT_PTR_NE(test, parent, NULL); 2500 + 2501 + parent_rate = clk_get_rate(parent); 2502 + KUNIT_ASSERT_GT(test, parent_rate, 0); 2503 + 2504 + other_parent = clk_hw_get_clk(&ctx->parents_ctx[1].hw, NULL); 2505 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, other_parent); 2506 + KUNIT_ASSERT_FALSE(test, clk_is_match(parent, other_parent)); 2507 + 2508 + other_parent_rate = clk_get_rate(other_parent); 2509 + KUNIT_ASSERT_GT(test, other_parent_rate, 0); 2510 + clk_put(other_parent); 2511 + 2512 + ret = clk_set_rate(clk, other_parent_rate); 2513 + KUNIT_ASSERT_EQ(test, ret, 0); 2514 + 2515 + rate = clk_get_rate(clk); 2516 + KUNIT_ASSERT_GT(test, rate, 0); 2517 + KUNIT_EXPECT_EQ(test, rate, parent_rate); 2518 + 2519 + clk_put(clk); 2520 + } 2521 + 2522 + static struct kunit_case clk_mux_no_reparent_test_cases[] = { 2523 + KUNIT_CASE(clk_mux_no_reparent_round_rate), 2524 + KUNIT_CASE(clk_mux_no_reparent_set_rate), 2525 + {} 2526 + }; 2527 + 2528 + /* 2529 + * Test suite for a clock mux that isn't allowed to change parent, using 2530 + * the clk_hw_determine_rate_no_reparent() helper. 2531 + * 2532 + * These tests exercise that helper, and the proper selection of 2533 + * rates and parents. 2534 + */ 2535 + static struct kunit_suite clk_mux_no_reparent_test_suite = { 2536 + .name = "clk-mux-no-reparent", 2537 + .init = clk_mux_no_reparent_test_init, 2538 + .exit = clk_mux_no_reparent_test_exit, 2539 + .test_cases = clk_mux_no_reparent_test_cases, 2540 + }; 2541 + 2421 2542 kunit_test_suites( 2422 2543 &clk_leaf_mux_set_rate_parent_test_suite, 2423 2544 &clk_test_suite, 2424 2545 &clk_multiple_parents_mux_test_suite, 2546 + &clk_mux_no_reparent_test_suite, 2425 2547 &clk_mux_notifier_test_suite, 2426 2548 &clk_orphan_transparent_multiple_parent_mux_test_suite, 2427 2549 &clk_orphan_transparent_single_parent_test_suite,
+8 -4
drivers/clk/davinci/da8xx-cfgchip.c
··· 229 229 } 230 230 231 231 static const struct clk_ops da8xx_cfgchip_mux_clk_ops = { 232 + .determine_rate = clk_hw_determine_rate_no_reparent, 232 233 .set_parent = da8xx_cfgchip_mux_clk_set_parent, 233 234 .get_parent = da8xx_cfgchip_mux_clk_get_parent, 234 235 }; ··· 462 461 return 48000000; 463 462 } 464 463 465 - static long da8xx_usb0_clk48_round_rate(struct clk_hw *hw, unsigned long rate, 466 - unsigned long *parent_rate) 464 + static int da8xx_usb0_clk48_determine_rate(struct clk_hw *hw, 465 + struct clk_rate_request *req) 467 466 { 468 - return 48000000; 467 + req->rate = 48000000; 468 + 469 + return 0; 469 470 } 470 471 471 472 static int da8xx_usb0_clk48_set_parent(struct clk_hw *hw, u8 index) ··· 496 493 .disable = da8xx_usb0_clk48_disable, 497 494 .is_enabled = da8xx_usb0_clk48_is_enabled, 498 495 .recalc_rate = da8xx_usb0_clk48_recalc_rate, 499 - .round_rate = da8xx_usb0_clk48_round_rate, 496 + .determine_rate = da8xx_usb0_clk48_determine_rate, 500 497 .set_parent = da8xx_usb0_clk48_set_parent, 501 498 .get_parent = da8xx_usb0_clk48_get_parent, 502 499 }; ··· 567 564 } 568 565 569 566 static const struct clk_ops da8xx_usb1_clk48_ops = { 567 + .determine_rate = clk_hw_determine_rate_no_reparent, 570 568 .set_parent = da8xx_usb1_clk48_set_parent, 571 569 .get_parent = da8xx_usb1_clk48_get_parent, 572 570 };
+1
drivers/clk/imx/clk-busy.c
··· 148 148 } 149 149 150 150 static const struct clk_ops clk_busy_mux_ops = { 151 + .determine_rate = clk_hw_determine_rate_no_reparent, 151 152 .get_parent = clk_busy_mux_get_parent, 152 153 .set_parent = clk_busy_mux_set_parent, 153 154 };
+31
drivers/clk/imx/clk-composite-8m.c
··· 119 119 return ret; 120 120 } 121 121 122 + static int imx8m_divider_determine_rate(struct clk_hw *hw, 123 + struct clk_rate_request *req) 124 + { 125 + struct clk_divider *divider = to_clk_divider(hw); 126 + int prediv_value; 127 + int div_value; 128 + 129 + /* if read only, just return current value */ 130 + if (divider->flags & CLK_DIVIDER_READ_ONLY) { 131 + u32 val; 132 + 133 + val = readl(divider->reg); 134 + prediv_value = val >> divider->shift; 135 + prediv_value &= clk_div_mask(divider->width); 136 + prediv_value++; 137 + 138 + div_value = val >> PCG_DIV_SHIFT; 139 + div_value &= clk_div_mask(PCG_DIV_WIDTH); 140 + div_value++; 141 + 142 + return divider_ro_determine_rate(hw, req, divider->table, 143 + PCG_PREDIV_WIDTH + PCG_DIV_WIDTH, 144 + divider->flags, prediv_value * div_value); 145 + } 146 + 147 + return divider_determine_rate(hw, req, divider->table, 148 + PCG_PREDIV_WIDTH + PCG_DIV_WIDTH, 149 + divider->flags); 150 + } 151 + 122 152 static const struct clk_ops imx8m_clk_composite_divider_ops = { 123 153 .recalc_rate = imx8m_clk_composite_divider_recalc_rate, 124 154 .round_rate = imx8m_clk_composite_divider_round_rate, 125 155 .set_rate = imx8m_clk_composite_divider_set_rate, 156 + .determine_rate = imx8m_divider_determine_rate, 126 157 }; 127 158 128 159 static u8 imx8m_clk_composite_mux_get_parent(struct clk_hw *hw)
+1
drivers/clk/imx/clk-fixup-mux.c
··· 60 60 } 61 61 62 62 static const struct clk_ops clk_fixup_mux_ops = { 63 + .determine_rate = clk_hw_determine_rate_no_reparent, 63 64 .get_parent = clk_fixup_mux_get_parent, 64 65 .set_parent = clk_fixup_mux_set_parent, 65 66 };
+4 -4
drivers/clk/imx/clk-imx6sx.c
··· 302 302 hws[IMX6SX_CLK_CKO2_SEL] = imx_clk_hw_mux("cko2_sel", base + 0x60, 16, 5, cko2_sels, ARRAY_SIZE(cko2_sels)); 303 303 hws[IMX6SX_CLK_CKO] = imx_clk_hw_mux("cko", base + 0x60, 8, 1, cko_sels, ARRAY_SIZE(cko_sels)); 304 304 305 - 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); 306 - 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); 307 - 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); 308 - 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); 305 + hws[IMX6SX_CLK_LDB_DI1_DIV_SEL] = imx_clk_hw_mux("ldb_di1_div_sel", base + 0x20, 11, 1, ldb_di1_div_sels, ARRAY_SIZE(ldb_di1_div_sels)); 306 + hws[IMX6SX_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)); 307 + hws[IMX6SX_CLK_LDB_DI1_SEL] = imx_clk_hw_mux("ldb_di1_sel", base + 0x2c, 12, 3, ldb_di1_sels, ARRAY_SIZE(ldb_di1_sels)); 308 + hws[IMX6SX_CLK_LDB_DI0_SEL] = imx_clk_hw_mux("ldb_di0_sel", base + 0x2c, 9, 3, ldb_di0_sels, ARRAY_SIZE(ldb_di0_sels)); 309 309 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); 310 310 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); 311 311
+2
drivers/clk/imx/clk-imx6ul.c
··· 544 544 545 545 clk_set_parent(hws[IMX6UL_CLK_ENET1_REF_SEL]->clk, hws[IMX6UL_CLK_ENET_REF]->clk); 546 546 clk_set_parent(hws[IMX6UL_CLK_ENET2_REF_SEL]->clk, hws[IMX6UL_CLK_ENET2_REF]->clk); 547 + 548 + imx_register_uart_clocks(); 547 549 } 548 550 549 551 CLK_OF_DECLARE(imx6ul, "fsl,imx6ul-ccm", imx6ul_clocks_init);
+4 -4
drivers/clk/imx/clk-imx8mn.c
··· 323 323 void __iomem *base; 324 324 int ret; 325 325 326 - clk_hw_data = kzalloc(struct_size(clk_hw_data, hws, 326 + clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, 327 327 IMX8MN_CLK_END), GFP_KERNEL); 328 328 if (WARN_ON(!clk_hw_data)) 329 329 return -ENOMEM; ··· 340 340 hws[IMX8MN_CLK_EXT4] = imx_get_clk_hw_by_name(np, "clk_ext4"); 341 341 342 342 np = of_find_compatible_node(NULL, NULL, "fsl,imx8mn-anatop"); 343 - base = of_iomap(np, 0); 343 + base = devm_of_iomap(dev, np, 0, NULL); 344 344 of_node_put(np); 345 - if (WARN_ON(!base)) { 346 - ret = -ENOMEM; 345 + if (WARN_ON(IS_ERR(base))) { 346 + ret = PTR_ERR(base); 347 347 goto unregister_hws; 348 348 } 349 349
+13 -11
drivers/clk/imx/clk-imx8mp.c
··· 414 414 struct device *dev = &pdev->dev; 415 415 struct device_node *np; 416 416 void __iomem *anatop_base, *ccm_base; 417 + int err; 417 418 418 419 np = of_find_compatible_node(NULL, NULL, "fsl,imx8mp-anatop"); 419 - anatop_base = of_iomap(np, 0); 420 + anatop_base = devm_of_iomap(dev, np, 0, NULL); 420 421 of_node_put(np); 421 - if (WARN_ON(!anatop_base)) 422 - return -ENOMEM; 422 + if (WARN_ON(IS_ERR(anatop_base))) 423 + return PTR_ERR(anatop_base); 423 424 424 425 np = dev->of_node; 425 426 ccm_base = devm_platform_ioremap_resource(pdev, 0); 426 - if (WARN_ON(IS_ERR(ccm_base))) { 427 - iounmap(anatop_base); 427 + if (WARN_ON(IS_ERR(ccm_base))) 428 428 return PTR_ERR(ccm_base); 429 - } 430 429 431 - clk_hw_data = kzalloc(struct_size(clk_hw_data, hws, IMX8MP_CLK_END), GFP_KERNEL); 432 - if (WARN_ON(!clk_hw_data)) { 433 - iounmap(anatop_base); 430 + clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, IMX8MP_CLK_END), GFP_KERNEL); 431 + if (WARN_ON(!clk_hw_data)) 434 432 return -ENOMEM; 435 - } 436 433 437 434 clk_hw_data->num = IMX8MP_CLK_END; 438 435 hws = clk_hw_data->hws; ··· 719 722 720 723 imx_check_clk_hws(hws, IMX8MP_CLK_END); 721 724 722 - of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data); 725 + err = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data); 726 + if (err < 0) { 727 + dev_err(dev, "failed to register hws for i.MX8MP\n"); 728 + imx_unregister_hw_clocks(hws, IMX8MP_CLK_END); 729 + return err; 730 + } 723 731 724 732 imx_register_uart_clocks(); 725 733
+8 -7
drivers/clk/imx/clk-imx93.c
··· 264 264 void __iomem *base, *anatop_base; 265 265 int i, ret; 266 266 267 - clk_hw_data = kzalloc(struct_size(clk_hw_data, hws, 267 + clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, 268 268 IMX93_CLK_END), GFP_KERNEL); 269 269 if (!clk_hw_data) 270 270 return -ENOMEM; ··· 288 288 "sys_pll_pfd2", 1, 2); 289 289 290 290 np = of_find_compatible_node(NULL, NULL, "fsl,imx93-anatop"); 291 - anatop_base = of_iomap(np, 0); 291 + anatop_base = devm_of_iomap(dev, np, 0, NULL); 292 292 of_node_put(np); 293 - if (WARN_ON(!anatop_base)) 294 - return -ENOMEM; 293 + if (WARN_ON(IS_ERR(anatop_base))) { 294 + ret = PTR_ERR(base); 295 + goto unregister_hws; 296 + } 295 297 296 298 clks[IMX93_CLK_ARM_PLL] = imx_clk_fracn_gppll_integer("arm_pll", "osc_24m", 297 299 anatop_base + 0x1000, ··· 306 304 np = dev->of_node; 307 305 base = devm_platform_ioremap_resource(pdev, 0); 308 306 if (WARN_ON(IS_ERR(base))) { 309 - iounmap(anatop_base); 310 - return PTR_ERR(base); 307 + ret = PTR_ERR(base); 308 + goto unregister_hws; 311 309 } 312 310 313 311 for (i = 0; i < ARRAY_SIZE(root_array); i++) { ··· 347 345 348 346 unregister_hws: 349 347 imx_unregister_hw_clocks(clks, IMX93_CLK_END); 350 - iounmap(anatop_base); 351 348 352 349 return ret; 353 350 }
+15 -7
drivers/clk/imx/clk-imxrt1050.c
··· 42 42 struct device_node *anp; 43 43 int ret; 44 44 45 - clk_hw_data = kzalloc(struct_size(clk_hw_data, hws, 45 + clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, 46 46 IMXRT1050_CLK_END), GFP_KERNEL); 47 47 if (WARN_ON(!clk_hw_data)) 48 48 return -ENOMEM; ··· 53 53 hws[IMXRT1050_CLK_OSC] = imx_get_clk_hw_by_name(np, "osc"); 54 54 55 55 anp = of_find_compatible_node(NULL, NULL, "fsl,imxrt-anatop"); 56 - pll_base = of_iomap(anp, 0); 56 + pll_base = devm_of_iomap(dev, anp, 0, NULL); 57 57 of_node_put(anp); 58 - if (WARN_ON(!pll_base)) 59 - return -ENOMEM; 58 + if (WARN_ON(IS_ERR(pll_base))) { 59 + ret = PTR_ERR(pll_base); 60 + goto unregister_hws; 61 + } 60 62 61 63 /* Anatop clocks */ 62 64 hws[IMXRT1050_CLK_DUMMY] = imx_clk_hw_fixed("dummy", 0UL); ··· 106 104 107 105 /* CCM clocks */ 108 106 ccm_base = devm_platform_ioremap_resource(pdev, 0); 109 - if (WARN_ON(IS_ERR(ccm_base))) 110 - return PTR_ERR(ccm_base); 107 + if (WARN_ON(IS_ERR(ccm_base))) { 108 + ret = PTR_ERR(ccm_base); 109 + goto unregister_hws; 110 + } 111 111 112 112 hws[IMXRT1050_CLK_ARM_PODF] = imx_clk_hw_divider("arm_podf", "pll1_arm", ccm_base + 0x10, 0, 3); 113 113 hws[IMXRT1050_CLK_PRE_PERIPH_SEL] = imx_clk_hw_mux("pre_periph_sel", ccm_base + 0x18, 18, 2, ··· 153 149 ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data); 154 150 if (ret < 0) { 155 151 dev_err(dev, "Failed to register clks for i.MXRT1050.\n"); 156 - imx_unregister_hw_clocks(hws, IMXRT1050_CLK_END); 152 + goto unregister_hws; 157 153 } 154 + return 0; 155 + 156 + unregister_hws: 157 + imx_unregister_hw_clocks(hws, IMXRT1050_CLK_END); 158 158 return ret; 159 159 } 160 160 static const struct of_device_id imxrt1050_clk_of_match[] = {
+21 -3
drivers/clk/imx/clk-scu.c
··· 251 251 } 252 252 253 253 /* 254 + * clk_scu_determine_rate - Returns the closest rate for a SCU clock 255 + * @hw: clock to round rate for 256 + * @req: clock rate request 257 + * 258 + * Returns 0 on success, a negative error on failure 259 + */ 260 + static int clk_scu_determine_rate(struct clk_hw *hw, 261 + struct clk_rate_request *req) 262 + { 263 + /* 264 + * Assume we support all the requested rate and let the SCU firmware 265 + * to handle the left work 266 + */ 267 + return 0; 268 + } 269 + 270 + /* 254 271 * clk_scu_round_rate - Round clock rate for a SCU clock 255 272 * @hw: clock to round rate for 256 273 * @rate: rate to round ··· 442 425 443 426 static const struct clk_ops clk_scu_ops = { 444 427 .recalc_rate = clk_scu_recalc_rate, 445 - .round_rate = clk_scu_round_rate, 428 + .determine_rate = clk_scu_determine_rate, 446 429 .set_rate = clk_scu_set_rate, 447 430 .get_parent = clk_scu_get_parent, 448 431 .set_parent = clk_scu_set_parent, ··· 724 707 725 708 void imx_clk_scu_unregister(void) 726 709 { 727 - struct imx_scu_clk_node *clk; 710 + struct imx_scu_clk_node *clk, *n; 728 711 int i; 729 712 730 713 for (i = 0; i < IMX_SC_R_LAST; i++) { 731 - list_for_each_entry(clk, &imx_scu_clks[i], node) { 714 + list_for_each_entry_safe(clk, n, &imx_scu_clks[i], node) { 732 715 clk_hw_unregister(clk->hw); 733 716 kfree(clk); 734 717 } ··· 802 785 } 803 786 804 787 static const struct clk_ops clk_gpr_mux_scu_ops = { 788 + .determine_rate = clk_hw_determine_rate_no_reparent, 805 789 .get_parent = clk_gpr_mux_scu_get_parent, 806 790 .set_parent = clk_gpr_mux_scu_set_parent, 807 791 };
-8
drivers/clk/imx/clk.c
··· 20 20 bool mcore_booted; 21 21 EXPORT_SYMBOL_GPL(mcore_booted); 22 22 23 - void imx_unregister_clocks(struct clk *clks[], unsigned int count) 24 - { 25 - unsigned int i; 26 - 27 - for (i = 0; i < count; i++) 28 - clk_unregister(clks[i]); 29 - } 30 - 31 23 void imx_unregister_hw_clocks(struct clk_hw *hws[], unsigned int count) 32 24 { 33 25 unsigned int i;
-1
drivers/clk/imx/clk.h
··· 19 19 } 20 20 #endif 21 21 void imx_mmdc_mask_handshake(void __iomem *ccm_base, unsigned int chn); 22 - void imx_unregister_clocks(struct clk *clks[], unsigned int count); 23 22 void imx_unregister_hw_clocks(struct clk_hw *hws[], unsigned int count); 24 23 25 24 extern void imx_cscmr1_fixup(u32 *val);
+8 -7
drivers/clk/ingenic/cgu.c
··· 491 491 return div; 492 492 } 493 493 494 - static long 495 - ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate, 496 - unsigned long *parent_rate) 494 + static int ingenic_clk_determine_rate(struct clk_hw *hw, 495 + struct clk_rate_request *req) 497 496 { 498 497 struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 499 498 const struct ingenic_cgu_clk_info *clk_info = to_clk_info(ingenic_clk); 500 499 unsigned int div = 1; 501 500 502 501 if (clk_info->type & CGU_CLK_DIV) 503 - div = ingenic_clk_calc_div(hw, clk_info, *parent_rate, req_rate); 502 + div = ingenic_clk_calc_div(hw, clk_info, req->best_parent_rate, 503 + req->rate); 504 504 else if (clk_info->type & CGU_CLK_FIXDIV) 505 505 div = clk_info->fixdiv.div; 506 506 else if (clk_hw_can_set_rate_parent(hw)) 507 - *parent_rate = req_rate; 507 + req->best_parent_rate = req->rate; 508 508 509 - return DIV_ROUND_UP(*parent_rate, div); 509 + req->rate = DIV_ROUND_UP(req->best_parent_rate, div); 510 + return 0; 510 511 } 511 512 512 513 static inline int ingenic_clk_check_stable(struct ingenic_cgu *cgu, ··· 627 626 .set_parent = ingenic_clk_set_parent, 628 627 629 628 .recalc_rate = ingenic_clk_recalc_rate, 630 - .round_rate = ingenic_clk_round_rate, 629 + .determine_rate = ingenic_clk_determine_rate, 631 630 .set_rate = ingenic_clk_set_rate, 632 631 633 632 .enable = ingenic_clk_enable,
+11 -8
drivers/clk/ingenic/tcu.c
··· 178 178 return 5; /* /1024 divider */ 179 179 } 180 180 181 - static long ingenic_tcu_round_rate(struct clk_hw *hw, unsigned long req_rate, 182 - unsigned long *parent_rate) 181 + static int ingenic_tcu_determine_rate(struct clk_hw *hw, 182 + struct clk_rate_request *req) 183 183 { 184 - unsigned long rate = *parent_rate; 184 + unsigned long rate = req->best_parent_rate; 185 185 u8 prescale; 186 186 187 - if (req_rate > rate) 188 - return rate; 187 + if (req->rate > rate) { 188 + req->rate = rate; 189 + return 0; 190 + } 189 191 190 - prescale = ingenic_tcu_get_prescale(rate, req_rate); 192 + prescale = ingenic_tcu_get_prescale(rate, req->rate); 191 193 192 - return rate >> (prescale * 2); 194 + req->rate = rate >> (prescale * 2); 195 + return 0; 193 196 } 194 197 195 198 static int ingenic_tcu_set_rate(struct clk_hw *hw, unsigned long req_rate, ··· 222 219 .set_parent = ingenic_tcu_set_parent, 223 220 224 221 .recalc_rate = ingenic_tcu_recalc_rate, 225 - .round_rate = ingenic_tcu_round_rate, 222 + .determine_rate = ingenic_tcu_determine_rate, 226 223 .set_rate = ingenic_tcu_set_rate, 227 224 228 225 .enable = ingenic_tcu_enable,
+2
drivers/clk/keystone/sci-clk.c
··· 294 294 295 295 name = kasprintf(GFP_KERNEL, "clk:%d:%d", sci_clk->dev_id, 296 296 sci_clk->clk_id); 297 + if (!name) 298 + return -ENOMEM; 297 299 298 300 init.name = name; 299 301
+42 -7
drivers/clk/keystone/syscon-clk.c
··· 4 4 */ 5 5 6 6 #include <linux/clk-provider.h> 7 + #include <linux/kernel.h> 7 8 #include <linux/mfd/syscon.h> 8 9 #include <linux/module.h> 9 10 #include <linux/platform_device.h> 10 11 #include <linux/regmap.h> 12 + #include <linux/slab.h> 11 13 12 14 struct ti_syscon_gate_clk_priv { 13 15 struct clk_hw hw; ··· 63 61 64 62 static struct clk_hw 65 63 *ti_syscon_gate_clk_register(struct device *dev, struct regmap *regmap, 64 + const char *parent_name, 66 65 const struct ti_syscon_gate_clk_data *data) 67 66 { 68 67 struct ti_syscon_gate_clk_priv *priv; 69 68 struct clk_init_data init; 69 + char *name = NULL; 70 70 int ret; 71 71 72 72 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 73 73 if (!priv) 74 74 return ERR_PTR(-ENOMEM); 75 75 76 - init.name = data->name; 77 76 init.ops = &ti_syscon_gate_clk_ops; 78 - init.parent_names = NULL; 79 - init.num_parents = 0; 80 - init.flags = 0; 77 + if (parent_name) { 78 + name = kasprintf(GFP_KERNEL, "%s:%s", data->name, parent_name); 79 + init.name = name; 80 + init.parent_names = &parent_name; 81 + init.num_parents = 1; 82 + init.flags = CLK_SET_RATE_PARENT; 83 + } else { 84 + init.name = data->name; 85 + init.parent_names = NULL; 86 + init.num_parents = 0; 87 + init.flags = 0; 88 + } 81 89 82 90 priv->regmap = regmap; 83 91 priv->reg = data->offset; ··· 95 83 priv->hw.init = &init; 96 84 97 85 ret = devm_clk_hw_register(dev, &priv->hw); 86 + 87 + if (name) 88 + kfree(init.name); 89 + 98 90 if (ret) 99 91 return ERR_PTR(ret); 100 92 ··· 110 94 const struct ti_syscon_gate_clk_data *data, *p; 111 95 struct clk_hw_onecell_data *hw_data; 112 96 struct device *dev = &pdev->dev; 97 + int num_clks, num_parents, i; 98 + const char *parent_name; 113 99 struct regmap *regmap; 114 - int num_clks, i; 115 100 116 101 data = device_get_match_data(dev); 117 102 if (!data) 118 103 return -EINVAL; 119 104 120 - regmap = syscon_node_to_regmap(dev->of_node); 105 + regmap = device_node_to_regmap(dev->of_node); 121 106 if (IS_ERR(regmap)) 122 107 return dev_err_probe(dev, PTR_ERR(regmap), 123 - "failed to find parent regmap\n"); 108 + "failed to get regmap\n"); 124 109 125 110 num_clks = 0; 126 111 for (p = data; p->name; p++) 127 112 num_clks++; 113 + 114 + num_parents = of_clk_get_parent_count(dev->of_node); 115 + if (of_device_is_compatible(dev->of_node, "ti,am62-audio-refclk") && 116 + num_parents == 0) { 117 + return dev_err_probe(dev, -EINVAL, 118 + "must specify a parent clock\n"); 119 + } 128 120 129 121 hw_data = devm_kzalloc(dev, struct_size(hw_data, hws, num_clks), 130 122 GFP_KERNEL); ··· 141 117 142 118 hw_data->num = num_clks; 143 119 120 + parent_name = of_clk_get_parent_name(dev->of_node, 0); 144 121 for (i = 0; i < num_clks; i++) { 145 122 hw_data->hws[i] = ti_syscon_gate_clk_register(dev, regmap, 123 + parent_name, 146 124 &data[i]); 147 125 if (IS_ERR(hw_data->hws[i])) 148 126 dev_warn(dev, "failed to register %s\n", ··· 192 166 { /* Sentinel */ }, 193 167 }; 194 168 169 + static const struct ti_syscon_gate_clk_data am62_audio_clk_data[] = { 170 + TI_SYSCON_CLK_GATE("audio_refclk", 0x0, 15), 171 + { /* Sentinel */ }, 172 + }; 173 + 195 174 static const struct of_device_id ti_syscon_gate_clk_ids[] = { 196 175 { 197 176 .compatible = "ti,am654-ehrpwm-tbclk", ··· 209 178 { 210 179 .compatible = "ti,am62-epwm-tbclk", 211 180 .data = &am62_clk_data, 181 + }, 182 + { 183 + .compatible = "ti,am62-audio-refclk", 184 + .data = &am62_audio_clk_data, 212 185 }, 213 186 { } 214 187 };
+12
drivers/clk/mediatek/Kconfig
··· 781 781 config COMMON_CLK_MT8192_AUDSYS 782 782 tristate "Clock driver for MediaTek MT8192 audsys" 783 783 depends on COMMON_CLK_MT8192 784 + default COMMON_CLK_MT8192 784 785 help 785 786 This driver supports MediaTek MT8192 audsys clocks. 786 787 787 788 config COMMON_CLK_MT8192_CAMSYS 788 789 tristate "Clock driver for MediaTek MT8192 camsys" 789 790 depends on COMMON_CLK_MT8192 791 + default COMMON_CLK_MT8192 790 792 help 791 793 This driver supports MediaTek MT8192 camsys and camsys_raw clocks. 792 794 793 795 config COMMON_CLK_MT8192_IMGSYS 794 796 tristate "Clock driver for MediaTek MT8192 imgsys" 795 797 depends on COMMON_CLK_MT8192 798 + default COMMON_CLK_MT8192 796 799 help 797 800 This driver supports MediaTek MT8192 imgsys and imgsys2 clocks. 798 801 799 802 config COMMON_CLK_MT8192_IMP_IIC_WRAP 800 803 tristate "Clock driver for MediaTek MT8192 imp_iic_wrap" 801 804 depends on COMMON_CLK_MT8192 805 + default COMMON_CLK_MT8192 802 806 help 803 807 This driver supports MediaTek MT8192 imp_iic_wrap clocks. 804 808 805 809 config COMMON_CLK_MT8192_IPESYS 806 810 tristate "Clock driver for MediaTek MT8192 ipesys" 807 811 depends on COMMON_CLK_MT8192 812 + default COMMON_CLK_MT8192 808 813 help 809 814 This driver supports MediaTek MT8192 ipesys clocks. 810 815 811 816 config COMMON_CLK_MT8192_MDPSYS 812 817 tristate "Clock driver for MediaTek MT8192 mdpsys" 813 818 depends on COMMON_CLK_MT8192 819 + default COMMON_CLK_MT8192 814 820 help 815 821 This driver supports MediaTek MT8192 mdpsys clocks. 816 822 817 823 config COMMON_CLK_MT8192_MFGCFG 818 824 tristate "Clock driver for MediaTek MT8192 mfgcfg" 819 825 depends on COMMON_CLK_MT8192 826 + default COMMON_CLK_MT8192 820 827 help 821 828 This driver supports MediaTek MT8192 mfgcfg clocks. 822 829 823 830 config COMMON_CLK_MT8192_MMSYS 824 831 tristate "Clock driver for MediaTek MT8192 mmsys" 825 832 depends on COMMON_CLK_MT8192 833 + default COMMON_CLK_MT8192 826 834 help 827 835 This driver supports MediaTek MT8192 mmsys clocks. 828 836 829 837 config COMMON_CLK_MT8192_MSDC 830 838 tristate "Clock driver for MediaTek MT8192 msdc" 831 839 depends on COMMON_CLK_MT8192 840 + default COMMON_CLK_MT8192 832 841 help 833 842 This driver supports MediaTek MT8192 msdc and msdc_top clocks. 834 843 835 844 config COMMON_CLK_MT8192_SCP_ADSP 836 845 tristate "Clock driver for MediaTek MT8192 scp_adsp" 837 846 depends on COMMON_CLK_MT8192 847 + default COMMON_CLK_MT8192 838 848 help 839 849 This driver supports MediaTek MT8192 scp_adsp clocks. 840 850 841 851 config COMMON_CLK_MT8192_VDECSYS 842 852 tristate "Clock driver for MediaTek MT8192 vdecsys" 843 853 depends on COMMON_CLK_MT8192 854 + default COMMON_CLK_MT8192 844 855 help 845 856 This driver supports MediaTek MT8192 vdecsys and vdecsys_soc clocks. 846 857 847 858 config COMMON_CLK_MT8192_VENCSYS 848 859 tristate "Clock driver for MediaTek MT8192 vencsys" 849 860 depends on COMMON_CLK_MT8192 861 + default COMMON_CLK_MT8192 850 862 help 851 863 This driver supports MediaTek MT8192 vencsys clocks. 852 864
+1
drivers/clk/mediatek/clk-cpumux.c
··· 53 53 } 54 54 55 55 static const struct clk_ops clk_cpumux_ops = { 56 + .determine_rate = clk_hw_determine_rate_no_reparent, 56 57 .get_parent = clk_cpumux_get_parent, 57 58 .set_parent = clk_cpumux_set_parent, 58 59 };
+3 -3
drivers/clk/mediatek/clk-mt2701-aud.c
··· 150 150 return r; 151 151 } 152 152 153 - static int clk_mt2701_aud_remove(struct platform_device *pdev) 153 + static void clk_mt2701_aud_remove(struct platform_device *pdev) 154 154 { 155 155 of_platform_depopulate(&pdev->dev); 156 - return mtk_clk_simple_remove(pdev); 156 + mtk_clk_simple_remove(pdev); 157 157 } 158 158 159 159 static struct platform_driver clk_mt2701_aud_drv = { 160 160 .probe = clk_mt2701_aud_probe, 161 - .remove = clk_mt2701_aud_remove, 161 + .remove_new = clk_mt2701_aud_remove, 162 162 .driver = { 163 163 .name = "clk-mt2701-aud", 164 164 .of_match_table = of_match_clk_mt2701_aud,
+1 -1
drivers/clk/mediatek/clk-mt2701-bdp.c
··· 99 99 100 100 static struct platform_driver clk_mt2701_bdp_drv = { 101 101 .probe = mtk_clk_simple_probe, 102 - .remove = mtk_clk_simple_remove, 102 + .remove_new = mtk_clk_simple_remove, 103 103 .driver = { 104 104 .name = "clk-mt2701-bdp", 105 105 .of_match_table = of_match_clk_mt2701_bdp,
+1 -1
drivers/clk/mediatek/clk-mt2701-eth.c
··· 53 53 54 54 static struct platform_driver clk_mt2701_eth_drv = { 55 55 .probe = mtk_clk_simple_probe, 56 - .remove = mtk_clk_simple_remove, 56 + .remove_new = mtk_clk_simple_remove, 57 57 .driver = { 58 58 .name = "clk-mt2701-eth", 59 59 .of_match_table = of_match_clk_mt2701_eth,
+1 -1
drivers/clk/mediatek/clk-mt2701-g3d.c
··· 52 52 53 53 static struct platform_driver clk_mt2701_g3d_drv = { 54 54 .probe = mtk_clk_simple_probe, 55 - .remove = mtk_clk_simple_remove, 55 + .remove_new = mtk_clk_simple_remove, 56 56 .driver = { 57 57 .name = "clk-mt2701-g3d", 58 58 .of_match_table = of_match_clk_mt2701_g3d,
+1 -1
drivers/clk/mediatek/clk-mt2701-hif.c
··· 50 50 51 51 static struct platform_driver clk_mt2701_hif_drv = { 52 52 .probe = mtk_clk_simple_probe, 53 - .remove = mtk_clk_simple_remove, 53 + .remove_new = mtk_clk_simple_remove, 54 54 .driver = { 55 55 .name = "clk-mt2701-hif", 56 56 .of_match_table = of_match_clk_mt2701_hif,
+1 -1
drivers/clk/mediatek/clk-mt2701-img.c
··· 47 47 48 48 static struct platform_driver clk_mt2701_img_drv = { 49 49 .probe = mtk_clk_simple_probe, 50 - .remove = mtk_clk_simple_remove, 50 + .remove_new = mtk_clk_simple_remove, 51 51 .driver = { 52 52 .name = "clk-mt2701-img", 53 53 .of_match_table = of_match_clk_mt2701_img,
+1 -1
drivers/clk/mediatek/clk-mt2701-mm.c
··· 80 80 81 81 static struct platform_driver clk_mt2701_mm_drv = { 82 82 .probe = mtk_clk_pdev_probe, 83 - .remove = mtk_clk_pdev_remove, 83 + .remove_new = mtk_clk_pdev_remove, 84 84 .driver = { 85 85 .name = "clk-mt2701-mm", 86 86 },
+1 -1
drivers/clk/mediatek/clk-mt2701-vdec.c
··· 52 52 53 53 static struct platform_driver clk_mt2701_vdec_drv = { 54 54 .probe = mtk_clk_simple_probe, 55 - .remove = mtk_clk_simple_remove, 55 + .remove_new = mtk_clk_simple_remove, 56 56 .driver = { 57 57 .name = "clk-mt2701-vdec", 58 58 .of_match_table = of_match_clk_mt2701_vdec,
+2 -4
drivers/clk/mediatek/clk-mt2712-apmixedsys.c
··· 138 138 return r; 139 139 } 140 140 141 - static int clk_mt2712_apmixed_remove(struct platform_device *pdev) 141 + static void clk_mt2712_apmixed_remove(struct platform_device *pdev) 142 142 { 143 143 struct device_node *node = pdev->dev.of_node; 144 144 struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev); ··· 146 146 of_clk_del_provider(node); 147 147 mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data); 148 148 mtk_free_clk_data(clk_data); 149 - 150 - return 0; 151 149 } 152 150 153 151 static const struct of_device_id of_match_clk_mt2712_apmixed[] = { ··· 156 158 157 159 static struct platform_driver clk_mt2712_apmixed_drv = { 158 160 .probe = clk_mt2712_apmixed_probe, 159 - .remove = clk_mt2712_apmixed_remove, 161 + .remove_new = clk_mt2712_apmixed_remove, 160 162 .driver = { 161 163 .name = "clk-mt2712-apmixed", 162 164 .of_match_table = of_match_clk_mt2712_apmixed,
+1 -1
drivers/clk/mediatek/clk-mt2712-bdp.c
··· 69 69 70 70 static struct platform_driver clk_mt2712_bdp_drv = { 71 71 .probe = mtk_clk_simple_probe, 72 - .remove = mtk_clk_simple_remove, 72 + .remove_new = mtk_clk_simple_remove, 73 73 .driver = { 74 74 .name = "clk-mt2712-bdp", 75 75 .of_match_table = of_match_clk_mt2712_bdp,
+1 -1
drivers/clk/mediatek/clk-mt2712-img.c
··· 47 47 48 48 static struct platform_driver clk_mt2712_img_drv = { 49 49 .probe = mtk_clk_simple_probe, 50 - .remove = mtk_clk_simple_remove, 50 + .remove_new = mtk_clk_simple_remove, 51 51 .driver = { 52 52 .name = "clk-mt2712-img", 53 53 .of_match_table = of_match_clk_mt2712_img,
+1 -1
drivers/clk/mediatek/clk-mt2712-jpgdec.c
··· 43 43 44 44 static struct platform_driver clk_mt2712_jpgdec_drv = { 45 45 .probe = mtk_clk_simple_probe, 46 - .remove = mtk_clk_simple_remove, 46 + .remove_new = mtk_clk_simple_remove, 47 47 .driver = { 48 48 .name = "clk-mt2712-jpgdec", 49 49 .of_match_table = of_match_clk_mt2712_jpgdec,
+1 -1
drivers/clk/mediatek/clk-mt2712-mfg.c
··· 42 42 43 43 static struct platform_driver clk_mt2712_mfg_drv = { 44 44 .probe = mtk_clk_simple_probe, 45 - .remove = mtk_clk_simple_remove, 45 + .remove_new = mtk_clk_simple_remove, 46 46 .driver = { 47 47 .name = "clk-mt2712-mfg", 48 48 .of_match_table = of_match_clk_mt2712_mfg,
+1 -1
drivers/clk/mediatek/clk-mt2712-mm.c
··· 121 121 122 122 static struct platform_driver clk_mt2712_mm_drv = { 123 123 .probe = mtk_clk_pdev_probe, 124 - .remove = mtk_clk_pdev_remove, 124 + .remove_new = mtk_clk_pdev_remove, 125 125 .driver = { 126 126 .name = "clk-mt2712-mm", 127 127 },
+1 -1
drivers/clk/mediatek/clk-mt2712-vdec.c
··· 55 55 56 56 static struct platform_driver clk_mt2712_vdec_drv = { 57 57 .probe = mtk_clk_simple_probe, 58 - .remove = mtk_clk_simple_remove, 58 + .remove_new = mtk_clk_simple_remove, 59 59 .driver = { 60 60 .name = "clk-mt2712-vdec", 61 61 .of_match_table = of_match_clk_mt2712_vdec,
+1 -1
drivers/clk/mediatek/clk-mt2712-venc.c
··· 44 44 45 45 static struct platform_driver clk_mt2712_venc_drv = { 46 46 .probe = mtk_clk_simple_probe, 47 - .remove = mtk_clk_simple_remove, 47 + .remove_new = mtk_clk_simple_remove, 48 48 .driver = { 49 49 .name = "clk-mt2712-venc", 50 50 .of_match_table = of_match_clk_mt2712_venc,
+1 -1
drivers/clk/mediatek/clk-mt2712.c
··· 995 995 996 996 static struct platform_driver clk_mt2712_drv = { 997 997 .probe = mtk_clk_simple_probe, 998 - .remove = mtk_clk_simple_remove, 998 + .remove_new = mtk_clk_simple_remove, 999 999 .driver = { 1000 1000 .name = "clk-mt2712", 1001 1001 .of_match_table = of_match_clk_mt2712,
+1 -1
drivers/clk/mediatek/clk-mt6765-audio.c
··· 69 69 70 70 static struct platform_driver clk_mt6765_audio_drv = { 71 71 .probe = mtk_clk_simple_probe, 72 - .remove = mtk_clk_simple_remove, 72 + .remove_new = mtk_clk_simple_remove, 73 73 .driver = { 74 74 .name = "clk-mt6765-audio", 75 75 .of_match_table = of_match_clk_mt6765_audio,
+1 -1
drivers/clk/mediatek/clk-mt6765-cam.c
··· 50 50 51 51 static struct platform_driver clk_mt6765_cam_drv = { 52 52 .probe = mtk_clk_simple_probe, 53 - .remove = mtk_clk_simple_remove, 53 + .remove_new = mtk_clk_simple_remove, 54 54 .driver = { 55 55 .name = "clk-mt6765-cam", 56 56 .of_match_table = of_match_clk_mt6765_cam,
+1 -1
drivers/clk/mediatek/clk-mt6765-img.c
··· 46 46 47 47 static struct platform_driver clk_mt6765_img_drv = { 48 48 .probe = mtk_clk_simple_probe, 49 - .remove = mtk_clk_simple_remove, 49 + .remove_new = mtk_clk_simple_remove, 50 50 .driver = { 51 51 .name = "clk-mt6765-img", 52 52 .of_match_table = of_match_clk_mt6765_img,
+1 -1
drivers/clk/mediatek/clk-mt6765-mipi0a.c
··· 43 43 44 44 static struct platform_driver clk_mt6765_mipi0a_drv = { 45 45 .probe = mtk_clk_simple_probe, 46 - .remove = mtk_clk_simple_remove, 46 + .remove_new = mtk_clk_simple_remove, 47 47 .driver = { 48 48 .name = "clk-mt6765-mipi0a", 49 49 .of_match_table = of_match_clk_mt6765_mipi0a,
+1 -1
drivers/clk/mediatek/clk-mt6765-mm.c
··· 72 72 73 73 static struct platform_driver clk_mt6765_mm_drv = { 74 74 .probe = mtk_clk_simple_probe, 75 - .remove = mtk_clk_simple_remove, 75 + .remove_new = mtk_clk_simple_remove, 76 76 .driver = { 77 77 .name = "clk-mt6765-mm", 78 78 .of_match_table = of_match_clk_mt6765_mm,
+1 -1
drivers/clk/mediatek/clk-mt6765-vcodec.c
··· 45 45 46 46 static struct platform_driver clk_mt6765_vcodec_drv = { 47 47 .probe = mtk_clk_simple_probe, 48 - .remove = mtk_clk_simple_remove, 48 + .remove_new = mtk_clk_simple_remove, 49 49 .driver = { 50 50 .name = "clk-mt6765-vcodec", 51 51 .of_match_table = of_match_clk_mt6765_vcodec,
+11 -9
drivers/clk/mediatek/clk-mt6765.c
··· 367 367 /* CLK_CFG_0 */ 368 368 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_AXI_SEL, "axi_sel", axi_parents, 369 369 CLK_CFG_0, CLK_CFG_0_SET, CLK_CFG_0_CLR, 370 - 0, 2, 7, CLK_CFG_UPDATE, 0, CLK_IS_CRITICAL), 370 + 0, 2, 7, CLK_CFG_UPDATE, 0, 371 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 371 372 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MEM_SEL, "mem_sel", mem_parents, 372 373 CLK_CFG_0, CLK_CFG_0_SET, CLK_CFG_0_CLR, 373 - 8, 2, 15, CLK_CFG_UPDATE, 1, CLK_IS_CRITICAL), 374 + 8, 2, 15, CLK_CFG_UPDATE, 1, 375 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 374 376 MUX_GATE_CLR_SET_UPD(CLK_TOP_MM_SEL, "mm_sel", mm_parents, CLK_CFG_0, 375 377 CLK_CFG_0_SET, CLK_CFG_0_CLR, 16, 3, 23, 376 378 CLK_CFG_UPDATE, 2), ··· 406 404 CLK_CFG_2_SET, CLK_CFG_2_CLR, 24, 2, 31, 407 405 CLK_CFG_UPDATE, 11), 408 406 /* CLK_CFG_3 */ 409 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC50_0_HCLK_SEL, "msdc5hclk", 407 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_0_HCLK_SEL, "msdc5hclk", 410 408 msdc5hclk_parents, CLK_CFG_3, CLK_CFG_3_SET, 411 - CLK_CFG_3_CLR, 0, 2, 7, CLK_CFG_UPDATE, 12), 412 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC50_0_SEL, "msdc50_0_sel", 409 + CLK_CFG_3_CLR, 0, 2, 7, CLK_CFG_UPDATE, 12, 0), 410 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_0_SEL, "msdc50_0_sel", 413 411 msdc50_0_parents, CLK_CFG_3, CLK_CFG_3_SET, 414 - CLK_CFG_3_CLR, 8, 3, 15, CLK_CFG_UPDATE, 13), 415 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC30_1_SEL, "msdc30_1_sel", 412 + CLK_CFG_3_CLR, 8, 3, 15, CLK_CFG_UPDATE, 13, 0), 413 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC30_1_SEL, "msdc30_1_sel", 416 414 msdc30_1_parents, CLK_CFG_3, CLK_CFG_3_SET, 417 - CLK_CFG_3_CLR, 16, 3, 23, CLK_CFG_UPDATE, 14), 415 + CLK_CFG_3_CLR, 16, 3, 23, CLK_CFG_UPDATE, 14, 0), 418 416 MUX_GATE_CLR_SET_UPD(CLK_TOP_AUDIO_SEL, "audio_sel", audio_parents, 419 417 CLK_CFG_3, CLK_CFG_3_SET, CLK_CFG_3_CLR, 420 418 24, 2, 31, CLK_CFG_UPDATE, 15), ··· 461 459 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_PWRAP_ULPOSC_SEL, "ulposc_sel", 462 460 ulposc_parents, CLK_CFG_7, CLK_CFG_7_SET, 463 461 CLK_CFG_7_CLR, 0, 3, 7, CLK_CFG_UPDATE, 28, 464 - CLK_IS_CRITICAL), 462 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 465 463 MUX_GATE_CLR_SET_UPD(CLK_TOP_CAMTM_SEL, "camtm_sel", camtm_parents, 466 464 CLK_CFG_7, CLK_CFG_7_SET, CLK_CFG_7_CLR, 8, 2, 15, 467 465 CLK_CFG_UPDATE, 29),
+1 -1
drivers/clk/mediatek/clk-mt6779-aud.c
··· 106 106 107 107 static struct platform_driver clk_mt6779_aud_drv = { 108 108 .probe = mtk_clk_simple_probe, 109 - .remove = mtk_clk_simple_remove, 109 + .remove_new = mtk_clk_simple_remove, 110 110 .driver = { 111 111 .name = "clk-mt6779-aud", 112 112 .of_match_table = of_match_clk_mt6779_aud,
+1 -1
drivers/clk/mediatek/clk-mt6779-cam.c
··· 55 55 56 56 static struct platform_driver clk_mt6779_cam_drv = { 57 57 .probe = mtk_clk_simple_probe, 58 - .remove = mtk_clk_simple_remove, 58 + .remove_new = mtk_clk_simple_remove, 59 59 .driver = { 60 60 .name = "clk-mt6779-cam", 61 61 .of_match_table = of_match_clk_mt6779_cam,
+1 -1
drivers/clk/mediatek/clk-mt6779-img.c
··· 47 47 48 48 static struct platform_driver clk_mt6779_img_drv = { 49 49 .probe = mtk_clk_simple_probe, 50 - .remove = mtk_clk_simple_remove, 50 + .remove_new = mtk_clk_simple_remove, 51 51 .driver = { 52 52 .name = "clk-mt6779-img", 53 53 .of_match_table = of_match_clk_mt6779_img,
+1 -1
drivers/clk/mediatek/clk-mt6779-ipe.c
··· 49 49 50 50 static struct platform_driver clk_mt6779_ipe_drv = { 51 51 .probe = mtk_clk_simple_probe, 52 - .remove = mtk_clk_simple_remove, 52 + .remove_new = mtk_clk_simple_remove, 53 53 .driver = { 54 54 .name = "clk-mt6779-ipe", 55 55 .of_match_table = of_match_clk_mt6779_ipe,
+1 -1
drivers/clk/mediatek/clk-mt6779-mfg.c
··· 44 44 45 45 static struct platform_driver clk_mt6779_mfg_drv = { 46 46 .probe = mtk_clk_simple_probe, 47 - .remove = mtk_clk_simple_remove, 47 + .remove_new = mtk_clk_simple_remove, 48 48 .driver = { 49 49 .name = "clk-mt6779-mfg", 50 50 .of_match_table = of_match_clk_mt6779_mfg,
+1 -1
drivers/clk/mediatek/clk-mt6779-mm.c
··· 98 98 99 99 static struct platform_driver clk_mt6779_mm_drv = { 100 100 .probe = mtk_clk_pdev_probe, 101 - .remove = mtk_clk_pdev_remove, 101 + .remove_new = mtk_clk_pdev_remove, 102 102 .driver = { 103 103 .name = "clk-mt6779-mm", 104 104 },
+1 -1
drivers/clk/mediatek/clk-mt6779-vdec.c
··· 56 56 57 57 static struct platform_driver clk_mt6779_vdec_drv = { 58 58 .probe = mtk_clk_simple_probe, 59 - .remove = mtk_clk_simple_remove, 59 + .remove_new = mtk_clk_simple_remove, 60 60 .driver = { 61 61 .name = "clk-mt6779-vdec", 62 62 .of_match_table = of_match_clk_mt6779_vdec,
+1 -1
drivers/clk/mediatek/clk-mt6779-venc.c
··· 47 47 48 48 static struct platform_driver clk_mt6779_venc_drv = { 49 49 .probe = mtk_clk_simple_probe, 50 - .remove = mtk_clk_simple_remove, 50 + .remove_new = mtk_clk_simple_remove, 51 51 .driver = { 52 52 .name = "clk-mt6779-venc", 53 53 .of_match_table = of_match_clk_mt6779_venc,
+13 -13
drivers/clk/mediatek/clk-mt6779.c
··· 640 640 /* CLK_CFG_0 */ 641 641 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_AXI, "axi_sel", axi_parents, 642 642 0x20, 0x24, 0x28, 0, 2, 7, 643 - 0x004, 0, CLK_IS_CRITICAL), 643 + 0x004, 0, CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 644 644 MUX_GATE_CLR_SET_UPD(CLK_TOP_MM, "mm_sel", mm_parents, 645 645 0x20, 0x24, 0x28, 8, 3, 15, 0x004, 1), 646 646 MUX_GATE_CLR_SET_UPD(CLK_TOP_SCP, "scp_sel", scp_parents, ··· 687 687 0x70, 0x74, 0x78, 0, 1, 7, 0x004, 20), 688 688 MUX_GATE_CLR_SET_UPD(CLK_TOP_SPI, "spi_sel", spi_parents, 689 689 0x70, 0x74, 0x78, 8, 2, 15, 0x004, 21), 690 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC50_0_HCLK, "msdc50_hclk_sel", 691 - msdc50_hclk_parents, 0x70, 0x74, 0x78, 692 - 16, 2, 23, 0x004, 22), 693 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC50_0, "msdc50_0_sel", 694 - msdc50_0_parents, 0x70, 0x74, 0x78, 695 - 24, 3, 31, 0x004, 23), 690 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_0_HCLK, "msdc50_hclk_sel", 691 + msdc50_hclk_parents, 0x70, 0x74, 0x78, 692 + 16, 2, 23, 0x004, 22, 0), 693 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_0, "msdc50_0_sel", 694 + msdc50_0_parents, 0x70, 0x74, 0x78, 695 + 24, 3, 31, 0x004, 23, 0), 696 696 /* CLK_CFG_6 */ 697 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC30_1, "msdc30_1_sel", 698 - msdc30_1_parents, 0x80, 0x84, 0x88, 699 - 0, 3, 7, 0x004, 24), 697 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC30_1, "msdc30_1_sel", 698 + msdc30_1_parents, 0x80, 0x84, 0x88, 699 + 0, 3, 7, 0x004, 24, 0), 700 700 MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD, "audio_sel", audio_parents, 701 701 0x80, 0x84, 0x88, 8, 2, 15, 0x004, 25), 702 702 MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD_INTBUS, "aud_intbus_sel", ··· 710 710 0x90, 0x94, 0x98, 0, 2, 7, 0x004, 28), 711 711 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SSPM, "sspm_sel", sspm_parents, 712 712 0x90, 0x94, 0x98, 8, 3, 15, 713 - 0x004, 29, CLK_IS_CRITICAL), 713 + 0x004, 29, CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 714 714 MUX_GATE_CLR_SET_UPD(CLK_TOP_DPI0, "dpi0_sel", dpi0_parents, 715 715 0x90, 0x94, 0x98, 16, 3, 23, 0x004, 30), 716 716 MUX_GATE_CLR_SET_UPD(CLK_TOP_SCAM, "scam_sel", scam_parents, ··· 727 727 16, 2, 23, 0x008, 3), 728 728 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SPM, "spm_sel", spm_parents, 729 729 0xa0, 0xa4, 0xa8, 24, 2, 31, 730 - 0x008, 4, CLK_IS_CRITICAL), 730 + 0x008, 4, CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 731 731 /* CLK_CFG_9 */ 732 732 MUX_GATE_CLR_SET_UPD(CLK_TOP_I2C, "i2c_sel", i2c_parents, 733 733 0xb0, 0xb4, 0xb8, 0, 2, 7, 0x008, 5), ··· 1303 1303 1304 1304 static struct platform_driver clk_mt6779_infra_drv = { 1305 1305 .probe = mtk_clk_simple_probe, 1306 - .remove = mtk_clk_simple_remove, 1306 + .remove_new = mtk_clk_simple_remove, 1307 1307 .driver = { 1308 1308 .name = "clk-mt6779-infra", 1309 1309 .of_match_table = of_match_clk_mt6779_infra,
+2 -4
drivers/clk/mediatek/clk-mt6795-apmixedsys.c
··· 187 187 return ret; 188 188 } 189 189 190 - static int clk_mt6795_apmixed_remove(struct platform_device *pdev) 190 + static void clk_mt6795_apmixed_remove(struct platform_device *pdev) 191 191 { 192 192 struct device_node *node = pdev->dev.of_node; 193 193 struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev); ··· 197 197 mtk_clk_unregister_pllfhs(plls, ARRAY_SIZE(plls), pllfhs, 198 198 ARRAY_SIZE(pllfhs), clk_data); 199 199 mtk_free_clk_data(clk_data); 200 - 201 - return 0; 202 200 } 203 201 204 202 static struct platform_driver clk_mt6795_apmixed_drv = { 205 203 .probe = clk_mt6795_apmixed_probe, 206 - .remove = clk_mt6795_apmixed_remove, 204 + .remove_new = clk_mt6795_apmixed_remove, 207 205 .driver = { 208 206 .name = "clk-mt6795-apmixed", 209 207 .of_match_table = of_match_clk_mt6795_apmixed,
+2 -4
drivers/clk/mediatek/clk-mt6795-infracfg.c
··· 127 127 return ret; 128 128 } 129 129 130 - static int clk_mt6795_infracfg_remove(struct platform_device *pdev) 130 + static void clk_mt6795_infracfg_remove(struct platform_device *pdev) 131 131 { 132 132 struct device_node *node = pdev->dev.of_node; 133 133 struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev); ··· 136 136 mtk_clk_unregister_cpumuxes(cpu_muxes, ARRAY_SIZE(cpu_muxes), clk_data); 137 137 mtk_clk_unregister_gates(infra_gates, ARRAY_SIZE(infra_gates), clk_data); 138 138 mtk_free_clk_data(clk_data); 139 - 140 - return 0; 141 139 } 142 140 143 141 static struct platform_driver clk_mt6795_infracfg_drv = { ··· 144 146 .of_match_table = of_match_clk_mt6795_infracfg, 145 147 }, 146 148 .probe = clk_mt6795_infracfg_probe, 147 - .remove = clk_mt6795_infracfg_remove, 149 + .remove_new = clk_mt6795_infracfg_remove, 148 150 }; 149 151 module_platform_driver(clk_mt6795_infracfg_drv); 150 152
+1 -1
drivers/clk/mediatek/clk-mt6795-mfg.c
··· 43 43 .of_match_table = of_match_clk_mt6795_mfg, 44 44 }, 45 45 .probe = mtk_clk_simple_probe, 46 - .remove = mtk_clk_simple_remove, 46 + .remove_new = mtk_clk_simple_remove, 47 47 }; 48 48 module_platform_driver(clk_mt6795_mfg_drv); 49 49
+1 -1
drivers/clk/mediatek/clk-mt6795-mm.c
··· 93 93 }, 94 94 .id_table = clk_mt6795_mm_id_table, 95 95 .probe = mtk_clk_pdev_probe, 96 - .remove = mtk_clk_pdev_remove, 96 + .remove_new = mtk_clk_pdev_remove, 97 97 }; 98 98 module_platform_driver(clk_mt6795_mm_drv); 99 99
+2 -4
drivers/clk/mediatek/clk-mt6795-pericfg.c
··· 136 136 return ret; 137 137 } 138 138 139 - static int clk_mt6795_pericfg_remove(struct platform_device *pdev) 139 + static void clk_mt6795_pericfg_remove(struct platform_device *pdev) 140 140 { 141 141 struct device_node *node = pdev->dev.of_node; 142 142 struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev); ··· 145 145 mtk_clk_unregister_composites(peri_clks, ARRAY_SIZE(peri_clks), clk_data); 146 146 mtk_clk_unregister_gates(peri_gates, ARRAY_SIZE(peri_gates), clk_data); 147 147 mtk_free_clk_data(clk_data); 148 - 149 - return 0; 150 148 } 151 149 152 150 static struct platform_driver clk_mt6795_pericfg_drv = { ··· 153 155 .of_match_table = of_match_clk_mt6795_pericfg, 154 156 }, 155 157 .probe = clk_mt6795_pericfg_probe, 156 - .remove = clk_mt6795_pericfg_remove, 158 + .remove_new = clk_mt6795_pericfg_remove, 157 159 }; 158 160 module_platform_driver(clk_mt6795_pericfg_drv); 159 161
+1 -1
drivers/clk/mediatek/clk-mt6795-topckgen.c
··· 547 547 .of_match_table = of_match_clk_mt6795_topckgen, 548 548 }, 549 549 .probe = mtk_clk_simple_probe, 550 - .remove = mtk_clk_simple_remove, 550 + .remove_new = mtk_clk_simple_remove, 551 551 }; 552 552 module_platform_driver(clk_mt6795_topckgen_drv); 553 553
+1 -1
drivers/clk/mediatek/clk-mt6795-vdecsys.c
··· 44 44 45 45 static struct platform_driver clk_mt6795_vdecsys_drv = { 46 46 .probe = mtk_clk_simple_probe, 47 - .remove = mtk_clk_simple_remove, 47 + .remove_new = mtk_clk_simple_remove, 48 48 .driver = { 49 49 .name = "clk-mt6795-vdecsys", 50 50 .of_match_table = of_match_clk_mt6795_vdecsys,
+1 -1
drivers/clk/mediatek/clk-mt6795-vencsys.c
··· 43 43 .of_match_table = of_match_clk_mt6795_vencsys, 44 44 }, 45 45 .probe = mtk_clk_simple_probe, 46 - .remove = mtk_clk_simple_remove, 46 + .remove_new = mtk_clk_simple_remove, 47 47 }; 48 48 module_platform_driver(clk_mt6795_vencsys_drv); 49 49
+1 -1
drivers/clk/mediatek/clk-mt6797-img.c
··· 43 43 44 44 static struct platform_driver clk_mt6797_img_drv = { 45 45 .probe = mtk_clk_simple_probe, 46 - .remove = mtk_clk_simple_remove, 46 + .remove_new = mtk_clk_simple_remove, 47 47 .driver = { 48 48 .name = "clk-mt6797-img", 49 49 .of_match_table = of_match_clk_mt6797_img,
+1 -1
drivers/clk/mediatek/clk-mt6797-mm.c
··· 93 93 94 94 static struct platform_driver clk_mt6797_mm_drv = { 95 95 .probe = mtk_clk_pdev_probe, 96 - .remove = mtk_clk_pdev_remove, 96 + .remove_new = mtk_clk_pdev_remove, 97 97 .driver = { 98 98 .name = "clk-mt6797-mm", 99 99 },
+1 -1
drivers/clk/mediatek/clk-mt6797-vdec.c
··· 54 54 55 55 static struct platform_driver clk_mt6797_vdec_drv = { 56 56 .probe = mtk_clk_simple_probe, 57 - .remove = mtk_clk_simple_remove, 57 + .remove_new = mtk_clk_simple_remove, 58 58 .driver = { 59 59 .name = "clk-mt6797-vdec", 60 60 .of_match_table = of_match_clk_mt6797_vdec,
+1 -1
drivers/clk/mediatek/clk-mt6797-venc.c
··· 45 45 46 46 static struct platform_driver clk_mt6797_venc_drv = { 47 47 .probe = mtk_clk_simple_probe, 48 - .remove = mtk_clk_simple_remove, 48 + .remove_new = mtk_clk_simple_remove, 49 49 .driver = { 50 50 .name = "clk-mt6797-venc", 51 51 .of_match_table = of_match_clk_mt6797_venc,
+2 -4
drivers/clk/mediatek/clk-mt7622-apmixedsys.c
··· 119 119 return ret; 120 120 } 121 121 122 - static int clk_mt7622_apmixed_remove(struct platform_device *pdev) 122 + static void clk_mt7622_apmixed_remove(struct platform_device *pdev) 123 123 { 124 124 struct device_node *node = pdev->dev.of_node; 125 125 struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev); ··· 128 128 mtk_clk_unregister_gates(apmixed_clks, ARRAY_SIZE(apmixed_clks), clk_data); 129 129 mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data); 130 130 mtk_free_clk_data(clk_data); 131 - 132 - return 0; 133 131 } 134 132 135 133 static const struct of_device_id of_match_clk_mt7622_apmixed[] = { ··· 138 140 139 141 static struct platform_driver clk_mt7622_apmixed_drv = { 140 142 .probe = clk_mt7622_apmixed_probe, 141 - .remove = clk_mt7622_apmixed_remove, 143 + .remove_new = clk_mt7622_apmixed_remove, 142 144 .driver = { 143 145 .name = "clk-mt7622-apmixed", 144 146 .of_match_table = of_match_clk_mt7622_apmixed,
+3 -3
drivers/clk/mediatek/clk-mt7622-aud.c
··· 135 135 return r; 136 136 } 137 137 138 - static int clk_mt7622_aud_remove(struct platform_device *pdev) 138 + static void clk_mt7622_aud_remove(struct platform_device *pdev) 139 139 { 140 140 of_platform_depopulate(&pdev->dev); 141 - return mtk_clk_simple_remove(pdev); 141 + mtk_clk_simple_remove(pdev); 142 142 } 143 143 144 144 static const struct of_device_id of_match_clk_mt7622_aud[] = { ··· 149 149 150 150 static struct platform_driver clk_mt7622_aud_drv = { 151 151 .probe = clk_mt7622_aud_probe, 152 - .remove = clk_mt7622_aud_remove, 152 + .remove_new = clk_mt7622_aud_remove, 153 153 .driver = { 154 154 .name = "clk-mt7622-aud", 155 155 .of_match_table = of_match_clk_mt7622_aud,
+1 -1
drivers/clk/mediatek/clk-mt7622-eth.c
··· 81 81 82 82 static struct platform_driver clk_mt7622_eth_drv = { 83 83 .probe = mtk_clk_simple_probe, 84 - .remove = mtk_clk_simple_remove, 84 + .remove_new = mtk_clk_simple_remove, 85 85 .driver = { 86 86 .name = "clk-mt7622-eth", 87 87 .of_match_table = of_match_clk_mt7622_eth,
+1 -1
drivers/clk/mediatek/clk-mt7622-hif.c
··· 93 93 94 94 static struct platform_driver clk_mt7622_hif_drv = { 95 95 .probe = mtk_clk_simple_probe, 96 - .remove = mtk_clk_simple_remove, 96 + .remove_new = mtk_clk_simple_remove, 97 97 .driver = { 98 98 .name = "clk-mt7622-hif", 99 99 .of_match_table = of_match_clk_mt7622_hif,
+2 -4
drivers/clk/mediatek/clk-mt7622-infracfg.c
··· 101 101 return ret; 102 102 } 103 103 104 - static int clk_mt7622_infracfg_remove(struct platform_device *pdev) 104 + static void clk_mt7622_infracfg_remove(struct platform_device *pdev) 105 105 { 106 106 struct device_node *node = pdev->dev.of_node; 107 107 struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev); ··· 110 110 mtk_clk_unregister_cpumuxes(cpu_muxes, ARRAY_SIZE(cpu_muxes), clk_data); 111 111 mtk_clk_unregister_gates(infra_clks, ARRAY_SIZE(infra_clks), clk_data); 112 112 mtk_free_clk_data(clk_data); 113 - 114 - return 0; 115 113 } 116 114 117 115 static struct platform_driver clk_mt7622_infracfg_drv = { ··· 118 120 .of_match_table = of_match_clk_mt7622_infracfg, 119 121 }, 120 122 .probe = clk_mt7622_infracfg_probe, 121 - .remove = clk_mt7622_infracfg_remove, 123 + .remove_new = clk_mt7622_infracfg_remove, 122 124 }; 123 125 module_platform_driver(clk_mt7622_infracfg_drv); 124 126
+1 -1
drivers/clk/mediatek/clk-mt7622.c
··· 526 526 .of_match_table = of_match_clk_mt7622, 527 527 }, 528 528 .probe = mtk_clk_simple_probe, 529 - .remove = mtk_clk_simple_remove, 529 + .remove_new = mtk_clk_simple_remove, 530 530 }; 531 531 module_platform_driver(clk_mt7622_drv) 532 532
+1 -1
drivers/clk/mediatek/clk-mt7629-hif.c
··· 88 88 89 89 static struct platform_driver clk_mt7629_hif_drv = { 90 90 .probe = mtk_clk_simple_probe, 91 - .remove = mtk_clk_simple_remove, 91 + .remove_new = mtk_clk_simple_remove, 92 92 .driver = { 93 93 .name = "clk-mt7629-hif", 94 94 .of_match_table = of_match_clk_mt7629_hif,
+1 -1
drivers/clk/mediatek/clk-mt7981-eth.c
··· 109 109 110 110 static struct platform_driver clk_mt7981_eth_drv = { 111 111 .probe = mtk_clk_simple_probe, 112 - .remove = mtk_clk_simple_remove, 112 + .remove_new = mtk_clk_simple_remove, 113 113 .driver = { 114 114 .name = "clk-mt7981-eth", 115 115 .of_match_table = of_match_clk_mt7981_eth,
+1 -1
drivers/clk/mediatek/clk-mt7981-infracfg.c
··· 199 199 200 200 static struct platform_driver clk_mt7981_infracfg_drv = { 201 201 .probe = mtk_clk_simple_probe, 202 - .remove = mtk_clk_simple_remove, 202 + .remove_new = mtk_clk_simple_remove, 203 203 .driver = { 204 204 .name = "clk-mt7981-infracfg", 205 205 .of_match_table = of_match_clk_mt7981_infracfg,
+7 -7
drivers/clk/mediatek/clk-mt7981-topckgen.c
··· 310 310 pextp_tl_ck_parents, 0x010, 0x014, 0x018, 24, 2, 31, 311 311 0x1C0, 7), 312 312 /* CLK_CFG_2 */ 313 - MUX_GATE_CLR_SET_UPD(CLK_TOP_EMMC_208M_SEL, "emmc_208m_sel", 314 - emmc_208m_parents, 0x020, 0x024, 0x028, 0, 3, 7, 315 - 0x1C0, 8), 316 - MUX_GATE_CLR_SET_UPD(CLK_TOP_EMMC_400M_SEL, "emmc_400m_sel", 317 - emmc_400m_parents, 0x020, 0x024, 0x028, 8, 2, 15, 318 - 0x1C0, 9), 313 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_EMMC_208M_SEL, "emmc_208m_sel", 314 + emmc_208m_parents, 0x020, 0x024, 0x028, 0, 3, 7, 315 + 0x1C0, 8, 0), 316 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_EMMC_400M_SEL, "emmc_400m_sel", 317 + emmc_400m_parents, 0x020, 0x024, 0x028, 8, 2, 15, 318 + 0x1C0, 9, 0), 319 319 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_F26M_SEL, "csw_f26m_sel", 320 320 csw_f26m_parents, 0x020, 0x024, 0x028, 16, 1, 23, 321 321 0x1C0, 10, ··· 414 414 415 415 static struct platform_driver clk_mt7981_topckgen_drv = { 416 416 .probe = mtk_clk_simple_probe, 417 - .remove = mtk_clk_simple_remove, 417 + .remove_new = mtk_clk_simple_remove, 418 418 .driver = { 419 419 .name = "clk-mt7981-topckgen", 420 420 .of_match_table = of_match_clk_mt7981_topckgen,
+1 -1
drivers/clk/mediatek/clk-mt7986-eth.c
··· 94 94 .of_match_table = of_match_clk_mt7986_eth, 95 95 }, 96 96 .probe = mtk_clk_simple_probe, 97 - .remove = mtk_clk_simple_remove, 97 + .remove_new = mtk_clk_simple_remove, 98 98 }; 99 99 module_platform_driver(clk_mt7986_eth_drv); 100 100
+1 -1
drivers/clk/mediatek/clk-mt7986-infracfg.c
··· 179 179 .of_match_table = of_match_clk_mt7986_infracfg, 180 180 }, 181 181 .probe = mtk_clk_simple_probe, 182 - .remove = mtk_clk_simple_remove, 182 + .remove_new = mtk_clk_simple_remove, 183 183 }; 184 184 module_platform_driver(clk_mt7986_infracfg_drv); 185 185
+7 -7
drivers/clk/mediatek/clk-mt7986-topckgen.c
··· 193 193 pextp_tl_ck_parents, 0x010, 0x014, 0x018, 24, 2, 194 194 31, 0x1C0, 7), 195 195 /* CLK_CFG_2 */ 196 - MUX_GATE_CLR_SET_UPD(CLK_TOP_EMMC_250M_SEL, "emmc_250m_sel", 197 - emmc_250m_parents, 0x020, 0x024, 0x028, 0, 1, 7, 198 - 0x1C0, 8), 199 - MUX_GATE_CLR_SET_UPD(CLK_TOP_EMMC_416M_SEL, "emmc_416m_sel", 200 - emmc_416m_parents, 0x020, 0x024, 0x028, 8, 1, 15, 201 - 0x1C0, 9), 196 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_EMMC_250M_SEL, "emmc_250m_sel", 197 + emmc_250m_parents, 0x020, 0x024, 0x028, 0, 1, 7, 198 + 0x1C0, 8, 0), 199 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_EMMC_416M_SEL, "emmc_416m_sel", 200 + emmc_416m_parents, 0x020, 0x024, 0x028, 8, 1, 15, 201 + 0x1C0, 9, 0), 202 202 MUX_GATE_CLR_SET_UPD(CLK_TOP_F_26M_ADC_SEL, "f_26m_adc_sel", 203 203 f_26m_adc_parents, 0x020, 0x024, 0x028, 16, 1, 23, 204 204 0x1C0, 10), ··· 308 308 309 309 static struct platform_driver clk_mt7986_topckgen_drv = { 310 310 .probe = mtk_clk_simple_probe, 311 - .remove = mtk_clk_simple_remove, 311 + .remove_new = mtk_clk_simple_remove, 312 312 .driver = { 313 313 .name = "clk-mt7986-topckgen", 314 314 .of_match_table = of_match_clk_mt7986_topckgen,
+2 -4
drivers/clk/mediatek/clk-mt8135-apmixedsys.c
··· 73 73 return ret; 74 74 } 75 75 76 - static int clk_mt8135_apmixed_remove(struct platform_device *pdev) 76 + static void clk_mt8135_apmixed_remove(struct platform_device *pdev) 77 77 { 78 78 struct device_node *node = pdev->dev.of_node; 79 79 struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev); ··· 81 81 of_clk_del_provider(node); 82 82 mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data); 83 83 mtk_free_clk_data(clk_data); 84 - 85 - return 0; 86 84 } 87 85 88 86 static const struct of_device_id of_match_clk_mt8135_apmixed[] = { ··· 91 93 92 94 static struct platform_driver clk_mt8135_apmixed_drv = { 93 95 .probe = clk_mt8135_apmixed_probe, 94 - .remove = clk_mt8135_apmixed_remove, 96 + .remove_new = clk_mt8135_apmixed_remove, 95 97 .driver = { 96 98 .name = "clk-mt8135-apmixed", 97 99 .of_match_table = of_match_clk_mt8135_apmixed,
+1 -1
drivers/clk/mediatek/clk-mt8135.c
··· 558 558 .of_match_table = of_match_clk_mt8135, 559 559 }, 560 560 .probe = mtk_clk_simple_probe, 561 - .remove = mtk_clk_simple_remove, 561 + .remove_new = mtk_clk_simple_remove, 562 562 }; 563 563 module_platform_driver(clk_mt8135_drv); 564 564
+1 -1
drivers/clk/mediatek/clk-mt8167-aud.c
··· 56 56 57 57 static struct platform_driver clk_mt8167_audsys_drv = { 58 58 .probe = mtk_clk_simple_probe, 59 - .remove = mtk_clk_simple_remove, 59 + .remove_new = mtk_clk_simple_remove, 60 60 .driver = { 61 61 .name = "clk-mt8167-audsys", 62 62 .of_match_table = of_match_clk_mt8167_audsys,
+1 -1
drivers/clk/mediatek/clk-mt8167-img.c
··· 48 48 49 49 static struct platform_driver clk_mt8167_imgsys_drv = { 50 50 .probe = mtk_clk_simple_probe, 51 - .remove = mtk_clk_simple_remove, 51 + .remove_new = mtk_clk_simple_remove, 52 52 .driver = { 53 53 .name = "clk-mt8167-imgsys", 54 54 .of_match_table = of_match_clk_mt8167_imgsys,
+1 -1
drivers/clk/mediatek/clk-mt8167-mfgcfg.c
··· 46 46 47 47 static struct platform_driver clk_mt8167_mfgcfg_drv = { 48 48 .probe = mtk_clk_simple_probe, 49 - .remove = mtk_clk_simple_remove, 49 + .remove_new = mtk_clk_simple_remove, 50 50 .driver = { 51 51 .name = "clk-mt8167-mfgcfg", 52 52 .of_match_table = of_match_clk_mt8167_mfgcfg,
+1 -1
drivers/clk/mediatek/clk-mt8167-mm.c
··· 87 87 88 88 static struct platform_driver clk_mt8167_mm_drv = { 89 89 .probe = mtk_clk_pdev_probe, 90 - .remove = mtk_clk_pdev_remove, 90 + .remove_new = mtk_clk_pdev_remove, 91 91 .driver = { 92 92 .name = "clk-mt8167-mm", 93 93 },
+1 -1
drivers/clk/mediatek/clk-mt8167-vdec.c
··· 55 55 56 56 static struct platform_driver clk_mt8167_vdec_drv = { 57 57 .probe = mtk_clk_simple_probe, 58 - .remove = mtk_clk_simple_remove, 58 + .remove_new = mtk_clk_simple_remove, 59 59 .driver = { 60 60 .name = "clk-mt8167-vdecsys", 61 61 .of_match_table = of_match_clk_mt8167_vdec,
+1 -1
drivers/clk/mediatek/clk-mt8167.c
··· 887 887 888 888 static struct platform_driver clk_mt8167_drv = { 889 889 .probe = mtk_clk_simple_probe, 890 - .remove = mtk_clk_simple_remove, 890 + .remove_new = mtk_clk_simple_remove, 891 891 .driver = { 892 892 .name = "clk-mt8167", 893 893 .of_match_table = of_match_clk_mt8167,
+7 -6
drivers/clk/mediatek/clk-mt8173-apmixedsys.c
··· 148 148 149 149 base = of_iomap(node, 0); 150 150 if (!base) 151 - return PTR_ERR(base); 151 + return -ENOMEM; 152 152 153 153 clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK); 154 - if (IS_ERR_OR_NULL(clk_data)) 154 + if (IS_ERR_OR_NULL(clk_data)) { 155 + iounmap(base); 155 156 return -ENOMEM; 157 + } 156 158 157 159 fhctl_parse_dt(fhctl_node, pllfhs, ARRAY_SIZE(pllfhs)); 158 160 r = mtk_clk_register_pllfhs(node, plls, ARRAY_SIZE(plls), ··· 188 186 ARRAY_SIZE(pllfhs), clk_data); 189 187 free_clk_data: 190 188 mtk_free_clk_data(clk_data); 189 + iounmap(base); 191 190 return r; 192 191 } 193 192 194 - static int clk_mt8173_apmixed_remove(struct platform_device *pdev) 193 + static void clk_mt8173_apmixed_remove(struct platform_device *pdev) 195 194 { 196 195 struct device_node *node = pdev->dev.of_node; 197 196 struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev); ··· 202 199 mtk_clk_unregister_pllfhs(plls, ARRAY_SIZE(plls), pllfhs, 203 200 ARRAY_SIZE(pllfhs), clk_data); 204 201 mtk_free_clk_data(clk_data); 205 - 206 - return 0; 207 202 } 208 203 209 204 static struct platform_driver clk_mt8173_apmixed_drv = { 210 205 .probe = clk_mt8173_apmixed_probe, 211 - .remove = clk_mt8173_apmixed_remove, 206 + .remove_new = clk_mt8173_apmixed_remove, 212 207 .driver = { 213 208 .name = "clk-mt8173-apmixed", 214 209 .of_match_table = of_match_clk_mt8173_apmixed,
+1 -1
drivers/clk/mediatek/clk-mt8173-img.c
··· 44 44 45 45 static struct platform_driver clk_mt8173_vdecsys_drv = { 46 46 .probe = mtk_clk_simple_probe, 47 - .remove = mtk_clk_simple_remove, 47 + .remove_new = mtk_clk_simple_remove, 48 48 .driver = { 49 49 .name = "clk-mt8173-imgsys", 50 50 .of_match_table = of_match_clk_mt8173_imgsys,
+2 -4
drivers/clk/mediatek/clk-mt8173-infracfg.c
··· 129 129 return r; 130 130 } 131 131 132 - static int clk_mt8173_infracfg_remove(struct platform_device *pdev) 132 + static void clk_mt8173_infracfg_remove(struct platform_device *pdev) 133 133 { 134 134 struct device_node *node = pdev->dev.of_node; 135 135 struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev); ··· 138 138 mtk_clk_unregister_cpumuxes(cpu_muxes, ARRAY_SIZE(cpu_muxes), clk_data); 139 139 mtk_clk_unregister_gates(infra_gates, ARRAY_SIZE(infra_gates), clk_data); 140 140 mtk_free_clk_data(clk_data); 141 - 142 - return 0; 143 141 } 144 142 145 143 static struct platform_driver clk_mt8173_infracfg_drv = { ··· 146 148 .of_match_table = of_match_clk_mt8173_infracfg, 147 149 }, 148 150 .probe = clk_mt8173_infracfg_probe, 149 - .remove = clk_mt8173_infracfg_remove, 151 + .remove_new = clk_mt8173_infracfg_remove, 150 152 }; 151 153 module_platform_driver(clk_mt8173_infracfg_drv); 152 154
+1 -1
drivers/clk/mediatek/clk-mt8173-mm.c
··· 106 106 }, 107 107 .id_table = clk_mt8173_mm_id_table, 108 108 .probe = mtk_clk_pdev_probe, 109 - .remove = mtk_clk_pdev_remove, 109 + .remove_new = mtk_clk_pdev_remove, 110 110 }; 111 111 module_platform_driver(clk_mt8173_mm_drv); 112 112
+1 -1
drivers/clk/mediatek/clk-mt8173-pericfg.c
··· 115 115 .of_match_table = of_match_clk_mt8173_pericfg, 116 116 }, 117 117 .probe = mtk_clk_simple_probe, 118 - .remove = mtk_clk_simple_remove, 118 + .remove_new = mtk_clk_simple_remove, 119 119 }; 120 120 module_platform_driver(clk_mt8173_pericfg_drv); 121 121
+13 -13
drivers/clk/mediatek/clk-mt8173-topckgen.c
··· 547 547 MUX_GATE(CLK_TOP_USB20_SEL, "usb20_sel", usb20_parents, 0x0060, 24, 2, 31), 548 548 /* CLK_CFG_3 */ 549 549 MUX_GATE(CLK_TOP_USB30_SEL, "usb30_sel", usb30_parents, 0x0070, 0, 2, 7), 550 - MUX_GATE(CLK_TOP_MSDC50_0_H_SEL, "msdc50_0_h_sel", msdc50_0_h_parents, 551 - 0x0070, 8, 3, 15), 552 - MUX_GATE(CLK_TOP_MSDC50_0_SEL, "msdc50_0_sel", msdc50_0_parents, 553 - 0x0070, 16, 4, 23), 554 - MUX_GATE(CLK_TOP_MSDC30_1_SEL, "msdc30_1_sel", msdc30_1_parents, 555 - 0x0070, 24, 3, 31), 550 + MUX_GATE_FLAGS(CLK_TOP_MSDC50_0_H_SEL, "msdc50_0_h_sel", msdc50_0_h_parents, 551 + 0x0070, 8, 3, 15, 0), 552 + MUX_GATE_FLAGS(CLK_TOP_MSDC50_0_SEL, "msdc50_0_sel", msdc50_0_parents, 553 + 0x0070, 16, 4, 23, 0), 554 + MUX_GATE_FLAGS(CLK_TOP_MSDC30_1_SEL, "msdc30_1_sel", msdc30_1_parents, 555 + 0x0070, 24, 3, 31, 0), 556 556 /* CLK_CFG_4 */ 557 - MUX_GATE(CLK_TOP_MSDC30_2_SEL, "msdc30_2_sel", msdc30_2_parents, 558 - 0x0080, 0, 3, 7), 559 - MUX_GATE(CLK_TOP_MSDC30_3_SEL, "msdc30_3_sel", msdc30_3_parents, 560 - 0x0080, 8, 4, 15), 557 + MUX_GATE_FLAGS(CLK_TOP_MSDC30_2_SEL, "msdc30_2_sel", msdc30_2_parents, 558 + 0x0080, 0, 3, 7, 0), 559 + MUX_GATE_FLAGS(CLK_TOP_MSDC30_3_SEL, "msdc30_3_sel", msdc30_3_parents, 560 + 0x0080, 8, 4, 15, 0), 561 561 MUX_GATE(CLK_TOP_AUDIO_SEL, "audio_sel", audio_parents, 562 562 0x0080, 16, 2, 23), 563 563 MUX_GATE(CLK_TOP_AUD_INTBUS_SEL, "aud_intbus_sel", aud_intbus_parents, ··· 595 595 MUX_GATE(CLK_TOP_DPILVDS_SEL, "dpilvds_sel", dpilvds_parents, 596 596 0x00c0, 24, 3, 31), 597 597 /* CLK_CFG_13 */ 598 - MUX_GATE(CLK_TOP_MSDC50_2_H_SEL, "msdc50_2_h_sel", msdc50_2_h_parents, 599 - 0x00d0, 0, 3, 7), 598 + MUX_GATE_FLAGS(CLK_TOP_MSDC50_2_H_SEL, "msdc50_2_h_sel", msdc50_2_h_parents, 599 + 0x00d0, 0, 3, 7, 0), 600 600 MUX_GATE(CLK_TOP_HDCP_SEL, "hdcp_sel", hdcp_parents, 0x00d0, 8, 2, 15), 601 601 MUX_GATE(CLK_TOP_HDCP_24M_SEL, "hdcp_24m_sel", hdcp_24m_parents, 602 602 0x00d0, 16, 2, 23), ··· 646 646 .of_match_table = of_match_clk_mt8173_topckgen, 647 647 }, 648 648 .probe = mtk_clk_simple_probe, 649 - .remove = mtk_clk_simple_remove, 649 + .remove_new = mtk_clk_simple_remove, 650 650 }; 651 651 module_platform_driver(clk_mt8173_topckgen_drv); 652 652
+1 -1
drivers/clk/mediatek/clk-mt8173-vdecsys.c
··· 46 46 47 47 static struct platform_driver clk_mt8173_vdecsys_drv = { 48 48 .probe = mtk_clk_simple_probe, 49 - .remove = mtk_clk_simple_remove, 49 + .remove_new = mtk_clk_simple_remove, 50 50 .driver = { 51 51 .name = "clk-mt8173-vdecsys", 52 52 .of_match_table = of_match_clk_mt8173_vdecsys,
+1 -1
drivers/clk/mediatek/clk-mt8173-vencsys.c
··· 57 57 .of_match_table = of_match_clk_mt8173_vencsys, 58 58 }, 59 59 .probe = mtk_clk_simple_probe, 60 - .remove = mtk_clk_simple_remove, 60 + .remove_new = mtk_clk_simple_remove, 61 61 }; 62 62 module_platform_driver(clk_mt8173_vencsys_drv); 63 63
+3 -3
drivers/clk/mediatek/clk-mt8183-audio.c
··· 87 87 return r; 88 88 } 89 89 90 - static int clk_mt8183_audio_remove(struct platform_device *pdev) 90 + static void clk_mt8183_audio_remove(struct platform_device *pdev) 91 91 { 92 92 of_platform_depopulate(&pdev->dev); 93 - return mtk_clk_simple_remove(pdev); 93 + mtk_clk_simple_remove(pdev); 94 94 } 95 95 96 96 static const struct of_device_id of_match_clk_mt8183_audio[] = { ··· 101 101 102 102 static struct platform_driver clk_mt8183_audio_drv = { 103 103 .probe = clk_mt8183_audio_probe, 104 - .remove = clk_mt8183_audio_remove, 104 + .remove_new = clk_mt8183_audio_remove, 105 105 .driver = { 106 106 .name = "clk-mt8183-audio", 107 107 .of_match_table = of_match_clk_mt8183_audio,
+1 -1
drivers/clk/mediatek/clk-mt8183-cam.c
··· 51 51 52 52 static struct platform_driver clk_mt8183_cam_drv = { 53 53 .probe = mtk_clk_simple_probe, 54 - .remove = mtk_clk_simple_remove, 54 + .remove_new = mtk_clk_simple_remove, 55 55 .driver = { 56 56 .name = "clk-mt8183-cam", 57 57 .of_match_table = of_match_clk_mt8183_cam,
+1 -1
drivers/clk/mediatek/clk-mt8183-img.c
··· 51 51 52 52 static struct platform_driver clk_mt8183_img_drv = { 53 53 .probe = mtk_clk_simple_probe, 54 - .remove = mtk_clk_simple_remove, 54 + .remove_new = mtk_clk_simple_remove, 55 55 .driver = { 56 56 .name = "clk-mt8183-img", 57 57 .of_match_table = of_match_clk_mt8183_img,
+1 -1
drivers/clk/mediatek/clk-mt8183-ipu0.c
··· 44 44 45 45 static struct platform_driver clk_mt8183_ipu_core0_drv = { 46 46 .probe = mtk_clk_simple_probe, 47 - .remove = mtk_clk_simple_remove, 47 + .remove_new = mtk_clk_simple_remove, 48 48 .driver = { 49 49 .name = "clk-mt8183-ipu_core0", 50 50 .of_match_table = of_match_clk_mt8183_ipu_core0,
+1 -1
drivers/clk/mediatek/clk-mt8183-ipu1.c
··· 44 44 45 45 static struct platform_driver clk_mt8183_ipu_core1_drv = { 46 46 .probe = mtk_clk_simple_probe, 47 - .remove = mtk_clk_simple_remove, 47 + .remove_new = mtk_clk_simple_remove, 48 48 .driver = { 49 49 .name = "clk-mt8183-ipu_core1", 50 50 .of_match_table = of_match_clk_mt8183_ipu_core1,
+1 -1
drivers/clk/mediatek/clk-mt8183-ipu_adl.c
··· 42 42 43 43 static struct platform_driver clk_mt8183_ipu_adl_drv = { 44 44 .probe = mtk_clk_simple_probe, 45 - .remove = mtk_clk_simple_remove, 45 + .remove_new = mtk_clk_simple_remove, 46 46 .driver = { 47 47 .name = "clk-mt8183-ipu_adl", 48 48 .of_match_table = of_match_clk_mt8183_ipu_adl,
+1 -1
drivers/clk/mediatek/clk-mt8183-ipu_conn.c
··· 111 111 112 112 static struct platform_driver clk_mt8183_ipu_conn_drv = { 113 113 .probe = mtk_clk_simple_probe, 114 - .remove = mtk_clk_simple_remove, 114 + .remove_new = mtk_clk_simple_remove, 115 115 .driver = { 116 116 .name = "clk-mt8183-ipu_conn", 117 117 .of_match_table = of_match_clk_mt8183_ipu_conn,
+1 -1
drivers/clk/mediatek/clk-mt8183-mfgcfg.c
··· 43 43 44 44 static struct platform_driver clk_mt8183_mfg_drv = { 45 45 .probe = mtk_clk_simple_probe, 46 - .remove = mtk_clk_simple_remove, 46 + .remove_new = mtk_clk_simple_remove, 47 47 .driver = { 48 48 .name = "clk-mt8183-mfg", 49 49 .of_match_table = of_match_clk_mt8183_mfg,
+1 -1
drivers/clk/mediatek/clk-mt8183-mm.c
··· 95 95 96 96 static struct platform_driver clk_mt8183_mm_drv = { 97 97 .probe = mtk_clk_pdev_probe, 98 - .remove = mtk_clk_pdev_remove, 98 + .remove_new = mtk_clk_pdev_remove, 99 99 .driver = { 100 100 .name = "clk-mt8183-mm", 101 101 },
+1 -1
drivers/clk/mediatek/clk-mt8183-vdec.c
··· 55 55 56 56 static struct platform_driver clk_mt8183_vdec_drv = { 57 57 .probe = mtk_clk_simple_probe, 58 - .remove = mtk_clk_simple_remove, 58 + .remove_new = mtk_clk_simple_remove, 59 59 .driver = { 60 60 .name = "clk-mt8183-vdec", 61 61 .of_match_table = of_match_clk_mt8183_vdec,
+1 -1
drivers/clk/mediatek/clk-mt8183-venc.c
··· 47 47 48 48 static struct platform_driver clk_mt8183_venc_drv = { 49 49 .probe = mtk_clk_simple_probe, 50 - .remove = mtk_clk_simple_remove, 50 + .remove_new = mtk_clk_simple_remove, 51 51 .driver = { 52 52 .name = "clk-mt8183-venc", 53 53 .of_match_table = of_match_clk_mt8183_venc,
+13 -11
drivers/clk/mediatek/clk-mt8183.c
··· 451 451 static const struct mtk_mux top_muxes[] = { 452 452 /* CLK_CFG_0 */ 453 453 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MUX_AXI, "axi_sel", 454 - axi_parents, 0x40, 0x44, 0x48, 0, 2, 7, 0x004, 0, CLK_IS_CRITICAL), 454 + axi_parents, 0x40, 0x44, 0x48, 0, 2, 7, 0x004, 0, 455 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 455 456 MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_MM, "mm_sel", 456 457 mm_parents, 0x40, 0x44, 0x48, 8, 3, 15, 0x004, 1), 457 458 MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_IMG, "img_sel", ··· 487 486 MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_SPI, "spi_sel", 488 487 spi_parents, 0x70, 0x74, 0x78, 24, 2, 31, 0x004, 15), 489 488 /* CLK_CFG_4 */ 490 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_MSDC50_0_HCLK, "msdc50_hclk_sel", 491 - msdc50_hclk_parents, 0x80, 0x84, 0x88, 0, 2, 7, 0x004, 16), 492 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_MSDC50_0, "msdc50_0_sel", 493 - msdc50_0_parents, 0x80, 0x84, 0x88, 8, 3, 15, 0x004, 17), 494 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_MSDC30_1, "msdc30_1_sel", 495 - msdc30_1_parents, 0x80, 0x84, 0x88, 16, 3, 23, 0x004, 18), 496 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_MSDC30_2, "msdc30_2_sel", 497 - msdc30_2_parents, 0x80, 0x84, 0x88, 24, 3, 31, 0x004, 19), 489 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MUX_MSDC50_0_HCLK, "msdc50_hclk_sel", 490 + msdc50_hclk_parents, 0x80, 0x84, 0x88, 0, 2, 7, 0x004, 16, 0), 491 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MUX_MSDC50_0, "msdc50_0_sel", 492 + msdc50_0_parents, 0x80, 0x84, 0x88, 8, 3, 15, 0x004, 17, 0), 493 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MUX_MSDC30_1, "msdc30_1_sel", 494 + msdc30_1_parents, 0x80, 0x84, 0x88, 16, 3, 23, 0x004, 18, 0), 495 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MUX_MSDC30_2, "msdc30_2_sel", 496 + msdc30_2_parents, 0x80, 0x84, 0x88, 24, 3, 31, 0x004, 19, 0), 498 497 /* CLK_CFG_5 */ 499 498 MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_AUDIO, "audio_sel", 500 499 audio_parents, 0x90, 0x94, 0x98, 0, 2, 7, 0x004, 20), ··· 519 518 MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_SSUSB_TOP_XHCI, "ssusb_top_xhci_sel", 520 519 ssusb_top_xhci_parents, 0xb0, 0xb4, 0xb8, 16, 2, 23, 0x004, 30), 521 520 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MUX_SPM, "spm_sel", 522 - spm_parents, 0xb0, 0xb4, 0xb8, 24, 1, 31, 0x008, 0, CLK_IS_CRITICAL), 521 + spm_parents, 0xb0, 0xb4, 0xb8, 24, 1, 31, 0x008, 0, 522 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 523 523 /* CLK_CFG_8 */ 524 524 MUX_GATE_CLR_SET_UPD(CLK_TOP_MUX_I2C, "i2c_sel", 525 525 i2c_parents, 0xc0, 0xc4, 0xc8, 0, 2, 7, 0x008, 1), ··· 874 872 875 873 static struct platform_driver clk_mt8183_drv = { 876 874 .probe = mtk_clk_simple_probe, 877 - .remove = mtk_clk_simple_remove, 875 + .remove_new = mtk_clk_simple_remove, 878 876 .driver = { 879 877 .name = "clk-mt8183", 880 878 .of_match_table = of_match_clk_mt8183,
+2 -4
drivers/clk/mediatek/clk-mt8186-apmixedsys.c
··· 172 172 return r; 173 173 } 174 174 175 - static int clk_mt8186_apmixed_remove(struct platform_device *pdev) 175 + static void clk_mt8186_apmixed_remove(struct platform_device *pdev) 176 176 { 177 177 struct device_node *node = pdev->dev.of_node; 178 178 struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev); ··· 181 181 mtk_clk_unregister_pllfhs(plls, ARRAY_SIZE(plls), pllfhs, 182 182 ARRAY_SIZE(pllfhs), clk_data); 183 183 mtk_free_clk_data(clk_data); 184 - 185 - return 0; 186 184 } 187 185 188 186 static struct platform_driver clk_mt8186_apmixed_drv = { 189 187 .probe = clk_mt8186_apmixed_probe, 190 - .remove = clk_mt8186_apmixed_remove, 188 + .remove_new = clk_mt8186_apmixed_remove, 191 189 .driver = { 192 190 .name = "clk-mt8186-apmixed", 193 191 .of_match_table = of_match_clk_mt8186_apmixed,
+1 -1
drivers/clk/mediatek/clk-mt8186-cam.c
··· 82 82 83 83 static struct platform_driver clk_mt8186_cam_drv = { 84 84 .probe = mtk_clk_simple_probe, 85 - .remove = mtk_clk_simple_remove, 85 + .remove_new = mtk_clk_simple_remove, 86 86 .driver = { 87 87 .name = "clk-mt8186-cam", 88 88 .of_match_table = of_match_clk_mt8186_cam,
+1 -1
drivers/clk/mediatek/clk-mt8186-img.c
··· 60 60 61 61 static struct platform_driver clk_mt8186_img_drv = { 62 62 .probe = mtk_clk_simple_probe, 63 - .remove = mtk_clk_simple_remove, 63 + .remove_new = mtk_clk_simple_remove, 64 64 .driver = { 65 65 .name = "clk-mt8186-img", 66 66 .of_match_table = of_match_clk_mt8186_img,
+1 -1
drivers/clk/mediatek/clk-mt8186-imp_iic_wrap.c
··· 59 59 60 60 static struct platform_driver clk_mt8186_imp_iic_wrap_drv = { 61 61 .probe = mtk_clk_simple_probe, 62 - .remove = mtk_clk_simple_remove, 62 + .remove_new = mtk_clk_simple_remove, 63 63 .driver = { 64 64 .name = "clk-mt8186-imp_iic_wrap", 65 65 .of_match_table = of_match_clk_mt8186_imp_iic_wrap,
+1 -1
drivers/clk/mediatek/clk-mt8186-infra_ao.c
··· 231 231 232 232 static struct platform_driver clk_mt8186_infra_ao_drv = { 233 233 .probe = mtk_clk_simple_probe, 234 - .remove = mtk_clk_simple_remove, 234 + .remove_new = mtk_clk_simple_remove, 235 235 .driver = { 236 236 .name = "clk-mt8186-infra-ao", 237 237 .of_match_table = of_match_clk_mt8186_infra_ao,
+1 -1
drivers/clk/mediatek/clk-mt8186-ipe.c
··· 47 47 48 48 static struct platform_driver clk_mt8186_ipe_drv = { 49 49 .probe = mtk_clk_simple_probe, 50 - .remove = mtk_clk_simple_remove, 50 + .remove_new = mtk_clk_simple_remove, 51 51 .driver = { 52 52 .name = "clk-mt8186-ipe", 53 53 .of_match_table = of_match_clk_mt8186_ipe,
+1 -1
drivers/clk/mediatek/clk-mt8186-mcu.c
··· 60 60 .of_match_table = of_match_clk_mt8186_mcu, 61 61 }, 62 62 .probe = mtk_clk_simple_probe, 63 - .remove = mtk_clk_simple_remove, 63 + .remove_new = mtk_clk_simple_remove, 64 64 }; 65 65 module_platform_driver(clk_mt8186_mcu_drv); 66 66
+1 -1
drivers/clk/mediatek/clk-mt8186-mdp.c
··· 72 72 73 73 static struct platform_driver clk_mt8186_mdp_drv = { 74 74 .probe = mtk_clk_simple_probe, 75 - .remove = mtk_clk_simple_remove, 75 + .remove_new = mtk_clk_simple_remove, 76 76 .driver = { 77 77 .name = "clk-mt8186-mdp", 78 78 .of_match_table = of_match_clk_mt8186_mdp,
+1 -1
drivers/clk/mediatek/clk-mt8186-mfg.c
··· 41 41 42 42 static struct platform_driver clk_mt8186_mfg_drv = { 43 43 .probe = mtk_clk_simple_probe, 44 - .remove = mtk_clk_simple_remove, 44 + .remove_new = mtk_clk_simple_remove, 45 45 .driver = { 46 46 .name = "clk-mt8186-mfg", 47 47 .of_match_table = of_match_clk_mt8186_mfg,
+1 -1
drivers/clk/mediatek/clk-mt8186-mm.c
··· 71 71 72 72 static struct platform_driver clk_mt8186_mm_drv = { 73 73 .probe = mtk_clk_pdev_probe, 74 - .remove = mtk_clk_pdev_remove, 74 + .remove_new = mtk_clk_pdev_remove, 75 75 .driver = { 76 76 .name = "clk-mt8186-mm", 77 77 },
+13 -13
drivers/clk/mediatek/clk-mt8186-topckgen.c
··· 504 504 */ 505 505 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_AXI, "top_axi", axi_parents, 506 506 0x0040, 0x0044, 0x0048, 0, 2, 7, 0x0004, 0, 507 - CLK_IS_CRITICAL), 507 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 508 508 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SCP, "top_scp", scp_parents, 509 509 0x0040, 0x0044, 0x0048, 8, 3, 15, 0x0004, 1, 510 - CLK_IS_CRITICAL), 510 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 511 511 MUX_GATE_CLR_SET_UPD(CLK_TOP_MFG, "top_mfg", 512 512 mfg_parents, 0x0040, 0x0044, 0x0048, 16, 2, 23, 0x0004, 2), 513 513 MUX_GATE_CLR_SET_UPD(CLK_TOP_CAMTG, "top_camtg", ··· 531 531 MUX_GATE_CLR_SET_UPD(CLK_TOP_SPI, "top_spi", 532 532 spi_parents, 0x0060, 0x0064, 0x0068, 24, 3, 31, 0x0004, 11), 533 533 /* CLK_CFG_3 */ 534 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC50_0_HCLK, "top_msdc5hclk", 535 - msdc5hclk_parents, 0x0070, 0x0074, 0x0078, 0, 2, 7, 0x0004, 12), 536 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC50_0, "top_msdc50_0", 537 - msdc50_0_parents, 0x0070, 0x0074, 0x0078, 8, 3, 15, 0x0004, 13), 538 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC30_1, "top_msdc30_1", 539 - msdc30_1_parents, 0x0070, 0x0074, 0x0078, 16, 3, 23, 0x0004, 14), 534 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_0_HCLK, "top_msdc5hclk", 535 + msdc5hclk_parents, 0x0070, 0x0074, 0x0078, 0, 2, 7, 0x0004, 12, 0), 536 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_0, "top_msdc50_0", 537 + msdc50_0_parents, 0x0070, 0x0074, 0x0078, 8, 3, 15, 0x0004, 13, 0), 538 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC30_1, "top_msdc30_1", 539 + msdc30_1_parents, 0x0070, 0x0074, 0x0078, 16, 3, 23, 0x0004, 14, 0), 540 540 MUX_GATE_CLR_SET_UPD(CLK_TOP_AUDIO, "top_audio", 541 541 audio_parents, 0x0070, 0x0074, 0x0078, 24, 2, 31, 0x0004, 15), 542 542 /* CLK_CFG_4 */ ··· 559 559 disp_pwm_parents, 0x0090, 0x0094, 0x0098, 8, 3, 15, 0x0004, 21), 560 560 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SSPM, "top_sspm", sspm_parents, 561 561 0x0090, 0x0094, 0x0098, 16, 3, 23, 0x0004, 22, 562 - CLK_IS_CRITICAL), 562 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 563 563 MUX_GATE_CLR_SET_UPD(CLK_TOP_DXCC, "top_dxcc", 564 564 dxcc_parents, 0x0090, 0x0094, 0x0098, 24, 2, 31, 0x0004, 23), 565 565 /* ··· 570 570 usb_parents, 0x00a0, 0x00a4, 0x00a8, 0, 2, 7, 0x0004, 24), 571 571 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SRCK, "top_srck", srck_parents, 572 572 0x00a0, 0x00a4, 0x00a8, 8, 2, 15, 0x0004, 25, 573 - CLK_IS_CRITICAL), 573 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 574 574 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SPM, "top_spm", spm_parents, 575 575 0x00a0, 0x00a4, 0x00a8, 16, 2, 23, 0x0004, 26, 576 - CLK_IS_CRITICAL), 576 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 577 577 MUX_GATE_CLR_SET_UPD(CLK_TOP_I2C, "top_i2c", 578 578 i2c_parents, 0x00a0, 0x00a4, 0x00a8, 24, 2, 31, 0x0004, 27), 579 579 /* CLK_CFG_7 */ ··· 627 627 */ 628 628 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_DVFSRC, "top_dvfsrc", dvfsrc_parents, 629 629 0x0100, 0x0104, 0x0108, 0, 1, 7, 0x0008, 17, 630 - CLK_IS_CRITICAL), 630 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 631 631 MUX_GATE_CLR_SET_UPD(CLK_TOP_DSI_OCC, "top_dsi_occ", 632 632 dsi_occ_parents, 0x0100, 0x0104, 0x0108, 8, 2, 15, 0x0008, 18), 633 633 MUX_GATE_CLR_SET_UPD(CLK_TOP_SPMI_MST, "top_spmi_mst", ··· 725 725 726 726 static struct platform_driver clk_mt8186_topck_drv = { 727 727 .probe = mtk_clk_simple_probe, 728 - .remove = mtk_clk_simple_remove, 728 + .remove_new = mtk_clk_simple_remove, 729 729 .driver = { 730 730 .name = "clk-mt8186-topck", 731 731 .of_match_table = of_match_clk_mt8186_topck,
+1 -1
drivers/clk/mediatek/clk-mt8186-vdec.c
··· 80 80 81 81 static struct platform_driver clk_mt8186_vdec_drv = { 82 82 .probe = mtk_clk_simple_probe, 83 - .remove = mtk_clk_simple_remove, 83 + .remove_new = mtk_clk_simple_remove, 84 84 .driver = { 85 85 .name = "clk-mt8186-vdec", 86 86 .of_match_table = of_match_clk_mt8186_vdec,
+1 -1
drivers/clk/mediatek/clk-mt8186-venc.c
··· 43 43 44 44 static struct platform_driver clk_mt8186_venc_drv = { 45 45 .probe = mtk_clk_simple_probe, 46 - .remove = mtk_clk_simple_remove, 46 + .remove_new = mtk_clk_simple_remove, 47 47 .driver = { 48 48 .name = "clk-mt8186-venc", 49 49 .of_match_table = of_match_clk_mt8186_venc,
+1 -1
drivers/clk/mediatek/clk-mt8186-wpe.c
··· 43 43 44 44 static struct platform_driver clk_mt8186_wpe_drv = { 45 45 .probe = mtk_clk_simple_probe, 46 - .remove = mtk_clk_simple_remove, 46 + .remove_new = mtk_clk_simple_remove, 47 47 .driver = { 48 48 .name = "clk-mt8186-wpe", 49 49 .of_match_table = of_match_clk_mt8186_wpe,
+1 -1
drivers/clk/mediatek/clk-mt8188-adsp_audio26m.c
··· 40 40 41 41 static struct platform_driver clk_mt8188_adsp_audio26m_drv = { 42 42 .probe = mtk_clk_simple_probe, 43 - .remove = mtk_clk_simple_remove, 43 + .remove_new = mtk_clk_simple_remove, 44 44 .driver = { 45 45 .name = "clk-mt8188-adsp_audio26m", 46 46 .of_match_table = of_match_clk_mt8188_adsp_audio26m,
+2 -4
drivers/clk/mediatek/clk-mt8188-apmixedsys.c
··· 132 132 return r; 133 133 } 134 134 135 - static int clk_mt8188_apmixed_remove(struct platform_device *pdev) 135 + static void clk_mt8188_apmixed_remove(struct platform_device *pdev) 136 136 { 137 137 struct device_node *node = pdev->dev.of_node; 138 138 struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev); ··· 141 141 mtk_clk_unregister_gates(apmixed_clks, ARRAY_SIZE(apmixed_clks), clk_data); 142 142 mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data); 143 143 mtk_free_clk_data(clk_data); 144 - 145 - return 0; 146 144 } 147 145 148 146 static struct platform_driver clk_mt8188_apmixed_drv = { 149 147 .probe = clk_mt8188_apmixed_probe, 150 - .remove = clk_mt8188_apmixed_remove, 148 + .remove_new = clk_mt8188_apmixed_remove, 151 149 .driver = { 152 150 .name = "clk-mt8188-apmixed", 153 151 .of_match_table = of_match_clk_mt8188_apmixed,
+1 -1
drivers/clk/mediatek/clk-mt8188-cam.c
··· 109 109 110 110 static struct platform_driver clk_mt8188_cam_drv = { 111 111 .probe = mtk_clk_simple_probe, 112 - .remove = mtk_clk_simple_remove, 112 + .remove_new = mtk_clk_simple_remove, 113 113 .driver = { 114 114 .name = "clk-mt8188-cam", 115 115 .of_match_table = of_match_clk_mt8188_cam,
+1 -1
drivers/clk/mediatek/clk-mt8188-ccu.c
··· 39 39 40 40 static struct platform_driver clk_mt8188_ccu_drv = { 41 41 .probe = mtk_clk_simple_probe, 42 - .remove = mtk_clk_simple_remove, 42 + .remove_new = mtk_clk_simple_remove, 43 43 .driver = { 44 44 .name = "clk-mt8188-ccu", 45 45 .of_match_table = of_match_clk_mt8188_ccu,
+1 -1
drivers/clk/mediatek/clk-mt8188-img.c
··· 101 101 102 102 static struct platform_driver clk_mt8188_imgsys_main_drv = { 103 103 .probe = mtk_clk_simple_probe, 104 - .remove = mtk_clk_simple_remove, 104 + .remove_new = mtk_clk_simple_remove, 105 105 .driver = { 106 106 .name = "clk-mt8188-imgsys_main", 107 107 .of_match_table = of_match_clk_mt8188_imgsys_main,
+1 -1
drivers/clk/mediatek/clk-mt8188-imp_iic_wrap.c
··· 71 71 72 72 static struct platform_driver clk_mt8188_imp_iic_wrap_drv = { 73 73 .probe = mtk_clk_simple_probe, 74 - .remove = mtk_clk_simple_remove, 74 + .remove_new = mtk_clk_simple_remove, 75 75 .driver = { 76 76 .name = "clk-mt8188-imp_iic_wrap", 77 77 .of_match_table = of_match_clk_mt8188_imp_iic_wrap,
+25 -1
drivers/clk/mediatek/clk-mt8188-infra_ao.c
··· 5 5 */ 6 6 7 7 #include <dt-bindings/clock/mediatek,mt8188-clk.h> 8 + #include <dt-bindings/reset/mt8188-resets.h> 8 9 #include <linux/clk-provider.h> 9 10 #include <linux/platform_device.h> 10 11 ··· 177 176 "infra_ao_aes_msdcfde_0p", "top_aes_msdcfde", 18), 178 177 }; 179 178 179 + static u16 infra_ao_rst_ofs[] = { 180 + INFRA_RST0_SET_OFFSET, 181 + INFRA_RST1_SET_OFFSET, 182 + INFRA_RST2_SET_OFFSET, 183 + INFRA_RST3_SET_OFFSET, 184 + INFRA_RST4_SET_OFFSET, 185 + }; 186 + 187 + static u16 infra_ao_idx_map[] = { 188 + [MT8188_INFRA_RST1_THERMAL_MCU_RST] = 1 * RST_NR_PER_BANK + 2, 189 + [MT8188_INFRA_RST1_THERMAL_CTRL_RST] = 1 * RST_NR_PER_BANK + 4, 190 + [MT8188_INFRA_RST3_PTP_CTRL_RST] = 3 * RST_NR_PER_BANK + 5, 191 + }; 192 + 193 + static const struct mtk_clk_rst_desc infra_ao_rst_desc = { 194 + .version = MTK_RST_SET_CLR, 195 + .rst_bank_ofs = infra_ao_rst_ofs, 196 + .rst_bank_nr = ARRAY_SIZE(infra_ao_rst_ofs), 197 + .rst_idx_map = infra_ao_idx_map, 198 + .rst_idx_map_nr = ARRAY_SIZE(infra_ao_idx_map), 199 + }; 200 + 180 201 static const struct mtk_clk_desc infra_ao_desc = { 181 202 .clks = infra_ao_clks, 182 203 .num_clks = ARRAY_SIZE(infra_ao_clks), 204 + .rst_desc = &infra_ao_rst_desc, 183 205 }; 184 206 185 207 static const struct of_device_id of_match_clk_mt8188_infra_ao[] = { ··· 213 189 214 190 static struct platform_driver clk_mt8188_infra_ao_drv = { 215 191 .probe = mtk_clk_simple_probe, 216 - .remove = mtk_clk_simple_remove, 192 + .remove_new = mtk_clk_simple_remove, 217 193 .driver = { 218 194 .name = "clk-mt8188-infra_ao", 219 195 .of_match_table = of_match_clk_mt8188_infra_ao,
+1 -1
drivers/clk/mediatek/clk-mt8188-ipe.c
··· 41 41 42 42 static struct platform_driver clk_mt8188_ipe_drv = { 43 43 .probe = mtk_clk_simple_probe, 44 - .remove = mtk_clk_simple_remove, 44 + .remove_new = mtk_clk_simple_remove, 45 45 .driver = { 46 46 .name = "clk-mt8188-ipe", 47 47 .of_match_table = of_match_clk_mt8188_ipe,
+1 -1
drivers/clk/mediatek/clk-mt8188-mfg.c
··· 38 38 39 39 static struct platform_driver clk_mt8188_mfgcfg_drv = { 40 40 .probe = mtk_clk_simple_probe, 41 - .remove = mtk_clk_simple_remove, 41 + .remove_new = mtk_clk_simple_remove, 42 42 .driver = { 43 43 .name = "clk-mt8188-mfgcfg", 44 44 .of_match_table = of_match_clk_mt8188_mfgcfg,
+1 -1
drivers/clk/mediatek/clk-mt8188-peri_ao.c
··· 49 49 50 50 static struct platform_driver clk_mt8188_peri_ao_drv = { 51 51 .probe = mtk_clk_simple_probe, 52 - .remove = mtk_clk_simple_remove, 52 + .remove_new = mtk_clk_simple_remove, 53 53 .driver = { 54 54 .name = "clk-mt8188-peri_ao", 55 55 .of_match_table = of_match_clk_mt8188_peri_ao,
+26 -20
drivers/clk/mediatek/clk-mt8188-topckgen.c
··· 954 954 * spm_sel and scp_sel are main clocks in always-on co-processor. 955 955 */ 956 956 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_AXI, "top_axi", axi_parents, 957 - 0x020, 0x024, 0x028, 0, 4, 7, 0x04, 0, CLK_IS_CRITICAL), 957 + 0x020, 0x024, 0x028, 0, 4, 7, 0x04, 0, 958 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 958 959 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SPM, "top_spm", spm_parents, 959 - 0x020, 0x024, 0x028, 8, 4, 15, 0x04, 1, CLK_IS_CRITICAL), 960 + 0x020, 0x024, 0x028, 8, 4, 15, 0x04, 1, 961 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 960 962 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SCP, "top_scp", scp_parents, 961 - 0x020, 0x024, 0x028, 16, 4, 23, 0x04, 2, CLK_IS_CRITICAL), 963 + 0x020, 0x024, 0x028, 16, 4, 23, 0x04, 2, 964 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 962 965 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_BUS_AXIMEM, "top_bus_aximem", bus_aximem_parents, 963 - 0x020, 0x024, 0x028, 24, 4, 31, 0x04, 3, CLK_IS_CRITICAL), 966 + 0x020, 0x024, 0x028, 24, 4, 31, 0x04, 3, 967 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 964 968 /* CLK_CFG_1 */ 965 969 MUX_GATE_CLR_SET_UPD(CLK_TOP_VPP, "top_vpp", 966 970 vpp_parents, 0x02C, 0x030, 0x034, 0, 4, 7, 0x04, 4), ··· 1015 1011 uart_parents, 0x068, 0x06C, 0x070, 0, 4, 7, 0x04, 24), 1016 1012 MUX_GATE_CLR_SET_UPD(CLK_TOP_SPI, "top_spi", 1017 1013 spi_parents, 0x068, 0x06C, 0x070, 8, 4, 15, 0x04, 25), 1018 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC50_0_HCLK, "top_msdc5hclk", 1019 - msdc5hclk_parents, 0x068, 0x06C, 0x070, 16, 4, 23, 0x04, 26), 1020 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC50_0, "top_msdc50_0", 1021 - msdc50_0_parents, 0x068, 0x06C, 0x070, 24, 4, 31, 0x04, 27), 1014 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_0_HCLK, "top_msdc5hclk", 1015 + msdc5hclk_parents, 0x068, 0x06C, 0x070, 16, 4, 23, 0x04, 26, 0), 1016 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_0, "top_msdc50_0", 1017 + msdc50_0_parents, 0x068, 0x06C, 0x070, 24, 4, 31, 0x04, 27, 0), 1022 1018 /* CLK_CFG_7 */ 1023 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC30_1, "top_msdc30_1", 1024 - msdc30_1_parents, 0x074, 0x078, 0x07C, 0, 4, 7, 0x04, 28), 1025 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC30_2, "top_msdc30_2", 1026 - msdc30_2_parents, 0x074, 0x078, 0x07C, 8, 4, 15, 0x04, 29), 1019 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC30_1, "top_msdc30_1", 1020 + msdc30_1_parents, 0x074, 0x078, 0x07C, 0, 4, 7, 0x04, 28, 0), 1021 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC30_2, "top_msdc30_2", 1022 + msdc30_2_parents, 0x074, 0x078, 0x07C, 8, 4, 15, 0x04, 29, 0), 1027 1023 MUX_GATE_CLR_SET_UPD(CLK_TOP_INTDIR, "top_intdir", 1028 1024 intdir_parents, 0x074, 0x078, 0x07C, 16, 4, 23, 0x04, 30), 1029 1025 MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD_INTBUS, "top_aud_intbus", ··· 1082 1078 MUX_GATE_CLR_SET_UPD(CLK_TOP_PWM, "top_pwm", 1083 1079 pwm_parents, 0x0BC, 0x0C0, 0x0C4, 8, 4, 15, 0x08, 21), 1084 1080 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MCUPM, "top_mcupm", mcupm_parents, 1085 - 0x0BC, 0x0C0, 0x0C4, 16, 4, 23, 0x08, 22, CLK_IS_CRITICAL), 1081 + 0x0BC, 0x0C0, 0x0C4, 16, 4, 23, 0x08, 22, 1082 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 1086 1083 MUX_GATE_CLR_SET_UPD(CLK_TOP_SPMI_P_MST, "top_spmi_p_mst", 1087 1084 spmi_p_mst_parents, 0x0BC, 0x0C0, 0x0C4, 24, 4, 31, 0x08, 23), 1088 1085 /* ··· 1093 1088 MUX_GATE_CLR_SET_UPD(CLK_TOP_SPMI_M_MST, "top_spmi_m_mst", 1094 1089 spmi_m_mst_parents, 0x0C8, 0x0CC, 0x0D0, 0, 4, 7, 0x08, 24), 1095 1090 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_DVFSRC, "top_dvfsrc", dvfsrc_parents, 1096 - 0x0C8, 0x0CC, 0x0D0, 8, 4, 15, 0x08, 25, CLK_IS_CRITICAL), 1091 + 0x0C8, 0x0CC, 0x0D0, 8, 4, 15, 0x08, 25, 1092 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 1097 1093 MUX_GATE_CLR_SET_UPD(CLK_TOP_TL, "top_tl", 1098 1094 tl_parents, 0x0C8, 0x0CC, 0x0D0, 16, 4, 23, 0x08, 26), 1099 1095 MUX_GATE_CLR_SET_UPD(CLK_TOP_AES_MSDCFDE, "top_aes_msdcfde", ··· 1170 1164 MUX_GATE_CLR_SET_UPD(CLK_TOP_SPINOR, "top_spinor", 1171 1165 spinor_parents, 0x0128, 0x012C, 0x0130, 0, 4, 7, 0x0C, 24), 1172 1166 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_ULPOSC, "top_ulposc", ulposc_parents, 1173 - 0x0128, 0x012C, 0x0130, 8, 4, 15, 0x0C, 25, CLK_IS_CRITICAL), 1167 + 0x0128, 0x012C, 0x0130, 8, 4, 15, 0x0C, 25, 1168 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 1174 1169 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SRCK, "top_srck", srck_parents, 1175 - 0x0128, 0x012C, 0x0130, 16, 4, 23, 0x0C, 26, CLK_IS_CRITICAL), 1170 + 0x0128, 0x012C, 0x0130, 16, 4, 23, 0x0C, 26, 1171 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 1176 1172 }; 1177 1173 1178 1174 static const struct mtk_composite top_adj_divs[] = { ··· 1330 1322 return r; 1331 1323 } 1332 1324 1333 - static int clk_mt8188_topck_remove(struct platform_device *pdev) 1325 + static void clk_mt8188_topck_remove(struct platform_device *pdev) 1334 1326 { 1335 1327 struct clk_hw_onecell_data *top_clk_data = platform_get_drvdata(pdev); 1336 1328 struct device_node *node = pdev->dev.of_node; ··· 1342 1334 mtk_clk_unregister_factors(top_divs, ARRAY_SIZE(top_divs), top_clk_data); 1343 1335 mtk_clk_unregister_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), top_clk_data); 1344 1336 mtk_free_clk_data(top_clk_data); 1345 - 1346 - return 0; 1347 1337 } 1348 1338 1349 1339 static struct platform_driver clk_mt8188_topck_drv = { 1350 1340 .probe = clk_mt8188_topck_probe, 1351 - .remove = clk_mt8188_topck_remove, 1341 + .remove_new = clk_mt8188_topck_remove, 1352 1342 .driver = { 1353 1343 .name = "clk-mt8188-topck", 1354 1344 .of_match_table = of_match_clk_mt8188_topck,
+1 -1
drivers/clk/mediatek/clk-mt8188-vdec.c
··· 81 81 82 82 static struct platform_driver clk_mt8188_vdec_drv = { 83 83 .probe = mtk_clk_simple_probe, 84 - .remove = mtk_clk_simple_remove, 84 + .remove_new = mtk_clk_simple_remove, 85 85 .driver = { 86 86 .name = "clk-mt8188-vdec", 87 87 .of_match_table = of_match_clk_mt8188_vdec,
+1 -1
drivers/clk/mediatek/clk-mt8188-vdo0.c
··· 97 97 98 98 static struct platform_driver clk_mt8188_vdo0_drv = { 99 99 .probe = mtk_clk_pdev_probe, 100 - .remove = mtk_clk_pdev_remove, 100 + .remove_new = mtk_clk_pdev_remove, 101 101 .driver = { 102 102 .name = "clk-mt8188-vdo0", 103 103 },
+1 -1
drivers/clk/mediatek/clk-mt8188-vdo1.c
··· 144 144 145 145 static struct platform_driver clk_mt8188_vdo1_drv = { 146 146 .probe = mtk_clk_pdev_probe, 147 - .remove = mtk_clk_pdev_remove, 147 + .remove_new = mtk_clk_pdev_remove, 148 148 .driver = { 149 149 .name = "clk-mt8188-vdo1", 150 150 },
+1 -1
drivers/clk/mediatek/clk-mt8188-venc.c
··· 45 45 46 46 static struct platform_driver clk_mt8188_venc1_drv = { 47 47 .probe = mtk_clk_simple_probe, 48 - .remove = mtk_clk_simple_remove, 48 + .remove_new = mtk_clk_simple_remove, 49 49 .driver = { 50 50 .name = "clk-mt8188-venc1", 51 51 .of_match_table = of_match_clk_mt8188_venc1,
+1 -1
drivers/clk/mediatek/clk-mt8188-vpp0.c
··· 104 104 105 105 static struct platform_driver clk_mt8188_vpp0_drv = { 106 106 .probe = mtk_clk_pdev_probe, 107 - .remove = mtk_clk_pdev_remove, 107 + .remove_new = mtk_clk_pdev_remove, 108 108 .driver = { 109 109 .name = "clk-mt8188-vpp0", 110 110 },
+1 -1
drivers/clk/mediatek/clk-mt8188-vpp1.c
··· 99 99 100 100 static struct platform_driver clk_mt8188_vpp1_drv = { 101 101 .probe = mtk_clk_pdev_probe, 102 - .remove = mtk_clk_pdev_remove, 102 + .remove_new = mtk_clk_pdev_remove, 103 103 .driver = { 104 104 .name = "clk-mt8188-vpp1", 105 105 },
+1 -1
drivers/clk/mediatek/clk-mt8188-wpe.c
··· 94 94 95 95 static struct platform_driver clk_mt8188_wpe_drv = { 96 96 .probe = mtk_clk_simple_probe, 97 - .remove = mtk_clk_simple_remove, 97 + .remove_new = mtk_clk_simple_remove, 98 98 .driver = { 99 99 .name = "clk-mt8188-wpe", 100 100 .of_match_table = of_match_clk_mt8188_wpe,
+2 -4
drivers/clk/mediatek/clk-mt8192-apmixedsys.c
··· 188 188 return r; 189 189 } 190 190 191 - static int clk_mt8192_apmixed_remove(struct platform_device *pdev) 191 + static void clk_mt8192_apmixed_remove(struct platform_device *pdev) 192 192 { 193 193 struct device_node *node = pdev->dev.of_node; 194 194 struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev); ··· 198 198 mtk_clk_unregister_pllfhs(plls, ARRAY_SIZE(plls), pllfhs, 199 199 ARRAY_SIZE(pllfhs), clk_data); 200 200 mtk_free_clk_data(clk_data); 201 - 202 - return 0; 203 201 } 204 202 205 203 static struct platform_driver clk_mt8192_apmixed_drv = { ··· 206 208 .of_match_table = of_match_clk_mt8192_apmixed, 207 209 }, 208 210 .probe = clk_mt8192_apmixed_probe, 209 - .remove = clk_mt8192_apmixed_remove, 211 + .remove_new = clk_mt8192_apmixed_remove, 210 212 }; 211 213 module_platform_driver(clk_mt8192_apmixed_drv); 212 214 MODULE_DESCRIPTION("MediaTek MT8192 apmixed clocks driver");
+3 -3
drivers/clk/mediatek/clk-mt8192-aud.c
··· 97 97 return r; 98 98 } 99 99 100 - static int clk_mt8192_aud_remove(struct platform_device *pdev) 100 + static void clk_mt8192_aud_remove(struct platform_device *pdev) 101 101 { 102 102 of_platform_depopulate(&pdev->dev); 103 - return mtk_clk_simple_remove(pdev); 103 + mtk_clk_simple_remove(pdev); 104 104 } 105 105 106 106 static const struct of_device_id of_match_clk_mt8192_aud[] = { ··· 111 111 112 112 static struct platform_driver clk_mt8192_aud_drv = { 113 113 .probe = clk_mt8192_aud_probe, 114 - .remove = clk_mt8192_aud_remove, 114 + .remove_new = clk_mt8192_aud_remove, 115 115 .driver = { 116 116 .name = "clk-mt8192-aud", 117 117 .of_match_table = of_match_clk_mt8192_aud,
+1 -1
drivers/clk/mediatek/clk-mt8192-cam.c
··· 99 99 100 100 static struct platform_driver clk_mt8192_cam_drv = { 101 101 .probe = mtk_clk_simple_probe, 102 - .remove = mtk_clk_simple_remove, 102 + .remove_new = mtk_clk_simple_remove, 103 103 .driver = { 104 104 .name = "clk-mt8192-cam", 105 105 .of_match_table = of_match_clk_mt8192_cam,
+1 -1
drivers/clk/mediatek/clk-mt8192-img.c
··· 62 62 63 63 static struct platform_driver clk_mt8192_img_drv = { 64 64 .probe = mtk_clk_simple_probe, 65 - .remove = mtk_clk_simple_remove, 65 + .remove_new = mtk_clk_simple_remove, 66 66 .driver = { 67 67 .name = "clk-mt8192-img", 68 68 .of_match_table = of_match_clk_mt8192_img,
+1 -1
drivers/clk/mediatek/clk-mt8192-imp_iic_wrap.c
··· 111 111 112 112 static struct platform_driver clk_mt8192_imp_iic_wrap_drv = { 113 113 .probe = mtk_clk_simple_probe, 114 - .remove = mtk_clk_simple_remove, 114 + .remove_new = mtk_clk_simple_remove, 115 115 .driver = { 116 116 .name = "clk-mt8192-imp_iic_wrap", 117 117 .of_match_table = of_match_clk_mt8192_imp_iic_wrap,
+1 -1
drivers/clk/mediatek/clk-mt8192-ipe.c
··· 49 49 50 50 static struct platform_driver clk_mt8192_ipe_drv = { 51 51 .probe = mtk_clk_simple_probe, 52 - .remove = mtk_clk_simple_remove, 52 + .remove_new = mtk_clk_simple_remove, 53 53 .driver = { 54 54 .name = "clk-mt8192-ipe", 55 55 .of_match_table = of_match_clk_mt8192_ipe,
+1 -1
drivers/clk/mediatek/clk-mt8192-mdp.c
··· 74 74 75 75 static struct platform_driver clk_mt8192_mdp_drv = { 76 76 .probe = mtk_clk_simple_probe, 77 - .remove = mtk_clk_simple_remove, 77 + .remove_new = mtk_clk_simple_remove, 78 78 .driver = { 79 79 .name = "clk-mt8192-mdp", 80 80 .of_match_table = of_match_clk_mt8192_mdp,
+1 -1
drivers/clk/mediatek/clk-mt8192-mfg.c
··· 44 44 45 45 static struct platform_driver clk_mt8192_mfg_drv = { 46 46 .probe = mtk_clk_simple_probe, 47 - .remove = mtk_clk_simple_remove, 47 + .remove_new = mtk_clk_simple_remove, 48 48 .driver = { 49 49 .name = "clk-mt8192-mfg", 50 50 .of_match_table = of_match_clk_mt8192_mfg,
+1 -1
drivers/clk/mediatek/clk-mt8192-mm.c
··· 93 93 94 94 static struct platform_driver clk_mt8192_mm_drv = { 95 95 .probe = mtk_clk_pdev_probe, 96 - .remove = mtk_clk_pdev_remove, 96 + .remove_new = mtk_clk_pdev_remove, 97 97 .driver = { 98 98 .name = "clk-mt8192-mm", 99 99 },
+1 -1
drivers/clk/mediatek/clk-mt8192-msdc.c
··· 56 56 57 57 static struct platform_driver clk_mt8192_msdc_drv = { 58 58 .probe = mtk_clk_simple_probe, 59 - .remove = mtk_clk_simple_remove, 59 + .remove_new = mtk_clk_simple_remove, 60 60 .driver = { 61 61 .name = "clk-mt8192-msdc", 62 62 .of_match_table = of_match_clk_mt8192_msdc,
+1 -1
drivers/clk/mediatek/clk-mt8192-scp_adsp.c
··· 42 42 43 43 static struct platform_driver clk_mt8192_scp_adsp_drv = { 44 44 .probe = mtk_clk_simple_probe, 45 - .remove = mtk_clk_simple_remove, 45 + .remove_new = mtk_clk_simple_remove, 46 46 .driver = { 47 47 .name = "clk-mt8192-scp_adsp", 48 48 .of_match_table = of_match_clk_mt8192_scp_adsp,
+1 -1
drivers/clk/mediatek/clk-mt8192-vdec.c
··· 86 86 87 87 static struct platform_driver clk_mt8192_vdec_drv = { 88 88 .probe = mtk_clk_simple_probe, 89 - .remove = mtk_clk_simple_remove, 89 + .remove_new = mtk_clk_simple_remove, 90 90 .driver = { 91 91 .name = "clk-mt8192-vdec", 92 92 .of_match_table = of_match_clk_mt8192_vdec,
+1 -1
drivers/clk/mediatek/clk-mt8192-venc.c
··· 45 45 46 46 static struct platform_driver clk_mt8192_venc_drv = { 47 47 .probe = mtk_clk_simple_probe, 48 - .remove = mtk_clk_simple_remove, 48 + .remove_new = mtk_clk_simple_remove, 49 49 .driver = { 50 50 .name = "clk-mt8192-venc", 51 51 .of_match_table = of_match_clk_mt8192_venc,
+13 -12
drivers/clk/mediatek/clk-mt8192.c
··· 549 549 /* CLK_CFG_0 */ 550 550 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_AXI_SEL, "axi_sel", 551 551 axi_parents, 0x010, 0x014, 0x018, 0, 3, 7, 0x004, 0, 552 - CLK_IS_CRITICAL), 552 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 553 553 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SPM_SEL, "spm_sel", 554 554 spm_parents, 0x010, 0x014, 0x018, 8, 2, 15, 0x004, 1, 555 - CLK_IS_CRITICAL), 555 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 556 556 MUX_GATE_CLR_SET_UPD(CLK_TOP_SCP_SEL, "scp_sel", 557 557 scp_parents, 0x010, 0x014, 0x018, 16, 3, 23, 0x004, 2), 558 558 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_BUS_AXIMEM_SEL, "bus_aximem_sel", 559 559 bus_aximem_parents, 0x010, 0x014, 0x018, 24, 3, 31, 0x004, 3, 560 - CLK_IS_CRITICAL), 560 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 561 561 /* CLK_CFG_1 */ 562 562 MUX_GATE_CLR_SET_UPD(CLK_TOP_DISP_SEL, "disp_sel", 563 563 disp_parents, 0x020, 0x024, 0x028, 0, 4, 7, 0x004, 4), ··· 601 601 uart_parents, 0x070, 0x074, 0x078, 8, 1, 15, 0x004, 25), 602 602 MUX_GATE_CLR_SET_UPD(CLK_TOP_SPI_SEL, "spi_sel", 603 603 spi_parents, 0x070, 0x074, 0x078, 16, 2, 23, 0x004, 26), 604 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC50_0_H_SEL, "msdc50_0_h_sel", 605 - msdc50_0_h_parents, 0x070, 0x074, 0x078, 24, 2, 31, 0x004, 27), 604 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_0_H_SEL, "msdc50_0_h_sel", 605 + msdc50_0_h_parents, 0x070, 0x074, 0x078, 24, 2, 606 + 31, 0x004, 27, 0), 606 607 /* CLK_CFG_7 */ 607 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC50_0_SEL, "msdc50_0_sel", 608 - msdc50_0_parents, 0x080, 0x084, 0x088, 0, 3, 7, 0x004, 28), 609 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC30_1_SEL, "msdc30_1_sel", 610 - msdc30_parents, 0x080, 0x084, 0x088, 8, 3, 15, 0x004, 29), 611 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC30_2_SEL, "msdc30_2_sel", 612 - msdc30_parents, 0x080, 0x084, 0x088, 16, 3, 23, 0x004, 30), 608 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_0_SEL, "msdc50_0_sel", 609 + msdc50_0_parents, 0x080, 0x084, 0x088, 0, 3, 7, 0x004, 28, 0), 610 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC30_1_SEL, "msdc30_1_sel", 611 + msdc30_parents, 0x080, 0x084, 0x088, 8, 3, 15, 0x004, 29, 0), 612 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC30_2_SEL, "msdc30_2_sel", 613 + msdc30_parents, 0x080, 0x084, 0x088, 16, 3, 23, 0x004, 30, 0), 613 614 MUX_GATE_CLR_SET_UPD(CLK_TOP_AUDIO_SEL, "audio_sel", 614 615 audio_parents, 0x080, 0x084, 0x088, 24, 2, 31, 0x008, 0), 615 616 /* CLK_CFG_8 */ ··· 1028 1027 .of_match_table = of_match_clk_mt8192, 1029 1028 }, 1030 1029 .probe = mtk_clk_simple_probe, 1031 - .remove = mtk_clk_simple_remove, 1030 + .remove_new = mtk_clk_simple_remove, 1032 1031 }; 1033 1032 module_platform_driver(clk_mt8192_drv); 1034 1033 MODULE_LICENSE("GPL");
+2 -4
drivers/clk/mediatek/clk-mt8195-apmixedsys.c
··· 209 209 return r; 210 210 } 211 211 212 - static int clk_mt8195_apmixed_remove(struct platform_device *pdev) 212 + static void clk_mt8195_apmixed_remove(struct platform_device *pdev) 213 213 { 214 214 struct device_node *node = pdev->dev.of_node; 215 215 struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev); ··· 219 219 mtk_clk_unregister_pllfhs(plls, ARRAY_SIZE(plls), pllfhs, 220 220 ARRAY_SIZE(pllfhs), clk_data); 221 221 mtk_free_clk_data(clk_data); 222 - 223 - return 0; 224 222 } 225 223 226 224 static struct platform_driver clk_mt8195_apmixed_drv = { 227 225 .probe = clk_mt8195_apmixed_probe, 228 - .remove = clk_mt8195_apmixed_remove, 226 + .remove_new = clk_mt8195_apmixed_remove, 229 227 .driver = { 230 228 .name = "clk-mt8195-apmixed", 231 229 .of_match_table = of_match_clk_mt8195_apmixed,
+2 -4
drivers/clk/mediatek/clk-mt8195-apusys_pll.c
··· 85 85 return r; 86 86 } 87 87 88 - static int clk_mt8195_apusys_pll_remove(struct platform_device *pdev) 88 + static void clk_mt8195_apusys_pll_remove(struct platform_device *pdev) 89 89 { 90 90 struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev); 91 91 struct device_node *node = pdev->dev.of_node; ··· 93 93 of_clk_del_provider(node); 94 94 mtk_clk_unregister_plls(apusys_plls, ARRAY_SIZE(apusys_plls), clk_data); 95 95 mtk_free_clk_data(clk_data); 96 - 97 - return 0; 98 96 } 99 97 100 98 static const struct of_device_id of_match_clk_mt8195_apusys_pll[] = { ··· 103 105 104 106 static struct platform_driver clk_mt8195_apusys_pll_drv = { 105 107 .probe = clk_mt8195_apusys_pll_probe, 106 - .remove = clk_mt8195_apusys_pll_remove, 108 + .remove_new = clk_mt8195_apusys_pll_remove, 107 109 .driver = { 108 110 .name = "clk-mt8195-apusys_pll", 109 111 .of_match_table = of_match_clk_mt8195_apusys_pll,
+1 -1
drivers/clk/mediatek/clk-mt8195-cam.c
··· 135 135 136 136 static struct platform_driver clk_mt8195_cam_drv = { 137 137 .probe = mtk_clk_simple_probe, 138 - .remove = mtk_clk_simple_remove, 138 + .remove_new = mtk_clk_simple_remove, 139 139 .driver = { 140 140 .name = "clk-mt8195-cam", 141 141 .of_match_table = of_match_clk_mt8195_cam,
+1 -1
drivers/clk/mediatek/clk-mt8195-ccu.c
··· 43 43 44 44 static struct platform_driver clk_mt8195_ccu_drv = { 45 45 .probe = mtk_clk_simple_probe, 46 - .remove = mtk_clk_simple_remove, 46 + .remove_new = mtk_clk_simple_remove, 47 47 .driver = { 48 48 .name = "clk-mt8195-ccu", 49 49 .of_match_table = of_match_clk_mt8195_ccu,
+1 -1
drivers/clk/mediatek/clk-mt8195-img.c
··· 89 89 90 90 static struct platform_driver clk_mt8195_img_drv = { 91 91 .probe = mtk_clk_simple_probe, 92 - .remove = mtk_clk_simple_remove, 92 + .remove_new = mtk_clk_simple_remove, 93 93 .driver = { 94 94 .name = "clk-mt8195-img", 95 95 .of_match_table = of_match_clk_mt8195_img,
+1 -1
drivers/clk/mediatek/clk-mt8195-imp_iic_wrap.c
··· 59 59 60 60 static struct platform_driver clk_mt8195_imp_iic_wrap_drv = { 61 61 .probe = mtk_clk_simple_probe, 62 - .remove = mtk_clk_simple_remove, 62 + .remove_new = mtk_clk_simple_remove, 63 63 .driver = { 64 64 .name = "clk-mt8195-imp_iic_wrap", 65 65 .of_match_table = of_match_clk_mt8195_imp_iic_wrap,
+1 -1
drivers/clk/mediatek/clk-mt8195-infra_ao.c
··· 233 233 234 234 static struct platform_driver clk_mt8195_infra_ao_drv = { 235 235 .probe = mtk_clk_simple_probe, 236 - .remove = mtk_clk_simple_remove, 236 + .remove_new = mtk_clk_simple_remove, 237 237 .driver = { 238 238 .name = "clk-mt8195-infra_ao", 239 239 .of_match_table = of_match_clk_mt8195_infra_ao,
+1 -1
drivers/clk/mediatek/clk-mt8195-ipe.c
··· 44 44 45 45 static struct platform_driver clk_mt8195_ipe_drv = { 46 46 .probe = mtk_clk_simple_probe, 47 - .remove = mtk_clk_simple_remove, 47 + .remove_new = mtk_clk_simple_remove, 48 48 .driver = { 49 49 .name = "clk-mt8195-ipe", 50 50 .of_match_table = of_match_clk_mt8195_ipe,
+1 -1
drivers/clk/mediatek/clk-mt8195-mfg.c
··· 42 42 43 43 static struct platform_driver clk_mt8195_mfg_drv = { 44 44 .probe = mtk_clk_simple_probe, 45 - .remove = mtk_clk_simple_remove, 45 + .remove_new = mtk_clk_simple_remove, 46 46 .driver = { 47 47 .name = "clk-mt8195-mfg", 48 48 .of_match_table = of_match_clk_mt8195_mfg,
+1 -1
drivers/clk/mediatek/clk-mt8195-peri_ao.c
··· 55 55 56 56 static struct platform_driver clk_mt8195_peri_ao_drv = { 57 57 .probe = mtk_clk_simple_probe, 58 - .remove = mtk_clk_simple_remove, 58 + .remove_new = mtk_clk_simple_remove, 59 59 .driver = { 60 60 .name = "clk-mt8195-peri_ao", 61 61 .of_match_table = of_match_clk_mt8195_peri_ao,
+1 -1
drivers/clk/mediatek/clk-mt8195-scp_adsp.c
··· 40 40 41 41 static struct platform_driver clk_mt8195_scp_adsp_drv = { 42 42 .probe = mtk_clk_simple_probe, 43 - .remove = mtk_clk_simple_remove, 43 + .remove_new = mtk_clk_simple_remove, 44 44 .driver = { 45 45 .name = "clk-mt8195-scp_adsp", 46 46 .of_match_table = of_match_clk_mt8195_scp_adsp,
+30 -22
drivers/clk/mediatek/clk-mt8195-topckgen.c
··· 862 862 * top_spm and top_scp are main clocks in always-on co-processor. 863 863 */ 864 864 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_AXI, "top_axi", 865 - axi_parents, 0x020, 0x024, 0x028, 0, 3, 7, 0x04, 0, CLK_IS_CRITICAL), 865 + axi_parents, 0x020, 0x024, 0x028, 0, 3, 7, 0x04, 0, 866 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 866 867 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SPM, "top_spm", 867 - spm_parents, 0x020, 0x024, 0x028, 8, 2, 15, 0x04, 1, CLK_IS_CRITICAL), 868 + spm_parents, 0x020, 0x024, 0x028, 8, 2, 15, 0x04, 1, 869 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 868 870 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SCP, "top_scp", 869 - scp_parents, 0x020, 0x024, 0x028, 16, 3, 23, 0x04, 2, CLK_IS_CRITICAL), 871 + scp_parents, 0x020, 0x024, 0x028, 16, 3, 23, 0x04, 2, 872 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 870 873 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_BUS_AXIMEM, "top_bus_aximem", 871 - bus_aximem_parents, 0x020, 0x024, 0x028, 24, 3, 31, 0x04, 3, CLK_IS_CRITICAL), 874 + bus_aximem_parents, 0x020, 0x024, 0x028, 24, 3, 31, 0x04, 3, 875 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 872 876 /* CLK_CFG_1 */ 873 877 MUX_GATE_CLR_SET_UPD(CLK_TOP_VPP, "top_vpp", 874 878 vpp_parents, 0x02C, 0x030, 0x034, 0, 4, 7, 0x04, 4), ··· 930 926 /* CLK_CFG_7 */ 931 927 MUX_GATE_CLR_SET_UPD(CLK_TOP_SPIS, "top_spis", 932 928 spis_parents, 0x074, 0x078, 0x07C, 0, 3, 7, 0x04, 28), 933 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC50_0_HCLK, "top_msdc50_0_hclk", 934 - msdc50_0_h_parents, 0x074, 0x078, 0x07C, 8, 2, 15, 0x04, 29), 935 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC50_0, "top_msdc50_0", 936 - msdc50_0_parents, 0x074, 0x078, 0x07C, 16, 3, 23, 0x04, 30), 937 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC30_1, "top_msdc30_1", 938 - msdc30_parents, 0x074, 0x078, 0x07C, 24, 3, 31, 0x04, 31), 929 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_0_HCLK, "top_msdc50_0_hclk", 930 + msdc50_0_h_parents, 0x074, 0x078, 0x07C, 8, 2, 15, 0x04, 29, 0), 931 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_0, "top_msdc50_0", 932 + msdc50_0_parents, 0x074, 0x078, 0x07C, 16, 3, 23, 0x04, 30, 0), 933 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC30_1, "top_msdc30_1", 934 + msdc30_parents, 0x074, 0x078, 0x07C, 24, 3, 31, 0x04, 31, 0), 939 935 /* CLK_CFG_8 */ 940 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC30_2, "top_msdc30_2", 941 - msdc30_parents, 0x080, 0x084, 0x088, 0, 3, 7, 0x08, 0), 936 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC30_2, "top_msdc30_2", 937 + msdc30_parents, 0x080, 0x084, 0x088, 0, 3, 7, 0x08, 0, 0), 942 938 MUX_GATE_CLR_SET_UPD(CLK_TOP_INTDIR, "top_intdir", 943 939 intdir_parents, 0x080, 0x084, 0x088, 8, 2, 15, 0x08, 1), 944 940 MUX_GATE_CLR_SET_UPD(CLK_TOP_AUD_INTBUS, "top_aud_intbus", ··· 955 951 MUX_GATE_CLR_SET_UPD(CLK_TOP_ATB, "top_atb", 956 952 atb_parents, 0x08C, 0x090, 0x094, 8, 2, 15, 0x08, 5), 957 953 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_PWRMCU, "top_pwrmcu", 958 - pwrmcu_parents, 0x08C, 0x090, 0x094, 16, 3, 23, 0x08, 6, CLK_IS_CRITICAL), 954 + pwrmcu_parents, 0x08C, 0x090, 0x094, 16, 3, 23, 0x08, 6, 955 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 959 956 MUX_GATE_CLR_SET_UPD(CLK_TOP_DP, "top_dp", 960 957 dp_parents, 0x08C, 0x090, 0x094, 24, 4, 31, 0x08, 7), 961 958 /* CLK_CFG_10 */ ··· 1025 1020 MUX_GATE_CLR_SET_UPD(CLK_TOP_PWM, "top_pwm", 1026 1021 pwm_parents, 0x0E0, 0x0E4, 0x0E8, 16, 1, 23, 0x0C, 2), 1027 1022 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MCUPM, "top_mcupm", 1028 - mcupm_parents, 0x0E0, 0x0E4, 0x0E8, 24, 2, 31, 0x0C, 3, CLK_IS_CRITICAL), 1023 + mcupm_parents, 0x0E0, 0x0E4, 0x0E8, 24, 2, 31, 0x0C, 3, 1024 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 1029 1025 /* 1030 1026 * CLK_CFG_17 1031 1027 * top_dvfsrc is for internal DVFS usage, should not be handled by Linux. ··· 1036 1030 MUX_GATE_CLR_SET_UPD(CLK_TOP_SPMI_M_MST, "top_spmi_m_mst", 1037 1031 spmi_parents, 0x0EC, 0x0F0, 0x0F4, 8, 4, 15, 0x0C, 5), 1038 1032 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_DVFSRC, "top_dvfsrc", 1039 - dvfsrc_parents, 0x0EC, 0x0F0, 0x0F4, 16, 2, 23, 0x0C, 6, CLK_IS_CRITICAL), 1033 + dvfsrc_parents, 0x0EC, 0x0F0, 0x0F4, 16, 2, 23, 0x0C, 6, 1034 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 1040 1035 MUX_GATE_CLR_SET_UPD(CLK_TOP_TL, "top_tl", 1041 1036 tl_parents, 0x0EC, 0x0F0, 0x0F4, 24, 2, 31, 0x0C, 7), 1042 1037 /* CLK_CFG_18 */ ··· 1148 1141 MUX_GATE_CLR_SET_UPD(CLK_TOP_DVIO_DGI_REF, "top_dvio_dgi_ref", 1149 1142 dvio_dgi_ref_parents, 0x017C, 0x0180, 0x0184, 0, 3, 7, 0x010, 20), 1150 1143 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_ULPOSC, "top_ulposc", 1151 - ulposc_parents, 0x017C, 0x0180, 0x0184, 8, 2, 15, 0x010, 21, CLK_IS_CRITICAL), 1144 + ulposc_parents, 0x017C, 0x0180, 0x0184, 8, 2, 15, 0x010, 21, 1145 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 1152 1146 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_ULPOSC_CORE, "top_ulposc_core", 1153 - ulposc_core_parents, 0x017C, 0x0180, 0x0184, 16, 2, 23, 0x010, 22, CLK_IS_CRITICAL), 1147 + ulposc_core_parents, 0x017C, 0x0180, 0x0184, 16, 2, 23, 0x010, 22, 1148 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 1154 1149 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SRCK, "top_srck", 1155 - srck_parents, 0x017C, 0x0180, 0x0184, 24, 1, 31, 0x010, 23, CLK_IS_CRITICAL), 1150 + srck_parents, 0x017C, 0x0180, 0x0184, 24, 1, 31, 0x010, 23, 1151 + CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 1156 1152 /* 1157 1153 * the clocks in CLK_CFG_30 ~ 37 are backup clock source, no need to handled 1158 1154 * by Linux. ··· 1327 1317 return r; 1328 1318 } 1329 1319 1330 - static int clk_mt8195_topck_remove(struct platform_device *pdev) 1320 + static void clk_mt8195_topck_remove(struct platform_device *pdev) 1331 1321 { 1332 1322 struct clk_hw_onecell_data *top_clk_data = platform_get_drvdata(pdev); 1333 1323 struct device_node *node = pdev->dev.of_node; ··· 1339 1329 mtk_clk_unregister_factors(top_divs, ARRAY_SIZE(top_divs), top_clk_data); 1340 1330 mtk_clk_unregister_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), top_clk_data); 1341 1331 mtk_free_clk_data(top_clk_data); 1342 - 1343 - return 0; 1344 1332 } 1345 1333 1346 1334 static struct platform_driver clk_mt8195_topck_drv = { 1347 1335 .probe = clk_mt8195_topck_probe, 1348 - .remove = clk_mt8195_topck_remove, 1336 + .remove_new = clk_mt8195_topck_remove, 1349 1337 .driver = { 1350 1338 .name = "clk-mt8195-topck", 1351 1339 .of_match_table = of_match_clk_mt8195_topck,
+1 -1
drivers/clk/mediatek/clk-mt8195-vdec.c
··· 97 97 98 98 static struct platform_driver clk_mt8195_vdec_drv = { 99 99 .probe = mtk_clk_simple_probe, 100 - .remove = mtk_clk_simple_remove, 100 + .remove_new = mtk_clk_simple_remove, 101 101 .driver = { 102 102 .name = "clk-mt8195-vdec", 103 103 .of_match_table = of_match_clk_mt8195_vdec,
+1 -1
drivers/clk/mediatek/clk-mt8195-vdo0.c
··· 106 106 107 107 static struct platform_driver clk_mt8195_vdo0_drv = { 108 108 .probe = mtk_clk_pdev_probe, 109 - .remove = mtk_clk_pdev_remove, 109 + .remove_new = mtk_clk_pdev_remove, 110 110 .driver = { 111 111 .name = "clk-mt8195-vdo0", 112 112 },
+1 -1
drivers/clk/mediatek/clk-mt8195-vdo1.c
··· 133 133 134 134 static struct platform_driver clk_mt8195_vdo1_drv = { 135 135 .probe = mtk_clk_pdev_probe, 136 - .remove = mtk_clk_pdev_remove, 136 + .remove_new = mtk_clk_pdev_remove, 137 137 .driver = { 138 138 .name = "clk-mt8195-vdo1", 139 139 },
+1 -1
drivers/clk/mediatek/clk-mt8195-venc.c
··· 62 62 63 63 static struct platform_driver clk_mt8195_venc_drv = { 64 64 .probe = mtk_clk_simple_probe, 65 - .remove = mtk_clk_simple_remove, 65 + .remove_new = mtk_clk_simple_remove, 66 66 .driver = { 67 67 .name = "clk-mt8195-venc", 68 68 .of_match_table = of_match_clk_mt8195_venc,
+1 -1
drivers/clk/mediatek/clk-mt8195-vpp0.c
··· 99 99 100 100 static struct platform_driver clk_mt8195_vpp0_drv = { 101 101 .probe = mtk_clk_pdev_probe, 102 - .remove = mtk_clk_pdev_remove, 102 + .remove_new = mtk_clk_pdev_remove, 103 103 .driver = { 104 104 .name = "clk-mt8195-vpp0", 105 105 },
+1 -1
drivers/clk/mediatek/clk-mt8195-vpp1.c
··· 97 97 98 98 static struct platform_driver clk_mt8195_vpp1_drv = { 99 99 .probe = mtk_clk_pdev_probe, 100 - .remove = mtk_clk_pdev_remove, 100 + .remove_new = mtk_clk_pdev_remove, 101 101 .driver = { 102 102 .name = "clk-mt8195-vpp1", 103 103 },
+1 -1
drivers/clk/mediatek/clk-mt8195-wpe.c
··· 136 136 137 137 static struct platform_driver clk_mt8195_wpe_drv = { 138 138 .probe = mtk_clk_simple_probe, 139 - .remove = mtk_clk_simple_remove, 139 + .remove_new = mtk_clk_simple_remove, 140 140 .driver = { 141 141 .name = "clk-mt8195-wpe", 142 142 .of_match_table = of_match_clk_mt8195_wpe,
+1 -1
drivers/clk/mediatek/clk-mt8365-apu.c
··· 46 46 47 47 static struct platform_driver clk_mt8365_apu_drv = { 48 48 .probe = mtk_clk_simple_probe, 49 - .remove = mtk_clk_simple_remove, 49 + .remove_new = mtk_clk_simple_remove, 50 50 .driver = { 51 51 .name = "clk-mt8365-apu", 52 52 .of_match_table = of_match_clk_mt8365_apu,
+1 -1
drivers/clk/mediatek/clk-mt8365-cam.c
··· 48 48 49 49 static struct platform_driver clk_mt8365_cam_drv = { 50 50 .probe = mtk_clk_simple_probe, 51 - .remove = mtk_clk_simple_remove, 51 + .remove_new = mtk_clk_simple_remove, 52 52 .driver = { 53 53 .name = "clk-mt8365-cam", 54 54 .of_match_table = of_match_clk_mt8365_cam,
+1 -1
drivers/clk/mediatek/clk-mt8365-mfg.c
··· 54 54 55 55 static struct platform_driver clk_mt8365_mfg_drv = { 56 56 .probe = mtk_clk_simple_probe, 57 - .remove = mtk_clk_simple_remove, 57 + .remove_new = mtk_clk_simple_remove, 58 58 .driver = { 59 59 .name = "clk-mt8365-mfg", 60 60 .of_match_table = of_match_clk_mt8365_mfg,
+1 -1
drivers/clk/mediatek/clk-mt8365-mm.c
··· 85 85 86 86 static struct platform_driver clk_mt8365_mm_drv = { 87 87 .probe = mtk_clk_pdev_probe, 88 - .remove = mtk_clk_pdev_remove, 88 + .remove_new = mtk_clk_pdev_remove, 89 89 .driver = { 90 90 .name = "clk-mt8365-mm", 91 91 },
+1 -1
drivers/clk/mediatek/clk-mt8365-vdec.c
··· 54 54 55 55 static struct platform_driver clk_mt8365_vdec_drv = { 56 56 .probe = mtk_clk_simple_probe, 57 - .remove = mtk_clk_simple_remove, 57 + .remove_new = mtk_clk_simple_remove, 58 58 .driver = { 59 59 .name = "clk-mt8365-vdec", 60 60 .of_match_table = of_match_clk_mt8365_vdec,
+1 -1
drivers/clk/mediatek/clk-mt8365-venc.c
··· 43 43 44 44 static struct platform_driver clk_mt8365_venc_drv = { 45 45 .probe = mtk_clk_simple_probe, 46 - .remove = mtk_clk_simple_remove, 46 + .remove_new = mtk_clk_simple_remove, 47 47 .driver = { 48 48 .name = "clk-mt8365-venc", 49 49 .of_match_table = of_match_clk_mt8365_venc,
+20 -20
drivers/clk/mediatek/clk-mt8365.c
··· 411 411 /* CLK_CFG_0 */ 412 412 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_AXI_SEL, "axi_sel", axi_parents, 413 413 0x040, 0x044, 0x048, 0, 2, 7, CLK_CFG_UPDATE, 414 - 0, CLK_IS_CRITICAL), 414 + 0, CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 415 415 MUX_GATE_CLR_SET_UPD(CLK_TOP_MEM_SEL, "mem_sel", mem_parents, 0x040, 416 416 0x044, 0x048, 8, 2, 15, CLK_CFG_UPDATE, 1), 417 417 MUX_GATE_CLR_SET_UPD(CLK_TOP_MM_SEL, "mm_sel", mm_parents, 0x040, 0x044, ··· 432 432 0x064, 0x068, 0, 1, 7, CLK_CFG_UPDATE, 8), 433 433 MUX_GATE_CLR_SET_UPD(CLK_TOP_SPI_SEL, "spi_sel", spi_parents, 0x060, 434 434 0x064, 0x068, 8, 2, 15, CLK_CFG_UPDATE, 9), 435 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC50_0_HC_SEL, "msdc50_0_hc_sel", 436 - msdc50_0_hc_parents, 0x060, 0x064, 0x068, 16, 2, 437 - 23, CLK_CFG_UPDATE, 10), 438 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC2_2_HC_SEL, "msdc2_2_hc_sel", 439 - msdc50_0_hc_parents, 0x060, 0x064, 0x068, 24, 2, 440 - 31, CLK_CFG_UPDATE, 11), 435 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_0_HC_SEL, "msdc50_0_hc_sel", 436 + msdc50_0_hc_parents, 0x060, 0x064, 0x068, 16, 2, 437 + 23, CLK_CFG_UPDATE, 10, 0), 438 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC2_2_HC_SEL, "msdc2_2_hc_sel", 439 + msdc50_0_hc_parents, 0x060, 0x064, 0x068, 24, 2, 440 + 31, CLK_CFG_UPDATE, 11, 0), 441 441 /* CLK_CFG_3 */ 442 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC50_0_SEL, "msdc50_0_sel", 443 - msdc50_0_parents, 0x070, 0x074, 0x078, 0, 3, 7, 444 - CLK_CFG_UPDATE, 12), 445 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC50_2_SEL, "msdc50_2_sel", 446 - msdc50_2_parents, 0x070, 0x074, 0x078, 8, 3, 15, 447 - CLK_CFG_UPDATE, 13), 448 - MUX_GATE_CLR_SET_UPD(CLK_TOP_MSDC30_1_SEL, "msdc30_1_sel", 449 - msdc30_1_parents, 0x070, 0x074, 0x078, 16, 3, 23, 450 - CLK_CFG_UPDATE, 14), 442 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_0_SEL, "msdc50_0_sel", 443 + msdc50_0_parents, 0x070, 0x074, 0x078, 0, 3, 7, 444 + CLK_CFG_UPDATE, 12, 0), 445 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC50_2_SEL, "msdc50_2_sel", 446 + msdc50_2_parents, 0x070, 0x074, 0x078, 8, 3, 15, 447 + CLK_CFG_UPDATE, 13, 0), 448 + MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_MSDC30_1_SEL, "msdc30_1_sel", 449 + msdc30_1_parents, 0x070, 0x074, 0x078, 16, 3, 23, 450 + CLK_CFG_UPDATE, 14, 0), 451 451 MUX_GATE_CLR_SET_UPD(CLK_TOP_AUDIO_SEL, "audio_sel", audio_parents, 452 452 0x070, 0x074, 0x078, 24, 2, 31, CLK_CFG_UPDATE, 453 453 15), ··· 476 476 /* CLK_CFG_6 */ 477 477 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_DXCC_SEL, "dxcc_sel", dxcc_parents, 478 478 0x0a0, 0x0a4, 0x0a8, 0, 2, 7, CLK_CFG_UPDATE, 479 - 24, CLK_IS_CRITICAL), 479 + 24, CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 480 480 MUX_GATE_CLR_SET_UPD(CLK_TOP_SSUSB_SYS_SEL, "ssusb_sys_sel", 481 481 ssusb_sys_parents, 0x0a0, 0x0a4, 0x0a8, 8, 2, 15, 482 482 CLK_CFG_UPDATE, 25), ··· 484 484 ssusb_sys_parents, 0x0a0, 0x0a4, 0x0a8, 16, 2, 23, 485 485 CLK_CFG_UPDATE, 26), 486 486 MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_SPM_SEL, "spm_sel", spm_parents, 487 - 0x0a0, 0x0a4, 0x0a8, 24, 1, 31, 488 - CLK_CFG_UPDATE, 27, CLK_IS_CRITICAL), 487 + 0x0a0, 0x0a4, 0x0a8, 24, 1, 31, CLK_CFG_UPDATE, 488 + 27, CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), 489 489 /* CLK_CFG_7 */ 490 490 MUX_GATE_CLR_SET_UPD(CLK_TOP_I2C_SEL, "i2c_sel", i2c_parents, 0x0b0, 491 491 0x0b4, 0x0b8, 0, 3, 7, CLK_CFG_UPDATE, 28), ··· 811 811 .of_match_table = of_match_clk_mt8365, 812 812 }, 813 813 .probe = mtk_clk_simple_probe, 814 - .remove = mtk_clk_simple_remove, 814 + .remove_new = mtk_clk_simple_remove, 815 815 }; 816 816 module_platform_driver(clk_mt8365_drv); 817 817 MODULE_LICENSE("GPL");
+1 -1
drivers/clk/mediatek/clk-mt8516-aud.c
··· 55 55 56 56 static struct platform_driver clk_mt8516_aud_drv = { 57 57 .probe = mtk_clk_simple_probe, 58 - .remove = mtk_clk_simple_remove, 58 + .remove_new = mtk_clk_simple_remove, 59 59 .driver = { 60 60 .name = "clk-mt8516-aud", 61 61 .of_match_table = of_match_clk_mt8516_aud,
+1 -1
drivers/clk/mediatek/clk-mt8516.c
··· 669 669 670 670 static struct platform_driver clk_mt8516_drv = { 671 671 .probe = mtk_clk_simple_probe, 672 - .remove = mtk_clk_simple_remove, 672 + .remove_new = mtk_clk_simple_remove, 673 673 .driver = { 674 674 .name = "clk-mt8516", 675 675 .of_match_table = of_match_clk_mt8516,
+13 -12
drivers/clk/mediatek/clk-mtk.c
··· 469 469 const struct platform_device_id *id; 470 470 const struct mtk_clk_desc *mcd; 471 471 struct clk_hw_onecell_data *clk_data; 472 - void __iomem *base; 472 + void __iomem *base = NULL; 473 473 int num_clks, r; 474 474 475 475 mcd = device_get_match_data(&pdev->dev); ··· 483 483 return -EINVAL; 484 484 } 485 485 486 - /* Composite clocks needs us to pass iomem pointer */ 487 - if (mcd->composite_clks) { 486 + /* Composite and divider clocks needs us to pass iomem pointer */ 487 + if (mcd->composite_clks || mcd->divider_clks) { 488 488 if (!mcd->shared_io) 489 489 base = devm_platform_ioremap_resource(pdev, 0); 490 490 else ··· 500 500 num_clks += mcd->num_mux_clks + mcd->num_divider_clks; 501 501 502 502 clk_data = mtk_alloc_clk_data(num_clks); 503 - if (!clk_data) 504 - return -ENOMEM; 503 + if (!clk_data) { 504 + r = -ENOMEM; 505 + goto free_base; 506 + } 505 507 506 508 if (mcd->fixed_clks) { 507 509 r = mtk_clk_register_fixed_clks(mcd->fixed_clks, ··· 601 599 mcd->num_fixed_clks, clk_data); 602 600 free_data: 603 601 mtk_free_clk_data(clk_data); 602 + free_base: 604 603 if (mcd->shared_io && base) 605 604 iounmap(base); 606 605 return r; 607 606 } 608 607 609 - static int __mtk_clk_simple_remove(struct platform_device *pdev, 608 + static void __mtk_clk_simple_remove(struct platform_device *pdev, 610 609 struct device_node *node) 611 610 { 612 611 struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev); ··· 632 629 mtk_clk_unregister_fixed_clks(mcd->fixed_clks, 633 630 mcd->num_fixed_clks, clk_data); 634 631 mtk_free_clk_data(clk_data); 635 - 636 - return 0; 637 632 } 638 633 639 634 int mtk_clk_pdev_probe(struct platform_device *pdev) ··· 651 650 } 652 651 EXPORT_SYMBOL_GPL(mtk_clk_simple_probe); 653 652 654 - int mtk_clk_pdev_remove(struct platform_device *pdev) 653 + void mtk_clk_pdev_remove(struct platform_device *pdev) 655 654 { 656 655 struct device *dev = &pdev->dev; 657 656 struct device_node *node = dev->parent->of_node; 658 657 659 - return __mtk_clk_simple_remove(pdev, node); 658 + __mtk_clk_simple_remove(pdev, node); 660 659 } 661 660 EXPORT_SYMBOL_GPL(mtk_clk_pdev_remove); 662 661 663 - int mtk_clk_simple_remove(struct platform_device *pdev) 662 + void mtk_clk_simple_remove(struct platform_device *pdev) 664 663 { 665 - return __mtk_clk_simple_remove(pdev, pdev->dev.of_node); 664 + __mtk_clk_simple_remove(pdev, pdev->dev.of_node); 666 665 } 667 666 EXPORT_SYMBOL_GPL(mtk_clk_simple_remove); 668 667
+2 -2
drivers/clk/mediatek/clk-mtk.h
··· 240 240 }; 241 241 242 242 int mtk_clk_pdev_probe(struct platform_device *pdev); 243 - int mtk_clk_pdev_remove(struct platform_device *pdev); 243 + void mtk_clk_pdev_remove(struct platform_device *pdev); 244 244 int mtk_clk_simple_probe(struct platform_device *pdev); 245 - int mtk_clk_simple_remove(struct platform_device *pdev); 245 + void mtk_clk_simple_remove(struct platform_device *pdev); 246 246 247 247 #endif /* __DRV_CLK_MTK_H */
+1 -1
drivers/clk/mediatek/clk-mux.c
··· 168 168 return ERR_PTR(-ENOMEM); 169 169 170 170 init.name = mux->name; 171 - init.flags = mux->flags | CLK_SET_RATE_PARENT; 171 + init.flags = mux->flags; 172 172 init.parent_names = mux->parent_names; 173 173 init.num_parents = mux->num_parents; 174 174 init.ops = mux->ops;
+20
drivers/clk/meson/Kconfig
··· 99 99 Support for the audio clock controller on AmLogic A113D devices, 100 100 aka axg, Say Y if you want audio subsystem to work. 101 101 102 + config COMMON_CLK_A1_PLL 103 + tristate "Amlogic A1 SoC PLL controller support" 104 + depends on ARM64 105 + select COMMON_CLK_MESON_REGMAP 106 + select COMMON_CLK_MESON_PLL 107 + help 108 + Support for the PLL clock controller on Amlogic A113L based 109 + device, A1 SoC Family. Say Y if you want A1 PLL clock controller 110 + to work. 111 + 112 + config COMMON_CLK_A1_PERIPHERALS 113 + tristate "Amlogic A1 SoC Peripherals clock controller support" 114 + depends on ARM64 115 + select COMMON_CLK_MESON_DUALDIV 116 + select COMMON_CLK_MESON_REGMAP 117 + help 118 + Support for the Peripherals clock controller on Amlogic A113L based 119 + device, A1 SoC Family. Say Y if you want A1 Peripherals clock 120 + controller to work. 121 + 102 122 config COMMON_CLK_G12A 103 123 tristate "G12 and SM1 SoC clock controllers support" 104 124 depends on ARM64
+2
drivers/clk/meson/Makefile
··· 16 16 17 17 obj-$(CONFIG_COMMON_CLK_AXG) += axg.o axg-aoclk.o 18 18 obj-$(CONFIG_COMMON_CLK_AXG_AUDIO) += axg-audio.o 19 + obj-$(CONFIG_COMMON_CLK_A1_PLL) += a1-pll.o 20 + obj-$(CONFIG_COMMON_CLK_A1_PERIPHERALS) += a1-peripherals.o 19 21 obj-$(CONFIG_COMMON_CLK_GXBB) += gxbb.o gxbb-aoclk.o 20 22 obj-$(CONFIG_COMMON_CLK_G12A) += g12a.o g12a-aoclk.o 21 23 obj-$(CONFIG_COMMON_CLK_MESON8B) += meson8b.o meson8-ddr.o
+2243
drivers/clk/meson/a1-peripherals.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * Copyright (c) 2019 Amlogic, Inc. All rights reserved. 4 + * Author: Jian Hu <jian.hu@amlogic.com> 5 + * 6 + * Copyright (c) 2023, SberDevices. All Rights Reserved. 7 + * Author: Dmitry Rokosov <ddrokosov@sberdevices.ru> 8 + */ 9 + 10 + #include <linux/clk-provider.h> 11 + #include <linux/of_device.h> 12 + #include <linux/platform_device.h> 13 + #include "a1-peripherals.h" 14 + #include "clk-dualdiv.h" 15 + #include "clk-regmap.h" 16 + 17 + static struct clk_regmap xtal_in = { 18 + .data = &(struct clk_regmap_gate_data){ 19 + .offset = SYS_OSCIN_CTRL, 20 + .bit_idx = 0, 21 + }, 22 + .hw.init = &(struct clk_init_data) { 23 + .name = "xtal_in", 24 + .ops = &clk_regmap_gate_ro_ops, 25 + .parent_data = &(const struct clk_parent_data) { 26 + .fw_name = "xtal", 27 + }, 28 + .num_parents = 1, 29 + }, 30 + }; 31 + 32 + static struct clk_regmap fixpll_in = { 33 + .data = &(struct clk_regmap_gate_data){ 34 + .offset = SYS_OSCIN_CTRL, 35 + .bit_idx = 1, 36 + }, 37 + .hw.init = &(struct clk_init_data) { 38 + .name = "fixpll_in", 39 + .ops = &clk_regmap_gate_ro_ops, 40 + .parent_data = &(const struct clk_parent_data) { 41 + .fw_name = "xtal", 42 + }, 43 + .num_parents = 1, 44 + }, 45 + }; 46 + 47 + static struct clk_regmap usb_phy_in = { 48 + .data = &(struct clk_regmap_gate_data){ 49 + .offset = SYS_OSCIN_CTRL, 50 + .bit_idx = 2, 51 + }, 52 + .hw.init = &(struct clk_init_data) { 53 + .name = "usb_phy_in", 54 + .ops = &clk_regmap_gate_ops, 55 + .parent_data = &(const struct clk_parent_data) { 56 + .fw_name = "xtal", 57 + }, 58 + .num_parents = 1, 59 + }, 60 + }; 61 + 62 + static struct clk_regmap usb_ctrl_in = { 63 + .data = &(struct clk_regmap_gate_data){ 64 + .offset = SYS_OSCIN_CTRL, 65 + .bit_idx = 3, 66 + }, 67 + .hw.init = &(struct clk_init_data) { 68 + .name = "usb_ctrl_in", 69 + .ops = &clk_regmap_gate_ops, 70 + .parent_data = &(const struct clk_parent_data) { 71 + .fw_name = "xtal", 72 + }, 73 + .num_parents = 1, 74 + }, 75 + }; 76 + 77 + static struct clk_regmap hifipll_in = { 78 + .data = &(struct clk_regmap_gate_data){ 79 + .offset = SYS_OSCIN_CTRL, 80 + .bit_idx = 4, 81 + }, 82 + .hw.init = &(struct clk_init_data) { 83 + .name = "hifipll_in", 84 + .ops = &clk_regmap_gate_ops, 85 + .parent_data = &(const struct clk_parent_data) { 86 + .fw_name = "xtal", 87 + }, 88 + .num_parents = 1, 89 + }, 90 + }; 91 + 92 + static struct clk_regmap syspll_in = { 93 + .data = &(struct clk_regmap_gate_data){ 94 + .offset = SYS_OSCIN_CTRL, 95 + .bit_idx = 5, 96 + }, 97 + .hw.init = &(struct clk_init_data) { 98 + .name = "syspll_in", 99 + .ops = &clk_regmap_gate_ops, 100 + .parent_data = &(const struct clk_parent_data) { 101 + .fw_name = "xtal", 102 + }, 103 + .num_parents = 1, 104 + }, 105 + }; 106 + 107 + static struct clk_regmap dds_in = { 108 + .data = &(struct clk_regmap_gate_data){ 109 + .offset = SYS_OSCIN_CTRL, 110 + .bit_idx = 6, 111 + }, 112 + .hw.init = &(struct clk_init_data) { 113 + .name = "dds_in", 114 + .ops = &clk_regmap_gate_ops, 115 + .parent_data = &(const struct clk_parent_data) { 116 + .fw_name = "xtal", 117 + }, 118 + .num_parents = 1, 119 + }, 120 + }; 121 + 122 + static struct clk_regmap rtc_32k_in = { 123 + .data = &(struct clk_regmap_gate_data){ 124 + .offset = RTC_BY_OSCIN_CTRL0, 125 + .bit_idx = 31, 126 + }, 127 + .hw.init = &(struct clk_init_data) { 128 + .name = "rtc_32k_in", 129 + .ops = &clk_regmap_gate_ops, 130 + .parent_data = &(const struct clk_parent_data) { 131 + .fw_name = "xtal", 132 + }, 133 + .num_parents = 1, 134 + }, 135 + }; 136 + 137 + static const struct meson_clk_dualdiv_param clk_32k_div_table[] = { 138 + { 139 + .dual = 1, 140 + .n1 = 733, 141 + .m1 = 8, 142 + .n2 = 732, 143 + .m2 = 11, 144 + }, 145 + {} 146 + }; 147 + 148 + static struct clk_regmap rtc_32k_div = { 149 + .data = &(struct meson_clk_dualdiv_data){ 150 + .n1 = { 151 + .reg_off = RTC_BY_OSCIN_CTRL0, 152 + .shift = 0, 153 + .width = 12, 154 + }, 155 + .n2 = { 156 + .reg_off = RTC_BY_OSCIN_CTRL0, 157 + .shift = 12, 158 + .width = 12, 159 + }, 160 + .m1 = { 161 + .reg_off = RTC_BY_OSCIN_CTRL1, 162 + .shift = 0, 163 + .width = 12, 164 + }, 165 + .m2 = { 166 + .reg_off = RTC_BY_OSCIN_CTRL1, 167 + .shift = 12, 168 + .width = 12, 169 + }, 170 + .dual = { 171 + .reg_off = RTC_BY_OSCIN_CTRL0, 172 + .shift = 28, 173 + .width = 1, 174 + }, 175 + .table = clk_32k_div_table, 176 + }, 177 + .hw.init = &(struct clk_init_data){ 178 + .name = "rtc_32k_div", 179 + .ops = &meson_clk_dualdiv_ops, 180 + .parent_hws = (const struct clk_hw *[]) { 181 + &rtc_32k_in.hw 182 + }, 183 + .num_parents = 1, 184 + }, 185 + }; 186 + 187 + static struct clk_regmap rtc_32k_xtal = { 188 + .data = &(struct clk_regmap_gate_data){ 189 + .offset = RTC_BY_OSCIN_CTRL1, 190 + .bit_idx = 24, 191 + }, 192 + .hw.init = &(struct clk_init_data) { 193 + .name = "rtc_32k_xtal", 194 + .ops = &clk_regmap_gate_ops, 195 + .parent_hws = (const struct clk_hw *[]) { 196 + &rtc_32k_in.hw 197 + }, 198 + .num_parents = 1, 199 + }, 200 + }; 201 + 202 + static struct clk_regmap rtc_32k_sel = { 203 + .data = &(struct clk_regmap_mux_data) { 204 + .offset = RTC_CTRL, 205 + .mask = 0x3, 206 + .shift = 0, 207 + .flags = CLK_MUX_ROUND_CLOSEST, 208 + }, 209 + .hw.init = &(struct clk_init_data){ 210 + .name = "rtc_32k_sel", 211 + .ops = &clk_regmap_mux_ops, 212 + .parent_hws = (const struct clk_hw *[]) { 213 + &rtc_32k_xtal.hw, 214 + &rtc_32k_div.hw, 215 + }, 216 + .num_parents = 2, 217 + .flags = CLK_SET_RATE_PARENT, 218 + }, 219 + }; 220 + 221 + static struct clk_regmap rtc = { 222 + .data = &(struct clk_regmap_gate_data){ 223 + .offset = RTC_BY_OSCIN_CTRL0, 224 + .bit_idx = 30, 225 + }, 226 + .hw.init = &(struct clk_init_data){ 227 + .name = "rtc", 228 + .ops = &clk_regmap_gate_ops, 229 + .parent_hws = (const struct clk_hw *[]) { 230 + &rtc_32k_sel.hw 231 + }, 232 + .num_parents = 1, 233 + .flags = CLK_SET_RATE_PARENT, 234 + }, 235 + }; 236 + 237 + static u32 mux_table_sys[] = { 0, 1, 2, 3, 7 }; 238 + static const struct clk_parent_data sys_parents[] = { 239 + { .fw_name = "xtal" }, 240 + { .fw_name = "fclk_div2" }, 241 + { .fw_name = "fclk_div3" }, 242 + { .fw_name = "fclk_div5" }, 243 + { .hw = &rtc.hw }, 244 + }; 245 + 246 + static struct clk_regmap sys_b_sel = { 247 + .data = &(struct clk_regmap_mux_data){ 248 + .offset = SYS_CLK_CTRL0, 249 + .mask = 0x7, 250 + .shift = 26, 251 + .table = mux_table_sys, 252 + }, 253 + .hw.init = &(struct clk_init_data){ 254 + .name = "sys_b_sel", 255 + .ops = &clk_regmap_mux_ro_ops, 256 + .parent_data = sys_parents, 257 + .num_parents = ARRAY_SIZE(sys_parents), 258 + }, 259 + }; 260 + 261 + static struct clk_regmap sys_b_div = { 262 + .data = &(struct clk_regmap_div_data){ 263 + .offset = SYS_CLK_CTRL0, 264 + .shift = 16, 265 + .width = 10, 266 + }, 267 + .hw.init = &(struct clk_init_data){ 268 + .name = "sys_b_div", 269 + .ops = &clk_regmap_divider_ro_ops, 270 + .parent_hws = (const struct clk_hw *[]) { 271 + &sys_b_sel.hw 272 + }, 273 + .num_parents = 1, 274 + .flags = CLK_SET_RATE_PARENT, 275 + }, 276 + }; 277 + 278 + static struct clk_regmap sys_b = { 279 + .data = &(struct clk_regmap_gate_data){ 280 + .offset = SYS_CLK_CTRL0, 281 + .bit_idx = 29, 282 + }, 283 + .hw.init = &(struct clk_init_data) { 284 + .name = "sys_b", 285 + .ops = &clk_regmap_gate_ro_ops, 286 + .parent_hws = (const struct clk_hw *[]) { 287 + &sys_b_div.hw 288 + }, 289 + .num_parents = 1, 290 + .flags = CLK_SET_RATE_PARENT, 291 + }, 292 + }; 293 + 294 + static struct clk_regmap sys_a_sel = { 295 + .data = &(struct clk_regmap_mux_data){ 296 + .offset = SYS_CLK_CTRL0, 297 + .mask = 0x7, 298 + .shift = 10, 299 + .table = mux_table_sys, 300 + }, 301 + .hw.init = &(struct clk_init_data){ 302 + .name = "sys_a_sel", 303 + .ops = &clk_regmap_mux_ro_ops, 304 + .parent_data = sys_parents, 305 + .num_parents = ARRAY_SIZE(sys_parents), 306 + }, 307 + }; 308 + 309 + static struct clk_regmap sys_a_div = { 310 + .data = &(struct clk_regmap_div_data){ 311 + .offset = SYS_CLK_CTRL0, 312 + .shift = 0, 313 + .width = 10, 314 + }, 315 + .hw.init = &(struct clk_init_data){ 316 + .name = "sys_a_div", 317 + .ops = &clk_regmap_divider_ro_ops, 318 + .parent_hws = (const struct clk_hw *[]) { 319 + &sys_a_sel.hw 320 + }, 321 + .num_parents = 1, 322 + .flags = CLK_SET_RATE_PARENT, 323 + }, 324 + }; 325 + 326 + static struct clk_regmap sys_a = { 327 + .data = &(struct clk_regmap_gate_data){ 328 + .offset = SYS_CLK_CTRL0, 329 + .bit_idx = 13, 330 + }, 331 + .hw.init = &(struct clk_init_data) { 332 + .name = "sys_a", 333 + .ops = &clk_regmap_gate_ro_ops, 334 + .parent_hws = (const struct clk_hw *[]) { 335 + &sys_a_div.hw 336 + }, 337 + .num_parents = 1, 338 + .flags = CLK_SET_RATE_PARENT, 339 + }, 340 + }; 341 + 342 + static struct clk_regmap sys = { 343 + .data = &(struct clk_regmap_mux_data){ 344 + .offset = SYS_CLK_CTRL0, 345 + .mask = 0x1, 346 + .shift = 31, 347 + }, 348 + .hw.init = &(struct clk_init_data){ 349 + .name = "sys", 350 + .ops = &clk_regmap_mux_ro_ops, 351 + .parent_hws = (const struct clk_hw *[]) { 352 + &sys_a.hw, 353 + &sys_b.hw, 354 + }, 355 + .num_parents = 2, 356 + /* 357 + * This clock is used by APB bus which is set in boot ROM code 358 + * and is required by the platform to operate correctly. 359 + * Until the following condition are met, we need this clock to 360 + * be marked as critical: 361 + * a) Mark the clock used by a firmware resource, if possible 362 + * b) CCF has a clock hand-off mechanism to make the sure the 363 + * clock stays on until the proper driver comes along 364 + */ 365 + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, 366 + }, 367 + }; 368 + 369 + static u32 mux_table_dsp_ab[] = { 0, 1, 2, 3, 4, 7 }; 370 + static const struct clk_parent_data dsp_ab_parent_data[] = { 371 + { .fw_name = "xtal", }, 372 + { .fw_name = "fclk_div2", }, 373 + { .fw_name = "fclk_div3", }, 374 + { .fw_name = "fclk_div5", }, 375 + { .fw_name = "hifi_pll", }, 376 + { .hw = &rtc.hw }, 377 + }; 378 + 379 + static struct clk_regmap dspa_a_sel = { 380 + .data = &(struct clk_regmap_mux_data){ 381 + .offset = DSPA_CLK_CTRL0, 382 + .mask = 0x7, 383 + .shift = 10, 384 + .table = mux_table_dsp_ab, 385 + }, 386 + .hw.init = &(struct clk_init_data){ 387 + .name = "dspa_a_sel", 388 + .ops = &clk_regmap_mux_ops, 389 + .parent_data = dsp_ab_parent_data, 390 + .num_parents = ARRAY_SIZE(dsp_ab_parent_data), 391 + }, 392 + }; 393 + 394 + static struct clk_regmap dspa_a_div = { 395 + .data = &(struct clk_regmap_div_data){ 396 + .offset = DSPA_CLK_CTRL0, 397 + .shift = 0, 398 + .width = 10, 399 + }, 400 + .hw.init = &(struct clk_init_data){ 401 + .name = "dspa_a_div", 402 + .ops = &clk_regmap_divider_ops, 403 + .parent_hws = (const struct clk_hw *[]) { 404 + &dspa_a_sel.hw 405 + }, 406 + .num_parents = 1, 407 + .flags = CLK_SET_RATE_PARENT, 408 + }, 409 + }; 410 + 411 + static struct clk_regmap dspa_a = { 412 + .data = &(struct clk_regmap_gate_data){ 413 + .offset = DSPA_CLK_CTRL0, 414 + .bit_idx = 13, 415 + }, 416 + .hw.init = &(struct clk_init_data) { 417 + .name = "dspa_a", 418 + .ops = &clk_regmap_gate_ops, 419 + .parent_hws = (const struct clk_hw *[]) { 420 + &dspa_a_div.hw 421 + }, 422 + .num_parents = 1, 423 + .flags = CLK_SET_RATE_PARENT, 424 + }, 425 + }; 426 + 427 + static struct clk_regmap dspa_b_sel = { 428 + .data = &(struct clk_regmap_mux_data){ 429 + .offset = DSPA_CLK_CTRL0, 430 + .mask = 0x7, 431 + .shift = 26, 432 + .table = mux_table_dsp_ab, 433 + }, 434 + .hw.init = &(struct clk_init_data){ 435 + .name = "dspa_b_sel", 436 + .ops = &clk_regmap_mux_ops, 437 + .parent_data = dsp_ab_parent_data, 438 + .num_parents = ARRAY_SIZE(dsp_ab_parent_data), 439 + }, 440 + }; 441 + 442 + static struct clk_regmap dspa_b_div = { 443 + .data = &(struct clk_regmap_div_data){ 444 + .offset = DSPA_CLK_CTRL0, 445 + .shift = 16, 446 + .width = 10, 447 + }, 448 + .hw.init = &(struct clk_init_data){ 449 + .name = "dspa_b_div", 450 + .ops = &clk_regmap_divider_ops, 451 + .parent_hws = (const struct clk_hw *[]) { 452 + &dspa_b_sel.hw 453 + }, 454 + .num_parents = 1, 455 + .flags = CLK_SET_RATE_PARENT, 456 + }, 457 + }; 458 + 459 + static struct clk_regmap dspa_b = { 460 + .data = &(struct clk_regmap_gate_data){ 461 + .offset = DSPA_CLK_CTRL0, 462 + .bit_idx = 29, 463 + }, 464 + .hw.init = &(struct clk_init_data) { 465 + .name = "dspa_b", 466 + .ops = &clk_regmap_gate_ops, 467 + .parent_hws = (const struct clk_hw *[]) { 468 + &dspa_b_div.hw 469 + }, 470 + .num_parents = 1, 471 + .flags = CLK_SET_RATE_PARENT, 472 + }, 473 + }; 474 + 475 + static struct clk_regmap dspa_sel = { 476 + .data = &(struct clk_regmap_mux_data){ 477 + .offset = DSPA_CLK_CTRL0, 478 + .mask = 0x1, 479 + .shift = 15, 480 + }, 481 + .hw.init = &(struct clk_init_data){ 482 + .name = "dspa_sel", 483 + .ops = &clk_regmap_mux_ops, 484 + .parent_hws = (const struct clk_hw *[]) { 485 + &dspa_a.hw, 486 + &dspa_b.hw, 487 + }, 488 + .num_parents = 2, 489 + .flags = CLK_SET_RATE_PARENT, 490 + }, 491 + }; 492 + 493 + static struct clk_regmap dspa_en = { 494 + .data = &(struct clk_regmap_gate_data){ 495 + .offset = DSPA_CLK_EN, 496 + .bit_idx = 1, 497 + }, 498 + .hw.init = &(struct clk_init_data) { 499 + .name = "dspa_en", 500 + .ops = &clk_regmap_gate_ops, 501 + .parent_hws = (const struct clk_hw *[]) { 502 + &dspa_sel.hw 503 + }, 504 + .num_parents = 1, 505 + .flags = CLK_SET_RATE_PARENT, 506 + }, 507 + }; 508 + 509 + static struct clk_regmap dspa_en_nic = { 510 + .data = &(struct clk_regmap_gate_data){ 511 + .offset = DSPA_CLK_EN, 512 + .bit_idx = 0, 513 + }, 514 + .hw.init = &(struct clk_init_data) { 515 + .name = "dspa_en_nic", 516 + .ops = &clk_regmap_gate_ops, 517 + .parent_hws = (const struct clk_hw *[]) { 518 + &dspa_sel.hw 519 + }, 520 + .num_parents = 1, 521 + .flags = CLK_SET_RATE_PARENT, 522 + }, 523 + }; 524 + 525 + static struct clk_regmap dspb_a_sel = { 526 + .data = &(struct clk_regmap_mux_data){ 527 + .offset = DSPB_CLK_CTRL0, 528 + .mask = 0x7, 529 + .shift = 10, 530 + .table = mux_table_dsp_ab, 531 + }, 532 + .hw.init = &(struct clk_init_data){ 533 + .name = "dspb_a_sel", 534 + .ops = &clk_regmap_mux_ops, 535 + .parent_data = dsp_ab_parent_data, 536 + .num_parents = ARRAY_SIZE(dsp_ab_parent_data), 537 + }, 538 + }; 539 + 540 + static struct clk_regmap dspb_a_div = { 541 + .data = &(struct clk_regmap_div_data){ 542 + .offset = DSPB_CLK_CTRL0, 543 + .shift = 0, 544 + .width = 10, 545 + }, 546 + .hw.init = &(struct clk_init_data){ 547 + .name = "dspb_a_div", 548 + .ops = &clk_regmap_divider_ops, 549 + .parent_hws = (const struct clk_hw *[]) { 550 + &dspb_a_sel.hw 551 + }, 552 + .num_parents = 1, 553 + .flags = CLK_SET_RATE_PARENT, 554 + }, 555 + }; 556 + 557 + static struct clk_regmap dspb_a = { 558 + .data = &(struct clk_regmap_gate_data){ 559 + .offset = DSPB_CLK_CTRL0, 560 + .bit_idx = 13, 561 + }, 562 + .hw.init = &(struct clk_init_data) { 563 + .name = "dspb_a", 564 + .ops = &clk_regmap_gate_ops, 565 + .parent_hws = (const struct clk_hw *[]) { 566 + &dspb_a_div.hw 567 + }, 568 + .num_parents = 1, 569 + .flags = CLK_SET_RATE_PARENT, 570 + }, 571 + }; 572 + 573 + static struct clk_regmap dspb_b_sel = { 574 + .data = &(struct clk_regmap_mux_data){ 575 + .offset = DSPB_CLK_CTRL0, 576 + .mask = 0x7, 577 + .shift = 26, 578 + .table = mux_table_dsp_ab, 579 + }, 580 + .hw.init = &(struct clk_init_data){ 581 + .name = "dspb_b_sel", 582 + .ops = &clk_regmap_mux_ops, 583 + .parent_data = dsp_ab_parent_data, 584 + .num_parents = ARRAY_SIZE(dsp_ab_parent_data), 585 + }, 586 + }; 587 + 588 + static struct clk_regmap dspb_b_div = { 589 + .data = &(struct clk_regmap_div_data){ 590 + .offset = DSPB_CLK_CTRL0, 591 + .shift = 16, 592 + .width = 10, 593 + }, 594 + .hw.init = &(struct clk_init_data){ 595 + .name = "dspb_b_div", 596 + .ops = &clk_regmap_divider_ops, 597 + .parent_hws = (const struct clk_hw *[]) { 598 + &dspb_b_sel.hw 599 + }, 600 + .num_parents = 1, 601 + .flags = CLK_SET_RATE_PARENT, 602 + }, 603 + }; 604 + 605 + static struct clk_regmap dspb_b = { 606 + .data = &(struct clk_regmap_gate_data){ 607 + .offset = DSPB_CLK_CTRL0, 608 + .bit_idx = 29, 609 + }, 610 + .hw.init = &(struct clk_init_data) { 611 + .name = "dspb_b", 612 + .ops = &clk_regmap_gate_ops, 613 + .parent_hws = (const struct clk_hw *[]) { 614 + &dspb_b_div.hw 615 + }, 616 + .num_parents = 1, 617 + .flags = CLK_SET_RATE_PARENT, 618 + }, 619 + }; 620 + 621 + static struct clk_regmap dspb_sel = { 622 + .data = &(struct clk_regmap_mux_data){ 623 + .offset = DSPB_CLK_CTRL0, 624 + .mask = 0x1, 625 + .shift = 15, 626 + }, 627 + .hw.init = &(struct clk_init_data){ 628 + .name = "dspb_sel", 629 + .ops = &clk_regmap_mux_ops, 630 + .parent_hws = (const struct clk_hw *[]) { 631 + &dspb_a.hw, 632 + &dspb_b.hw, 633 + }, 634 + .num_parents = 2, 635 + .flags = CLK_SET_RATE_PARENT, 636 + }, 637 + }; 638 + 639 + static struct clk_regmap dspb_en = { 640 + .data = &(struct clk_regmap_gate_data){ 641 + .offset = DSPB_CLK_EN, 642 + .bit_idx = 1, 643 + }, 644 + .hw.init = &(struct clk_init_data) { 645 + .name = "dspb_en", 646 + .ops = &clk_regmap_gate_ops, 647 + .parent_hws = (const struct clk_hw *[]) { 648 + &dspb_sel.hw 649 + }, 650 + .num_parents = 1, 651 + .flags = CLK_SET_RATE_PARENT, 652 + }, 653 + }; 654 + 655 + static struct clk_regmap dspb_en_nic = { 656 + .data = &(struct clk_regmap_gate_data){ 657 + .offset = DSPB_CLK_EN, 658 + .bit_idx = 0, 659 + }, 660 + .hw.init = &(struct clk_init_data) { 661 + .name = "dspb_en_nic", 662 + .ops = &clk_regmap_gate_ops, 663 + .parent_hws = (const struct clk_hw *[]) { 664 + &dspb_sel.hw 665 + }, 666 + .num_parents = 1, 667 + .flags = CLK_SET_RATE_PARENT, 668 + }, 669 + }; 670 + 671 + static struct clk_regmap clk_24m = { 672 + .data = &(struct clk_regmap_gate_data){ 673 + .offset = CLK12_24_CTRL, 674 + .bit_idx = 11, 675 + }, 676 + .hw.init = &(struct clk_init_data) { 677 + .name = "24m", 678 + .ops = &clk_regmap_gate_ops, 679 + .parent_data = &(const struct clk_parent_data) { 680 + .fw_name = "xtal", 681 + }, 682 + .num_parents = 1, 683 + }, 684 + }; 685 + 686 + static struct clk_fixed_factor clk_24m_div2 = { 687 + .mult = 1, 688 + .div = 2, 689 + .hw.init = &(struct clk_init_data){ 690 + .name = "24m_div2", 691 + .ops = &clk_fixed_factor_ops, 692 + .parent_hws = (const struct clk_hw *[]) { 693 + &clk_24m.hw 694 + }, 695 + .num_parents = 1, 696 + }, 697 + }; 698 + 699 + static struct clk_regmap clk_12m = { 700 + .data = &(struct clk_regmap_gate_data){ 701 + .offset = CLK12_24_CTRL, 702 + .bit_idx = 10, 703 + }, 704 + .hw.init = &(struct clk_init_data) { 705 + .name = "12m", 706 + .ops = &clk_regmap_gate_ops, 707 + .parent_hws = (const struct clk_hw *[]) { 708 + &clk_24m_div2.hw 709 + }, 710 + .num_parents = 1, 711 + }, 712 + }; 713 + 714 + static struct clk_regmap fclk_div2_divn_pre = { 715 + .data = &(struct clk_regmap_div_data){ 716 + .offset = CLK12_24_CTRL, 717 + .shift = 0, 718 + .width = 8, 719 + }, 720 + .hw.init = &(struct clk_init_data){ 721 + .name = "fclk_div2_divn_pre", 722 + .ops = &clk_regmap_divider_ops, 723 + .parent_data = &(const struct clk_parent_data) { 724 + .fw_name = "fclk_div2", 725 + }, 726 + .num_parents = 1, 727 + }, 728 + }; 729 + 730 + static struct clk_regmap fclk_div2_divn = { 731 + .data = &(struct clk_regmap_gate_data){ 732 + .offset = CLK12_24_CTRL, 733 + .bit_idx = 12, 734 + }, 735 + .hw.init = &(struct clk_init_data){ 736 + .name = "fclk_div2_divn", 737 + .ops = &clk_regmap_gate_ops, 738 + .parent_hws = (const struct clk_hw *[]) { 739 + &fclk_div2_divn_pre.hw 740 + }, 741 + .num_parents = 1, 742 + .flags = CLK_SET_RATE_PARENT, 743 + }, 744 + }; 745 + 746 + /* 747 + * the index 2 is sys_pll_div16, it will be implemented in the CPU clock driver, 748 + * the index 4 is the clock measurement source, it's not supported yet 749 + */ 750 + static u32 gen_table[] = { 0, 1, 3, 5, 6, 7, 8 }; 751 + static const struct clk_parent_data gen_parent_data[] = { 752 + { .fw_name = "xtal", }, 753 + { .hw = &rtc.hw }, 754 + { .fw_name = "hifi_pll", }, 755 + { .fw_name = "fclk_div2", }, 756 + { .fw_name = "fclk_div3", }, 757 + { .fw_name = "fclk_div5", }, 758 + { .fw_name = "fclk_div7", }, 759 + }; 760 + 761 + static struct clk_regmap gen_sel = { 762 + .data = &(struct clk_regmap_mux_data){ 763 + .offset = GEN_CLK_CTRL, 764 + .mask = 0xf, 765 + .shift = 12, 766 + .table = gen_table, 767 + }, 768 + .hw.init = &(struct clk_init_data){ 769 + .name = "gen_sel", 770 + .ops = &clk_regmap_mux_ops, 771 + .parent_data = gen_parent_data, 772 + .num_parents = ARRAY_SIZE(gen_parent_data), 773 + /* 774 + * The GEN clock can be connected to an external pad, so it 775 + * may be set up directly from the device tree. Additionally, 776 + * the GEN clock can be inherited from a more accurate RTC 777 + * clock, so in certain situations, it may be necessary 778 + * to freeze its parent. 779 + */ 780 + .flags = CLK_SET_RATE_NO_REPARENT, 781 + }, 782 + }; 783 + 784 + static struct clk_regmap gen_div = { 785 + .data = &(struct clk_regmap_div_data){ 786 + .offset = GEN_CLK_CTRL, 787 + .shift = 0, 788 + .width = 11, 789 + }, 790 + .hw.init = &(struct clk_init_data){ 791 + .name = "gen_div", 792 + .ops = &clk_regmap_divider_ops, 793 + .parent_hws = (const struct clk_hw *[]) { 794 + &gen_sel.hw 795 + }, 796 + .num_parents = 1, 797 + .flags = CLK_SET_RATE_PARENT, 798 + }, 799 + }; 800 + 801 + static struct clk_regmap gen = { 802 + .data = &(struct clk_regmap_gate_data){ 803 + .offset = GEN_CLK_CTRL, 804 + .bit_idx = 11, 805 + }, 806 + .hw.init = &(struct clk_init_data) { 807 + .name = "gen", 808 + .ops = &clk_regmap_gate_ops, 809 + .parent_hws = (const struct clk_hw *[]) { 810 + &gen_div.hw 811 + }, 812 + .num_parents = 1, 813 + .flags = CLK_SET_RATE_PARENT, 814 + }, 815 + }; 816 + 817 + static struct clk_regmap saradc_sel = { 818 + .data = &(struct clk_regmap_mux_data){ 819 + .offset = SAR_ADC_CLK_CTRL, 820 + .mask = 0x1, 821 + .shift = 9, 822 + }, 823 + .hw.init = &(struct clk_init_data){ 824 + .name = "saradc_sel", 825 + .ops = &clk_regmap_mux_ops, 826 + .parent_data = (const struct clk_parent_data []) { 827 + { .fw_name = "xtal", }, 828 + { .hw = &sys.hw, }, 829 + }, 830 + .num_parents = 2, 831 + }, 832 + }; 833 + 834 + static struct clk_regmap saradc_div = { 835 + .data = &(struct clk_regmap_div_data){ 836 + .offset = SAR_ADC_CLK_CTRL, 837 + .shift = 0, 838 + .width = 8, 839 + }, 840 + .hw.init = &(struct clk_init_data){ 841 + .name = "saradc_div", 842 + .ops = &clk_regmap_divider_ops, 843 + .parent_hws = (const struct clk_hw *[]) { 844 + &saradc_sel.hw 845 + }, 846 + .num_parents = 1, 847 + .flags = CLK_SET_RATE_PARENT, 848 + }, 849 + }; 850 + 851 + static struct clk_regmap saradc = { 852 + .data = &(struct clk_regmap_gate_data){ 853 + .offset = SAR_ADC_CLK_CTRL, 854 + .bit_idx = 8, 855 + }, 856 + .hw.init = &(struct clk_init_data) { 857 + .name = "saradc", 858 + .ops = &clk_regmap_gate_ops, 859 + .parent_hws = (const struct clk_hw *[]) { 860 + &saradc_div.hw 861 + }, 862 + .num_parents = 1, 863 + .flags = CLK_SET_RATE_PARENT, 864 + }, 865 + }; 866 + 867 + static const struct clk_parent_data pwm_abcd_parents[] = { 868 + { .fw_name = "xtal", }, 869 + { .hw = &sys.hw }, 870 + { .hw = &rtc.hw }, 871 + }; 872 + 873 + static struct clk_regmap pwm_a_sel = { 874 + .data = &(struct clk_regmap_mux_data){ 875 + .offset = PWM_CLK_AB_CTRL, 876 + .mask = 0x1, 877 + .shift = 9, 878 + }, 879 + .hw.init = &(struct clk_init_data){ 880 + .name = "pwm_a_sel", 881 + .ops = &clk_regmap_mux_ops, 882 + .parent_data = pwm_abcd_parents, 883 + .num_parents = ARRAY_SIZE(pwm_abcd_parents), 884 + }, 885 + }; 886 + 887 + static struct clk_regmap pwm_a_div = { 888 + .data = &(struct clk_regmap_div_data){ 889 + .offset = PWM_CLK_AB_CTRL, 890 + .shift = 0, 891 + .width = 8, 892 + }, 893 + .hw.init = &(struct clk_init_data){ 894 + .name = "pwm_a_div", 895 + .ops = &clk_regmap_divider_ops, 896 + .parent_hws = (const struct clk_hw *[]) { 897 + &pwm_a_sel.hw 898 + }, 899 + .num_parents = 1, 900 + .flags = CLK_SET_RATE_PARENT, 901 + }, 902 + }; 903 + 904 + static struct clk_regmap pwm_a = { 905 + .data = &(struct clk_regmap_gate_data){ 906 + .offset = PWM_CLK_AB_CTRL, 907 + .bit_idx = 8, 908 + }, 909 + .hw.init = &(struct clk_init_data) { 910 + .name = "pwm_a", 911 + .ops = &clk_regmap_gate_ops, 912 + .parent_hws = (const struct clk_hw *[]) { 913 + &pwm_a_div.hw 914 + }, 915 + .num_parents = 1, 916 + .flags = CLK_SET_RATE_PARENT, 917 + }, 918 + }; 919 + 920 + static struct clk_regmap pwm_b_sel = { 921 + .data = &(struct clk_regmap_mux_data){ 922 + .offset = PWM_CLK_AB_CTRL, 923 + .mask = 0x1, 924 + .shift = 25, 925 + }, 926 + .hw.init = &(struct clk_init_data){ 927 + .name = "pwm_b_sel", 928 + .ops = &clk_regmap_mux_ops, 929 + .parent_data = pwm_abcd_parents, 930 + .num_parents = ARRAY_SIZE(pwm_abcd_parents), 931 + }, 932 + }; 933 + 934 + static struct clk_regmap pwm_b_div = { 935 + .data = &(struct clk_regmap_div_data){ 936 + .offset = PWM_CLK_AB_CTRL, 937 + .shift = 16, 938 + .width = 8, 939 + }, 940 + .hw.init = &(struct clk_init_data){ 941 + .name = "pwm_b_div", 942 + .ops = &clk_regmap_divider_ops, 943 + .parent_hws = (const struct clk_hw *[]) { 944 + &pwm_b_sel.hw 945 + }, 946 + .num_parents = 1, 947 + .flags = CLK_SET_RATE_PARENT, 948 + }, 949 + }; 950 + 951 + static struct clk_regmap pwm_b = { 952 + .data = &(struct clk_regmap_gate_data){ 953 + .offset = PWM_CLK_AB_CTRL, 954 + .bit_idx = 24, 955 + }, 956 + .hw.init = &(struct clk_init_data) { 957 + .name = "pwm_b", 958 + .ops = &clk_regmap_gate_ops, 959 + .parent_hws = (const struct clk_hw *[]) { 960 + &pwm_b_div.hw 961 + }, 962 + .num_parents = 1, 963 + .flags = CLK_SET_RATE_PARENT, 964 + }, 965 + }; 966 + 967 + static struct clk_regmap pwm_c_sel = { 968 + .data = &(struct clk_regmap_mux_data){ 969 + .offset = PWM_CLK_CD_CTRL, 970 + .mask = 0x1, 971 + .shift = 9, 972 + }, 973 + .hw.init = &(struct clk_init_data){ 974 + .name = "pwm_c_sel", 975 + .ops = &clk_regmap_mux_ops, 976 + .parent_data = pwm_abcd_parents, 977 + .num_parents = ARRAY_SIZE(pwm_abcd_parents), 978 + }, 979 + }; 980 + 981 + static struct clk_regmap pwm_c_div = { 982 + .data = &(struct clk_regmap_div_data){ 983 + .offset = PWM_CLK_CD_CTRL, 984 + .shift = 0, 985 + .width = 8, 986 + }, 987 + .hw.init = &(struct clk_init_data){ 988 + .name = "pwm_c_div", 989 + .ops = &clk_regmap_divider_ops, 990 + .parent_hws = (const struct clk_hw *[]) { 991 + &pwm_c_sel.hw 992 + }, 993 + .num_parents = 1, 994 + .flags = CLK_SET_RATE_PARENT, 995 + }, 996 + }; 997 + 998 + static struct clk_regmap pwm_c = { 999 + .data = &(struct clk_regmap_gate_data){ 1000 + .offset = PWM_CLK_CD_CTRL, 1001 + .bit_idx = 8, 1002 + }, 1003 + .hw.init = &(struct clk_init_data) { 1004 + .name = "pwm_c", 1005 + .ops = &clk_regmap_gate_ops, 1006 + .parent_hws = (const struct clk_hw *[]) { 1007 + &pwm_c_div.hw 1008 + }, 1009 + .num_parents = 1, 1010 + .flags = CLK_SET_RATE_PARENT, 1011 + }, 1012 + }; 1013 + 1014 + static struct clk_regmap pwm_d_sel = { 1015 + .data = &(struct clk_regmap_mux_data){ 1016 + .offset = PWM_CLK_CD_CTRL, 1017 + .mask = 0x1, 1018 + .shift = 25, 1019 + }, 1020 + .hw.init = &(struct clk_init_data){ 1021 + .name = "pwm_d_sel", 1022 + .ops = &clk_regmap_mux_ops, 1023 + .parent_data = pwm_abcd_parents, 1024 + .num_parents = ARRAY_SIZE(pwm_abcd_parents), 1025 + }, 1026 + }; 1027 + 1028 + static struct clk_regmap pwm_d_div = { 1029 + .data = &(struct clk_regmap_div_data){ 1030 + .offset = PWM_CLK_CD_CTRL, 1031 + .shift = 16, 1032 + .width = 8, 1033 + }, 1034 + .hw.init = &(struct clk_init_data){ 1035 + .name = "pwm_d_div", 1036 + .ops = &clk_regmap_divider_ops, 1037 + .parent_hws = (const struct clk_hw *[]) { 1038 + &pwm_d_sel.hw 1039 + }, 1040 + .num_parents = 1, 1041 + .flags = CLK_SET_RATE_PARENT, 1042 + }, 1043 + }; 1044 + 1045 + static struct clk_regmap pwm_d = { 1046 + .data = &(struct clk_regmap_gate_data){ 1047 + .offset = PWM_CLK_CD_CTRL, 1048 + .bit_idx = 24, 1049 + }, 1050 + .hw.init = &(struct clk_init_data) { 1051 + .name = "pwm_d", 1052 + .ops = &clk_regmap_gate_ops, 1053 + .parent_hws = (const struct clk_hw *[]) { 1054 + &pwm_d_div.hw 1055 + }, 1056 + .num_parents = 1, 1057 + .flags = CLK_SET_RATE_PARENT, 1058 + }, 1059 + }; 1060 + 1061 + static const struct clk_parent_data pwm_ef_parents[] = { 1062 + { .fw_name = "xtal", }, 1063 + { .hw = &sys.hw }, 1064 + { .fw_name = "fclk_div5", }, 1065 + { .hw = &rtc.hw }, 1066 + }; 1067 + 1068 + static struct clk_regmap pwm_e_sel = { 1069 + .data = &(struct clk_regmap_mux_data){ 1070 + .offset = PWM_CLK_EF_CTRL, 1071 + .mask = 0x3, 1072 + .shift = 9, 1073 + }, 1074 + .hw.init = &(struct clk_init_data){ 1075 + .name = "pwm_e_sel", 1076 + .ops = &clk_regmap_mux_ops, 1077 + .parent_data = pwm_ef_parents, 1078 + .num_parents = ARRAY_SIZE(pwm_ef_parents), 1079 + }, 1080 + }; 1081 + 1082 + static struct clk_regmap pwm_e_div = { 1083 + .data = &(struct clk_regmap_div_data){ 1084 + .offset = PWM_CLK_EF_CTRL, 1085 + .shift = 0, 1086 + .width = 8, 1087 + }, 1088 + .hw.init = &(struct clk_init_data){ 1089 + .name = "pwm_e_div", 1090 + .ops = &clk_regmap_divider_ops, 1091 + .parent_hws = (const struct clk_hw *[]) { 1092 + &pwm_e_sel.hw 1093 + }, 1094 + .num_parents = 1, 1095 + .flags = CLK_SET_RATE_PARENT, 1096 + }, 1097 + }; 1098 + 1099 + static struct clk_regmap pwm_e = { 1100 + .data = &(struct clk_regmap_gate_data){ 1101 + .offset = PWM_CLK_EF_CTRL, 1102 + .bit_idx = 8, 1103 + }, 1104 + .hw.init = &(struct clk_init_data) { 1105 + .name = "pwm_e", 1106 + .ops = &clk_regmap_gate_ops, 1107 + .parent_hws = (const struct clk_hw *[]) { 1108 + &pwm_e_div.hw 1109 + }, 1110 + .num_parents = 1, 1111 + .flags = CLK_SET_RATE_PARENT, 1112 + }, 1113 + }; 1114 + 1115 + static struct clk_regmap pwm_f_sel = { 1116 + .data = &(struct clk_regmap_mux_data){ 1117 + .offset = PWM_CLK_EF_CTRL, 1118 + .mask = 0x3, 1119 + .shift = 25, 1120 + }, 1121 + .hw.init = &(struct clk_init_data){ 1122 + .name = "pwm_f_sel", 1123 + .ops = &clk_regmap_mux_ops, 1124 + .parent_data = pwm_ef_parents, 1125 + .num_parents = ARRAY_SIZE(pwm_ef_parents), 1126 + }, 1127 + }; 1128 + 1129 + static struct clk_regmap pwm_f_div = { 1130 + .data = &(struct clk_regmap_div_data){ 1131 + .offset = PWM_CLK_EF_CTRL, 1132 + .shift = 16, 1133 + .width = 8, 1134 + }, 1135 + .hw.init = &(struct clk_init_data){ 1136 + .name = "pwm_f_div", 1137 + .ops = &clk_regmap_divider_ops, 1138 + .parent_hws = (const struct clk_hw *[]) { 1139 + &pwm_f_sel.hw 1140 + }, 1141 + .num_parents = 1, 1142 + .flags = CLK_SET_RATE_PARENT, 1143 + }, 1144 + }; 1145 + 1146 + static struct clk_regmap pwm_f = { 1147 + .data = &(struct clk_regmap_gate_data){ 1148 + .offset = PWM_CLK_EF_CTRL, 1149 + .bit_idx = 24, 1150 + }, 1151 + .hw.init = &(struct clk_init_data) { 1152 + .name = "pwm_f", 1153 + .ops = &clk_regmap_gate_ops, 1154 + .parent_hws = (const struct clk_hw *[]) { 1155 + &pwm_f_div.hw 1156 + }, 1157 + .num_parents = 1, 1158 + .flags = CLK_SET_RATE_PARENT, 1159 + }, 1160 + }; 1161 + 1162 + /* 1163 + * spicc clk 1164 + * fdiv2 |\ |\ _____ 1165 + * ---------| |---DIV--| | | | spicc out 1166 + * ---------| | | |-----|GATE |--------- 1167 + * ..... |/ | / |_____| 1168 + * --------------------|/ 1169 + * 24M 1170 + */ 1171 + static const struct clk_parent_data spicc_spifc_parents[] = { 1172 + { .fw_name = "fclk_div2"}, 1173 + { .fw_name = "fclk_div3"}, 1174 + { .fw_name = "fclk_div5"}, 1175 + { .fw_name = "hifi_pll" }, 1176 + }; 1177 + 1178 + static struct clk_regmap spicc_sel = { 1179 + .data = &(struct clk_regmap_mux_data){ 1180 + .offset = SPICC_CLK_CTRL, 1181 + .mask = 0x3, 1182 + .shift = 9, 1183 + }, 1184 + .hw.init = &(struct clk_init_data){ 1185 + .name = "spicc_sel", 1186 + .ops = &clk_regmap_mux_ops, 1187 + .parent_data = spicc_spifc_parents, 1188 + .num_parents = ARRAY_SIZE(spicc_spifc_parents), 1189 + }, 1190 + }; 1191 + 1192 + static struct clk_regmap spicc_div = { 1193 + .data = &(struct clk_regmap_div_data){ 1194 + .offset = SPICC_CLK_CTRL, 1195 + .shift = 0, 1196 + .width = 8, 1197 + }, 1198 + .hw.init = &(struct clk_init_data){ 1199 + .name = "spicc_div", 1200 + .ops = &clk_regmap_divider_ops, 1201 + .parent_hws = (const struct clk_hw *[]) { 1202 + &spicc_sel.hw 1203 + }, 1204 + .num_parents = 1, 1205 + .flags = CLK_SET_RATE_PARENT, 1206 + }, 1207 + }; 1208 + 1209 + static struct clk_regmap spicc_sel2 = { 1210 + .data = &(struct clk_regmap_mux_data){ 1211 + .offset = SPICC_CLK_CTRL, 1212 + .mask = 0x1, 1213 + .shift = 15, 1214 + }, 1215 + .hw.init = &(struct clk_init_data){ 1216 + .name = "spicc_sel2", 1217 + .ops = &clk_regmap_mux_ops, 1218 + .parent_data = (const struct clk_parent_data []) { 1219 + { .hw = &spicc_div.hw }, 1220 + { .fw_name = "xtal", }, 1221 + }, 1222 + .num_parents = 2, 1223 + .flags = CLK_SET_RATE_PARENT, 1224 + }, 1225 + }; 1226 + 1227 + static struct clk_regmap spicc = { 1228 + .data = &(struct clk_regmap_gate_data){ 1229 + .offset = SPICC_CLK_CTRL, 1230 + .bit_idx = 8, 1231 + }, 1232 + .hw.init = &(struct clk_init_data) { 1233 + .name = "spicc", 1234 + .ops = &clk_regmap_gate_ops, 1235 + .parent_hws = (const struct clk_hw *[]) { 1236 + &spicc_sel2.hw 1237 + }, 1238 + .num_parents = 1, 1239 + .flags = CLK_SET_RATE_PARENT, 1240 + }, 1241 + }; 1242 + 1243 + static struct clk_regmap ts_div = { 1244 + .data = &(struct clk_regmap_div_data){ 1245 + .offset = TS_CLK_CTRL, 1246 + .shift = 0, 1247 + .width = 8, 1248 + }, 1249 + .hw.init = &(struct clk_init_data){ 1250 + .name = "ts_div", 1251 + .ops = &clk_regmap_divider_ops, 1252 + .parent_data = &(const struct clk_parent_data) { 1253 + .fw_name = "xtal", 1254 + }, 1255 + .num_parents = 1, 1256 + }, 1257 + }; 1258 + 1259 + static struct clk_regmap ts = { 1260 + .data = &(struct clk_regmap_gate_data){ 1261 + .offset = TS_CLK_CTRL, 1262 + .bit_idx = 8, 1263 + }, 1264 + .hw.init = &(struct clk_init_data) { 1265 + .name = "ts", 1266 + .ops = &clk_regmap_gate_ops, 1267 + .parent_hws = (const struct clk_hw *[]) { 1268 + &ts_div.hw 1269 + }, 1270 + .num_parents = 1, 1271 + .flags = CLK_SET_RATE_PARENT, 1272 + }, 1273 + }; 1274 + 1275 + static struct clk_regmap spifc_sel = { 1276 + .data = &(struct clk_regmap_mux_data){ 1277 + .offset = SPIFC_CLK_CTRL, 1278 + .mask = 0x3, 1279 + .shift = 9, 1280 + }, 1281 + .hw.init = &(struct clk_init_data){ 1282 + .name = "spifc_sel", 1283 + .ops = &clk_regmap_mux_ops, 1284 + .parent_data = spicc_spifc_parents, 1285 + .num_parents = ARRAY_SIZE(spicc_spifc_parents), 1286 + }, 1287 + }; 1288 + 1289 + static struct clk_regmap spifc_div = { 1290 + .data = &(struct clk_regmap_div_data){ 1291 + .offset = SPIFC_CLK_CTRL, 1292 + .shift = 0, 1293 + .width = 8, 1294 + }, 1295 + .hw.init = &(struct clk_init_data){ 1296 + .name = "spifc_div", 1297 + .ops = &clk_regmap_divider_ops, 1298 + .parent_hws = (const struct clk_hw *[]) { 1299 + &spifc_sel.hw 1300 + }, 1301 + .num_parents = 1, 1302 + .flags = CLK_SET_RATE_PARENT, 1303 + }, 1304 + }; 1305 + 1306 + static struct clk_regmap spifc_sel2 = { 1307 + .data = &(struct clk_regmap_mux_data){ 1308 + .offset = SPIFC_CLK_CTRL, 1309 + .mask = 0x1, 1310 + .shift = 15, 1311 + }, 1312 + .hw.init = &(struct clk_init_data){ 1313 + .name = "spifc_sel2", 1314 + .ops = &clk_regmap_mux_ops, 1315 + .parent_data = (const struct clk_parent_data []) { 1316 + { .hw = &spifc_div.hw }, 1317 + { .fw_name = "xtal", }, 1318 + }, 1319 + .num_parents = 2, 1320 + .flags = CLK_SET_RATE_PARENT, 1321 + }, 1322 + }; 1323 + 1324 + static struct clk_regmap spifc = { 1325 + .data = &(struct clk_regmap_gate_data){ 1326 + .offset = SPIFC_CLK_CTRL, 1327 + .bit_idx = 8, 1328 + }, 1329 + .hw.init = &(struct clk_init_data) { 1330 + .name = "spifc", 1331 + .ops = &clk_regmap_gate_ops, 1332 + .parent_hws = (const struct clk_hw *[]) { 1333 + &spifc_sel2.hw 1334 + }, 1335 + .num_parents = 1, 1336 + .flags = CLK_SET_RATE_PARENT, 1337 + }, 1338 + }; 1339 + 1340 + static const struct clk_parent_data usb_bus_parents[] = { 1341 + { .fw_name = "xtal", }, 1342 + { .hw = &sys.hw }, 1343 + { .fw_name = "fclk_div3", }, 1344 + { .fw_name = "fclk_div5", }, 1345 + }; 1346 + 1347 + static struct clk_regmap usb_bus_sel = { 1348 + .data = &(struct clk_regmap_mux_data){ 1349 + .offset = USB_BUSCLK_CTRL, 1350 + .mask = 0x3, 1351 + .shift = 9, 1352 + }, 1353 + .hw.init = &(struct clk_init_data){ 1354 + .name = "usb_bus_sel", 1355 + .ops = &clk_regmap_mux_ops, 1356 + .parent_data = usb_bus_parents, 1357 + .num_parents = ARRAY_SIZE(usb_bus_parents), 1358 + .flags = CLK_SET_RATE_PARENT, 1359 + }, 1360 + }; 1361 + 1362 + static struct clk_regmap usb_bus_div = { 1363 + .data = &(struct clk_regmap_div_data){ 1364 + .offset = USB_BUSCLK_CTRL, 1365 + .shift = 0, 1366 + .width = 8, 1367 + }, 1368 + .hw.init = &(struct clk_init_data){ 1369 + .name = "usb_bus_div", 1370 + .ops = &clk_regmap_divider_ops, 1371 + .parent_hws = (const struct clk_hw *[]) { 1372 + &usb_bus_sel.hw 1373 + }, 1374 + .num_parents = 1, 1375 + .flags = CLK_SET_RATE_PARENT, 1376 + }, 1377 + }; 1378 + 1379 + static struct clk_regmap usb_bus = { 1380 + .data = &(struct clk_regmap_gate_data){ 1381 + .offset = USB_BUSCLK_CTRL, 1382 + .bit_idx = 8, 1383 + }, 1384 + .hw.init = &(struct clk_init_data) { 1385 + .name = "usb_bus", 1386 + .ops = &clk_regmap_gate_ops, 1387 + .parent_hws = (const struct clk_hw *[]) { 1388 + &usb_bus_div.hw 1389 + }, 1390 + .num_parents = 1, 1391 + .flags = CLK_SET_RATE_PARENT, 1392 + }, 1393 + }; 1394 + 1395 + static const struct clk_parent_data sd_emmc_psram_dmc_parents[] = { 1396 + { .fw_name = "fclk_div2", }, 1397 + { .fw_name = "fclk_div3", }, 1398 + { .fw_name = "fclk_div5", }, 1399 + { .fw_name = "hifi_pll", }, 1400 + }; 1401 + 1402 + static struct clk_regmap sd_emmc_sel = { 1403 + .data = &(struct clk_regmap_mux_data){ 1404 + .offset = SD_EMMC_CLK_CTRL, 1405 + .mask = 0x3, 1406 + .shift = 9, 1407 + }, 1408 + .hw.init = &(struct clk_init_data){ 1409 + .name = "sd_emmc_sel", 1410 + .ops = &clk_regmap_mux_ops, 1411 + .parent_data = sd_emmc_psram_dmc_parents, 1412 + .num_parents = ARRAY_SIZE(sd_emmc_psram_dmc_parents), 1413 + }, 1414 + }; 1415 + 1416 + static struct clk_regmap sd_emmc_div = { 1417 + .data = &(struct clk_regmap_div_data){ 1418 + .offset = SD_EMMC_CLK_CTRL, 1419 + .shift = 0, 1420 + .width = 8, 1421 + }, 1422 + .hw.init = &(struct clk_init_data){ 1423 + .name = "sd_emmc_div", 1424 + .ops = &clk_regmap_divider_ops, 1425 + .parent_hws = (const struct clk_hw *[]) { 1426 + &sd_emmc_sel.hw 1427 + }, 1428 + .num_parents = 1, 1429 + .flags = CLK_SET_RATE_PARENT, 1430 + }, 1431 + }; 1432 + 1433 + static struct clk_regmap sd_emmc_sel2 = { 1434 + .data = &(struct clk_regmap_mux_data){ 1435 + .offset = SD_EMMC_CLK_CTRL, 1436 + .mask = 0x1, 1437 + .shift = 15, 1438 + }, 1439 + .hw.init = &(struct clk_init_data){ 1440 + .name = "sd_emmc_sel2", 1441 + .ops = &clk_regmap_mux_ops, 1442 + .parent_data = (const struct clk_parent_data []) { 1443 + { .hw = &sd_emmc_div.hw }, 1444 + { .fw_name = "xtal", }, 1445 + }, 1446 + .num_parents = 2, 1447 + .flags = CLK_SET_RATE_PARENT, 1448 + }, 1449 + }; 1450 + 1451 + static struct clk_regmap sd_emmc = { 1452 + .data = &(struct clk_regmap_gate_data){ 1453 + .offset = SD_EMMC_CLK_CTRL, 1454 + .bit_idx = 8, 1455 + }, 1456 + .hw.init = &(struct clk_init_data) { 1457 + .name = "sd_emmc", 1458 + .ops = &clk_regmap_gate_ops, 1459 + .parent_hws = (const struct clk_hw *[]) { 1460 + &sd_emmc_sel2.hw 1461 + }, 1462 + .num_parents = 1, 1463 + .flags = CLK_SET_RATE_PARENT, 1464 + }, 1465 + }; 1466 + 1467 + static struct clk_regmap psram_sel = { 1468 + .data = &(struct clk_regmap_mux_data){ 1469 + .offset = PSRAM_CLK_CTRL, 1470 + .mask = 0x3, 1471 + .shift = 9, 1472 + }, 1473 + .hw.init = &(struct clk_init_data){ 1474 + .name = "psram_sel", 1475 + .ops = &clk_regmap_mux_ops, 1476 + .parent_data = sd_emmc_psram_dmc_parents, 1477 + .num_parents = ARRAY_SIZE(sd_emmc_psram_dmc_parents), 1478 + }, 1479 + }; 1480 + 1481 + static struct clk_regmap psram_div = { 1482 + .data = &(struct clk_regmap_div_data){ 1483 + .offset = PSRAM_CLK_CTRL, 1484 + .shift = 0, 1485 + .width = 8, 1486 + }, 1487 + .hw.init = &(struct clk_init_data){ 1488 + .name = "psram_div", 1489 + .ops = &clk_regmap_divider_ops, 1490 + .parent_hws = (const struct clk_hw *[]) { 1491 + &psram_sel.hw 1492 + }, 1493 + .num_parents = 1, 1494 + .flags = CLK_SET_RATE_PARENT, 1495 + }, 1496 + }; 1497 + 1498 + static struct clk_regmap psram_sel2 = { 1499 + .data = &(struct clk_regmap_mux_data){ 1500 + .offset = PSRAM_CLK_CTRL, 1501 + .mask = 0x1, 1502 + .shift = 15, 1503 + }, 1504 + .hw.init = &(struct clk_init_data){ 1505 + .name = "psram_sel2", 1506 + .ops = &clk_regmap_mux_ops, 1507 + .parent_data = (const struct clk_parent_data []) { 1508 + { .hw = &psram_div.hw }, 1509 + { .fw_name = "xtal", }, 1510 + }, 1511 + .num_parents = 2, 1512 + .flags = CLK_SET_RATE_PARENT, 1513 + }, 1514 + }; 1515 + 1516 + static struct clk_regmap psram = { 1517 + .data = &(struct clk_regmap_gate_data){ 1518 + .offset = PSRAM_CLK_CTRL, 1519 + .bit_idx = 8, 1520 + }, 1521 + .hw.init = &(struct clk_init_data) { 1522 + .name = "psram", 1523 + .ops = &clk_regmap_gate_ops, 1524 + .parent_hws = (const struct clk_hw *[]) { 1525 + &psram_sel2.hw 1526 + }, 1527 + .num_parents = 1, 1528 + .flags = CLK_SET_RATE_PARENT, 1529 + }, 1530 + }; 1531 + 1532 + static struct clk_regmap dmc_sel = { 1533 + .data = &(struct clk_regmap_mux_data){ 1534 + .offset = DMC_CLK_CTRL, 1535 + .mask = 0x3, 1536 + .shift = 9, 1537 + }, 1538 + .hw.init = &(struct clk_init_data){ 1539 + .name = "dmc_sel", 1540 + .ops = &clk_regmap_mux_ops, 1541 + .parent_data = sd_emmc_psram_dmc_parents, 1542 + .num_parents = ARRAY_SIZE(sd_emmc_psram_dmc_parents), 1543 + }, 1544 + }; 1545 + 1546 + static struct clk_regmap dmc_div = { 1547 + .data = &(struct clk_regmap_div_data){ 1548 + .offset = DMC_CLK_CTRL, 1549 + .shift = 0, 1550 + .width = 8, 1551 + }, 1552 + .hw.init = &(struct clk_init_data){ 1553 + .name = "dmc_div", 1554 + .ops = &clk_regmap_divider_ops, 1555 + .parent_hws = (const struct clk_hw *[]) { 1556 + &dmc_sel.hw 1557 + }, 1558 + .num_parents = 1, 1559 + .flags = CLK_SET_RATE_PARENT, 1560 + }, 1561 + }; 1562 + 1563 + static struct clk_regmap dmc_sel2 = { 1564 + .data = &(struct clk_regmap_mux_data){ 1565 + .offset = DMC_CLK_CTRL, 1566 + .mask = 0x1, 1567 + .shift = 15, 1568 + }, 1569 + .hw.init = &(struct clk_init_data){ 1570 + .name = "dmc_sel2", 1571 + .ops = &clk_regmap_mux_ops, 1572 + .parent_data = (const struct clk_parent_data []) { 1573 + { .hw = &dmc_div.hw }, 1574 + { .fw_name = "xtal", }, 1575 + }, 1576 + .num_parents = 2, 1577 + .flags = CLK_SET_RATE_PARENT, 1578 + }, 1579 + }; 1580 + 1581 + static struct clk_regmap dmc = { 1582 + .data = &(struct clk_regmap_gate_data){ 1583 + .offset = DMC_CLK_CTRL, 1584 + .bit_idx = 8, 1585 + }, 1586 + .hw.init = &(struct clk_init_data) { 1587 + .name = "dmc", 1588 + .ops = &clk_regmap_gate_ro_ops, 1589 + .parent_hws = (const struct clk_hw *[]) { 1590 + &dmc_sel2.hw 1591 + }, 1592 + .num_parents = 1, 1593 + .flags = CLK_SET_RATE_PARENT, 1594 + }, 1595 + }; 1596 + 1597 + static struct clk_regmap ceca_32k_in = { 1598 + .data = &(struct clk_regmap_gate_data){ 1599 + .offset = CECA_CLK_CTRL0, 1600 + .bit_idx = 31, 1601 + }, 1602 + .hw.init = &(struct clk_init_data) { 1603 + .name = "ceca_32k_in", 1604 + .ops = &clk_regmap_gate_ops, 1605 + .parent_data = &(const struct clk_parent_data) { 1606 + .fw_name = "xtal", 1607 + }, 1608 + .num_parents = 1, 1609 + }, 1610 + }; 1611 + 1612 + static struct clk_regmap ceca_32k_div = { 1613 + .data = &(struct meson_clk_dualdiv_data){ 1614 + .n1 = { 1615 + .reg_off = CECA_CLK_CTRL0, 1616 + .shift = 0, 1617 + .width = 12, 1618 + }, 1619 + .n2 = { 1620 + .reg_off = CECA_CLK_CTRL0, 1621 + .shift = 12, 1622 + .width = 12, 1623 + }, 1624 + .m1 = { 1625 + .reg_off = CECA_CLK_CTRL1, 1626 + .shift = 0, 1627 + .width = 12, 1628 + }, 1629 + .m2 = { 1630 + .reg_off = CECA_CLK_CTRL1, 1631 + .shift = 12, 1632 + .width = 12, 1633 + }, 1634 + .dual = { 1635 + .reg_off = CECA_CLK_CTRL0, 1636 + .shift = 28, 1637 + .width = 1, 1638 + }, 1639 + .table = clk_32k_div_table, 1640 + }, 1641 + .hw.init = &(struct clk_init_data){ 1642 + .name = "ceca_32k_div", 1643 + .ops = &meson_clk_dualdiv_ops, 1644 + .parent_hws = (const struct clk_hw *[]) { 1645 + &ceca_32k_in.hw 1646 + }, 1647 + .num_parents = 1, 1648 + }, 1649 + }; 1650 + 1651 + static struct clk_regmap ceca_32k_sel_pre = { 1652 + .data = &(struct clk_regmap_mux_data) { 1653 + .offset = CECA_CLK_CTRL1, 1654 + .mask = 0x1, 1655 + .shift = 24, 1656 + .flags = CLK_MUX_ROUND_CLOSEST, 1657 + }, 1658 + .hw.init = &(struct clk_init_data){ 1659 + .name = "ceca_32k_sel_pre", 1660 + .ops = &clk_regmap_mux_ops, 1661 + .parent_hws = (const struct clk_hw *[]) { 1662 + &ceca_32k_div.hw, 1663 + &ceca_32k_in.hw, 1664 + }, 1665 + .num_parents = 2, 1666 + .flags = CLK_SET_RATE_PARENT, 1667 + }, 1668 + }; 1669 + 1670 + static struct clk_regmap ceca_32k_sel = { 1671 + .data = &(struct clk_regmap_mux_data) { 1672 + .offset = CECA_CLK_CTRL1, 1673 + .mask = 0x1, 1674 + .shift = 31, 1675 + .flags = CLK_MUX_ROUND_CLOSEST, 1676 + }, 1677 + .hw.init = &(struct clk_init_data){ 1678 + .name = "ceca_32k_sel", 1679 + .ops = &clk_regmap_mux_ops, 1680 + .parent_hws = (const struct clk_hw *[]) { 1681 + &ceca_32k_sel_pre.hw, 1682 + &rtc.hw, 1683 + }, 1684 + .num_parents = 2, 1685 + }, 1686 + }; 1687 + 1688 + static struct clk_regmap ceca_32k_out = { 1689 + .data = &(struct clk_regmap_gate_data){ 1690 + .offset = CECA_CLK_CTRL0, 1691 + .bit_idx = 30, 1692 + }, 1693 + .hw.init = &(struct clk_init_data){ 1694 + .name = "ceca_32k_out", 1695 + .ops = &clk_regmap_gate_ops, 1696 + .parent_hws = (const struct clk_hw *[]) { 1697 + &ceca_32k_sel.hw 1698 + }, 1699 + .num_parents = 1, 1700 + .flags = CLK_SET_RATE_PARENT, 1701 + }, 1702 + }; 1703 + 1704 + static struct clk_regmap cecb_32k_in = { 1705 + .data = &(struct clk_regmap_gate_data){ 1706 + .offset = CECB_CLK_CTRL0, 1707 + .bit_idx = 31, 1708 + }, 1709 + .hw.init = &(struct clk_init_data) { 1710 + .name = "cecb_32k_in", 1711 + .ops = &clk_regmap_gate_ops, 1712 + .parent_data = &(const struct clk_parent_data) { 1713 + .fw_name = "xtal", 1714 + }, 1715 + .num_parents = 1, 1716 + }, 1717 + }; 1718 + 1719 + static struct clk_regmap cecb_32k_div = { 1720 + .data = &(struct meson_clk_dualdiv_data){ 1721 + .n1 = { 1722 + .reg_off = CECB_CLK_CTRL0, 1723 + .shift = 0, 1724 + .width = 12, 1725 + }, 1726 + .n2 = { 1727 + .reg_off = CECB_CLK_CTRL0, 1728 + .shift = 12, 1729 + .width = 12, 1730 + }, 1731 + .m1 = { 1732 + .reg_off = CECB_CLK_CTRL1, 1733 + .shift = 0, 1734 + .width = 12, 1735 + }, 1736 + .m2 = { 1737 + .reg_off = CECB_CLK_CTRL1, 1738 + .shift = 12, 1739 + .width = 12, 1740 + }, 1741 + .dual = { 1742 + .reg_off = CECB_CLK_CTRL0, 1743 + .shift = 28, 1744 + .width = 1, 1745 + }, 1746 + .table = clk_32k_div_table, 1747 + }, 1748 + .hw.init = &(struct clk_init_data){ 1749 + .name = "cecb_32k_div", 1750 + .ops = &meson_clk_dualdiv_ops, 1751 + .parent_hws = (const struct clk_hw *[]) { 1752 + &cecb_32k_in.hw 1753 + }, 1754 + .num_parents = 1, 1755 + }, 1756 + }; 1757 + 1758 + static struct clk_regmap cecb_32k_sel_pre = { 1759 + .data = &(struct clk_regmap_mux_data) { 1760 + .offset = CECB_CLK_CTRL1, 1761 + .mask = 0x1, 1762 + .shift = 24, 1763 + .flags = CLK_MUX_ROUND_CLOSEST, 1764 + }, 1765 + .hw.init = &(struct clk_init_data){ 1766 + .name = "cecb_32k_sel_pre", 1767 + .ops = &clk_regmap_mux_ops, 1768 + .parent_hws = (const struct clk_hw *[]) { 1769 + &cecb_32k_div.hw, 1770 + &cecb_32k_in.hw, 1771 + }, 1772 + .num_parents = 2, 1773 + .flags = CLK_SET_RATE_PARENT, 1774 + }, 1775 + }; 1776 + 1777 + static struct clk_regmap cecb_32k_sel = { 1778 + .data = &(struct clk_regmap_mux_data) { 1779 + .offset = CECB_CLK_CTRL1, 1780 + .mask = 0x1, 1781 + .shift = 31, 1782 + .flags = CLK_MUX_ROUND_CLOSEST, 1783 + }, 1784 + .hw.init = &(struct clk_init_data){ 1785 + .name = "cecb_32k_sel", 1786 + .ops = &clk_regmap_mux_ops, 1787 + .parent_hws = (const struct clk_hw *[]) { 1788 + &cecb_32k_sel_pre.hw, 1789 + &rtc.hw, 1790 + }, 1791 + .num_parents = 2, 1792 + }, 1793 + }; 1794 + 1795 + static struct clk_regmap cecb_32k_out = { 1796 + .data = &(struct clk_regmap_gate_data){ 1797 + .offset = CECB_CLK_CTRL0, 1798 + .bit_idx = 30, 1799 + }, 1800 + .hw.init = &(struct clk_init_data){ 1801 + .name = "cecb_32k_out", 1802 + .ops = &clk_regmap_gate_ops, 1803 + .parent_hws = (const struct clk_hw *[]) { 1804 + &cecb_32k_sel.hw 1805 + }, 1806 + .num_parents = 1, 1807 + .flags = CLK_SET_RATE_PARENT, 1808 + }, 1809 + }; 1810 + 1811 + #define MESON_GATE(_name, _reg, _bit) \ 1812 + MESON_PCLK(_name, _reg, _bit, &sys.hw) 1813 + 1814 + static MESON_GATE(clktree, SYS_CLK_EN0, 0); 1815 + static MESON_GATE(reset_ctrl, SYS_CLK_EN0, 1); 1816 + static MESON_GATE(analog_ctrl, SYS_CLK_EN0, 2); 1817 + static MESON_GATE(pwr_ctrl, SYS_CLK_EN0, 3); 1818 + static MESON_GATE(pad_ctrl, SYS_CLK_EN0, 4); 1819 + static MESON_GATE(sys_ctrl, SYS_CLK_EN0, 5); 1820 + static MESON_GATE(temp_sensor, SYS_CLK_EN0, 6); 1821 + static MESON_GATE(am2axi_dev, SYS_CLK_EN0, 7); 1822 + static MESON_GATE(spicc_b, SYS_CLK_EN0, 8); 1823 + static MESON_GATE(spicc_a, SYS_CLK_EN0, 9); 1824 + static MESON_GATE(msr, SYS_CLK_EN0, 10); 1825 + static MESON_GATE(audio, SYS_CLK_EN0, 11); 1826 + static MESON_GATE(jtag_ctrl, SYS_CLK_EN0, 12); 1827 + static MESON_GATE(saradc_en, SYS_CLK_EN0, 13); 1828 + static MESON_GATE(pwm_ef, SYS_CLK_EN0, 14); 1829 + static MESON_GATE(pwm_cd, SYS_CLK_EN0, 15); 1830 + static MESON_GATE(pwm_ab, SYS_CLK_EN0, 16); 1831 + static MESON_GATE(cec, SYS_CLK_EN0, 17); 1832 + static MESON_GATE(i2c_s, SYS_CLK_EN0, 18); 1833 + static MESON_GATE(ir_ctrl, SYS_CLK_EN0, 19); 1834 + static MESON_GATE(i2c_m_d, SYS_CLK_EN0, 20); 1835 + static MESON_GATE(i2c_m_c, SYS_CLK_EN0, 21); 1836 + static MESON_GATE(i2c_m_b, SYS_CLK_EN0, 22); 1837 + static MESON_GATE(i2c_m_a, SYS_CLK_EN0, 23); 1838 + static MESON_GATE(acodec, SYS_CLK_EN0, 24); 1839 + static MESON_GATE(otp, SYS_CLK_EN0, 25); 1840 + static MESON_GATE(sd_emmc_a, SYS_CLK_EN0, 26); 1841 + static MESON_GATE(usb_phy, SYS_CLK_EN0, 27); 1842 + static MESON_GATE(usb_ctrl, SYS_CLK_EN0, 28); 1843 + static MESON_GATE(sys_dspb, SYS_CLK_EN0, 29); 1844 + static MESON_GATE(sys_dspa, SYS_CLK_EN0, 30); 1845 + static MESON_GATE(dma, SYS_CLK_EN0, 31); 1846 + static MESON_GATE(irq_ctrl, SYS_CLK_EN1, 0); 1847 + static MESON_GATE(nic, SYS_CLK_EN1, 1); 1848 + static MESON_GATE(gic, SYS_CLK_EN1, 2); 1849 + static MESON_GATE(uart_c, SYS_CLK_EN1, 3); 1850 + static MESON_GATE(uart_b, SYS_CLK_EN1, 4); 1851 + static MESON_GATE(uart_a, SYS_CLK_EN1, 5); 1852 + static MESON_GATE(sys_psram, SYS_CLK_EN1, 6); 1853 + static MESON_GATE(rsa, SYS_CLK_EN1, 8); 1854 + static MESON_GATE(coresight, SYS_CLK_EN1, 9); 1855 + static MESON_GATE(am2axi_vad, AXI_CLK_EN, 0); 1856 + static MESON_GATE(audio_vad, AXI_CLK_EN, 1); 1857 + static MESON_GATE(axi_dmc, AXI_CLK_EN, 3); 1858 + static MESON_GATE(axi_psram, AXI_CLK_EN, 4); 1859 + static MESON_GATE(ramb, AXI_CLK_EN, 5); 1860 + static MESON_GATE(rama, AXI_CLK_EN, 6); 1861 + static MESON_GATE(axi_spifc, AXI_CLK_EN, 7); 1862 + static MESON_GATE(axi_nic, AXI_CLK_EN, 8); 1863 + static MESON_GATE(axi_dma, AXI_CLK_EN, 9); 1864 + static MESON_GATE(cpu_ctrl, AXI_CLK_EN, 10); 1865 + static MESON_GATE(rom, AXI_CLK_EN, 11); 1866 + static MESON_GATE(prod_i2c, AXI_CLK_EN, 12); 1867 + 1868 + /* Array of all clocks registered by this provider */ 1869 + static struct clk_hw_onecell_data a1_periphs_clks = { 1870 + .hws = { 1871 + [CLKID_XTAL_IN] = &xtal_in.hw, 1872 + [CLKID_FIXPLL_IN] = &fixpll_in.hw, 1873 + [CLKID_USB_PHY_IN] = &usb_phy_in.hw, 1874 + [CLKID_USB_CTRL_IN] = &usb_ctrl_in.hw, 1875 + [CLKID_HIFIPLL_IN] = &hifipll_in.hw, 1876 + [CLKID_SYSPLL_IN] = &syspll_in.hw, 1877 + [CLKID_DDS_IN] = &dds_in.hw, 1878 + [CLKID_SYS] = &sys.hw, 1879 + [CLKID_CLKTREE] = &clktree.hw, 1880 + [CLKID_RESET_CTRL] = &reset_ctrl.hw, 1881 + [CLKID_ANALOG_CTRL] = &analog_ctrl.hw, 1882 + [CLKID_PWR_CTRL] = &pwr_ctrl.hw, 1883 + [CLKID_PAD_CTRL] = &pad_ctrl.hw, 1884 + [CLKID_SYS_CTRL] = &sys_ctrl.hw, 1885 + [CLKID_TEMP_SENSOR] = &temp_sensor.hw, 1886 + [CLKID_AM2AXI_DIV] = &am2axi_dev.hw, 1887 + [CLKID_SPICC_B] = &spicc_b.hw, 1888 + [CLKID_SPICC_A] = &spicc_a.hw, 1889 + [CLKID_MSR] = &msr.hw, 1890 + [CLKID_AUDIO] = &audio.hw, 1891 + [CLKID_JTAG_CTRL] = &jtag_ctrl.hw, 1892 + [CLKID_SARADC_EN] = &saradc_en.hw, 1893 + [CLKID_PWM_EF] = &pwm_ef.hw, 1894 + [CLKID_PWM_CD] = &pwm_cd.hw, 1895 + [CLKID_PWM_AB] = &pwm_ab.hw, 1896 + [CLKID_CEC] = &cec.hw, 1897 + [CLKID_I2C_S] = &i2c_s.hw, 1898 + [CLKID_IR_CTRL] = &ir_ctrl.hw, 1899 + [CLKID_I2C_M_D] = &i2c_m_d.hw, 1900 + [CLKID_I2C_M_C] = &i2c_m_c.hw, 1901 + [CLKID_I2C_M_B] = &i2c_m_b.hw, 1902 + [CLKID_I2C_M_A] = &i2c_m_a.hw, 1903 + [CLKID_ACODEC] = &acodec.hw, 1904 + [CLKID_OTP] = &otp.hw, 1905 + [CLKID_SD_EMMC_A] = &sd_emmc_a.hw, 1906 + [CLKID_USB_PHY] = &usb_phy.hw, 1907 + [CLKID_USB_CTRL] = &usb_ctrl.hw, 1908 + [CLKID_SYS_DSPB] = &sys_dspb.hw, 1909 + [CLKID_SYS_DSPA] = &sys_dspa.hw, 1910 + [CLKID_DMA] = &dma.hw, 1911 + [CLKID_IRQ_CTRL] = &irq_ctrl.hw, 1912 + [CLKID_NIC] = &nic.hw, 1913 + [CLKID_GIC] = &gic.hw, 1914 + [CLKID_UART_C] = &uart_c.hw, 1915 + [CLKID_UART_B] = &uart_b.hw, 1916 + [CLKID_UART_A] = &uart_a.hw, 1917 + [CLKID_SYS_PSRAM] = &sys_psram.hw, 1918 + [CLKID_RSA] = &rsa.hw, 1919 + [CLKID_CORESIGHT] = &coresight.hw, 1920 + [CLKID_AM2AXI_VAD] = &am2axi_vad.hw, 1921 + [CLKID_AUDIO_VAD] = &audio_vad.hw, 1922 + [CLKID_AXI_DMC] = &axi_dmc.hw, 1923 + [CLKID_AXI_PSRAM] = &axi_psram.hw, 1924 + [CLKID_RAMB] = &ramb.hw, 1925 + [CLKID_RAMA] = &rama.hw, 1926 + [CLKID_AXI_SPIFC] = &axi_spifc.hw, 1927 + [CLKID_AXI_NIC] = &axi_nic.hw, 1928 + [CLKID_AXI_DMA] = &axi_dma.hw, 1929 + [CLKID_CPU_CTRL] = &cpu_ctrl.hw, 1930 + [CLKID_ROM] = &rom.hw, 1931 + [CLKID_PROC_I2C] = &prod_i2c.hw, 1932 + [CLKID_DSPA_SEL] = &dspa_sel.hw, 1933 + [CLKID_DSPB_SEL] = &dspb_sel.hw, 1934 + [CLKID_DSPA_EN] = &dspa_en.hw, 1935 + [CLKID_DSPA_EN_NIC] = &dspa_en_nic.hw, 1936 + [CLKID_DSPB_EN] = &dspb_en.hw, 1937 + [CLKID_DSPB_EN_NIC] = &dspb_en_nic.hw, 1938 + [CLKID_RTC] = &rtc.hw, 1939 + [CLKID_CECA_32K] = &ceca_32k_out.hw, 1940 + [CLKID_CECB_32K] = &cecb_32k_out.hw, 1941 + [CLKID_24M] = &clk_24m.hw, 1942 + [CLKID_12M] = &clk_12m.hw, 1943 + [CLKID_FCLK_DIV2_DIVN] = &fclk_div2_divn.hw, 1944 + [CLKID_GEN] = &gen.hw, 1945 + [CLKID_SARADC_SEL] = &saradc_sel.hw, 1946 + [CLKID_SARADC] = &saradc.hw, 1947 + [CLKID_PWM_A] = &pwm_a.hw, 1948 + [CLKID_PWM_B] = &pwm_b.hw, 1949 + [CLKID_PWM_C] = &pwm_c.hw, 1950 + [CLKID_PWM_D] = &pwm_d.hw, 1951 + [CLKID_PWM_E] = &pwm_e.hw, 1952 + [CLKID_PWM_F] = &pwm_f.hw, 1953 + [CLKID_SPICC] = &spicc.hw, 1954 + [CLKID_TS] = &ts.hw, 1955 + [CLKID_SPIFC] = &spifc.hw, 1956 + [CLKID_USB_BUS] = &usb_bus.hw, 1957 + [CLKID_SD_EMMC] = &sd_emmc.hw, 1958 + [CLKID_PSRAM] = &psram.hw, 1959 + [CLKID_DMC] = &dmc.hw, 1960 + [CLKID_SYS_A_SEL] = &sys_a_sel.hw, 1961 + [CLKID_SYS_A_DIV] = &sys_a_div.hw, 1962 + [CLKID_SYS_A] = &sys_a.hw, 1963 + [CLKID_SYS_B_SEL] = &sys_b_sel.hw, 1964 + [CLKID_SYS_B_DIV] = &sys_b_div.hw, 1965 + [CLKID_SYS_B] = &sys_b.hw, 1966 + [CLKID_DSPA_A_SEL] = &dspa_a_sel.hw, 1967 + [CLKID_DSPA_A_DIV] = &dspa_a_div.hw, 1968 + [CLKID_DSPA_A] = &dspa_a.hw, 1969 + [CLKID_DSPA_B_SEL] = &dspa_b_sel.hw, 1970 + [CLKID_DSPA_B_DIV] = &dspa_b_div.hw, 1971 + [CLKID_DSPA_B] = &dspa_b.hw, 1972 + [CLKID_DSPB_A_SEL] = &dspb_a_sel.hw, 1973 + [CLKID_DSPB_A_DIV] = &dspb_a_div.hw, 1974 + [CLKID_DSPB_A] = &dspb_a.hw, 1975 + [CLKID_DSPB_B_SEL] = &dspb_b_sel.hw, 1976 + [CLKID_DSPB_B_DIV] = &dspb_b_div.hw, 1977 + [CLKID_DSPB_B] = &dspb_b.hw, 1978 + [CLKID_RTC_32K_IN] = &rtc_32k_in.hw, 1979 + [CLKID_RTC_32K_DIV] = &rtc_32k_div.hw, 1980 + [CLKID_RTC_32K_XTAL] = &rtc_32k_xtal.hw, 1981 + [CLKID_RTC_32K_SEL] = &rtc_32k_sel.hw, 1982 + [CLKID_CECB_32K_IN] = &cecb_32k_in.hw, 1983 + [CLKID_CECB_32K_DIV] = &cecb_32k_div.hw, 1984 + [CLKID_CECB_32K_SEL_PRE] = &cecb_32k_sel_pre.hw, 1985 + [CLKID_CECB_32K_SEL] = &cecb_32k_sel.hw, 1986 + [CLKID_CECA_32K_IN] = &ceca_32k_in.hw, 1987 + [CLKID_CECA_32K_DIV] = &ceca_32k_div.hw, 1988 + [CLKID_CECA_32K_SEL_PRE] = &ceca_32k_sel_pre.hw, 1989 + [CLKID_CECA_32K_SEL] = &ceca_32k_sel.hw, 1990 + [CLKID_DIV2_PRE] = &fclk_div2_divn_pre.hw, 1991 + [CLKID_24M_DIV2] = &clk_24m_div2.hw, 1992 + [CLKID_GEN_SEL] = &gen_sel.hw, 1993 + [CLKID_GEN_DIV] = &gen_div.hw, 1994 + [CLKID_SARADC_DIV] = &saradc_div.hw, 1995 + [CLKID_PWM_A_SEL] = &pwm_a_sel.hw, 1996 + [CLKID_PWM_A_DIV] = &pwm_a_div.hw, 1997 + [CLKID_PWM_B_SEL] = &pwm_b_sel.hw, 1998 + [CLKID_PWM_B_DIV] = &pwm_b_div.hw, 1999 + [CLKID_PWM_C_SEL] = &pwm_c_sel.hw, 2000 + [CLKID_PWM_C_DIV] = &pwm_c_div.hw, 2001 + [CLKID_PWM_D_SEL] = &pwm_d_sel.hw, 2002 + [CLKID_PWM_D_DIV] = &pwm_d_div.hw, 2003 + [CLKID_PWM_E_SEL] = &pwm_e_sel.hw, 2004 + [CLKID_PWM_E_DIV] = &pwm_e_div.hw, 2005 + [CLKID_PWM_F_SEL] = &pwm_f_sel.hw, 2006 + [CLKID_PWM_F_DIV] = &pwm_f_div.hw, 2007 + [CLKID_SPICC_SEL] = &spicc_sel.hw, 2008 + [CLKID_SPICC_DIV] = &spicc_div.hw, 2009 + [CLKID_SPICC_SEL2] = &spicc_sel2.hw, 2010 + [CLKID_TS_DIV] = &ts_div.hw, 2011 + [CLKID_SPIFC_SEL] = &spifc_sel.hw, 2012 + [CLKID_SPIFC_DIV] = &spifc_div.hw, 2013 + [CLKID_SPIFC_SEL2] = &spifc_sel2.hw, 2014 + [CLKID_USB_BUS_SEL] = &usb_bus_sel.hw, 2015 + [CLKID_USB_BUS_DIV] = &usb_bus_div.hw, 2016 + [CLKID_SD_EMMC_SEL] = &sd_emmc_sel.hw, 2017 + [CLKID_SD_EMMC_DIV] = &sd_emmc_div.hw, 2018 + [CLKID_SD_EMMC_SEL2] = &sd_emmc_sel2.hw, 2019 + [CLKID_PSRAM_SEL] = &psram_sel.hw, 2020 + [CLKID_PSRAM_DIV] = &psram_div.hw, 2021 + [CLKID_PSRAM_SEL2] = &psram_sel2.hw, 2022 + [CLKID_DMC_SEL] = &dmc_sel.hw, 2023 + [CLKID_DMC_DIV] = &dmc_div.hw, 2024 + [CLKID_DMC_SEL2] = &dmc_sel2.hw, 2025 + [NR_CLKS] = NULL, 2026 + }, 2027 + .num = NR_CLKS, 2028 + }; 2029 + 2030 + /* Convenience table to populate regmap in .probe */ 2031 + static struct clk_regmap *const a1_periphs_regmaps[] = { 2032 + &xtal_in, 2033 + &fixpll_in, 2034 + &usb_phy_in, 2035 + &usb_ctrl_in, 2036 + &hifipll_in, 2037 + &syspll_in, 2038 + &dds_in, 2039 + &sys, 2040 + &clktree, 2041 + &reset_ctrl, 2042 + &analog_ctrl, 2043 + &pwr_ctrl, 2044 + &pad_ctrl, 2045 + &sys_ctrl, 2046 + &temp_sensor, 2047 + &am2axi_dev, 2048 + &spicc_b, 2049 + &spicc_a, 2050 + &msr, 2051 + &audio, 2052 + &jtag_ctrl, 2053 + &saradc_en, 2054 + &pwm_ef, 2055 + &pwm_cd, 2056 + &pwm_ab, 2057 + &cec, 2058 + &i2c_s, 2059 + &ir_ctrl, 2060 + &i2c_m_d, 2061 + &i2c_m_c, 2062 + &i2c_m_b, 2063 + &i2c_m_a, 2064 + &acodec, 2065 + &otp, 2066 + &sd_emmc_a, 2067 + &usb_phy, 2068 + &usb_ctrl, 2069 + &sys_dspb, 2070 + &sys_dspa, 2071 + &dma, 2072 + &irq_ctrl, 2073 + &nic, 2074 + &gic, 2075 + &uart_c, 2076 + &uart_b, 2077 + &uart_a, 2078 + &sys_psram, 2079 + &rsa, 2080 + &coresight, 2081 + &am2axi_vad, 2082 + &audio_vad, 2083 + &axi_dmc, 2084 + &axi_psram, 2085 + &ramb, 2086 + &rama, 2087 + &axi_spifc, 2088 + &axi_nic, 2089 + &axi_dma, 2090 + &cpu_ctrl, 2091 + &rom, 2092 + &prod_i2c, 2093 + &dspa_sel, 2094 + &dspb_sel, 2095 + &dspa_en, 2096 + &dspa_en_nic, 2097 + &dspb_en, 2098 + &dspb_en_nic, 2099 + &rtc, 2100 + &ceca_32k_out, 2101 + &cecb_32k_out, 2102 + &clk_24m, 2103 + &clk_12m, 2104 + &fclk_div2_divn, 2105 + &gen, 2106 + &saradc_sel, 2107 + &saradc, 2108 + &pwm_a, 2109 + &pwm_b, 2110 + &pwm_c, 2111 + &pwm_d, 2112 + &pwm_e, 2113 + &pwm_f, 2114 + &spicc, 2115 + &ts, 2116 + &spifc, 2117 + &usb_bus, 2118 + &sd_emmc, 2119 + &psram, 2120 + &dmc, 2121 + &sys_a_sel, 2122 + &sys_a_div, 2123 + &sys_a, 2124 + &sys_b_sel, 2125 + &sys_b_div, 2126 + &sys_b, 2127 + &dspa_a_sel, 2128 + &dspa_a_div, 2129 + &dspa_a, 2130 + &dspa_b_sel, 2131 + &dspa_b_div, 2132 + &dspa_b, 2133 + &dspb_a_sel, 2134 + &dspb_a_div, 2135 + &dspb_a, 2136 + &dspb_b_sel, 2137 + &dspb_b_div, 2138 + &dspb_b, 2139 + &rtc_32k_in, 2140 + &rtc_32k_div, 2141 + &rtc_32k_xtal, 2142 + &rtc_32k_sel, 2143 + &cecb_32k_in, 2144 + &cecb_32k_div, 2145 + &cecb_32k_sel_pre, 2146 + &cecb_32k_sel, 2147 + &ceca_32k_in, 2148 + &ceca_32k_div, 2149 + &ceca_32k_sel_pre, 2150 + &ceca_32k_sel, 2151 + &fclk_div2_divn_pre, 2152 + &gen_sel, 2153 + &gen_div, 2154 + &saradc_div, 2155 + &pwm_a_sel, 2156 + &pwm_a_div, 2157 + &pwm_b_sel, 2158 + &pwm_b_div, 2159 + &pwm_c_sel, 2160 + &pwm_c_div, 2161 + &pwm_d_sel, 2162 + &pwm_d_div, 2163 + &pwm_e_sel, 2164 + &pwm_e_div, 2165 + &pwm_f_sel, 2166 + &pwm_f_div, 2167 + &spicc_sel, 2168 + &spicc_div, 2169 + &spicc_sel2, 2170 + &ts_div, 2171 + &spifc_sel, 2172 + &spifc_div, 2173 + &spifc_sel2, 2174 + &usb_bus_sel, 2175 + &usb_bus_div, 2176 + &sd_emmc_sel, 2177 + &sd_emmc_div, 2178 + &sd_emmc_sel2, 2179 + &psram_sel, 2180 + &psram_div, 2181 + &psram_sel2, 2182 + &dmc_sel, 2183 + &dmc_div, 2184 + &dmc_sel2, 2185 + }; 2186 + 2187 + static struct regmap_config a1_periphs_regmap_cfg = { 2188 + .reg_bits = 32, 2189 + .val_bits = 32, 2190 + .reg_stride = 4, 2191 + }; 2192 + 2193 + static int meson_a1_periphs_probe(struct platform_device *pdev) 2194 + { 2195 + struct device *dev = &pdev->dev; 2196 + void __iomem *base; 2197 + struct regmap *map; 2198 + int clkid, i, err; 2199 + 2200 + base = devm_platform_ioremap_resource(pdev, 0); 2201 + if (IS_ERR(base)) 2202 + return dev_err_probe(dev, PTR_ERR(base), 2203 + "can't ioremap resource\n"); 2204 + 2205 + map = devm_regmap_init_mmio(dev, base, &a1_periphs_regmap_cfg); 2206 + if (IS_ERR(map)) 2207 + return dev_err_probe(dev, PTR_ERR(map), 2208 + "can't init regmap mmio region\n"); 2209 + 2210 + /* Populate regmap for the regmap backed clocks */ 2211 + for (i = 0; i < ARRAY_SIZE(a1_periphs_regmaps); i++) 2212 + a1_periphs_regmaps[i]->map = map; 2213 + 2214 + for (clkid = 0; clkid < a1_periphs_clks.num; clkid++) { 2215 + err = devm_clk_hw_register(dev, a1_periphs_clks.hws[clkid]); 2216 + if (err) 2217 + return dev_err_probe(dev, err, 2218 + "clock[%d] registration failed\n", 2219 + clkid); 2220 + } 2221 + 2222 + return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, 2223 + &a1_periphs_clks); 2224 + } 2225 + 2226 + static const struct of_device_id a1_periphs_clkc_match_table[] = { 2227 + { .compatible = "amlogic,a1-peripherals-clkc", }, 2228 + {} 2229 + }; 2230 + MODULE_DEVICE_TABLE(of, a1_periphs_clkc_match_table); 2231 + 2232 + static struct platform_driver a1_periphs_clkc_driver = { 2233 + .probe = meson_a1_periphs_probe, 2234 + .driver = { 2235 + .name = "a1-peripherals-clkc", 2236 + .of_match_table = a1_periphs_clkc_match_table, 2237 + }, 2238 + }; 2239 + 2240 + module_platform_driver(a1_periphs_clkc_driver); 2241 + MODULE_AUTHOR("Jian Hu <jian.hu@amlogic.com>"); 2242 + MODULE_AUTHOR("Dmitry Rokosov <ddrokosov@sberdevices.ru>"); 2243 + MODULE_LICENSE("GPL");
+113
drivers/clk/meson/a1-peripherals.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0+ */ 2 + /* 3 + * Amlogic A1 Peripherals Clock Controller internals 4 + * 5 + * Copyright (c) 2019 Amlogic, Inc. All rights reserved. 6 + * Author: Jian Hu <jian.hu@amlogic.com> 7 + * 8 + * Copyright (c) 2023, SberDevices. All Rights Reserved. 9 + * Author: Dmitry Rokosov <ddrokosov@sberdevices.ru> 10 + */ 11 + 12 + #ifndef __A1_PERIPHERALS_H 13 + #define __A1_PERIPHERALS_H 14 + 15 + /* peripherals clock controller register offset */ 16 + #define SYS_OSCIN_CTRL 0x0 17 + #define RTC_BY_OSCIN_CTRL0 0x4 18 + #define RTC_BY_OSCIN_CTRL1 0x8 19 + #define RTC_CTRL 0xc 20 + #define SYS_CLK_CTRL0 0x10 21 + #define SYS_CLK_EN0 0x1c 22 + #define SYS_CLK_EN1 0x20 23 + #define AXI_CLK_EN 0x24 24 + #define DSPA_CLK_EN 0x28 25 + #define DSPB_CLK_EN 0x2c 26 + #define DSPA_CLK_CTRL0 0x30 27 + #define DSPB_CLK_CTRL0 0x34 28 + #define CLK12_24_CTRL 0x38 29 + #define GEN_CLK_CTRL 0x3c 30 + #define SAR_ADC_CLK_CTRL 0xc0 31 + #define PWM_CLK_AB_CTRL 0xc4 32 + #define PWM_CLK_CD_CTRL 0xc8 33 + #define PWM_CLK_EF_CTRL 0xcc 34 + #define SPICC_CLK_CTRL 0xd0 35 + #define TS_CLK_CTRL 0xd4 36 + #define SPIFC_CLK_CTRL 0xd8 37 + #define USB_BUSCLK_CTRL 0xdc 38 + #define SD_EMMC_CLK_CTRL 0xe0 39 + #define CECA_CLK_CTRL0 0xe4 40 + #define CECA_CLK_CTRL1 0xe8 41 + #define CECB_CLK_CTRL0 0xec 42 + #define CECB_CLK_CTRL1 0xf0 43 + #define PSRAM_CLK_CTRL 0xf4 44 + #define DMC_CLK_CTRL 0xf8 45 + 46 + /* include the CLKIDs that have been made part of the DT binding */ 47 + #include <dt-bindings/clock/amlogic,a1-peripherals-clkc.h> 48 + 49 + /* 50 + * CLKID index values for internal clocks 51 + * 52 + * These indices are entirely contrived and do not map onto the hardware. 53 + * It has now been decided to expose everything by default in the DT header: 54 + * include/dt-bindings/clock/a1-peripherals-clkc.h. 55 + * Only the clocks ids we don't want to expose, such as the internal muxes and 56 + * dividers of composite clocks, will remain defined here. 57 + */ 58 + #define CLKID_XTAL_IN 0 59 + #define CLKID_DSPA_SEL 61 60 + #define CLKID_DSPB_SEL 62 61 + #define CLKID_SARADC_SEL 74 62 + #define CLKID_SYS_A_SEL 89 63 + #define CLKID_SYS_A_DIV 90 64 + #define CLKID_SYS_A 91 65 + #define CLKID_SYS_B_SEL 92 66 + #define CLKID_SYS_B_DIV 93 67 + #define CLKID_SYS_B 94 68 + #define CLKID_DSPA_A_DIV 96 69 + #define CLKID_DSPA_A 97 70 + #define CLKID_DSPA_B_DIV 99 71 + #define CLKID_DSPA_B 100 72 + #define CLKID_DSPB_A_DIV 102 73 + #define CLKID_DSPB_A 103 74 + #define CLKID_DSPB_B_DIV 105 75 + #define CLKID_DSPB_B 106 76 + #define CLKID_RTC_32K_IN 107 77 + #define CLKID_RTC_32K_DIV 108 78 + #define CLKID_RTC_32K_XTAL 109 79 + #define CLKID_RTC_32K_SEL 110 80 + #define CLKID_CECB_32K_IN 111 81 + #define CLKID_CECB_32K_DIV 112 82 + #define CLKID_CECA_32K_IN 115 83 + #define CLKID_CECA_32K_DIV 116 84 + #define CLKID_DIV2_PRE 119 85 + #define CLKID_24M_DIV2 120 86 + #define CLKID_GEN_DIV 122 87 + #define CLKID_SARADC_DIV 123 88 + #define CLKID_PWM_A_DIV 125 89 + #define CLKID_PWM_B_DIV 127 90 + #define CLKID_PWM_C_DIV 129 91 + #define CLKID_PWM_D_DIV 131 92 + #define CLKID_PWM_E_DIV 133 93 + #define CLKID_PWM_F_DIV 135 94 + #define CLKID_SPICC_SEL 136 95 + #define CLKID_SPICC_DIV 137 96 + #define CLKID_SPICC_SEL2 138 97 + #define CLKID_TS_DIV 139 98 + #define CLKID_SPIFC_SEL 140 99 + #define CLKID_SPIFC_DIV 141 100 + #define CLKID_SPIFC_SEL2 142 101 + #define CLKID_USB_BUS_SEL 143 102 + #define CLKID_USB_BUS_DIV 144 103 + #define CLKID_SD_EMMC_SEL 145 104 + #define CLKID_SD_EMMC_DIV 146 105 + #define CLKID_PSRAM_SEL 148 106 + #define CLKID_PSRAM_DIV 149 107 + #define CLKID_PSRAM_SEL2 150 108 + #define CLKID_DMC_SEL 151 109 + #define CLKID_DMC_DIV 152 110 + #define CLKID_DMC_SEL2 153 111 + #define NR_CLKS 154 112 + 113 + #endif /* __A1_PERIPHERALS_H */
+356
drivers/clk/meson/a1-pll.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * Copyright (c) 2019 Amlogic, Inc. All rights reserved. 4 + * Author: Jian Hu <jian.hu@amlogic.com> 5 + * 6 + * Copyright (c) 2023, SberDevices. All Rights Reserved. 7 + * Author: Dmitry Rokosov <ddrokosov@sberdevices.ru> 8 + */ 9 + 10 + #include <linux/clk-provider.h> 11 + #include <linux/of_device.h> 12 + #include <linux/platform_device.h> 13 + #include "a1-pll.h" 14 + #include "clk-regmap.h" 15 + 16 + static struct clk_regmap fixed_pll_dco = { 17 + .data = &(struct meson_clk_pll_data){ 18 + .en = { 19 + .reg_off = ANACTRL_FIXPLL_CTRL0, 20 + .shift = 28, 21 + .width = 1, 22 + }, 23 + .m = { 24 + .reg_off = ANACTRL_FIXPLL_CTRL0, 25 + .shift = 0, 26 + .width = 8, 27 + }, 28 + .n = { 29 + .reg_off = ANACTRL_FIXPLL_CTRL0, 30 + .shift = 10, 31 + .width = 5, 32 + }, 33 + .frac = { 34 + .reg_off = ANACTRL_FIXPLL_CTRL1, 35 + .shift = 0, 36 + .width = 19, 37 + }, 38 + .l = { 39 + .reg_off = ANACTRL_FIXPLL_STS, 40 + .shift = 31, 41 + .width = 1, 42 + }, 43 + .rst = { 44 + .reg_off = ANACTRL_FIXPLL_CTRL0, 45 + .shift = 29, 46 + .width = 1, 47 + }, 48 + }, 49 + .hw.init = &(struct clk_init_data){ 50 + .name = "fixed_pll_dco", 51 + .ops = &meson_clk_pll_ro_ops, 52 + .parent_data = &(const struct clk_parent_data) { 53 + .fw_name = "fixpll_in", 54 + }, 55 + .num_parents = 1, 56 + }, 57 + }; 58 + 59 + static struct clk_regmap fixed_pll = { 60 + .data = &(struct clk_regmap_gate_data){ 61 + .offset = ANACTRL_FIXPLL_CTRL0, 62 + .bit_idx = 20, 63 + }, 64 + .hw.init = &(struct clk_init_data) { 65 + .name = "fixed_pll", 66 + .ops = &clk_regmap_gate_ops, 67 + .parent_hws = (const struct clk_hw *[]) { 68 + &fixed_pll_dco.hw 69 + }, 70 + .num_parents = 1, 71 + }, 72 + }; 73 + 74 + static const struct pll_mult_range hifi_pll_mult_range = { 75 + .min = 32, 76 + .max = 64, 77 + }; 78 + 79 + static const struct reg_sequence hifi_init_regs[] = { 80 + { .reg = ANACTRL_HIFIPLL_CTRL1, .def = 0x01800000 }, 81 + { .reg = ANACTRL_HIFIPLL_CTRL2, .def = 0x00001100 }, 82 + { .reg = ANACTRL_HIFIPLL_CTRL3, .def = 0x100a1100 }, 83 + { .reg = ANACTRL_HIFIPLL_CTRL4, .def = 0x00302000 }, 84 + { .reg = ANACTRL_HIFIPLL_CTRL0, .def = 0x01f18000 }, 85 + }; 86 + 87 + static struct clk_regmap hifi_pll = { 88 + .data = &(struct meson_clk_pll_data){ 89 + .en = { 90 + .reg_off = ANACTRL_HIFIPLL_CTRL0, 91 + .shift = 28, 92 + .width = 1, 93 + }, 94 + .m = { 95 + .reg_off = ANACTRL_HIFIPLL_CTRL0, 96 + .shift = 0, 97 + .width = 8, 98 + }, 99 + .n = { 100 + .reg_off = ANACTRL_HIFIPLL_CTRL0, 101 + .shift = 10, 102 + .width = 5, 103 + }, 104 + .frac = { 105 + .reg_off = ANACTRL_HIFIPLL_CTRL1, 106 + .shift = 0, 107 + .width = 19, 108 + }, 109 + .l = { 110 + .reg_off = ANACTRL_HIFIPLL_STS, 111 + .shift = 31, 112 + .width = 1, 113 + }, 114 + .current_en = { 115 + .reg_off = ANACTRL_HIFIPLL_CTRL0, 116 + .shift = 26, 117 + .width = 1, 118 + }, 119 + .l_detect = { 120 + .reg_off = ANACTRL_HIFIPLL_CTRL2, 121 + .shift = 6, 122 + .width = 1, 123 + }, 124 + .range = &hifi_pll_mult_range, 125 + .init_regs = hifi_init_regs, 126 + .init_count = ARRAY_SIZE(hifi_init_regs), 127 + }, 128 + .hw.init = &(struct clk_init_data){ 129 + .name = "hifi_pll", 130 + .ops = &meson_clk_pll_ops, 131 + .parent_data = &(const struct clk_parent_data) { 132 + .fw_name = "hifipll_in", 133 + }, 134 + .num_parents = 1, 135 + }, 136 + }; 137 + 138 + static struct clk_fixed_factor fclk_div2_div = { 139 + .mult = 1, 140 + .div = 2, 141 + .hw.init = &(struct clk_init_data){ 142 + .name = "fclk_div2_div", 143 + .ops = &clk_fixed_factor_ops, 144 + .parent_hws = (const struct clk_hw *[]) { 145 + &fixed_pll.hw 146 + }, 147 + .num_parents = 1, 148 + }, 149 + }; 150 + 151 + static struct clk_regmap fclk_div2 = { 152 + .data = &(struct clk_regmap_gate_data){ 153 + .offset = ANACTRL_FIXPLL_CTRL0, 154 + .bit_idx = 21, 155 + }, 156 + .hw.init = &(struct clk_init_data){ 157 + .name = "fclk_div2", 158 + .ops = &clk_regmap_gate_ops, 159 + .parent_hws = (const struct clk_hw *[]) { 160 + &fclk_div2_div.hw 161 + }, 162 + .num_parents = 1, 163 + /* 164 + * This clock is used by DDR clock in BL2 firmware 165 + * and is required by the platform to operate correctly. 166 + * Until the following condition are met, we need this clock to 167 + * be marked as critical: 168 + * a) Mark the clock used by a firmware resource, if possible 169 + * b) CCF has a clock hand-off mechanism to make the sure the 170 + * clock stays on until the proper driver comes along 171 + */ 172 + .flags = CLK_IS_CRITICAL, 173 + }, 174 + }; 175 + 176 + static struct clk_fixed_factor fclk_div3_div = { 177 + .mult = 1, 178 + .div = 3, 179 + .hw.init = &(struct clk_init_data){ 180 + .name = "fclk_div3_div", 181 + .ops = &clk_fixed_factor_ops, 182 + .parent_hws = (const struct clk_hw *[]) { 183 + &fixed_pll.hw 184 + }, 185 + .num_parents = 1, 186 + }, 187 + }; 188 + 189 + static struct clk_regmap fclk_div3 = { 190 + .data = &(struct clk_regmap_gate_data){ 191 + .offset = ANACTRL_FIXPLL_CTRL0, 192 + .bit_idx = 22, 193 + }, 194 + .hw.init = &(struct clk_init_data){ 195 + .name = "fclk_div3", 196 + .ops = &clk_regmap_gate_ops, 197 + .parent_hws = (const struct clk_hw *[]) { 198 + &fclk_div3_div.hw 199 + }, 200 + .num_parents = 1, 201 + /* 202 + * This clock is used by APB bus which is set in boot ROM code 203 + * and is required by the platform to operate correctly. 204 + */ 205 + .flags = CLK_IS_CRITICAL, 206 + }, 207 + }; 208 + 209 + static struct clk_fixed_factor fclk_div5_div = { 210 + .mult = 1, 211 + .div = 5, 212 + .hw.init = &(struct clk_init_data){ 213 + .name = "fclk_div5_div", 214 + .ops = &clk_fixed_factor_ops, 215 + .parent_hws = (const struct clk_hw *[]) { 216 + &fixed_pll.hw 217 + }, 218 + .num_parents = 1, 219 + }, 220 + }; 221 + 222 + static struct clk_regmap fclk_div5 = { 223 + .data = &(struct clk_regmap_gate_data){ 224 + .offset = ANACTRL_FIXPLL_CTRL0, 225 + .bit_idx = 23, 226 + }, 227 + .hw.init = &(struct clk_init_data){ 228 + .name = "fclk_div5", 229 + .ops = &clk_regmap_gate_ops, 230 + .parent_hws = (const struct clk_hw *[]) { 231 + &fclk_div5_div.hw 232 + }, 233 + .num_parents = 1, 234 + /* 235 + * This clock is used by AXI bus which setted in Romcode 236 + * and is required by the platform to operate correctly. 237 + */ 238 + .flags = CLK_IS_CRITICAL, 239 + }, 240 + }; 241 + 242 + static struct clk_fixed_factor fclk_div7_div = { 243 + .mult = 1, 244 + .div = 7, 245 + .hw.init = &(struct clk_init_data){ 246 + .name = "fclk_div7_div", 247 + .ops = &clk_fixed_factor_ops, 248 + .parent_hws = (const struct clk_hw *[]) { 249 + &fixed_pll.hw 250 + }, 251 + .num_parents = 1, 252 + }, 253 + }; 254 + 255 + static struct clk_regmap fclk_div7 = { 256 + .data = &(struct clk_regmap_gate_data){ 257 + .offset = ANACTRL_FIXPLL_CTRL0, 258 + .bit_idx = 24, 259 + }, 260 + .hw.init = &(struct clk_init_data){ 261 + .name = "fclk_div7", 262 + .ops = &clk_regmap_gate_ops, 263 + .parent_hws = (const struct clk_hw *[]) { 264 + &fclk_div7_div.hw 265 + }, 266 + .num_parents = 1, 267 + }, 268 + }; 269 + 270 + /* Array of all clocks registered by this provider */ 271 + static struct clk_hw_onecell_data a1_pll_clks = { 272 + .hws = { 273 + [CLKID_FIXED_PLL_DCO] = &fixed_pll_dco.hw, 274 + [CLKID_FIXED_PLL] = &fixed_pll.hw, 275 + [CLKID_FCLK_DIV2_DIV] = &fclk_div2_div.hw, 276 + [CLKID_FCLK_DIV3_DIV] = &fclk_div3_div.hw, 277 + [CLKID_FCLK_DIV5_DIV] = &fclk_div5_div.hw, 278 + [CLKID_FCLK_DIV7_DIV] = &fclk_div7_div.hw, 279 + [CLKID_FCLK_DIV2] = &fclk_div2.hw, 280 + [CLKID_FCLK_DIV3] = &fclk_div3.hw, 281 + [CLKID_FCLK_DIV5] = &fclk_div5.hw, 282 + [CLKID_FCLK_DIV7] = &fclk_div7.hw, 283 + [CLKID_HIFI_PLL] = &hifi_pll.hw, 284 + [NR_PLL_CLKS] = NULL, 285 + }, 286 + .num = NR_PLL_CLKS, 287 + }; 288 + 289 + static struct clk_regmap *const a1_pll_regmaps[] = { 290 + &fixed_pll_dco, 291 + &fixed_pll, 292 + &fclk_div2, 293 + &fclk_div3, 294 + &fclk_div5, 295 + &fclk_div7, 296 + &hifi_pll, 297 + }; 298 + 299 + static struct regmap_config a1_pll_regmap_cfg = { 300 + .reg_bits = 32, 301 + .val_bits = 32, 302 + .reg_stride = 4, 303 + }; 304 + 305 + static int meson_a1_pll_probe(struct platform_device *pdev) 306 + { 307 + struct device *dev = &pdev->dev; 308 + void __iomem *base; 309 + struct regmap *map; 310 + int clkid, i, err; 311 + 312 + base = devm_platform_ioremap_resource(pdev, 0); 313 + if (IS_ERR(base)) 314 + return dev_err_probe(dev, PTR_ERR(base), 315 + "can't ioremap resource\n"); 316 + 317 + map = devm_regmap_init_mmio(dev, base, &a1_pll_regmap_cfg); 318 + if (IS_ERR(map)) 319 + return dev_err_probe(dev, PTR_ERR(map), 320 + "can't init regmap mmio region\n"); 321 + 322 + /* Populate regmap for the regmap backed clocks */ 323 + for (i = 0; i < ARRAY_SIZE(a1_pll_regmaps); i++) 324 + a1_pll_regmaps[i]->map = map; 325 + 326 + /* Register clocks */ 327 + for (clkid = 0; clkid < a1_pll_clks.num; clkid++) { 328 + err = devm_clk_hw_register(dev, a1_pll_clks.hws[clkid]); 329 + if (err) 330 + return dev_err_probe(dev, err, 331 + "clock[%d] registration failed\n", 332 + clkid); 333 + } 334 + 335 + return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, 336 + &a1_pll_clks); 337 + } 338 + 339 + static const struct of_device_id a1_pll_clkc_match_table[] = { 340 + { .compatible = "amlogic,a1-pll-clkc", }, 341 + {} 342 + }; 343 + MODULE_DEVICE_TABLE(of, a1_pll_clkc_match_table); 344 + 345 + static struct platform_driver a1_pll_clkc_driver = { 346 + .probe = meson_a1_pll_probe, 347 + .driver = { 348 + .name = "a1-pll-clkc", 349 + .of_match_table = a1_pll_clkc_match_table, 350 + }, 351 + }; 352 + 353 + module_platform_driver(a1_pll_clkc_driver); 354 + MODULE_AUTHOR("Jian Hu <jian.hu@amlogic.com>"); 355 + MODULE_AUTHOR("Dmitry Rokosov <ddrokosov@sberdevices.ru>"); 356 + MODULE_LICENSE("GPL");
+47
drivers/clk/meson/a1-pll.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0+ */ 2 + /* 3 + * Amlogic A1 PLL Clock Controller internals 4 + * 5 + * Copyright (c) 2019 Amlogic, Inc. All rights reserved. 6 + * Author: Jian Hu <jian.hu@amlogic.com> 7 + * 8 + * Copyright (c) 2023, SberDevices. All Rights Reserved. 9 + * Author: Dmitry Rokosov <ddrokosov@sberdevices.ru> 10 + */ 11 + 12 + #ifndef __A1_PLL_H 13 + #define __A1_PLL_H 14 + 15 + #include "clk-pll.h" 16 + 17 + /* PLL register offset */ 18 + #define ANACTRL_FIXPLL_CTRL0 0x0 19 + #define ANACTRL_FIXPLL_CTRL1 0x4 20 + #define ANACTRL_FIXPLL_STS 0x14 21 + #define ANACTRL_HIFIPLL_CTRL0 0xc0 22 + #define ANACTRL_HIFIPLL_CTRL1 0xc4 23 + #define ANACTRL_HIFIPLL_CTRL2 0xc8 24 + #define ANACTRL_HIFIPLL_CTRL3 0xcc 25 + #define ANACTRL_HIFIPLL_CTRL4 0xd0 26 + #define ANACTRL_HIFIPLL_STS 0xd4 27 + 28 + /* include the CLKIDs that have been made part of the DT binding */ 29 + #include <dt-bindings/clock/amlogic,a1-pll-clkc.h> 30 + 31 + /* 32 + * CLKID index values for internal clocks 33 + * 34 + * These indices are entirely contrived and do not map onto the hardware. 35 + * It has now been decided to expose everything by default in the DT header: 36 + * include/dt-bindings/clock/a1-pll-clkc.h. Only the clocks ids we don't want 37 + * to expose, such as the internal muxes and dividers of composite clocks, 38 + * will remain defined here. 39 + */ 40 + #define CLKID_FIXED_PLL_DCO 0 41 + #define CLKID_FCLK_DIV2_DIV 2 42 + #define CLKID_FCLK_DIV3_DIV 3 43 + #define CLKID_FCLK_DIV5_DIV 4 44 + #define CLKID_FCLK_DIV7_DIV 5 45 + #define NR_PLL_CLKS 11 46 + 47 + #endif /* __A1_PLL_H */
+40 -7
drivers/clk/meson/clk-pll.c
··· 295 295 struct meson_clk_pll_data *pll = meson_clk_pll_data(clk); 296 296 297 297 if (pll->init_count) { 298 - meson_parm_write(clk->map, &pll->rst, 1); 298 + if (MESON_PARM_APPLICABLE(&pll->rst)) 299 + meson_parm_write(clk->map, &pll->rst, 1); 300 + 299 301 regmap_multi_reg_write(clk->map, pll->init_regs, 300 302 pll->init_count); 301 - meson_parm_write(clk->map, &pll->rst, 0); 303 + 304 + if (MESON_PARM_APPLICABLE(&pll->rst)) 305 + meson_parm_write(clk->map, &pll->rst, 0); 302 306 } 303 307 304 308 return 0; ··· 313 309 struct clk_regmap *clk = to_clk_regmap(hw); 314 310 struct meson_clk_pll_data *pll = meson_clk_pll_data(clk); 315 311 316 - if (meson_parm_read(clk->map, &pll->rst) || 317 - !meson_parm_read(clk->map, &pll->en) || 312 + if (MESON_PARM_APPLICABLE(&pll->rst) && 313 + meson_parm_read(clk->map, &pll->rst)) 314 + return 0; 315 + 316 + if (!meson_parm_read(clk->map, &pll->en) || 318 317 !meson_parm_read(clk->map, &pll->l)) 319 318 return 0; 320 319 ··· 348 341 return 0; 349 342 350 343 /* Make sure the pll is in reset */ 351 - meson_parm_write(clk->map, &pll->rst, 1); 344 + if (MESON_PARM_APPLICABLE(&pll->rst)) 345 + meson_parm_write(clk->map, &pll->rst, 1); 352 346 353 347 /* Enable the pll */ 354 348 meson_parm_write(clk->map, &pll->en, 1); 355 349 356 350 /* Take the pll out reset */ 357 - meson_parm_write(clk->map, &pll->rst, 0); 351 + if (MESON_PARM_APPLICABLE(&pll->rst)) 352 + meson_parm_write(clk->map, &pll->rst, 0); 353 + 354 + /* 355 + * Compared with the previous SoCs, self-adaption current module 356 + * is newly added for A1, keep the new power-on sequence to enable the 357 + * PLL. The sequence is: 358 + * 1. enable the pll, delay for 10us 359 + * 2. enable the pll self-adaption current module, delay for 40us 360 + * 3. enable the lock detect module 361 + */ 362 + if (MESON_PARM_APPLICABLE(&pll->current_en)) { 363 + usleep_range(10, 20); 364 + meson_parm_write(clk->map, &pll->current_en, 1); 365 + usleep_range(40, 50); 366 + } 367 + 368 + if (MESON_PARM_APPLICABLE(&pll->l_detect)) { 369 + meson_parm_write(clk->map, &pll->l_detect, 1); 370 + meson_parm_write(clk->map, &pll->l_detect, 0); 371 + } 358 372 359 373 if (meson_clk_pll_wait_lock(hw)) 360 374 return -EIO; ··· 389 361 struct meson_clk_pll_data *pll = meson_clk_pll_data(clk); 390 362 391 363 /* Put the pll is in reset */ 392 - meson_parm_write(clk->map, &pll->rst, 1); 364 + if (MESON_PARM_APPLICABLE(&pll->rst)) 365 + meson_parm_write(clk->map, &pll->rst, 1); 393 366 394 367 /* Disable the pll */ 395 368 meson_parm_write(clk->map, &pll->en, 0); 369 + 370 + /* Disable PLL internal self-adaption current module */ 371 + if (MESON_PARM_APPLICABLE(&pll->current_en)) 372 + meson_parm_write(clk->map, &pll->current_en, 0); 396 373 } 397 374 398 375 static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,
+2
drivers/clk/meson/clk-pll.h
··· 36 36 struct parm frac; 37 37 struct parm l; 38 38 struct parm rst; 39 + struct parm current_en; 40 + struct parm l_detect; 39 41 const struct reg_sequence *init_regs; 40 42 unsigned int init_count; 41 43 const struct pll_params_table *table;
+2 -2
drivers/clk/microchip/Kconfig
··· 5 5 6 6 config MCHP_CLK_MPFS 7 7 bool "Clk driver for PolarFire SoC" 8 - depends on SOC_MICROCHIP_POLARFIRE || COMPILE_TEST 9 - default SOC_MICROCHIP_POLARFIRE 8 + depends on ARCH_MICROCHIP_POLARFIRE || COMPILE_TEST 9 + default ARCH_MICROCHIP_POLARFIRE 10 10 select AUXILIARY_BUS 11 11 help 12 12 Supports Clock Configuration for PolarFire SoC
+1 -1
drivers/clk/microchip/clk-pic32mzda.c
··· 184 184 clks[UPLLCLK] = clk_register_fixed_rate(&pdev->dev, "usbphy_clk", NULL, 185 185 0, 24000000); 186 186 /* fixed rate (optional) clock */ 187 - if (of_find_property(np, "microchip,pic32mzda-sosc", NULL)) { 187 + if (of_property_read_bool(np, "microchip,pic32mzda-sosc")) { 188 188 pr_info("pic32-clk: dt requests SOSC.\n"); 189 189 clks[SOSCCLK] = pic32_sosc_clk_register(&sosc_clk, core); 190 190 }
+8 -8
drivers/clk/mvebu/ap-cpu-clk.c
··· 253 253 */ 254 254 nclusters = 1; 255 255 for_each_of_cpu_node(dn) { 256 - int cpu, err; 256 + u64 cpu; 257 257 258 - err = of_property_read_u32(dn, "reg", &cpu); 259 - if (WARN_ON(err)) { 258 + cpu = of_get_cpu_hwid(dn, 0); 259 + if (WARN_ON(cpu == OF_BAD_ADDR)) { 260 260 of_node_put(dn); 261 - return err; 261 + return -EINVAL; 262 262 } 263 263 264 264 /* If cpu2 or cpu3 is enabled */ ··· 288 288 struct clk_init_data init; 289 289 const char *parent_name; 290 290 struct clk *parent; 291 - int cpu, err; 291 + u64 cpu; 292 292 293 - err = of_property_read_u32(dn, "reg", &cpu); 294 - if (WARN_ON(err)) { 293 + cpu = of_get_cpu_hwid(dn, 0); 294 + if (WARN_ON(cpu == OF_BAD_ADDR)) { 295 295 of_node_put(dn); 296 - return err; 296 + return -EINVAL; 297 297 } 298 298 299 299 cluster_index = cpu & APN806_CLUSTER_NUM_MASK;
+3 -5
drivers/clk/mvebu/armada_ap_cp_helper.c
··· 16 16 char *ap_cp_unique_name(struct device *dev, struct device_node *np, 17 17 const char *name) 18 18 { 19 - const __be32 *reg; 20 - u64 addr; 19 + struct resource res; 21 20 22 21 /* Do not create a name if there is no clock */ 23 22 if (!name) 24 23 return NULL; 25 24 26 - reg = of_get_property(np, "reg", NULL); 27 - addr = of_translate_address(np, reg); 25 + of_address_to_resource(np, 0, &res); 28 26 return devm_kasprintf(dev, GFP_KERNEL, "%llx-%s", 29 - (unsigned long long)addr, name); 27 + (unsigned long long)res.start, name); 30 28 }
+3 -11
drivers/clk/mvebu/clk-cpu.c
··· 168 168 struct cpu_clk *cpuclk; 169 169 void __iomem *clock_complex_base = of_iomap(node, 0); 170 170 void __iomem *pmu_dfs_base = of_iomap(node, 1); 171 - int ncpus = 0; 172 - struct device_node *dn; 171 + int ncpus = num_possible_cpus(); 172 + int cpu; 173 173 174 174 if (clock_complex_base == NULL) { 175 175 pr_err("%s: clock-complex base register not set\n", ··· 181 181 pr_warn("%s: pmu-dfs base register not set, dynamic frequency scaling not available\n", 182 182 __func__); 183 183 184 - for_each_of_cpu_node(dn) 185 - ncpus++; 186 - 187 184 cpuclk = kcalloc(ncpus, sizeof(*cpuclk), GFP_KERNEL); 188 185 if (WARN_ON(!cpuclk)) 189 186 goto cpuclk_out; ··· 189 192 if (WARN_ON(!clks)) 190 193 goto clks_out; 191 194 192 - for_each_of_cpu_node(dn) { 195 + for_each_possible_cpu(cpu) { 193 196 struct clk_init_data init; 194 197 struct clk *clk; 195 198 char *clk_name = kzalloc(5, GFP_KERNEL); 196 - int cpu, err; 197 199 198 200 if (WARN_ON(!clk_name)) 199 - goto bail_out; 200 - 201 - err = of_property_read_u32(dn, "reg", &cpu); 202 - if (WARN_ON(err)) 203 201 goto bail_out; 204 202 205 203 sprintf(clk_name, "cpu%d", cpu);
+1
drivers/clk/pxa/clk-pxa.c
··· 82 82 } 83 83 84 84 static const struct clk_ops cken_mux_ops = { 85 + .determine_rate = clk_hw_determine_rate_no_reparent, 85 86 .get_parent = cken_get_parent, 86 87 .set_parent = dummy_clk_set_parent, 87 88 };
+7 -11
drivers/clk/renesas/clk-mstp.c
··· 14 14 #include <linux/clk/renesas.h> 15 15 #include <linux/device.h> 16 16 #include <linux/io.h> 17 + #include <linux/iopoll.h> 17 18 #include <linux/of.h> 18 19 #include <linux/of_address.h> 19 20 #include <linux/pm_clock.h> ··· 79 78 struct mstp_clock_group *group = clock->group; 80 79 u32 bitmask = BIT(clock->bit_index); 81 80 unsigned long flags; 82 - unsigned int i; 83 81 u32 value; 82 + int ret; 84 83 85 84 spin_lock_irqsave(&group->lock, flags); 86 85 ··· 102 101 if (!enable || !group->mstpsr) 103 102 return 0; 104 103 105 - for (i = 1000; i > 0; --i) { 106 - if (!(cpg_mstp_read(group, group->mstpsr) & bitmask)) 107 - break; 108 - cpu_relax(); 109 - } 110 - 111 - if (!i) { 104 + /* group->width_8bit is always false if group->mstpsr is present */ 105 + ret = readl_poll_timeout_atomic(group->mstpsr, value, 106 + !(value & bitmask), 0, 10); 107 + if (ret) 112 108 pr_err("%s: failed to enable %p[%d]\n", __func__, 113 109 group->smstpcr, clock->bit_index); 114 - return -ETIMEDOUT; 115 - } 116 110 117 - return 0; 111 + return ret; 118 112 } 119 113 120 114 static int cpg_mstp_clock_enable(struct clk_hw *hw)
+1
drivers/clk/renesas/r8a779a0-cpg-mssr.c
··· 170 170 DEF_MOD("msi3", 621, R8A779A0_CLK_MSO), 171 171 DEF_MOD("msi4", 622, R8A779A0_CLK_MSO), 172 172 DEF_MOD("msi5", 623, R8A779A0_CLK_MSO), 173 + DEF_MOD("pwm0", 628, R8A779A0_CLK_S1D8), 173 174 DEF_MOD("rpc-if", 629, R8A779A0_CLK_RPCD2), 174 175 DEF_MOD("scif0", 702, R8A779A0_CLK_S1D8), 175 176 DEF_MOD("scif1", 703, R8A779A0_CLK_S1D8),
+1
drivers/clk/renesas/r9a06g032-clocks.c
··· 1121 1121 } 1122 1122 1123 1123 static const struct clk_ops clk_bitselect_ops = { 1124 + .determine_rate = clk_hw_determine_rate_no_reparent, 1124 1125 .get_parent = r9a06g032_clk_mux_get_parent, 1125 1126 .set_parent = r9a06g032_clk_mux_set_parent, 1126 1127 };
+11 -20
drivers/clk/renesas/renesas-cpg-mssr.c
··· 17 17 #include <linux/device.h> 18 18 #include <linux/init.h> 19 19 #include <linux/io.h> 20 + #include <linux/iopoll.h> 20 21 #include <linux/mod_devicetable.h> 21 22 #include <linux/module.h> 22 23 #include <linux/of_address.h> ··· 197 196 struct device *dev = priv->dev; 198 197 u32 bitmask = BIT(bit); 199 198 unsigned long flags; 200 - unsigned int i; 201 199 u32 value; 200 + int error; 202 201 203 202 dev_dbg(dev, "MSTP %u%02u/%pC %s\n", reg, bit, hw->clk, 204 203 enable ? "ON" : "OFF"); ··· 229 228 if (!enable || priv->reg_layout == CLK_REG_LAYOUT_RZ_A) 230 229 return 0; 231 230 232 - for (i = 1000; i > 0; --i) { 233 - if (!(readl(priv->base + priv->status_regs[reg]) & bitmask)) 234 - break; 235 - cpu_relax(); 236 - } 237 - 238 - if (!i) { 231 + error = readl_poll_timeout_atomic(priv->base + priv->status_regs[reg], 232 + value, !(value & bitmask), 0, 10); 233 + if (error) 239 234 dev_err(dev, "Failed to enable SMSTP %p[%d]\n", 240 235 priv->base + priv->control_regs[reg], bit); 241 - return -ETIMEDOUT; 242 - } 243 236 244 - return 0; 237 + return error; 245 238 } 246 239 247 240 static int cpg_mstp_clock_enable(struct clk_hw *hw) ··· 891 896 static int cpg_mssr_resume_noirq(struct device *dev) 892 897 { 893 898 struct cpg_mssr_priv *priv = dev_get_drvdata(dev); 894 - unsigned int reg, i; 899 + unsigned int reg; 895 900 u32 mask, oldval, newval; 901 + int error; 896 902 897 903 /* This is the best we can do to check for the presence of PSCI */ 898 904 if (!psci_ops.cpu_suspend) ··· 931 935 if (!mask) 932 936 continue; 933 937 934 - for (i = 1000; i > 0; --i) { 935 - oldval = readl(priv->base + priv->status_regs[reg]); 936 - if (!(oldval & mask)) 937 - break; 938 - cpu_relax(); 939 - } 940 - 941 - if (!i) 938 + error = readl_poll_timeout_atomic(priv->base + priv->status_regs[reg], 939 + oldval, !(oldval & mask), 0, 10); 940 + if (error) 942 941 dev_warn(dev, "Failed to enable SMSTP%u[0x%x]\n", reg, 943 942 oldval & mask); 944 943 }
+7 -15
drivers/clk/renesas/rzg2l-cpg.c
··· 603 603 } 604 604 605 605 /* Output clock setting 1 */ 606 - writel(CPG_SIPLL5_CLK1_POSTDIV1_WEN | CPG_SIPLL5_CLK1_POSTDIV2_WEN | 607 - CPG_SIPLL5_CLK1_REFDIV_WEN | (params.pl5_postdiv1 << 0) | 608 - (params.pl5_postdiv2 << 4) | (params.pl5_refdiv << 8), 609 - priv->base + CPG_SIPLL5_CLK1); 606 + writel((params.pl5_postdiv1 << 0) | (params.pl5_postdiv2 << 4) | 607 + (params.pl5_refdiv << 8), priv->base + CPG_SIPLL5_CLK1); 610 608 611 609 /* Output clock setting, SSCG modulation value setting 3 */ 612 610 writel((params.pl5_fracin << 8), priv->base + CPG_SIPLL5_CLK3); ··· 903 905 unsigned int reg = clock->off; 904 906 struct device *dev = priv->dev; 905 907 unsigned long flags; 906 - unsigned int i; 907 908 u32 bitmask = BIT(clock->bit); 908 909 u32 value; 910 + int error; 909 911 910 912 if (!clock->off) { 911 913 dev_dbg(dev, "%pC does not support ON/OFF\n", hw->clk); ··· 930 932 if (!priv->info->has_clk_mon_regs) 931 933 return 0; 932 934 933 - for (i = 1000; i > 0; --i) { 934 - if (((readl(priv->base + CLK_MON_R(reg))) & bitmask)) 935 - break; 936 - cpu_relax(); 937 - } 938 - 939 - if (!i) { 935 + error = readl_poll_timeout_atomic(priv->base + CLK_MON_R(reg), value, 936 + value & bitmask, 0, 10); 937 + if (error) 940 938 dev_err(dev, "Failed to enable CLK_ON %p\n", 941 939 priv->base + CLK_ON_R(reg)); 942 - return -ETIMEDOUT; 943 - } 944 940 945 - return 0; 941 + return error; 946 942 } 947 943 948 944 static int rzg2l_mod_clock_enable(struct clk_hw *hw)
-3
drivers/clk/renesas/rzg2l-cpg.h
··· 32 32 #define CPG_SIPLL5_STBY_RESETB_WEN BIT(16) 33 33 #define CPG_SIPLL5_STBY_SSCG_EN_WEN BIT(18) 34 34 #define CPG_SIPLL5_STBY_DOWNSPREAD_WEN BIT(20) 35 - #define CPG_SIPLL5_CLK1_POSTDIV1_WEN BIT(16) 36 - #define CPG_SIPLL5_CLK1_POSTDIV2_WEN BIT(20) 37 - #define CPG_SIPLL5_CLK1_REFDIV_WEN BIT(24) 38 35 #define CPG_SIPLL5_CLK4_RESV_LSB (0xFF) 39 36 #define CPG_SIPLL5_MON_PLL5_LOCK BIT(4) 40 37
+1
drivers/clk/samsung/Kconfig
··· 2 2 # Recent Exynos platforms should just select COMMON_CLK_SAMSUNG: 3 3 config COMMON_CLK_SAMSUNG 4 4 bool "Samsung Exynos clock controller support" if COMPILE_TEST 5 + depends on OF 5 6 select S3C64XX_COMMON_CLK if ARM && ARCH_S3C64XX 6 7 select S5PV210_COMMON_CLK if ARM && ARCH_S5PV210 7 8 select EXYNOS_3250_COMMON_CLK if ARM && SOC_EXYNOS3250
+3
drivers/clk/samsung/clk-exynos-clkout.c
··· 56 56 .compatible = "samsung,exynos4210-pmu", 57 57 .data = &exynos_clkout_exynos4, 58 58 }, { 59 + .compatible = "samsung,exynos4212-pmu", 60 + .data = &exynos_clkout_exynos4, 61 + }, { 59 62 .compatible = "samsung,exynos4412-pmu", 60 63 .data = &exynos_clkout_exynos4, 61 64 }, {
+39 -5
drivers/clk/samsung/clk-exynos4.c
··· 138 138 /* the exynos4 soc type */ 139 139 enum exynos4_soc { 140 140 EXYNOS4210, 141 - EXYNOS4X12, 141 + EXYNOS4212, 142 + EXYNOS4412, 142 143 }; 143 144 144 145 /* list of PLLs to be registered */ ··· 1206 1205 { 0 }, 1207 1206 }; 1208 1207 1208 + static const struct exynos_cpuclk_cfg_data e4212_armclk_d[] __initconst = { 1209 + { 1500000, E4210_CPU_DIV0(2, 1, 6, 0, 7, 3), E4210_CPU_DIV1(2, 6), }, 1210 + { 1400000, E4210_CPU_DIV0(2, 1, 6, 0, 7, 3), E4210_CPU_DIV1(2, 6), }, 1211 + { 1300000, E4210_CPU_DIV0(2, 1, 5, 0, 7, 3), E4210_CPU_DIV1(2, 5), }, 1212 + { 1200000, E4210_CPU_DIV0(2, 1, 5, 0, 7, 3), E4210_CPU_DIV1(2, 5), }, 1213 + { 1100000, E4210_CPU_DIV0(2, 1, 4, 0, 6, 3), E4210_CPU_DIV1(2, 4), }, 1214 + { 1000000, E4210_CPU_DIV0(1, 1, 4, 0, 5, 2), E4210_CPU_DIV1(2, 4), }, 1215 + { 900000, E4210_CPU_DIV0(1, 1, 3, 0, 5, 2), E4210_CPU_DIV1(2, 3), }, 1216 + { 800000, E4210_CPU_DIV0(1, 1, 3, 0, 5, 2), E4210_CPU_DIV1(2, 3), }, 1217 + { 700000, E4210_CPU_DIV0(1, 1, 3, 0, 4, 2), E4210_CPU_DIV1(2, 3), }, 1218 + { 600000, E4210_CPU_DIV0(1, 1, 3, 0, 4, 2), E4210_CPU_DIV1(2, 3), }, 1219 + { 500000, E4210_CPU_DIV0(1, 1, 3, 0, 4, 2), E4210_CPU_DIV1(2, 3), }, 1220 + { 400000, E4210_CPU_DIV0(1, 1, 3, 0, 4, 2), E4210_CPU_DIV1(2, 3), }, 1221 + { 300000, E4210_CPU_DIV0(1, 1, 2, 0, 4, 2), E4210_CPU_DIV1(2, 3), }, 1222 + { 200000, E4210_CPU_DIV0(1, 1, 1, 0, 3, 1), E4210_CPU_DIV1(2, 3), }, 1223 + { 0 }, 1224 + }; 1225 + 1209 1226 #define E4412_CPU_DIV1(cores, hpm, copy) \ 1210 1227 (((cores) << 8) | ((hpm) << 4) | ((copy) << 0)) 1211 1228 ··· 1250 1231 static const struct samsung_cpu_clock exynos4210_cpu_clks[] __initconst = { 1251 1232 CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_SCLK_MPLL, 1252 1233 CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1, 0x14200, e4210_armclk_d), 1234 + }; 1235 + 1236 + static const struct samsung_cpu_clock exynos4212_cpu_clks[] __initconst = { 1237 + CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MPLL_USER_C, 1238 + CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1, 0x14200, e4212_armclk_d), 1253 1239 }; 1254 1240 1255 1241 static const struct samsung_cpu_clock exynos4412_cpu_clks[] __initconst = { ··· 1350 1326 samsung_clk_register_fixed_factor(ctx, 1351 1327 exynos4x12_fixed_factor_clks, 1352 1328 ARRAY_SIZE(exynos4x12_fixed_factor_clks)); 1353 - samsung_clk_register_cpu(ctx, exynos4412_cpu_clks, 1354 - ARRAY_SIZE(exynos4412_cpu_clks)); 1329 + if (soc == EXYNOS4412) 1330 + samsung_clk_register_cpu(ctx, exynos4412_cpu_clks, 1331 + ARRAY_SIZE(exynos4412_cpu_clks)); 1332 + else 1333 + samsung_clk_register_cpu(ctx, exynos4212_cpu_clks, 1334 + ARRAY_SIZE(exynos4212_cpu_clks)); 1355 1335 } 1356 1336 1357 - if (soc == EXYNOS4X12) 1337 + if (soc == EXYNOS4212 || soc == EXYNOS4412) 1358 1338 exynos4x12_core_down_clock(); 1359 1339 1360 1340 samsung_clk_extended_sleep_init(reg_base, ··· 1391 1363 } 1392 1364 CLK_OF_DECLARE(exynos4210_clk, "samsung,exynos4210-clock", exynos4210_clk_init); 1393 1365 1366 + static void __init exynos4212_clk_init(struct device_node *np) 1367 + { 1368 + exynos4_clk_init(np, EXYNOS4212); 1369 + } 1370 + CLK_OF_DECLARE(exynos4212_clk, "samsung,exynos4212-clock", exynos4212_clk_init); 1371 + 1394 1372 static void __init exynos4412_clk_init(struct device_node *np) 1395 1373 { 1396 - exynos4_clk_init(np, EXYNOS4X12); 1374 + exynos4_clk_init(np, EXYNOS4412); 1397 1375 } 1398 1376 CLK_OF_DECLARE(exynos4412_clk, "samsung,exynos4412-clock", exynos4412_clk_init);
+1 -3
drivers/clk/sifive/sifive-prci.c
··· 567 567 static int sifive_prci_probe(struct platform_device *pdev) 568 568 { 569 569 struct device *dev = &pdev->dev; 570 - struct resource *res; 571 570 struct __prci_data *pd; 572 571 const struct prci_clk_desc *desc; 573 572 int r; ··· 577 578 if (!pd) 578 579 return -ENOMEM; 579 580 580 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 581 - pd->va = devm_ioremap_resource(dev, res); 581 + pd->va = devm_platform_ioremap_resource(pdev, 0); 582 582 if (IS_ERR(pd->va)) 583 583 return PTR_ERR(pd->va); 584 584
+1
drivers/clk/socfpga/clk-gate.c
··· 110 110 111 111 static struct clk_ops gateclk_ops = { 112 112 .recalc_rate = socfpga_clk_recalc_rate, 113 + .determine_rate = clk_hw_determine_rate_no_reparent, 113 114 .get_parent = socfpga_clk_get_parent, 114 115 .set_parent = socfpga_clk_set_parent, 115 116 };
+4 -5
drivers/clk/sprd/composite.c
··· 9 9 10 10 #include "composite.h" 11 11 12 - static long sprd_comp_round_rate(struct clk_hw *hw, unsigned long rate, 13 - unsigned long *parent_rate) 12 + static int sprd_comp_determine_rate(struct clk_hw *hw, 13 + struct clk_rate_request *req) 14 14 { 15 15 struct sprd_comp *cc = hw_to_sprd_comp(hw); 16 16 17 - return sprd_div_helper_round_rate(&cc->common, &cc->div, 18 - rate, parent_rate); 17 + return divider_determine_rate(hw, req, NULL, cc->div.width, 0); 19 18 } 20 19 21 20 static unsigned long sprd_comp_recalc_rate(struct clk_hw *hw, ··· 52 53 .get_parent = sprd_comp_get_parent, 53 54 .set_parent = sprd_comp_set_parent, 54 55 55 - .round_rate = sprd_comp_round_rate, 56 + .determine_rate = sprd_comp_determine_rate, 56 57 .recalc_rate = sprd_comp_recalc_rate, 57 58 .set_rate = sprd_comp_set_rate, 58 59 };
+2 -12
drivers/clk/sprd/div.c
··· 9 9 10 10 #include "div.h" 11 11 12 - long sprd_div_helper_round_rate(struct sprd_clk_common *common, 13 - const struct sprd_div_internal *div, 14 - unsigned long rate, 15 - unsigned long *parent_rate) 16 - { 17 - return divider_round_rate(&common->hw, rate, parent_rate, 18 - NULL, div->width, 0); 19 - } 20 - EXPORT_SYMBOL_GPL(sprd_div_helper_round_rate); 21 - 22 12 static long sprd_div_round_rate(struct clk_hw *hw, unsigned long rate, 23 13 unsigned long *parent_rate) 24 14 { 25 15 struct sprd_div *cd = hw_to_sprd_div(hw); 26 16 27 - return sprd_div_helper_round_rate(&cd->common, &cd->div, 28 - rate, parent_rate); 17 + return divider_round_rate(&cd->common.hw, rate, parent_rate, NULL, 18 + cd->div.width, 0); 29 19 } 30 20 31 21 unsigned long sprd_div_helper_recalc_rate(struct sprd_clk_common *common,
-5
drivers/clk/sprd/div.h
··· 64 64 return container_of(common, struct sprd_div, common); 65 65 } 66 66 67 - long sprd_div_helper_round_rate(struct sprd_clk_common *common, 68 - const struct sprd_div_internal *div, 69 - unsigned long rate, 70 - unsigned long *parent_rate); 71 - 72 67 unsigned long sprd_div_helper_recalc_rate(struct sprd_clk_common *common, 73 68 const struct sprd_div_internal *div, 74 69 unsigned long parent_rate);
+8 -7
drivers/clk/st/clk-flexgen.c
··· 119 119 return parent_rate / rate + ((rate > (2*(parent_rate % rate))) ? 0 : 1); 120 120 } 121 121 122 - static long flexgen_round_rate(struct clk_hw *hw, unsigned long rate, 123 - unsigned long *prate) 122 + static int flexgen_determine_rate(struct clk_hw *hw, 123 + struct clk_rate_request *req) 124 124 { 125 125 unsigned long div; 126 126 127 127 /* Round div according to exact prate and wished rate */ 128 - div = clk_best_div(*prate, rate); 128 + div = clk_best_div(req->best_parent_rate, req->rate); 129 129 130 130 if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) { 131 - *prate = rate * div; 132 - return rate; 131 + req->best_parent_rate = req->rate * div; 132 + return 0; 133 133 } 134 134 135 - return *prate / div; 135 + req->rate = req->best_parent_rate / div; 136 + return 0; 136 137 } 137 138 138 139 static unsigned long flexgen_recalc_rate(struct clk_hw *hw, ··· 198 197 .is_enabled = flexgen_is_enabled, 199 198 .get_parent = flexgen_get_parent, 200 199 .set_parent = flexgen_set_parent, 201 - .round_rate = flexgen_round_rate, 200 + .determine_rate = flexgen_determine_rate, 202 201 .recalc_rate = flexgen_recalc_rate, 203 202 .set_rate = flexgen_set_rate, 204 203 };
+22 -11
drivers/clk/stm32/clk-stm32-core.c
··· 275 275 } 276 276 277 277 const struct clk_ops clk_stm32_mux_ops = { 278 + .determine_rate = __clk_mux_determine_rate, 278 279 .get_parent = clk_stm32_mux_get_parent, 279 280 .set_parent = clk_stm32_mux_set_parent, 280 281 }; ··· 426 425 composite->div_id, parent_rate); 427 426 } 428 427 429 - static long clk_stm32_composite_round_rate(struct clk_hw *hw, unsigned long rate, 430 - unsigned long *prate) 428 + static int clk_stm32_composite_determine_rate(struct clk_hw *hw, 429 + struct clk_rate_request *req) 431 430 { 432 431 struct clk_stm32_composite *composite = to_clk_stm32_composite(hw); 433 - 434 432 const struct stm32_div_cfg *divider; 433 + unsigned long rate; 435 434 436 435 if (composite->div_id == NO_STM32_DIV) 437 - return rate; 436 + return 0; 438 437 439 438 divider = &composite->clock_data->dividers[composite->div_id]; 440 439 ··· 445 444 val = readl(composite->base + divider->offset) >> divider->shift; 446 445 val &= clk_div_mask(divider->width); 447 446 448 - return divider_ro_round_rate(hw, rate, prate, divider->table, 449 - divider->width, divider->flags, 450 - val); 447 + rate = divider_ro_round_rate(hw, req->rate, &req->best_parent_rate, 448 + divider->table, divider->width, divider->flags, 449 + val); 450 + if (rate < 0) 451 + return rate; 452 + 453 + req->rate = rate; 454 + return 0; 451 455 } 452 456 453 - return divider_round_rate_parent(hw, clk_hw_get_parent(hw), 454 - rate, prate, divider->table, 455 - divider->width, divider->flags); 457 + rate = divider_round_rate_parent(hw, clk_hw_get_parent(hw), 458 + req->rate, &req->best_parent_rate, 459 + divider->table, divider->width, divider->flags); 460 + if (rate < 0) 461 + return rate; 462 + 463 + req->rate = rate; 464 + return 0; 456 465 } 457 466 458 467 static u8 clk_stm32_composite_get_parent(struct clk_hw *hw) ··· 612 601 const struct clk_ops clk_stm32_composite_ops = { 613 602 .set_rate = clk_stm32_composite_set_rate, 614 603 .recalc_rate = clk_stm32_composite_recalc_rate, 615 - .round_rate = clk_stm32_composite_round_rate, 604 + .determine_rate = clk_stm32_composite_determine_rate, 616 605 .get_parent = clk_stm32_composite_get_parent, 617 606 .set_parent = clk_stm32_composite_set_parent, 618 607 .enable = clk_stm32_composite_gate_enable,
+13 -1
drivers/clk/sunxi-ng/ccu-sun50i-a64.c
··· 528 528 0x104, 0, 4, 24, 3, BIT(31), 529 529 CLK_SET_RATE_PARENT); 530 530 531 + /* 532 + * DSI output seems to work only when PLL_MIPI selected. Set it and prevent 533 + * the mux from reparenting. 534 + */ 535 + #define SUN50I_A64_TCON0_CLK_REG 0x118 536 + 531 537 static const char * const tcon0_parents[] = { "pll-mipi", "pll-video0-2x" }; 532 538 static const u8 tcon0_table[] = { 0, 2, }; 533 539 static SUNXI_CCU_MUX_TABLE_WITH_GATE(tcon0_clk, "tcon0", tcon0_parents, 534 540 tcon0_table, 0x118, 24, 3, BIT(31), 535 - CLK_SET_RATE_PARENT); 541 + CLK_SET_RATE_PARENT | 542 + CLK_SET_RATE_NO_REPARENT); 536 543 537 544 static const char * const tcon1_parents[] = { "pll-video0", "pll-video1" }; 538 545 static const u8 tcon1_table[] = { 0, 2, }; ··· 959 952 writel(val | (0 << 16), reg + SUN50I_A64_PLL_AUDIO_REG); 960 953 961 954 writel(0x515, reg + SUN50I_A64_PLL_MIPI_REG); 955 + 956 + /* Set PLL MIPI as parent for TCON0 */ 957 + val = readl(reg + SUN50I_A64_TCON0_CLK_REG); 958 + val &= ~GENMASK(26, 24); 959 + writel(val | (0 << 24), reg + SUN50I_A64_TCON0_CLK_REG); 962 960 963 961 ret = devm_sunxi_ccu_probe(&pdev->dev, reg, &sun50i_a64_ccu_desc); 964 962 if (ret)
+1
drivers/clk/tegra/clk-bpmp.c
··· 286 286 .unprepare = tegra_bpmp_clk_unprepare, 287 287 .is_prepared = tegra_bpmp_clk_is_prepared, 288 288 .recalc_rate = tegra_bpmp_clk_recalc_rate, 289 + .determine_rate = clk_hw_determine_rate_no_reparent, 289 290 .set_parent = tegra_bpmp_clk_set_parent, 290 291 .get_parent = tegra_bpmp_clk_get_parent, 291 292 };
+12 -5
drivers/clk/tegra/clk-periph.c
··· 45 45 return div_ops->recalc_rate(div_hw, parent_rate); 46 46 } 47 47 48 - static long clk_periph_round_rate(struct clk_hw *hw, unsigned long rate, 49 - unsigned long *prate) 48 + static int clk_periph_determine_rate(struct clk_hw *hw, 49 + struct clk_rate_request *req) 50 50 { 51 51 struct tegra_clk_periph *periph = to_clk_periph(hw); 52 52 const struct clk_ops *div_ops = periph->div_ops; 53 53 struct clk_hw *div_hw = &periph->divider.hw; 54 + unsigned long rate; 54 55 55 56 __clk_hw_set_clk(div_hw, hw); 56 57 57 - return div_ops->round_rate(div_hw, rate, prate); 58 + rate = div_ops->round_rate(div_hw, req->rate, &req->best_parent_rate); 59 + if (rate < 0) 60 + return rate; 61 + 62 + req->rate = rate; 63 + return 0; 58 64 } 59 65 60 66 static int clk_periph_set_rate(struct clk_hw *hw, unsigned long rate, ··· 136 130 .get_parent = clk_periph_get_parent, 137 131 .set_parent = clk_periph_set_parent, 138 132 .recalc_rate = clk_periph_recalc_rate, 139 - .round_rate = clk_periph_round_rate, 133 + .determine_rate = clk_periph_determine_rate, 140 134 .set_rate = clk_periph_set_rate, 141 135 .is_enabled = clk_periph_is_enabled, 142 136 .enable = clk_periph_enable, ··· 146 140 }; 147 141 148 142 static const struct clk_ops tegra_clk_periph_nodiv_ops = { 143 + .determine_rate = clk_hw_determine_rate_no_reparent, 149 144 .get_parent = clk_periph_get_parent, 150 145 .set_parent = clk_periph_set_parent, 151 146 .is_enabled = clk_periph_is_enabled, ··· 160 153 .get_parent = clk_periph_get_parent, 161 154 .set_parent = clk_periph_set_parent, 162 155 .recalc_rate = clk_periph_recalc_rate, 163 - .round_rate = clk_periph_round_rate, 156 + .determine_rate = clk_periph_determine_rate, 164 157 .set_rate = clk_periph_set_rate, 165 158 .restore_context = clk_periph_restore_context, 166 159 };
+12 -4
drivers/clk/tegra/clk-super.c
··· 136 136 } 137 137 138 138 static const struct clk_ops tegra_clk_super_mux_ops = { 139 + .determine_rate = clk_hw_determine_rate_no_reparent, 139 140 .get_parent = clk_super_get_parent, 140 141 .set_parent = clk_super_set_parent, 141 142 .restore_context = clk_super_mux_restore_context, 142 143 }; 143 144 144 - static long clk_super_round_rate(struct clk_hw *hw, unsigned long rate, 145 - unsigned long *parent_rate) 145 + static int clk_super_determine_rate(struct clk_hw *hw, 146 + struct clk_rate_request *req) 146 147 { 147 148 struct tegra_clk_super_mux *super = to_clk_super_mux(hw); 148 149 struct clk_hw *div_hw = &super->frac_div.hw; 150 + unsigned long rate; 149 151 150 152 __clk_hw_set_clk(div_hw, hw); 151 153 152 - return super->div_ops->round_rate(div_hw, rate, parent_rate); 154 + rate = super->div_ops->round_rate(div_hw, req->rate, 155 + &req->best_parent_rate); 156 + if (rate < 0) 157 + return rate; 158 + 159 + req->rate = rate; 160 + return 0; 153 161 } 154 162 155 163 static unsigned long clk_super_recalc_rate(struct clk_hw *hw, ··· 200 192 .get_parent = clk_super_get_parent, 201 193 .set_parent = clk_super_set_parent, 202 194 .set_rate = clk_super_set_rate, 203 - .round_rate = clk_super_round_rate, 195 + .determine_rate = clk_super_determine_rate, 204 196 .recalc_rate = clk_super_recalc_rate, 205 197 .restore_context = clk_super_restore_context, 206 198 };
+2
drivers/clk/tegra/clk-tegra124-emc.c
··· 464 464 err = load_one_timing_from_dt(tegra, timing, child); 465 465 if (err) { 466 466 of_node_put(child); 467 + kfree(tegra->timings); 467 468 return err; 468 469 } 469 470 ··· 516 515 err = load_timings_from_dt(tegra, node, node_ram_code); 517 516 if (err) { 518 517 of_node_put(node); 518 + kfree(tegra); 519 519 return ERR_PTR(err); 520 520 } 521 521 }
+7
drivers/clk/ti/clkctrl.c
··· 258 258 if (clkctrl_name && !legacy_naming) { 259 259 clock_name = kasprintf(GFP_KERNEL, "%s-clkctrl:%04x:%d", 260 260 clkctrl_name, offset, index); 261 + if (!clock_name) 262 + return NULL; 263 + 261 264 strreplace(clock_name, '_', '-'); 262 265 263 266 return clock_name; ··· 589 586 if (clkctrl_name) { 590 587 provider->clkdm_name = kasprintf(GFP_KERNEL, 591 588 "%s_clkdm", clkctrl_name); 589 + if (!provider->clkdm_name) { 590 + kfree(provider); 591 + return; 592 + } 592 593 goto clkdm_found; 593 594 } 594 595
+1
drivers/clk/ux500/clk-prcmu.c
··· 344 344 .prepare = clk_prcmu_clkout_prepare, 345 345 .unprepare = clk_prcmu_clkout_unprepare, 346 346 .recalc_rate = clk_prcmu_clkout_recalc_rate, 347 + .determine_rate = clk_hw_determine_rate_no_reparent, 347 348 .get_parent = clk_prcmu_clkout_get_parent, 348 349 .set_parent = clk_prcmu_clkout_set_parent, 349 350 };
+1
drivers/clk/ux500/clk-sysctrl.c
··· 110 110 }; 111 111 112 112 static const struct clk_ops clk_sysctrl_set_parent_ops = { 113 + .determine_rate = clk_hw_determine_rate_no_reparent, 113 114 .set_parent = clk_sysctrl_set_parent, 114 115 .get_parent = clk_sysctrl_get_parent, 115 116 };
+1
drivers/clk/versatile/clk-sp810.c
··· 63 63 } 64 64 65 65 static const struct clk_ops clk_sp810_timerclken_ops = { 66 + .determine_rate = clk_hw_determine_rate_no_reparent, 66 67 .get_parent = clk_sp810_timerclken_get_parent, 67 68 .set_parent = clk_sp810_timerclken_set_parent, 68 69 };
+6 -1
drivers/clk/xilinx/clk-xlnx-clock-wizard.c
··· 525 525 hw = &div->hw; 526 526 ret = devm_clk_hw_register(dev, hw); 527 527 if (ret) 528 - hw = ERR_PTR(ret); 528 + return ERR_PTR(ret); 529 529 530 530 return hw->clk; 531 531 } ··· 648 648 } 649 649 650 650 clkout_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s_out0", dev_name(&pdev->dev)); 651 + if (!clkout_name) { 652 + ret = -ENOMEM; 653 + goto err_disable_clk; 654 + } 655 + 651 656 if (nr_outputs == 1) { 652 657 clk_wzrd->clkout[0] = clk_wzrd_register_divider 653 658 (&pdev->dev, clkout_name,
+1
drivers/gpu/drm/tegra/sor.c
··· 586 586 } 587 587 588 588 static const struct clk_ops tegra_clk_sor_pad_ops = { 589 + .determine_rate = clk_hw_determine_rate_no_reparent, 589 590 .set_parent = tegra_clk_sor_pad_set_parent, 590 591 .get_parent = tegra_clk_sor_pad_get_parent, 591 592 };
+1
drivers/phy/cadence/phy-cadence-sierra.c
··· 720 720 } 721 721 722 722 static const struct clk_ops cdns_sierra_pll_mux_ops = { 723 + .determine_rate = __clk_mux_determine_rate, 723 724 .set_parent = cdns_sierra_pll_mux_set_parent, 724 725 .get_parent = cdns_sierra_pll_mux_get_parent, 725 726 };
+1
drivers/phy/cadence/phy-cadence-torrent.c
··· 1861 1861 .enable = cdns_torrent_refclk_driver_enable, 1862 1862 .disable = cdns_torrent_refclk_driver_disable, 1863 1863 .is_enabled = cdns_torrent_refclk_driver_is_enabled, 1864 + .determine_rate = __clk_mux_determine_rate, 1864 1865 .set_parent = cdns_torrent_refclk_driver_set_parent, 1865 1866 .get_parent = cdns_torrent_refclk_driver_get_parent, 1866 1867 };
+1
drivers/phy/ti/phy-am654-serdes.c
··· 634 634 } 635 635 636 636 static const struct clk_ops serdes_am654_clk_mux_ops = { 637 + .determine_rate = __clk_mux_determine_rate, 637 638 .set_parent = serdes_am654_clk_mux_set_parent, 638 639 .get_parent = serdes_am654_clk_mux_get_parent, 639 640 };
+1
drivers/phy/ti/phy-j721e-wiz.c
··· 801 801 } 802 802 803 803 static const struct clk_ops wiz_clk_mux_ops = { 804 + .determine_rate = __clk_mux_determine_rate, 804 805 .set_parent = wiz_clk_mux_set_parent, 805 806 .get_parent = wiz_clk_mux_get_parent, 806 807 };
+1
drivers/rtc/rtc-sun6i.c
··· 214 214 215 215 static const struct clk_ops sun6i_rtc_osc_ops = { 216 216 .recalc_rate = sun6i_rtc_osc_recalc_rate, 217 + .determine_rate = clk_hw_determine_rate_no_reparent, 217 218 218 219 .get_parent = sun6i_rtc_osc_get_parent, 219 220 .set_parent = sun6i_rtc_osc_set_parent,
+115
include/dt-bindings/clock/amlogic,a1-peripherals-clkc.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ 2 + /* 3 + * Copyright (c) 2019 Amlogic, Inc. All rights reserved. 4 + * Author: Jian Hu <jian.hu@amlogic.com> 5 + * 6 + * Copyright (c) 2023, SberDevices. All Rights Reserved. 7 + * Author: Dmitry Rokosov <ddrokosov@sberdevices.ru> 8 + */ 9 + 10 + #ifndef __A1_PERIPHERALS_CLKC_H 11 + #define __A1_PERIPHERALS_CLKC_H 12 + 13 + #define CLKID_FIXPLL_IN 1 14 + #define CLKID_USB_PHY_IN 2 15 + #define CLKID_USB_CTRL_IN 3 16 + #define CLKID_HIFIPLL_IN 4 17 + #define CLKID_SYSPLL_IN 5 18 + #define CLKID_DDS_IN 6 19 + #define CLKID_SYS 7 20 + #define CLKID_CLKTREE 8 21 + #define CLKID_RESET_CTRL 9 22 + #define CLKID_ANALOG_CTRL 10 23 + #define CLKID_PWR_CTRL 11 24 + #define CLKID_PAD_CTRL 12 25 + #define CLKID_SYS_CTRL 13 26 + #define CLKID_TEMP_SENSOR 14 27 + #define CLKID_AM2AXI_DIV 15 28 + #define CLKID_SPICC_B 16 29 + #define CLKID_SPICC_A 17 30 + #define CLKID_MSR 18 31 + #define CLKID_AUDIO 19 32 + #define CLKID_JTAG_CTRL 20 33 + #define CLKID_SARADC_EN 21 34 + #define CLKID_PWM_EF 22 35 + #define CLKID_PWM_CD 23 36 + #define CLKID_PWM_AB 24 37 + #define CLKID_CEC 25 38 + #define CLKID_I2C_S 26 39 + #define CLKID_IR_CTRL 27 40 + #define CLKID_I2C_M_D 28 41 + #define CLKID_I2C_M_C 29 42 + #define CLKID_I2C_M_B 30 43 + #define CLKID_I2C_M_A 31 44 + #define CLKID_ACODEC 32 45 + #define CLKID_OTP 33 46 + #define CLKID_SD_EMMC_A 34 47 + #define CLKID_USB_PHY 35 48 + #define CLKID_USB_CTRL 36 49 + #define CLKID_SYS_DSPB 37 50 + #define CLKID_SYS_DSPA 38 51 + #define CLKID_DMA 39 52 + #define CLKID_IRQ_CTRL 40 53 + #define CLKID_NIC 41 54 + #define CLKID_GIC 42 55 + #define CLKID_UART_C 43 56 + #define CLKID_UART_B 44 57 + #define CLKID_UART_A 45 58 + #define CLKID_SYS_PSRAM 46 59 + #define CLKID_RSA 47 60 + #define CLKID_CORESIGHT 48 61 + #define CLKID_AM2AXI_VAD 49 62 + #define CLKID_AUDIO_VAD 50 63 + #define CLKID_AXI_DMC 51 64 + #define CLKID_AXI_PSRAM 52 65 + #define CLKID_RAMB 53 66 + #define CLKID_RAMA 54 67 + #define CLKID_AXI_SPIFC 55 68 + #define CLKID_AXI_NIC 56 69 + #define CLKID_AXI_DMA 57 70 + #define CLKID_CPU_CTRL 58 71 + #define CLKID_ROM 59 72 + #define CLKID_PROC_I2C 60 73 + #define CLKID_DSPA_EN 63 74 + #define CLKID_DSPA_EN_NIC 64 75 + #define CLKID_DSPB_EN 65 76 + #define CLKID_DSPB_EN_NIC 66 77 + #define CLKID_RTC 67 78 + #define CLKID_CECA_32K 68 79 + #define CLKID_CECB_32K 69 80 + #define CLKID_24M 70 81 + #define CLKID_12M 71 82 + #define CLKID_FCLK_DIV2_DIVN 72 83 + #define CLKID_GEN 73 84 + #define CLKID_SARADC 75 85 + #define CLKID_PWM_A 76 86 + #define CLKID_PWM_B 77 87 + #define CLKID_PWM_C 78 88 + #define CLKID_PWM_D 79 89 + #define CLKID_PWM_E 80 90 + #define CLKID_PWM_F 81 91 + #define CLKID_SPICC 82 92 + #define CLKID_TS 83 93 + #define CLKID_SPIFC 84 94 + #define CLKID_USB_BUS 85 95 + #define CLKID_SD_EMMC 86 96 + #define CLKID_PSRAM 87 97 + #define CLKID_DMC 88 98 + #define CLKID_DSPA_A_SEL 95 99 + #define CLKID_DSPA_B_SEL 98 100 + #define CLKID_DSPB_A_SEL 101 101 + #define CLKID_DSPB_B_SEL 104 102 + #define CLKID_CECB_32K_SEL_PRE 113 103 + #define CLKID_CECB_32K_SEL 114 104 + #define CLKID_CECA_32K_SEL_PRE 117 105 + #define CLKID_CECA_32K_SEL 118 106 + #define CLKID_GEN_SEL 121 107 + #define CLKID_PWM_A_SEL 124 108 + #define CLKID_PWM_B_SEL 126 109 + #define CLKID_PWM_C_SEL 128 110 + #define CLKID_PWM_D_SEL 130 111 + #define CLKID_PWM_E_SEL 132 112 + #define CLKID_PWM_F_SEL 134 113 + #define CLKID_SD_EMMC_SEL2 147 114 + 115 + #endif /* __A1_PERIPHERALS_CLKC_H */
+20
include/dt-bindings/clock/amlogic,a1-pll-clkc.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ 2 + /* 3 + * Copyright (c) 2019 Amlogic, Inc. All rights reserved. 4 + * Author: Jian Hu <jian.hu@amlogic.com> 5 + * 6 + * Copyright (c) 2023, SberDevices. All Rights Reserved. 7 + * Author: Dmitry Rokosov <ddrokosov@sberdevices.ru> 8 + */ 9 + 10 + #ifndef __A1_PLL_CLKC_H 11 + #define __A1_PLL_CLKC_H 12 + 13 + #define CLKID_FIXED_PLL 1 14 + #define CLKID_FCLK_DIV2 6 15 + #define CLKID_FCLK_DIV3 7 16 + #define CLKID_FCLK_DIV5 8 17 + #define CLKID_FCLK_DIV7 9 18 + #define CLKID_HIFI_PLL 10 19 + 20 + #endif /* __A1_PLL_CLKC_H */
+3 -3
include/dt-bindings/clock/stm32mp13-clks.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0+ or BSD-3-Clause */ 1 + /* SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause */ 2 2 /* 3 3 * Copyright (C) STMicroelectronics 2020 - All Rights Reserved 4 - * Author: Gabriel Fernandez <gabriel.fernandez@st.com> for STMicroelectronics. 4 + * Author: Gabriel Fernandez <gabriel.fernandez@foss.st.com> for STMicroelectronics. 5 5 */ 6 6 7 7 #ifndef _DT_BINDINGS_STM32MP13_CLKS_H_ ··· 64 64 #define CK_MCO1 38 65 65 #define CK_MCO2 39 66 66 67 - /* IP clocks */ 67 + /* IP clocks */ 68 68 #define SYSCFG 40 69 69 #define VREF 41 70 70 #define DTS 42
+5
include/dt-bindings/reset/mt8188-resets.h
··· 33 33 34 34 #define MT8188_TOPRGU_SW_RST_NUM 24 35 35 36 + /* INFRA resets */ 37 + #define MT8188_INFRA_RST1_THERMAL_MCU_RST 0 38 + #define MT8188_INFRA_RST1_THERMAL_CTRL_RST 1 39 + #define MT8188_INFRA_RST3_PTP_CTRL_RST 2 40 + 36 41 #endif /* _DT_BINDINGS_RESET_CONTROLLER_MT8188 */
+2 -2
include/dt-bindings/reset/stm32mp13-resets.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */ 1 + /* SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause */ 2 2 /* 3 3 * Copyright (C) STMicroelectronics 2018 - All Rights Reserved 4 - * Author: Gabriel Fernandez <gabriel.fernandez@st.com> for STMicroelectronics. 4 + * Author: Gabriel Fernandez <gabriel.fernandez@foss.st.com> for STMicroelectronics. 5 5 */ 6 6 7 7 #ifndef _DT_BINDINGS_STM32MP13_RESET_H_
+3 -1
include/linux/clk-provider.h
··· 415 415 * @flags: framework-specific flags 416 416 * @fixed_rate: non-adjustable clock rate 417 417 */ 418 - #define clk_hw_register_fixed_rate_parent_data(dev, name, parent_hw, flags, \ 418 + #define clk_hw_register_fixed_rate_parent_data(dev, name, parent_data, flags, \ 419 419 fixed_rate) \ 420 420 __clk_hw_register_fixed_rate((dev), NULL, (name), NULL, NULL, \ 421 421 (parent_data), (flags), (fixed_rate), 0, \ ··· 1333 1333 int clk_mux_determine_rate_flags(struct clk_hw *hw, 1334 1334 struct clk_rate_request *req, 1335 1335 unsigned long flags); 1336 + int clk_hw_determine_rate_no_reparent(struct clk_hw *hw, 1337 + struct clk_rate_request *req); 1336 1338 void clk_hw_reparent(struct clk_hw *hw, struct clk_hw *new_parent); 1337 1339 void clk_hw_get_rate_range(struct clk_hw *hw, unsigned long *min_rate, 1338 1340 unsigned long *max_rate);
+19 -5
include/linux/iopoll.h
··· 53 53 } \ 54 54 if (__sleep_us) \ 55 55 usleep_range((__sleep_us >> 2) + 1, __sleep_us); \ 56 + cpu_relax(); \ 56 57 } \ 57 58 (cond) ? 0 : -ETIMEDOUT; \ 58 59 }) ··· 74 73 * Returns 0 on success and -ETIMEDOUT upon a timeout. In either 75 74 * case, the last read value at @args is stored in @val. 76 75 * 76 + * This macro does not rely on timekeeping. Hence it is safe to call even when 77 + * timekeeping is suspended, at the expense of an underestimation of wall clock 78 + * time, which is rather minimal with a non-zero delay_us. 79 + * 77 80 * When available, you'll probably want to use one of the specialized 78 81 * macros defined below rather than this macro directly. 79 82 */ ··· 85 80 delay_before_read, args...) \ 86 81 ({ \ 87 82 u64 __timeout_us = (timeout_us); \ 83 + s64 __left_ns = __timeout_us * NSEC_PER_USEC; \ 88 84 unsigned long __delay_us = (delay_us); \ 89 - ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \ 90 - if (delay_before_read && __delay_us) \ 85 + u64 __delay_ns = __delay_us * NSEC_PER_USEC; \ 86 + if (delay_before_read && __delay_us) { \ 91 87 udelay(__delay_us); \ 88 + if (__timeout_us) \ 89 + __left_ns -= __delay_ns; \ 90 + } \ 92 91 for (;;) { \ 93 92 (val) = op(args); \ 94 93 if (cond) \ 95 94 break; \ 96 - if (__timeout_us && \ 97 - ktime_compare(ktime_get(), __timeout) > 0) { \ 95 + if (__timeout_us && __left_ns < 0) { \ 98 96 (val) = op(args); \ 99 97 break; \ 100 98 } \ 101 - if (__delay_us) \ 99 + if (__delay_us) { \ 102 100 udelay(__delay_us); \ 101 + if (__timeout_us) \ 102 + __left_ns -= __delay_ns; \ 103 + } \ 104 + cpu_relax(); \ 105 + if (__timeout_us) \ 106 + __left_ns--; \ 103 107 } \ 104 108 (cond) ? 0 : -ETIMEDOUT; \ 105 109 })
+16 -13
sound/soc/codecs/tlv320aic32x4-clk.c
··· 204 204 return clk_aic32x4_pll_calc_rate(&settings, parent_rate); 205 205 } 206 206 207 - static long clk_aic32x4_pll_round_rate(struct clk_hw *hw, 208 - unsigned long rate, 209 - unsigned long *parent_rate) 207 + static int clk_aic32x4_pll_determine_rate(struct clk_hw *hw, 208 + struct clk_rate_request *req) 210 209 { 211 210 struct clk_aic32x4_pll_muldiv settings; 212 211 int ret; 213 212 214 - ret = clk_aic32x4_pll_calc_muldiv(&settings, rate, *parent_rate); 213 + ret = clk_aic32x4_pll_calc_muldiv(&settings, req->rate, req->best_parent_rate); 215 214 if (ret < 0) 216 - return 0; 215 + return -EINVAL; 217 216 218 - return clk_aic32x4_pll_calc_rate(&settings, *parent_rate); 217 + req->rate = clk_aic32x4_pll_calc_rate(&settings, req->best_parent_rate); 218 + 219 + return 0; 219 220 } 220 221 221 222 static int clk_aic32x4_pll_set_rate(struct clk_hw *hw, ··· 267 266 .unprepare = clk_aic32x4_pll_unprepare, 268 267 .is_prepared = clk_aic32x4_pll_is_prepared, 269 268 .recalc_rate = clk_aic32x4_pll_recalc_rate, 270 - .round_rate = clk_aic32x4_pll_round_rate, 269 + .determine_rate = clk_aic32x4_pll_determine_rate, 271 270 .set_rate = clk_aic32x4_pll_set_rate, 272 271 .set_parent = clk_aic32x4_pll_set_parent, 273 272 .get_parent = clk_aic32x4_pll_get_parent, ··· 293 292 } 294 293 295 294 static const struct clk_ops aic32x4_codec_clkin_ops = { 295 + .determine_rate = clk_hw_determine_rate_no_reparent, 296 296 .set_parent = clk_aic32x4_codec_clkin_set_parent, 297 297 .get_parent = clk_aic32x4_codec_clkin_get_parent, 298 298 }; ··· 328 326 AIC32X4_DIV_MASK, divisor); 329 327 } 330 328 331 - static long clk_aic32x4_div_round_rate(struct clk_hw *hw, unsigned long rate, 332 - unsigned long *parent_rate) 329 + static int clk_aic32x4_div_determine_rate(struct clk_hw *hw, 330 + struct clk_rate_request *req) 333 331 { 334 332 unsigned long divisor; 335 333 336 - divisor = DIV_ROUND_UP(*parent_rate, rate); 334 + divisor = DIV_ROUND_UP(req->best_parent_rate, req->rate); 337 335 if (divisor > 128) 338 336 return -EINVAL; 339 337 340 - return DIV_ROUND_UP(*parent_rate, divisor); 338 + req->rate = DIV_ROUND_UP(req->best_parent_rate, divisor); 339 + return 0; 341 340 } 342 341 343 342 static unsigned long clk_aic32x4_div_recalc_rate(struct clk_hw *hw, ··· 357 354 .prepare = clk_aic32x4_div_prepare, 358 355 .unprepare = clk_aic32x4_div_unprepare, 359 356 .set_rate = clk_aic32x4_div_set_rate, 360 - .round_rate = clk_aic32x4_div_round_rate, 357 + .determine_rate = clk_aic32x4_div_determine_rate, 361 358 .recalc_rate = clk_aic32x4_div_recalc_rate, 362 359 }; 363 360 ··· 385 382 .set_parent = clk_aic32x4_bdiv_set_parent, 386 383 .get_parent = clk_aic32x4_bdiv_get_parent, 387 384 .set_rate = clk_aic32x4_div_set_rate, 388 - .round_rate = clk_aic32x4_div_round_rate, 385 + .determine_rate = clk_aic32x4_div_determine_rate, 389 386 .recalc_rate = clk_aic32x4_div_recalc_rate, 390 387 }; 391 388