diff options
author | Michael Turquette <mturquette@baylibre.com> | 2016-02-16 15:31:51 -0500 |
---|---|---|
committer | Michael Turquette <mturquette@baylibre.com> | 2016-02-16 15:31:51 -0500 |
commit | 3aef66490d8ef1f6cc3e0fc92264f47a1a398535 (patch) | |
tree | 440116c49ae0b911731286a90bf9c1e1d4199004 /drivers/clk/bcm | |
parent | 70750ff2c91049beca635e0a31ac19f8b54aebee (diff) | |
parent | 79c1e2fc2c0e0243d6ecaacfb650cf0ad5ad4aa5 (diff) |
Merge branch 'clk-bcm2835' into clk-next
Diffstat (limited to 'drivers/clk/bcm')
-rw-r--r-- | drivers/clk/bcm/clk-bcm2835.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c index 015e687ffabe..353e43835d5d 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c | |||
@@ -1060,16 +1060,7 @@ static long bcm2835_pll_divider_round_rate(struct clk_hw *hw, | |||
1060 | static unsigned long bcm2835_pll_divider_get_rate(struct clk_hw *hw, | 1060 | static unsigned long bcm2835_pll_divider_get_rate(struct clk_hw *hw, |
1061 | unsigned long parent_rate) | 1061 | unsigned long parent_rate) |
1062 | { | 1062 | { |
1063 | struct bcm2835_pll_divider *divider = bcm2835_pll_divider_from_hw(hw); | 1063 | return clk_divider_ops.recalc_rate(hw, parent_rate); |
1064 | struct bcm2835_cprman *cprman = divider->cprman; | ||
1065 | const struct bcm2835_pll_divider_data *data = divider->data; | ||
1066 | u32 div = cprman_read(cprman, data->a2w_reg); | ||
1067 | |||
1068 | div &= (1 << A2W_PLL_DIV_BITS) - 1; | ||
1069 | if (div == 0) | ||
1070 | div = 256; | ||
1071 | |||
1072 | return parent_rate / div; | ||
1073 | } | 1064 | } |
1074 | 1065 | ||
1075 | static void bcm2835_pll_divider_off(struct clk_hw *hw) | 1066 | static void bcm2835_pll_divider_off(struct clk_hw *hw) |
@@ -1107,13 +1098,15 @@ static int bcm2835_pll_divider_set_rate(struct clk_hw *hw, | |||
1107 | struct bcm2835_pll_divider *divider = bcm2835_pll_divider_from_hw(hw); | 1098 | struct bcm2835_pll_divider *divider = bcm2835_pll_divider_from_hw(hw); |
1108 | struct bcm2835_cprman *cprman = divider->cprman; | 1099 | struct bcm2835_cprman *cprman = divider->cprman; |
1109 | const struct bcm2835_pll_divider_data *data = divider->data; | 1100 | const struct bcm2835_pll_divider_data *data = divider->data; |
1110 | u32 cm; | 1101 | u32 cm, div, max_div = 1 << A2W_PLL_DIV_BITS; |
1111 | int ret; | ||
1112 | 1102 | ||
1113 | ret = clk_divider_ops.set_rate(hw, rate, parent_rate); | 1103 | div = DIV_ROUND_UP_ULL(parent_rate, rate); |
1114 | if (ret) | 1104 | |
1115 | return ret; | 1105 | div = min(div, max_div); |
1106 | if (div == max_div) | ||
1107 | div = 0; | ||
1116 | 1108 | ||
1109 | cprman_write(cprman, data->a2w_reg, div); | ||
1117 | cm = cprman_read(cprman, data->cm_reg); | 1110 | cm = cprman_read(cprman, data->cm_reg); |
1118 | cprman_write(cprman, data->cm_reg, cm | data->load_mask); | 1111 | cprman_write(cprman, data->cm_reg, cm | data->load_mask); |
1119 | cprman_write(cprman, data->cm_reg, cm & ~data->load_mask); | 1112 | cprman_write(cprman, data->cm_reg, cm & ~data->load_mask); |
@@ -1428,7 +1421,7 @@ bcm2835_register_pll_divider(struct bcm2835_cprman *cprman, | |||
1428 | divider->div.reg = cprman->regs + data->a2w_reg; | 1421 | divider->div.reg = cprman->regs + data->a2w_reg; |
1429 | divider->div.shift = A2W_PLL_DIV_SHIFT; | 1422 | divider->div.shift = A2W_PLL_DIV_SHIFT; |
1430 | divider->div.width = A2W_PLL_DIV_BITS; | 1423 | divider->div.width = A2W_PLL_DIV_BITS; |
1431 | divider->div.flags = 0; | 1424 | divider->div.flags = CLK_DIVIDER_MAX_AT_ZERO; |
1432 | divider->div.lock = &cprman->regs_lock; | 1425 | divider->div.lock = &cprman->regs_lock; |
1433 | divider->div.hw.init = &init; | 1426 | divider->div.hw.init = &init; |
1434 | divider->div.table = NULL; | 1427 | divider->div.table = NULL; |