Lines Matching defs:periph
49 struct clk_peripheral *periph = to_clk_peripheral(hw);
51 u32 id = periph->id;
57 regmap_write(periph->regmap, offset, PERIPHERAL_MASK(id));
64 struct clk_peripheral *periph = to_clk_peripheral(hw);
66 u32 id = periph->id;
72 regmap_write(periph->regmap, offset, PERIPHERAL_MASK(id));
77 struct clk_peripheral *periph = to_clk_peripheral(hw);
80 u32 id = periph->id;
86 regmap_read(periph->regmap, offset, &status);
101 struct clk_peripheral *periph;
109 periph = kzalloc(sizeof(*periph), GFP_KERNEL);
110 if (!periph)
119 periph->id = id;
120 periph->hw.init = &init;
121 periph->regmap = regmap;
123 hw = &periph->hw;
124 ret = clk_hw_register(NULL, &periph->hw);
126 kfree(periph);
133 static void clk_sam9x5_peripheral_autodiv(struct clk_sam9x5_peripheral *periph)
139 if (!periph->auto_div)
142 if (periph->range.max) {
143 parent = clk_hw_get_parent_by_index(&periph->hw, 0);
149 if (parent_rate >> shift <= periph->range.max)
154 periph->auto_div = false;
155 periph->div = shift;
160 struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw);
163 if (periph->id < PERIPHERAL_ID_MIN)
166 spin_lock_irqsave(periph->lock, flags);
167 regmap_write(periph->regmap, periph->layout->offset,
168 (periph->id & periph->layout->pid_mask));
169 regmap_update_bits(periph->regmap, periph->layout->offset,
170 periph->layout->div_mask | periph->layout->cmd |
172 field_prep(periph->layout->div_mask, periph->div) |
173 periph->layout->cmd |
175 spin_unlock_irqrestore(periph->lock, flags);
182 struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw);
185 if (periph->id < PERIPHERAL_ID_MIN)
188 spin_lock_irqsave(periph->lock, flags);
189 regmap_write(periph->regmap, periph->layout->offset,
190 (periph->id & periph->layout->pid_mask));
191 regmap_update_bits(periph->regmap, periph->layout->offset,
192 AT91_PMC_PCR_EN | periph->layout->cmd,
193 periph->layout->cmd);
194 spin_unlock_irqrestore(periph->lock, flags);
199 struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw);
203 if (periph->id < PERIPHERAL_ID_MIN)
206 spin_lock_irqsave(periph->lock, flags);
207 regmap_write(periph->regmap, periph->layout->offset,
208 (periph->id & periph->layout->pid_mask));
209 regmap_read(periph->regmap, periph->layout->offset, &status);
210 spin_unlock_irqrestore(periph->lock, flags);
219 struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw);
223 if (periph->id < PERIPHERAL_ID_MIN)
226 spin_lock_irqsave(periph->lock, flags);
227 regmap_write(periph->regmap, periph->layout->offset,
228 (periph->id & periph->layout->pid_mask));
229 regmap_read(periph->regmap, periph->layout->offset, &status);
230 spin_unlock_irqrestore(periph->lock, flags);
233 periph->div = field_get(periph->layout->div_mask, status);
234 periph->auto_div = false;
236 clk_sam9x5_peripheral_autodiv(periph);
239 return parent_rate >> periph->div;
262 struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw);
271 if (periph->id < PERIPHERAL_ID_MIN || !periph->range.max)
278 if (periph->range.max && tmp_rate > periph->range.max)
288 if (periph->chg_pid < 0)
292 parent = clk_hw_get_parent_by_index(hw, periph->chg_pid);
310 (periph->range.max && best_rate > periph->range.max))
332 struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw);
334 if (periph->id < PERIPHERAL_ID_MIN || !periph->range.max)
337 if (periph->range.max) {
340 if (cur_rate <= periph->range.max)
374 struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw);
375 if (periph->id < PERIPHERAL_ID_MIN || !periph->range.max) {
382 if (periph->range.max && rate > periph->range.max)
387 periph->auto_div = false;
388 periph->div = shift;
421 struct clk_sam9x5_peripheral *periph;
429 periph = kzalloc(sizeof(*periph), GFP_KERNEL);
430 if (!periph)
445 periph->id = id;
446 periph->hw.init = &init;
447 periph->div = 0;
448 periph->regmap = regmap;
449 periph->lock = lock;
451 periph->auto_div = true;
452 periph->layout = layout;
453 periph->range = *range;
454 periph->chg_pid = chg_pid;
456 hw = &periph->hw;
457 ret = clk_hw_register(NULL, &periph->hw);
459 kfree(periph);
462 clk_sam9x5_peripheral_autodiv(periph);