Commit b29dd359 authored by Laurent Pinchart's avatar Laurent Pinchart

clk: shmobile: rcar-gen2: Fix clock parent for all non-PLL clocks

The lb, qspi, sdh, sd0 and sd1 clocks have the PLL1 (divided by 2) as
their parent, not the main clock. Fix it.

This bug introduced in v3.14-rc1 breaks various devices on the Lager and
Kolesh shmobile boards and should thus be considered as a regression for
which a fix during the -rc series is appropriate.
Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: default avatarSimon Horman <horms+renesas@verge.net.au>
parent cfbf8d48
...@@ -186,7 +186,7 @@ rcar_gen2_cpg_register_clock(struct device_node *np, struct rcar_gen2_cpg *cpg, ...@@ -186,7 +186,7 @@ rcar_gen2_cpg_register_clock(struct device_node *np, struct rcar_gen2_cpg *cpg,
const char *name) const char *name)
{ {
const struct clk_div_table *table = NULL; const struct clk_div_table *table = NULL;
const char *parent_name = "main"; const char *parent_name;
unsigned int shift; unsigned int shift;
unsigned int mult = 1; unsigned int mult = 1;
unsigned int div = 1; unsigned int div = 1;
...@@ -201,23 +201,31 @@ rcar_gen2_cpg_register_clock(struct device_node *np, struct rcar_gen2_cpg *cpg, ...@@ -201,23 +201,31 @@ rcar_gen2_cpg_register_clock(struct device_node *np, struct rcar_gen2_cpg *cpg,
* the multiplier value. * the multiplier value.
*/ */
u32 value = clk_readl(cpg->reg + CPG_PLL0CR); u32 value = clk_readl(cpg->reg + CPG_PLL0CR);
parent_name = "main";
mult = ((value >> 24) & ((1 << 7) - 1)) + 1; mult = ((value >> 24) & ((1 << 7) - 1)) + 1;
} else if (!strcmp(name, "pll1")) { } else if (!strcmp(name, "pll1")) {
parent_name = "main";
mult = config->pll1_mult / 2; mult = config->pll1_mult / 2;
} else if (!strcmp(name, "pll3")) { } else if (!strcmp(name, "pll3")) {
parent_name = "main";
mult = config->pll3_mult; mult = config->pll3_mult;
} else if (!strcmp(name, "lb")) { } else if (!strcmp(name, "lb")) {
parent_name = "pll1_div2";
div = cpg_mode & BIT(18) ? 36 : 24; div = cpg_mode & BIT(18) ? 36 : 24;
} else if (!strcmp(name, "qspi")) { } else if (!strcmp(name, "qspi")) {
parent_name = "pll1_div2";
div = (cpg_mode & (BIT(3) | BIT(2) | BIT(1))) == BIT(2) div = (cpg_mode & (BIT(3) | BIT(2) | BIT(1))) == BIT(2)
? 16 : 20; ? 16 : 20;
} else if (!strcmp(name, "sdh")) { } else if (!strcmp(name, "sdh")) {
parent_name = "pll1_div2";
table = cpg_sdh_div_table; table = cpg_sdh_div_table;
shift = 8; shift = 8;
} else if (!strcmp(name, "sd0")) { } else if (!strcmp(name, "sd0")) {
parent_name = "pll1_div2";
table = cpg_sd01_div_table; table = cpg_sd01_div_table;
shift = 4; shift = 4;
} else if (!strcmp(name, "sd1")) { } else if (!strcmp(name, "sd1")) {
parent_name = "pll1_div2";
table = cpg_sd01_div_table; table = cpg_sd01_div_table;
shift = 0; shift = 0;
} else if (!strcmp(name, "z")) { } else if (!strcmp(name, "z")) {
......
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