History

clk: remove s3c24xx driver

The s3c24xx platform is gone, so the clk driver can be removed as well.

Arnd Bergmann committed 4 years ago

Commit 594b3ca1 parent 0b145588 files · +0 −1634Browse files

Unified · Split

8 files
  1. MAINTAINERS +0 −1
  2. drivers/clk/samsung/Kconfig +0 −32
  3. drivers/clk/samsung/Makefile +0 −4
  4. drivers/clk/samsung/clk-s3c2410-dclk.c +0 −440
  5. drivers/clk/samsung/clk-s3c2410.c +0 −446
  6. drivers/clk/samsung/clk-s3c2412.c +0 −254
  7. drivers/clk/samsung/clk-s3c2443.c +0 −438
  8. include/linux/platform_data/clk-s3c2410.h +0 −19
MAINTAINERS+0−1
@@ -18440,7 +18440,6 @@ F: include/dt-bindings/clock/s3c*.h · 18439 unmodified lines
1844018440 F: include/dt-bindings/clock/s5p*.h
1844118441 F: include/dt-bindings/clock/samsung,*.h
1844218442 F: include/linux/clk/samsung.h
18443−F: include/linux/platform_data/clk-s3c2410.h
1844418443
1844518444 SAMSUNG SPI DRIVERS
1844618445 M: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
drivers/clk/samsung/Kconfig+0−32
@@ -94,38 +94,6 @@ config EXYNOS_CLKOUT · 93 unmodified lines
9494 status of the certains clocks from SoC, but it could also be tied to
9595 other devices as an input clock.
9696
97−# For S3C24XX platforms, select following symbols:
98−config S3C2410_COMMON_CLK
99− bool "Samsung S3C2410 clock controller support" if COMPILE_TEST
100− select COMMON_CLK_SAMSUNG
101− help
102− Support for the clock controller present on the Samsung
103− S3C2410/S3C2440/S3C2442 SoCs. Choose Y here only if you build for
104− this SoC.
105−
106−config S3C2410_COMMON_DCLK
107− bool
108− select COMMON_CLK_SAMSUNG
109− select REGMAP_MMIO
110− help
111− Support for the dclk clock controller present on the Samsung
112− S3C2410/S3C2412/S3C2440/S3C2443 SoCs. Choose Y here only if you build
113− for this SoC.
114−
115−config S3C2412_COMMON_CLK
116− bool "Samsung S3C2412 clock controller support" if COMPILE_TEST
117− select COMMON_CLK_SAMSUNG
118− help
119− Support for the clock controller present on the Samsung S3C2412 SoCs.
120− Choose Y here only if you build for this SoC.
121−
122−config S3C2443_COMMON_CLK
123− bool "Samsung S3C2443 clock controller support" if COMPILE_TEST
124− select COMMON_CLK_SAMSUNG
125− help
126− Support for the clock controller present on the Samsung
127− S3C2416/S3C2443 SoCs. Choose Y here only if you build for this SoC.
128−
12997 config TESLA_FSD_COMMON_CLK
13098 bool "Tesla FSD clock controller support" if COMPILE_TEST
13199 depends on COMMON_CLK_SAMSUNG
drivers/clk/samsung/Makefile+0−4
@@ -21,10 +21,6 @@ obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos7.o · 20 unmodified lines
2121 obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos7885.o
2222 obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos850.o
2323 obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynosautov9.o
24−obj-$(CONFIG_S3C2410_COMMON_CLK)+= clk-s3c2410.o
25−obj-$(CONFIG_S3C2410_COMMON_DCLK)+= clk-s3c2410-dclk.o
26−obj-$(CONFIG_S3C2412_COMMON_CLK)+= clk-s3c2412.o
27−obj-$(CONFIG_S3C2443_COMMON_CLK)+= clk-s3c2443.o
2824 obj-$(CONFIG_S3C64XX_COMMON_CLK) += clk-s3c64xx.o
2925 obj-$(CONFIG_S5PV210_COMMON_CLK) += clk-s5pv210.o clk-s5pv210-audss.o
3026 obj-$(CONFIG_TESLA_FSD_COMMON_CLK) += clk-fsd.o
drivers/clk/samsung/clk-s3c2410-dclk.c+0−440
@@ -1,440 +0,0 @@
1−// SPDX-License-Identifier: GPL-2.0-only
2−/*
3− * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
4− *
5− * Common Clock Framework support for s3c24xx external clock output.
6− */
7−
8−#include <linux/clkdev.h>
9−#include <linux/slab.h>
10−#include <linux/clk.h>
11−#include <linux/clk-provider.h>
12−#include <linux/io.h>
13−#include <linux/platform_device.h>
14−#include <linux/platform_data/clk-s3c2410.h>
15−#include <linux/module.h>
16−#include "clk.h"
17−
18−#define MUX_DCLK0 0
19−#define MUX_DCLK1 1
20−#define DIV_DCLK0 2
21−#define DIV_DCLK1 3
22−#define GATE_DCLK0 4
23−#define GATE_DCLK1 5
24−#define MUX_CLKOUT0 6
25−#define MUX_CLKOUT1 7
26−#define DCLK_MAX_CLKS (MUX_CLKOUT1 + 1)
27−
28−enum supported_socs {
29− S3C2410,
30− S3C2412,
31− S3C2440,
32− S3C2443,
33−};
34−
35−struct s3c24xx_dclk_drv_data {
36− const char **clkout0_parent_names;
37− int clkout0_num_parents;
38− const char **clkout1_parent_names;
39− int clkout1_num_parents;
40− const char **mux_parent_names;
41− int mux_num_parents;
42−};
43−
44−/*
45− * Clock for output-parent selection in misccr
46− */
47−
48−struct s3c24xx_clkout {
49− struct clk_hw hw;
50− u32 mask;
51− u8 shift;
52− unsigned int (*modify_misccr)(unsigned int clr, unsigned int chg);
53−};
54−
55−#define to_s3c24xx_clkout(_hw) container_of(_hw, struct s3c24xx_clkout, hw)
56−
57−static u8 s3c24xx_clkout_get_parent(struct clk_hw *hw)
58−{
59− struct s3c24xx_clkout *clkout = to_s3c24xx_clkout(hw);
60− int num_parents = clk_hw_get_num_parents(hw);
61− u32 val;
62−
63− val = clkout->modify_misccr(0, 0) >> clkout->shift;
64− val >>= clkout->shift;
65− val &= clkout->mask;
66−
67− if (val >= num_parents)
68− return -EINVAL;
69−
70− return val;
71−}
72−
73−static int s3c24xx_clkout_set_parent(struct clk_hw *hw, u8 index)
74−{
75− struct s3c24xx_clkout *clkout = to_s3c24xx_clkout(hw);
76−
77− clkout->modify_misccr((clkout->mask << clkout->shift),
78− (index << clkout->shift));
79−
80− return 0;
81−}
82−
83−static const struct clk_ops s3c24xx_clkout_ops = {
84− .get_parent = s3c24xx_clkout_get_parent,
85− .set_parent = s3c24xx_clkout_set_parent,
86− .determine_rate = __clk_mux_determine_rate,
87−};
88−
89−static struct clk_hw *s3c24xx_register_clkout(struct device *dev,
90− const char *name, const char **parent_names, u8 num_parents,
91− u8 shift, u32 mask)
92−{
93− struct s3c2410_clk_platform_data *pdata = dev_get_platdata(dev);
94− struct s3c24xx_clkout *clkout;
95− struct clk_init_data init;
96− int ret;
97−
98− if (!pdata)
99− return ERR_PTR(-EINVAL);
100−
101− /* allocate the clkout */
102− clkout = kzalloc(sizeof(*clkout), GFP_KERNEL);
103− if (!clkout)
104− return ERR_PTR(-ENOMEM);
105−
106− init.name = name;
107− init.ops = &s3c24xx_clkout_ops;
108− init.flags = 0;
109− init.parent_names = parent_names;
110− init.num_parents = num_parents;
111−
112− clkout->shift = shift;
113− clkout->mask = mask;
114− clkout->hw.init = &init;
115− clkout->modify_misccr = pdata->modify_misccr;
116−
117− ret = clk_hw_register(dev, &clkout->hw);
118− if (ret)
119− return ERR_PTR(ret);
120−
121− return &clkout->hw;
122−}
123−
124−/*
125− * dclk and clkout init
126− */
127−
128−struct s3c24xx_dclk {
129− struct device *dev;
130− void __iomem *base;
131− struct notifier_block dclk0_div_change_nb;
132− struct notifier_block dclk1_div_change_nb;
133− spinlock_t dclk_lock;
134− unsigned long reg_save;
135− /* clk_data must be the last entry in the structure */
136− struct clk_hw_onecell_data clk_data;
137−};
138−
139−#define to_s3c24xx_dclk0(x) \
140− container_of(x, struct s3c24xx_dclk, dclk0_div_change_nb)
141−
142−#define to_s3c24xx_dclk1(x) \
143− container_of(x, struct s3c24xx_dclk, dclk1_div_change_nb)
144−
145−static const char *dclk_s3c2410_p[] = { "pclk", "uclk" };
146−static const char *clkout0_s3c2410_p[] = { "mpll", "upll", "fclk", "hclk", "pclk",
147− "gate_dclk0" };
148−static const char *clkout1_s3c2410_p[] = { "mpll", "upll", "fclk", "hclk", "pclk",
149− "gate_dclk1" };
150−
151−static const char *clkout0_s3c2412_p[] = { "mpll", "upll", "rtc_clkout",
152− "hclk", "pclk", "gate_dclk0" };
153−static const char *clkout1_s3c2412_p[] = { "xti", "upll", "fclk", "hclk", "pclk",
154− "gate_dclk1" };
155−
156−static const char *clkout0_s3c2440_p[] = { "xti", "upll", "fclk", "hclk", "pclk",
157− "gate_dclk0" };
158−static const char *clkout1_s3c2440_p[] = { "mpll", "upll", "rtc_clkout",
159− "hclk", "pclk", "gate_dclk1" };
160−
161−static const char *dclk_s3c2443_p[] = { "pclk", "epll" };
162−static const char *clkout0_s3c2443_p[] = { "xti", "epll", "armclk", "hclk", "pclk",
163− "gate_dclk0" };
164−static const char *clkout1_s3c2443_p[] = { "dummy", "epll", "rtc_clkout",
165− "hclk", "pclk", "gate_dclk1" };
166−
167−#define DCLKCON_DCLK_DIV_MASK 0xf
168−#define DCLKCON_DCLK0_DIV_SHIFT 4
169−#define DCLKCON_DCLK0_CMP_SHIFT 8
170−#define DCLKCON_DCLK1_DIV_SHIFT 20
171−#define DCLKCON_DCLK1_CMP_SHIFT 24
172−
173−static void s3c24xx_dclk_update_cmp(struct s3c24xx_dclk *s3c24xx_dclk,
174− int div_shift, int cmp_shift)
175−{
176− unsigned long flags = 0;
177− u32 dclk_con, div, cmp;
178−
179− spin_lock_irqsave(&s3c24xx_dclk->dclk_lock, flags);
180−
181− dclk_con = readl_relaxed(s3c24xx_dclk->base);
182−
183− div = ((dclk_con >> div_shift) & DCLKCON_DCLK_DIV_MASK) + 1;
184− cmp = ((div + 1) / 2) - 1;
185−
186− dclk_con &= ~(DCLKCON_DCLK_DIV_MASK << cmp_shift);
187− dclk_con |= (cmp << cmp_shift);
188−
189− writel_relaxed(dclk_con, s3c24xx_dclk->base);
190−
191− spin_unlock_irqrestore(&s3c24xx_dclk->dclk_lock, flags);
192−}
193−
194−static int s3c24xx_dclk0_div_notify(struct notifier_block *nb,
195− unsigned long event, void *data)
196−{
197− struct s3c24xx_dclk *s3c24xx_dclk = to_s3c24xx_dclk0(nb);
198−
199− if (event == POST_RATE_CHANGE) {
200− s3c24xx_dclk_update_cmp(s3c24xx_dclk,
201− DCLKCON_DCLK0_DIV_SHIFT, DCLKCON_DCLK0_CMP_SHIFT);
202− }
203−
204− return NOTIFY_DONE;
205−}
206−
207−static int s3c24xx_dclk1_div_notify(struct notifier_block *nb,
208− unsigned long event, void *data)
209−{
210− struct s3c24xx_dclk *s3c24xx_dclk = to_s3c24xx_dclk1(nb);
211−
212− if (event == POST_RATE_CHANGE) {
213− s3c24xx_dclk_update_cmp(s3c24xx_dclk,
214− DCLKCON_DCLK1_DIV_SHIFT, DCLKCON_DCLK1_CMP_SHIFT);
215− }
216−
217− return NOTIFY_DONE;
218−}
219−
220−#ifdef CONFIG_PM_SLEEP
221−static int s3c24xx_dclk_suspend(struct device *dev)
222−{
223− struct s3c24xx_dclk *s3c24xx_dclk = dev_get_drvdata(dev);
224−
225− s3c24xx_dclk->reg_save = readl_relaxed(s3c24xx_dclk->base);
226− return 0;
227−}
228−
229−static int s3c24xx_dclk_resume(struct device *dev)
230−{
231− struct s3c24xx_dclk *s3c24xx_dclk = dev_get_drvdata(dev);
232−
233− writel_relaxed(s3c24xx_dclk->reg_save, s3c24xx_dclk->base);
234− return 0;
235−}
236−#endif
237−
238−static SIMPLE_DEV_PM_OPS(s3c24xx_dclk_pm_ops,
239− s3c24xx_dclk_suspend, s3c24xx_dclk_resume);
240−
241−static int s3c24xx_dclk_probe(struct platform_device *pdev)
242−{
243− struct s3c24xx_dclk *s3c24xx_dclk;
244− struct s3c24xx_dclk_drv_data *dclk_variant;
245− struct clk_hw **clk_table;
246− int ret, i;
247−
248− s3c24xx_dclk = devm_kzalloc(&pdev->dev,
249− struct_size(s3c24xx_dclk, clk_data.hws,
250− DCLK_MAX_CLKS),
251− GFP_KERNEL);
252− if (!s3c24xx_dclk)
253− return -ENOMEM;
254−
255− clk_table = s3c24xx_dclk->clk_data.hws;
256−
257− s3c24xx_dclk->dev = &pdev->dev;
258− s3c24xx_dclk->clk_data.num = DCLK_MAX_CLKS;
259− platform_set_drvdata(pdev, s3c24xx_dclk);
260− spin_lock_init(&s3c24xx_dclk->dclk_lock);
261−
262− s3c24xx_dclk->base = devm_platform_ioremap_resource(pdev, 0);
263− if (IS_ERR(s3c24xx_dclk->base))
264− return PTR_ERR(s3c24xx_dclk->base);
265−
266− dclk_variant = (struct s3c24xx_dclk_drv_data *)
267− platform_get_device_id(pdev)->driver_data;
268−
269−
270− clk_table[MUX_DCLK0] = clk_hw_register_mux(&pdev->dev, "mux_dclk0",
271− dclk_variant->mux_parent_names,
272− dclk_variant->mux_num_parents, 0,
273− s3c24xx_dclk->base, 1, 1, 0,
274− &s3c24xx_dclk->dclk_lock);
275− clk_table[MUX_DCLK1] = clk_hw_register_mux(&pdev->dev, "mux_dclk1",
276− dclk_variant->mux_parent_names,
277− dclk_variant->mux_num_parents, 0,
278− s3c24xx_dclk->base, 17, 1, 0,
279− &s3c24xx_dclk->dclk_lock);
280−
281− clk_table[DIV_DCLK0] = clk_hw_register_divider(&pdev->dev, "div_dclk0",
282− "mux_dclk0", 0, s3c24xx_dclk->base,
283− 4, 4, 0, &s3c24xx_dclk->dclk_lock);
284− clk_table[DIV_DCLK1] = clk_hw_register_divider(&pdev->dev, "div_dclk1",
285− "mux_dclk1", 0, s3c24xx_dclk->base,
286− 20, 4, 0, &s3c24xx_dclk->dclk_lock);
287−
288− clk_table[GATE_DCLK0] = clk_hw_register_gate(&pdev->dev, "gate_dclk0",
289− "div_dclk0", CLK_SET_RATE_PARENT,
290− s3c24xx_dclk->base, 0, 0,
291− &s3c24xx_dclk->dclk_lock);
292− clk_table[GATE_DCLK1] = clk_hw_register_gate(&pdev->dev, "gate_dclk1",
293− "div_dclk1", CLK_SET_RATE_PARENT,
294− s3c24xx_dclk->base, 16, 0,
295− &s3c24xx_dclk->dclk_lock);
296−
297− clk_table[MUX_CLKOUT0] = s3c24xx_register_clkout(&pdev->dev,
298− "clkout0", dclk_variant->clkout0_parent_names,
299− dclk_variant->clkout0_num_parents, 4, 7);
300− clk_table[MUX_CLKOUT1] = s3c24xx_register_clkout(&pdev->dev,
301− "clkout1", dclk_variant->clkout1_parent_names,
302− dclk_variant->clkout1_num_parents, 8, 7);
303−
304− for (i = 0; i < DCLK_MAX_CLKS; i++)
305− if (IS_ERR(clk_table[i])) {
306− dev_err(&pdev->dev, "clock %d failed to register\n", i);
307− ret = PTR_ERR(clk_table[i]);
308− goto err_clk_register;
309− }
310−
311− ret = clk_hw_register_clkdev(clk_table[MUX_DCLK0], "dclk0", NULL);
312− if (!ret)
313− ret = clk_hw_register_clkdev(clk_table[MUX_DCLK1], "dclk1",
314− NULL);
315− if (!ret)
316− ret = clk_hw_register_clkdev(clk_table[MUX_CLKOUT0],
317− "clkout0", NULL);
318− if (!ret)
319− ret = clk_hw_register_clkdev(clk_table[MUX_CLKOUT1],
320− "clkout1", NULL);
321− if (ret) {
322− dev_err(&pdev->dev, "failed to register aliases, %d\n", ret);
323− goto err_clk_register;
324− }
325−
326− s3c24xx_dclk->dclk0_div_change_nb.notifier_call =
327− s3c24xx_dclk0_div_notify;
328−
329− s3c24xx_dclk->dclk1_div_change_nb.notifier_call =
330− s3c24xx_dclk1_div_notify;
331−
332− ret = clk_notifier_register(clk_table[DIV_DCLK0]->clk,
333− &s3c24xx_dclk->dclk0_div_change_nb);
334− if (ret)
335− goto err_clk_register;
336−
337− ret = clk_notifier_register(clk_table[DIV_DCLK1]->clk,
338− &s3c24xx_dclk->dclk1_div_change_nb);
339− if (ret)
340− goto err_dclk_notify;
341−
342− return 0;
343−
344−err_dclk_notify:
345− clk_notifier_unregister(clk_table[DIV_DCLK0]->clk,
346− &s3c24xx_dclk->dclk0_div_change_nb);
347−err_clk_register:
348− for (i = 0; i < DCLK_MAX_CLKS; i++)
349− if (clk_table[i] && !IS_ERR(clk_table[i]))
350− clk_hw_unregister(clk_table[i]);
351−
352− return ret;
353−}
354−
355−static int s3c24xx_dclk_remove(struct platform_device *pdev)
356−{
357− struct s3c24xx_dclk *s3c24xx_dclk = platform_get_drvdata(pdev);
358− struct clk_hw **clk_table = s3c24xx_dclk->clk_data.hws;
359− int i;
360−
361− clk_notifier_unregister(clk_table[DIV_DCLK1]->clk,
362− &s3c24xx_dclk->dclk1_div_change_nb);
363− clk_notifier_unregister(clk_table[DIV_DCLK0]->clk,
364− &s3c24xx_dclk->dclk0_div_change_nb);
365−
366− for (i = 0; i < DCLK_MAX_CLKS; i++)
367− clk_hw_unregister(clk_table[i]);
368−
369− return 0;
370−}
371−
372−static struct s3c24xx_dclk_drv_data dclk_variants[] = {
373− [S3C2410] = {
374− .clkout0_parent_names = clkout0_s3c2410_p,
375− .clkout0_num_parents = ARRAY_SIZE(clkout0_s3c2410_p),
376− .clkout1_parent_names = clkout1_s3c2410_p,
377− .clkout1_num_parents = ARRAY_SIZE(clkout1_s3c2410_p),
378− .mux_parent_names = dclk_s3c2410_p,
379− .mux_num_parents = ARRAY_SIZE(dclk_s3c2410_p),
380− },
381− [S3C2412] = {
382− .clkout0_parent_names = clkout0_s3c2412_p,
383− .clkout0_num_parents = ARRAY_SIZE(clkout0_s3c2412_p),
384− .clkout1_parent_names = clkout1_s3c2412_p,
385− .clkout1_num_parents = ARRAY_SIZE(clkout1_s3c2412_p),
386− .mux_parent_names = dclk_s3c2410_p,
387− .mux_num_parents = ARRAY_SIZE(dclk_s3c2410_p),
388− },
389− [S3C2440] = {
390− .clkout0_parent_names = clkout0_s3c2440_p,
391− .clkout0_num_parents = ARRAY_SIZE(clkout0_s3c2440_p),
392− .clkout1_parent_names = clkout1_s3c2440_p,
393− .clkout1_num_parents = ARRAY_SIZE(clkout1_s3c2440_p),
394− .mux_parent_names = dclk_s3c2410_p,
395− .mux_num_parents = ARRAY_SIZE(dclk_s3c2410_p),
396− },
397− [S3C2443] = {
398− .clkout0_parent_names = clkout0_s3c2443_p,
399− .clkout0_num_parents = ARRAY_SIZE(clkout0_s3c2443_p),
400− .clkout1_parent_names = clkout1_s3c2443_p,
401− .clkout1_num_parents = ARRAY_SIZE(clkout1_s3c2443_p),
402− .mux_parent_names = dclk_s3c2443_p,
403− .mux_num_parents = ARRAY_SIZE(dclk_s3c2443_p),
404− },
405−};
406−
407−static const struct platform_device_id s3c24xx_dclk_driver_ids[] = {
408− {
409− .name = "s3c2410-dclk",
410− .driver_data = (kernel_ulong_t)&dclk_variants[S3C2410],
411− }, {
412− .name = "s3c2412-dclk",
413− .driver_data = (kernel_ulong_t)&dclk_variants[S3C2412],
414− }, {
415− .name = "s3c2440-dclk",
416− .driver_data = (kernel_ulong_t)&dclk_variants[S3C2440],
417− }, {
418− .name = "s3c2443-dclk",
419− .driver_data = (kernel_ulong_t)&dclk_variants[S3C2443],
420− },
421− { }
422−};
423−
424−MODULE_DEVICE_TABLE(platform, s3c24xx_dclk_driver_ids);
425−
426−static struct platform_driver s3c24xx_dclk_driver = {
427− .driver = {
428− .name = "s3c24xx-dclk",
429− .pm = &s3c24xx_dclk_pm_ops,
430− .suppress_bind_attrs = true,
431− },
432− .probe = s3c24xx_dclk_probe,
433− .remove = s3c24xx_dclk_remove,
434− .id_table = s3c24xx_dclk_driver_ids,
435−};
436−module_platform_driver(s3c24xx_dclk_driver);
437−
438−MODULE_LICENSE("GPL v2");
439−MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>");
440−MODULE_DESCRIPTION("Driver for the S3C24XX external clock outputs");
drivers/clk/samsung/clk-s3c2410.c+0−446
@@ -1,446 +0,0 @@
1−// SPDX-License-Identifier: GPL-2.0-only
2−/*
3− * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
4− *
5− * Common Clock Framework support for S3C2410 and following SoCs.
6− */
7−
8−#include <linux/clk-provider.h>
9−#include <linux/clk/samsung.h>
10−#include <linux/of.h>
11−#include <linux/of_address.h>
12−
13−#include <dt-bindings/clock/s3c2410.h>
14−
15−#include "clk.h"
16−#include "clk-pll.h"
17−
18−#define LOCKTIME 0x00
19−#define MPLLCON 0x04
20−#define UPLLCON 0x08
21−#define CLKCON 0x0c
22−#define CLKSLOW 0x10
23−#define CLKDIVN 0x14
24−#define CAMDIVN 0x18
25−
26−/* the soc types */
27−enum supported_socs {
28− S3C2410,
29− S3C2440,
30− S3C2442,
31−};
32−
33−/* list of PLLs to be registered */
34−enum s3c2410_plls {
35− mpll, upll,
36−};
37−
38−static void __iomem *reg_base;
39−
40−/*
41− * list of controller registers to be saved and restored during a
42− * suspend/resume cycle.
43− */
44−static unsigned long s3c2410_clk_regs[] __initdata = {
45− LOCKTIME,
46− MPLLCON,
47− UPLLCON,
48− CLKCON,
49− CLKSLOW,
50− CLKDIVN,
51− CAMDIVN,
52−};
53−
54−PNAME(fclk_p) = { "mpll", "div_slow" };
55−
56−static struct samsung_mux_clock s3c2410_common_muxes[] __initdata = {
57− MUX(FCLK, "fclk", fclk_p, CLKSLOW, 4, 1),
58−};
59−
60−static struct clk_div_table divslow_d[] = {
61− { .val = 0, .div = 1 },
62− { .val = 1, .div = 2 },
63− { .val = 2, .div = 4 },
64− { .val = 3, .div = 6 },
65− { .val = 4, .div = 8 },
66− { .val = 5, .div = 10 },
67− { .val = 6, .div = 12 },
68− { .val = 7, .div = 14 },
69− { /* sentinel */ },
70−};
71−
72−static struct samsung_div_clock s3c2410_common_dividers[] __initdata = {
73− DIV_T(0, "div_slow", "xti", CLKSLOW, 0, 3, divslow_d),
74− DIV(PCLK, "pclk", "hclk", CLKDIVN, 0, 1),
75−};
76−
77−static struct samsung_gate_clock s3c2410_common_gates[] __initdata = {
78− GATE(PCLK_SPI, "spi", "pclk", CLKCON, 18, 0, 0),
79− GATE(PCLK_I2S, "i2s", "pclk", CLKCON, 17, 0, 0),
80− GATE(PCLK_I2C, "i2c", "pclk", CLKCON, 16, 0, 0),
81− GATE(PCLK_ADC, "adc", "pclk", CLKCON, 15, 0, 0),
82− GATE(PCLK_RTC, "rtc", "pclk", CLKCON, 14, 0, 0),
83− GATE(PCLK_GPIO, "gpio", "pclk", CLKCON, 13, CLK_IGNORE_UNUSED, 0),
84− GATE(PCLK_UART2, "uart2", "pclk", CLKCON, 12, 0, 0),
85− GATE(PCLK_UART1, "uart1", "pclk", CLKCON, 11, 0, 0),
86− GATE(PCLK_UART0, "uart0", "pclk", CLKCON, 10, 0, 0),
87− GATE(PCLK_SDI, "sdi", "pclk", CLKCON, 9, 0, 0),
88− GATE(PCLK_PWM, "pwm", "pclk", CLKCON, 8, 0, 0),
89− GATE(HCLK_USBD, "usb-device", "hclk", CLKCON, 7, 0, 0),
90− GATE(HCLK_USBH, "usb-host", "hclk", CLKCON, 6, 0, 0),
91− GATE(HCLK_LCD, "lcd", "hclk", CLKCON, 5, 0, 0),
92− GATE(HCLK_NAND, "nand", "hclk", CLKCON, 4, 0, 0),
93−};
94−
95−/* should be added _after_ the soc-specific clocks are created */
96−static struct samsung_clock_alias s3c2410_common_aliases[] __initdata = {
97− ALIAS(PCLK_I2C, "s3c2410-i2c.0", "i2c"),
98− ALIAS(PCLK_ADC, NULL, "adc"),
99− ALIAS(PCLK_RTC, NULL, "rtc"),
100− ALIAS(PCLK_PWM, NULL, "timers"),
101− ALIAS(HCLK_LCD, NULL, "lcd"),
102− ALIAS(HCLK_USBD, NULL, "usb-device"),
103− ALIAS(HCLK_USBH, NULL, "usb-host"),
104− ALIAS(UCLK, NULL, "usb-bus-host"),
105− ALIAS(UCLK, NULL, "usb-bus-gadget"),
106− ALIAS(ARMCLK, NULL, "armclk"),
107− ALIAS(UCLK, NULL, "uclk"),
108− ALIAS(HCLK, NULL, "hclk"),
109− ALIAS(MPLL, NULL, "mpll"),
110− ALIAS(FCLK, NULL, "fclk"),
111− ALIAS(PCLK, NULL, "watchdog"),
112− ALIAS(PCLK_SDI, NULL, "sdi"),
113− ALIAS(HCLK_NAND, NULL, "nand"),
114− ALIAS(PCLK_I2S, NULL, "iis"),
115− ALIAS(PCLK_I2C, NULL, "i2c"),
116−};
117−
118−/* S3C2410 specific clocks */
119−
120−static struct samsung_pll_rate_table pll_s3c2410_12mhz_tbl[] __initdata = {
121− /* sorted in descending order */
122− /* 2410A extras */
123− PLL_S3C2410_MPLL_RATE(12 * MHZ, 270000000, 127, 1, 1),
124− PLL_S3C2410_MPLL_RATE(12 * MHZ, 268000000, 126, 1, 1),
125− PLL_S3C2410_MPLL_RATE(12 * MHZ, 266000000, 125, 1, 1),
126− PLL_S3C2410_MPLL_RATE(12 * MHZ, 226000000, 105, 1, 1),
127− PLL_S3C2410_MPLL_RATE(12 * MHZ, 210000000, 132, 2, 1),
128− /* 2410 common */
129− PLL_S3C2410_MPLL_RATE(12 * MHZ, 202800000, 161, 3, 1),
130− PLL_S3C2410_MPLL_RATE(12 * MHZ, 192000000, 88, 1, 1),
131− PLL_S3C2410_MPLL_RATE(12 * MHZ, 186000000, 85, 1, 1),
132− PLL_S3C2410_MPLL_RATE(12 * MHZ, 180000000, 82, 1, 1),
133− PLL_S3C2410_MPLL_RATE(12 * MHZ, 170000000, 77, 1, 1),
134− PLL_S3C2410_MPLL_RATE(12 * MHZ, 158000000, 71, 1, 1),
135− PLL_S3C2410_MPLL_RATE(12 * MHZ, 152000000, 68, 1, 1),
136− PLL_S3C2410_MPLL_RATE(12 * MHZ, 147000000, 90, 2, 1),
137− PLL_S3C2410_MPLL_RATE(12 * MHZ, 135000000, 82, 2, 1),
138− PLL_S3C2410_MPLL_RATE(12 * MHZ, 124000000, 116, 1, 2),
139− PLL_S3C2410_MPLL_RATE(12 * MHZ, 118500000, 150, 2, 2),
140− PLL_S3C2410_MPLL_RATE(12 * MHZ, 113000000, 105, 1, 2),
141− PLL_S3C2410_MPLL_RATE(12 * MHZ, 101250000, 127, 2, 2),
142− PLL_S3C2410_MPLL_RATE(12 * MHZ, 90000000, 112, 2, 2),
143− PLL_S3C2410_MPLL_RATE(12 * MHZ, 84750000, 105, 2, 2),
144− PLL_S3C2410_MPLL_RATE(12 * MHZ, 79000000, 71, 1, 2),
145− PLL_S3C2410_MPLL_RATE(12 * MHZ, 67500000, 82, 2, 2),
146− PLL_S3C2410_MPLL_RATE(12 * MHZ, 56250000, 142, 2, 3),
147− PLL_S3C2410_MPLL_RATE(12 * MHZ, 48000000, 120, 2, 3),
148− PLL_S3C2410_MPLL_RATE(12 * MHZ, 50700000, 161, 3, 3),
149− PLL_S3C2410_MPLL_RATE(12 * MHZ, 45000000, 82, 1, 3),
150− PLL_S3C2410_MPLL_RATE(12 * MHZ, 33750000, 82, 2, 3),
151− { /* sentinel */ },
152−};
153−
154−static struct samsung_pll_clock s3c2410_plls[] __initdata = {
155− [mpll] = PLL(pll_s3c2410_mpll, MPLL, "mpll", "xti",
156− LOCKTIME, MPLLCON, NULL),
157− [upll] = PLL(pll_s3c2410_upll, UPLL, "upll", "xti",
158− LOCKTIME, UPLLCON, NULL),
159−};
160−
161−static struct samsung_div_clock s3c2410_dividers[] __initdata = {
162− DIV(HCLK, "hclk", "mpll", CLKDIVN, 1, 1),
163−};
164−
165−static struct samsung_fixed_factor_clock s3c2410_ffactor[] __initdata = {
166− /*
167− * armclk is directly supplied by the fclk, without
168− * switching possibility like on the s3c244x below.
169− */
170− FFACTOR(ARMCLK, "armclk", "fclk", 1, 1, 0),
171−
172− /* uclk is fed from the unmodified upll */
173− FFACTOR(UCLK, "uclk", "upll", 1, 1, 0),
174−};
175−
176−static struct samsung_clock_alias s3c2410_aliases[] __initdata = {
177− ALIAS(PCLK_UART0, "s3c2410-uart.0", "uart"),
178− ALIAS(PCLK_UART1, "s3c2410-uart.1", "uart"),
179− ALIAS(PCLK_UART2, "s3c2410-uart.2", "uart"),
180− ALIAS(PCLK_UART0, "s3c2410-uart.0", "clk_uart_baud0"),
181− ALIAS(PCLK_UART1, "s3c2410-uart.1", "clk_uart_baud0"),
182− ALIAS(PCLK_UART2, "s3c2410-uart.2", "clk_uart_baud0"),
183− ALIAS(UCLK, NULL, "clk_uart_baud1"),
184−};
185−
186−/* S3C244x specific clocks */
187−
188−static struct samsung_pll_rate_table pll_s3c244x_12mhz_tbl[] __initdata = {
189− /* sorted in descending order */
190− PLL_S3C2440_MPLL_RATE(12 * MHZ, 400000000, 0x5c, 1, 1),
191− PLL_S3C2440_MPLL_RATE(12 * MHZ, 390000000, 0x7a, 2, 1),
192− PLL_S3C2440_MPLL_RATE(12 * MHZ, 380000000, 0x57, 1, 1),
193− PLL_S3C2440_MPLL_RATE(12 * MHZ, 370000000, 0xb1, 4, 1),
194− PLL_S3C2440_MPLL_RATE(12 * MHZ, 360000000, 0x70, 2, 1),
195− PLL_S3C2440_MPLL_RATE(12 * MHZ, 350000000, 0xa7, 4, 1),
196− PLL_S3C2440_MPLL_RATE(12 * MHZ, 340000000, 0x4d, 1, 1),
197− PLL_S3C2440_MPLL_RATE(12 * MHZ, 330000000, 0x66, 2, 1),
198− PLL_S3C2440_MPLL_RATE(12 * MHZ, 320000000, 0x98, 4, 1),
199− PLL_S3C2440_MPLL_RATE(12 * MHZ, 310000000, 0x93, 4, 1),
200− PLL_S3C2440_MPLL_RATE(12 * MHZ, 300000000, 0x75, 3, 1),
201− PLL_S3C2440_MPLL_RATE(12 * MHZ, 240000000, 0x70, 1, 2),
202− PLL_S3C2440_MPLL_RATE(12 * MHZ, 230000000, 0x6b, 1, 2),
203− PLL_S3C2440_MPLL_RATE(12 * MHZ, 220000000, 0x66, 1, 2),
204− PLL_S3C2440_MPLL_RATE(12 * MHZ, 210000000, 0x84, 2, 2),
205− PLL_S3C2440_MPLL_RATE(12 * MHZ, 200000000, 0x5c, 1, 2),
206− PLL_S3C2440_MPLL_RATE(12 * MHZ, 190000000, 0x57, 1, 2),
207− PLL_S3C2440_MPLL_RATE(12 * MHZ, 180000000, 0x70, 2, 2),
208− PLL_S3C2440_MPLL_RATE(12 * MHZ, 170000000, 0x4d, 1, 2),
209− PLL_S3C2440_MPLL_RATE(12 * MHZ, 160000000, 0x98, 4, 2),
210− PLL_S3C2440_MPLL_RATE(12 * MHZ, 150000000, 0x75, 3, 2),
211− PLL_S3C2440_MPLL_RATE(12 * MHZ, 120000000, 0x70, 1, 3),
212− PLL_S3C2440_MPLL_RATE(12 * MHZ, 110000000, 0x66, 1, 3),
213− PLL_S3C2440_MPLL_RATE(12 * MHZ, 100000000, 0x5c, 1, 3),
214− PLL_S3C2440_MPLL_RATE(12 * MHZ, 90000000, 0x70, 2, 3),
215− PLL_S3C2440_MPLL_RATE(12 * MHZ, 80000000, 0x98, 4, 3),
216− PLL_S3C2440_MPLL_RATE(12 * MHZ, 75000000, 0x75, 3, 3),
217− { /* sentinel */ },
218−};
219−
220−static struct samsung_pll_clock s3c244x_common_plls[] __initdata = {
221− [mpll] = PLL(pll_s3c2440_mpll, MPLL, "mpll", "xti",
222− LOCKTIME, MPLLCON, NULL),
223− [upll] = PLL(pll_s3c2410_upll, UPLL, "upll", "xti",
224− LOCKTIME, UPLLCON, NULL),
225−};
226−
227−PNAME(hclk_p) = { "fclk", "div_hclk_2", "div_hclk_4", "div_hclk_3" };
228−PNAME(armclk_p) = { "fclk", "hclk" };
229−
230−static struct samsung_mux_clock s3c244x_common_muxes[] __initdata = {
231− MUX(HCLK, "hclk", hclk_p, CLKDIVN, 1, 2),
232− MUX(ARMCLK, "armclk", armclk_p, CAMDIVN, 12, 1),
233−};
234−
235−static struct samsung_fixed_factor_clock s3c244x_common_ffactor[] __initdata = {
236− FFACTOR(0, "div_hclk_2", "fclk", 1, 2, 0),
237− FFACTOR(0, "ff_cam", "div_cam", 2, 1, CLK_SET_RATE_PARENT),
238−};
239−
240−static struct clk_div_table div_hclk_4_d[] = {
241− { .val = 0, .div = 4 },
242− { .val = 1, .div = 8 },
243− { /* sentinel */ },
244−};
245−
246−static struct clk_div_table div_hclk_3_d[] = {
247− { .val = 0, .div = 3 },
248− { .val = 1, .div = 6 },
249− { /* sentinel */ },
250−};
251−
252−static struct samsung_div_clock s3c244x_common_dividers[] __initdata = {
253− DIV(UCLK, "uclk", "upll", CLKDIVN, 3, 1),
254− DIV(0, "div_hclk", "fclk", CLKDIVN, 1, 1),
255− DIV_T(0, "div_hclk_4", "fclk", CAMDIVN, 9, 1, div_hclk_4_d),
256− DIV_T(0, "div_hclk_3", "fclk", CAMDIVN, 8, 1, div_hclk_3_d),
257− DIV(0, "div_cam", "upll", CAMDIVN, 0, 3),
258−};
259−
260−static struct samsung_gate_clock s3c244x_common_gates[] __initdata = {
261− GATE(HCLK_CAM, "cam", "hclk", CLKCON, 19, 0, 0),
262−};
263−
264−static struct samsung_clock_alias s3c244x_common_aliases[] __initdata = {
265− ALIAS(PCLK_UART0, "s3c2440-uart.0", "uart"),
266− ALIAS(PCLK_UART1, "s3c2440-uart.1", "uart"),
267− ALIAS(PCLK_UART2, "s3c2440-uart.2", "uart"),
268− ALIAS(PCLK_UART0, "s3c2440-uart.0", "clk_uart_baud2"),
269− ALIAS(PCLK_UART1, "s3c2440-uart.1", "clk_uart_baud2"),
270− ALIAS(PCLK_UART2, "s3c2440-uart.2", "clk_uart_baud2"),
271− ALIAS(HCLK_CAM, NULL, "camif"),
272− ALIAS(CAMIF, NULL, "camif-upll"),
273−};
274−
275−/* S3C2440 specific clocks */
276−
277−PNAME(s3c2440_camif_p) = { "upll", "ff_cam" };
278−
279−static struct samsung_mux_clock s3c2440_muxes[] __initdata = {
280− MUX(CAMIF, "camif", s3c2440_camif_p, CAMDIVN, 4, 1),
281−};
282−
283−static struct samsung_gate_clock s3c2440_gates[] __initdata = {
284− GATE(PCLK_AC97, "ac97", "pclk", CLKCON, 20, 0, 0),
285−};
286−
287−/* S3C2442 specific clocks */
288−
289−static struct samsung_fixed_factor_clock s3c2442_ffactor[] __initdata = {
290− FFACTOR(0, "upll_3", "upll", 1, 3, 0),
291−};
292−
293−PNAME(s3c2442_camif_p) = { "upll", "ff_cam", "upll", "upll_3" };
294−
295−static struct samsung_mux_clock s3c2442_muxes[] __initdata = {
296− MUX(CAMIF, "camif", s3c2442_camif_p, CAMDIVN, 4, 2),
297−};
298−
299−/*
300− * fixed rate clocks generated outside the soc
301− * Only necessary until the devicetree-move is complete
302− */
303−#define XTI 1
304−static struct samsung_fixed_rate_clock s3c2410_common_frate_clks[] __initdata = {
305− FRATE(XTI, "xti", NULL, 0, 0),
306−};
307−
308−static void __init s3c2410_common_clk_register_fixed_ext(
309− struct samsung_clk_provider *ctx,
310− unsigned long xti_f)
311−{
312− struct samsung_clock_alias xti_alias = ALIAS(XTI, NULL, "xtal");
313−
314− s3c2410_common_frate_clks[0].fixed_rate = xti_f;
315− samsung_clk_register_fixed_rate(ctx, s3c2410_common_frate_clks,
316− ARRAY_SIZE(s3c2410_common_frate_clks));
317−
318− samsung_clk_register_alias(ctx, &xti_alias, 1);
319−}
320−
321−void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f,
322− int current_soc,
323− void __iomem *base)
324−{
325− struct samsung_clk_provider *ctx;
326− struct clk_hw **hws;
327− reg_base = base;
328−
329− if (np) {
330− reg_base = of_iomap(np, 0);
331− if (!reg_base)
332− panic("%s: failed to map registers\n", __func__);
333− }
334−
335− ctx = samsung_clk_init(np, reg_base, NR_CLKS);
336− hws = ctx->clk_data.hws;
337−
338− /* Register external clocks only in non-dt cases */
339− if (!np)
340− s3c2410_common_clk_register_fixed_ext(ctx, xti_f);
341−
342− if (current_soc == S3C2410) {
343− if (clk_hw_get_rate(hws[XTI]) == 12 * MHZ) {
344− s3c2410_plls[mpll].rate_table = pll_s3c2410_12mhz_tbl;
345− s3c2410_plls[upll].rate_table = pll_s3c2410_12mhz_tbl;
346− }
347−
348− /* Register PLLs. */
349− samsung_clk_register_pll(ctx, s3c2410_plls,
350− ARRAY_SIZE(s3c2410_plls), reg_base);
351−
352− } else { /* S3C2440, S3C2442 */
353− if (clk_hw_get_rate(hws[XTI]) == 12 * MHZ) {
354− /*
355− * plls follow different calculation schemes, with the
356− * upll following the same scheme as the s3c2410 plls
357− */
358− s3c244x_common_plls[mpll].rate_table =
359− pll_s3c244x_12mhz_tbl;
360− s3c244x_common_plls[upll].rate_table =
361− pll_s3c2410_12mhz_tbl;
362− }
363−
364− /* Register PLLs. */
365− samsung_clk_register_pll(ctx, s3c244x_common_plls,
366− ARRAY_SIZE(s3c244x_common_plls), reg_base);
367− }
368−
369− /* Register common internal clocks. */
370− samsung_clk_register_mux(ctx, s3c2410_common_muxes,
371− ARRAY_SIZE(s3c2410_common_muxes));
372− samsung_clk_register_div(ctx, s3c2410_common_dividers,
373− ARRAY_SIZE(s3c2410_common_dividers));
374− samsung_clk_register_gate(ctx, s3c2410_common_gates,
375− ARRAY_SIZE(s3c2410_common_gates));
376−
377− if (current_soc == S3C2440 || current_soc == S3C2442) {
378− samsung_clk_register_div(ctx, s3c244x_common_dividers,
379− ARRAY_SIZE(s3c244x_common_dividers));
380− samsung_clk_register_gate(ctx, s3c244x_common_gates,
381− ARRAY_SIZE(s3c244x_common_gates));
382− samsung_clk_register_mux(ctx, s3c244x_common_muxes,
383− ARRAY_SIZE(s3c244x_common_muxes));
384− samsung_clk_register_fixed_factor(ctx, s3c244x_common_ffactor,
385− ARRAY_SIZE(s3c244x_common_ffactor));
386− }
387−
388− /* Register SoC-specific clocks. */
389− switch (current_soc) {
390− case S3C2410:
391− samsung_clk_register_div(ctx, s3c2410_dividers,
392− ARRAY_SIZE(s3c2410_dividers));
393− samsung_clk_register_fixed_factor(ctx, s3c2410_ffactor,
394− ARRAY_SIZE(s3c2410_ffactor));
395− samsung_clk_register_alias(ctx, s3c2410_aliases,
396− ARRAY_SIZE(s3c2410_aliases));
397− break;
398− case S3C2440:
399− samsung_clk_register_mux(ctx, s3c2440_muxes,
400− ARRAY_SIZE(s3c2440_muxes));
401− samsung_clk_register_gate(ctx, s3c2440_gates,
402− ARRAY_SIZE(s3c2440_gates));
403− break;
404− case S3C2442:
405− samsung_clk_register_mux(ctx, s3c2442_muxes,
406− ARRAY_SIZE(s3c2442_muxes));
407− samsung_clk_register_fixed_factor(ctx, s3c2442_ffactor,
408− ARRAY_SIZE(s3c2442_ffactor));
409− break;
410− }
411−
412− /*
413− * Register common aliases at the end, as some of the aliased clocks
414− * are SoC specific.
415− */
416− samsung_clk_register_alias(ctx, s3c2410_common_aliases,
417− ARRAY_SIZE(s3c2410_common_aliases));
418−
419− if (current_soc == S3C2440 || current_soc == S3C2442) {
420− samsung_clk_register_alias(ctx, s3c244x_common_aliases,
421− ARRAY_SIZE(s3c244x_common_aliases));
422− }
423−
424− samsung_clk_sleep_init(reg_base, s3c2410_clk_regs,
425− ARRAY_SIZE(s3c2410_clk_regs));
426−
427− samsung_clk_of_add_provider(np, ctx);
428−}
429−
430−static void __init s3c2410_clk_init(struct device_node *np)
431−{
432− s3c2410_common_clk_init(np, 0, S3C2410, NULL);
433−}
434−CLK_OF_DECLARE(s3c2410_clk, "samsung,s3c2410-clock", s3c2410_clk_init);
435−
436−static void __init s3c2440_clk_init(struct device_node *np)
437−{
438− s3c2410_common_clk_init(np, 0, S3C2440, NULL);
439−}
440−CLK_OF_DECLARE(s3c2440_clk, "samsung,s3c2440-clock", s3c2440_clk_init);
441−
442−static void __init s3c2442_clk_init(struct device_node *np)
443−{
444− s3c2410_common_clk_init(np, 0, S3C2442, NULL);
445−}
446−CLK_OF_DECLARE(s3c2442_clk, "samsung,s3c2442-clock", s3c2442_clk_init);
drivers/clk/samsung/clk-s3c2412.c+0−254
@@ -1,254 +0,0 @@
1−// SPDX-License-Identifier: GPL-2.0-only
2−/*
3− * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
4− *
5− * Common Clock Framework support for S3C2412 and S3C2413.
6− */
7−
8−#include <linux/clk-provider.h>
9−#include <linux/clk/samsung.h>
10−#include <linux/io.h>
11−#include <linux/of.h>
12−#include <linux/of_address.h>
13−#include <linux/reboot.h>
14−
15−#include <dt-bindings/clock/s3c2412.h>
16−
17−#include "clk.h"
18−#include "clk-pll.h"
19−
20−#define LOCKTIME 0x00
21−#define MPLLCON 0x04
22−#define UPLLCON 0x08
23−#define CLKCON 0x0c
24−#define CLKDIVN 0x14
25−#define CLKSRC 0x1c
26−#define SWRST 0x30
27−
28−static void __iomem *reg_base;
29−
30−/*
31− * list of controller registers to be saved and restored during a
32− * suspend/resume cycle.
33− */
34−static unsigned long s3c2412_clk_regs[] __initdata = {
35− LOCKTIME,
36− MPLLCON,
37− UPLLCON,
38− CLKCON,
39− CLKDIVN,
40− CLKSRC,
41−};
42−
43−static struct clk_div_table divxti_d[] = {
44− { .val = 0, .div = 1 },
45− { .val = 1, .div = 2 },
46− { .val = 2, .div = 4 },
47− { .val = 3, .div = 6 },
48− { .val = 4, .div = 8 },
49− { .val = 5, .div = 10 },
50− { .val = 6, .div = 12 },
51− { .val = 7, .div = 14 },
52− { /* sentinel */ },
53−};
54−
55−static struct samsung_div_clock s3c2412_dividers[] __initdata = {
56− DIV_T(0, "div_xti", "xti", CLKSRC, 0, 3, divxti_d),
57− DIV(0, "div_cam", "mux_cam", CLKDIVN, 16, 4),
58− DIV(0, "div_i2s", "mux_i2s", CLKDIVN, 12, 4),
59− DIV(0, "div_uart", "mux_uart", CLKDIVN, 8, 4),
60− DIV(0, "div_usb", "mux_usb", CLKDIVN, 6, 1),
61− DIV(0, "div_hclk_half", "hclk", CLKDIVN, 5, 1),
62− DIV(ARMDIV, "armdiv", "msysclk", CLKDIVN, 3, 1),
63− DIV(PCLK, "pclk", "hclk", CLKDIVN, 2, 1),
64− DIV(HCLK, "hclk", "armdiv", CLKDIVN, 0, 2),
65−};
66−
67−static struct samsung_fixed_factor_clock s3c2412_ffactor[] __initdata = {
68− FFACTOR(0, "ff_hclk", "hclk", 2, 1, CLK_SET_RATE_PARENT),
69−};
70−
71−/*
72− * The first two use the OM[4] setting, which is not readable from
73− * software, so assume it is set to xti.
74− */
75−PNAME(erefclk_p) = { "xti", "xti", "xti", "ext" };
76−PNAME(urefclk_p) = { "xti", "xti", "xti", "ext" };
77−
78−PNAME(camclk_p) = { "usysclk", "hclk" };
79−PNAME(usbclk_p) = { "usysclk", "hclk" };
80−PNAME(i2sclk_p) = { "erefclk", "mpll" };
81−PNAME(uartclk_p) = { "erefclk", "mpll" };
82−PNAME(usysclk_p) = { "urefclk", "upll" };
83−PNAME(msysclk_p) = { "mdivclk", "mpll" };
84−PNAME(mdivclk_p) = { "xti", "div_xti" };
85−PNAME(armclk_p) = { "armdiv", "hclk" };
86−
87−static struct samsung_mux_clock s3c2412_muxes[] __initdata = {
88− MUX(0, "erefclk", erefclk_p, CLKSRC, 14, 2),
89− MUX(0, "urefclk", urefclk_p, CLKSRC, 12, 2),
90− MUX(0, "mux_cam", camclk_p, CLKSRC, 11, 1),
91− MUX(0, "mux_usb", usbclk_p, CLKSRC, 10, 1),
92− MUX(0, "mux_i2s", i2sclk_p, CLKSRC, 9, 1),
93− MUX(0, "mux_uart", uartclk_p, CLKSRC, 8, 1),
94− MUX(USYSCLK, "usysclk", usysclk_p, CLKSRC, 5, 1),
95− MUX(MSYSCLK, "msysclk", msysclk_p, CLKSRC, 4, 1),
96− MUX(MDIVCLK, "mdivclk", mdivclk_p, CLKSRC, 3, 1),
97− MUX(ARMCLK, "armclk", armclk_p, CLKDIVN, 4, 1),
98−};
99−
100−static struct samsung_pll_clock s3c2412_plls[] __initdata = {
101− PLL(pll_s3c2440_mpll, MPLL, "mpll", "xti", LOCKTIME, MPLLCON, NULL),
102− PLL(pll_s3c2410_upll, UPLL, "upll", "urefclk", LOCKTIME, UPLLCON, NULL),
103−};
104−
105−static struct samsung_gate_clock s3c2412_gates[] __initdata = {
106− GATE(PCLK_WDT, "wdt", "pclk", CLKCON, 28, 0, 0),
107− GATE(PCLK_SPI, "spi", "pclk", CLKCON, 27, 0, 0),
108− GATE(PCLK_I2S, "i2s", "pclk", CLKCON, 26, 0, 0),
109− GATE(PCLK_I2C, "i2c", "pclk", CLKCON, 25, 0, 0),
110− GATE(PCLK_ADC, "adc", "pclk", CLKCON, 24, 0, 0),
111− GATE(PCLK_RTC, "rtc", "pclk", CLKCON, 23, 0, 0),
112− GATE(PCLK_GPIO, "gpio", "pclk", CLKCON, 22, CLK_IGNORE_UNUSED, 0),
113− GATE(PCLK_UART2, "uart2", "pclk", CLKCON, 21, 0, 0),
114− GATE(PCLK_UART1, "uart1", "pclk", CLKCON, 20, 0, 0),
115− GATE(PCLK_UART0, "uart0", "pclk", CLKCON, 19, 0, 0),
116− GATE(PCLK_SDI, "sdi", "pclk", CLKCON, 18, 0, 0),
117− GATE(PCLK_PWM, "pwm", "pclk", CLKCON, 17, 0, 0),
118− GATE(PCLK_USBD, "usb-device", "pclk", CLKCON, 16, 0, 0),
119− GATE(SCLK_CAM, "sclk_cam", "div_cam", CLKCON, 15, 0, 0),
120− GATE(SCLK_UART, "sclk_uart", "div_uart", CLKCON, 14, 0, 0),
121− GATE(SCLK_I2S, "sclk_i2s", "div_i2s", CLKCON, 13, 0, 0),
122− GATE(SCLK_USBH, "sclk_usbh", "div_usb", CLKCON, 12, 0, 0),
123− GATE(SCLK_USBD, "sclk_usbd", "div_usb", CLKCON, 11, 0, 0),
124− GATE(HCLK_HALF, "hclk_half", "div_hclk_half", CLKCON, 10, CLK_IGNORE_UNUSED, 0),
125− GATE(HCLK_X2, "hclkx2", "ff_hclk", CLKCON, 9, CLK_IGNORE_UNUSED, 0),
126− GATE(HCLK_SDRAM, "sdram", "hclk", CLKCON, 8, CLK_IGNORE_UNUSED, 0),
127− GATE(HCLK_USBH, "usb-host", "hclk", CLKCON, 6, 0, 0),
128− GATE(HCLK_LCD, "lcd", "hclk", CLKCON, 5, 0, 0),
129− GATE(HCLK_NAND, "nand", "hclk", CLKCON, 4, 0, 0),
130− GATE(HCLK_DMA3, "dma3", "hclk", CLKCON, 3, CLK_IGNORE_UNUSED, 0),
131− GATE(HCLK_DMA2, "dma2", "hclk", CLKCON, 2, CLK_IGNORE_UNUSED, 0),
132− GATE(HCLK_DMA1, "dma1", "hclk", CLKCON, 1, CLK_IGNORE_UNUSED, 0),
133− GATE(HCLK_DMA0, "dma0", "hclk", CLKCON, 0, CLK_IGNORE_UNUSED, 0),
134−};
135−
136−static struct samsung_clock_alias s3c2412_aliases[] __initdata = {
137− ALIAS(PCLK_UART0, "s3c2412-uart.0", "uart"),
138− ALIAS(PCLK_UART1, "s3c2412-uart.1", "uart"),
139− ALIAS(PCLK_UART2, "s3c2412-uart.2", "uart"),
140− ALIAS(PCLK_UART0, "s3c2412-uart.0", "clk_uart_baud2"),
141− ALIAS(PCLK_UART1, "s3c2412-uart.1", "clk_uart_baud2"),
142− ALIAS(PCLK_UART2, "s3c2412-uart.2", "clk_uart_baud2"),
143− ALIAS(SCLK_UART, NULL, "clk_uart_baud3"),
144− ALIAS(PCLK_I2C, "s3c2410-i2c.0", "i2c"),
145− ALIAS(PCLK_ADC, NULL, "adc"),
146− ALIAS(PCLK_RTC, NULL, "rtc"),
147− ALIAS(PCLK_PWM, NULL, "timers"),
148− ALIAS(HCLK_LCD, NULL, "lcd"),
149− ALIAS(PCLK_USBD, NULL, "usb-device"),
150− ALIAS(SCLK_USBD, NULL, "usb-bus-gadget"),
151− ALIAS(HCLK_USBH, NULL, "usb-host"),
152− ALIAS(SCLK_USBH, NULL, "usb-bus-host"),
153− ALIAS(ARMCLK, NULL, "armclk"),
154− ALIAS(HCLK, NULL, "hclk"),
155− ALIAS(MPLL, NULL, "mpll"),
156− ALIAS(MSYSCLK, NULL, "fclk"),
157−};
158−
159−static int s3c2412_restart(struct notifier_block *this,
160− unsigned long mode, void *cmd)
161−{
162− /* errata "Watch-dog/Software Reset Problem" specifies that
163− * this reset must be done with the SYSCLK sourced from
164− * EXTCLK instead of FOUT to avoid a glitch in the reset
165− * mechanism.
166− *
167− * See the watchdog section of the S3C2412 manual for more
168− * information on this fix.
169− */
170−
171− __raw_writel(0x00, reg_base + CLKSRC);
172− __raw_writel(0x533C2412, reg_base + SWRST);
173− return NOTIFY_DONE;
174−}
175−
176−static struct notifier_block s3c2412_restart_handler = {
177− .notifier_call = s3c2412_restart,
178− .priority = 129,
179−};
180−
181−/*
182− * fixed rate clocks generated outside the soc
183− * Only necessary until the devicetree-move is complete
184− */
185−#define XTI 1
186−static struct samsung_fixed_rate_clock s3c2412_common_frate_clks[] __initdata = {
187− FRATE(XTI, "xti", NULL, 0, 0),
188− FRATE(0, "ext", NULL, 0, 0),
189−};
190−
191−static void __init s3c2412_common_clk_register_fixed_ext(
192− struct samsung_clk_provider *ctx,
193− unsigned long xti_f, unsigned long ext_f)
194−{
195− /* xtal alias is necessary for the current cpufreq driver */
196− struct samsung_clock_alias xti_alias = ALIAS(XTI, NULL, "xtal");
197−
198− s3c2412_common_frate_clks[0].fixed_rate = xti_f;
199− s3c2412_common_frate_clks[1].fixed_rate = ext_f;
200− samsung_clk_register_fixed_rate(ctx, s3c2412_common_frate_clks,
201− ARRAY_SIZE(s3c2412_common_frate_clks));
202−
203− samsung_clk_register_alias(ctx, &xti_alias, 1);
204−}
205−
206−void __init s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f,
207− unsigned long ext_f, void __iomem *base)
208−{
209− struct samsung_clk_provider *ctx;
210− int ret;
211− reg_base = base;
212−
213− if (np) {
214− reg_base = of_iomap(np, 0);
215− if (!reg_base)
216− panic("%s: failed to map registers\n", __func__);
217− }
218−
219− ctx = samsung_clk_init(np, reg_base, NR_CLKS);
220−
221− /* Register external clocks only in non-dt cases */
222− if (!np)
223− s3c2412_common_clk_register_fixed_ext(ctx, xti_f, ext_f);
224−
225− /* Register PLLs. */
226− samsung_clk_register_pll(ctx, s3c2412_plls, ARRAY_SIZE(s3c2412_plls),
227− reg_base);
228−
229− /* Register common internal clocks. */
230− samsung_clk_register_mux(ctx, s3c2412_muxes, ARRAY_SIZE(s3c2412_muxes));
231− samsung_clk_register_div(ctx, s3c2412_dividers,
232− ARRAY_SIZE(s3c2412_dividers));
233− samsung_clk_register_gate(ctx, s3c2412_gates,
234− ARRAY_SIZE(s3c2412_gates));
235− samsung_clk_register_fixed_factor(ctx, s3c2412_ffactor,
236− ARRAY_SIZE(s3c2412_ffactor));
237− samsung_clk_register_alias(ctx, s3c2412_aliases,
238− ARRAY_SIZE(s3c2412_aliases));
239−
240− samsung_clk_sleep_init(reg_base, s3c2412_clk_regs,
241− ARRAY_SIZE(s3c2412_clk_regs));
242−
243− samsung_clk_of_add_provider(np, ctx);
244−
245− ret = register_restart_handler(&s3c2412_restart_handler);
246− if (ret)
247− pr_warn("cannot register restart handler, %d\n", ret);
248−}
249−
250−static void __init s3c2412_clk_init(struct device_node *np)
251−{
252− s3c2412_common_clk_init(np, 0, 0, NULL);
253−}
254−CLK_OF_DECLARE(s3c2412_clk, "samsung,s3c2412-clock", s3c2412_clk_init);
drivers/clk/samsung/clk-s3c2443.c+0−438
@@ -1,438 +0,0 @@
1−// SPDX-License-Identifier: GPL-2.0-only
2−/*
3− * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
4− *
5− * Common Clock Framework support for S3C2443 and following SoCs.
6− */
7−
8−#include <linux/clk-provider.h>
9−#include <linux/clk/samsung.h>
10−#include <linux/io.h>
11−#include <linux/of.h>
12−#include <linux/of_address.h>
13−#include <linux/reboot.h>
14−
15−#include <dt-bindings/clock/s3c2443.h>
16−
17−#include "clk.h"
18−#include "clk-pll.h"
19−
20−/* S3C2416 clock controller register offsets */
21−#define LOCKCON0 0x00
22−#define LOCKCON1 0x04
23−#define MPLLCON 0x10
24−#define EPLLCON 0x18
25−#define EPLLCON_K 0x1C
26−#define CLKSRC 0x20
27−#define CLKDIV0 0x24
28−#define CLKDIV1 0x28
29−#define CLKDIV2 0x2C
30−#define HCLKCON 0x30
31−#define PCLKCON 0x34
32−#define SCLKCON 0x38
33−#define SWRST 0x44
34−
35−/* the soc types */
36−enum supported_socs {
37− S3C2416,
38− S3C2443,
39− S3C2450,
40−};
41−
42−static void __iomem *reg_base;
43−
44−/*
45− * list of controller registers to be saved and restored during a
46− * suspend/resume cycle.
47− */
48−static unsigned long s3c2443_clk_regs[] __initdata = {
49− LOCKCON0,
50− LOCKCON1,
51− MPLLCON,
52− EPLLCON,
53− EPLLCON_K,
54− CLKSRC,
55− CLKDIV0,
56− CLKDIV1,
57− CLKDIV2,
58− PCLKCON,
59− HCLKCON,
60− SCLKCON,
61−};
62−
63−PNAME(epllref_p) = { "mpllref", "mpllref", "xti", "ext" };
64−PNAME(esysclk_p) = { "epllref", "epll" };
65−PNAME(mpllref_p) = { "xti", "mdivclk" };
66−PNAME(msysclk_p) = { "mpllref", "mpll" };
67−PNAME(armclk_p) = { "armdiv" , "hclk" };
68−PNAME(i2s0_p) = { "div_i2s0", "ext_i2s", "epllref", "epllref" };
69−
70−static struct samsung_mux_clock s3c2443_common_muxes[] __initdata = {
71− MUX(0, "epllref", epllref_p, CLKSRC, 7, 2),
72− MUX(ESYSCLK, "esysclk", esysclk_p, CLKSRC, 6, 1),
73− MUX(0, "mpllref", mpllref_p, CLKSRC, 3, 1),
74− MUX(MSYSCLK, "msysclk", msysclk_p, CLKSRC, 4, 1),
75− MUX(ARMCLK, "armclk", armclk_p, CLKDIV0, 13, 1),
76− MUX(0, "mux_i2s0", i2s0_p, CLKSRC, 14, 2),
77−};
78−
79−static struct clk_div_table hclk_d[] = {
80− { .val = 0, .div = 1 },
81− { .val = 1, .div = 2 },
82− { .val = 3, .div = 4 },
83− { /* sentinel */ },
84−};
85−
86−static struct clk_div_table mdivclk_d[] = {
87− { .val = 0, .div = 1 },
88− { .val = 1, .div = 3 },
89− { .val = 2, .div = 5 },
90− { .val = 3, .div = 7 },
91− { .val = 4, .div = 9 },
92− { .val = 5, .div = 11 },
93− { .val = 6, .div = 13 },
94− { .val = 7, .div = 15 },
95− { /* sentinel */ },
96−};
97−
98−static struct samsung_div_clock s3c2443_common_dividers[] __initdata = {
99− DIV_T(0, "mdivclk", "xti", CLKDIV0, 6, 3, mdivclk_d),
100− DIV(0, "prediv", "msysclk", CLKDIV0, 4, 2),
101− DIV_T(HCLK, "hclk", "prediv", CLKDIV0, 0, 2, hclk_d),
102− DIV(PCLK, "pclk", "hclk", CLKDIV0, 2, 1),
103− DIV(0, "div_hsspi0_epll", "esysclk", CLKDIV1, 24, 2),
104− DIV(0, "div_fimd", "esysclk", CLKDIV1, 16, 8),
105− DIV(0, "div_i2s0", "esysclk", CLKDIV1, 12, 4),
106− DIV(0, "div_uart", "esysclk", CLKDIV1, 8, 4),
107− DIV(0, "div_hsmmc1", "esysclk", CLKDIV1, 6, 2),
108− DIV(0, "div_usbhost", "esysclk", CLKDIV1, 4, 2),
109−};
110−
111−static struct samsung_gate_clock s3c2443_common_gates[] __initdata = {
112− GATE(SCLK_HSMMC_EXT, "sclk_hsmmcext", "ext", SCLKCON, 13, 0, 0),
113− GATE(SCLK_HSMMC1, "sclk_hsmmc1", "div_hsmmc1", SCLKCON, 12, 0, 0),
114− GATE(SCLK_FIMD, "sclk_fimd", "div_fimd", SCLKCON, 10, 0, 0),
115− GATE(SCLK_I2S0, "sclk_i2s0", "mux_i2s0", SCLKCON, 9, 0, 0),
116− GATE(SCLK_UART, "sclk_uart", "div_uart", SCLKCON, 8, 0, 0),
117− GATE(SCLK_USBH, "sclk_usbhost", "div_usbhost", SCLKCON, 1, 0, 0),
118− GATE(HCLK_DRAM, "dram", "hclk", HCLKCON, 19, CLK_IGNORE_UNUSED, 0),
119− GATE(HCLK_SSMC, "ssmc", "hclk", HCLKCON, 18, CLK_IGNORE_UNUSED, 0),
120− GATE(HCLK_HSMMC1, "hsmmc1", "hclk", HCLKCON, 16, 0, 0),
121− GATE(HCLK_USBD, "usb-device", "hclk", HCLKCON, 12, 0, 0),
122− GATE(HCLK_USBH, "usb-host", "hclk", HCLKCON, 11, 0, 0),
123− GATE(HCLK_LCD, "lcd", "hclk", HCLKCON, 9, 0, 0),
124− GATE(HCLK_DMA5, "dma5", "hclk", HCLKCON, 5, CLK_IGNORE_UNUSED, 0),
125− GATE(HCLK_DMA4, "dma4", "hclk", HCLKCON, 4, CLK_IGNORE_UNUSED, 0),
126− GATE(HCLK_DMA3, "dma3", "hclk", HCLKCON, 3, CLK_IGNORE_UNUSED, 0),
127− GATE(HCLK_DMA2, "dma2", "hclk", HCLKCON, 2, CLK_IGNORE_UNUSED, 0),
128− GATE(HCLK_DMA1, "dma1", "hclk", HCLKCON, 1, CLK_IGNORE_UNUSED, 0),
129− GATE(HCLK_DMA0, "dma0", "hclk", HCLKCON, 0, CLK_IGNORE_UNUSED, 0),
130− GATE(PCLK_GPIO, "gpio", "pclk", PCLKCON, 13, CLK_IGNORE_UNUSED, 0),
131− GATE(PCLK_RTC, "rtc", "pclk", PCLKCON, 12, 0, 0),
132− GATE(PCLK_WDT, "wdt", "pclk", PCLKCON, 11, 0, 0),
133− GATE(PCLK_PWM, "pwm", "pclk", PCLKCON, 10, 0, 0),
134− GATE(PCLK_I2S0, "i2s0", "pclk", PCLKCON, 9, 0, 0),
135− GATE(PCLK_AC97, "ac97", "pclk", PCLKCON, 8, 0, 0),
136− GATE(PCLK_ADC, "adc", "pclk", PCLKCON, 7, 0, 0),
137− GATE(PCLK_SPI0, "spi0", "pclk", PCLKCON, 6, 0, 0),
138− GATE(PCLK_I2C0, "i2c0", "pclk", PCLKCON, 4, 0, 0),
139− GATE(PCLK_UART3, "uart3", "pclk", PCLKCON, 3, 0, 0),
140− GATE(PCLK_UART2, "uart2", "pclk", PCLKCON, 2, 0, 0),
141− GATE(PCLK_UART1, "uart1", "pclk", PCLKCON, 1, 0, 0),
142− GATE(PCLK_UART0, "uart0", "pclk", PCLKCON, 0, 0, 0),
143−};
144−
145−static struct samsung_clock_alias s3c2443_common_aliases[] __initdata = {
146− ALIAS(MSYSCLK, NULL, "msysclk"),
147− ALIAS(ARMCLK, NULL, "armclk"),
148− ALIAS(MPLL, NULL, "mpll"),
149− ALIAS(EPLL, NULL, "epll"),
150− ALIAS(HCLK, NULL, "hclk"),
151− ALIAS(HCLK_SSMC, NULL, "nand"),
152− ALIAS(PCLK_UART0, "s3c2440-uart.0", "uart"),
153− ALIAS(PCLK_UART1, "s3c2440-uart.1", "uart"),
154− ALIAS(PCLK_UART2, "s3c2440-uart.2", "uart"),
155− ALIAS(PCLK_UART3, "s3c2440-uart.3", "uart"),
156− ALIAS(PCLK_UART0, "s3c2440-uart.0", "clk_uart_baud2"),
157− ALIAS(PCLK_UART1, "s3c2440-uart.1", "clk_uart_baud2"),
158− ALIAS(PCLK_UART2, "s3c2440-uart.2", "clk_uart_baud2"),
159− ALIAS(PCLK_UART3, "s3c2440-uart.3", "clk_uart_baud2"),
160− ALIAS(SCLK_UART, NULL, "clk_uart_baud3"),
161− ALIAS(PCLK_PWM, NULL, "timers"),
162− ALIAS(PCLK_RTC, NULL, "rtc"),
163− ALIAS(PCLK_WDT, NULL, "watchdog"),
164− ALIAS(PCLK_ADC, NULL, "adc"),
165− ALIAS(PCLK_I2C0, "s3c2410-i2c.0", "i2c"),
166− ALIAS(HCLK_USBD, NULL, "usb-device"),
167− ALIAS(HCLK_USBH, NULL, "usb-host"),
168− ALIAS(SCLK_USBH, NULL, "usb-bus-host"),
169− ALIAS(PCLK_SPI0, "s3c2443-spi.0", "spi"),
170− ALIAS(PCLK_SPI0, "s3c2443-spi.0", "spi_busclk0"),
171− ALIAS(HCLK_HSMMC1, "s3c-sdhci.1", "hsmmc"),
172− ALIAS(HCLK_HSMMC1, "s3c-sdhci.1", "mmc_busclk.0"),
173− ALIAS(PCLK_I2S0, "samsung-i2s.0", "iis"),
174− ALIAS(SCLK_I2S0, NULL, "i2s-if"),
175− ALIAS(HCLK_LCD, NULL, "lcd"),
176− ALIAS(SCLK_FIMD, NULL, "sclk_fimd"),
177−};
178−
179−/* S3C2416 specific clocks */
180−
181−static struct samsung_pll_clock s3c2416_pll_clks[] __initdata = {
182− PLL(pll_6552_s3c2416, MPLL, "mpll", "mpllref", LOCKCON0, MPLLCON, NULL),
183− PLL(pll_6553, EPLL, "epll", "epllref", LOCKCON1, EPLLCON, NULL),
184−};
185−
186−PNAME(s3c2416_hsmmc0_p) = { "sclk_hsmmc0", "sclk_hsmmcext" };
187−PNAME(s3c2416_hsmmc1_p) = { "sclk_hsmmc1", "sclk_hsmmcext" };
188−PNAME(s3c2416_hsspi0_p) = { "hsspi0_epll", "hsspi0_mpll" };
189−
190−static struct clk_div_table armdiv_s3c2416_d[] = {
191− { .val = 0, .div = 1 },
192− { .val = 1, .div = 2 },
193− { .val = 2, .div = 3 },
194− { .val = 3, .div = 4 },
195− { .val = 5, .div = 6 },
196− { .val = 7, .div = 8 },
197− { /* sentinel */ },
198−};
199−
200−static struct samsung_div_clock s3c2416_dividers[] __initdata = {
201− DIV_T(ARMDIV, "armdiv", "msysclk", CLKDIV0, 9, 3, armdiv_s3c2416_d),
202− DIV(0, "div_hsspi0_mpll", "msysclk", CLKDIV2, 0, 4),
203− DIV(0, "div_hsmmc0", "esysclk", CLKDIV2, 6, 2),
204−};
205−
206−static struct samsung_mux_clock s3c2416_muxes[] __initdata = {
207− MUX(MUX_HSMMC0, "mux_hsmmc0", s3c2416_hsmmc0_p, CLKSRC, 16, 1),
208− MUX(MUX_HSMMC1, "mux_hsmmc1", s3c2416_hsmmc1_p, CLKSRC, 17, 1),
209− MUX(MUX_HSSPI0, "mux_hsspi0", s3c2416_hsspi0_p, CLKSRC, 18, 1),
210−};
211−
212−static struct samsung_gate_clock s3c2416_gates[] __initdata = {
213− GATE(0, "hsspi0_mpll", "div_hsspi0_mpll", SCLKCON, 19, 0, 0),
214− GATE(0, "hsspi0_epll", "div_hsspi0_epll", SCLKCON, 14, 0, 0),
215− GATE(0, "sclk_hsmmc0", "div_hsmmc0", SCLKCON, 6, 0, 0),
216− GATE(HCLK_2D, "2d", "hclk", HCLKCON, 20, 0, 0),
217− GATE(HCLK_HSMMC0, "hsmmc0", "hclk", HCLKCON, 15, 0, 0),
218− GATE(HCLK_IROM, "irom", "hclk", HCLKCON, 13, CLK_IGNORE_UNUSED, 0),
219− GATE(PCLK_PCM, "pcm", "pclk", PCLKCON, 19, 0, 0),
220−};
221−
222−static struct samsung_clock_alias s3c2416_aliases[] __initdata = {
223− ALIAS(HCLK_HSMMC0, "s3c-sdhci.0", "hsmmc"),
224− ALIAS(HCLK_HSMMC0, "s3c-sdhci.0", "mmc_busclk.0"),
225− ALIAS(MUX_HSMMC0, "s3c-sdhci.0", "mmc_busclk.2"),
226− ALIAS(MUX_HSMMC1, "s3c-sdhci.1", "mmc_busclk.2"),
227− ALIAS(MUX_HSSPI0, "s3c2443-spi.0", "spi_busclk2"),
228− ALIAS(ARMDIV, NULL, "armdiv"),
229−};
230−
231−/* S3C2443 specific clocks */
232−
233−static struct samsung_pll_clock s3c2443_pll_clks[] __initdata = {
234− PLL(pll_3000, MPLL, "mpll", "mpllref", LOCKCON0, MPLLCON, NULL),
235− PLL(pll_2126, EPLL, "epll", "epllref", LOCKCON1, EPLLCON, NULL),
236−};
237−
238−static struct clk_div_table armdiv_s3c2443_d[] = {
239− { .val = 0, .div = 1 },
240− { .val = 8, .div = 2 },
241− { .val = 2, .div = 3 },
242− { .val = 9, .div = 4 },
243− { .val = 10, .div = 6 },
244− { .val = 11, .div = 8 },
245− { .val = 13, .div = 12 },
246− { .val = 15, .div = 16 },
247− { /* sentinel */ },
248−};
249−
250−static struct samsung_div_clock s3c2443_dividers[] __initdata = {
251− DIV_T(ARMDIV, "armdiv", "msysclk", CLKDIV0, 9, 4, armdiv_s3c2443_d),
252− DIV(0, "div_cam", "esysclk", CLKDIV1, 26, 4),
253−};
254−
255−static struct samsung_gate_clock s3c2443_gates[] __initdata = {
256− GATE(SCLK_HSSPI0, "sclk_hsspi0", "div_hsspi0_epll", SCLKCON, 14, 0, 0),
257− GATE(SCLK_CAM, "sclk_cam", "div_cam", SCLKCON, 11, 0, 0),
258− GATE(HCLK_CFC, "cfc", "hclk", HCLKCON, 17, CLK_IGNORE_UNUSED, 0),
259− GATE(HCLK_CAM, "cam", "hclk", HCLKCON, 8, 0, 0),
260− GATE(PCLK_SPI1, "spi1", "pclk", PCLKCON, 15, 0, 0),
261− GATE(PCLK_SDI, "sdi", "pclk", PCLKCON, 5, 0, 0),
262−};
263−
264−static struct samsung_clock_alias s3c2443_aliases[] __initdata = {
265− ALIAS(SCLK_HSSPI0, "s3c2443-spi.0", "spi_busclk2"),
266− ALIAS(SCLK_HSMMC1, "s3c-sdhci.1", "mmc_busclk.2"),
267− ALIAS(SCLK_CAM, NULL, "camif-upll"),
268− ALIAS(PCLK_SPI1, "s3c2410-spi.0", "spi"),
269− ALIAS(PCLK_SDI, NULL, "sdi"),
270− ALIAS(HCLK_CFC, NULL, "cfc"),
271− ALIAS(ARMDIV, NULL, "armdiv"),
272−};
273−
274−/* S3C2450 specific clocks */
275−
276−PNAME(s3c2450_cam_p) = { "div_cam", "hclk" };
277−PNAME(s3c2450_hsspi1_p) = { "hsspi1_epll", "hsspi1_mpll" };
278−PNAME(i2s1_p) = { "div_i2s1", "ext_i2s", "epllref", "epllref" };
279−
280−static struct samsung_div_clock s3c2450_dividers[] __initdata = {
281− DIV(0, "div_cam", "esysclk", CLKDIV1, 26, 4),
282− DIV(0, "div_hsspi1_epll", "esysclk", CLKDIV2, 24, 2),
283− DIV(0, "div_hsspi1_mpll", "msysclk", CLKDIV2, 16, 4),
284− DIV(0, "div_i2s1", "esysclk", CLKDIV2, 12, 4),
285−};
286−
287−static struct samsung_mux_clock s3c2450_muxes[] __initdata = {
288− MUX(0, "mux_cam", s3c2450_cam_p, CLKSRC, 20, 1),
289− MUX(MUX_HSSPI1, "mux_hsspi1", s3c2450_hsspi1_p, CLKSRC, 19, 1),
290− MUX(0, "mux_i2s1", i2s1_p, CLKSRC, 12, 2),
291−};
292−
293−static struct samsung_gate_clock s3c2450_gates[] __initdata = {
294− GATE(SCLK_I2S1, "sclk_i2s1", "div_i2s1", SCLKCON, 5, 0, 0),
295− GATE(HCLK_CFC, "cfc", "hclk", HCLKCON, 17, 0, 0),
296− GATE(HCLK_CAM, "cam", "hclk", HCLKCON, 8, 0, 0),
297− GATE(HCLK_DMA7, "dma7", "hclk", HCLKCON, 7, CLK_IGNORE_UNUSED, 0),
298− GATE(HCLK_DMA6, "dma6", "hclk", HCLKCON, 6, CLK_IGNORE_UNUSED, 0),
299− GATE(PCLK_I2S1, "i2s1", "pclk", PCLKCON, 17, 0, 0),
300− GATE(PCLK_I2C1, "i2c1", "pclk", PCLKCON, 16, 0, 0),
301− GATE(PCLK_SPI1, "spi1", "pclk", PCLKCON, 14, 0, 0),
302−};
303−
304−static struct samsung_clock_alias s3c2450_aliases[] __initdata = {
305− ALIAS(PCLK_SPI1, "s3c2443-spi.1", "spi"),
306− ALIAS(PCLK_SPI1, "s3c2443-spi.1", "spi_busclk0"),
307− ALIAS(MUX_HSSPI1, "s3c2443-spi.1", "spi_busclk2"),
308− ALIAS(PCLK_I2C1, "s3c2410-i2c.1", "i2c"),
309−};
310−
311−static int s3c2443_restart(struct notifier_block *this,
312− unsigned long mode, void *cmd)
313−{
314− __raw_writel(0x533c2443, reg_base + SWRST);
315− return NOTIFY_DONE;
316−}
317−
318−static struct notifier_block s3c2443_restart_handler = {
319− .notifier_call = s3c2443_restart,
320− .priority = 129,
321−};
322−
323−/*
324− * fixed rate clocks generated outside the soc
325− * Only necessary until the devicetree-move is complete
326− */
327−static struct samsung_fixed_rate_clock s3c2443_common_frate_clks[] __initdata = {
328− FRATE(0, "xti", NULL, 0, 0),
329− FRATE(0, "ext", NULL, 0, 0),
330− FRATE(0, "ext_i2s", NULL, 0, 0),
331− FRATE(0, "ext_uart", NULL, 0, 0),
332−};
333−
334−static void __init s3c2443_common_clk_register_fixed_ext(
335− struct samsung_clk_provider *ctx, unsigned long xti_f)
336−{
337− s3c2443_common_frate_clks[0].fixed_rate = xti_f;
338− samsung_clk_register_fixed_rate(ctx, s3c2443_common_frate_clks,
339− ARRAY_SIZE(s3c2443_common_frate_clks));
340−}
341−
342−void __init s3c2443_common_clk_init(struct device_node *np, unsigned long xti_f,
343− int current_soc,
344− void __iomem *base)
345−{
346− struct samsung_clk_provider *ctx;
347− int ret;
348− reg_base = base;
349−
350− if (np) {
351− reg_base = of_iomap(np, 0);
352− if (!reg_base)
353− panic("%s: failed to map registers\n", __func__);
354− }
355−
356− ctx = samsung_clk_init(np, reg_base, NR_CLKS);
357−
358− /* Register external clocks only in non-dt cases */
359− if (!np)
360− s3c2443_common_clk_register_fixed_ext(ctx, xti_f);
361−
362− /* Register PLLs. */
363− if (current_soc == S3C2416 || current_soc == S3C2450)
364− samsung_clk_register_pll(ctx, s3c2416_pll_clks,
365− ARRAY_SIZE(s3c2416_pll_clks), reg_base);
366− else
367− samsung_clk_register_pll(ctx, s3c2443_pll_clks,
368− ARRAY_SIZE(s3c2443_pll_clks), reg_base);
369−
370− /* Register common internal clocks. */
371− samsung_clk_register_mux(ctx, s3c2443_common_muxes,
372− ARRAY_SIZE(s3c2443_common_muxes));
373− samsung_clk_register_div(ctx, s3c2443_common_dividers,
374− ARRAY_SIZE(s3c2443_common_dividers));
375− samsung_clk_register_gate(ctx, s3c2443_common_gates,
376− ARRAY_SIZE(s3c2443_common_gates));
377− samsung_clk_register_alias(ctx, s3c2443_common_aliases,
378− ARRAY_SIZE(s3c2443_common_aliases));
379−
380− /* Register SoC-specific clocks. */
381− switch (current_soc) {
382− case S3C2450:
383− samsung_clk_register_div(ctx, s3c2450_dividers,
384− ARRAY_SIZE(s3c2450_dividers));
385− samsung_clk_register_mux(ctx, s3c2450_muxes,
386− ARRAY_SIZE(s3c2450_muxes));
387− samsung_clk_register_gate(ctx, s3c2450_gates,
388− ARRAY_SIZE(s3c2450_gates));
389− samsung_clk_register_alias(ctx, s3c2450_aliases,
390− ARRAY_SIZE(s3c2450_aliases));
391− fallthrough; /* as s3c2450 extends the s3c2416 clocks */
392− case S3C2416:
393− samsung_clk_register_div(ctx, s3c2416_dividers,
394− ARRAY_SIZE(s3c2416_dividers));
395− samsung_clk_register_mux(ctx, s3c2416_muxes,
396− ARRAY_SIZE(s3c2416_muxes));
397− samsung_clk_register_gate(ctx, s3c2416_gates,
398− ARRAY_SIZE(s3c2416_gates));
399− samsung_clk_register_alias(ctx, s3c2416_aliases,
400− ARRAY_SIZE(s3c2416_aliases));
401− break;
402− case S3C2443:
403− samsung_clk_register_div(ctx, s3c2443_dividers,
404− ARRAY_SIZE(s3c2443_dividers));
405− samsung_clk_register_gate(ctx, s3c2443_gates,
406− ARRAY_SIZE(s3c2443_gates));
407− samsung_clk_register_alias(ctx, s3c2443_aliases,
408− ARRAY_SIZE(s3c2443_aliases));
409− break;
410− }
411−
412− samsung_clk_sleep_init(reg_base, s3c2443_clk_regs,
413− ARRAY_SIZE(s3c2443_clk_regs));
414−
415− samsung_clk_of_add_provider(np, ctx);
416−
417− ret = register_restart_handler(&s3c2443_restart_handler);
418− if (ret)
419− pr_warn("cannot register restart handler, %d\n", ret);
420−}
421−
422−static void __init s3c2416_clk_init(struct device_node *np)
423−{
424− s3c2443_common_clk_init(np, 0, S3C2416, NULL);
425−}
426−CLK_OF_DECLARE(s3c2416_clk, "samsung,s3c2416-clock", s3c2416_clk_init);
427−
428−static void __init s3c2443_clk_init(struct device_node *np)
429−{
430− s3c2443_common_clk_init(np, 0, S3C2443, NULL);
431−}
432−CLK_OF_DECLARE(s3c2443_clk, "samsung,s3c2443-clock", s3c2443_clk_init);
433−
434−static void __init s3c2450_clk_init(struct device_node *np)
435−{
436− s3c2443_common_clk_init(np, 0, S3C2450, NULL);
437−}
438−CLK_OF_DECLARE(s3c2450_clk, "samsung,s3c2450-clock", s3c2450_clk_init);
include/linux/platform_data/clk-s3c2410.h+0−19
@@ -1,19 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
2−/*
3− * Copyright (c) 2020 Krzysztof Kozlowski <krzk@kernel.org>
4− */
5−
6−#ifndef __LINUX_PLATFORM_DATA_CLK_S3C2410_H_
7−#define __LINUX_PLATFORM_DATA_CLK_S3C2410_H_
8−
9−/**
10− * struct s3c2410_clk_platform_data - platform data for S3C2410 clock driver
11− *
12− * @modify_misccr: Function to modify the MISCCR and return the new value
13− */
14−struct s3c2410_clk_platform_data {
15− unsigned int (*modify_misccr)(unsigned int clr, unsigned int chg);
16−};
17−
18−#endif /* __LINUX_PLATFORM_DATA_CLK_S3C2410_H_ */
19−

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t