Skip to content

Commit bb30271

Browse files
committed
Merge tag 'sunxi-clk-for-5.5-1' of https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux into clk-allwinner
Pull Allwinner clk driver updates from Maxime Ripard: A few clock patches for sunxi, mostly to export new clocks to the DT, and fix some issues with the clock tree on the H6. * tag 'sunxi-clk-for-5.5-1' of https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux: clk: sunxi-ng: h3: Export MBUS clock clk: sunxi-ng: h6: Allow GPU to change parent rate clk: sunxi-ng: h6: Use sigma-delta modulation for audio PLL
2 parents 54ecb8f + 4441b57 commit bb30271

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

drivers/clk/sunxi-ng/ccu-sun50i-h6.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,21 @@ static struct ccu_nkmp pll_hsic_clk = {
203203
* hardcode it to match with the clock names.
204204
*/
205205
#define SUN50I_H6_PLL_AUDIO_REG 0x078
206+
207+
static struct ccu_sdm_setting pll_audio_sdm_table[] = {
208+
{ .rate = 541900800, .pattern = 0xc001288d, .m = 1, .n = 22 },
209+
{ .rate = 589824000, .pattern = 0xc00126e9, .m = 1, .n = 24 },
210+
};
211+
206212
static struct ccu_nm pll_audio_base_clk = {
207213
.enable = BIT(31),
208214
.lock = BIT(28),
209215
.n = _SUNXI_CCU_MULT_MIN(8, 8, 12),
210216
.m = _SUNXI_CCU_DIV(1, 1), /* input divider */
217+
.sdm = _SUNXI_CCU_SDM(pll_audio_sdm_table,
218+
BIT(24), 0x178, BIT(31)),
211219
.common = {
220+
.features = CCU_FEATURE_SIGMA_DELTA_MOD,
212221
.reg = 0x078,
213222
.hw.init = CLK_HW_INIT("pll-audio-base", "osc24M",
214223
&ccu_nm_ops,
@@ -290,7 +299,7 @@ static SUNXI_CCU_M_WITH_MUX_GATE(gpu_clk, "gpu", gpu_parents, 0x670,
290299
0, 3, /* M */
291300
24, 1, /* mux */
292301
BIT(31), /* gate */
293-
0);
302+
CLK_SET_RATE_PARENT);
294303

295304
static SUNXI_CCU_GATE(bus_gpu_clk, "bus-gpu", "psi-ahb1-ahb2",
296305
0x67c, BIT(0), 0);
@@ -753,12 +762,12 @@ static const struct clk_hw *clk_parent_pll_audio[] = {
753762
};
754763

755764
/*
756-
* The divider of pll-audio is fixed to 8 now, as pll-audio-4x has a
757-
* fixed post-divider 2.
765+
* The divider of pll-audio is fixed to 24 for now, so 24576000 and 22579200
766+
* rates can be set exactly in conjunction with sigma-delta modulation.
758767
*/
759768
static CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio",
760769
clk_parent_pll_audio,
761-
8, 1, CLK_SET_RATE_PARENT);
770+
24, 1, CLK_SET_RATE_PARENT);
762771
static CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x",
763772
clk_parent_pll_audio,
764773
4, 1, CLK_SET_RATE_PARENT);
@@ -1215,12 +1224,12 @@ static int sun50i_h6_ccu_probe(struct platform_device *pdev)
12151224
}
12161225

12171226
/*
1218-
* Force the post-divider of pll-audio to 8 and the output divider
1219-
* of it to 1, to make the clock name represents the real frequency.
1227+
* Force the post-divider of pll-audio to 12 and the output divider
1228+
* of it to 2, so 24576000 and 22579200 rates can be set exactly.
12201229
*/
12211230
val = readl(reg + SUN50I_H6_PLL_AUDIO_REG);
12221231
val &= ~(GENMASK(21, 16) | BIT(0));
1223-
writel(val | (7 << 16), reg + SUN50I_H6_PLL_AUDIO_REG);
1232+
writel(val | (11 << 16) | BIT(0), reg + SUN50I_H6_PLL_AUDIO_REG);
12241233

12251234
/*
12261235
* First clock parent (osc32K) is unusable for CEC. But since there

drivers/clk/sunxi-ng/ccu-sun8i-h3.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@
4848

4949
/* Some more module clocks are exported */
5050

51-
#define CLK_MBUS 113
52-
53-
/* And the GPU module clock is exported */
54-
5551
#define CLK_NUMBER_H3 (CLK_GPU + 1)
5652
#define CLK_NUMBER_H5 (CLK_BUS_SCR1 + 1)
5753

include/dt-bindings/clock/sun8i-h3-ccu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
#define CLK_AVS 110
144144
#define CLK_HDMI 111
145145
#define CLK_HDMI_DDC 112
146-
146+
#define CLK_MBUS 113
147147
#define CLK_GPU 114
148148

149149
/* New clocks imported in H5 */

0 commit comments

Comments
 (0)