Lines Matching +full:reg +full:- +full:init
1 // SPDX-License-Identifier: GPL-2.0+
8 #include <linux/clk-provider.h>
14 #include "clk-scu.h"
23 * struct clk_lpcg_scu - Description of LPCG clock
26 * @reg: register of this LPCG clock
34 void __iomem *reg; member
48 u32 reg, val; in clk_lpcg_scu_enable() local
52 reg = readl_relaxed(clk->reg); in clk_lpcg_scu_enable()
53 reg &= ~(CLK_GATE_SCU_LPCG_MASK << clk->bit_idx); in clk_lpcg_scu_enable()
56 if (clk->hw_gate) in clk_lpcg_scu_enable()
59 reg |= val << clk->bit_idx; in clk_lpcg_scu_enable()
60 writel(reg, clk->reg); in clk_lpcg_scu_enable()
71 u32 reg; in clk_lpcg_scu_disable() local
75 reg = readl_relaxed(clk->reg); in clk_lpcg_scu_disable()
76 reg &= ~(CLK_GATE_SCU_LPCG_MASK << clk->bit_idx); in clk_lpcg_scu_disable()
77 writel(reg, clk->reg); in clk_lpcg_scu_disable()
89 void __iomem *reg, u8 bit_idx, bool hw_gate) in __imx_clk_lpcg_scu() argument
92 struct clk_init_data init; in __imx_clk_lpcg_scu() local
98 return ERR_PTR(-ENOMEM); in __imx_clk_lpcg_scu()
100 clk->reg = reg; in __imx_clk_lpcg_scu()
101 clk->bit_idx = bit_idx; in __imx_clk_lpcg_scu()
102 clk->hw_gate = hw_gate; in __imx_clk_lpcg_scu()
104 init.name = name; in __imx_clk_lpcg_scu()
105 init.ops = &clk_lpcg_scu_ops; in __imx_clk_lpcg_scu()
106 init.flags = CLK_SET_RATE_PARENT | flags; in __imx_clk_lpcg_scu()
107 init.parent_names = parent_name ? &parent_name : NULL; in __imx_clk_lpcg_scu()
108 init.num_parents = parent_name ? 1 : 0; in __imx_clk_lpcg_scu()
110 clk->hw.init = &init; in __imx_clk_lpcg_scu()
112 hw = &clk->hw; in __imx_clk_lpcg_scu()
130 clk_hw_unregister(&clk->hw); in imx_clk_lpcg_scu_unregister()
138 clk->state = readl_relaxed(clk->reg); in imx_clk_lpcg_scu_suspend()
139 dev_dbg(dev, "save lpcg state 0x%x\n", clk->state); in imx_clk_lpcg_scu_suspend()
153 writel(clk->state, clk->reg); in imx_clk_lpcg_scu_resume()
154 writel(clk->state, clk->reg); in imx_clk_lpcg_scu_resume()
155 dev_dbg(dev, "restore lpcg state 0x%x\n", clk->state); in imx_clk_lpcg_scu_resume()