]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.6.1/clk-bcm2835-add-locking-to-pll-_on-off-methods.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.6.1 / clk-bcm2835-add-locking-to-pll-_on-off-methods.patch
1 From ec36a5c6682fdd5328abf15c3c67281bed0241d7 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: clk: bcm2835: add locking to pll*_on/off methods
5
6 From: Martin Sperl <kernel@martin.sperl.org>
7
8 commit ec36a5c6682fdd5328abf15c3c67281bed0241d7 upstream.
9
10 Add missing locking to:
11 * bcm2835_pll_divider_on
12 * bcm2835_pll_divider_off
13 to protect the read modify write cycle for the
14 register access protecting both cm_reg and a2w_reg
15 registers.
16
17 Fixes: 41691b8862e2 ("clk: bcm2835: Add support for programming the
18 audio domain clocks")
19
20 Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
21 Signed-off-by: Eric Anholt <eric@anholt.net>
22 Reviewed-by: Eric Anholt <eric@anholt.net>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24
25 ---
26 drivers/clk/bcm/clk-bcm2835.c | 4 ++++
27 1 file changed, 4 insertions(+)
28
29 --- a/drivers/clk/bcm/clk-bcm2835.c
30 +++ b/drivers/clk/bcm/clk-bcm2835.c
31 @@ -1079,10 +1079,12 @@ static void bcm2835_pll_divider_off(stru
32 struct bcm2835_cprman *cprman = divider->cprman;
33 const struct bcm2835_pll_divider_data *data = divider->data;
34
35 + spin_lock(&cprman->regs_lock);
36 cprman_write(cprman, data->cm_reg,
37 (cprman_read(cprman, data->cm_reg) &
38 ~data->load_mask) | data->hold_mask);
39 cprman_write(cprman, data->a2w_reg, A2W_PLL_CHANNEL_DISABLE);
40 + spin_unlock(&cprman->regs_lock);
41 }
42
43 static int bcm2835_pll_divider_on(struct clk_hw *hw)
44 @@ -1091,12 +1093,14 @@ static int bcm2835_pll_divider_on(struct
45 struct bcm2835_cprman *cprman = divider->cprman;
46 const struct bcm2835_pll_divider_data *data = divider->data;
47
48 + spin_lock(&cprman->regs_lock);
49 cprman_write(cprman, data->a2w_reg,
50 cprman_read(cprman, data->a2w_reg) &
51 ~A2W_PLL_CHANNEL_DISABLE);
52
53 cprman_write(cprman, data->cm_reg,
54 cprman_read(cprman, data->cm_reg) & ~data->hold_mask);
55 + spin_unlock(&cprman->regs_lock);
56
57 return 0;
58 }