Lines Matching refs:periph

56 	struct clk_peripheral *periph = to_clk_peripheral(hw);  in clk_peripheral_enable()  local
57 struct at91_pmc *pmc = periph->pmc; in clk_peripheral_enable()
59 u32 id = periph->id; in clk_peripheral_enable()
71 struct clk_peripheral *periph = to_clk_peripheral(hw); in clk_peripheral_disable() local
72 struct at91_pmc *pmc = periph->pmc; in clk_peripheral_disable()
74 u32 id = periph->id; in clk_peripheral_disable()
85 struct clk_peripheral *periph = to_clk_peripheral(hw); in clk_peripheral_is_enabled() local
86 struct at91_pmc *pmc = periph->pmc; in clk_peripheral_is_enabled()
88 u32 id = periph->id; in clk_peripheral_is_enabled()
107 struct clk_peripheral *periph; in at91_clk_register_peripheral() local
114 periph = kzalloc(sizeof(*periph), GFP_KERNEL); in at91_clk_register_peripheral()
115 if (!periph) in at91_clk_register_peripheral()
124 periph->id = id; in at91_clk_register_peripheral()
125 periph->hw.init = &init; in at91_clk_register_peripheral()
126 periph->pmc = pmc; in at91_clk_register_peripheral()
128 clk = clk_register(NULL, &periph->hw); in at91_clk_register_peripheral()
130 kfree(periph); in at91_clk_register_peripheral()
135 static void clk_sam9x5_peripheral_autodiv(struct clk_sam9x5_peripheral *periph) in clk_sam9x5_peripheral_autodiv() argument
141 if (!periph->auto_div) in clk_sam9x5_peripheral_autodiv()
144 if (periph->range.max) { in clk_sam9x5_peripheral_autodiv()
145 parent = clk_hw_get_parent_by_index(&periph->hw, 0); in clk_sam9x5_peripheral_autodiv()
151 if (parent_rate >> shift <= periph->range.max) in clk_sam9x5_peripheral_autodiv()
156 periph->auto_div = false; in clk_sam9x5_peripheral_autodiv()
157 periph->div = shift; in clk_sam9x5_peripheral_autodiv()
162 struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); in clk_sam9x5_peripheral_enable() local
163 struct at91_pmc *pmc = periph->pmc; in clk_sam9x5_peripheral_enable()
166 if (periph->id < PERIPHERAL_ID_MIN) in clk_sam9x5_peripheral_enable()
170 pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID_MASK)); in clk_sam9x5_peripheral_enable()
172 pmc_write(pmc, AT91_PMC_PCR, tmp | AT91_PMC_PCR_DIV(periph->div) in clk_sam9x5_peripheral_enable()
181 struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); in clk_sam9x5_peripheral_disable() local
182 struct at91_pmc *pmc = periph->pmc; in clk_sam9x5_peripheral_disable()
185 if (periph->id < PERIPHERAL_ID_MIN) in clk_sam9x5_peripheral_disable()
189 pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID_MASK)); in clk_sam9x5_peripheral_disable()
197 struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); in clk_sam9x5_peripheral_is_enabled() local
198 struct at91_pmc *pmc = periph->pmc; in clk_sam9x5_peripheral_is_enabled()
201 if (periph->id < PERIPHERAL_ID_MIN) in clk_sam9x5_peripheral_is_enabled()
205 pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID_MASK)); in clk_sam9x5_peripheral_is_enabled()
216 struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); in clk_sam9x5_peripheral_recalc_rate() local
217 struct at91_pmc *pmc = periph->pmc; in clk_sam9x5_peripheral_recalc_rate()
220 if (periph->id < PERIPHERAL_ID_MIN) in clk_sam9x5_peripheral_recalc_rate()
224 pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID_MASK)); in clk_sam9x5_peripheral_recalc_rate()
229 periph->div = PERIPHERAL_RSHIFT(tmp); in clk_sam9x5_peripheral_recalc_rate()
230 periph->auto_div = false; in clk_sam9x5_peripheral_recalc_rate()
232 clk_sam9x5_peripheral_autodiv(periph); in clk_sam9x5_peripheral_recalc_rate()
235 return parent_rate >> periph->div; in clk_sam9x5_peripheral_recalc_rate()
247 struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); in clk_sam9x5_peripheral_round_rate() local
249 if (periph->id < PERIPHERAL_ID_MIN || !periph->range.max) in clk_sam9x5_peripheral_round_rate()
252 if (periph->range.max) { in clk_sam9x5_peripheral_round_rate()
255 if (cur_rate <= periph->range.max) in clk_sam9x5_peripheral_round_rate()
289 struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); in clk_sam9x5_peripheral_set_rate() local
290 if (periph->id < PERIPHERAL_ID_MIN || !periph->range.max) { in clk_sam9x5_peripheral_set_rate()
297 if (periph->range.max && rate > periph->range.max) in clk_sam9x5_peripheral_set_rate()
302 periph->auto_div = false; in clk_sam9x5_peripheral_set_rate()
303 periph->div = shift; in clk_sam9x5_peripheral_set_rate()
325 struct clk_sam9x5_peripheral *periph; in at91_clk_register_sam9x5_peripheral() local
332 periph = kzalloc(sizeof(*periph), GFP_KERNEL); in at91_clk_register_sam9x5_peripheral()
333 if (!periph) in at91_clk_register_sam9x5_peripheral()
342 periph->id = id; in at91_clk_register_sam9x5_peripheral()
343 periph->hw.init = &init; in at91_clk_register_sam9x5_peripheral()
344 periph->div = 0; in at91_clk_register_sam9x5_peripheral()
345 periph->pmc = pmc; in at91_clk_register_sam9x5_peripheral()
346 periph->auto_div = true; in at91_clk_register_sam9x5_peripheral()
347 periph->range = *range; in at91_clk_register_sam9x5_peripheral()
349 clk = clk_register(NULL, &periph->hw); in at91_clk_register_sam9x5_peripheral()
351 kfree(periph); in at91_clk_register_sam9x5_peripheral()
353 clk_sam9x5_peripheral_autodiv(periph); in at91_clk_register_sam9x5_peripheral()