Skip to content

Commit d8b210f

Browse files
committed
Merge tag 'clk-meson-v6.20-1' of https://github.com/BayLibre/clk-meson into clk-amlogic
Pull Amlogic clk driver updates from Jerome Brunet: - Add support for Amlogic t7 clock controllers - Add video clocks on Amlogic s4 - HDMI PLL post divider fixes on Amlogic gx/g12 SoCs * tag 'clk-meson-v6.20-1' of https://github.com/BayLibre/clk-meson: clk: meson: gxbb: use the existing HHI_HDMI_PLL_CNTL3 macro clk: meson: g12a: Limit the HDMI PLL OD to /4 clk: meson: gxbb: Limit the HDMI PLL OD to /4 on GXL/GXM SoCs clk: amlogic: remove potentially unsafe flags from S4 video clocks clk: amlogic: add video-related clocks for S4 SoC dt-bindings: clock: add video clock indices for Amlogic S4 SoC clk: meson: t7: add t7 clock peripherals controller driver clk: meson: t7: add support for the T7 SoC PLL clock dt-bindings: clock: add Amlogic T7 peripherals clock controller dt-bindings: clock: add Amlogic T7 SCMI clock controller dt-bindings: clock: add Amlogic T7 PLL clock controller
2 parents 8f0b4cc + 2fe1ef4 commit d8b210f

13 files changed

Lines changed: 3180 additions & 13 deletions

File tree

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
# Copyright (C) 2024-2025 Amlogic, Inc. All rights reserved
3+
%YAML 1.2
4+
---
5+
$id: http://devicetree.org/schemas/clock/amlogic,t7-peripherals-clkc.yaml#
6+
$schema: http://devicetree.org/meta-schemas/core.yaml#
7+
8+
title: Amlogic T7 Peripherals Clock Controller
9+
10+
maintainers:
11+
- Neil Armstrong <neil.armstrong@linaro.org>
12+
- Jerome Brunet <jbrunet@baylibre.com>
13+
- Xianwei Zhao <xianwei.zhao@amlogic.com>
14+
- Jian Hu <jian.hu@amlogic.com>
15+
16+
properties:
17+
compatible:
18+
const: amlogic,t7-peripherals-clkc
19+
20+
reg:
21+
maxItems: 1
22+
23+
'#clock-cells':
24+
const: 1
25+
26+
clocks:
27+
minItems: 14
28+
items:
29+
- description: input oscillator
30+
- description: input sys clk
31+
- description: input fixed pll
32+
- description: input fclk div 2
33+
- description: input fclk div 2p5
34+
- description: input fclk div 3
35+
- description: input fclk div 4
36+
- description: input fclk div 5
37+
- description: input fclk div 7
38+
- description: input hifi pll
39+
- description: input gp0 pll
40+
- description: input gp1 pll
41+
- description: input mpll1
42+
- description: input mpll2
43+
- description: external input rmii oscillator (optional)
44+
- description: input video pll0 (optional)
45+
- description: external pad input for rtc (optional)
46+
47+
clock-names:
48+
minItems: 14
49+
items:
50+
- const: xtal
51+
- const: sys
52+
- const: fix
53+
- const: fdiv2
54+
- const: fdiv2p5
55+
- const: fdiv3
56+
- const: fdiv4
57+
- const: fdiv5
58+
- const: fdiv7
59+
- const: hifi
60+
- const: gp0
61+
- const: gp1
62+
- const: mpll1
63+
- const: mpll2
64+
- const: ext_rmii
65+
- const: vid_pll0
66+
- const: ext_rtc
67+
68+
required:
69+
- compatible
70+
- '#clock-cells'
71+
- reg
72+
- clocks
73+
- clock-names
74+
75+
additionalProperties: false
76+
77+
examples:
78+
- |
79+
apb {
80+
#address-cells = <2>;
81+
#size-cells = <2>;
82+
83+
clkc_periphs:clock-controller@0 {
84+
compatible = "amlogic,t7-peripherals-clkc";
85+
reg = <0 0x0 0 0x1c8>;
86+
#clock-cells = <1>;
87+
clocks = <&xtal>,
88+
<&scmi_clk 13>,
89+
<&scmi_clk 16>,
90+
<&scmi_clk 18>,
91+
<&scmi_clk 20>,
92+
<&scmi_clk 22>,
93+
<&scmi_clk 24>,
94+
<&scmi_clk 26>,
95+
<&scmi_clk 28>,
96+
<&hifi 1>,
97+
<&gp0 1>,
98+
<&gp1 1>,
99+
<&mpll 4>,
100+
<&mpll 6>;
101+
clock-names = "xtal",
102+
"sys",
103+
"fix",
104+
"fdiv2",
105+
"fdiv2p5",
106+
"fdiv3",
107+
"fdiv4",
108+
"fdiv5",
109+
"fdiv7",
110+
"hifi",
111+
"gp0",
112+
"gp1",
113+
"mpll1",
114+
"mpll2";
115+
};
116+
};
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
# Copyright (C) 2024-2025 Amlogic, Inc. All rights reserved
3+
%YAML 1.2
4+
---
5+
$id: http://devicetree.org/schemas/clock/amlogic,t7-pll-clkc.yaml#
6+
$schema: http://devicetree.org/meta-schemas/core.yaml#
7+
8+
title: Amlogic T7 PLL Clock Control Controller
9+
10+
maintainers:
11+
- Neil Armstrong <neil.armstrong@linaro.org>
12+
- Jerome Brunet <jbrunet@baylibre.com>
13+
- Jian Hu <jian.hu@amlogic.com>
14+
- Xianwei Zhao <xianwei.zhao@amlogic.com>
15+
16+
properties:
17+
compatible:
18+
enum:
19+
- amlogic,t7-gp0-pll
20+
- amlogic,t7-gp1-pll
21+
- amlogic,t7-hifi-pll
22+
- amlogic,t7-pcie-pll
23+
- amlogic,t7-mpll
24+
- amlogic,t7-hdmi-pll
25+
- amlogic,t7-mclk-pll
26+
27+
reg:
28+
maxItems: 1
29+
30+
'#clock-cells':
31+
const: 1
32+
33+
clocks:
34+
items:
35+
- description: mclk pll input oscillator gate
36+
- description: oscillator input clock source for mclk_sel_0
37+
- description: fixed input clock source for mclk_sel_0
38+
minItems: 1
39+
40+
clock-names:
41+
items:
42+
- const: in0
43+
- const: in1
44+
- const: in2
45+
minItems: 1
46+
47+
required:
48+
- compatible
49+
- '#clock-cells'
50+
- reg
51+
- clocks
52+
- clock-names
53+
54+
allOf:
55+
- if:
56+
properties:
57+
compatible:
58+
contains:
59+
const: amlogic,t7-mclk-pll
60+
61+
then:
62+
properties:
63+
clocks:
64+
minItems: 3
65+
66+
clock-names:
67+
minItems: 3
68+
69+
- if:
70+
properties:
71+
compatible:
72+
contains:
73+
enum:
74+
- amlogic,t7-gp0-pll
75+
- amlogic,t7-gp1--pll
76+
- amlogic,t7-hifi-pll
77+
- amlogic,t7-pcie-pll
78+
- amlogic,t7-mpll
79+
- amlogic,t7-hdmi-pll
80+
81+
then:
82+
properties:
83+
clocks:
84+
maxItems: 1
85+
86+
clock-names:
87+
maxItems: 1
88+
89+
additionalProperties: false
90+
91+
examples:
92+
- |
93+
apb {
94+
#address-cells = <2>;
95+
#size-cells = <2>;
96+
97+
clock-controller@8080 {
98+
compatible = "amlogic,t7-gp0-pll";
99+
reg = <0 0x8080 0 0x20>;
100+
clocks = <&scmi_clk 2>;
101+
clock-names = "in0";
102+
#clock-cells = <1>;
103+
};
104+
105+
clock-controller@8300 {
106+
compatible = "amlogic,t7-mclk-pll";
107+
reg = <0 0x8300 0 0x18>;
108+
clocks = <&scmi_clk 2>,
109+
<&xtal>,
110+
<&scmi_clk 31>;
111+
clock-names = "in0", "in1", "in2";
112+
#clock-cells = <1>;
113+
};
114+
};

drivers/clk/meson/Kconfig

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,32 @@ config COMMON_CLK_S4_PERIPHERALS
201201
help
202202
Support for the peripherals clock controller on Amlogic S805X2 and S905Y4
203203
devices, AKA S4. Say Y if you want S4 peripherals clock controller to work.
204+
205+
config COMMON_CLK_T7_PLL
206+
tristate "Amlogic T7 SoC PLL controller support"
207+
depends on ARM64
208+
default ARCH_MESON
209+
select COMMON_CLK_MESON_REGMAP
210+
select COMMON_CLK_MESON_CLKC_UTILS
211+
select COMMON_CLK_MESON_MPLL
212+
select COMMON_CLK_MESON_PLL
213+
imply COMMON_CLK_SCMI
214+
help
215+
Support for the PLL clock controller on Amlogic A311D2 based
216+
device, AKA T7. PLLs are required by most peripheral to operate.
217+
Say Y if you want T7 PLL clock controller to work.
218+
219+
config COMMON_CLK_T7_PERIPHERALS
220+
tristate "Amlogic T7 SoC peripherals clock controller support"
221+
depends on ARM64
222+
default ARCH_MESON
223+
select COMMON_CLK_MESON_REGMAP
224+
select COMMON_CLK_MESON_CLKC_UTILS
225+
select COMMON_CLK_MESON_DUALDIV
226+
imply COMMON_CLK_SCMI
227+
imply COMMON_CLK_T7_PLL
228+
help
229+
Support for the peripherals clock controller on Amlogic A311D2 based
230+
device, AKA T7. Peripherals are required by most peripheral to operate.
231+
Say Y if you want T7 peripherals clock controller to work.
204232
endmenu

drivers/clk/meson/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ obj-$(CONFIG_COMMON_CLK_G12A) += g12a.o g12a-aoclk.o
2626
obj-$(CONFIG_COMMON_CLK_MESON8B) += meson8b.o meson8-ddr.o
2727
obj-$(CONFIG_COMMON_CLK_S4_PLL) += s4-pll.o
2828
obj-$(CONFIG_COMMON_CLK_S4_PERIPHERALS) += s4-peripherals.o
29+
obj-$(CONFIG_COMMON_CLK_T7_PLL) += t7-pll.o
30+
obj-$(CONFIG_COMMON_CLK_T7_PERIPHERALS) += t7-peripherals.o

drivers/clk/meson/g12a.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -777,12 +777,23 @@ static struct clk_regmap g12a_hdmi_pll_dco = {
777777
},
778778
};
779779

780+
/*
781+
* G12/SM1 hdmi OD dividers are POWER_OF_TWO dividers but limited to /4.
782+
* A divider value of 3 should map to /8 but instead map /4 so ignore it.
783+
*/
784+
static const struct clk_div_table g12a_hdmi_pll_od_div_table[] = {
785+
{ .val = 0, .div = 1 },
786+
{ .val = 1, .div = 2 },
787+
{ .val = 2, .div = 4 },
788+
{ /* sentinel */ }
789+
};
790+
780791
static struct clk_regmap g12a_hdmi_pll_od = {
781792
.data = &(struct clk_regmap_div_data){
782793
.offset = HHI_HDMI_PLL_CNTL0,
783794
.shift = 16,
784795
.width = 2,
785-
.flags = CLK_DIVIDER_POWER_OF_TWO,
796+
.table = g12a_hdmi_pll_od_div_table,
786797
},
787798
.hw.init = &(struct clk_init_data){
788799
.name = "hdmi_pll_od",
@@ -800,7 +811,7 @@ static struct clk_regmap g12a_hdmi_pll_od2 = {
800811
.offset = HHI_HDMI_PLL_CNTL0,
801812
.shift = 18,
802813
.width = 2,
803-
.flags = CLK_DIVIDER_POWER_OF_TWO,
814+
.table = g12a_hdmi_pll_od_div_table,
804815
},
805816
.hw.init = &(struct clk_init_data){
806817
.name = "hdmi_pll_od2",
@@ -818,7 +829,7 @@ static struct clk_regmap g12a_hdmi_pll = {
818829
.offset = HHI_HDMI_PLL_CNTL0,
819830
.shift = 20,
820831
.width = 2,
821-
.flags = CLK_DIVIDER_POWER_OF_TWO,
832+
.table = g12a_hdmi_pll_od_div_table,
822833
},
823834
.hw.init = &(struct clk_init_data){
824835
.name = "hdmi_pll",

drivers/clk/meson/gxbb.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,23 @@ static struct clk_regmap gxbb_hdmi_pll = {
349349
},
350350
};
351351

352+
/*
353+
* GXL hdmi OD dividers are POWER_OF_TWO dividers but limited to /4.
354+
* A divider value of 3 should map to /8 but instead map /4 so ignore it.
355+
*/
356+
static const struct clk_div_table gxl_hdmi_pll_od_div_table[] = {
357+
{ .val = 0, .div = 1 },
358+
{ .val = 1, .div = 2 },
359+
{ .val = 2, .div = 4 },
360+
{ /* sentinel */ }
361+
};
362+
352363
static struct clk_regmap gxl_hdmi_pll_od = {
353364
.data = &(struct clk_regmap_div_data){
354-
.offset = HHI_HDMI_PLL_CNTL + 8,
365+
.offset = HHI_HDMI_PLL_CNTL3,
355366
.shift = 21,
356367
.width = 2,
357-
.flags = CLK_DIVIDER_POWER_OF_TWO,
368+
.table = gxl_hdmi_pll_od_div_table,
358369
},
359370
.hw.init = &(struct clk_init_data){
360371
.name = "hdmi_pll_od",
@@ -369,10 +380,10 @@ static struct clk_regmap gxl_hdmi_pll_od = {
369380

370381
static struct clk_regmap gxl_hdmi_pll_od2 = {
371382
.data = &(struct clk_regmap_div_data){
372-
.offset = HHI_HDMI_PLL_CNTL + 8,
383+
.offset = HHI_HDMI_PLL_CNTL3,
373384
.shift = 23,
374385
.width = 2,
375-
.flags = CLK_DIVIDER_POWER_OF_TWO,
386+
.table = gxl_hdmi_pll_od_div_table,
376387
},
377388
.hw.init = &(struct clk_init_data){
378389
.name = "hdmi_pll_od2",
@@ -387,10 +398,10 @@ static struct clk_regmap gxl_hdmi_pll_od2 = {
387398

388399
static struct clk_regmap gxl_hdmi_pll = {
389400
.data = &(struct clk_regmap_div_data){
390-
.offset = HHI_HDMI_PLL_CNTL + 8,
401+
.offset = HHI_HDMI_PLL_CNTL3,
391402
.shift = 19,
392403
.width = 2,
393-
.flags = CLK_DIVIDER_POWER_OF_TWO,
404+
.table = gxl_hdmi_pll_od_div_table,
394405
},
395406
.hw.init = &(struct clk_init_data){
396407
.name = "hdmi_pll",

0 commit comments

Comments
 (0)