Skip to content

Commit 7997f3b

Browse files
Boris Brezillonbebarino
authored andcommitted
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: 41691b8 ("clk: bcm2835: Add support for programming the audio domain clocks") Cc: <[email protected]> Signed-off-by: Boris Brezillon <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent 49012d1 commit 7997f3b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/clk/bcm/clk-bcm2835.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,10 @@ static int bcm2835_pll_on(struct clk_hw *hw)
623623
~A2W_PLL_CTRL_PWRDN);
624624

625625
/* Take the PLL out of reset. */
626+
spin_lock(&cprman->regs_lock);
626627
cprman_write(cprman, data->cm_ctrl_reg,
627628
cprman_read(cprman, data->cm_ctrl_reg) & ~CM_PLL_ANARST);
629+
spin_unlock(&cprman->regs_lock);
628630

629631
/* Wait for the PLL to lock. */
630632
timeout = ktime_add_ns(ktime_get(), LOCK_TIMEOUT_NS);
@@ -701,9 +703,11 @@ static int bcm2835_pll_set_rate(struct clk_hw *hw,
701703
}
702704

703705
/* Unmask the reference clock from the oscillator. */
706+
spin_lock(&cprman->regs_lock);
704707
cprman_write(cprman, A2W_XOSC_CTRL,
705708
cprman_read(cprman, A2W_XOSC_CTRL) |
706709
data->reference_enable_mask);
710+
spin_unlock(&cprman->regs_lock);
707711

708712
if (do_ana_setup_first)
709713
bcm2835_pll_write_ana(cprman, data->ana_reg_base, ana);

0 commit comments

Comments
 (0)