Lines Matching refs:gate

18 /* Macros to assist peripheral gate clock */
19 #define read_enb(gate) \
20 readl_relaxed(gate->clk_base + (gate->regs->enb_reg))
21 #define write_enb_set(val, gate) \
22 writel_relaxed(val, gate->clk_base + (gate->regs->enb_set_reg))
23 #define write_enb_clr(val, gate) \
24 writel_relaxed(val, gate->clk_base + (gate->regs->enb_clr_reg))
26 #define read_rst(gate) \
27 readl_relaxed(gate->clk_base + (gate->regs->rst_reg))
28 #define write_rst_clr(val, gate) \
29 writel_relaxed(val, gate->clk_base + (gate->regs->rst_clr_reg))
31 #define periph_clk_to_bit(gate) (1 << (gate->clk_num % 32))
35 /* Peripheral gate clock ops */
38 struct tegra_clk_periph_gate *gate = to_clk_periph_gate(hw);
41 if (!(read_enb(gate) & periph_clk_to_bit(gate)))
44 if (!(gate->flags & TEGRA_PERIPH_NO_RESET))
45 if (read_rst(gate) & periph_clk_to_bit(gate))
53 struct tegra_clk_periph_gate *gate = to_clk_periph_gate(hw);
55 write_enb_set(periph_clk_to_bit(gate), gate);
58 if (gate->flags & TEGRA_PERIPH_WAR_1005168) {
59 writel_relaxed(0, gate->clk_base + LVL2_CLK_GATE_OVRE);
60 writel_relaxed(BIT(22), gate->clk_base + LVL2_CLK_GATE_OVRE);
62 writel_relaxed(0, gate->clk_base + LVL2_CLK_GATE_OVRE);
68 struct tegra_clk_periph_gate *gate = to_clk_periph_gate(hw);
75 if (gate->flags & TEGRA_PERIPH_ON_APB)
78 write_enb_clr(periph_clk_to_bit(gate), gate);
83 struct tegra_clk_periph_gate *gate = to_clk_periph_gate(hw);
88 if (!gate->enable_refcnt[gate->clk_num]++)
98 struct tegra_clk_periph_gate *gate = to_clk_periph_gate(hw);
103 WARN_ON(!gate->enable_refcnt[gate->clk_num]);
105 if (--gate->enable_refcnt[gate->clk_num] == 0)
113 struct tegra_clk_periph_gate *gate = to_clk_periph_gate(hw);
123 if (!gate->enable_refcnt[gate->clk_num])
140 struct tegra_clk_periph_gate *gate;
149 gate = kzalloc(sizeof(*gate), GFP_KERNEL);
150 if (!gate) {
151 pr_err("%s: could not allocate periph gate clk\n", __func__);
161 gate->magic = TEGRA_CLK_PERIPH_GATE_MAGIC;
162 gate->clk_base = clk_base;
163 gate->clk_num = clk_num;
164 gate->flags = gate_flags;
165 gate->enable_refcnt = enable_refcnt;
166 gate->regs = pregs;
169 gate->hw.init = &init;
171 clk = clk_register(NULL, &gate->hw);
173 kfree(gate);