19c92ab61SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
2763c5bd0SIcenowy Zheng /*
3763c5bd0SIcenowy Zheng * Copyright (c) 2017 Icenowy Zheng <icenowy@aosc.io>
4763c5bd0SIcenowy Zheng */
5763c5bd0SIcenowy Zheng
6763c5bd0SIcenowy Zheng #include <linux/clk.h>
7763c5bd0SIcenowy Zheng #include <linux/clk-provider.h>
8c8c525b0SSamuel Holland #include <linux/module.h>
9a96cbb14SRob Herring #include <linux/of.h>
10763c5bd0SIcenowy Zheng #include <linux/platform_device.h>
11763c5bd0SIcenowy Zheng #include <linux/reset.h>
12763c5bd0SIcenowy Zheng
13763c5bd0SIcenowy Zheng #include "ccu_common.h"
14763c5bd0SIcenowy Zheng #include "ccu_div.h"
15763c5bd0SIcenowy Zheng #include "ccu_gate.h"
16763c5bd0SIcenowy Zheng #include "ccu_reset.h"
17763c5bd0SIcenowy Zheng
18763c5bd0SIcenowy Zheng #include "ccu-sun8i-de2.h"
19763c5bd0SIcenowy Zheng
20763c5bd0SIcenowy Zheng static SUNXI_CCU_GATE(bus_mixer0_clk, "bus-mixer0", "bus-de",
21763c5bd0SIcenowy Zheng 0x04, BIT(0), 0);
22763c5bd0SIcenowy Zheng static SUNXI_CCU_GATE(bus_mixer1_clk, "bus-mixer1", "bus-de",
23763c5bd0SIcenowy Zheng 0x04, BIT(1), 0);
24763c5bd0SIcenowy Zheng static SUNXI_CCU_GATE(bus_wb_clk, "bus-wb", "bus-de",
25763c5bd0SIcenowy Zheng 0x04, BIT(2), 0);
2656808da9SJernej Skrabec static SUNXI_CCU_GATE(bus_rot_clk, "bus-rot", "bus-de",
2756808da9SJernej Skrabec 0x04, BIT(3), 0);
28763c5bd0SIcenowy Zheng
29763c5bd0SIcenowy Zheng static SUNXI_CCU_GATE(mixer0_clk, "mixer0", "mixer0-div",
30763c5bd0SIcenowy Zheng 0x00, BIT(0), CLK_SET_RATE_PARENT);
31763c5bd0SIcenowy Zheng static SUNXI_CCU_GATE(mixer1_clk, "mixer1", "mixer1-div",
32763c5bd0SIcenowy Zheng 0x00, BIT(1), CLK_SET_RATE_PARENT);
33763c5bd0SIcenowy Zheng static SUNXI_CCU_GATE(wb_clk, "wb", "wb-div",
34763c5bd0SIcenowy Zheng 0x00, BIT(2), CLK_SET_RATE_PARENT);
3556808da9SJernej Skrabec static SUNXI_CCU_GATE(rot_clk, "rot", "rot-div",
3656808da9SJernej Skrabec 0x00, BIT(3), CLK_SET_RATE_PARENT);
37763c5bd0SIcenowy Zheng
38763c5bd0SIcenowy Zheng static SUNXI_CCU_M(mixer0_div_clk, "mixer0-div", "de", 0x0c, 0, 4,
39763c5bd0SIcenowy Zheng CLK_SET_RATE_PARENT);
4019368d99SIcenowy Zheng static SUNXI_CCU_M(mixer1_div_clk, "mixer1-div", "de", 0x0c, 4, 4,
4119368d99SIcenowy Zheng CLK_SET_RATE_PARENT);
42763c5bd0SIcenowy Zheng static SUNXI_CCU_M(wb_div_clk, "wb-div", "de", 0x0c, 8, 4,
43763c5bd0SIcenowy Zheng CLK_SET_RATE_PARENT);
4456808da9SJernej Skrabec static SUNXI_CCU_M(rot_div_clk, "rot-div", "de", 0x0c, 0x0c, 4,
4556808da9SJernej Skrabec CLK_SET_RATE_PARENT);
46763c5bd0SIcenowy Zheng
47553c7d5bSMaxime Ripard static SUNXI_CCU_M(mixer0_div_a83_clk, "mixer0-div", "pll-de", 0x0c, 0, 4,
48553c7d5bSMaxime Ripard CLK_SET_RATE_PARENT);
49553c7d5bSMaxime Ripard static SUNXI_CCU_M(mixer1_div_a83_clk, "mixer1-div", "pll-de", 0x0c, 4, 4,
50553c7d5bSMaxime Ripard CLK_SET_RATE_PARENT);
51553c7d5bSMaxime Ripard static SUNXI_CCU_M(wb_div_a83_clk, "wb-div", "pll-de", 0x0c, 8, 4,
52553c7d5bSMaxime Ripard CLK_SET_RATE_PARENT);
53b0bfba90SJernej Skrabec static SUNXI_CCU_M(rot_div_a83_clk, "rot-div", "pll-de", 0x0c, 0x0c, 4,
54b0bfba90SJernej Skrabec CLK_SET_RATE_PARENT);
55553c7d5bSMaxime Ripard
56e1c51d31SSamuel Holland static struct ccu_common *sun8i_de2_ccu_clks[] = {
57763c5bd0SIcenowy Zheng &mixer0_clk.common,
58763c5bd0SIcenowy Zheng &mixer1_clk.common,
59763c5bd0SIcenowy Zheng &wb_clk.common,
60e1c51d31SSamuel Holland &rot_clk.common,
61763c5bd0SIcenowy Zheng
62763c5bd0SIcenowy Zheng &bus_mixer0_clk.common,
63763c5bd0SIcenowy Zheng &bus_mixer1_clk.common,
64763c5bd0SIcenowy Zheng &bus_wb_clk.common,
65e1c51d31SSamuel Holland &bus_rot_clk.common,
66e1c51d31SSamuel Holland
67e1c51d31SSamuel Holland &mixer0_div_clk.common,
68e1c51d31SSamuel Holland &mixer1_div_clk.common,
69e1c51d31SSamuel Holland &wb_div_clk.common,
70e1c51d31SSamuel Holland &rot_div_clk.common,
71763c5bd0SIcenowy Zheng
72553c7d5bSMaxime Ripard &mixer0_div_a83_clk.common,
73553c7d5bSMaxime Ripard &mixer1_div_a83_clk.common,
74553c7d5bSMaxime Ripard &wb_div_a83_clk.common,
75b0bfba90SJernej Skrabec &rot_div_a83_clk.common,
76763c5bd0SIcenowy Zheng };
77763c5bd0SIcenowy Zheng
78763c5bd0SIcenowy Zheng static struct clk_hw_onecell_data sun8i_a83t_de2_hw_clks = {
79763c5bd0SIcenowy Zheng .hws = {
80763c5bd0SIcenowy Zheng [CLK_MIXER0] = &mixer0_clk.common.hw,
81763c5bd0SIcenowy Zheng [CLK_MIXER1] = &mixer1_clk.common.hw,
82763c5bd0SIcenowy Zheng [CLK_WB] = &wb_clk.common.hw,
83b0bfba90SJernej Skrabec [CLK_ROT] = &rot_clk.common.hw,
84763c5bd0SIcenowy Zheng
85763c5bd0SIcenowy Zheng [CLK_BUS_MIXER0] = &bus_mixer0_clk.common.hw,
86763c5bd0SIcenowy Zheng [CLK_BUS_MIXER1] = &bus_mixer1_clk.common.hw,
87763c5bd0SIcenowy Zheng [CLK_BUS_WB] = &bus_wb_clk.common.hw,
88b0bfba90SJernej Skrabec [CLK_BUS_ROT] = &bus_rot_clk.common.hw,
89763c5bd0SIcenowy Zheng
90553c7d5bSMaxime Ripard [CLK_MIXER0_DIV] = &mixer0_div_a83_clk.common.hw,
91553c7d5bSMaxime Ripard [CLK_MIXER1_DIV] = &mixer1_div_a83_clk.common.hw,
92553c7d5bSMaxime Ripard [CLK_WB_DIV] = &wb_div_a83_clk.common.hw,
93b0bfba90SJernej Skrabec [CLK_ROT_DIV] = &rot_div_a83_clk.common.hw,
94763c5bd0SIcenowy Zheng },
95b0bfba90SJernej Skrabec .num = CLK_NUMBER_WITH_ROT,
96763c5bd0SIcenowy Zheng };
97763c5bd0SIcenowy Zheng
9819368d99SIcenowy Zheng static struct clk_hw_onecell_data sun8i_h3_de2_hw_clks = {
9919368d99SIcenowy Zheng .hws = {
10019368d99SIcenowy Zheng [CLK_MIXER0] = &mixer0_clk.common.hw,
10119368d99SIcenowy Zheng [CLK_MIXER1] = &mixer1_clk.common.hw,
10219368d99SIcenowy Zheng [CLK_WB] = &wb_clk.common.hw,
10319368d99SIcenowy Zheng
10419368d99SIcenowy Zheng [CLK_BUS_MIXER0] = &bus_mixer0_clk.common.hw,
10519368d99SIcenowy Zheng [CLK_BUS_MIXER1] = &bus_mixer1_clk.common.hw,
10619368d99SIcenowy Zheng [CLK_BUS_WB] = &bus_wb_clk.common.hw,
10719368d99SIcenowy Zheng
10819368d99SIcenowy Zheng [CLK_MIXER0_DIV] = &mixer0_div_clk.common.hw,
10919368d99SIcenowy Zheng [CLK_MIXER1_DIV] = &mixer1_div_clk.common.hw,
11019368d99SIcenowy Zheng [CLK_WB_DIV] = &wb_div_clk.common.hw,
11119368d99SIcenowy Zheng },
11256808da9SJernej Skrabec .num = CLK_NUMBER_WITHOUT_ROT,
11319368d99SIcenowy Zheng };
11419368d99SIcenowy Zheng
115763c5bd0SIcenowy Zheng static struct clk_hw_onecell_data sun8i_v3s_de2_hw_clks = {
116763c5bd0SIcenowy Zheng .hws = {
117763c5bd0SIcenowy Zheng [CLK_MIXER0] = &mixer0_clk.common.hw,
118763c5bd0SIcenowy Zheng [CLK_WB] = &wb_clk.common.hw,
119763c5bd0SIcenowy Zheng
120763c5bd0SIcenowy Zheng [CLK_BUS_MIXER0] = &bus_mixer0_clk.common.hw,
121763c5bd0SIcenowy Zheng [CLK_BUS_WB] = &bus_wb_clk.common.hw,
122763c5bd0SIcenowy Zheng
123763c5bd0SIcenowy Zheng [CLK_MIXER0_DIV] = &mixer0_div_clk.common.hw,
124763c5bd0SIcenowy Zheng [CLK_WB_DIV] = &wb_div_clk.common.hw,
125763c5bd0SIcenowy Zheng },
12656808da9SJernej Skrabec .num = CLK_NUMBER_WITHOUT_ROT,
12756808da9SJernej Skrabec };
12856808da9SJernej Skrabec
129b4bbce66SJernej Skrabec static struct clk_hw_onecell_data sun50i_a64_de2_hw_clks = {
130b4bbce66SJernej Skrabec .hws = {
131b4bbce66SJernej Skrabec [CLK_MIXER0] = &mixer0_clk.common.hw,
132b4bbce66SJernej Skrabec [CLK_MIXER1] = &mixer1_clk.common.hw,
133b4bbce66SJernej Skrabec [CLK_WB] = &wb_clk.common.hw,
134b4bbce66SJernej Skrabec [CLK_ROT] = &rot_clk.common.hw,
135b4bbce66SJernej Skrabec
136b4bbce66SJernej Skrabec [CLK_BUS_MIXER0] = &bus_mixer0_clk.common.hw,
137b4bbce66SJernej Skrabec [CLK_BUS_MIXER1] = &bus_mixer1_clk.common.hw,
138b4bbce66SJernej Skrabec [CLK_BUS_WB] = &bus_wb_clk.common.hw,
139b4bbce66SJernej Skrabec [CLK_BUS_ROT] = &bus_rot_clk.common.hw,
140b4bbce66SJernej Skrabec
141b4bbce66SJernej Skrabec [CLK_MIXER0_DIV] = &mixer0_div_clk.common.hw,
142b4bbce66SJernej Skrabec [CLK_MIXER1_DIV] = &mixer1_div_clk.common.hw,
143b4bbce66SJernej Skrabec [CLK_WB_DIV] = &wb_div_clk.common.hw,
144b4bbce66SJernej Skrabec [CLK_ROT_DIV] = &rot_div_clk.common.hw,
145b4bbce66SJernej Skrabec },
146b4bbce66SJernej Skrabec .num = CLK_NUMBER_WITH_ROT,
147b4bbce66SJernej Skrabec };
148b4bbce66SJernej Skrabec
149763c5bd0SIcenowy Zheng static struct ccu_reset_map sun8i_a83t_de2_resets[] = {
150763c5bd0SIcenowy Zheng [RST_MIXER0] = { 0x08, BIT(0) },
151763c5bd0SIcenowy Zheng /*
1528f9b11a3SJernej Skrabec * Mixer1 reset line is shared with wb, so only RST_WB is
1538f9b11a3SJernej Skrabec * exported here.
1548f9b11a3SJernej Skrabec */
1558f9b11a3SJernej Skrabec [RST_WB] = { 0x08, BIT(2) },
156b0bfba90SJernej Skrabec [RST_ROT] = { 0x08, BIT(3) },
1578f9b11a3SJernej Skrabec };
1588f9b11a3SJernej Skrabec
1598f9b11a3SJernej Skrabec static struct ccu_reset_map sun8i_h3_de2_resets[] = {
1608f9b11a3SJernej Skrabec [RST_MIXER0] = { 0x08, BIT(0) },
1618f9b11a3SJernej Skrabec /*
1628f9b11a3SJernej Skrabec * Mixer1 reset line is shared with wb, so only RST_WB is
1638f9b11a3SJernej Skrabec * exported here.
1648f9b11a3SJernej Skrabec * V3s doesn't have mixer1, so it also shares this struct.
165763c5bd0SIcenowy Zheng */
166763c5bd0SIcenowy Zheng [RST_WB] = { 0x08, BIT(2) },
167763c5bd0SIcenowy Zheng };
168763c5bd0SIcenowy Zheng
169763c5bd0SIcenowy Zheng static struct ccu_reset_map sun50i_a64_de2_resets[] = {
170763c5bd0SIcenowy Zheng [RST_MIXER0] = { 0x08, BIT(0) },
171763c5bd0SIcenowy Zheng [RST_MIXER1] = { 0x08, BIT(1) },
172763c5bd0SIcenowy Zheng [RST_WB] = { 0x08, BIT(2) },
173b4bbce66SJernej Skrabec [RST_ROT] = { 0x08, BIT(3) },
174763c5bd0SIcenowy Zheng };
175763c5bd0SIcenowy Zheng
1762b48dcb7SJernej Skrabec static struct ccu_reset_map sun50i_h5_de2_resets[] = {
1772b48dcb7SJernej Skrabec [RST_MIXER0] = { 0x08, BIT(0) },
1782b48dcb7SJernej Skrabec [RST_MIXER1] = { 0x08, BIT(1) },
1792b48dcb7SJernej Skrabec [RST_WB] = { 0x08, BIT(2) },
1802b48dcb7SJernej Skrabec };
1812b48dcb7SJernej Skrabec
182763c5bd0SIcenowy Zheng static const struct sunxi_ccu_desc sun8i_a83t_de2_clk_desc = {
183e1c51d31SSamuel Holland .ccu_clks = sun8i_de2_ccu_clks,
184e1c51d31SSamuel Holland .num_ccu_clks = ARRAY_SIZE(sun8i_de2_ccu_clks),
185763c5bd0SIcenowy Zheng
186763c5bd0SIcenowy Zheng .hw_clks = &sun8i_a83t_de2_hw_clks,
187763c5bd0SIcenowy Zheng
188763c5bd0SIcenowy Zheng .resets = sun8i_a83t_de2_resets,
189763c5bd0SIcenowy Zheng .num_resets = ARRAY_SIZE(sun8i_a83t_de2_resets),
190763c5bd0SIcenowy Zheng };
191763c5bd0SIcenowy Zheng
19219368d99SIcenowy Zheng static const struct sunxi_ccu_desc sun8i_h3_de2_clk_desc = {
193e1c51d31SSamuel Holland .ccu_clks = sun8i_de2_ccu_clks,
194e1c51d31SSamuel Holland .num_ccu_clks = ARRAY_SIZE(sun8i_de2_ccu_clks),
19519368d99SIcenowy Zheng
19619368d99SIcenowy Zheng .hw_clks = &sun8i_h3_de2_hw_clks,
19719368d99SIcenowy Zheng
1988f9b11a3SJernej Skrabec .resets = sun8i_h3_de2_resets,
1998f9b11a3SJernej Skrabec .num_resets = ARRAY_SIZE(sun8i_h3_de2_resets),
20019368d99SIcenowy Zheng };
20119368d99SIcenowy Zheng
20211d0c436SJernej Skrabec static const struct sunxi_ccu_desc sun8i_r40_de2_clk_desc = {
203e1c51d31SSamuel Holland .ccu_clks = sun8i_de2_ccu_clks,
204e1c51d31SSamuel Holland .num_ccu_clks = ARRAY_SIZE(sun8i_de2_ccu_clks),
20511d0c436SJernej Skrabec
20611d0c436SJernej Skrabec .hw_clks = &sun50i_a64_de2_hw_clks,
20711d0c436SJernej Skrabec
20811d0c436SJernej Skrabec .resets = sun8i_a83t_de2_resets,
20911d0c436SJernej Skrabec .num_resets = ARRAY_SIZE(sun8i_a83t_de2_resets),
21011d0c436SJernej Skrabec };
21111d0c436SJernej Skrabec
212b998b75fSJernej Skrabec static const struct sunxi_ccu_desc sun8i_v3s_de2_clk_desc = {
213e1c51d31SSamuel Holland .ccu_clks = sun8i_de2_ccu_clks,
214e1c51d31SSamuel Holland .num_ccu_clks = ARRAY_SIZE(sun8i_de2_ccu_clks),
215b998b75fSJernej Skrabec
216b998b75fSJernej Skrabec .hw_clks = &sun8i_v3s_de2_hw_clks,
217b998b75fSJernej Skrabec
218b998b75fSJernej Skrabec .resets = sun8i_a83t_de2_resets,
219b998b75fSJernej Skrabec .num_resets = ARRAY_SIZE(sun8i_a83t_de2_resets),
220b998b75fSJernej Skrabec };
221b998b75fSJernej Skrabec
222763c5bd0SIcenowy Zheng static const struct sunxi_ccu_desc sun50i_a64_de2_clk_desc = {
223e1c51d31SSamuel Holland .ccu_clks = sun8i_de2_ccu_clks,
224e1c51d31SSamuel Holland .num_ccu_clks = ARRAY_SIZE(sun8i_de2_ccu_clks),
225763c5bd0SIcenowy Zheng
226b4bbce66SJernej Skrabec .hw_clks = &sun50i_a64_de2_hw_clks,
227763c5bd0SIcenowy Zheng
228763c5bd0SIcenowy Zheng .resets = sun50i_a64_de2_resets,
229763c5bd0SIcenowy Zheng .num_resets = ARRAY_SIZE(sun50i_a64_de2_resets),
230763c5bd0SIcenowy Zheng };
231763c5bd0SIcenowy Zheng
2322b48dcb7SJernej Skrabec static const struct sunxi_ccu_desc sun50i_h5_de2_clk_desc = {
233e1c51d31SSamuel Holland .ccu_clks = sun8i_de2_ccu_clks,
234e1c51d31SSamuel Holland .num_ccu_clks = ARRAY_SIZE(sun8i_de2_ccu_clks),
2352b48dcb7SJernej Skrabec
2362b48dcb7SJernej Skrabec .hw_clks = &sun8i_h3_de2_hw_clks,
2372b48dcb7SJernej Skrabec
2382b48dcb7SJernej Skrabec .resets = sun50i_h5_de2_resets,
2392b48dcb7SJernej Skrabec .num_resets = ARRAY_SIZE(sun50i_h5_de2_resets),
2402b48dcb7SJernej Skrabec };
2412b48dcb7SJernej Skrabec
sunxi_de2_clk_probe(struct platform_device * pdev)242763c5bd0SIcenowy Zheng static int sunxi_de2_clk_probe(struct platform_device *pdev)
243763c5bd0SIcenowy Zheng {
244763c5bd0SIcenowy Zheng struct clk *bus_clk, *mod_clk;
245763c5bd0SIcenowy Zheng struct reset_control *rstc;
246763c5bd0SIcenowy Zheng void __iomem *reg;
247763c5bd0SIcenowy Zheng const struct sunxi_ccu_desc *ccu_desc;
248763c5bd0SIcenowy Zheng int ret;
249763c5bd0SIcenowy Zheng
250763c5bd0SIcenowy Zheng ccu_desc = of_device_get_match_data(&pdev->dev);
251763c5bd0SIcenowy Zheng if (!ccu_desc)
252763c5bd0SIcenowy Zheng return -EINVAL;
253763c5bd0SIcenowy Zheng
2543f7785a2SCai Huoqing reg = devm_platform_ioremap_resource(pdev, 0);
255763c5bd0SIcenowy Zheng if (IS_ERR(reg))
256763c5bd0SIcenowy Zheng return PTR_ERR(reg);
257763c5bd0SIcenowy Zheng
258763c5bd0SIcenowy Zheng bus_clk = devm_clk_get(&pdev->dev, "bus");
2595c05a33eSYang Yingliang if (IS_ERR(bus_clk))
2605c05a33eSYang Yingliang return dev_err_probe(&pdev->dev, PTR_ERR(bus_clk),
2615c05a33eSYang Yingliang "Couldn't get bus clk\n");
262763c5bd0SIcenowy Zheng
263763c5bd0SIcenowy Zheng mod_clk = devm_clk_get(&pdev->dev, "mod");
2645c05a33eSYang Yingliang if (IS_ERR(mod_clk))
2655c05a33eSYang Yingliang return dev_err_probe(&pdev->dev, PTR_ERR(mod_clk),
2665c05a33eSYang Yingliang "Couldn't get mod clk\n");
267763c5bd0SIcenowy Zheng
268763c5bd0SIcenowy Zheng rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
2695c05a33eSYang Yingliang if (IS_ERR(rstc))
2705c05a33eSYang Yingliang return dev_err_probe(&pdev->dev, PTR_ERR(rstc),
2715c05a33eSYang Yingliang "Couldn't get reset control\n");
272763c5bd0SIcenowy Zheng
273763c5bd0SIcenowy Zheng /* The clocks need to be enabled for us to access the registers */
274763c5bd0SIcenowy Zheng ret = clk_prepare_enable(bus_clk);
275763c5bd0SIcenowy Zheng if (ret) {
276763c5bd0SIcenowy Zheng dev_err(&pdev->dev, "Couldn't enable bus clk: %d\n", ret);
277763c5bd0SIcenowy Zheng return ret;
278763c5bd0SIcenowy Zheng }
279763c5bd0SIcenowy Zheng
280763c5bd0SIcenowy Zheng ret = clk_prepare_enable(mod_clk);
281763c5bd0SIcenowy Zheng if (ret) {
282763c5bd0SIcenowy Zheng dev_err(&pdev->dev, "Couldn't enable mod clk: %d\n", ret);
283763c5bd0SIcenowy Zheng goto err_disable_bus_clk;
284763c5bd0SIcenowy Zheng }
285763c5bd0SIcenowy Zheng
286763c5bd0SIcenowy Zheng /* The reset control needs to be asserted for the controls to work */
287763c5bd0SIcenowy Zheng ret = reset_control_deassert(rstc);
288763c5bd0SIcenowy Zheng if (ret) {
289763c5bd0SIcenowy Zheng dev_err(&pdev->dev,
290763c5bd0SIcenowy Zheng "Couldn't deassert reset control: %d\n", ret);
291763c5bd0SIcenowy Zheng goto err_disable_mod_clk;
292763c5bd0SIcenowy Zheng }
293763c5bd0SIcenowy Zheng
2949bec2b9cSSamuel Holland ret = devm_sunxi_ccu_probe(&pdev->dev, reg, ccu_desc);
295763c5bd0SIcenowy Zheng if (ret)
296763c5bd0SIcenowy Zheng goto err_assert_reset;
297763c5bd0SIcenowy Zheng
298763c5bd0SIcenowy Zheng return 0;
299763c5bd0SIcenowy Zheng
300763c5bd0SIcenowy Zheng err_assert_reset:
301763c5bd0SIcenowy Zheng reset_control_assert(rstc);
302763c5bd0SIcenowy Zheng err_disable_mod_clk:
303763c5bd0SIcenowy Zheng clk_disable_unprepare(mod_clk);
304763c5bd0SIcenowy Zheng err_disable_bus_clk:
305763c5bd0SIcenowy Zheng clk_disable_unprepare(bus_clk);
306763c5bd0SIcenowy Zheng return ret;
307763c5bd0SIcenowy Zheng }
308763c5bd0SIcenowy Zheng
309763c5bd0SIcenowy Zheng static const struct of_device_id sunxi_de2_clk_ids[] = {
310763c5bd0SIcenowy Zheng {
311763c5bd0SIcenowy Zheng .compatible = "allwinner,sun8i-a83t-de2-clk",
312763c5bd0SIcenowy Zheng .data = &sun8i_a83t_de2_clk_desc,
313763c5bd0SIcenowy Zheng },
314763c5bd0SIcenowy Zheng {
31519368d99SIcenowy Zheng .compatible = "allwinner,sun8i-h3-de2-clk",
31619368d99SIcenowy Zheng .data = &sun8i_h3_de2_clk_desc,
31719368d99SIcenowy Zheng },
31819368d99SIcenowy Zheng {
31911d0c436SJernej Skrabec .compatible = "allwinner,sun8i-r40-de2-clk",
32011d0c436SJernej Skrabec .data = &sun8i_r40_de2_clk_desc,
32111d0c436SJernej Skrabec },
32211d0c436SJernej Skrabec {
323763c5bd0SIcenowy Zheng .compatible = "allwinner,sun8i-v3s-de2-clk",
324763c5bd0SIcenowy Zheng .data = &sun8i_v3s_de2_clk_desc,
325763c5bd0SIcenowy Zheng },
326763c5bd0SIcenowy Zheng {
32701951563SIcenowy Zheng .compatible = "allwinner,sun50i-a64-de2-clk",
32801951563SIcenowy Zheng .data = &sun50i_a64_de2_clk_desc,
32901951563SIcenowy Zheng },
33001951563SIcenowy Zheng {
331763c5bd0SIcenowy Zheng .compatible = "allwinner,sun50i-h5-de2-clk",
3322b48dcb7SJernej Skrabec .data = &sun50i_h5_de2_clk_desc,
333763c5bd0SIcenowy Zheng },
33456808da9SJernej Skrabec {
33556808da9SJernej Skrabec .compatible = "allwinner,sun50i-h6-de3-clk",
33675250eb7SJernej Skrabec .data = &sun50i_h5_de2_clk_desc,
33756808da9SJernej Skrabec },
338763c5bd0SIcenowy Zheng { }
339763c5bd0SIcenowy Zheng };
340c60f6804SKrzysztof Kozlowski MODULE_DEVICE_TABLE(of, sunxi_de2_clk_ids);
341763c5bd0SIcenowy Zheng
342763c5bd0SIcenowy Zheng static struct platform_driver sunxi_de2_clk_driver = {
343763c5bd0SIcenowy Zheng .probe = sunxi_de2_clk_probe,
344763c5bd0SIcenowy Zheng .driver = {
345763c5bd0SIcenowy Zheng .name = "sunxi-de2-clks",
346763c5bd0SIcenowy Zheng .of_match_table = sunxi_de2_clk_ids,
347763c5bd0SIcenowy Zheng },
348763c5bd0SIcenowy Zheng };
349c8c525b0SSamuel Holland module_platform_driver(sunxi_de2_clk_driver);
350c8c525b0SSamuel Holland
351c8c525b0SSamuel Holland MODULE_IMPORT_NS(SUNXI_CCU);
352*4e7134faSJeff Johnson MODULE_DESCRIPTION("Support for the Allwinner SoCs DE2 CCU");
353c8c525b0SSamuel Holland MODULE_LICENSE("GPL");
354