Commit cf63f060 authored by Martin Sperl's avatar Martin Sperl Committed by Greg Kroah-Hartman

clk: bcm2835: add locking to pll*_on/off methods

commit ec36a5c6 upstream.

Add missing locking to:
* bcm2835_pll_divider_on
* bcm2835_pll_divider_off
to protect the read modify write cycle for the
register access protecting both cm_reg and a2w_reg
registers.

Fixes: 41691b88 ("clk: bcm2835: Add support for programming the
audio domain clocks")
Signed-off-by: default avatarMartin Sperl <kernel@martin.sperl.org>
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
Reviewed-by: default avatarEric Anholt <eric@anholt.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1267ee34
...@@ -1079,10 +1079,12 @@ static void bcm2835_pll_divider_off(struct clk_hw *hw) ...@@ -1079,10 +1079,12 @@ static void bcm2835_pll_divider_off(struct clk_hw *hw)
struct bcm2835_cprman *cprman = divider->cprman; struct bcm2835_cprman *cprman = divider->cprman;
const struct bcm2835_pll_divider_data *data = divider->data; const struct bcm2835_pll_divider_data *data = divider->data;
spin_lock(&cprman->regs_lock);
cprman_write(cprman, data->cm_reg, cprman_write(cprman, data->cm_reg,
(cprman_read(cprman, data->cm_reg) & (cprman_read(cprman, data->cm_reg) &
~data->load_mask) | data->hold_mask); ~data->load_mask) | data->hold_mask);
cprman_write(cprman, data->a2w_reg, A2W_PLL_CHANNEL_DISABLE); cprman_write(cprman, data->a2w_reg, A2W_PLL_CHANNEL_DISABLE);
spin_unlock(&cprman->regs_lock);
} }
static int bcm2835_pll_divider_on(struct clk_hw *hw) static int bcm2835_pll_divider_on(struct clk_hw *hw)
...@@ -1091,12 +1093,14 @@ static int bcm2835_pll_divider_on(struct clk_hw *hw) ...@@ -1091,12 +1093,14 @@ static int bcm2835_pll_divider_on(struct clk_hw *hw)
struct bcm2835_cprman *cprman = divider->cprman; struct bcm2835_cprman *cprman = divider->cprman;
const struct bcm2835_pll_divider_data *data = divider->data; const struct bcm2835_pll_divider_data *data = divider->data;
spin_lock(&cprman->regs_lock);
cprman_write(cprman, data->a2w_reg, cprman_write(cprman, data->a2w_reg,
cprman_read(cprman, data->a2w_reg) & cprman_read(cprman, data->a2w_reg) &
~A2W_PLL_CHANNEL_DISABLE); ~A2W_PLL_CHANNEL_DISABLE);
cprman_write(cprman, data->cm_reg, cprman_write(cprman, data->cm_reg,
cprman_read(cprman, data->cm_reg) & ~data->hold_mask); cprman_read(cprman, data->cm_reg) & ~data->hold_mask);
spin_unlock(&cprman->regs_lock);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment