@@ -93,8 +93,8 @@ static int sam9x60_frac_pll_set(struct sam9x60_pll_core *core)
9393
9494 spin_lock_irqsave (core -> lock , flags );
9595
96- regmap_update_bits (regmap , AT91_PMC_PLL_UPDT ,
97- AT91_PMC_PLL_UPDT_ID_MSK , core -> id );
96+ regmap_write_bits (regmap , AT91_PMC_PLL_UPDT ,
97+ AT91_PMC_PLL_UPDT_ID_MSK , core -> id );
9898 regmap_read (regmap , AT91_PMC_PLL_CTRL1 , & val );
9999 cmul = (val & core -> layout -> mul_mask ) >> core -> layout -> mul_shift ;
100100 cfrac = (val & core -> layout -> frac_mask ) >> core -> layout -> frac_shift ;
@@ -103,11 +103,8 @@ static int sam9x60_frac_pll_set(struct sam9x60_pll_core *core)
103103 (cmul == frac -> mul && cfrac == frac -> frac ))
104104 goto unlock ;
105105
106- /* Recommended value for PMC_PLL_ACR */
107- if (core -> characteristics -> upll )
108- val = AT91_PMC_PLL_ACR_DEFAULT_UPLL ;
109- else
110- val = AT91_PMC_PLL_ACR_DEFAULT_PLLA ;
106+ /* Load recommended value for PMC_PLL_ACR */
107+ val = core -> characteristics -> acr ;
111108 regmap_write (regmap , AT91_PMC_PLL_ACR , val );
112109
113110 regmap_write (regmap , AT91_PMC_PLL_CTRL1 ,
@@ -128,17 +125,17 @@ static int sam9x60_frac_pll_set(struct sam9x60_pll_core *core)
128125 udelay (10 );
129126 }
130127
131- regmap_update_bits (regmap , AT91_PMC_PLL_UPDT ,
132- AT91_PMC_PLL_UPDT_UPDATE | AT91_PMC_PLL_UPDT_ID_MSK ,
133- AT91_PMC_PLL_UPDT_UPDATE | core -> id );
128+ regmap_write_bits (regmap , AT91_PMC_PLL_UPDT ,
129+ AT91_PMC_PLL_UPDT_UPDATE | AT91_PMC_PLL_UPDT_ID_MSK ,
130+ AT91_PMC_PLL_UPDT_UPDATE | core -> id );
134131
135132 regmap_update_bits (regmap , AT91_PMC_PLL_CTRL0 ,
136133 AT91_PMC_PLL_CTRL0_ENLOCK | AT91_PMC_PLL_CTRL0_ENPLL ,
137134 AT91_PMC_PLL_CTRL0_ENLOCK | AT91_PMC_PLL_CTRL0_ENPLL );
138135
139- regmap_update_bits (regmap , AT91_PMC_PLL_UPDT ,
140- AT91_PMC_PLL_UPDT_UPDATE | AT91_PMC_PLL_UPDT_ID_MSK ,
141- AT91_PMC_PLL_UPDT_UPDATE | core -> id );
136+ regmap_write_bits (regmap , AT91_PMC_PLL_UPDT ,
137+ AT91_PMC_PLL_UPDT_UPDATE | AT91_PMC_PLL_UPDT_ID_MSK ,
138+ AT91_PMC_PLL_UPDT_UPDATE | core -> id );
142139
143140 while (!sam9x60_pll_ready (regmap , core -> id ))
144141 cpu_relax ();
@@ -164,18 +161,18 @@ static void sam9x60_frac_pll_unprepare(struct clk_hw *hw)
164161
165162 spin_lock_irqsave (core -> lock , flags );
166163
167- regmap_update_bits (regmap , AT91_PMC_PLL_UPDT ,
168- AT91_PMC_PLL_UPDT_ID_MSK , core -> id );
164+ regmap_write_bits (regmap , AT91_PMC_PLL_UPDT ,
165+ AT91_PMC_PLL_UPDT_ID_MSK , core -> id );
169166
170167 regmap_update_bits (regmap , AT91_PMC_PLL_CTRL0 , AT91_PMC_PLL_CTRL0_ENPLL , 0 );
171168
172169 if (core -> characteristics -> upll )
173170 regmap_update_bits (regmap , AT91_PMC_PLL_ACR ,
174171 AT91_PMC_PLL_ACR_UTMIBG | AT91_PMC_PLL_ACR_UTMIVR , 0 );
175172
176- regmap_update_bits (regmap , AT91_PMC_PLL_UPDT ,
177- AT91_PMC_PLL_UPDT_UPDATE | AT91_PMC_PLL_UPDT_ID_MSK ,
178- AT91_PMC_PLL_UPDT_UPDATE | core -> id );
173+ regmap_write_bits (regmap , AT91_PMC_PLL_UPDT ,
174+ AT91_PMC_PLL_UPDT_UPDATE | AT91_PMC_PLL_UPDT_ID_MSK ,
175+ AT91_PMC_PLL_UPDT_UPDATE | core -> id );
179176
180177 spin_unlock_irqrestore (core -> lock , flags );
181178}
@@ -262,8 +259,8 @@ static int sam9x60_frac_pll_set_rate_chg(struct clk_hw *hw, unsigned long rate,
262259
263260 spin_lock_irqsave (core -> lock , irqflags );
264261
265- regmap_update_bits (regmap , AT91_PMC_PLL_UPDT , AT91_PMC_PLL_UPDT_ID_MSK ,
266- core -> id );
262+ regmap_write_bits (regmap , AT91_PMC_PLL_UPDT , AT91_PMC_PLL_UPDT_ID_MSK ,
263+ core -> id );
267264 regmap_read (regmap , AT91_PMC_PLL_CTRL1 , & val );
268265 cmul = (val & core -> layout -> mul_mask ) >> core -> layout -> mul_shift ;
269266 cfrac = (val & core -> layout -> frac_mask ) >> core -> layout -> frac_shift ;
@@ -275,18 +272,18 @@ static int sam9x60_frac_pll_set_rate_chg(struct clk_hw *hw, unsigned long rate,
275272 (frac -> mul << core -> layout -> mul_shift ) |
276273 (frac -> frac << core -> layout -> frac_shift ));
277274
278- regmap_update_bits (regmap , AT91_PMC_PLL_UPDT ,
279- AT91_PMC_PLL_UPDT_UPDATE | AT91_PMC_PLL_UPDT_ID_MSK ,
280- AT91_PMC_PLL_UPDT_UPDATE | core -> id );
275+ regmap_write_bits (regmap , AT91_PMC_PLL_UPDT ,
276+ AT91_PMC_PLL_UPDT_UPDATE | AT91_PMC_PLL_UPDT_ID_MSK ,
277+ AT91_PMC_PLL_UPDT_UPDATE | core -> id );
281278
282279 regmap_update_bits (regmap , AT91_PMC_PLL_CTRL0 ,
283280 AT91_PMC_PLL_CTRL0_ENLOCK | AT91_PMC_PLL_CTRL0_ENPLL ,
284281 AT91_PMC_PLL_CTRL0_ENLOCK |
285282 AT91_PMC_PLL_CTRL0_ENPLL );
286283
287- regmap_update_bits (regmap , AT91_PMC_PLL_UPDT ,
288- AT91_PMC_PLL_UPDT_UPDATE | AT91_PMC_PLL_UPDT_ID_MSK ,
289- AT91_PMC_PLL_UPDT_UPDATE | core -> id );
284+ regmap_write_bits (regmap , AT91_PMC_PLL_UPDT ,
285+ AT91_PMC_PLL_UPDT_UPDATE | AT91_PMC_PLL_UPDT_ID_MSK ,
286+ AT91_PMC_PLL_UPDT_UPDATE | core -> id );
290287
291288 while (!sam9x60_pll_ready (regmap , core -> id ))
292289 cpu_relax ();
@@ -338,7 +335,10 @@ static const struct clk_ops sam9x60_frac_pll_ops_chg = {
338335 .restore_context = sam9x60_frac_pll_restore_context ,
339336};
340337
341- /* This function should be called with spinlock acquired. */
338+ /* This function should be called with spinlock acquired.
339+ * Warning: this function must be called only if the same PLL ID was set in
340+ * PLL_UPDT register previously.
341+ */
342342static void sam9x60_div_pll_set_div (struct sam9x60_pll_core * core , u32 div ,
343343 bool enable )
344344{
@@ -350,9 +350,9 @@ static void sam9x60_div_pll_set_div(struct sam9x60_pll_core *core, u32 div,
350350 core -> layout -> div_mask | ena_msk ,
351351 (div << core -> layout -> div_shift ) | ena_val );
352352
353- regmap_update_bits (regmap , AT91_PMC_PLL_UPDT ,
354- AT91_PMC_PLL_UPDT_UPDATE | AT91_PMC_PLL_UPDT_ID_MSK ,
355- AT91_PMC_PLL_UPDT_UPDATE | core -> id );
353+ regmap_write_bits (regmap , AT91_PMC_PLL_UPDT ,
354+ AT91_PMC_PLL_UPDT_UPDATE | AT91_PMC_PLL_UPDT_ID_MSK ,
355+ AT91_PMC_PLL_UPDT_UPDATE | core -> id );
356356
357357 while (!sam9x60_pll_ready (regmap , core -> id ))
358358 cpu_relax ();
@@ -366,8 +366,8 @@ static int sam9x60_div_pll_set(struct sam9x60_pll_core *core)
366366 unsigned int val , cdiv ;
367367
368368 spin_lock_irqsave (core -> lock , flags );
369- regmap_update_bits (regmap , AT91_PMC_PLL_UPDT ,
370- AT91_PMC_PLL_UPDT_ID_MSK , core -> id );
369+ regmap_write_bits (regmap , AT91_PMC_PLL_UPDT ,
370+ AT91_PMC_PLL_UPDT_ID_MSK , core -> id );
371371 regmap_read (regmap , AT91_PMC_PLL_CTRL0 , & val );
372372 cdiv = (val & core -> layout -> div_mask ) >> core -> layout -> div_shift ;
373373
@@ -398,15 +398,15 @@ static void sam9x60_div_pll_unprepare(struct clk_hw *hw)
398398
399399 spin_lock_irqsave (core -> lock , flags );
400400
401- regmap_update_bits (regmap , AT91_PMC_PLL_UPDT ,
402- AT91_PMC_PLL_UPDT_ID_MSK , core -> id );
401+ regmap_write_bits (regmap , AT91_PMC_PLL_UPDT ,
402+ AT91_PMC_PLL_UPDT_ID_MSK , core -> id );
403403
404404 regmap_update_bits (regmap , AT91_PMC_PLL_CTRL0 ,
405405 core -> layout -> endiv_mask , 0 );
406406
407- regmap_update_bits (regmap , AT91_PMC_PLL_UPDT ,
408- AT91_PMC_PLL_UPDT_UPDATE | AT91_PMC_PLL_UPDT_ID_MSK ,
409- AT91_PMC_PLL_UPDT_UPDATE | core -> id );
407+ regmap_write_bits (regmap , AT91_PMC_PLL_UPDT ,
408+ AT91_PMC_PLL_UPDT_UPDATE | AT91_PMC_PLL_UPDT_ID_MSK ,
409+ AT91_PMC_PLL_UPDT_UPDATE | core -> id );
410410
411411 spin_unlock_irqrestore (core -> lock , flags );
412412}
@@ -518,8 +518,8 @@ static int sam9x60_div_pll_set_rate_chg(struct clk_hw *hw, unsigned long rate,
518518 div -> div = DIV_ROUND_CLOSEST (parent_rate , rate ) - 1 ;
519519
520520 spin_lock_irqsave (core -> lock , irqflags );
521- regmap_update_bits (regmap , AT91_PMC_PLL_UPDT , AT91_PMC_PLL_UPDT_ID_MSK ,
522- core -> id );
521+ regmap_write_bits (regmap , AT91_PMC_PLL_UPDT , AT91_PMC_PLL_UPDT_ID_MSK ,
522+ core -> id );
523523 regmap_read (regmap , AT91_PMC_PLL_CTRL0 , & val );
524524 cdiv = (val & core -> layout -> div_mask ) >> core -> layout -> div_shift ;
525525
@@ -574,8 +574,8 @@ static int sam9x60_div_pll_notifier_fn(struct notifier_block *notifier,
574574 div -> div = div -> safe_div ;
575575
576576 spin_lock_irqsave (core .lock , irqflags );
577- regmap_update_bits (regmap , AT91_PMC_PLL_UPDT , AT91_PMC_PLL_UPDT_ID_MSK ,
578- core .id );
577+ regmap_write_bits (regmap , AT91_PMC_PLL_UPDT , AT91_PMC_PLL_UPDT_ID_MSK ,
578+ core .id );
579579 regmap_read (regmap , AT91_PMC_PLL_CTRL0 , & val );
580580 cdiv = (val & core .layout -> div_mask ) >> core .layout -> div_shift ;
581581
0 commit comments