Commit 86dbfda83215e340445a0ae44e24c84031e79f1c
Committed by
Greg Kroah-Hartman
1 parent
035688290a
Exists in
smarct4x-processor-sdk-linux-03.00.00.04
and in
2 other branches
clk: bcm2835: add locking to pll*_on/off methods
commit ec36a5c6682fdd5328abf15c3c67281bed0241d7 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: 41691b8862e2 ("clk: bcm2835: Add support for programming the audio domain clocks") Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 4 additions and 0 deletions Side-by-side Diff
drivers/clk/bcm/clk-bcm2835.c
... | ... | @@ -1068,10 +1068,12 @@ |
1068 | 1068 | struct bcm2835_cprman *cprman = divider->cprman; |
1069 | 1069 | const struct bcm2835_pll_divider_data *data = divider->data; |
1070 | 1070 | |
1071 | + spin_lock(&cprman->regs_lock); | |
1071 | 1072 | cprman_write(cprman, data->cm_reg, |
1072 | 1073 | (cprman_read(cprman, data->cm_reg) & |
1073 | 1074 | ~data->load_mask) | data->hold_mask); |
1074 | 1075 | cprman_write(cprman, data->a2w_reg, A2W_PLL_CHANNEL_DISABLE); |
1076 | + spin_unlock(&cprman->regs_lock); | |
1075 | 1077 | } |
1076 | 1078 | |
1077 | 1079 | static int bcm2835_pll_divider_on(struct clk_hw *hw) |
1078 | 1080 | |
... | ... | @@ -1080,12 +1082,14 @@ |
1080 | 1082 | struct bcm2835_cprman *cprman = divider->cprman; |
1081 | 1083 | const struct bcm2835_pll_divider_data *data = divider->data; |
1082 | 1084 | |
1085 | + spin_lock(&cprman->regs_lock); | |
1083 | 1086 | cprman_write(cprman, data->a2w_reg, |
1084 | 1087 | cprman_read(cprman, data->a2w_reg) & |
1085 | 1088 | ~A2W_PLL_CHANNEL_DISABLE); |
1086 | 1089 | |
1087 | 1090 | cprman_write(cprman, data->cm_reg, |
1088 | 1091 | cprman_read(cprman, data->cm_reg) & ~data->hold_mask); |
1092 | + spin_unlock(&cprman->regs_lock); | |
1089 | 1093 | |
1090 | 1094 | return 0; |
1091 | 1095 | } |