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_get_parent_by_index(periph->hw.clk, 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()
165 if (periph->id < PERIPHERAL_ID_MIN) in clk_sam9x5_peripheral_enable()
168 pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID) | in clk_sam9x5_peripheral_enable()
170 AT91_PMC_PCR_DIV(periph->div) | in clk_sam9x5_peripheral_enable()
177 struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); in clk_sam9x5_peripheral_disable() local
178 struct at91_pmc *pmc = periph->pmc; in clk_sam9x5_peripheral_disable()
180 if (periph->id < PERIPHERAL_ID_MIN) in clk_sam9x5_peripheral_disable()
183 pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID) | in clk_sam9x5_peripheral_disable()
189 struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); in clk_sam9x5_peripheral_is_enabled() local
190 struct at91_pmc *pmc = periph->pmc; in clk_sam9x5_peripheral_is_enabled()
193 if (periph->id < PERIPHERAL_ID_MIN) in clk_sam9x5_peripheral_is_enabled()
197 pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID)); in clk_sam9x5_peripheral_is_enabled()
208 struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); in clk_sam9x5_peripheral_recalc_rate() local
209 struct at91_pmc *pmc = periph->pmc; in clk_sam9x5_peripheral_recalc_rate()
212 if (periph->id < PERIPHERAL_ID_MIN) in clk_sam9x5_peripheral_recalc_rate()
216 pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID)); in clk_sam9x5_peripheral_recalc_rate()
221 periph->div = PERIPHERAL_RSHIFT(tmp); in clk_sam9x5_peripheral_recalc_rate()
222 periph->auto_div = false; in clk_sam9x5_peripheral_recalc_rate()
224 clk_sam9x5_peripheral_autodiv(periph); in clk_sam9x5_peripheral_recalc_rate()
227 return parent_rate >> periph->div; in clk_sam9x5_peripheral_recalc_rate()
239 struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); in clk_sam9x5_peripheral_round_rate() local
241 if (periph->id < PERIPHERAL_ID_MIN || !periph->range.max) in clk_sam9x5_peripheral_round_rate()
244 if (periph->range.max) { in clk_sam9x5_peripheral_round_rate()
247 if (cur_rate <= periph->range.max) in clk_sam9x5_peripheral_round_rate()
281 struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); in clk_sam9x5_peripheral_set_rate() local
282 if (periph->id < PERIPHERAL_ID_MIN || !periph->range.max) { in clk_sam9x5_peripheral_set_rate()
289 if (periph->range.max && rate > periph->range.max) in clk_sam9x5_peripheral_set_rate()
294 periph->auto_div = false; in clk_sam9x5_peripheral_set_rate()
295 periph->div = shift; in clk_sam9x5_peripheral_set_rate()
317 struct clk_sam9x5_peripheral *periph; in at91_clk_register_sam9x5_peripheral() local
324 periph = kzalloc(sizeof(*periph), GFP_KERNEL); in at91_clk_register_sam9x5_peripheral()
325 if (!periph) in at91_clk_register_sam9x5_peripheral()
334 periph->id = id; in at91_clk_register_sam9x5_peripheral()
335 periph->hw.init = &init; in at91_clk_register_sam9x5_peripheral()
336 periph->div = 0; in at91_clk_register_sam9x5_peripheral()
337 periph->pmc = pmc; in at91_clk_register_sam9x5_peripheral()
338 periph->auto_div = true; in at91_clk_register_sam9x5_peripheral()
339 periph->range = *range; in at91_clk_register_sam9x5_peripheral()
341 clk = clk_register(NULL, &periph->hw); in at91_clk_register_sam9x5_peripheral()
343 kfree(periph); in at91_clk_register_sam9x5_peripheral()
345 clk_sam9x5_peripheral_autodiv(periph); in at91_clk_register_sam9x5_peripheral()