|
9 | 9 | #include <linux/clk.h>
|
10 | 10 | #include <linux/clk-provider.h>
|
11 | 11 | #include <linux/of.h>
|
12 |
| -#include <linux/of_address.h> |
13 | 12 | #include <linux/of_device.h>
|
14 | 13 | #include <linux/platform_device.h>
|
15 | 14 |
|
16 | 15 | #include <dt-bindings/clock/exynos850.h>
|
17 | 16 |
|
18 | 17 | #include "clk.h"
|
19 |
| - |
20 |
| -/* Gate register bits */ |
21 |
| -#define GATE_MANUAL BIT(20) |
22 |
| -#define GATE_ENABLE_HWACG BIT(28) |
23 |
| - |
24 |
| -/* Gate register offsets range */ |
25 |
| -#define GATE_OFF_START 0x2000 |
26 |
| -#define GATE_OFF_END 0x2fff |
27 |
| - |
28 |
| -/** |
29 |
| - * exynos850_init_clocks - Set clocks initial configuration |
30 |
| - * @np: CMU device tree node with "reg" property (CMU addr) |
31 |
| - * @reg_offs: Register offsets array for clocks to init |
32 |
| - * @reg_offs_len: Number of register offsets in reg_offs array |
33 |
| - * |
34 |
| - * Set manual control mode for all gate clocks. |
35 |
| - */ |
36 |
| -static void __init exynos850_init_clocks(struct device_node *np, |
37 |
| - const unsigned long *reg_offs, size_t reg_offs_len) |
38 |
| -{ |
39 |
| - void __iomem *reg_base; |
40 |
| - size_t i; |
41 |
| - |
42 |
| - reg_base = of_iomap(np, 0); |
43 |
| - if (!reg_base) |
44 |
| - panic("%s: failed to map registers\n", __func__); |
45 |
| - |
46 |
| - for (i = 0; i < reg_offs_len; ++i) { |
47 |
| - void __iomem *reg = reg_base + reg_offs[i]; |
48 |
| - u32 val; |
49 |
| - |
50 |
| - /* Modify only gate clock registers */ |
51 |
| - if (reg_offs[i] < GATE_OFF_START || reg_offs[i] > GATE_OFF_END) |
52 |
| - continue; |
53 |
| - |
54 |
| - val = readl(reg); |
55 |
| - val |= GATE_MANUAL; |
56 |
| - val &= ~GATE_ENABLE_HWACG; |
57 |
| - writel(val, reg); |
58 |
| - } |
59 |
| - |
60 |
| - iounmap(reg_base); |
61 |
| -} |
62 |
| - |
63 |
| -/** |
64 |
| - * exynos850_register_cmu - Register specified Exynos850 CMU domain |
65 |
| - * @dev: Device object; may be NULL if this function is not being |
66 |
| - * called from platform driver probe function |
67 |
| - * @np: CMU device tree node |
68 |
| - * @cmu: CMU data |
69 |
| - * |
70 |
| - * Register specified CMU domain, which includes next steps: |
71 |
| - * |
72 |
| - * 1. Enable parent clock of @cmu CMU |
73 |
| - * 2. Set initial registers configuration for @cmu CMU clocks |
74 |
| - * 3. Register @cmu CMU clocks using Samsung clock framework API |
75 |
| - */ |
76 |
| -static void __init exynos850_register_cmu(struct device *dev, |
77 |
| - struct device_node *np, const struct samsung_cmu_info *cmu) |
78 |
| -{ |
79 |
| - /* Keep CMU parent clock running (needed for CMU registers access) */ |
80 |
| - if (cmu->clk_name) { |
81 |
| - struct clk *parent_clk; |
82 |
| - |
83 |
| - if (dev) |
84 |
| - parent_clk = clk_get(dev, cmu->clk_name); |
85 |
| - else |
86 |
| - parent_clk = of_clk_get_by_name(np, cmu->clk_name); |
87 |
| - |
88 |
| - if (IS_ERR(parent_clk)) { |
89 |
| - pr_err("%s: could not find bus clock %s; err = %ld\n", |
90 |
| - __func__, cmu->clk_name, PTR_ERR(parent_clk)); |
91 |
| - } else { |
92 |
| - clk_prepare_enable(parent_clk); |
93 |
| - } |
94 |
| - } |
95 |
| - |
96 |
| - exynos850_init_clocks(np, cmu->clk_regs, cmu->nr_clk_regs); |
97 |
| - samsung_cmu_register_one(np, cmu); |
98 |
| -} |
| 18 | +#include "clk-exynos-arm64.h" |
99 | 19 |
|
100 | 20 | /* ---- CMU_TOP ------------------------------------------------------------- */
|
101 | 21 |
|
@@ -404,7 +324,7 @@ static const struct samsung_cmu_info top_cmu_info __initconst = {
|
404 | 324 |
|
405 | 325 | static void __init exynos850_cmu_top_init(struct device_node *np)
|
406 | 326 | {
|
407 |
| - exynos850_register_cmu(NULL, np, &top_cmu_info); |
| 327 | + exynos_arm64_register_cmu(NULL, np, &top_cmu_info); |
408 | 328 | }
|
409 | 329 |
|
410 | 330 | /* Register CMU_TOP early, as it's a dependency for other early domains */
|
@@ -911,7 +831,7 @@ static const struct samsung_cmu_info peri_cmu_info __initconst = {
|
911 | 831 |
|
912 | 832 | static void __init exynos850_cmu_peri_init(struct device_node *np)
|
913 | 833 | {
|
914 |
| - exynos850_register_cmu(NULL, np, &peri_cmu_info); |
| 834 | + exynos_arm64_register_cmu(NULL, np, &peri_cmu_info); |
915 | 835 | }
|
916 | 836 |
|
917 | 837 | /* Register CMU_PERI early, as it's needed for MCT timer */
|
@@ -1098,7 +1018,7 @@ static int __init exynos850_cmu_probe(struct platform_device *pdev)
|
1098 | 1018 | struct device *dev = &pdev->dev;
|
1099 | 1019 |
|
1100 | 1020 | info = of_device_get_match_data(dev);
|
1101 |
| - exynos850_register_cmu(dev, dev->of_node, info); |
| 1021 | + exynos_arm64_register_cmu(dev, dev->of_node, info); |
1102 | 1022 |
|
1103 | 1023 | return 0;
|
1104 | 1024 | }
|
|
0 commit comments