• Home
  • Raw
  • Download

Lines Matching +full:reg +full:- +full:init

1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2010-2011 Canonical Ltd <jeremy.kerr@canonical.com>
4 * Copyright (C) 2011-2012 Mike Turquette, Linaro Ltd <mturquette@linaro.org>
9 #include <linux/clk-provider.h>
20 * prepare - clk_(un)prepare only ensures parent is (un)prepared
21 * enable - clk_enable and clk_disable are functional & control gating
22 * rate - inherits rate from parent. No clk_set_rate support
23 * parent - fixed parent. No clk_set_parent support
28 if (gate->flags & CLK_GATE_BIG_ENDIAN) in clk_gate_readl()
29 return ioread32be(gate->reg); in clk_gate_readl()
31 return readl(gate->reg); in clk_gate_readl()
36 if (gate->flags & CLK_GATE_BIG_ENDIAN) in clk_gate_writel()
37 iowrite32be(val, gate->reg); in clk_gate_writel()
39 writel(val, gate->reg); in clk_gate_writel()
46 * set2dis = 1 -> clear bit -> set = 0
47 * set2dis = 0 -> set bit -> set = 1
50 * set2dis = 1 -> set bit -> set = 1
51 * set2dis = 0 -> clear bit -> set = 0
58 int set = gate->flags & CLK_GATE_SET_TO_DISABLE ? 1 : 0; in clk_gate_endisable()
60 u32 reg; in clk_gate_endisable() local
64 if (gate->lock) in clk_gate_endisable()
65 spin_lock_irqsave(gate->lock, flags); in clk_gate_endisable()
67 __acquire(gate->lock); in clk_gate_endisable()
69 if (gate->flags & CLK_GATE_HIWORD_MASK) { in clk_gate_endisable()
70 reg = BIT(gate->bit_idx + 16); in clk_gate_endisable()
72 reg |= BIT(gate->bit_idx); in clk_gate_endisable()
74 reg = clk_gate_readl(gate); in clk_gate_endisable()
77 reg |= BIT(gate->bit_idx); in clk_gate_endisable()
79 reg &= ~BIT(gate->bit_idx); in clk_gate_endisable()
82 clk_gate_writel(gate, reg); in clk_gate_endisable()
84 if (gate->lock) in clk_gate_endisable()
85 spin_unlock_irqrestore(gate->lock, flags); in clk_gate_endisable()
87 __release(gate->lock); in clk_gate_endisable()
104 u32 reg; in clk_gate_is_enabled() local
107 reg = clk_gate_readl(gate); in clk_gate_is_enabled()
110 if (gate->flags & CLK_GATE_SET_TO_DISABLE) in clk_gate_is_enabled()
111 reg ^= BIT(gate->bit_idx); in clk_gate_is_enabled()
113 reg &= BIT(gate->bit_idx); in clk_gate_is_enabled()
115 return reg ? 1 : 0; in clk_gate_is_enabled()
131 void __iomem *reg, u8 bit_idx, in __clk_hw_register_gate() argument
136 struct clk_init_data init = {}; in __clk_hw_register_gate() local
137 int ret = -EINVAL; in __clk_hw_register_gate()
142 return ERR_PTR(-EINVAL); in __clk_hw_register_gate()
149 return ERR_PTR(-ENOMEM); in __clk_hw_register_gate()
151 init.name = name; in __clk_hw_register_gate()
152 init.ops = &clk_gate_ops; in __clk_hw_register_gate()
153 init.flags = flags; in __clk_hw_register_gate()
154 init.parent_names = parent_name ? &parent_name : NULL; in __clk_hw_register_gate()
155 init.parent_hws = parent_hw ? &parent_hw : NULL; in __clk_hw_register_gate()
156 init.parent_data = parent_data; in __clk_hw_register_gate()
158 init.num_parents = 1; in __clk_hw_register_gate()
160 init.num_parents = 0; in __clk_hw_register_gate()
163 gate->reg = reg; in __clk_hw_register_gate()
164 gate->bit_idx = bit_idx; in __clk_hw_register_gate()
165 gate->flags = clk_gate_flags; in __clk_hw_register_gate()
166 gate->lock = lock; in __clk_hw_register_gate()
167 gate->hw.init = &init; in __clk_hw_register_gate()
169 hw = &gate->hw; in __clk_hw_register_gate()
186 void __iomem *reg, u8 bit_idx, in clk_register_gate() argument
191 hw = clk_hw_register_gate(dev, name, parent_name, flags, reg, in clk_register_gate()
195 return hw->clk; in clk_register_gate()