| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * r8a7743 Clock Pulse Generator / Module Standby and Software Reset |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2016 Cogent Embedded Inc. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 7 | | - * under the terms of the GNU General Public License version 2 as published |
|---|
| 8 | | - * by the Free Software Foundation; of the License. |
|---|
| 9 | 6 | */ |
|---|
| 10 | 7 | |
|---|
| 11 | 8 | #include <linux/device.h> |
|---|
| 12 | 9 | #include <linux/init.h> |
|---|
| 13 | 10 | #include <linux/kernel.h> |
|---|
| 11 | +#include <linux/of.h> |
|---|
| 14 | 12 | #include <linux/soc/renesas/rcar-rst.h> |
|---|
| 15 | 13 | |
|---|
| 16 | 14 | #include <dt-bindings/clock/r8a7743-cpg-mssr.h> |
|---|
| .. | .. |
|---|
| 37 | 35 | MOD_CLK_BASE |
|---|
| 38 | 36 | }; |
|---|
| 39 | 37 | |
|---|
| 40 | | -static const struct cpg_core_clk r8a7743_core_clks[] __initconst = { |
|---|
| 38 | +static struct cpg_core_clk r8a7743_core_clks[] __initdata = { |
|---|
| 41 | 39 | /* External Clock Inputs */ |
|---|
| 42 | 40 | DEF_INPUT("extal", CLK_EXTAL), |
|---|
| 43 | 41 | DEF_INPUT("usb_extal", CLK_USB_EXTAL), |
|---|
| .. | .. |
|---|
| 94 | 92 | DEF_MOD("tmu0", 125, R8A7743_CLK_CP), |
|---|
| 95 | 93 | DEF_MOD("vsp1du1", 127, R8A7743_CLK_ZS), |
|---|
| 96 | 94 | DEF_MOD("vsp1du0", 128, R8A7743_CLK_ZS), |
|---|
| 97 | | - DEF_MOD("vsp1-sy", 131, R8A7743_CLK_ZS), |
|---|
| 95 | + DEF_MOD("vsps", 131, R8A7743_CLK_ZS), |
|---|
| 98 | 96 | DEF_MOD("scifa2", 202, R8A7743_CLK_MP), |
|---|
| 99 | 97 | DEF_MOD("scifa1", 203, R8A7743_CLK_MP), |
|---|
| 100 | 98 | DEF_MOD("scifa0", 204, R8A7743_CLK_MP), |
|---|
| .. | .. |
|---|
| 238 | 236 | static int __init r8a7743_cpg_mssr_init(struct device *dev) |
|---|
| 239 | 237 | { |
|---|
| 240 | 238 | const struct rcar_gen2_cpg_pll_config *cpg_pll_config; |
|---|
| 239 | + struct device_node *np = dev->of_node; |
|---|
| 240 | + unsigned int i; |
|---|
| 241 | 241 | u32 cpg_mode; |
|---|
| 242 | 242 | int error; |
|---|
| 243 | 243 | |
|---|
| .. | .. |
|---|
| 247 | 247 | |
|---|
| 248 | 248 | cpg_pll_config = &cpg_pll_configs[CPG_PLL_CONFIG_INDEX(cpg_mode)]; |
|---|
| 249 | 249 | |
|---|
| 250 | + if (of_device_is_compatible(np, "renesas,r8a7744-cpg-mssr")) { |
|---|
| 251 | + /* RZ/G1N uses a 1/5 divider for ZG */ |
|---|
| 252 | + for (i = 0; i < ARRAY_SIZE(r8a7743_core_clks); i++) |
|---|
| 253 | + if (r8a7743_core_clks[i].id == R8A7743_CLK_ZG) { |
|---|
| 254 | + r8a7743_core_clks[i].div = 5; |
|---|
| 255 | + break; |
|---|
| 256 | + } |
|---|
| 257 | + } |
|---|
| 250 | 258 | return rcar_gen2_cpg_init(cpg_pll_config, 2, cpg_mode); |
|---|
| 251 | 259 | } |
|---|
| 252 | 260 | |
|---|