.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de> |
---|
3 | | - * |
---|
4 | | - * This program is free software; you can redistribute it and/or modify |
---|
5 | | - * it under the terms of the GNU General Public License version 2 as |
---|
6 | | - * published by the Free Software Foundation. |
---|
7 | 4 | * |
---|
8 | 5 | * Common Clock Framework support for S3C2443 and following SoCs. |
---|
9 | 6 | */ |
---|
10 | 7 | |
---|
11 | 8 | #include <linux/clk-provider.h> |
---|
| 9 | +#include <linux/clk/samsung.h> |
---|
| 10 | +#include <linux/io.h> |
---|
12 | 11 | #include <linux/of.h> |
---|
13 | 12 | #include <linux/of_address.h> |
---|
14 | | -#include <linux/syscore_ops.h> |
---|
15 | 13 | #include <linux/reboot.h> |
---|
16 | 14 | |
---|
17 | 15 | #include <dt-bindings/clock/s3c2443.h> |
---|
.. | .. |
---|
43 | 41 | |
---|
44 | 42 | static void __iomem *reg_base; |
---|
45 | 43 | |
---|
46 | | -#ifdef CONFIG_PM_SLEEP |
---|
47 | | -static struct samsung_clk_reg_dump *s3c2443_save; |
---|
48 | | - |
---|
49 | 44 | /* |
---|
50 | 45 | * list of controller registers to be saved and restored during a |
---|
51 | 46 | * suspend/resume cycle. |
---|
.. | .. |
---|
64 | 59 | HCLKCON, |
---|
65 | 60 | SCLKCON, |
---|
66 | 61 | }; |
---|
67 | | - |
---|
68 | | -static int s3c2443_clk_suspend(void) |
---|
69 | | -{ |
---|
70 | | - samsung_clk_save(reg_base, s3c2443_save, |
---|
71 | | - ARRAY_SIZE(s3c2443_clk_regs)); |
---|
72 | | - |
---|
73 | | - return 0; |
---|
74 | | -} |
---|
75 | | - |
---|
76 | | -static void s3c2443_clk_resume(void) |
---|
77 | | -{ |
---|
78 | | - samsung_clk_restore(reg_base, s3c2443_save, |
---|
79 | | - ARRAY_SIZE(s3c2443_clk_regs)); |
---|
80 | | -} |
---|
81 | | - |
---|
82 | | -static struct syscore_ops s3c2443_clk_syscore_ops = { |
---|
83 | | - .suspend = s3c2443_clk_suspend, |
---|
84 | | - .resume = s3c2443_clk_resume, |
---|
85 | | -}; |
---|
86 | | - |
---|
87 | | -static void __init s3c2443_clk_sleep_init(void) |
---|
88 | | -{ |
---|
89 | | - s3c2443_save = samsung_clk_alloc_reg_dump(s3c2443_clk_regs, |
---|
90 | | - ARRAY_SIZE(s3c2443_clk_regs)); |
---|
91 | | - if (!s3c2443_save) { |
---|
92 | | - pr_warn("%s: failed to allocate sleep save data, no sleep support!\n", |
---|
93 | | - __func__); |
---|
94 | | - return; |
---|
95 | | - } |
---|
96 | | - |
---|
97 | | - register_syscore_ops(&s3c2443_clk_syscore_ops); |
---|
98 | | - return; |
---|
99 | | -} |
---|
100 | | -#else |
---|
101 | | -static void __init s3c2443_clk_sleep_init(void) {} |
---|
102 | | -#endif |
---|
103 | 62 | |
---|
104 | 63 | PNAME(epllref_p) = { "mpllref", "mpllref", "xti", "ext" }; |
---|
105 | 64 | PNAME(esysclk_p) = { "epllref", "epll" }; |
---|
.. | .. |
---|
429 | 388 | ARRAY_SIZE(s3c2450_gates)); |
---|
430 | 389 | samsung_clk_register_alias(ctx, s3c2450_aliases, |
---|
431 | 390 | ARRAY_SIZE(s3c2450_aliases)); |
---|
432 | | - /* fall through, as s3c2450 extends the s3c2416 clocks */ |
---|
| 391 | + fallthrough; /* as s3c2450 extends the s3c2416 clocks */ |
---|
433 | 392 | case S3C2416: |
---|
434 | 393 | samsung_clk_register_div(ctx, s3c2416_dividers, |
---|
435 | 394 | ARRAY_SIZE(s3c2416_dividers)); |
---|
.. | .. |
---|
450 | 409 | break; |
---|
451 | 410 | } |
---|
452 | 411 | |
---|
453 | | - s3c2443_clk_sleep_init(); |
---|
| 412 | + samsung_clk_sleep_init(reg_base, s3c2443_clk_regs, |
---|
| 413 | + ARRAY_SIZE(s3c2443_clk_regs)); |
---|
454 | 414 | |
---|
455 | 415 | samsung_clk_of_add_provider(np, ctx); |
---|
456 | 416 | |
---|