Skip to content

Commit 054b4ea

Browse files
committed
Merge tag 'sunxi-clk-for-6.15' of https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux into clk-allwinner
Pull Allwinner clk driver updates from Chen-Yu Tsai: - Extend Allwinner H616 clock driver to cover TCON clock and reset - Enable Allwinner H616 GPU clock reparenting during rate change - Add new clock driver for Allwinner's A523/T527 * tag 'sunxi-clk-for-6.15' of https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux: clk: sunxi-ng: add support for the A523/T527 PRCM CCU clk: sunxi-ng: a523: add reset lines clk: sunxi-ng: a523: add bus clock gates clk: sunxi-ng: a523: remaining mod clocks clk: sunxi-ng: a523: add USB mod clocks clk: sunxi-ng: a523: add interface mod clocks clk: sunxi-ng: a523: add system mod clocks clk: sunxi-ng: a523: add video mod clocks clk: sunxi-ng: a523: Add support for bus clocks clk: sunxi-ng: Add support for the A523/T527 CCU PLLs dt-bindings: clk: sunxi-ng: document two Allwinner A523 CCUs clk: sunxi-ng: Add support for update bit clk: sunxi-ng: mp: provide wrappers for setting feature flags clk: sunxi-ng: mp: introduce dual-divider clock clk: sunxi-ng: h616: Reparent GPU clock during frequency changes clk: sunxi-ng: h616: Add clock/reset for LCD TCON dt-bindings: clock: sun50i-h616-ccu: Add LCD TCON clk and reset
2 parents 2014c95 + 8cea339 commit 054b4ea

21 files changed

+2590
-17
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/clock/allwinner,sun55i-a523-ccu.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Allwinner A523 Clock Control Unit
8+
9+
maintainers:
10+
- Andre Przywara <andre.przywara@arm.com>
11+
12+
properties:
13+
"#clock-cells":
14+
const: 1
15+
16+
"#reset-cells":
17+
const: 1
18+
19+
compatible:
20+
enum:
21+
- allwinner,sun55i-a523-ccu
22+
- allwinner,sun55i-a523-r-ccu
23+
24+
reg:
25+
maxItems: 1
26+
27+
clocks:
28+
minItems: 4
29+
maxItems: 5
30+
31+
clock-names:
32+
minItems: 4
33+
maxItems: 5
34+
35+
required:
36+
- "#clock-cells"
37+
- "#reset-cells"
38+
- compatible
39+
- reg
40+
- clocks
41+
- clock-names
42+
43+
allOf:
44+
- if:
45+
properties:
46+
compatible:
47+
enum:
48+
- allwinner,sun55i-a523-ccu
49+
50+
then:
51+
properties:
52+
clocks:
53+
items:
54+
- description: High Frequency Oscillator (usually at 24MHz)
55+
- description: Low Frequency Oscillator (usually at 32kHz)
56+
- description: Internal Oscillator
57+
- description: Low Frequency Oscillator fanout
58+
59+
clock-names:
60+
items:
61+
- const: hosc
62+
- const: losc
63+
- const: iosc
64+
- const: losc-fanout
65+
66+
- if:
67+
properties:
68+
compatible:
69+
enum:
70+
- allwinner,sun55i-a523-r-ccu
71+
72+
then:
73+
properties:
74+
clocks:
75+
items:
76+
- description: High Frequency Oscillator (usually at 24MHz)
77+
- description: Low Frequency Oscillator (usually at 32kHz)
78+
- description: Internal Oscillator
79+
- description: Peripherals PLL
80+
- description: Audio PLL
81+
82+
clock-names:
83+
items:
84+
- const: hosc
85+
- const: losc
86+
- const: iosc
87+
- const: pll-periph
88+
- const: pll-audio
89+
90+
additionalProperties: false
91+
92+
examples:
93+
- |
94+
clock-controller@2001000 {
95+
compatible = "allwinner,sun55i-a523-ccu";
96+
reg = <0x02001000 0x1000>;
97+
clocks = <&osc24M>, <&osc32k>, <&iosc>, <&r_ccu 1>;
98+
clock-names = "hosc", "losc", "iosc", "losc-fanout";
99+
#clock-cells = <1>;
100+
#reset-cells = <1>;
101+
};
102+
103+
...

drivers/clk/sunxi-ng/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ config SUN50I_H6_R_CCU
5252
default y
5353
depends on ARM64 || COMPILE_TEST
5454

55+
config SUN55I_A523_CCU
56+
tristate "Support for the Allwinner A523/T527 CCU"
57+
default y
58+
depends on ARM64 || COMPILE_TEST
59+
60+
config SUN55I_A523_R_CCU
61+
tristate "Support for the Allwinner A523/T527 PRCM CCU"
62+
default y
63+
depends on ARM64 || COMPILE_TEST
64+
5565
config SUN4I_A10_CCU
5666
tristate "Support for the Allwinner A10/A20 CCU"
5767
default y

drivers/clk/sunxi-ng/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ obj-$(CONFIG_SUN50I_A100_R_CCU) += sun50i-a100-r-ccu.o
3333
obj-$(CONFIG_SUN50I_H6_CCU) += sun50i-h6-ccu.o
3434
obj-$(CONFIG_SUN50I_H6_R_CCU) += sun50i-h6-r-ccu.o
3535
obj-$(CONFIG_SUN50I_H616_CCU) += sun50i-h616-ccu.o
36+
obj-$(CONFIG_SUN55I_A523_CCU) += sun55i-a523-ccu.o
37+
obj-$(CONFIG_SUN55I_A523_R_CCU) += sun55i-a523-r-ccu.o
3638
obj-$(CONFIG_SUN4I_A10_CCU) += sun4i-a10-ccu.o
3739
obj-$(CONFIG_SUN5I_CCU) += sun5i-ccu.o
3840
obj-$(CONFIG_SUN6I_A31_CCU) += sun6i-a31-ccu.o
@@ -58,6 +60,8 @@ sun50i-a100-r-ccu-y += ccu-sun50i-a100-r.o
5860
sun50i-h6-ccu-y += ccu-sun50i-h6.o
5961
sun50i-h6-r-ccu-y += ccu-sun50i-h6-r.o
6062
sun50i-h616-ccu-y += ccu-sun50i-h616.o
63+
sun55i-a523-ccu-y += ccu-sun55i-a523.o
64+
sun55i-a523-r-ccu-y += ccu-sun55i-a523-r.o
6165
sun4i-a10-ccu-y += ccu-sun4i-a10.o
6266
sun5i-ccu-y += ccu-sun5i.o
6367
sun6i-a31-ccu-y += ccu-sun6i-a31.o

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

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,16 @@ static SUNXI_CCU_M_WITH_MUX_GATE(gpu0_clk, "gpu0", gpu0_parents, 0x670,
328328
24, 1, /* mux */
329329
BIT(31), /* gate */
330330
CLK_SET_RATE_PARENT);
331+
332+
/*
333+
* This clk is needed as a temporary fall back during GPU PLL freq changes.
334+
* Set CLK_IS_CRITICAL flag to prevent from being disabled.
335+
*/
336+
#define SUN50I_H616_GPU_CLK1_REG 0x674
331337
static SUNXI_CCU_M_WITH_GATE(gpu1_clk, "gpu1", "pll-periph0-2x", 0x674,
332338
0, 2, /* M */
333339
BIT(31),/* gate */
334-
0);
340+
CLK_IS_CRITICAL);
335341

336342
static SUNXI_CCU_GATE(bus_gpu_clk, "bus-gpu", "psi-ahb1-ahb2",
337343
0x67c, BIT(0), 0);
@@ -645,6 +651,20 @@ static const char * const tcon_tv_parents[] = { "pll-video0",
645651
"pll-video0-4x",
646652
"pll-video1",
647653
"pll-video1-4x" };
654+
static SUNXI_CCU_MUX_WITH_GATE(tcon_lcd0_clk, "tcon-lcd0",
655+
tcon_tv_parents, 0xb60,
656+
24, 3, /* mux */
657+
BIT(31), /* gate */
658+
CLK_SET_RATE_PARENT);
659+
static SUNXI_CCU_MUX_WITH_GATE(tcon_lcd1_clk, "tcon-lcd1",
660+
tcon_tv_parents, 0xb64,
661+
24, 3, /* mux */
662+
BIT(31), /* gate */
663+
CLK_SET_RATE_PARENT);
664+
static SUNXI_CCU_GATE(bus_tcon_lcd0_clk, "bus-tcon-lcd0", "ahb3",
665+
0xb7c, BIT(0), 0);
666+
static SUNXI_CCU_GATE(bus_tcon_lcd1_clk, "bus-tcon-lcd1", "ahb3",
667+
0xb7c, BIT(1), 0);
648668
static SUNXI_CCU_MP_WITH_MUX_GATE(tcon_tv0_clk, "tcon-tv0",
649669
tcon_tv_parents, 0xb80,
650670
0, 4, /* M */
@@ -855,8 +875,12 @@ static struct ccu_common *sun50i_h616_ccu_clks[] = {
855875
&hdmi_cec_clk.common,
856876
&bus_hdmi_clk.common,
857877
&bus_tcon_top_clk.common,
878+
&tcon_lcd0_clk.common,
879+
&tcon_lcd1_clk.common,
858880
&tcon_tv0_clk.common,
859881
&tcon_tv1_clk.common,
882+
&bus_tcon_lcd0_clk.common,
883+
&bus_tcon_lcd1_clk.common,
860884
&bus_tcon_tv0_clk.common,
861885
&bus_tcon_tv1_clk.common,
862886
&tve0_clk.common,
@@ -989,8 +1013,12 @@ static struct clk_hw_onecell_data sun50i_h616_hw_clks = {
9891013
[CLK_HDMI_CEC] = &hdmi_cec_clk.common.hw,
9901014
[CLK_BUS_HDMI] = &bus_hdmi_clk.common.hw,
9911015
[CLK_BUS_TCON_TOP] = &bus_tcon_top_clk.common.hw,
1016+
[CLK_TCON_LCD0] = &tcon_lcd0_clk.common.hw,
1017+
[CLK_TCON_LCD1] = &tcon_lcd1_clk.common.hw,
9921018
[CLK_TCON_TV0] = &tcon_tv0_clk.common.hw,
9931019
[CLK_TCON_TV1] = &tcon_tv1_clk.common.hw,
1020+
[CLK_BUS_TCON_LCD0] = &bus_tcon_lcd0_clk.common.hw,
1021+
[CLK_BUS_TCON_LCD1] = &bus_tcon_lcd1_clk.common.hw,
9941022
[CLK_BUS_TCON_TV0] = &bus_tcon_tv0_clk.common.hw,
9951023
[CLK_BUS_TCON_TV1] = &bus_tcon_tv1_clk.common.hw,
9961024
[CLK_TVE0] = &tve0_clk.common.hw,
@@ -1062,6 +1090,8 @@ static const struct ccu_reset_map sun50i_h616_ccu_resets[] = {
10621090
[RST_BUS_HDMI] = { 0xb1c, BIT(16) },
10631091
[RST_BUS_HDMI_SUB] = { 0xb1c, BIT(17) },
10641092
[RST_BUS_TCON_TOP] = { 0xb5c, BIT(16) },
1093+
[RST_BUS_TCON_LCD0] = { 0xb7c, BIT(16) },
1094+
[RST_BUS_TCON_LCD1] = { 0xb7c, BIT(17) },
10651095
[RST_BUS_TCON_TV0] = { 0xb9c, BIT(16) },
10661096
[RST_BUS_TCON_TV1] = { 0xb9c, BIT(17) },
10671097
[RST_BUS_TVE_TOP] = { 0xbbc, BIT(16) },
@@ -1120,6 +1150,19 @@ static struct ccu_pll_nb sun50i_h616_pll_cpu_nb = {
11201150
.lock = BIT(28),
11211151
};
11221152

1153+
static struct ccu_mux_nb sun50i_h616_gpu_nb = {
1154+
.common = &gpu0_clk.common,
1155+
.cm = &gpu0_clk.mux,
1156+
.delay_us = 1, /* manual doesn't really say */
1157+
.bypass_index = 1, /* GPU_CLK1@400MHz */
1158+
};
1159+
1160+
static struct ccu_pll_nb sun50i_h616_pll_gpu_nb = {
1161+
.common = &pll_gpu_clk.common,
1162+
.enable = BIT(29), /* LOCK_ENABLE */
1163+
.lock = BIT(28),
1164+
};
1165+
11231166
static int sun50i_h616_ccu_probe(struct platform_device *pdev)
11241167
{
11251168
void __iomem *reg;
@@ -1170,6 +1213,14 @@ static int sun50i_h616_ccu_probe(struct platform_device *pdev)
11701213
val |= BIT(0);
11711214
writel(val, reg + SUN50I_H616_PLL_AUDIO_REG);
11721215

1216+
/*
1217+
* Set the input-divider for the gpu1 clock to 3, to reach a safe 400 MHz.
1218+
*/
1219+
val = readl(reg + SUN50I_H616_GPU_CLK1_REG);
1220+
val &= ~GENMASK(1, 0);
1221+
val |= 2;
1222+
writel(val, reg + SUN50I_H616_GPU_CLK1_REG);
1223+
11731224
/*
11741225
* First clock parent (osc32K) is unusable for CEC. But since there
11751226
* is no good way to force parent switch (both run with same frequency),
@@ -1190,6 +1241,13 @@ static int sun50i_h616_ccu_probe(struct platform_device *pdev)
11901241
/* Re-lock the CPU PLL after any rate changes */
11911242
ccu_pll_notifier_register(&sun50i_h616_pll_cpu_nb);
11921243

1244+
/* Reparent GPU during GPU PLL rate changes */
1245+
ccu_mux_notifier_register(pll_gpu_clk.common.hw.clk,
1246+
&sun50i_h616_gpu_nb);
1247+
1248+
/* Re-lock the GPU PLL after any rate changes */
1249+
ccu_pll_notifier_register(&sun50i_h616_pll_gpu_nb);
1250+
11931251
return 0;
11941252
}
11951253

drivers/clk/sunxi-ng/ccu-sun50i-h616.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@
5151

5252
#define CLK_BUS_DRAM 56
5353

54-
#define CLK_NUMBER (CLK_BUS_GPADC + 1)
54+
#define CLK_NUMBER (CLK_BUS_TCON_LCD1 + 1)
5555

5656
#endif /* _CCU_SUN50I_H616_H_ */

0 commit comments

Comments
 (0)