hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/clk/samsung/clk-s3c64xx.c
....@@ -1,18 +1,15 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2013 Tomasz Figa <tomasz.figa at gmail.com>
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.
74 *
85 * Common Clock Framework support for all S3C64xx SoCs.
96 */
107
118 #include <linux/slab.h>
129 #include <linux/clk-provider.h>
10
+#include <linux/clk/samsung.h>
1311 #include <linux/of.h>
1412 #include <linux/of_address.h>
15
-#include <linux/syscore_ops.h>
1613
1714 #include <dt-bindings/clock/samsung,s3c64xx-clock.h>
1815
....@@ -59,10 +56,6 @@
5956 static void __iomem *reg_base;
6057 static bool is_s3c6400;
6158
62
-#ifdef CONFIG_PM_SLEEP
63
-static struct samsung_clk_reg_dump *s3c64xx_save_common;
64
-static struct samsung_clk_reg_dump *s3c64xx_save_soc;
65
-
6659 /*
6760 * List of controller registers to be saved and restored during
6861 * a suspend/resume cycle.
....@@ -88,60 +81,6 @@
8881 CLK_SRC2,
8982 MEM0_GATE,
9083 };
91
-
92
-static int s3c64xx_clk_suspend(void)
93
-{
94
- samsung_clk_save(reg_base, s3c64xx_save_common,
95
- ARRAY_SIZE(s3c64xx_clk_regs));
96
-
97
- if (!is_s3c6400)
98
- samsung_clk_save(reg_base, s3c64xx_save_soc,
99
- ARRAY_SIZE(s3c6410_clk_regs));
100
-
101
- return 0;
102
-}
103
-
104
-static void s3c64xx_clk_resume(void)
105
-{
106
- samsung_clk_restore(reg_base, s3c64xx_save_common,
107
- ARRAY_SIZE(s3c64xx_clk_regs));
108
-
109
- if (!is_s3c6400)
110
- samsung_clk_restore(reg_base, s3c64xx_save_soc,
111
- ARRAY_SIZE(s3c6410_clk_regs));
112
-}
113
-
114
-static struct syscore_ops s3c64xx_clk_syscore_ops = {
115
- .suspend = s3c64xx_clk_suspend,
116
- .resume = s3c64xx_clk_resume,
117
-};
118
-
119
-static void __init s3c64xx_clk_sleep_init(void)
120
-{
121
- s3c64xx_save_common = samsung_clk_alloc_reg_dump(s3c64xx_clk_regs,
122
- ARRAY_SIZE(s3c64xx_clk_regs));
123
- if (!s3c64xx_save_common)
124
- goto err_warn;
125
-
126
- if (!is_s3c6400) {
127
- s3c64xx_save_soc = samsung_clk_alloc_reg_dump(s3c6410_clk_regs,
128
- ARRAY_SIZE(s3c6410_clk_regs));
129
- if (!s3c64xx_save_soc)
130
- goto err_soc;
131
- }
132
-
133
- register_syscore_ops(&s3c64xx_clk_syscore_ops);
134
- return;
135
-
136
-err_soc:
137
- kfree(s3c64xx_save_common);
138
-err_warn:
139
- pr_warn("%s: failed to allocate sleep save data, no sleep support!\n",
140
- __func__);
141
-}
142
-#else
143
-static void __init s3c64xx_clk_sleep_init(void) {}
144
-#endif
14584
14685 /* List of parent clocks common for all S3C64xx SoCs. */
14786 PNAME(spi_mmc_p) = { "mout_epll", "dout_mpll", "fin_pll", "clk27m" };
....@@ -508,7 +447,12 @@
508447
509448 samsung_clk_register_alias(ctx, s3c64xx_clock_aliases,
510449 ARRAY_SIZE(s3c64xx_clock_aliases));
511
- s3c64xx_clk_sleep_init();
450
+
451
+ samsung_clk_sleep_init(reg_base, s3c64xx_clk_regs,
452
+ ARRAY_SIZE(s3c64xx_clk_regs));
453
+ if (!is_s3c6400)
454
+ samsung_clk_sleep_init(reg_base, s3c6410_clk_regs,
455
+ ARRAY_SIZE(s3c6410_clk_regs));
512456
513457 samsung_clk_of_add_provider(np, ctx);
514458