aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/st/clkgen-fsyn.c
diff options
context:
space:
mode:
authorGabriel FERNANDEZ <gabriel.fernandez@st.com>2014-07-15 11:20:25 -0400
committerMike Turquette <mturquette@linaro.org>2014-07-29 01:36:44 -0400
commit8f26df843204a5f24254fdf2836bd81202d8e929 (patch)
tree423e505c8aabf60cb288602ebcbef0c436bf9c73 /drivers/clk/st/clkgen-fsyn.c
parenteee8f783277ae1c174350e6048b1352a997421e5 (diff)
clk: st: Add polarity bit indication
This patch introduces polarity indication for pll power up bit and for standby bit in order to have same code between stih416 and stih407 boards. Signed-off-by: Gabriel Fernandez <gabriel.fernandez@linaro.org> Acked-by: Peter Griffin <peter.griffin@linaro.org> Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk/st/clkgen-fsyn.c')
-rw-r--r--drivers/clk/st/clkgen-fsyn.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c
index e8d599d57f70..b925580646a0 100644
--- a/drivers/clk/st/clkgen-fsyn.c
+++ b/drivers/clk/st/clkgen-fsyn.c
@@ -67,6 +67,8 @@ struct clkgen_quadfs_data {
67 bool reset_present; 67 bool reset_present;
68 bool bwfilter_present; 68 bool bwfilter_present;
69 bool lockstatus_present; 69 bool lockstatus_present;
70 bool powerup_polarity;
71 bool standby_polarity;
70 bool nsdiv_present; 72 bool nsdiv_present;
71 struct clkgen_field ndiv; 73 struct clkgen_field ndiv;
72 struct clkgen_field ref_bw; 74 struct clkgen_field ref_bw;
@@ -308,7 +310,7 @@ static int quadfs_pll_enable(struct clk_hw *hw)
308 /* 310 /*
309 * Power up the PLL 311 * Power up the PLL
310 */ 312 */
311 CLKGEN_WRITE(pll, npda, 1); 313 CLKGEN_WRITE(pll, npda, !pll->data->powerup_polarity);
312 314
313 if (pll->lock) 315 if (pll->lock)
314 spin_unlock_irqrestore(pll->lock, flags); 316 spin_unlock_irqrestore(pll->lock, flags);
@@ -335,7 +337,7 @@ static void quadfs_pll_disable(struct clk_hw *hw)
335 * Powerdown the PLL and then put block into soft reset if we have 337 * Powerdown the PLL and then put block into soft reset if we have
336 * reset control. 338 * reset control.
337 */ 339 */
338 CLKGEN_WRITE(pll, npda, 0); 340 CLKGEN_WRITE(pll, npda, pll->data->powerup_polarity);
339 341
340 if (pll->data->reset_present) 342 if (pll->data->reset_present)
341 CLKGEN_WRITE(pll, nreset, 0); 343 CLKGEN_WRITE(pll, nreset, 0);
@@ -611,7 +613,7 @@ static int quadfs_fsynth_enable(struct clk_hw *hw)
611 if (fs->lock) 613 if (fs->lock)
612 spin_lock_irqsave(fs->lock, flags); 614 spin_lock_irqsave(fs->lock, flags);
613 615
614 CLKGEN_WRITE(fs, nsb[fs->chan], 1); 616 CLKGEN_WRITE(fs, nsb[fs->chan], !fs->data->standby_polarity);
615 617
616 if (fs->lock) 618 if (fs->lock)
617 spin_unlock_irqrestore(fs->lock, flags); 619 spin_unlock_irqrestore(fs->lock, flags);
@@ -631,7 +633,7 @@ static void quadfs_fsynth_disable(struct clk_hw *hw)
631 if (fs->lock) 633 if (fs->lock)
632 spin_lock_irqsave(fs->lock, flags); 634 spin_lock_irqsave(fs->lock, flags);
633 635
634 CLKGEN_WRITE(fs, nsb[fs->chan], 0); 636 CLKGEN_WRITE(fs, nsb[fs->chan], !fs->data->standby_polarity);
635 637
636 if (fs->lock) 638 if (fs->lock)
637 spin_unlock_irqrestore(fs->lock, flags); 639 spin_unlock_irqrestore(fs->lock, flags);
@@ -645,7 +647,7 @@ static int quadfs_fsynth_is_enabled(struct clk_hw *hw)
645 pr_debug("%s: %s enable bit = 0x%x\n", 647 pr_debug("%s: %s enable bit = 0x%x\n",
646 __func__, __clk_get_name(hw->clk), nsb); 648 __func__, __clk_get_name(hw->clk), nsb);
647 649
648 return !!nsb; 650 return fs->data->standby_polarity ? !nsb : !!nsb;
649} 651}
650 652
651#define P15 (uint64_t)(1 << 15) 653#define P15 (uint64_t)(1 << 15)