mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
clk: renesas: Updates for v4.10 (take two)
- Add R-Car RST driver for obtaining mode pin state, and move the
related functionality from platform code to DT,
- Add r8a7743 and r8a7745 CPG Core Clock Definitions.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABAgAGBQJYIJj/AAoJEEgEtLw/Ve773fgP/3yhgJLa6zoYzFE4lS5q/+vk
95DAqkGrc9D+QzCw1/YAb8w2zqr9kigwBcwc9xlv9wQ/5Nx63WN9jgccw1Kd2xhU
OaKhgyHpeXpH9MM46TRVJ5Txu7xLVofxtgxGv4ED43sNwZinrH9PrC/ELgQWgbq+
SQTVjE4bKqANNugt91UzPIzL5YPeJvX02SlFoDjbS3XNg5/cTjAaidVW24Ed8x5S
OAUkC4chm81Jz4B7M5QcVy4vdfb9aE/m7d5a6iy6nE5EopH6Puu8RwL0SzvltDp4
AxIj5ZslOKhvqCKvVlp2ALlBeZ1rOXr5KsOdHHN+rkMiaR8a8agv7y/H/gJSbwiZ
x7oI0QDiS5/6tYDxx67KtGECMAcSK0b0p/rWziYw9C5BDuvuMe5HhxN9fesHLUOx
Yq6f0GwveUgWfcHIjcEh6Htj4dUfXaxiTgZSF1Dgp5SvW9fPhg40Rz3+ahnT40rP
8Ke/W5M5QZ2f+L51l3QiZ3NtX1kWLr1H8GExV15Cm08aBWx7p/8fvdqpv1EcVhiW
dEnhtPBVf8O/LiZ6eS+0aBQS22fl9u06s3d/vXQoO9kaCcK+BWP9cB+5CsieTD6s
D/3iOq4da3OnOjTcmIQEKEsnrtJq5qxBOZ52Fk422Wk/EX9Bwl+/ggmXhchiGn4V
I28aLLIUHIfmOMb5H23E
=Pd5n
-----END PGP SIGNATURE-----
Merge tag 'clk-renesas-for-v4.10-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into clk-next
Pull Renesas clk driver updates from Geerty Uytterhoeven:
- Add R-Car RST driver for obtaining mode pin state, and move the
related functionality from platform code to DT,
- Add r8a7743 and r8a7745 CPG Core Clock Definitions.
The commits here are intermingled with arm-soc material because
of the hard dependency we're breaking between mach code and
driver code. We're replacing that with a driver dependency
between the soc driver and the clk driver.
* tag 'clk-renesas-for-v4.10-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers: (25 commits)
clk: renesas: Add r8a7745 CPG Core Clock Definitions
clk: renesas: Add r8a7743 CPG Core Clock Definitions
clk: renesas: rcar-gen2: Remove obsolete rcar_gen2_clocks_init()
clk: renesas: r8a7779: Remove obsolete r8a7779_clocks_init()
clk: renesas: r8a7778: Remove obsolete r8a7778_clocks_init()
ARM: shmobile: rcar-gen2: Stop passing mode pins state to clock driver
ARM: shmobile: r8a7779: Stop passing mode pins state to clock driver
ARM: shmobile: r8a7778: Stop passing mode pins state to clock driver
clk: renesas: rcar-gen3-cpg: Remove obsolete rcar_gen3_read_mode_pins()
clk: renesas: r8a7796: Obtain mode pin values from R-Car RST driver
clk: renesas: r8a7795: Obtain mode pin values from R-Car RST driver
clk: renesas: rcar-gen2: Obtain mode pin values using RST driver
clk: renesas: r8a7779: Obtain mode pin values from R-Car RST driver
clk: renesas: r8a7778: Obtain mode pin values using R-Car RST driver
arm64: renesas: r8a7796 dtsi: Add device node for RST module
arm64: renesas: r8a7795 dtsi: Add device node for RST module
ARM: dts: r8a7794: Add device node for RST module
ARM: dts: r8a7793: Add device node for RST module
ARM: dts: r8a7792: Add device node for RST module
ARM: dts: r8a7791: Add device node for RST module
...
This commit is contained in:
commit
54fd1b3bc4
26 changed files with 333 additions and 100 deletions
|
|
@ -12,6 +12,7 @@
|
|||
#include <linux/clk/renesas.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/soc/renesas/rcar-rst.h>
|
||||
|
||||
struct r8a7778_cpg {
|
||||
struct clk_onecell_data data;
|
||||
|
|
@ -83,6 +84,18 @@ static void __init r8a7778_cpg_clocks_init(struct device_node *np)
|
|||
struct clk **clks;
|
||||
unsigned int i;
|
||||
int num_clks;
|
||||
u32 mode;
|
||||
|
||||
if (rcar_rst_read_mode_pins(&mode))
|
||||
return;
|
||||
|
||||
BUG_ON(!(mode & BIT(19)));
|
||||
|
||||
cpg_mode_rates = (!!(mode & BIT(18)) << 2) |
|
||||
(!!(mode & BIT(12)) << 1) |
|
||||
(!!(mode & BIT(11)));
|
||||
cpg_mode_divs = (!!(mode & BIT(2)) << 1) |
|
||||
(!!(mode & BIT(1)));
|
||||
|
||||
num_clks = of_property_count_strings(np, "clock-output-names");
|
||||
if (num_clks < 0) {
|
||||
|
|
@ -130,16 +143,3 @@ static void __init r8a7778_cpg_clocks_init(struct device_node *np)
|
|||
|
||||
CLK_OF_DECLARE(r8a7778_cpg_clks, "renesas,r8a7778-cpg-clocks",
|
||||
r8a7778_cpg_clocks_init);
|
||||
|
||||
void __init r8a7778_clocks_init(u32 mode)
|
||||
{
|
||||
BUG_ON(!(mode & BIT(19)));
|
||||
|
||||
cpg_mode_rates = (!!(mode & BIT(18)) << 2) |
|
||||
(!!(mode & BIT(12)) << 1) |
|
||||
(!!(mode & BIT(11)));
|
||||
cpg_mode_divs = (!!(mode & BIT(2)) << 1) |
|
||||
(!!(mode & BIT(1)));
|
||||
|
||||
of_clk_init(NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include <linux/of_address.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/soc/renesas/rcar-rst.h>
|
||||
|
||||
#include <dt-bindings/clock/r8a7779-clock.h>
|
||||
|
||||
|
|
@ -88,8 +89,6 @@ static const unsigned int cpg_plla_mult[4] __initconst = { 42, 48, 56, 64 };
|
|||
* Initialization
|
||||
*/
|
||||
|
||||
static u32 cpg_mode __initdata;
|
||||
|
||||
static struct clk * __init
|
||||
r8a7779_cpg_register_clock(struct device_node *np, struct r8a7779_cpg *cpg,
|
||||
const struct cpg_clk_config *config,
|
||||
|
|
@ -127,6 +126,10 @@ static void __init r8a7779_cpg_clocks_init(struct device_node *np)
|
|||
struct clk **clks;
|
||||
unsigned int i, plla_mult;
|
||||
int num_clks;
|
||||
u32 mode;
|
||||
|
||||
if (rcar_rst_read_mode_pins(&mode))
|
||||
return;
|
||||
|
||||
num_clks = of_property_count_strings(np, "clock-output-names");
|
||||
if (num_clks < 0) {
|
||||
|
|
@ -148,8 +151,8 @@ static void __init r8a7779_cpg_clocks_init(struct device_node *np)
|
|||
cpg->data.clks = clks;
|
||||
cpg->data.clk_num = num_clks;
|
||||
|
||||
config = &cpg_clk_configs[CPG_CLK_CONFIG_INDEX(cpg_mode)];
|
||||
plla_mult = cpg_plla_mult[CPG_PLLA_MULT_INDEX(cpg_mode)];
|
||||
config = &cpg_clk_configs[CPG_CLK_CONFIG_INDEX(mode)];
|
||||
plla_mult = cpg_plla_mult[CPG_PLLA_MULT_INDEX(mode)];
|
||||
|
||||
for (i = 0; i < num_clks; ++i) {
|
||||
const char *name;
|
||||
|
|
@ -173,10 +176,3 @@ static void __init r8a7779_cpg_clocks_init(struct device_node *np)
|
|||
}
|
||||
CLK_OF_DECLARE(r8a7779_cpg_clks, "renesas,r8a7779-cpg-clocks",
|
||||
r8a7779_cpg_clocks_init);
|
||||
|
||||
void __init r8a7779_clocks_init(u32 mode)
|
||||
{
|
||||
cpg_mode = mode;
|
||||
|
||||
of_clk_init(NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include <linux/of_address.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/soc/renesas/rcar-rst.h>
|
||||
|
||||
struct rcar_gen2_cpg {
|
||||
struct clk_onecell_data data;
|
||||
|
|
@ -364,6 +365,23 @@ rcar_gen2_cpg_register_clock(struct device_node *np, struct rcar_gen2_cpg *cpg,
|
|||
4, 0, table, &cpg->lock);
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset register definitions.
|
||||
*/
|
||||
#define MODEMR 0xe6160060
|
||||
|
||||
static u32 __init rcar_gen2_read_mode_pins(void)
|
||||
{
|
||||
void __iomem *modemr = ioremap_nocache(MODEMR, 4);
|
||||
u32 mode;
|
||||
|
||||
BUG_ON(!modemr);
|
||||
mode = ioread32(modemr);
|
||||
iounmap(modemr);
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
static void __init rcar_gen2_cpg_clocks_init(struct device_node *np)
|
||||
{
|
||||
const struct cpg_pll_config *config;
|
||||
|
|
@ -372,6 +390,13 @@ static void __init rcar_gen2_cpg_clocks_init(struct device_node *np)
|
|||
unsigned int i;
|
||||
int num_clks;
|
||||
|
||||
if (rcar_rst_read_mode_pins(&cpg_mode)) {
|
||||
/* Backward-compatibility with old DT */
|
||||
pr_warn("%s: failed to obtain mode pins from RST\n",
|
||||
np->full_name);
|
||||
cpg_mode = rcar_gen2_read_mode_pins();
|
||||
}
|
||||
|
||||
num_clks = of_property_count_strings(np, "clock-output-names");
|
||||
if (num_clks < 0) {
|
||||
pr_err("%s: failed to count clocks\n", __func__);
|
||||
|
|
@ -420,10 +445,3 @@ static void __init rcar_gen2_cpg_clocks_init(struct device_node *np)
|
|||
}
|
||||
CLK_OF_DECLARE(rcar_gen2_cpg_clks, "renesas,rcar-gen2-cpg-clocks",
|
||||
rcar_gen2_cpg_clocks_init);
|
||||
|
||||
void __init rcar_gen2_clocks_init(u32 mode)
|
||||
{
|
||||
cpg_mode = mode;
|
||||
|
||||
of_clk_init(NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include <linux/device.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/soc/renesas/rcar-rst.h>
|
||||
|
||||
#include <dt-bindings/clock/r8a7795-cpg-mssr.h>
|
||||
|
||||
|
|
@ -311,7 +312,12 @@ static const struct rcar_gen3_cpg_pll_config cpg_pll_configs[16] __initconst = {
|
|||
static int __init r8a7795_cpg_mssr_init(struct device *dev)
|
||||
{
|
||||
const struct rcar_gen3_cpg_pll_config *cpg_pll_config;
|
||||
u32 cpg_mode = rcar_gen3_read_mode_pins();
|
||||
u32 cpg_mode;
|
||||
int error;
|
||||
|
||||
error = rcar_rst_read_mode_pins(&cpg_mode);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
cpg_pll_config = &cpg_pll_configs[CPG_PLL_CONFIG_INDEX(cpg_mode)];
|
||||
if (!cpg_pll_config->extal_div) {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
#include <linux/device.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/soc/renesas/rcar-rst.h>
|
||||
|
||||
#include <dt-bindings/clock/r8a7796-cpg-mssr.h>
|
||||
|
||||
|
|
@ -235,7 +236,12 @@ static const struct rcar_gen3_cpg_pll_config cpg_pll_configs[16] __initconst = {
|
|||
static int __init r8a7796_cpg_mssr_init(struct device *dev)
|
||||
{
|
||||
const struct rcar_gen3_cpg_pll_config *cpg_pll_config;
|
||||
u32 cpg_mode = rcar_gen3_read_mode_pins();
|
||||
u32 cpg_mode;
|
||||
int error;
|
||||
|
||||
error = rcar_rst_read_mode_pins(&cpg_mode);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
cpg_pll_config = &cpg_pll_configs[CPG_PLL_CONFIG_INDEX(cpg_mode)];
|
||||
if (!cpg_pll_config->extal_div) {
|
||||
|
|
|
|||
|
|
@ -333,23 +333,6 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev,
|
|||
__clk_get_name(parent), 0, mult, div);
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset register definitions.
|
||||
*/
|
||||
#define MODEMR 0xe6160060
|
||||
|
||||
u32 __init rcar_gen3_read_mode_pins(void)
|
||||
{
|
||||
void __iomem *modemr = ioremap_nocache(MODEMR, 4);
|
||||
u32 mode;
|
||||
|
||||
BUG_ON(!modemr);
|
||||
mode = ioread32(modemr);
|
||||
iounmap(modemr);
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
int __init rcar_gen3_cpg_init(const struct rcar_gen3_cpg_pll_config *config,
|
||||
unsigned int clk_extalr)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ struct rcar_gen3_cpg_pll_config {
|
|||
|
||||
#define CPG_RCKCR 0x240
|
||||
|
||||
u32 rcar_gen3_read_mode_pins(void);
|
||||
struct clk *rcar_gen3_cpg_clk_register(struct device *dev,
|
||||
const struct cpg_core_clk *core, const struct cpg_mssr_info *info,
|
||||
struct clk **clks, void __iomem *base);
|
||||
|
|
|
|||
Loading…
Reference in a new issue