]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Merge branch 'clk-renesas' into clk-next
authorStephen Boyd <sboyd@kernel.org>
Thu, 18 Oct 2018 22:38:51 +0000 (15:38 -0700)
committerStephen Boyd <sboyd@kernel.org>
Thu, 18 Oct 2018 22:38:51 +0000 (15:38 -0700)
* clk-renesas: (36 commits)
  clk: renesas: r7s9210: Add SPI clocks
  clk: renesas: r7s9210: Move table update to separate function
  clk: renesas: r7s9210: Convert some clocks to early
  clk: renesas: cpg-mssr: Add early clock support
  clk: renesas: r8a77970: Add TPU clock
  clk: renesas: r8a77990: Fix incorrect PLL0 divider in comment
  dt-bindings: clock: renesas: cpg-mssr: Document r8a774c0
  clk: renesas: cpg-mssr: Add r8a774c0 support
  clk: renesas: Add r8a774c0 CPG Core Clock Definitions
  clk: renesas: r8a7743: Add r8a7744 support
  clk: renesas: Add r8a7744 CPG Core Clock Definitions
  dt-bindings: clock: renesas: cpg-mssr: Document r8a7744 binding
  dt-bindings: clock: renesas: Convert to SPDX identifiers
  clk: renesas: cpg-mssr: Add R7S9210 support
  clk: renesas: r8a77970: Add TMU clocks
  clk: renesas: r8a77970: Add CMT clocks
  clk: renesas: r9a06g032: Fix UART34567 clock rate
  clk: renesas: r8a77970: Add SD0H/SD0 clocks for SDHI
  clk: renesas: r8a77980: Add CMT clocks
  clk: renesas: r8a77990: Add missing I2C7 clock
  ...

1  2 
drivers/clk/renesas/Kconfig
drivers/clk/renesas/r8a7743-cpg-mssr.c
drivers/clk/renesas/r8a7795-cpg-mssr.c
drivers/clk/renesas/r8a7796-cpg-mssr.c
drivers/clk/renesas/r8a77970-cpg-mssr.c
drivers/clk/renesas/r8a77995-cpg-mssr.c
drivers/clk/renesas/rcar-gen3-cpg.c
drivers/clk/renesas/rcar-gen3-cpg.h
drivers/clk/renesas/renesas-cpg-mssr.c
drivers/clk/renesas/renesas-cpg-mssr.h

index ab2110f9622560798770c5aea6e3d1842e95b724,8d5a6fbef7e9b4ca1ccfceebdb40f2da16b67ead..b879e3e3a6b426aed8e9d3729d0c9cee48bcde15
@@@ -1,15 -1,16 +1,18 @@@
 +# SPDX-License-Identifier: GPL-2.0
 +
  config CLK_RENESAS
        bool "Renesas SoC clock support" if COMPILE_TEST && !ARCH_RENESAS
        default y if ARCH_RENESAS
        select CLK_EMEV2 if ARCH_EMEV2
        select CLK_RZA1 if ARCH_R7S72100
+       select CLK_R7S9210 if ARCH_R7S9210
        select CLK_R8A73A4 if ARCH_R8A73A4
        select CLK_R8A7740 if ARCH_R8A7740
-       select CLK_R8A7743 if ARCH_R8A7743
+       select CLK_R8A7743 if ARCH_R8A7743 || ARCH_R8A7744
        select CLK_R8A7745 if ARCH_R8A7745
        select CLK_R8A77470 if ARCH_R8A77470
+       select CLK_R8A774A1 if ARCH_R8A774A1
+       select CLK_R8A774C0 if ARCH_R8A774C0
        select CLK_R8A7778 if ARCH_R8A7778
        select CLK_R8A7779 if ARCH_R8A7779
        select CLK_R8A7790 if ARCH_R8A7790
@@@ -47,6 -48,10 +50,10 @@@ config CLK_RZA
        bool "RZ/A1H clock support" if COMPILE_TEST
        select CLK_RENESAS_CPG_MSTP
  
+ config CLK_R7S9210
+       bool "RZ/A2 clock support" if COMPILE_TEST
+       select CLK_RENESAS_CPG_MSSR
  config CLK_R8A73A4
        bool "R-Mobile APE6 clock support" if COMPILE_TEST
        select CLK_RENESAS_CPG_MSTP
@@@ -69,6 -74,14 +76,14 @@@ config CLK_R8A7747
        bool "RZ/G1C clock support" if COMPILE_TEST
        select CLK_RCAR_GEN2_CPG
  
+ config CLK_R8A774A1
+       bool "RZ/G2M clock support" if COMPILE_TEST
+       select CLK_RCAR_GEN3_CPG
+ config CLK_R8A774C0
+       bool "RZ/G2E clock support" if COMPILE_TEST
+       select CLK_RCAR_GEN3_CPG
  config CLK_R8A7778
        bool "R-Car M1A clock support" if COMPILE_TEST
        select CLK_RENESAS_CPG_MSTP
index f880b9cb72e0172ffd94c83dd31ddfc383459737,ab994f4c1ec8c62faa1b829f88cbd9cf5e490cbf..c01d9af2525a181a3614a40b2444138126310fa5
@@@ -1,13 -1,17 +1,14 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /*
   * r8a7743 Clock Pulse Generator / Module Standby and Software Reset
   *
   * Copyright (C) 2016 Cogent Embedded Inc.
 - *
 - * This program is free software; you can redistribute it and/or modify it
 - * under the terms of the GNU General Public License version 2 as published
 - * by the Free Software Foundation; of the License.
   */
  
  #include <linux/device.h>
  #include <linux/init.h>
  #include <linux/kernel.h>
+ #include <linux/of.h>
  #include <linux/soc/renesas/rcar-rst.h>
  
  #include <dt-bindings/clock/r8a7743-cpg-mssr.h>
@@@ -34,7 -38,7 +35,7 @@@ enum clk_ids 
        MOD_CLK_BASE
  };
  
- static const struct cpg_core_clk r8a7743_core_clks[] __initconst = {
+ static struct cpg_core_clk r8a7743_core_clks[] __initdata = {
        /* External Clock Inputs */
        DEF_INPUT("extal",      CLK_EXTAL),
        DEF_INPUT("usb_extal",  CLK_USB_EXTAL),
@@@ -235,6 -239,8 +236,8 @@@ static const struct rcar_gen2_cpg_pll_c
  static int __init r8a7743_cpg_mssr_init(struct device *dev)
  {
        const struct rcar_gen2_cpg_pll_config *cpg_pll_config;
+       struct device_node *np = dev->of_node;
+       unsigned int i;
        u32 cpg_mode;
        int error;
  
  
        cpg_pll_config = &cpg_pll_configs[CPG_PLL_CONFIG_INDEX(cpg_mode)];
  
+       if (of_device_is_compatible(np, "renesas,r8a7744-cpg-mssr")) {
+               /* RZ/G1N uses a 1/5 divider for ZG */
+               for (i = 0; i < ARRAY_SIZE(r8a7743_core_clks); i++)
+                       if (r8a7743_core_clks[i].id == R8A7743_CLK_ZG) {
+                               r8a7743_core_clks[i].div = 5;
+                               break;
+                       }
+       }
        return rcar_gen2_cpg_init(cpg_pll_config, 2, cpg_mode);
  }
  
index 846a4f984c8da8839da183bffd842b657dce6674,ca8cb0eed950161c9c026878aca0a52850180a36..119c024407263568e89d0a66bcf89be8a6259c43
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /*
   * r8a7795 Clock Pulse Generator / Module Standby and Software Reset
   *
@@@ -7,6 -6,10 +7,6 @@@
   * Based on clk-rcar-gen3.c
   *
   * Copyright (C) 2015 Renesas Electronics Corp.
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License as published by
 - * the Free Software Foundation; version 2 of the License.
   */
  
  #include <linux/device.h>
@@@ -70,6 -73,8 +70,8 @@@ static struct cpg_core_clk r8a7795_core
        DEF_FIXED(".s3",        CLK_S3,            CLK_PLL1_DIV2,  6, 1),
        DEF_FIXED(".sdsrc",     CLK_SDSRC,         CLK_PLL1_DIV2,  2, 1),
  
+       DEF_GEN3_OSC(".r",      CLK_RINT,          CLK_EXTAL,      32),
        /* Core Clock Outputs */
        DEF_BASE("z",           R8A7795_CLK_Z,     CLK_TYPE_GEN3_Z, CLK_PLL0),
        DEF_BASE("z2",          R8A7795_CLK_Z2,    CLK_TYPE_GEN3_Z2, CLK_PLL2),
        DEF_DIV6P1("mso",       R8A7795_CLK_MSO,   CLK_PLL1_DIV4, 0x014),
        DEF_DIV6P1("hdmi",      R8A7795_CLK_HDMI,  CLK_PLL1_DIV4, 0x250),
  
-       DEF_DIV6_RO("osc",      R8A7795_CLK_OSC,   CLK_EXTAL, CPG_RCKCR,  8),
-       DEF_DIV6_RO("r_int",    CLK_RINT,          CLK_EXTAL, CPG_RCKCR, 32),
+       DEF_GEN3_OSC("osc",     R8A7795_CLK_OSC,   CLK_EXTAL,     8),
  
        DEF_BASE("r",           R8A7795_CLK_R,     CLK_TYPE_GEN3_R, CLK_RINT),
  };
@@@ -280,25 -284,25 +281,25 @@@ static const unsigned int r8a7795_crit_
   */
  
  /*
-  *   MD               EXTAL           PLL0    PLL1    PLL2    PLL3    PLL4
+  *   MD               EXTAL           PLL0    PLL1    PLL2    PLL3    PLL4    OSC
   * 14 13 19 17        (MHz)
-  *-------------------------------------------------------------------
-  * 0  0  0  0 16.66 x 1       x180    x192    x144    x192    x144
-  * 0  0  0  1 16.66 x 1       x180    x192    x144    x128    x144
+  *-------------------------------------------------------------------------
+  * 0  0  0  0 16.66 x 1       x180    x192    x144    x192    x144    /16
+  * 0  0  0  1 16.66 x 1       x180    x192    x144    x128    x144    /16
   * 0  0  1  0 Prohibited setting
-  * 0  0  1  1 16.66 x 1       x180    x192    x144    x192    x144
-  * 0  1  0  0 20    x 1       x150    x160    x120    x160    x120
-  * 0  1  0  1 20    x 1       x150    x160    x120    x106    x120
+  * 0  0  1  1 16.66 x 1       x180    x192    x144    x192    x144    /16
+  * 0  1  0  0 20    x 1       x150    x160    x120    x160    x120    /19
+  * 0  1  0  1 20    x 1       x150    x160    x120    x106    x120    /19
   * 0  1  1  0 Prohibited setting
-  * 0  1  1  1 20    x 1       x150    x160    x120    x160    x120
-  * 1  0  0  0 25    x 1       x120    x128    x96     x128    x96
-  * 1  0  0  1 25    x 1       x120    x128    x96     x84     x96
+  * 0  1  1  1 20    x 1       x150    x160    x120    x160    x120    /19
+  * 1  0  0  0 25    x 1       x120    x128    x96     x128    x96     /24
+  * 1  0  0  1 25    x 1       x120    x128    x96     x84     x96     /24
   * 1  0  1  0 Prohibited setting
-  * 1  0  1  1 25    x 1       x120    x128    x96     x128    x96
-  * 1  1  0  0 33.33 / 2       x180    x192    x144    x192    x144
-  * 1  1  0  1 33.33 / 2       x180    x192    x144    x128    x144
+  * 1  0  1  1 25    x 1       x120    x128    x96     x128    x96     /24
+  * 1  1  0  0 33.33 / 2       x180    x192    x144    x192    x144    /32
+  * 1  1  0  1 33.33 / 2       x180    x192    x144    x128    x144    /32
   * 1  1  1  0 Prohibited setting
-  * 1  1  1  1 33.33 / 2       x180    x192    x144    x192    x144
+  * 1  1  1  1 33.33 / 2       x180    x192    x144    x192    x144    /32
   */
  #define CPG_PLL_CONFIG_INDEX(md)      ((((md) & BIT(14)) >> 11) | \
                                         (((md) & BIT(13)) >> 11) | \
                                         (((md) & BIT(17)) >> 17))
  
  static const struct rcar_gen3_cpg_pll_config cpg_pll_configs[16] __initconst = {
-       /* EXTAL div    PLL1 mult/div   PLL3 mult/div */
-       { 1,            192,    1,      192,    1,      },
-       { 1,            192,    1,      128,    1,      },
-       { 0, /* Prohibited setting */                   },
-       { 1,            192,    1,      192,    1,      },
-       { 1,            160,    1,      160,    1,      },
-       { 1,            160,    1,      106,    1,      },
-       { 0, /* Prohibited setting */                   },
-       { 1,            160,    1,      160,    1,      },
-       { 1,            128,    1,      128,    1,      },
-       { 1,            128,    1,      84,     1,      },
-       { 0, /* Prohibited setting */                   },
-       { 1,            128,    1,      128,    1,      },
-       { 2,            192,    1,      192,    1,      },
-       { 2,            192,    1,      128,    1,      },
-       { 0, /* Prohibited setting */                   },
-       { 2,            192,    1,      192,    1,      },
+       /* EXTAL div    PLL1 mult/div   PLL3 mult/div   OSC prediv */
+       { 1,            192,    1,      192,    1,      16,     },
+       { 1,            192,    1,      128,    1,      16,     },
+       { 0, /* Prohibited setting */                           },
+       { 1,            192,    1,      192,    1,      16,     },
+       { 1,            160,    1,      160,    1,      19,     },
+       { 1,            160,    1,      106,    1,      19,     },
+       { 0, /* Prohibited setting */                           },
+       { 1,            160,    1,      160,    1,      19,     },
+       { 1,            128,    1,      128,    1,      24,     },
+       { 1,            128,    1,      84,     1,      24,     },
+       { 0, /* Prohibited setting */                           },
+       { 1,            128,    1,      128,    1,      24,     },
+       { 2,            192,    1,      192,    1,      32,     },
+       { 2,            192,    1,      128,    1,      32,     },
+       { 0, /* Prohibited setting */                           },
+       { 2,            192,    1,      192,    1,      32,     },
  };
  
  static const struct soc_device_attribute r8a7795es1[] __initconst = {
index 9476ffeebb7bce3643c345f971ff0f1ee641b208,7e98fb8b1074c298b7c81da6f5375b1de67bacaa..10567386e6dd83eb8e9e4f9e448eaafa6bcdc95d
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /*
   * r8a7796 Clock Pulse Generator / Module Standby and Software Reset
   *
@@@ -8,6 -7,10 +8,6 @@@
   *
   * Copyright (C) 2015 Glider bvba
   * Copyright (C) 2015 Renesas Electronics Corp.
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License as published by
 - * the Free Software Foundation; version 2 of the License.
   */
  
  #include <linux/device.h>
@@@ -70,6 -73,8 +70,8 @@@ static const struct cpg_core_clk r8a779
        DEF_FIXED(".s3",        CLK_S3,            CLK_PLL1_DIV2,  6, 1),
        DEF_FIXED(".sdsrc",     CLK_SDSRC,         CLK_PLL1_DIV2,  2, 1),
  
+       DEF_GEN3_OSC(".r",      CLK_RINT,          CLK_EXTAL,      32),
        /* Core Clock Outputs */
        DEF_BASE("z",           R8A7796_CLK_Z,     CLK_TYPE_GEN3_Z, CLK_PLL0),
        DEF_BASE("z2",          R8A7796_CLK_Z2,    CLK_TYPE_GEN3_Z2, CLK_PLL2),
        DEF_DIV6P1("mso",       R8A7796_CLK_MSO,   CLK_PLL1_DIV4, 0x014),
        DEF_DIV6P1("hdmi",      R8A7796_CLK_HDMI,  CLK_PLL1_DIV4, 0x250),
  
-       DEF_DIV6_RO("osc",      R8A7796_CLK_OSC,   CLK_EXTAL, CPG_RCKCR,  8),
-       DEF_DIV6_RO("r_int",    CLK_RINT,          CLK_EXTAL, CPG_RCKCR, 32),
+       DEF_GEN3_OSC("osc",     R8A7796_CLK_OSC,   CLK_EXTAL,     8),
  
        DEF_BASE("r",           R8A7796_CLK_R,     CLK_TYPE_GEN3_R, CLK_RINT),
  };
@@@ -252,25 -256,25 +253,25 @@@ static const unsigned int r8a7796_crit_
   */
  
  /*
-  *   MD               EXTAL           PLL0    PLL1    PLL2    PLL3    PLL4
+  *   MD               EXTAL           PLL0    PLL1    PLL2    PLL3    PLL4    OSC
   * 14 13 19 17        (MHz)
-  *-------------------------------------------------------------------
-  * 0  0  0  0 16.66 x 1       x180    x192    x144    x192    x144
-  * 0  0  0  1 16.66 x 1       x180    x192    x144    x128    x144
+  *-------------------------------------------------------------------------
+  * 0  0  0  0 16.66 x 1       x180    x192    x144    x192    x144    /16
+  * 0  0  0  1 16.66 x 1       x180    x192    x144    x128    x144    /16
   * 0  0  1  0 Prohibited setting
-  * 0  0  1  1 16.66 x 1       x180    x192    x144    x192    x144
-  * 0  1  0  0 20    x 1       x150    x160    x120    x160    x120
-  * 0  1  0  1 20    x 1       x150    x160    x120    x106    x120
+  * 0  0  1  1 16.66 x 1       x180    x192    x144    x192    x144    /16
+  * 0  1  0  0 20    x 1       x150    x160    x120    x160    x120    /19
+  * 0  1  0  1 20    x 1       x150    x160    x120    x106    x120    /19
   * 0  1  1  0 Prohibited setting
-  * 0  1  1  1 20    x 1       x150    x160    x120    x160    x120
-  * 1  0  0  0 25    x 1       x120    x128    x96     x128    x96
-  * 1  0  0  1 25    x 1       x120    x128    x96     x84     x96
+  * 0  1  1  1 20    x 1       x150    x160    x120    x160    x120    /19
+  * 1  0  0  0 25    x 1       x120    x128    x96     x128    x96     /24
+  * 1  0  0  1 25    x 1       x120    x128    x96     x84     x96     /24
   * 1  0  1  0 Prohibited setting
-  * 1  0  1  1 25    x 1       x120    x128    x96     x128    x96
-  * 1  1  0  0 33.33 / 2       x180    x192    x144    x192    x144
-  * 1  1  0  1 33.33 / 2       x180    x192    x144    x128    x144
+  * 1  0  1  1 25    x 1       x120    x128    x96     x128    x96     /24
+  * 1  1  0  0 33.33 / 2       x180    x192    x144    x192    x144    /32
+  * 1  1  0  1 33.33 / 2       x180    x192    x144    x128    x144    /32
   * 1  1  1  0 Prohibited setting
-  * 1  1  1  1 33.33 / 2       x180    x192    x144    x192    x144
+  * 1  1  1  1 33.33 / 2       x180    x192    x144    x192    x144    /32
   */
  #define CPG_PLL_CONFIG_INDEX(md)      ((((md) & BIT(14)) >> 11) | \
                                         (((md) & BIT(13)) >> 11) | \
                                         (((md) & BIT(17)) >> 17))
  
  static const struct rcar_gen3_cpg_pll_config cpg_pll_configs[16] __initconst = {
-       /* EXTAL div    PLL1 mult/div   PLL3 mult/div */
-       { 1,            192,    1,      192,    1,      },
-       { 1,            192,    1,      128,    1,      },
-       { 0, /* Prohibited setting */                   },
-       { 1,            192,    1,      192,    1,      },
-       { 1,            160,    1,      160,    1,      },
-       { 1,            160,    1,      106,    1,      },
-       { 0, /* Prohibited setting */                   },
-       { 1,            160,    1,      160,    1,      },
-       { 1,            128,    1,      128,    1,      },
-       { 1,            128,    1,      84,     1,      },
-       { 0, /* Prohibited setting */                   },
-       { 1,            128,    1,      128,    1,      },
-       { 2,            192,    1,      192,    1,      },
-       { 2,            192,    1,      128,    1,      },
-       { 0, /* Prohibited setting */                   },
-       { 2,            192,    1,      192,    1,      },
+       /* EXTAL div    PLL1 mult/div   PLL3 mult/div   OSC prediv */
+       { 1,            192,    1,      192,    1,      16,     },
+       { 1,            192,    1,      128,    1,      16,     },
+       { 0, /* Prohibited setting */                           },
+       { 1,            192,    1,      192,    1,      16,     },
+       { 1,            160,    1,      160,    1,      19,     },
+       { 1,            160,    1,      106,    1,      19,     },
+       { 0, /* Prohibited setting */                           },
+       { 1,            160,    1,      160,    1,      19,     },
+       { 1,            128,    1,      128,    1,      24,     },
+       { 1,            128,    1,      84,     1,      24,     },
+       { 0, /* Prohibited setting */                           },
+       { 1,            128,    1,      128,    1,      24,     },
+       { 2,            192,    1,      192,    1,      32,     },
+       { 2,            192,    1,      128,    1,      32,     },
+       { 0, /* Prohibited setting */                           },
+       { 2,            192,    1,      192,    1,      32,     },
  };
  
  static int __init r8a7796_cpg_mssr_init(struct device *dev)
index 38509873d06c4c5028a7c3e7439ecea910efad55,71341ffa2016695cb9b9c85fa228ec06576ed1e0..2015e45543e948f23aa70160a4a5b34f9f61355d
@@@ -1,14 -1,18 +1,15 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /*
   * r8a77970 Clock Pulse Generator / Module Standby and Software Reset
   *
-  * Copyright (C) 2017 Cogent Embedded Inc.
+  * Copyright (C) 2017-2018 Cogent Embedded Inc.
   *
   * Based on r8a7795-cpg-mssr.c
   *
   * Copyright (C) 2015 Glider bvba
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License as published by
 - * the Free Software Foundation; version 2 of the License.
   */
  
+ #include <linux/clk-provider.h>
  #include <linux/device.h>
  #include <linux/init.h>
  #include <linux/kernel.h>
  #include "renesas-cpg-mssr.h"
  #include "rcar-gen3-cpg.h"
  
+ #define CPG_SD0CKCR           0x0074
+ enum r8a77970_clk_types {
+       CLK_TYPE_R8A77970_SD0H = CLK_TYPE_GEN3_SOC_BASE,
+       CLK_TYPE_R8A77970_SD0,
+ };
  enum clk_ids {
        /* Core Clock Outputs exported to DT */
        LAST_DT_CORE_CLK = R8A77970_CLK_OSC,
        MOD_CLK_BASE
  };
  
+ static spinlock_t cpg_lock;
+ static const struct clk_div_table cpg_sd0h_div_table[] = {
+       {  0,  2 }, {  1,  3 }, {  2,  4 }, {  3,  6 },
+       {  4,  8 }, {  5, 12 }, {  6, 16 }, {  7, 18 },
+       {  8, 24 }, { 10, 36 }, { 11, 48 }, {  0,  0 },
+ };
+ static const struct clk_div_table cpg_sd0_div_table[] = {
+       {  4,  8 }, {  5, 12 }, {  6, 16 }, {  7, 18 },
+       {  8, 24 }, { 10, 36 }, { 11, 48 }, { 12, 10 },
+       {  0,  0 },
+ };
  static const struct cpg_core_clk r8a77970_core_clks[] __initconst = {
        /* External Clock Inputs */
        DEF_INPUT("extal",      CLK_EXTAL),
        DEF_FIXED("s2d2",       R8A77970_CLK_S2D2,  CLK_PLL1_DIV2, 12, 1),
        DEF_FIXED("s2d4",       R8A77970_CLK_S2D4,  CLK_PLL1_DIV2, 24, 1),
  
+       DEF_BASE("sd0h", R8A77970_CLK_SD0H, CLK_TYPE_R8A77970_SD0H,
+                CLK_PLL1_DIV2),
+       DEF_BASE("sd0", R8A77970_CLK_SD0, CLK_TYPE_R8A77970_SD0, CLK_PLL1_DIV2),
        DEF_FIXED("cl",         R8A77970_CLK_CL,    CLK_PLL1_DIV2, 48, 1),
        DEF_FIXED("cp",         R8A77970_CLK_CP,    CLK_EXTAL,      2, 1),
  
  };
  
  static const struct mssr_mod_clk r8a77970_mod_clks[] __initconst = {
+       DEF_MOD("tmu4",                  121,   R8A77970_CLK_S2D2),
+       DEF_MOD("tmu3",                  122,   R8A77970_CLK_S2D2),
+       DEF_MOD("tmu2",                  123,   R8A77970_CLK_S2D2),
+       DEF_MOD("tmu1",                  124,   R8A77970_CLK_S2D2),
+       DEF_MOD("tmu0",                  125,   R8A77970_CLK_CP),
        DEF_MOD("ivcp1e",                127,   R8A77970_CLK_S2D1),
        DEF_MOD("scif4",                 203,   R8A77970_CLK_S2D4),
        DEF_MOD("scif3",                 204,   R8A77970_CLK_S2D4),
        DEF_MOD("mfis",                  213,   R8A77970_CLK_S2D2),
        DEF_MOD("sys-dmac2",             217,   R8A77970_CLK_S2D1),
        DEF_MOD("sys-dmac1",             218,   R8A77970_CLK_S2D1),
+       DEF_MOD("cmt3",                  300,   R8A77970_CLK_R),
+       DEF_MOD("cmt2",                  301,   R8A77970_CLK_R),
+       DEF_MOD("cmt1",                  302,   R8A77970_CLK_R),
+       DEF_MOD("cmt0",                  303,   R8A77970_CLK_R),
+       DEF_MOD("tpu0",                  304,   R8A77970_CLK_S2D4),
+       DEF_MOD("sd-if",                 314,   R8A77970_CLK_SD0),
        DEF_MOD("rwdt",                  402,   R8A77970_CLK_R),
        DEF_MOD("intc-ex",               407,   R8A77970_CLK_CP),
        DEF_MOD("intc-ap",               408,   R8A77970_CLK_S2D1),
@@@ -170,11 -210,46 +207,46 @@@ static int __init r8a77970_cpg_mssr_ini
        if (error)
                return error;
  
+       spin_lock_init(&cpg_lock);
        cpg_pll_config = &cpg_pll_configs[CPG_PLL_CONFIG_INDEX(cpg_mode)];
  
        return rcar_gen3_cpg_init(cpg_pll_config, CLK_EXTALR, cpg_mode);
  }
  
+ static struct clk * __init r8a77970_cpg_clk_register(struct device *dev,
+       const struct cpg_core_clk *core, const struct cpg_mssr_info *info,
+       struct clk **clks, void __iomem *base,
+       struct raw_notifier_head *notifiers)
+ {
+       const struct clk_div_table *table;
+       const struct clk *parent;
+       unsigned int shift;
+       switch (core->type) {
+       case CLK_TYPE_R8A77970_SD0H:
+               table = cpg_sd0h_div_table;
+               shift = 8;
+               break;
+       case CLK_TYPE_R8A77970_SD0:
+               table = cpg_sd0_div_table;
+               shift = 4;
+               break;
+       default:
+               return rcar_gen3_cpg_clk_register(dev, core, info, clks, base,
+                                                 notifiers);
+       }
+       parent = clks[core->parent];
+       if (IS_ERR(parent))
+               return ERR_CAST(parent);
+       return clk_register_divider_table(NULL, core->name,
+                                         __clk_get_name(parent), 0,
+                                         base + CPG_SD0CKCR,
+                                         shift, 4, 0, table, &cpg_lock);
+ }
  const struct cpg_mssr_info r8a77970_cpg_mssr_info __initconst = {
        /* Core Clocks */
        .core_clks = r8a77970_core_clks,
  
        /* Callbacks */
        .init = r8a77970_cpg_mssr_init,
-       .cpg_clk_register = rcar_gen3_cpg_clk_register,
+       .cpg_clk_register = r8a77970_cpg_clk_register,
  };
index 334b3c141dad417cceab6390c090cb423813cfb0,49e6a0de54916e2dd039f204d4858b7d421b1777..47e60e3dbe05ff18252c7513ec2bd5e3c5b39aff
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /*
   * r8a77995 Clock Pulse Generator / Module Standby and Software Reset
   *
@@@ -8,6 -7,10 +8,6 @@@
   *
   * Copyright (C) 2015 Glider bvba
   * Copyright (C) 2015 Renesas Electronics Corp.
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License as published by
 - * the Free Software Foundation; version 2 of the License.
   */
  
  #include <linux/device.h>
@@@ -43,6 -46,8 +43,8 @@@ enum clk_ids 
        CLK_S3,
        CLK_SDSRC,
        CLK_SSPSRC,
+       CLK_RINT,
+       CLK_OCO,
  
        /* Module Clocks */
        MOD_CLK_BASE
@@@ -69,6 -74,10 +71,10 @@@ static const struct cpg_core_clk r8a779
        DEF_FIXED(".s3",       CLK_S3,             CLK_PLL1,       6, 1),
        DEF_FIXED(".sdsrc",    CLK_SDSRC,          CLK_PLL1,       2, 1),
  
+       DEF_DIV6_RO(".r",      CLK_RINT,           CLK_EXTAL, CPG_RCKCR, 32),
+       DEF_RATE(".oco",       CLK_OCO,            8 * 1000 * 1000),
        /* Core Clock Outputs */
        DEF_FIXED("z2",        R8A77995_CLK_Z2,    CLK_PLL0D3,     1, 1),
        DEF_FIXED("ztr",       R8A77995_CLK_ZTR,   CLK_PLL1,       6, 1),
@@@ -87,8 -96,8 +93,8 @@@
  
        DEF_FIXED("cl",        R8A77995_CLK_CL,    CLK_PLL1,      48, 1),
        DEF_FIXED("cp",        R8A77995_CLK_CP,    CLK_EXTAL,      2, 1),
-       DEF_FIXED("osc",       R8A77995_CLK_OSC,   CLK_EXTAL,    384, 1),
-       DEF_FIXED("r",         R8A77995_CLK_R,     CLK_EXTAL,   1536, 1),
+       DEF_DIV6_RO("osc",     R8A77995_CLK_OSC,   CLK_EXTAL, CPG_RCKCR,  8),
  
        DEF_GEN3_PE("s1d4c",   R8A77995_CLK_S1D4C, CLK_S1, 4, CLK_PE, 2),
        DEF_GEN3_PE("s3d1c",   R8A77995_CLK_S3D1C, CLK_S3, 1, CLK_PE, 1),
  
        DEF_DIV6P1("canfd",    R8A77995_CLK_CANFD, CLK_PLL0D3,    0x244),
        DEF_DIV6P1("mso",      R8A77995_CLK_MSO,   CLK_PLL1D2,    0x014),
+       DEF_GEN3_RCKSEL("r",   R8A77995_CLK_R, CLK_RINT, 1, CLK_OCO, 61 * 4),
  };
  
  static const struct mssr_mod_clk r8a77995_mod_clks[] __initconst = {
index 07fabc6475c5246160ebc916839d6606c0c98b7a,4346fdeef01bbeaeea33e5c87177dec3cc254bfd..4ba38f98cc7bab8296631c04e1d3901870e4891e
@@@ -1,12 -1,15 +1,12 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /*
   * R-Car Gen3 Clock Pulse Generator
   *
-  * Copyright (C) 2015-2016 Glider bvba
+  * Copyright (C) 2015-2018 Glider bvba
   *
   * Based on clk-rcar-gen3.c
   *
   * Copyright (C) 2015 Renesas Electronics Corp.
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License as published by
 - * the Free Software Foundation; version 2 of the License.
   */
  
  #include <linux/bug.h>
@@@ -28,6 -31,8 +28,8 @@@
  #define CPG_PLL2CR            0x002c
  #define CPG_PLL4CR            0x01f4
  
+ #define CPG_RCKCR_CKSEL       BIT(15) /* RCLK Clock Source Select */
  struct cpg_simple_notifier {
        struct notifier_block nb;
        void __iomem *reg;
@@@ -441,7 -446,7 +443,7 @@@ struct clk * __init rcar_gen3_cpg_clk_r
        unsigned int div = 1;
        u32 value;
  
-       parent = clks[core->parent & 0xffff];   /* CLK_TYPE_PE uses high bits */
+       parent = clks[core->parent & 0xffff];   /* some types use high bits */
        if (IS_ERR(parent))
                return ERR_CAST(parent);
  
  
                        if (clk_get_rate(clks[cpg_clk_extalr])) {
                                parent = clks[cpg_clk_extalr];
-                               value |= BIT(15);
+                               value |= CPG_RCKCR_CKSEL;
                        }
  
                        writel(value, csn->reg);
                        parent = clks[cpg_clk_extalr];
                break;
  
-       case CLK_TYPE_GEN3_PE:
+       case CLK_TYPE_GEN3_MDSEL:
                /*
-                * Peripheral clock with a fixed divider, selectable between
-                * clean and spread spectrum parents using MD12
+                * Clock selectable between two parents and two fixed dividers
+                * using a mode pin
                 */
-               if (cpg_mode & BIT(12)) {
-                       /* Clean */
+               if (cpg_mode & BIT(core->offset)) {
                        div = core->div & 0xffff;
                } else {
-                       /* SCCG */
                        parent = clks[core->parent >> 16];
                        if (IS_ERR(parent))
                                return ERR_CAST(parent);
                return cpg_z_clk_register(core->name, __clk_get_name(parent),
                                          base, CPG_FRQCRC_Z2FC_MASK);
  
+       case CLK_TYPE_GEN3_OSC:
+               /*
+                * Clock combining OSC EXTAL predivider and a fixed divider
+                */
+               div = cpg_pll_config->osc_prediv * core->div;
+               break;
+       case CLK_TYPE_GEN3_RCKSEL:
+               /*
+                * Clock selectable between two parents and two fixed dividers
+                * using RCKCR.CKSEL
+                */
+               if (readl(base + CPG_RCKCR) & CPG_RCKCR_CKSEL) {
+                       div = core->div & 0xffff;
+               } else {
+                       parent = clks[core->parent >> 16];
+                       if (IS_ERR(parent))
+                               return ERR_CAST(parent);
+                       div = core->div >> 16;
+               }
+               break;
        default:
                return ERR_PTR(-EINVAL);
        }
index 6ebc4b42c5a3b584cee41fe3e98312ba017fb028,ba4e4f1946a9741ca7a9bd69815d314e0aa2dfe4..f4fb6cf16688cfb3d34a07f8add2764a181c46d9
@@@ -1,8 -1,11 +1,9 @@@
 -/*
 +/* SPDX-License-Identifier: GPL-2.0
 + *
   * R-Car Gen3 Clock Pulse Generator
   *
-  * Copyright (C) 2015-2016 Glider bvba
+  * Copyright (C) 2015-2018 Glider bvba
+  *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License as published by
 - * the Free Software Foundation; version 2 of the License.
   */
  
  #ifndef __CLK_RENESAS_RCAR_GEN3_CPG_H__
@@@ -17,19 -20,35 +18,35 @@@ enum rcar_gen3_clk_types 
        CLK_TYPE_GEN3_PLL4,
        CLK_TYPE_GEN3_SD,
        CLK_TYPE_GEN3_R,
-       CLK_TYPE_GEN3_PE,
+       CLK_TYPE_GEN3_MDSEL,    /* Select parent/divider using mode pin */
        CLK_TYPE_GEN3_Z,
        CLK_TYPE_GEN3_Z2,
+       CLK_TYPE_GEN3_OSC,      /* OSC EXTAL predivider and fixed divider */
+       CLK_TYPE_GEN3_RCKSEL,   /* Select parent/divider using RCKCR.CKSEL */
+       /* SoC specific definitions start here */
+       CLK_TYPE_GEN3_SOC_BASE,
  };
  
  #define DEF_GEN3_SD(_name, _id, _parent, _offset)     \
        DEF_BASE(_name, _id, CLK_TYPE_GEN3_SD, _parent, .offset = _offset)
  
+ #define DEF_GEN3_MDSEL(_name, _id, _md, _parent0, _div0, _parent1, _div1) \
+       DEF_BASE(_name, _id, CLK_TYPE_GEN3_MDSEL,       \
+                (_parent0) << 16 | (_parent1),         \
+                .div = (_div0) << 16 | (_div1), .offset = _md)
  #define DEF_GEN3_PE(_name, _id, _parent_sscg, _div_sscg, _parent_clean, \
                    _div_clean) \
-       DEF_BASE(_name, _id, CLK_TYPE_GEN3_PE,                  \
-                (_parent_sscg) << 16 | (_parent_clean),        \
-                .div = (_div_sscg) << 16 | (_div_clean))
+       DEF_GEN3_MDSEL(_name, _id, 12, _parent_sscg, _div_sscg, \
+                      _parent_clean, _div_clean)
+ #define DEF_GEN3_OSC(_name, _id, _parent, _div)               \
+       DEF_BASE(_name, _id, CLK_TYPE_GEN3_OSC, _parent, .div = _div)
+ #define DEF_GEN3_RCKSEL(_name, _id, _parent0, _div0, _parent1, _div1) \
+       DEF_BASE(_name, _id, CLK_TYPE_GEN3_RCKSEL,      \
+                (_parent0) << 16 | (_parent1), .div = (_div0) << 16 | (_div1))
  
  struct rcar_gen3_cpg_pll_config {
        u8 extal_div;
@@@ -37,6 -56,7 +54,7 @@@
        u8 pll1_div;
        u8 pll3_mult;
        u8 pll3_div;
+       u8 osc_prediv;
  };
  
  #define CPG_RCKCR     0x240
index a9c4f67b94b5dc60c67a77af482b3818f17789de,394a7d10392a2ef0fed3d1b7f9fafc1e4214c402..f7bb817420b4fdbb681680fb6bed29dbaf8b9bf4
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /*
   * Renesas Clock Pulse Generator / Module Standby and Software Reset
   *
@@@ -8,6 -7,10 +8,6 @@@
   *
   * Copyright (C) 2013 Ideas On Board SPRL
   * Copyright (C) 2015 Renesas Electronics Corp.
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License as published by
 - * the Free Software Foundation; version 2 of the License.
   */
  
  #include <linux/clk.h>
@@@ -70,6 -73,17 +70,17 @@@ static const u16 smstpcr[] = 
  
  #define       SMSTPCR(i)      smstpcr[i]
  
+ /*
+  * Standby Control Register offsets (RZ/A)
+  * Base address is FRQCR register
+  */
+ static const u16 stbcr[] = {
+       0xFFFF/*dummy*/, 0x010, 0x014, 0x410, 0x414, 0x418, 0x41C, 0x420,
+       0x424, 0x428, 0x42C,
+ };
+ #define       STBCR(i)        stbcr[i]
  
  /*
   * Software Reset Register offsets
@@@ -107,6 -121,7 +118,7 @@@ static const u16 srcr[] = 
   * @notifiers: Notifier chain to save/restore clock state for system resume
   * @smstpcr_saved[].mask: Mask of SMSTPCR[] bits under our control
   * @smstpcr_saved[].val: Saved values of SMSTPCR[]
+  * @stbyctrl: This device has Standby Control Registers
   */
  struct cpg_mssr_priv {
  #ifdef CONFIG_RESET_CONTROLLER
        struct device *dev;
        void __iomem *base;
        spinlock_t rmw_lock;
+       struct device_node *np;
  
        struct clk **clks;
        unsigned int num_core_clks;
        unsigned int num_mod_clks;
        unsigned int last_dt_core_clk;
+       bool stbyctrl;
  
        struct raw_notifier_head notifiers;
        struct {
        } smstpcr_saved[ARRAY_SIZE(smstpcr)];
  };
  
+ static struct cpg_mssr_priv *cpg_mssr_priv;
  
  /**
   * struct mstp_clock - MSTP gating clock
@@@ -159,16 -177,29 +174,29 @@@ static int cpg_mstp_clock_endisable(str
                enable ? "ON" : "OFF");
        spin_lock_irqsave(&priv->rmw_lock, flags);
  
-       value = readl(priv->base + SMSTPCR(reg));
-       if (enable)
-               value &= ~bitmask;
-       else
-               value |= bitmask;
-       writel(value, priv->base + SMSTPCR(reg));
+       if (priv->stbyctrl) {
+               value = readb(priv->base + STBCR(reg));
+               if (enable)
+                       value &= ~bitmask;
+               else
+                       value |= bitmask;
+               writeb(value, priv->base + STBCR(reg));
+               /* dummy read to ensure write has completed */
+               readb(priv->base + STBCR(reg));
+               barrier_data(priv->base + STBCR(reg));
+       } else {
+               value = readl(priv->base + SMSTPCR(reg));
+               if (enable)
+                       value &= ~bitmask;
+               else
+                       value |= bitmask;
+               writel(value, priv->base + SMSTPCR(reg));
+       }
  
        spin_unlock_irqrestore(&priv->rmw_lock, flags);
  
-       if (!enable)
+       if (!enable || priv->stbyctrl)
                return 0;
  
        for (i = 1000; i > 0; --i) {
@@@ -202,7 -233,10 +230,10 @@@ static int cpg_mstp_clock_is_enabled(st
        struct cpg_mssr_priv *priv = clock->priv;
        u32 value;
  
-       value = readl(priv->base + MSTPSR(clock->index / 32));
+       if (priv->stbyctrl)
+               value = readb(priv->base + STBCR(clock->index / 32));
+       else
+               value = readl(priv->base + MSTPSR(clock->index / 32));
  
        return !(value & BIT(clock->index % 32));
  }
@@@ -223,6 -257,7 +254,7 @@@ struct clk *cpg_mssr_clk_src_twocell_ge
        unsigned int idx;
        const char *type;
        struct clk *clk;
+       int range_check;
  
        switch (clkspec->args[0]) {
        case CPG_CORE:
  
        case CPG_MOD:
                type = "module";
-               idx = MOD_CLK_PACK(clkidx);
-               if (clkidx % 100 > 31 || idx >= priv->num_mod_clks) {
+               if (priv->stbyctrl) {
+                       idx = MOD_CLK_PACK_10(clkidx);
+                       range_check = 7 - (clkidx % 10);
+               } else {
+                       idx = MOD_CLK_PACK(clkidx);
+                       range_check = 31 - (clkidx % 100);
+               }
+               if (range_check < 0 || idx >= priv->num_mod_clks) {
                        dev_err(dev, "Invalid %s clock index %u\n", type,
                                clkidx);
                        return ERR_PTR(-EINVAL);
@@@ -280,7 -321,7 +318,7 @@@ static void __init cpg_mssr_register_co
  
        switch (core->type) {
        case CLK_TYPE_IN:
-               clk = of_clk_get_by_name(priv->dev->of_node, core->name);
+               clk = of_clk_get_by_name(priv->np, core->name);
                break;
  
        case CLK_TYPE_FF:
                }
                break;
  
+       case CLK_TYPE_FR:
+               clk = clk_register_fixed_rate(NULL, core->name, NULL, 0,
+                                             core->mult);
+               break;
        default:
                if (info->cpg_clk_register)
                        clk = info->cpg_clk_register(dev, core, info,
@@@ -638,11 -684,22 +681,22 @@@ static inline int cpg_mssr_reset_contro
  
  
  static const struct of_device_id cpg_mssr_match[] = {
+ #ifdef CONFIG_CLK_R7S9210
+       {
+               .compatible = "renesas,r7s9210-cpg-mssr",
+               .data = &r7s9210_cpg_mssr_info,
+       },
+ #endif
  #ifdef CONFIG_CLK_R8A7743
        {
                .compatible = "renesas,r8a7743-cpg-mssr",
                .data = &r8a7743_cpg_mssr_info,
        },
+       /* RZ/G1N is (almost) identical to RZ/G1M w.r.t. clocks. */
+       {
+               .compatible = "renesas,r8a7744-cpg-mssr",
+               .data = &r8a7743_cpg_mssr_info,
+       },
  #endif
  #ifdef CONFIG_CLK_R8A7745
        {
                .data = &r8a77470_cpg_mssr_info,
        },
  #endif
+ #ifdef CONFIG_CLK_R8A774A1
+       {
+               .compatible = "renesas,r8a774a1-cpg-mssr",
+               .data = &r8a774a1_cpg_mssr_info,
+       },
+ #endif
+ #ifdef CONFIG_CLK_R8A774C0
+       {
+               .compatible = "renesas,r8a774c0-cpg-mssr",
+               .data = &r8a774c0_cpg_mssr_info,
+       },
+ #endif
  #ifdef CONFIG_CLK_R8A7790
        {
                .compatible = "renesas,r8a7790-cpg-mssr",
@@@ -777,13 -846,23 +843,23 @@@ static int cpg_mssr_resume_noirq(struc
                if (!mask)
                        continue;
  
-               oldval = readl(priv->base + SMSTPCR(reg));
+               if (priv->stbyctrl)
+                       oldval = readb(priv->base + STBCR(reg));
+               else
+                       oldval = readl(priv->base + SMSTPCR(reg));
                newval = oldval & ~mask;
                newval |= priv->smstpcr_saved[reg].val & mask;
                if (newval == oldval)
                        continue;
  
-               writel(newval, priv->base + SMSTPCR(reg));
+               if (priv->stbyctrl) {
+                       writeb(newval, priv->base + STBCR(reg));
+                       /* dummy read to ensure write has completed */
+                       readb(priv->base + STBCR(reg));
+                       barrier_data(priv->base + STBCR(reg));
+                       continue;
+               } else
+                       writel(newval, priv->base + SMSTPCR(reg));
  
                /* Wait until enabled clocks are really enabled */
                mask &= ~priv->smstpcr_saved[reg].val;
@@@ -814,61 -893,115 +890,115 @@@ static const struct dev_pm_ops cpg_mssr
  #define DEV_PM_OPS    NULL
  #endif /* CONFIG_PM_SLEEP && CONFIG_ARM_PSCI_FW */
  
- static int __init cpg_mssr_probe(struct platform_device *pdev)
+ static int __init cpg_mssr_common_init(struct device *dev,
+                                      struct device_node *np,
+                                      const struct cpg_mssr_info *info)
  {
-       struct device *dev = &pdev->dev;
-       struct device_node *np = dev->of_node;
-       const struct cpg_mssr_info *info;
        struct cpg_mssr_priv *priv;
+       struct clk **clks = NULL;
        unsigned int nclks, i;
-       struct resource *res;
-       struct clk **clks;
        int error;
  
-       info = of_device_get_match_data(dev);
        if (info->init) {
                error = info->init(dev);
                if (error)
                        return error;
        }
  
-       priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+       priv = kzalloc(sizeof(*priv), GFP_KERNEL);
        if (!priv)
                return -ENOMEM;
  
+       priv->np = np;
        priv->dev = dev;
        spin_lock_init(&priv->rmw_lock);
  
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       priv->base = devm_ioremap_resource(dev, res);
-       if (IS_ERR(priv->base))
-               return PTR_ERR(priv->base);
+       priv->base = of_iomap(np, 0);
+       if (!priv->base) {
+               error = -ENOMEM;
+               goto out_err;
+       }
  
        nclks = info->num_total_core_clks + info->num_hw_mod_clks;
-       clks = devm_kmalloc_array(dev, nclks, sizeof(*clks), GFP_KERNEL);
-       if (!clks)
-               return -ENOMEM;
+       clks = kmalloc_array(nclks, sizeof(*clks), GFP_KERNEL);
+       if (!clks) {
+               error = -ENOMEM;
+               goto out_err;
+       }
  
-       dev_set_drvdata(dev, priv);
+       cpg_mssr_priv = priv;
        priv->clks = clks;
        priv->num_core_clks = info->num_total_core_clks;
        priv->num_mod_clks = info->num_hw_mod_clks;
        priv->last_dt_core_clk = info->last_dt_core_clk;
        RAW_INIT_NOTIFIER_HEAD(&priv->notifiers);
+       priv->stbyctrl = info->stbyctrl;
  
        for (i = 0; i < nclks; i++)
                clks[i] = ERR_PTR(-ENOENT);
  
+       error = of_clk_add_provider(np, cpg_mssr_clk_src_twocell_get, priv);
+       if (error)
+               goto out_err;
+       return 0;
+ out_err:
+       kfree(clks);
+       if (priv->base)
+               iounmap(priv->base);
+       kfree(priv);
+       return error;
+ }
+ void __init cpg_mssr_early_init(struct device_node *np,
+                               const struct cpg_mssr_info *info)
+ {
+       int error;
+       int i;
+       error = cpg_mssr_common_init(NULL, np, info);
+       if (error)
+               return;
+       for (i = 0; i < info->num_early_core_clks; i++)
+               cpg_mssr_register_core_clk(&info->early_core_clks[i], info,
+                                          cpg_mssr_priv);
+       for (i = 0; i < info->num_early_mod_clks; i++)
+               cpg_mssr_register_mod_clk(&info->early_mod_clks[i], info,
+                                         cpg_mssr_priv);
+ }
+ static int __init cpg_mssr_probe(struct platform_device *pdev)
+ {
+       struct device *dev = &pdev->dev;
+       struct device_node *np = dev->of_node;
+       const struct cpg_mssr_info *info;
+       struct cpg_mssr_priv *priv;
+       unsigned int i;
+       int error;
+       info = of_device_get_match_data(dev);
+       if (!cpg_mssr_priv) {
+               error = cpg_mssr_common_init(dev, dev->of_node, info);
+               if (error)
+                       return error;
+       }
+       priv = cpg_mssr_priv;
+       priv->dev = dev;
+       dev_set_drvdata(dev, priv);
        for (i = 0; i < info->num_core_clks; i++)
                cpg_mssr_register_core_clk(&info->core_clks[i], info, priv);
  
        for (i = 0; i < info->num_mod_clks; i++)
                cpg_mssr_register_mod_clk(&info->mod_clks[i], info, priv);
  
-       error = of_clk_add_provider(np, cpg_mssr_clk_src_twocell_get, priv);
-       if (error)
-               return error;
        error = devm_add_action_or_reset(dev,
                                         cpg_mssr_del_clk_provider,
                                         np);
        if (error)
                return error;
  
+       /* Reset Controller not supported for Standby Control SoCs */
+       if (info->stbyctrl)
+               return 0;
        error = cpg_mssr_reset_controller_register(priv);
        if (error)
                return error;
index d52d1f8da9d7932bc5959b9bc67afd729d2fd659,4e639fb8da9a25c62391b6f1dc9d38f457c4612c..c4ec9df146fd990e90bb3b93b78e93c1d14e811c
@@@ -1,8 -1,11 +1,8 @@@
 -/*
 +/* SPDX-License-Identifier: GPL-2.0
 + *
   * Renesas Clock Pulse Generator / Module Standby and Software Reset
   *
   * Copyright (C) 2015 Glider bvba
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License as published by
 - * the Free Software Foundation; version 2 of the License.
   */
  
  #ifndef __CLK_RENESAS_CPG_MSSR_H__
@@@ -35,6 -38,7 +35,7 @@@ enum clk_types 
        CLK_TYPE_FF,            /* Fixed Factor Clock */
        CLK_TYPE_DIV6P1,        /* DIV6 Clock with 1 parent clock */
        CLK_TYPE_DIV6_RO,       /* DIV6 Clock read only with extra divisor */
+       CLK_TYPE_FR,            /* Fixed Rate Clock */
  
        /* Custom definitions start here */
        CLK_TYPE_CUSTOM,
@@@ -53,6 -57,8 +54,8 @@@
        DEF_BASE(_name, _id, CLK_TYPE_DIV6P1, _parent, .offset = _offset)
  #define DEF_DIV6_RO(_name, _id, _parent, _offset, _div)       \
        DEF_BASE(_name, _id, CLK_TYPE_DIV6_RO, _parent, .offset = _offset, .div = _div, .mult = 1)
+ #define DEF_RATE(_name, _id, _rate)   \
+       DEF_TYPE(_name, _id, CLK_TYPE_FR, .mult = _rate)
  
      /*
       * Definitions of Module Clocks
@@@ -72,12 -78,24 +75,24 @@@ struct mssr_mod_clk 
  #define DEF_MOD(_name, _mod, _parent...)      \
        { .name = _name, .id = MOD_CLK_ID(_mod), .parent = _parent }
  
+ /* Convert from sparse base-10 to packed index space */
+ #define MOD_CLK_PACK_10(x)    ((x / 10) * 32 + (x % 10))
+ #define MOD_CLK_ID_10(x)      (MOD_CLK_BASE + MOD_CLK_PACK_10(x))
+ #define DEF_MOD_STB(_name, _mod, _parent...)  \
+       { .name = _name, .id = MOD_CLK_ID_10(_mod), .parent = _parent }
  
  struct device_node;
  
      /**
       * SoC-specific CPG/MSSR Description
       *
+      * @early_core_clks: Array of Early Core Clock definitions
+      * @num_early_core_clks: Number of entries in early_core_clks[]
+      * @early_mod_clks: Array of Early Module Clock definitions
+      * @num_early_mod_clks: Number of entries in early_mod_clks[]
+      *
       * @core_clks: Array of Core Clock definitions
       * @num_core_clks: Number of entries in core_clks[]
       * @last_dt_core_clk: ID of the last Core Clock exported to DT
       *
       * @init: Optional callback to perform SoC-specific initialization
       * @cpg_clk_register: Optional callback to handle special Core Clock types
+      *
+      * @stbyctrl: This device has Standby Control Registers which are 8-bits
+      *            wide, no status registers (MSTPSR) and have different address
+      *            offsets.
       */
  
  struct cpg_mssr_info {
+       /* Early Clocks */
+       const struct cpg_core_clk *early_core_clks;
+       unsigned int num_early_core_clks;
+       const struct mssr_mod_clk *early_mod_clks;
+       unsigned int num_early_mod_clks;
        /* Core Clocks */
        const struct cpg_core_clk *core_clks;
        unsigned int num_core_clks;
        unsigned int last_dt_core_clk;
        unsigned int num_total_core_clks;
+       bool stbyctrl;
  
        /* Module Clocks */
        const struct mssr_mod_clk *mod_clks;
                                        struct raw_notifier_head *notifiers);
  };
  
+ extern const struct cpg_mssr_info r7s9210_cpg_mssr_info;
  extern const struct cpg_mssr_info r8a7743_cpg_mssr_info;
  extern const struct cpg_mssr_info r8a7745_cpg_mssr_info;
  extern const struct cpg_mssr_info r8a77470_cpg_mssr_info;
+ extern const struct cpg_mssr_info r8a774a1_cpg_mssr_info;
+ extern const struct cpg_mssr_info r8a774c0_cpg_mssr_info;
  extern const struct cpg_mssr_info r8a7790_cpg_mssr_info;
  extern const struct cpg_mssr_info r8a7791_cpg_mssr_info;
  extern const struct cpg_mssr_info r8a7792_cpg_mssr_info;
@@@ -143,6 -175,8 +172,8 @@@ extern const struct cpg_mssr_info r8a77
  extern const struct cpg_mssr_info r8a77990_cpg_mssr_info;
  extern const struct cpg_mssr_info r8a77995_cpg_mssr_info;
  
+ void __init cpg_mssr_early_init(struct device_node *np,
+                               const struct cpg_mssr_info *info);
  
      /*
       * Helpers for fixing up clock tables depending on SoC revision