1 From 39c3c0d0a8d038a692b95cc13e7d6acf2d04cf14 Mon Sep 17 00:00:00 2001
2 From: Martin Sperl <kernel@martin.sperl.org>
3 Date: Mon, 29 Feb 2016 11:39:18 +0000
4 Subject: [PATCH 257/304] clk: bcm2835: add locking to pll*_on/off methods
6 Add missing locking to:
7 * bcm2835_pll_divider_on
8 * bcm2835_pll_divider_off
9 to protect the read modify write cycle for the
10 register access protecting both cm_reg and a2w_reg
13 Fixes: 41691b8862e2 ("clk: bcm2835: Add support for programming the
16 Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
17 Signed-off-by: Eric Anholt <eric@anholt.net>
18 Reviewed-by: Eric Anholt <eric@anholt.net>
19 (cherry picked from commit ec36a5c6682fdd5328abf15c3c67281bed0241d7)
21 drivers/clk/bcm/clk-bcm2835.c | 4 ++++
22 1 file changed, 4 insertions(+)
24 --- a/drivers/clk/bcm/clk-bcm2835.c
25 +++ b/drivers/clk/bcm/clk-bcm2835.c
26 @@ -1097,10 +1097,12 @@ static void bcm2835_pll_divider_off(stru
27 struct bcm2835_cprman *cprman = divider->cprman;
28 const struct bcm2835_pll_divider_data *data = divider->data;
30 + spin_lock(&cprman->regs_lock);
31 cprman_write(cprman, data->cm_reg,
32 (cprman_read(cprman, data->cm_reg) &
33 ~data->load_mask) | data->hold_mask);
34 cprman_write(cprman, data->a2w_reg, A2W_PLL_CHANNEL_DISABLE);
35 + spin_unlock(&cprman->regs_lock);
38 static int bcm2835_pll_divider_on(struct clk_hw *hw)
39 @@ -1109,12 +1111,14 @@ static int bcm2835_pll_divider_on(struct
40 struct bcm2835_cprman *cprman = divider->cprman;
41 const struct bcm2835_pll_divider_data *data = divider->data;
43 + spin_lock(&cprman->regs_lock);
44 cprman_write(cprman, data->a2w_reg,
45 cprman_read(cprman, data->a2w_reg) &
46 ~A2W_PLL_CHANNEL_DISABLE);
48 cprman_write(cprman, data->cm_reg,
49 cprman_read(cprman, data->cm_reg) & ~data->hold_mask);
50 + spin_unlock(&cprman->regs_lock);