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 contains no changes to the core framework. It is a collection of
various clk driver updates.

The biggest driver updates in terms of lines of code is the Allwinner
driver, closely followed by the Qualcomm and Mediatek drivers. All of
those hit high because we add so many lines of clk data. Coming in
fourth place is i.MX which also adds a bunch of clk data. This
accounts for the new driver additions this time around.

Otherwise the patches are lots of little cleanups and fixes for
various clk drivers that have baked in linux-next for a while. I
suppose one highlight or theme is that more clk drivers are being
updated to work as modules, which is interesting to see such critical
SoC infrastructure work as a loadable module.

New Drivers:
- Support qcom SM8150/SM8250 video and display clks
- Support Mediatek MT8167 clks
- Add clock for CRC block found on vf610 SoCs
- Add support for the Renesas R-Car V3U (R8A779A0) SoC
- Add support for the VSP for Resizing clock on Renesas RZ/G1H
- Support Allwinner A100 SoC clks

Removed Drivers:
- Remove i.MX21 clock driver, as i.MX21 platform support is being
dropped

Updates:
- Change how qcom's display port clks work
- Small non-critical fixes for TI clk driver
- Remove various unused variables in clk drivers
- Allow Rockchip clk driver to be a module
- Remove most __clk_lookup() calls in Samsung drivers (yay!)
- Support building i.MX ARMv8 platforms clock driver as module
- Some kerneldoc fixes here and there
- A couple of minor i.MX clk data corrections
- Update audio clock inverter and fdiv2 flag on Amlogic g12
- Make amlogic clk drivers configurable in Kconfig
- Fix Renesas VSP clock names to match corrected hardware
documentation
- Sigma-delta modulation on Allwinner R40
- Various fixes for at91 clk driver
- Use semicolons instead of commas in some places
- Mark some variables const so they can move to RO memory"

* tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: (102 commits)
clk: imx8mq: Fix usdhc parents order
clk: qcom: gdsc: Keep RETAIN_FF bit set if gdsc is already on
clk: Restrict CLK_HSDK to ARC_SOC_HSDK
clk: at91: sam9x60: support only two programmable clocks
clk: ingenic: Respect CLK_SET_RATE_PARENT in .round_rate
clk: ingenic: Don't tag custom clocks with CLK_SET_RATE_PARENT
clk: ingenic: Don't use CLK_SET_RATE_GATE for PLL
clk: ingenic: Use readl_poll_timeout instead of custom loop
clk: ingenic: Use to_clk_info() macro for all clocks
clk: bcm2835: add missing release if devm_clk_hw_register fails
clk: at91: clk-sam9x60-pll: remove unused variable
clk: at91: clk-main: update key before writing AT91_CKGR_MOR
clk: at91: remove the checking of parent_name
clk: clk-prima2: fix return value check in prima2_clk_init()
clk: mmp2: Fix the display clock divider base
clk: pxa: Constify static struct clk_ops
clk: baikal-t1: Mark Ethernet PLL as critical
clk: qoriq: modify MAX_PLL_DIV to 32
clk: axi-clkgen: Set power bits for fractional mode
clk: axi-clkgen: Add support for fractional dividers
...

+7585 -884
+1
Documentation/devicetree/bindings/arm/mediatek/mediatek,apmixedsys.txt
··· 15 15 - "mediatek,mt7623-apmixedsys", "mediatek,mt2701-apmixedsys" 16 16 - "mediatek,mt7629-apmixedsys" 17 17 - "mediatek,mt8135-apmixedsys" 18 + - "mediatek,mt8167-apmixedsys", "syscon" 18 19 - "mediatek,mt8173-apmixedsys" 19 20 - "mediatek,mt8183-apmixedsys", "syscon" 20 21 - "mediatek,mt8516-apmixedsys"
+1
Documentation/devicetree/bindings/arm/mediatek/mediatek,audsys.txt
··· 11 11 - "mediatek,mt6779-audio", "syscon" 12 12 - "mediatek,mt7622-audsys", "syscon" 13 13 - "mediatek,mt7623-audsys", "mediatek,mt2701-audsys", "syscon" 14 + - "mediatek,mt8167-audiosys", "syscon" 14 15 - "mediatek,mt8183-audiosys", "syscon" 15 16 - "mediatek,mt8516-audsys", "syscon" 16 17 - #clock-cells: Must be 1
+1
Documentation/devicetree/bindings/arm/mediatek/mediatek,imgsys.txt
··· 12 12 - "mediatek,mt6779-imgsys", "syscon" 13 13 - "mediatek,mt6797-imgsys", "syscon" 14 14 - "mediatek,mt7623-imgsys", "mediatek,mt2701-imgsys", "syscon" 15 + - "mediatek,mt8167-imgsys", "syscon" 15 16 - "mediatek,mt8173-imgsys", "syscon" 16 17 - "mediatek,mt8183-imgsys", "syscon" 17 18 - #clock-cells: Must be 1
+1
Documentation/devicetree/bindings/arm/mediatek/mediatek,infracfg.txt
··· 16 16 - "mediatek,mt7623-infracfg", "mediatek,mt2701-infracfg", "syscon" 17 17 - "mediatek,mt7629-infracfg", "syscon" 18 18 - "mediatek,mt8135-infracfg", "syscon" 19 + - "mediatek,mt8167-infracfg", "syscon" 19 20 - "mediatek,mt8173-infracfg", "syscon" 20 21 - "mediatek,mt8183-infracfg", "syscon" 21 22 - "mediatek,mt8516-infracfg", "syscon"
+1
Documentation/devicetree/bindings/arm/mediatek/mediatek,mfgcfg.txt
··· 8 8 - compatible: Should be one of: 9 9 - "mediatek,mt2712-mfgcfg", "syscon" 10 10 - "mediatek,mt6779-mfgcfg", "syscon" 11 + - "mediatek,mt8167-mfgcfg", "syscon" 11 12 - "mediatek,mt8183-mfgcfg", "syscon" 12 13 - #clock-cells: Must be 1 13 14
+1
Documentation/devicetree/bindings/arm/mediatek/mediatek,topckgen.txt
··· 15 15 - "mediatek,mt7623-topckgen", "mediatek,mt2701-topckgen" 16 16 - "mediatek,mt7629-topckgen" 17 17 - "mediatek,mt8135-topckgen" 18 + - "mediatek,mt8167-topckgen", "syscon" 18 19 - "mediatek,mt8173-topckgen" 19 20 - "mediatek,mt8183-topckgen", "syscon" 20 21 - "mediatek,mt8516-topckgen"
+1
Documentation/devicetree/bindings/arm/mediatek/mediatek,vdecsys.txt
··· 11 11 - "mediatek,mt6779-vdecsys", "syscon" 12 12 - "mediatek,mt6797-vdecsys", "syscon" 13 13 - "mediatek,mt7623-vdecsys", "mediatek,mt2701-vdecsys", "syscon" 14 + - "mediatek,mt8167-vdecsys", "syscon" 14 15 - "mediatek,mt8173-vdecsys", "syscon" 15 16 - "mediatek,mt8183-vdecsys", "syscon" 16 17 - #clock-cells: Must be 1
+6 -1
Documentation/devicetree/bindings/clock/allwinner,sun4i-a10-ccu.yaml
··· 36 36 - allwinner,sun9i-a80-ccu 37 37 - allwinner,sun50i-a64-ccu 38 38 - allwinner,sun50i-a64-r-ccu 39 + - allwinner,sun50i-a100-ccu 40 + - allwinner,sun50i-a100-r-ccu 39 41 - allwinner,sun50i-h5-ccu 40 42 - allwinner,sun50i-h6-ccu 41 43 - allwinner,sun50i-h6-r-ccu ··· 80 78 - allwinner,sun8i-a83t-r-ccu 81 79 - allwinner,sun8i-h3-r-ccu 82 80 - allwinner,sun50i-a64-r-ccu 81 + - allwinner,sun50i-a100-r-ccu 83 82 - allwinner,sun50i-h6-r-ccu 84 83 85 84 then: ··· 97 94 if: 98 95 properties: 99 96 compatible: 100 - const: allwinner,sun50i-h6-ccu 97 + enum: 98 + - allwinner,sun50i-a100-ccu 99 + - allwinner,sun50i-h6-ccu 101 100 102 101 then: 103 102 properties:
+93
Documentation/devicetree/bindings/clock/qcom,dispcc-sm8x50.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/qcom,dispcc-sm8x50.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Qualcomm Display Clock & Reset Controller Binding for SM8150/SM8250 8 + 9 + maintainers: 10 + - Jonathan Marek <jonathan@marek.ca> 11 + 12 + description: | 13 + Qualcomm display clock control module which supports the clocks, resets and 14 + power domains on SM8150 and SM8250. 15 + 16 + See also: 17 + dt-bindings/clock/qcom,dispcc-sm8150.h 18 + dt-bindings/clock/qcom,dispcc-sm8250.h 19 + 20 + properties: 21 + compatible: 22 + enum: 23 + - qcom,sm8150-dispcc 24 + - qcom,sm8250-dispcc 25 + 26 + clocks: 27 + items: 28 + - description: Board XO source 29 + - description: Byte clock from DSI PHY0 30 + - description: Pixel clock from DSI PHY0 31 + - description: Byte clock from DSI PHY1 32 + - description: Pixel clock from DSI PHY1 33 + - description: Link clock from DP PHY 34 + - description: VCO DIV clock from DP PHY 35 + 36 + clock-names: 37 + items: 38 + - const: bi_tcxo 39 + - const: dsi0_phy_pll_out_byteclk 40 + - const: dsi0_phy_pll_out_dsiclk 41 + - const: dsi1_phy_pll_out_byteclk 42 + - const: dsi1_phy_pll_out_dsiclk 43 + - const: dp_phy_pll_link_clk 44 + - const: dp_phy_pll_vco_div_clk 45 + 46 + '#clock-cells': 47 + const: 1 48 + 49 + '#reset-cells': 50 + const: 1 51 + 52 + '#power-domain-cells': 53 + const: 1 54 + 55 + reg: 56 + maxItems: 1 57 + 58 + required: 59 + - compatible 60 + - reg 61 + - clocks 62 + - clock-names 63 + - '#clock-cells' 64 + - '#reset-cells' 65 + - '#power-domain-cells' 66 + 67 + additionalProperties: false 68 + 69 + examples: 70 + - | 71 + #include <dt-bindings/clock/qcom,rpmh.h> 72 + clock-controller@af00000 { 73 + compatible = "qcom,sm8250-dispcc"; 74 + reg = <0x0af00000 0x10000>; 75 + clocks = <&rpmhcc RPMH_CXO_CLK>, 76 + <&dsi0_phy 0>, 77 + <&dsi0_phy 1>, 78 + <&dsi1_phy 0>, 79 + <&dsi1_phy 1>, 80 + <&dp_phy 0>, 81 + <&dp_phy 1>; 82 + clock-names = "bi_tcxo", 83 + "dsi0_phy_pll_out_byteclk", 84 + "dsi0_phy_pll_out_dsiclk", 85 + "dsi1_phy_pll_out_byteclk", 86 + "dsi1_phy_pll_out_dsiclk", 87 + "dp_phy_pll_link_clk", 88 + "dp_phy_pll_vco_div_clk"; 89 + #clock-cells = <1>; 90 + #reset-cells = <1>; 91 + #power-domain-cells = <1>; 92 + }; 93 + ...
+14 -6
Documentation/devicetree/bindings/clock/qcom,sc7180-videocc.yaml Documentation/devicetree/bindings/clock/qcom,videocc.yaml
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 %YAML 1.2 3 3 --- 4 - $id: http://devicetree.org/schemas/clock/qcom,sc7180-videocc.yaml# 4 + $id: http://devicetree.org/schemas/clock/qcom,videocc.yaml# 5 5 $schema: http://devicetree.org/meta-schemas/core.yaml# 6 6 7 - title: Qualcomm Video Clock & Reset Controller Binding for SC7180 7 + title: Qualcomm Video Clock & Reset Controller Binding 8 8 9 9 maintainers: 10 10 - Taniya Das <tdas@codeaurora.org> 11 11 12 12 description: | 13 13 Qualcomm video clock control module which supports the clocks, resets and 14 - power domains on SC7180. 14 + power domains on SDM845/SC7180/SM8150/SM8250. 15 15 16 - See also dt-bindings/clock/qcom,videocc-sc7180.h. 16 + See also: 17 + dt-bindings/clock/qcom,videocc-sc7180.h 18 + dt-bindings/clock/qcom,videocc-sdm845.h 19 + dt-bindings/clock/qcom,videocc-sm8150.h 20 + dt-bindings/clock/qcom,videocc-sm8250.h 17 21 18 22 properties: 19 23 compatible: 20 - const: qcom,sc7180-videocc 24 + enum: 25 + - qcom,sc7180-videocc 26 + - qcom,sdm845-videocc 27 + - qcom,sm8150-videocc 28 + - qcom,sm8250-videocc 21 29 22 30 clocks: 23 31 items: ··· 62 54 - | 63 55 #include <dt-bindings/clock/qcom,rpmh.h> 64 56 clock-controller@ab00000 { 65 - compatible = "qcom,sc7180-videocc"; 57 + compatible = "qcom,sdm845-videocc"; 66 58 reg = <0x0ab00000 0x10000>; 67 59 clocks = <&rpmhcc RPMH_CXO_CLK>; 68 60 clock-names = "bi_tcxo";
-65
Documentation/devicetree/bindings/clock/qcom,sdm845-videocc.yaml
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - %YAML 1.2 3 - --- 4 - $id: http://devicetree.org/schemas/clock/qcom,sdm845-videocc.yaml# 5 - $schema: http://devicetree.org/meta-schemas/core.yaml# 6 - 7 - title: Qualcomm Video Clock & Reset Controller Binding for SDM845 8 - 9 - maintainers: 10 - - Taniya Das <tdas@codeaurora.org> 11 - 12 - description: | 13 - Qualcomm video clock control module which supports the clocks, resets and 14 - power domains on SDM845. 15 - 16 - See also dt-bindings/clock/qcom,videocc-sdm845.h. 17 - 18 - properties: 19 - compatible: 20 - const: qcom,sdm845-videocc 21 - 22 - clocks: 23 - items: 24 - - description: Board XO source 25 - 26 - clock-names: 27 - items: 28 - - const: bi_tcxo 29 - 30 - '#clock-cells': 31 - const: 1 32 - 33 - '#reset-cells': 34 - const: 1 35 - 36 - '#power-domain-cells': 37 - const: 1 38 - 39 - reg: 40 - maxItems: 1 41 - 42 - required: 43 - - compatible 44 - - reg 45 - - clocks 46 - - clock-names 47 - - '#clock-cells' 48 - - '#reset-cells' 49 - - '#power-domain-cells' 50 - 51 - additionalProperties: false 52 - 53 - examples: 54 - - | 55 - #include <dt-bindings/clock/qcom,rpmh.h> 56 - clock-controller@ab00000 { 57 - compatible = "qcom,sdm845-videocc"; 58 - reg = <0x0ab00000 0x10000>; 59 - clocks = <&rpmhcc RPMH_CXO_CLK>; 60 - clock-names = "bi_tcxo"; 61 - #clock-cells = <1>; 62 - #reset-cells = <1>; 63 - #power-domain-cells = <1>; 64 - }; 65 - ...
+1
Documentation/devicetree/bindings/clock/renesas,cpg-mssr.yaml
··· 47 47 - renesas,r8a77980-cpg-mssr # R-Car V3H 48 48 - renesas,r8a77990-cpg-mssr # R-Car E3 49 49 - renesas,r8a77995-cpg-mssr # R-Car D3 50 + - renesas,r8a779a0-cpg-mssr # R-Car V3U 50 51 51 52 reg: 52 53 maxItems: 1
+2 -1
drivers/clk/Kconfig
··· 49 49 50 50 config CLK_HSDK 51 51 bool "PLL Driver for HSDK platform" 52 - depends on OF || COMPILE_TEST 52 + depends on ARC_SOC_HSDK || COMPILE_TEST 53 53 depends on HAS_IOMEM 54 54 help 55 55 This driver supports the HSDK core, system, ddr, tunnel and hdmi PLLs ··· 373 373 source "drivers/clk/mvebu/Kconfig" 374 374 source "drivers/clk/qcom/Kconfig" 375 375 source "drivers/clk/renesas/Kconfig" 376 + source "drivers/clk/rockchip/Kconfig" 376 377 source "drivers/clk/samsung/Kconfig" 377 378 source "drivers/clk/sifive/Kconfig" 378 379 source "drivers/clk/sprd/Kconfig"
-7
drivers/clk/at91/at91sam9g45.c
··· 46 46 { .n = "pck1", .p = "prog1", .id = 9 }, 47 47 }; 48 48 49 - static const struct clk_pcr_layout at91sam9g45_pcr_layout = { 50 - .offset = 0x10c, 51 - .cmd = BIT(12), 52 - .pid_mask = GENMASK(5, 0), 53 - .div_mask = GENMASK(17, 16), 54 - }; 55 - 56 49 struct pck { 57 50 char *n; 58 51 u8 id;
+8 -3
drivers/clk/at91/clk-main.c
··· 437 437 return -EINVAL; 438 438 439 439 regmap_read(regmap, AT91_CKGR_MOR, &tmp); 440 - tmp &= ~MOR_KEY_MASK; 441 440 442 441 if (index && !(tmp & AT91_PMC_MOSCSEL)) 443 - regmap_write(regmap, AT91_CKGR_MOR, tmp | AT91_PMC_MOSCSEL); 442 + tmp = AT91_PMC_MOSCSEL; 444 443 else if (!index && (tmp & AT91_PMC_MOSCSEL)) 445 - regmap_write(regmap, AT91_CKGR_MOR, tmp & ~AT91_PMC_MOSCSEL); 444 + tmp = 0; 445 + else 446 + return 0; 447 + 448 + regmap_update_bits(regmap, AT91_CKGR_MOR, 449 + AT91_PMC_MOSCSEL | MOR_KEY_MASK, 450 + tmp | AT91_PMC_KEY); 446 451 447 452 while (!clk_sam9x5_main_ready(regmap)) 448 453 cpu_relax();
+2 -2
drivers/clk/at91/clk-peripheral.c
··· 112 112 113 113 init.name = name; 114 114 init.ops = &peripheral_ops; 115 - init.parent_names = (parent_name ? &parent_name : NULL); 116 - init.num_parents = (parent_name ? 1 : 0); 115 + init.parent_names = &parent_name; 116 + init.num_parents = 1; 117 117 init.flags = 0; 118 118 119 119 periph->id = id;
+1 -2
drivers/clk/at91/clk-sam9x60-pll.c
··· 331 331 struct clk_hw *parent = clk_hw_get_parent(&core->hw); 332 332 unsigned long tmp_rate, tmp_parent_rate, tmp_diff; 333 333 long best_diff = -1, best_rate = -EINVAL; 334 - u32 divid, best_div; 334 + u32 divid; 335 335 336 336 if (!rate) 337 337 return 0; ··· 352 352 *parent_rate = tmp_parent_rate; 353 353 best_rate = tmp_rate; 354 354 best_diff = tmp_diff; 355 - best_div = divid; 356 355 } 357 356 358 357 if (!best_diff)
+1 -1
drivers/clk/at91/sam9x60.c
··· 279 279 parent_names[3] = "masterck"; 280 280 parent_names[4] = "pllack_divck"; 281 281 parent_names[5] = "upllck_divck"; 282 - for (i = 0; i < 8; i++) { 282 + for (i = 0; i < 2; i++) { 283 283 char name[6]; 284 284 285 285 snprintf(name, sizeof(name), "prog%d", i);
+8 -6
drivers/clk/baikal-t1/clk-ccu-pll.c
··· 51 51 }; 52 52 53 53 /* 54 - * Mark as critical all PLLs except Ethernet one. CPU and DDR PLLs are sources 55 - * of CPU cores and DDR controller reference clocks, due to which they 56 - * obviously shouldn't be ever gated. SATA and PCIe PLLs are the parents of 57 - * APB-bus and DDR controller AXI-bus clocks. If they are gated the system will 58 - * be unusable. 54 + * Alas we have to mark all PLLs as critical. CPU and DDR PLLs are sources of 55 + * CPU cores and DDR controller reference clocks, due to which they obviously 56 + * shouldn't be ever gated. SATA and PCIe PLLs are the parents of APB-bus and 57 + * DDR controller AXI-bus clocks. If they are gated the system will be 58 + * unusable. Moreover disabling SATA and Ethernet PLLs causes automatic reset 59 + * of the corresponding subsystems. So until we aren't ready to re-initialize 60 + * all the devices consuming those PLLs, they will be marked as critical too. 59 61 */ 60 62 static const struct ccu_pll_info pll_info[] = { 61 63 CCU_PLL_INFO(CCU_CPU_PLL, "cpu_pll", "ref_clk", CCU_CPU_PLL_BASE, ··· 69 67 CCU_PLL_INFO(CCU_PCIE_PLL, "pcie_pll", "ref_clk", CCU_PCIE_PLL_BASE, 70 68 CLK_IS_CRITICAL), 71 69 CCU_PLL_INFO(CCU_ETH_PLL, "eth_pll", "ref_clk", CCU_ETH_PLL_BASE, 72 - CLK_SET_RATE_GATE) 70 + CLK_IS_CRITICAL | CLK_SET_RATE_GATE) 73 71 }; 74 72 75 73 struct ccu_pll_data {
+3 -1
drivers/clk/bcm/clk-bcm2835.c
··· 1338 1338 pll->hw.init = &init; 1339 1339 1340 1340 ret = devm_clk_hw_register(cprman->dev, &pll->hw); 1341 - if (ret) 1341 + if (ret) { 1342 + kfree(pll); 1342 1343 return NULL; 1344 + } 1343 1345 return &pll->hw; 1344 1346 } 1345 1347
+1
drivers/clk/bcm/clk-raspberrypi.c
··· 271 271 case RPI_FIRMWARE_CORE_CLK_ID: 272 272 case RPI_FIRMWARE_M2MC_CLK_ID: 273 273 case RPI_FIRMWARE_V3D_CLK_ID: 274 + case RPI_FIRMWARE_PIXEL_BVB_CLK_ID: 274 275 hw = raspberrypi_clk_register(rpi, clks->parent, 275 276 clks->id); 276 277 if (IS_ERR(hw))
+137 -52
drivers/clk/clk-axi-clkgen.c
··· 27 27 28 28 #define AXI_CLKGEN_V2_DRP_STATUS_BUSY BIT(16) 29 29 30 + #define MMCM_REG_CLKOUT5_2 0x07 30 31 #define MMCM_REG_CLKOUT0_1 0x08 31 32 #define MMCM_REG_CLKOUT0_2 0x09 33 + #define MMCM_REG_CLKOUT6_2 0x13 32 34 #define MMCM_REG_CLK_FB1 0x14 33 35 #define MMCM_REG_CLK_FB2 0x15 34 36 #define MMCM_REG_CLK_DIV 0x16 35 37 #define MMCM_REG_LOCK1 0x18 36 38 #define MMCM_REG_LOCK2 0x19 37 39 #define MMCM_REG_LOCK3 0x1a 40 + #define MMCM_REG_POWER 0x28 38 41 #define MMCM_REG_FILTER1 0x4e 39 42 #define MMCM_REG_FILTER2 0x4f 40 43 41 44 #define MMCM_CLKOUT_NOCOUNT BIT(6) 42 45 46 + #define MMCM_CLK_DIV_DIVIDE BIT(11) 43 47 #define MMCM_CLK_DIV_NOCOUNT BIT(12) 44 48 45 49 struct axi_clkgen { ··· 111 107 unsigned long d, d_min, d_max, _d_min, _d_max; 112 108 unsigned long m, m_min, m_max; 113 109 unsigned long f, dout, best_f, fvco; 110 + unsigned long fract_shift = 0; 111 + unsigned long fvco_min_fract, fvco_max_fract; 114 112 115 113 fin /= 1000; 116 114 fout /= 1000; ··· 125 119 d_min = max_t(unsigned long, DIV_ROUND_UP(fin, fpfd_max), 1); 126 120 d_max = min_t(unsigned long, fin / fpfd_min, 80); 127 121 128 - m_min = max_t(unsigned long, DIV_ROUND_UP(fvco_min, fin) * d_min, 1); 129 - m_max = min_t(unsigned long, fvco_max * d_max / fin, 64); 122 + again: 123 + fvco_min_fract = fvco_min << fract_shift; 124 + fvco_max_fract = fvco_max << fract_shift; 125 + 126 + m_min = max_t(unsigned long, DIV_ROUND_UP(fvco_min_fract, fin) * d_min, 1); 127 + m_max = min_t(unsigned long, fvco_max_fract * d_max / fin, 64 << fract_shift); 130 128 131 129 for (m = m_min; m <= m_max; m++) { 132 - _d_min = max(d_min, DIV_ROUND_UP(fin * m, fvco_max)); 133 - _d_max = min(d_max, fin * m / fvco_min); 130 + _d_min = max(d_min, DIV_ROUND_UP(fin * m, fvco_max_fract)); 131 + _d_max = min(d_max, fin * m / fvco_min_fract); 134 132 135 133 for (d = _d_min; d <= _d_max; d++) { 136 134 fvco = fin * m / d; 137 135 138 136 dout = DIV_ROUND_CLOSEST(fvco, fout); 139 - dout = clamp_t(unsigned long, dout, 1, 128); 137 + dout = clamp_t(unsigned long, dout, 1, 128 << fract_shift); 140 138 f = fvco / dout; 141 139 if (abs(f - fout) < abs(best_f - fout)) { 142 140 best_f = f; 143 141 *best_d = d; 144 - *best_m = m; 145 - *best_dout = dout; 142 + *best_m = m << (3 - fract_shift); 143 + *best_dout = dout << (3 - fract_shift); 146 144 if (best_f == fout) 147 145 return; 148 146 } 149 147 } 150 148 } 149 + 150 + /* Lets see if we find a better setting in fractional mode */ 151 + if (fract_shift == 0) { 152 + fract_shift = 3; 153 + goto again; 154 + } 151 155 } 152 156 153 - static void axi_clkgen_calc_clk_params(unsigned int divider, unsigned int *low, 154 - unsigned int *high, unsigned int *edge, unsigned int *nocount) 155 - { 156 - if (divider == 1) 157 - *nocount = 1; 158 - else 159 - *nocount = 0; 157 + struct axi_clkgen_div_params { 158 + unsigned int low; 159 + unsigned int high; 160 + unsigned int edge; 161 + unsigned int nocount; 162 + unsigned int frac_en; 163 + unsigned int frac; 164 + unsigned int frac_wf_f; 165 + unsigned int frac_wf_r; 166 + unsigned int frac_phase; 167 + }; 160 168 161 - *high = divider / 2; 162 - *edge = divider % 2; 163 - *low = divider - *high; 169 + static void axi_clkgen_calc_clk_params(unsigned int divider, 170 + unsigned int frac_divider, struct axi_clkgen_div_params *params) 171 + { 172 + 173 + memset(params, 0x0, sizeof(*params)); 174 + 175 + if (divider == 1) { 176 + params->nocount = 1; 177 + return; 178 + } 179 + 180 + if (frac_divider == 0) { 181 + params->high = divider / 2; 182 + params->edge = divider % 2; 183 + params->low = divider - params->high; 184 + } else { 185 + params->frac_en = 1; 186 + params->frac = frac_divider; 187 + 188 + params->high = divider / 2; 189 + params->edge = divider % 2; 190 + params->low = params->high; 191 + 192 + if (params->edge == 0) { 193 + params->high--; 194 + params->frac_wf_r = 1; 195 + } 196 + 197 + if (params->edge == 0 || frac_divider == 1) 198 + params->low--; 199 + if (((params->edge == 0) ^ (frac_divider == 1)) || 200 + (divider == 2 && frac_divider == 1)) 201 + params->frac_wf_f = 1; 202 + 203 + params->frac_phase = params->edge * 4 + frac_divider / 2; 204 + } 164 205 } 165 206 166 207 static void axi_clkgen_write(struct axi_clkgen *axi_clkgen, ··· 299 246 return container_of(clk_hw, struct axi_clkgen, clk_hw); 300 247 } 301 248 249 + static void axi_clkgen_set_div(struct axi_clkgen *axi_clkgen, 250 + unsigned int reg1, unsigned int reg2, unsigned int reg3, 251 + struct axi_clkgen_div_params *params) 252 + { 253 + axi_clkgen_mmcm_write(axi_clkgen, reg1, 254 + (params->high << 6) | params->low, 0xefff); 255 + axi_clkgen_mmcm_write(axi_clkgen, reg2, 256 + (params->frac << 12) | (params->frac_en << 11) | 257 + (params->frac_wf_r << 10) | (params->edge << 7) | 258 + (params->nocount << 6), 0x7fff); 259 + if (reg3 != 0) { 260 + axi_clkgen_mmcm_write(axi_clkgen, reg3, 261 + (params->frac_phase << 11) | (params->frac_wf_f << 10), 0x3c00); 262 + } 263 + } 264 + 302 265 static int axi_clkgen_set_rate(struct clk_hw *clk_hw, 303 266 unsigned long rate, unsigned long parent_rate) 304 267 { 305 268 struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(clk_hw); 306 269 unsigned int d, m, dout; 307 - unsigned int nocount; 308 - unsigned int high; 309 - unsigned int edge; 310 - unsigned int low; 270 + struct axi_clkgen_div_params params; 271 + uint32_t power = 0; 311 272 uint32_t filter; 312 273 uint32_t lock; 313 274 ··· 333 266 if (d == 0 || dout == 0 || m == 0) 334 267 return -EINVAL; 335 268 269 + if ((dout & 0x7) != 0 || (m & 0x7) != 0) 270 + power |= 0x9800; 271 + 272 + axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_POWER, power, 0x9800); 273 + 336 274 filter = axi_clkgen_lookup_filter(m - 1); 337 275 lock = axi_clkgen_lookup_lock(m - 1); 338 276 339 - axi_clkgen_calc_clk_params(dout, &low, &high, &edge, &nocount); 340 - axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_CLKOUT0_1, 341 - (high << 6) | low, 0xefff); 342 - axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_CLKOUT0_2, 343 - (edge << 7) | (nocount << 6), 0x03ff); 277 + axi_clkgen_calc_clk_params(dout >> 3, dout & 0x7, &params); 278 + axi_clkgen_set_div(axi_clkgen, MMCM_REG_CLKOUT0_1, MMCM_REG_CLKOUT0_2, 279 + MMCM_REG_CLKOUT5_2, &params); 344 280 345 - axi_clkgen_calc_clk_params(d, &low, &high, &edge, &nocount); 281 + axi_clkgen_calc_clk_params(d, 0, &params); 346 282 axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_CLK_DIV, 347 - (edge << 13) | (nocount << 12) | (high << 6) | low, 0x3fff); 283 + (params.edge << 13) | (params.nocount << 12) | 284 + (params.high << 6) | params.low, 0x3fff); 348 285 349 - axi_clkgen_calc_clk_params(m, &low, &high, &edge, &nocount); 350 - axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_CLK_FB1, 351 - (high << 6) | low, 0xefff); 352 - axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_CLK_FB2, 353 - (edge << 7) | (nocount << 6), 0x03ff); 286 + axi_clkgen_calc_clk_params(m >> 3, m & 0x7, &params); 287 + axi_clkgen_set_div(axi_clkgen, MMCM_REG_CLK_FB1, MMCM_REG_CLK_FB2, 288 + MMCM_REG_CLKOUT6_2, &params); 354 289 355 290 axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_LOCK1, lock & 0x3ff, 0x3ff); 356 291 axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_LOCK2, ··· 382 313 return min_t(unsigned long long, tmp, LONG_MAX); 383 314 } 384 315 316 + static unsigned int axi_clkgen_get_div(struct axi_clkgen *axi_clkgen, 317 + unsigned int reg1, unsigned int reg2) 318 + { 319 + unsigned int val1, val2; 320 + unsigned int div; 321 + 322 + axi_clkgen_mmcm_read(axi_clkgen, reg2, &val2); 323 + if (val2 & MMCM_CLKOUT_NOCOUNT) 324 + return 8; 325 + 326 + axi_clkgen_mmcm_read(axi_clkgen, reg1, &val1); 327 + 328 + div = (val1 & 0x3f) + ((val1 >> 6) & 0x3f); 329 + div <<= 3; 330 + 331 + if (val2 & MMCM_CLK_DIV_DIVIDE) { 332 + if ((val2 & BIT(7)) && (val2 & 0x7000) != 0x1000) 333 + div += 8; 334 + else 335 + div += 16; 336 + 337 + div += (val2 >> 12) & 0x7; 338 + } 339 + 340 + return div; 341 + } 342 + 385 343 static unsigned long axi_clkgen_recalc_rate(struct clk_hw *clk_hw, 386 344 unsigned long parent_rate) 387 345 { 388 346 struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(clk_hw); 389 347 unsigned int d, m, dout; 390 - unsigned int reg; 391 348 unsigned long long tmp; 349 + unsigned int val; 392 350 393 - axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLKOUT0_2, &reg); 394 - if (reg & MMCM_CLKOUT_NOCOUNT) { 395 - dout = 1; 396 - } else { 397 - axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLKOUT0_1, &reg); 398 - dout = (reg & 0x3f) + ((reg >> 6) & 0x3f); 399 - } 351 + dout = axi_clkgen_get_div(axi_clkgen, MMCM_REG_CLKOUT0_1, 352 + MMCM_REG_CLKOUT0_2); 353 + m = axi_clkgen_get_div(axi_clkgen, MMCM_REG_CLK_FB1, 354 + MMCM_REG_CLK_FB2); 400 355 401 - axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLK_DIV, &reg); 402 - if (reg & MMCM_CLK_DIV_NOCOUNT) 356 + axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLK_DIV, &val); 357 + if (val & MMCM_CLK_DIV_NOCOUNT) 403 358 d = 1; 404 359 else 405 - d = (reg & 0x3f) + ((reg >> 6) & 0x3f); 406 - 407 - axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLK_FB2, &reg); 408 - if (reg & MMCM_CLKOUT_NOCOUNT) { 409 - m = 1; 410 - } else { 411 - axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLK_FB1, &reg); 412 - m = (reg & 0x3f) + ((reg >> 6) & 0x3f); 413 - } 360 + d = (val & 0x3f) + ((val >> 6) & 0x3f); 414 361 415 362 if (d == 0 || dout == 0) 416 363 return 0;
+1
drivers/clk/clk-composite.c
··· 328 328 rate_hw, rate_ops, gate_hw, 329 329 gate_ops, flags); 330 330 } 331 + EXPORT_SYMBOL_GPL(clk_hw_register_composite); 331 332 332 333 struct clk_hw *clk_hw_register_composite_pdata(struct device *dev, 333 334 const char *name,
+1
drivers/clk/clk-fixed-factor.c
··· 206 206 207 207 /** 208 208 * of_fixed_factor_clk_setup() - Setup function for simple fixed factor clock 209 + * @node: device node for the clock 209 210 */ 210 211 void __init of_fixed_factor_clk_setup(struct device_node *node) 211 212 {
+1
drivers/clk/clk-fixed-rate.c
··· 168 168 169 169 /** 170 170 * of_fixed_clk_setup() - Setup function for simple fixed rate clock 171 + * @node: device node for the clock 171 172 */ 172 173 void __init of_fixed_clk_setup(struct device_node *node) 173 174 {
+1 -1
drivers/clk/clk-qoriq.c
··· 31 31 #define CGA_PLL4 4 /* only on clockgen-1.0, which lacks CGB */ 32 32 #define CGB_PLL1 4 33 33 #define CGB_PLL2 5 34 - #define MAX_PLL_DIV 16 34 + #define MAX_PLL_DIV 32 35 35 36 36 struct clockgen_pll_div { 37 37 struct clk *clk;
+1 -12
drivers/clk/clk-s2mps11.c
··· 267 267 .remove = s2mps11_clk_remove, 268 268 .id_table = s2mps11_clk_id, 269 269 }; 270 - 271 - static int __init s2mps11_clk_init(void) 272 - { 273 - return platform_driver_register(&s2mps11_clk_driver); 274 - } 275 - subsys_initcall(s2mps11_clk_init); 276 - 277 - static void __exit s2mps11_clk_cleanup(void) 278 - { 279 - platform_driver_unregister(&s2mps11_clk_driver); 280 - } 281 - module_exit(s2mps11_clk_cleanup); 270 + module_platform_driver(s2mps11_clk_driver); 282 271 283 272 MODULE_DESCRIPTION("S2MPS11 Clock Driver"); 284 273 MODULE_AUTHOR("Yadwinder Singh Brar <yadi.brar@samsung.com>");
+1 -3
drivers/clk/clk-si5341.c
··· 883 883 static u8 si5341_output_get_parent(struct clk_hw *hw) 884 884 { 885 885 struct clk_si5341_output *output = to_clk_si5341_output(hw); 886 - int err; 887 886 u32 val; 888 887 889 - err = regmap_read(output->data->regmap, 890 - SI5341_OUT_MUX_SEL(output), &val); 888 + regmap_read(output->data->regmap, SI5341_OUT_MUX_SEL(output), &val); 891 889 892 890 return val & 0x7; 893 891 }
+1
drivers/clk/davinci/da8xx-cfgchip.c
··· 571 571 572 572 /** 573 573 * da8xx_cfgchip_register_usb1_clk48 - Register a new USB 1.1 PHY clock 574 + * @dev: The device 574 575 * @regmap: The CFGCHIP regmap 575 576 */ 576 577 static struct da8xx_usb1_clk48 *
+76 -14
drivers/clk/imx/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 # common clock support for NXP i.MX SoC family. 3 3 config MXC_CLK 4 - bool 5 - def_bool ARCH_MXC 4 + tristate "IMX clock" 5 + depends on ARCH_MXC || COMPILE_TEST 6 6 7 7 config MXC_CLK_SCU 8 - bool 9 - depends on IMX_SCU 8 + tristate "IMX SCU clock" 9 + depends on ARCH_MXC || COMPILE_TEST 10 + depends on IMX_SCU && HAVE_ARM_SMCCC 11 + 12 + config CLK_IMX1 13 + def_bool SOC_IMX1 14 + select MXC_CLK 15 + 16 + config CLK_IMX25 17 + def_bool SOC_IMX25 18 + select MXC_CLK 19 + 20 + config CLK_IMX27 21 + def_bool SOC_IMX27 22 + select MXC_CLK 23 + 24 + config CLK_IMX31 25 + def_bool SOC_IMX31 26 + select MXC_CLK 27 + 28 + config CLK_IMX35 29 + def_bool SOC_IMX35 30 + select MXC_CLK 31 + 32 + config CLK_IMX5 33 + def_bool SOC_IMX5 34 + select MXC_CLK 35 + 36 + config CLK_IMX6Q 37 + def_bool SOC_IMX6Q 38 + select MXC_CLK 39 + 40 + config CLK_IMX6SL 41 + def_bool SOC_IMX6SL 42 + select MXC_CLK 43 + 44 + config CLK_IMX6SLL 45 + def_bool SOC_IMX6SLL 46 + select MXC_CLK 47 + 48 + config CLK_IMX6SX 49 + def_bool SOC_IMX6SX 50 + select MXC_CLK 51 + 52 + config CLK_IMX6UL 53 + def_bool SOC_IMX6UL 54 + select MXC_CLK 55 + 56 + config CLK_IMX7D 57 + def_bool SOC_IMX7D 58 + select MXC_CLK 59 + 60 + config CLK_IMX7ULP 61 + def_bool SOC_IMX7ULP 62 + select MXC_CLK 63 + 64 + config CLK_VF610 65 + def_bool SOC_VF610 66 + select MXC_CLK 10 67 11 68 config CLK_IMX8MM 12 - bool "IMX8MM CCM Clock Driver" 13 - depends on ARCH_MXC 69 + tristate "IMX8MM CCM Clock Driver" 70 + depends on ARCH_MXC || COMPILE_TEST 71 + select MXC_CLK 14 72 help 15 73 Build the driver for i.MX8MM CCM Clock Driver 16 74 17 75 config CLK_IMX8MN 18 - bool "IMX8MN CCM Clock Driver" 19 - depends on ARCH_MXC 76 + tristate "IMX8MN CCM Clock Driver" 77 + depends on ARCH_MXC || COMPILE_TEST 78 + select MXC_CLK 20 79 help 21 80 Build the driver for i.MX8MN CCM Clock Driver 22 81 23 82 config CLK_IMX8MP 24 - bool "IMX8MP CCM Clock Driver" 25 - depends on ARCH_MXC 83 + tristate "IMX8MP CCM Clock Driver" 84 + depends on ARCH_MXC || COMPILE_TEST 85 + select MXC_CLK 26 86 help 27 87 Build the driver for i.MX8MP CCM Clock Driver 28 88 29 89 config CLK_IMX8MQ 30 - bool "IMX8MQ CCM Clock Driver" 31 - depends on ARCH_MXC 90 + tristate "IMX8MQ CCM Clock Driver" 91 + depends on ARCH_MXC || COMPILE_TEST 92 + select MXC_CLK 32 93 help 33 94 Build the driver for i.MX8MQ CCM Clock Driver 34 95 35 96 config CLK_IMX8QXP 36 - bool "IMX8QXP SCU Clock" 37 - depends on ARCH_MXC && IMX_SCU && ARM64 97 + tristate "IMX8QXP SCU Clock" 98 + depends on (ARCH_MXC && ARM64) || COMPILE_TEST 99 + depends on IMX_SCU && HAVE_ARM_SMCCC 38 100 select MXC_CLK_SCU 39 101 help 40 102 Build the driver for IMX8QXP SCU based clocks.
+38 -40
drivers/clk/imx/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 3 - obj-$(CONFIG_MXC_CLK) += \ 4 - clk.o \ 5 - clk-busy.o \ 6 - clk-composite-8m.o \ 7 - clk-cpu.o \ 8 - clk-composite-7ulp.o \ 9 - clk-divider-gate.o \ 10 - clk-fixup-div.o \ 11 - clk-fixup-mux.o \ 12 - clk-frac-pll.o \ 13 - clk-gate-exclusive.o \ 14 - clk-gate2.o \ 15 - clk-pfd.o \ 16 - clk-pfdv2.o \ 17 - clk-pllv1.o \ 18 - clk-pllv2.o \ 19 - clk-pllv3.o \ 20 - clk-pllv4.o \ 21 - clk-sscg-pll.o \ 22 - clk-pll14xx.o 23 - 24 - obj-$(CONFIG_MXC_CLK_SCU) += \ 25 - clk-scu.o \ 26 - clk-lpcg-scu.o 3 + mxc-clk-objs += clk.o 4 + mxc-clk-objs += clk-busy.o 5 + mxc-clk-objs += clk-composite-7ulp.o 6 + mxc-clk-objs += clk-composite-8m.o 7 + mxc-clk-objs += clk-cpu.o 8 + mxc-clk-objs += clk-divider-gate.o 9 + mxc-clk-objs += clk-fixup-div.o 10 + mxc-clk-objs += clk-fixup-mux.o 11 + mxc-clk-objs += clk-frac-pll.o 12 + mxc-clk-objs += clk-gate2.o 13 + mxc-clk-objs += clk-gate-exclusive.o 14 + mxc-clk-objs += clk-pfd.o 15 + mxc-clk-objs += clk-pfdv2.o 16 + mxc-clk-objs += clk-pllv1.o 17 + mxc-clk-objs += clk-pllv2.o 18 + mxc-clk-objs += clk-pllv3.o 19 + mxc-clk-objs += clk-pllv4.o 20 + mxc-clk-objs += clk-pll14xx.o 21 + mxc-clk-objs += clk-sscg-pll.o 22 + obj-$(CONFIG_MXC_CLK) += mxc-clk.o 27 23 28 24 obj-$(CONFIG_CLK_IMX8MM) += clk-imx8mm.o 29 25 obj-$(CONFIG_CLK_IMX8MN) += clk-imx8mn.o 30 26 obj-$(CONFIG_CLK_IMX8MP) += clk-imx8mp.o 31 27 obj-$(CONFIG_CLK_IMX8MQ) += clk-imx8mq.o 32 - obj-$(CONFIG_CLK_IMX8QXP) += clk-imx8qxp.o clk-imx8qxp-lpcg.o 33 28 34 - obj-$(CONFIG_SOC_IMX1) += clk-imx1.o 35 - obj-$(CONFIG_SOC_IMX21) += clk-imx21.o 36 - obj-$(CONFIG_SOC_IMX25) += clk-imx25.o 37 - obj-$(CONFIG_SOC_IMX27) += clk-imx27.o 38 - obj-$(CONFIG_SOC_IMX31) += clk-imx31.o 39 - obj-$(CONFIG_SOC_IMX35) += clk-imx35.o 40 - obj-$(CONFIG_SOC_IMX5) += clk-imx5.o 41 - obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o 42 - obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o 43 - obj-$(CONFIG_SOC_IMX6SLL) += clk-imx6sll.o 44 - obj-$(CONFIG_SOC_IMX6SX) += clk-imx6sx.o 45 - obj-$(CONFIG_SOC_IMX6UL) += clk-imx6ul.o 46 - obj-$(CONFIG_SOC_IMX7D) += clk-imx7d.o 47 - obj-$(CONFIG_SOC_IMX7ULP) += clk-imx7ulp.o 48 - obj-$(CONFIG_SOC_VF610) += clk-vf610.o 29 + obj-$(CONFIG_MXC_CLK_SCU) += clk-imx-scu.o clk-imx-lpcg-scu.o 30 + clk-imx-scu-$(CONFIG_CLK_IMX8QXP) += clk-scu.o clk-imx8qxp.o 31 + clk-imx-lpcg-scu-$(CONFIG_CLK_IMX8QXP) += clk-lpcg-scu.o clk-imx8qxp-lpcg.o 32 + 33 + obj-$(CONFIG_CLK_IMX1) += clk-imx1.o 34 + obj-$(CONFIG_CLK_IMX25) += clk-imx25.o 35 + obj-$(CONFIG_CLK_IMX27) += clk-imx27.o 36 + obj-$(CONFIG_CLK_IMX31) += clk-imx31.o 37 + obj-$(CONFIG_CLK_IMX35) += clk-imx35.o 38 + obj-$(CONFIG_CLK_IMX5) += clk-imx5.o 39 + obj-$(CONFIG_CLK_IMX6Q) += clk-imx6q.o 40 + obj-$(CONFIG_CLK_IMX6SL) += clk-imx6sl.o 41 + obj-$(CONFIG_CLK_IMX6SLL) += clk-imx6sll.o 42 + obj-$(CONFIG_CLK_IMX6SX) += clk-imx6sx.o 43 + obj-$(CONFIG_CLK_IMX6UL) += clk-imx6ul.o 44 + obj-$(CONFIG_CLK_IMX7D) += clk-imx7d.o 45 + obj-$(CONFIG_CLK_IMX7ULP) += clk-imx7ulp.o 46 + obj-$(CONFIG_CLK_VF610) += clk-vf610.o
+1
drivers/clk/imx/clk-busy.c
··· 4 4 * Copyright 2012 Linaro Ltd. 5 5 */ 6 6 7 + #include <linux/bits.h> 7 8 #include <linux/clk.h> 8 9 #include <linux/clk-provider.h> 9 10 #include <linux/io.h>
+1
drivers/clk/imx/clk-composite-7ulp.c
··· 5 5 * 6 6 */ 7 7 8 + #include <linux/bits.h> 8 9 #include <linux/clk-provider.h> 9 10 #include <linux/err.h> 10 11 #include <linux/slab.h>
+3
drivers/clk/imx/clk-composite-8m.c
··· 5 5 6 6 #include <linux/clk-provider.h> 7 7 #include <linux/errno.h> 8 + #include <linux/export.h> 8 9 #include <linux/io.h> 9 10 #include <linux/slab.h> 10 11 ··· 216 215 div->width = PCG_PREDIV_WIDTH; 217 216 divider_ops = &imx8m_clk_composite_divider_ops; 218 217 mux_ops = &clk_mux_ops; 218 + flags |= CLK_SET_PARENT_GATE; 219 219 } 220 220 221 221 div->lock = &imx_ccm_lock; ··· 245 243 kfree(mux); 246 244 return ERR_CAST(hw); 247 245 } 246 + EXPORT_SYMBOL_GPL(imx8m_clk_hw_composite_flags);
+2
drivers/clk/imx/clk-cpu.c
··· 5 5 6 6 #include <linux/clk.h> 7 7 #include <linux/clk-provider.h> 8 + #include <linux/export.h> 8 9 #include <linux/slab.h> 9 10 #include "clk.h" 10 11 ··· 105 104 106 105 return hw; 107 106 } 107 + EXPORT_SYMBOL_GPL(imx_clk_hw_cpu);
+1
drivers/clk/imx/clk-fixup-mux.c
··· 3 3 * Copyright (C) 2013 Freescale Semiconductor, Inc. 4 4 */ 5 5 6 + #include <linux/bits.h> 6 7 #include <linux/clk-provider.h> 7 8 #include <linux/err.h> 8 9 #include <linux/io.h>
+2
drivers/clk/imx/clk-frac-pll.c
··· 10 10 11 11 #include <linux/clk-provider.h> 12 12 #include <linux/err.h> 13 + #include <linux/export.h> 13 14 #include <linux/io.h> 14 15 #include <linux/iopoll.h> 15 16 #include <linux/slab.h> ··· 234 233 235 234 return hw; 236 235 } 236 + EXPORT_SYMBOL_GPL(imx_clk_hw_frac_pll);
+3 -1
drivers/clk/imx/clk-gate2.c
··· 7 7 */ 8 8 9 9 #include <linux/clk-provider.h> 10 + #include <linux/export.h> 10 11 #include <linux/module.h> 11 12 #include <linux/slab.h> 12 13 #include <linux/io.h> ··· 16 15 #include "clk.h" 17 16 18 17 /** 19 - * DOC: basic gatable clock which can gate and ungate it's ouput 18 + * DOC: basic gateable clock which can gate and ungate its output 20 19 * 21 20 * Traits of this clock: 22 21 * prepare - clk_(un)prepare only ensures parent is (un)prepared ··· 178 177 179 178 return hw; 180 179 } 180 + EXPORT_SYMBOL_GPL(clk_hw_register_gate2);
-171
drivers/clk/imx/clk-imx21.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved. 4 - * Copyright 2008 Juergen Beisert, kernel@pengutronix.de 5 - * Copyright 2008 Martin Fuzzey, mfuzzey@gmail.com 6 - */ 7 - 8 - #include <linux/clk-provider.h> 9 - #include <linux/clkdev.h> 10 - #include <linux/io.h> 11 - #include <linux/of.h> 12 - #include <linux/of_address.h> 13 - #include <dt-bindings/clock/imx21-clock.h> 14 - #include <soc/imx/timer.h> 15 - #include <asm/irq.h> 16 - 17 - #include "clk.h" 18 - 19 - #define MX21_CCM_BASE_ADDR 0x10027000 20 - #define MX21_GPT1_BASE_ADDR 0x10003000 21 - #define MX21_INT_GPT1 (NR_IRQS_LEGACY + 26) 22 - 23 - static void __iomem *ccm __initdata; 24 - 25 - /* Register offsets */ 26 - #define CCM_CSCR (ccm + 0x00) 27 - #define CCM_MPCTL0 (ccm + 0x04) 28 - #define CCM_SPCTL0 (ccm + 0x0c) 29 - #define CCM_PCDR0 (ccm + 0x18) 30 - #define CCM_PCDR1 (ccm + 0x1c) 31 - #define CCM_PCCR0 (ccm + 0x20) 32 - #define CCM_PCCR1 (ccm + 0x24) 33 - 34 - static const char *mpll_osc_sel_clks[] = { "ckih_gate", "ckih_div1p5", }; 35 - static const char *mpll_sel_clks[] = { "fpm_gate", "mpll_osc_sel", }; 36 - static const char *spll_sel_clks[] = { "fpm_gate", "mpll_osc_sel", }; 37 - static const char *ssi_sel_clks[] = { "spll_gate", "mpll_gate", }; 38 - 39 - static struct clk *clk[IMX21_CLK_MAX]; 40 - static struct clk_onecell_data clk_data; 41 - 42 - static void __init _mx21_clocks_init(unsigned long lref, unsigned long href) 43 - { 44 - BUG_ON(!ccm); 45 - 46 - clk[IMX21_CLK_DUMMY] = imx_clk_fixed("dummy", 0); 47 - clk[IMX21_CLK_CKIL] = imx_obtain_fixed_clock("ckil", lref); 48 - clk[IMX21_CLK_CKIH] = imx_obtain_fixed_clock("ckih", href); 49 - clk[IMX21_CLK_FPM] = imx_clk_fixed_factor("fpm", "ckil", 512, 1); 50 - clk[IMX21_CLK_CKIH_DIV1P5] = imx_clk_fixed_factor("ckih_div1p5", "ckih_gate", 2, 3); 51 - 52 - clk[IMX21_CLK_MPLL_GATE] = imx_clk_gate("mpll_gate", "mpll", CCM_CSCR, 0); 53 - clk[IMX21_CLK_SPLL_GATE] = imx_clk_gate("spll_gate", "spll", CCM_CSCR, 1); 54 - clk[IMX21_CLK_FPM_GATE] = imx_clk_gate("fpm_gate", "fpm", CCM_CSCR, 2); 55 - clk[IMX21_CLK_CKIH_GATE] = imx_clk_gate_dis("ckih_gate", "ckih", CCM_CSCR, 3); 56 - clk[IMX21_CLK_MPLL_OSC_SEL] = imx_clk_mux("mpll_osc_sel", CCM_CSCR, 4, 1, mpll_osc_sel_clks, ARRAY_SIZE(mpll_osc_sel_clks)); 57 - clk[IMX21_CLK_IPG] = imx_clk_divider("ipg", "hclk", CCM_CSCR, 9, 1); 58 - clk[IMX21_CLK_HCLK] = imx_clk_divider("hclk", "fclk", CCM_CSCR, 10, 4); 59 - clk[IMX21_CLK_MPLL_SEL] = imx_clk_mux("mpll_sel", CCM_CSCR, 16, 1, mpll_sel_clks, ARRAY_SIZE(mpll_sel_clks)); 60 - clk[IMX21_CLK_SPLL_SEL] = imx_clk_mux("spll_sel", CCM_CSCR, 17, 1, spll_sel_clks, ARRAY_SIZE(spll_sel_clks)); 61 - clk[IMX21_CLK_SSI1_SEL] = imx_clk_mux("ssi1_sel", CCM_CSCR, 19, 1, ssi_sel_clks, ARRAY_SIZE(ssi_sel_clks)); 62 - clk[IMX21_CLK_SSI2_SEL] = imx_clk_mux("ssi2_sel", CCM_CSCR, 20, 1, ssi_sel_clks, ARRAY_SIZE(ssi_sel_clks)); 63 - clk[IMX21_CLK_USB_DIV] = imx_clk_divider("usb_div", "spll_gate", CCM_CSCR, 26, 3); 64 - clk[IMX21_CLK_FCLK] = imx_clk_divider("fclk", "mpll_gate", CCM_CSCR, 29, 3); 65 - 66 - clk[IMX21_CLK_MPLL] = imx_clk_pllv1(IMX_PLLV1_IMX21, "mpll", "mpll_sel", CCM_MPCTL0); 67 - 68 - clk[IMX21_CLK_SPLL] = imx_clk_pllv1(IMX_PLLV1_IMX21, "spll", "spll_sel", CCM_SPCTL0); 69 - 70 - clk[IMX21_CLK_NFC_DIV] = imx_clk_divider("nfc_div", "fclk", CCM_PCDR0, 12, 4); 71 - clk[IMX21_CLK_SSI1_DIV] = imx_clk_divider("ssi1_div", "ssi1_sel", CCM_PCDR0, 16, 6); 72 - clk[IMX21_CLK_SSI2_DIV] = imx_clk_divider("ssi2_div", "ssi2_sel", CCM_PCDR0, 26, 6); 73 - 74 - clk[IMX21_CLK_PER1] = imx_clk_divider("per1", "mpll_gate", CCM_PCDR1, 0, 6); 75 - clk[IMX21_CLK_PER2] = imx_clk_divider("per2", "mpll_gate", CCM_PCDR1, 8, 6); 76 - clk[IMX21_CLK_PER3] = imx_clk_divider("per3", "mpll_gate", CCM_PCDR1, 16, 6); 77 - clk[IMX21_CLK_PER4] = imx_clk_divider("per4", "mpll_gate", CCM_PCDR1, 24, 6); 78 - 79 - clk[IMX21_CLK_UART1_IPG_GATE] = imx_clk_gate("uart1_ipg_gate", "ipg", CCM_PCCR0, 0); 80 - clk[IMX21_CLK_UART2_IPG_GATE] = imx_clk_gate("uart2_ipg_gate", "ipg", CCM_PCCR0, 1); 81 - clk[IMX21_CLK_UART3_IPG_GATE] = imx_clk_gate("uart3_ipg_gate", "ipg", CCM_PCCR0, 2); 82 - clk[IMX21_CLK_UART4_IPG_GATE] = imx_clk_gate("uart4_ipg_gate", "ipg", CCM_PCCR0, 3); 83 - clk[IMX21_CLK_CSPI1_IPG_GATE] = imx_clk_gate("cspi1_ipg_gate", "ipg", CCM_PCCR0, 4); 84 - clk[IMX21_CLK_CSPI2_IPG_GATE] = imx_clk_gate("cspi2_ipg_gate", "ipg", CCM_PCCR0, 5); 85 - clk[IMX21_CLK_SSI1_GATE] = imx_clk_gate("ssi1_gate", "ipg", CCM_PCCR0, 6); 86 - clk[IMX21_CLK_SSI2_GATE] = imx_clk_gate("ssi2_gate", "ipg", CCM_PCCR0, 7); 87 - clk[IMX21_CLK_SDHC1_IPG_GATE] = imx_clk_gate("sdhc1_ipg_gate", "ipg", CCM_PCCR0, 9); 88 - clk[IMX21_CLK_SDHC2_IPG_GATE] = imx_clk_gate("sdhc2_ipg_gate", "ipg", CCM_PCCR0, 10); 89 - clk[IMX21_CLK_GPIO_GATE] = imx_clk_gate("gpio_gate", "ipg", CCM_PCCR0, 11); 90 - clk[IMX21_CLK_I2C_GATE] = imx_clk_gate("i2c_gate", "ipg", CCM_PCCR0, 12); 91 - clk[IMX21_CLK_DMA_GATE] = imx_clk_gate("dma_gate", "ipg", CCM_PCCR0, 13); 92 - clk[IMX21_CLK_USB_GATE] = imx_clk_gate("usb_gate", "usb_div", CCM_PCCR0, 14); 93 - clk[IMX21_CLK_EMMA_GATE] = imx_clk_gate("emma_gate", "ipg", CCM_PCCR0, 15); 94 - clk[IMX21_CLK_SSI2_BAUD_GATE] = imx_clk_gate("ssi2_baud_gate", "ipg", CCM_PCCR0, 16); 95 - clk[IMX21_CLK_SSI1_BAUD_GATE] = imx_clk_gate("ssi1_baud_gate", "ipg", CCM_PCCR0, 17); 96 - clk[IMX21_CLK_LCDC_IPG_GATE] = imx_clk_gate("lcdc_ipg_gate", "ipg", CCM_PCCR0, 18); 97 - clk[IMX21_CLK_NFC_GATE] = imx_clk_gate("nfc_gate", "nfc_div", CCM_PCCR0, 19); 98 - clk[IMX21_CLK_SLCDC_HCLK_GATE] = imx_clk_gate("slcdc_hclk_gate", "hclk", CCM_PCCR0, 21); 99 - clk[IMX21_CLK_PER4_GATE] = imx_clk_gate("per4_gate", "per4", CCM_PCCR0, 22); 100 - clk[IMX21_CLK_BMI_GATE] = imx_clk_gate("bmi_gate", "hclk", CCM_PCCR0, 23); 101 - clk[IMX21_CLK_USB_HCLK_GATE] = imx_clk_gate("usb_hclk_gate", "hclk", CCM_PCCR0, 24); 102 - clk[IMX21_CLK_SLCDC_GATE] = imx_clk_gate("slcdc_gate", "hclk", CCM_PCCR0, 25); 103 - clk[IMX21_CLK_LCDC_HCLK_GATE] = imx_clk_gate("lcdc_hclk_gate", "hclk", CCM_PCCR0, 26); 104 - clk[IMX21_CLK_EMMA_HCLK_GATE] = imx_clk_gate("emma_hclk_gate", "hclk", CCM_PCCR0, 27); 105 - clk[IMX21_CLK_BROM_GATE] = imx_clk_gate("brom_gate", "hclk", CCM_PCCR0, 28); 106 - clk[IMX21_CLK_DMA_HCLK_GATE] = imx_clk_gate("dma_hclk_gate", "hclk", CCM_PCCR0, 30); 107 - clk[IMX21_CLK_CSI_HCLK_GATE] = imx_clk_gate("csi_hclk_gate", "hclk", CCM_PCCR0, 31); 108 - 109 - clk[IMX21_CLK_CSPI3_IPG_GATE] = imx_clk_gate("cspi3_ipg_gate", "ipg", CCM_PCCR1, 23); 110 - clk[IMX21_CLK_WDOG_GATE] = imx_clk_gate("wdog_gate", "ipg", CCM_PCCR1, 24); 111 - clk[IMX21_CLK_GPT1_IPG_GATE] = imx_clk_gate("gpt1_ipg_gate", "ipg", CCM_PCCR1, 25); 112 - clk[IMX21_CLK_GPT2_IPG_GATE] = imx_clk_gate("gpt2_ipg_gate", "ipg", CCM_PCCR1, 26); 113 - clk[IMX21_CLK_GPT3_IPG_GATE] = imx_clk_gate("gpt3_ipg_gate", "ipg", CCM_PCCR1, 27); 114 - clk[IMX21_CLK_PWM_IPG_GATE] = imx_clk_gate("pwm_ipg_gate", "ipg", CCM_PCCR1, 28); 115 - clk[IMX21_CLK_RTC_GATE] = imx_clk_gate("rtc_gate", "ipg", CCM_PCCR1, 29); 116 - clk[IMX21_CLK_KPP_GATE] = imx_clk_gate("kpp_gate", "ipg", CCM_PCCR1, 30); 117 - clk[IMX21_CLK_OWIRE_GATE] = imx_clk_gate("owire_gate", "ipg", CCM_PCCR1, 31); 118 - 119 - imx_check_clocks(clk, ARRAY_SIZE(clk)); 120 - } 121 - 122 - int __init mx21_clocks_init(unsigned long lref, unsigned long href) 123 - { 124 - ccm = ioremap(MX21_CCM_BASE_ADDR, SZ_2K); 125 - 126 - _mx21_clocks_init(lref, href); 127 - 128 - clk_register_clkdev(clk[IMX21_CLK_PER1], "per", "imx21-uart.0"); 129 - clk_register_clkdev(clk[IMX21_CLK_UART1_IPG_GATE], "ipg", "imx21-uart.0"); 130 - clk_register_clkdev(clk[IMX21_CLK_PER1], "per", "imx21-uart.1"); 131 - clk_register_clkdev(clk[IMX21_CLK_UART2_IPG_GATE], "ipg", "imx21-uart.1"); 132 - clk_register_clkdev(clk[IMX21_CLK_PER1], "per", "imx21-uart.2"); 133 - clk_register_clkdev(clk[IMX21_CLK_UART3_IPG_GATE], "ipg", "imx21-uart.2"); 134 - clk_register_clkdev(clk[IMX21_CLK_PER1], "per", "imx21-uart.3"); 135 - clk_register_clkdev(clk[IMX21_CLK_UART4_IPG_GATE], "ipg", "imx21-uart.3"); 136 - clk_register_clkdev(clk[IMX21_CLK_GPT1_IPG_GATE], "ipg", "imx-gpt.0"); 137 - clk_register_clkdev(clk[IMX21_CLK_PER1], "per", "imx-gpt.0"); 138 - clk_register_clkdev(clk[IMX21_CLK_PER2], "per", "imx21-cspi.0"); 139 - clk_register_clkdev(clk[IMX21_CLK_CSPI1_IPG_GATE], "ipg", "imx21-cspi.0"); 140 - clk_register_clkdev(clk[IMX21_CLK_PER2], "per", "imx21-cspi.1"); 141 - clk_register_clkdev(clk[IMX21_CLK_CSPI2_IPG_GATE], "ipg", "imx21-cspi.1"); 142 - clk_register_clkdev(clk[IMX21_CLK_PER2], "per", "imx21-cspi.2"); 143 - clk_register_clkdev(clk[IMX21_CLK_CSPI3_IPG_GATE], "ipg", "imx21-cspi.2"); 144 - clk_register_clkdev(clk[IMX21_CLK_PER3], "per", "imx21-fb.0"); 145 - clk_register_clkdev(clk[IMX21_CLK_LCDC_IPG_GATE], "ipg", "imx21-fb.0"); 146 - clk_register_clkdev(clk[IMX21_CLK_LCDC_HCLK_GATE], "ahb", "imx21-fb.0"); 147 - clk_register_clkdev(clk[IMX21_CLK_USB_GATE], "per", "imx21-hcd.0"); 148 - clk_register_clkdev(clk[IMX21_CLK_USB_HCLK_GATE], "ahb", "imx21-hcd.0"); 149 - clk_register_clkdev(clk[IMX21_CLK_NFC_GATE], NULL, "imx21-nand.0"); 150 - clk_register_clkdev(clk[IMX21_CLK_DMA_HCLK_GATE], "ahb", "imx21-dma"); 151 - clk_register_clkdev(clk[IMX21_CLK_DMA_GATE], "ipg", "imx21-dma"); 152 - clk_register_clkdev(clk[IMX21_CLK_WDOG_GATE], NULL, "imx2-wdt.0"); 153 - clk_register_clkdev(clk[IMX21_CLK_I2C_GATE], NULL, "imx21-i2c.0"); 154 - clk_register_clkdev(clk[IMX21_CLK_OWIRE_GATE], NULL, "mxc_w1.0"); 155 - 156 - mxc_timer_init(MX21_GPT1_BASE_ADDR, MX21_INT_GPT1, GPT_TYPE_IMX21); 157 - 158 - return 0; 159 - } 160 - 161 - static void __init mx21_clocks_init_dt(struct device_node *np) 162 - { 163 - ccm = of_iomap(np, 0); 164 - 165 - _mx21_clocks_init(32768, 26000000); 166 - 167 - clk_data.clks = clk; 168 - clk_data.clk_num = ARRAY_SIZE(clk); 169 - of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 170 - } 171 - CLK_OF_DECLARE(imx27_ccm, "fsl,imx21-ccm", mx21_clocks_init_dt);
+1
drivers/clk/imx/clk-imx6q.c
··· 6 6 7 7 #include <linux/init.h> 8 8 #include <linux/types.h> 9 + #include <linux/bits.h> 9 10 #include <linux/clk.h> 10 11 #include <linux/clkdev.h> 11 12 #include <linux/clk-provider.h>
+8 -7
drivers/clk/imx/clk-imx6sl.c
··· 3 3 * Copyright 2013-2014 Freescale Semiconductor, Inc. 4 4 */ 5 5 6 + #include <linux/bits.h> 6 7 #include <linux/clk.h> 7 8 #include <linux/clkdev.h> 8 9 #include <linux/err.h> ··· 15 14 #include "clk.h" 16 15 17 16 #define CCSR 0xc 18 - #define BM_CCSR_PLL1_SW_CLK_SEL (1 << 2) 17 + #define BM_CCSR_PLL1_SW_CLK_SEL BIT(2) 19 18 #define CACRR 0x10 20 19 #define CDHIPR 0x48 21 - #define BM_CDHIPR_ARM_PODF_BUSY (1 << 16) 20 + #define BM_CDHIPR_ARM_PODF_BUSY BIT(16) 22 21 #define ARM_WAIT_DIV_396M 2 23 22 #define ARM_WAIT_DIV_792M 4 24 23 #define ARM_WAIT_DIV_996M 6 25 24 26 25 #define PLL_ARM 0x0 27 - #define BM_PLL_ARM_DIV_SELECT (0x7f << 0) 28 - #define BM_PLL_ARM_POWERDOWN (1 << 12) 29 - #define BM_PLL_ARM_ENABLE (1 << 13) 30 - #define BM_PLL_ARM_LOCK (1 << 31) 26 + #define BM_PLL_ARM_DIV_SELECT 0x7f 27 + #define BM_PLL_ARM_POWERDOWN BIT(12) 28 + #define BM_PLL_ARM_ENABLE BIT(13) 29 + #define BM_PLL_ARM_LOCK BIT(31) 31 30 #define PLL_ARM_DIV_792M 66 32 31 33 32 static const char *step_sels[] = { "osc", "pll2_pfd2", }; ··· 146 145 val |= BM_PLL_ARM_ENABLE; 147 146 val &= ~BM_PLL_ARM_POWERDOWN; 148 147 writel_relaxed(val, anatop_base + PLL_ARM); 149 - while (!(__raw_readl(anatop_base + PLL_ARM) & BM_PLL_ARM_LOCK)) 148 + while (!(readl_relaxed(anatop_base + PLL_ARM) & BM_PLL_ARM_LOCK)) 150 149 ; 151 150 } else { 152 151 writel_relaxed(saved_pll_arm, anatop_base + PLL_ARM);
+1
drivers/clk/imx/clk-imx6sx.c
··· 4 4 */ 5 5 6 6 #include <dt-bindings/clock/imx6sx-clock.h> 7 + #include <linux/bits.h> 7 8 #include <linux/clk.h> 8 9 #include <linux/clkdev.h> 9 10 #include <linux/clk-provider.h>
+67 -65
drivers/clk/imx/clk-imx7d.c
··· 4 4 */ 5 5 6 6 #include <dt-bindings/clock/imx7d-clock.h> 7 + #include <linux/bits.h> 7 8 #include <linux/clk.h> 8 9 #include <linux/clkdev.h> 9 10 #include <linux/clk-provider.h> ··· 506 505 hws[IMX7D_ARM_M4_ROOT_SRC] = imx_clk_hw_mux2("arm_m4_src", base + 0x8080, 24, 3, arm_m4_sel, ARRAY_SIZE(arm_m4_sel)); 507 506 hws[IMX7D_MAIN_AXI_ROOT_SRC] = imx_clk_hw_mux2("axi_src", base + 0x8800, 24, 3, axi_sel, ARRAY_SIZE(axi_sel)); 508 507 hws[IMX7D_DISP_AXI_ROOT_SRC] = imx_clk_hw_mux2("disp_axi_src", base + 0x8880, 24, 3, disp_axi_sel, ARRAY_SIZE(disp_axi_sel)); 509 - hws[IMX7D_ENET_AXI_ROOT_SRC] = imx_clk_hw_mux2("enet_axi_src", base + 0x8900, 24, 3, enet_axi_sel, ARRAY_SIZE(enet_axi_sel)); 510 - hws[IMX7D_NAND_USDHC_BUS_ROOT_SRC] = imx_clk_hw_mux2("nand_usdhc_src", base + 0x8980, 24, 3, nand_usdhc_bus_sel, ARRAY_SIZE(nand_usdhc_bus_sel)); 511 508 hws[IMX7D_AHB_CHANNEL_ROOT_SRC] = imx_clk_hw_mux2("ahb_src", base + 0x9000, 24, 3, ahb_channel_sel, ARRAY_SIZE(ahb_channel_sel)); 512 - hws[IMX7D_DRAM_PHYM_ROOT_SRC] = imx_clk_hw_mux2("dram_phym_src", base + 0x9800, 24, 1, dram_phym_sel, ARRAY_SIZE(dram_phym_sel)); 513 - hws[IMX7D_DRAM_ROOT_SRC] = imx_clk_hw_mux2("dram_src", base + 0x9880, 24, 1, dram_sel, ARRAY_SIZE(dram_sel)); 514 - hws[IMX7D_DRAM_PHYM_ALT_ROOT_SRC] = imx_clk_hw_mux2("dram_phym_alt_src", base + 0xa000, 24, 3, dram_phym_alt_sel, ARRAY_SIZE(dram_phym_alt_sel)); 515 - hws[IMX7D_DRAM_ALT_ROOT_SRC] = imx_clk_hw_mux2("dram_alt_src", base + 0xa080, 24, 3, dram_alt_sel, ARRAY_SIZE(dram_alt_sel)); 516 - hws[IMX7D_USB_HSIC_ROOT_SRC] = imx_clk_hw_mux2("usb_hsic_src", base + 0xa100, 24, 3, usb_hsic_sel, ARRAY_SIZE(usb_hsic_sel)); 517 - hws[IMX7D_PCIE_CTRL_ROOT_SRC] = imx_clk_hw_mux2("pcie_ctrl_src", base + 0xa180, 24, 3, pcie_ctrl_sel, ARRAY_SIZE(pcie_ctrl_sel)); 518 - hws[IMX7D_PCIE_PHY_ROOT_SRC] = imx_clk_hw_mux2("pcie_phy_src", base + 0xa200, 24, 3, pcie_phy_sel, ARRAY_SIZE(pcie_phy_sel)); 519 - hws[IMX7D_EPDC_PIXEL_ROOT_SRC] = imx_clk_hw_mux2("epdc_pixel_src", base + 0xa280, 24, 3, epdc_pixel_sel, ARRAY_SIZE(epdc_pixel_sel)); 520 - hws[IMX7D_LCDIF_PIXEL_ROOT_SRC] = imx_clk_hw_mux2("lcdif_pixel_src", base + 0xa300, 24, 3, lcdif_pixel_sel, ARRAY_SIZE(lcdif_pixel_sel)); 521 - hws[IMX7D_MIPI_DSI_ROOT_SRC] = imx_clk_hw_mux2("mipi_dsi_src", base + 0xa380, 24, 3, mipi_dsi_sel, ARRAY_SIZE(mipi_dsi_sel)); 522 - hws[IMX7D_MIPI_CSI_ROOT_SRC] = imx_clk_hw_mux2("mipi_csi_src", base + 0xa400, 24, 3, mipi_csi_sel, ARRAY_SIZE(mipi_csi_sel)); 523 - hws[IMX7D_MIPI_DPHY_ROOT_SRC] = imx_clk_hw_mux2("mipi_dphy_src", base + 0xa480, 24, 3, mipi_dphy_sel, ARRAY_SIZE(mipi_dphy_sel)); 524 - hws[IMX7D_SAI1_ROOT_SRC] = imx_clk_hw_mux2("sai1_src", base + 0xa500, 24, 3, sai1_sel, ARRAY_SIZE(sai1_sel)); 525 - hws[IMX7D_SAI2_ROOT_SRC] = imx_clk_hw_mux2("sai2_src", base + 0xa580, 24, 3, sai2_sel, ARRAY_SIZE(sai2_sel)); 526 - hws[IMX7D_SAI3_ROOT_SRC] = imx_clk_hw_mux2("sai3_src", base + 0xa600, 24, 3, sai3_sel, ARRAY_SIZE(sai3_sel)); 527 - hws[IMX7D_SPDIF_ROOT_SRC] = imx_clk_hw_mux2("spdif_src", base + 0xa680, 24, 3, spdif_sel, ARRAY_SIZE(spdif_sel)); 528 - hws[IMX7D_ENET1_REF_ROOT_SRC] = imx_clk_hw_mux2("enet1_ref_src", base + 0xa700, 24, 3, enet1_ref_sel, ARRAY_SIZE(enet1_ref_sel)); 529 - hws[IMX7D_ENET1_TIME_ROOT_SRC] = imx_clk_hw_mux2("enet1_time_src", base + 0xa780, 24, 3, enet1_time_sel, ARRAY_SIZE(enet1_time_sel)); 530 - hws[IMX7D_ENET2_REF_ROOT_SRC] = imx_clk_hw_mux2("enet2_ref_src", base + 0xa800, 24, 3, enet2_ref_sel, ARRAY_SIZE(enet2_ref_sel)); 531 - hws[IMX7D_ENET2_TIME_ROOT_SRC] = imx_clk_hw_mux2("enet2_time_src", base + 0xa880, 24, 3, enet2_time_sel, ARRAY_SIZE(enet2_time_sel)); 532 - hws[IMX7D_ENET_PHY_REF_ROOT_SRC] = imx_clk_hw_mux2("enet_phy_ref_src", base + 0xa900, 24, 3, enet_phy_ref_sel, ARRAY_SIZE(enet_phy_ref_sel)); 533 - hws[IMX7D_EIM_ROOT_SRC] = imx_clk_hw_mux2("eim_src", base + 0xa980, 24, 3, eim_sel, ARRAY_SIZE(eim_sel)); 534 - hws[IMX7D_NAND_ROOT_SRC] = imx_clk_hw_mux2("nand_src", base + 0xaa00, 24, 3, nand_sel, ARRAY_SIZE(nand_sel)); 535 - hws[IMX7D_QSPI_ROOT_SRC] = imx_clk_hw_mux2("qspi_src", base + 0xaa80, 24, 3, qspi_sel, ARRAY_SIZE(qspi_sel)); 536 - hws[IMX7D_USDHC1_ROOT_SRC] = imx_clk_hw_mux2("usdhc1_src", base + 0xab00, 24, 3, usdhc1_sel, ARRAY_SIZE(usdhc1_sel)); 537 - hws[IMX7D_USDHC2_ROOT_SRC] = imx_clk_hw_mux2("usdhc2_src", base + 0xab80, 24, 3, usdhc2_sel, ARRAY_SIZE(usdhc2_sel)); 538 - hws[IMX7D_USDHC3_ROOT_SRC] = imx_clk_hw_mux2("usdhc3_src", base + 0xac00, 24, 3, usdhc3_sel, ARRAY_SIZE(usdhc3_sel)); 539 - hws[IMX7D_CAN1_ROOT_SRC] = imx_clk_hw_mux2("can1_src", base + 0xac80, 24, 3, can1_sel, ARRAY_SIZE(can1_sel)); 540 - hws[IMX7D_CAN2_ROOT_SRC] = imx_clk_hw_mux2("can2_src", base + 0xad00, 24, 3, can2_sel, ARRAY_SIZE(can2_sel)); 541 - hws[IMX7D_I2C1_ROOT_SRC] = imx_clk_hw_mux2("i2c1_src", base + 0xad80, 24, 3, i2c1_sel, ARRAY_SIZE(i2c1_sel)); 542 - hws[IMX7D_I2C2_ROOT_SRC] = imx_clk_hw_mux2("i2c2_src", base + 0xae00, 24, 3, i2c2_sel, ARRAY_SIZE(i2c2_sel)); 543 - hws[IMX7D_I2C3_ROOT_SRC] = imx_clk_hw_mux2("i2c3_src", base + 0xae80, 24, 3, i2c3_sel, ARRAY_SIZE(i2c3_sel)); 544 - hws[IMX7D_I2C4_ROOT_SRC] = imx_clk_hw_mux2("i2c4_src", base + 0xaf00, 24, 3, i2c4_sel, ARRAY_SIZE(i2c4_sel)); 545 - hws[IMX7D_UART1_ROOT_SRC] = imx_clk_hw_mux2("uart1_src", base + 0xaf80, 24, 3, uart1_sel, ARRAY_SIZE(uart1_sel)); 546 - hws[IMX7D_UART2_ROOT_SRC] = imx_clk_hw_mux2("uart2_src", base + 0xb000, 24, 3, uart2_sel, ARRAY_SIZE(uart2_sel)); 547 - hws[IMX7D_UART3_ROOT_SRC] = imx_clk_hw_mux2("uart3_src", base + 0xb080, 24, 3, uart3_sel, ARRAY_SIZE(uart3_sel)); 548 - hws[IMX7D_UART4_ROOT_SRC] = imx_clk_hw_mux2("uart4_src", base + 0xb100, 24, 3, uart4_sel, ARRAY_SIZE(uart4_sel)); 549 - hws[IMX7D_UART5_ROOT_SRC] = imx_clk_hw_mux2("uart5_src", base + 0xb180, 24, 3, uart5_sel, ARRAY_SIZE(uart5_sel)); 550 - hws[IMX7D_UART6_ROOT_SRC] = imx_clk_hw_mux2("uart6_src", base + 0xb200, 24, 3, uart6_sel, ARRAY_SIZE(uart6_sel)); 551 - hws[IMX7D_UART7_ROOT_SRC] = imx_clk_hw_mux2("uart7_src", base + 0xb280, 24, 3, uart7_sel, ARRAY_SIZE(uart7_sel)); 552 - hws[IMX7D_ECSPI1_ROOT_SRC] = imx_clk_hw_mux2("ecspi1_src", base + 0xb300, 24, 3, ecspi1_sel, ARRAY_SIZE(ecspi1_sel)); 553 - hws[IMX7D_ECSPI2_ROOT_SRC] = imx_clk_hw_mux2("ecspi2_src", base + 0xb380, 24, 3, ecspi2_sel, ARRAY_SIZE(ecspi2_sel)); 554 - hws[IMX7D_ECSPI3_ROOT_SRC] = imx_clk_hw_mux2("ecspi3_src", base + 0xb400, 24, 3, ecspi3_sel, ARRAY_SIZE(ecspi3_sel)); 555 - hws[IMX7D_ECSPI4_ROOT_SRC] = imx_clk_hw_mux2("ecspi4_src", base + 0xb480, 24, 3, ecspi4_sel, ARRAY_SIZE(ecspi4_sel)); 556 - hws[IMX7D_PWM1_ROOT_SRC] = imx_clk_hw_mux2("pwm1_src", base + 0xb500, 24, 3, pwm1_sel, ARRAY_SIZE(pwm1_sel)); 557 - hws[IMX7D_PWM2_ROOT_SRC] = imx_clk_hw_mux2("pwm2_src", base + 0xb580, 24, 3, pwm2_sel, ARRAY_SIZE(pwm2_sel)); 558 - hws[IMX7D_PWM3_ROOT_SRC] = imx_clk_hw_mux2("pwm3_src", base + 0xb600, 24, 3, pwm3_sel, ARRAY_SIZE(pwm3_sel)); 559 - hws[IMX7D_PWM4_ROOT_SRC] = imx_clk_hw_mux2("pwm4_src", base + 0xb680, 24, 3, pwm4_sel, ARRAY_SIZE(pwm4_sel)); 560 - hws[IMX7D_FLEXTIMER1_ROOT_SRC] = imx_clk_hw_mux2("flextimer1_src", base + 0xb700, 24, 3, flextimer1_sel, ARRAY_SIZE(flextimer1_sel)); 561 - hws[IMX7D_FLEXTIMER2_ROOT_SRC] = imx_clk_hw_mux2("flextimer2_src", base + 0xb780, 24, 3, flextimer2_sel, ARRAY_SIZE(flextimer2_sel)); 562 - hws[IMX7D_SIM1_ROOT_SRC] = imx_clk_hw_mux2("sim1_src", base + 0xb800, 24, 3, sim1_sel, ARRAY_SIZE(sim1_sel)); 563 - hws[IMX7D_SIM2_ROOT_SRC] = imx_clk_hw_mux2("sim2_src", base + 0xb880, 24, 3, sim2_sel, ARRAY_SIZE(sim2_sel)); 564 - hws[IMX7D_GPT1_ROOT_SRC] = imx_clk_hw_mux2("gpt1_src", base + 0xb900, 24, 3, gpt1_sel, ARRAY_SIZE(gpt1_sel)); 565 - hws[IMX7D_GPT2_ROOT_SRC] = imx_clk_hw_mux2("gpt2_src", base + 0xb980, 24, 3, gpt2_sel, ARRAY_SIZE(gpt2_sel)); 566 - hws[IMX7D_GPT3_ROOT_SRC] = imx_clk_hw_mux2("gpt3_src", base + 0xba00, 24, 3, gpt3_sel, ARRAY_SIZE(gpt3_sel)); 567 - hws[IMX7D_GPT4_ROOT_SRC] = imx_clk_hw_mux2("gpt4_src", base + 0xba80, 24, 3, gpt4_sel, ARRAY_SIZE(gpt4_sel)); 568 - hws[IMX7D_TRACE_ROOT_SRC] = imx_clk_hw_mux2("trace_src", base + 0xbb00, 24, 3, trace_sel, ARRAY_SIZE(trace_sel)); 569 - hws[IMX7D_WDOG_ROOT_SRC] = imx_clk_hw_mux2("wdog_src", base + 0xbb80, 24, 3, wdog_sel, ARRAY_SIZE(wdog_sel)); 570 - hws[IMX7D_CSI_MCLK_ROOT_SRC] = imx_clk_hw_mux2("csi_mclk_src", base + 0xbc00, 24, 3, csi_mclk_sel, ARRAY_SIZE(csi_mclk_sel)); 571 - hws[IMX7D_AUDIO_MCLK_ROOT_SRC] = imx_clk_hw_mux2("audio_mclk_src", base + 0xbc80, 24, 3, audio_mclk_sel, ARRAY_SIZE(audio_mclk_sel)); 572 - hws[IMX7D_WRCLK_ROOT_SRC] = imx_clk_hw_mux2("wrclk_src", base + 0xbd00, 24, 3, wrclk_sel, ARRAY_SIZE(wrclk_sel)); 573 - hws[IMX7D_CLKO1_ROOT_SRC] = imx_clk_hw_mux2("clko1_src", base + 0xbd80, 24, 3, clko1_sel, ARRAY_SIZE(clko1_sel)); 574 - hws[IMX7D_CLKO2_ROOT_SRC] = imx_clk_hw_mux2("clko2_src", base + 0xbe00, 24, 3, clko2_sel, ARRAY_SIZE(clko2_sel)); 509 + 510 + hws[IMX7D_ENET_AXI_ROOT_SRC] = imx_clk_hw_mux2_flags("enet_axi_src", base + 0x8900, 24, 3, enet_axi_sel, ARRAY_SIZE(enet_axi_sel), CLK_SET_PARENT_GATE); 511 + hws[IMX7D_NAND_USDHC_BUS_ROOT_SRC] = imx_clk_hw_mux2_flags("nand_usdhc_src", base + 0x8980, 24, 3, nand_usdhc_bus_sel, ARRAY_SIZE(nand_usdhc_bus_sel), CLK_SET_PARENT_GATE); 512 + hws[IMX7D_DRAM_PHYM_ROOT_SRC] = imx_clk_hw_mux2_flags("dram_phym_src", base + 0x9800, 24, 1, dram_phym_sel, ARRAY_SIZE(dram_phym_sel), CLK_SET_PARENT_GATE); 513 + hws[IMX7D_DRAM_ROOT_SRC] = imx_clk_hw_mux2_flags("dram_src", base + 0x9880, 24, 1, dram_sel, ARRAY_SIZE(dram_sel), CLK_SET_PARENT_GATE); 514 + hws[IMX7D_DRAM_PHYM_ALT_ROOT_SRC] = imx_clk_hw_mux2_flags("dram_phym_alt_src", base + 0xa000, 24, 3, dram_phym_alt_sel, ARRAY_SIZE(dram_phym_alt_sel), CLK_SET_PARENT_GATE); 515 + hws[IMX7D_DRAM_ALT_ROOT_SRC] = imx_clk_hw_mux2_flags("dram_alt_src", base + 0xa080, 24, 3, dram_alt_sel, ARRAY_SIZE(dram_alt_sel), CLK_SET_PARENT_GATE); 516 + hws[IMX7D_USB_HSIC_ROOT_SRC] = imx_clk_hw_mux2_flags("usb_hsic_src", base + 0xa100, 24, 3, usb_hsic_sel, ARRAY_SIZE(usb_hsic_sel), CLK_SET_PARENT_GATE); 517 + hws[IMX7D_PCIE_CTRL_ROOT_SRC] = imx_clk_hw_mux2_flags("pcie_ctrl_src", base + 0xa180, 24, 3, pcie_ctrl_sel, ARRAY_SIZE(pcie_ctrl_sel), CLK_SET_PARENT_GATE); 518 + hws[IMX7D_PCIE_PHY_ROOT_SRC] = imx_clk_hw_mux2_flags("pcie_phy_src", base + 0xa200, 24, 3, pcie_phy_sel, ARRAY_SIZE(pcie_phy_sel), CLK_SET_PARENT_GATE); 519 + hws[IMX7D_EPDC_PIXEL_ROOT_SRC] = imx_clk_hw_mux2_flags("epdc_pixel_src", base + 0xa280, 24, 3, epdc_pixel_sel, ARRAY_SIZE(epdc_pixel_sel), CLK_SET_PARENT_GATE); 520 + hws[IMX7D_LCDIF_PIXEL_ROOT_SRC] = imx_clk_hw_mux2_flags("lcdif_pixel_src", base + 0xa300, 24, 3, lcdif_pixel_sel, ARRAY_SIZE(lcdif_pixel_sel), CLK_SET_PARENT_GATE); 521 + hws[IMX7D_MIPI_DSI_ROOT_SRC] = imx_clk_hw_mux2_flags("mipi_dsi_src", base + 0xa380, 24, 3, mipi_dsi_sel, ARRAY_SIZE(mipi_dsi_sel), CLK_SET_PARENT_GATE); 522 + hws[IMX7D_MIPI_CSI_ROOT_SRC] = imx_clk_hw_mux2_flags("mipi_csi_src", base + 0xa400, 24, 3, mipi_csi_sel, ARRAY_SIZE(mipi_csi_sel), CLK_SET_PARENT_GATE); 523 + hws[IMX7D_MIPI_DPHY_ROOT_SRC] = imx_clk_hw_mux2_flags("mipi_dphy_src", base + 0xa480, 24, 3, mipi_dphy_sel, ARRAY_SIZE(mipi_dphy_sel), CLK_SET_PARENT_GATE); 524 + hws[IMX7D_SAI1_ROOT_SRC] = imx_clk_hw_mux2_flags("sai1_src", base + 0xa500, 24, 3, sai1_sel, ARRAY_SIZE(sai1_sel), CLK_SET_PARENT_GATE); 525 + hws[IMX7D_SAI2_ROOT_SRC] = imx_clk_hw_mux2_flags("sai2_src", base + 0xa580, 24, 3, sai2_sel, ARRAY_SIZE(sai2_sel), CLK_SET_PARENT_GATE); 526 + hws[IMX7D_SAI3_ROOT_SRC] = imx_clk_hw_mux2_flags("sai3_src", base + 0xa600, 24, 3, sai3_sel, ARRAY_SIZE(sai3_sel), CLK_SET_PARENT_GATE); 527 + hws[IMX7D_SPDIF_ROOT_SRC] = imx_clk_hw_mux2_flags("spdif_src", base + 0xa680, 24, 3, spdif_sel, ARRAY_SIZE(spdif_sel), CLK_SET_PARENT_GATE); 528 + hws[IMX7D_ENET1_REF_ROOT_SRC] = imx_clk_hw_mux2_flags("enet1_ref_src", base + 0xa700, 24, 3, enet1_ref_sel, ARRAY_SIZE(enet1_ref_sel), CLK_SET_PARENT_GATE); 529 + hws[IMX7D_ENET1_TIME_ROOT_SRC] = imx_clk_hw_mux2_flags("enet1_time_src", base + 0xa780, 24, 3, enet1_time_sel, ARRAY_SIZE(enet1_time_sel), CLK_SET_PARENT_GATE); 530 + hws[IMX7D_ENET2_REF_ROOT_SRC] = imx_clk_hw_mux2_flags("enet2_ref_src", base + 0xa800, 24, 3, enet2_ref_sel, ARRAY_SIZE(enet2_ref_sel), CLK_SET_PARENT_GATE); 531 + hws[IMX7D_ENET2_TIME_ROOT_SRC] = imx_clk_hw_mux2_flags("enet2_time_src", base + 0xa880, 24, 3, enet2_time_sel, ARRAY_SIZE(enet2_time_sel), CLK_SET_PARENT_GATE); 532 + hws[IMX7D_ENET_PHY_REF_ROOT_SRC] = imx_clk_hw_mux2_flags("enet_phy_ref_src", base + 0xa900, 24, 3, enet_phy_ref_sel, ARRAY_SIZE(enet_phy_ref_sel), CLK_SET_PARENT_GATE); 533 + hws[IMX7D_EIM_ROOT_SRC] = imx_clk_hw_mux2_flags("eim_src", base + 0xa980, 24, 3, eim_sel, ARRAY_SIZE(eim_sel), CLK_SET_PARENT_GATE); 534 + hws[IMX7D_NAND_ROOT_SRC] = imx_clk_hw_mux2_flags("nand_src", base + 0xaa00, 24, 3, nand_sel, ARRAY_SIZE(nand_sel), CLK_SET_PARENT_GATE); 535 + hws[IMX7D_QSPI_ROOT_SRC] = imx_clk_hw_mux2_flags("qspi_src", base + 0xaa80, 24, 3, qspi_sel, ARRAY_SIZE(qspi_sel), CLK_SET_PARENT_GATE); 536 + hws[IMX7D_USDHC1_ROOT_SRC] = imx_clk_hw_mux2_flags("usdhc1_src", base + 0xab00, 24, 3, usdhc1_sel, ARRAY_SIZE(usdhc1_sel), CLK_SET_PARENT_GATE); 537 + hws[IMX7D_USDHC2_ROOT_SRC] = imx_clk_hw_mux2_flags("usdhc2_src", base + 0xab80, 24, 3, usdhc2_sel, ARRAY_SIZE(usdhc2_sel), CLK_SET_PARENT_GATE); 538 + hws[IMX7D_USDHC3_ROOT_SRC] = imx_clk_hw_mux2_flags("usdhc3_src", base + 0xac00, 24, 3, usdhc3_sel, ARRAY_SIZE(usdhc3_sel), CLK_SET_PARENT_GATE); 539 + hws[IMX7D_CAN1_ROOT_SRC] = imx_clk_hw_mux2_flags("can1_src", base + 0xac80, 24, 3, can1_sel, ARRAY_SIZE(can1_sel), CLK_SET_PARENT_GATE); 540 + hws[IMX7D_CAN2_ROOT_SRC] = imx_clk_hw_mux2_flags("can2_src", base + 0xad00, 24, 3, can2_sel, ARRAY_SIZE(can2_sel), CLK_SET_PARENT_GATE); 541 + hws[IMX7D_I2C1_ROOT_SRC] = imx_clk_hw_mux2_flags("i2c1_src", base + 0xad80, 24, 3, i2c1_sel, ARRAY_SIZE(i2c1_sel), CLK_SET_PARENT_GATE); 542 + hws[IMX7D_I2C2_ROOT_SRC] = imx_clk_hw_mux2_flags("i2c2_src", base + 0xae00, 24, 3, i2c2_sel, ARRAY_SIZE(i2c2_sel), CLK_SET_PARENT_GATE); 543 + hws[IMX7D_I2C3_ROOT_SRC] = imx_clk_hw_mux2_flags("i2c3_src", base + 0xae80, 24, 3, i2c3_sel, ARRAY_SIZE(i2c3_sel), CLK_SET_PARENT_GATE); 544 + hws[IMX7D_I2C4_ROOT_SRC] = imx_clk_hw_mux2_flags("i2c4_src", base + 0xaf00, 24, 3, i2c4_sel, ARRAY_SIZE(i2c4_sel), CLK_SET_PARENT_GATE); 545 + hws[IMX7D_UART1_ROOT_SRC] = imx_clk_hw_mux2_flags("uart1_src", base + 0xaf80, 24, 3, uart1_sel, ARRAY_SIZE(uart1_sel), CLK_SET_PARENT_GATE); 546 + hws[IMX7D_UART2_ROOT_SRC] = imx_clk_hw_mux2_flags("uart2_src", base + 0xb000, 24, 3, uart2_sel, ARRAY_SIZE(uart2_sel), CLK_SET_PARENT_GATE); 547 + hws[IMX7D_UART3_ROOT_SRC] = imx_clk_hw_mux2_flags("uart3_src", base + 0xb080, 24, 3, uart3_sel, ARRAY_SIZE(uart3_sel), CLK_SET_PARENT_GATE); 548 + hws[IMX7D_UART4_ROOT_SRC] = imx_clk_hw_mux2_flags("uart4_src", base + 0xb100, 24, 3, uart4_sel, ARRAY_SIZE(uart4_sel), CLK_SET_PARENT_GATE); 549 + hws[IMX7D_UART5_ROOT_SRC] = imx_clk_hw_mux2_flags("uart5_src", base + 0xb180, 24, 3, uart5_sel, ARRAY_SIZE(uart5_sel), CLK_SET_PARENT_GATE); 550 + hws[IMX7D_UART6_ROOT_SRC] = imx_clk_hw_mux2_flags("uart6_src", base + 0xb200, 24, 3, uart6_sel, ARRAY_SIZE(uart6_sel), CLK_SET_PARENT_GATE); 551 + hws[IMX7D_UART7_ROOT_SRC] = imx_clk_hw_mux2_flags("uart7_src", base + 0xb280, 24, 3, uart7_sel, ARRAY_SIZE(uart7_sel), CLK_SET_PARENT_GATE); 552 + hws[IMX7D_ECSPI1_ROOT_SRC] = imx_clk_hw_mux2_flags("ecspi1_src", base + 0xb300, 24, 3, ecspi1_sel, ARRAY_SIZE(ecspi1_sel), CLK_SET_PARENT_GATE); 553 + hws[IMX7D_ECSPI2_ROOT_SRC] = imx_clk_hw_mux2_flags("ecspi2_src", base + 0xb380, 24, 3, ecspi2_sel, ARRAY_SIZE(ecspi2_sel), CLK_SET_PARENT_GATE); 554 + hws[IMX7D_ECSPI3_ROOT_SRC] = imx_clk_hw_mux2_flags("ecspi3_src", base + 0xb400, 24, 3, ecspi3_sel, ARRAY_SIZE(ecspi3_sel), CLK_SET_PARENT_GATE); 555 + hws[IMX7D_ECSPI4_ROOT_SRC] = imx_clk_hw_mux2_flags("ecspi4_src", base + 0xb480, 24, 3, ecspi4_sel, ARRAY_SIZE(ecspi4_sel), CLK_SET_PARENT_GATE); 556 + hws[IMX7D_PWM1_ROOT_SRC] = imx_clk_hw_mux2_flags("pwm1_src", base + 0xb500, 24, 3, pwm1_sel, ARRAY_SIZE(pwm1_sel), CLK_SET_PARENT_GATE); 557 + hws[IMX7D_PWM2_ROOT_SRC] = imx_clk_hw_mux2_flags("pwm2_src", base + 0xb580, 24, 3, pwm2_sel, ARRAY_SIZE(pwm2_sel), CLK_SET_PARENT_GATE); 558 + hws[IMX7D_PWM3_ROOT_SRC] = imx_clk_hw_mux2_flags("pwm3_src", base + 0xb600, 24, 3, pwm3_sel, ARRAY_SIZE(pwm3_sel), CLK_SET_PARENT_GATE); 559 + hws[IMX7D_PWM4_ROOT_SRC] = imx_clk_hw_mux2_flags("pwm4_src", base + 0xb680, 24, 3, pwm4_sel, ARRAY_SIZE(pwm4_sel), CLK_SET_PARENT_GATE); 560 + hws[IMX7D_FLEXTIMER1_ROOT_SRC] = imx_clk_hw_mux2_flags("flextimer1_src", base + 0xb700, 24, 3, flextimer1_sel, ARRAY_SIZE(flextimer1_sel), CLK_SET_PARENT_GATE); 561 + hws[IMX7D_FLEXTIMER2_ROOT_SRC] = imx_clk_hw_mux2_flags("flextimer2_src", base + 0xb780, 24, 3, flextimer2_sel, ARRAY_SIZE(flextimer2_sel), CLK_SET_PARENT_GATE); 562 + hws[IMX7D_SIM1_ROOT_SRC] = imx_clk_hw_mux2_flags("sim1_src", base + 0xb800, 24, 3, sim1_sel, ARRAY_SIZE(sim1_sel), CLK_SET_PARENT_GATE); 563 + hws[IMX7D_SIM2_ROOT_SRC] = imx_clk_hw_mux2_flags("sim2_src", base + 0xb880, 24, 3, sim2_sel, ARRAY_SIZE(sim2_sel), CLK_SET_PARENT_GATE); 564 + hws[IMX7D_GPT1_ROOT_SRC] = imx_clk_hw_mux2_flags("gpt1_src", base + 0xb900, 24, 3, gpt1_sel, ARRAY_SIZE(gpt1_sel), CLK_SET_PARENT_GATE); 565 + hws[IMX7D_GPT2_ROOT_SRC] = imx_clk_hw_mux2_flags("gpt2_src", base + 0xb980, 24, 3, gpt2_sel, ARRAY_SIZE(gpt2_sel), CLK_SET_PARENT_GATE); 566 + hws[IMX7D_GPT3_ROOT_SRC] = imx_clk_hw_mux2_flags("gpt3_src", base + 0xba00, 24, 3, gpt3_sel, ARRAY_SIZE(gpt3_sel), CLK_SET_PARENT_GATE); 567 + hws[IMX7D_GPT4_ROOT_SRC] = imx_clk_hw_mux2_flags("gpt4_src", base + 0xba80, 24, 3, gpt4_sel, ARRAY_SIZE(gpt4_sel), CLK_SET_PARENT_GATE); 568 + hws[IMX7D_TRACE_ROOT_SRC] = imx_clk_hw_mux2_flags("trace_src", base + 0xbb00, 24, 3, trace_sel, ARRAY_SIZE(trace_sel), CLK_SET_PARENT_GATE); 569 + hws[IMX7D_WDOG_ROOT_SRC] = imx_clk_hw_mux2_flags("wdog_src", base + 0xbb80, 24, 3, wdog_sel, ARRAY_SIZE(wdog_sel), CLK_SET_PARENT_GATE); 570 + hws[IMX7D_CSI_MCLK_ROOT_SRC] = imx_clk_hw_mux2_flags("csi_mclk_src", base + 0xbc00, 24, 3, csi_mclk_sel, ARRAY_SIZE(csi_mclk_sel), CLK_SET_PARENT_GATE); 571 + hws[IMX7D_AUDIO_MCLK_ROOT_SRC] = imx_clk_hw_mux2_flags("audio_mclk_src", base + 0xbc80, 24, 3, audio_mclk_sel, ARRAY_SIZE(audio_mclk_sel), CLK_SET_PARENT_GATE); 572 + hws[IMX7D_WRCLK_ROOT_SRC] = imx_clk_hw_mux2_flags("wrclk_src", base + 0xbd00, 24, 3, wrclk_sel, ARRAY_SIZE(wrclk_sel), CLK_SET_PARENT_GATE); 573 + hws[IMX7D_CLKO1_ROOT_SRC] = imx_clk_hw_mux2_flags("clko1_src", base + 0xbd80, 24, 3, clko1_sel, ARRAY_SIZE(clko1_sel), CLK_SET_PARENT_GATE); 574 + hws[IMX7D_CLKO2_ROOT_SRC] = imx_clk_hw_mux2_flags("clko2_src", base + 0xbe00, 24, 3, clko2_sel, ARRAY_SIZE(clko2_sel), CLK_SET_PARENT_GATE); 575 575 576 576 hws[IMX7D_ARM_A7_ROOT_CG] = imx_clk_hw_gate3("arm_a7_cg", "arm_a7_src", base + 0x8000, 28); 577 577 hws[IMX7D_ARM_M4_ROOT_CG] = imx_clk_hw_gate3("arm_m4_cg", "arm_m4_src", base + 0x8080, 28);
+4
drivers/clk/imx/clk-imx8mm.c
··· 657 657 }, 658 658 }; 659 659 module_platform_driver(imx8mm_clk_driver); 660 + 661 + MODULE_AUTHOR("Bai Ping <ping.bai@nxp.com>"); 662 + MODULE_DESCRIPTION("NXP i.MX8MM clock driver"); 663 + MODULE_LICENSE("GPL v2");
+4
drivers/clk/imx/clk-imx8mn.c
··· 608 608 }, 609 609 }; 610 610 module_platform_driver(imx8mn_clk_driver); 611 + 612 + MODULE_AUTHOR("Anson Huang <Anson.Huang@nxp.com>"); 613 + MODULE_DESCRIPTION("NXP i.MX8MN clock driver"); 614 + MODULE_LICENSE("GPL v2");
+13 -15
drivers/clk/imx/clk-imx8mp.c
··· 152 152 "sys_pll1_160m", "sys_pll1_800m", "sys_pll3_out", 153 153 "sys_pll2_250m", "audio_pll2_out", }; 154 154 155 - static const char * const imx8mp_memrepair_sels[] = {"osc_24m", "sys_pll1_160m", "sys_pll2_50m", 156 - "sys_pll3_out", "audio_pll1_out", "video_pll1_out", 157 - "audio_pll2_out", "sys_pll1_133m", }; 158 - 159 155 static const char * const imx8mp_pcie_phy_sels[] = {"osc_24m", "sys_pll2_100m", "sys_pll2_500m", 160 156 "clk_ext1", "clk_ext2", "clk_ext3", 161 157 "clk_ext4", "sys_pll1_400m", }; ··· 371 375 "sys_pll3_out", "audio_pll2_out", 372 376 "video_pll1_out", }; 373 377 374 - static const char * const imx8mp_media_mipi_phy2_ref_sels[] = {"osc_24m", "sys_pll2_333m", "sys_pll2_100m", 375 - "sys_pll1_800m", "sys_pll2_1000m", 376 - "clk_ext2", "audio_pll2_out", 377 - "video_pll1_out", }; 378 + static const char * const imx8mp_media_ldb_sels[] = {"osc_24m", "sys_pll2_333m", "sys_pll2_100m", 379 + "sys_pll1_800m", "sys_pll2_1000m", 380 + "clk_ext2", "audio_pll2_out", 381 + "video_pll1_out", }; 378 382 379 - static const char * const imx8mp_media_mipi_csi2_esc_sels[] = {"osc_24m", "sys_pll2_100m", "sys_pll1_80m", 380 - "sys_pll1_800m", "sys_pll2_1000m", 381 - "sys_pll3_out", "clk_ext3", 382 - "audio_pll2_out", }; 383 + static const char * const imx8mp_memrepair_sels[] = {"osc_24m", "sys_pll2_100m", "sys_pll1_80m", 384 + "sys_pll1_800m", "sys_pll2_1000m", "sys_pll3_out", 385 + "clk_ext3", "audio_pll2_out", }; 383 386 384 387 static const char * const imx8mp_pcie2_ctrl_sels[] = {"osc_24m", "sys_pll2_250m", "sys_pll2_200m", 385 388 "sys_pll1_266m", "sys_pll1_800m", "sys_pll2_500m", ··· 585 590 hws[IMX8MP_CLK_VPU_G2] = imx8m_clk_hw_composite("vpu_g2", imx8mp_vpu_g2_sels, ccm_base + 0xa180); 586 591 hws[IMX8MP_CLK_CAN1] = imx8m_clk_hw_composite("can1", imx8mp_can1_sels, ccm_base + 0xa200); 587 592 hws[IMX8MP_CLK_CAN2] = imx8m_clk_hw_composite("can2", imx8mp_can2_sels, ccm_base + 0xa280); 588 - hws[IMX8MP_CLK_MEMREPAIR] = imx8m_clk_hw_composite("memrepair", imx8mp_memrepair_sels, ccm_base + 0xa300); 589 593 hws[IMX8MP_CLK_PCIE_PHY] = imx8m_clk_hw_composite("pcie_phy", imx8mp_pcie_phy_sels, ccm_base + 0xa380); 590 594 hws[IMX8MP_CLK_PCIE_AUX] = imx8m_clk_hw_composite("pcie_aux", imx8mp_pcie_aux_sels, ccm_base + 0xa400); 591 595 hws[IMX8MP_CLK_I2C5] = imx8m_clk_hw_composite("i2c5", imx8mp_i2c5_sels, ccm_base + 0xa480); ··· 641 647 hws[IMX8MP_CLK_MEDIA_MIPI_PHY1_REF] = imx8m_clk_hw_composite("media_mipi_phy1_ref", imx8mp_media_mipi_phy1_ref_sels, ccm_base + 0xbd80); 642 648 hws[IMX8MP_CLK_MEDIA_DISP1_PIX] = imx8m_clk_hw_composite("media_disp1_pix", imx8mp_media_disp1_pix_sels, ccm_base + 0xbe00); 643 649 hws[IMX8MP_CLK_MEDIA_CAM2_PIX] = imx8m_clk_hw_composite("media_cam2_pix", imx8mp_media_cam2_pix_sels, ccm_base + 0xbe80); 644 - hws[IMX8MP_CLK_MEDIA_MIPI_PHY2_REF] = imx8m_clk_hw_composite("media_mipi_phy2_ref", imx8mp_media_mipi_phy2_ref_sels, ccm_base + 0xbf00); 645 - hws[IMX8MP_CLK_MEDIA_MIPI_CSI2_ESC] = imx8m_clk_hw_composite("media_mipi_csi2_esc", imx8mp_media_mipi_csi2_esc_sels, ccm_base + 0xbf80); 650 + hws[IMX8MP_CLK_MEDIA_LDB] = imx8m_clk_hw_composite("media_ldb", imx8mp_media_ldb_sels, ccm_base + 0xbf00); 651 + hws[IMX8MP_CLK_MEMREPAIR] = imx8m_clk_hw_composite_critical("mem_repair", imx8mp_memrepair_sels, ccm_base + 0xbf80); 646 652 hws[IMX8MP_CLK_PCIE2_CTRL] = imx8m_clk_hw_composite("pcie2_ctrl", imx8mp_pcie2_ctrl_sels, ccm_base + 0xc000); 647 653 hws[IMX8MP_CLK_PCIE2_PHY] = imx8m_clk_hw_composite("pcie2_phy", imx8mp_pcie2_phy_sels, ccm_base + 0xc080); 648 654 hws[IMX8MP_CLK_MEDIA_MIPI_TEST_BYTE] = imx8m_clk_hw_composite("media_mipi_test_byte", imx8mp_media_mipi_test_byte_sels, ccm_base + 0xc100); ··· 767 773 }, 768 774 }; 769 775 module_platform_driver(imx8mp_clk_driver); 776 + 777 + MODULE_AUTHOR("Anson Huang <Anson.Huang@nxp.com>"); 778 + MODULE_DESCRIPTION("NXP i.MX8MP clock driver"); 779 + MODULE_LICENSE("GPL v2");
+6 -2
drivers/clk/imx/clk-imx8mq.c
··· 157 157 "audio_pll2_out", "sys1_pll_266m", "sys3_pll_out", "sys1_pll_100m", }; 158 158 159 159 static const char * const imx8mq_usdhc1_sels[] = {"osc_25m", "sys1_pll_400m", "sys1_pll_800m", "sys2_pll_500m", 160 - "audio_pll2_out", "sys1_pll_266m", "sys3_pll_out", "sys1_pll_100m", }; 160 + "sys3_pll_out", "sys1_pll_266m", "audio_pll2_out", "sys1_pll_100m", }; 161 161 162 162 static const char * const imx8mq_usdhc2_sels[] = {"osc_25m", "sys1_pll_400m", "sys1_pll_800m", "sys2_pll_500m", 163 - "audio_pll2_out", "sys1_pll_266m", "sys3_pll_out", "sys1_pll_100m", }; 163 + "sys3_pll_out", "sys1_pll_266m", "audio_pll2_out", "sys1_pll_100m", }; 164 164 165 165 static const char * const imx8mq_i2c1_sels[] = {"osc_25m", "sys1_pll_160m", "sys2_pll_50m", "sys3_pll_out", "audio_pll1_out", 166 166 "video_pll1_out", "audio_pll2_out", "sys1_pll_133m", }; ··· 643 643 }, 644 644 }; 645 645 module_platform_driver(imx8mq_clk_driver); 646 + 647 + MODULE_AUTHOR("Abel Vesa <abel.vesa@nxp.com>"); 648 + MODULE_DESCRIPTION("NXP i.MX8MQ clock driver"); 649 + MODULE_LICENSE("GPL v2");
+4
drivers/clk/imx/clk-imx8qxp-lpcg.c
··· 232 232 }; 233 233 234 234 builtin_platform_driver(imx8qxp_lpcg_clk_driver); 235 + 236 + MODULE_AUTHOR("Aisheng Dong <aisheng.dong@nxp.com>"); 237 + MODULE_DESCRIPTION("NXP i.MX8QXP LPCG clock driver"); 238 + MODULE_LICENSE("GPL v2");
+4
drivers/clk/imx/clk-imx8qxp.c
··· 152 152 .probe = imx8qxp_clk_probe, 153 153 }; 154 154 builtin_platform_driver(imx8qxp_clk_driver); 155 + 156 + MODULE_AUTHOR("Aisheng Dong <aisheng.dong@nxp.com>"); 157 + MODULE_DESCRIPTION("NXP i.MX8QXP clock driver"); 158 + MODULE_LICENSE("GPL v2");
+1
drivers/clk/imx/clk-lpcg-scu.c
··· 4 4 * Dong Aisheng <aisheng.dong@nxp.com> 5 5 */ 6 6 7 + #include <linux/bits.h> 7 8 #include <linux/clk-provider.h> 8 9 #include <linux/err.h> 9 10 #include <linux/io.h>
+1 -1
drivers/clk/imx/clk-pfd.c
··· 12 12 13 13 /** 14 14 * struct clk_pfd - IMX PFD clock 15 - * @clk_hw: clock source 15 + * @hw: clock source 16 16 * @reg: PFD register address 17 17 * @idx: the index of PFD encoded in the register 18 18 *
+1 -1
drivers/clk/imx/clk-pfdv2.c
··· 17 17 18 18 /** 19 19 * struct clk_pfdv2 - IMX PFD clock 20 - * @clk_hw: clock source 20 + * @hw: clock source 21 21 * @reg: PFD register address 22 22 * @gate_bit: Gate bit offset 23 23 * @vld_bit: Valid bit offset
+6 -1
drivers/clk/imx/clk-pll14xx.c
··· 3 3 * Copyright 2017-2018 NXP. 4 4 */ 5 5 6 - #include <linux/bitops.h> 6 + #include <linux/bits.h> 7 7 #include <linux/clk-provider.h> 8 8 #include <linux/err.h> 9 + #include <linux/export.h> 9 10 #include <linux/io.h> 10 11 #include <linux/iopoll.h> 11 12 #include <linux/slab.h> ··· 69 68 .rate_table = imx_pll1443x_tbl, 70 69 .rate_count = ARRAY_SIZE(imx_pll1443x_tbl), 71 70 }; 71 + EXPORT_SYMBOL_GPL(imx_1443x_pll); 72 72 73 73 struct imx_pll14xx_clk imx_1443x_dram_pll = { 74 74 .type = PLL_1443X, ··· 77 75 .rate_count = ARRAY_SIZE(imx_pll1443x_tbl), 78 76 .flags = CLK_GET_RATE_NOCACHE, 79 77 }; 78 + EXPORT_SYMBOL_GPL(imx_1443x_dram_pll); 80 79 81 80 struct imx_pll14xx_clk imx_1416x_pll = { 82 81 .type = PLL_1416X, 83 82 .rate_table = imx_pll1416x_tbl, 84 83 .rate_count = ARRAY_SIZE(imx_pll1416x_tbl), 85 84 }; 85 + EXPORT_SYMBOL_GPL(imx_1416x_pll); 86 86 87 87 static const struct imx_pll14xx_rate_table *imx_get_pll_settings( 88 88 struct clk_pll14xx *pll, unsigned long rate) ··· 440 436 441 437 return hw; 442 438 } 439 + EXPORT_SYMBOL_GPL(imx_dev_clk_hw_pll14xx);
+1
drivers/clk/imx/clk-pllv1.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 + #include <linux/bits.h> 2 3 #include <linux/clk-provider.h> 3 4 #include <linux/io.h> 4 5 #include <linux/slab.h>
+4 -1
drivers/clk/imx/clk-pllv3.c
··· 30 30 31 31 /** 32 32 * struct clk_pllv3 - IMX PLL clock version 3 33 - * @clk_hw: clock source 33 + * @hw: clock source 34 34 * @base: base address of PLL registers 35 35 * @power_bit: pll power bit mask 36 36 * @powerup_set: set power_bit to power up the PLL 37 37 * @div_mask: mask of divider bits 38 38 * @div_shift: shift of divider bits 39 + * @ref_clock: reference clock rate 40 + * @num_offset: num register offset 41 + * @denom_offset: denom register offset 39 42 * 40 43 * IMX PLL clock version 3, found on i.MX6 series. Divider for pllv3 41 44 * is actually a multiplier, and always sits at bit 0.
+1
drivers/clk/imx/clk-pllv4.c
··· 7 7 * 8 8 */ 9 9 10 + #include <linux/bits.h> 10 11 #include <linux/clk-provider.h> 11 12 #include <linux/err.h> 12 13 #include <linux/io.h>
+2
drivers/clk/imx/clk-sscg-pll.c
··· 10 10 11 11 #include <linux/clk-provider.h> 12 12 #include <linux/err.h> 13 + #include <linux/export.h> 13 14 #include <linux/io.h> 14 15 #include <linux/iopoll.h> 15 16 #include <linux/slab.h> ··· 538 537 539 538 return hw; 540 539 } 540 + EXPORT_SYMBOL_GPL(imx_clk_hw_sscg_pll);
+2
drivers/clk/imx/clk-vf610.c
··· 4 4 */ 5 5 6 6 #include <linux/of_address.h> 7 + #include <linux/bits.h> 7 8 #include <linux/clk.h> 8 9 #include <linux/syscore_ops.h> 9 10 #include <dt-bindings/clock/vf610-clock.h> ··· 329 328 clk[VF610_CLK_DSPI2] = imx_clk_gate2("dspi2", "ipg_bus", CCM_CCGR6, CCM_CCGRx_CGn(12)); 330 329 clk[VF610_CLK_DSPI3] = imx_clk_gate2("dspi3", "ipg_bus", CCM_CCGR6, CCM_CCGRx_CGn(13)); 331 330 331 + clk[VF610_CLK_CRC] = imx_clk_gate2("crc", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(3)); 332 332 clk[VF610_CLK_WDT] = imx_clk_gate2("wdt", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(14)); 333 333 334 334 clk[VF610_CLK_ESDHC0_SEL] = imx_clk_mux("esdhc0_sel", CCM_CSCMR1, 16, 2, esdhc_sels, 4);
+14 -4
drivers/clk/imx/clk.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 + #include <linux/bits.h> 2 3 #include <linux/clk.h> 3 4 #include <linux/clk-provider.h> 4 5 #include <linux/err.h> 5 6 #include <linux/io.h> 7 + #include <linux/module.h> 6 8 #include <linux/of.h> 7 9 #include <linux/slab.h> 8 10 #include <linux/spinlock.h> ··· 15 13 #define CCDR_MMDC_CH1_MASK BIT(16) 16 14 17 15 DEFINE_SPINLOCK(imx_ccm_lock); 16 + EXPORT_SYMBOL_GPL(imx_ccm_lock); 18 17 19 18 void imx_unregister_clocks(struct clk *clks[], unsigned int count) 20 19 { ··· 32 29 for (i = 0; i < count; i++) 33 30 clk_hw_unregister(hws[i]); 34 31 } 32 + EXPORT_SYMBOL_GPL(imx_unregister_hw_clocks); 35 33 36 - void __init imx_mmdc_mask_handshake(void __iomem *ccm_base, 34 + void imx_mmdc_mask_handshake(void __iomem *ccm_base, 37 35 unsigned int chn) 38 36 { 39 37 unsigned int reg; ··· 63 59 pr_err("i.MX clk %u: register failed with %ld\n", 64 60 i, PTR_ERR(clks[i])); 65 61 } 62 + EXPORT_SYMBOL_GPL(imx_check_clk_hws); 66 63 67 - static struct clk * __init imx_obtain_fixed_clock_from_dt(const char *name) 64 + static struct clk *imx_obtain_fixed_clock_from_dt(const char *name) 68 65 { 69 66 struct of_phandle_args phandle; 70 67 struct clk *clk = ERR_PTR(-ENODEV); ··· 85 80 return clk; 86 81 } 87 82 88 - struct clk * __init imx_obtain_fixed_clock( 83 + struct clk *imx_obtain_fixed_clock( 89 84 const char *name, unsigned long rate) 90 85 { 91 86 struct clk *clk; ··· 96 91 return clk; 97 92 } 98 93 99 - struct clk_hw * __init imx_obtain_fixed_clock_hw( 94 + struct clk_hw *imx_obtain_fixed_clock_hw( 100 95 const char *name, unsigned long rate) 101 96 { 102 97 struct clk *clk; ··· 118 113 119 114 return __clk_get_hw(clk); 120 115 } 116 + EXPORT_SYMBOL_GPL(imx_obtain_fixed_clk_hw); 121 117 122 118 /* 123 119 * This fixups the register CCM_CSCMR1 write value. ··· 146 140 return; 147 141 } 148 142 143 + #ifndef MODULE 149 144 static int imx_keep_uart_clocks; 150 145 static struct clk ** const *imx_uart_clocks; 151 146 ··· 184 177 return 0; 185 178 } 186 179 late_initcall_sync(imx_clk_disable_uart); 180 + #endif 181 + 182 + MODULE_LICENSE("GPL v2");
+7
drivers/clk/imx/clk.h
··· 2 2 #ifndef __MACH_IMX_CLK_H 3 3 #define __MACH_IMX_CLK_H 4 4 5 + #include <linux/bits.h> 5 6 #include <linux/spinlock.h> 6 7 #include <linux/clk-provider.h> 7 8 ··· 12 11 13 12 void imx_check_clocks(struct clk *clks[], unsigned int count); 14 13 void imx_check_clk_hws(struct clk_hw *clks[], unsigned int count); 14 + #ifndef MODULE 15 15 void imx_register_uart_clocks(struct clk ** const clks[]); 16 + #else 17 + static inline void imx_register_uart_clocks(struct clk ** const clks[]) 18 + { 19 + } 20 + #endif 16 21 void imx_mmdc_mask_handshake(void __iomem *ccm_base, unsigned int chn); 17 22 void imx_unregister_clocks(struct clk *clks[], unsigned int count); 18 23 void imx_unregister_hw_clocks(struct clk_hw *hws[], unsigned int count);
+60 -74
drivers/clk/ingenic/cgu.c
··· 12 12 #include <linux/clkdev.h> 13 13 #include <linux/delay.h> 14 14 #include <linux/io.h> 15 + #include <linux/iopoll.h> 15 16 #include <linux/math64.h> 16 17 #include <linux/of.h> 17 18 #include <linux/of_address.h> 18 19 #include <linux/slab.h> 19 20 #include <linux/spinlock.h> 21 + #include <linux/time.h> 22 + 20 23 #include "cgu.h" 21 24 22 25 #define MHZ (1000 * 1000) 26 + 27 + static inline const struct ingenic_cgu_clk_info * 28 + to_clk_info(struct ingenic_clk *clk) 29 + { 30 + return &clk->cgu->clock_info[clk->idx]; 31 + } 23 32 24 33 /** 25 34 * ingenic_cgu_gate_get() - get the value of clock gate register bit ··· 80 71 ingenic_pll_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) 81 72 { 82 73 struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 74 + const struct ingenic_cgu_clk_info *clk_info = to_clk_info(ingenic_clk); 83 75 struct ingenic_cgu *cgu = ingenic_clk->cgu; 84 - const struct ingenic_cgu_clk_info *clk_info; 85 76 const struct ingenic_cgu_pll_info *pll_info; 86 77 unsigned m, n, od_enc, od; 87 78 bool bypass; 88 79 u32 ctl; 89 80 90 - clk_info = &cgu->clock_info[ingenic_clk->idx]; 91 81 BUG_ON(clk_info->type != CGU_CLK_PLL); 92 82 pll_info = &clk_info->pll; 93 83 ··· 152 144 n * od); 153 145 } 154 146 155 - static inline const struct ingenic_cgu_clk_info *to_clk_info( 156 - struct ingenic_clk *ingenic_clk) 157 - { 158 - struct ingenic_cgu *cgu = ingenic_clk->cgu; 159 - const struct ingenic_cgu_clk_info *clk_info; 160 - 161 - clk_info = &cgu->clock_info[ingenic_clk->idx]; 162 - BUG_ON(clk_info->type != CGU_CLK_PLL); 163 - 164 - return clk_info; 165 - } 166 - 167 147 static long 168 148 ingenic_pll_round_rate(struct clk_hw *hw, unsigned long req_rate, 169 149 unsigned long *prate) ··· 160 164 const struct ingenic_cgu_clk_info *clk_info = to_clk_info(ingenic_clk); 161 165 162 166 return ingenic_pll_calc(clk_info, req_rate, *prate, NULL, NULL, NULL); 167 + } 168 + 169 + static inline int ingenic_pll_check_stable(struct ingenic_cgu *cgu, 170 + const struct ingenic_cgu_pll_info *pll_info) 171 + { 172 + u32 ctl; 173 + 174 + return readl_poll_timeout(cgu->base + pll_info->reg, ctl, 175 + ctl & BIT(pll_info->stable_bit), 176 + 0, 100 * USEC_PER_MSEC); 163 177 } 164 178 165 179 static int ··· 182 176 const struct ingenic_cgu_pll_info *pll_info = &clk_info->pll; 183 177 unsigned long rate, flags; 184 178 unsigned int m, n, od; 179 + int ret = 0; 185 180 u32 ctl; 186 181 187 182 rate = ingenic_pll_calc(clk_info, req_rate, parent_rate, ··· 204 197 ctl |= pll_info->od_encoding[od - 1] << pll_info->od_shift; 205 198 206 199 writel(ctl, cgu->base + pll_info->reg); 200 + 201 + /* If the PLL is enabled, verify that it's stable */ 202 + if (ctl & BIT(pll_info->enable_bit)) 203 + ret = ingenic_pll_check_stable(cgu, pll_info); 204 + 207 205 spin_unlock_irqrestore(&cgu->lock, flags); 208 206 209 - return 0; 207 + return ret; 210 208 } 211 209 212 210 static int ingenic_pll_enable(struct clk_hw *hw) ··· 220 208 struct ingenic_cgu *cgu = ingenic_clk->cgu; 221 209 const struct ingenic_cgu_clk_info *clk_info = to_clk_info(ingenic_clk); 222 210 const struct ingenic_cgu_pll_info *pll_info = &clk_info->pll; 223 - const unsigned int timeout = 100; 224 211 unsigned long flags; 225 - unsigned int i; 212 + int ret; 226 213 u32 ctl; 227 214 228 215 spin_lock_irqsave(&cgu->lock, flags); ··· 237 226 238 227 writel(ctl, cgu->base + pll_info->reg); 239 228 240 - /* wait for the PLL to stabilise */ 241 - for (i = 0; i < timeout; i++) { 242 - ctl = readl(cgu->base + pll_info->reg); 243 - if (ctl & BIT(pll_info->stable_bit)) 244 - break; 245 - mdelay(1); 246 - } 247 - 229 + ret = ingenic_pll_check_stable(cgu, pll_info); 248 230 spin_unlock_irqrestore(&cgu->lock, flags); 249 231 250 - if (i == timeout) 251 - return -EBUSY; 252 - 253 - return 0; 232 + return ret; 254 233 } 255 234 256 235 static void ingenic_pll_disable(struct clk_hw *hw) ··· 291 290 static u8 ingenic_clk_get_parent(struct clk_hw *hw) 292 291 { 293 292 struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 293 + const struct ingenic_cgu_clk_info *clk_info = to_clk_info(ingenic_clk); 294 294 struct ingenic_cgu *cgu = ingenic_clk->cgu; 295 - const struct ingenic_cgu_clk_info *clk_info; 296 295 u32 reg; 297 296 u8 i, hw_idx, idx = 0; 298 - 299 - clk_info = &cgu->clock_info[ingenic_clk->idx]; 300 297 301 298 if (clk_info->type & CGU_CLK_MUX) { 302 299 reg = readl(cgu->base + clk_info->mux.reg); ··· 317 318 static int ingenic_clk_set_parent(struct clk_hw *hw, u8 idx) 318 319 { 319 320 struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 321 + const struct ingenic_cgu_clk_info *clk_info = to_clk_info(ingenic_clk); 320 322 struct ingenic_cgu *cgu = ingenic_clk->cgu; 321 - const struct ingenic_cgu_clk_info *clk_info; 322 323 unsigned long flags; 323 324 u8 curr_idx, hw_idx, num_poss; 324 325 u32 reg, mask; 325 - 326 - clk_info = &cgu->clock_info[ingenic_clk->idx]; 327 326 328 327 if (clk_info->type & CGU_CLK_MUX) { 329 328 /* ··· 365 368 ingenic_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) 366 369 { 367 370 struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 371 + const struct ingenic_cgu_clk_info *clk_info = to_clk_info(ingenic_clk); 368 372 struct ingenic_cgu *cgu = ingenic_clk->cgu; 369 - const struct ingenic_cgu_clk_info *clk_info; 370 373 unsigned long rate = parent_rate; 371 374 u32 div_reg, div; 372 - 373 - clk_info = &cgu->clock_info[ingenic_clk->idx]; 374 375 375 376 if (clk_info->type & CGU_CLK_DIV) { 376 377 div_reg = readl(cgu->base + clk_info->div.reg); ··· 438 443 unsigned long *parent_rate) 439 444 { 440 445 struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 441 - struct ingenic_cgu *cgu = ingenic_clk->cgu; 442 - const struct ingenic_cgu_clk_info *clk_info; 446 + const struct ingenic_cgu_clk_info *clk_info = to_clk_info(ingenic_clk); 443 447 unsigned int div = 1; 444 - 445 - clk_info = &cgu->clock_info[ingenic_clk->idx]; 446 448 447 449 if (clk_info->type & CGU_CLK_DIV) 448 450 div = ingenic_clk_calc_div(clk_info, *parent_rate, req_rate); 449 451 else if (clk_info->type & CGU_CLK_FIXDIV) 450 452 div = clk_info->fixdiv.div; 453 + else if (clk_hw_can_set_rate_parent(hw)) 454 + *parent_rate = req_rate; 451 455 452 456 return DIV_ROUND_UP(*parent_rate, div); 457 + } 458 + 459 + static inline int ingenic_clk_check_stable(struct ingenic_cgu *cgu, 460 + const struct ingenic_cgu_clk_info *clk_info) 461 + { 462 + u32 reg; 463 + 464 + return readl_poll_timeout(cgu->base + clk_info->div.reg, reg, 465 + !(reg & BIT(clk_info->div.busy_bit)), 466 + 0, 100 * USEC_PER_MSEC); 453 467 } 454 468 455 469 static int ··· 466 462 unsigned long parent_rate) 467 463 { 468 464 struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 465 + const struct ingenic_cgu_clk_info *clk_info = to_clk_info(ingenic_clk); 469 466 struct ingenic_cgu *cgu = ingenic_clk->cgu; 470 - const struct ingenic_cgu_clk_info *clk_info; 471 - const unsigned timeout = 100; 472 467 unsigned long rate, flags; 473 - unsigned int hw_div, div, i; 468 + unsigned int hw_div, div; 474 469 u32 reg, mask; 475 470 int ret = 0; 476 - 477 - clk_info = &cgu->clock_info[ingenic_clk->idx]; 478 471 479 472 if (clk_info->type & CGU_CLK_DIV) { 480 473 div = ingenic_clk_calc_div(clk_info, parent_rate, req_rate); ··· 505 504 writel(reg, cgu->base + clk_info->div.reg); 506 505 507 506 /* wait for the change to take effect */ 508 - if (clk_info->div.busy_bit != -1) { 509 - for (i = 0; i < timeout; i++) { 510 - reg = readl(cgu->base + clk_info->div.reg); 511 - if (!(reg & BIT(clk_info->div.busy_bit))) 512 - break; 513 - mdelay(1); 514 - } 515 - if (i == timeout) 516 - ret = -EBUSY; 517 - } 507 + if (clk_info->div.busy_bit != -1) 508 + ret = ingenic_clk_check_stable(cgu, clk_info); 518 509 519 510 spin_unlock_irqrestore(&cgu->lock, flags); 520 511 return ret; ··· 518 525 static int ingenic_clk_enable(struct clk_hw *hw) 519 526 { 520 527 struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 528 + const struct ingenic_cgu_clk_info *clk_info = to_clk_info(ingenic_clk); 521 529 struct ingenic_cgu *cgu = ingenic_clk->cgu; 522 - const struct ingenic_cgu_clk_info *clk_info; 523 530 unsigned long flags; 524 - 525 - clk_info = &cgu->clock_info[ingenic_clk->idx]; 526 531 527 532 if (clk_info->type & CGU_CLK_GATE) { 528 533 /* ungate the clock */ ··· 538 547 static void ingenic_clk_disable(struct clk_hw *hw) 539 548 { 540 549 struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 550 + const struct ingenic_cgu_clk_info *clk_info = to_clk_info(ingenic_clk); 541 551 struct ingenic_cgu *cgu = ingenic_clk->cgu; 542 - const struct ingenic_cgu_clk_info *clk_info; 543 552 unsigned long flags; 544 - 545 - clk_info = &cgu->clock_info[ingenic_clk->idx]; 546 553 547 554 if (clk_info->type & CGU_CLK_GATE) { 548 555 /* gate the clock */ ··· 553 564 static int ingenic_clk_is_enabled(struct clk_hw *hw) 554 565 { 555 566 struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); 567 + const struct ingenic_cgu_clk_info *clk_info = to_clk_info(ingenic_clk); 556 568 struct ingenic_cgu *cgu = ingenic_clk->cgu; 557 - const struct ingenic_cgu_clk_info *clk_info; 558 569 int enabled = 1; 559 - 560 - clk_info = &cgu->clock_info[ingenic_clk->idx]; 561 570 562 571 if (clk_info->type & CGU_CLK_GATE) 563 572 enabled = !ingenic_cgu_gate_get(cgu, &clk_info->gate); ··· 631 644 632 645 caps = clk_info->type; 633 646 647 + if (caps & CGU_CLK_DIV) { 648 + caps &= ~CGU_CLK_DIV; 649 + } else if (!(caps & CGU_CLK_CUSTOM)) { 650 + /* pass rate changes to the parent clock */ 651 + clk_init.flags |= CLK_SET_RATE_PARENT; 652 + } 653 + 634 654 if (caps & (CGU_CLK_MUX | CGU_CLK_CUSTOM)) { 635 655 clk_init.num_parents = 0; 636 656 ··· 677 683 } 678 684 } else if (caps & CGU_CLK_PLL) { 679 685 clk_init.ops = &ingenic_pll_ops; 680 - clk_init.flags |= CLK_SET_RATE_GATE; 681 686 682 687 caps &= ~CGU_CLK_PLL; 683 688 ··· 697 704 clk_init.flags |= CLK_SET_PARENT_GATE; 698 705 699 706 caps &= ~(CGU_CLK_MUX | CGU_CLK_MUX_GLITCHFREE); 700 - } 701 - 702 - if (caps & CGU_CLK_DIV) { 703 - caps &= ~CGU_CLK_DIV; 704 - } else { 705 - /* pass rate changes to the parent clock */ 706 - clk_init.flags |= CLK_SET_RATE_PARENT; 707 707 } 708 708 709 709 if (caps) {
+17 -2
drivers/clk/keystone/sci-clk.c
··· 54 54 * @provider: Master clock provider 55 55 * @flags: Flags for the clock 56 56 * @node: Link for handling clocks probed via DT 57 + * @cached_req: Cached requested freq for determine rate calls 58 + * @cached_res: Cached result freq for determine rate calls 57 59 */ 58 60 struct sci_clk { 59 61 struct clk_hw hw; ··· 65 63 struct sci_clk_provider *provider; 66 64 u8 flags; 67 65 struct list_head node; 66 + unsigned long cached_req; 67 + unsigned long cached_res; 68 68 }; 69 69 70 70 #define to_sci_clk(_hw) container_of(_hw, struct sci_clk, hw) ··· 179 175 int ret; 180 176 u64 new_rate; 181 177 178 + if (clk->cached_req && clk->cached_req == req->rate) { 179 + req->rate = clk->cached_res; 180 + return 0; 181 + } 182 + 182 183 ret = clk->provider->ops->get_best_match_freq(clk->provider->sci, 183 184 clk->dev_id, 184 185 clk->clk_id, ··· 197 188 clk->dev_id, clk->clk_id, ret); 198 189 return ret; 199 190 } 191 + 192 + clk->cached_req = req->rate; 193 + clk->cached_res = new_rate; 200 194 201 195 req->rate = new_rate; 202 196 ··· 221 209 struct sci_clk *clk = to_sci_clk(hw); 222 210 223 211 return clk->provider->ops->set_freq(clk->provider->sci, clk->dev_id, 224 - clk->clk_id, rate, rate, rate); 212 + clk->clk_id, rate / 10 * 9, rate, 213 + rate / 10 * 11); 225 214 } 226 215 227 216 /** ··· 261 248 static int sci_clk_set_parent(struct clk_hw *hw, u8 index) 262 249 { 263 250 struct sci_clk *clk = to_sci_clk(hw); 251 + 252 + clk->cached_req = 0; 264 253 265 254 return clk->provider->ops->set_parent(clk->provider->sci, clk->dev_id, 266 255 clk->clk_id, ··· 537 522 np = of_find_node_with_property(np, *clk_name); 538 523 if (!np) { 539 524 clk_name++; 540 - break; 525 + continue; 541 526 } 542 527 543 528 if (!of_device_is_available(np))
+48
drivers/clk/mediatek/Kconfig
··· 352 352 help 353 353 This driver supports MediaTek MT8135 clocks. 354 354 355 + config COMMON_CLK_MT8167 356 + bool "Clock driver for MediaTek MT8167" 357 + depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST 358 + select COMMON_CLK_MEDIATEK 359 + default ARCH_MEDIATEK 360 + help 361 + This driver supports MediaTek MT8167 basic clocks. 362 + 363 + config COMMON_CLK_MT8167_AUDSYS 364 + bool "Clock driver for MediaTek MT8167 audsys" 365 + depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST 366 + select COMMON_CLK_MEDIATEK 367 + default ARCH_MEDIATEK 368 + help 369 + This driver supports MediaTek MT8167 audsys clocks. 370 + 371 + config COMMON_CLK_MT8167_IMGSYS 372 + bool "Clock driver for MediaTek MT8167 imgsys" 373 + depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST 374 + select COMMON_CLK_MEDIATEK 375 + default ARCH_MEDIATEK 376 + help 377 + This driver supports MediaTek MT8167 imgsys clocks. 378 + 379 + config COMMON_CLK_MT8167_MFGCFG 380 + bool "Clock driver for MediaTek MT8167 mfgcfg" 381 + depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST 382 + select COMMON_CLK_MEDIATEK 383 + default ARCH_MEDIATEK 384 + help 385 + This driver supports MediaTek MT8167 mfgcfg clocks. 386 + 387 + config COMMON_CLK_MT8167_MMSYS 388 + bool "Clock driver for MediaTek MT8167 mmsys" 389 + depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST 390 + select COMMON_CLK_MEDIATEK 391 + default ARCH_MEDIATEK 392 + help 393 + This driver supports MediaTek MT8167 mmsys clocks. 394 + 395 + config COMMON_CLK_MT8167_VDECSYS 396 + bool "Clock driver for MediaTek MT8167 vdecsys" 397 + depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST 398 + select COMMON_CLK_MEDIATEK 399 + default ARCH_MEDIATEK 400 + help 401 + This driver supports MediaTek MT8167 vdecsys clocks. 402 + 355 403 config COMMON_CLK_MT8173 356 404 bool "Clock driver for MediaTek MT8173" 357 405 depends on ARCH_MEDIATEK || COMPILE_TEST
+6
drivers/clk/mediatek/Makefile
··· 47 47 obj-$(CONFIG_COMMON_CLK_MT7629_ETHSYS) += clk-mt7629-eth.o 48 48 obj-$(CONFIG_COMMON_CLK_MT7629_HIFSYS) += clk-mt7629-hif.o 49 49 obj-$(CONFIG_COMMON_CLK_MT8135) += clk-mt8135.o 50 + obj-$(CONFIG_COMMON_CLK_MT8167) += clk-mt8167.o 51 + obj-$(CONFIG_COMMON_CLK_MT8167_AUDSYS) += clk-mt8167-aud.o 52 + obj-$(CONFIG_COMMON_CLK_MT8167_IMGSYS) += clk-mt8167-img.o 53 + obj-$(CONFIG_COMMON_CLK_MT8167_MFGCFG) += clk-mt8167-mfgcfg.o 54 + obj-$(CONFIG_COMMON_CLK_MT8167_MMSYS) += clk-mt8167-mm.o 55 + obj-$(CONFIG_COMMON_CLK_MT8167_VDECSYS) += clk-mt8167-vdec.o 50 56 obj-$(CONFIG_COMMON_CLK_MT8173) += clk-mt8173.o 51 57 obj-$(CONFIG_COMMON_CLK_MT8173_MMSYS) += clk-mt8173-mm.o 52 58 obj-$(CONFIG_COMMON_CLK_MT8183) += clk-mt8183.o
-1
drivers/clk/mediatek/clk-mt6765.c
··· 909 909 .probe = clk_mt6765_probe, 910 910 .driver = { 911 911 .name = "clk-mt6765", 912 - .owner = THIS_MODULE, 913 912 .of_match_table = of_match_clk_mt6765, 914 913 }, 915 914 };
+2
drivers/clk/mediatek/clk-mt6779.c
··· 919 919 "pwm_sel", 19), 920 920 GATE_INFRA0(CLK_INFRA_PWM, "infra_pwm", 921 921 "pwm_sel", 21), 922 + GATE_INFRA0(CLK_INFRA_UART0, "infra_uart0", 923 + "uart_sel", 22), 922 924 GATE_INFRA0(CLK_INFRA_UART1, "infra_uart1", 923 925 "uart_sel", 23), 924 926 GATE_INFRA0(CLK_INFRA_UART2, "infra_uart2",
+2 -6
drivers/clk/mediatek/clk-mt6797.c
··· 582 582 583 583 static int mtk_infrasys_init(struct platform_device *pdev) 584 584 { 585 - int r, i; 585 + int i; 586 586 struct device_node *node = pdev->dev.of_node; 587 587 588 588 if (!infra_clk_data) { ··· 599 599 mtk_clk_register_factors(infra_fixed_divs, ARRAY_SIZE(infra_fixed_divs), 600 600 infra_clk_data); 601 601 602 - r = of_clk_add_provider(node, of_clk_src_onecell_get, infra_clk_data); 603 - if (r) 604 - return r; 605 - 606 - return 0; 602 + return of_clk_add_provider(node, of_clk_src_onecell_get, infra_clk_data); 607 603 } 608 604 609 605 #define MT6797_PLL_FMAX (3000UL * MHZ)
+2 -7
drivers/clk/mediatek/clk-mt7629.c
··· 601 601 { 602 602 struct device_node *node = pdev->dev.of_node; 603 603 struct clk_onecell_data *clk_data; 604 - int r; 605 604 606 605 clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK); 607 606 ··· 610 611 mtk_clk_register_cpumuxes(node, infra_muxes, ARRAY_SIZE(infra_muxes), 611 612 clk_data); 612 613 613 - r = of_clk_add_provider(node, of_clk_src_onecell_get, 614 - clk_data); 615 - if (r) 616 - return r; 617 - 618 - return 0; 614 + return of_clk_add_provider(node, of_clk_src_onecell_get, 615 + clk_data); 619 616 } 620 617 621 618 static int mtk_pericfg_init(struct platform_device *pdev)
+66
drivers/clk/mediatek/clk-mt8167-aud.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (c) 2020 MediaTek Inc. 4 + * Copyright (c) 2020 BayLibre, SAS 5 + * Author: James Liao <jamesjj.liao@mediatek.com> 6 + * Fabien Parent <fparent@baylibre.com> 7 + */ 8 + 9 + #include <linux/clk-provider.h> 10 + #include <linux/of.h> 11 + #include <linux/of_address.h> 12 + #include <linux/of_device.h> 13 + #include <linux/platform_device.h> 14 + 15 + #include "clk-mtk.h" 16 + #include "clk-gate.h" 17 + 18 + #include <dt-bindings/clock/mt8167-clk.h> 19 + 20 + static const struct mtk_gate_regs aud_cg_regs = { 21 + .set_ofs = 0x0, 22 + .clr_ofs = 0x0, 23 + .sta_ofs = 0x0, 24 + }; 25 + 26 + #define GATE_AUD(_id, _name, _parent, _shift) { \ 27 + .id = _id, \ 28 + .name = _name, \ 29 + .parent_name = _parent, \ 30 + .regs = &aud_cg_regs, \ 31 + .shift = _shift, \ 32 + .ops = &mtk_clk_gate_ops_no_setclr, \ 33 + } 34 + 35 + static const struct mtk_gate aud_clks[] __initconst = { 36 + GATE_AUD(CLK_AUD_AFE, "aud_afe", "clk26m_ck", 2), 37 + GATE_AUD(CLK_AUD_I2S, "aud_i2s", "i2s_infra_bck", 6), 38 + GATE_AUD(CLK_AUD_22M, "aud_22m", "rg_aud_engen1", 8), 39 + GATE_AUD(CLK_AUD_24M, "aud_24m", "rg_aud_engen2", 9), 40 + GATE_AUD(CLK_AUD_INTDIR, "aud_intdir", "rg_aud_spdif_in", 15), 41 + GATE_AUD(CLK_AUD_APLL2_TUNER, "aud_apll2_tuner", "rg_aud_engen2", 18), 42 + GATE_AUD(CLK_AUD_APLL_TUNER, "aud_apll_tuner", "rg_aud_engen1", 19), 43 + GATE_AUD(CLK_AUD_HDMI, "aud_hdmi", "apll12_div4", 20), 44 + GATE_AUD(CLK_AUD_SPDF, "aud_spdf", "apll12_div6", 21), 45 + GATE_AUD(CLK_AUD_ADC, "aud_adc", "aud_afe", 24), 46 + GATE_AUD(CLK_AUD_DAC, "aud_dac", "aud_afe", 25), 47 + GATE_AUD(CLK_AUD_DAC_PREDIS, "aud_dac_predis", "aud_afe", 26), 48 + GATE_AUD(CLK_AUD_TML, "aud_tml", "aud_afe", 27), 49 + }; 50 + 51 + static void __init mtk_audsys_init(struct device_node *node) 52 + { 53 + struct clk_onecell_data *clk_data; 54 + int r; 55 + 56 + clk_data = mtk_alloc_clk_data(CLK_AUD_NR_CLK); 57 + 58 + mtk_clk_register_gates(node, aud_clks, ARRAY_SIZE(aud_clks), clk_data); 59 + 60 + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); 61 + if (r) 62 + pr_err("%s(): could not register clock provider: %d\n", 63 + __func__, r); 64 + 65 + } 66 + CLK_OF_DECLARE(mtk_audsys, "mediatek,mt8167-audsys", mtk_audsys_init);
+60
drivers/clk/mediatek/clk-mt8167-img.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (c) 2020 MediaTek Inc. 4 + * Copyright (c) 2020 BayLibre, SAS 5 + * Author: James Liao <jamesjj.liao@mediatek.com> 6 + * Fabien Parent <fparent@baylibre.com> 7 + */ 8 + 9 + #include <linux/clk-provider.h> 10 + #include <linux/of.h> 11 + #include <linux/of_address.h> 12 + #include <linux/of_device.h> 13 + #include <linux/platform_device.h> 14 + 15 + #include "clk-mtk.h" 16 + #include "clk-gate.h" 17 + 18 + #include <dt-bindings/clock/mt8167-clk.h> 19 + 20 + static const struct mtk_gate_regs img_cg_regs = { 21 + .set_ofs = 0x4, 22 + .clr_ofs = 0x8, 23 + .sta_ofs = 0x0, 24 + }; 25 + 26 + #define GATE_IMG(_id, _name, _parent, _shift) { \ 27 + .id = _id, \ 28 + .name = _name, \ 29 + .parent_name = _parent, \ 30 + .regs = &img_cg_regs, \ 31 + .shift = _shift, \ 32 + .ops = &mtk_clk_gate_ops_setclr, \ 33 + } 34 + 35 + static const struct mtk_gate img_clks[] __initconst = { 36 + GATE_IMG(CLK_IMG_LARB1_SMI, "img_larb1_smi", "smi_mm", 0), 37 + GATE_IMG(CLK_IMG_CAM_SMI, "img_cam_smi", "smi_mm", 5), 38 + GATE_IMG(CLK_IMG_CAM_CAM, "img_cam_cam", "smi_mm", 6), 39 + GATE_IMG(CLK_IMG_SEN_TG, "img_sen_tg", "cam_mm", 7), 40 + GATE_IMG(CLK_IMG_SEN_CAM, "img_sen_cam", "smi_mm", 8), 41 + GATE_IMG(CLK_IMG_VENC, "img_venc", "smi_mm", 9), 42 + }; 43 + 44 + static void __init mtk_imgsys_init(struct device_node *node) 45 + { 46 + struct clk_onecell_data *clk_data; 47 + int r; 48 + 49 + clk_data = mtk_alloc_clk_data(CLK_IMG_NR_CLK); 50 + 51 + mtk_clk_register_gates(node, img_clks, ARRAY_SIZE(img_clks), clk_data); 52 + 53 + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); 54 + 55 + if (r) 56 + pr_err("%s(): could not register clock provider: %d\n", 57 + __func__, r); 58 + 59 + } 60 + CLK_OF_DECLARE(mtk_imgsys, "mediatek,mt8167-imgsys", mtk_imgsys_init);
+58
drivers/clk/mediatek/clk-mt8167-mfgcfg.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (c) 2020 MediaTek Inc. 4 + * Copyright (c) 2020 BayLibre, SAS 5 + * Author: James Liao <jamesjj.liao@mediatek.com> 6 + * Fabien Parent <fparent@baylibre.com> 7 + */ 8 + 9 + #include <linux/clk-provider.h> 10 + #include <linux/of.h> 11 + #include <linux/of_address.h> 12 + #include <linux/of_device.h> 13 + #include <linux/platform_device.h> 14 + 15 + #include "clk-mtk.h" 16 + #include "clk-gate.h" 17 + 18 + #include <dt-bindings/clock/mt8167-clk.h> 19 + 20 + static const struct mtk_gate_regs mfg_cg_regs = { 21 + .set_ofs = 0x4, 22 + .clr_ofs = 0x8, 23 + .sta_ofs = 0x0, 24 + }; 25 + 26 + #define GATE_MFG(_id, _name, _parent, _shift) { \ 27 + .id = _id, \ 28 + .name = _name, \ 29 + .parent_name = _parent, \ 30 + .regs = &mfg_cg_regs, \ 31 + .shift = _shift, \ 32 + .ops = &mtk_clk_gate_ops_setclr, \ 33 + } 34 + 35 + static const struct mtk_gate mfg_clks[] __initconst = { 36 + GATE_MFG(CLK_MFG_BAXI, "mfg_baxi", "ahb_infra_sel", 0), 37 + GATE_MFG(CLK_MFG_BMEM, "mfg_bmem", "gfmux_emi1x_sel", 1), 38 + GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_mm", 2), 39 + GATE_MFG(CLK_MFG_B26M, "mfg_b26m", "clk26m_ck", 3), 40 + }; 41 + 42 + static void __init mtk_mfgcfg_init(struct device_node *node) 43 + { 44 + struct clk_onecell_data *clk_data; 45 + int r; 46 + 47 + clk_data = mtk_alloc_clk_data(CLK_MFG_NR_CLK); 48 + 49 + mtk_clk_register_gates(node, mfg_clks, ARRAY_SIZE(mfg_clks), clk_data); 50 + 51 + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); 52 + 53 + if (r) 54 + pr_err("%s(): could not register clock provider: %d\n", 55 + __func__, r); 56 + 57 + } 58 + CLK_OF_DECLARE(mtk_mfgcfg, "mediatek,mt8167-mfgcfg", mtk_mfgcfg_init);
+132
drivers/clk/mediatek/clk-mt8167-mm.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (c) 2020 MediaTek Inc. 4 + * Copyright (c) 2020 BayLibre, SAS 5 + * Author: James Liao <jamesjj.liao@mediatek.com> 6 + * Fabien Parent <fparent@baylibre.com> 7 + */ 8 + 9 + #include <linux/clk-provider.h> 10 + #include <linux/of.h> 11 + #include <linux/of_address.h> 12 + #include <linux/of_device.h> 13 + #include <linux/platform_device.h> 14 + 15 + #include "clk-mtk.h" 16 + #include "clk-gate.h" 17 + 18 + #include <dt-bindings/clock/mt8167-clk.h> 19 + 20 + static const struct mtk_gate_regs mm0_cg_regs = { 21 + .set_ofs = 0x104, 22 + .clr_ofs = 0x108, 23 + .sta_ofs = 0x100, 24 + }; 25 + 26 + static const struct mtk_gate_regs mm1_cg_regs = { 27 + .set_ofs = 0x114, 28 + .clr_ofs = 0x118, 29 + .sta_ofs = 0x110, 30 + }; 31 + 32 + #define GATE_MM0(_id, _name, _parent, _shift) { \ 33 + .id = _id, \ 34 + .name = _name, \ 35 + .parent_name = _parent, \ 36 + .regs = &mm0_cg_regs, \ 37 + .shift = _shift, \ 38 + .ops = &mtk_clk_gate_ops_setclr, \ 39 + } 40 + 41 + #define GATE_MM1(_id, _name, _parent, _shift) { \ 42 + .id = _id, \ 43 + .name = _name, \ 44 + .parent_name = _parent, \ 45 + .regs = &mm1_cg_regs, \ 46 + .shift = _shift, \ 47 + .ops = &mtk_clk_gate_ops_setclr, \ 48 + } 49 + 50 + static const struct mtk_gate mm_clks[] = { 51 + /* MM0 */ 52 + GATE_MM0(CLK_MM_SMI_COMMON, "mm_smi_common", "smi_mm", 0), 53 + GATE_MM0(CLK_MM_SMI_LARB0, "mm_smi_larb0", "smi_mm", 1), 54 + GATE_MM0(CLK_MM_CAM_MDP, "mm_cam_mdp", "smi_mm", 2), 55 + GATE_MM0(CLK_MM_MDP_RDMA, "mm_mdp_rdma", "smi_mm", 3), 56 + GATE_MM0(CLK_MM_MDP_RSZ0, "mm_mdp_rsz0", "smi_mm", 4), 57 + GATE_MM0(CLK_MM_MDP_RSZ1, "mm_mdp_rsz1", "smi_mm", 5), 58 + GATE_MM0(CLK_MM_MDP_TDSHP, "mm_mdp_tdshp", "smi_mm", 6), 59 + GATE_MM0(CLK_MM_MDP_WDMA, "mm_mdp_wdma", "smi_mm", 7), 60 + GATE_MM0(CLK_MM_MDP_WROT, "mm_mdp_wrot", "smi_mm", 8), 61 + GATE_MM0(CLK_MM_FAKE_ENG, "mm_fake_eng", "smi_mm", 9), 62 + GATE_MM0(CLK_MM_DISP_OVL0, "mm_disp_ovl0", "smi_mm", 10), 63 + GATE_MM0(CLK_MM_DISP_RDMA0, "mm_disp_rdma0", "smi_mm", 11), 64 + GATE_MM0(CLK_MM_DISP_RDMA1, "mm_disp_rdma1", "smi_mm", 12), 65 + GATE_MM0(CLK_MM_DISP_WDMA, "mm_disp_wdma", "smi_mm", 13), 66 + GATE_MM0(CLK_MM_DISP_COLOR, "mm_disp_color", "smi_mm", 14), 67 + GATE_MM0(CLK_MM_DISP_CCORR, "mm_disp_ccorr", "smi_mm", 15), 68 + GATE_MM0(CLK_MM_DISP_AAL, "mm_disp_aal", "smi_mm", 16), 69 + GATE_MM0(CLK_MM_DISP_GAMMA, "mm_disp_gamma", "smi_mm", 17), 70 + GATE_MM0(CLK_MM_DISP_DITHER, "mm_disp_dither", "smi_mm", 18), 71 + GATE_MM0(CLK_MM_DISP_UFOE, "mm_disp_ufoe", "smi_mm", 19), 72 + /* MM1 */ 73 + GATE_MM1(CLK_MM_DISP_PWM_MM, "mm_disp_pwm_mm", "smi_mm", 0), 74 + GATE_MM1(CLK_MM_DISP_PWM_26M, "mm_disp_pwm_26m", "smi_mm", 1), 75 + GATE_MM1(CLK_MM_DSI_ENGINE, "mm_dsi_engine", "smi_mm", 2), 76 + GATE_MM1(CLK_MM_DSI_DIGITAL, "mm_dsi_digital", "dsi0_lntc_dsick", 3), 77 + GATE_MM1(CLK_MM_DPI0_ENGINE, "mm_dpi0_engine", "smi_mm", 4), 78 + GATE_MM1(CLK_MM_DPI0_PXL, "mm_dpi0_pxl", "rg_fdpi0", 5), 79 + GATE_MM1(CLK_MM_LVDS_PXL, "mm_lvds_pxl", "vpll_dpix", 14), 80 + GATE_MM1(CLK_MM_LVDS_CTS, "mm_lvds_cts", "lvdstx_dig_cts", 15), 81 + GATE_MM1(CLK_MM_DPI1_ENGINE, "mm_dpi1_engine", "smi_mm", 16), 82 + GATE_MM1(CLK_MM_DPI1_PXL, "mm_dpi1_pxl", "rg_fdpi1", 17), 83 + GATE_MM1(CLK_MM_HDMI_PXL, "mm_hdmi_pxl", "rg_fdpi1", 18), 84 + GATE_MM1(CLK_MM_HDMI_SPDIF, "mm_hdmi_spdif", "apll12_div6", 19), 85 + GATE_MM1(CLK_MM_HDMI_ADSP_BCK, "mm_hdmi_adsp_b", "apll12_div4b", 20), 86 + GATE_MM1(CLK_MM_HDMI_PLL, "mm_hdmi_pll", "hdmtx_dig_cts", 21), 87 + }; 88 + 89 + struct clk_mt8167_mm_driver_data { 90 + const struct mtk_gate *gates_clk; 91 + int gates_num; 92 + }; 93 + 94 + static const struct clk_mt8167_mm_driver_data mt8167_mmsys_driver_data = { 95 + .gates_clk = mm_clks, 96 + .gates_num = ARRAY_SIZE(mm_clks), 97 + }; 98 + 99 + static int clk_mt8167_mm_probe(struct platform_device *pdev) 100 + { 101 + struct device *dev = &pdev->dev; 102 + struct device_node *node = dev->parent->of_node; 103 + const struct clk_mt8167_mm_driver_data *data; 104 + struct clk_onecell_data *clk_data; 105 + int ret; 106 + 107 + clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK); 108 + if (!clk_data) 109 + return -ENOMEM; 110 + 111 + data = &mt8167_mmsys_driver_data; 112 + 113 + ret = mtk_clk_register_gates(node, data->gates_clk, data->gates_num, 114 + clk_data); 115 + if (ret) 116 + return ret; 117 + 118 + ret = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); 119 + if (ret) 120 + return ret; 121 + 122 + return 0; 123 + } 124 + 125 + static struct platform_driver clk_mt8173_mm_drv = { 126 + .driver = { 127 + .name = "clk-mt8167-mm", 128 + }, 129 + .probe = clk_mt8167_mm_probe, 130 + }; 131 + 132 + builtin_platform_driver(clk_mt8173_mm_drv);
+73
drivers/clk/mediatek/clk-mt8167-vdec.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (c) 2020 MediaTek Inc. 4 + * Copyright (c) 2020 BayLibre, SAS 5 + * Author: James Liao <jamesjj.liao@mediatek.com> 6 + * Fabien Parent <fparent@baylibre.com> 7 + */ 8 + 9 + #include <linux/clk-provider.h> 10 + #include <linux/of.h> 11 + #include <linux/of_address.h> 12 + #include <linux/of_device.h> 13 + #include <linux/platform_device.h> 14 + 15 + #include "clk-mtk.h" 16 + #include "clk-gate.h" 17 + 18 + #include <dt-bindings/clock/mt8167-clk.h> 19 + 20 + static const struct mtk_gate_regs vdec0_cg_regs = { 21 + .set_ofs = 0x0, 22 + .clr_ofs = 0x4, 23 + .sta_ofs = 0x0, 24 + }; 25 + 26 + static const struct mtk_gate_regs vdec1_cg_regs = { 27 + .set_ofs = 0x8, 28 + .clr_ofs = 0xc, 29 + .sta_ofs = 0x8, 30 + }; 31 + 32 + #define GATE_VDEC0_I(_id, _name, _parent, _shift) { \ 33 + .id = _id, \ 34 + .name = _name, \ 35 + .parent_name = _parent, \ 36 + .regs = &vdec0_cg_regs, \ 37 + .shift = _shift, \ 38 + .ops = &mtk_clk_gate_ops_setclr_inv, \ 39 + } 40 + 41 + #define GATE_VDEC1_I(_id, _name, _parent, _shift) { \ 42 + .id = _id, \ 43 + .name = _name, \ 44 + .parent_name = _parent, \ 45 + .regs = &vdec1_cg_regs, \ 46 + .shift = _shift, \ 47 + .ops = &mtk_clk_gate_ops_setclr_inv, \ 48 + } 49 + 50 + static const struct mtk_gate vdec_clks[] __initconst = { 51 + /* VDEC0 */ 52 + GATE_VDEC0_I(CLK_VDEC_CKEN, "vdec_cken", "rg_vdec", 0), 53 + /* VDEC1 */ 54 + GATE_VDEC1_I(CLK_VDEC_LARB1_CKEN, "vdec_larb1_cken", "smi_mm", 0), 55 + }; 56 + 57 + static void __init mtk_vdecsys_init(struct device_node *node) 58 + { 59 + struct clk_onecell_data *clk_data; 60 + int r; 61 + 62 + clk_data = mtk_alloc_clk_data(CLK_VDEC_NR_CLK); 63 + 64 + mtk_clk_register_gates(node, vdec_clks, ARRAY_SIZE(vdec_clks), clk_data); 65 + 66 + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); 67 + 68 + if (r) 69 + pr_err("%s(): could not register clock provider: %d\n", 70 + __func__, r); 71 + 72 + } 73 + CLK_OF_DECLARE(mtk_vdecsys, "mediatek,mt8167-vdecsys", mtk_vdecsys_init);
+1062
drivers/clk/mediatek/clk-mt8167.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (c) 2020 MediaTek Inc. 4 + * Copyright (c) 2020 BayLibre, SAS 5 + * Author: James Liao <jamesjj.liao@mediatek.com> 6 + * Fabien Parent <fparent@baylibre.com> 7 + */ 8 + 9 + #include <linux/delay.h> 10 + #include <linux/of.h> 11 + #include <linux/of_address.h> 12 + #include <linux/slab.h> 13 + #include <linux/mfd/syscon.h> 14 + 15 + #include "clk-mtk.h" 16 + #include "clk-gate.h" 17 + 18 + #include <dt-bindings/clock/mt8167-clk.h> 19 + 20 + static DEFINE_SPINLOCK(mt8167_clk_lock); 21 + 22 + static const struct mtk_fixed_clk fixed_clks[] __initconst = { 23 + FIXED_CLK(CLK_TOP_CLK_NULL, "clk_null", NULL, 0), 24 + FIXED_CLK(CLK_TOP_I2S_INFRA_BCK, "i2s_infra_bck", "clk_null", 26000000), 25 + FIXED_CLK(CLK_TOP_MEMPLL, "mempll", "clk26m", 800000000), 26 + FIXED_CLK(CLK_TOP_DSI0_LNTC_DSICK, "dsi0_lntc_dsick", "clk26m", 75000000), 27 + FIXED_CLK(CLK_TOP_VPLL_DPIX, "vpll_dpix", "clk26m", 75000000), 28 + FIXED_CLK(CLK_TOP_LVDSTX_CLKDIG_CTS, "lvdstx_dig_cts", "clk26m", 52500000), 29 + }; 30 + 31 + static const struct mtk_fixed_factor top_divs[] __initconst = { 32 + FACTOR(CLK_TOP_DMPLL, "dmpll_ck", "mempll", 1, 1), 33 + FACTOR(CLK_TOP_MAINPLL_D2, "mainpll_d2", "mainpll", 1, 2), 34 + FACTOR(CLK_TOP_MAINPLL_D4, "mainpll_d4", "mainpll", 1, 4), 35 + FACTOR(CLK_TOP_MAINPLL_D8, "mainpll_d8", "mainpll", 1, 8), 36 + FACTOR(CLK_TOP_MAINPLL_D16, "mainpll_d16", "mainpll", 1, 16), 37 + FACTOR(CLK_TOP_MAINPLL_D11, "mainpll_d11", "mainpll", 1, 11), 38 + FACTOR(CLK_TOP_MAINPLL_D22, "mainpll_d22", "mainpll", 1, 22), 39 + FACTOR(CLK_TOP_MAINPLL_D3, "mainpll_d3", "mainpll", 1, 3), 40 + FACTOR(CLK_TOP_MAINPLL_D6, "mainpll_d6", "mainpll", 1, 6), 41 + FACTOR(CLK_TOP_MAINPLL_D12, "mainpll_d12", "mainpll", 1, 12), 42 + FACTOR(CLK_TOP_MAINPLL_D5, "mainpll_d5", "mainpll", 1, 5), 43 + FACTOR(CLK_TOP_MAINPLL_D10, "mainpll_d10", "mainpll", 1, 10), 44 + FACTOR(CLK_TOP_MAINPLL_D20, "mainpll_d20", "mainpll", 1, 20), 45 + FACTOR(CLK_TOP_MAINPLL_D40, "mainpll_d40", "mainpll", 1, 40), 46 + FACTOR(CLK_TOP_MAINPLL_D7, "mainpll_d7", "mainpll", 1, 7), 47 + FACTOR(CLK_TOP_MAINPLL_D14, "mainpll_d14", "mainpll", 1, 14), 48 + FACTOR(CLK_TOP_UNIVPLL_D2, "univpll_d2", "univpll", 1, 2), 49 + FACTOR(CLK_TOP_UNIVPLL_D4, "univpll_d4", "univpll", 1, 4), 50 + FACTOR(CLK_TOP_UNIVPLL_D8, "univpll_d8", "univpll", 1, 8), 51 + FACTOR(CLK_TOP_UNIVPLL_D16, "univpll_d16", "univpll", 1, 16), 52 + FACTOR(CLK_TOP_UNIVPLL_D3, "univpll_d3", "univpll", 1, 3), 53 + FACTOR(CLK_TOP_UNIVPLL_D6, "univpll_d6", "univpll", 1, 6), 54 + FACTOR(CLK_TOP_UNIVPLL_D12, "univpll_d12", "univpll", 1, 12), 55 + FACTOR(CLK_TOP_UNIVPLL_D24, "univpll_d24", "univpll", 1, 24), 56 + FACTOR(CLK_TOP_UNIVPLL_D5, "univpll_d5", "univpll", 1, 5), 57 + FACTOR(CLK_TOP_UNIVPLL_D20, "univpll_d20", "univpll", 1, 20), 58 + FACTOR(CLK_TOP_MMPLL380M, "mmpll380m", "mmpll", 1, 1), 59 + FACTOR(CLK_TOP_MMPLL_D2, "mmpll_d2", "mmpll", 1, 2), 60 + FACTOR(CLK_TOP_MMPLL_200M, "mmpll_200m", "mmpll", 1, 3), 61 + FACTOR(CLK_TOP_LVDSPLL, "lvdspll_ck", "lvdspll", 1, 1), 62 + FACTOR(CLK_TOP_LVDSPLL_D2, "lvdspll_d2", "lvdspll", 1, 2), 63 + FACTOR(CLK_TOP_LVDSPLL_D4, "lvdspll_d4", "lvdspll", 1, 4), 64 + FACTOR(CLK_TOP_LVDSPLL_D8, "lvdspll_d8", "lvdspll", 1, 8), 65 + FACTOR(CLK_TOP_USB_PHY48M, "usb_phy48m_ck", "univpll", 1, 26), 66 + FACTOR(CLK_TOP_APLL1, "apll1_ck", "apll1", 1, 1), 67 + FACTOR(CLK_TOP_APLL1_D2, "apll1_d2", "apll1_ck", 1, 2), 68 + FACTOR(CLK_TOP_APLL1_D4, "apll1_d4", "rg_apll1_d2_en", 1, 2), 69 + FACTOR(CLK_TOP_APLL1_D8, "apll1_d8", "rg_apll1_d4_en", 1, 2), 70 + FACTOR(CLK_TOP_APLL2, "apll2_ck", "apll2", 1, 1), 71 + FACTOR(CLK_TOP_APLL2_D2, "apll2_d2", "apll2_ck", 1, 2), 72 + FACTOR(CLK_TOP_APLL2_D4, "apll2_d4", "rg_apll2_d2_en", 1, 2), 73 + FACTOR(CLK_TOP_APLL2_D8, "apll2_d8", "rg_apll2_d4_en", 1, 2), 74 + FACTOR(CLK_TOP_CLK26M, "clk26m_ck", "clk26m", 1, 1), 75 + FACTOR(CLK_TOP_CLK26M_D2, "clk26m_d2", "clk26m", 1, 2), 76 + FACTOR(CLK_TOP_MIPI_26M, "mipi_26m", "clk26m", 1, 1), 77 + FACTOR(CLK_TOP_TVDPLL, "tvdpll_ck", "tvdpll", 1, 1), 78 + FACTOR(CLK_TOP_TVDPLL_D2, "tvdpll_d2", "tvdpll_ck", 1, 2), 79 + FACTOR(CLK_TOP_TVDPLL_D4, "tvdpll_d4", "tvdpll_ck", 1, 4), 80 + FACTOR(CLK_TOP_TVDPLL_D8, "tvdpll_d8", "tvdpll_ck", 1, 8), 81 + FACTOR(CLK_TOP_TVDPLL_D16, "tvdpll_d16", "tvdpll_ck", 1, 16), 82 + FACTOR(CLK_TOP_AHB_INFRA_D2, "ahb_infra_d2", "ahb_infra_sel", 1, 2), 83 + FACTOR(CLK_TOP_NFI1X, "nfi1x_ck", "nfi2x_pad_sel", 1, 2), 84 + FACTOR(CLK_TOP_ETH_D2, "eth_d2_ck", "eth_sel", 1, 2), 85 + }; 86 + 87 + static const char * const uart0_parents[] __initconst = { 88 + "clk26m_ck", 89 + "univpll_d24" 90 + }; 91 + 92 + static const char * const gfmux_emi1x_parents[] __initconst = { 93 + "clk26m_ck", 94 + "dmpll_ck" 95 + }; 96 + 97 + static const char * const emi_ddrphy_parents[] __initconst = { 98 + "gfmux_emi1x_sel", 99 + "gfmux_emi1x_sel" 100 + }; 101 + 102 + static const char * const ahb_infra_parents[] __initconst = { 103 + "clk_null", 104 + "clk26m_ck", 105 + "mainpll_d11", 106 + "clk_null", 107 + "mainpll_d12", 108 + "clk_null", 109 + "clk_null", 110 + "clk_null", 111 + "clk_null", 112 + "clk_null", 113 + "clk_null", 114 + "clk_null", 115 + "mainpll_d10" 116 + }; 117 + 118 + static const char * const csw_mux_mfg_parents[] __initconst = { 119 + "clk_null", 120 + "clk_null", 121 + "univpll_d3", 122 + "univpll_d2", 123 + "clk26m_ck", 124 + "mainpll_d4", 125 + "univpll_d24", 126 + "mmpll380m" 127 + }; 128 + 129 + static const char * const msdc0_parents[] __initconst = { 130 + "clk26m_ck", 131 + "univpll_d6", 132 + "mainpll_d8", 133 + "univpll_d8", 134 + "mainpll_d16", 135 + "mmpll_200m", 136 + "mainpll_d12", 137 + "mmpll_d2" 138 + }; 139 + 140 + static const char * const camtg_mm_parents[] __initconst = { 141 + "clk_null", 142 + "clk26m_ck", 143 + "usb_phy48m_ck", 144 + "clk_null", 145 + "univpll_d6" 146 + }; 147 + 148 + static const char * const pwm_mm_parents[] __initconst = { 149 + "clk26m_ck", 150 + "univpll_d12" 151 + }; 152 + 153 + static const char * const uart1_parents[] __initconst = { 154 + "clk26m_ck", 155 + "univpll_d24" 156 + }; 157 + 158 + static const char * const msdc1_parents[] __initconst = { 159 + "clk26m_ck", 160 + "univpll_d6", 161 + "mainpll_d8", 162 + "univpll_d8", 163 + "mainpll_d16", 164 + "mmpll_200m", 165 + "mainpll_d12", 166 + "mmpll_d2" 167 + }; 168 + 169 + static const char * const spm_52m_parents[] __initconst = { 170 + "clk26m_ck", 171 + "univpll_d24" 172 + }; 173 + 174 + static const char * const pmicspi_parents[] __initconst = { 175 + "univpll_d20", 176 + "usb_phy48m_ck", 177 + "univpll_d16", 178 + "clk26m_ck" 179 + }; 180 + 181 + static const char * const qaxi_aud26m_parents[] __initconst = { 182 + "clk26m_ck", 183 + "ahb_infra_sel" 184 + }; 185 + 186 + static const char * const aud_intbus_parents[] __initconst = { 187 + "clk_null", 188 + "clk26m_ck", 189 + "mainpll_d22", 190 + "clk_null", 191 + "mainpll_d11" 192 + }; 193 + 194 + static const char * const nfi2x_pad_parents[] __initconst = { 195 + "clk_null", 196 + "clk_null", 197 + "clk_null", 198 + "clk_null", 199 + "clk_null", 200 + "clk_null", 201 + "clk_null", 202 + "clk_null", 203 + "clk26m_ck", 204 + "clk_null", 205 + "clk_null", 206 + "clk_null", 207 + "clk_null", 208 + "clk_null", 209 + "clk_null", 210 + "clk_null", 211 + "clk_null", 212 + "mainpll_d12", 213 + "mainpll_d8", 214 + "clk_null", 215 + "mainpll_d6", 216 + "clk_null", 217 + "clk_null", 218 + "clk_null", 219 + "clk_null", 220 + "clk_null", 221 + "clk_null", 222 + "clk_null", 223 + "clk_null", 224 + "clk_null", 225 + "clk_null", 226 + "clk_null", 227 + "mainpll_d4", 228 + "clk_null", 229 + "clk_null", 230 + "clk_null", 231 + "clk_null", 232 + "clk_null", 233 + "clk_null", 234 + "clk_null", 235 + "clk_null", 236 + "clk_null", 237 + "clk_null", 238 + "clk_null", 239 + "clk_null", 240 + "clk_null", 241 + "clk_null", 242 + "clk_null", 243 + "clk_null", 244 + "clk_null", 245 + "clk_null", 246 + "clk_null", 247 + "clk_null", 248 + "clk_null", 249 + "clk_null", 250 + "clk_null", 251 + "clk_null", 252 + "clk_null", 253 + "clk_null", 254 + "clk_null", 255 + "clk_null", 256 + "clk_null", 257 + "clk_null", 258 + "clk_null", 259 + "clk_null", 260 + "clk_null", 261 + "clk_null", 262 + "clk_null", 263 + "clk_null", 264 + "clk_null", 265 + "clk_null", 266 + "clk_null", 267 + "clk_null", 268 + "clk_null", 269 + "clk_null", 270 + "clk_null", 271 + "clk_null", 272 + "clk_null", 273 + "clk_null", 274 + "clk_null", 275 + "clk_null", 276 + "mainpll_d10", 277 + "mainpll_d7", 278 + "clk_null", 279 + "mainpll_d5" 280 + }; 281 + 282 + static const char * const nfi1x_pad_parents[] __initconst = { 283 + "ahb_infra_sel", 284 + "nfi1x_ck" 285 + }; 286 + 287 + static const char * const mfg_mm_parents[] __initconst = { 288 + "clk_null", 289 + "clk_null", 290 + "clk_null", 291 + "clk_null", 292 + "clk_null", 293 + "clk_null", 294 + "clk_null", 295 + "clk_null", 296 + "csw_mux_mfg_sel", 297 + "clk_null", 298 + "clk_null", 299 + "clk_null", 300 + "clk_null", 301 + "clk_null", 302 + "clk_null", 303 + "clk_null", 304 + "mainpll_d3", 305 + "clk_null", 306 + "clk_null", 307 + "clk_null", 308 + "clk_null", 309 + "clk_null", 310 + "clk_null", 311 + "clk_null", 312 + "clk_null", 313 + "clk_null", 314 + "clk_null", 315 + "clk_null", 316 + "clk_null", 317 + "clk_null", 318 + "clk_null", 319 + "clk_null", 320 + "clk_null", 321 + "mainpll_d5", 322 + "mainpll_d7", 323 + "clk_null", 324 + "mainpll_d14" 325 + }; 326 + 327 + static const char * const ddrphycfg_parents[] __initconst = { 328 + "clk26m_ck", 329 + "mainpll_d16" 330 + }; 331 + 332 + static const char * const smi_mm_parents[] __initconst = { 333 + "clk26m_ck", 334 + "clk_null", 335 + "clk_null", 336 + "clk_null", 337 + "clk_null", 338 + "clk_null", 339 + "clk_null", 340 + "clk_null", 341 + "clk_null", 342 + "univpll_d4", 343 + "mainpll_d7", 344 + "clk_null", 345 + "mainpll_d14" 346 + }; 347 + 348 + static const char * const usb_78m_parents[] __initconst = { 349 + "clk_null", 350 + "clk26m_ck", 351 + "univpll_d16", 352 + "clk_null", 353 + "mainpll_d20" 354 + }; 355 + 356 + static const char * const scam_mm_parents[] __initconst = { 357 + "clk_null", 358 + "clk26m_ck", 359 + "mainpll_d14", 360 + "clk_null", 361 + "mainpll_d12" 362 + }; 363 + 364 + static const char * const spinor_parents[] __initconst = { 365 + "clk26m_d2", 366 + "clk26m_ck", 367 + "mainpll_d40", 368 + "univpll_d24", 369 + "univpll_d20", 370 + "mainpll_d20", 371 + "mainpll_d16", 372 + "univpll_d12" 373 + }; 374 + 375 + static const char * const msdc2_parents[] __initconst = { 376 + "clk26m_ck", 377 + "univpll_d6", 378 + "mainpll_d8", 379 + "univpll_d8", 380 + "mainpll_d16", 381 + "mmpll_200m", 382 + "mainpll_d12", 383 + "mmpll_d2" 384 + }; 385 + 386 + static const char * const eth_parents[] __initconst = { 387 + "clk26m_ck", 388 + "mainpll_d40", 389 + "univpll_d24", 390 + "univpll_d20", 391 + "mainpll_d20" 392 + }; 393 + 394 + static const char * const vdec_mm_parents[] __initconst = { 395 + "clk26m_ck", 396 + "univpll_d4", 397 + "mainpll_d4", 398 + "univpll_d5", 399 + "univpll_d6", 400 + "mainpll_d6" 401 + }; 402 + 403 + static const char * const dpi0_mm_parents[] __initconst = { 404 + "clk26m_ck", 405 + "lvdspll_ck", 406 + "lvdspll_d2", 407 + "lvdspll_d4", 408 + "lvdspll_d8" 409 + }; 410 + 411 + static const char * const dpi1_mm_parents[] __initconst = { 412 + "clk26m_ck", 413 + "tvdpll_d2", 414 + "tvdpll_d4", 415 + "tvdpll_d8", 416 + "tvdpll_d16" 417 + }; 418 + 419 + static const char * const axi_mfg_in_parents[] __initconst = { 420 + "clk26m_ck", 421 + "mainpll_d11", 422 + "univpll_d24", 423 + "mmpll380m" 424 + }; 425 + 426 + static const char * const slow_mfg_parents[] __initconst = { 427 + "clk26m_ck", 428 + "univpll_d12", 429 + "univpll_d24" 430 + }; 431 + 432 + static const char * const aud1_parents[] __initconst = { 433 + "clk26m_ck", 434 + "apll1_ck" 435 + }; 436 + 437 + static const char * const aud2_parents[] __initconst = { 438 + "clk26m_ck", 439 + "apll2_ck" 440 + }; 441 + 442 + static const char * const aud_engen1_parents[] __initconst = { 443 + "clk26m_ck", 444 + "rg_apll1_d2_en", 445 + "rg_apll1_d4_en", 446 + "rg_apll1_d8_en" 447 + }; 448 + 449 + static const char * const aud_engen2_parents[] __initconst = { 450 + "clk26m_ck", 451 + "rg_apll2_d2_en", 452 + "rg_apll2_d4_en", 453 + "rg_apll2_d8_en" 454 + }; 455 + 456 + static const char * const i2c_parents[] __initconst = { 457 + "clk26m_ck", 458 + "univpll_d20", 459 + "univpll_d16", 460 + "univpll_d12" 461 + }; 462 + 463 + static const char * const aud_i2s0_m_parents[] __initconst = { 464 + "rg_aud1", 465 + "rg_aud2" 466 + }; 467 + 468 + static const char * const pwm_parents[] __initconst = { 469 + "clk26m_ck", 470 + "univpll_d12" 471 + }; 472 + 473 + static const char * const spi_parents[] __initconst = { 474 + "clk26m_ck", 475 + "univpll_d12", 476 + "univpll_d8", 477 + "univpll_d6" 478 + }; 479 + 480 + static const char * const aud_spdifin_parents[] __initconst = { 481 + "clk26m_ck", 482 + "univpll_d2" 483 + }; 484 + 485 + static const char * const uart2_parents[] __initconst = { 486 + "clk26m_ck", 487 + "univpll_d24" 488 + }; 489 + 490 + static const char * const bsi_parents[] __initconst = { 491 + "clk26m_ck", 492 + "mainpll_d10", 493 + "mainpll_d12", 494 + "mainpll_d20" 495 + }; 496 + 497 + static const char * const dbg_atclk_parents[] __initconst = { 498 + "clk_null", 499 + "clk26m_ck", 500 + "mainpll_d5", 501 + "clk_null", 502 + "univpll_d5" 503 + }; 504 + 505 + static const char * const csw_nfiecc_parents[] __initconst = { 506 + "clk_null", 507 + "mainpll_d7", 508 + "mainpll_d6", 509 + "clk_null", 510 + "mainpll_d5" 511 + }; 512 + 513 + static const char * const nfiecc_parents[] __initconst = { 514 + "clk_null", 515 + "nfi2x_pad_sel", 516 + "mainpll_d4", 517 + "clk_null", 518 + "csw_nfiecc_sel" 519 + }; 520 + 521 + static struct mtk_composite top_muxes[] __initdata = { 522 + /* CLK_MUX_SEL0 */ 523 + MUX(CLK_TOP_UART0_SEL, "uart0_sel", uart0_parents, 524 + 0x000, 0, 1), 525 + MUX(CLK_TOP_GFMUX_EMI1X_SEL, "gfmux_emi1x_sel", gfmux_emi1x_parents, 526 + 0x000, 1, 1), 527 + MUX(CLK_TOP_EMI_DDRPHY_SEL, "emi_ddrphy_sel", emi_ddrphy_parents, 528 + 0x000, 2, 1), 529 + MUX(CLK_TOP_AHB_INFRA_SEL, "ahb_infra_sel", ahb_infra_parents, 530 + 0x000, 4, 4), 531 + MUX(CLK_TOP_CSW_MUX_MFG_SEL, "csw_mux_mfg_sel", csw_mux_mfg_parents, 532 + 0x000, 8, 3), 533 + MUX(CLK_TOP_MSDC0_SEL, "msdc0_sel", msdc0_parents, 534 + 0x000, 11, 3), 535 + MUX(CLK_TOP_CAMTG_MM_SEL, "camtg_mm_sel", camtg_mm_parents, 536 + 0x000, 15, 3), 537 + MUX(CLK_TOP_PWM_MM_SEL, "pwm_mm_sel", pwm_mm_parents, 538 + 0x000, 18, 1), 539 + MUX(CLK_TOP_UART1_SEL, "uart1_sel", uart1_parents, 540 + 0x000, 19, 1), 541 + MUX(CLK_TOP_MSDC1_SEL, "msdc1_sel", msdc1_parents, 542 + 0x000, 20, 3), 543 + MUX(CLK_TOP_SPM_52M_SEL, "spm_52m_sel", spm_52m_parents, 544 + 0x000, 23, 1), 545 + MUX(CLK_TOP_PMICSPI_SEL, "pmicspi_sel", pmicspi_parents, 546 + 0x000, 24, 2), 547 + MUX(CLK_TOP_QAXI_AUD26M_SEL, "qaxi_aud26m_sel", qaxi_aud26m_parents, 548 + 0x000, 26, 1), 549 + MUX(CLK_TOP_AUD_INTBUS_SEL, "aud_intbus_sel", aud_intbus_parents, 550 + 0x000, 27, 3), 551 + /* CLK_MUX_SEL1 */ 552 + MUX(CLK_TOP_NFI2X_PAD_SEL, "nfi2x_pad_sel", nfi2x_pad_parents, 553 + 0x004, 0, 7), 554 + MUX(CLK_TOP_NFI1X_PAD_SEL, "nfi1x_pad_sel", nfi1x_pad_parents, 555 + 0x004, 7, 1), 556 + MUX(CLK_TOP_MFG_MM_SEL, "mfg_mm_sel", mfg_mm_parents, 557 + 0x004, 8, 6), 558 + MUX(CLK_TOP_DDRPHYCFG_SEL, "ddrphycfg_sel", ddrphycfg_parents, 559 + 0x004, 15, 1), 560 + MUX(CLK_TOP_SMI_MM_SEL, "smi_mm_sel", smi_mm_parents, 561 + 0x004, 16, 4), 562 + MUX(CLK_TOP_USB_78M_SEL, "usb_78m_sel", usb_78m_parents, 563 + 0x004, 20, 3), 564 + MUX(CLK_TOP_SCAM_MM_SEL, "scam_mm_sel", scam_mm_parents, 565 + 0x004, 23, 3), 566 + /* CLK_MUX_SEL8 */ 567 + MUX(CLK_TOP_SPINOR_SEL, "spinor_sel", spinor_parents, 568 + 0x040, 0, 3), 569 + MUX(CLK_TOP_MSDC2_SEL, "msdc2_sel", msdc2_parents, 570 + 0x040, 3, 3), 571 + MUX(CLK_TOP_ETH_SEL, "eth_sel", eth_parents, 572 + 0x040, 6, 3), 573 + MUX(CLK_TOP_VDEC_MM_SEL, "vdec_mm_sel", vdec_mm_parents, 574 + 0x040, 9, 3), 575 + MUX(CLK_TOP_DPI0_MM_SEL, "dpi0_mm_sel", dpi0_mm_parents, 576 + 0x040, 12, 3), 577 + MUX(CLK_TOP_DPI1_MM_SEL, "dpi1_mm_sel", dpi1_mm_parents, 578 + 0x040, 15, 3), 579 + MUX(CLK_TOP_AXI_MFG_IN_SEL, "axi_mfg_in_sel", axi_mfg_in_parents, 580 + 0x040, 18, 2), 581 + MUX(CLK_TOP_SLOW_MFG_SEL, "slow_mfg_sel", slow_mfg_parents, 582 + 0x040, 20, 2), 583 + MUX(CLK_TOP_AUD1_SEL, "aud1_sel", aud1_parents, 584 + 0x040, 22, 1), 585 + MUX(CLK_TOP_AUD2_SEL, "aud2_sel", aud2_parents, 586 + 0x040, 23, 1), 587 + MUX(CLK_TOP_AUD_ENGEN1_SEL, "aud_engen1_sel", aud_engen1_parents, 588 + 0x040, 24, 2), 589 + MUX(CLK_TOP_AUD_ENGEN2_SEL, "aud_engen2_sel", aud_engen2_parents, 590 + 0x040, 26, 2), 591 + MUX(CLK_TOP_I2C_SEL, "i2c_sel", i2c_parents, 592 + 0x040, 28, 2), 593 + /* CLK_SEL_9 */ 594 + MUX(CLK_TOP_AUD_I2S0_M_SEL, "aud_i2s0_m_sel", aud_i2s0_m_parents, 595 + 0x044, 12, 1), 596 + MUX(CLK_TOP_AUD_I2S1_M_SEL, "aud_i2s1_m_sel", aud_i2s0_m_parents, 597 + 0x044, 13, 1), 598 + MUX(CLK_TOP_AUD_I2S2_M_SEL, "aud_i2s2_m_sel", aud_i2s0_m_parents, 599 + 0x044, 14, 1), 600 + MUX(CLK_TOP_AUD_I2S3_M_SEL, "aud_i2s3_m_sel", aud_i2s0_m_parents, 601 + 0x044, 15, 1), 602 + MUX(CLK_TOP_AUD_I2S4_M_SEL, "aud_i2s4_m_sel", aud_i2s0_m_parents, 603 + 0x044, 16, 1), 604 + MUX(CLK_TOP_AUD_I2S5_M_SEL, "aud_i2s5_m_sel", aud_i2s0_m_parents, 605 + 0x044, 17, 1), 606 + MUX(CLK_TOP_AUD_SPDIF_B_SEL, "aud_spdif_b_sel", aud_i2s0_m_parents, 607 + 0x044, 18, 1), 608 + /* CLK_MUX_SEL13 */ 609 + MUX(CLK_TOP_PWM_SEL, "pwm_sel", pwm_parents, 610 + 0x07c, 0, 1), 611 + MUX(CLK_TOP_SPI_SEL, "spi_sel", spi_parents, 612 + 0x07c, 1, 2), 613 + MUX(CLK_TOP_AUD_SPDIFIN_SEL, "aud_spdifin_sel", aud_spdifin_parents, 614 + 0x07c, 3, 1), 615 + MUX(CLK_TOP_UART2_SEL, "uart2_sel", uart2_parents, 616 + 0x07c, 4, 1), 617 + MUX(CLK_TOP_BSI_SEL, "bsi_sel", bsi_parents, 618 + 0x07c, 5, 2), 619 + MUX(CLK_TOP_DBG_ATCLK_SEL, "dbg_atclk_sel", dbg_atclk_parents, 620 + 0x07c, 7, 3), 621 + MUX(CLK_TOP_CSW_NFIECC_SEL, "csw_nfiecc_sel", csw_nfiecc_parents, 622 + 0x07c, 10, 3), 623 + MUX(CLK_TOP_NFIECC_SEL, "nfiecc_sel", nfiecc_parents, 624 + 0x07c, 13, 3), 625 + }; 626 + 627 + static const char * const ifr_mux1_parents[] __initconst = { 628 + "clk26m_ck", 629 + "armpll", 630 + "univpll", 631 + "mainpll_d2" 632 + }; 633 + 634 + static const char * const ifr_eth_25m_parents[] __initconst = { 635 + "eth_d2_ck", 636 + "rg_eth" 637 + }; 638 + 639 + static const char * const ifr_i2c0_parents[] __initconst = { 640 + "ahb_infra_d2", 641 + "rg_i2c" 642 + }; 643 + 644 + static const struct mtk_composite ifr_muxes[] __initconst = { 645 + MUX(CLK_IFR_MUX1_SEL, "ifr_mux1_sel", ifr_mux1_parents, 0x000, 646 + 2, 2), 647 + MUX(CLK_IFR_ETH_25M_SEL, "ifr_eth_25m_sel", ifr_eth_25m_parents, 0x080, 648 + 0, 1), 649 + MUX(CLK_IFR_I2C0_SEL, "ifr_i2c0_sel", ifr_i2c0_parents, 0x080, 650 + 1, 1), 651 + MUX(CLK_IFR_I2C1_SEL, "ifr_i2c1_sel", ifr_i2c0_parents, 0x080, 652 + 2, 1), 653 + MUX(CLK_IFR_I2C2_SEL, "ifr_i2c2_sel", ifr_i2c0_parents, 0x080, 654 + 3, 1), 655 + }; 656 + 657 + #define DIV_ADJ(_id, _name, _parent, _reg, _shift, _width) { \ 658 + .id = _id, \ 659 + .name = _name, \ 660 + .parent_name = _parent, \ 661 + .div_reg = _reg, \ 662 + .div_shift = _shift, \ 663 + .div_width = _width, \ 664 + } 665 + 666 + static const struct mtk_clk_divider top_adj_divs[] = { 667 + DIV_ADJ(CLK_TOP_APLL12_CK_DIV0, "apll12_ck_div0", "aud_i2s0_m_sel", 668 + 0x0048, 0, 8), 669 + DIV_ADJ(CLK_TOP_APLL12_CK_DIV1, "apll12_ck_div1", "aud_i2s1_m_sel", 670 + 0x0048, 8, 8), 671 + DIV_ADJ(CLK_TOP_APLL12_CK_DIV2, "apll12_ck_div2", "aud_i2s2_m_sel", 672 + 0x0048, 16, 8), 673 + DIV_ADJ(CLK_TOP_APLL12_CK_DIV3, "apll12_ck_div3", "aud_i2s3_m_sel", 674 + 0x0048, 24, 8), 675 + DIV_ADJ(CLK_TOP_APLL12_CK_DIV4, "apll12_ck_div4", "aud_i2s4_m_sel", 676 + 0x004c, 0, 8), 677 + DIV_ADJ(CLK_TOP_APLL12_CK_DIV4B, "apll12_ck_div4b", "apll12_div4", 678 + 0x004c, 8, 8), 679 + DIV_ADJ(CLK_TOP_APLL12_CK_DIV5, "apll12_ck_div5", "aud_i2s5_m_sel", 680 + 0x004c, 16, 8), 681 + DIV_ADJ(CLK_TOP_APLL12_CK_DIV5B, "apll12_ck_div5b", "apll12_div5", 682 + 0x004c, 24, 8), 683 + DIV_ADJ(CLK_TOP_APLL12_CK_DIV6, "apll12_ck_div6", "aud_spdif_b_sel", 684 + 0x0078, 0, 8), 685 + }; 686 + 687 + #define DIV_ADJ_FLAG(_id, _name, _parent, _reg, _shift, _width, _flag) { \ 688 + .id = _id, \ 689 + .name = _name, \ 690 + .parent_name = _parent, \ 691 + .div_reg = _reg, \ 692 + .div_shift = _shift, \ 693 + .div_width = _width, \ 694 + .clk_divider_flags = _flag, \ 695 + } 696 + 697 + static const struct mtk_clk_divider apmixed_adj_divs[] = { 698 + DIV_ADJ_FLAG(CLK_APMIXED_HDMI_REF, "hdmi_ref", "tvdpll", 699 + 0x1c4, 24, 3, CLK_DIVIDER_POWER_OF_TWO), 700 + }; 701 + 702 + static const struct mtk_gate_regs top0_cg_regs = { 703 + .set_ofs = 0x50, 704 + .clr_ofs = 0x80, 705 + .sta_ofs = 0x20, 706 + }; 707 + 708 + static const struct mtk_gate_regs top1_cg_regs = { 709 + .set_ofs = 0x54, 710 + .clr_ofs = 0x84, 711 + .sta_ofs = 0x24, 712 + }; 713 + 714 + static const struct mtk_gate_regs top2_cg_regs = { 715 + .set_ofs = 0x6c, 716 + .clr_ofs = 0x9c, 717 + .sta_ofs = 0x3c, 718 + }; 719 + 720 + static const struct mtk_gate_regs top3_cg_regs = { 721 + .set_ofs = 0xa0, 722 + .clr_ofs = 0xb0, 723 + .sta_ofs = 0x70, 724 + }; 725 + 726 + static const struct mtk_gate_regs top4_cg_regs = { 727 + .set_ofs = 0xa4, 728 + .clr_ofs = 0xb4, 729 + .sta_ofs = 0x74, 730 + }; 731 + 732 + static const struct mtk_gate_regs top5_cg_regs = { 733 + .set_ofs = 0x44, 734 + .clr_ofs = 0x44, 735 + .sta_ofs = 0x44, 736 + }; 737 + 738 + #define GATE_TOP0(_id, _name, _parent, _shift) { \ 739 + .id = _id, \ 740 + .name = _name, \ 741 + .parent_name = _parent, \ 742 + .regs = &top0_cg_regs, \ 743 + .shift = _shift, \ 744 + .ops = &mtk_clk_gate_ops_setclr, \ 745 + } 746 + 747 + #define GATE_TOP0_I(_id, _name, _parent, _shift) { \ 748 + .id = _id, \ 749 + .name = _name, \ 750 + .parent_name = _parent, \ 751 + .regs = &top0_cg_regs, \ 752 + .shift = _shift, \ 753 + .ops = &mtk_clk_gate_ops_setclr_inv, \ 754 + } 755 + 756 + #define GATE_TOP1(_id, _name, _parent, _shift) { \ 757 + .id = _id, \ 758 + .name = _name, \ 759 + .parent_name = _parent, \ 760 + .regs = &top1_cg_regs, \ 761 + .shift = _shift, \ 762 + .ops = &mtk_clk_gate_ops_setclr, \ 763 + } 764 + 765 + #define GATE_TOP2(_id, _name, _parent, _shift) { \ 766 + .id = _id, \ 767 + .name = _name, \ 768 + .parent_name = _parent, \ 769 + .regs = &top2_cg_regs, \ 770 + .shift = _shift, \ 771 + .ops = &mtk_clk_gate_ops_setclr, \ 772 + } 773 + 774 + #define GATE_TOP2_I(_id, _name, _parent, _shift) { \ 775 + .id = _id, \ 776 + .name = _name, \ 777 + .parent_name = _parent, \ 778 + .regs = &top2_cg_regs, \ 779 + .shift = _shift, \ 780 + .ops = &mtk_clk_gate_ops_setclr_inv, \ 781 + } 782 + 783 + #define GATE_TOP3(_id, _name, _parent, _shift) { \ 784 + .id = _id, \ 785 + .name = _name, \ 786 + .parent_name = _parent, \ 787 + .regs = &top3_cg_regs, \ 788 + .shift = _shift, \ 789 + .ops = &mtk_clk_gate_ops_setclr, \ 790 + } 791 + 792 + #define GATE_TOP4_I(_id, _name, _parent, _shift) { \ 793 + .id = _id, \ 794 + .name = _name, \ 795 + .parent_name = _parent, \ 796 + .regs = &top4_cg_regs, \ 797 + .shift = _shift, \ 798 + .ops = &mtk_clk_gate_ops_setclr_inv, \ 799 + } 800 + 801 + #define GATE_TOP5(_id, _name, _parent, _shift) { \ 802 + .id = _id, \ 803 + .name = _name, \ 804 + .parent_name = _parent, \ 805 + .regs = &top5_cg_regs, \ 806 + .shift = _shift, \ 807 + .ops = &mtk_clk_gate_ops_no_setclr, \ 808 + } 809 + 810 + static const struct mtk_gate top_clks[] __initconst = { 811 + /* TOP0 */ 812 + GATE_TOP0(CLK_TOP_PWM_MM, "pwm_mm", "pwm_mm_sel", 0), 813 + GATE_TOP0(CLK_TOP_CAM_MM, "cam_mm", "camtg_mm_sel", 1), 814 + GATE_TOP0(CLK_TOP_MFG_MM, "mfg_mm", "mfg_mm_sel", 2), 815 + GATE_TOP0(CLK_TOP_SPM_52M, "spm_52m", "spm_52m_sel", 3), 816 + GATE_TOP0_I(CLK_TOP_MIPI_26M_DBG, "mipi_26m_dbg", "mipi_26m", 4), 817 + GATE_TOP0(CLK_TOP_SCAM_MM, "scam_mm", "scam_mm_sel", 5), 818 + GATE_TOP0(CLK_TOP_SMI_MM, "smi_mm", "smi_mm_sel", 9), 819 + /* TOP1 */ 820 + GATE_TOP1(CLK_TOP_THEM, "them", "ahb_infra_sel", 1), 821 + GATE_TOP1(CLK_TOP_APDMA, "apdma", "ahb_infra_sel", 2), 822 + GATE_TOP1(CLK_TOP_I2C0, "i2c0", "ifr_i2c0_sel", 3), 823 + GATE_TOP1(CLK_TOP_I2C1, "i2c1", "ifr_i2c1_sel", 4), 824 + GATE_TOP1(CLK_TOP_AUXADC1, "auxadc1", "ahb_infra_sel", 5), 825 + GATE_TOP1(CLK_TOP_NFI, "nfi", "nfi1x_pad_sel", 6), 826 + GATE_TOP1(CLK_TOP_NFIECC, "nfiecc", "rg_nfiecc", 7), 827 + GATE_TOP1(CLK_TOP_DEBUGSYS, "debugsys", "rg_dbg_atclk", 8), 828 + GATE_TOP1(CLK_TOP_PWM, "pwm", "ahb_infra_sel", 9), 829 + GATE_TOP1(CLK_TOP_UART0, "uart0", "uart0_sel", 10), 830 + GATE_TOP1(CLK_TOP_UART1, "uart1", "uart1_sel", 11), 831 + GATE_TOP1(CLK_TOP_BTIF, "btif", "ahb_infra_sel", 12), 832 + GATE_TOP1(CLK_TOP_USB, "usb", "usb_78m", 13), 833 + GATE_TOP1(CLK_TOP_FLASHIF_26M, "flashif_26m", "clk26m_ck", 14), 834 + GATE_TOP1(CLK_TOP_AUXADC2, "auxadc2", "ahb_infra_sel", 15), 835 + GATE_TOP1(CLK_TOP_I2C2, "i2c2", "ifr_i2c2_sel", 16), 836 + GATE_TOP1(CLK_TOP_MSDC0, "msdc0", "msdc0_sel", 17), 837 + GATE_TOP1(CLK_TOP_MSDC1, "msdc1", "msdc1_sel", 18), 838 + GATE_TOP1(CLK_TOP_NFI2X, "nfi2x", "nfi2x_pad_sel", 19), 839 + GATE_TOP1(CLK_TOP_PMICWRAP_AP, "pwrap_ap", "clk26m_ck", 20), 840 + GATE_TOP1(CLK_TOP_SEJ, "sej", "ahb_infra_sel", 21), 841 + GATE_TOP1(CLK_TOP_MEMSLP_DLYER, "memslp_dlyer", "clk26m_ck", 22), 842 + GATE_TOP1(CLK_TOP_SPI, "spi", "spi_sel", 23), 843 + GATE_TOP1(CLK_TOP_APXGPT, "apxgpt", "clk26m_ck", 24), 844 + GATE_TOP1(CLK_TOP_AUDIO, "audio", "clk26m_ck", 25), 845 + GATE_TOP1(CLK_TOP_PMICWRAP_MD, "pwrap_md", "clk26m_ck", 27), 846 + GATE_TOP1(CLK_TOP_PMICWRAP_CONN, "pwrap_conn", "clk26m_ck", 28), 847 + GATE_TOP1(CLK_TOP_PMICWRAP_26M, "pwrap_26m", "clk26m_ck", 29), 848 + GATE_TOP1(CLK_TOP_AUX_ADC, "aux_adc", "clk26m_ck", 30), 849 + GATE_TOP1(CLK_TOP_AUX_TP, "aux_tp", "clk26m_ck", 31), 850 + /* TOP2 */ 851 + GATE_TOP2(CLK_TOP_MSDC2, "msdc2", "ahb_infra_sel", 0), 852 + GATE_TOP2(CLK_TOP_RBIST, "rbist", "univpll_d12", 1), 853 + GATE_TOP2(CLK_TOP_NFI_BUS, "nfi_bus", "ahb_infra_sel", 2), 854 + GATE_TOP2(CLK_TOP_GCE, "gce", "ahb_infra_sel", 4), 855 + GATE_TOP2(CLK_TOP_TRNG, "trng", "ahb_infra_sel", 5), 856 + GATE_TOP2(CLK_TOP_SEJ_13M, "sej_13m", "clk26m_ck", 6), 857 + GATE_TOP2(CLK_TOP_AES, "aes", "ahb_infra_sel", 7), 858 + GATE_TOP2(CLK_TOP_PWM_B, "pwm_b", "rg_pwm_infra", 8), 859 + GATE_TOP2(CLK_TOP_PWM1_FB, "pwm1_fb", "rg_pwm_infra", 9), 860 + GATE_TOP2(CLK_TOP_PWM2_FB, "pwm2_fb", "rg_pwm_infra", 10), 861 + GATE_TOP2(CLK_TOP_PWM3_FB, "pwm3_fb", "rg_pwm_infra", 11), 862 + GATE_TOP2(CLK_TOP_PWM4_FB, "pwm4_fb", "rg_pwm_infra", 12), 863 + GATE_TOP2(CLK_TOP_PWM5_FB, "pwm5_fb", "rg_pwm_infra", 13), 864 + GATE_TOP2(CLK_TOP_USB_1P, "usb_1p", "usb_78m", 14), 865 + GATE_TOP2(CLK_TOP_FLASHIF_FREERUN, "flashif_freerun", "ahb_infra_sel", 866 + 15), 867 + GATE_TOP2(CLK_TOP_26M_HDMI_SIFM, "hdmi_sifm_26m", "clk26m_ck", 16), 868 + GATE_TOP2(CLK_TOP_26M_CEC, "cec_26m", "clk26m_ck", 17), 869 + GATE_TOP2(CLK_TOP_32K_CEC, "cec_32k", "clk32k", 18), 870 + GATE_TOP2(CLK_TOP_66M_ETH, "eth_66m", "ahb_infra_d2", 19), 871 + GATE_TOP2(CLK_TOP_133M_ETH, "eth_133m", "ahb_infra_sel", 20), 872 + GATE_TOP2(CLK_TOP_FETH_25M, "feth_25m", "ifr_eth_25m_sel", 21), 873 + GATE_TOP2(CLK_TOP_FETH_50M, "feth_50m", "rg_eth", 22), 874 + GATE_TOP2(CLK_TOP_FLASHIF_AXI, "flashif_axi", "ahb_infra_sel", 23), 875 + GATE_TOP2(CLK_TOP_USBIF, "usbif", "ahb_infra_sel", 24), 876 + GATE_TOP2(CLK_TOP_UART2, "uart2", "rg_uart2", 25), 877 + GATE_TOP2(CLK_TOP_BSI, "bsi", "ahb_infra_sel", 26), 878 + GATE_TOP2(CLK_TOP_GCPU_B, "gcpu_b", "ahb_infra_sel", 27), 879 + GATE_TOP2_I(CLK_TOP_MSDC0_INFRA, "msdc0_infra", "msdc0", 28), 880 + GATE_TOP2_I(CLK_TOP_MSDC1_INFRA, "msdc1_infra", "msdc1", 29), 881 + GATE_TOP2_I(CLK_TOP_MSDC2_INFRA, "msdc2_infra", "rg_msdc2", 30), 882 + GATE_TOP2(CLK_TOP_USB_78M, "usb_78m", "usb_78m_sel", 31), 883 + /* TOP3 */ 884 + GATE_TOP3(CLK_TOP_RG_SPINOR, "rg_spinor", "spinor_sel", 0), 885 + GATE_TOP3(CLK_TOP_RG_MSDC2, "rg_msdc2", "msdc2_sel", 1), 886 + GATE_TOP3(CLK_TOP_RG_ETH, "rg_eth", "eth_sel", 2), 887 + GATE_TOP3(CLK_TOP_RG_VDEC, "rg_vdec", "vdec_mm_sel", 3), 888 + GATE_TOP3(CLK_TOP_RG_FDPI0, "rg_fdpi0", "dpi0_mm_sel", 4), 889 + GATE_TOP3(CLK_TOP_RG_FDPI1, "rg_fdpi1", "dpi1_mm_sel", 5), 890 + GATE_TOP3(CLK_TOP_RG_AXI_MFG, "rg_axi_mfg", "axi_mfg_in_sel", 6), 891 + GATE_TOP3(CLK_TOP_RG_SLOW_MFG, "rg_slow_mfg", "slow_mfg_sel", 7), 892 + GATE_TOP3(CLK_TOP_RG_AUD1, "rg_aud1", "aud1_sel", 8), 893 + GATE_TOP3(CLK_TOP_RG_AUD2, "rg_aud2", "aud2_sel", 9), 894 + GATE_TOP3(CLK_TOP_RG_AUD_ENGEN1, "rg_aud_engen1", "aud_engen1_sel", 10), 895 + GATE_TOP3(CLK_TOP_RG_AUD_ENGEN2, "rg_aud_engen2", "aud_engen2_sel", 11), 896 + GATE_TOP3(CLK_TOP_RG_I2C, "rg_i2c", "i2c_sel", 12), 897 + GATE_TOP3(CLK_TOP_RG_PWM_INFRA, "rg_pwm_infra", "pwm_sel", 13), 898 + GATE_TOP3(CLK_TOP_RG_AUD_SPDIF_IN, "rg_aud_spdif_in", "aud_spdifin_sel", 899 + 14), 900 + GATE_TOP3(CLK_TOP_RG_UART2, "rg_uart2", "uart2_sel", 15), 901 + GATE_TOP3(CLK_TOP_RG_BSI, "rg_bsi", "bsi_sel", 16), 902 + GATE_TOP3(CLK_TOP_RG_DBG_ATCLK, "rg_dbg_atclk", "dbg_atclk_sel", 17), 903 + GATE_TOP3(CLK_TOP_RG_NFIECC, "rg_nfiecc", "nfiecc_sel", 18), 904 + /* TOP4 */ 905 + GATE_TOP4_I(CLK_TOP_RG_APLL1_D2_EN, "rg_apll1_d2_en", "apll1_d2", 8), 906 + GATE_TOP4_I(CLK_TOP_RG_APLL1_D4_EN, "rg_apll1_d4_en", "apll1_d4", 9), 907 + GATE_TOP4_I(CLK_TOP_RG_APLL1_D8_EN, "rg_apll1_d8_en", "apll1_d8", 10), 908 + GATE_TOP4_I(CLK_TOP_RG_APLL2_D2_EN, "rg_apll2_d2_en", "apll2_d2", 11), 909 + GATE_TOP4_I(CLK_TOP_RG_APLL2_D4_EN, "rg_apll2_d4_en", "apll2_d4", 12), 910 + GATE_TOP4_I(CLK_TOP_RG_APLL2_D8_EN, "rg_apll2_d8_en", "apll2_d8", 13), 911 + /* TOP5 */ 912 + GATE_TOP5(CLK_TOP_APLL12_DIV0, "apll12_div0", "apll12_ck_div0", 0), 913 + GATE_TOP5(CLK_TOP_APLL12_DIV1, "apll12_div1", "apll12_ck_div1", 1), 914 + GATE_TOP5(CLK_TOP_APLL12_DIV2, "apll12_div2", "apll12_ck_div2", 2), 915 + GATE_TOP5(CLK_TOP_APLL12_DIV3, "apll12_div3", "apll12_ck_div3", 3), 916 + GATE_TOP5(CLK_TOP_APLL12_DIV4, "apll12_div4", "apll12_ck_div4", 4), 917 + GATE_TOP5(CLK_TOP_APLL12_DIV4B, "apll12_div4b", "apll12_ck_div4b", 5), 918 + GATE_TOP5(CLK_TOP_APLL12_DIV5, "apll12_div5", "apll12_ck_div5", 6), 919 + GATE_TOP5(CLK_TOP_APLL12_DIV5B, "apll12_div5b", "apll12_ck_div5b", 7), 920 + GATE_TOP5(CLK_TOP_APLL12_DIV6, "apll12_div6", "apll12_ck_div6", 8), 921 + }; 922 + 923 + static void __init mtk_topckgen_init(struct device_node *node) 924 + { 925 + struct clk_onecell_data *clk_data; 926 + int r; 927 + void __iomem *base; 928 + 929 + base = of_iomap(node, 0); 930 + if (!base) { 931 + pr_err("%s(): ioremap failed\n", __func__); 932 + return; 933 + } 934 + 935 + clk_data = mtk_alloc_clk_data(MT8167_CLK_TOP_NR_CLK); 936 + 937 + mtk_clk_register_fixed_clks(fixed_clks, ARRAY_SIZE(fixed_clks), 938 + clk_data); 939 + mtk_clk_register_gates(node, top_clks, ARRAY_SIZE(top_clks), clk_data); 940 + 941 + mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data); 942 + mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base, 943 + &mt8167_clk_lock, clk_data); 944 + mtk_clk_register_dividers(top_adj_divs, ARRAY_SIZE(top_adj_divs), 945 + base, &mt8167_clk_lock, clk_data); 946 + 947 + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); 948 + if (r) 949 + pr_err("%s(): could not register clock provider: %d\n", 950 + __func__, r); 951 + } 952 + CLK_OF_DECLARE(mtk_topckgen, "mediatek,mt8167-topckgen", mtk_topckgen_init); 953 + 954 + static void __init mtk_infracfg_init(struct device_node *node) 955 + { 956 + struct clk_onecell_data *clk_data; 957 + int r; 958 + void __iomem *base; 959 + 960 + base = of_iomap(node, 0); 961 + if (!base) { 962 + pr_err("%s(): ioremap failed\n", __func__); 963 + return; 964 + } 965 + 966 + clk_data = mtk_alloc_clk_data(CLK_IFR_NR_CLK); 967 + 968 + mtk_clk_register_composites(ifr_muxes, ARRAY_SIZE(ifr_muxes), base, 969 + &mt8167_clk_lock, clk_data); 970 + 971 + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); 972 + if (r) 973 + pr_err("%s(): could not register clock provider: %d\n", 974 + __func__, r); 975 + } 976 + CLK_OF_DECLARE(mtk_infracfg, "mediatek,mt8167-infracfg", mtk_infracfg_init); 977 + 978 + #define MT8167_PLL_FMAX (2500UL * MHZ) 979 + 980 + #define CON0_MT8167_RST_BAR BIT(27) 981 + 982 + #define PLL_B(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \ 983 + _pd_reg, _pd_shift, _tuner_reg, _pcw_reg, \ 984 + _pcw_shift, _div_table) { \ 985 + .id = _id, \ 986 + .name = _name, \ 987 + .reg = _reg, \ 988 + .pwr_reg = _pwr_reg, \ 989 + .en_mask = _en_mask, \ 990 + .flags = _flags, \ 991 + .rst_bar_mask = CON0_MT8167_RST_BAR, \ 992 + .fmax = MT8167_PLL_FMAX, \ 993 + .pcwbits = _pcwbits, \ 994 + .pd_reg = _pd_reg, \ 995 + .pd_shift = _pd_shift, \ 996 + .tuner_reg = _tuner_reg, \ 997 + .pcw_reg = _pcw_reg, \ 998 + .pcw_shift = _pcw_shift, \ 999 + .div_table = _div_table, \ 1000 + } 1001 + 1002 + #define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \ 1003 + _pd_reg, _pd_shift, _tuner_reg, _pcw_reg, \ 1004 + _pcw_shift) \ 1005 + PLL_B(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \ 1006 + _pd_reg, _pd_shift, _tuner_reg, _pcw_reg, _pcw_shift, \ 1007 + NULL) 1008 + 1009 + static const struct mtk_pll_div_table mmpll_div_table[] = { 1010 + { .div = 0, .freq = MT8167_PLL_FMAX }, 1011 + { .div = 1, .freq = 1000000000 }, 1012 + { .div = 2, .freq = 604500000 }, 1013 + { .div = 3, .freq = 253500000 }, 1014 + { .div = 4, .freq = 126750000 }, 1015 + { } /* sentinel */ 1016 + }; 1017 + 1018 + static const struct mtk_pll_data plls[] = { 1019 + PLL(CLK_APMIXED_ARMPLL, "armpll", 0x0100, 0x0110, 0x00000001, 0, 1020 + 21, 0x0104, 24, 0, 0x0104, 0), 1021 + PLL(CLK_APMIXED_MAINPLL, "mainpll", 0x0120, 0x0130, 0x00000001, 1022 + HAVE_RST_BAR, 21, 0x0124, 24, 0, 0x0124, 0), 1023 + PLL(CLK_APMIXED_UNIVPLL, "univpll", 0x0140, 0x0150, 0x30000001, 1024 + HAVE_RST_BAR, 7, 0x0144, 24, 0, 0x0144, 0), 1025 + PLL_B(CLK_APMIXED_MMPLL, "mmpll", 0x0160, 0x0170, 0x00000001, 0, 1026 + 21, 0x0164, 24, 0, 0x0164, 0, mmpll_div_table), 1027 + PLL(CLK_APMIXED_APLL1, "apll1", 0x0180, 0x0190, 0x00000001, 0, 1028 + 31, 0x0180, 1, 0x0194, 0x0184, 0), 1029 + PLL(CLK_APMIXED_APLL2, "apll2", 0x01A0, 0x01B0, 0x00000001, 0, 1030 + 31, 0x01A0, 1, 0x01B4, 0x01A4, 0), 1031 + PLL(CLK_APMIXED_TVDPLL, "tvdpll", 0x01C0, 0x01D0, 0x00000001, 0, 1032 + 21, 0x01C4, 24, 0, 0x01C4, 0), 1033 + PLL(CLK_APMIXED_LVDSPLL, "lvdspll", 0x01E0, 0x01F0, 0x00000001, 0, 1034 + 21, 0x01E4, 24, 0, 0x01E4, 0), 1035 + }; 1036 + 1037 + static void __init mtk_apmixedsys_init(struct device_node *node) 1038 + { 1039 + struct clk_onecell_data *clk_data; 1040 + void __iomem *base; 1041 + int r; 1042 + 1043 + base = of_iomap(node, 0); 1044 + if (!base) { 1045 + pr_err("%s(): ioremap failed\n", __func__); 1046 + return; 1047 + } 1048 + 1049 + clk_data = mtk_alloc_clk_data(MT8167_CLK_APMIXED_NR_CLK); 1050 + 1051 + mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data); 1052 + mtk_clk_register_dividers(apmixed_adj_divs, ARRAY_SIZE(apmixed_adj_divs), 1053 + base, &mt8167_clk_lock, clk_data); 1054 + 1055 + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); 1056 + if (r) 1057 + pr_err("%s(): could not register clock provider: %d\n", 1058 + __func__, r); 1059 + 1060 + } 1061 + CLK_OF_DECLARE(mtk_apmixedsys, "mediatek,mt8167-apmixedsys", 1062 + mtk_apmixedsys_init);
+17 -9
drivers/clk/meson/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 + menu "Clock support for Amlogic platforms" 3 + depends on ARCH_MESON || COMPILE_TEST 4 + 2 5 config COMMON_CLK_MESON_REGMAP 3 6 tristate 4 7 select REGMAP ··· 44 41 select COMMON_CLK_MESON_REGMAP 45 42 46 43 config COMMON_CLK_MESON8B 47 - bool 48 - depends on ARCH_MESON 44 + bool "Meson8 SoC Clock controller support" 45 + depends on ARM 46 + default y 49 47 select COMMON_CLK_MESON_REGMAP 50 48 select COMMON_CLK_MESON_MPLL 51 49 select COMMON_CLK_MESON_PLL ··· 58 54 want peripherals and CPU frequency scaling to work. 59 55 60 56 config COMMON_CLK_GXBB 61 - bool 62 - depends on ARCH_MESON 57 + bool "GXBB and GXL SoC clock controllers support" 58 + depends on ARM64 59 + default y 63 60 select COMMON_CLK_MESON_REGMAP 64 61 select COMMON_CLK_MESON_DUALDIV 65 62 select COMMON_CLK_MESON_VID_PLL_DIV ··· 74 69 Say Y if you want peripherals and CPU frequency scaling to work. 75 70 76 71 config COMMON_CLK_AXG 77 - bool 78 - depends on ARCH_MESON 72 + bool "AXG SoC clock controllers support" 73 + depends on ARM64 74 + default y 79 75 select COMMON_CLK_MESON_REGMAP 80 76 select COMMON_CLK_MESON_DUALDIV 81 77 select COMMON_CLK_MESON_MPLL ··· 90 84 91 85 config COMMON_CLK_AXG_AUDIO 92 86 tristate "Meson AXG Audio Clock Controller Driver" 93 - depends on ARCH_MESON 87 + depends on ARM64 94 88 select COMMON_CLK_MESON_REGMAP 95 89 select COMMON_CLK_MESON_PHASE 96 90 select COMMON_CLK_MESON_SCLK_DIV ··· 100 94 aka axg, Say Y if you want audio subsystem to work. 101 95 102 96 config COMMON_CLK_G12A 103 - bool 104 - depends on ARCH_MESON 97 + bool "G12 and SM1 SoC clock controllers support" 98 + depends on ARM64 99 + default y 105 100 select COMMON_CLK_MESON_REGMAP 106 101 select COMMON_CLK_MESON_DUALDIV 107 102 select COMMON_CLK_MESON_MPLL ··· 114 107 help 115 108 Support for the clock controller on Amlogic S905D2, S905X2 and S905Y2 116 109 devices, aka g12a. Say Y if you want peripherals to work. 110 + endmenu
+184 -30
drivers/clk/meson/axg-audio.c
··· 147 147 }, \ 148 148 } 149 149 150 + #define AUD_SCLK_WS(_name, _reg, _width, _shift_ph, _shift_ws, _pname, \ 151 + _iflags) { \ 152 + .data = &(struct meson_sclk_ws_inv_data) { \ 153 + .ph = { \ 154 + .reg_off = (_reg), \ 155 + .shift = (_shift_ph), \ 156 + .width = (_width), \ 157 + }, \ 158 + .ws = { \ 159 + .reg_off = (_reg), \ 160 + .shift = (_shift_ws), \ 161 + .width = (_width), \ 162 + }, \ 163 + }, \ 164 + .hw.init = &(struct clk_init_data) { \ 165 + .name = "aud_"#_name, \ 166 + .ops = &meson_clk_phase_ops, \ 167 + .parent_names = (const char *[]){ #_pname }, \ 168 + .num_parents = 1, \ 169 + .flags = (_iflags), \ 170 + }, \ 171 + } 172 + 150 173 /* Audio Master Clocks */ 151 174 static const struct clk_parent_data mst_mux_parent_data[] = { 152 175 { .fw_name = "mst_in0", }, ··· 277 254 AUD_PHASE(tdm##_name##_sclk, _reg, 1, 29, \ 278 255 aud_tdm##_name##_sclk_post_en, \ 279 256 CLK_DUTY_CYCLE_PARENT | CLK_SET_RATE_PARENT) 257 + #define AUD_TDM_SCLK_WS(_name, _reg) \ 258 + AUD_SCLK_WS(tdm##_name##_sclk, _reg, 1, 29, 28, \ 259 + aud_tdm##_name##_sclk_post_en, \ 260 + CLK_DUTY_CYCLE_PARENT | CLK_SET_RATE_PARENT) 280 261 281 262 #define AUD_TDM_LRLCK(_name, _reg) \ 282 263 AUD_MUX(tdm##_name##_lrclk, _reg, 0xf, 20, \ ··· 526 499 AUD_TDM_SCLK(in_c, AUDIO_CLK_TDMIN_C_CTRL); 527 500 static struct clk_regmap tdmin_lb_sclk = 528 501 AUD_TDM_SCLK(in_lb, AUDIO_CLK_TDMIN_LB_CTRL); 529 - static struct clk_regmap tdmout_a_sclk = 530 - AUD_TDM_SCLK(out_a, AUDIO_CLK_TDMOUT_A_CTRL); 531 - static struct clk_regmap tdmout_b_sclk = 532 - AUD_TDM_SCLK(out_b, AUDIO_CLK_TDMOUT_B_CTRL); 533 - static struct clk_regmap tdmout_c_sclk = 534 - AUD_TDM_SCLK(out_c, AUDIO_CLK_TDMOUT_C_CTRL); 535 502 536 503 static struct clk_regmap tdmin_a_lrclk = 537 504 AUD_TDM_LRLCK(in_a, AUDIO_CLK_TDMIN_A_CTRL); ··· 541 520 AUD_TDM_LRLCK(out_b, AUDIO_CLK_TDMOUT_B_CTRL); 542 521 static struct clk_regmap tdmout_c_lrclk = 543 522 AUD_TDM_LRLCK(out_c, AUDIO_CLK_TDMOUT_C_CTRL); 523 + 524 + /* AXG Clocks */ 525 + static struct clk_regmap axg_tdmout_a_sclk = 526 + AUD_TDM_SCLK(out_a, AUDIO_CLK_TDMOUT_A_CTRL); 527 + static struct clk_regmap axg_tdmout_b_sclk = 528 + AUD_TDM_SCLK(out_b, AUDIO_CLK_TDMOUT_B_CTRL); 529 + static struct clk_regmap axg_tdmout_c_sclk = 530 + AUD_TDM_SCLK(out_c, AUDIO_CLK_TDMOUT_C_CTRL); 544 531 545 532 /* AXG/G12A Clocks */ 546 533 static struct clk_hw axg_aud_top = { ··· 620 591 static struct clk_regmap g12a_tdm_sclk_pad_2 = AUD_TDM_PAD_CTRL( 621 592 sclk_pad_2, AUDIO_MST_PAD_CTRL1, 8, sclk_pad_ctrl_parent_data); 622 593 623 - /* G12a/SM1 clocks */ 594 + static struct clk_regmap g12a_tdmout_a_sclk = 595 + AUD_TDM_SCLK_WS(out_a, AUDIO_CLK_TDMOUT_A_CTRL); 596 + static struct clk_regmap g12a_tdmout_b_sclk = 597 + AUD_TDM_SCLK_WS(out_b, AUDIO_CLK_TDMOUT_B_CTRL); 598 + static struct clk_regmap g12a_tdmout_c_sclk = 599 + AUD_TDM_SCLK_WS(out_c, AUDIO_CLK_TDMOUT_C_CTRL); 600 + 624 601 static struct clk_regmap toram = 625 602 AUD_PCLK_GATE(toram, AUDIO_CLK_GATE_EN, 20); 626 603 static struct clk_regmap spdifout_b = ··· 924 889 [AUD_CLKID_TDMIN_B_SCLK] = &tdmin_b_sclk.hw, 925 890 [AUD_CLKID_TDMIN_C_SCLK] = &tdmin_c_sclk.hw, 926 891 [AUD_CLKID_TDMIN_LB_SCLK] = &tdmin_lb_sclk.hw, 927 - [AUD_CLKID_TDMOUT_A_SCLK] = &tdmout_a_sclk.hw, 928 - [AUD_CLKID_TDMOUT_B_SCLK] = &tdmout_b_sclk.hw, 929 - [AUD_CLKID_TDMOUT_C_SCLK] = &tdmout_c_sclk.hw, 892 + [AUD_CLKID_TDMOUT_A_SCLK] = &axg_tdmout_a_sclk.hw, 893 + [AUD_CLKID_TDMOUT_B_SCLK] = &axg_tdmout_b_sclk.hw, 894 + [AUD_CLKID_TDMOUT_C_SCLK] = &axg_tdmout_c_sclk.hw, 930 895 [AUD_CLKID_TDMIN_A_LRCLK] = &tdmin_a_lrclk.hw, 931 896 [AUD_CLKID_TDMIN_B_LRCLK] = &tdmin_b_lrclk.hw, 932 897 [AUD_CLKID_TDMIN_C_LRCLK] = &tdmin_c_lrclk.hw, ··· 1061 1026 [AUD_CLKID_TDMIN_B_SCLK] = &tdmin_b_sclk.hw, 1062 1027 [AUD_CLKID_TDMIN_C_SCLK] = &tdmin_c_sclk.hw, 1063 1028 [AUD_CLKID_TDMIN_LB_SCLK] = &tdmin_lb_sclk.hw, 1064 - [AUD_CLKID_TDMOUT_A_SCLK] = &tdmout_a_sclk.hw, 1065 - [AUD_CLKID_TDMOUT_B_SCLK] = &tdmout_b_sclk.hw, 1066 - [AUD_CLKID_TDMOUT_C_SCLK] = &tdmout_c_sclk.hw, 1029 + [AUD_CLKID_TDMOUT_A_SCLK] = &g12a_tdmout_a_sclk.hw, 1030 + [AUD_CLKID_TDMOUT_B_SCLK] = &g12a_tdmout_b_sclk.hw, 1031 + [AUD_CLKID_TDMOUT_C_SCLK] = &g12a_tdmout_c_sclk.hw, 1067 1032 [AUD_CLKID_TDMIN_A_LRCLK] = &tdmin_a_lrclk.hw, 1068 1033 [AUD_CLKID_TDMIN_B_LRCLK] = &tdmin_b_lrclk.hw, 1069 1034 [AUD_CLKID_TDMIN_C_LRCLK] = &tdmin_c_lrclk.hw, ··· 1205 1170 [AUD_CLKID_TDMIN_B_SCLK] = &tdmin_b_sclk.hw, 1206 1171 [AUD_CLKID_TDMIN_C_SCLK] = &tdmin_c_sclk.hw, 1207 1172 [AUD_CLKID_TDMIN_LB_SCLK] = &tdmin_lb_sclk.hw, 1208 - [AUD_CLKID_TDMOUT_A_SCLK] = &tdmout_a_sclk.hw, 1209 - [AUD_CLKID_TDMOUT_B_SCLK] = &tdmout_b_sclk.hw, 1210 - [AUD_CLKID_TDMOUT_C_SCLK] = &tdmout_c_sclk.hw, 1173 + [AUD_CLKID_TDMOUT_A_SCLK] = &g12a_tdmout_a_sclk.hw, 1174 + [AUD_CLKID_TDMOUT_B_SCLK] = &g12a_tdmout_b_sclk.hw, 1175 + [AUD_CLKID_TDMOUT_C_SCLK] = &g12a_tdmout_c_sclk.hw, 1211 1176 [AUD_CLKID_TDMIN_A_LRCLK] = &tdmin_a_lrclk.hw, 1212 1177 [AUD_CLKID_TDMIN_B_LRCLK] = &tdmin_b_lrclk.hw, 1213 1178 [AUD_CLKID_TDMIN_C_LRCLK] = &tdmin_c_lrclk.hw, ··· 1244 1209 }; 1245 1210 1246 1211 1247 - /* Convenience table to populate regmap in .probe() 1248 - * Note that this table is shared between both AXG and G12A, 1249 - * with spdifout_b clocks being exclusive to G12A. Since those 1250 - * clocks are not declared within the AXG onecell table, we do not 1251 - * feel the need to have separate AXG/G12A regmap tables. 1252 - */ 1212 + /* Convenience table to populate regmap in .probe(). */ 1253 1213 static struct clk_regmap *const axg_clk_regmaps[] = { 1214 + &ddr_arb, 1215 + &pdm, 1216 + &tdmin_a, 1217 + &tdmin_b, 1218 + &tdmin_c, 1219 + &tdmin_lb, 1220 + &tdmout_a, 1221 + &tdmout_b, 1222 + &tdmout_c, 1223 + &frddr_a, 1224 + &frddr_b, 1225 + &frddr_c, 1226 + &toddr_a, 1227 + &toddr_b, 1228 + &toddr_c, 1229 + &loopback, 1230 + &spdifin, 1231 + &spdifout, 1232 + &resample, 1233 + &power_detect, 1234 + &mst_a_mclk_sel, 1235 + &mst_b_mclk_sel, 1236 + &mst_c_mclk_sel, 1237 + &mst_d_mclk_sel, 1238 + &mst_e_mclk_sel, 1239 + &mst_f_mclk_sel, 1240 + &mst_a_mclk_div, 1241 + &mst_b_mclk_div, 1242 + &mst_c_mclk_div, 1243 + &mst_d_mclk_div, 1244 + &mst_e_mclk_div, 1245 + &mst_f_mclk_div, 1246 + &mst_a_mclk, 1247 + &mst_b_mclk, 1248 + &mst_c_mclk, 1249 + &mst_d_mclk, 1250 + &mst_e_mclk, 1251 + &mst_f_mclk, 1252 + &spdifout_clk_sel, 1253 + &spdifout_clk_div, 1254 + &spdifout_clk, 1255 + &spdifin_clk_sel, 1256 + &spdifin_clk_div, 1257 + &spdifin_clk, 1258 + &pdm_dclk_sel, 1259 + &pdm_dclk_div, 1260 + &pdm_dclk, 1261 + &pdm_sysclk_sel, 1262 + &pdm_sysclk_div, 1263 + &pdm_sysclk, 1264 + &mst_a_sclk_pre_en, 1265 + &mst_b_sclk_pre_en, 1266 + &mst_c_sclk_pre_en, 1267 + &mst_d_sclk_pre_en, 1268 + &mst_e_sclk_pre_en, 1269 + &mst_f_sclk_pre_en, 1270 + &mst_a_sclk_div, 1271 + &mst_b_sclk_div, 1272 + &mst_c_sclk_div, 1273 + &mst_d_sclk_div, 1274 + &mst_e_sclk_div, 1275 + &mst_f_sclk_div, 1276 + &mst_a_sclk_post_en, 1277 + &mst_b_sclk_post_en, 1278 + &mst_c_sclk_post_en, 1279 + &mst_d_sclk_post_en, 1280 + &mst_e_sclk_post_en, 1281 + &mst_f_sclk_post_en, 1282 + &mst_a_sclk, 1283 + &mst_b_sclk, 1284 + &mst_c_sclk, 1285 + &mst_d_sclk, 1286 + &mst_e_sclk, 1287 + &mst_f_sclk, 1288 + &mst_a_lrclk_div, 1289 + &mst_b_lrclk_div, 1290 + &mst_c_lrclk_div, 1291 + &mst_d_lrclk_div, 1292 + &mst_e_lrclk_div, 1293 + &mst_f_lrclk_div, 1294 + &mst_a_lrclk, 1295 + &mst_b_lrclk, 1296 + &mst_c_lrclk, 1297 + &mst_d_lrclk, 1298 + &mst_e_lrclk, 1299 + &mst_f_lrclk, 1300 + &tdmin_a_sclk_sel, 1301 + &tdmin_b_sclk_sel, 1302 + &tdmin_c_sclk_sel, 1303 + &tdmin_lb_sclk_sel, 1304 + &tdmout_a_sclk_sel, 1305 + &tdmout_b_sclk_sel, 1306 + &tdmout_c_sclk_sel, 1307 + &tdmin_a_sclk_pre_en, 1308 + &tdmin_b_sclk_pre_en, 1309 + &tdmin_c_sclk_pre_en, 1310 + &tdmin_lb_sclk_pre_en, 1311 + &tdmout_a_sclk_pre_en, 1312 + &tdmout_b_sclk_pre_en, 1313 + &tdmout_c_sclk_pre_en, 1314 + &tdmin_a_sclk_post_en, 1315 + &tdmin_b_sclk_post_en, 1316 + &tdmin_c_sclk_post_en, 1317 + &tdmin_lb_sclk_post_en, 1318 + &tdmout_a_sclk_post_en, 1319 + &tdmout_b_sclk_post_en, 1320 + &tdmout_c_sclk_post_en, 1321 + &tdmin_a_sclk, 1322 + &tdmin_b_sclk, 1323 + &tdmin_c_sclk, 1324 + &tdmin_lb_sclk, 1325 + &axg_tdmout_a_sclk, 1326 + &axg_tdmout_b_sclk, 1327 + &axg_tdmout_c_sclk, 1328 + &tdmin_a_lrclk, 1329 + &tdmin_b_lrclk, 1330 + &tdmin_c_lrclk, 1331 + &tdmin_lb_lrclk, 1332 + &tdmout_a_lrclk, 1333 + &tdmout_b_lrclk, 1334 + &tdmout_c_lrclk, 1335 + }; 1336 + 1337 + static struct clk_regmap *const g12a_clk_regmaps[] = { 1254 1338 &ddr_arb, 1255 1339 &pdm, 1256 1340 &tdmin_a, ··· 1482 1328 &tdmin_b_sclk, 1483 1329 &tdmin_c_sclk, 1484 1330 &tdmin_lb_sclk, 1485 - &tdmout_a_sclk, 1486 - &tdmout_b_sclk, 1487 - &tdmout_c_sclk, 1331 + &g12a_tdmout_a_sclk, 1332 + &g12a_tdmout_b_sclk, 1333 + &g12a_tdmout_c_sclk, 1488 1334 &tdmin_a_lrclk, 1489 1335 &tdmin_b_lrclk, 1490 1336 &tdmin_c_lrclk, ··· 1619 1465 &tdmin_b_sclk, 1620 1466 &tdmin_c_sclk, 1621 1467 &tdmin_lb_sclk, 1622 - &tdmout_a_sclk, 1623 - &tdmout_b_sclk, 1624 - &tdmout_c_sclk, 1468 + &g12a_tdmout_a_sclk, 1469 + &g12a_tdmout_b_sclk, 1470 + &g12a_tdmout_c_sclk, 1625 1471 &tdmin_a_lrclk, 1626 1472 &tdmin_b_lrclk, 1627 1473 &tdmin_c_lrclk, ··· 1867 1713 }; 1868 1714 1869 1715 static const struct audioclk_data g12a_audioclk_data = { 1870 - .regmap_clks = axg_clk_regmaps, 1871 - .regmap_clk_num = ARRAY_SIZE(axg_clk_regmaps), 1716 + .regmap_clks = g12a_clk_regmaps, 1717 + .regmap_clk_num = ARRAY_SIZE(g12a_clk_regmaps), 1872 1718 .hw_onecell_data = &g12a_audio_hw_onecell_data, 1873 1719 .reset_offset = AUDIO_SW_RESET, 1874 1720 .reset_num = 26,
+56
drivers/clk/meson/clk-phase.c
··· 125 125 }; 126 126 EXPORT_SYMBOL_GPL(meson_clk_triphase_ops); 127 127 128 + /* 129 + * This is a special clock for the audio controller. 130 + * This drive a bit clock inverter for which the 131 + * opposite value of the inverter bit needs to be manually 132 + * set into another bit 133 + */ 134 + static inline struct meson_sclk_ws_inv_data * 135 + meson_sclk_ws_inv_data(struct clk_regmap *clk) 136 + { 137 + return (struct meson_sclk_ws_inv_data *)clk->data; 138 + } 139 + 140 + static int meson_sclk_ws_inv_sync(struct clk_hw *hw) 141 + { 142 + struct clk_regmap *clk = to_clk_regmap(hw); 143 + struct meson_sclk_ws_inv_data *tph = meson_sclk_ws_inv_data(clk); 144 + unsigned int val; 145 + 146 + /* Get phase and sync the inverted value to ws */ 147 + val = meson_parm_read(clk->map, &tph->ph); 148 + meson_parm_write(clk->map, &tph->ws, val ? 0 : 1); 149 + 150 + return 0; 151 + } 152 + 153 + static int meson_sclk_ws_inv_get_phase(struct clk_hw *hw) 154 + { 155 + struct clk_regmap *clk = to_clk_regmap(hw); 156 + struct meson_sclk_ws_inv_data *tph = meson_sclk_ws_inv_data(clk); 157 + unsigned int val; 158 + 159 + val = meson_parm_read(clk->map, &tph->ph); 160 + 161 + return meson_clk_degrees_from_val(val, tph->ph.width); 162 + } 163 + 164 + static int meson_sclk_ws_inv_set_phase(struct clk_hw *hw, int degrees) 165 + { 166 + struct clk_regmap *clk = to_clk_regmap(hw); 167 + struct meson_sclk_ws_inv_data *tph = meson_sclk_ws_inv_data(clk); 168 + unsigned int val; 169 + 170 + val = meson_clk_degrees_to_val(degrees, tph->ph.width); 171 + meson_parm_write(clk->map, &tph->ph, val); 172 + meson_parm_write(clk->map, &tph->ws, val ? 0 : 1); 173 + return 0; 174 + } 175 + 176 + const struct clk_ops meson_sclk_ws_inv_ops = { 177 + .init = meson_sclk_ws_inv_sync, 178 + .get_phase = meson_sclk_ws_inv_get_phase, 179 + .set_phase = meson_sclk_ws_inv_set_phase, 180 + }; 181 + EXPORT_SYMBOL_GPL(meson_sclk_ws_inv_ops); 182 + 183 + 128 184 MODULE_DESCRIPTION("Amlogic phase driver"); 129 185 MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>"); 130 186 MODULE_LICENSE("GPL v2");
+6
drivers/clk/meson/clk-phase.h
··· 20 20 struct parm ph2; 21 21 }; 22 22 23 + struct meson_sclk_ws_inv_data { 24 + struct parm ph; 25 + struct parm ws; 26 + }; 27 + 23 28 extern const struct clk_ops meson_clk_phase_ops; 24 29 extern const struct clk_ops meson_clk_triphase_ops; 30 + extern const struct clk_ops meson_sclk_ws_inv_ops; 25 31 26 32 #endif /* __MESON_CLK_PHASE_H */
+11
drivers/clk/meson/g12a.c
··· 298 298 &g12a_fclk_div2_div.hw 299 299 }, 300 300 .num_parents = 1, 301 + /* 302 + * Similar to fclk_div3, it seems that this clock is used by 303 + * the resident firmware and is required by the platform to 304 + * operate correctly. 305 + * Until the following condition are met, we need this clock to 306 + * be marked as critical: 307 + * a) Mark the clock used by a firmware resource, if possible 308 + * b) CCF has a clock hand-off mechanism to make the sure the 309 + * clock stays on until the proper driver comes along 310 + */ 311 + .flags = CLK_IS_CRITICAL, 301 312 }, 302 313 }; 303 314
+1 -1
drivers/clk/meson/meson-aoclk.c
··· 57 57 rstc->data = data; 58 58 rstc->regmap = regmap; 59 59 rstc->reset.ops = &meson_aoclk_reset_ops; 60 - rstc->reset.nr_resets = data->num_reset, 60 + rstc->reset.nr_resets = data->num_reset; 61 61 rstc->reset.of_node = dev->of_node; 62 62 ret = devm_reset_controller_register(dev, &rstc->reset); 63 63 if (ret) {
+2 -2
drivers/clk/mmp/clk-of-mmp2.c
··· 347 347 }; 348 348 349 349 static struct mmp_param_div_clk apmu_div_clks[] = { 350 - {0, "disp0_div", "disp0_mux", CLK_SET_RATE_PARENT, APMU_DISP0, 8, 4, 0, &disp0_lock}, 350 + {0, "disp0_div", "disp0_mux", CLK_SET_RATE_PARENT, APMU_DISP0, 8, 4, CLK_DIVIDER_ONE_BASED, &disp0_lock}, 351 351 {0, "disp0_sphy_div", "disp0_mux", CLK_SET_RATE_PARENT, APMU_DISP0, 15, 5, 0, &disp0_lock}, 352 - {0, "disp1_div", "disp1_mux", CLK_SET_RATE_PARENT, APMU_DISP1, 8, 4, 0, &disp1_lock}, 352 + {0, "disp1_div", "disp1_mux", CLK_SET_RATE_PARENT, APMU_DISP1, 8, 4, CLK_DIVIDER_ONE_BASED, &disp1_lock}, 353 353 {0, "ccic0_sphy_div", "ccic0_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC0, 10, 5, 0, &ccic0_lock}, 354 354 {0, "ccic1_sphy_div", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 10, 5, 0, &ccic1_lock}, 355 355 };
+1 -2
drivers/clk/mmp/clk-of-pxa1928.c
··· 68 68 69 69 static void pxa1928_pll_init(struct pxa1928_clk_unit *pxa_unit) 70 70 { 71 - struct clk *clk; 72 71 struct mmp_clk_unit *unit = &pxa_unit->unit; 73 72 74 73 mmp_register_fixed_rate_clks(unit, fixed_rate_clks, ··· 76 77 mmp_register_fixed_factor_clks(unit, fixed_factor_clks, 77 78 ARRAY_SIZE(fixed_factor_clks)); 78 79 79 - clk = mmp_clk_register_factor("uart_pll", "pll1_416", 80 + mmp_clk_register_factor("uart_pll", "pll1_416", 80 81 CLK_SET_RATE_PARENT, 81 82 pxa_unit->mpmu_base + MPMU_UART_PLL, 82 83 &uart_factor_masks, uart_factor_tbl,
+1 -1
drivers/clk/mvebu/ap-cpu-clk.c
··· 197 197 198 198 stable_bit = BIT(clk->pll_regs->ratio_state_offset + 199 199 clk->cluster * 200 - clk->pll_regs->ratio_state_cluster_offset), 200 + clk->pll_regs->ratio_state_cluster_offset); 201 201 ret = regmap_read_poll_timeout(clk->pll_cr_base, 202 202 clk->pll_regs->ratio_state_reg, reg, 203 203 reg & stable_bit, STATUS_POLL_PERIOD_US,
+4 -4
drivers/clk/pxa/clk-pxa.h
··· 19 19 #define MUX_RO_RATE_RO_OPS(name, clk_name) \ 20 20 static struct clk_hw name ## _mux_hw; \ 21 21 static struct clk_hw name ## _rate_hw; \ 22 - static struct clk_ops name ## _mux_ops = { \ 22 + static const struct clk_ops name ## _mux_ops = { \ 23 23 .get_parent = name ## _get_parent, \ 24 24 .set_parent = dummy_clk_set_parent, \ 25 25 }; \ 26 - static struct clk_ops name ## _rate_ops = { \ 26 + static const struct clk_ops name ## _rate_ops = { \ 27 27 .recalc_rate = name ## _get_rate, \ 28 28 }; \ 29 29 static struct clk * __init clk_register_ ## name(void) \ ··· 38 38 39 39 #define RATE_RO_OPS(name, clk_name) \ 40 40 static struct clk_hw name ## _rate_hw; \ 41 - static const struct clk_ops name ## _rate_ops = { \ 41 + static const struct clk_ops name ## _rate_ops = { \ 42 42 .recalc_rate = name ## _get_rate, \ 43 43 }; \ 44 44 static struct clk * __init clk_register_ ## name(void) \ ··· 53 53 54 54 #define RATE_OPS(name, clk_name) \ 55 55 static struct clk_hw name ## _rate_hw; \ 56 - static struct clk_ops name ## _rate_ops = { \ 56 + static const struct clk_ops name ## _rate_ops = { \ 57 57 .recalc_rate = name ## _get_rate, \ 58 58 .set_rate = name ## _set_rate, \ 59 59 .determine_rate = name ## _determine_rate, \
+27
drivers/clk/qcom/Kconfig
··· 413 413 Say Y if you want to use the LPASS branch clocks of the LPASS clock 414 414 controller to reset the LPASS subsystem. 415 415 416 + config SM_DISPCC_8250 417 + tristate "SM8150 and SM8250 Display Clock Controller" 418 + depends on SM_GCC_8150 || SM_GCC_8250 419 + help 420 + Support for the display clock controller on Qualcomm Technologies, Inc 421 + SM8150 and SM8250 devices. 422 + Say Y if you want to support display devices and functionality such as 423 + splash screen. 424 + 416 425 config SM_GCC_8150 417 426 tristate "SM8150 Global Clock Controller" 418 427 help ··· 452 443 Support for the graphics clock controller on SM8250 devices. 453 444 Say Y if you want to support graphics controller devices and 454 445 functionality such as 3D graphics. 446 + 447 + config SM_VIDEOCC_8150 448 + tristate "SM8150 Video Clock Controller" 449 + select SDM_GCC_8150 450 + select QCOM_GDSC 451 + help 452 + Support for the video clock controller on SM8150 devices. 453 + Say Y if you want to support video devices and functionality such as 454 + video encode and decode. 455 + 456 + config SM_VIDEOCC_8250 457 + tristate "SM8250 Video Clock Controller" 458 + select SDM_GCC_8250 459 + select QCOM_GDSC 460 + help 461 + Support for the video clock controller on SM8250 devices. 462 + Say Y if you want to support video devices and functionality such as 463 + video encode and decode. 455 464 456 465 config SPMI_PMIC_CLKDIV 457 466 tristate "SPMI PMIC clkdiv Support"
+3
drivers/clk/qcom/Makefile
··· 64 64 obj-$(CONFIG_SDM_GPUCC_845) += gpucc-sdm845.o 65 65 obj-$(CONFIG_SDM_LPASSCC_845) += lpasscc-sdm845.o 66 66 obj-$(CONFIG_SDM_VIDEOCC_845) += videocc-sdm845.o 67 + obj-$(CONFIG_SM_DISPCC_8250) += dispcc-sm8250.o 67 68 obj-$(CONFIG_SM_GCC_8150) += gcc-sm8150.o 68 69 obj-$(CONFIG_SM_GCC_8250) += gcc-sm8250.o 69 70 obj-$(CONFIG_SM_GPUCC_8150) += gpucc-sm8150.o 70 71 obj-$(CONFIG_SM_GPUCC_8250) += gpucc-sm8250.o 72 + obj-$(CONFIG_SM_VIDEOCC_8150) += videocc-sm8150.o 73 + obj-$(CONFIG_SM_VIDEOCC_8250) += videocc-sm8250.o 71 74 obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o 72 75 obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o 73 76 obj-$(CONFIG_QCOM_HFPLL) += hfpll.o
+5 -5
drivers/clk/qcom/clk-alpha-pll.c
··· 609 609 alpha_huayra_pll_calc_rate(u64 prate, u32 l, u32 a) 610 610 { 611 611 /* 612 - * a contains 16 bit alpha_val in two’s compliment number in the range 612 + * a contains 16 bit alpha_val in two’s complement number in the range 613 613 * of [-0.5, 0.5). 614 614 */ 615 615 if (a >= BIT(PLL_HUAYRA_ALPHA_WIDTH - 1)) ··· 641 641 quotient++; 642 642 643 643 /* 644 - * alpha_val should be in two’s compliment number in the range 644 + * alpha_val should be in two’s complement number in the range 645 645 * of [-0.5, 0.5) so if quotient >= 0.5 then increment the l value 646 646 * since alpha value will be subtracted in this case. 647 647 */ ··· 666 666 regmap_read(pll->clkr.regmap, PLL_ALPHA_VAL(pll), &alpha); 667 667 /* 668 668 * Depending upon alpha_mode, it can be treated as M/N value or 669 - * as a two’s compliment number. When alpha_mode=1, 669 + * as a two’s complement number. When alpha_mode=1, 670 670 * pll_alpha_val<15:8>=M and pll_apla_val<7:0>=N 671 671 * 672 672 * Fout=FIN*(L+(M/N)) ··· 674 674 * M is a signed number (-128 to 127) and N is unsigned 675 675 * (0 to 255). M/N has to be within +/-0.5. 676 676 * 677 - * When alpha_mode=0, it is a two’s compliment number in the 677 + * When alpha_mode=0, it is a two’s complement number in the 678 678 * range [-0.5, 0.5). 679 679 * 680 680 * Fout=FIN*(L+(alpha_val)/2^16) 681 681 * 682 - * where alpha_val is two’s compliment number. 682 + * where alpha_val is two’s complement number. 683 683 */ 684 684 if (!(ctl & PLL_ALPHA_MODE)) 685 685 return alpha_huayra_pll_calc_rate(rate, l, alpha);
+13 -6
drivers/clk/qcom/clk-rcg2.c
··· 1182 1182 static int clk_rcg2_dp_determine_rate(struct clk_hw *hw, 1183 1183 struct clk_rate_request *req) 1184 1184 { 1185 - struct clk_rate_request parent_req = *req; 1186 - int ret; 1185 + struct clk_rcg2 *rcg = to_clk_rcg2(hw); 1186 + unsigned long num, den; 1187 + u64 tmp; 1187 1188 1188 - ret = __clk_determine_rate(clk_hw_get_parent(hw), &parent_req); 1189 - if (ret) 1190 - return ret; 1189 + /* Parent rate is a fixed phy link rate */ 1190 + rational_best_approximation(req->best_parent_rate, req->rate, 1191 + GENMASK(rcg->mnd_width - 1, 0), 1192 + GENMASK(rcg->mnd_width - 1, 0), &den, &num); 1191 1193 1192 - req->best_parent_rate = parent_req.rate; 1194 + if (!num || !den) 1195 + return -EINVAL; 1196 + 1197 + tmp = req->best_parent_rate * num; 1198 + do_div(tmp, den); 1199 + req->rate = tmp; 1193 1200 1194 1201 return 0; 1195 1202 }
-3
drivers/clk/qcom/dispcc-sc7180.c
··· 202 202 .name = "disp_cc_mdss_dp_crypto_clk_src", 203 203 .parent_data = disp_cc_parent_data_1, 204 204 .num_parents = ARRAY_SIZE(disp_cc_parent_data_1), 205 - .flags = CLK_SET_RATE_PARENT, 206 205 .ops = &clk_byte2_ops, 207 206 }, 208 207 }; ··· 215 216 .name = "disp_cc_mdss_dp_link_clk_src", 216 217 .parent_data = disp_cc_parent_data_1, 217 218 .num_parents = ARRAY_SIZE(disp_cc_parent_data_1), 218 - .flags = CLK_SET_RATE_PARENT, 219 219 .ops = &clk_byte2_ops, 220 220 }, 221 221 }; ··· 228 230 .name = "disp_cc_mdss_dp_pixel_clk_src", 229 231 .parent_data = disp_cc_parent_data_1, 230 232 .num_parents = ARRAY_SIZE(disp_cc_parent_data_1), 231 - .flags = CLK_SET_RATE_PARENT, 232 233 .ops = &clk_dp_ops, 233 234 }, 234 235 };
+1107
drivers/clk/qcom/dispcc-sm8250.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. 4 + */ 5 + 6 + #include <linux/clk-provider.h> 7 + #include <linux/module.h> 8 + #include <linux/platform_device.h> 9 + #include <linux/regmap.h> 10 + #include <linux/reset-controller.h> 11 + 12 + #include <dt-bindings/clock/qcom,dispcc-sm8250.h> 13 + 14 + #include "clk-alpha-pll.h" 15 + #include "clk-branch.h" 16 + #include "clk-rcg.h" 17 + #include "clk-regmap-divider.h" 18 + #include "common.h" 19 + #include "gdsc.h" 20 + #include "reset.h" 21 + 22 + enum { 23 + P_BI_TCXO, 24 + P_CHIP_SLEEP_CLK, 25 + P_CORE_BI_PLL_TEST_SE, 26 + P_DISP_CC_PLL0_OUT_MAIN, 27 + P_DISP_CC_PLL1_OUT_EVEN, 28 + P_DISP_CC_PLL1_OUT_MAIN, 29 + P_DP_PHY_PLL_LINK_CLK, 30 + P_DP_PHY_PLL_VCO_DIV_CLK, 31 + P_DPTX1_PHY_PLL_LINK_CLK, 32 + P_DPTX1_PHY_PLL_VCO_DIV_CLK, 33 + P_DPTX2_PHY_PLL_LINK_CLK, 34 + P_DPTX2_PHY_PLL_VCO_DIV_CLK, 35 + P_DSI0_PHY_PLL_OUT_BYTECLK, 36 + P_DSI0_PHY_PLL_OUT_DSICLK, 37 + P_DSI1_PHY_PLL_OUT_BYTECLK, 38 + P_DSI1_PHY_PLL_OUT_DSICLK, 39 + P_EDP_PHY_PLL_LINK_CLK, 40 + P_EDP_PHY_PLL_VCO_DIV_CLK, 41 + }; 42 + 43 + static struct pll_vco vco_table[] = { 44 + { 249600000, 2000000000, 0 }, 45 + }; 46 + 47 + static struct alpha_pll_config disp_cc_pll0_config = { 48 + .l = 0x47, 49 + .alpha = 0xE000, 50 + .config_ctl_val = 0x20485699, 51 + .config_ctl_hi_val = 0x00002261, 52 + .config_ctl_hi1_val = 0x329A699C, 53 + .user_ctl_val = 0x00000000, 54 + .user_ctl_hi_val = 0x00000805, 55 + .user_ctl_hi1_val = 0x00000000, 56 + }; 57 + 58 + static struct clk_init_data disp_cc_pll0_init = { 59 + .name = "disp_cc_pll0", 60 + .parent_data = &(const struct clk_parent_data){ 61 + .fw_name = "bi_tcxo", 62 + }, 63 + .num_parents = 1, 64 + .ops = &clk_alpha_pll_lucid_ops, 65 + }; 66 + 67 + static struct clk_alpha_pll disp_cc_pll0 = { 68 + .offset = 0x0, 69 + .vco_table = vco_table, 70 + .num_vco = ARRAY_SIZE(vco_table), 71 + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID], 72 + .clkr.hw.init = &disp_cc_pll0_init 73 + }; 74 + 75 + static struct alpha_pll_config disp_cc_pll1_config = { 76 + .l = 0x1F, 77 + .alpha = 0x4000, 78 + .config_ctl_val = 0x20485699, 79 + .config_ctl_hi_val = 0x00002261, 80 + .config_ctl_hi1_val = 0x329A699C, 81 + .user_ctl_val = 0x00000000, 82 + .user_ctl_hi_val = 0x00000805, 83 + .user_ctl_hi1_val = 0x00000000, 84 + }; 85 + 86 + static struct clk_init_data disp_cc_pll1_init = { 87 + .name = "disp_cc_pll1", 88 + .parent_data = &(const struct clk_parent_data){ 89 + .fw_name = "bi_tcxo", 90 + }, 91 + .num_parents = 1, 92 + .ops = &clk_alpha_pll_lucid_ops, 93 + }; 94 + 95 + static struct clk_alpha_pll disp_cc_pll1 = { 96 + .offset = 0x1000, 97 + .vco_table = vco_table, 98 + .num_vco = ARRAY_SIZE(vco_table), 99 + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID], 100 + .clkr.hw.init = &disp_cc_pll1_init 101 + }; 102 + 103 + static const struct parent_map disp_cc_parent_map_0[] = { 104 + { P_BI_TCXO, 0 }, 105 + { P_DP_PHY_PLL_LINK_CLK, 1 }, 106 + { P_DP_PHY_PLL_VCO_DIV_CLK, 2 }, 107 + }; 108 + 109 + static const struct clk_parent_data disp_cc_parent_data_0[] = { 110 + { .fw_name = "bi_tcxo" }, 111 + { .fw_name = "dp_phy_pll_link_clk" }, 112 + { .fw_name = "dp_phy_pll_vco_div_clk" }, 113 + }; 114 + 115 + static const struct parent_map disp_cc_parent_map_1[] = { 116 + { P_BI_TCXO, 0 }, 117 + }; 118 + 119 + static const struct clk_parent_data disp_cc_parent_data_1[] = { 120 + { .fw_name = "bi_tcxo" }, 121 + }; 122 + 123 + static const struct parent_map disp_cc_parent_map_2[] = { 124 + { P_BI_TCXO, 0 }, 125 + { P_DSI0_PHY_PLL_OUT_BYTECLK, 1 }, 126 + { P_DSI1_PHY_PLL_OUT_BYTECLK, 2 }, 127 + }; 128 + 129 + static const struct clk_parent_data disp_cc_parent_data_2[] = { 130 + { .fw_name = "bi_tcxo" }, 131 + { .fw_name = "dsi0_phy_pll_out_byteclk" }, 132 + { .fw_name = "dsi1_phy_pll_out_byteclk" }, 133 + }; 134 + 135 + static const struct parent_map disp_cc_parent_map_3[] = { 136 + { P_BI_TCXO, 0 }, 137 + { P_DISP_CC_PLL1_OUT_MAIN, 4 }, 138 + }; 139 + 140 + static const struct clk_parent_data disp_cc_parent_data_3[] = { 141 + { .fw_name = "bi_tcxo" }, 142 + { .hw = &disp_cc_pll1.clkr.hw }, 143 + }; 144 + 145 + static const struct parent_map disp_cc_parent_map_5[] = { 146 + { P_BI_TCXO, 0 }, 147 + { P_DISP_CC_PLL0_OUT_MAIN, 1 }, 148 + { P_DISP_CC_PLL1_OUT_MAIN, 4 }, 149 + }; 150 + 151 + static const struct clk_parent_data disp_cc_parent_data_5[] = { 152 + { .fw_name = "bi_tcxo" }, 153 + { .hw = &disp_cc_pll0.clkr.hw }, 154 + { .hw = &disp_cc_pll1.clkr.hw }, 155 + }; 156 + 157 + static const struct parent_map disp_cc_parent_map_6[] = { 158 + { P_BI_TCXO, 0 }, 159 + { P_DSI0_PHY_PLL_OUT_DSICLK, 1 }, 160 + { P_DSI1_PHY_PLL_OUT_DSICLK, 2 }, 161 + }; 162 + 163 + static const struct clk_parent_data disp_cc_parent_data_6[] = { 164 + { .fw_name = "bi_tcxo" }, 165 + { .fw_name = "dsi0_phy_pll_out_dsiclk" }, 166 + { .fw_name = "dsi1_phy_pll_out_dsiclk" }, 167 + }; 168 + 169 + static const struct freq_tbl ftbl_disp_cc_mdss_ahb_clk_src[] = { 170 + F(19200000, P_BI_TCXO, 1, 0, 0), 171 + F(37500000, P_DISP_CC_PLL1_OUT_MAIN, 16, 0, 0), 172 + F(75000000, P_DISP_CC_PLL1_OUT_MAIN, 8, 0, 0), 173 + { } 174 + }; 175 + 176 + static struct clk_rcg2 disp_cc_mdss_ahb_clk_src = { 177 + .cmd_rcgr = 0x22bc, 178 + .mnd_width = 0, 179 + .hid_width = 5, 180 + .parent_map = disp_cc_parent_map_3, 181 + .freq_tbl = ftbl_disp_cc_mdss_ahb_clk_src, 182 + .clkr.hw.init = &(struct clk_init_data){ 183 + .name = "disp_cc_mdss_ahb_clk_src", 184 + .parent_data = disp_cc_parent_data_3, 185 + .num_parents = ARRAY_SIZE(disp_cc_parent_data_3), 186 + .flags = CLK_SET_RATE_PARENT, 187 + .ops = &clk_rcg2_shared_ops, 188 + }, 189 + }; 190 + 191 + static const struct freq_tbl ftbl_disp_cc_mdss_byte0_clk_src[] = { 192 + F(19200000, P_BI_TCXO, 1, 0, 0), 193 + { } 194 + }; 195 + 196 + static struct clk_rcg2 disp_cc_mdss_byte0_clk_src = { 197 + .cmd_rcgr = 0x2110, 198 + .mnd_width = 0, 199 + .hid_width = 5, 200 + .parent_map = disp_cc_parent_map_2, 201 + .clkr.hw.init = &(struct clk_init_data){ 202 + .name = "disp_cc_mdss_byte0_clk_src", 203 + .parent_data = disp_cc_parent_data_2, 204 + .num_parents = ARRAY_SIZE(disp_cc_parent_data_2), 205 + .flags = CLK_SET_RATE_PARENT, 206 + .ops = &clk_byte2_ops, 207 + }, 208 + }; 209 + 210 + static struct clk_rcg2 disp_cc_mdss_byte1_clk_src = { 211 + .cmd_rcgr = 0x212c, 212 + .mnd_width = 0, 213 + .hid_width = 5, 214 + .parent_map = disp_cc_parent_map_2, 215 + .clkr.hw.init = &(struct clk_init_data){ 216 + .name = "disp_cc_mdss_byte1_clk_src", 217 + .parent_data = disp_cc_parent_data_2, 218 + .num_parents = ARRAY_SIZE(disp_cc_parent_data_2), 219 + .flags = CLK_SET_RATE_PARENT, 220 + .ops = &clk_byte2_ops, 221 + }, 222 + }; 223 + 224 + static struct clk_rcg2 disp_cc_mdss_dp_aux1_clk_src = { 225 + .cmd_rcgr = 0x2240, 226 + .mnd_width = 0, 227 + .hid_width = 5, 228 + .parent_map = disp_cc_parent_map_1, 229 + .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src, 230 + .clkr.hw.init = &(struct clk_init_data){ 231 + .name = "disp_cc_mdss_dp_aux1_clk_src", 232 + .parent_data = disp_cc_parent_data_1, 233 + .num_parents = ARRAY_SIZE(disp_cc_parent_data_1), 234 + .flags = CLK_SET_RATE_PARENT, 235 + .ops = &clk_rcg2_ops, 236 + }, 237 + }; 238 + 239 + static struct clk_rcg2 disp_cc_mdss_dp_aux_clk_src = { 240 + .cmd_rcgr = 0x21dc, 241 + .mnd_width = 0, 242 + .hid_width = 5, 243 + .parent_map = disp_cc_parent_map_1, 244 + .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src, 245 + .clkr.hw.init = &(struct clk_init_data){ 246 + .name = "disp_cc_mdss_dp_aux_clk_src", 247 + .parent_data = disp_cc_parent_data_1, 248 + .num_parents = ARRAY_SIZE(disp_cc_parent_data_1), 249 + .flags = CLK_SET_RATE_PARENT, 250 + .ops = &clk_rcg2_ops, 251 + }, 252 + }; 253 + 254 + static const struct freq_tbl ftbl_disp_cc_mdss_dp_link1_clk_src[] = { 255 + F(162000000, P_DP_PHY_PLL_LINK_CLK, 1, 0, 0), 256 + F(270000000, P_DP_PHY_PLL_LINK_CLK, 1, 0, 0), 257 + F(540000000, P_DP_PHY_PLL_LINK_CLK, 1, 0, 0), 258 + F(810000000, P_DP_PHY_PLL_LINK_CLK, 1, 0, 0), 259 + { } 260 + }; 261 + 262 + static struct clk_rcg2 disp_cc_mdss_dp_link1_clk_src = { 263 + .cmd_rcgr = 0x220c, 264 + .mnd_width = 0, 265 + .hid_width = 5, 266 + .parent_map = disp_cc_parent_map_0, 267 + .freq_tbl = ftbl_disp_cc_mdss_dp_link1_clk_src, 268 + .clkr.hw.init = &(struct clk_init_data){ 269 + .name = "disp_cc_mdss_dp_link1_clk_src", 270 + .parent_data = disp_cc_parent_data_0, 271 + .num_parents = ARRAY_SIZE(disp_cc_parent_data_0), 272 + .ops = &clk_rcg2_ops, 273 + }, 274 + }; 275 + 276 + static struct clk_rcg2 disp_cc_mdss_dp_link_clk_src = { 277 + .cmd_rcgr = 0x2178, 278 + .mnd_width = 0, 279 + .hid_width = 5, 280 + .parent_map = disp_cc_parent_map_0, 281 + .freq_tbl = ftbl_disp_cc_mdss_dp_link1_clk_src, 282 + .clkr.hw.init = &(struct clk_init_data){ 283 + .name = "disp_cc_mdss_dp_link_clk_src", 284 + .parent_data = disp_cc_parent_data_0, 285 + .num_parents = ARRAY_SIZE(disp_cc_parent_data_0), 286 + .ops = &clk_rcg2_ops, 287 + }, 288 + }; 289 + 290 + static struct clk_rcg2 disp_cc_mdss_dp_pixel1_clk_src = { 291 + .cmd_rcgr = 0x21c4, 292 + .mnd_width = 16, 293 + .hid_width = 5, 294 + .parent_map = disp_cc_parent_map_0, 295 + .clkr.hw.init = &(struct clk_init_data){ 296 + .name = "disp_cc_mdss_dp_pixel1_clk_src", 297 + .parent_data = disp_cc_parent_data_0, 298 + .num_parents = ARRAY_SIZE(disp_cc_parent_data_0), 299 + .ops = &clk_dp_ops, 300 + }, 301 + }; 302 + 303 + static struct clk_rcg2 disp_cc_mdss_dp_pixel2_clk_src = { 304 + .cmd_rcgr = 0x21f4, 305 + .mnd_width = 16, 306 + .hid_width = 5, 307 + .parent_map = disp_cc_parent_map_0, 308 + .clkr.hw.init = &(struct clk_init_data){ 309 + .name = "disp_cc_mdss_dp_pixel2_clk_src", 310 + .parent_data = disp_cc_parent_data_0, 311 + .num_parents = ARRAY_SIZE(disp_cc_parent_data_0), 312 + .ops = &clk_dp_ops, 313 + }, 314 + }; 315 + 316 + static struct clk_rcg2 disp_cc_mdss_dp_pixel_clk_src = { 317 + .cmd_rcgr = 0x21ac, 318 + .mnd_width = 16, 319 + .hid_width = 5, 320 + .parent_map = disp_cc_parent_map_0, 321 + .clkr.hw.init = &(struct clk_init_data){ 322 + .name = "disp_cc_mdss_dp_pixel_clk_src", 323 + .parent_data = disp_cc_parent_data_0, 324 + .num_parents = ARRAY_SIZE(disp_cc_parent_data_0), 325 + .ops = &clk_dp_ops, 326 + }, 327 + }; 328 + 329 + static struct clk_rcg2 disp_cc_mdss_esc0_clk_src = { 330 + .cmd_rcgr = 0x2148, 331 + .mnd_width = 0, 332 + .hid_width = 5, 333 + .parent_map = disp_cc_parent_map_2, 334 + .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src, 335 + .clkr.hw.init = &(struct clk_init_data){ 336 + .name = "disp_cc_mdss_esc0_clk_src", 337 + .parent_data = disp_cc_parent_data_2, 338 + .num_parents = ARRAY_SIZE(disp_cc_parent_data_2), 339 + .flags = CLK_SET_RATE_PARENT, 340 + .ops = &clk_rcg2_ops, 341 + }, 342 + }; 343 + 344 + static struct clk_rcg2 disp_cc_mdss_esc1_clk_src = { 345 + .cmd_rcgr = 0x2160, 346 + .mnd_width = 0, 347 + .hid_width = 5, 348 + .parent_map = disp_cc_parent_map_2, 349 + .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src, 350 + .clkr.hw.init = &(struct clk_init_data){ 351 + .name = "disp_cc_mdss_esc1_clk_src", 352 + .parent_data = disp_cc_parent_data_2, 353 + .num_parents = ARRAY_SIZE(disp_cc_parent_data_2), 354 + .flags = CLK_SET_RATE_PARENT, 355 + .ops = &clk_rcg2_ops, 356 + }, 357 + }; 358 + 359 + static const struct freq_tbl ftbl_disp_cc_mdss_mdp_clk_src[] = { 360 + F(19200000, P_BI_TCXO, 1, 0, 0), 361 + F(85714286, P_DISP_CC_PLL1_OUT_MAIN, 7, 0, 0), 362 + F(100000000, P_DISP_CC_PLL1_OUT_MAIN, 6, 0, 0), 363 + F(150000000, P_DISP_CC_PLL1_OUT_MAIN, 4, 0, 0), 364 + F(200000000, P_DISP_CC_PLL1_OUT_MAIN, 3, 0, 0), 365 + F(300000000, P_DISP_CC_PLL1_OUT_MAIN, 2, 0, 0), 366 + F(345000000, P_DISP_CC_PLL0_OUT_MAIN, 4, 0, 0), 367 + F(460000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0), 368 + { } 369 + }; 370 + 371 + static struct clk_rcg2 disp_cc_mdss_mdp_clk_src = { 372 + .cmd_rcgr = 0x20c8, 373 + .mnd_width = 0, 374 + .hid_width = 5, 375 + .parent_map = disp_cc_parent_map_5, 376 + .freq_tbl = ftbl_disp_cc_mdss_mdp_clk_src, 377 + .clkr.hw.init = &(struct clk_init_data){ 378 + .name = "disp_cc_mdss_mdp_clk_src", 379 + .parent_data = disp_cc_parent_data_5, 380 + .num_parents = ARRAY_SIZE(disp_cc_parent_data_5), 381 + .flags = CLK_SET_RATE_PARENT, 382 + .ops = &clk_rcg2_shared_ops, 383 + }, 384 + }; 385 + 386 + static struct clk_rcg2 disp_cc_mdss_pclk0_clk_src = { 387 + .cmd_rcgr = 0x2098, 388 + .mnd_width = 8, 389 + .hid_width = 5, 390 + .parent_map = disp_cc_parent_map_6, 391 + .clkr.hw.init = &(struct clk_init_data){ 392 + .name = "disp_cc_mdss_pclk0_clk_src", 393 + .parent_data = disp_cc_parent_data_6, 394 + .num_parents = ARRAY_SIZE(disp_cc_parent_data_6), 395 + .flags = CLK_SET_RATE_PARENT, 396 + .ops = &clk_pixel_ops, 397 + }, 398 + }; 399 + 400 + static struct clk_rcg2 disp_cc_mdss_pclk1_clk_src = { 401 + .cmd_rcgr = 0x20b0, 402 + .mnd_width = 8, 403 + .hid_width = 5, 404 + .parent_map = disp_cc_parent_map_6, 405 + .clkr.hw.init = &(struct clk_init_data){ 406 + .name = "disp_cc_mdss_pclk1_clk_src", 407 + .parent_data = disp_cc_parent_data_6, 408 + .num_parents = ARRAY_SIZE(disp_cc_parent_data_6), 409 + .flags = CLK_SET_RATE_PARENT, 410 + .ops = &clk_pixel_ops, 411 + }, 412 + }; 413 + 414 + static const struct freq_tbl ftbl_disp_cc_mdss_rot_clk_src[] = { 415 + F(19200000, P_BI_TCXO, 1, 0, 0), 416 + F(200000000, P_DISP_CC_PLL1_OUT_MAIN, 3, 0, 0), 417 + F(300000000, P_DISP_CC_PLL1_OUT_MAIN, 2, 0, 0), 418 + F(345000000, P_DISP_CC_PLL0_OUT_MAIN, 4, 0, 0), 419 + F(460000000, P_DISP_CC_PLL0_OUT_MAIN, 3, 0, 0), 420 + { } 421 + }; 422 + 423 + static struct clk_rcg2 disp_cc_mdss_rot_clk_src = { 424 + .cmd_rcgr = 0x20e0, 425 + .mnd_width = 0, 426 + .hid_width = 5, 427 + .parent_map = disp_cc_parent_map_5, 428 + .freq_tbl = ftbl_disp_cc_mdss_rot_clk_src, 429 + .clkr.hw.init = &(struct clk_init_data){ 430 + .name = "disp_cc_mdss_rot_clk_src", 431 + .parent_data = disp_cc_parent_data_5, 432 + .num_parents = ARRAY_SIZE(disp_cc_parent_data_5), 433 + .flags = CLK_SET_RATE_PARENT, 434 + .ops = &clk_rcg2_shared_ops, 435 + }, 436 + }; 437 + 438 + static struct clk_rcg2 disp_cc_mdss_vsync_clk_src = { 439 + .cmd_rcgr = 0x20f8, 440 + .mnd_width = 0, 441 + .hid_width = 5, 442 + .parent_map = disp_cc_parent_map_1, 443 + .freq_tbl = ftbl_disp_cc_mdss_byte0_clk_src, 444 + .clkr.hw.init = &(struct clk_init_data){ 445 + .name = "disp_cc_mdss_vsync_clk_src", 446 + .parent_data = disp_cc_parent_data_1, 447 + .num_parents = ARRAY_SIZE(disp_cc_parent_data_1), 448 + .flags = CLK_SET_RATE_PARENT, 449 + .ops = &clk_rcg2_ops, 450 + }, 451 + }; 452 + 453 + static struct clk_regmap_div disp_cc_mdss_byte0_div_clk_src = { 454 + .reg = 0x2128, 455 + .shift = 0, 456 + .width = 2, 457 + .clkr.hw.init = &(struct clk_init_data) { 458 + .name = "disp_cc_mdss_byte0_div_clk_src", 459 + .parent_data = &(const struct clk_parent_data){ 460 + .hw = &disp_cc_mdss_byte0_clk_src.clkr.hw, 461 + }, 462 + .num_parents = 1, 463 + .ops = &clk_regmap_div_ops, 464 + }, 465 + }; 466 + 467 + 468 + static struct clk_regmap_div disp_cc_mdss_byte1_div_clk_src = { 469 + .reg = 0x2144, 470 + .shift = 0, 471 + .width = 2, 472 + .clkr.hw.init = &(struct clk_init_data) { 473 + .name = "disp_cc_mdss_byte1_div_clk_src", 474 + .parent_data = &(const struct clk_parent_data){ 475 + .hw = &disp_cc_mdss_byte1_clk_src.clkr.hw, 476 + }, 477 + .num_parents = 1, 478 + .ops = &clk_regmap_div_ops, 479 + }, 480 + }; 481 + 482 + 483 + static struct clk_regmap_div disp_cc_mdss_dp_link1_div_clk_src = { 484 + .reg = 0x2224, 485 + .shift = 0, 486 + .width = 2, 487 + .clkr.hw.init = &(struct clk_init_data) { 488 + .name = "disp_cc_mdss_dp_link1_div_clk_src", 489 + .parent_data = &(const struct clk_parent_data){ 490 + .hw = &disp_cc_mdss_dp_link1_clk_src.clkr.hw, 491 + }, 492 + .num_parents = 1, 493 + .ops = &clk_regmap_div_ro_ops, 494 + }, 495 + }; 496 + 497 + 498 + static struct clk_regmap_div disp_cc_mdss_dp_link_div_clk_src = { 499 + .reg = 0x2190, 500 + .shift = 0, 501 + .width = 2, 502 + .clkr.hw.init = &(struct clk_init_data) { 503 + .name = "disp_cc_mdss_dp_link_div_clk_src", 504 + .parent_data = &(const struct clk_parent_data){ 505 + .hw = &disp_cc_mdss_dp_link_clk_src.clkr.hw, 506 + }, 507 + .num_parents = 1, 508 + .ops = &clk_regmap_div_ro_ops, 509 + }, 510 + }; 511 + 512 + static struct clk_branch disp_cc_mdss_ahb_clk = { 513 + .halt_reg = 0x2080, 514 + .halt_check = BRANCH_HALT, 515 + .clkr = { 516 + .enable_reg = 0x2080, 517 + .enable_mask = BIT(0), 518 + .hw.init = &(struct clk_init_data){ 519 + .name = "disp_cc_mdss_ahb_clk", 520 + .parent_data = &(const struct clk_parent_data){ 521 + .hw = &disp_cc_mdss_ahb_clk_src.clkr.hw, 522 + }, 523 + .num_parents = 1, 524 + .flags = CLK_SET_RATE_PARENT, 525 + .ops = &clk_branch2_ops, 526 + }, 527 + }, 528 + }; 529 + 530 + static struct clk_branch disp_cc_mdss_byte0_clk = { 531 + .halt_reg = 0x2028, 532 + .halt_check = BRANCH_HALT, 533 + .clkr = { 534 + .enable_reg = 0x2028, 535 + .enable_mask = BIT(0), 536 + .hw.init = &(struct clk_init_data){ 537 + .name = "disp_cc_mdss_byte0_clk", 538 + .parent_data = &(const struct clk_parent_data){ 539 + .hw = &disp_cc_mdss_byte0_clk_src.clkr.hw, 540 + }, 541 + .num_parents = 1, 542 + .flags = CLK_SET_RATE_PARENT, 543 + .ops = &clk_branch2_ops, 544 + }, 545 + }, 546 + }; 547 + 548 + static struct clk_branch disp_cc_mdss_byte0_intf_clk = { 549 + .halt_reg = 0x202c, 550 + .halt_check = BRANCH_HALT, 551 + .clkr = { 552 + .enable_reg = 0x202c, 553 + .enable_mask = BIT(0), 554 + .hw.init = &(struct clk_init_data){ 555 + .name = "disp_cc_mdss_byte0_intf_clk", 556 + .parent_data = &(const struct clk_parent_data){ 557 + .hw = &disp_cc_mdss_byte0_div_clk_src.clkr.hw, 558 + }, 559 + .num_parents = 1, 560 + .flags = CLK_SET_RATE_PARENT, 561 + .ops = &clk_branch2_ops, 562 + }, 563 + }, 564 + }; 565 + 566 + static struct clk_branch disp_cc_mdss_byte1_clk = { 567 + .halt_reg = 0x2030, 568 + .halt_check = BRANCH_HALT, 569 + .clkr = { 570 + .enable_reg = 0x2030, 571 + .enable_mask = BIT(0), 572 + .hw.init = &(struct clk_init_data){ 573 + .name = "disp_cc_mdss_byte1_clk", 574 + .parent_data = &(const struct clk_parent_data){ 575 + .hw = &disp_cc_mdss_byte1_clk_src.clkr.hw, 576 + }, 577 + .num_parents = 1, 578 + .flags = CLK_SET_RATE_PARENT, 579 + .ops = &clk_branch2_ops, 580 + }, 581 + }, 582 + }; 583 + 584 + static struct clk_branch disp_cc_mdss_byte1_intf_clk = { 585 + .halt_reg = 0x2034, 586 + .halt_check = BRANCH_HALT, 587 + .clkr = { 588 + .enable_reg = 0x2034, 589 + .enable_mask = BIT(0), 590 + .hw.init = &(struct clk_init_data){ 591 + .name = "disp_cc_mdss_byte1_intf_clk", 592 + .parent_data = &(const struct clk_parent_data){ 593 + .hw = &disp_cc_mdss_byte1_div_clk_src.clkr.hw, 594 + }, 595 + .num_parents = 1, 596 + .flags = CLK_SET_RATE_PARENT, 597 + .ops = &clk_branch2_ops, 598 + }, 599 + }, 600 + }; 601 + 602 + static struct clk_branch disp_cc_mdss_dp_aux1_clk = { 603 + .halt_reg = 0x2068, 604 + .halt_check = BRANCH_HALT, 605 + .clkr = { 606 + .enable_reg = 0x2068, 607 + .enable_mask = BIT(0), 608 + .hw.init = &(struct clk_init_data){ 609 + .name = "disp_cc_mdss_dp_aux1_clk", 610 + .parent_data = &(const struct clk_parent_data){ 611 + .hw = &disp_cc_mdss_dp_aux1_clk_src.clkr.hw, 612 + }, 613 + .num_parents = 1, 614 + .flags = CLK_SET_RATE_PARENT, 615 + .ops = &clk_branch2_ops, 616 + }, 617 + }, 618 + }; 619 + 620 + static struct clk_branch disp_cc_mdss_dp_aux_clk = { 621 + .halt_reg = 0x2054, 622 + .halt_check = BRANCH_HALT, 623 + .clkr = { 624 + .enable_reg = 0x2054, 625 + .enable_mask = BIT(0), 626 + .hw.init = &(struct clk_init_data){ 627 + .name = "disp_cc_mdss_dp_aux_clk", 628 + .parent_data = &(const struct clk_parent_data){ 629 + .hw = &disp_cc_mdss_dp_aux_clk_src.clkr.hw, 630 + }, 631 + .num_parents = 1, 632 + .flags = CLK_SET_RATE_PARENT, 633 + .ops = &clk_branch2_ops, 634 + }, 635 + }, 636 + }; 637 + 638 + static struct clk_branch disp_cc_mdss_dp_link1_clk = { 639 + .halt_reg = 0x205c, 640 + .halt_check = BRANCH_HALT, 641 + .clkr = { 642 + .enable_reg = 0x205c, 643 + .enable_mask = BIT(0), 644 + .hw.init = &(struct clk_init_data){ 645 + .name = "disp_cc_mdss_dp_link1_clk", 646 + .parent_data = &(const struct clk_parent_data){ 647 + .hw = &disp_cc_mdss_dp_link1_clk_src.clkr.hw, 648 + }, 649 + .num_parents = 1, 650 + .flags = CLK_SET_RATE_PARENT, 651 + .ops = &clk_branch2_ops, 652 + }, 653 + }, 654 + }; 655 + 656 + static struct clk_branch disp_cc_mdss_dp_link1_intf_clk = { 657 + .halt_reg = 0x2060, 658 + .halt_check = BRANCH_HALT, 659 + .clkr = { 660 + .enable_reg = 0x2060, 661 + .enable_mask = BIT(0), 662 + .hw.init = &(struct clk_init_data){ 663 + .name = "disp_cc_mdss_dp_link1_intf_clk", 664 + .parent_data = &(const struct clk_parent_data){ 665 + .hw = &disp_cc_mdss_dp_link1_div_clk_src.clkr.hw, 666 + }, 667 + .num_parents = 1, 668 + .ops = &clk_branch2_ops, 669 + }, 670 + }, 671 + }; 672 + 673 + static struct clk_branch disp_cc_mdss_dp_link_clk = { 674 + .halt_reg = 0x2040, 675 + .halt_check = BRANCH_HALT, 676 + .clkr = { 677 + .enable_reg = 0x2040, 678 + .enable_mask = BIT(0), 679 + .hw.init = &(struct clk_init_data){ 680 + .name = "disp_cc_mdss_dp_link_clk", 681 + .parent_data = &(const struct clk_parent_data){ 682 + .hw = &disp_cc_mdss_dp_link_clk_src.clkr.hw, 683 + }, 684 + .num_parents = 1, 685 + .flags = CLK_SET_RATE_PARENT, 686 + .ops = &clk_branch2_ops, 687 + }, 688 + }, 689 + }; 690 + 691 + static struct clk_branch disp_cc_mdss_dp_link_intf_clk = { 692 + .halt_reg = 0x2044, 693 + .halt_check = BRANCH_HALT, 694 + .clkr = { 695 + .enable_reg = 0x2044, 696 + .enable_mask = BIT(0), 697 + .hw.init = &(struct clk_init_data){ 698 + .name = "disp_cc_mdss_dp_link_intf_clk", 699 + .parent_data = &(const struct clk_parent_data){ 700 + .hw = &disp_cc_mdss_dp_link_div_clk_src.clkr.hw, 701 + }, 702 + .num_parents = 1, 703 + .ops = &clk_branch2_ops, 704 + }, 705 + }, 706 + }; 707 + 708 + static struct clk_branch disp_cc_mdss_dp_pixel1_clk = { 709 + .halt_reg = 0x2050, 710 + .halt_check = BRANCH_HALT, 711 + .clkr = { 712 + .enable_reg = 0x2050, 713 + .enable_mask = BIT(0), 714 + .hw.init = &(struct clk_init_data){ 715 + .name = "disp_cc_mdss_dp_pixel1_clk", 716 + .parent_data = &(const struct clk_parent_data){ 717 + .hw = &disp_cc_mdss_dp_pixel1_clk_src.clkr.hw, 718 + }, 719 + .num_parents = 1, 720 + .flags = CLK_SET_RATE_PARENT, 721 + .ops = &clk_branch2_ops, 722 + }, 723 + }, 724 + }; 725 + 726 + static struct clk_branch disp_cc_mdss_dp_pixel2_clk = { 727 + .halt_reg = 0x2058, 728 + .halt_check = BRANCH_HALT, 729 + .clkr = { 730 + .enable_reg = 0x2058, 731 + .enable_mask = BIT(0), 732 + .hw.init = &(struct clk_init_data){ 733 + .name = "disp_cc_mdss_dp_pixel2_clk", 734 + .parent_data = &(const struct clk_parent_data){ 735 + .hw = &disp_cc_mdss_dp_pixel2_clk_src.clkr.hw, 736 + }, 737 + .num_parents = 1, 738 + .flags = CLK_SET_RATE_PARENT, 739 + .ops = &clk_branch2_ops, 740 + }, 741 + }, 742 + }; 743 + 744 + static struct clk_branch disp_cc_mdss_dp_pixel_clk = { 745 + .halt_reg = 0x204c, 746 + .halt_check = BRANCH_HALT, 747 + .clkr = { 748 + .enable_reg = 0x204c, 749 + .enable_mask = BIT(0), 750 + .hw.init = &(struct clk_init_data){ 751 + .name = "disp_cc_mdss_dp_pixel_clk", 752 + .parent_data = &(const struct clk_parent_data){ 753 + .hw = &disp_cc_mdss_dp_pixel_clk_src.clkr.hw, 754 + }, 755 + .num_parents = 1, 756 + .flags = CLK_SET_RATE_PARENT, 757 + .ops = &clk_branch2_ops, 758 + }, 759 + }, 760 + }; 761 + 762 + static struct clk_branch disp_cc_mdss_esc0_clk = { 763 + .halt_reg = 0x2038, 764 + .halt_check = BRANCH_HALT, 765 + .clkr = { 766 + .enable_reg = 0x2038, 767 + .enable_mask = BIT(0), 768 + .hw.init = &(struct clk_init_data){ 769 + .name = "disp_cc_mdss_esc0_clk", 770 + .parent_data = &(const struct clk_parent_data){ 771 + .hw = &disp_cc_mdss_esc0_clk_src.clkr.hw, 772 + }, 773 + .num_parents = 1, 774 + .flags = CLK_SET_RATE_PARENT, 775 + .ops = &clk_branch2_ops, 776 + }, 777 + }, 778 + }; 779 + 780 + static struct clk_branch disp_cc_mdss_esc1_clk = { 781 + .halt_reg = 0x203c, 782 + .halt_check = BRANCH_HALT, 783 + .clkr = { 784 + .enable_reg = 0x203c, 785 + .enable_mask = BIT(0), 786 + .hw.init = &(struct clk_init_data){ 787 + .name = "disp_cc_mdss_esc1_clk", 788 + .parent_data = &(const struct clk_parent_data){ 789 + .hw = &disp_cc_mdss_esc1_clk_src.clkr.hw, 790 + }, 791 + .num_parents = 1, 792 + .flags = CLK_SET_RATE_PARENT, 793 + .ops = &clk_branch2_ops, 794 + }, 795 + }, 796 + }; 797 + 798 + static struct clk_branch disp_cc_mdss_mdp_clk = { 799 + .halt_reg = 0x200c, 800 + .halt_check = BRANCH_HALT, 801 + .clkr = { 802 + .enable_reg = 0x200c, 803 + .enable_mask = BIT(0), 804 + .hw.init = &(struct clk_init_data){ 805 + .name = "disp_cc_mdss_mdp_clk", 806 + .parent_data = &(const struct clk_parent_data){ 807 + .hw = &disp_cc_mdss_mdp_clk_src.clkr.hw, 808 + }, 809 + .num_parents = 1, 810 + .flags = CLK_SET_RATE_PARENT, 811 + .ops = &clk_branch2_ops, 812 + }, 813 + }, 814 + }; 815 + 816 + static struct clk_branch disp_cc_mdss_mdp_lut_clk = { 817 + .halt_reg = 0x201c, 818 + .halt_check = BRANCH_VOTED, 819 + .clkr = { 820 + .enable_reg = 0x201c, 821 + .enable_mask = BIT(0), 822 + .hw.init = &(struct clk_init_data){ 823 + .name = "disp_cc_mdss_mdp_lut_clk", 824 + .parent_data = &(const struct clk_parent_data){ 825 + .hw = &disp_cc_mdss_mdp_clk_src.clkr.hw, 826 + }, 827 + .num_parents = 1, 828 + .ops = &clk_branch2_ops, 829 + }, 830 + }, 831 + }; 832 + 833 + static struct clk_branch disp_cc_mdss_non_gdsc_ahb_clk = { 834 + .halt_reg = 0x4004, 835 + .halt_check = BRANCH_VOTED, 836 + .clkr = { 837 + .enable_reg = 0x4004, 838 + .enable_mask = BIT(0), 839 + .hw.init = &(struct clk_init_data){ 840 + .name = "disp_cc_mdss_non_gdsc_ahb_clk", 841 + .parent_data = &(const struct clk_parent_data){ 842 + .hw = &disp_cc_mdss_ahb_clk_src.clkr.hw, 843 + }, 844 + .num_parents = 1, 845 + .flags = CLK_SET_RATE_PARENT, 846 + .ops = &clk_branch2_ops, 847 + }, 848 + }, 849 + }; 850 + 851 + static struct clk_branch disp_cc_mdss_pclk0_clk = { 852 + .halt_reg = 0x2004, 853 + .halt_check = BRANCH_HALT, 854 + .clkr = { 855 + .enable_reg = 0x2004, 856 + .enable_mask = BIT(0), 857 + .hw.init = &(struct clk_init_data){ 858 + .name = "disp_cc_mdss_pclk0_clk", 859 + .parent_data = &(const struct clk_parent_data){ 860 + .hw = &disp_cc_mdss_pclk0_clk_src.clkr.hw, 861 + }, 862 + .num_parents = 1, 863 + .flags = CLK_SET_RATE_PARENT, 864 + .ops = &clk_branch2_ops, 865 + }, 866 + }, 867 + }; 868 + 869 + static struct clk_branch disp_cc_mdss_pclk1_clk = { 870 + .halt_reg = 0x2008, 871 + .halt_check = BRANCH_HALT, 872 + .clkr = { 873 + .enable_reg = 0x2008, 874 + .enable_mask = BIT(0), 875 + .hw.init = &(struct clk_init_data){ 876 + .name = "disp_cc_mdss_pclk1_clk", 877 + .parent_data = &(const struct clk_parent_data){ 878 + .hw = &disp_cc_mdss_pclk1_clk_src.clkr.hw, 879 + }, 880 + .num_parents = 1, 881 + .flags = CLK_SET_RATE_PARENT, 882 + .ops = &clk_branch2_ops, 883 + }, 884 + }, 885 + }; 886 + 887 + static struct clk_branch disp_cc_mdss_rot_clk = { 888 + .halt_reg = 0x2014, 889 + .halt_check = BRANCH_HALT, 890 + .clkr = { 891 + .enable_reg = 0x2014, 892 + .enable_mask = BIT(0), 893 + .hw.init = &(struct clk_init_data){ 894 + .name = "disp_cc_mdss_rot_clk", 895 + .parent_data = &(const struct clk_parent_data){ 896 + .hw = &disp_cc_mdss_rot_clk_src.clkr.hw, 897 + }, 898 + .num_parents = 1, 899 + .flags = CLK_SET_RATE_PARENT, 900 + .ops = &clk_branch2_ops, 901 + }, 902 + }, 903 + }; 904 + 905 + static struct clk_branch disp_cc_mdss_rscc_ahb_clk = { 906 + .halt_reg = 0x400c, 907 + .halt_check = BRANCH_HALT, 908 + .clkr = { 909 + .enable_reg = 0x400c, 910 + .enable_mask = BIT(0), 911 + .hw.init = &(struct clk_init_data){ 912 + .name = "disp_cc_mdss_rscc_ahb_clk", 913 + .parent_data = &(const struct clk_parent_data){ 914 + .hw = &disp_cc_mdss_ahb_clk_src.clkr.hw, 915 + }, 916 + .num_parents = 1, 917 + .flags = CLK_SET_RATE_PARENT, 918 + .ops = &clk_branch2_ops, 919 + }, 920 + }, 921 + }; 922 + 923 + static struct clk_branch disp_cc_mdss_rscc_vsync_clk = { 924 + .halt_reg = 0x4008, 925 + .halt_check = BRANCH_HALT, 926 + .clkr = { 927 + .enable_reg = 0x4008, 928 + .enable_mask = BIT(0), 929 + .hw.init = &(struct clk_init_data){ 930 + .name = "disp_cc_mdss_rscc_vsync_clk", 931 + .parent_data = &(const struct clk_parent_data){ 932 + .hw = &disp_cc_mdss_vsync_clk_src.clkr.hw, 933 + }, 934 + .num_parents = 1, 935 + .flags = CLK_SET_RATE_PARENT, 936 + .ops = &clk_branch2_ops, 937 + }, 938 + }, 939 + }; 940 + 941 + static struct clk_branch disp_cc_mdss_vsync_clk = { 942 + .halt_reg = 0x2024, 943 + .halt_check = BRANCH_HALT, 944 + .clkr = { 945 + .enable_reg = 0x2024, 946 + .enable_mask = BIT(0), 947 + .hw.init = &(struct clk_init_data){ 948 + .name = "disp_cc_mdss_vsync_clk", 949 + .parent_data = &(const struct clk_parent_data){ 950 + .hw = &disp_cc_mdss_vsync_clk_src.clkr.hw, 951 + }, 952 + .num_parents = 1, 953 + .flags = CLK_SET_RATE_PARENT, 954 + .ops = &clk_branch2_ops, 955 + }, 956 + }, 957 + }; 958 + 959 + static struct gdsc mdss_gdsc = { 960 + .gdscr = 0x3000, 961 + .pd = { 962 + .name = "mdss_gdsc", 963 + }, 964 + .pwrsts = PWRSTS_OFF_ON, 965 + .flags = HW_CTRL, 966 + }; 967 + 968 + static struct clk_regmap *disp_cc_sm8250_clocks[] = { 969 + [DISP_CC_MDSS_AHB_CLK] = &disp_cc_mdss_ahb_clk.clkr, 970 + [DISP_CC_MDSS_AHB_CLK_SRC] = &disp_cc_mdss_ahb_clk_src.clkr, 971 + [DISP_CC_MDSS_BYTE0_CLK] = &disp_cc_mdss_byte0_clk.clkr, 972 + [DISP_CC_MDSS_BYTE0_CLK_SRC] = &disp_cc_mdss_byte0_clk_src.clkr, 973 + [DISP_CC_MDSS_BYTE0_DIV_CLK_SRC] = &disp_cc_mdss_byte0_div_clk_src.clkr, 974 + [DISP_CC_MDSS_BYTE0_INTF_CLK] = &disp_cc_mdss_byte0_intf_clk.clkr, 975 + [DISP_CC_MDSS_BYTE1_CLK] = &disp_cc_mdss_byte1_clk.clkr, 976 + [DISP_CC_MDSS_BYTE1_CLK_SRC] = &disp_cc_mdss_byte1_clk_src.clkr, 977 + [DISP_CC_MDSS_BYTE1_DIV_CLK_SRC] = &disp_cc_mdss_byte1_div_clk_src.clkr, 978 + [DISP_CC_MDSS_BYTE1_INTF_CLK] = &disp_cc_mdss_byte1_intf_clk.clkr, 979 + [DISP_CC_MDSS_DP_AUX1_CLK] = &disp_cc_mdss_dp_aux1_clk.clkr, 980 + [DISP_CC_MDSS_DP_AUX1_CLK_SRC] = &disp_cc_mdss_dp_aux1_clk_src.clkr, 981 + [DISP_CC_MDSS_DP_AUX_CLK] = &disp_cc_mdss_dp_aux_clk.clkr, 982 + [DISP_CC_MDSS_DP_AUX_CLK_SRC] = &disp_cc_mdss_dp_aux_clk_src.clkr, 983 + [DISP_CC_MDSS_DP_LINK1_CLK] = &disp_cc_mdss_dp_link1_clk.clkr, 984 + [DISP_CC_MDSS_DP_LINK1_CLK_SRC] = &disp_cc_mdss_dp_link1_clk_src.clkr, 985 + [DISP_CC_MDSS_DP_LINK1_DIV_CLK_SRC] = &disp_cc_mdss_dp_link1_div_clk_src.clkr, 986 + [DISP_CC_MDSS_DP_LINK1_INTF_CLK] = &disp_cc_mdss_dp_link1_intf_clk.clkr, 987 + [DISP_CC_MDSS_DP_LINK_CLK] = &disp_cc_mdss_dp_link_clk.clkr, 988 + [DISP_CC_MDSS_DP_LINK_CLK_SRC] = &disp_cc_mdss_dp_link_clk_src.clkr, 989 + [DISP_CC_MDSS_DP_LINK_DIV_CLK_SRC] = &disp_cc_mdss_dp_link_div_clk_src.clkr, 990 + [DISP_CC_MDSS_DP_LINK_INTF_CLK] = &disp_cc_mdss_dp_link_intf_clk.clkr, 991 + [DISP_CC_MDSS_DP_PIXEL1_CLK] = &disp_cc_mdss_dp_pixel1_clk.clkr, 992 + [DISP_CC_MDSS_DP_PIXEL1_CLK_SRC] = &disp_cc_mdss_dp_pixel1_clk_src.clkr, 993 + [DISP_CC_MDSS_DP_PIXEL2_CLK] = &disp_cc_mdss_dp_pixel2_clk.clkr, 994 + [DISP_CC_MDSS_DP_PIXEL2_CLK_SRC] = &disp_cc_mdss_dp_pixel2_clk_src.clkr, 995 + [DISP_CC_MDSS_DP_PIXEL_CLK] = &disp_cc_mdss_dp_pixel_clk.clkr, 996 + [DISP_CC_MDSS_DP_PIXEL_CLK_SRC] = &disp_cc_mdss_dp_pixel_clk_src.clkr, 997 + [DISP_CC_MDSS_ESC0_CLK] = &disp_cc_mdss_esc0_clk.clkr, 998 + [DISP_CC_MDSS_ESC0_CLK_SRC] = &disp_cc_mdss_esc0_clk_src.clkr, 999 + [DISP_CC_MDSS_ESC1_CLK] = &disp_cc_mdss_esc1_clk.clkr, 1000 + [DISP_CC_MDSS_ESC1_CLK_SRC] = &disp_cc_mdss_esc1_clk_src.clkr, 1001 + [DISP_CC_MDSS_MDP_CLK] = &disp_cc_mdss_mdp_clk.clkr, 1002 + [DISP_CC_MDSS_MDP_CLK_SRC] = &disp_cc_mdss_mdp_clk_src.clkr, 1003 + [DISP_CC_MDSS_MDP_LUT_CLK] = &disp_cc_mdss_mdp_lut_clk.clkr, 1004 + [DISP_CC_MDSS_NON_GDSC_AHB_CLK] = &disp_cc_mdss_non_gdsc_ahb_clk.clkr, 1005 + [DISP_CC_MDSS_PCLK0_CLK] = &disp_cc_mdss_pclk0_clk.clkr, 1006 + [DISP_CC_MDSS_PCLK0_CLK_SRC] = &disp_cc_mdss_pclk0_clk_src.clkr, 1007 + [DISP_CC_MDSS_PCLK1_CLK] = &disp_cc_mdss_pclk1_clk.clkr, 1008 + [DISP_CC_MDSS_PCLK1_CLK_SRC] = &disp_cc_mdss_pclk1_clk_src.clkr, 1009 + [DISP_CC_MDSS_ROT_CLK] = &disp_cc_mdss_rot_clk.clkr, 1010 + [DISP_CC_MDSS_ROT_CLK_SRC] = &disp_cc_mdss_rot_clk_src.clkr, 1011 + [DISP_CC_MDSS_RSCC_AHB_CLK] = &disp_cc_mdss_rscc_ahb_clk.clkr, 1012 + [DISP_CC_MDSS_RSCC_VSYNC_CLK] = &disp_cc_mdss_rscc_vsync_clk.clkr, 1013 + [DISP_CC_MDSS_VSYNC_CLK] = &disp_cc_mdss_vsync_clk.clkr, 1014 + [DISP_CC_MDSS_VSYNC_CLK_SRC] = &disp_cc_mdss_vsync_clk_src.clkr, 1015 + [DISP_CC_PLL0] = &disp_cc_pll0.clkr, 1016 + [DISP_CC_PLL1] = &disp_cc_pll1.clkr, 1017 + }; 1018 + 1019 + static const struct qcom_reset_map disp_cc_sm8250_resets[] = { 1020 + [DISP_CC_MDSS_CORE_BCR] = { 0x2000 }, 1021 + [DISP_CC_MDSS_RSCC_BCR] = { 0x4000 }, 1022 + }; 1023 + 1024 + static struct gdsc *disp_cc_sm8250_gdscs[] = { 1025 + [MDSS_GDSC] = &mdss_gdsc, 1026 + }; 1027 + 1028 + static const struct regmap_config disp_cc_sm8250_regmap_config = { 1029 + .reg_bits = 32, 1030 + .reg_stride = 4, 1031 + .val_bits = 32, 1032 + .max_register = 0x10000, 1033 + .fast_io = true, 1034 + }; 1035 + 1036 + static const struct qcom_cc_desc disp_cc_sm8250_desc = { 1037 + .config = &disp_cc_sm8250_regmap_config, 1038 + .clks = disp_cc_sm8250_clocks, 1039 + .num_clks = ARRAY_SIZE(disp_cc_sm8250_clocks), 1040 + .resets = disp_cc_sm8250_resets, 1041 + .num_resets = ARRAY_SIZE(disp_cc_sm8250_resets), 1042 + .gdscs = disp_cc_sm8250_gdscs, 1043 + .num_gdscs = ARRAY_SIZE(disp_cc_sm8250_gdscs), 1044 + }; 1045 + 1046 + static const struct of_device_id disp_cc_sm8250_match_table[] = { 1047 + { .compatible = "qcom,sm8150-dispcc" }, 1048 + { .compatible = "qcom,sm8250-dispcc" }, 1049 + { } 1050 + }; 1051 + MODULE_DEVICE_TABLE(of, disp_cc_sm8250_match_table); 1052 + 1053 + static int disp_cc_sm8250_probe(struct platform_device *pdev) 1054 + { 1055 + struct regmap *regmap; 1056 + 1057 + regmap = qcom_cc_map(pdev, &disp_cc_sm8250_desc); 1058 + if (IS_ERR(regmap)) 1059 + return PTR_ERR(regmap); 1060 + 1061 + /* note: trion == lucid, except for the prepare() op */ 1062 + BUILD_BUG_ON(CLK_ALPHA_PLL_TYPE_TRION != CLK_ALPHA_PLL_TYPE_LUCID); 1063 + if (of_device_is_compatible(pdev->dev.of_node, "qcom,sm8150-dispcc")) { 1064 + disp_cc_pll0_config.config_ctl_hi_val = 0x00002267; 1065 + disp_cc_pll0_config.config_ctl_hi1_val = 0x00000024; 1066 + disp_cc_pll0_config.user_ctl_hi1_val = 0x000000D0; 1067 + disp_cc_pll0_init.ops = &clk_alpha_pll_trion_ops; 1068 + disp_cc_pll1_config.config_ctl_hi_val = 0x00002267; 1069 + disp_cc_pll1_config.config_ctl_hi1_val = 0x00000024; 1070 + disp_cc_pll1_config.user_ctl_hi1_val = 0x000000D0; 1071 + disp_cc_pll1_init.ops = &clk_alpha_pll_trion_ops; 1072 + } 1073 + 1074 + clk_lucid_pll_configure(&disp_cc_pll0, regmap, &disp_cc_pll0_config); 1075 + clk_lucid_pll_configure(&disp_cc_pll1, regmap, &disp_cc_pll1_config); 1076 + 1077 + /* Enable clock gating for MDP clocks */ 1078 + regmap_update_bits(regmap, 0x8000, 0x10, 0x10); 1079 + 1080 + /* DISP_CC_XO_CLK always-on */ 1081 + regmap_update_bits(regmap, 0x605c, BIT(0), BIT(0)); 1082 + 1083 + return qcom_cc_really_probe(pdev, &disp_cc_sm8250_desc, regmap); 1084 + } 1085 + 1086 + static struct platform_driver disp_cc_sm8250_driver = { 1087 + .probe = disp_cc_sm8250_probe, 1088 + .driver = { 1089 + .name = "disp_cc-sm8250", 1090 + .of_match_table = disp_cc_sm8250_match_table, 1091 + }, 1092 + }; 1093 + 1094 + static int __init disp_cc_sm8250_init(void) 1095 + { 1096 + return platform_driver_register(&disp_cc_sm8250_driver); 1097 + } 1098 + subsys_initcall(disp_cc_sm8250_init); 1099 + 1100 + static void __exit disp_cc_sm8250_exit(void) 1101 + { 1102 + platform_driver_unregister(&disp_cc_sm8250_driver); 1103 + } 1104 + module_exit(disp_cc_sm8250_exit); 1105 + 1106 + MODULE_DESCRIPTION("QTI DISPCC SM8250 Driver"); 1107 + MODULE_LICENSE("GPL v2");
+1 -1
drivers/clk/qcom/gcc-ipq8074.c
··· 4322 4322 { } 4323 4323 }; 4324 4324 4325 - struct clk_rcg2 pcie0_rchng_clk_src = { 4325 + static struct clk_rcg2 pcie0_rchng_clk_src = { 4326 4326 .cmd_rcgr = 0x75070, 4327 4327 .freq_tbl = ftbl_pcie_rchng_clk_src, 4328 4328 .hid_width = 5,
-12
drivers/clk/qcom/gcc-msm8939.c
··· 595 595 { .fw_name = "sleep_clk", .name = "sleep_clk" }, 596 596 }; 597 597 598 - static const struct parent_map gcc_xo_gpll6_gpll0_map[] = { 599 - { P_XO, 0 }, 600 - { P_GPLL6, 1 }, 601 - { P_GPLL0, 2 }, 602 - }; 603 - 604 598 static const struct clk_parent_data gcc_xo_gpll6_gpll0_parent_data[] = { 605 599 { .fw_name = "xo" }, 606 600 { .hw = &gpll6_vote.hw }, 607 601 { .hw = &gpll0_vote.hw }, 608 - }; 609 - 610 - static const struct parent_map gcc_xo_gpll6_gpll0a_map[] = { 611 - { P_XO, 0 }, 612 - { P_GPLL6, 1 }, 613 - { P_GPLL0_AUX, 2 }, 614 602 }; 615 603 616 604 static const struct clk_parent_data gcc_xo_gpll6_gpll0a_parent_data[] = {
+390 -4
drivers/clk/qcom/gcc-msm8994.c
··· 20 20 #include "clk-rcg.h" 21 21 #include "clk-branch.h" 22 22 #include "reset.h" 23 + #include "gdsc.h" 23 24 24 25 enum { 25 26 P_XO, ··· 1773 1772 }, 1774 1773 }; 1775 1774 1775 + static struct clk_branch gcc_lpass_q6_axi_clk = { 1776 + .halt_reg = 0x0280, 1777 + .clkr = { 1778 + .enable_reg = 0x0280, 1779 + .enable_mask = BIT(0), 1780 + .hw.init = &(struct clk_init_data) 1781 + { 1782 + .name = "gcc_lpass_q6_axi_clk", 1783 + .ops = &clk_branch2_ops, 1784 + }, 1785 + }, 1786 + }; 1787 + 1788 + static struct clk_branch gcc_mss_q6_bimc_axi_clk = { 1789 + .halt_reg = 0x0284, 1790 + .clkr = { 1791 + .enable_reg = 0x0284, 1792 + .enable_mask = BIT(0), 1793 + .hw.init = &(struct clk_init_data) 1794 + { 1795 + .name = "gcc_mss_q6_bimc_axi_clk", 1796 + .ops = &clk_branch2_ops, 1797 + }, 1798 + }, 1799 + }; 1800 + 1776 1801 static struct clk_branch gcc_pcie_0_aux_clk = { 1777 1802 .halt_reg = 0x1ad4, 1778 1803 .clkr = { ··· 1812 1785 }, 1813 1786 .num_parents = 1, 1814 1787 .flags = CLK_SET_RATE_PARENT, 1788 + .ops = &clk_branch2_ops, 1789 + }, 1790 + }, 1791 + }; 1792 + 1793 + static struct clk_branch gcc_pcie_0_cfg_ahb_clk = { 1794 + .halt_reg = 0x1ad0, 1795 + .clkr = { 1796 + .enable_reg = 0x1ad0, 1797 + .enable_mask = BIT(0), 1798 + .hw.init = &(struct clk_init_data) 1799 + { 1800 + .name = "gcc_pcie_0_cfg_ahb_clk", 1801 + .ops = &clk_branch2_ops, 1802 + }, 1803 + }, 1804 + }; 1805 + 1806 + static struct clk_branch gcc_pcie_0_mstr_axi_clk = { 1807 + .halt_reg = 0x1acc, 1808 + .clkr = { 1809 + .enable_reg = 0x1acc, 1810 + .enable_mask = BIT(0), 1811 + .hw.init = &(struct clk_init_data) 1812 + { 1813 + .name = "gcc_pcie_0_mstr_axi_clk", 1815 1814 .ops = &clk_branch2_ops, 1816 1815 }, 1817 1816 }, ··· 1862 1809 }, 1863 1810 }; 1864 1811 1812 + static struct clk_branch gcc_pcie_0_slv_axi_clk = { 1813 + .halt_reg = 0x1ac8, 1814 + .halt_check = BRANCH_HALT_DELAY, 1815 + .clkr = { 1816 + .enable_reg = 0x1ac8, 1817 + .enable_mask = BIT(0), 1818 + .hw.init = &(struct clk_init_data) 1819 + { 1820 + .name = "gcc_pcie_0_slv_axi_clk", 1821 + .ops = &clk_branch2_ops, 1822 + }, 1823 + }, 1824 + }; 1825 + 1865 1826 static struct clk_branch gcc_pcie_1_aux_clk = { 1866 1827 .halt_reg = 0x1b54, 1867 1828 .clkr = { ··· 1889 1822 }, 1890 1823 .num_parents = 1, 1891 1824 .flags = CLK_SET_RATE_PARENT, 1825 + .ops = &clk_branch2_ops, 1826 + }, 1827 + }, 1828 + }; 1829 + 1830 + static struct clk_branch gcc_pcie_1_cfg_ahb_clk = { 1831 + .halt_reg = 0x1b54, 1832 + .clkr = { 1833 + .enable_reg = 0x1b54, 1834 + .enable_mask = BIT(0), 1835 + .hw.init = &(struct clk_init_data) 1836 + { 1837 + .name = "gcc_pcie_1_cfg_ahb_clk", 1838 + .ops = &clk_branch2_ops, 1839 + }, 1840 + }, 1841 + }; 1842 + 1843 + static struct clk_branch gcc_pcie_1_mstr_axi_clk = { 1844 + .halt_reg = 0x1b50, 1845 + .clkr = { 1846 + .enable_reg = 0x1b50, 1847 + .enable_mask = BIT(0), 1848 + .hw.init = &(struct clk_init_data) 1849 + { 1850 + .name = "gcc_pcie_1_mstr_axi_clk", 1892 1851 .ops = &clk_branch2_ops, 1893 1852 }, 1894 1853 }, ··· 1939 1846 }, 1940 1847 }; 1941 1848 1849 + static struct clk_branch gcc_pcie_1_slv_axi_clk = { 1850 + .halt_reg = 0x1b48, 1851 + .clkr = { 1852 + .enable_reg = 0x1b48, 1853 + .enable_mask = BIT(0), 1854 + .hw.init = &(struct clk_init_data) 1855 + { 1856 + .name = "gcc_pcie_1_slv_axi_clk", 1857 + .ops = &clk_branch2_ops, 1858 + }, 1859 + }, 1860 + }; 1861 + 1942 1862 static struct clk_branch gcc_pdm2_clk = { 1943 1863 .halt_reg = 0x0ccc, 1944 1864 .clkr = { ··· 1965 1859 }, 1966 1860 .num_parents = 1, 1967 1861 .flags = CLK_SET_RATE_PARENT, 1862 + .ops = &clk_branch2_ops, 1863 + }, 1864 + }, 1865 + }; 1866 + 1867 + static struct clk_branch gcc_pdm_ahb_clk = { 1868 + .halt_reg = 0x0cc4, 1869 + .clkr = { 1870 + .enable_reg = 0x0cc4, 1871 + .enable_mask = BIT(0), 1872 + .hw.init = &(struct clk_init_data) 1873 + { 1874 + .name = "gcc_pdm_ahb_clk", 1968 1875 .ops = &clk_branch2_ops, 1969 1876 }, 1970 1877 }, ··· 2018 1899 }, 2019 1900 }; 2020 1901 1902 + static struct clk_branch gcc_sdcc2_ahb_clk = { 1903 + .halt_reg = 0x0508, 1904 + .clkr = { 1905 + .enable_reg = 0x0508, 1906 + .enable_mask = BIT(0), 1907 + .hw.init = &(struct clk_init_data) 1908 + { 1909 + .name = "gcc_sdcc2_ahb_clk", 1910 + .parent_names = (const char *[]){ 1911 + "periph_noc_clk_src", 1912 + }, 1913 + .num_parents = 1, 1914 + .ops = &clk_branch2_ops, 1915 + }, 1916 + }, 1917 + }; 1918 + 2021 1919 static struct clk_branch gcc_sdcc2_apps_clk = { 2022 1920 .halt_reg = 0x0504, 2023 1921 .clkr = { ··· 2053 1917 }, 2054 1918 }; 2055 1919 1920 + static struct clk_branch gcc_sdcc3_ahb_clk = { 1921 + .halt_reg = 0x0548, 1922 + .clkr = { 1923 + .enable_reg = 0x0548, 1924 + .enable_mask = BIT(0), 1925 + .hw.init = &(struct clk_init_data) 1926 + { 1927 + .name = "gcc_sdcc3_ahb_clk", 1928 + .parent_names = (const char *[]){ 1929 + "periph_noc_clk_src", 1930 + }, 1931 + .num_parents = 1, 1932 + .ops = &clk_branch2_ops, 1933 + }, 1934 + }, 1935 + }; 1936 + 2056 1937 static struct clk_branch gcc_sdcc3_apps_clk = { 2057 1938 .halt_reg = 0x0544, 2058 1939 .clkr = { ··· 2083 1930 }, 2084 1931 .num_parents = 1, 2085 1932 .flags = CLK_SET_RATE_PARENT, 1933 + .ops = &clk_branch2_ops, 1934 + }, 1935 + }, 1936 + }; 1937 + 1938 + static struct clk_branch gcc_sdcc4_ahb_clk = { 1939 + .halt_reg = 0x0588, 1940 + .clkr = { 1941 + .enable_reg = 0x0588, 1942 + .enable_mask = BIT(0), 1943 + .hw.init = &(struct clk_init_data) 1944 + { 1945 + .name = "gcc_sdcc4_ahb_clk", 1946 + .parent_names = (const char *[]){ 1947 + "periph_noc_clk_src", 1948 + }, 1949 + .num_parents = 1, 2086 1950 .ops = &clk_branch2_ops, 2087 1951 }, 2088 1952 }, ··· 2159 1989 }, 2160 1990 }; 2161 1991 1992 + static struct clk_branch gcc_tsif_ahb_clk = { 1993 + .halt_reg = 0x0d84, 1994 + .clkr = { 1995 + .enable_reg = 0x0d84, 1996 + .enable_mask = BIT(0), 1997 + .hw.init = &(struct clk_init_data) 1998 + { 1999 + .name = "gcc_tsif_ahb_clk", 2000 + .ops = &clk_branch2_ops, 2001 + }, 2002 + }, 2003 + }; 2004 + 2162 2005 static struct clk_branch gcc_tsif_ref_clk = { 2163 2006 .halt_reg = 0x0d88, 2164 2007 .clkr = { ··· 2185 2002 }, 2186 2003 .num_parents = 1, 2187 2004 .flags = CLK_SET_RATE_PARENT, 2005 + .ops = &clk_branch2_ops, 2006 + }, 2007 + }, 2008 + }; 2009 + 2010 + static struct clk_branch gcc_ufs_ahb_clk = { 2011 + .halt_reg = 0x1d4c, 2012 + .clkr = { 2013 + .enable_reg = 0x1d4c, 2014 + .enable_mask = BIT(0), 2015 + .hw.init = &(struct clk_init_data) 2016 + { 2017 + .name = "gcc_ufs_ahb_clk", 2188 2018 .ops = &clk_branch2_ops, 2189 2019 }, 2190 2020 }, ··· 2239 2043 }, 2240 2044 }; 2241 2045 2046 + static struct clk_branch gcc_ufs_rx_symbol_0_clk = { 2047 + .halt_reg = 0x1d60, 2048 + .halt_check = BRANCH_HALT_DELAY, 2049 + .clkr = { 2050 + .enable_reg = 0x1d60, 2051 + .enable_mask = BIT(0), 2052 + .hw.init = &(struct clk_init_data) 2053 + { 2054 + .name = "gcc_ufs_rx_symbol_0_clk", 2055 + .ops = &clk_branch2_ops, 2056 + }, 2057 + }, 2058 + }; 2059 + 2060 + static struct clk_branch gcc_ufs_rx_symbol_1_clk = { 2061 + .halt_reg = 0x1d64, 2062 + .halt_check = BRANCH_HALT_DELAY, 2063 + .clkr = { 2064 + .enable_reg = 0x1d64, 2065 + .enable_mask = BIT(0), 2066 + .hw.init = &(struct clk_init_data) 2067 + { 2068 + .name = "gcc_ufs_rx_symbol_1_clk", 2069 + .ops = &clk_branch2_ops, 2070 + }, 2071 + }, 2072 + }; 2073 + 2242 2074 static struct clk_branch gcc_ufs_tx_cfg_clk = { 2243 2075 .halt_reg = 0x1d50, 2244 2076 .clkr = { ··· 2280 2056 }, 2281 2057 .num_parents = 1, 2282 2058 .flags = CLK_SET_RATE_PARENT, 2059 + .ops = &clk_branch2_ops, 2060 + }, 2061 + }, 2062 + }; 2063 + 2064 + static struct clk_branch gcc_ufs_tx_symbol_0_clk = { 2065 + .halt_reg = 0x1d58, 2066 + .halt_check = BRANCH_HALT_DELAY, 2067 + .clkr = { 2068 + .enable_reg = 0x1d58, 2069 + .enable_mask = BIT(0), 2070 + .hw.init = &(struct clk_init_data) 2071 + { 2072 + .name = "gcc_ufs_tx_symbol_0_clk", 2073 + .ops = &clk_branch2_ops, 2074 + }, 2075 + }, 2076 + }; 2077 + 2078 + static struct clk_branch gcc_ufs_tx_symbol_1_clk = { 2079 + .halt_reg = 0x1d5c, 2080 + .halt_check = BRANCH_HALT_DELAY, 2081 + .clkr = { 2082 + .enable_reg = 0x1d5c, 2083 + .enable_mask = BIT(0), 2084 + .hw.init = &(struct clk_init_data) 2085 + { 2086 + .name = "gcc_ufs_tx_symbol_1_clk", 2087 + .ops = &clk_branch2_ops, 2088 + }, 2089 + }, 2090 + }; 2091 + 2092 + static struct clk_branch gcc_usb2_hs_phy_sleep_clk = { 2093 + .halt_reg = 0x04ac, 2094 + .clkr = { 2095 + .enable_reg = 0x04ac, 2096 + .enable_mask = BIT(0), 2097 + .hw.init = &(struct clk_init_data) 2098 + { 2099 + .name = "gcc_usb2_hs_phy_sleep_clk", 2283 2100 .ops = &clk_branch2_ops, 2284 2101 }, 2285 2102 }, ··· 2362 2097 }, 2363 2098 }; 2364 2099 2100 + static struct clk_branch gcc_usb30_sleep_clk = { 2101 + .halt_reg = 0x03cc, 2102 + .clkr = { 2103 + .enable_reg = 0x03cc, 2104 + .enable_mask = BIT(0), 2105 + .hw.init = &(struct clk_init_data) 2106 + { 2107 + .name = "gcc_usb30_sleep_clk", 2108 + .ops = &clk_branch2_ops, 2109 + }, 2110 + }, 2111 + }; 2112 + 2365 2113 static struct clk_branch gcc_usb3_phy_aux_clk = { 2366 2114 .halt_reg = 0x1408, 2367 2115 .clkr = { ··· 2388 2110 }, 2389 2111 .num_parents = 1, 2390 2112 .flags = CLK_SET_RATE_PARENT, 2113 + .ops = &clk_branch2_ops, 2114 + }, 2115 + }, 2116 + }; 2117 + 2118 + static struct clk_branch gcc_usb_hs_ahb_clk = { 2119 + .halt_reg = 0x0488, 2120 + .clkr = { 2121 + .enable_reg = 0x0488, 2122 + .enable_mask = BIT(0), 2123 + .hw.init = &(struct clk_init_data) 2124 + { 2125 + .name = "gcc_usb_hs_ahb_clk", 2391 2126 .ops = &clk_branch2_ops, 2392 2127 }, 2393 2128 }, ··· 2422 2131 .ops = &clk_branch2_ops, 2423 2132 }, 2424 2133 }, 2134 + }; 2135 + 2136 + static struct clk_branch gcc_usb_phy_cfg_ahb2phy_clk = { 2137 + .halt_reg = 0x1a84, 2138 + .clkr = { 2139 + .enable_reg = 0x1a84, 2140 + .enable_mask = BIT(0), 2141 + .hw.init = &(struct clk_init_data) 2142 + { 2143 + .name = "gcc_usb_phy_cfg_ahb2phy_clk", 2144 + .ops = &clk_branch2_ops, 2145 + }, 2146 + }, 2147 + }; 2148 + 2149 + static struct gdsc pcie_gdsc = { 2150 + .gdscr = 0x1e18, 2151 + .pd = { 2152 + .name = "pcie", 2153 + }, 2154 + .pwrsts = PWRSTS_OFF_ON, 2155 + }; 2156 + 2157 + static struct gdsc pcie_0_gdsc = { 2158 + .gdscr = 0x1ac4, 2159 + .pd = { 2160 + .name = "pcie_0", 2161 + }, 2162 + .pwrsts = PWRSTS_OFF_ON, 2163 + }; 2164 + 2165 + static struct gdsc pcie_1_gdsc = { 2166 + .gdscr = 0x1b44, 2167 + .pd = { 2168 + .name = "pcie_1", 2169 + }, 2170 + .pwrsts = PWRSTS_OFF_ON, 2171 + }; 2172 + 2173 + static struct gdsc usb30_gdsc = { 2174 + .gdscr = 0x3c4, 2175 + .pd = { 2176 + .name = "usb30", 2177 + }, 2178 + .pwrsts = PWRSTS_OFF_ON, 2179 + }; 2180 + 2181 + static struct gdsc ufs_gdsc = { 2182 + .gdscr = 0x1d44, 2183 + .pd = { 2184 + .name = "ufs", 2185 + }, 2186 + .pwrsts = PWRSTS_OFF_ON, 2425 2187 }; 2426 2188 2427 2189 static struct clk_regmap *gcc_msm8994_clocks[] = { ··· 2577 2233 [GCC_GP1_CLK] = &gcc_gp1_clk.clkr, 2578 2234 [GCC_GP2_CLK] = &gcc_gp2_clk.clkr, 2579 2235 [GCC_GP3_CLK] = &gcc_gp3_clk.clkr, 2236 + [GCC_LPASS_Q6_AXI_CLK] = &gcc_lpass_q6_axi_clk.clkr, 2237 + [GCC_MSS_Q6_BIMC_AXI_CLK] = &gcc_mss_q6_bimc_axi_clk.clkr, 2580 2238 [GCC_PCIE_0_AUX_CLK] = &gcc_pcie_0_aux_clk.clkr, 2239 + [GCC_PCIE_0_CFG_AHB_CLK] = &gcc_pcie_0_cfg_ahb_clk.clkr, 2240 + [GCC_PCIE_0_MSTR_AXI_CLK] = &gcc_pcie_0_mstr_axi_clk.clkr, 2581 2241 [GCC_PCIE_0_PIPE_CLK] = &gcc_pcie_0_pipe_clk.clkr, 2242 + [GCC_PCIE_0_SLV_AXI_CLK] = &gcc_pcie_0_slv_axi_clk.clkr, 2582 2243 [GCC_PCIE_1_AUX_CLK] = &gcc_pcie_1_aux_clk.clkr, 2244 + [GCC_PCIE_1_CFG_AHB_CLK] = &gcc_pcie_1_cfg_ahb_clk.clkr, 2245 + [GCC_PCIE_1_MSTR_AXI_CLK] = &gcc_pcie_1_mstr_axi_clk.clkr, 2583 2246 [GCC_PCIE_1_PIPE_CLK] = &gcc_pcie_1_pipe_clk.clkr, 2247 + [GCC_PCIE_1_SLV_AXI_CLK] = &gcc_pcie_1_slv_axi_clk.clkr, 2584 2248 [GCC_PDM2_CLK] = &gcc_pdm2_clk.clkr, 2585 - [GCC_SDCC1_APPS_CLK] = &gcc_sdcc1_apps_clk.clkr, 2586 - [GCC_SDCC2_APPS_CLK] = &gcc_sdcc2_apps_clk.clkr, 2587 - [GCC_SDCC3_APPS_CLK] = &gcc_sdcc3_apps_clk.clkr, 2588 - [GCC_SDCC4_APPS_CLK] = &gcc_sdcc4_apps_clk.clkr, 2249 + [GCC_PDM_AHB_CLK] = &gcc_pdm_ahb_clk.clkr, 2589 2250 [GCC_SDCC1_AHB_CLK] = &gcc_sdcc1_ahb_clk.clkr, 2251 + [GCC_SDCC1_APPS_CLK] = &gcc_sdcc1_apps_clk.clkr, 2252 + [GCC_SDCC2_AHB_CLK] = &gcc_sdcc2_ahb_clk.clkr, 2253 + [GCC_SDCC2_APPS_CLK] = &gcc_sdcc2_apps_clk.clkr, 2254 + [GCC_SDCC3_AHB_CLK] = &gcc_sdcc3_ahb_clk.clkr, 2255 + [GCC_SDCC3_APPS_CLK] = &gcc_sdcc3_apps_clk.clkr, 2256 + [GCC_SDCC4_AHB_CLK] = &gcc_sdcc4_ahb_clk.clkr, 2257 + [GCC_SDCC4_APPS_CLK] = &gcc_sdcc4_apps_clk.clkr, 2590 2258 [GCC_SYS_NOC_UFS_AXI_CLK] = &gcc_sys_noc_ufs_axi_clk.clkr, 2591 2259 [GCC_SYS_NOC_USB3_AXI_CLK] = &gcc_sys_noc_usb3_axi_clk.clkr, 2260 + [GCC_TSIF_AHB_CLK] = &gcc_tsif_ahb_clk.clkr, 2592 2261 [GCC_TSIF_REF_CLK] = &gcc_tsif_ref_clk.clkr, 2262 + [GCC_UFS_AHB_CLK] = &gcc_ufs_ahb_clk.clkr, 2593 2263 [GCC_UFS_AXI_CLK] = &gcc_ufs_axi_clk.clkr, 2594 2264 [GCC_UFS_RX_CFG_CLK] = &gcc_ufs_rx_cfg_clk.clkr, 2265 + [GCC_UFS_RX_SYMBOL_0_CLK] = &gcc_ufs_rx_symbol_0_clk.clkr, 2266 + [GCC_UFS_RX_SYMBOL_1_CLK] = &gcc_ufs_rx_symbol_1_clk.clkr, 2595 2267 [GCC_UFS_TX_CFG_CLK] = &gcc_ufs_tx_cfg_clk.clkr, 2268 + [GCC_UFS_TX_SYMBOL_0_CLK] = &gcc_ufs_tx_symbol_0_clk.clkr, 2269 + [GCC_UFS_TX_SYMBOL_1_CLK] = &gcc_ufs_tx_symbol_1_clk.clkr, 2270 + [GCC_USB2_HS_PHY_SLEEP_CLK] = &gcc_usb2_hs_phy_sleep_clk.clkr, 2596 2271 [GCC_USB30_MASTER_CLK] = &gcc_usb30_master_clk.clkr, 2597 2272 [GCC_USB30_MOCK_UTMI_CLK] = &gcc_usb30_mock_utmi_clk.clkr, 2273 + [GCC_USB30_SLEEP_CLK] = &gcc_usb30_sleep_clk.clkr, 2598 2274 [GCC_USB3_PHY_AUX_CLK] = &gcc_usb3_phy_aux_clk.clkr, 2275 + [GCC_USB_HS_AHB_CLK] = &gcc_usb_hs_ahb_clk.clkr, 2599 2276 [GCC_USB_HS_SYSTEM_CLK] = &gcc_usb_hs_system_clk.clkr, 2277 + [GCC_USB_PHY_CFG_AHB2PHY_CLK] = &gcc_usb_phy_cfg_ahb2phy_clk.clkr, 2278 + }; 2279 + 2280 + static struct gdsc *gcc_msm8994_gdscs[] = { 2281 + [PCIE_GDSC] = &pcie_gdsc, 2282 + [PCIE_0_GDSC] = &pcie_0_gdsc, 2283 + [PCIE_1_GDSC] = &pcie_1_gdsc, 2284 + [USB30_GDSC] = &usb30_gdsc, 2285 + [UFS_GDSC] = &ufs_gdsc, 2286 + }; 2287 + 2288 + static const struct qcom_reset_map gcc_msm8994_resets[] = { 2289 + [USB3_PHY_RESET] = { 0x1400 }, 2290 + [USB3PHY_PHY_RESET] = { 0x1404 }, 2291 + [PCIE_PHY_0_RESET] = { 0x1b18 }, 2292 + [PCIE_PHY_1_RESET] = { 0x1b98 }, 2293 + [QUSB2_PHY_RESET] = { 0x04b8 }, 2600 2294 }; 2601 2295 2602 2296 static const struct regmap_config gcc_msm8994_regmap_config = { ··· 2649 2267 .config = &gcc_msm8994_regmap_config, 2650 2268 .clks = gcc_msm8994_clocks, 2651 2269 .num_clks = ARRAY_SIZE(gcc_msm8994_clocks), 2270 + .resets = gcc_msm8994_resets, 2271 + .num_resets = ARRAY_SIZE(gcc_msm8994_resets), 2272 + .gdscs = gcc_msm8994_gdscs, 2273 + .num_gdscs = ARRAY_SIZE(gcc_msm8994_gdscs), 2652 2274 }; 2653 2275 2654 2276 static const struct of_device_id gcc_msm8994_match_table[] = {
+1 -1
drivers/clk/qcom/gcc-sdm660.c
··· 666 666 .cmd_rcgr = 0x48044, 667 667 .mnd_width = 0, 668 668 .hid_width = 5, 669 - .parent_map = gcc_parent_map_xo_gpll0_gpll0_early_div, 669 + .parent_map = gcc_parent_map_xo_gpll0, 670 670 .freq_tbl = ftbl_hmss_rbcpr_clk_src, 671 671 .clkr.hw.init = &(struct clk_init_data){ 672 672 .name = "hmss_rbcpr_clk_src",
+8
drivers/clk/qcom/gdsc.c
··· 358 358 if ((sc->flags & VOTABLE) && on) 359 359 gdsc_enable(&sc->pd); 360 360 361 + /* 362 + * Make sure the retain bit is set if the GDSC is already on, otherwise 363 + * we end up turning off the GDSC and destroying all the register 364 + * contents that we thought we were saving. 365 + */ 366 + if ((sc->flags & RETAIN_FF_ENABLE) && on) 367 + gdsc_retain_ff_on(sc); 368 + 361 369 /* If ALWAYS_ON GDSCs are not ON, turn them ON */ 362 370 if (sc->flags & ALWAYS_ON) { 363 371 if (!on)
+276
drivers/clk/qcom/videocc-sm8150.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 4 + */ 5 + 6 + #include <linux/clk-provider.h> 7 + #include <linux/module.h> 8 + #include <linux/platform_device.h> 9 + #include <linux/regmap.h> 10 + 11 + #include <dt-bindings/clock/qcom,videocc-sm8150.h> 12 + 13 + #include "common.h" 14 + #include "clk-alpha-pll.h" 15 + #include "clk-branch.h" 16 + #include "clk-rcg.h" 17 + #include "clk-regmap.h" 18 + #include "reset.h" 19 + #include "gdsc.h" 20 + 21 + enum { 22 + P_BI_TCXO, 23 + P_CHIP_SLEEP_CLK, 24 + P_CORE_BI_PLL_TEST_SE, 25 + P_VIDEO_PLL0_OUT_EVEN, 26 + P_VIDEO_PLL0_OUT_MAIN, 27 + P_VIDEO_PLL0_OUT_ODD, 28 + }; 29 + 30 + static struct pll_vco trion_vco[] = { 31 + { 249600000, 2000000000, 0 }, 32 + }; 33 + 34 + static struct alpha_pll_config video_pll0_config = { 35 + .l = 0x14, 36 + .alpha = 0xD555, 37 + .config_ctl_val = 0x20485699, 38 + .config_ctl_hi_val = 0x00002267, 39 + .config_ctl_hi1_val = 0x00000024, 40 + .user_ctl_val = 0x00000000, 41 + .user_ctl_hi_val = 0x00000805, 42 + .user_ctl_hi1_val = 0x000000D0, 43 + }; 44 + 45 + static struct clk_alpha_pll video_pll0 = { 46 + .offset = 0x42c, 47 + .vco_table = trion_vco, 48 + .num_vco = ARRAY_SIZE(trion_vco), 49 + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_TRION], 50 + .clkr = { 51 + .hw.init = &(struct clk_init_data){ 52 + .name = "video_pll0", 53 + .parent_data = &(const struct clk_parent_data){ 54 + .fw_name = "bi_tcxo", 55 + }, 56 + .num_parents = 1, 57 + .ops = &clk_alpha_pll_trion_ops, 58 + }, 59 + }, 60 + }; 61 + 62 + static const struct parent_map video_cc_parent_map_0[] = { 63 + { P_BI_TCXO, 0 }, 64 + { P_VIDEO_PLL0_OUT_MAIN, 1 }, 65 + }; 66 + 67 + static const struct clk_parent_data video_cc_parent_data_0[] = { 68 + { .fw_name = "bi_tcxo" }, 69 + { .hw = &video_pll0.clkr.hw }, 70 + }; 71 + 72 + static const struct freq_tbl ftbl_video_cc_iris_clk_src[] = { 73 + F(19200000, P_BI_TCXO, 1, 0, 0), 74 + F(200000000, P_VIDEO_PLL0_OUT_MAIN, 2, 0, 0), 75 + F(240000000, P_VIDEO_PLL0_OUT_MAIN, 2, 0, 0), 76 + F(338000000, P_VIDEO_PLL0_OUT_MAIN, 2, 0, 0), 77 + F(365000000, P_VIDEO_PLL0_OUT_MAIN, 2, 0, 0), 78 + F(444000000, P_VIDEO_PLL0_OUT_MAIN, 2, 0, 0), 79 + F(533000000, P_VIDEO_PLL0_OUT_MAIN, 2, 0, 0), 80 + { } 81 + }; 82 + 83 + static struct clk_rcg2 video_cc_iris_clk_src = { 84 + .cmd_rcgr = 0x7f0, 85 + .mnd_width = 0, 86 + .hid_width = 5, 87 + .parent_map = video_cc_parent_map_0, 88 + .freq_tbl = ftbl_video_cc_iris_clk_src, 89 + .clkr.hw.init = &(struct clk_init_data){ 90 + .name = "video_cc_iris_clk_src", 91 + .parent_data = video_cc_parent_data_0, 92 + .num_parents = ARRAY_SIZE(video_cc_parent_data_0), 93 + .flags = CLK_SET_RATE_PARENT, 94 + .ops = &clk_rcg2_shared_ops, 95 + }, 96 + }; 97 + 98 + static struct clk_branch video_cc_iris_ahb_clk = { 99 + .halt_reg = 0x8f4, 100 + .halt_check = BRANCH_VOTED, 101 + .clkr = { 102 + .enable_reg = 0x8f4, 103 + .enable_mask = BIT(0), 104 + .hw.init = &(struct clk_init_data){ 105 + .name = "video_cc_iris_ahb_clk", 106 + .parent_data = &(const struct clk_parent_data){ 107 + .hw = &video_cc_iris_clk_src.clkr.hw, 108 + }, 109 + .num_parents = 1, 110 + .flags = CLK_SET_RATE_PARENT, 111 + .ops = &clk_branch2_ops, 112 + }, 113 + }, 114 + }; 115 + 116 + static struct clk_branch video_cc_mvs0_core_clk = { 117 + .halt_reg = 0x890, 118 + .halt_check = BRANCH_VOTED, 119 + .clkr = { 120 + .enable_reg = 0x890, 121 + .enable_mask = BIT(0), 122 + .hw.init = &(struct clk_init_data){ 123 + .name = "video_cc_mvs0_core_clk", 124 + .parent_data = &(const struct clk_parent_data){ 125 + .hw = &video_cc_iris_clk_src.clkr.hw, 126 + }, 127 + .num_parents = 1, 128 + .flags = CLK_SET_RATE_PARENT, 129 + .ops = &clk_branch2_ops, 130 + }, 131 + }, 132 + }; 133 + 134 + static struct clk_branch video_cc_mvs1_core_clk = { 135 + .halt_reg = 0x8d0, 136 + .halt_check = BRANCH_VOTED, 137 + .clkr = { 138 + .enable_reg = 0x8d0, 139 + .enable_mask = BIT(0), 140 + .hw.init = &(struct clk_init_data){ 141 + .name = "video_cc_mvs1_core_clk", 142 + .parent_data = &(const struct clk_parent_data){ 143 + .hw = &video_cc_iris_clk_src.clkr.hw, 144 + }, 145 + .num_parents = 1, 146 + .flags = CLK_SET_RATE_PARENT, 147 + .ops = &clk_branch2_ops, 148 + }, 149 + }, 150 + }; 151 + 152 + static struct clk_branch video_cc_mvsc_core_clk = { 153 + .halt_reg = 0x850, 154 + .halt_check = BRANCH_HALT, 155 + .clkr = { 156 + .enable_reg = 0x850, 157 + .enable_mask = BIT(0), 158 + .hw.init = &(struct clk_init_data){ 159 + .name = "video_cc_mvsc_core_clk", 160 + .parent_data = &(const struct clk_parent_data){ 161 + .hw = &video_cc_iris_clk_src.clkr.hw, 162 + }, 163 + .num_parents = 1, 164 + .flags = CLK_SET_RATE_PARENT, 165 + .ops = &clk_branch2_ops, 166 + }, 167 + }, 168 + }; 169 + 170 + static struct gdsc venus_gdsc = { 171 + .gdscr = 0x814, 172 + .pd = { 173 + .name = "venus_gdsc", 174 + }, 175 + .flags = 0, 176 + .pwrsts = PWRSTS_OFF_ON, 177 + }; 178 + 179 + static struct gdsc vcodec0_gdsc = { 180 + .gdscr = 0x874, 181 + .pd = { 182 + .name = "vcodec0_gdsc", 183 + }, 184 + .flags = HW_CTRL, 185 + .pwrsts = PWRSTS_OFF_ON, 186 + }; 187 + 188 + static struct gdsc vcodec1_gdsc = { 189 + .gdscr = 0x8b4, 190 + .pd = { 191 + .name = "vcodec1_gdsc", 192 + }, 193 + .flags = HW_CTRL, 194 + .pwrsts = PWRSTS_OFF_ON, 195 + }; 196 + static struct clk_regmap *video_cc_sm8150_clocks[] = { 197 + [VIDEO_CC_IRIS_AHB_CLK] = &video_cc_iris_ahb_clk.clkr, 198 + [VIDEO_CC_IRIS_CLK_SRC] = &video_cc_iris_clk_src.clkr, 199 + [VIDEO_CC_MVS0_CORE_CLK] = &video_cc_mvs0_core_clk.clkr, 200 + [VIDEO_CC_MVS1_CORE_CLK] = &video_cc_mvs1_core_clk.clkr, 201 + [VIDEO_CC_MVSC_CORE_CLK] = &video_cc_mvsc_core_clk.clkr, 202 + [VIDEO_CC_PLL0] = &video_pll0.clkr, 203 + }; 204 + 205 + static struct gdsc *video_cc_sm8150_gdscs[] = { 206 + [VENUS_GDSC] = &venus_gdsc, 207 + [VCODEC0_GDSC] = &vcodec0_gdsc, 208 + [VCODEC1_GDSC] = &vcodec1_gdsc, 209 + }; 210 + 211 + static const struct regmap_config video_cc_sm8150_regmap_config = { 212 + .reg_bits = 32, 213 + .reg_stride = 4, 214 + .val_bits = 32, 215 + .max_register = 0xb94, 216 + .fast_io = true, 217 + }; 218 + 219 + static const struct qcom_reset_map video_cc_sm8150_resets[] = { 220 + [VIDEO_CC_MVSC_CORE_CLK_BCR] = { 0x850, 2 }, 221 + }; 222 + 223 + static const struct qcom_cc_desc video_cc_sm8150_desc = { 224 + .config = &video_cc_sm8150_regmap_config, 225 + .clks = video_cc_sm8150_clocks, 226 + .num_clks = ARRAY_SIZE(video_cc_sm8150_clocks), 227 + .resets = video_cc_sm8150_resets, 228 + .num_resets = ARRAY_SIZE(video_cc_sm8150_resets), 229 + .gdscs = video_cc_sm8150_gdscs, 230 + .num_gdscs = ARRAY_SIZE(video_cc_sm8150_gdscs), 231 + }; 232 + 233 + static const struct of_device_id video_cc_sm8150_match_table[] = { 234 + { .compatible = "qcom,sm8150-videocc" }, 235 + { } 236 + }; 237 + MODULE_DEVICE_TABLE(of, video_cc_sm8150_match_table); 238 + 239 + static int video_cc_sm8150_probe(struct platform_device *pdev) 240 + { 241 + struct regmap *regmap; 242 + 243 + regmap = qcom_cc_map(pdev, &video_cc_sm8150_desc); 244 + if (IS_ERR(regmap)) 245 + return PTR_ERR(regmap); 246 + 247 + clk_trion_pll_configure(&video_pll0, regmap, &video_pll0_config); 248 + 249 + /* Keep VIDEO_CC_XO_CLK ALWAYS-ON */ 250 + regmap_update_bits(regmap, 0x984, 0x1, 0x1); 251 + 252 + return qcom_cc_really_probe(pdev, &video_cc_sm8150_desc, regmap); 253 + } 254 + 255 + static struct platform_driver video_cc_sm8150_driver = { 256 + .probe = video_cc_sm8150_probe, 257 + .driver = { 258 + .name = "video_cc-sm8150", 259 + .of_match_table = video_cc_sm8150_match_table, 260 + }, 261 + }; 262 + 263 + static int __init video_cc_sm8150_init(void) 264 + { 265 + return platform_driver_register(&video_cc_sm8150_driver); 266 + } 267 + subsys_initcall(video_cc_sm8150_init); 268 + 269 + static void __exit video_cc_sm8150_exit(void) 270 + { 271 + platform_driver_unregister(&video_cc_sm8150_driver); 272 + } 273 + module_exit(video_cc_sm8150_exit); 274 + 275 + MODULE_LICENSE("GPL v2"); 276 + MODULE_DESCRIPTION("QTI VIDEOCC SM8150 Driver");
+369
drivers/clk/qcom/videocc-sm8250.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. 4 + */ 5 + 6 + #include <linux/clk-provider.h> 7 + #include <linux/module.h> 8 + #include <linux/platform_device.h> 9 + #include <linux/regmap.h> 10 + 11 + #include <dt-bindings/clock/qcom,videocc-sm8250.h> 12 + 13 + #include "clk-alpha-pll.h" 14 + #include "clk-branch.h" 15 + #include "clk-rcg.h" 16 + #include "clk-regmap.h" 17 + #include "clk-regmap-divider.h" 18 + #include "common.h" 19 + #include "reset.h" 20 + #include "gdsc.h" 21 + 22 + enum { 23 + P_BI_TCXO, 24 + P_CHIP_SLEEP_CLK, 25 + P_CORE_BI_PLL_TEST_SE, 26 + P_VIDEO_PLL0_OUT_MAIN, 27 + P_VIDEO_PLL1_OUT_MAIN, 28 + }; 29 + 30 + static struct pll_vco lucid_vco[] = { 31 + { 249600000, 2000000000, 0 }, 32 + }; 33 + 34 + static const struct alpha_pll_config video_pll0_config = { 35 + .l = 0x25, 36 + .alpha = 0x8000, 37 + .config_ctl_val = 0x20485699, 38 + .config_ctl_hi_val = 0x00002261, 39 + .config_ctl_hi1_val = 0x329A699C, 40 + .user_ctl_val = 0x00000000, 41 + .user_ctl_hi_val = 0x00000805, 42 + .user_ctl_hi1_val = 0x00000000, 43 + }; 44 + 45 + static struct clk_alpha_pll video_pll0 = { 46 + .offset = 0x42c, 47 + .vco_table = lucid_vco, 48 + .num_vco = ARRAY_SIZE(lucid_vco), 49 + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID], 50 + .clkr = { 51 + .hw.init = &(struct clk_init_data){ 52 + .name = "video_pll0", 53 + .parent_data = &(const struct clk_parent_data){ 54 + .fw_name = "bi_tcxo", 55 + }, 56 + .num_parents = 1, 57 + .ops = &clk_alpha_pll_lucid_ops, 58 + }, 59 + }, 60 + }; 61 + 62 + static const struct alpha_pll_config video_pll1_config = { 63 + .l = 0x2B, 64 + .alpha = 0xC000, 65 + .config_ctl_val = 0x20485699, 66 + .config_ctl_hi_val = 0x00002261, 67 + .config_ctl_hi1_val = 0x329A699C, 68 + .user_ctl_val = 0x00000000, 69 + .user_ctl_hi_val = 0x00000805, 70 + .user_ctl_hi1_val = 0x00000000, 71 + }; 72 + 73 + static struct clk_alpha_pll video_pll1 = { 74 + .offset = 0x7d0, 75 + .vco_table = lucid_vco, 76 + .num_vco = ARRAY_SIZE(lucid_vco), 77 + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID], 78 + .clkr = { 79 + .hw.init = &(struct clk_init_data){ 80 + .name = "video_pll1", 81 + .parent_data = &(const struct clk_parent_data){ 82 + .fw_name = "bi_tcxo", 83 + }, 84 + .num_parents = 1, 85 + .ops = &clk_alpha_pll_lucid_ops, 86 + }, 87 + }, 88 + }; 89 + 90 + static const struct parent_map video_cc_parent_map_1[] = { 91 + { P_BI_TCXO, 0 }, 92 + { P_VIDEO_PLL0_OUT_MAIN, 1 }, 93 + }; 94 + 95 + static const struct clk_parent_data video_cc_parent_data_1[] = { 96 + { .fw_name = "bi_tcxo" }, 97 + { .hw = &video_pll0.clkr.hw }, 98 + }; 99 + 100 + static const struct parent_map video_cc_parent_map_2[] = { 101 + { P_BI_TCXO, 0 }, 102 + { P_VIDEO_PLL1_OUT_MAIN, 1 }, 103 + }; 104 + 105 + static const struct clk_parent_data video_cc_parent_data_2[] = { 106 + { .fw_name = "bi_tcxo" }, 107 + { .hw = &video_pll1.clkr.hw }, 108 + }; 109 + 110 + static const struct freq_tbl ftbl_video_cc_mvs0_clk_src[] = { 111 + F(19200000, P_BI_TCXO, 1, 0, 0), 112 + F(720000000, P_VIDEO_PLL0_OUT_MAIN, 1, 0, 0), 113 + F(1014000000, P_VIDEO_PLL0_OUT_MAIN, 1, 0, 0), 114 + F(1098000000, P_VIDEO_PLL0_OUT_MAIN, 1, 0, 0), 115 + F(1332000000, P_VIDEO_PLL0_OUT_MAIN, 1, 0, 0), 116 + { } 117 + }; 118 + 119 + static struct clk_rcg2 video_cc_mvs0_clk_src = { 120 + .cmd_rcgr = 0xb94, 121 + .mnd_width = 0, 122 + .hid_width = 5, 123 + .parent_map = video_cc_parent_map_1, 124 + .freq_tbl = ftbl_video_cc_mvs0_clk_src, 125 + .clkr.hw.init = &(struct clk_init_data){ 126 + .name = "video_cc_mvs0_clk_src", 127 + .parent_data = video_cc_parent_data_1, 128 + .num_parents = ARRAY_SIZE(video_cc_parent_data_1), 129 + .flags = CLK_SET_RATE_PARENT, 130 + .ops = &clk_rcg2_shared_ops, 131 + }, 132 + }; 133 + 134 + static const struct freq_tbl ftbl_video_cc_mvs1_clk_src[] = { 135 + F(19200000, P_BI_TCXO, 1, 0, 0), 136 + F(840000000, P_VIDEO_PLL1_OUT_MAIN, 1, 0, 0), 137 + F(1098000000, P_VIDEO_PLL1_OUT_MAIN, 1, 0, 0), 138 + F(1332000000, P_VIDEO_PLL1_OUT_MAIN, 1, 0, 0), 139 + { } 140 + }; 141 + 142 + static struct clk_rcg2 video_cc_mvs1_clk_src = { 143 + .cmd_rcgr = 0xbb4, 144 + .mnd_width = 0, 145 + .hid_width = 5, 146 + .parent_map = video_cc_parent_map_2, 147 + .freq_tbl = ftbl_video_cc_mvs1_clk_src, 148 + .clkr.hw.init = &(struct clk_init_data){ 149 + .name = "video_cc_mvs1_clk_src", 150 + .parent_data = video_cc_parent_data_2, 151 + .num_parents = ARRAY_SIZE(video_cc_parent_data_2), 152 + .flags = CLK_SET_RATE_PARENT, 153 + .ops = &clk_rcg2_shared_ops, 154 + }, 155 + }; 156 + 157 + static struct clk_regmap_div video_cc_mvs0c_div2_div_clk_src = { 158 + .reg = 0xc54, 159 + .shift = 0, 160 + .width = 2, 161 + .clkr.hw.init = &(struct clk_init_data) { 162 + .name = "video_cc_mvs0c_div2_div_clk_src", 163 + .parent_data = &(const struct clk_parent_data){ 164 + .hw = &video_cc_mvs0_clk_src.clkr.hw, 165 + }, 166 + .num_parents = 1, 167 + .flags = CLK_SET_RATE_PARENT, 168 + .ops = &clk_regmap_div_ro_ops, 169 + }, 170 + }; 171 + 172 + static struct clk_regmap_div video_cc_mvs1c_div2_div_clk_src = { 173 + .reg = 0xcf4, 174 + .shift = 0, 175 + .width = 2, 176 + .clkr.hw.init = &(struct clk_init_data) { 177 + .name = "video_cc_mvs1c_div2_div_clk_src", 178 + .parent_data = &(const struct clk_parent_data){ 179 + .hw = &video_cc_mvs1_clk_src.clkr.hw, 180 + }, 181 + .num_parents = 1, 182 + .flags = CLK_SET_RATE_PARENT, 183 + .ops = &clk_regmap_div_ro_ops, 184 + }, 185 + }; 186 + 187 + static struct clk_branch video_cc_mvs0c_clk = { 188 + .halt_reg = 0xc34, 189 + .halt_check = BRANCH_HALT, 190 + .clkr = { 191 + .enable_reg = 0xc34, 192 + .enable_mask = BIT(0), 193 + .hw.init = &(struct clk_init_data){ 194 + .name = "video_cc_mvs0c_clk", 195 + .parent_data = &(const struct clk_parent_data){ 196 + .hw = &video_cc_mvs0c_div2_div_clk_src.clkr.hw, 197 + }, 198 + .num_parents = 1, 199 + .flags = CLK_SET_RATE_PARENT, 200 + .ops = &clk_branch2_ops, 201 + }, 202 + }, 203 + }; 204 + 205 + static struct clk_branch video_cc_mvs1_div2_clk = { 206 + .halt_reg = 0xdf4, 207 + .halt_check = BRANCH_HALT_VOTED, 208 + .clkr = { 209 + .enable_reg = 0xdf4, 210 + .enable_mask = BIT(0), 211 + .hw.init = &(struct clk_init_data){ 212 + .name = "video_cc_mvs1_div2_clk", 213 + .parent_data = &(const struct clk_parent_data){ 214 + .hw = &video_cc_mvs1c_div2_div_clk_src.clkr.hw, 215 + }, 216 + .num_parents = 1, 217 + .flags = CLK_SET_RATE_PARENT, 218 + .ops = &clk_branch2_ops, 219 + }, 220 + }, 221 + }; 222 + 223 + static struct clk_branch video_cc_mvs1c_clk = { 224 + .halt_reg = 0xcd4, 225 + .halt_check = BRANCH_HALT_VOTED, 226 + .clkr = { 227 + .enable_reg = 0xcd4, 228 + .enable_mask = BIT(0), 229 + .hw.init = &(struct clk_init_data){ 230 + .name = "video_cc_mvs1c_clk", 231 + .parent_data = &(const struct clk_parent_data){ 232 + .hw = &video_cc_mvs1c_div2_div_clk_src.clkr.hw, 233 + }, 234 + .num_parents = 1, 235 + .flags = CLK_SET_RATE_PARENT, 236 + .ops = &clk_branch2_ops, 237 + }, 238 + }, 239 + }; 240 + 241 + static struct gdsc mvs0c_gdsc = { 242 + .gdscr = 0xbf8, 243 + .pd = { 244 + .name = "mvs0c_gdsc", 245 + }, 246 + .flags = 0, 247 + .pwrsts = PWRSTS_OFF_ON, 248 + }; 249 + 250 + static struct gdsc mvs1c_gdsc = { 251 + .gdscr = 0xc98, 252 + .pd = { 253 + .name = "mvs1c_gdsc", 254 + }, 255 + .flags = 0, 256 + .pwrsts = PWRSTS_OFF_ON, 257 + }; 258 + 259 + static struct gdsc mvs0_gdsc = { 260 + .gdscr = 0xd18, 261 + .pd = { 262 + .name = "mvs0_gdsc", 263 + }, 264 + .flags = HW_CTRL, 265 + .pwrsts = PWRSTS_OFF_ON, 266 + }; 267 + 268 + static struct gdsc mvs1_gdsc = { 269 + .gdscr = 0xd98, 270 + .pd = { 271 + .name = "mvs1_gdsc", 272 + }, 273 + .flags = HW_CTRL, 274 + .pwrsts = PWRSTS_OFF_ON, 275 + }; 276 + 277 + static struct clk_regmap *video_cc_sm8250_clocks[] = { 278 + [VIDEO_CC_MVS0_CLK_SRC] = &video_cc_mvs0_clk_src.clkr, 279 + [VIDEO_CC_MVS0C_CLK] = &video_cc_mvs0c_clk.clkr, 280 + [VIDEO_CC_MVS0C_DIV2_DIV_CLK_SRC] = &video_cc_mvs0c_div2_div_clk_src.clkr, 281 + [VIDEO_CC_MVS1_CLK_SRC] = &video_cc_mvs1_clk_src.clkr, 282 + [VIDEO_CC_MVS1_DIV2_CLK] = &video_cc_mvs1_div2_clk.clkr, 283 + [VIDEO_CC_MVS1C_CLK] = &video_cc_mvs1c_clk.clkr, 284 + [VIDEO_CC_MVS1C_DIV2_DIV_CLK_SRC] = &video_cc_mvs1c_div2_div_clk_src.clkr, 285 + [VIDEO_CC_PLL0] = &video_pll0.clkr, 286 + [VIDEO_CC_PLL1] = &video_pll1.clkr, 287 + }; 288 + 289 + static const struct qcom_reset_map video_cc_sm8250_resets[] = { 290 + [VIDEO_CC_CVP_INTERFACE_BCR] = { 0xe54 }, 291 + [VIDEO_CC_CVP_MVS0_BCR] = { 0xd14 }, 292 + [VIDEO_CC_MVS0C_CLK_ARES] = { 0xc34, 2 }, 293 + [VIDEO_CC_CVP_MVS0C_BCR] = { 0xbf4 }, 294 + [VIDEO_CC_CVP_MVS1_BCR] = { 0xd94 }, 295 + [VIDEO_CC_MVS1C_CLK_ARES] = { 0xcd4, 2 }, 296 + [VIDEO_CC_CVP_MVS1C_BCR] = { 0xc94 }, 297 + }; 298 + 299 + static struct gdsc *video_cc_sm8250_gdscs[] = { 300 + [MVS0C_GDSC] = &mvs0c_gdsc, 301 + [MVS1C_GDSC] = &mvs1c_gdsc, 302 + [MVS0_GDSC] = &mvs0_gdsc, 303 + [MVS1_GDSC] = &mvs1_gdsc, 304 + }; 305 + 306 + static const struct regmap_config video_cc_sm8250_regmap_config = { 307 + .reg_bits = 32, 308 + .reg_stride = 4, 309 + .val_bits = 32, 310 + .max_register = 0xf4c, 311 + .fast_io = true, 312 + }; 313 + 314 + static const struct qcom_cc_desc video_cc_sm8250_desc = { 315 + .config = &video_cc_sm8250_regmap_config, 316 + .clks = video_cc_sm8250_clocks, 317 + .num_clks = ARRAY_SIZE(video_cc_sm8250_clocks), 318 + .resets = video_cc_sm8250_resets, 319 + .num_resets = ARRAY_SIZE(video_cc_sm8250_resets), 320 + .gdscs = video_cc_sm8250_gdscs, 321 + .num_gdscs = ARRAY_SIZE(video_cc_sm8250_gdscs), 322 + }; 323 + 324 + static const struct of_device_id video_cc_sm8250_match_table[] = { 325 + { .compatible = "qcom,sm8250-videocc" }, 326 + { } 327 + }; 328 + MODULE_DEVICE_TABLE(of, video_cc_sm8250_match_table); 329 + 330 + static int video_cc_sm8250_probe(struct platform_device *pdev) 331 + { 332 + struct regmap *regmap; 333 + 334 + regmap = qcom_cc_map(pdev, &video_cc_sm8250_desc); 335 + if (IS_ERR(regmap)) 336 + return PTR_ERR(regmap); 337 + 338 + clk_lucid_pll_configure(&video_pll0, regmap, &video_pll0_config); 339 + clk_lucid_pll_configure(&video_pll1, regmap, &video_pll1_config); 340 + 341 + /* Keep VIDEO_CC_AHB_CLK and VIDEO_CC_XO_CLK ALWAYS-ON */ 342 + regmap_update_bits(regmap, 0xe58, BIT(0), BIT(0)); 343 + regmap_update_bits(regmap, 0xeec, BIT(0), BIT(0)); 344 + 345 + return qcom_cc_really_probe(pdev, &video_cc_sm8250_desc, regmap); 346 + } 347 + 348 + static struct platform_driver video_cc_sm8250_driver = { 349 + .probe = video_cc_sm8250_probe, 350 + .driver = { 351 + .name = "sm8250-videocc", 352 + .of_match_table = video_cc_sm8250_match_table, 353 + }, 354 + }; 355 + 356 + static int __init video_cc_sm8250_init(void) 357 + { 358 + return platform_driver_register(&video_cc_sm8250_driver); 359 + } 360 + subsys_initcall(video_cc_sm8250_init); 361 + 362 + static void __exit video_cc_sm8250_exit(void) 363 + { 364 + platform_driver_unregister(&video_cc_sm8250_driver); 365 + } 366 + module_exit(video_cc_sm8250_exit); 367 + 368 + MODULE_LICENSE("GPL v2"); 369 + MODULE_DESCRIPTION("QTI VIDEOCC SM8250 Driver");
+6 -1
drivers/clk/renesas/Kconfig
··· 30 30 select CLK_R8A77980 if ARCH_R8A77980 31 31 select CLK_R8A77990 if ARCH_R8A77990 32 32 select CLK_R8A77995 if ARCH_R8A77995 33 + select CLK_R8A779A0 if ARCH_R8A779A0 33 34 select CLK_R9A06G032 if ARCH_R9A06G032 34 35 select CLK_SH73A0 if ARCH_SH73A0 35 36 ··· 146 145 bool "R-Car D3 clock support" if COMPILE_TEST 147 146 select CLK_RCAR_GEN3_CPG 148 147 148 + config CLK_R8A779A0 149 + bool "R-Car V3U clock support" if COMPILE_TEST 150 + select CLK_RENESAS_CPG_MSSR 151 + 149 152 config CLK_R9A06G032 150 153 bool "Renesas R9A06G032 clock driver" 151 154 help ··· 167 162 select CLK_RENESAS_CPG_MSSR 168 163 169 164 config CLK_RCAR_GEN3_CPG 170 - bool "R-Car Gen3 CPG clock support" if COMPILE_TEST 165 + bool "R-Car Gen3 and RZ/G2 CPG clock support" if COMPILE_TEST 171 166 select CLK_RENESAS_CPG_MSSR 172 167 173 168 config CLK_RCAR_USB2_CLOCK_SEL
+1
drivers/clk/renesas/Makefile
··· 27 27 obj-$(CONFIG_CLK_R8A77980) += r8a77980-cpg-mssr.o 28 28 obj-$(CONFIG_CLK_R8A77990) += r8a77990-cpg-mssr.o 29 29 obj-$(CONFIG_CLK_R8A77995) += r8a77995-cpg-mssr.o 30 + obj-$(CONFIG_CLK_R8A779A0) += r8a779a0-cpg-mssr.o 30 31 obj-$(CONFIG_CLK_R9A06G032) += r9a06g032-clocks.o 31 32 obj-$(CONFIG_CLK_SH73A0) += clk-sh73a0.o 32 33
+1 -1
drivers/clk/renesas/r7s9210-cpg-mssr.c
··· 214 214 .cpg_clk_register = rza2_cpg_clk_register, 215 215 216 216 /* RZ/A2 has Standby Control Registers */ 217 - .stbyctrl = true, 217 + .reg_layout = CLK_REG_LAYOUT_RZ_A, 218 218 }; 219 219 220 220 static void __init r7s9210_cpg_mssr_early_init(struct device_node *np)
+2 -1
drivers/clk/renesas/r8a7742-cpg-mssr.c
··· 97 97 DEF_MOD("tmu0", 125, R8A7742_CLK_CP), 98 98 DEF_MOD("vsp1du1", 127, R8A7742_CLK_ZS), 99 99 DEF_MOD("vsp1du0", 128, R8A7742_CLK_ZS), 100 - DEF_MOD("vsp1-sy", 131, R8A7742_CLK_ZS), 100 + DEF_MOD("vspr", 130, R8A7742_CLK_ZS), 101 + DEF_MOD("vsps", 131, R8A7742_CLK_ZS), 101 102 DEF_MOD("scifa2", 202, R8A7742_CLK_MP), 102 103 DEF_MOD("scifa1", 203, R8A7742_CLK_MP), 103 104 DEF_MOD("scifa0", 204, R8A7742_CLK_MP),
+1 -1
drivers/clk/renesas/r8a7743-cpg-mssr.c
··· 92 92 DEF_MOD("tmu0", 125, R8A7743_CLK_CP), 93 93 DEF_MOD("vsp1du1", 127, R8A7743_CLK_ZS), 94 94 DEF_MOD("vsp1du0", 128, R8A7743_CLK_ZS), 95 - DEF_MOD("vsp1-sy", 131, R8A7743_CLK_ZS), 95 + DEF_MOD("vsps", 131, R8A7743_CLK_ZS), 96 96 DEF_MOD("scifa2", 202, R8A7743_CLK_MP), 97 97 DEF_MOD("scifa1", 203, R8A7743_CLK_MP), 98 98 DEF_MOD("scifa0", 204, R8A7743_CLK_MP),
+1 -1
drivers/clk/renesas/r8a7745-cpg-mssr.c
··· 90 90 DEF_MOD("cmt0", 124, R8A7745_CLK_R), 91 91 DEF_MOD("tmu0", 125, R8A7745_CLK_CP), 92 92 DEF_MOD("vsp1du0", 128, R8A7745_CLK_ZS), 93 - DEF_MOD("vsp1-sy", 131, R8A7745_CLK_ZS), 93 + DEF_MOD("vsps", 131, R8A7745_CLK_ZS), 94 94 DEF_MOD("scifa2", 202, R8A7745_CLK_MP), 95 95 DEF_MOD("scifa1", 203, R8A7745_CLK_MP), 96 96 DEF_MOD("scifa0", 204, R8A7745_CLK_MP),
+1 -1
drivers/clk/renesas/r8a77470-cpg-mssr.c
··· 85 85 DEF_MOD("tmu2", 122, R8A77470_CLK_P), 86 86 DEF_MOD("cmt0", 124, R8A77470_CLK_R), 87 87 DEF_MOD("vsp1du0", 128, R8A77470_CLK_ZS), 88 - DEF_MOD("vsp1-sy", 131, R8A77470_CLK_ZS), 88 + DEF_MOD("vsps", 131, R8A77470_CLK_ZS), 89 89 DEF_MOD("msiof2", 205, R8A77470_CLK_MP), 90 90 DEF_MOD("msiof1", 208, R8A77470_CLK_MP), 91 91 DEF_MOD("sys-dmac1", 218, R8A77470_CLK_ZS),
+2 -2
drivers/clk/renesas/r8a7790-cpg-mssr.c
··· 108 108 DEF_MOD("tmu0", 125, R8A7790_CLK_CP), 109 109 DEF_MOD("vsp1du1", 127, R8A7790_CLK_ZS), 110 110 DEF_MOD("vsp1du0", 128, R8A7790_CLK_ZS), 111 - DEF_MOD("vsp1-rt", 130, R8A7790_CLK_ZS), 112 - DEF_MOD("vsp1-sy", 131, R8A7790_CLK_ZS), 111 + DEF_MOD("vspr", 130, R8A7790_CLK_ZS), 112 + DEF_MOD("vsps", 131, R8A7790_CLK_ZS), 113 113 DEF_MOD("scifa2", 202, R8A7790_CLK_MP), 114 114 DEF_MOD("scifa1", 203, R8A7790_CLK_MP), 115 115 DEF_MOD("scifa0", 204, R8A7790_CLK_MP),
+1 -1
drivers/clk/renesas/r8a7791-cpg-mssr.c
··· 102 102 DEF_MOD("tmu0", 125, R8A7791_CLK_CP), 103 103 DEF_MOD("vsp1du1", 127, R8A7791_CLK_ZS), 104 104 DEF_MOD("vsp1du0", 128, R8A7791_CLK_ZS), 105 - DEF_MOD("vsp1-sy", 131, R8A7791_CLK_ZS), 105 + DEF_MOD("vsps", 131, R8A7791_CLK_ZS), 106 106 DEF_MOD("scifa2", 202, R8A7791_CLK_MP), 107 107 DEF_MOD("scifa1", 203, R8A7791_CLK_MP), 108 108 DEF_MOD("scifa0", 204, R8A7791_CLK_MP),
+1 -1
drivers/clk/renesas/r8a7792-cpg-mssr.c
··· 88 88 DEF_MOD("tmu0", 125, R8A7792_CLK_CP), 89 89 DEF_MOD("vsp1du1", 127, R8A7792_CLK_ZS), 90 90 DEF_MOD("vsp1du0", 128, R8A7792_CLK_ZS), 91 - DEF_MOD("vsp1-sy", 131, R8A7792_CLK_ZS), 91 + DEF_MOD("vsps", 131, R8A7792_CLK_ZS), 92 92 DEF_MOD("msiof1", 208, R8A7792_CLK_MP), 93 93 DEF_MOD("sys-dmac1", 218, R8A7792_CLK_ZS), 94 94 DEF_MOD("sys-dmac0", 219, R8A7792_CLK_ZS),
+1 -1
drivers/clk/renesas/r8a7794-cpg-mssr.c
··· 97 97 DEF_MOD("cmt0", 124, R8A7794_CLK_R), 98 98 DEF_MOD("tmu0", 125, R8A7794_CLK_CP), 99 99 DEF_MOD("vsp1du0", 128, R8A7794_CLK_ZS), 100 - DEF_MOD("vsp1-sy", 131, R8A7794_CLK_ZS), 100 + DEF_MOD("vsps", 131, R8A7794_CLK_ZS), 101 101 DEF_MOD("scifa2", 202, R8A7794_CLK_MP), 102 102 DEF_MOD("scifa1", 203, R8A7794_CLK_MP), 103 103 DEF_MOD("scifa0", 204, R8A7794_CLK_MP),
+276
drivers/clk/renesas/r8a779a0-cpg-mssr.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * r8a779a0 Clock Pulse Generator / Module Standby and Software Reset 4 + * 5 + * Copyright (C) 2020 Renesas Electronics Corp. 6 + * 7 + * Based on r8a7795-cpg-mssr.c 8 + * 9 + * Copyright (C) 2015 Glider bvba 10 + * Copyright (C) 2015 Renesas Electronics Corp. 11 + */ 12 + 13 + #include <linux/bug.h> 14 + #include <linux/bitfield.h> 15 + #include <linux/clk.h> 16 + #include <linux/clk-provider.h> 17 + #include <linux/device.h> 18 + #include <linux/err.h> 19 + #include <linux/init.h> 20 + #include <linux/io.h> 21 + #include <linux/kernel.h> 22 + #include <linux/pm.h> 23 + #include <linux/slab.h> 24 + #include <linux/soc/renesas/rcar-rst.h> 25 + 26 + #include <dt-bindings/clock/r8a779a0-cpg-mssr.h> 27 + 28 + #include "renesas-cpg-mssr.h" 29 + #include "rcar-gen3-cpg.h" 30 + 31 + enum rcar_r8a779a0_clk_types { 32 + CLK_TYPE_R8A779A0_MAIN = CLK_TYPE_CUSTOM, 33 + CLK_TYPE_R8A779A0_PLL1, 34 + CLK_TYPE_R8A779A0_PLL2X_3X, /* PLL[23][01] */ 35 + CLK_TYPE_R8A779A0_PLL5, 36 + CLK_TYPE_R8A779A0_MDSEL, /* Select parent/divider using mode pin */ 37 + CLK_TYPE_R8A779A0_OSC, /* OSC EXTAL predivider and fixed divider */ 38 + }; 39 + 40 + struct rcar_r8a779a0_cpg_pll_config { 41 + u8 extal_div; 42 + u8 pll1_mult; 43 + u8 pll1_div; 44 + u8 pll5_mult; 45 + u8 pll5_div; 46 + u8 osc_prediv; 47 + }; 48 + 49 + enum clk_ids { 50 + /* Core Clock Outputs exported to DT */ 51 + LAST_DT_CORE_CLK = R8A779A0_CLK_OSC, 52 + 53 + /* External Input Clocks */ 54 + CLK_EXTAL, 55 + CLK_EXTALR, 56 + 57 + /* Internal Core Clocks */ 58 + CLK_MAIN, 59 + CLK_PLL1, 60 + CLK_PLL20, 61 + CLK_PLL21, 62 + CLK_PLL30, 63 + CLK_PLL31, 64 + CLK_PLL5, 65 + CLK_PLL1_DIV2, 66 + CLK_PLL20_DIV2, 67 + CLK_PLL21_DIV2, 68 + CLK_PLL30_DIV2, 69 + CLK_PLL31_DIV2, 70 + CLK_PLL5_DIV2, 71 + CLK_PLL5_DIV4, 72 + CLK_S1, 73 + CLK_S2, 74 + CLK_S3, 75 + CLK_SDSRC, 76 + CLK_RPCSRC, 77 + CLK_OCO, 78 + 79 + /* Module Clocks */ 80 + MOD_CLK_BASE 81 + }; 82 + 83 + #define DEF_PLL(_name, _id, _offset) \ 84 + DEF_BASE(_name, _id, CLK_TYPE_R8A779A0_PLL2X_3X, CLK_MAIN, \ 85 + .offset = _offset) 86 + 87 + static const struct cpg_core_clk r8a779a0_core_clks[] __initconst = { 88 + /* External Clock Inputs */ 89 + DEF_INPUT("extal", CLK_EXTAL), 90 + DEF_INPUT("extalr", CLK_EXTALR), 91 + 92 + /* Internal Core Clocks */ 93 + DEF_BASE(".main", CLK_MAIN, CLK_TYPE_R8A779A0_MAIN, CLK_EXTAL), 94 + DEF_BASE(".pll1", CLK_PLL1, CLK_TYPE_R8A779A0_PLL1, CLK_MAIN), 95 + DEF_BASE(".pll5", CLK_PLL5, CLK_TYPE_R8A779A0_PLL5, CLK_MAIN), 96 + DEF_PLL(".pll20", CLK_PLL20, 0x0834), 97 + DEF_PLL(".pll21", CLK_PLL21, 0x0838), 98 + DEF_PLL(".pll30", CLK_PLL30, 0x083c), 99 + DEF_PLL(".pll31", CLK_PLL31, 0x0840), 100 + 101 + DEF_FIXED(".pll1_div2", CLK_PLL1_DIV2, CLK_PLL1, 2, 1), 102 + DEF_FIXED(".pll20_div2", CLK_PLL20_DIV2, CLK_PLL20, 2, 1), 103 + DEF_FIXED(".pll21_div2", CLK_PLL21_DIV2, CLK_PLL21, 2, 1), 104 + DEF_FIXED(".pll30_div2", CLK_PLL30_DIV2, CLK_PLL30, 2, 1), 105 + DEF_FIXED(".pll31_div2", CLK_PLL31_DIV2, CLK_PLL31, 2, 1), 106 + DEF_FIXED(".pll5_div2", CLK_PLL5_DIV2, CLK_PLL5, 2, 1), 107 + DEF_FIXED(".pll5_div4", CLK_PLL5_DIV4, CLK_PLL5_DIV2, 2, 1), 108 + DEF_FIXED(".s1", CLK_S1, CLK_PLL1_DIV2, 2, 1), 109 + DEF_FIXED(".s3", CLK_S3, CLK_PLL1_DIV2, 4, 1), 110 + DEF_RATE(".oco", CLK_OCO, 32768), 111 + 112 + /* Core Clock Outputs */ 113 + DEF_FIXED("zx", R8A779A0_CLK_ZX, CLK_PLL20_DIV2, 2, 1), 114 + DEF_FIXED("s1d1", R8A779A0_CLK_S1D1, CLK_S1, 1, 1), 115 + DEF_FIXED("s1d2", R8A779A0_CLK_S1D2, CLK_S1, 2, 1), 116 + DEF_FIXED("s1d4", R8A779A0_CLK_S1D4, CLK_S1, 4, 1), 117 + DEF_FIXED("s1d8", R8A779A0_CLK_S1D8, CLK_S1, 8, 1), 118 + DEF_FIXED("s1d12", R8A779A0_CLK_S1D12, CLK_S1, 12, 1), 119 + DEF_FIXED("s3d1", R8A779A0_CLK_S3D1, CLK_S3, 1, 1), 120 + DEF_FIXED("s3d2", R8A779A0_CLK_S3D2, CLK_S3, 2, 1), 121 + DEF_FIXED("s3d4", R8A779A0_CLK_S3D4, CLK_S3, 4, 1), 122 + DEF_FIXED("zs", R8A779A0_CLK_ZS, CLK_PLL1_DIV2, 4, 1), 123 + DEF_FIXED("zt", R8A779A0_CLK_ZT, CLK_PLL1_DIV2, 2, 1), 124 + DEF_FIXED("ztr", R8A779A0_CLK_ZTR, CLK_PLL1_DIV2, 2, 1), 125 + DEF_FIXED("zr", R8A779A0_CLK_ZR, CLK_PLL1_DIV2, 1, 1), 126 + DEF_FIXED("dsi", R8A779A0_CLK_DSI, CLK_PLL5_DIV4, 1, 1), 127 + DEF_FIXED("cnndsp", R8A779A0_CLK_CNNDSP, CLK_PLL5_DIV4, 1, 1), 128 + DEF_FIXED("vip", R8A779A0_CLK_VIP, CLK_PLL5, 5, 1), 129 + DEF_FIXED("adgh", R8A779A0_CLK_ADGH, CLK_PLL5_DIV4, 1, 1), 130 + DEF_FIXED("icu", R8A779A0_CLK_ICU, CLK_PLL5_DIV4, 2, 1), 131 + DEF_FIXED("icud2", R8A779A0_CLK_ICUD2, CLK_PLL5_DIV4, 4, 1), 132 + DEF_FIXED("vcbus", R8A779A0_CLK_VCBUS, CLK_PLL5_DIV4, 1, 1), 133 + DEF_FIXED("cbfusa", R8A779A0_CLK_CBFUSA, CLK_MAIN, 2, 1), 134 + 135 + DEF_DIV6P1("mso", R8A779A0_CLK_MSO, CLK_PLL5_DIV4, 0x87c), 136 + DEF_DIV6P1("canfd", R8A779A0_CLK_CANFD, CLK_PLL5_DIV4, 0x878), 137 + DEF_DIV6P1("csi0", R8A779A0_CLK_CSI0, CLK_PLL5_DIV4, 0x880), 138 + 139 + DEF_GEN3_OSC("osc", R8A779A0_CLK_OSC, CLK_EXTAL, 8), 140 + DEF_GEN3_MDSEL("r", R8A779A0_CLK_R, 29, CLK_EXTALR, 1, CLK_OCO, 1), 141 + }; 142 + 143 + static const struct mssr_mod_clk r8a779a0_mod_clks[] __initconst = { 144 + DEF_MOD("scif0", 702, R8A779A0_CLK_S1D8), 145 + DEF_MOD("scif1", 703, R8A779A0_CLK_S1D8), 146 + DEF_MOD("scif3", 704, R8A779A0_CLK_S1D8), 147 + DEF_MOD("scif4", 705, R8A779A0_CLK_S1D8), 148 + }; 149 + 150 + static spinlock_t cpg_lock; 151 + 152 + static const struct rcar_r8a779a0_cpg_pll_config *cpg_pll_config __initdata; 153 + static unsigned int cpg_clk_extalr __initdata; 154 + static u32 cpg_mode __initdata; 155 + 156 + struct clk * __init rcar_r8a779a0_cpg_clk_register(struct device *dev, 157 + const struct cpg_core_clk *core, const struct cpg_mssr_info *info, 158 + struct clk **clks, void __iomem *base, 159 + struct raw_notifier_head *notifiers) 160 + { 161 + const struct clk *parent; 162 + unsigned int mult = 1; 163 + unsigned int div = 1; 164 + u32 value; 165 + 166 + parent = clks[core->parent & 0xffff]; /* some types use high bits */ 167 + if (IS_ERR(parent)) 168 + return ERR_CAST(parent); 169 + 170 + switch (core->type) { 171 + case CLK_TYPE_R8A779A0_MAIN: 172 + div = cpg_pll_config->extal_div; 173 + break; 174 + 175 + case CLK_TYPE_R8A779A0_PLL1: 176 + mult = cpg_pll_config->pll1_mult; 177 + div = cpg_pll_config->pll1_div; 178 + break; 179 + 180 + case CLK_TYPE_R8A779A0_PLL2X_3X: 181 + value = readl(base + core->offset); 182 + mult = (((value >> 24) & 0x7f) + 1) * 2; 183 + break; 184 + 185 + case CLK_TYPE_R8A779A0_PLL5: 186 + mult = cpg_pll_config->pll5_mult; 187 + div = cpg_pll_config->pll5_div; 188 + break; 189 + 190 + case CLK_TYPE_R8A779A0_MDSEL: 191 + /* 192 + * Clock selectable between two parents and two fixed dividers 193 + * using a mode pin 194 + */ 195 + if (cpg_mode & BIT(core->offset)) { 196 + div = core->div & 0xffff; 197 + } else { 198 + parent = clks[core->parent >> 16]; 199 + if (IS_ERR(parent)) 200 + return ERR_CAST(parent); 201 + div = core->div >> 16; 202 + } 203 + mult = 1; 204 + break; 205 + 206 + case CLK_TYPE_R8A779A0_OSC: 207 + /* 208 + * Clock combining OSC EXTAL predivider and a fixed divider 209 + */ 210 + div = cpg_pll_config->osc_prediv * core->div; 211 + break; 212 + 213 + default: 214 + return ERR_PTR(-EINVAL); 215 + } 216 + 217 + return clk_register_fixed_factor(NULL, core->name, 218 + __clk_get_name(parent), 0, mult, div); 219 + } 220 + 221 + /* 222 + * CPG Clock Data 223 + */ 224 + /* 225 + * MD EXTAL PLL1 PLL20 PLL30 PLL4 PLL5 OSC 226 + * 14 13 (MHz) 21 31 227 + * -------------------------------------------------------- 228 + * 0 0 16.66 x 1 x128 x216 x128 x144 x192 /16 229 + * 0 1 20 x 1 x106 x180 x106 x120 x160 /19 230 + * 1 0 Prohibited setting 231 + * 1 1 33.33 / 2 x128 x216 x128 x144 x192 /32 232 + */ 233 + #define CPG_PLL_CONFIG_INDEX(md) ((((md) & BIT(14)) >> 13) | \ 234 + (((md) & BIT(13)) >> 13)) 235 + 236 + static const struct rcar_r8a779a0_cpg_pll_config cpg_pll_configs[4] = { 237 + /* EXTAL div PLL1 mult/div PLL5 mult/div OSC prediv */ 238 + { 1, 128, 1, 192, 1, 16, }, 239 + { 1, 106, 1, 160, 1, 19, }, 240 + { 0, 0, 0, 0, 0, 0, }, 241 + { 2, 128, 1, 192, 1, 32, }, 242 + }; 243 + 244 + static int __init r8a779a0_cpg_mssr_init(struct device *dev) 245 + { 246 + int error; 247 + 248 + error = rcar_rst_read_mode_pins(&cpg_mode); 249 + if (error) 250 + return error; 251 + 252 + cpg_pll_config = &cpg_pll_configs[CPG_PLL_CONFIG_INDEX(cpg_mode)]; 253 + cpg_clk_extalr = CLK_EXTALR; 254 + spin_lock_init(&cpg_lock); 255 + 256 + return 0; 257 + } 258 + 259 + const struct cpg_mssr_info r8a779a0_cpg_mssr_info __initconst = { 260 + /* Core Clocks */ 261 + .core_clks = r8a779a0_core_clks, 262 + .num_core_clks = ARRAY_SIZE(r8a779a0_core_clks), 263 + .last_dt_core_clk = LAST_DT_CORE_CLK, 264 + .num_total_core_clks = MOD_CLK_BASE, 265 + 266 + /* Module Clocks */ 267 + .mod_clks = r8a779a0_mod_clks, 268 + .num_mod_clks = ARRAY_SIZE(r8a779a0_mod_clks), 269 + .num_hw_mod_clks = 15 * 32, 270 + 271 + /* Callbacks */ 272 + .init = r8a779a0_cpg_mssr_init, 273 + .cpg_clk_register = rcar_r8a779a0_cpg_clk_register, 274 + 275 + .reg_layout = CLK_REG_LAYOUT_RCAR_V3U, 276 + };
+90 -46
drivers/clk/renesas/renesas-cpg-mssr.c
··· 57 57 0x9A0, 0x9A4, 0x9A8, 0x9AC, 58 58 }; 59 59 60 - #define MSTPSR(i) mstpsr[i] 61 - 60 + static const u16 mstpsr_for_v3u[] = { 61 + 0x2E00, 0x2E04, 0x2E08, 0x2E0C, 0x2E10, 0x2E14, 0x2E18, 0x2E1C, 62 + 0x2E20, 0x2E24, 0x2E28, 0x2E2C, 0x2E30, 0x2E34, 0x2E38, 63 + }; 62 64 63 65 /* 64 66 * System Module Stop Control Register offsets ··· 71 69 0x990, 0x994, 0x998, 0x99C, 72 70 }; 73 71 74 - #define SMSTPCR(i) smstpcr[i] 72 + static const u16 mstpcr_for_v3u[] = { 73 + 0x2D00, 0x2D04, 0x2D08, 0x2D0C, 0x2D10, 0x2D14, 0x2D18, 0x2D1C, 74 + 0x2D20, 0x2D24, 0x2D28, 0x2D2C, 0x2D30, 0x2D34, 0x2D38, 75 + }; 75 76 76 77 /* 77 78 * Standby Control Register offsets (RZ/A) ··· 86 81 0x424, 0x428, 0x42C, 87 82 }; 88 83 89 - #define STBCR(i) stbcr[i] 90 - 91 84 /* 92 85 * Software Reset Register offsets 93 86 */ ··· 95 92 0x920, 0x924, 0x928, 0x92C, 96 93 }; 97 94 98 - #define SRCR(i) srcr[i] 99 - 95 + static const u16 srcr_for_v3u[] = { 96 + 0x2C00, 0x2C04, 0x2C08, 0x2C0C, 0x2C10, 0x2C14, 0x2C18, 0x2C1C, 97 + 0x2C20, 0x2C24, 0x2C28, 0x2C2C, 0x2C30, 0x2C34, 0x2C38, 98 + }; 100 99 101 100 /* Realtime Module Stop Control Register offsets */ 102 101 #define RMSTPCR(i) (smstpcr[i] - 0x20) ··· 107 102 #define MMSTPCR(i) (smstpcr[i] + 0x20) 108 103 109 104 /* Software Reset Clearing Register offsets */ 110 - #define SRSTCLR(i) (0x940 + (i) * 4) 111 105 106 + static const u16 srstclr[] = { 107 + 0x940, 0x944, 0x948, 0x94C, 0x950, 0x954, 0x958, 0x95C, 108 + 0x960, 0x964, 0x968, 0x96C, 109 + }; 110 + 111 + static const u16 srstclr_for_v3u[] = { 112 + 0x2C80, 0x2C84, 0x2C88, 0x2C8C, 0x2C90, 0x2C94, 0x2C98, 0x2C9C, 113 + 0x2CA0, 0x2CA4, 0x2CA8, 0x2CAC, 0x2CB0, 0x2CB4, 0x2CB8, 114 + }; 112 115 113 116 /** 114 117 * Clock Pulse Generator / Module Standby and Software Reset Private Data ··· 124 111 * @rcdev: Optional reset controller entity 125 112 * @dev: CPG/MSSR device 126 113 * @base: CPG/MSSR register block base address 114 + * @reg_layout: CPG/MSSR register layout 127 115 * @rmw_lock: protects RMW register accesses 128 116 * @np: Device node in DT for this CPG/MSSR module 129 117 * @num_core_clks: Number of Core Clocks in clks[] 130 118 * @num_mod_clks: Number of Module Clocks in clks[] 131 119 * @last_dt_core_clk: ID of the last Core Clock exported to DT 132 - * @stbyctrl: This device has Standby Control Registers 133 120 * @notifiers: Notifier chain to save/restore clock state for system resume 121 + * @status_regs: Pointer to status registers array 122 + * @control_regs: Pointer to control registers array 123 + * @reset_regs: Pointer to reset registers array 124 + * @reset_clear_regs: Pointer to reset clearing registers array 134 125 * @smstpcr_saved[].mask: Mask of SMSTPCR[] bits under our control 135 126 * @smstpcr_saved[].val: Saved values of SMSTPCR[] 136 127 * @clks: Array containing all Core and Module Clocks ··· 145 128 #endif 146 129 struct device *dev; 147 130 void __iomem *base; 131 + enum clk_reg_layout reg_layout; 148 132 spinlock_t rmw_lock; 149 133 struct device_node *np; 150 134 151 135 unsigned int num_core_clks; 152 136 unsigned int num_mod_clks; 153 137 unsigned int last_dt_core_clk; 154 - bool stbyctrl; 155 138 156 139 struct raw_notifier_head notifiers; 140 + const u16 *status_regs; 141 + const u16 *control_regs; 142 + const u16 *reset_regs; 143 + const u16 *reset_clear_regs; 157 144 struct { 158 145 u32 mask; 159 146 u32 val; 160 - } smstpcr_saved[ARRAY_SIZE(smstpcr)]; 147 + } smstpcr_saved[ARRAY_SIZE(mstpsr_for_v3u)]; 161 148 162 149 struct clk *clks[]; 163 150 }; ··· 198 177 enable ? "ON" : "OFF"); 199 178 spin_lock_irqsave(&priv->rmw_lock, flags); 200 179 201 - if (priv->stbyctrl) { 202 - value = readb(priv->base + STBCR(reg)); 180 + if (priv->reg_layout == CLK_REG_LAYOUT_RZ_A) { 181 + value = readb(priv->base + priv->control_regs[reg]); 203 182 if (enable) 204 183 value &= ~bitmask; 205 184 else 206 185 value |= bitmask; 207 - writeb(value, priv->base + STBCR(reg)); 186 + writeb(value, priv->base + priv->control_regs[reg]); 208 187 209 188 /* dummy read to ensure write has completed */ 210 - readb(priv->base + STBCR(reg)); 211 - barrier_data(priv->base + STBCR(reg)); 189 + readb(priv->base + priv->control_regs[reg]); 190 + barrier_data(priv->base + priv->control_regs[reg]); 212 191 } else { 213 - value = readl(priv->base + SMSTPCR(reg)); 192 + value = readl(priv->base + priv->control_regs[reg]); 214 193 if (enable) 215 194 value &= ~bitmask; 216 195 else 217 196 value |= bitmask; 218 - writel(value, priv->base + SMSTPCR(reg)); 197 + writel(value, priv->base + priv->control_regs[reg]); 219 198 } 220 199 221 200 spin_unlock_irqrestore(&priv->rmw_lock, flags); 222 201 223 - if (!enable || priv->stbyctrl) 202 + if (!enable || priv->reg_layout == CLK_REG_LAYOUT_RZ_A) 224 203 return 0; 225 204 226 205 for (i = 1000; i > 0; --i) { 227 - if (!(readl(priv->base + MSTPSR(reg)) & bitmask)) 206 + if (!(readl(priv->base + priv->status_regs[reg]) & bitmask)) 228 207 break; 229 208 cpu_relax(); 230 209 } 231 210 232 211 if (!i) { 233 212 dev_err(dev, "Failed to enable SMSTP %p[%d]\n", 234 - priv->base + SMSTPCR(reg), bit); 213 + priv->base + priv->control_regs[reg], bit); 235 214 return -ETIMEDOUT; 236 215 } 237 216 ··· 254 233 struct cpg_mssr_priv *priv = clock->priv; 255 234 u32 value; 256 235 257 - if (priv->stbyctrl) 258 - value = readb(priv->base + STBCR(clock->index / 32)); 236 + if (priv->reg_layout == CLK_REG_LAYOUT_RZ_A) 237 + value = readb(priv->base + priv->control_regs[clock->index / 32]); 259 238 else 260 - value = readl(priv->base + MSTPSR(clock->index / 32)); 239 + value = readl(priv->base + priv->status_regs[clock->index / 32]); 261 240 262 241 return !(value & BIT(clock->index % 32)); 263 242 } ··· 293 272 294 273 case CPG_MOD: 295 274 type = "module"; 296 - if (priv->stbyctrl) { 275 + if (priv->reg_layout == CLK_REG_LAYOUT_RZ_A) { 297 276 idx = MOD_CLK_PACK_10(clkidx); 298 277 range_check = 7 - (clkidx % 10); 299 278 } else { ··· 599 578 dev_dbg(priv->dev, "reset %u%02u\n", reg, bit); 600 579 601 580 /* Reset module */ 602 - writel(bitmask, priv->base + SRCR(reg)); 581 + writel(bitmask, priv->base + priv->reset_regs[reg]); 603 582 604 583 /* Wait for at least one cycle of the RCLK clock (@ ca. 32 kHz) */ 605 584 udelay(35); 606 585 607 586 /* Release module from reset state */ 608 - writel(bitmask, priv->base + SRSTCLR(reg)); 587 + writel(bitmask, priv->base + priv->reset_clear_regs[reg]); 609 588 610 589 return 0; 611 590 } ··· 619 598 620 599 dev_dbg(priv->dev, "assert %u%02u\n", reg, bit); 621 600 622 - writel(bitmask, priv->base + SRCR(reg)); 601 + writel(bitmask, priv->base + priv->reset_regs[reg]); 623 602 return 0; 624 603 } 625 604 ··· 633 612 634 613 dev_dbg(priv->dev, "deassert %u%02u\n", reg, bit); 635 614 636 - writel(bitmask, priv->base + SRSTCLR(reg)); 615 + writel(bitmask, priv->base + priv->reset_clear_regs[reg]); 637 616 return 0; 638 617 } 639 618 ··· 645 624 unsigned int bit = id % 32; 646 625 u32 bitmask = BIT(bit); 647 626 648 - return !!(readl(priv->base + SRCR(reg)) & bitmask); 627 + return !!(readl(priv->base + priv->reset_regs[reg]) & bitmask); 649 628 } 650 629 651 630 static const struct reset_control_ops cpg_mssr_reset_ops = { ··· 825 804 .data = &r8a77995_cpg_mssr_info, 826 805 }, 827 806 #endif 807 + #ifdef CONFIG_CLK_R8A779A0 808 + { 809 + .compatible = "renesas,r8a779a0-cpg-mssr", 810 + .data = &r8a779a0_cpg_mssr_info, 811 + }, 812 + #endif 828 813 { /* sentinel */ } 829 814 }; 830 815 ··· 852 825 /* Save module registers with bits under our control */ 853 826 for (reg = 0; reg < ARRAY_SIZE(priv->smstpcr_saved); reg++) { 854 827 if (priv->smstpcr_saved[reg].mask) 855 - priv->smstpcr_saved[reg].val = priv->stbyctrl ? 856 - readb(priv->base + STBCR(reg)) : 857 - readl(priv->base + SMSTPCR(reg)); 828 + priv->smstpcr_saved[reg].val = 829 + priv->reg_layout == CLK_REG_LAYOUT_RZ_A ? 830 + readb(priv->base + priv->control_regs[reg]) : 831 + readl(priv->base + priv->control_regs[reg]); 858 832 } 859 833 860 834 /* Save core clocks */ ··· 883 855 if (!mask) 884 856 continue; 885 857 886 - if (priv->stbyctrl) 887 - oldval = readb(priv->base + STBCR(reg)); 858 + if (priv->reg_layout == CLK_REG_LAYOUT_RZ_A) 859 + oldval = readb(priv->base + priv->control_regs[reg]); 888 860 else 889 - oldval = readl(priv->base + SMSTPCR(reg)); 861 + oldval = readl(priv->base + priv->control_regs[reg]); 890 862 newval = oldval & ~mask; 891 863 newval |= priv->smstpcr_saved[reg].val & mask; 892 864 if (newval == oldval) 893 865 continue; 894 866 895 - if (priv->stbyctrl) { 896 - writeb(newval, priv->base + STBCR(reg)); 867 + if (priv->reg_layout == CLK_REG_LAYOUT_RZ_A) { 868 + writeb(newval, priv->base + priv->control_regs[reg]); 897 869 /* dummy read to ensure write has completed */ 898 - readb(priv->base + STBCR(reg)); 899 - barrier_data(priv->base + STBCR(reg)); 870 + readb(priv->base + priv->control_regs[reg]); 871 + barrier_data(priv->base + priv->control_regs[reg]); 900 872 continue; 901 873 } else 902 - writel(newval, priv->base + SMSTPCR(reg)); 874 + writel(newval, priv->base + priv->control_regs[reg]); 903 875 904 876 /* Wait until enabled clocks are really enabled */ 905 877 mask &= ~priv->smstpcr_saved[reg].val; ··· 907 879 continue; 908 880 909 881 for (i = 1000; i > 0; --i) { 910 - oldval = readl(priv->base + MSTPSR(reg)); 882 + oldval = readl(priv->base + priv->status_regs[reg]); 911 883 if (!(oldval & mask)) 912 884 break; 913 885 cpu_relax(); ··· 915 887 916 888 if (!i) 917 889 dev_warn(dev, "Failed to enable %s%u[0x%x]\n", 918 - priv->stbyctrl ? "STB" : "SMSTP", reg, 919 - oldval & mask); 890 + priv->reg_layout == CLK_REG_LAYOUT_RZ_A ? 891 + "STB" : "SMSTP", reg, oldval & mask); 920 892 } 921 893 922 894 return 0; ··· 965 937 priv->num_mod_clks = info->num_hw_mod_clks; 966 938 priv->last_dt_core_clk = info->last_dt_core_clk; 967 939 RAW_INIT_NOTIFIER_HEAD(&priv->notifiers); 968 - priv->stbyctrl = info->stbyctrl; 940 + priv->reg_layout = info->reg_layout; 941 + if (priv->reg_layout == CLK_REG_LAYOUT_RCAR_GEN2_AND_GEN3) { 942 + priv->status_regs = mstpsr; 943 + priv->control_regs = smstpcr; 944 + priv->reset_regs = srcr; 945 + priv->reset_clear_regs = srstclr; 946 + } else if (priv->reg_layout == CLK_REG_LAYOUT_RZ_A) { 947 + priv->control_regs = stbcr; 948 + } else if (priv->reg_layout == CLK_REG_LAYOUT_RCAR_V3U) { 949 + priv->status_regs = mstpsr_for_v3u; 950 + priv->control_regs = mstpcr_for_v3u; 951 + priv->reset_regs = srcr_for_v3u; 952 + priv->reset_clear_regs = srstclr_for_v3u; 953 + } else { 954 + error = -EINVAL; 955 + goto out_err; 956 + } 969 957 970 958 for (i = 0; i < nclks; i++) 971 959 priv->clks[i] = ERR_PTR(-ENOENT); ··· 1059 1015 return error; 1060 1016 1061 1017 /* Reset Controller not supported for Standby Control SoCs */ 1062 - if (info->stbyctrl) 1018 + if (priv->reg_layout == CLK_REG_LAYOUT_RZ_A) 1063 1019 return 0; 1064 1020 1065 1021 error = cpg_mssr_reset_controller_register(priv);
+9 -5
drivers/clk/renesas/renesas-cpg-mssr.h
··· 85 85 86 86 struct device_node; 87 87 88 + enum clk_reg_layout { 89 + CLK_REG_LAYOUT_RCAR_GEN2_AND_GEN3 = 0, 90 + CLK_REG_LAYOUT_RZ_A, 91 + CLK_REG_LAYOUT_RCAR_V3U, 92 + }; 93 + 88 94 /** 89 95 * SoC-specific CPG/MSSR Description 90 96 * ··· 111 105 * @crit_mod_clks: Array with Module Clock IDs of critical clocks that 112 106 * should not be disabled without a knowledgeable driver 113 107 * @num_crit_mod_clks: Number of entries in crit_mod_clks[] 108 + * @reg_layout: CPG/MSSR register layout from enum clk_reg_layout 114 109 * 115 110 * @core_pm_clks: Array with IDs of Core Clocks that are suitable for Power 116 111 * Management, in addition to Module Clocks ··· 119 112 * 120 113 * @init: Optional callback to perform SoC-specific initialization 121 114 * @cpg_clk_register: Optional callback to handle special Core Clock types 122 - * 123 - * @stbyctrl: This device has Standby Control Registers which are 8-bits 124 - * wide, no status registers (MSTPSR) and have different address 125 - * offsets. 126 115 */ 127 116 128 117 struct cpg_mssr_info { ··· 133 130 unsigned int num_core_clks; 134 131 unsigned int last_dt_core_clk; 135 132 unsigned int num_total_core_clks; 136 - bool stbyctrl; 133 + enum clk_reg_layout reg_layout; 137 134 138 135 /* Module Clocks */ 139 136 const struct mssr_mod_clk *mod_clks; ··· 177 174 extern const struct cpg_mssr_info r8a77980_cpg_mssr_info; 178 175 extern const struct cpg_mssr_info r8a77990_cpg_mssr_info; 179 176 extern const struct cpg_mssr_info r8a77995_cpg_mssr_info; 177 + extern const struct cpg_mssr_info r8a779a0_cpg_mssr_info; 180 178 181 179 void __init cpg_mssr_early_init(struct device_node *np, 182 180 const struct cpg_mssr_info *info);
+78
drivers/clk/rockchip/Kconfig
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + # common clock support for ROCKCHIP SoC family. 3 + 4 + config COMMON_CLK_ROCKCHIP 5 + bool "Rockchip clock controller common support" 6 + depends on ARCH_ROCKCHIP 7 + default ARCH_ROCKCHIP 8 + help 9 + Say y here to enable common clock controller for Rockchip platforms. 10 + 11 + if COMMON_CLK_ROCKCHIP 12 + config CLK_PX30 13 + bool "Rockchip PX30 clock controller support" 14 + default y 15 + help 16 + Build the driver for PX30 Clock Driver. 17 + 18 + config CLK_RV110X 19 + bool "Rockchip RV110x clock controller support" 20 + default y 21 + help 22 + Build the driver for RV110x Clock Driver. 23 + 24 + config CLK_RK3036 25 + bool "Rockchip RK3036 clock controller support" 26 + default y 27 + help 28 + Build the driver for RK3036 Clock Driver. 29 + 30 + config CLK_RK312X 31 + bool "Rockchip RK312x clock controller support" 32 + default y 33 + help 34 + Build the driver for RK312x Clock Driver. 35 + 36 + config CLK_RK3188 37 + bool "Rockchip RK3188 clock controller support" 38 + default y 39 + help 40 + Build the driver for RK3188 Clock Driver. 41 + 42 + config CLK_RK322X 43 + bool "Rockchip RK322x clock controller support" 44 + default y 45 + help 46 + Build the driver for RK322x Clock Driver. 47 + 48 + config CLK_RK3288 49 + bool "Rockchip RK3288 clock controller support" 50 + depends on ARM 51 + default y 52 + help 53 + Build the driver for RK3288 Clock Driver. 54 + 55 + config CLK_RK3308 56 + bool "Rockchip RK3308 clock controller support" 57 + default y 58 + help 59 + Build the driver for RK3308 Clock Driver. 60 + 61 + config CLK_RK3328 62 + bool "Rockchip RK3328 clock controller support" 63 + default y 64 + help 65 + Build the driver for RK3328 Clock Driver. 66 + 67 + config CLK_RK3368 68 + bool "Rockchip RK3368 clock controller support" 69 + default y 70 + help 71 + Build the driver for RK3368 Clock Driver. 72 + 73 + config CLK_RK3399 74 + tristate "Rockchip RK3399 clock controller support" 75 + default y 76 + help 77 + Build the driver for RK3399 Clock Driver. 78 + endif
+22 -20
drivers/clk/rockchip/Makefile
··· 3 3 # Rockchip Clock specific Makefile 4 4 # 5 5 6 - obj-y += clk.o 7 - obj-y += clk-pll.o 8 - obj-y += clk-cpu.o 9 - obj-y += clk-half-divider.o 10 - obj-y += clk-inverter.o 11 - obj-y += clk-mmc-phase.o 12 - obj-y += clk-muxgrf.o 13 - obj-y += clk-ddr.o 14 - obj-$(CONFIG_RESET_CONTROLLER) += softrst.o 6 + obj-$(CONFIG_COMMON_CLK_ROCKCHIP) += clk-rockchip.o 15 7 16 - obj-y += clk-px30.o 17 - obj-y += clk-rv1108.o 18 - obj-y += clk-rk3036.o 19 - obj-y += clk-rk3128.o 20 - obj-y += clk-rk3188.o 21 - obj-y += clk-rk3228.o 22 - obj-y += clk-rk3288.o 23 - obj-y += clk-rk3308.o 24 - obj-y += clk-rk3328.o 25 - obj-y += clk-rk3368.o 26 - obj-y += clk-rk3399.o 8 + clk-rockchip-y += clk.o 9 + clk-rockchip-y += clk-pll.o 10 + clk-rockchip-y += clk-cpu.o 11 + clk-rockchip-y += clk-half-divider.o 12 + clk-rockchip-y += clk-inverter.o 13 + clk-rockchip-y += clk-mmc-phase.o 14 + clk-rockchip-y += clk-muxgrf.o 15 + clk-rockchip-y += clk-ddr.o 16 + clk-rockchip-$(CONFIG_RESET_CONTROLLER) += softrst.o 17 + 18 + obj-$(CONFIG_CLK_PX30) += clk-px30.o 19 + obj-$(CONFIG_CLK_RV110X) += clk-rv1108.o 20 + obj-$(CONFIG_CLK_RK3036) += clk-rk3036.o 21 + obj-$(CONFIG_CLK_RK312X) += clk-rk3128.o 22 + obj-$(CONFIG_CLK_RK3188) += clk-rk3188.o 23 + obj-$(CONFIG_CLK_RK322X) += clk-rk3228.o 24 + obj-$(CONFIG_CLK_RK3288) += clk-rk3288.o 25 + obj-$(CONFIG_CLK_RK3308) += clk-rk3308.o 26 + obj-$(CONFIG_CLK_RK3328) += clk-rk3328.o 27 + obj-$(CONFIG_CLK_RK3368) += clk-rk3368.o 28 + obj-$(CONFIG_CLK_RK3399) += clk-rk3399.o
+1
drivers/clk/rockchip/clk-ddr.c
··· 136 136 137 137 return clk; 138 138 } 139 + EXPORT_SYMBOL_GPL(rockchip_clk_register_ddrclk);
+10 -8
drivers/clk/rockchip/clk-half-divider.c
··· 166 166 unsigned long flags, 167 167 spinlock_t *lock) 168 168 { 169 - struct clk *clk; 169 + struct clk_hw *hw = ERR_PTR(-ENOMEM); 170 170 struct clk_mux *mux = NULL; 171 171 struct clk_gate *gate = NULL; 172 172 struct clk_divider *div = NULL; ··· 212 212 div_ops = &clk_half_divider_ops; 213 213 } 214 214 215 - clk = clk_register_composite(NULL, name, parent_names, num_parents, 216 - mux ? &mux->hw : NULL, mux_ops, 217 - div ? &div->hw : NULL, div_ops, 218 - gate ? &gate->hw : NULL, gate_ops, 219 - flags); 215 + hw = clk_hw_register_composite(NULL, name, parent_names, num_parents, 216 + mux ? &mux->hw : NULL, mux_ops, 217 + div ? &div->hw : NULL, div_ops, 218 + gate ? &gate->hw : NULL, gate_ops, 219 + flags); 220 + if (IS_ERR(hw)) 221 + goto err_div; 220 222 221 - return clk; 223 + return hw->clk; 222 224 err_div: 223 225 kfree(gate); 224 226 err_gate: 225 227 kfree(mux); 226 - return ERR_PTR(-ENOMEM); 228 + return ERR_CAST(hw); 227 229 }
-1
drivers/clk/rockchip/clk-rk3308.c
··· 133 133 PNAME(mux_uart2_p) = { "clk_uart2_src", "dummy", "clk_uart2_frac" }; 134 134 PNAME(mux_uart3_p) = { "clk_uart3_src", "dummy", "clk_uart3_frac" }; 135 135 PNAME(mux_uart4_p) = { "clk_uart4_src", "dummy", "clk_uart4_frac" }; 136 - PNAME(mux_timer_src_p) = { "xin24m", "clk_rtc32k" }; 137 136 PNAME(mux_dclk_vop_p) = { "dclk_vop_src", "dclk_vop_frac", "xin24m" }; 138 137 PNAME(mux_nandc_p) = { "clk_nandc_div", "clk_nandc_div50" }; 139 138 PNAME(mux_sdmmc_p) = { "clk_sdmmc_div", "clk_sdmmc_div50" };
+56
drivers/clk/rockchip/clk-rk3399.c
··· 5 5 */ 6 6 7 7 #include <linux/clk-provider.h> 8 + #include <linux/module.h> 8 9 #include <linux/io.h> 9 10 #include <linux/of.h> 10 11 #include <linux/of_address.h> 12 + #include <linux/of_device.h> 11 13 #include <linux/platform_device.h> 12 14 #include <linux/regmap.h> 13 15 #include <dt-bindings/clock/rk3399-cru.h> ··· 1602 1600 rockchip_clk_of_add_provider(np, ctx); 1603 1601 } 1604 1602 CLK_OF_DECLARE(rk3399_cru_pmu, "rockchip,rk3399-pmucru", rk3399_pmu_clk_init); 1603 + 1604 + struct clk_rk3399_inits { 1605 + void (*inits)(struct device_node *np); 1606 + }; 1607 + 1608 + static const struct clk_rk3399_inits clk_rk3399_pmucru_init = { 1609 + .inits = rk3399_pmu_clk_init, 1610 + }; 1611 + 1612 + static const struct clk_rk3399_inits clk_rk3399_cru_init = { 1613 + .inits = rk3399_clk_init, 1614 + }; 1615 + 1616 + static const struct of_device_id clk_rk3399_match_table[] = { 1617 + { 1618 + .compatible = "rockchip,rk3399-cru", 1619 + .data = &clk_rk3399_cru_init, 1620 + }, { 1621 + .compatible = "rockchip,rk3399-pmucru", 1622 + .data = &clk_rk3399_pmucru_init, 1623 + }, 1624 + { } 1625 + }; 1626 + MODULE_DEVICE_TABLE(of, clk_rk3399_match_table); 1627 + 1628 + static int __init clk_rk3399_probe(struct platform_device *pdev) 1629 + { 1630 + struct device_node *np = pdev->dev.of_node; 1631 + const struct of_device_id *match; 1632 + const struct clk_rk3399_inits *init_data; 1633 + 1634 + match = of_match_device(clk_rk3399_match_table, &pdev->dev); 1635 + if (!match || !match->data) 1636 + return -EINVAL; 1637 + 1638 + init_data = match->data; 1639 + if (init_data->inits) 1640 + init_data->inits(np); 1641 + 1642 + return 0; 1643 + } 1644 + 1645 + static struct platform_driver clk_rk3399_driver = { 1646 + .driver = { 1647 + .name = "clk-rk3399", 1648 + .of_match_table = clk_rk3399_match_table, 1649 + .suppress_bind_attrs = true, 1650 + }, 1651 + }; 1652 + builtin_platform_driver_probe(clk_rk3399_driver, clk_rk3399_probe); 1653 + 1654 + MODULE_DESCRIPTION("Rockchip RK3399 Clock Driver"); 1655 + MODULE_LICENSE("GPL"); 1656 + MODULE_ALIAS("platform:clk-rk3399");
+59 -52
drivers/clk/rockchip/clk.c
··· 43 43 u8 gate_shift, u8 gate_flags, unsigned long flags, 44 44 spinlock_t *lock) 45 45 { 46 - struct clk *clk; 46 + struct clk_hw *hw; 47 47 struct clk_mux *mux = NULL; 48 48 struct clk_gate *gate = NULL; 49 49 struct clk_divider *div = NULL; ··· 100 100 : &clk_divider_ops; 101 101 } 102 102 103 - clk = clk_register_composite(NULL, name, parent_names, num_parents, 104 - mux ? &mux->hw : NULL, mux_ops, 105 - div ? &div->hw : NULL, div_ops, 106 - gate ? &gate->hw : NULL, gate_ops, 107 - flags); 108 - 109 - if (IS_ERR(clk)) { 110 - ret = PTR_ERR(clk); 111 - goto err_composite; 103 + hw = clk_hw_register_composite(NULL, name, parent_names, num_parents, 104 + mux ? &mux->hw : NULL, mux_ops, 105 + div ? &div->hw : NULL, div_ops, 106 + gate ? &gate->hw : NULL, gate_ops, 107 + flags); 108 + if (IS_ERR(hw)) { 109 + kfree(div); 110 + kfree(gate); 111 + return ERR_CAST(hw); 112 112 } 113 113 114 - return clk; 115 - err_composite: 116 - kfree(div); 114 + return hw->clk; 117 115 err_div: 118 116 kfree(gate); 119 117 err_gate: ··· 212 214 unsigned long flags, struct rockchip_clk_branch *child, 213 215 spinlock_t *lock) 214 216 { 217 + struct clk_hw *hw; 215 218 struct rockchip_clk_frac *frac; 216 - struct clk *clk; 217 219 struct clk_gate *gate = NULL; 218 220 struct clk_fractional_divider *div = NULL; 219 221 const struct clk_ops *div_ops = NULL, *gate_ops = NULL; ··· 253 255 div->approximation = rockchip_fractional_approximation; 254 256 div_ops = &clk_fractional_divider_ops; 255 257 256 - clk = clk_register_composite(NULL, name, parent_names, num_parents, 257 - NULL, NULL, 258 - &div->hw, div_ops, 259 - gate ? &gate->hw : NULL, gate_ops, 260 - flags | CLK_SET_RATE_UNGATE); 261 - if (IS_ERR(clk)) { 258 + hw = clk_hw_register_composite(NULL, name, parent_names, num_parents, 259 + NULL, NULL, 260 + &div->hw, div_ops, 261 + gate ? &gate->hw : NULL, gate_ops, 262 + flags | CLK_SET_RATE_UNGATE); 263 + if (IS_ERR(hw)) { 262 264 kfree(frac); 263 - return clk; 265 + return ERR_CAST(hw); 264 266 } 265 267 266 268 if (child) { ··· 290 292 mux_clk = clk_register(NULL, &frac_mux->hw); 291 293 if (IS_ERR(mux_clk)) { 292 294 kfree(frac); 293 - return clk; 295 + return mux_clk; 294 296 } 295 297 296 298 rockchip_clk_add_lookup(ctx, mux_clk, child->id); ··· 299 301 if (frac->mux_frac_idx >= 0) { 300 302 pr_debug("%s: found fractional parent in mux at pos %d\n", 301 303 __func__, frac->mux_frac_idx); 302 - ret = clk_notifier_register(clk, &frac->clk_nb); 304 + ret = clk_notifier_register(hw->clk, &frac->clk_nb); 303 305 if (ret) 304 306 pr_err("%s: failed to register clock notifier for %s\n", 305 307 __func__, name); ··· 309 311 } 310 312 } 311 313 312 - return clk; 314 + return hw->clk; 313 315 } 314 316 315 317 static struct clk *rockchip_clk_register_factor_branch(const char *name, ··· 318 320 int gate_offset, u8 gate_shift, u8 gate_flags, 319 321 unsigned long flags, spinlock_t *lock) 320 322 { 321 - struct clk *clk; 323 + struct clk_hw *hw; 322 324 struct clk_gate *gate = NULL; 323 325 struct clk_fixed_factor *fix = NULL; 324 326 ··· 347 349 fix->mult = mult; 348 350 fix->div = div; 349 351 350 - clk = clk_register_composite(NULL, name, parent_names, num_parents, 351 - NULL, NULL, 352 - &fix->hw, &clk_fixed_factor_ops, 353 - &gate->hw, &clk_gate_ops, flags); 354 - if (IS_ERR(clk)) { 352 + hw = clk_hw_register_composite(NULL, name, parent_names, num_parents, 353 + NULL, NULL, 354 + &fix->hw, &clk_fixed_factor_ops, 355 + &gate->hw, &clk_gate_ops, flags); 356 + if (IS_ERR(hw)) { 355 357 kfree(fix); 356 358 kfree(gate); 359 + return ERR_CAST(hw); 357 360 } 358 361 359 - return clk; 362 + return hw->clk; 360 363 } 361 364 362 - struct rockchip_clk_provider * __init rockchip_clk_init(struct device_node *np, 363 - void __iomem *base, unsigned long nr_clks) 365 + struct rockchip_clk_provider *rockchip_clk_init(struct device_node *np, 366 + void __iomem *base, 367 + unsigned long nr_clks) 364 368 { 365 369 struct rockchip_clk_provider *ctx; 366 370 struct clk **clk_table; ··· 394 394 kfree(ctx); 395 395 return ERR_PTR(-ENOMEM); 396 396 } 397 + EXPORT_SYMBOL_GPL(rockchip_clk_init); 397 398 398 - void __init rockchip_clk_of_add_provider(struct device_node *np, 399 - struct rockchip_clk_provider *ctx) 399 + void rockchip_clk_of_add_provider(struct device_node *np, 400 + struct rockchip_clk_provider *ctx) 400 401 { 401 402 if (of_clk_add_provider(np, of_clk_src_onecell_get, 402 403 &ctx->clk_data)) 403 404 pr_err("%s: could not register clk provider\n", __func__); 404 405 } 406 + EXPORT_SYMBOL_GPL(rockchip_clk_of_add_provider); 405 407 406 408 void rockchip_clk_add_lookup(struct rockchip_clk_provider *ctx, 407 409 struct clk *clk, unsigned int id) ··· 411 409 if (ctx->clk_data.clks && id) 412 410 ctx->clk_data.clks[id] = clk; 413 411 } 412 + EXPORT_SYMBOL_GPL(rockchip_clk_add_lookup); 414 413 415 - void __init rockchip_clk_register_plls(struct rockchip_clk_provider *ctx, 414 + void rockchip_clk_register_plls(struct rockchip_clk_provider *ctx, 416 415 struct rockchip_pll_clock *list, 417 416 unsigned int nr_pll, int grf_lock_offset) 418 417 { ··· 436 433 rockchip_clk_add_lookup(ctx, clk, list->id); 437 434 } 438 435 } 436 + EXPORT_SYMBOL_GPL(rockchip_clk_register_plls); 439 437 440 - void __init rockchip_clk_register_branches( 441 - struct rockchip_clk_provider *ctx, 442 - struct rockchip_clk_branch *list, 443 - unsigned int nr_clk) 438 + void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx, 439 + struct rockchip_clk_branch *list, 440 + unsigned int nr_clk) 444 441 { 445 442 struct clk *clk = NULL; 446 443 unsigned int idx; ··· 569 566 rockchip_clk_add_lookup(ctx, clk, list->id); 570 567 } 571 568 } 569 + EXPORT_SYMBOL_GPL(rockchip_clk_register_branches); 572 570 573 - void __init rockchip_clk_register_armclk(struct rockchip_clk_provider *ctx, 574 - unsigned int lookup_id, 575 - const char *name, const char *const *parent_names, 576 - u8 num_parents, 577 - const struct rockchip_cpuclk_reg_data *reg_data, 578 - const struct rockchip_cpuclk_rate_table *rates, 579 - int nrates) 571 + void rockchip_clk_register_armclk(struct rockchip_clk_provider *ctx, 572 + unsigned int lookup_id, 573 + const char *name, const char *const *parent_names, 574 + u8 num_parents, 575 + const struct rockchip_cpuclk_reg_data *reg_data, 576 + const struct rockchip_cpuclk_rate_table *rates, 577 + int nrates) 580 578 { 581 579 struct clk *clk; 582 580 ··· 592 588 593 589 rockchip_clk_add_lookup(ctx, clk, lookup_id); 594 590 } 591 + EXPORT_SYMBOL_GPL(rockchip_clk_register_armclk); 595 592 596 - void __init rockchip_clk_protect_critical(const char *const clocks[], 597 - int nclocks) 593 + void rockchip_clk_protect_critical(const char *const clocks[], 594 + int nclocks) 598 595 { 599 596 int i; 600 597 ··· 607 602 clk_prepare_enable(clk); 608 603 } 609 604 } 605 + EXPORT_SYMBOL_GPL(rockchip_clk_protect_critical); 610 606 611 607 static void __iomem *rst_base; 612 608 static unsigned int reg_restart; ··· 627 621 .priority = 128, 628 622 }; 629 623 630 - void __init 624 + void 631 625 rockchip_register_restart_notifier(struct rockchip_clk_provider *ctx, 632 - unsigned int reg, 633 - void (*cb)(void)) 626 + unsigned int reg, 627 + void (*cb)(void)) 634 628 { 635 629 int ret; 636 630 ··· 642 636 pr_err("%s: cannot register restart handler, %d\n", 643 637 __func__, ret); 644 638 } 639 + EXPORT_SYMBOL_GPL(rockchip_register_restart_notifier);
+4 -3
drivers/clk/rockchip/softrst.c
··· 77 77 .deassert = rockchip_softrst_deassert, 78 78 }; 79 79 80 - void __init rockchip_register_softrst(struct device_node *np, 81 - unsigned int num_regs, 82 - void __iomem *base, u8 flags) 80 + void rockchip_register_softrst(struct device_node *np, 81 + unsigned int num_regs, 82 + void __iomem *base, u8 flags) 83 83 { 84 84 struct rockchip_softrst *softrst; 85 85 int ret; ··· 107 107 kfree(softrst); 108 108 } 109 109 }; 110 + EXPORT_SYMBOL_GPL(rockchip_register_softrst);
+15 -22
drivers/clk/samsung/clk-cpu.c
··· 401 401 402 402 /* helper function to register a CPU clock */ 403 403 int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx, 404 - unsigned int lookup_id, const char *name, const char *parent, 405 - const char *alt_parent, unsigned long offset, 406 - const struct exynos_cpuclk_cfg_data *cfg, 404 + unsigned int lookup_id, const char *name, 405 + const struct clk_hw *parent, const struct clk_hw *alt_parent, 406 + unsigned long offset, const struct exynos_cpuclk_cfg_data *cfg, 407 407 unsigned long num_cfgs, unsigned long flags) 408 408 { 409 409 struct exynos_cpuclk *cpuclk; 410 410 struct clk_init_data init; 411 - struct clk *parent_clk; 411 + const char *parent_name; 412 412 int ret = 0; 413 + 414 + if (IS_ERR(parent) || IS_ERR(alt_parent)) { 415 + pr_err("%s: invalid parent clock(s)\n", __func__); 416 + return -EINVAL; 417 + } 413 418 414 419 cpuclk = kzalloc(sizeof(*cpuclk), GFP_KERNEL); 415 420 if (!cpuclk) 416 421 return -ENOMEM; 417 422 423 + parent_name = clk_hw_get_name(parent); 424 + 418 425 init.name = name; 419 426 init.flags = CLK_SET_RATE_PARENT; 420 - init.parent_names = &parent; 427 + init.parent_names = &parent_name; 421 428 init.num_parents = 1; 422 429 init.ops = &exynos_cpuclk_clk_ops; 423 430 431 + cpuclk->alt_parent = alt_parent; 424 432 cpuclk->hw.init = &init; 425 433 cpuclk->ctrl_base = ctx->reg_base + offset; 426 434 cpuclk->lock = &ctx->lock; ··· 438 430 else 439 431 cpuclk->clk_nb.notifier_call = exynos_cpuclk_notifier_cb; 440 432 441 - cpuclk->alt_parent = __clk_get_hw(__clk_lookup(alt_parent)); 442 - if (!cpuclk->alt_parent) { 443 - pr_err("%s: could not lookup alternate parent %s\n", 444 - __func__, alt_parent); 445 - ret = -EINVAL; 446 - goto free_cpuclk; 447 - } 448 433 449 - parent_clk = __clk_lookup(parent); 450 - if (!parent_clk) { 451 - pr_err("%s: could not lookup parent clock %s\n", 452 - __func__, parent); 453 - ret = -EINVAL; 454 - goto free_cpuclk; 455 - } 456 - 457 - ret = clk_notifier_register(parent_clk, &cpuclk->clk_nb); 434 + ret = clk_notifier_register(parent->clk, &cpuclk->clk_nb); 458 435 if (ret) { 459 436 pr_err("%s: failed to register clock notifier for %s\n", 460 437 __func__, name); ··· 464 471 free_cpuclk_data: 465 472 kfree(cpuclk->cfg); 466 473 unregister_clk_nb: 467 - clk_notifier_unregister(parent_clk, &cpuclk->clk_nb); 474 + clk_notifier_unregister(parent->clk, &cpuclk->clk_nb); 468 475 free_cpuclk: 469 476 kfree(cpuclk); 470 477 return ret;
+3 -3
drivers/clk/samsung/clk-cpu.h
··· 46 46 */ 47 47 struct exynos_cpuclk { 48 48 struct clk_hw hw; 49 - struct clk_hw *alt_parent; 49 + const struct clk_hw *alt_parent; 50 50 void __iomem *ctrl_base; 51 51 spinlock_t *lock; 52 52 const struct exynos_cpuclk_cfg_data *cfg; ··· 62 62 #define CLK_CPU_HAS_E5433_REGS_LAYOUT (1 << 2) 63 63 }; 64 64 65 - extern int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx, 65 + int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx, 66 66 unsigned int lookup_id, const char *name, 67 - const char *parent, const char *alt_parent, 67 + const struct clk_hw *parent, const struct clk_hw *alt_parent, 68 68 unsigned long offset, 69 69 const struct exynos_cpuclk_cfg_data *cfg, 70 70 unsigned long num_cfgs, unsigned long flags);
+4 -2
drivers/clk/samsung/clk-exynos3250.c
··· 808 808 static void __init exynos3250_cmu_init(struct device_node *np) 809 809 { 810 810 struct samsung_clk_provider *ctx; 811 + struct clk_hw **hws; 811 812 812 813 ctx = samsung_cmu_register_one(np, &cmu_info); 813 814 if (!ctx) 814 815 return; 815 816 817 + hws = ctx->clk_data.hws; 816 818 exynos_register_cpu_clock(ctx, CLK_ARM_CLK, "armclk", 817 - mout_core_p[0], mout_core_p[1], 0x14200, 818 - e3250_armclk_d, ARRAY_SIZE(e3250_armclk_d), 819 + hws[CLK_MOUT_APLL], hws[CLK_MOUT_MPLL_USER_C], 820 + 0x14200, e3250_armclk_d, ARRAY_SIZE(e3250_armclk_d), 819 821 CLK_CPU_HAS_DIV1); 820 822 821 823 exynos3_core_down_clock(ctx->reg_base);
+5 -2
drivers/clk/samsung/clk-exynos4.c
··· 1233 1233 enum exynos4_soc soc) 1234 1234 { 1235 1235 struct samsung_clk_provider *ctx; 1236 + struct clk_hw **hws; 1237 + 1236 1238 exynos4_soc = soc; 1237 1239 1238 1240 reg_base = of_iomap(np, 0); ··· 1242 1240 panic("%s: failed to map registers\n", __func__); 1243 1241 1244 1242 ctx = samsung_clk_init(np, reg_base, CLK_NR_CLKS); 1243 + hws = ctx->clk_data.hws; 1245 1244 1246 1245 samsung_clk_of_register_fixed_ext(ctx, exynos4_fixed_rate_ext_clks, 1247 1246 ARRAY_SIZE(exynos4_fixed_rate_ext_clks), ··· 1305 1302 exynos4210_fixed_factor_clks, 1306 1303 ARRAY_SIZE(exynos4210_fixed_factor_clks)); 1307 1304 exynos_register_cpu_clock(ctx, CLK_ARM_CLK, "armclk", 1308 - mout_core_p4210[0], mout_core_p4210[1], 0x14200, 1305 + hws[CLK_MOUT_APLL], hws[CLK_SCLK_MPLL], 0x14200, 1309 1306 e4210_armclk_d, ARRAY_SIZE(e4210_armclk_d), 1310 1307 CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1); 1311 1308 } else { ··· 1320 1317 ARRAY_SIZE(exynos4x12_fixed_factor_clks)); 1321 1318 1322 1319 exynos_register_cpu_clock(ctx, CLK_ARM_CLK, "armclk", 1323 - mout_core_p4x12[0], mout_core_p4x12[1], 0x14200, 1320 + hws[CLK_MOUT_APLL], hws[CLK_MOUT_MPLL_USER_C], 0x14200, 1324 1321 e4412_armclk_d, ARRAY_SIZE(e4412_armclk_d), 1325 1322 CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1); 1326 1323 }
+5 -3
drivers/clk/samsung/clk-exynos5250.c
··· 253 253 /* 254 254 * CMU_CPU 255 255 */ 256 - MUX_F(0, "mout_apll", mout_apll_p, SRC_CPU, 0, 1, 256 + MUX_F(CLK_MOUT_APLL, "mout_apll", mout_apll_p, SRC_CPU, 0, 1, 257 257 CLK_SET_RATE_PARENT, 0), 258 258 MUX(0, "mout_cpu", mout_cpu_p, SRC_CPU, 16, 1), 259 259 260 260 /* 261 261 * CMU_CORE 262 262 */ 263 - MUX(0, "mout_mpll", mout_mpll_p, SRC_CORE1, 8, 1), 263 + MUX(CLK_MOUT_MPLL, "mout_mpll", mout_mpll_p, SRC_CORE1, 8, 1), 264 264 265 265 /* 266 266 * CMU_TOP ··· 782 782 { 783 783 struct samsung_clk_provider *ctx; 784 784 unsigned int tmp; 785 + struct clk_hw **hws; 785 786 786 787 if (np) { 787 788 reg_base = of_iomap(np, 0); ··· 793 792 } 794 793 795 794 ctx = samsung_clk_init(np, reg_base, CLK_NR_CLKS); 795 + hws = ctx->clk_data.hws; 796 796 797 797 samsung_clk_of_register_fixed_ext(ctx, exynos5250_fixed_rate_ext_clks, 798 798 ARRAY_SIZE(exynos5250_fixed_rate_ext_clks), ··· 823 821 samsung_clk_register_gate(ctx, exynos5250_gate_clks, 824 822 ARRAY_SIZE(exynos5250_gate_clks)); 825 823 exynos_register_cpu_clock(ctx, CLK_ARM_CLK, "armclk", 826 - mout_cpu_p[0], mout_cpu_p[1], 0x200, 824 + hws[CLK_MOUT_APLL], hws[CLK_MOUT_MPLL], 0x200, 827 825 exynos5250_armclk_d, ARRAY_SIZE(exynos5250_armclk_d), 828 826 CLK_CPU_HAS_DIV1); 829 827
+15 -12
drivers/clk/samsung/clk-exynos5420.c
··· 596 596 static const struct samsung_mux_clock exynos5x_mux_clks[] __initconst = { 597 597 MUX(0, "mout_user_pclk66_gpio", mout_user_pclk66_gpio_p, 598 598 SRC_TOP7, 4, 1), 599 - MUX(0, "mout_mspll_kfc", mout_mspll_cpu_p, SRC_TOP7, 8, 2), 600 - MUX(0, "mout_mspll_cpu", mout_mspll_cpu_p, SRC_TOP7, 12, 2), 601 - 602 - MUX_F(0, "mout_apll", mout_apll_p, SRC_CPU, 0, 1, 599 + MUX(CLK_MOUT_MSPLL_KFC, "mout_mspll_kfc", mout_mspll_cpu_p, 600 + SRC_TOP7, 8, 2), 601 + MUX(CLK_MOUT_MSPLL_CPU, "mout_mspll_cpu", mout_mspll_cpu_p, 602 + SRC_TOP7, 12, 2), 603 + MUX_F(CLK_MOUT_APLL, "mout_apll", mout_apll_p, SRC_CPU, 0, 1, 603 604 CLK_SET_RATE_PARENT | CLK_RECALC_NEW_RATES, 0), 604 605 MUX(0, "mout_cpu", mout_cpu_p, SRC_CPU, 16, 1), 605 - MUX_F(0, "mout_kpll", mout_kpll_p, SRC_KFC, 0, 1, 606 + MUX_F(CLK_MOUT_KPLL, "mout_kpll", mout_kpll_p, SRC_KFC, 0, 1, 606 607 CLK_SET_RATE_PARENT | CLK_RECALC_NEW_RATES, 0), 607 608 MUX(0, "mout_kfc", mout_kfc_p, SRC_KFC, 16, 1), 608 609 ··· 713 712 SRC_TOP12, 8, 1), 714 713 MUX(0, "mout_sw_aclk266_g2d", mout_sw_aclk266_g2d_p, 715 714 SRC_TOP12, 12, 1), 716 - MUX_F(0, "mout_sw_aclk_g3d", mout_sw_aclk_g3d_p, SRC_TOP12, 16, 1, 717 - CLK_SET_RATE_PARENT, 0), 715 + MUX_F(CLK_MOUT_SW_ACLK_G3D, "mout_sw_aclk_g3d", mout_sw_aclk_g3d_p, 716 + SRC_TOP12, 16, 1, CLK_SET_RATE_PARENT, 0), 718 717 MUX(0, "mout_sw_aclk300_jpeg", mout_sw_aclk300_jpeg_p, 719 718 SRC_TOP12, 20, 1), 720 719 MUX(CLK_MOUT_SW_ACLK300, "mout_sw_aclk300_disp1", ··· 1561 1560 enum exynos5x_soc soc) 1562 1561 { 1563 1562 struct samsung_clk_provider *ctx; 1563 + struct clk_hw **hws; 1564 1564 1565 1565 if (np) { 1566 1566 reg_base = of_iomap(np, 0); ··· 1574 1572 exynos5x_soc = soc; 1575 1573 1576 1574 ctx = samsung_clk_init(np, reg_base, CLK_NR_CLKS); 1575 + hws = ctx->clk_data.hws; 1577 1576 1578 1577 samsung_clk_of_register_fixed_ext(ctx, exynos5x_fixed_rate_ext_clks, 1579 1578 ARRAY_SIZE(exynos5x_fixed_rate_ext_clks), ··· 1626 1623 1627 1624 if (soc == EXYNOS5420) { 1628 1625 exynos_register_cpu_clock(ctx, CLK_ARM_CLK, "armclk", 1629 - mout_cpu_p[0], mout_cpu_p[1], 0x200, 1626 + hws[CLK_MOUT_APLL], hws[CLK_MOUT_MSPLL_CPU], 0x200, 1630 1627 exynos5420_eglclk_d, ARRAY_SIZE(exynos5420_eglclk_d), 0); 1631 1628 } else { 1632 1629 exynos_register_cpu_clock(ctx, CLK_ARM_CLK, "armclk", 1633 - mout_cpu_p[0], mout_cpu_p[1], 0x200, 1630 + hws[CLK_MOUT_APLL], hws[CLK_MOUT_MSPLL_CPU], 0x200, 1634 1631 exynos5800_eglclk_d, ARRAY_SIZE(exynos5800_eglclk_d), 0); 1635 1632 } 1636 1633 exynos_register_cpu_clock(ctx, CLK_KFC_CLK, "kfcclk", 1637 - mout_kfc_p[0], mout_kfc_p[1], 0x28200, 1634 + hws[CLK_MOUT_KPLL], hws[CLK_MOUT_MSPLL_KFC], 0x28200, 1638 1635 exynos5420_kfcclk_d, ARRAY_SIZE(exynos5420_kfcclk_d), 0); 1639 1636 1640 1637 samsung_clk_extended_sleep_init(reg_base, ··· 1657 1654 * that the internal busses get their clock regardless of the 1658 1655 * main G3D clock enablement status. 1659 1656 */ 1660 - clk_prepare_enable(__clk_lookup("mout_sw_aclk_g3d")); 1657 + clk_prepare_enable(hws[CLK_MOUT_SW_ACLK_G3D]->clk); 1661 1658 /* 1662 1659 * Keep top BPLL mux enabled permanently to ensure that DRAM operates 1663 1660 * properly. 1664 1661 */ 1665 - clk_prepare_enable(__clk_lookup("mout_bpll")); 1662 + clk_prepare_enable(hws[CLK_MOUT_BPLL]->clk); 1666 1663 1667 1664 samsung_clk_of_add_provider(np, ctx); 1668 1665 }
+8 -2
drivers/clk/samsung/clk-exynos5433.c
··· 3679 3679 { 3680 3680 void __iomem *reg_base; 3681 3681 struct samsung_clk_provider *ctx; 3682 + struct clk_hw **hws; 3682 3683 3683 3684 reg_base = of_iomap(np, 0); 3684 3685 if (!reg_base) { ··· 3702 3701 samsung_clk_register_gate(ctx, apollo_gate_clks, 3703 3702 ARRAY_SIZE(apollo_gate_clks)); 3704 3703 3704 + hws = ctx->clk_data.hws; 3705 + 3705 3706 exynos_register_cpu_clock(ctx, CLK_SCLK_APOLLO, "apolloclk", 3706 - mout_apollo_p[0], mout_apollo_p[1], 0x200, 3707 + hws[CLK_MOUT_APOLLO_PLL], hws[CLK_MOUT_BUS_PLL_APOLLO_USER], 0x200, 3707 3708 exynos5433_apolloclk_d, ARRAY_SIZE(exynos5433_apolloclk_d), 3708 3709 CLK_CPU_HAS_E5433_REGS_LAYOUT); 3709 3710 ··· 3936 3933 { 3937 3934 void __iomem *reg_base; 3938 3935 struct samsung_clk_provider *ctx; 3936 + struct clk_hw **hws; 3939 3937 3940 3938 reg_base = of_iomap(np, 0); 3941 3939 if (!reg_base) { ··· 3959 3955 samsung_clk_register_gate(ctx, atlas_gate_clks, 3960 3956 ARRAY_SIZE(atlas_gate_clks)); 3961 3957 3958 + hws = ctx->clk_data.hws; 3959 + 3962 3960 exynos_register_cpu_clock(ctx, CLK_SCLK_ATLAS, "atlasclk", 3963 - mout_atlas_p[0], mout_atlas_p[1], 0x200, 3961 + hws[CLK_MOUT_ATLAS_PLL], hws[CLK_MOUT_BUS_PLL_ATLAS_USER], 0x200, 3964 3962 exynos5433_atlasclk_d, ARRAY_SIZE(exynos5433_atlasclk_d), 3965 3963 CLK_CPU_HAS_E5433_REGS_LAYOUT); 3966 3964
+1 -1
drivers/clk/sirf/clk-prima2.c
··· 134 134 135 135 for (i = pll1; i < maxclk; i++) { 136 136 prima2_clks[i] = clk_register(NULL, prima2_clk_hw_array[i]); 137 - BUG_ON(!prima2_clks[i]); 137 + BUG_ON(IS_ERR(prima2_clks[i])); 138 138 } 139 139 clk_register_clkdev(prima2_clks[cpu], NULL, "cpu"); 140 140 clk_register_clkdev(prima2_clks[io], NULL, "io");
-13
drivers/clk/socfpga/clk-agilex.c
··· 21 21 .name = "f2s-free-clk", }, 22 22 }; 23 23 24 - static const struct clk_parent_data cntr_mux[] = { 25 - { .fw_name = "main_pll", 26 - .name = "main_pll", }, 27 - { .fw_name = "periph_pll", 28 - .name = "periph_pll", }, 29 - { .fw_name = "osc1", 30 - .name = "osc1", }, 31 - { .fw_name = "cb-intosc-hs-div2-clk", 32 - .name = "cb-intosc-hs-div2-clk", }, 33 - { .fw_name = "f2s-free-clk", 34 - .name = "f2s-free-clk", }, 35 - }; 36 - 37 24 static const struct clk_parent_data boot_mux[] = { 38 25 { .fw_name = "osc1", 39 26 .name = "osc1", },
+10
drivers/clk/sunxi-ng/Kconfig
··· 17 17 default ARM64 && ARCH_SUNXI 18 18 depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST 19 19 20 + config SUN50I_A100_CCU 21 + bool "Support for the Allwinner A100 CCU" 22 + default ARM64 && ARCH_SUNXI 23 + depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST 24 + 25 + config SUN50I_A100_R_CCU 26 + bool "Support for the Allwinner A100 PRCM CCU" 27 + default ARM64 && ARCH_SUNXI 28 + depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST 29 + 20 30 config SUN50I_H6_CCU 21 31 bool "Support for the Allwinner H6 CCU" 22 32 default ARM64 && ARCH_SUNXI
+2
drivers/clk/sunxi-ng/Makefile
··· 23 23 # SoC support 24 24 obj-$(CONFIG_SUNIV_F1C100S_CCU) += ccu-suniv-f1c100s.o 25 25 obj-$(CONFIG_SUN50I_A64_CCU) += ccu-sun50i-a64.o 26 + obj-$(CONFIG_SUN50I_A100_CCU) += ccu-sun50i-a100.o 27 + obj-$(CONFIG_SUN50I_A100_R_CCU) += ccu-sun50i-a100-r.o 26 28 obj-$(CONFIG_SUN50I_H6_CCU) += ccu-sun50i-h6.o 27 29 obj-$(CONFIG_SUN50I_H6_R_CCU) += ccu-sun50i-h6-r.o 28 30 obj-$(CONFIG_SUN4I_A10_CCU) += ccu-sun4i-a10.o
+214
drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (c) 2020 Yangtao Li <frank@allwinnertech.com> 4 + */ 5 + 6 + #include <linux/clk-provider.h> 7 + #include <linux/module.h> 8 + #include <linux/of_address.h> 9 + #include <linux/platform_device.h> 10 + 11 + #include "ccu_common.h" 12 + #include "ccu_reset.h" 13 + 14 + #include "ccu_div.h" 15 + #include "ccu_gate.h" 16 + #include "ccu_mp.h" 17 + #include "ccu_nm.h" 18 + 19 + #include "ccu-sun50i-a100-r.h" 20 + 21 + static const char * const cpus_r_apb2_parents[] = { "dcxo24M", "osc32k", 22 + "iosc", "pll-periph0" }; 23 + static const struct ccu_mux_var_prediv cpus_r_apb2_predivs[] = { 24 + { .index = 3, .shift = 0, .width = 5 }, 25 + }; 26 + 27 + static struct ccu_div r_cpus_clk = { 28 + .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 29 + 30 + .mux = { 31 + .shift = 24, 32 + .width = 2, 33 + 34 + .var_predivs = cpus_r_apb2_predivs, 35 + .n_var_predivs = ARRAY_SIZE(cpus_r_apb2_predivs), 36 + }, 37 + 38 + .common = { 39 + .reg = 0x000, 40 + .features = CCU_FEATURE_VARIABLE_PREDIV, 41 + .hw.init = CLK_HW_INIT_PARENTS("cpus", 42 + cpus_r_apb2_parents, 43 + &ccu_div_ops, 44 + 0), 45 + }, 46 + }; 47 + 48 + static CLK_FIXED_FACTOR_HW(r_ahb_clk, "r-ahb", &r_cpus_clk.common.hw, 1, 1, 0); 49 + 50 + static struct ccu_div r_apb1_clk = { 51 + .div = _SUNXI_CCU_DIV(0, 2), 52 + 53 + .common = { 54 + .reg = 0x00c, 55 + .hw.init = CLK_HW_INIT("r-apb1", 56 + "r-ahb", 57 + &ccu_div_ops, 58 + 0), 59 + }, 60 + }; 61 + 62 + static struct ccu_div r_apb2_clk = { 63 + .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 64 + 65 + .mux = { 66 + .shift = 24, 67 + .width = 2, 68 + 69 + .var_predivs = cpus_r_apb2_predivs, 70 + .n_var_predivs = ARRAY_SIZE(cpus_r_apb2_predivs), 71 + }, 72 + 73 + .common = { 74 + .reg = 0x010, 75 + .features = CCU_FEATURE_VARIABLE_PREDIV, 76 + .hw.init = CLK_HW_INIT_PARENTS("r-apb2", 77 + cpus_r_apb2_parents, 78 + &ccu_div_ops, 79 + 0), 80 + }, 81 + }; 82 + 83 + static const struct clk_parent_data clk_parent_r_apb1[] = { 84 + { .hw = &r_apb1_clk.common.hw }, 85 + }; 86 + 87 + static const struct clk_parent_data clk_parent_r_apb2[] = { 88 + { .hw = &r_apb2_clk.common.hw }, 89 + }; 90 + 91 + static SUNXI_CCU_GATE_DATA(r_apb1_timer_clk, "r-apb1-timer", clk_parent_r_apb1, 92 + 0x11c, BIT(0), 0); 93 + 94 + static SUNXI_CCU_GATE_DATA(r_apb1_twd_clk, "r-apb1-twd", clk_parent_r_apb1, 95 + 0x12c, BIT(0), 0); 96 + 97 + static const char * const r_apb1_pwm_clk_parents[] = { "dcxo24M", "osc32k", 98 + "iosc" }; 99 + static SUNXI_CCU_MUX(r_apb1_pwm_clk, "r-apb1-pwm", r_apb1_pwm_clk_parents, 100 + 0x130, 24, 2, 0); 101 + 102 + static SUNXI_CCU_GATE_DATA(r_apb1_bus_pwm_clk, "r-apb1-bus-pwm", 103 + clk_parent_r_apb1, 0x13c, BIT(0), 0); 104 + 105 + static SUNXI_CCU_GATE_DATA(r_apb1_ppu_clk, "r-apb1-ppu", clk_parent_r_apb1, 106 + 0x17c, BIT(0), 0); 107 + 108 + static SUNXI_CCU_GATE_DATA(r_apb2_uart_clk, "r-apb2-uart", clk_parent_r_apb2, 109 + 0x18c, BIT(0), 0); 110 + 111 + static SUNXI_CCU_GATE_DATA(r_apb2_i2c0_clk, "r-apb2-i2c0", clk_parent_r_apb2, 112 + 0x19c, BIT(0), 0); 113 + 114 + static SUNXI_CCU_GATE_DATA(r_apb2_i2c1_clk, "r-apb2-i2c1", clk_parent_r_apb2, 115 + 0x19c, BIT(1), 0); 116 + 117 + static const char * const r_apb1_ir_rx_parents[] = { "osc32k", "dcxo24M" }; 118 + static SUNXI_CCU_MP_WITH_MUX_GATE(r_apb1_ir_rx_clk, "r-apb1-ir-rx", 119 + r_apb1_ir_rx_parents, 0x1c0, 120 + 0, 5, /* M */ 121 + 8, 2, /* P */ 122 + 24, 1, /* mux */ 123 + BIT(31), /* gate */ 124 + 0); 125 + 126 + static SUNXI_CCU_GATE_DATA(r_apb1_bus_ir_rx_clk, "r-apb1-bus-ir-rx", 127 + clk_parent_r_apb1, 0x1cc, BIT(0), 0); 128 + 129 + static SUNXI_CCU_GATE(r_ahb_bus_rtc_clk, "r-ahb-rtc", "r-ahb", 130 + 0x20c, BIT(0), 0); 131 + 132 + static struct ccu_common *sun50i_a100_r_ccu_clks[] = { 133 + &r_cpus_clk.common, 134 + &r_apb1_clk.common, 135 + &r_apb2_clk.common, 136 + &r_apb1_timer_clk.common, 137 + &r_apb1_twd_clk.common, 138 + &r_apb1_pwm_clk.common, 139 + &r_apb1_bus_pwm_clk.common, 140 + &r_apb1_ppu_clk.common, 141 + &r_apb2_uart_clk.common, 142 + &r_apb2_i2c0_clk.common, 143 + &r_apb2_i2c1_clk.common, 144 + &r_apb1_ir_rx_clk.common, 145 + &r_apb1_bus_ir_rx_clk.common, 146 + &r_ahb_bus_rtc_clk.common, 147 + }; 148 + 149 + static struct clk_hw_onecell_data sun50i_a100_r_hw_clks = { 150 + .hws = { 151 + [CLK_R_CPUS] = &r_cpus_clk.common.hw, 152 + [CLK_R_AHB] = &r_ahb_clk.hw, 153 + [CLK_R_APB1] = &r_apb1_clk.common.hw, 154 + [CLK_R_APB2] = &r_apb2_clk.common.hw, 155 + [CLK_R_APB1_TIMER] = &r_apb1_timer_clk.common.hw, 156 + [CLK_R_APB1_TWD] = &r_apb1_twd_clk.common.hw, 157 + [CLK_R_APB1_PWM] = &r_apb1_pwm_clk.common.hw, 158 + [CLK_R_APB1_BUS_PWM] = &r_apb1_bus_pwm_clk.common.hw, 159 + [CLK_R_APB1_PPU] = &r_apb1_ppu_clk.common.hw, 160 + [CLK_R_APB2_UART] = &r_apb2_uart_clk.common.hw, 161 + [CLK_R_APB2_I2C0] = &r_apb2_i2c0_clk.common.hw, 162 + [CLK_R_APB2_I2C1] = &r_apb2_i2c1_clk.common.hw, 163 + [CLK_R_APB1_IR] = &r_apb1_ir_rx_clk.common.hw, 164 + [CLK_R_APB1_BUS_IR] = &r_apb1_bus_ir_rx_clk.common.hw, 165 + [CLK_R_AHB_BUS_RTC] = &r_ahb_bus_rtc_clk.common.hw, 166 + }, 167 + .num = CLK_NUMBER, 168 + }; 169 + 170 + static struct ccu_reset_map sun50i_a100_r_ccu_resets[] = { 171 + [RST_R_APB1_TIMER] = { 0x11c, BIT(16) }, 172 + [RST_R_APB1_BUS_PWM] = { 0x13c, BIT(16) }, 173 + [RST_R_APB1_PPU] = { 0x17c, BIT(16) }, 174 + [RST_R_APB2_UART] = { 0x18c, BIT(16) }, 175 + [RST_R_APB2_I2C0] = { 0x19c, BIT(16) }, 176 + [RST_R_APB2_I2C1] = { 0x19c, BIT(17) }, 177 + [RST_R_APB1_BUS_IR] = { 0x1cc, BIT(16) }, 178 + [RST_R_AHB_BUS_RTC] = { 0x20c, BIT(16) }, 179 + }; 180 + 181 + static const struct sunxi_ccu_desc sun50i_a100_r_ccu_desc = { 182 + .ccu_clks = sun50i_a100_r_ccu_clks, 183 + .num_ccu_clks = ARRAY_SIZE(sun50i_a100_r_ccu_clks), 184 + 185 + .hw_clks = &sun50i_a100_r_hw_clks, 186 + 187 + .resets = sun50i_a100_r_ccu_resets, 188 + .num_resets = ARRAY_SIZE(sun50i_a100_r_ccu_resets), 189 + }; 190 + 191 + static int sun50i_a100_r_ccu_probe(struct platform_device *pdev) 192 + { 193 + void __iomem *reg; 194 + 195 + reg = devm_platform_ioremap_resource(pdev, 0); 196 + if (IS_ERR(reg)) 197 + return PTR_ERR(reg); 198 + 199 + return sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_a100_r_ccu_desc); 200 + } 201 + 202 + static const struct of_device_id sun50i_a100_r_ccu_ids[] = { 203 + { .compatible = "allwinner,sun50i-a100-r-ccu" }, 204 + { } 205 + }; 206 + 207 + static struct platform_driver sun50i_a100_r_ccu_driver = { 208 + .probe = sun50i_a100_r_ccu_probe, 209 + .driver = { 210 + .name = "sun50i-a100-r-ccu", 211 + .of_match_table = sun50i_a100_r_ccu_ids, 212 + }, 213 + }; 214 + module_platform_driver(sun50i_a100_r_ccu_driver);
+21
drivers/clk/sunxi-ng/ccu-sun50i-a100-r.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (c) 2020 Yangtao Li <frank@allwinnertech.com> 4 + */ 5 + 6 + #ifndef _CCU_SUN50I_A100_R_H 7 + #define _CCU_SUN50I_A100_R_H 8 + 9 + #include <dt-bindings/clock/sun50i-a100-r-ccu.h> 10 + #include <dt-bindings/reset/sun50i-a100-r-ccu.h> 11 + 12 + #define CLK_R_CPUS 0 13 + #define CLK_R_AHB 1 14 + 15 + /* exported except APB1 for R_PIO */ 16 + 17 + #define CLK_R_APB2 3 18 + 19 + #define CLK_NUMBER (CLK_R_AHB_BUS_RTC + 1) 20 + 21 + #endif /* _CCU_SUN50I_A100_R_H */
+1276
drivers/clk/sunxi-ng/ccu-sun50i-a100.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (c) 2020 Yangtao Li <frank@allwinnertech.com> 4 + */ 5 + 6 + #include <linux/clk-provider.h> 7 + #include <linux/io.h> 8 + #include <linux/module.h> 9 + #include <linux/of_address.h> 10 + #include <linux/platform_device.h> 11 + 12 + #include "ccu_common.h" 13 + #include "ccu_reset.h" 14 + 15 + #include "ccu_div.h" 16 + #include "ccu_gate.h" 17 + #include "ccu_mp.h" 18 + #include "ccu_mult.h" 19 + #include "ccu_nk.h" 20 + #include "ccu_nkm.h" 21 + #include "ccu_nkmp.h" 22 + #include "ccu_nm.h" 23 + 24 + #include "ccu-sun50i-a100.h" 25 + 26 + #define SUN50I_A100_PLL_SDM_ENABLE BIT(24) 27 + #define SUN50I_A100_PLL_OUTPUT_ENABLE BIT(27) 28 + #define SUN50I_A100_PLL_LOCK BIT(28) 29 + #define SUN50I_A100_PLL_LOCK_ENABLE BIT(29) 30 + #define SUN50I_A100_PLL_ENABLE BIT(31) 31 + 32 + #define SUN50I_A100_PLL_PERIPH1_PATTERN0 0xd1303333 33 + 34 + /* 35 + * The CPU PLL is actually NP clock, with P being /1, /2 or /4. However 36 + * P should only be used for output frequencies lower than 288 MHz. 37 + * 38 + * For now we can just model it as a multiplier clock, and force P to /1. 39 + * 40 + * The M factor is present in the register's description, but not in the 41 + * frequency formula, and it's documented as "M is only used for backdoor 42 + * testing", so it's not modelled and then force to 0. 43 + */ 44 + #define SUN50I_A100_PLL_CPUX_REG 0x000 45 + static struct ccu_mult pll_cpux_clk = { 46 + .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 47 + .lock = SUN50I_A100_PLL_LOCK, 48 + .mult = _SUNXI_CCU_MULT_MIN(8, 8, 12), 49 + .common = { 50 + .reg = 0x000, 51 + .hw.init = CLK_HW_INIT("pll-cpux", "dcxo24M", 52 + &ccu_mult_ops, 53 + CLK_SET_RATE_UNGATE), 54 + }, 55 + }; 56 + 57 + /* Some PLLs are input * N / div1 / P. Model them as NKMP with no K */ 58 + #define SUN50I_A100_PLL_DDR0_REG 0x010 59 + static struct ccu_nkmp pll_ddr0_clk = { 60 + .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 61 + .lock = SUN50I_A100_PLL_LOCK, 62 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 63 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 64 + .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 65 + .common = { 66 + .reg = 0x010, 67 + .hw.init = CLK_HW_INIT("pll-ddr0", "dcxo24M", 68 + &ccu_nkmp_ops, 69 + CLK_SET_RATE_UNGATE | 70 + CLK_IS_CRITICAL), 71 + }, 72 + }; 73 + 74 + #define SUN50I_A100_PLL_PERIPH0_REG 0x020 75 + static struct ccu_nkmp pll_periph0_clk = { 76 + .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 77 + .lock = SUN50I_A100_PLL_LOCK, 78 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 79 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 80 + .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 81 + .fixed_post_div = 2, 82 + .common = { 83 + .reg = 0x020, 84 + .features = CCU_FEATURE_FIXED_POSTDIV, 85 + .hw.init = CLK_HW_INIT("pll-periph0", "dcxo24M", 86 + &ccu_nkmp_ops, 87 + CLK_SET_RATE_UNGATE), 88 + }, 89 + }; 90 + 91 + #define SUN50I_A100_PLL_PERIPH1_REG 0x028 92 + static struct ccu_nkmp pll_periph1_clk = { 93 + .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 94 + .lock = SUN50I_A100_PLL_LOCK, 95 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 96 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 97 + .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 98 + .fixed_post_div = 2, 99 + .common = { 100 + .reg = 0x028, 101 + .features = CCU_FEATURE_FIXED_POSTDIV, 102 + .hw.init = CLK_HW_INIT("pll-periph1", "dcxo24M", 103 + &ccu_nkmp_ops, 104 + CLK_SET_RATE_UNGATE), 105 + }, 106 + }; 107 + #define SUN50I_A100_PLL_PERIPH1_PATTERN0_REG 0x128 108 + 109 + #define SUN50I_A100_PLL_GPU_REG 0x030 110 + static struct ccu_nkmp pll_gpu_clk = { 111 + .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 112 + .lock = SUN50I_A100_PLL_LOCK, 113 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 114 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 115 + .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 116 + .common = { 117 + .reg = 0x030, 118 + .hw.init = CLK_HW_INIT("pll-gpu", "dcxo24M", 119 + &ccu_nkmp_ops, 120 + CLK_SET_RATE_UNGATE), 121 + }, 122 + }; 123 + 124 + /* 125 + * For Video PLLs, the output divider is described as "used for testing" 126 + * in the user manual. So it's not modelled and forced to 0. 127 + */ 128 + #define SUN50I_A100_PLL_VIDEO0_REG 0x040 129 + static struct ccu_nm pll_video0_clk = { 130 + .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 131 + .lock = SUN50I_A100_PLL_LOCK, 132 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 133 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 134 + .fixed_post_div = 4, 135 + .common = { 136 + .reg = 0x040, 137 + .features = CCU_FEATURE_FIXED_POSTDIV, 138 + .hw.init = CLK_HW_INIT("pll-video0", "dcxo24M", 139 + &ccu_nm_ops, 140 + CLK_SET_RATE_UNGATE), 141 + }, 142 + }; 143 + 144 + #define SUN50I_A100_PLL_VIDEO1_REG 0x048 145 + static struct ccu_nm pll_video1_clk = { 146 + .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 147 + .lock = SUN50I_A100_PLL_LOCK, 148 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 149 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 150 + .fixed_post_div = 4, 151 + .common = { 152 + .reg = 0x048, 153 + .features = CCU_FEATURE_FIXED_POSTDIV, 154 + .hw.init = CLK_HW_INIT("pll-video1", "dcxo24M", 155 + &ccu_nm_ops, 156 + CLK_SET_RATE_UNGATE), 157 + }, 158 + }; 159 + 160 + #define SUN50I_A100_PLL_VIDEO2_REG 0x050 161 + static struct ccu_nm pll_video2_clk = { 162 + .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 163 + .lock = SUN50I_A100_PLL_LOCK, 164 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 165 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 166 + .fixed_post_div = 4, 167 + .common = { 168 + .reg = 0x050, 169 + .features = CCU_FEATURE_FIXED_POSTDIV, 170 + .hw.init = CLK_HW_INIT("pll-video2", "dcxo24M", 171 + &ccu_nm_ops, 172 + CLK_SET_RATE_UNGATE), 173 + }, 174 + }; 175 + 176 + #define SUN50I_A100_PLL_VE_REG 0x058 177 + static struct ccu_nkmp pll_ve_clk = { 178 + .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 179 + .lock = SUN50I_A100_PLL_LOCK, 180 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 181 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 182 + .p = _SUNXI_CCU_DIV(0, 1), /* output divider */ 183 + .common = { 184 + .reg = 0x058, 185 + .hw.init = CLK_HW_INIT("pll-ve", "dcxo24M", 186 + &ccu_nkmp_ops, 187 + CLK_SET_RATE_UNGATE), 188 + }, 189 + }; 190 + 191 + /* 192 + * The COM PLL has m0 dividers in addition to the usual N, M 193 + * factors. Since we only need 1 frequencies from this PLL: 45.1584 MHz, 194 + * ignore it for now. 195 + */ 196 + #define SUN50I_A100_PLL_COM_REG 0x060 197 + static struct ccu_sdm_setting pll_com_sdm_table[] = { 198 + { .rate = 451584000, .pattern = 0xc0014396, .m = 2, .n = 37 }, 199 + }; 200 + 201 + static struct ccu_nm pll_com_clk = { 202 + .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 203 + .lock = SUN50I_A100_PLL_LOCK, 204 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 205 + .m = _SUNXI_CCU_DIV(0, 1), 206 + .sdm = _SUNXI_CCU_SDM(pll_com_sdm_table, BIT(24), 207 + 0x160, BIT(31)), 208 + .common = { 209 + .reg = 0x060, 210 + .features = CCU_FEATURE_SIGMA_DELTA_MOD, 211 + .hw.init = CLK_HW_INIT("pll-com", "dcxo24M", 212 + &ccu_nm_ops, 213 + CLK_SET_RATE_UNGATE), 214 + }, 215 + }; 216 + 217 + #define SUN50I_A100_PLL_VIDEO3_REG 0x068 218 + static struct ccu_nm pll_video3_clk = { 219 + .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 220 + .lock = SUN50I_A100_PLL_LOCK, 221 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 222 + .m = _SUNXI_CCU_DIV(1, 1), /* input divider */ 223 + .fixed_post_div = 4, 224 + .common = { 225 + .reg = 0x068, 226 + .features = CCU_FEATURE_FIXED_POSTDIV, 227 + .hw.init = CLK_HW_INIT("pll-video3", "dcxo24M", 228 + &ccu_nm_ops, 229 + CLK_SET_RATE_UNGATE), 230 + }, 231 + }; 232 + 233 + /* 234 + * The Audio PLL has m0, m1 dividers in addition to the usual N, M 235 + * factors. Since we only need 4 frequencies from this PLL: 22.5792 MHz, 236 + * 24.576 MHz, 90.3168MHz and 98.304MHz ignore them for now. 237 + * Enforce the default for them, which is m0 = 1, m1 = 0. 238 + */ 239 + #define SUN50I_A100_PLL_AUDIO_REG 0x078 240 + static struct ccu_sdm_setting pll_audio_sdm_table[] = { 241 + { .rate = 45158400, .pattern = 0xc001bcd3, .m = 18, .n = 33 }, 242 + { .rate = 49152000, .pattern = 0xc001eb85, .m = 20, .n = 40 }, 243 + { .rate = 180633600, .pattern = 0xc001288d, .m = 3, .n = 22 }, 244 + { .rate = 196608000, .pattern = 0xc001eb85, .m = 5, .n = 40 }, 245 + }; 246 + 247 + static struct ccu_nm pll_audio_clk = { 248 + .enable = SUN50I_A100_PLL_OUTPUT_ENABLE, 249 + .lock = SUN50I_A100_PLL_LOCK, 250 + .n = _SUNXI_CCU_MULT_MIN(8, 8, 12), 251 + .m = _SUNXI_CCU_DIV(16, 6), 252 + .fixed_post_div = 2, 253 + .sdm = _SUNXI_CCU_SDM(pll_audio_sdm_table, BIT(24), 254 + 0x178, BIT(31)), 255 + .common = { 256 + .reg = 0x078, 257 + .features = CCU_FEATURE_FIXED_POSTDIV | 258 + CCU_FEATURE_SIGMA_DELTA_MOD, 259 + .hw.init = CLK_HW_INIT("pll-audio", "dcxo24M", 260 + &ccu_nm_ops, 261 + CLK_SET_RATE_UNGATE), 262 + }, 263 + }; 264 + 265 + static const char * const cpux_parents[] = { "dcxo24M", "osc32k", 266 + "iosc", "pll-cpux", 267 + "pll-periph0" }; 268 + static SUNXI_CCU_MUX(cpux_clk, "cpux", cpux_parents, 269 + 0x500, 24, 3, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); 270 + static SUNXI_CCU_M(axi_clk, "axi", "cpux", 0x500, 0, 2, 0); 271 + static SUNXI_CCU_M(cpux_apb_clk, "cpux-apb", "cpux", 0x500, 8, 2, 0); 272 + 273 + static const char * const psi_ahb1_ahb2_parents[] = { "dcxo24M", "osc32k", 274 + "iosc", "pll-periph0", 275 + "pll-periph0-2x" }; 276 + static SUNXI_CCU_MP_WITH_MUX(psi_ahb1_ahb2_clk, "psi-ahb1-ahb2", 277 + psi_ahb1_ahb2_parents, 0x510, 278 + 0, 2, /* M */ 279 + 8, 2, /* P */ 280 + 24, 3, /* mux */ 281 + 0); 282 + 283 + static const char * const ahb3_apb1_apb2_parents[] = { "dcxo24M", "osc32k", 284 + "psi-ahb1-ahb2", 285 + "pll-periph0", 286 + "pll-periph0-2x" }; 287 + static SUNXI_CCU_MP_WITH_MUX(ahb3_clk, "ahb3", ahb3_apb1_apb2_parents, 0x51c, 288 + 0, 2, /* M */ 289 + 8, 2, /* P */ 290 + 24, 3, /* mux */ 291 + 0); 292 + 293 + static SUNXI_CCU_MP_WITH_MUX(apb1_clk, "apb1", ahb3_apb1_apb2_parents, 0x520, 294 + 0, 2, /* M */ 295 + 8, 2, /* P */ 296 + 24, 3, /* mux */ 297 + 0); 298 + 299 + static SUNXI_CCU_MP_WITH_MUX(apb2_clk, "apb2", ahb3_apb1_apb2_parents, 0x524, 300 + 0, 2, /* M */ 301 + 8, 2, /* P */ 302 + 24, 3, /* mux */ 303 + 0); 304 + 305 + static const char * const mbus_parents[] = { "dcxo24M", "pll-ddr0", 306 + "pll-periph0", 307 + "pll-periph0-2x" }; 308 + static SUNXI_CCU_M_WITH_MUX_GATE(mbus_clk, "mbus", mbus_parents, 0x540, 309 + 0, 3, /* M */ 310 + 24, 2, /* mux */ 311 + BIT(31), /* gate */ 312 + CLK_IS_CRITICAL); 313 + 314 + static const char * const de_parents[] = { "pll-com", "pll-periph0-2x" }; 315 + static SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de0", de_parents, 0x600, 316 + 0, 4, /* M */ 317 + 24, 1, /* mux */ 318 + BIT(31), /* gate */ 319 + CLK_SET_RATE_PARENT); 320 + 321 + static SUNXI_CCU_GATE(bus_de_clk, "bus-de", "psi-ahb1-ahb2", 322 + 0x60c, BIT(0), 0); 323 + 324 + static const char * const g2d_parents[] = { "pll-com", "pll-periph0-2x", 325 + "pll-video0-2x", "pll-video1-2x", 326 + "pll-video2-2x"}; 327 + static SUNXI_CCU_M_WITH_MUX_GATE(g2d_clk, "g2d", 328 + g2d_parents, 329 + 0x630, 330 + 0, 4, /* M */ 331 + 24, 3, /* mux */ 332 + BIT(31), /* gate */ 333 + 0); 334 + 335 + static SUNXI_CCU_GATE(bus_g2d_clk, "bus-g2d", "psi-ahb1-ahb2", 336 + 0x63c, BIT(0), 0); 337 + 338 + static const char * const gpu_parents[] = { "pll-gpu" }; 339 + static SUNXI_CCU_M_WITH_MUX_GATE(gpu_clk, "gpu", gpu_parents, 0x670, 340 + 0, 2, /* M */ 341 + 24, 1, /* mux */ 342 + BIT(31), /* gate */ 343 + 0); 344 + 345 + static SUNXI_CCU_GATE(bus_gpu_clk, "bus-gpu", "psi-ahb1-ahb2", 346 + 0x67c, BIT(0), 0); 347 + 348 + static const char * const ce_parents[] = { "dcxo24M", "pll-periph0-2x" }; 349 + static SUNXI_CCU_MP_WITH_MUX_GATE(ce_clk, "ce", ce_parents, 0x680, 350 + 0, 4, /* M */ 351 + 8, 2, /* P */ 352 + 24, 1, /* mux */ 353 + BIT(31), /* gate */ 354 + 0); 355 + 356 + static SUNXI_CCU_GATE(bus_ce_clk, "bus-ce", "psi-ahb1-ahb2", 357 + 0x68c, BIT(0), 0); 358 + 359 + static const char * const ve_parents[] = { "pll-ve" }; 360 + static SUNXI_CCU_M_WITH_MUX_GATE(ve_clk, "ve", ve_parents, 0x690, 361 + 0, 3, /* M */ 362 + 24, 1, /* mux */ 363 + BIT(31), /* gate */ 364 + CLK_SET_RATE_PARENT); 365 + 366 + static SUNXI_CCU_GATE(bus_ve_clk, "bus-ve", "psi-ahb1-ahb2", 367 + 0x69c, BIT(0), 0); 368 + 369 + static SUNXI_CCU_GATE(bus_dma_clk, "bus-dma", "psi-ahb1-ahb2", 370 + 0x70c, BIT(0), 0); 371 + 372 + static SUNXI_CCU_GATE(bus_msgbox_clk, "bus-msgbox", "psi-ahb1-ahb2", 373 + 0x71c, BIT(0), 0); 374 + 375 + static SUNXI_CCU_GATE(bus_spinlock_clk, "bus-spinlock", "psi-ahb1-ahb2", 376 + 0x72c, BIT(0), 0); 377 + 378 + static SUNXI_CCU_GATE(bus_hstimer_clk, "bus-hstimer", "psi-ahb1-ahb2", 379 + 0x73c, BIT(0), 0); 380 + 381 + static SUNXI_CCU_GATE(avs_clk, "avs", "dcxo24M", 0x740, BIT(31), 0); 382 + 383 + static SUNXI_CCU_GATE(bus_dbg_clk, "bus-dbg", "psi-ahb1-ahb2", 384 + 0x78c, BIT(0), 0); 385 + 386 + static SUNXI_CCU_GATE(bus_psi_clk, "bus-psi", "psi-ahb1-ahb2", 387 + 0x79c, BIT(0), 0); 388 + 389 + static SUNXI_CCU_GATE(bus_pwm_clk, "bus-pwm", "apb1", 0x7ac, BIT(0), 0); 390 + 391 + static SUNXI_CCU_GATE(bus_iommu_clk, "bus-iommu", "apb1", 0x7bc, BIT(0), 0); 392 + 393 + static SUNXI_CCU_GATE(mbus_dma_clk, "mbus-dma", "mbus", 394 + 0x804, BIT(0), 0); 395 + static SUNXI_CCU_GATE(mbus_ve_clk, "mbus-ve", "mbus", 396 + 0x804, BIT(1), 0); 397 + static SUNXI_CCU_GATE(mbus_ce_clk, "mbus-ce", "mbus", 398 + 0x804, BIT(2), 0); 399 + static SUNXI_CCU_GATE(mbus_nand_clk, "mbus-nand", "mbus", 400 + 0x804, BIT(5), 0); 401 + static SUNXI_CCU_GATE(mbus_csi_clk, "mbus-csi", "mbus", 402 + 0x804, BIT(8), 0); 403 + static SUNXI_CCU_GATE(mbus_isp_clk, "mbus-isp", "mbus", 404 + 0x804, BIT(9), 0); 405 + static SUNXI_CCU_GATE(mbus_g2d_clk, "mbus-g2d", "mbus", 406 + 0x804, BIT(10), 0); 407 + 408 + static SUNXI_CCU_GATE(bus_dram_clk, "bus-dram", "psi-ahb1-ahb2", 409 + 0x80c, BIT(0), CLK_IS_CRITICAL); 410 + 411 + static const char * const nand_spi_parents[] = { "dcxo24M", 412 + "pll-periph0", 413 + "pll-periph1", 414 + "pll-periph0-2x", 415 + "pll-periph1-2x" }; 416 + static SUNXI_CCU_MP_WITH_MUX_GATE(nand0_clk, "nand0", nand_spi_parents, 0x810, 417 + 0, 4, /* M */ 418 + 8, 2, /* P */ 419 + 24, 3, /* mux */ 420 + BIT(31), /* gate */ 421 + 0); 422 + 423 + static SUNXI_CCU_MP_WITH_MUX_GATE(nand1_clk, "nand1", nand_spi_parents, 0x814, 424 + 0, 4, /* M */ 425 + 8, 2, /* P */ 426 + 24, 3, /* mux */ 427 + BIT(31), /* gate */ 428 + 0); 429 + 430 + static SUNXI_CCU_GATE(bus_nand_clk, "bus-nand", "ahb3", 0x82c, BIT(0), 0); 431 + 432 + static const char * const mmc_parents[] = { "dcxo24M", "pll-periph0-2x", 433 + "pll-periph1-2x" }; 434 + static SUNXI_CCU_MP_WITH_MUX_GATE_POSTDIV(mmc0_clk, "mmc0", mmc_parents, 0x830, 435 + 0, 4, /* M */ 436 + 8, 2, /* P */ 437 + 24, 2, /* mux */ 438 + BIT(31), /* gate */ 439 + 2, /* post-div */ 440 + CLK_SET_RATE_NO_REPARENT); 441 + 442 + static SUNXI_CCU_MP_WITH_MUX_GATE_POSTDIV(mmc1_clk, "mmc1", mmc_parents, 0x834, 443 + 0, 4, /* M */ 444 + 8, 2, /* P */ 445 + 24, 2, /* mux */ 446 + BIT(31), /* gate */ 447 + 2, /* post-div */ 448 + CLK_SET_RATE_NO_REPARENT); 449 + 450 + static SUNXI_CCU_MP_WITH_MUX_GATE_POSTDIV(mmc2_clk, "mmc2", mmc_parents, 0x838, 451 + 0, 4, /* M */ 452 + 8, 2, /* P */ 453 + 24, 2, /* mux */ 454 + BIT(31), /* gate */ 455 + 2, /* post-div */ 456 + CLK_SET_RATE_NO_REPARENT); 457 + 458 + static SUNXI_CCU_GATE(bus_mmc0_clk, "bus-mmc0", "ahb3", 0x84c, BIT(0), 0); 459 + static SUNXI_CCU_GATE(bus_mmc1_clk, "bus-mmc1", "ahb3", 0x84c, BIT(1), 0); 460 + static SUNXI_CCU_GATE(bus_mmc2_clk, "bus-mmc2", "ahb3", 0x84c, BIT(2), 0); 461 + 462 + static SUNXI_CCU_GATE(bus_uart0_clk, "bus-uart0", "apb2", 0x90c, BIT(0), 0); 463 + static SUNXI_CCU_GATE(bus_uart1_clk, "bus-uart1", "apb2", 0x90c, BIT(1), 0); 464 + static SUNXI_CCU_GATE(bus_uart2_clk, "bus-uart2", "apb2", 0x90c, BIT(2), 0); 465 + static SUNXI_CCU_GATE(bus_uart3_clk, "bus-uart3", "apb2", 0x90c, BIT(3), 0); 466 + static SUNXI_CCU_GATE(bus_uart4_clk, "bus-uart4", "apb2", 0x90c, BIT(4), 0); 467 + 468 + static SUNXI_CCU_GATE(bus_i2c0_clk, "bus-i2c0", "apb2", 0x91c, BIT(0), 0); 469 + static SUNXI_CCU_GATE(bus_i2c1_clk, "bus-i2c1", "apb2", 0x91c, BIT(1), 0); 470 + static SUNXI_CCU_GATE(bus_i2c2_clk, "bus-i2c2", "apb2", 0x91c, BIT(2), 0); 471 + static SUNXI_CCU_GATE(bus_i2c3_clk, "bus-i2c3", "apb2", 0x91c, BIT(3), 0); 472 + 473 + static SUNXI_CCU_MP_WITH_MUX_GATE(spi0_clk, "spi0", nand_spi_parents, 0x940, 474 + 0, 4, /* M */ 475 + 8, 2, /* P */ 476 + 24, 3, /* mux */ 477 + BIT(31), /* gate */ 478 + 0); 479 + 480 + static SUNXI_CCU_MP_WITH_MUX_GATE(spi1_clk, "spi1", nand_spi_parents, 0x944, 481 + 0, 4, /* M */ 482 + 8, 2, /* P */ 483 + 24, 3, /* mux */ 484 + BIT(31), /* gate */ 485 + 0); 486 + 487 + static SUNXI_CCU_MP_WITH_MUX_GATE(spi2_clk, "spi2", nand_spi_parents, 0x948, 488 + 0, 4, /* M */ 489 + 8, 2, /* P */ 490 + 24, 3, /* mux */ 491 + BIT(31), /* gate */ 492 + 0); 493 + 494 + static SUNXI_CCU_GATE(bus_spi0_clk, "bus-spi0", "ahb3", 0x96c, BIT(0), 0); 495 + static SUNXI_CCU_GATE(bus_spi1_clk, "bus-spi1", "ahb3", 0x96c, BIT(1), 0); 496 + static SUNXI_CCU_GATE(bus_spi2_clk, "bus-spi2", "ahb3", 0x96c, BIT(2), 0); 497 + 498 + static SUNXI_CCU_GATE(emac_25m_clk, "emac-25m", "ahb3", 0x970, 499 + BIT(31) | BIT(30), 0); 500 + 501 + static SUNXI_CCU_GATE(bus_emac_clk, "bus-emac", "ahb3", 0x97c, BIT(0), 0); 502 + 503 + static const char * const ir_parents[] = { "osc32k", "iosc", 504 + "pll-periph0", "pll-periph1" }; 505 + static SUNXI_CCU_MP_WITH_MUX_GATE(ir_rx_clk, "ir-rx", ir_parents, 0x990, 506 + 0, 4, /* M */ 507 + 8, 2, /* P */ 508 + 24, 3, /* mux */ 509 + BIT(31), /* gate */ 510 + 0); 511 + 512 + static SUNXI_CCU_GATE(bus_ir_rx_clk, "bus-ir-rx", "ahb3", 0x99c, BIT(0), 0); 513 + 514 + static SUNXI_CCU_MP_WITH_MUX_GATE(ir_tx_clk, "ir-tx", ir_parents, 0x9c0, 515 + 0, 4, /* M */ 516 + 8, 2, /* P */ 517 + 24, 3, /* mux */ 518 + BIT(31), /* gate */ 519 + 0); 520 + 521 + static SUNXI_CCU_GATE(bus_ir_tx_clk, "bus-ir-tx", "apb1", 0x9cc, BIT(0), 0); 522 + 523 + static SUNXI_CCU_GATE(bus_gpadc_clk, "bus-gpadc", "apb1", 0x9ec, BIT(0), 0); 524 + 525 + static SUNXI_CCU_GATE(bus_ths_clk, "bus-ths", "apb1", 0x9fc, BIT(0), 0); 526 + 527 + static const char * const audio_parents[] = { "pll-audio", "pll-com-audio" }; 528 + static struct ccu_div i2s0_clk = { 529 + .enable = BIT(31), 530 + .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 531 + .mux = _SUNXI_CCU_MUX(24, 2), 532 + .common = { 533 + .reg = 0xa10, 534 + .hw.init = CLK_HW_INIT_PARENTS("i2s0", 535 + audio_parents, 536 + &ccu_div_ops, 537 + CLK_SET_RATE_PARENT), 538 + }, 539 + }; 540 + 541 + static struct ccu_div i2s1_clk = { 542 + .enable = BIT(31), 543 + .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 544 + .mux = _SUNXI_CCU_MUX(24, 2), 545 + .common = { 546 + .reg = 0xa14, 547 + .hw.init = CLK_HW_INIT_PARENTS("i2s1", 548 + audio_parents, 549 + &ccu_div_ops, 550 + CLK_SET_RATE_PARENT), 551 + }, 552 + }; 553 + 554 + static struct ccu_div i2s2_clk = { 555 + .enable = BIT(31), 556 + .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 557 + .mux = _SUNXI_CCU_MUX(24, 2), 558 + .common = { 559 + .reg = 0xa18, 560 + .hw.init = CLK_HW_INIT_PARENTS("i2s2", 561 + audio_parents, 562 + &ccu_div_ops, 563 + CLK_SET_RATE_PARENT), 564 + }, 565 + }; 566 + 567 + static struct ccu_div i2s3_clk = { 568 + .enable = BIT(31), 569 + .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 570 + .mux = _SUNXI_CCU_MUX(24, 2), 571 + .common = { 572 + .reg = 0xa1c, 573 + .hw.init = CLK_HW_INIT_PARENTS("i2s3", 574 + audio_parents, 575 + &ccu_div_ops, 576 + CLK_SET_RATE_PARENT), 577 + }, 578 + }; 579 + 580 + static SUNXI_CCU_GATE(bus_i2s0_clk, "bus-i2s0", "apb1", 0xa20, BIT(0), 0); 581 + static SUNXI_CCU_GATE(bus_i2s1_clk, "bus-i2s1", "apb1", 0xa20, BIT(1), 0); 582 + static SUNXI_CCU_GATE(bus_i2s2_clk, "bus-i2s2", "apb1", 0xa20, BIT(2), 0); 583 + static SUNXI_CCU_GATE(bus_i2s3_clk, "bus-i2s3", "apb1", 0xa20, BIT(3), 0); 584 + 585 + static struct ccu_div spdif_clk = { 586 + .enable = BIT(31), 587 + .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 588 + .mux = _SUNXI_CCU_MUX(24, 2), 589 + .common = { 590 + .reg = 0xa24, 591 + .hw.init = CLK_HW_INIT_PARENTS("spdif", 592 + audio_parents, 593 + &ccu_div_ops, 594 + 0), 595 + }, 596 + }; 597 + 598 + static SUNXI_CCU_GATE(bus_spdif_clk, "bus-spdif", "apb1", 0xa2c, BIT(0), 0); 599 + 600 + static struct ccu_div dmic_clk = { 601 + .enable = BIT(31), 602 + .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO), 603 + .mux = _SUNXI_CCU_MUX(24, 2), 604 + .common = { 605 + .reg = 0xa40, 606 + .hw.init = CLK_HW_INIT_PARENTS("dmic", 607 + audio_parents, 608 + &ccu_div_ops, 609 + 0), 610 + }, 611 + }; 612 + 613 + static SUNXI_CCU_GATE(bus_dmic_clk, "bus-dmic", "apb1", 0xa4c, BIT(0), 0); 614 + 615 + static SUNXI_CCU_M_WITH_MUX_GATE(audio_codec_dac_clk, "audio-codec-dac", 616 + audio_parents, 0xa50, 617 + 0, 4, /* M */ 618 + 24, 2, /* mux */ 619 + BIT(31), /* gate */ 620 + 0); 621 + 622 + static SUNXI_CCU_M_WITH_MUX_GATE(audio_codec_adc_clk, "audio-codec-adc", 623 + audio_parents, 0xa54, 624 + 0, 4, /* M */ 625 + 24, 2, /* mux */ 626 + BIT(31), /* gate */ 627 + 0); 628 + 629 + static SUNXI_CCU_M_WITH_MUX_GATE(audio_codec_4x_clk, "audio-codec-4x", 630 + audio_parents, 0xa58, 631 + 0, 4, /* M */ 632 + 24, 2, /* mux */ 633 + BIT(31), /* gate */ 634 + 0); 635 + 636 + static SUNXI_CCU_GATE(bus_audio_codec_clk, "bus-audio-codec", "apb1", 0xa5c, 637 + BIT(0), 0); 638 + 639 + /* 640 + * There are OHCI 12M clock source selection bits for 2 USB 2.0 ports. 641 + * We will force them to 0 (12M divided from 48M). 642 + */ 643 + #define SUN50I_A100_USB0_CLK_REG 0xa70 644 + #define SUN50I_A100_USB1_CLK_REG 0xa74 645 + 646 + static SUNXI_CCU_GATE(usb_ohci0_clk, "usb-ohci0", "osc12M", 0xa70, BIT(31), 0); 647 + static SUNXI_CCU_GATE(usb_phy0_clk, "usb-phy0", "dcxo24M", 0xa70, BIT(29), 0); 648 + 649 + static SUNXI_CCU_GATE(usb_ohci1_clk, "usb-ohci1", "osc12M", 0xa74, BIT(31), 0); 650 + static SUNXI_CCU_GATE(usb_phy1_clk, "usb-phy1", "dcxo24M", 0xa74, BIT(29), 0); 651 + 652 + static SUNXI_CCU_GATE(bus_ohci0_clk, "bus-ohci0", "ahb3", 0xa8c, BIT(0), 0); 653 + static SUNXI_CCU_GATE(bus_ohci1_clk, "bus-ohci1", "ahb3", 0xa8c, BIT(1), 0); 654 + static SUNXI_CCU_GATE(bus_ehci0_clk, "bus-ehci0", "ahb3", 0xa8c, BIT(4), 0); 655 + static SUNXI_CCU_GATE(bus_ehci1_clk, "bus-ehci1", "ahb3", 0xa8c, BIT(5), 0); 656 + static SUNXI_CCU_GATE(bus_otg_clk, "bus-otg", "ahb3", 0xa8c, BIT(8), 0); 657 + 658 + static SUNXI_CCU_GATE(bus_lradc_clk, "bus-lradc", "ahb3", 0xa9c, BIT(0), 0); 659 + 660 + static SUNXI_CCU_GATE(bus_dpss_top0_clk, "bus-dpss-top0", "ahb3", 661 + 0xabc, BIT(0), 0); 662 + 663 + static SUNXI_CCU_GATE(bus_dpss_top1_clk, "bus-dpss-top1", "ahb3", 664 + 0xacc, BIT(0), 0); 665 + 666 + static const char * const mipi_dsi_parents[] = { "dcxo24M", "pll-periph0-2x", 667 + "pll-periph0" }; 668 + static SUNXI_CCU_M_WITH_MUX_GATE(mipi_dsi_clk, "mipi-dsi", 669 + mipi_dsi_parents, 670 + 0xb24, 671 + 0, 4, /* M */ 672 + 24, 2, /* mux */ 673 + BIT(31), /* gate */ 674 + 0); 675 + 676 + static SUNXI_CCU_GATE(bus_mipi_dsi_clk, "bus-mipi-dsi", "ahb3", 677 + 0xb4c, BIT(0), 0); 678 + 679 + static const char * const tcon_lcd_parents[] = { "pll-video0-4x", 680 + "pll-video1-4x", 681 + "pll-video2-4x", 682 + "pll-video3-4x", 683 + "pll-periph0-2x" }; 684 + static SUNXI_CCU_MP_WITH_MUX_GATE(tcon_lcd_clk, "tcon-lcd0", 685 + tcon_lcd_parents, 0xb60, 686 + 0, 4, /* M */ 687 + 8, 2, /* P */ 688 + 24, 3, /* mux */ 689 + BIT(31), /* gate */ 690 + 0); 691 + 692 + static SUNXI_CCU_GATE(bus_tcon_lcd_clk, "bus-tcon-lcd0", "ahb3", 693 + 0xb7c, BIT(0), 0); 694 + 695 + static const char * const ledc_parents[] = { "dcxo24M", 696 + "pll-periph0" }; 697 + static SUNXI_CCU_MP_WITH_MUX_GATE(ledc_clk, "ledc", 698 + ledc_parents, 0xbf0, 699 + 0, 4, /* M */ 700 + 8, 2, /* P */ 701 + 24, 3, /* mux */ 702 + BIT(31), /* gate */ 703 + 0); 704 + 705 + static SUNXI_CCU_GATE(bus_ledc_clk, "bus-ledc", "ahb3", 0xbfc, BIT(0), 0); 706 + 707 + static const char * const csi_top_parents[] = { "pll-periph0-2x", 708 + "pll-video0-2x", 709 + "pll-video1-2x", 710 + "pll-video2-2x", 711 + "pll-video3-2x" }; 712 + static SUNXI_CCU_M_WITH_MUX_GATE(csi_top_clk, "csi-top", 713 + csi_top_parents, 0xc04, 714 + 0, 4, /* M */ 715 + 24, 3, /* mux */ 716 + BIT(31), /* gate */ 717 + 0); 718 + 719 + static const char * const csi0_mclk_parents[] = { "dcxo24M", "pll-video2", 720 + "pll-video3", "pll-video0", 721 + "pll-video1" }; 722 + static SUNXI_CCU_M_WITH_MUX_GATE(csi0_mclk_clk, "csi0-mclk", 723 + csi0_mclk_parents, 0xc08, 724 + 0, 5, /* M */ 725 + 24, 3, /* mux */ 726 + BIT(31), /* gate */ 727 + 0); 728 + 729 + static const char * const csi1_mclk_parents[] = { "dcxo24M", "pll-video3", 730 + "pll-video0", "pll-video1", 731 + "pll-video2" }; 732 + static SUNXI_CCU_M_WITH_MUX_GATE(csi1_mclk_clk, "csi1-mclk", 733 + csi1_mclk_parents, 0xc0c, 734 + 0, 5, /* M */ 735 + 24, 3, /* mux */ 736 + BIT(31), /* gate */ 737 + 0); 738 + 739 + static SUNXI_CCU_GATE(bus_csi_clk, "bus-csi", "ahb3", 0xc1c, BIT(0), 0); 740 + 741 + static const char * const csi_isp_parents[] = { "pll-periph0-2x", 742 + "pll-video0-2x", 743 + "pll-video1-2x", 744 + "pll-video2-2x", 745 + "pll-video3-2x" }; 746 + static SUNXI_CCU_M_WITH_MUX_GATE(csi_isp_clk, "csi-isp", 747 + csi_isp_parents, 0xc20, 748 + 0, 5, /* M */ 749 + 24, 3, /* mux */ 750 + BIT(31), /* gate */ 751 + 0); 752 + 753 + /* Fixed factor clocks */ 754 + static CLK_FIXED_FACTOR_FW_NAME(osc12M_clk, "osc12M", "hosc", 2, 1, 0); 755 + 756 + static CLK_FIXED_FACTOR_HW(pll_com_audio_clk, "pll-com-audio", 757 + &pll_com_clk.common.hw, 758 + 5, 1, CLK_SET_RATE_PARENT); 759 + 760 + static CLK_FIXED_FACTOR_HW(pll_periph0_2x_clk, "pll-periph0-2x", 761 + &pll_periph0_clk.common.hw, 762 + 1, 2, 0); 763 + 764 + static CLK_FIXED_FACTOR_HW(pll_periph1_2x_clk, "pll-periph1-2x", 765 + &pll_periph1_clk.common.hw, 766 + 1, 2, 0); 767 + 768 + static const struct clk_hw *pll_video0_parents[] = { 769 + &pll_video0_clk.common.hw 770 + }; 771 + static CLK_FIXED_FACTOR_HWS(pll_video0_4x_clk, "pll-video0-4x", 772 + pll_video0_parents, 773 + 1, 4, CLK_SET_RATE_PARENT); 774 + static CLK_FIXED_FACTOR_HWS(pll_video0_2x_clk, "pll-video0-2x", 775 + pll_video0_parents, 776 + 1, 2, CLK_SET_RATE_PARENT); 777 + 778 + static const struct clk_hw *pll_video1_parents[] = { 779 + &pll_video1_clk.common.hw 780 + }; 781 + static CLK_FIXED_FACTOR_HWS(pll_video1_4x_clk, "pll-video1-4x", 782 + pll_video1_parents, 783 + 1, 4, CLK_SET_RATE_PARENT); 784 + static CLK_FIXED_FACTOR_HWS(pll_video1_2x_clk, "pll-video1-2x", 785 + pll_video1_parents, 786 + 1, 2, CLK_SET_RATE_PARENT); 787 + 788 + static const struct clk_hw *pll_video2_parents[] = { 789 + &pll_video2_clk.common.hw 790 + }; 791 + static CLK_FIXED_FACTOR_HWS(pll_video2_4x_clk, "pll-video2-4x", 792 + pll_video2_parents, 793 + 1, 4, CLK_SET_RATE_PARENT); 794 + static CLK_FIXED_FACTOR_HWS(pll_video2_2x_clk, "pll-video2-2x", 795 + pll_video2_parents, 796 + 1, 2, CLK_SET_RATE_PARENT); 797 + 798 + static const struct clk_hw *pll_video3_parents[] = { 799 + &pll_video3_clk.common.hw 800 + }; 801 + static CLK_FIXED_FACTOR_HWS(pll_video3_4x_clk, "pll-video3-4x", 802 + pll_video3_parents, 803 + 1, 4, CLK_SET_RATE_PARENT); 804 + static CLK_FIXED_FACTOR_HWS(pll_video3_2x_clk, "pll-video3-2x", 805 + pll_video3_parents, 806 + 1, 2, CLK_SET_RATE_PARENT); 807 + 808 + static struct ccu_common *sun50i_a100_ccu_clks[] = { 809 + &pll_cpux_clk.common, 810 + &pll_ddr0_clk.common, 811 + &pll_periph0_clk.common, 812 + &pll_periph1_clk.common, 813 + &pll_gpu_clk.common, 814 + &pll_video0_clk.common, 815 + &pll_video1_clk.common, 816 + &pll_video2_clk.common, 817 + &pll_video3_clk.common, 818 + &pll_ve_clk.common, 819 + &pll_com_clk.common, 820 + &pll_audio_clk.common, 821 + &cpux_clk.common, 822 + &axi_clk.common, 823 + &cpux_apb_clk.common, 824 + &psi_ahb1_ahb2_clk.common, 825 + &ahb3_clk.common, 826 + &apb1_clk.common, 827 + &apb2_clk.common, 828 + &mbus_clk.common, 829 + &de_clk.common, 830 + &bus_de_clk.common, 831 + &g2d_clk.common, 832 + &bus_g2d_clk.common, 833 + &gpu_clk.common, 834 + &bus_gpu_clk.common, 835 + &ce_clk.common, 836 + &bus_ce_clk.common, 837 + &ve_clk.common, 838 + &bus_ve_clk.common, 839 + &bus_dma_clk.common, 840 + &bus_msgbox_clk.common, 841 + &bus_spinlock_clk.common, 842 + &bus_hstimer_clk.common, 843 + &avs_clk.common, 844 + &bus_dbg_clk.common, 845 + &bus_psi_clk.common, 846 + &bus_pwm_clk.common, 847 + &bus_iommu_clk.common, 848 + &mbus_dma_clk.common, 849 + &mbus_ve_clk.common, 850 + &mbus_ce_clk.common, 851 + &mbus_nand_clk.common, 852 + &mbus_csi_clk.common, 853 + &mbus_isp_clk.common, 854 + &mbus_g2d_clk.common, 855 + &bus_dram_clk.common, 856 + &nand0_clk.common, 857 + &nand1_clk.common, 858 + &bus_nand_clk.common, 859 + &mmc0_clk.common, 860 + &mmc1_clk.common, 861 + &mmc2_clk.common, 862 + &bus_mmc0_clk.common, 863 + &bus_mmc1_clk.common, 864 + &bus_mmc2_clk.common, 865 + &bus_uart0_clk.common, 866 + &bus_uart1_clk.common, 867 + &bus_uart2_clk.common, 868 + &bus_uart3_clk.common, 869 + &bus_uart4_clk.common, 870 + &bus_i2c0_clk.common, 871 + &bus_i2c1_clk.common, 872 + &bus_i2c2_clk.common, 873 + &bus_i2c3_clk.common, 874 + &spi0_clk.common, 875 + &spi1_clk.common, 876 + &spi2_clk.common, 877 + &bus_spi0_clk.common, 878 + &bus_spi1_clk.common, 879 + &bus_spi2_clk.common, 880 + &emac_25m_clk.common, 881 + &bus_emac_clk.common, 882 + &ir_rx_clk.common, 883 + &bus_ir_rx_clk.common, 884 + &ir_tx_clk.common, 885 + &bus_ir_tx_clk.common, 886 + &bus_gpadc_clk.common, 887 + &bus_ths_clk.common, 888 + &i2s0_clk.common, 889 + &i2s1_clk.common, 890 + &i2s2_clk.common, 891 + &i2s3_clk.common, 892 + &bus_i2s0_clk.common, 893 + &bus_i2s1_clk.common, 894 + &bus_i2s2_clk.common, 895 + &bus_i2s3_clk.common, 896 + &spdif_clk.common, 897 + &bus_spdif_clk.common, 898 + &dmic_clk.common, 899 + &bus_dmic_clk.common, 900 + &audio_codec_dac_clk.common, 901 + &audio_codec_adc_clk.common, 902 + &audio_codec_4x_clk.common, 903 + &bus_audio_codec_clk.common, 904 + &usb_ohci0_clk.common, 905 + &usb_phy0_clk.common, 906 + &usb_ohci1_clk.common, 907 + &usb_phy1_clk.common, 908 + &bus_ohci0_clk.common, 909 + &bus_ohci1_clk.common, 910 + &bus_ehci0_clk.common, 911 + &bus_ehci1_clk.common, 912 + &bus_otg_clk.common, 913 + &bus_lradc_clk.common, 914 + &bus_dpss_top0_clk.common, 915 + &bus_dpss_top1_clk.common, 916 + &mipi_dsi_clk.common, 917 + &bus_mipi_dsi_clk.common, 918 + &tcon_lcd_clk.common, 919 + &bus_tcon_lcd_clk.common, 920 + &ledc_clk.common, 921 + &bus_ledc_clk.common, 922 + &csi_top_clk.common, 923 + &csi0_mclk_clk.common, 924 + &csi1_mclk_clk.common, 925 + &bus_csi_clk.common, 926 + &csi_isp_clk.common, 927 + }; 928 + 929 + static struct clk_hw_onecell_data sun50i_a100_hw_clks = { 930 + .hws = { 931 + [CLK_OSC12M] = &osc12M_clk.hw, 932 + [CLK_PLL_CPUX] = &pll_cpux_clk.common.hw, 933 + [CLK_PLL_DDR0] = &pll_ddr0_clk.common.hw, 934 + [CLK_PLL_PERIPH0] = &pll_periph0_clk.common.hw, 935 + [CLK_PLL_PERIPH0_2X] = &pll_periph0_2x_clk.hw, 936 + [CLK_PLL_PERIPH1] = &pll_periph1_clk.common.hw, 937 + [CLK_PLL_PERIPH1_2X] = &pll_periph1_2x_clk.hw, 938 + [CLK_PLL_GPU] = &pll_gpu_clk.common.hw, 939 + [CLK_PLL_VIDEO0] = &pll_video0_clk.common.hw, 940 + [CLK_PLL_VIDEO0_2X] = &pll_video0_2x_clk.hw, 941 + [CLK_PLL_VIDEO0_4X] = &pll_video0_4x_clk.hw, 942 + [CLK_PLL_VIDEO1] = &pll_video1_clk.common.hw, 943 + [CLK_PLL_VIDEO1_2X] = &pll_video1_2x_clk.hw, 944 + [CLK_PLL_VIDEO1_4X] = &pll_video1_4x_clk.hw, 945 + [CLK_PLL_VIDEO2] = &pll_video2_clk.common.hw, 946 + [CLK_PLL_VIDEO2_2X] = &pll_video2_2x_clk.hw, 947 + [CLK_PLL_VIDEO2_4X] = &pll_video2_4x_clk.hw, 948 + [CLK_PLL_VIDEO3] = &pll_video3_clk.common.hw, 949 + [CLK_PLL_VIDEO3_2X] = &pll_video3_2x_clk.hw, 950 + [CLK_PLL_VIDEO3_4X] = &pll_video3_4x_clk.hw, 951 + [CLK_PLL_VE] = &pll_ve_clk.common.hw, 952 + [CLK_PLL_COM] = &pll_com_clk.common.hw, 953 + [CLK_PLL_COM_AUDIO] = &pll_com_audio_clk.hw, 954 + [CLK_PLL_AUDIO] = &pll_audio_clk.common.hw, 955 + [CLK_CPUX] = &cpux_clk.common.hw, 956 + [CLK_AXI] = &axi_clk.common.hw, 957 + [CLK_CPUX_APB] = &cpux_apb_clk.common.hw, 958 + [CLK_PSI_AHB1_AHB2] = &psi_ahb1_ahb2_clk.common.hw, 959 + [CLK_AHB3] = &ahb3_clk.common.hw, 960 + [CLK_APB1] = &apb1_clk.common.hw, 961 + [CLK_APB2] = &apb2_clk.common.hw, 962 + [CLK_MBUS] = &mbus_clk.common.hw, 963 + [CLK_DE] = &de_clk.common.hw, 964 + [CLK_BUS_DE] = &bus_de_clk.common.hw, 965 + [CLK_G2D] = &g2d_clk.common.hw, 966 + [CLK_BUS_G2D] = &bus_g2d_clk.common.hw, 967 + [CLK_GPU] = &gpu_clk.common.hw, 968 + [CLK_BUS_GPU] = &bus_gpu_clk.common.hw, 969 + [CLK_CE] = &ce_clk.common.hw, 970 + [CLK_BUS_CE] = &bus_ce_clk.common.hw, 971 + [CLK_VE] = &ve_clk.common.hw, 972 + [CLK_BUS_VE] = &bus_ve_clk.common.hw, 973 + [CLK_BUS_DMA] = &bus_dma_clk.common.hw, 974 + [CLK_BUS_MSGBOX] = &bus_msgbox_clk.common.hw, 975 + [CLK_BUS_SPINLOCK] = &bus_spinlock_clk.common.hw, 976 + [CLK_BUS_HSTIMER] = &bus_hstimer_clk.common.hw, 977 + [CLK_AVS] = &avs_clk.common.hw, 978 + [CLK_BUS_DBG] = &bus_dbg_clk.common.hw, 979 + [CLK_BUS_PSI] = &bus_psi_clk.common.hw, 980 + [CLK_BUS_PWM] = &bus_pwm_clk.common.hw, 981 + [CLK_BUS_IOMMU] = &bus_iommu_clk.common.hw, 982 + [CLK_MBUS_DMA] = &mbus_dma_clk.common.hw, 983 + [CLK_MBUS_VE] = &mbus_ve_clk.common.hw, 984 + [CLK_MBUS_CE] = &mbus_ce_clk.common.hw, 985 + [CLK_MBUS_NAND] = &mbus_nand_clk.common.hw, 986 + [CLK_MBUS_CSI] = &mbus_csi_clk.common.hw, 987 + [CLK_MBUS_ISP] = &mbus_isp_clk.common.hw, 988 + [CLK_MBUS_G2D] = &mbus_g2d_clk.common.hw, 989 + [CLK_BUS_DRAM] = &bus_dram_clk.common.hw, 990 + [CLK_NAND0] = &nand0_clk.common.hw, 991 + [CLK_NAND1] = &nand1_clk.common.hw, 992 + [CLK_BUS_NAND] = &bus_nand_clk.common.hw, 993 + [CLK_MMC0] = &mmc0_clk.common.hw, 994 + [CLK_MMC1] = &mmc1_clk.common.hw, 995 + [CLK_MMC2] = &mmc2_clk.common.hw, 996 + [CLK_BUS_MMC0] = &bus_mmc0_clk.common.hw, 997 + [CLK_BUS_MMC1] = &bus_mmc1_clk.common.hw, 998 + [CLK_BUS_MMC2] = &bus_mmc2_clk.common.hw, 999 + [CLK_BUS_UART0] = &bus_uart0_clk.common.hw, 1000 + [CLK_BUS_UART1] = &bus_uart1_clk.common.hw, 1001 + [CLK_BUS_UART2] = &bus_uart2_clk.common.hw, 1002 + [CLK_BUS_UART3] = &bus_uart3_clk.common.hw, 1003 + [CLK_BUS_UART4] = &bus_uart4_clk.common.hw, 1004 + [CLK_BUS_I2C0] = &bus_i2c0_clk.common.hw, 1005 + [CLK_BUS_I2C1] = &bus_i2c1_clk.common.hw, 1006 + [CLK_BUS_I2C2] = &bus_i2c2_clk.common.hw, 1007 + [CLK_BUS_I2C3] = &bus_i2c3_clk.common.hw, 1008 + [CLK_SPI0] = &spi0_clk.common.hw, 1009 + [CLK_SPI1] = &spi1_clk.common.hw, 1010 + [CLK_SPI2] = &spi2_clk.common.hw, 1011 + [CLK_BUS_SPI0] = &bus_spi0_clk.common.hw, 1012 + [CLK_BUS_SPI1] = &bus_spi1_clk.common.hw, 1013 + [CLK_BUS_SPI2] = &bus_spi2_clk.common.hw, 1014 + [CLK_EMAC_25M] = &emac_25m_clk.common.hw, 1015 + [CLK_BUS_EMAC] = &bus_emac_clk.common.hw, 1016 + [CLK_IR_RX] = &ir_rx_clk.common.hw, 1017 + [CLK_BUS_IR_RX] = &bus_ir_rx_clk.common.hw, 1018 + [CLK_IR_TX] = &ir_tx_clk.common.hw, 1019 + [CLK_BUS_IR_TX] = &bus_ir_tx_clk.common.hw, 1020 + [CLK_BUS_GPADC] = &bus_gpadc_clk.common.hw, 1021 + [CLK_BUS_THS] = &bus_ths_clk.common.hw, 1022 + [CLK_I2S0] = &i2s0_clk.common.hw, 1023 + [CLK_I2S1] = &i2s1_clk.common.hw, 1024 + [CLK_I2S2] = &i2s2_clk.common.hw, 1025 + [CLK_I2S3] = &i2s3_clk.common.hw, 1026 + [CLK_BUS_I2S0] = &bus_i2s0_clk.common.hw, 1027 + [CLK_BUS_I2S1] = &bus_i2s1_clk.common.hw, 1028 + [CLK_BUS_I2S2] = &bus_i2s2_clk.common.hw, 1029 + [CLK_BUS_I2S3] = &bus_i2s3_clk.common.hw, 1030 + [CLK_SPDIF] = &spdif_clk.common.hw, 1031 + [CLK_BUS_SPDIF] = &bus_spdif_clk.common.hw, 1032 + [CLK_DMIC] = &dmic_clk.common.hw, 1033 + [CLK_BUS_DMIC] = &bus_dmic_clk.common.hw, 1034 + [CLK_AUDIO_DAC] = &audio_codec_dac_clk.common.hw, 1035 + [CLK_AUDIO_ADC] = &audio_codec_adc_clk.common.hw, 1036 + [CLK_AUDIO_4X] = &audio_codec_4x_clk.common.hw, 1037 + [CLK_BUS_AUDIO_CODEC] = &bus_audio_codec_clk.common.hw, 1038 + [CLK_USB_OHCI0] = &usb_ohci0_clk.common.hw, 1039 + [CLK_USB_PHY0] = &usb_phy0_clk.common.hw, 1040 + [CLK_USB_OHCI1] = &usb_ohci1_clk.common.hw, 1041 + [CLK_USB_PHY1] = &usb_phy1_clk.common.hw, 1042 + [CLK_BUS_OHCI0] = &bus_ohci0_clk.common.hw, 1043 + [CLK_BUS_OHCI1] = &bus_ohci1_clk.common.hw, 1044 + [CLK_BUS_EHCI0] = &bus_ehci0_clk.common.hw, 1045 + [CLK_BUS_EHCI1] = &bus_ehci1_clk.common.hw, 1046 + [CLK_BUS_OTG] = &bus_otg_clk.common.hw, 1047 + [CLK_BUS_LRADC] = &bus_lradc_clk.common.hw, 1048 + [CLK_BUS_DPSS_TOP0] = &bus_dpss_top0_clk.common.hw, 1049 + [CLK_BUS_DPSS_TOP1] = &bus_dpss_top1_clk.common.hw, 1050 + [CLK_MIPI_DSI] = &mipi_dsi_clk.common.hw, 1051 + [CLK_BUS_MIPI_DSI] = &bus_mipi_dsi_clk.common.hw, 1052 + [CLK_TCON_LCD] = &tcon_lcd_clk.common.hw, 1053 + [CLK_BUS_TCON_LCD] = &bus_tcon_lcd_clk.common.hw, 1054 + [CLK_LEDC] = &ledc_clk.common.hw, 1055 + [CLK_BUS_LEDC] = &bus_ledc_clk.common.hw, 1056 + [CLK_CSI_TOP] = &csi_top_clk.common.hw, 1057 + [CLK_CSI0_MCLK] = &csi0_mclk_clk.common.hw, 1058 + [CLK_CSI1_MCLK] = &csi1_mclk_clk.common.hw, 1059 + [CLK_BUS_CSI] = &bus_csi_clk.common.hw, 1060 + [CLK_CSI_ISP] = &csi_isp_clk.common.hw, 1061 + }, 1062 + .num = CLK_NUMBER, 1063 + }; 1064 + 1065 + static struct ccu_reset_map sun50i_a100_ccu_resets[] = { 1066 + [RST_MBUS] = { 0x540, BIT(30) }, 1067 + 1068 + [RST_BUS_DE] = { 0x60c, BIT(16) }, 1069 + [RST_BUS_G2D] = { 0x63c, BIT(16) }, 1070 + [RST_BUS_GPU] = { 0x67c, BIT(16) }, 1071 + [RST_BUS_CE] = { 0x68c, BIT(16) }, 1072 + [RST_BUS_VE] = { 0x69c, BIT(16) }, 1073 + [RST_BUS_DMA] = { 0x70c, BIT(16) }, 1074 + [RST_BUS_MSGBOX] = { 0x71c, BIT(16) }, 1075 + [RST_BUS_SPINLOCK] = { 0x72c, BIT(16) }, 1076 + [RST_BUS_HSTIMER] = { 0x73c, BIT(16) }, 1077 + [RST_BUS_DBG] = { 0x78c, BIT(16) }, 1078 + [RST_BUS_PSI] = { 0x79c, BIT(16) }, 1079 + [RST_BUS_PWM] = { 0x7ac, BIT(16) }, 1080 + [RST_BUS_DRAM] = { 0x80c, BIT(16) }, 1081 + [RST_BUS_NAND] = { 0x82c, BIT(16) }, 1082 + [RST_BUS_MMC0] = { 0x84c, BIT(16) }, 1083 + [RST_BUS_MMC1] = { 0x84c, BIT(17) }, 1084 + [RST_BUS_MMC2] = { 0x84c, BIT(18) }, 1085 + [RST_BUS_UART0] = { 0x90c, BIT(16) }, 1086 + [RST_BUS_UART1] = { 0x90c, BIT(17) }, 1087 + [RST_BUS_UART2] = { 0x90c, BIT(18) }, 1088 + [RST_BUS_UART3] = { 0x90c, BIT(19) }, 1089 + [RST_BUS_UART4] = { 0x90c, BIT(20) }, 1090 + [RST_BUS_I2C0] = { 0x91c, BIT(16) }, 1091 + [RST_BUS_I2C1] = { 0x91c, BIT(17) }, 1092 + [RST_BUS_I2C2] = { 0x91c, BIT(18) }, 1093 + [RST_BUS_I2C3] = { 0x91c, BIT(19) }, 1094 + [RST_BUS_SPI0] = { 0x96c, BIT(16) }, 1095 + [RST_BUS_SPI1] = { 0x96c, BIT(17) }, 1096 + [RST_BUS_SPI2] = { 0x96c, BIT(18) }, 1097 + [RST_BUS_EMAC] = { 0x97c, BIT(16) }, 1098 + [RST_BUS_IR_RX] = { 0x99c, BIT(16) }, 1099 + [RST_BUS_IR_TX] = { 0x9cc, BIT(16) }, 1100 + [RST_BUS_GPADC] = { 0x9ec, BIT(16) }, 1101 + [RST_BUS_THS] = { 0x9fc, BIT(16) }, 1102 + [RST_BUS_I2S0] = { 0xa20, BIT(16) }, 1103 + [RST_BUS_I2S1] = { 0xa20, BIT(17) }, 1104 + [RST_BUS_I2S2] = { 0xa20, BIT(18) }, 1105 + [RST_BUS_I2S3] = { 0xa20, BIT(19) }, 1106 + [RST_BUS_SPDIF] = { 0xa2c, BIT(16) }, 1107 + [RST_BUS_DMIC] = { 0xa4c, BIT(16) }, 1108 + [RST_BUS_AUDIO_CODEC] = { 0xa5c, BIT(16) }, 1109 + 1110 + [RST_USB_PHY0] = { 0xa70, BIT(30) }, 1111 + [RST_USB_PHY1] = { 0xa74, BIT(30) }, 1112 + 1113 + [RST_BUS_OHCI0] = { 0xa8c, BIT(16) }, 1114 + [RST_BUS_OHCI1] = { 0xa8c, BIT(17) }, 1115 + [RST_BUS_EHCI0] = { 0xa8c, BIT(20) }, 1116 + [RST_BUS_EHCI1] = { 0xa8c, BIT(21) }, 1117 + [RST_BUS_OTG] = { 0xa8c, BIT(24) }, 1118 + 1119 + [RST_BUS_LRADC] = { 0xa9c, BIT(16) }, 1120 + [RST_BUS_DPSS_TOP0] = { 0xabc, BIT(16) }, 1121 + [RST_BUS_DPSS_TOP1] = { 0xacc, BIT(16) }, 1122 + [RST_BUS_MIPI_DSI] = { 0xb4c, BIT(16) }, 1123 + [RST_BUS_TCON_LCD] = { 0xb7c, BIT(16) }, 1124 + [RST_BUS_LVDS] = { 0xbac, BIT(16) }, 1125 + [RST_BUS_LEDC] = { 0xbfc, BIT(16) }, 1126 + [RST_BUS_CSI] = { 0xc1c, BIT(16) }, 1127 + [RST_BUS_CSI_ISP] = { 0xc2c, BIT(16) }, 1128 + }; 1129 + 1130 + static const struct sunxi_ccu_desc sun50i_a100_ccu_desc = { 1131 + .ccu_clks = sun50i_a100_ccu_clks, 1132 + .num_ccu_clks = ARRAY_SIZE(sun50i_a100_ccu_clks), 1133 + 1134 + .hw_clks = &sun50i_a100_hw_clks, 1135 + 1136 + .resets = sun50i_a100_ccu_resets, 1137 + .num_resets = ARRAY_SIZE(sun50i_a100_ccu_resets), 1138 + }; 1139 + 1140 + static const u32 sun50i_a100_pll_regs[] = { 1141 + SUN50I_A100_PLL_CPUX_REG, 1142 + SUN50I_A100_PLL_DDR0_REG, 1143 + SUN50I_A100_PLL_PERIPH0_REG, 1144 + SUN50I_A100_PLL_PERIPH1_REG, 1145 + SUN50I_A100_PLL_GPU_REG, 1146 + SUN50I_A100_PLL_VIDEO0_REG, 1147 + SUN50I_A100_PLL_VIDEO1_REG, 1148 + SUN50I_A100_PLL_VIDEO2_REG, 1149 + SUN50I_A100_PLL_VIDEO3_REG, 1150 + SUN50I_A100_PLL_VE_REG, 1151 + SUN50I_A100_PLL_COM_REG, 1152 + SUN50I_A100_PLL_AUDIO_REG, 1153 + }; 1154 + 1155 + static const u32 sun50i_a100_pll_video_regs[] = { 1156 + SUN50I_A100_PLL_VIDEO0_REG, 1157 + SUN50I_A100_PLL_VIDEO1_REG, 1158 + SUN50I_A100_PLL_VIDEO2_REG, 1159 + SUN50I_A100_PLL_VIDEO3_REG, 1160 + }; 1161 + 1162 + static const u32 sun50i_a100_usb2_clk_regs[] = { 1163 + SUN50I_A100_USB0_CLK_REG, 1164 + SUN50I_A100_USB1_CLK_REG, 1165 + }; 1166 + 1167 + static struct ccu_pll_nb sun50i_a100_pll_cpu_nb = { 1168 + .common = &pll_cpux_clk.common, 1169 + /* copy from pll_cpux_clk */ 1170 + .enable = BIT(27), 1171 + .lock = BIT(28), 1172 + }; 1173 + 1174 + static struct ccu_mux_nb sun50i_a100_cpu_nb = { 1175 + .common = &cpux_clk.common, 1176 + .cm = &cpux_clk.mux, 1177 + .delay_us = 1, 1178 + .bypass_index = 4, /* index of pll periph0 */ 1179 + }; 1180 + 1181 + static int sun50i_a100_ccu_probe(struct platform_device *pdev) 1182 + { 1183 + void __iomem *reg; 1184 + u32 val; 1185 + int i, ret; 1186 + 1187 + reg = devm_platform_ioremap_resource(pdev, 0); 1188 + if (IS_ERR(reg)) 1189 + return PTR_ERR(reg); 1190 + 1191 + /* 1192 + * Enable lock and enable bits on all PLLs. 1193 + * 1194 + * Due to the current design, multiple PLLs share one power switch, 1195 + * so switching PLL is easy to cause stability problems. 1196 + * When initializing, we enable them by default. When disable, 1197 + * we only turn off the output of PLL. 1198 + */ 1199 + for (i = 0; i < ARRAY_SIZE(sun50i_a100_pll_regs); i++) { 1200 + val = readl(reg + sun50i_a100_pll_regs[i]); 1201 + val |= SUN50I_A100_PLL_LOCK_ENABLE | SUN50I_A100_PLL_ENABLE; 1202 + writel(val, reg + sun50i_a100_pll_regs[i]); 1203 + } 1204 + 1205 + /* 1206 + * In order to pass the EMI certification, the SDM function of 1207 + * the peripheral 1 bus is enabled, and the frequency is still 1208 + * calculated using the previous division factor. 1209 + */ 1210 + writel(SUN50I_A100_PLL_PERIPH1_PATTERN0, 1211 + reg + SUN50I_A100_PLL_PERIPH1_PATTERN0_REG); 1212 + 1213 + val = readl(reg + SUN50I_A100_PLL_PERIPH1_REG); 1214 + val |= SUN50I_A100_PLL_SDM_ENABLE; 1215 + writel(val, reg + SUN50I_A100_PLL_PERIPH1_REG); 1216 + 1217 + /* 1218 + * Force the output divider of video PLLs to 0. 1219 + * 1220 + * See the comment before pll-video0 definition for the reason. 1221 + */ 1222 + for (i = 0; i < ARRAY_SIZE(sun50i_a100_pll_video_regs); i++) { 1223 + val = readl(reg + sun50i_a100_pll_video_regs[i]); 1224 + val &= ~BIT(0); 1225 + writel(val, reg + sun50i_a100_pll_video_regs[i]); 1226 + } 1227 + 1228 + /* 1229 + * Enforce m1 = 0, m0 = 1 for Audio PLL 1230 + * 1231 + * See the comment before pll-audio definition for the reason. 1232 + */ 1233 + val = readl(reg + SUN50I_A100_PLL_AUDIO_REG); 1234 + val &= ~BIT(1); 1235 + val |= BIT(0); 1236 + writel(val, reg + SUN50I_A100_PLL_AUDIO_REG); 1237 + 1238 + /* 1239 + * Force OHCI 12M clock sources to 00 (12MHz divided from 48MHz) 1240 + * 1241 + * This clock mux is still mysterious, and the code just enforces 1242 + * it to have a valid clock parent. 1243 + */ 1244 + for (i = 0; i < ARRAY_SIZE(sun50i_a100_usb2_clk_regs); i++) { 1245 + val = readl(reg + sun50i_a100_usb2_clk_regs[i]); 1246 + val &= ~GENMASK(25, 24); 1247 + writel(val, reg + sun50i_a100_usb2_clk_regs[i]); 1248 + } 1249 + 1250 + ret = sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_a100_ccu_desc); 1251 + if (ret) 1252 + return ret; 1253 + 1254 + /* Gate then ungate PLL CPU after any rate changes */ 1255 + ccu_pll_notifier_register(&sun50i_a100_pll_cpu_nb); 1256 + 1257 + /* Reparent CPU during PLL CPU rate changes */ 1258 + ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk, 1259 + &sun50i_a100_cpu_nb); 1260 + 1261 + return 0; 1262 + } 1263 + 1264 + static const struct of_device_id sun50i_a100_ccu_ids[] = { 1265 + { .compatible = "allwinner,sun50i-a100-ccu" }, 1266 + { } 1267 + }; 1268 + 1269 + static struct platform_driver sun50i_a100_ccu_driver = { 1270 + .probe = sun50i_a100_ccu_probe, 1271 + .driver = { 1272 + .name = "sun50i-a100-ccu", 1273 + .of_match_table = sun50i_a100_ccu_ids, 1274 + }, 1275 + }; 1276 + module_platform_driver(sun50i_a100_ccu_driver);
+56
drivers/clk/sunxi-ng/ccu-sun50i-a100.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (c) 2020 Yangtao Li <frank@allwinnertech.com> 4 + */ 5 + 6 + #ifndef _CCU_SUN50I_A100_H_ 7 + #define _CCU_SUN50I_A100_H_ 8 + 9 + #include <dt-bindings/clock/sun50i-a100-ccu.h> 10 + #include <dt-bindings/reset/sun50i-a100-ccu.h> 11 + 12 + #define CLK_OSC12M 0 13 + #define CLK_PLL_CPUX 1 14 + #define CLK_PLL_DDR0 2 15 + 16 + /* PLL_PERIPH0 exported for PRCM */ 17 + 18 + #define CLK_PLL_PERIPH0_2X 4 19 + #define CLK_PLL_PERIPH1 5 20 + #define CLK_PLL_PERIPH1_2X 6 21 + #define CLK_PLL_GPU 7 22 + #define CLK_PLL_VIDEO0 8 23 + #define CLK_PLL_VIDEO0_2X 9 24 + #define CLK_PLL_VIDEO0_4X 10 25 + #define CLK_PLL_VIDEO1 11 26 + #define CLK_PLL_VIDEO1_2X 12 27 + #define CLK_PLL_VIDEO1_4X 13 28 + #define CLK_PLL_VIDEO2 14 29 + #define CLK_PLL_VIDEO2_2X 15 30 + #define CLK_PLL_VIDEO2_4X 16 31 + #define CLK_PLL_VIDEO3 17 32 + #define CLK_PLL_VIDEO3_2X 18 33 + #define CLK_PLL_VIDEO3_4X 19 34 + #define CLK_PLL_VE 20 35 + #define CLK_PLL_COM 21 36 + #define CLK_PLL_COM_AUDIO 22 37 + #define CLK_PLL_AUDIO 23 38 + 39 + /* CPUX clock exported for DVFS */ 40 + 41 + #define CLK_AXI 25 42 + #define CLK_CPUX_APB 26 43 + #define CLK_PSI_AHB1_AHB2 27 44 + #define CLK_AHB3 28 45 + 46 + /* APB1 clock exported for PIO */ 47 + 48 + #define CLK_APB2 30 49 + 50 + /* All module clocks and bus gates are exported except DRAM */ 51 + 52 + #define CLK_BUS_DRAM 58 53 + 54 + #define CLK_NUMBER (CLK_CSI_ISP + 1) 55 + 56 + #endif /* _CCU_SUN50I_A100_H_ */
+24 -13
drivers/clk/sunxi-ng/ccu-sun8i-r40.c
··· 45 45 * the base (2x, 4x and 8x), and one variable divider (the one true 46 46 * pll audio). 47 47 * 48 - * We don't have any need for the variable divider for now, so we just 49 - * hardcode it to match with the clock names 48 + * With sigma-delta modulation for fractional-N on the audio PLL, 49 + * we have to use specific dividers. This means the variable divider 50 + * can no longer be used, as the audio codec requests the exact clock 51 + * rates we support through this mechanism. So we now hard code the 52 + * variable divider to 1. This means the clock rates will no longer 53 + * match the clock names. 50 54 */ 51 55 #define SUN8I_R40_PLL_AUDIO_REG 0x008 52 56 53 - static SUNXI_CCU_NM_WITH_GATE_LOCK(pll_audio_base_clk, "pll-audio-base", 54 - "osc24M", 0x008, 55 - 8, 7, /* N */ 56 - 0, 5, /* M */ 57 - BIT(31), /* gate */ 58 - BIT(28), /* lock */ 59 - CLK_SET_RATE_UNGATE); 57 + static struct ccu_sdm_setting pll_audio_sdm_table[] = { 58 + { .rate = 22579200, .pattern = 0xc0010d84, .m = 8, .n = 7 }, 59 + { .rate = 24576000, .pattern = 0xc000ac02, .m = 14, .n = 14 }, 60 + }; 61 + 62 + static SUNXI_CCU_NM_WITH_SDM_GATE_LOCK(pll_audio_base_clk, "pll-audio-base", 63 + "osc24M", 0x008, 64 + 8, 7, /* N */ 65 + 0, 5, /* M */ 66 + pll_audio_sdm_table, BIT(24), 67 + 0x284, BIT(31), 68 + BIT(31), /* gate */ 69 + BIT(28), /* lock */ 70 + CLK_SET_RATE_UNGATE); 60 71 61 72 static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX(pll_video0_clk, "pll-video0", 62 73 "osc24M", 0x0010, ··· 963 952 &pll_audio_base_clk.common.hw 964 953 }; 965 954 966 - /* We hardcode the divider to 4 for now */ 955 + /* We hardcode the divider to 1 for now */ 967 956 static CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", 968 957 clk_parent_pll_audio, 969 - 4, 1, CLK_SET_RATE_PARENT); 958 + 1, 1, CLK_SET_RATE_PARENT); 970 959 static CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", 971 960 clk_parent_pll_audio, 972 961 2, 1, CLK_SET_RATE_PARENT); ··· 1318 1307 if (IS_ERR(reg)) 1319 1308 return PTR_ERR(reg); 1320 1309 1321 - /* Force the PLL-Audio-1x divider to 4 */ 1310 + /* Force the PLL-Audio-1x divider to 1 */ 1322 1311 val = readl(reg + SUN8I_R40_PLL_AUDIO_REG); 1323 1312 val &= ~GENMASK(19, 16); 1324 - writel(val | (3 << 16), reg + SUN8I_R40_PLL_AUDIO_REG); 1313 + writel(val | (0 << 16), reg + SUN8I_R40_PLL_AUDIO_REG); 1325 1314 1326 1315 /* Force PLL-MIPI to MIPI mode */ 1327 1316 val = readl(reg + SUN8I_R40_PLL_MIPI_REG);
+1 -1
drivers/clk/tegra/clk-tegra210-emc.c
··· 128 128 unsigned int i; 129 129 int err; 130 130 131 - if (!provider || !provider->configs || provider->num_configs == 0) 131 + if (!provider->configs || provider->num_configs == 0) 132 132 return -EINVAL; 133 133 134 134 for (i = 0; i < provider->num_configs; i++) {
+12 -2
drivers/clk/ti/autoidle.c
··· 82 82 */ 83 83 int omap2_clk_deny_idle(struct clk *clk) 84 84 { 85 - struct clk_hw *hw = __clk_get_hw(clk); 85 + struct clk_hw *hw; 86 + 87 + if (!clk) 88 + return -EINVAL; 89 + 90 + hw = __clk_get_hw(clk); 86 91 87 92 if (omap2_clk_is_hw_omap(hw)) { 88 93 struct clk_hw_omap *c = to_clk_hw_omap(hw); ··· 106 101 */ 107 102 int omap2_clk_allow_idle(struct clk *clk) 108 103 { 109 - struct clk_hw *hw = __clk_get_hw(clk); 104 + struct clk_hw *hw; 105 + 106 + if (!clk) 107 + return -EINVAL; 108 + 109 + hw = __clk_get_hw(clk); 110 110 111 111 if (omap2_clk_is_hw_omap(hw)) { 112 112 struct clk_hw_omap *c = to_clk_hw_omap(hw);
+1
drivers/clk/ti/clk-7xx.c
··· 637 637 { DRA7_L4SEC_DES_CLKCTRL, NULL, CLKF_HW_SUP, "l3_iclk_div" }, 638 638 { DRA7_L4SEC_RNG_CLKCTRL, NULL, CLKF_HW_SUP | CLKF_SOC_NONSEC, "l4_root_clk_div" }, 639 639 { DRA7_L4SEC_SHAM_CLKCTRL, NULL, CLKF_HW_SUP, "l3_iclk_div" }, 640 + { DRA7_L4SEC_SHAM2_CLKCTRL, NULL, CLKF_HW_SUP, "l3_iclk_div" }, 640 641 { 0 }, 641 642 }; 642 643
+2
drivers/clk/ti/clockdomain.c
··· 148 148 if (!omap2_clk_is_hw_omap(clk_hw)) { 149 149 pr_warn("can't setup clkdm for basic clk %s\n", 150 150 __clk_get_name(clk)); 151 + clk_put(clk); 151 152 continue; 152 153 } 153 154 to_clk_hw_omap(clk_hw)->clkdm_name = clkdm_name; 154 155 omap2_init_clk_clkdm(clk_hw); 156 + clk_put(clk); 155 157 } 156 158 } 157 159
+1 -1
drivers/clk/uniphier/clk-uniphier-cpugear.c
··· 90 90 init.ops = &uniphier_clk_cpugear_ops; 91 91 init.flags = CLK_SET_RATE_PARENT; 92 92 init.parent_names = data->parent_names; 93 - init.num_parents = data->num_parents, 93 + init.num_parents = data->num_parents; 94 94 95 95 gear->regmap = regmap; 96 96 gear->regbase = data->regbase;
+1 -1
drivers/clk/uniphier/clk-uniphier-mux.c
··· 70 70 init.ops = &uniphier_clk_mux_ops; 71 71 init.flags = CLK_SET_RATE_PARENT; 72 72 init.parent_names = data->parent_names; 73 - init.num_parents = data->num_parents, 73 + init.num_parents = data->num_parents; 74 74 75 75 mux->regmap = regmap; 76 76 mux->reg = data->reg;
+1
include/dt-bindings/clock/dra7.h
··· 332 332 #define DRA7_L4SEC_DES_CLKCTRL DRA7_L4SEC_CLKCTRL_INDEX(0x1b0) 333 333 #define DRA7_L4SEC_RNG_CLKCTRL DRA7_L4SEC_CLKCTRL_INDEX(0x1c0) 334 334 #define DRA7_L4SEC_SHAM_CLKCTRL DRA7_L4SEC_CLKCTRL_INDEX(0x1c8) 335 + #define DRA7_L4SEC_SHAM2_CLKCTRL DRA7_L4SEC_CLKCTRL_INDEX(0x1f8) 335 336 336 337 /* l4per2 clocks */ 337 338 #define DRA7_L4PER2_CLKCTRL_OFFSET 0xc
+3 -1
include/dt-bindings/clock/exynos5250.h
··· 172 172 #define CLK_MOUT_GPLL 1025 173 173 #define CLK_MOUT_ACLK200_DISP1_SUB 1026 174 174 #define CLK_MOUT_ACLK300_DISP1_SUB 1027 175 + #define CLK_MOUT_APLL 1028 176 + #define CLK_MOUT_MPLL 1029 175 177 176 178 /* must be greater than maximal clock id */ 177 - #define CLK_NR_CLKS 1028 179 + #define CLK_NR_CLKS 1030 178 180 179 181 #endif /* _DT_BINDINGS_CLOCK_EXYNOS_5250_H */
+6
include/dt-bindings/clock/exynos5420.h
··· 230 230 #define CLK_MOUT_USER_MAU_EPLL 659 231 231 #define CLK_MOUT_SCLK_SPLL 660 232 232 #define CLK_MOUT_MX_MSPLL_CCORE_PHY 661 233 + #define CLK_MOUT_SW_ACLK_G3D 662 234 + #define CLK_MOUT_APLL 663 235 + #define CLK_MOUT_MSPLL_CPU 664 236 + #define CLK_MOUT_KPLL 665 237 + #define CLK_MOUT_MSPLL_KFC 666 238 + 233 239 234 240 /* divider clocks */ 235 241 #define CLK_DOUT_PIXEL 768
+1 -1
include/dt-bindings/clock/imx8mp-clock.h
··· 180 180 #define IMX8MP_CLK_MEDIA_MIPI_PHY1_REF 171 181 181 #define IMX8MP_CLK_MEDIA_DISP1_PIX 172 182 182 #define IMX8MP_CLK_MEDIA_CAM2_PIX 173 183 - #define IMX8MP_CLK_MEDIA_MIPI_PHY2_REF 174 183 + #define IMX8MP_CLK_MEDIA_LDB 174 184 184 #define IMX8MP_CLK_MEDIA_MIPI_CSI2_ESC 175 185 185 #define IMX8MP_CLK_PCIE2_CTRL 176 186 186 #define IMX8MP_CLK_PCIE2_PHY 177
+131
include/dt-bindings/clock/mt8167-clk.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (c) 2020 MediaTek Inc. 4 + * Copyright (c) 2020 BayLibre, SAS. 5 + * Author: James Liao <jamesjj.liao@mediatek.com> 6 + * Fabien Parent <fparent@baylibre.com> 7 + */ 8 + 9 + #ifndef _DT_BINDINGS_CLK_MT8167_H 10 + #define _DT_BINDINGS_CLK_MT8167_H 11 + 12 + /* MT8167 is based on MT8516 */ 13 + #include <dt-bindings/clock/mt8516-clk.h> 14 + 15 + /* APMIXEDSYS */ 16 + 17 + #define CLK_APMIXED_TVDPLL (CLK_APMIXED_NR_CLK + 0) 18 + #define CLK_APMIXED_LVDSPLL (CLK_APMIXED_NR_CLK + 1) 19 + #define CLK_APMIXED_HDMI_REF (CLK_APMIXED_NR_CLK + 2) 20 + #define MT8167_CLK_APMIXED_NR_CLK (CLK_APMIXED_NR_CLK + 3) 21 + 22 + /* TOPCKGEN */ 23 + 24 + #define CLK_TOP_DSI0_LNTC_DSICK (CLK_TOP_NR_CLK + 0) 25 + #define CLK_TOP_VPLL_DPIX (CLK_TOP_NR_CLK + 1) 26 + #define CLK_TOP_LVDSTX_CLKDIG_CTS (CLK_TOP_NR_CLK + 2) 27 + #define CLK_TOP_HDMTX_CLKDIG_CTS (CLK_TOP_NR_CLK + 3) 28 + #define CLK_TOP_LVDSPLL (CLK_TOP_NR_CLK + 4) 29 + #define CLK_TOP_LVDSPLL_D2 (CLK_TOP_NR_CLK + 5) 30 + #define CLK_TOP_LVDSPLL_D4 (CLK_TOP_NR_CLK + 6) 31 + #define CLK_TOP_LVDSPLL_D8 (CLK_TOP_NR_CLK + 7) 32 + #define CLK_TOP_MIPI_26M (CLK_TOP_NR_CLK + 8) 33 + #define CLK_TOP_TVDPLL (CLK_TOP_NR_CLK + 9) 34 + #define CLK_TOP_TVDPLL_D2 (CLK_TOP_NR_CLK + 10) 35 + #define CLK_TOP_TVDPLL_D4 (CLK_TOP_NR_CLK + 11) 36 + #define CLK_TOP_TVDPLL_D8 (CLK_TOP_NR_CLK + 12) 37 + #define CLK_TOP_TVDPLL_D16 (CLK_TOP_NR_CLK + 13) 38 + #define CLK_TOP_PWM_MM (CLK_TOP_NR_CLK + 14) 39 + #define CLK_TOP_CAM_MM (CLK_TOP_NR_CLK + 15) 40 + #define CLK_TOP_MFG_MM (CLK_TOP_NR_CLK + 16) 41 + #define CLK_TOP_SPM_52M (CLK_TOP_NR_CLK + 17) 42 + #define CLK_TOP_MIPI_26M_DBG (CLK_TOP_NR_CLK + 18) 43 + #define CLK_TOP_SCAM_MM (CLK_TOP_NR_CLK + 19) 44 + #define CLK_TOP_SMI_MM (CLK_TOP_NR_CLK + 20) 45 + #define CLK_TOP_26M_HDMI_SIFM (CLK_TOP_NR_CLK + 21) 46 + #define CLK_TOP_26M_CEC (CLK_TOP_NR_CLK + 22) 47 + #define CLK_TOP_32K_CEC (CLK_TOP_NR_CLK + 23) 48 + #define CLK_TOP_GCPU_B (CLK_TOP_NR_CLK + 24) 49 + #define CLK_TOP_RG_VDEC (CLK_TOP_NR_CLK + 25) 50 + #define CLK_TOP_RG_FDPI0 (CLK_TOP_NR_CLK + 26) 51 + #define CLK_TOP_RG_FDPI1 (CLK_TOP_NR_CLK + 27) 52 + #define CLK_TOP_RG_AXI_MFG (CLK_TOP_NR_CLK + 28) 53 + #define CLK_TOP_RG_SLOW_MFG (CLK_TOP_NR_CLK + 29) 54 + #define CLK_TOP_GFMUX_EMI1X_SEL (CLK_TOP_NR_CLK + 30) 55 + #define CLK_TOP_CSW_MUX_MFG_SEL (CLK_TOP_NR_CLK + 31) 56 + #define CLK_TOP_CAMTG_MM_SEL (CLK_TOP_NR_CLK + 32) 57 + #define CLK_TOP_PWM_MM_SEL (CLK_TOP_NR_CLK + 33) 58 + #define CLK_TOP_SPM_52M_SEL (CLK_TOP_NR_CLK + 34) 59 + #define CLK_TOP_MFG_MM_SEL (CLK_TOP_NR_CLK + 35) 60 + #define CLK_TOP_SMI_MM_SEL (CLK_TOP_NR_CLK + 36) 61 + #define CLK_TOP_SCAM_MM_SEL (CLK_TOP_NR_CLK + 37) 62 + #define CLK_TOP_VDEC_MM_SEL (CLK_TOP_NR_CLK + 38) 63 + #define CLK_TOP_DPI0_MM_SEL (CLK_TOP_NR_CLK + 39) 64 + #define CLK_TOP_DPI1_MM_SEL (CLK_TOP_NR_CLK + 40) 65 + #define CLK_TOP_AXI_MFG_IN_SEL (CLK_TOP_NR_CLK + 41) 66 + #define CLK_TOP_SLOW_MFG_SEL (CLK_TOP_NR_CLK + 42) 67 + #define MT8167_CLK_TOP_NR_CLK (CLK_TOP_NR_CLK + 43) 68 + 69 + /* MFGCFG */ 70 + 71 + #define CLK_MFG_BAXI 0 72 + #define CLK_MFG_BMEM 1 73 + #define CLK_MFG_BG3D 2 74 + #define CLK_MFG_B26M 3 75 + #define CLK_MFG_NR_CLK 4 76 + 77 + /* MMSYS */ 78 + 79 + #define CLK_MM_SMI_COMMON 0 80 + #define CLK_MM_SMI_LARB0 1 81 + #define CLK_MM_CAM_MDP 2 82 + #define CLK_MM_MDP_RDMA 3 83 + #define CLK_MM_MDP_RSZ0 4 84 + #define CLK_MM_MDP_RSZ1 5 85 + #define CLK_MM_MDP_TDSHP 6 86 + #define CLK_MM_MDP_WDMA 7 87 + #define CLK_MM_MDP_WROT 8 88 + #define CLK_MM_FAKE_ENG 9 89 + #define CLK_MM_DISP_OVL0 10 90 + #define CLK_MM_DISP_RDMA0 11 91 + #define CLK_MM_DISP_RDMA1 12 92 + #define CLK_MM_DISP_WDMA 13 93 + #define CLK_MM_DISP_COLOR 14 94 + #define CLK_MM_DISP_CCORR 15 95 + #define CLK_MM_DISP_AAL 16 96 + #define CLK_MM_DISP_GAMMA 17 97 + #define CLK_MM_DISP_DITHER 18 98 + #define CLK_MM_DISP_UFOE 19 99 + #define CLK_MM_DISP_PWM_MM 20 100 + #define CLK_MM_DISP_PWM_26M 21 101 + #define CLK_MM_DSI_ENGINE 22 102 + #define CLK_MM_DSI_DIGITAL 23 103 + #define CLK_MM_DPI0_ENGINE 24 104 + #define CLK_MM_DPI0_PXL 25 105 + #define CLK_MM_LVDS_PXL 26 106 + #define CLK_MM_LVDS_CTS 27 107 + #define CLK_MM_DPI1_ENGINE 28 108 + #define CLK_MM_DPI1_PXL 29 109 + #define CLK_MM_HDMI_PXL 30 110 + #define CLK_MM_HDMI_SPDIF 31 111 + #define CLK_MM_HDMI_ADSP_BCK 32 112 + #define CLK_MM_HDMI_PLL 33 113 + #define CLK_MM_NR_CLK 34 114 + 115 + /* IMGSYS */ 116 + 117 + #define CLK_IMG_LARB1_SMI 0 118 + #define CLK_IMG_CAM_SMI 1 119 + #define CLK_IMG_CAM_CAM 2 120 + #define CLK_IMG_SEN_TG 3 121 + #define CLK_IMG_SEN_CAM 4 122 + #define CLK_IMG_VENC 5 123 + #define CLK_IMG_NR_CLK 6 124 + 125 + /* VDECSYS */ 126 + 127 + #define CLK_VDEC_CKEN 0 128 + #define CLK_VDEC_LARB1_CKEN 1 129 + #define CLK_VDEC_NR_CLK 2 130 + 131 + #endif /* _DT_BINDINGS_CLK_MT8167_H */
+66
include/dt-bindings/clock/qcom,dispcc-sm8250.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. 4 + */ 5 + 6 + #ifndef _DT_BINDINGS_CLK_QCOM_DISP_CC_SM8250_H 7 + #define _DT_BINDINGS_CLK_QCOM_DISP_CC_SM8250_H 8 + 9 + /* DISP_CC clock registers */ 10 + #define DISP_CC_MDSS_AHB_CLK 0 11 + #define DISP_CC_MDSS_AHB_CLK_SRC 1 12 + #define DISP_CC_MDSS_BYTE0_CLK 2 13 + #define DISP_CC_MDSS_BYTE0_CLK_SRC 3 14 + #define DISP_CC_MDSS_BYTE0_DIV_CLK_SRC 4 15 + #define DISP_CC_MDSS_BYTE0_INTF_CLK 5 16 + #define DISP_CC_MDSS_BYTE1_CLK 6 17 + #define DISP_CC_MDSS_BYTE1_CLK_SRC 7 18 + #define DISP_CC_MDSS_BYTE1_DIV_CLK_SRC 8 19 + #define DISP_CC_MDSS_BYTE1_INTF_CLK 9 20 + #define DISP_CC_MDSS_DP_AUX1_CLK 10 21 + #define DISP_CC_MDSS_DP_AUX1_CLK_SRC 11 22 + #define DISP_CC_MDSS_DP_AUX_CLK 12 23 + #define DISP_CC_MDSS_DP_AUX_CLK_SRC 13 24 + #define DISP_CC_MDSS_DP_LINK1_CLK 14 25 + #define DISP_CC_MDSS_DP_LINK1_CLK_SRC 15 26 + #define DISP_CC_MDSS_DP_LINK1_DIV_CLK_SRC 16 27 + #define DISP_CC_MDSS_DP_LINK1_INTF_CLK 17 28 + #define DISP_CC_MDSS_DP_LINK_CLK 18 29 + #define DISP_CC_MDSS_DP_LINK_CLK_SRC 19 30 + #define DISP_CC_MDSS_DP_LINK_DIV_CLK_SRC 20 31 + #define DISP_CC_MDSS_DP_LINK_INTF_CLK 21 32 + #define DISP_CC_MDSS_DP_PIXEL1_CLK 22 33 + #define DISP_CC_MDSS_DP_PIXEL1_CLK_SRC 23 34 + #define DISP_CC_MDSS_DP_PIXEL2_CLK 24 35 + #define DISP_CC_MDSS_DP_PIXEL2_CLK_SRC 25 36 + #define DISP_CC_MDSS_DP_PIXEL_CLK 26 37 + #define DISP_CC_MDSS_DP_PIXEL_CLK_SRC 27 38 + #define DISP_CC_MDSS_ESC0_CLK 28 39 + #define DISP_CC_MDSS_ESC0_CLK_SRC 29 40 + #define DISP_CC_MDSS_ESC1_CLK 30 41 + #define DISP_CC_MDSS_ESC1_CLK_SRC 31 42 + #define DISP_CC_MDSS_MDP_CLK 32 43 + #define DISP_CC_MDSS_MDP_CLK_SRC 33 44 + #define DISP_CC_MDSS_MDP_LUT_CLK 34 45 + #define DISP_CC_MDSS_NON_GDSC_AHB_CLK 35 46 + #define DISP_CC_MDSS_PCLK0_CLK 36 47 + #define DISP_CC_MDSS_PCLK0_CLK_SRC 37 48 + #define DISP_CC_MDSS_PCLK1_CLK 38 49 + #define DISP_CC_MDSS_PCLK1_CLK_SRC 39 50 + #define DISP_CC_MDSS_ROT_CLK 40 51 + #define DISP_CC_MDSS_ROT_CLK_SRC 41 52 + #define DISP_CC_MDSS_RSCC_AHB_CLK 42 53 + #define DISP_CC_MDSS_RSCC_VSYNC_CLK 43 54 + #define DISP_CC_MDSS_VSYNC_CLK 44 55 + #define DISP_CC_MDSS_VSYNC_CLK_SRC 45 56 + #define DISP_CC_PLL0 46 57 + #define DISP_CC_PLL1 47 58 + 59 + /* DISP_CC Reset */ 60 + #define DISP_CC_MDSS_CORE_BCR 0 61 + #define DISP_CC_MDSS_RSCC_BCR 1 62 + 63 + /* DISP_CC GDSCR */ 64 + #define MDSS_GDSC 0 65 + 66 + #endif
+36
include/dt-bindings/clock/qcom,gcc-msm8994.h
··· 126 126 #define GCC_USB3_PHY_AUX_CLK 116 127 127 #define GCC_USB_HS_SYSTEM_CLK 117 128 128 #define GCC_SDCC1_AHB_CLK 118 129 + #define GCC_LPASS_Q6_AXI_CLK 119 130 + #define GCC_MSS_Q6_BIMC_AXI_CLK 120 131 + #define GCC_PCIE_0_CFG_AHB_CLK 121 132 + #define GCC_PCIE_0_MSTR_AXI_CLK 122 133 + #define GCC_PCIE_0_SLV_AXI_CLK 123 134 + #define GCC_PCIE_1_CFG_AHB_CLK 124 135 + #define GCC_PCIE_1_MSTR_AXI_CLK 125 136 + #define GCC_PCIE_1_SLV_AXI_CLK 126 137 + #define GCC_PDM_AHB_CLK 127 138 + #define GCC_SDCC2_AHB_CLK 128 139 + #define GCC_SDCC3_AHB_CLK 129 140 + #define GCC_SDCC4_AHB_CLK 130 141 + #define GCC_TSIF_AHB_CLK 131 142 + #define GCC_UFS_AHB_CLK 132 143 + #define GCC_UFS_RX_SYMBOL_0_CLK 133 144 + #define GCC_UFS_RX_SYMBOL_1_CLK 134 145 + #define GCC_UFS_TX_SYMBOL_0_CLK 135 146 + #define GCC_UFS_TX_SYMBOL_1_CLK 136 147 + #define GCC_USB2_HS_PHY_SLEEP_CLK 137 148 + #define GCC_USB30_SLEEP_CLK 138 149 + #define GCC_USB_HS_AHB_CLK 139 150 + #define GCC_USB_PHY_CFG_AHB2PHY_CLK 140 151 + 152 + /* GDSCs */ 153 + #define PCIE_GDSC 0 154 + #define PCIE_0_GDSC 1 155 + #define PCIE_1_GDSC 2 156 + #define USB30_GDSC 3 157 + #define UFS_GDSC 4 158 + 159 + /* Resets */ 160 + #define USB3_PHY_RESET 0 161 + #define USB3PHY_PHY_RESET 1 162 + #define PCIE_PHY_0_RESET 2 163 + #define PCIE_PHY_1_RESET 3 164 + #define QUSB2_PHY_RESET 4 129 165 130 166 #endif
+25
include/dt-bindings/clock/qcom,videocc-sm8150.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + /* 3 + * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 4 + */ 5 + 6 + #ifndef _DT_BINDINGS_CLK_QCOM_VIDEO_CC_SM8150_H 7 + #define _DT_BINDINGS_CLK_QCOM_VIDEO_CC_SM8150_H 8 + 9 + /* VIDEO_CC clocks */ 10 + #define VIDEO_CC_IRIS_AHB_CLK 0 11 + #define VIDEO_CC_IRIS_CLK_SRC 1 12 + #define VIDEO_CC_MVS0_CORE_CLK 2 13 + #define VIDEO_CC_MVS1_CORE_CLK 3 14 + #define VIDEO_CC_MVSC_CORE_CLK 4 15 + #define VIDEO_CC_PLL0 5 16 + 17 + /* VIDEO_CC Resets */ 18 + #define VIDEO_CC_MVSC_CORE_CLK_BCR 0 19 + 20 + /* VIDEO_CC GDSCRs */ 21 + #define VENUS_GDSC 0 22 + #define VCODEC0_GDSC 1 23 + #define VCODEC1_GDSC 2 24 + 25 + #endif
+34
include/dt-bindings/clock/qcom,videocc-sm8250.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + /* 3 + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. 4 + */ 5 + 6 + #ifndef _DT_BINDINGS_CLK_QCOM_VIDEO_CC_SM8250_H 7 + #define _DT_BINDINGS_CLK_QCOM_VIDEO_CC_SM8250_H 8 + 9 + /* VIDEO_CC clocks */ 10 + #define VIDEO_CC_MVS0_CLK_SRC 0 11 + #define VIDEO_CC_MVS0C_CLK 1 12 + #define VIDEO_CC_MVS0C_DIV2_DIV_CLK_SRC 2 13 + #define VIDEO_CC_MVS1_CLK_SRC 3 14 + #define VIDEO_CC_MVS1_DIV2_CLK 4 15 + #define VIDEO_CC_MVS1C_CLK 5 16 + #define VIDEO_CC_MVS1C_DIV2_DIV_CLK_SRC 6 17 + #define VIDEO_CC_PLL0 7 18 + #define VIDEO_CC_PLL1 8 19 + 20 + /* VIDEO_CC resets */ 21 + #define VIDEO_CC_CVP_INTERFACE_BCR 0 22 + #define VIDEO_CC_CVP_MVS0_BCR 1 23 + #define VIDEO_CC_MVS0C_CLK_ARES 2 24 + #define VIDEO_CC_CVP_MVS0C_BCR 3 25 + #define VIDEO_CC_CVP_MVS1_BCR 4 26 + #define VIDEO_CC_MVS1C_CLK_ARES 5 27 + #define VIDEO_CC_CVP_MVS1C_BCR 6 28 + 29 + #define MVS0C_GDSC 0 30 + #define MVS1C_GDSC 1 31 + #define MVS0_GDSC 2 32 + #define MVS1_GDSC 3 33 + 34 + #endif
+55
include/dt-bindings/clock/r8a779a0-cpg-mssr.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + /* 3 + * Copyright (C) 2020 Renesas Electronics Corp. 4 + */ 5 + #ifndef __DT_BINDINGS_CLOCK_R8A779A0_CPG_MSSR_H__ 6 + #define __DT_BINDINGS_CLOCK_R8A779A0_CPG_MSSR_H__ 7 + 8 + #include <dt-bindings/clock/renesas-cpg-mssr.h> 9 + 10 + /* r8a779A0 CPG Core Clocks */ 11 + #define R8A779A0_CLK_Z0 0 12 + #define R8A779A0_CLK_ZX 1 13 + #define R8A779A0_CLK_Z1 2 14 + #define R8A779A0_CLK_ZR 3 15 + #define R8A779A0_CLK_ZS 4 16 + #define R8A779A0_CLK_ZT 5 17 + #define R8A779A0_CLK_ZTR 6 18 + #define R8A779A0_CLK_S1D1 7 19 + #define R8A779A0_CLK_S1D2 8 20 + #define R8A779A0_CLK_S1D4 9 21 + #define R8A779A0_CLK_S1D8 10 22 + #define R8A779A0_CLK_S1D12 11 23 + #define R8A779A0_CLK_S3D1 12 24 + #define R8A779A0_CLK_S3D2 13 25 + #define R8A779A0_CLK_S3D4 14 26 + #define R8A779A0_CLK_LB 15 27 + #define R8A779A0_CLK_CP 16 28 + #define R8A779A0_CLK_CL 17 29 + #define R8A779A0_CLK_CL16MCK 18 30 + #define R8A779A0_CLK_ZB30 19 31 + #define R8A779A0_CLK_ZB30D2 20 32 + #define R8A779A0_CLK_ZB30D4 21 33 + #define R8A779A0_CLK_ZB31 22 34 + #define R8A779A0_CLK_ZB31D2 23 35 + #define R8A779A0_CLK_ZB31D4 24 36 + #define R8A779A0_CLK_SD0H 25 37 + #define R8A779A0_CLK_SD0 26 38 + #define R8A779A0_CLK_RPC 27 39 + #define R8A779A0_CLK_RPCD2 28 40 + #define R8A779A0_CLK_MSO 29 41 + #define R8A779A0_CLK_CANFD 30 42 + #define R8A779A0_CLK_CSI0 31 43 + #define R8A779A0_CLK_FRAY 32 44 + #define R8A779A0_CLK_DSI 33 45 + #define R8A779A0_CLK_VIP 34 46 + #define R8A779A0_CLK_ADGH 35 47 + #define R8A779A0_CLK_CNNDSP 36 48 + #define R8A779A0_CLK_ICU 37 49 + #define R8A779A0_CLK_ICUD2 38 50 + #define R8A779A0_CLK_VCBUS 39 51 + #define R8A779A0_CLK_CBFUSA 40 52 + #define R8A779A0_CLK_R 41 53 + #define R8A779A0_CLK_OSC 42 54 + 55 + #endif /* __DT_BINDINGS_CLOCK_R8A779A0_CPG_MSSR_H__ */
+116
include/dt-bindings/clock/sun50i-a100-ccu.h
··· 1 + /* SPDX-License-Identifier: (GPL-2.0+ or MIT) */ 2 + /* 3 + * Copyright (c) 2020 Yangtao Li <frank@allwinnertech.com> 4 + */ 5 + 6 + #ifndef _DT_BINDINGS_CLK_SUN50I_A100_H_ 7 + #define _DT_BINDINGS_CLK_SUN50I_A100_H_ 8 + 9 + #define CLK_PLL_PERIPH0 3 10 + 11 + #define CLK_CPUX 24 12 + 13 + #define CLK_APB1 29 14 + 15 + #define CLK_MBUS 31 16 + #define CLK_DE 32 17 + #define CLK_BUS_DE 33 18 + #define CLK_G2D 34 19 + #define CLK_BUS_G2D 35 20 + #define CLK_GPU 36 21 + #define CLK_BUS_GPU 37 22 + #define CLK_CE 38 23 + #define CLK_BUS_CE 39 24 + #define CLK_VE 40 25 + #define CLK_BUS_VE 41 26 + #define CLK_BUS_DMA 42 27 + #define CLK_BUS_MSGBOX 43 28 + #define CLK_BUS_SPINLOCK 44 29 + #define CLK_BUS_HSTIMER 45 30 + #define CLK_AVS 46 31 + #define CLK_BUS_DBG 47 32 + #define CLK_BUS_PSI 48 33 + #define CLK_BUS_PWM 49 34 + #define CLK_BUS_IOMMU 50 35 + #define CLK_MBUS_DMA 51 36 + #define CLK_MBUS_VE 52 37 + #define CLK_MBUS_CE 53 38 + #define CLK_MBUS_NAND 54 39 + #define CLK_MBUS_CSI 55 40 + #define CLK_MBUS_ISP 56 41 + #define CLK_MBUS_G2D 57 42 + 43 + #define CLK_NAND0 59 44 + #define CLK_NAND1 60 45 + #define CLK_BUS_NAND 61 46 + #define CLK_MMC0 62 47 + #define CLK_MMC1 63 48 + #define CLK_MMC2 64 49 + #define CLK_MMC3 65 50 + #define CLK_BUS_MMC0 66 51 + #define CLK_BUS_MMC1 67 52 + #define CLK_BUS_MMC2 68 53 + #define CLK_BUS_UART0 69 54 + #define CLK_BUS_UART1 70 55 + #define CLK_BUS_UART2 71 56 + #define CLK_BUS_UART3 72 57 + #define CLK_BUS_UART4 73 58 + #define CLK_BUS_I2C0 74 59 + #define CLK_BUS_I2C1 75 60 + #define CLK_BUS_I2C2 76 61 + #define CLK_BUS_I2C3 77 62 + #define CLK_SPI0 78 63 + #define CLK_SPI1 79 64 + #define CLK_SPI2 80 65 + #define CLK_BUS_SPI0 81 66 + #define CLK_BUS_SPI1 82 67 + #define CLK_BUS_SPI2 83 68 + #define CLK_EMAC_25M 84 69 + #define CLK_BUS_EMAC 85 70 + #define CLK_IR_RX 86 71 + #define CLK_BUS_IR_RX 87 72 + #define CLK_IR_TX 88 73 + #define CLK_BUS_IR_TX 89 74 + #define CLK_BUS_GPADC 90 75 + #define CLK_BUS_THS 91 76 + #define CLK_I2S0 92 77 + #define CLK_I2S1 93 78 + #define CLK_I2S2 94 79 + #define CLK_I2S3 95 80 + #define CLK_BUS_I2S0 96 81 + #define CLK_BUS_I2S1 97 82 + #define CLK_BUS_I2S2 98 83 + #define CLK_BUS_I2S3 99 84 + #define CLK_SPDIF 100 85 + #define CLK_BUS_SPDIF 101 86 + #define CLK_DMIC 102 87 + #define CLK_BUS_DMIC 103 88 + #define CLK_AUDIO_DAC 104 89 + #define CLK_AUDIO_ADC 105 90 + #define CLK_AUDIO_4X 106 91 + #define CLK_BUS_AUDIO_CODEC 107 92 + #define CLK_USB_OHCI0 108 93 + #define CLK_USB_PHY0 109 94 + #define CLK_USB_OHCI1 110 95 + #define CLK_USB_PHY1 111 96 + #define CLK_BUS_OHCI0 112 97 + #define CLK_BUS_OHCI1 113 98 + #define CLK_BUS_EHCI0 114 99 + #define CLK_BUS_EHCI1 115 100 + #define CLK_BUS_OTG 116 101 + #define CLK_BUS_LRADC 117 102 + #define CLK_BUS_DPSS_TOP0 118 103 + #define CLK_BUS_DPSS_TOP1 119 104 + #define CLK_MIPI_DSI 120 105 + #define CLK_BUS_MIPI_DSI 121 106 + #define CLK_TCON_LCD 122 107 + #define CLK_BUS_TCON_LCD 123 108 + #define CLK_LEDC 124 109 + #define CLK_BUS_LEDC 125 110 + #define CLK_CSI_TOP 126 111 + #define CLK_CSI0_MCLK 127 112 + #define CLK_CSI1_MCLK 128 113 + #define CLK_BUS_CSI 129 114 + #define CLK_CSI_ISP 130 115 + 116 + #endif /* _DT_BINDINGS_CLK_SUN50I_A100_H_ */
+23
include/dt-bindings/clock/sun50i-a100-r-ccu.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (c) 2020 Yangtao Li <frank@allwinnertech.com> 4 + */ 5 + 6 + #ifndef _DT_BINDINGS_CLK_SUN50I_A100_R_CCU_H_ 7 + #define _DT_BINDINGS_CLK_SUN50I_A100_R_CCU_H_ 8 + 9 + #define CLK_R_APB1 2 10 + 11 + #define CLK_R_APB1_TIMER 4 12 + #define CLK_R_APB1_TWD 5 13 + #define CLK_R_APB1_PWM 6 14 + #define CLK_R_APB1_BUS_PWM 7 15 + #define CLK_R_APB1_PPU 8 16 + #define CLK_R_APB2_UART 9 17 + #define CLK_R_APB2_I2C0 10 18 + #define CLK_R_APB2_I2C1 11 19 + #define CLK_R_APB1_IR 12 20 + #define CLK_R_APB1_BUS_IR 13 21 + #define CLK_R_AHB_BUS_RTC 14 22 + 23 + #endif /* _DT_BINDINGS_CLK_SUN50I_A100_R_CCU_H_ */
+2 -1
include/dt-bindings/clock/vf610-clock.h
··· 196 196 #define VF610_CLK_TCON0 187 197 197 #define VF610_CLK_TCON1 188 198 198 #define VF610_CLK_CAAM 189 199 - #define VF610_CLK_END 190 199 + #define VF610_CLK_CRC 190 200 + #define VF610_CLK_END 191 200 201 201 202 #endif /* __DT_BINDINGS_CLOCK_VF610_H */
+59
include/dt-bindings/power/r8a779a0-sysc.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + /* 3 + * Copyright (C) 2020 Renesas Electronics Corp. 4 + */ 5 + #ifndef __DT_BINDINGS_POWER_R8A779A0_SYSC_H__ 6 + #define __DT_BINDINGS_POWER_R8A779A0_SYSC_H__ 7 + 8 + /* 9 + * These power domain indices match the Power Domain Register Numbers (PDR) 10 + */ 11 + 12 + #define R8A779A0_PD_A1E0D0C0 0 13 + #define R8A779A0_PD_A1E0D0C1 1 14 + #define R8A779A0_PD_A1E0D1C0 2 15 + #define R8A779A0_PD_A1E0D1C1 3 16 + #define R8A779A0_PD_A1E1D0C0 4 17 + #define R8A779A0_PD_A1E1D0C1 5 18 + #define R8A779A0_PD_A1E1D1C0 6 19 + #define R8A779A0_PD_A1E1D1C1 7 20 + #define R8A779A0_PD_A2E0D0 16 21 + #define R8A779A0_PD_A2E0D1 17 22 + #define R8A779A0_PD_A2E1D0 18 23 + #define R8A779A0_PD_A2E1D1 19 24 + #define R8A779A0_PD_A3E0 20 25 + #define R8A779A0_PD_A3E1 21 26 + #define R8A779A0_PD_3DG_A 24 27 + #define R8A779A0_PD_3DG_B 25 28 + #define R8A779A0_PD_A1CNN2 32 29 + #define R8A779A0_PD_A1DSP0 33 30 + #define R8A779A0_PD_A2IMP01 34 31 + #define R8A779A0_PD_A2DP0 35 32 + #define R8A779A0_PD_A2CV0 36 33 + #define R8A779A0_PD_A2CV1 37 34 + #define R8A779A0_PD_A2CV4 38 35 + #define R8A779A0_PD_A2CV6 39 36 + #define R8A779A0_PD_A2CN2 40 37 + #define R8A779A0_PD_A1CNN0 41 38 + #define R8A779A0_PD_A2CN0 42 39 + #define R8A779A0_PD_A3IR 43 40 + #define R8A779A0_PD_A1CNN1 44 41 + #define R8A779A0_PD_A1DSP1 45 42 + #define R8A779A0_PD_A2IMP23 46 43 + #define R8A779A0_PD_A2DP1 47 44 + #define R8A779A0_PD_A2CV2 48 45 + #define R8A779A0_PD_A2CV3 49 46 + #define R8A779A0_PD_A2CV5 50 47 + #define R8A779A0_PD_A2CV7 51 48 + #define R8A779A0_PD_A2CN1 52 49 + #define R8A779A0_PD_A3VIP0 56 50 + #define R8A779A0_PD_A3VIP1 57 51 + #define R8A779A0_PD_A3VIP2 58 52 + #define R8A779A0_PD_A3VIP3 59 53 + #define R8A779A0_PD_A3ISP01 60 54 + #define R8A779A0_PD_A3ISP23 61 55 + 56 + /* Always-on power area */ 57 + #define R8A779A0_PD_ALWAYS_ON 64 58 + 59 + #endif /* __DT_BINDINGS_POWER_R8A779A0_SYSC_H__ */
+68
include/dt-bindings/reset/sun50i-a100-ccu.h
··· 1 + /* SPDX-License-Identifier: (GPL-2.0+ or MIT) */ 2 + /* 3 + * Copyright (c) 2020 Yangtao Li <frank@allwinnertech.com> 4 + */ 5 + 6 + #ifndef _DT_BINDINGS_RESET_SUN50I_A100_H_ 7 + #define _DT_BINDINGS_RESET_SUN50I_A100_H_ 8 + 9 + #define RST_MBUS 0 10 + #define RST_BUS_DE 1 11 + #define RST_BUS_G2D 2 12 + #define RST_BUS_GPU 3 13 + #define RST_BUS_CE 4 14 + #define RST_BUS_VE 5 15 + #define RST_BUS_DMA 6 16 + #define RST_BUS_MSGBOX 7 17 + #define RST_BUS_SPINLOCK 8 18 + #define RST_BUS_HSTIMER 9 19 + #define RST_BUS_DBG 10 20 + #define RST_BUS_PSI 11 21 + #define RST_BUS_PWM 12 22 + #define RST_BUS_DRAM 13 23 + #define RST_BUS_NAND 14 24 + #define RST_BUS_MMC0 15 25 + #define RST_BUS_MMC1 16 26 + #define RST_BUS_MMC2 17 27 + #define RST_BUS_UART0 18 28 + #define RST_BUS_UART1 19 29 + #define RST_BUS_UART2 20 30 + #define RST_BUS_UART3 21 31 + #define RST_BUS_UART4 22 32 + #define RST_BUS_I2C0 23 33 + #define RST_BUS_I2C1 24 34 + #define RST_BUS_I2C2 25 35 + #define RST_BUS_I2C3 26 36 + #define RST_BUS_SPI0 27 37 + #define RST_BUS_SPI1 28 38 + #define RST_BUS_SPI2 29 39 + #define RST_BUS_EMAC 30 40 + #define RST_BUS_IR_RX 31 41 + #define RST_BUS_IR_TX 32 42 + #define RST_BUS_GPADC 33 43 + #define RST_BUS_THS 34 44 + #define RST_BUS_I2S0 35 45 + #define RST_BUS_I2S1 36 46 + #define RST_BUS_I2S2 37 47 + #define RST_BUS_I2S3 38 48 + #define RST_BUS_SPDIF 39 49 + #define RST_BUS_DMIC 40 50 + #define RST_BUS_AUDIO_CODEC 41 51 + #define RST_USB_PHY0 42 52 + #define RST_USB_PHY1 43 53 + #define RST_BUS_OHCI0 44 54 + #define RST_BUS_OHCI1 45 55 + #define RST_BUS_EHCI0 46 56 + #define RST_BUS_EHCI1 47 57 + #define RST_BUS_OTG 48 58 + #define RST_BUS_LRADC 49 59 + #define RST_BUS_DPSS_TOP0 50 60 + #define RST_BUS_DPSS_TOP1 51 61 + #define RST_BUS_MIPI_DSI 52 62 + #define RST_BUS_TCON_LCD 53 63 + #define RST_BUS_LVDS 54 64 + #define RST_BUS_LEDC 55 65 + #define RST_BUS_CSI 56 66 + #define RST_BUS_CSI_ISP 57 67 + 68 + #endif /* _DT_BINDINGS_RESET_SUN50I_A100_H_ */
+18
include/dt-bindings/reset/sun50i-a100-r-ccu.h
··· 1 + /* SPDX-License-Identifier: (GPL-2.0+ or MIT) */ 2 + /* 3 + * Copyright (c) 2020 Yangtao Li <frank@allwinnertech.com> 4 + */ 5 + 6 + #ifndef _DT_BINDINGS_RST_SUN50I_A100_R_CCU_H_ 7 + #define _DT_BINDINGS_RST_SUN50I_A100_R_CCU_H_ 8 + 9 + #define RST_R_APB1_TIMER 0 10 + #define RST_R_APB1_BUS_PWM 1 11 + #define RST_R_APB1_PPU 2 12 + #define RST_R_APB2_UART 3 13 + #define RST_R_APB2_I2C0 4 14 + #define RST_R_APB2_I2C1 5 15 + #define RST_R_APB1_BUS_IR 6 16 + #define RST_R_AHB_BUS_RTC 7 17 + 18 + #endif /* _DT_BINDINGS_RST_SUN50I_A100_R_CCU_H_ */