forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/drivers/clk/renesas/renesas-cpg-mssr.h
....@@ -1,11 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0 */
12 /*
23 * Renesas Clock Pulse Generator / Module Standby and Software Reset
34 *
45 * Copyright (C) 2015 Glider bvba
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; version 2 of the License.
96 */
107
118 #ifndef __CLK_RENESAS_CPG_MSSR_H__
....@@ -38,6 +35,7 @@
3835 CLK_TYPE_FF, /* Fixed Factor Clock */
3936 CLK_TYPE_DIV6P1, /* DIV6 Clock with 1 parent clock */
4037 CLK_TYPE_DIV6_RO, /* DIV6 Clock read only with extra divisor */
38
+ CLK_TYPE_FR, /* Fixed Rate Clock */
4139
4240 /* Custom definitions start here */
4341 CLK_TYPE_CUSTOM,
....@@ -56,6 +54,8 @@
5654 DEF_BASE(_name, _id, CLK_TYPE_DIV6P1, _parent, .offset = _offset)
5755 #define DEF_DIV6_RO(_name, _id, _parent, _offset, _div) \
5856 DEF_BASE(_name, _id, CLK_TYPE_DIV6_RO, _parent, .offset = _offset, .div = _div, .mult = 1)
57
+#define DEF_RATE(_name, _id, _rate) \
58
+ DEF_TYPE(_name, _id, CLK_TYPE_FR, .mult = _rate)
5959
6060 /*
6161 * Definitions of Module Clocks
....@@ -75,11 +75,29 @@
7575 #define DEF_MOD(_name, _mod, _parent...) \
7676 { .name = _name, .id = MOD_CLK_ID(_mod), .parent = _parent }
7777
78
+/* Convert from sparse base-10 to packed index space */
79
+#define MOD_CLK_PACK_10(x) ((x / 10) * 32 + (x % 10))
80
+
81
+#define MOD_CLK_ID_10(x) (MOD_CLK_BASE + MOD_CLK_PACK_10(x))
82
+
83
+#define DEF_MOD_STB(_name, _mod, _parent...) \
84
+ { .name = _name, .id = MOD_CLK_ID_10(_mod), .parent = _parent }
7885
7986 struct device_node;
8087
88
+enum clk_reg_layout {
89
+ CLK_REG_LAYOUT_RCAR_GEN2_AND_GEN3 = 0,
90
+ CLK_REG_LAYOUT_RZ_A,
91
+ CLK_REG_LAYOUT_RCAR_V3U,
92
+};
93
+
8194 /**
8295 * SoC-specific CPG/MSSR Description
96
+ *
97
+ * @early_core_clks: Array of Early Core Clock definitions
98
+ * @num_early_core_clks: Number of entries in early_core_clks[]
99
+ * @early_mod_clks: Array of Early Module Clock definitions
100
+ * @num_early_mod_clks: Number of entries in early_mod_clks[]
83101 *
84102 * @core_clks: Array of Core Clock definitions
85103 * @num_core_clks: Number of entries in core_clks[]
....@@ -93,6 +111,7 @@
93111 * @crit_mod_clks: Array with Module Clock IDs of critical clocks that
94112 * should not be disabled without a knowledgeable driver
95113 * @num_crit_mod_clks: Number of entries in crit_mod_clks[]
114
+ * @reg_layout: CPG/MSSR register layout from enum clk_reg_layout
96115 *
97116 * @core_pm_clks: Array with IDs of Core Clocks that are suitable for Power
98117 * Management, in addition to Module Clocks
....@@ -103,11 +122,18 @@
103122 */
104123
105124 struct cpg_mssr_info {
125
+ /* Early Clocks */
126
+ const struct cpg_core_clk *early_core_clks;
127
+ unsigned int num_early_core_clks;
128
+ const struct mssr_mod_clk *early_mod_clks;
129
+ unsigned int num_early_mod_clks;
130
+
106131 /* Core Clocks */
107132 const struct cpg_core_clk *core_clks;
108133 unsigned int num_core_clks;
109134 unsigned int last_dt_core_clk;
110135 unsigned int num_total_core_clks;
136
+ enum clk_reg_layout reg_layout;
111137
112138 /* Module Clocks */
113139 const struct mssr_mod_clk *mod_clks;
....@@ -131,9 +157,15 @@
131157 struct raw_notifier_head *notifiers);
132158 };
133159
160
+extern const struct cpg_mssr_info r7s9210_cpg_mssr_info;
161
+extern const struct cpg_mssr_info r8a7742_cpg_mssr_info;
134162 extern const struct cpg_mssr_info r8a7743_cpg_mssr_info;
135163 extern const struct cpg_mssr_info r8a7745_cpg_mssr_info;
136164 extern const struct cpg_mssr_info r8a77470_cpg_mssr_info;
165
+extern const struct cpg_mssr_info r8a774a1_cpg_mssr_info;
166
+extern const struct cpg_mssr_info r8a774b1_cpg_mssr_info;
167
+extern const struct cpg_mssr_info r8a774c0_cpg_mssr_info;
168
+extern const struct cpg_mssr_info r8a774e1_cpg_mssr_info;
137169 extern const struct cpg_mssr_info r8a7790_cpg_mssr_info;
138170 extern const struct cpg_mssr_info r8a7791_cpg_mssr_info;
139171 extern const struct cpg_mssr_info r8a7792_cpg_mssr_info;
....@@ -145,7 +177,10 @@
145177 extern const struct cpg_mssr_info r8a77980_cpg_mssr_info;
146178 extern const struct cpg_mssr_info r8a77990_cpg_mssr_info;
147179 extern const struct cpg_mssr_info r8a77995_cpg_mssr_info;
180
+extern const struct cpg_mssr_info r8a779a0_cpg_mssr_info;
148181
182
+void __init cpg_mssr_early_init(struct device_node *np,
183
+ const struct cpg_mssr_info *info);
149184
150185 /*
151186 * Helpers for fixing up clock tables depending on SoC revision