Skip to content

Commit 394a36d

Browse files
Andre-ARMmripard
authored andcommitted
clk: sunxi-ng: Add support for the Allwinner H616 R-CCU
The clocks itself are identical to the H6 R-CCU, it's just that the H616 has not all of them implemented (or connected). Signed-off-by: Andre Przywara <andre.przywara@arm.com> Acked-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://lore.kernel.org/r/20210127172500.13356-3-andre.przywara@arm.com
1 parent f8d0e2b commit 394a36d

2 files changed

Lines changed: 49 additions & 1 deletion

File tree

drivers/clk/sunxi-ng/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ config SUN50I_H6_CCU
3333
depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST
3434

3535
config SUN50I_H6_R_CCU
36-
bool "Support for the Allwinner H6 PRCM CCU"
36+
bool "Support for the Allwinner H6 and H616 PRCM CCU"
3737
default ARM64 && ARCH_SUNXI
3838
depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST
3939

drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,16 @@ static struct ccu_common *sun50i_h6_r_ccu_clks[] = {
139139
&w1_clk.common,
140140
};
141141

142+
static struct ccu_common *sun50i_h616_r_ccu_clks[] = {
143+
&r_apb1_clk.common,
144+
&r_apb2_clk.common,
145+
&r_apb1_twd_clk.common,
146+
&r_apb2_i2c_clk.common,
147+
&r_apb2_rsb_clk.common,
148+
&r_apb1_ir_clk.common,
149+
&ir_clk.common,
150+
};
151+
142152
static struct clk_hw_onecell_data sun50i_h6_r_hw_clks = {
143153
.hws = {
144154
[CLK_AR100] = &ar100_clk.common.hw,
@@ -159,6 +169,20 @@ static struct clk_hw_onecell_data sun50i_h6_r_hw_clks = {
159169
.num = CLK_NUMBER,
160170
};
161171

172+
static struct clk_hw_onecell_data sun50i_h616_r_hw_clks = {
173+
.hws = {
174+
[CLK_R_AHB] = &r_ahb_clk.hw,
175+
[CLK_R_APB1] = &r_apb1_clk.common.hw,
176+
[CLK_R_APB2] = &r_apb2_clk.common.hw,
177+
[CLK_R_APB1_TWD] = &r_apb1_twd_clk.common.hw,
178+
[CLK_R_APB2_I2C] = &r_apb2_i2c_clk.common.hw,
179+
[CLK_R_APB2_RSB] = &r_apb2_rsb_clk.common.hw,
180+
[CLK_R_APB1_IR] = &r_apb1_ir_clk.common.hw,
181+
[CLK_IR] = &ir_clk.common.hw,
182+
},
183+
.num = CLK_NUMBER,
184+
};
185+
162186
static struct ccu_reset_map sun50i_h6_r_ccu_resets[] = {
163187
[RST_R_APB1_TIMER] = { 0x11c, BIT(16) },
164188
[RST_R_APB1_TWD] = { 0x12c, BIT(16) },
@@ -170,6 +194,13 @@ static struct ccu_reset_map sun50i_h6_r_ccu_resets[] = {
170194
[RST_R_APB1_W1] = { 0x1ec, BIT(16) },
171195
};
172196

197+
static struct ccu_reset_map sun50i_h616_r_ccu_resets[] = {
198+
[RST_R_APB1_TWD] = { 0x12c, BIT(16) },
199+
[RST_R_APB2_I2C] = { 0x19c, BIT(16) },
200+
[RST_R_APB2_RSB] = { 0x1bc, BIT(16) },
201+
[RST_R_APB1_IR] = { 0x1cc, BIT(16) },
202+
};
203+
173204
static const struct sunxi_ccu_desc sun50i_h6_r_ccu_desc = {
174205
.ccu_clks = sun50i_h6_r_ccu_clks,
175206
.num_ccu_clks = ARRAY_SIZE(sun50i_h6_r_ccu_clks),
@@ -180,6 +211,16 @@ static const struct sunxi_ccu_desc sun50i_h6_r_ccu_desc = {
180211
.num_resets = ARRAY_SIZE(sun50i_h6_r_ccu_resets),
181212
};
182213

214+
static const struct sunxi_ccu_desc sun50i_h616_r_ccu_desc = {
215+
.ccu_clks = sun50i_h616_r_ccu_clks,
216+
.num_ccu_clks = ARRAY_SIZE(sun50i_h616_r_ccu_clks),
217+
218+
.hw_clks = &sun50i_h616_r_hw_clks,
219+
220+
.resets = sun50i_h616_r_ccu_resets,
221+
.num_resets = ARRAY_SIZE(sun50i_h616_r_ccu_resets),
222+
};
223+
183224
static void __init sunxi_r_ccu_init(struct device_node *node,
184225
const struct sunxi_ccu_desc *desc)
185226
{
@@ -200,3 +241,10 @@ static void __init sun50i_h6_r_ccu_setup(struct device_node *node)
200241
}
201242
CLK_OF_DECLARE(sun50i_h6_r_ccu, "allwinner,sun50i-h6-r-ccu",
202243
sun50i_h6_r_ccu_setup);
244+
245+
static void __init sun50i_h616_r_ccu_setup(struct device_node *node)
246+
{
247+
sunxi_r_ccu_init(node, &sun50i_h616_r_ccu_desc);
248+
}
249+
CLK_OF_DECLARE(sun50i_h616_r_ccu, "allwinner,sun50i-h616-r-ccu",
250+
sun50i_h616_r_ccu_setup);

0 commit comments

Comments
 (0)