diff options
Diffstat (limited to 'drivers/clk/clk-divider.c')
-rw-r--r-- | drivers/clk/clk-divider.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index 6024e60e49aa..6d55eb2cb959 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c | |||
@@ -227,8 +227,12 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, | |||
227 | if (divider->lock) | 227 | if (divider->lock) |
228 | spin_lock_irqsave(divider->lock, flags); | 228 | spin_lock_irqsave(divider->lock, flags); |
229 | 229 | ||
230 | val = readl(divider->reg); | 230 | if (divider->flags & CLK_DIVIDER_HIWORD_MASK) { |
231 | val &= ~(div_mask(divider) << divider->shift); | 231 | val = div_mask(divider) << (divider->shift + 16); |
232 | } else { | ||
233 | val = readl(divider->reg); | ||
234 | val &= ~(div_mask(divider) << divider->shift); | ||
235 | } | ||
232 | val |= value << divider->shift; | 236 | val |= value << divider->shift; |
233 | writel(val, divider->reg); | 237 | writel(val, divider->reg); |
234 | 238 | ||
@@ -255,6 +259,13 @@ static struct clk *_register_divider(struct device *dev, const char *name, | |||
255 | struct clk *clk; | 259 | struct clk *clk; |
256 | struct clk_init_data init; | 260 | struct clk_init_data init; |
257 | 261 | ||
262 | if (clk_divider_flags & CLK_DIVIDER_HIWORD_MASK) { | ||
263 | if (width + shift > 16) { | ||
264 | pr_warn("divider value exceeds LOWORD field\n"); | ||
265 | return ERR_PTR(-EINVAL); | ||
266 | } | ||
267 | } | ||
268 | |||
258 | /* allocate the divider */ | 269 | /* allocate the divider */ |
259 | div = kzalloc(sizeof(struct clk_divider), GFP_KERNEL); | 270 | div = kzalloc(sizeof(struct clk_divider), GFP_KERNEL); |
260 | if (!div) { | 271 | if (!div) { |