aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@bootlin.com>2018-02-08 08:43:36 -0500
committerStephen Boyd <sboyd@kernel.org>2018-03-19 12:27:37 -0400
commit7997f3b2df751aab0b8e60149b226a32966c41ac (patch)
tree095c9fe6b9f28d0be578aa8c947c83a5acbc6032
parent49012d1bf5f78782d398adb984a080a88ba42965 (diff)
clk: bcm2835: Protect sections updating shared registers
CM_PLLx and A2W_XOSC_CTRL registers are accessed by different clock handlers and must be accessed with ->regs_lock held. Update the sections where this protection is missing. Fixes: 41691b8862e2 ("clk: bcm2835: Add support for programming the audio domain clocks") Cc: <stable@vger.kernel.org> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
-rw-r--r--drivers/clk/bcm/clk-bcm2835.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index 2108a274185a..a07f6451694a 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -623,8 +623,10 @@ static int bcm2835_pll_on(struct clk_hw *hw)
623 ~A2W_PLL_CTRL_PWRDN); 623 ~A2W_PLL_CTRL_PWRDN);
624 624
625 /* Take the PLL out of reset. */ 625 /* Take the PLL out of reset. */
626 spin_lock(&cprman->regs_lock);
626 cprman_write(cprman, data->cm_ctrl_reg, 627 cprman_write(cprman, data->cm_ctrl_reg,
627 cprman_read(cprman, data->cm_ctrl_reg) & ~CM_PLL_ANARST); 628 cprman_read(cprman, data->cm_ctrl_reg) & ~CM_PLL_ANARST);
629 spin_unlock(&cprman->regs_lock);
628 630
629 /* Wait for the PLL to lock. */ 631 /* Wait for the PLL to lock. */
630 timeout = ktime_add_ns(ktime_get(), LOCK_TIMEOUT_NS); 632 timeout = ktime_add_ns(ktime_get(), LOCK_TIMEOUT_NS);
@@ -701,9 +703,11 @@ static int bcm2835_pll_set_rate(struct clk_hw *hw,
701 } 703 }
702 704
703 /* Unmask the reference clock from the oscillator. */ 705 /* Unmask the reference clock from the oscillator. */
706 spin_lock(&cprman->regs_lock);
704 cprman_write(cprman, A2W_XOSC_CTRL, 707 cprman_write(cprman, A2W_XOSC_CTRL,
705 cprman_read(cprman, A2W_XOSC_CTRL) | 708 cprman_read(cprman, A2W_XOSC_CTRL) |
706 data->reference_enable_mask); 709 data->reference_enable_mask);
710 spin_unlock(&cprman->regs_lock);
707 711
708 if (do_ana_setup_first) 712 if (do_ana_setup_first)
709 bcm2835_pll_write_ana(cprman, data->ana_reg_base, ana); 713 bcm2835_pll_write_ana(cprman, data->ana_reg_base, ana);