Commit 09a7dea9 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven

clk: renesas: rcar-gen3: Add divider support for PLL1 and PLL3

On some R-Car Gen3 SoCs (e.g. R-Car D3), PLL1 and PLL3 use a divider
value different from one.  Extend struct rcar_gen3_cpg_pll_config to handle
this.  As all multipliers and dividers are small, table size increase
can be kept limited by storing them in u8s instead of unsigned ints,
which saves ca. 0.5 KiB for a generic kernel.
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Acked-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent 714c53aa
...@@ -305,23 +305,23 @@ static const unsigned int r8a7795_crit_mod_clks[] __initconst = { ...@@ -305,23 +305,23 @@ static const unsigned int r8a7795_crit_mod_clks[] __initconst = {
(((md) & BIT(17)) >> 17)) (((md) & BIT(17)) >> 17))
static const struct rcar_gen3_cpg_pll_config cpg_pll_configs[16] __initconst = { static const struct rcar_gen3_cpg_pll_config cpg_pll_configs[16] __initconst = {
/* EXTAL div PLL1 mult PLL3 mult */ /* EXTAL div PLL1 mult/div PLL3 mult/div */
{ 1, 192, 192, }, { 1, 192, 1, 192, 1, },
{ 1, 192, 128, }, { 1, 192, 1, 128, 1, },
{ 0, /* Prohibited setting */ }, { 0, /* Prohibited setting */ },
{ 1, 192, 192, }, { 1, 192, 1, 192, 1, },
{ 1, 160, 160, }, { 1, 160, 1, 160, 1, },
{ 1, 160, 106, }, { 1, 160, 1, 106, 1, },
{ 0, /* Prohibited setting */ }, { 0, /* Prohibited setting */ },
{ 1, 160, 160, }, { 1, 160, 1, 160, 1, },
{ 1, 128, 128, }, { 1, 128, 1, 128, 1, },
{ 1, 128, 84, }, { 1, 128, 1, 84, 1, },
{ 0, /* Prohibited setting */ }, { 0, /* Prohibited setting */ },
{ 1, 128, 128, }, { 1, 128, 1, 128, 1, },
{ 2, 192, 192, }, { 2, 192, 1, 192, 1, },
{ 2, 192, 128, }, { 2, 192, 1, 128, 1, },
{ 0, /* Prohibited setting */ }, { 0, /* Prohibited setting */ },
{ 2, 192, 192, }, { 2, 192, 1, 192, 1, },
}; };
static const struct soc_device_attribute r8a7795es1[] __initconst = { static const struct soc_device_attribute r8a7795es1[] __initconst = {
......
...@@ -277,23 +277,23 @@ static const unsigned int r8a7796_crit_mod_clks[] __initconst = { ...@@ -277,23 +277,23 @@ static const unsigned int r8a7796_crit_mod_clks[] __initconst = {
(((md) & BIT(17)) >> 17)) (((md) & BIT(17)) >> 17))
static const struct rcar_gen3_cpg_pll_config cpg_pll_configs[16] __initconst = { static const struct rcar_gen3_cpg_pll_config cpg_pll_configs[16] __initconst = {
/* EXTAL div PLL1 mult PLL3 mult */ /* EXTAL div PLL1 mult/div PLL3 mult/div */
{ 1, 192, 192, }, { 1, 192, 1, 192, 1, },
{ 1, 192, 128, }, { 1, 192, 1, 128, 1, },
{ 0, /* Prohibited setting */ }, { 0, /* Prohibited setting */ },
{ 1, 192, 192, }, { 1, 192, 1, 192, 1, },
{ 1, 160, 160, }, { 1, 160, 1, 160, 1, },
{ 1, 160, 106, }, { 1, 160, 1, 106, 1, },
{ 0, /* Prohibited setting */ }, { 0, /* Prohibited setting */ },
{ 1, 160, 160, }, { 1, 160, 1, 160, 1, },
{ 1, 128, 128, }, { 1, 128, 1, 128, 1, },
{ 1, 128, 84, }, { 1, 128, 1, 84, 1, },
{ 0, /* Prohibited setting */ }, { 0, /* Prohibited setting */ },
{ 1, 128, 128, }, { 1, 128, 1, 128, 1, },
{ 2, 192, 192, }, { 2, 192, 1, 192, 1, },
{ 2, 192, 128, }, { 2, 192, 1, 128, 1, },
{ 0, /* Prohibited setting */ }, { 0, /* Prohibited setting */ },
{ 2, 192, 192, }, { 2, 192, 1, 192, 1, },
}; };
static int __init r8a7796_cpg_mssr_init(struct device *dev) static int __init r8a7796_cpg_mssr_init(struct device *dev)
......
...@@ -296,6 +296,7 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev, ...@@ -296,6 +296,7 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev,
case CLK_TYPE_GEN3_PLL1: case CLK_TYPE_GEN3_PLL1:
mult = cpg_pll_config->pll1_mult; mult = cpg_pll_config->pll1_mult;
div = cpg_pll_config->pll1_div;
break; break;
case CLK_TYPE_GEN3_PLL2: case CLK_TYPE_GEN3_PLL2:
...@@ -313,6 +314,7 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev, ...@@ -313,6 +314,7 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev,
case CLK_TYPE_GEN3_PLL3: case CLK_TYPE_GEN3_PLL3:
mult = cpg_pll_config->pll3_mult; mult = cpg_pll_config->pll3_mult;
div = cpg_pll_config->pll3_div;
break; break;
case CLK_TYPE_GEN3_PLL4: case CLK_TYPE_GEN3_PLL4:
......
...@@ -26,9 +26,11 @@ enum rcar_gen3_clk_types { ...@@ -26,9 +26,11 @@ enum rcar_gen3_clk_types {
DEF_BASE(_name, _id, CLK_TYPE_GEN3_SD, _parent, .offset = _offset) DEF_BASE(_name, _id, CLK_TYPE_GEN3_SD, _parent, .offset = _offset)
struct rcar_gen3_cpg_pll_config { struct rcar_gen3_cpg_pll_config {
unsigned int extal_div; u8 extal_div;
unsigned int pll1_mult; u8 pll1_mult;
unsigned int pll3_mult; u8 pll1_div;
u8 pll3_mult;
u8 pll3_div;
}; };
#define CPG_RCKCR 0x240 #define CPG_RCKCR 0x240
......
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