* [PATCH 4/7] drivers: clk: meson: Add Amlogic T7 sys pll support
@ 2026-02-18 10:19 Ronald Claveau
0 siblings, 0 replies; 3+ messages in thread
From: Ronald Claveau @ 2026-02-18 10:19 UTC (permalink / raw)
To: linux-amlogic
Cc: Ronald Claveau, Neil Armstrong, Jerome Brunet, Michael Turquette,
Stephen Boyd, Kevin Hilman, Martin Blumenstingl, linux-clk,
linux-arm-kernel, linux-kernel
Add SYS PLL for the clock controller of the Amlogic T7 SoC family.
Signed-off-by: Ronald Claveau <linux-kernel-dev@aliel.fr>
---
drivers/clk/meson/t7-peripherals.c | 134 ++++++++++++++++++++++++++++-
1 file changed, 131 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/meson/t7-peripherals.c b/drivers/clk/meson/t7-peripherals.c
index 214db7850d86..de206473f3a7 100644
--- a/drivers/clk/meson/t7-peripherals.c
+++ b/drivers/clk/meson/t7-peripherals.c
@@ -176,6 +176,127 @@ static struct clk_regmap t7_rtc = {
},
};
+static u32 t7_sys_parents_val_table[] = { 0, 1, 2, 3, 4, 5, 7 };
+static const struct clk_parent_data t7_sys_parents[] = {
+ { .fw_name = "xtal", },
+ { .fw_name = "fdiv2", },
+ { .fw_name = "fdiv3", },
+ { .fw_name = "fdiv4", },
+ { .fw_name = "fdiv5", },
+ { .fw_name = "axi_clk_frcpu", },
+ { .hw = &t7_rtc.hw },
+};
+
+static struct clk_regmap t7_sys_a_sel = {
+ .data = &(struct clk_regmap_mux_data){
+ .offset = SYS_CLK_CTRL0,
+ .mask = 0x7,
+ .shift = 10,
+ .table = t7_sys_parents_val_table,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "sys_a_sel",
+ .ops = &clk_regmap_mux_ops,
+ .parent_data = t7_sys_parents,
+ .num_parents = ARRAY_SIZE(t7_sys_parents),
+ },
+};
+
+static struct clk_regmap t7_sys_a_div = {
+ .data = &(struct clk_regmap_div_data){
+ .offset = SYS_CLK_CTRL0,
+ .shift = 0,
+ .width = 10,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "sys_a_div",
+ .ops = &clk_regmap_divider_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &t7_sys_a_sel.hw
+ },
+ .num_parents = 1,
+ .flags = CLK_SET_RATE_PARENT,
+ },
+};
+
+static struct clk_regmap t7_sys_a = {
+ .data = &(struct clk_regmap_gate_data){
+ .offset = SYS_CLK_CTRL0,
+ .bit_idx = 13,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "sys_a",
+ .ops = &clk_regmap_gate_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &t7_sys_a_div.hw
+ },
+ .num_parents = 1,
+ },
+};
+
+static struct clk_regmap t7_sys_b_sel = {
+ .data = &(struct clk_regmap_mux_data){
+ .offset = SYS_CLK_CTRL0,
+ .mask = 0x7,
+ .shift = 26,
+ .table = t7_sys_parents_val_table,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "sys_b_sel",
+ .ops = &clk_regmap_mux_ops,
+ .parent_data = t7_sys_parents,
+ .num_parents = ARRAY_SIZE(t7_sys_parents),
+ },
+};
+
+static struct clk_regmap t7_sys_b_div = {
+ .data = &(struct clk_regmap_div_data){
+ .offset = SYS_CLK_CTRL0,
+ .shift = 16,
+ .width = 10,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "sys_b_div",
+ .ops = &clk_regmap_divider_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &t7_sys_b_sel.hw
+ },
+ .num_parents = 1,
+ },
+};
+
+static struct clk_regmap t7_sys_b = {
+ .data = &(struct clk_regmap_gate_data){
+ .offset = SYS_CLK_CTRL0,
+ .bit_idx = 29,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "sys_b",
+ .ops = &clk_regmap_gate_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &t7_sys_b_div.hw
+ },
+ .num_parents = 1,
+ },
+};
+
+static struct clk_regmap t7_sys = {
+ .data = &(struct clk_regmap_mux_data){
+ .offset = SYS_CLK_CTRL0,
+ .mask = 0x1,
+ .shift = 15,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "sys_clk",
+ .ops = &clk_regmap_mux_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &t7_sys_a.hw,
+ &t7_sys_b.hw,
+ },
+ .num_parents = 2,
+ },
+};
+
static struct clk_regmap t7_ceca_dualdiv_in = {
.data = &(struct clk_regmap_gate_data){
.offset = CECA_CTRL0,
@@ -824,7 +945,7 @@ static T7_COMP_GATE(sd_emmc_c, NAND_CLK_CTRL, 7, 0);
static const struct clk_parent_data t7_spicc_parents[] = {
{ .fw_name = "xtal", },
- { .fw_name = "sys", },
+ { .hw = &t7_sys.hw },
{ .fw_name = "fdiv4", },
{ .fw_name = "fdiv3", },
{ .fw_name = "fdiv2", },
@@ -859,7 +980,7 @@ static T7_COMP_GATE(spicc5, SPICC_CLK_CTRL2, 22, 0);
static const struct clk_parent_data t7_saradc_parents[] = {
{ .fw_name = "xtal" },
- { .fw_name = "sys" },
+ { .hw = &t7_sys.hw },
};
static T7_COMP_SEL(saradc, SAR_CLK_CTRL0, 9, 0x1, t7_saradc_parents);
@@ -929,7 +1050,7 @@ static T7_COMP_SEL(pwm_ao_h, PWM_CLK_AO_GH_CTRL, 25, 0x3, t7_pwm_parents);
static T7_COMP_DIV(pwm_ao_h, PWM_CLK_AO_GH_CTRL, 16, 8);
static T7_COMP_GATE(pwm_ao_h, PWM_CLK_AO_GH_CTRL, 24, 0);
-static const struct clk_parent_data t7_sys_pclk_parents = { .fw_name = "sys" };
+static const struct clk_parent_data t7_sys_pclk_parents = { .hw = &t7_sys.hw };
#define T7_SYS_PCLK(_name, _reg, _bit, _flags) \
MESON_PCLK(t7_##_name, _reg, _bit, &t7_sys_pclk_parents, _flags)
@@ -1161,6 +1282,13 @@ static struct clk_hw *t7_peripherals_hw_clks[] = {
[CLKID_PWM_AO_H_SEL] = &t7_pwm_ao_h_sel.hw,
[CLKID_PWM_AO_H_DIV] = &t7_pwm_ao_h_div.hw,
[CLKID_PWM_AO_H] = &t7_pwm_ao_h.hw,
+ [CLKID_SYS_A_SEL] = &t7_sys_a_sel.hw,
+ [CLKID_SYS_A_DIV] = &t7_sys_a_div.hw,
+ [CLKID_SYS_A] = &t7_sys_a.hw,
+ [CLKID_SYS_B_SEL] = &t7_sys_b_sel.hw,
+ [CLKID_SYS_B_DIV] = &t7_sys_b_div.hw,
+ [CLKID_SYS_B] = &t7_sys_b.hw,
+ [CLKID_SYS] = &t7_sys.hw,
[CLKID_SYS_DDR] = &t7_sys_ddr.hw,
[CLKID_SYS_DOS] = &t7_sys_dos.hw,
[CLKID_SYS_MIPI_DSI_A] = &t7_sys_mipi_dsi_a.hw,
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 1/7] drivers: clk: meson: Add Amlogic T7 fix pll support
@ 2026-02-18 10:17 Ronald Claveau
2026-02-18 11:00 ` [PATCH 4/7] drivers: clk: meson: Add Amlogic T7 sys " Ronald Claveau
0 siblings, 1 reply; 3+ messages in thread
From: Ronald Claveau @ 2026-02-18 10:17 UTC (permalink / raw)
To: linux-amlogic
Cc: Ronald Claveau, Neil Armstrong, Jerome Brunet, Michael Turquette,
Stephen Boyd, Kevin Hilman, Martin Blumenstingl, linux-clk,
linux-arm-kernel, linux-kernel
Add PLL for the clock controller of the Amlogic T7 SoC family.
Signed-off-by: Ronald Claveau <linux-kernel-dev@aliel.fr>
---
drivers/clk/meson/t7-pll.c | 257 +++++++++++++++++++++++++++++++++++++
1 file changed, 257 insertions(+)
diff --git a/drivers/clk/meson/t7-pll.c b/drivers/clk/meson/t7-pll.c
index 0a622f45fa36..3dd3aca50b7c 100644
--- a/drivers/clk/meson/t7-pll.c
+++ b/drivers/clk/meson/t7-pll.c
@@ -71,6 +71,15 @@
#define MCLK_PLL_CNTL4 0x10
#define MCLK_PLL_STS 0x14
+#define FPLL_CTRL0 0x00
+#define FPLL_CTRL1 0x04
+#define FPLL_CTRL2 0x08
+#define FPLL_CTRL3 0x0c
+#define FPLL_CTRL4 0x10
+#define FPLL_CTRL5 0x14
+#define FPLL_CTRL6 0x18
+#define FPLL_STS 0x1c
+
static const struct pll_mult_range t7_media_pll_mult_range = {
.min = 125,
.max = 250,
@@ -1047,6 +1056,253 @@ static const struct meson_clkc_data t7_mclk_data = {
},
};
+static struct clk_regmap t7_fpll_dco = {
+ .data = &(struct meson_clk_pll_data){
+ .en = {
+ .reg_off = FPLL_CTRL0,
+ .shift = 28,
+ .width = 1,
+ },
+ .m = {
+ .reg_off = FPLL_CTRL0,
+ .shift = 0,
+ .width = 8,
+ },
+ .n = {
+ .reg_off = FPLL_CTRL0,
+ .shift = 10,
+ .width = 5,
+ },
+ .frac = {
+ .reg_off = FPLL_CTRL1,
+ .shift = 0,
+ .width = 17,
+ },
+ .l = {
+ .reg_off = FPLL_CTRL0,
+ .shift = 31,
+ .width = 1,
+ },
+ .rst = {
+ .reg_off = FPLL_CTRL0,
+ .shift = 29,
+ .width = 1,
+ },
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "fpll_dco",
+ .ops = &meson_clk_pll_ro_ops,
+ .parent_data = &(const struct clk_parent_data) {
+ .fw_name = "xtal",
+ },
+ .num_parents = 1,
+ },
+};
+
+static struct clk_regmap t7_fpll = {
+ .data = &(struct clk_regmap_div_data){
+ .offset = FPLL_CTRL0,
+ .shift = 16,
+ .width = 2,
+ .flags = CLK_DIVIDER_POWER_OF_TWO,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "fpll",
+ .ops = &clk_regmap_divider_ro_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &t7_fpll_dco.hw
+ },
+ .num_parents = 1,
+ },
+};
+
+static struct clk_fixed_factor t7_fdiv2_div = {
+ .mult = 1,
+ .div = 2,
+ .hw.init = &(struct clk_init_data){
+ .name = "fdiv2_div",
+ .ops = &clk_fixed_factor_ops,
+ .parent_hws = (const struct clk_hw *[]) { &t7_fpll.hw },
+ .num_parents = 1,
+ },
+};
+
+static struct clk_regmap t7_fdiv2 = {
+ .data = &(struct clk_regmap_gate_data){
+ .offset = FPLL_CTRL1,
+ .bit_idx = 24,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "fdiv2",
+ .ops = &clk_regmap_gate_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &t7_fdiv2_div.hw
+ },
+ .num_parents = 1,
+ .flags = CLK_IS_CRITICAL,
+ },
+};
+
+static struct clk_fixed_factor t7_fdiv2p5_div = {
+ .mult = 2,
+ .div = 5,
+ .hw.init = &(struct clk_init_data){
+ .name = "fdiv2p5_div",
+ .ops = &clk_fixed_factor_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &t7_fpll.hw
+ },
+ .num_parents = 1,
+ },
+};
+
+static struct clk_regmap t7_fdiv2p5 = {
+ .data = &(struct clk_regmap_gate_data){
+ .offset = FPLL_CTRL1,
+ .bit_idx = 25,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "fdiv2p5",
+ .ops = &clk_regmap_gate_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &t7_fdiv2p5_div.hw
+ },
+ .num_parents = 1,
+ },
+};
+
+static struct clk_fixed_factor t7_fdiv3_div = {
+ .mult = 1,
+ .div = 3,
+ .hw.init = &(struct clk_init_data){
+ .name = "fdiv3_div",
+ .ops = &clk_fixed_factor_ops,
+ .parent_hws = (const struct clk_hw *[]) { &t7_fpll.hw },
+ .num_parents = 1,
+ },
+};
+
+static struct clk_regmap t7_fdiv3 = {
+ .data = &(struct clk_regmap_gate_data){
+ .offset = FPLL_CTRL1,
+ .bit_idx = 20,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "fdiv3",
+ .ops = &clk_regmap_gate_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &t7_fdiv3_div.hw
+ },
+ .num_parents = 1,
+ .flags = CLK_IS_CRITICAL,
+ },
+};
+
+static struct clk_fixed_factor t7_fdiv4_div = {
+ .mult = 1,
+ .div = 4,
+ .hw.init = &(struct clk_init_data){
+ .name = "fdiv4_div",
+ .ops = &clk_fixed_factor_ops,
+ .parent_hws = (const struct clk_hw *[]) { &t7_fpll.hw },
+ .num_parents = 1,
+ },
+};
+
+static struct clk_regmap t7_fdiv4 = {
+ .data = &(struct clk_regmap_gate_data){
+ .offset = FPLL_CTRL1,
+ .bit_idx = 21,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "fdiv4",
+ .ops = &clk_regmap_gate_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &t7_fdiv4_div.hw
+ },
+ .num_parents = 1,
+ .flags = CLK_IS_CRITICAL,
+ },
+};
+
+static struct clk_fixed_factor t7_fdiv5_div = {
+ .mult = 1,
+ .div = 5,
+ .hw.init = &(struct clk_init_data){
+ .name = "fdiv5_div",
+ .ops = &clk_fixed_factor_ops,
+ .parent_hws = (const struct clk_hw *[]) { &t7_fpll.hw },
+ .num_parents = 1,
+ },
+};
+
+static struct clk_regmap t7_fdiv5 = {
+ .data = &(struct clk_regmap_gate_data){
+ .offset = FPLL_CTRL1,
+ .bit_idx = 22,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "fdiv5",
+ .ops = &clk_regmap_gate_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &t7_fdiv5_div.hw
+ },
+ .num_parents = 1,
+ .flags = CLK_IS_CRITICAL,
+ },
+};
+
+static struct clk_fixed_factor t7_fdiv7_div = {
+ .mult = 1,
+ .div = 7,
+ .hw.init = &(struct clk_init_data){
+ .name = "fdiv7_div",
+ .ops = &clk_fixed_factor_ops,
+ .parent_hws = (const struct clk_hw *[]) { &t7_fpll.hw },
+ .num_parents = 1,
+ },
+};
+
+static struct clk_regmap t7_fdiv7 = {
+ .data = &(struct clk_regmap_gate_data){
+ .offset = FPLL_CTRL1,
+ .bit_idx = 23,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "fdiv7",
+ .ops = &clk_regmap_gate_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &t7_fdiv7_div.hw
+ },
+ .num_parents = 1,
+ .flags = CLK_IS_CRITICAL,
+ },
+};
+
+static struct clk_hw *t7_fpll_hw_clks[] = {
+ [CLKID_FPLL_DCO] = &t7_fpll_dco.hw,
+ [CLKID_FPLL] = &t7_fpll.hw,
+ [CLKID_FDIV2_DIV] = &t7_fdiv2_div.hw,
+ [CLKID_FDIV2] = &t7_fdiv2.hw,
+ [CLKID_FDIV2P5_DIV] = &t7_fdiv2p5_div.hw,
+ [CLKID_FDIV2P5] = &t7_fdiv2p5.hw,
+ [CLKID_FDIV3_DIV] = &t7_fdiv3_div.hw,
+ [CLKID_FDIV3] = &t7_fdiv3.hw,
+ [CLKID_FDIV4_DIV] = &t7_fdiv4_div.hw,
+ [CLKID_FDIV4] = &t7_fdiv4.hw,
+ [CLKID_FDIV5_DIV] = &t7_fdiv5_div.hw,
+ [CLKID_FDIV5] = &t7_fdiv5.hw,
+ [CLKID_FDIV7_DIV] = &t7_fdiv7_div.hw,
+ [CLKID_FDIV7] = &t7_fdiv7.hw,
+};
+
+static const struct meson_clkc_data t7_fpll_data = {
+ .hw_clks = {
+ .hws = t7_fpll_hw_clks,
+ .num = ARRAY_SIZE(t7_fpll_hw_clks),
+ },
+};
+
static const struct of_device_id t7_pll_clkc_match_table[] = {
{ .compatible = "amlogic,t7-gp0-pll", .data = &t7_gp0_data, },
{ .compatible = "amlogic,t7-gp1-pll", .data = &t7_gp1_data, },
@@ -1055,6 +1311,7 @@ static const struct of_device_id t7_pll_clkc_match_table[] = {
{ .compatible = "amlogic,t7-mpll", .data = &t7_mpll_data, },
{ .compatible = "amlogic,t7-hdmi-pll", .data = &t7_hdmi_data, },
{ .compatible = "amlogic,t7-mclk-pll", .data = &t7_mclk_data, },
+ { .compatible = "amlogic,t7-fpll", .data = &t7_fpll_data, },
{}
};
MODULE_DEVICE_TABLE(of, t7_pll_clkc_match_table);
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 4/7] drivers: clk: meson: Add Amlogic T7 sys pll support
2026-02-18 10:17 [PATCH 1/7] drivers: clk: meson: Add Amlogic T7 fix " Ronald Claveau
@ 2026-02-18 11:00 ` Ronald Claveau
2026-02-18 18:30 ` Jerome Brunet
0 siblings, 1 reply; 3+ messages in thread
From: Ronald Claveau @ 2026-02-18 11:00 UTC (permalink / raw)
To: linux-amlogic
Cc: Ronald Claveau, Neil Armstrong, Jerome Brunet, Michael Turquette,
Stephen Boyd, Kevin Hilman, Martin Blumenstingl, linux-clk,
linux-arm-kernel, linux-kernel
Add SYS PLL for the clock controller of the Amlogic T7 SoC family.
Signed-off-by: Ronald Claveau <linux-kernel-dev@aliel.fr>
---
drivers/clk/meson/t7-peripherals.c | 134 ++++++++++++++++++++++++++++-
1 file changed, 131 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/meson/t7-peripherals.c b/drivers/clk/meson/t7-peripherals.c
index 214db7850d86..de206473f3a7 100644
--- a/drivers/clk/meson/t7-peripherals.c
+++ b/drivers/clk/meson/t7-peripherals.c
@@ -176,6 +176,127 @@ static struct clk_regmap t7_rtc = {
},
};
+static u32 t7_sys_parents_val_table[] = { 0, 1, 2, 3, 4, 5, 7 };
+static const struct clk_parent_data t7_sys_parents[] = {
+ { .fw_name = "xtal", },
+ { .fw_name = "fdiv2", },
+ { .fw_name = "fdiv3", },
+ { .fw_name = "fdiv4", },
+ { .fw_name = "fdiv5", },
+ { .fw_name = "axi_clk_frcpu", },
+ { .hw = &t7_rtc.hw },
+};
+
+static struct clk_regmap t7_sys_a_sel = {
+ .data = &(struct clk_regmap_mux_data){
+ .offset = SYS_CLK_CTRL0,
+ .mask = 0x7,
+ .shift = 10,
+ .table = t7_sys_parents_val_table,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "sys_a_sel",
+ .ops = &clk_regmap_mux_ops,
+ .parent_data = t7_sys_parents,
+ .num_parents = ARRAY_SIZE(t7_sys_parents),
+ },
+};
+
+static struct clk_regmap t7_sys_a_div = {
+ .data = &(struct clk_regmap_div_data){
+ .offset = SYS_CLK_CTRL0,
+ .shift = 0,
+ .width = 10,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "sys_a_div",
+ .ops = &clk_regmap_divider_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &t7_sys_a_sel.hw
+ },
+ .num_parents = 1,
+ .flags = CLK_SET_RATE_PARENT,
+ },
+};
+
+static struct clk_regmap t7_sys_a = {
+ .data = &(struct clk_regmap_gate_data){
+ .offset = SYS_CLK_CTRL0,
+ .bit_idx = 13,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "sys_a",
+ .ops = &clk_regmap_gate_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &t7_sys_a_div.hw
+ },
+ .num_parents = 1,
+ },
+};
+
+static struct clk_regmap t7_sys_b_sel = {
+ .data = &(struct clk_regmap_mux_data){
+ .offset = SYS_CLK_CTRL0,
+ .mask = 0x7,
+ .shift = 26,
+ .table = t7_sys_parents_val_table,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "sys_b_sel",
+ .ops = &clk_regmap_mux_ops,
+ .parent_data = t7_sys_parents,
+ .num_parents = ARRAY_SIZE(t7_sys_parents),
+ },
+};
+
+static struct clk_regmap t7_sys_b_div = {
+ .data = &(struct clk_regmap_div_data){
+ .offset = SYS_CLK_CTRL0,
+ .shift = 16,
+ .width = 10,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "sys_b_div",
+ .ops = &clk_regmap_divider_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &t7_sys_b_sel.hw
+ },
+ .num_parents = 1,
+ },
+};
+
+static struct clk_regmap t7_sys_b = {
+ .data = &(struct clk_regmap_gate_data){
+ .offset = SYS_CLK_CTRL0,
+ .bit_idx = 29,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "sys_b",
+ .ops = &clk_regmap_gate_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &t7_sys_b_div.hw
+ },
+ .num_parents = 1,
+ },
+};
+
+static struct clk_regmap t7_sys = {
+ .data = &(struct clk_regmap_mux_data){
+ .offset = SYS_CLK_CTRL0,
+ .mask = 0x1,
+ .shift = 15,
+ },
+ .hw.init = &(struct clk_init_data){
+ .name = "sys_clk",
+ .ops = &clk_regmap_mux_ops,
+ .parent_hws = (const struct clk_hw *[]) {
+ &t7_sys_a.hw,
+ &t7_sys_b.hw,
+ },
+ .num_parents = 2,
+ },
+};
+
static struct clk_regmap t7_ceca_dualdiv_in = {
.data = &(struct clk_regmap_gate_data){
.offset = CECA_CTRL0,
@@ -824,7 +945,7 @@ static T7_COMP_GATE(sd_emmc_c, NAND_CLK_CTRL, 7, 0);
static const struct clk_parent_data t7_spicc_parents[] = {
{ .fw_name = "xtal", },
- { .fw_name = "sys", },
+ { .hw = &t7_sys.hw },
{ .fw_name = "fdiv4", },
{ .fw_name = "fdiv3", },
{ .fw_name = "fdiv2", },
@@ -859,7 +980,7 @@ static T7_COMP_GATE(spicc5, SPICC_CLK_CTRL2, 22, 0);
static const struct clk_parent_data t7_saradc_parents[] = {
{ .fw_name = "xtal" },
- { .fw_name = "sys" },
+ { .hw = &t7_sys.hw },
};
static T7_COMP_SEL(saradc, SAR_CLK_CTRL0, 9, 0x1, t7_saradc_parents);
@@ -929,7 +1050,7 @@ static T7_COMP_SEL(pwm_ao_h, PWM_CLK_AO_GH_CTRL, 25, 0x3, t7_pwm_parents);
static T7_COMP_DIV(pwm_ao_h, PWM_CLK_AO_GH_CTRL, 16, 8);
static T7_COMP_GATE(pwm_ao_h, PWM_CLK_AO_GH_CTRL, 24, 0);
-static const struct clk_parent_data t7_sys_pclk_parents = { .fw_name = "sys" };
+static const struct clk_parent_data t7_sys_pclk_parents = { .hw = &t7_sys.hw };
#define T7_SYS_PCLK(_name, _reg, _bit, _flags) \
MESON_PCLK(t7_##_name, _reg, _bit, &t7_sys_pclk_parents, _flags)
@@ -1161,6 +1282,13 @@ static struct clk_hw *t7_peripherals_hw_clks[] = {
[CLKID_PWM_AO_H_SEL] = &t7_pwm_ao_h_sel.hw,
[CLKID_PWM_AO_H_DIV] = &t7_pwm_ao_h_div.hw,
[CLKID_PWM_AO_H] = &t7_pwm_ao_h.hw,
+ [CLKID_SYS_A_SEL] = &t7_sys_a_sel.hw,
+ [CLKID_SYS_A_DIV] = &t7_sys_a_div.hw,
+ [CLKID_SYS_A] = &t7_sys_a.hw,
+ [CLKID_SYS_B_SEL] = &t7_sys_b_sel.hw,
+ [CLKID_SYS_B_DIV] = &t7_sys_b_div.hw,
+ [CLKID_SYS_B] = &t7_sys_b.hw,
+ [CLKID_SYS] = &t7_sys.hw,
[CLKID_SYS_DDR] = &t7_sys_ddr.hw,
[CLKID_SYS_DOS] = &t7_sys_dos.hw,
[CLKID_SYS_MIPI_DSI_A] = &t7_sys_mipi_dsi_a.hw,
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 4/7] drivers: clk: meson: Add Amlogic T7 sys pll support
2026-02-18 11:00 ` [PATCH 4/7] drivers: clk: meson: Add Amlogic T7 sys " Ronald Claveau
@ 2026-02-18 18:30 ` Jerome Brunet
0 siblings, 0 replies; 3+ messages in thread
From: Jerome Brunet @ 2026-02-18 18:30 UTC (permalink / raw)
To: Ronald Claveau
Cc: linux-amlogic, Neil Armstrong, Michael Turquette, Stephen Boyd,
Kevin Hilman, Martin Blumenstingl, linux-clk, linux-arm-kernel,
linux-kernel
On mer. 18 févr. 2026 at 12:00, Ronald Claveau <linux-kernel-dev@aliel.fr> wrote:
> Add SYS PLL for the clock controller of the Amlogic T7 SoC family.
Like the FDIVs, I think this is provided by SCMI.
Check include/dt-bindings/clock/amlogic,t7-scmi.h
>
> Signed-off-by: Ronald Claveau <linux-kernel-dev@aliel.fr>
> ---
> drivers/clk/meson/t7-peripherals.c | 134 ++++++++++++++++++++++++++++-
> 1 file changed, 131 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/meson/t7-peripherals.c b/drivers/clk/meson/t7-peripherals.c
> index 214db7850d86..de206473f3a7 100644
> --- a/drivers/clk/meson/t7-peripherals.c
> +++ b/drivers/clk/meson/t7-peripherals.c
> @@ -176,6 +176,127 @@ static struct clk_regmap t7_rtc = {
> },
> };
>
> +static u32 t7_sys_parents_val_table[] = { 0, 1, 2, 3, 4, 5, 7 };
> +static const struct clk_parent_data t7_sys_parents[] = {
> + { .fw_name = "xtal", },
> + { .fw_name = "fdiv2", },
> + { .fw_name = "fdiv3", },
> + { .fw_name = "fdiv4", },
> + { .fw_name = "fdiv5", },
> + { .fw_name = "axi_clk_frcpu", },
> + { .hw = &t7_rtc.hw },
> +};
> +
> +static struct clk_regmap t7_sys_a_sel = {
> + .data = &(struct clk_regmap_mux_data){
> + .offset = SYS_CLK_CTRL0,
> + .mask = 0x7,
> + .shift = 10,
> + .table = t7_sys_parents_val_table,
> + },
> + .hw.init = &(struct clk_init_data){
> + .name = "sys_a_sel",
> + .ops = &clk_regmap_mux_ops,
> + .parent_data = t7_sys_parents,
> + .num_parents = ARRAY_SIZE(t7_sys_parents),
> + },
> +};
> +
> +static struct clk_regmap t7_sys_a_div = {
> + .data = &(struct clk_regmap_div_data){
> + .offset = SYS_CLK_CTRL0,
> + .shift = 0,
> + .width = 10,
> + },
> + .hw.init = &(struct clk_init_data){
> + .name = "sys_a_div",
> + .ops = &clk_regmap_divider_ops,
> + .parent_hws = (const struct clk_hw *[]) {
> + &t7_sys_a_sel.hw
> + },
> + .num_parents = 1,
> + .flags = CLK_SET_RATE_PARENT,
> + },
> +};
> +
> +static struct clk_regmap t7_sys_a = {
> + .data = &(struct clk_regmap_gate_data){
> + .offset = SYS_CLK_CTRL0,
> + .bit_idx = 13,
> + },
> + .hw.init = &(struct clk_init_data){
> + .name = "sys_a",
> + .ops = &clk_regmap_gate_ops,
> + .parent_hws = (const struct clk_hw *[]) {
> + &t7_sys_a_div.hw
> + },
> + .num_parents = 1,
> + },
> +};
> +
> +static struct clk_regmap t7_sys_b_sel = {
> + .data = &(struct clk_regmap_mux_data){
> + .offset = SYS_CLK_CTRL0,
> + .mask = 0x7,
> + .shift = 26,
> + .table = t7_sys_parents_val_table,
> + },
> + .hw.init = &(struct clk_init_data){
> + .name = "sys_b_sel",
> + .ops = &clk_regmap_mux_ops,
> + .parent_data = t7_sys_parents,
> + .num_parents = ARRAY_SIZE(t7_sys_parents),
> + },
> +};
> +
> +static struct clk_regmap t7_sys_b_div = {
> + .data = &(struct clk_regmap_div_data){
> + .offset = SYS_CLK_CTRL0,
> + .shift = 16,
> + .width = 10,
> + },
> + .hw.init = &(struct clk_init_data){
> + .name = "sys_b_div",
> + .ops = &clk_regmap_divider_ops,
> + .parent_hws = (const struct clk_hw *[]) {
> + &t7_sys_b_sel.hw
> + },
> + .num_parents = 1,
> + },
> +};
> +
> +static struct clk_regmap t7_sys_b = {
> + .data = &(struct clk_regmap_gate_data){
> + .offset = SYS_CLK_CTRL0,
> + .bit_idx = 29,
> + },
> + .hw.init = &(struct clk_init_data){
> + .name = "sys_b",
> + .ops = &clk_regmap_gate_ops,
> + .parent_hws = (const struct clk_hw *[]) {
> + &t7_sys_b_div.hw
> + },
> + .num_parents = 1,
> + },
> +};
> +
> +static struct clk_regmap t7_sys = {
> + .data = &(struct clk_regmap_mux_data){
> + .offset = SYS_CLK_CTRL0,
> + .mask = 0x1,
> + .shift = 15,
> + },
> + .hw.init = &(struct clk_init_data){
> + .name = "sys_clk",
> + .ops = &clk_regmap_mux_ops,
> + .parent_hws = (const struct clk_hw *[]) {
> + &t7_sys_a.hw,
> + &t7_sys_b.hw,
> + },
> + .num_parents = 2,
> + },
> +};
> +
> static struct clk_regmap t7_ceca_dualdiv_in = {
> .data = &(struct clk_regmap_gate_data){
> .offset = CECA_CTRL0,
> @@ -824,7 +945,7 @@ static T7_COMP_GATE(sd_emmc_c, NAND_CLK_CTRL, 7, 0);
>
> static const struct clk_parent_data t7_spicc_parents[] = {
> { .fw_name = "xtal", },
> - { .fw_name = "sys", },
> + { .hw = &t7_sys.hw },
> { .fw_name = "fdiv4", },
> { .fw_name = "fdiv3", },
> { .fw_name = "fdiv2", },
> @@ -859,7 +980,7 @@ static T7_COMP_GATE(spicc5, SPICC_CLK_CTRL2, 22, 0);
>
> static const struct clk_parent_data t7_saradc_parents[] = {
> { .fw_name = "xtal" },
> - { .fw_name = "sys" },
> + { .hw = &t7_sys.hw },
> };
>
> static T7_COMP_SEL(saradc, SAR_CLK_CTRL0, 9, 0x1, t7_saradc_parents);
> @@ -929,7 +1050,7 @@ static T7_COMP_SEL(pwm_ao_h, PWM_CLK_AO_GH_CTRL, 25, 0x3, t7_pwm_parents);
> static T7_COMP_DIV(pwm_ao_h, PWM_CLK_AO_GH_CTRL, 16, 8);
> static T7_COMP_GATE(pwm_ao_h, PWM_CLK_AO_GH_CTRL, 24, 0);
>
> -static const struct clk_parent_data t7_sys_pclk_parents = { .fw_name = "sys" };
> +static const struct clk_parent_data t7_sys_pclk_parents = { .hw = &t7_sys.hw };
>
> #define T7_SYS_PCLK(_name, _reg, _bit, _flags) \
> MESON_PCLK(t7_##_name, _reg, _bit, &t7_sys_pclk_parents, _flags)
> @@ -1161,6 +1282,13 @@ static struct clk_hw *t7_peripherals_hw_clks[] = {
> [CLKID_PWM_AO_H_SEL] = &t7_pwm_ao_h_sel.hw,
> [CLKID_PWM_AO_H_DIV] = &t7_pwm_ao_h_div.hw,
> [CLKID_PWM_AO_H] = &t7_pwm_ao_h.hw,
> + [CLKID_SYS_A_SEL] = &t7_sys_a_sel.hw,
> + [CLKID_SYS_A_DIV] = &t7_sys_a_div.hw,
> + [CLKID_SYS_A] = &t7_sys_a.hw,
> + [CLKID_SYS_B_SEL] = &t7_sys_b_sel.hw,
> + [CLKID_SYS_B_DIV] = &t7_sys_b_div.hw,
> + [CLKID_SYS_B] = &t7_sys_b.hw,
> + [CLKID_SYS] = &t7_sys.hw,
> [CLKID_SYS_DDR] = &t7_sys_ddr.hw,
> [CLKID_SYS_DOS] = &t7_sys_dos.hw,
> [CLKID_SYS_MIPI_DSI_A] = &t7_sys_mipi_dsi_a.hw,
--
Jerome
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-18 18:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-18 10:19 [PATCH 4/7] drivers: clk: meson: Add Amlogic T7 sys pll support Ronald Claveau
-- strict thread matches above, loose matches on Subject: below --
2026-02-18 10:17 [PATCH 1/7] drivers: clk: meson: Add Amlogic T7 fix " Ronald Claveau
2026-02-18 11:00 ` [PATCH 4/7] drivers: clk: meson: Add Amlogic T7 sys " Ronald Claveau
2026-02-18 18:30 ` Jerome Brunet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox