forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
....@@ -1,17 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2016 Maxime Ripard. All rights reserved.
3
- *
4
- * This software is licensed under the terms of the GNU General Public
5
- * License version 2, as published by the Free Software Foundation, and
6
- * may be copied, distributed, and modified under those terms.
7
- *
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
124 */
135
146 #include <linux/clk-provider.h>
7
+#include <linux/io.h>
158 #include <linux/of_address.h>
169
1710 #include "ccu_common.h"
....@@ -69,18 +62,19 @@
6962 BIT(28), /* lock */
7063 CLK_SET_RATE_UNGATE);
7164
72
-static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN(pll_video_clk, "pll-video",
73
- "osc24M", 0x0010,
74
- 192000000, /* Minimum rate */
75
- 8, 7, /* N */
76
- 0, 4, /* M */
77
- BIT(24), /* frac enable */
78
- BIT(25), /* frac select */
79
- 270000000, /* frac rate 0 */
80
- 297000000, /* frac rate 1 */
81
- BIT(31), /* gate */
82
- BIT(28), /* lock */
83
- CLK_SET_RATE_UNGATE);
65
+static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK_MIN_MAX(pll_video_clk, "pll-video",
66
+ "osc24M", 0x0010,
67
+ 192000000, /* Minimum rate */
68
+ 912000000, /* Maximum rate */
69
+ 8, 7, /* N */
70
+ 0, 4, /* M */
71
+ BIT(24), /* frac enable */
72
+ BIT(25), /* frac select */
73
+ 270000000, /* frac rate 0 */
74
+ 297000000, /* frac rate 1 */
75
+ BIT(31), /* gate */
76
+ BIT(28), /* lock */
77
+ CLK_SET_RATE_UNGATE);
8478
8579 static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve",
8680 "osc24M", 0x0018,
....@@ -481,7 +475,7 @@
481475 0x134, 0, 5, 8, 3, BIT(15), 0);
482476
483477 static SUNXI_CCU_M_WITH_GATE(ve_clk, "ve", "pll-ve",
484
- 0x13c, 16, 3, BIT(31), 0);
478
+ 0x13c, 16, 3, BIT(31), CLK_SET_RATE_PARENT);
485479
486480 static SUNXI_CCU_GATE(ac_dig_clk, "ac-dig", "pll-audio",
487481 0x140, BIT(31), CLK_SET_RATE_PARENT);
....@@ -724,17 +718,26 @@
724718 &gpu_clk.common,
725719 };
726720
721
+static const struct clk_hw *clk_parent_pll_audio[] = {
722
+ &pll_audio_base_clk.common.hw
723
+};
724
+
727725 /* We hardcode the divider to 1 for now */
728
-static CLK_FIXED_FACTOR(pll_audio_clk, "pll-audio",
729
- "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT);
730
-static CLK_FIXED_FACTOR(pll_audio_2x_clk, "pll-audio-2x",
731
- "pll-audio-base", 2, 1, CLK_SET_RATE_PARENT);
732
-static CLK_FIXED_FACTOR(pll_audio_4x_clk, "pll-audio-4x",
733
- "pll-audio-base", 1, 1, CLK_SET_RATE_PARENT);
734
-static CLK_FIXED_FACTOR(pll_audio_8x_clk, "pll-audio-8x",
735
- "pll-audio-base", 1, 2, CLK_SET_RATE_PARENT);
736
-static CLK_FIXED_FACTOR(pll_periph0_2x_clk, "pll-periph0-2x",
737
- "pll-periph0", 1, 2, 0);
726
+static CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio",
727
+ clk_parent_pll_audio,
728
+ 1, 1, CLK_SET_RATE_PARENT);
729
+static CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x",
730
+ clk_parent_pll_audio,
731
+ 2, 1, CLK_SET_RATE_PARENT);
732
+static CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x",
733
+ clk_parent_pll_audio,
734
+ 1, 1, CLK_SET_RATE_PARENT);
735
+static CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x",
736
+ clk_parent_pll_audio,
737
+ 1, 2, CLK_SET_RATE_PARENT);
738
+static CLK_FIXED_FACTOR_HW(pll_periph0_2x_clk, "pll-periph0-2x",
739
+ &pll_periph0_clk.common.hw,
740
+ 1, 2, 0);
738741
739742 static struct clk_hw_onecell_data sun8i_h3_hw_clks = {
740743 .hws = {