xref: /openbmc/linux/drivers/clk/sunxi-ng/ccu-sun8i-r.c (revision 1667393126d7c51fad8b3cb9d3798e8e0367e2ec)
1cdb8b80bSIcenowy Zheng /*
2cdb8b80bSIcenowy Zheng  * Copyright (c) 2016 Icenowy Zheng <icenowy@aosc.xyz>
3cdb8b80bSIcenowy Zheng  *
4cdb8b80bSIcenowy Zheng  * This software is licensed under the terms of the GNU General Public
5cdb8b80bSIcenowy Zheng  * License version 2, as published by the Free Software Foundation, and
6cdb8b80bSIcenowy Zheng  * may be copied, distributed, and modified under those terms.
7cdb8b80bSIcenowy Zheng  *
8cdb8b80bSIcenowy Zheng  * This program is distributed in the hope that it will be useful,
9cdb8b80bSIcenowy Zheng  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10cdb8b80bSIcenowy Zheng  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11cdb8b80bSIcenowy Zheng  * GNU General Public License for more details.
12cdb8b80bSIcenowy Zheng  */
13cdb8b80bSIcenowy Zheng 
14cdb8b80bSIcenowy Zheng #include <linux/clk-provider.h>
15cdb8b80bSIcenowy Zheng #include <linux/of_address.h>
16cdb8b80bSIcenowy Zheng #include <linux/platform_device.h>
17cdb8b80bSIcenowy Zheng 
18cdb8b80bSIcenowy Zheng #include "ccu_common.h"
19cdb8b80bSIcenowy Zheng #include "ccu_reset.h"
20cdb8b80bSIcenowy Zheng 
21cdb8b80bSIcenowy Zheng #include "ccu_div.h"
22cdb8b80bSIcenowy Zheng #include "ccu_gate.h"
23cdb8b80bSIcenowy Zheng #include "ccu_mp.h"
24cdb8b80bSIcenowy Zheng #include "ccu_nm.h"
25cdb8b80bSIcenowy Zheng 
26cdb8b80bSIcenowy Zheng #include "ccu-sun8i-r.h"
27cdb8b80bSIcenowy Zheng 
28cdb8b80bSIcenowy Zheng static const char * const ar100_parents[] = { "osc32k", "osc24M",
29cdb8b80bSIcenowy Zheng 					     "pll-periph0", "iosc" };
305a90c14cSChen-Yu Tsai static const char * const a83t_ar100_parents[] = { "osc16M-d512", "osc24M",
315a90c14cSChen-Yu Tsai 						   "pll-periph0", "iosc" };
3213e0dde8SChen-Yu Tsai static const struct ccu_mux_var_prediv ar100_predivs[] = {
3313e0dde8SChen-Yu Tsai 	{ .index = 2, .shift = 8, .width = 5 },
3413e0dde8SChen-Yu Tsai };
35cdb8b80bSIcenowy Zheng 
36cdb8b80bSIcenowy Zheng static struct ccu_div ar100_clk = {
37cdb8b80bSIcenowy Zheng 	.div		= _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO),
38cdb8b80bSIcenowy Zheng 
39cdb8b80bSIcenowy Zheng 	.mux		= {
40cdb8b80bSIcenowy Zheng 		.shift	= 16,
41cdb8b80bSIcenowy Zheng 		.width	= 2,
42cdb8b80bSIcenowy Zheng 
4313e0dde8SChen-Yu Tsai 		.var_predivs	= ar100_predivs,
4413e0dde8SChen-Yu Tsai 		.n_var_predivs	= ARRAY_SIZE(ar100_predivs),
45cdb8b80bSIcenowy Zheng 	},
46cdb8b80bSIcenowy Zheng 
47cdb8b80bSIcenowy Zheng 	.common		= {
48cdb8b80bSIcenowy Zheng 		.reg		= 0x00,
49cdb8b80bSIcenowy Zheng 		.features	= CCU_FEATURE_VARIABLE_PREDIV,
50cdb8b80bSIcenowy Zheng 		.hw.init	= CLK_HW_INIT_PARENTS("ar100",
51cdb8b80bSIcenowy Zheng 						      ar100_parents,
52cdb8b80bSIcenowy Zheng 						      &ccu_div_ops,
53cdb8b80bSIcenowy Zheng 						      0),
54cdb8b80bSIcenowy Zheng 	},
55cdb8b80bSIcenowy Zheng };
56cdb8b80bSIcenowy Zheng 
575a90c14cSChen-Yu Tsai static struct ccu_div a83t_ar100_clk = {
585a90c14cSChen-Yu Tsai 	.div		= _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO),
595a90c14cSChen-Yu Tsai 
605a90c14cSChen-Yu Tsai 	.mux		= {
615a90c14cSChen-Yu Tsai 		.shift	= 16,
625a90c14cSChen-Yu Tsai 		.width	= 2,
635a90c14cSChen-Yu Tsai 
645a90c14cSChen-Yu Tsai 		.var_predivs	= ar100_predivs,
655a90c14cSChen-Yu Tsai 		.n_var_predivs	= ARRAY_SIZE(ar100_predivs),
665a90c14cSChen-Yu Tsai 	},
675a90c14cSChen-Yu Tsai 
685a90c14cSChen-Yu Tsai 	.common		= {
695a90c14cSChen-Yu Tsai 		.reg		= 0x00,
705a90c14cSChen-Yu Tsai 		.features	= CCU_FEATURE_VARIABLE_PREDIV,
715a90c14cSChen-Yu Tsai 		.hw.init	= CLK_HW_INIT_PARENTS("ar100",
725a90c14cSChen-Yu Tsai 						      a83t_ar100_parents,
735a90c14cSChen-Yu Tsai 						      &ccu_div_ops,
745a90c14cSChen-Yu Tsai 						      0),
755a90c14cSChen-Yu Tsai 	},
765a90c14cSChen-Yu Tsai };
775a90c14cSChen-Yu Tsai 
78cdb8b80bSIcenowy Zheng static CLK_FIXED_FACTOR(ahb0_clk, "ahb0", "ar100", 1, 1, 0);
79cdb8b80bSIcenowy Zheng 
80cdb8b80bSIcenowy Zheng static struct ccu_div apb0_clk = {
81cdb8b80bSIcenowy Zheng 	.div		= _SUNXI_CCU_DIV_FLAGS(0, 2, CLK_DIVIDER_POWER_OF_TWO),
82cdb8b80bSIcenowy Zheng 
83cdb8b80bSIcenowy Zheng 	.common		= {
84cdb8b80bSIcenowy Zheng 		.reg		= 0x0c,
85cdb8b80bSIcenowy Zheng 		.hw.init	= CLK_HW_INIT("apb0",
86cdb8b80bSIcenowy Zheng 					      "ahb0",
87cdb8b80bSIcenowy Zheng 					      &ccu_div_ops,
88cdb8b80bSIcenowy Zheng 					      0),
89cdb8b80bSIcenowy Zheng 	},
90cdb8b80bSIcenowy Zheng };
91cdb8b80bSIcenowy Zheng 
925a90c14cSChen-Yu Tsai static SUNXI_CCU_M(a83t_apb0_clk, "apb0", "ahb0", 0x0c, 0, 2, 0);
935a90c14cSChen-Yu Tsai 
94cdb8b80bSIcenowy Zheng static SUNXI_CCU_GATE(apb0_pio_clk,	"apb0-pio",	"apb0",
95cdb8b80bSIcenowy Zheng 		      0x28, BIT(0), 0);
96cdb8b80bSIcenowy Zheng static SUNXI_CCU_GATE(apb0_ir_clk,	"apb0-ir",	"apb0",
97cdb8b80bSIcenowy Zheng 		      0x28, BIT(1), 0);
98cdb8b80bSIcenowy Zheng static SUNXI_CCU_GATE(apb0_timer_clk,	"apb0-timer",	"apb0",
99cdb8b80bSIcenowy Zheng 		      0x28, BIT(2), 0);
100cdb8b80bSIcenowy Zheng static SUNXI_CCU_GATE(apb0_rsb_clk,	"apb0-rsb",	"apb0",
101cdb8b80bSIcenowy Zheng 		      0x28, BIT(3), 0);
102cdb8b80bSIcenowy Zheng static SUNXI_CCU_GATE(apb0_uart_clk,	"apb0-uart",	"apb0",
103cdb8b80bSIcenowy Zheng 		      0x28, BIT(4), 0);
104cdb8b80bSIcenowy Zheng static SUNXI_CCU_GATE(apb0_i2c_clk,	"apb0-i2c",	"apb0",
105cdb8b80bSIcenowy Zheng 		      0x28, BIT(6), 0);
106cdb8b80bSIcenowy Zheng static SUNXI_CCU_GATE(apb0_twd_clk,	"apb0-twd",	"apb0",
107cdb8b80bSIcenowy Zheng 		      0x28, BIT(7), 0);
108cdb8b80bSIcenowy Zheng 
10937cabc74SIcenowy Zheng static const char * const r_mod0_default_parents[] = { "osc32k", "osc24M" };
110cdb8b80bSIcenowy Zheng static SUNXI_CCU_MP_WITH_MUX_GATE(ir_clk, "ir",
111cdb8b80bSIcenowy Zheng 				  r_mod0_default_parents, 0x54,
112cdb8b80bSIcenowy Zheng 				  0, 4,		/* M */
113cdb8b80bSIcenowy Zheng 				  16, 2,	/* P */
114cdb8b80bSIcenowy Zheng 				  24, 2,	/* mux */
115cdb8b80bSIcenowy Zheng 				  BIT(31),	/* gate */
116cdb8b80bSIcenowy Zheng 				  0);
117cdb8b80bSIcenowy Zheng 
1185a90c14cSChen-Yu Tsai static const char *const a83t_r_mod0_parents[] = { "osc16M", "osc24M" };
1195a90c14cSChen-Yu Tsai static const struct ccu_mux_fixed_prediv a83t_ir_predivs[] = {
1205a90c14cSChen-Yu Tsai 	{ .index = 0, .div = 16 },
1215a90c14cSChen-Yu Tsai };
1225a90c14cSChen-Yu Tsai static struct ccu_mp a83t_ir_clk = {
1235a90c14cSChen-Yu Tsai 	.enable	= BIT(31),
1245a90c14cSChen-Yu Tsai 
1255a90c14cSChen-Yu Tsai 	.m	= _SUNXI_CCU_DIV(0, 4),
1265a90c14cSChen-Yu Tsai 	.p	= _SUNXI_CCU_DIV(16, 2),
1275a90c14cSChen-Yu Tsai 
1285a90c14cSChen-Yu Tsai 	.mux	= {
1295a90c14cSChen-Yu Tsai 		.shift	= 24,
1305a90c14cSChen-Yu Tsai 		.width	= 2,
1315a90c14cSChen-Yu Tsai 		.fixed_predivs	= a83t_ir_predivs,
1325a90c14cSChen-Yu Tsai 		.n_predivs	= ARRAY_SIZE(a83t_ir_predivs),
1335a90c14cSChen-Yu Tsai 	},
1345a90c14cSChen-Yu Tsai 
1355a90c14cSChen-Yu Tsai 	.common		= {
1365a90c14cSChen-Yu Tsai 		.reg		= 0x54,
1375a90c14cSChen-Yu Tsai 		.features	= CCU_FEATURE_VARIABLE_PREDIV,
1385a90c14cSChen-Yu Tsai 		.hw.init	= CLK_HW_INIT_PARENTS("ir",
1395a90c14cSChen-Yu Tsai 						      a83t_r_mod0_parents,
1405a90c14cSChen-Yu Tsai 						      &ccu_mp_ops,
1415a90c14cSChen-Yu Tsai 						      0),
1425a90c14cSChen-Yu Tsai 	},
1435a90c14cSChen-Yu Tsai };
1445a90c14cSChen-Yu Tsai 
1455a90c14cSChen-Yu Tsai static struct ccu_common *sun8i_a83t_r_ccu_clks[] = {
1465a90c14cSChen-Yu Tsai 	&a83t_ar100_clk.common,
1475a90c14cSChen-Yu Tsai 	&a83t_apb0_clk.common,
1485a90c14cSChen-Yu Tsai 	&apb0_pio_clk.common,
1495a90c14cSChen-Yu Tsai 	&apb0_ir_clk.common,
1505a90c14cSChen-Yu Tsai 	&apb0_timer_clk.common,
1515a90c14cSChen-Yu Tsai 	&apb0_rsb_clk.common,
1525a90c14cSChen-Yu Tsai 	&apb0_uart_clk.common,
1535a90c14cSChen-Yu Tsai 	&apb0_i2c_clk.common,
1545a90c14cSChen-Yu Tsai 	&apb0_twd_clk.common,
1555a90c14cSChen-Yu Tsai 	&a83t_ir_clk.common,
1565a90c14cSChen-Yu Tsai };
1575a90c14cSChen-Yu Tsai 
158cdb8b80bSIcenowy Zheng static struct ccu_common *sun8i_h3_r_ccu_clks[] = {
159cdb8b80bSIcenowy Zheng 	&ar100_clk.common,
160cdb8b80bSIcenowy Zheng 	&apb0_clk.common,
161cdb8b80bSIcenowy Zheng 	&apb0_pio_clk.common,
162cdb8b80bSIcenowy Zheng 	&apb0_ir_clk.common,
163cdb8b80bSIcenowy Zheng 	&apb0_timer_clk.common,
164cdb8b80bSIcenowy Zheng 	&apb0_uart_clk.common,
165cdb8b80bSIcenowy Zheng 	&apb0_i2c_clk.common,
166cdb8b80bSIcenowy Zheng 	&apb0_twd_clk.common,
167cdb8b80bSIcenowy Zheng 	&ir_clk.common,
168cdb8b80bSIcenowy Zheng };
169cdb8b80bSIcenowy Zheng 
170cdb8b80bSIcenowy Zheng static struct ccu_common *sun50i_a64_r_ccu_clks[] = {
171cdb8b80bSIcenowy Zheng 	&ar100_clk.common,
172cdb8b80bSIcenowy Zheng 	&apb0_clk.common,
173cdb8b80bSIcenowy Zheng 	&apb0_pio_clk.common,
174cdb8b80bSIcenowy Zheng 	&apb0_ir_clk.common,
175cdb8b80bSIcenowy Zheng 	&apb0_timer_clk.common,
176cdb8b80bSIcenowy Zheng 	&apb0_rsb_clk.common,
177cdb8b80bSIcenowy Zheng 	&apb0_uart_clk.common,
178cdb8b80bSIcenowy Zheng 	&apb0_i2c_clk.common,
179cdb8b80bSIcenowy Zheng 	&apb0_twd_clk.common,
180cdb8b80bSIcenowy Zheng 	&ir_clk.common,
181cdb8b80bSIcenowy Zheng };
182cdb8b80bSIcenowy Zheng 
1835a90c14cSChen-Yu Tsai static struct clk_hw_onecell_data sun8i_a83t_r_hw_clks = {
1845a90c14cSChen-Yu Tsai 	.hws	= {
1855a90c14cSChen-Yu Tsai 		[CLK_AR100]		= &a83t_ar100_clk.common.hw,
1865a90c14cSChen-Yu Tsai 		[CLK_AHB0]		= &ahb0_clk.hw,
1875a90c14cSChen-Yu Tsai 		[CLK_APB0]		= &a83t_apb0_clk.common.hw,
1885a90c14cSChen-Yu Tsai 		[CLK_APB0_PIO]		= &apb0_pio_clk.common.hw,
1895a90c14cSChen-Yu Tsai 		[CLK_APB0_IR]		= &apb0_ir_clk.common.hw,
1905a90c14cSChen-Yu Tsai 		[CLK_APB0_TIMER]	= &apb0_timer_clk.common.hw,
1915a90c14cSChen-Yu Tsai 		[CLK_APB0_RSB]		= &apb0_rsb_clk.common.hw,
1925a90c14cSChen-Yu Tsai 		[CLK_APB0_UART]		= &apb0_uart_clk.common.hw,
1935a90c14cSChen-Yu Tsai 		[CLK_APB0_I2C]		= &apb0_i2c_clk.common.hw,
1945a90c14cSChen-Yu Tsai 		[CLK_APB0_TWD]		= &apb0_twd_clk.common.hw,
1955a90c14cSChen-Yu Tsai 		[CLK_IR]		= &a83t_ir_clk.common.hw,
1965a90c14cSChen-Yu Tsai 	},
1975a90c14cSChen-Yu Tsai 	.num	= CLK_NUMBER,
1985a90c14cSChen-Yu Tsai };
1995a90c14cSChen-Yu Tsai 
200cdb8b80bSIcenowy Zheng static struct clk_hw_onecell_data sun8i_h3_r_hw_clks = {
201cdb8b80bSIcenowy Zheng 	.hws	= {
202cdb8b80bSIcenowy Zheng 		[CLK_AR100]		= &ar100_clk.common.hw,
203cdb8b80bSIcenowy Zheng 		[CLK_AHB0]		= &ahb0_clk.hw,
204cdb8b80bSIcenowy Zheng 		[CLK_APB0]		= &apb0_clk.common.hw,
205cdb8b80bSIcenowy Zheng 		[CLK_APB0_PIO]		= &apb0_pio_clk.common.hw,
206cdb8b80bSIcenowy Zheng 		[CLK_APB0_IR]		= &apb0_ir_clk.common.hw,
207cdb8b80bSIcenowy Zheng 		[CLK_APB0_TIMER]	= &apb0_timer_clk.common.hw,
208cdb8b80bSIcenowy Zheng 		[CLK_APB0_UART]		= &apb0_uart_clk.common.hw,
209cdb8b80bSIcenowy Zheng 		[CLK_APB0_I2C]		= &apb0_i2c_clk.common.hw,
210cdb8b80bSIcenowy Zheng 		[CLK_APB0_TWD]		= &apb0_twd_clk.common.hw,
211cdb8b80bSIcenowy Zheng 		[CLK_IR]		= &ir_clk.common.hw,
212cdb8b80bSIcenowy Zheng 	},
213cdb8b80bSIcenowy Zheng 	.num	= CLK_NUMBER,
214cdb8b80bSIcenowy Zheng };
215cdb8b80bSIcenowy Zheng 
216cdb8b80bSIcenowy Zheng static struct clk_hw_onecell_data sun50i_a64_r_hw_clks = {
217cdb8b80bSIcenowy Zheng 	.hws	= {
218cdb8b80bSIcenowy Zheng 		[CLK_AR100]		= &ar100_clk.common.hw,
219cdb8b80bSIcenowy Zheng 		[CLK_AHB0]		= &ahb0_clk.hw,
220cdb8b80bSIcenowy Zheng 		[CLK_APB0]		= &apb0_clk.common.hw,
221cdb8b80bSIcenowy Zheng 		[CLK_APB0_PIO]		= &apb0_pio_clk.common.hw,
222cdb8b80bSIcenowy Zheng 		[CLK_APB0_IR]		= &apb0_ir_clk.common.hw,
223cdb8b80bSIcenowy Zheng 		[CLK_APB0_TIMER]	= &apb0_timer_clk.common.hw,
224cdb8b80bSIcenowy Zheng 		[CLK_APB0_RSB]		= &apb0_rsb_clk.common.hw,
225cdb8b80bSIcenowy Zheng 		[CLK_APB0_UART]		= &apb0_uart_clk.common.hw,
226cdb8b80bSIcenowy Zheng 		[CLK_APB0_I2C]		= &apb0_i2c_clk.common.hw,
227cdb8b80bSIcenowy Zheng 		[CLK_APB0_TWD]		= &apb0_twd_clk.common.hw,
228cdb8b80bSIcenowy Zheng 		[CLK_IR]		= &ir_clk.common.hw,
229cdb8b80bSIcenowy Zheng 	},
230cdb8b80bSIcenowy Zheng 	.num	= CLK_NUMBER,
231cdb8b80bSIcenowy Zheng };
232cdb8b80bSIcenowy Zheng 
2335a90c14cSChen-Yu Tsai static struct ccu_reset_map sun8i_a83t_r_ccu_resets[] = {
2345a90c14cSChen-Yu Tsai 	[RST_APB0_IR]		=  { 0xb0, BIT(1) },
2355a90c14cSChen-Yu Tsai 	[RST_APB0_TIMER]	=  { 0xb0, BIT(2) },
2365a90c14cSChen-Yu Tsai 	[RST_APB0_RSB]		=  { 0xb0, BIT(3) },
2375a90c14cSChen-Yu Tsai 	[RST_APB0_UART]		=  { 0xb0, BIT(4) },
2385a90c14cSChen-Yu Tsai 	[RST_APB0_I2C]		=  { 0xb0, BIT(6) },
2395a90c14cSChen-Yu Tsai };
2405a90c14cSChen-Yu Tsai 
241cdb8b80bSIcenowy Zheng static struct ccu_reset_map sun8i_h3_r_ccu_resets[] = {
242cdb8b80bSIcenowy Zheng 	[RST_APB0_IR]		=  { 0xb0, BIT(1) },
243cdb8b80bSIcenowy Zheng 	[RST_APB0_TIMER]	=  { 0xb0, BIT(2) },
244cdb8b80bSIcenowy Zheng 	[RST_APB0_UART]		=  { 0xb0, BIT(4) },
245cdb8b80bSIcenowy Zheng 	[RST_APB0_I2C]		=  { 0xb0, BIT(6) },
246cdb8b80bSIcenowy Zheng };
247cdb8b80bSIcenowy Zheng 
248cdb8b80bSIcenowy Zheng static struct ccu_reset_map sun50i_a64_r_ccu_resets[] = {
249cdb8b80bSIcenowy Zheng 	[RST_APB0_IR]		=  { 0xb0, BIT(1) },
250cdb8b80bSIcenowy Zheng 	[RST_APB0_TIMER]	=  { 0xb0, BIT(2) },
251cdb8b80bSIcenowy Zheng 	[RST_APB0_RSB]		=  { 0xb0, BIT(3) },
252cdb8b80bSIcenowy Zheng 	[RST_APB0_UART]		=  { 0xb0, BIT(4) },
253cdb8b80bSIcenowy Zheng 	[RST_APB0_I2C]		=  { 0xb0, BIT(6) },
254cdb8b80bSIcenowy Zheng };
255cdb8b80bSIcenowy Zheng 
2565a90c14cSChen-Yu Tsai static const struct sunxi_ccu_desc sun8i_a83t_r_ccu_desc = {
2575a90c14cSChen-Yu Tsai 	.ccu_clks	= sun8i_a83t_r_ccu_clks,
2585a90c14cSChen-Yu Tsai 	.num_ccu_clks	= ARRAY_SIZE(sun8i_a83t_r_ccu_clks),
2595a90c14cSChen-Yu Tsai 
2605a90c14cSChen-Yu Tsai 	.hw_clks	= &sun8i_a83t_r_hw_clks,
2615a90c14cSChen-Yu Tsai 
2625a90c14cSChen-Yu Tsai 	.resets		= sun8i_a83t_r_ccu_resets,
2635a90c14cSChen-Yu Tsai 	.num_resets	= ARRAY_SIZE(sun8i_a83t_r_ccu_resets),
2645a90c14cSChen-Yu Tsai };
2655a90c14cSChen-Yu Tsai 
266cdb8b80bSIcenowy Zheng static const struct sunxi_ccu_desc sun8i_h3_r_ccu_desc = {
267cdb8b80bSIcenowy Zheng 	.ccu_clks	= sun8i_h3_r_ccu_clks,
268cdb8b80bSIcenowy Zheng 	.num_ccu_clks	= ARRAY_SIZE(sun8i_h3_r_ccu_clks),
269cdb8b80bSIcenowy Zheng 
270cdb8b80bSIcenowy Zheng 	.hw_clks	= &sun8i_h3_r_hw_clks,
271cdb8b80bSIcenowy Zheng 
272cdb8b80bSIcenowy Zheng 	.resets		= sun8i_h3_r_ccu_resets,
273cdb8b80bSIcenowy Zheng 	.num_resets	= ARRAY_SIZE(sun8i_h3_r_ccu_resets),
274cdb8b80bSIcenowy Zheng };
275cdb8b80bSIcenowy Zheng 
276cdb8b80bSIcenowy Zheng static const struct sunxi_ccu_desc sun50i_a64_r_ccu_desc = {
277cdb8b80bSIcenowy Zheng 	.ccu_clks	= sun50i_a64_r_ccu_clks,
278cdb8b80bSIcenowy Zheng 	.num_ccu_clks	= ARRAY_SIZE(sun50i_a64_r_ccu_clks),
279cdb8b80bSIcenowy Zheng 
280cdb8b80bSIcenowy Zheng 	.hw_clks	= &sun50i_a64_r_hw_clks,
281cdb8b80bSIcenowy Zheng 
282cdb8b80bSIcenowy Zheng 	.resets		= sun50i_a64_r_ccu_resets,
283cdb8b80bSIcenowy Zheng 	.num_resets	= ARRAY_SIZE(sun50i_a64_r_ccu_resets),
284cdb8b80bSIcenowy Zheng };
285cdb8b80bSIcenowy Zheng 
286cdb8b80bSIcenowy Zheng static void __init sunxi_r_ccu_init(struct device_node *node,
287cdb8b80bSIcenowy Zheng 				    const struct sunxi_ccu_desc *desc)
288cdb8b80bSIcenowy Zheng {
289cdb8b80bSIcenowy Zheng 	void __iomem *reg;
290cdb8b80bSIcenowy Zheng 
291cdb8b80bSIcenowy Zheng 	reg = of_io_request_and_map(node, 0, of_node_full_name(node));
292cdb8b80bSIcenowy Zheng 	if (IS_ERR(reg)) {
293*16673931SRob Herring 		pr_err("%pOF: Could not map the clock registers\n", node);
294cdb8b80bSIcenowy Zheng 		return;
295cdb8b80bSIcenowy Zheng 	}
296cdb8b80bSIcenowy Zheng 
297cdb8b80bSIcenowy Zheng 	sunxi_ccu_probe(node, reg, desc);
298cdb8b80bSIcenowy Zheng }
299cdb8b80bSIcenowy Zheng 
3005a90c14cSChen-Yu Tsai static void __init sun8i_a83t_r_ccu_setup(struct device_node *node)
3015a90c14cSChen-Yu Tsai {
3025a90c14cSChen-Yu Tsai 	sunxi_r_ccu_init(node, &sun8i_a83t_r_ccu_desc);
3035a90c14cSChen-Yu Tsai }
3045a90c14cSChen-Yu Tsai CLK_OF_DECLARE(sun8i_a83t_r_ccu, "allwinner,sun8i-a83t-r-ccu",
3055a90c14cSChen-Yu Tsai 	       sun8i_a83t_r_ccu_setup);
3065a90c14cSChen-Yu Tsai 
307cdb8b80bSIcenowy Zheng static void __init sun8i_h3_r_ccu_setup(struct device_node *node)
308cdb8b80bSIcenowy Zheng {
309cdb8b80bSIcenowy Zheng 	sunxi_r_ccu_init(node, &sun8i_h3_r_ccu_desc);
310cdb8b80bSIcenowy Zheng }
311cdb8b80bSIcenowy Zheng CLK_OF_DECLARE(sun8i_h3_r_ccu, "allwinner,sun8i-h3-r-ccu",
312cdb8b80bSIcenowy Zheng 	       sun8i_h3_r_ccu_setup);
313cdb8b80bSIcenowy Zheng 
314cdb8b80bSIcenowy Zheng static void __init sun50i_a64_r_ccu_setup(struct device_node *node)
315cdb8b80bSIcenowy Zheng {
316cdb8b80bSIcenowy Zheng 	sunxi_r_ccu_init(node, &sun50i_a64_r_ccu_desc);
317cdb8b80bSIcenowy Zheng }
318cdb8b80bSIcenowy Zheng CLK_OF_DECLARE(sun50i_a64_r_ccu, "allwinner,sun50i-a64-r-ccu",
319cdb8b80bSIcenowy Zheng 	       sun50i_a64_r_ccu_setup);
320