Merge branch 'clk-fixes' into clk-next

* clk-fixes:
  clk: mmp: pxa910: fix return value check in pxa910_clk_init()
  clk: mmp: pxa168: fix return value check in pxa168_clk_init()
  clk: mmp: mmp2: fix return value check in mmp2_clk_init()
  clk: qoriq: Don't allow CPU clocks higher than starting value
This commit is contained in:
Stephen Boyd 2016-11-01 18:39:07 -07:00
commit a4315592e8
4 changed files with 12 additions and 9 deletions

View File

@ -740,6 +740,7 @@ static struct clk * __init create_mux_common(struct clockgen *cg,
struct mux_hwclock *hwc, struct mux_hwclock *hwc,
const struct clk_ops *ops, const struct clk_ops *ops,
unsigned long min_rate, unsigned long min_rate,
unsigned long max_rate,
unsigned long pct80_rate, unsigned long pct80_rate,
const char *fmt, int idx) const char *fmt, int idx)
{ {
@ -768,6 +769,8 @@ static struct clk * __init create_mux_common(struct clockgen *cg,
continue; continue;
if (rate < min_rate) if (rate < min_rate)
continue; continue;
if (rate > max_rate)
continue;
parent_names[j] = div->name; parent_names[j] = div->name;
hwc->parent_to_clksel[j] = i; hwc->parent_to_clksel[j] = i;
@ -799,7 +802,7 @@ static struct clk * __init create_one_cmux(struct clockgen *cg, int idx)
struct mux_hwclock *hwc; struct mux_hwclock *hwc;
const struct clockgen_pll_div *div; const struct clockgen_pll_div *div;
unsigned long plat_rate, min_rate; unsigned long plat_rate, min_rate;
u64 pct80_rate; u64 max_rate, pct80_rate;
u32 clksel; u32 clksel;
hwc = kzalloc(sizeof(*hwc), GFP_KERNEL); hwc = kzalloc(sizeof(*hwc), GFP_KERNEL);
@ -827,8 +830,8 @@ static struct clk * __init create_one_cmux(struct clockgen *cg, int idx)
return NULL; return NULL;
} }
pct80_rate = clk_get_rate(div->clk); max_rate = clk_get_rate(div->clk);
pct80_rate *= 8; pct80_rate = max_rate * 8;
do_div(pct80_rate, 10); do_div(pct80_rate, 10);
plat_rate = clk_get_rate(cg->pll[PLATFORM_PLL].div[PLL_DIV1].clk); plat_rate = clk_get_rate(cg->pll[PLATFORM_PLL].div[PLL_DIV1].clk);
@ -838,7 +841,7 @@ static struct clk * __init create_one_cmux(struct clockgen *cg, int idx)
else else
min_rate = plat_rate / 2; min_rate = plat_rate / 2;
return create_mux_common(cg, hwc, &cmux_ops, min_rate, return create_mux_common(cg, hwc, &cmux_ops, min_rate, max_rate,
pct80_rate, "cg-cmux%d", idx); pct80_rate, "cg-cmux%d", idx);
} }
@ -853,7 +856,7 @@ static struct clk * __init create_one_hwaccel(struct clockgen *cg, int idx)
hwc->reg = cg->regs + 0x20 * idx + 0x10; hwc->reg = cg->regs + 0x20 * idx + 0x10;
hwc->info = cg->info.hwaccel[idx]; hwc->info = cg->info.hwaccel[idx];
return create_mux_common(cg, hwc, &hwaccel_ops, 0, 0, return create_mux_common(cg, hwc, &hwaccel_ops, 0, ULONG_MAX, 0,
"cg-hwaccel%d", idx); "cg-hwaccel%d", idx);
} }

View File

@ -313,7 +313,7 @@ static void __init mmp2_clk_init(struct device_node *np)
} }
pxa_unit->apmu_base = of_iomap(np, 1); pxa_unit->apmu_base = of_iomap(np, 1);
if (!pxa_unit->mpmu_base) { if (!pxa_unit->apmu_base) {
pr_err("failed to map apmu registers\n"); pr_err("failed to map apmu registers\n");
return; return;
} }

View File

@ -262,7 +262,7 @@ static void __init pxa168_clk_init(struct device_node *np)
} }
pxa_unit->apmu_base = of_iomap(np, 1); pxa_unit->apmu_base = of_iomap(np, 1);
if (!pxa_unit->mpmu_base) { if (!pxa_unit->apmu_base) {
pr_err("failed to map apmu registers\n"); pr_err("failed to map apmu registers\n");
return; return;
} }

View File

@ -282,7 +282,7 @@ static void __init pxa910_clk_init(struct device_node *np)
} }
pxa_unit->apmu_base = of_iomap(np, 1); pxa_unit->apmu_base = of_iomap(np, 1);
if (!pxa_unit->mpmu_base) { if (!pxa_unit->apmu_base) {
pr_err("failed to map apmu registers\n"); pr_err("failed to map apmu registers\n");
return; return;
} }
@ -294,7 +294,7 @@ static void __init pxa910_clk_init(struct device_node *np)
} }
pxa_unit->apbcp_base = of_iomap(np, 3); pxa_unit->apbcp_base = of_iomap(np, 3);
if (!pxa_unit->mpmu_base) { if (!pxa_unit->apbcp_base) {
pr_err("failed to map apbcp registers\n"); pr_err("failed to map apbcp registers\n");
return; return;
} }