diff options
author | Chen-Yu Tsai <wens@csie.org> | 2017-05-26 04:00:24 -0400 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@free-electrons.com> | 2017-06-07 09:33:06 -0400 |
commit | 5a90c14c0b11342f1121c9aa3fd8b679595015c7 (patch) | |
tree | aca7a4a5e2f7542caaa6dd4688834e088c59f81e /drivers/clk/sunxi-ng | |
parent | 0d28276b5cb520f6d3f4ef449377517579574e16 (diff) |
clk: sunxi-ng: a83t: Add support for A83T's PRCM
The A83T's PRCM has the same set of clocks and resets as the A64.
However, a few dividers are different. And due to the lack of a low
speed 32.768 kHz oscillator, a few of the clock parents are different.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Diffstat (limited to 'drivers/clk/sunxi-ng')
-rw-r--r-- | drivers/clk/sunxi-ng/ccu-sun8i-r.c | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-r.c b/drivers/clk/sunxi-ng/ccu-sun8i-r.c index de02be75785c..e54816ec1dbe 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-r.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-r.c | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | static const char * const ar100_parents[] = { "osc32k", "osc24M", | 28 | static const char * const ar100_parents[] = { "osc32k", "osc24M", |
29 | "pll-periph0", "iosc" }; | 29 | "pll-periph0", "iosc" }; |
30 | static const char * const a83t_ar100_parents[] = { "osc16M-d512", "osc24M", | ||
31 | "pll-periph0", "iosc" }; | ||
30 | static const struct ccu_mux_var_prediv ar100_predivs[] = { | 32 | static const struct ccu_mux_var_prediv ar100_predivs[] = { |
31 | { .index = 2, .shift = 8, .width = 5 }, | 33 | { .index = 2, .shift = 8, .width = 5 }, |
32 | }; | 34 | }; |
@@ -52,6 +54,27 @@ static struct ccu_div ar100_clk = { | |||
52 | }, | 54 | }, |
53 | }; | 55 | }; |
54 | 56 | ||
57 | static struct ccu_div a83t_ar100_clk = { | ||
58 | .div = _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO), | ||
59 | |||
60 | .mux = { | ||
61 | .shift = 16, | ||
62 | .width = 2, | ||
63 | |||
64 | .var_predivs = ar100_predivs, | ||
65 | .n_var_predivs = ARRAY_SIZE(ar100_predivs), | ||
66 | }, | ||
67 | |||
68 | .common = { | ||
69 | .reg = 0x00, | ||
70 | .features = CCU_FEATURE_VARIABLE_PREDIV, | ||
71 | .hw.init = CLK_HW_INIT_PARENTS("ar100", | ||
72 | a83t_ar100_parents, | ||
73 | &ccu_div_ops, | ||
74 | 0), | ||
75 | }, | ||
76 | }; | ||
77 | |||
55 | static CLK_FIXED_FACTOR(ahb0_clk, "ahb0", "ar100", 1, 1, 0); | 78 | static CLK_FIXED_FACTOR(ahb0_clk, "ahb0", "ar100", 1, 1, 0); |
56 | 79 | ||
57 | static struct ccu_div apb0_clk = { | 80 | static struct ccu_div apb0_clk = { |
@@ -66,6 +89,8 @@ static struct ccu_div apb0_clk = { | |||
66 | }, | 89 | }, |
67 | }; | 90 | }; |
68 | 91 | ||
92 | static SUNXI_CCU_M(a83t_apb0_clk, "apb0", "ahb0", 0x0c, 0, 2, 0); | ||
93 | |||
69 | static SUNXI_CCU_GATE(apb0_pio_clk, "apb0-pio", "apb0", | 94 | static SUNXI_CCU_GATE(apb0_pio_clk, "apb0-pio", "apb0", |
70 | 0x28, BIT(0), 0); | 95 | 0x28, BIT(0), 0); |
71 | static SUNXI_CCU_GATE(apb0_ir_clk, "apb0-ir", "apb0", | 96 | static SUNXI_CCU_GATE(apb0_ir_clk, "apb0-ir", "apb0", |
@@ -90,6 +115,46 @@ static SUNXI_CCU_MP_WITH_MUX_GATE(ir_clk, "ir", | |||
90 | BIT(31), /* gate */ | 115 | BIT(31), /* gate */ |
91 | 0); | 116 | 0); |
92 | 117 | ||
118 | static const char *const a83t_r_mod0_parents[] = { "osc16M", "osc24M" }; | ||
119 | static const struct ccu_mux_fixed_prediv a83t_ir_predivs[] = { | ||
120 | { .index = 0, .div = 16 }, | ||
121 | }; | ||
122 | static struct ccu_mp a83t_ir_clk = { | ||
123 | .enable = BIT(31), | ||
124 | |||
125 | .m = _SUNXI_CCU_DIV(0, 4), | ||
126 | .p = _SUNXI_CCU_DIV(16, 2), | ||
127 | |||
128 | .mux = { | ||
129 | .shift = 24, | ||
130 | .width = 2, | ||
131 | .fixed_predivs = a83t_ir_predivs, | ||
132 | .n_predivs = ARRAY_SIZE(a83t_ir_predivs), | ||
133 | }, | ||
134 | |||
135 | .common = { | ||
136 | .reg = 0x54, | ||
137 | .features = CCU_FEATURE_VARIABLE_PREDIV, | ||
138 | .hw.init = CLK_HW_INIT_PARENTS("ir", | ||
139 | a83t_r_mod0_parents, | ||
140 | &ccu_mp_ops, | ||
141 | 0), | ||
142 | }, | ||
143 | }; | ||
144 | |||
145 | static struct ccu_common *sun8i_a83t_r_ccu_clks[] = { | ||
146 | &a83t_ar100_clk.common, | ||
147 | &a83t_apb0_clk.common, | ||
148 | &apb0_pio_clk.common, | ||
149 | &apb0_ir_clk.common, | ||
150 | &apb0_timer_clk.common, | ||
151 | &apb0_rsb_clk.common, | ||
152 | &apb0_uart_clk.common, | ||
153 | &apb0_i2c_clk.common, | ||
154 | &apb0_twd_clk.common, | ||
155 | &a83t_ir_clk.common, | ||
156 | }; | ||
157 | |||
93 | static struct ccu_common *sun8i_h3_r_ccu_clks[] = { | 158 | static struct ccu_common *sun8i_h3_r_ccu_clks[] = { |
94 | &ar100_clk.common, | 159 | &ar100_clk.common, |
95 | &apb0_clk.common, | 160 | &apb0_clk.common, |
@@ -115,6 +180,23 @@ static struct ccu_common *sun50i_a64_r_ccu_clks[] = { | |||
115 | &ir_clk.common, | 180 | &ir_clk.common, |
116 | }; | 181 | }; |
117 | 182 | ||
183 | static struct clk_hw_onecell_data sun8i_a83t_r_hw_clks = { | ||
184 | .hws = { | ||
185 | [CLK_AR100] = &a83t_ar100_clk.common.hw, | ||
186 | [CLK_AHB0] = &ahb0_clk.hw, | ||
187 | [CLK_APB0] = &a83t_apb0_clk.common.hw, | ||
188 | [CLK_APB0_PIO] = &apb0_pio_clk.common.hw, | ||
189 | [CLK_APB0_IR] = &apb0_ir_clk.common.hw, | ||
190 | [CLK_APB0_TIMER] = &apb0_timer_clk.common.hw, | ||
191 | [CLK_APB0_RSB] = &apb0_rsb_clk.common.hw, | ||
192 | [CLK_APB0_UART] = &apb0_uart_clk.common.hw, | ||
193 | [CLK_APB0_I2C] = &apb0_i2c_clk.common.hw, | ||
194 | [CLK_APB0_TWD] = &apb0_twd_clk.common.hw, | ||
195 | [CLK_IR] = &a83t_ir_clk.common.hw, | ||
196 | }, | ||
197 | .num = CLK_NUMBER, | ||
198 | }; | ||
199 | |||
118 | static struct clk_hw_onecell_data sun8i_h3_r_hw_clks = { | 200 | static struct clk_hw_onecell_data sun8i_h3_r_hw_clks = { |
119 | .hws = { | 201 | .hws = { |
120 | [CLK_AR100] = &ar100_clk.common.hw, | 202 | [CLK_AR100] = &ar100_clk.common.hw, |
@@ -148,6 +230,14 @@ static struct clk_hw_onecell_data sun50i_a64_r_hw_clks = { | |||
148 | .num = CLK_NUMBER, | 230 | .num = CLK_NUMBER, |
149 | }; | 231 | }; |
150 | 232 | ||
233 | static struct ccu_reset_map sun8i_a83t_r_ccu_resets[] = { | ||
234 | [RST_APB0_IR] = { 0xb0, BIT(1) }, | ||
235 | [RST_APB0_TIMER] = { 0xb0, BIT(2) }, | ||
236 | [RST_APB0_RSB] = { 0xb0, BIT(3) }, | ||
237 | [RST_APB0_UART] = { 0xb0, BIT(4) }, | ||
238 | [RST_APB0_I2C] = { 0xb0, BIT(6) }, | ||
239 | }; | ||
240 | |||
151 | static struct ccu_reset_map sun8i_h3_r_ccu_resets[] = { | 241 | static struct ccu_reset_map sun8i_h3_r_ccu_resets[] = { |
152 | [RST_APB0_IR] = { 0xb0, BIT(1) }, | 242 | [RST_APB0_IR] = { 0xb0, BIT(1) }, |
153 | [RST_APB0_TIMER] = { 0xb0, BIT(2) }, | 243 | [RST_APB0_TIMER] = { 0xb0, BIT(2) }, |
@@ -163,6 +253,16 @@ static struct ccu_reset_map sun50i_a64_r_ccu_resets[] = { | |||
163 | [RST_APB0_I2C] = { 0xb0, BIT(6) }, | 253 | [RST_APB0_I2C] = { 0xb0, BIT(6) }, |
164 | }; | 254 | }; |
165 | 255 | ||
256 | static const struct sunxi_ccu_desc sun8i_a83t_r_ccu_desc = { | ||
257 | .ccu_clks = sun8i_a83t_r_ccu_clks, | ||
258 | .num_ccu_clks = ARRAY_SIZE(sun8i_a83t_r_ccu_clks), | ||
259 | |||
260 | .hw_clks = &sun8i_a83t_r_hw_clks, | ||
261 | |||
262 | .resets = sun8i_a83t_r_ccu_resets, | ||
263 | .num_resets = ARRAY_SIZE(sun8i_a83t_r_ccu_resets), | ||
264 | }; | ||
265 | |||
166 | static const struct sunxi_ccu_desc sun8i_h3_r_ccu_desc = { | 266 | static const struct sunxi_ccu_desc sun8i_h3_r_ccu_desc = { |
167 | .ccu_clks = sun8i_h3_r_ccu_clks, | 267 | .ccu_clks = sun8i_h3_r_ccu_clks, |
168 | .num_ccu_clks = ARRAY_SIZE(sun8i_h3_r_ccu_clks), | 268 | .num_ccu_clks = ARRAY_SIZE(sun8i_h3_r_ccu_clks), |
@@ -198,6 +298,13 @@ static void __init sunxi_r_ccu_init(struct device_node *node, | |||
198 | sunxi_ccu_probe(node, reg, desc); | 298 | sunxi_ccu_probe(node, reg, desc); |
199 | } | 299 | } |
200 | 300 | ||
301 | static void __init sun8i_a83t_r_ccu_setup(struct device_node *node) | ||
302 | { | ||
303 | sunxi_r_ccu_init(node, &sun8i_a83t_r_ccu_desc); | ||
304 | } | ||
305 | CLK_OF_DECLARE(sun8i_a83t_r_ccu, "allwinner,sun8i-a83t-r-ccu", | ||
306 | sun8i_a83t_r_ccu_setup); | ||
307 | |||
201 | static void __init sun8i_h3_r_ccu_setup(struct device_node *node) | 308 | static void __init sun8i_h3_r_ccu_setup(struct device_node *node) |
202 | { | 309 | { |
203 | sunxi_r_ccu_init(node, &sun8i_h3_r_ccu_desc); | 310 | sunxi_r_ccu_init(node, &sun8i_h3_r_ccu_desc); |