Skip to contentSkip to conversation

Add support for MT8196 clock controllers

PATCH Applied Laura Nao 3 participants 59 messages Sep 15, 2025 – Oct 24, 2025

Subsystems (6)
lore
Share & tools
lore

Laura Nao

author
#0 lore raw

v6 cover Add support for MT8196 clock controllers

This patch series introduces support for the clock controllers on the MediaTek MT8196 platform, following up on an earlier submission[1].

MT8196 uses a hardware voting mechanism to control some of the clock muxes and gates, along with a fence register responsible for tracking PLL and mux gate readiness. The series introduces support for these voting and fence mechanisms, and includes drivers for all clock controllers on the platform.

[1] https://lore.kernel.org/all/[email protected]/

Changes in v6:
- Removed unnecessary braces in clk-mux and clk-gate
- Excluded clk26m from the parent lists of vlp_audio_h, vlp_aud_engen1, vlp_aud_engen2, and vlp_aud_intbus
- Reordered entries in of_match_clk_mt8196_mdpsys
- Converted mfg_eb clock into a mux with a gate

Link to v5: https://lore.kernel.org/all/[email protected]/

Laura Nao (27):
clk: mediatek: clk-pll: Add set/clr regs for shared PLL enable control
clk: mediatek: clk-pll: Add ops for PLLs using set/clr regs and FENC
clk: mediatek: clk-mux: Add ops for mux gates with set/clr/upd and
FENC
clk: mediatek: clk-mtk: Introduce mtk_clk_get_hwv_regmap()
clk: mediatek: clk-mux: Add ops for mux gates with HW voter and FENC
clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use
mtk_gate struct
clk: mediatek: clk-gate: Add ops for gates with HW voter
clk: mediatek: clk-mtk: Add MUX_DIV_GATE macro
dt-bindings: clock: mediatek: Describe MT8196 clock controllers
clk: mediatek: Add MT8196 apmixedsys clock support
clk: mediatek: Add MT8196 topckgen clock support
clk: mediatek: Add MT8196 topckgen2 clock support
clk: mediatek: Add MT8196 vlpckgen clock support
clk: mediatek: Add MT8196 peripheral clock support
clk: mediatek: Add MT8196 ufssys clock support
clk: mediatek: Add MT8196 pextpsys clock support
clk: mediatek: Add MT8196 I2C clock support
clk: mediatek: Add MT8196 mcu clock support
clk: mediatek: Add MT8196 mdpsys clock support
clk: mediatek: Add MT8196 mfg clock support
clk: mediatek: Add MT8196 disp0 clock support
clk: mediatek: Add MT8196 disp1 clock support
clk: mediatek: Add MT8196 disp-ao clock support
clk: mediatek: Add MT8196 ovl0 clock support
clk: mediatek: Add MT8196 ovl1 clock support
clk: mediatek: Add MT8196 vdecsys clock support
clk: mediatek: Add MT8196 vencsys clock support

 .../bindings/clock/mediatek,mt8196-clock.yaml | 112 ++
 .../clock/mediatek,mt8196-sys-clock.yaml      | 107 ++
 drivers/clk/mediatek/Kconfig                  |  71 ++
 drivers/clk/mediatek/Makefile                 |  13 +
 drivers/clk/mediatek/clk-gate.c               | 117 ++-
 drivers/clk/mediatek/clk-gate.h               |   3 +
 drivers/clk/mediatek/clk-mt8196-apmixedsys.c  | 204 ++++
 drivers/clk/mediatek/clk-mt8196-disp0.c       | 170 +++
 drivers/clk/mediatek/clk-mt8196-disp1.c       | 170 +++
 .../clk/mediatek/clk-mt8196-imp_iic_wrap.c    | 118 +++
 drivers/clk/mediatek/clk-mt8196-mcu.c         | 167 +++
 drivers/clk/mediatek/clk-mt8196-mdpsys.c      | 186 ++++
 drivers/clk/mediatek/clk-mt8196-mfg.c         | 150 +++
 drivers/clk/mediatek/clk-mt8196-ovl0.c        | 154 +++
 drivers/clk/mediatek/clk-mt8196-ovl1.c        | 154 +++
 drivers/clk/mediatek/clk-mt8196-peri_ao.c     | 142 +++
 drivers/clk/mediatek/clk-mt8196-pextp.c       | 131 +++
 drivers/clk/mediatek/clk-mt8196-topckgen.c    | 985 ++++++++++++++++++
 drivers/clk/mediatek/clk-mt8196-topckgen2.c   | 568 ++++++++++
 drivers/clk/mediatek/clk-mt8196-ufs_ao.c      | 108 ++
 drivers/clk/mediatek/clk-mt8196-vdec.c        | 253 +++++
 drivers/clk/mediatek/clk-mt8196-vdisp_ao.c    |  80 ++
 drivers/clk/mediatek/clk-mt8196-venc.c        | 236 +++++
 drivers/clk/mediatek/clk-mt8196-vlpckgen.c    | 725 +++++++++++++
 drivers/clk/mediatek/clk-mtk.c                |  16 +
 drivers/clk/mediatek/clk-mtk.h                |  22 +
 drivers/clk/mediatek/clk-mux.c                | 120 ++-
 drivers/clk/mediatek/clk-mux.h                |  87 ++
 drivers/clk/mediatek/clk-pll.c                |  45 +-
 drivers/clk/mediatek/clk-pll.h                |   8 +
 .../dt-bindings/clock/mediatek,mt8196-clock.h | 803 ++++++++++++++
 .../reset/mediatek,mt8196-resets.h            |  26 +
 32 files changed, 6216 insertions(+), 35 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml
 create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt8196-sys-clock.yaml
 create mode 100644 drivers/clk/mediatek/clk-mt8196-apmixedsys.c
 create mode 100644 drivers/clk/mediatek/clk-mt8196-disp0.c
 create mode 100644 drivers/clk/mediatek/clk-mt8196-disp1.c
 create mode 100644 drivers/clk/mediatek/clk-mt8196-imp_iic_wrap.c
 create mode 100644 drivers/clk/mediatek/clk-mt8196-mcu.c
 create mode 100644 drivers/clk/mediatek/clk-mt8196-mdpsys.c
 create mode 100644 drivers/clk/mediatek/clk-mt8196-mfg.c
 create mode 100644 drivers/clk/mediatek/clk-mt8196-ovl0.c
 create mode 100644 drivers/clk/mediatek/clk-mt8196-ovl1.c
 create mode 100644 drivers/clk/mediatek/clk-mt8196-peri_ao.c
 create mode 100644 drivers/clk/mediatek/clk-mt8196-pextp.c
 create mode 100644 drivers/clk/mediatek/clk-mt8196-topckgen.c
 create mode 100644 drivers/clk/mediatek/clk-mt8196-topckgen2.c
 create mode 100644 drivers/clk/mediatek/clk-mt8196-ufs_ao.c
 create mode 100644 drivers/clk/mediatek/clk-mt8196-vdec.c
 create mode 100644 drivers/clk/mediatek/clk-mt8196-vdisp_ao.c
 create mode 100644 drivers/clk/mediatek/clk-mt8196-venc.c
 create mode 100644 drivers/clk/mediatek/clk-mt8196-vlpckgen.c
 create mode 100644 include/dt-bindings/clock/mediatek,mt8196-clock.h
 create mode 100644 include/dt-bindings/reset/mediatek,mt8196-resets.h
Signature · 1 line
2.39.5
author
#1 lore raw

PATCH v6 1/27 clk: mediatek: clk-pll: Add set/clr regs for shared PLL enable control

On MT8196, there are set/clr registers to control a shared PLL enable register. These are intended to prevent different masters from manipulating the PLLs independently. Add the corresponding en_set_reg and en_clr_reg fields to the mtk_pll_data structure.

---
 drivers/clk/mediatek/clk-pll.c | 4 ++++
 drivers/clk/mediatek/clk-pll.h | 4 ++++
 2 files changed, 8 insertions(+)
drivers/clk/mediatek/clk-pll.c +4 -0
index 139d3bfcf45f..738524bfd8d2 100644
@@ -311,6 +311,10 @@ struct clk_hw *mtk_clk_register_pll_ops(struct mtk_clk_pll *pll,
 		pll->en_addr = base + data->en_reg;
 	else
 		pll->en_addr = pll->base_addr + REG_CON0;
+	if (data->en_set_reg)
+		pll->en_set_addr = base + data->en_set_reg;
+	if (data->en_clr_reg)
+		pll->en_clr_addr = base + data->en_clr_reg;
 	pll->hw.init = &init;
 	pll->data = data;
 
drivers/clk/mediatek/clk-pll.h +4 -0
index 670fa2e9b898..a795d4dfe056 100644
@@ -47,6 +47,8 @@ struct mtk_pll_data {
 	const struct mtk_pll_div_table *div_table;
 	const char *parent_name;
 	u32 en_reg;
+	u32 en_set_reg;
+	u32 en_clr_reg;
 	u8 pll_en_bit; /* Assume 0, indicates BIT(0) by default */
 	u8 pcw_chg_bit;
 };
@@ -68,6 +70,8 @@ struct mtk_clk_pll {
 	void __iomem	*pcw_addr;
 	void __iomem	*pcw_chg_addr;
 	void __iomem	*en_addr;
+	void __iomem	*en_set_addr;
+	void __iomem	*en_clr_addr;
 	const struct mtk_pll_data *data;
 };
 
Signature · 1 line
2.39.5
maintainer Applied
#2 lore raw

Re: [PATCH v6 01/27] clk: mediatek: clk-pll: Add set/clr regs for shared PLL enable control

Quoting Laura Nao (2025-09-15 08:19:21)

Quoted 10 lines

On MT8196, there are set/clr registers to control a shared PLL enable register. These are intended to prevent different masters from manipulating the PLLs independently. Add the corresponding en_set_reg and en_clr_reg fields to the mtk_pll_data structure.

---

Applied to clk-next

author
#3 lore raw

PATCH v6 2/27 clk: mediatek: clk-pll: Add ops for PLLs using set/clr regs and FENC

In reply to Laura Nao

MT8196 uses a combination of set/clr registers to control the PLL enable state, along with a FENC bit to check the preparation status. Add new set of PLL clock operations with support for set/clr enable and FENC status logic.

---
 drivers/clk/mediatek/clk-pll.c | 41 +++++++++++++++++++++++++++++++++-
 drivers/clk/mediatek/clk-pll.h |  4 ++++
 2 files changed, 44 insertions(+), 1 deletion(-)
drivers/clk/mediatek/clk-pll.c +40 -1
index 738524bfd8d2..51d14ce147e5 100644
@@ -37,6 +37,13 @@ int mtk_pll_is_prepared(struct clk_hw *hw)
 	return (readl(pll->en_addr) & BIT(pll->data->pll_en_bit)) != 0;
 }
 
+static int mtk_pll_fenc_is_prepared(struct clk_hw *hw)
+{
+	struct mtk_clk_pll *pll = to_mtk_clk_pll(hw);
+
+	return !!(readl(pll->fenc_addr) & BIT(pll->data->fenc_sta_bit));
+}
+
 static unsigned long __mtk_pll_recalc_rate(struct mtk_clk_pll *pll, u32 fin,
 		u32 pcw, int postdiv)
 {
@@ -277,6 +284,25 @@ void mtk_pll_unprepare(struct clk_hw *hw)
 	writel(r, pll->pwr_addr);
 }
 
+static int mtk_pll_prepare_setclr(struct clk_hw *hw)
+{
+	struct mtk_clk_pll *pll = to_mtk_clk_pll(hw);
+
+	writel(BIT(pll->data->pll_en_bit), pll->en_set_addr);
+
+	/* Wait 20us after enable for the PLL to stabilize */
+	udelay(20);
+
+	return 0;
+}
+
+static void mtk_pll_unprepare_setclr(struct clk_hw *hw)
+{
+	struct mtk_clk_pll *pll = to_mtk_clk_pll(hw);
+
+	writel(BIT(pll->data->pll_en_bit), pll->en_clr_addr);
+}
+
 const struct clk_ops mtk_pll_ops = {
 	.is_prepared	= mtk_pll_is_prepared,
 	.prepare	= mtk_pll_prepare,
@@ -286,6 +312,16 @@ const struct clk_ops mtk_pll_ops = {
 	.set_rate	= mtk_pll_set_rate,
 };
 
+const struct clk_ops mtk_pll_fenc_clr_set_ops = {
+	.is_prepared	= mtk_pll_fenc_is_prepared,
+	.prepare	= mtk_pll_prepare_setclr,
+	.unprepare	= mtk_pll_unprepare_setclr,
+	.recalc_rate	= mtk_pll_recalc_rate,
+	.round_rate	= mtk_pll_round_rate,
+	.set_rate	= mtk_pll_set_rate,
+};
+EXPORT_SYMBOL_GPL(mtk_pll_fenc_clr_set_ops);
+
 struct clk_hw *mtk_clk_register_pll_ops(struct mtk_clk_pll *pll,
 					const struct mtk_pll_data *data,
 					void __iomem *base,
@@ -318,6 +354,8 @@ struct clk_hw *mtk_clk_register_pll_ops(struct mtk_clk_pll *pll,
 	pll->hw.init = &init;
 	pll->data = data;
 
+	pll->fenc_addr = base + data->fenc_sta_ofs;
+
 	init.name = data->name;
 	init.flags = (data->flags & PLL_AO) ? CLK_IS_CRITICAL : 0;
 	init.ops = pll_ops;
@@ -340,12 +378,13 @@ struct clk_hw *mtk_clk_register_pll(const struct mtk_pll_data *data,
 {
 	struct mtk_clk_pll *pll;
 	struct clk_hw *hw;
+	const struct clk_ops *pll_ops = data->ops ? data->ops : &mtk_pll_ops;
 
 	pll = kzalloc(sizeof(*pll), GFP_KERNEL);
 	if (!pll)
 		return ERR_PTR(-ENOMEM);
 
-	hw = mtk_clk_register_pll_ops(pll, data, base, &mtk_pll_ops);
+	hw = mtk_clk_register_pll_ops(pll, data, base, pll_ops);
 	if (IS_ERR(hw))
 		kfree(pll);
 
drivers/clk/mediatek/clk-pll.h +4 -0
index a795d4dfe056..d71c150ce83e 100644
@@ -29,6 +29,7 @@ struct mtk_pll_data {
 	u32 reg;
 	u32 pwr_reg;
 	u32 en_mask;
+	u32 fenc_sta_ofs;
 	u32 pd_reg;
 	u32 tuner_reg;
 	u32 tuner_en_reg;
@@ -51,6 +52,7 @@ struct mtk_pll_data {
 	u32 en_clr_reg;
 	u8 pll_en_bit; /* Assume 0, indicates BIT(0) by default */
 	u8 pcw_chg_bit;
+	u8 fenc_sta_bit;
 };
 
 /*
@@ -72,6 +74,7 @@ struct mtk_clk_pll {
 	void __iomem	*en_addr;
 	void __iomem	*en_set_addr;
 	void __iomem	*en_clr_addr;
+	void __iomem	*fenc_addr;
 	const struct mtk_pll_data *data;
 };
 
@@ -82,6 +85,7 @@ void mtk_clk_unregister_plls(const struct mtk_pll_data *plls, int num_plls,
 			     struct clk_hw_onecell_data *clk_data);
 
 extern const struct clk_ops mtk_pll_ops;
+extern const struct clk_ops mtk_pll_fenc_clr_set_ops;
 
 static inline struct mtk_clk_pll *to_mtk_clk_pll(struct clk_hw *hw)
 {
Signature · 1 line
2.39.5
maintainer Applied
#4 lore raw

Re: [PATCH v6 02/27] clk: mediatek: clk-pll: Add ops for PLLs using set/clr regs and FENC

Quoting Laura Nao (2025-09-15 08:19:22)

Quoted 10 lines

MT8196 uses a combination of set/clr registers to control the PLL enable state, along with a FENC bit to check the preparation status. Add new set of PLL clock operations with support for set/clr enable and FENC status logic.

---

Applied to clk-next

author
#5 lore raw

PATCH v6 3/27 clk: mediatek: clk-mux: Add ops for mux gates with set/clr/upd and FENC

In reply to Laura Nao

MT8196 uses set/clr/upd registers for mux gate enable/disable control, along with a FENC bit to check the status. Add new set of mux gate clock operations with support for set/clr/upd and FENC status logic.

---
 drivers/clk/mediatek/clk-mux.c | 49 ++++++++++++++++++++++++++++++++++
 drivers/clk/mediatek/clk-mux.h | 45 +++++++++++++++++++++++++++++++
 2 files changed, 94 insertions(+)
drivers/clk/mediatek/clk-mux.c +49 -0
index 60990296450b..3931d157b262 100644
@@ -17,6 +17,8 @@
 
 #include "clk-mux.h"
 
+#define MTK_WAIT_FENC_DONE_US	30
+
 struct mtk_clk_mux {
 	struct clk_hw hw;
 	struct regmap *regmap;
@@ -30,6 +32,33 @@ static inline struct mtk_clk_mux *to_mtk_clk_mux(struct clk_hw *hw)
 	return container_of(hw, struct mtk_clk_mux, hw);
 }
 
+static int mtk_clk_mux_fenc_enable_setclr(struct clk_hw *hw)
+{
+	struct mtk_clk_mux *mux = to_mtk_clk_mux(hw);
+	unsigned long flags;
+	u32 val;
+	int ret;
+
+	if (mux->lock)
+		spin_lock_irqsave(mux->lock, flags);
+	else
+		__acquire(mux->lock);
+
+	regmap_write(mux->regmap, mux->data->clr_ofs,
+		     BIT(mux->data->gate_shift));
+
+	ret = regmap_read_poll_timeout_atomic(mux->regmap, mux->data->fenc_sta_mon_ofs,
+					      val, val & BIT(mux->data->fenc_shift), 1,
+					      MTK_WAIT_FENC_DONE_US);
+
+	if (mux->lock)
+		spin_unlock_irqrestore(mux->lock, flags);
+	else
+		__release(mux->lock);
+
+	return ret;
+}
+
 static int mtk_clk_mux_enable_setclr(struct clk_hw *hw)
 {
 	struct mtk_clk_mux *mux = to_mtk_clk_mux(hw);
@@ -70,6 +99,16 @@ static void mtk_clk_mux_disable_setclr(struct clk_hw *hw)
 			BIT(mux->data->gate_shift));
 }
 
+static int mtk_clk_mux_fenc_is_enabled(struct clk_hw *hw)
+{
+	struct mtk_clk_mux *mux = to_mtk_clk_mux(hw);
+	u32 val;
+
+	regmap_read(mux->regmap, mux->data->fenc_sta_mon_ofs, &val);
+
+	return !!(val & BIT(mux->data->fenc_shift));
+}
+
 static int mtk_clk_mux_is_enabled(struct clk_hw *hw)
 {
 	struct mtk_clk_mux *mux = to_mtk_clk_mux(hw);
@@ -168,6 +207,16 @@ const struct clk_ops mtk_mux_gate_clr_set_upd_ops  = {
 };
 EXPORT_SYMBOL_GPL(mtk_mux_gate_clr_set_upd_ops);
 
+const struct clk_ops mtk_mux_gate_fenc_clr_set_upd_ops = {
+	.enable = mtk_clk_mux_fenc_enable_setclr,
+	.disable = mtk_clk_mux_disable_setclr,
+	.is_enabled = mtk_clk_mux_fenc_is_enabled,
+	.get_parent = mtk_clk_mux_get_parent,
+	.set_parent = mtk_clk_mux_set_parent_setclr_lock,
+	.determine_rate = mtk_clk_mux_determine_rate,
+};
+EXPORT_SYMBOL_GPL(mtk_mux_gate_fenc_clr_set_upd_ops);
+
 static struct clk_hw *mtk_clk_register_mux(struct device *dev,
 					   const struct mtk_mux *mux,
 					   struct regmap *regmap,
drivers/clk/mediatek/clk-mux.h +45 -0

68 lines not on this page · raw message

Signature · 1 line
2.39.5
maintainer Applied
#6 lore raw

Re: [PATCH v6 03/27] clk: mediatek: clk-mux: Add ops for mux gates with set/clr/upd and FENC

Quoting Laura Nao (2025-09-15 08:19:23)

Quoted 9 lines

MT8196 uses set/clr/upd registers for mux gate enable/disable control, along with a FENC bit to check the status. Add new set of mux gate clock operations with support for set/clr/upd and FENC status logic.

---

Applied to clk-next

author
#7 lore raw

PATCH v6 4/27 clk: mediatek: clk-mtk: Introduce mtk_clk_get_hwv_regmap()

In reply to Laura Nao

On MT8196, some clock controllers use a separate regmap for hardware voting via set/clear/status registers. Add mtk_clk_get_hwv_regmap() to retrieve this optional regmap, avoiding duplicated lookup code in mtk_clk_register_muxes() and mtk_clk_register_gate().

---
 drivers/clk/mediatek/clk-mtk.c | 16 ++++++++++++++++
 drivers/clk/mediatek/clk-mtk.h |  1 +
 2 files changed, 17 insertions(+)
drivers/clk/mediatek/clk-mtk.c +16 -0
index ba1d1c495bc2..19cd27941747 100644
@@ -685,4 +685,20 @@ void mtk_clk_simple_remove(struct platform_device *pdev)
 }
 EXPORT_SYMBOL_GPL(mtk_clk_simple_remove);
 
+struct regmap *mtk_clk_get_hwv_regmap(struct device_node *node)
+{
+	struct device_node *hwv_node;
+	struct regmap *regmap_hwv;
+
+	hwv_node = of_parse_phandle(node, "mediatek,hardware-voter", 0);
+	if (!hwv_node)
+		return NULL;
+
+	regmap_hwv = device_node_to_regmap(hwv_node);
+	of_node_put(hwv_node);
+
+	return regmap_hwv;
+}
+EXPORT_SYMBOL_GPL(mtk_clk_get_hwv_regmap);
+
 MODULE_LICENSE("GPL");
drivers/clk/mediatek/clk-mtk.h +1 -0
index c17fe1c2d732..11962fac43ea 100644
@@ -245,5 +245,6 @@ int mtk_clk_pdev_probe(struct platform_device *pdev);
 void mtk_clk_pdev_remove(struct platform_device *pdev);
 int mtk_clk_simple_probe(struct platform_device *pdev);
 void mtk_clk_simple_remove(struct platform_device *pdev);
+struct regmap *mtk_clk_get_hwv_regmap(struct device_node *node);
 
 #endif /* __DRV_CLK_MTK_H */
Signature · 1 line
2.39.5
maintainer Applied
#8 lore raw

Re: [PATCH v6 04/27] clk: mediatek: clk-mtk: Introduce mtk_clk_get_hwv_regmap()

Quoting Laura Nao (2025-09-15 08:19:24)

Quoted 10 lines

On MT8196, some clock controllers use a separate regmap for hardware voting via set/clear/status registers. Add mtk_clk_get_hwv_regmap() to retrieve this optional regmap, avoiding duplicated lookup code in mtk_clk_register_muxes() and mtk_clk_register_gate().

---

Applied to clk-next

author
#9 lore raw

PATCH v6 5/27 clk: mediatek: clk-mux: Add ops for mux gates with HW voter and FENC

In reply to Laura Nao

MT8196 use a HW voter for mux gate enable/disable control, along with a FENC status bit to check the status. Voting is performed using set/clr/upd registers, with a status bit used to verify the vote state. Add new set of mux gate clock operations with support for voting via set/clr/upd regs and FENC status logic.

---
 drivers/clk/mediatek/clk-mtk.h |  2 +
 drivers/clk/mediatek/clk-mux.c | 71 +++++++++++++++++++++++++++++++++-
 drivers/clk/mediatek/clk-mux.h | 42 ++++++++++++++++++++
 3 files changed, 114 insertions(+), 1 deletion(-)
drivers/clk/mediatek/clk-mtk.h +2 -0
index 11962fac43ea..c381d6a6d908 100644
@@ -20,6 +20,8 @@
 
 #define MHZ (1000 * 1000)
 
+#define MTK_WAIT_HWV_DONE_US	30
+
 struct platform_device;
 
 /*
drivers/clk/mediatek/clk-mux.c +70 -1

136 lines not on this page · raw message

drivers/clk/mediatek/clk-mux.h +42 -0

60 lines not on this page · raw message

Signature · 1 line
2.39.5
maintainer Applied
#10 lore raw

Re: [PATCH v6 05/27] clk: mediatek: clk-mux: Add ops for mux gates with HW voter and FENC

Quoting Laura Nao (2025-09-15 08:19:25)

Quoted 11 lines

MT8196 use a HW voter for mux gate enable/disable control, along with a FENC status bit to check the status. Voting is performed using set/clr/upd registers, with a status bit used to verify the vote state. Add new set of mux gate clock operations with support for voting via set/clr/upd regs and FENC status logic.

---

Applied to clk-next

author
#11 lore raw

PATCH v6 6/27 clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct

In reply to Laura Nao

MT8196 uses a HW voter for gate enable/disable control, with set/clr/sta registers located in a separate regmap. Refactor mtk_clk_register_gate() to take a struct mtk_gate, and add a pointer to it in struct mtk_clk_gate. This allows reuse of the static gate data (including HW voter register offsets) without adding extra function arguments, and removes redundant duplication in the runtime data struct.

---
 drivers/clk/mediatek/clk-gate.c | 52 ++++++++++++---------------------
 1 file changed, 19 insertions(+), 33 deletions(-)
drivers/clk/mediatek/clk-gate.c +19 -33
index 67d9e741c5e7..816e5f2d4079 100644
@@ -17,10 +17,7 @@
 struct mtk_clk_gate {
 	struct clk_hw	hw;
 	struct regmap	*regmap;
-	int		set_ofs;
-	int		clr_ofs;
-	int		sta_ofs;
-	u8		bit;
+	const struct mtk_gate *gate;
 };
 
 static inline struct mtk_clk_gate *to_mtk_clk_gate(struct clk_hw *hw)
@@ -33,9 +30,9 @@ static u32 mtk_get_clockgating(struct clk_hw *hw)
 	struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
 	u32 val;
 
-	regmap_read(cg->regmap, cg->sta_ofs, &val);
+	regmap_read(cg->regmap, cg->gate->regs->sta_ofs, &val);
 
-	return val & BIT(cg->bit);
+	return val & BIT(cg->gate->shift);
 }
 
 static int mtk_cg_bit_is_cleared(struct clk_hw *hw)
@@ -52,28 +49,30 @@ static void mtk_cg_set_bit(struct clk_hw *hw)
 {
 	struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
 
-	regmap_write(cg->regmap, cg->set_ofs, BIT(cg->bit));
+	regmap_write(cg->regmap, cg->gate->regs->set_ofs, BIT(cg->gate->shift));
 }
 
 static void mtk_cg_clr_bit(struct clk_hw *hw)
 {
 	struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
 
-	regmap_write(cg->regmap, cg->clr_ofs, BIT(cg->bit));
+	regmap_write(cg->regmap, cg->gate->regs->clr_ofs, BIT(cg->gate->shift));
 }
 
 static void mtk_cg_set_bit_no_setclr(struct clk_hw *hw)
 {
 	struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
 
-	regmap_set_bits(cg->regmap, cg->sta_ofs, BIT(cg->bit));
+	regmap_set_bits(cg->regmap, cg->gate->regs->sta_ofs,
+			BIT(cg->gate->shift));
 }
 
 static void mtk_cg_clr_bit_no_setclr(struct clk_hw *hw)
 {
 	struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
 
-	regmap_clear_bits(cg->regmap, cg->sta_ofs, BIT(cg->bit));
+	regmap_clear_bits(cg->regmap, cg->gate->regs->sta_ofs,
+			  BIT(cg->gate->shift));
 }
 
 static int mtk_cg_enable(struct clk_hw *hw)
@@ -152,12 +151,9 @@ const struct clk_ops mtk_clk_gate_ops_no_setclr_inv = {
 };
 EXPORT_SYMBOL_GPL(mtk_clk_gate_ops_no_setclr_inv);
 
-static struct clk_hw *mtk_clk_register_gate(struct device *dev, const char *name,
-					 const char *parent_name,
-					 struct regmap *regmap, int set_ofs,
-					 int clr_ofs, int sta_ofs, u8 bit,
-					 const struct clk_ops *ops,
-					 unsigned long flags)
+static struct clk_hw *mtk_clk_register_gate(struct device *dev,
+						const struct mtk_gate *gate,
+						struct regmap *regmap)
 {
 	struct mtk_clk_gate *cg;
 	int ret;
@@ -167,18 +163,14 @@ static struct clk_hw *mtk_clk_register_gate(struct device *dev, const char *name
 	if (!cg)
 		return ERR_PTR(-ENOMEM);
 
-	init.name = name;
-	init.flags = flags | CLK_SET_RATE_PARENT;
-	init.parent_names = parent_name ? &parent_name : NULL;
-	init.num_parents = parent_name ? 1 : 0;
-	init.ops = ops;
+	init.name = gate->name;
+	init.flags = gate->flags | CLK_SET_RATE_PARENT;
+	init.parent_names = gate->parent_name ? &gate->parent_name : NULL;
+	init.num_parents = gate->parent_name ? 1 : 0;
+	init.ops = gate->ops;
 
 	cg->regmap = regmap;
-	cg->set_ofs = set_ofs;
-	cg->clr_ofs = clr_ofs;
-	cg->sta_ofs = sta_ofs;
-	cg->bit = bit;
-
+	cg->gate = gate;
 	cg->hw.init = &init;
 
 	ret = clk_hw_register(dev, &cg->hw);
@@ -228,13 +220,7 @@ int mtk_clk_register_gates(struct device *dev, struct device_node *node,
 			continue;
 		}
 
-		hw = mtk_clk_register_gate(dev, gate->name, gate->parent_name,
-					    regmap,
-					    gate->regs->set_ofs,
-					    gate->regs->clr_ofs,
-					    gate->regs->sta_ofs,
-					    gate->shift, gate->ops,
-					    gate->flags);
+		hw = mtk_clk_register_gate(dev, gate, regmap);
 
 		if (IS_ERR(hw)) {
 			pr_err("Failed to register clk %s: %pe\n", gate->name,
Signature · 1 line
2.39.5
maintainer Applied
#12 lore raw

Re: [PATCH v6 06/27] clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct

Quoting Laura Nao (2025-09-15 08:19:26)

Quoted 11 lines

MT8196 uses a HW voter for gate enable/disable control, with set/clr/sta registers located in a separate regmap. Refactor mtk_clk_register_gate() to take a struct mtk_gate, and add a pointer to it in struct mtk_clk_gate. This allows reuse of the static gate data (including HW voter register offsets) without adding extra function arguments, and removes redundant duplication in the runtime data struct.

---

Applied to clk-next

#13 lore raw

issue with [PATCH v6 06/27] clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct

Hi,

this patch seems to break at least the mt7987 device i'm currently working on with torvalds/master + a bunch of some patches for mt7987 support.

if i revert these 2 commits my board works again:

Revert "clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct" => 8ceff24a754a Revert "clk: mediatek: clk-gate: Add ops for gates with HW voter"

if i reapply the first one (i had to revert the second before), it is broken again.

I have seen no changes to other clock drivers in mtk-folder. Mt7987 clk driver is not upstream yet, maybe you can help us changing this driver to work again.

this is "my" commit adding the mt7987 clock driver...

https://github.com/frank-w/BPI-Router-Linux/commit/7480615e752dee7ea9e60dfaf31f39580b4bf191

start of trace (had it sometimes with mmc or spi and a bit different with 2p5g phy, but this is maybe different issue):

[    5.593308] Unable to handle kernel paging request at virtual address ffffffc081371f88
[    5.593322] Mem abort info:
[    5.593324]   ESR = 0x0000000096000007
[    5.593326]   EC = 0x25: DABT (current EL), IL = 32 bits
[    5.593329]   SET = 0, FnV = 0
[    5.593331]   EA = 0, S1PTW = 0
[    5.593333]   FSC = 0x07: level 3 translation fault
[    5.593336] Data abort info:
[    5.593337]   ISV = 0, ISS = 0x00000007, ISS2 = 0x00000000
[    5.593340]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[    5.593343]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[    5.593345] swapper pgtable: 4k pages, 39-bit VAs, pgdp=0000000045294000
[    5.593349] [ffffffc081371f88] pgd=1000000045a7f003, p4d=1000000045a7f003, pud=1000000045a7f003, pmd=1000000045a82003, pte=0000000000000000
[    5.593364] Internal error: Oops: 0000000096000007 [#1]  SMP
[    5.593369] Modules linked in:
[    5.593375] CPU: 0 UID: 0 PID: 1570 Comm: udevd Not tainted 6.17.0-bpi-r4 #7 NONE 
[    5.593381] Hardware name: Bananapi BPI-R4-LITE (DT)
[    5.593385] pstate: 204000c5 (nzCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    5.593390] pc : mtk_cg_enable+0x14/0x38
[    5.593404] lr : clk_core_enable+0x70/0x16c
[    5.593411] sp : ffffffc085853090
[    5.593413] x29: ffffffc085853090 x28: 0000000000000000 x27: ffffffc0800b82c4
[    5.593420] x26: ffffffc085853754 x25: 0000000000000004 x24: ffffff80001828f4
[    5.593426] x23: 0000000000000000 x22: ffffff80030620c0 x21: ffffff8007819580
[    5.593432] x20: 0000000000000000 x19: ffffff8000feee00 x18: 0000003e39f23000
[    5.593438] x17: ffffffffffffffff x16: 0000000000020000 x15: ffffff8002f590a0
[    5.593444] x14: ffffff800346e000 x13: 0000000000000000 x12: 0000000000000000
[    5.593450] x11: 0000000000000001 x10: 0000000000000000 x9 : 0000000000000000
[    5.593455] x8 : ffffffc085853528 x7 : 0000000000000000 x6 : 0000000000002c01
[    5.593461] x5 : ffffffc080858794 x4 : 0000000000000014 x3 : 0000000000000001
[    5.593467] x2 : 0000000000000000 x1 : ffffffc081371f70 x0 : ffffff8001028c00
[    5.593473] Call trace:
[    5.593476]  mtk_cg_enable+0x14/0x38 (P)
[    5.593484]  clk_core_enable+0x70/0x16c
[    5.593490]  clk_enable+0x28/0x54
[    5.593496]  mtk_spi_runtime_resume+0x84/0x174
[    5.593506]  pm_generic_runtime_resume+0x2c/0x44
[    5.593513]  __rpm_callback+0x40/0x228
[    5.593521]  rpm_callback+0x38/0x80
[    5.593527]  rpm_resume+0x590/0x774
[    5.593533]  __pm_runtime_resume+0x5c/0xcc
[    5.593539]  spi_mem_access_start.isra.0+0x38/0xdc
[    5.593545]  spi_mem_exec_op+0x40c/0x4e0

it is not clear for me, how to debug further as i have different clock drivers (but i guess either the infracfg is the right). maybe the critical-flag is not passed?

regards Frank

Quoted 20 lines

Gesendet: Sonntag, 21. September 2025 um 18:53
Von: "Stephen Boyd" <[email protected]>
An: "Laura Nao" <[email protected]>, [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
CC: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], "Laura Nao" <[email protected]>
Betreff: Re: [PATCH v6 06/27] clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct

Quoting Laura Nao (2025-09-15 08:19:26)

Quoted 11 lines

MT8196 uses a HW voter for gate enable/disable control, with set/clr/sta registers located in a separate regmap. Refactor mtk_clk_register_gate() to take a struct mtk_gate, and add a pointer to it in struct mtk_clk_gate. This allows reuse of the static gate data (including HW voter register offsets) without adding extra function arguments, and removes redundant duplication in the runtime data struct.

---

Applied to clk-next

author
#14 lore raw

Re: issue with [PATCH v6 06/27] clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct

Hi Frank,

Quoted 63 lines · Frank Wunderlich

Hi,

this patch seems to break at least the mt7987 device i'm currently working on with torvalds/master + a bunch of some patches for mt7987 support.

if i revert these 2 commits my board works again:

Revert "clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct" => 8ceff24a754a Revert "clk: mediatek: clk-gate: Add ops for gates with HW voter"

if i reapply the first one (i had to revert the second before), it is broken again.

I have seen no changes to other clock drivers in mtk-folder. Mt7987 clk driver is not upstream yet, maybe you can help us changing this driver to work again.

this is "my" commit adding the mt7987 clock driver...

https://github.com/frank-w/BPI-Router-Linux/commit/7480615e752dee7ea9e60dfaf31f39580b4bf191

start of trace (had it sometimes with mmc or spi and a bit different with 2p5g phy, but this is maybe different issue):

[    5.593308] Unable to handle kernel paging request at virtual address ffffffc081371f88
[    5.593322] Mem abort info:
[    5.593324]   ESR = 0x0000000096000007
[    5.593326]   EC = 0x25: DABT (current EL), IL = 32 bits
[    5.593329]   SET = 0, FnV = 0
[    5.593331]   EA = 0, S1PTW = 0
[    5.593333]   FSC = 0x07: level 3 translation fault
[    5.593336] Data abort info:
[    5.593337]   ISV = 0, ISS = 0x00000007, ISS2 = 0x00000000
[    5.593340]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[    5.593343]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[    5.593345] swapper pgtable: 4k pages, 39-bit VAs, pgdp=0000000045294000
[    5.593349] [ffffffc081371f88] pgd=1000000045a7f003, p4d=1000000045a7f003, pud=1000000045a7f003, pmd=1000000045a82003, pte=0000000000000000
[    5.593364] Internal error: Oops: 0000000096000007 [#1]  SMP
[    5.593369] Modules linked in:
[    5.593375] CPU: 0 UID: 0 PID: 1570 Comm: udevd Not tainted 6.17.0-bpi-r4 #7 NONE 
[    5.593381] Hardware name: Bananapi BPI-R4-LITE (DT)
[    5.593385] pstate: 204000c5 (nzCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    5.593390] pc : mtk_cg_enable+0x14/0x38
[    5.593404] lr : clk_core_enable+0x70/0x16c
[    5.593411] sp : ffffffc085853090
[    5.593413] x29: ffffffc085853090 x28: 0000000000000000 x27: ffffffc0800b82c4
[    5.593420] x26: ffffffc085853754 x25: 0000000000000004 x24: ffffff80001828f4
[    5.593426] x23: 0000000000000000 x22: ffffff80030620c0 x21: ffffff8007819580
[    5.593432] x20: 0000000000000000 x19: ffffff8000feee00 x18: 0000003e39f23000
[    5.593438] x17: ffffffffffffffff x16: 0000000000020000 x15: ffffff8002f590a0
[    5.593444] x14: ffffff800346e000 x13: 0000000000000000 x12: 0000000000000000
[    5.593450] x11: 0000000000000001 x10: 0000000000000000 x9 : 0000000000000000
[    5.593455] x8 : ffffffc085853528 x7 : 0000000000000000 x6 : 0000000000002c01
[    5.593461] x5 : ffffffc080858794 x4 : 0000000000000014 x3 : 0000000000000001
[    5.593467] x2 : 0000000000000000 x1 : ffffffc081371f70 x0 : ffffff8001028c00
[    5.593473] Call trace:
[    5.593476]  mtk_cg_enable+0x14/0x38 (P)
[    5.593484]  clk_core_enable+0x70/0x16c
[    5.593490]  clk_enable+0x28/0x54
[    5.593496]  mtk_spi_runtime_resume+0x84/0x174
[    5.593506]  pm_generic_runtime_resume+0x2c/0x44
[    5.593513]  __rpm_callback+0x40/0x228
[    5.593521]  rpm_callback+0x38/0x80
[    5.593527]  rpm_resume+0x590/0x774
[    5.593533]  __pm_runtime_resume+0x5c/0xcc
[    5.593539]  spi_mem_access_start.isra.0+0x38/0xdc
[    5.593545]  spi_mem_exec_op+0x40c/0x4e0
Quoted 5 lines

it is not clear for me, how to debug further as i have different clock drivers (but i guess either the infracfg is the right). maybe the critical-flag is not passed?

regards Frank

Could you try adding some debug prints to help identify the specific gate/gates causing the issue? It would be very helpful in narrowing down the problem.

A couple notes - I noticed that some mux-gate clocks have -1 assigned to the _gate, _upd_ofs, and _upd unsigned int fields. Not sure this is directly related to the crash above, but it’s something that should be addressed regardless:

MUX_GATE_CLR_SET_UPD(CLK_INFRA_MUX_UART0_SEL, "infra_mux_uart0_sel",

		     infra_mux_uart0_parents, 0x0018, 0x0010, 0x0014,
		     0, 1, -1, -1, -1),

I think __initconst should also be removed from clocks that are used at runtime. I’m not certain this is directly related to the issue, but I wanted to mention it in case it’s helpful.

Best,

Laura

Quoted 22 lines
Quoted 21 lines

Gesendet: Sonntag, 21. September 2025 um 18:53
Von: "Stephen Boyd" <[email protected]>
An: "Laura Nao" <[email protected]>, [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
CC: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], "Laura Nao" <[email protected]>
Betreff: Re: [PATCH v6 06/27] clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct

Quoting Laura Nao (2025-09-15 08:19:26)

Quoted 11 lines

MT8196 uses a HW voter for gate enable/disable control, with set/clr/sta registers located in a separate regmap. Refactor mtk_clk_register_gate() to take a struct mtk_gate, and add a pointer to it in struct mtk_clk_gate. This allows reuse of the static gate data (including HW voter register offsets) without adding extra function arguments, and removes redundant duplication in the runtime data struct.

---

Applied to clk-next

#15 lore raw

Aw: Re: issue with [PATCH v6 06/27] clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct

Hi Laura

thanks for first look

tried to replace the -1 values in infracfg driver with 0, but then it's getting worse (debug uart issues came on top and still the "Unable to handle kernel paging request" for on mmc driver while enabling the clock gate - msdc_gate_clock).

i wonder why msdc_gate_clock disables the clocks and msdc_ungate_clock enables them...but in mmc driver first ungate is called which failes and then

mmc itself seems to be probed already, maybe switch to uhs triggers this

[    3.659479] mtk-msdc 11230000.mmc: Got CD GPIO
[    3.698999] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=52 arg=00000C00; host->error=0x00000002
[    3.708205] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=52 arg=80000C08; host->error=0x00000002
[    3.727275] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=5 arg=00000000; host->error=0x00000002
[    3.736355] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=5 arg=00000000; host->error=0x00000002
[    3.745425] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=5 arg=00000000; host->error=0x00000002
[    3.754505] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=5 arg=00000000; host->error=0x00000002
[    3.796499] mmc0: host does not support reading read-only switch, assuming write-enable
[    3.810131] mmc0: new high speed SDHC card at address aaaa
[    3.817725] mmcblk0: mmc0:aaaa SC32G 29.7 GiB
[    3.837920]  mmcblk0: p1 p2 p3 p4 p5 p6

the msdc_track_cmd_data errors already appearing on other boards since this error is printed at early boottime (not later) by a recent commit, so i guess this is unrelated.

the other code position where msdc_gate_clock is called it in msdc_runtime_suspend which seems to be called on first access to mmc while bootup (mount rootfs + starting init), not sure why...

which debugging do you want? tried adding debug in mtk_cg_enable / mtk_cg_disable and it is running through console...stopped that after 2 minutes.

and yes, the -1 cause very high "bit" through BIT(cg->gate->shift), but set this to 0 seems not fixing it

so i tried debugging it from the msdc driver

[    6.023214] systemd[1]: Hostname set to <bpi-r4-lite>. # first access to sdcard (read from /etc/hostname)
[    6.117320] mtk-msdc 11230000.mmc: msdc_runtime_suspend:3308 before gate_clock
[    6.124547] mtk-msdc 11230000.mmc: msdc_gate_clock:925 before bulk_disable_unprepare
[    6.132296] Unable to handle kernel paging request at virtual address ffffffc0813d2388
...
[    6.235005] pc : mtk_cg_disable+0x18/0x38
[    6.239009] lr : clk_core_disable+0x7c/0x150
[    6.243271] sp : ffffffc083a6bbc0
[    6.246573] x29: ffffffc083a6bbc0 x28: ffffff80012f2180 x27: 0000000000000000
[    6.253698] x26: ffffff80012f21c0 x25: 00000000000f4240 x24: ffffff80001a1ac0
[    6.260823] x23: 0000000000000008 x22: 0000000000000004 x21: ffffff80014c4738
[    6.267947] x20: ffffff800134e600 x19: ffffff800134e600 x18: 00000000ffffffff
[    6.275072] x17: 755f656c62617369 x16: 645f6b6c75622065 x15: 726f666562203532
[    6.282197] x14: 00000000ffffffea x13: ffffffc083a6b918 x12: ffffffc081869cf0
[    6.289321] x11: 0000000000000001 x10: 0000000000000001 x9 : 0000000000017fe8
[    6.296446] x8 : c0000000ffffefff x7 : ffffffc081811c70 x6 : 0000000000057fa8
[    6.303570] x5 : ffffffc081869c98 x4 : ffffffc081ace6a8 x3 : 0000000000000001
[    6.310695] x2 : 0000000000000001 x1 : ffffffc0813d2370 x0 : ffffff8001376800
[    6.317820] Call trace:
[    6.320256]  mtk_cg_disable+0x18/0x38 (P)
[    6.324258]  clk_core_disable+0x7c/0x150
[    6.328172]  clk_disable+0x30/0x4c
[    6.331566]  clk_bulk_disable+0x3c/0x58
[    6.335392]  msdc_gate_clock+0x48/0x15c
[    6.339220]  msdc_runtime_suspend+0x2a0/0x2e4

result is same with 0 instead of -1, but uart is than scrambled...tried also with changing only spi0/2 to 0 from -1 (sdmmc is connected to spi2 pins), but has same effect.

so than i tried removng the __initconst in infracfg clocks and this seems fixing the issue...wonder why this came up with your patch, imho this should also happen before.

only noticed with my debugs, that sdmmc does the
gate_clock/ungate_clock nearly every second...not sure if this is normal as we normally do not see it.

regards Frank

Quoted 123 lines

Gesendet: Donnerstag, 23. Oktober 2025 um 13:09
Von: "Laura Nao" <[email protected]>
An: [email protected]
CC: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Betreff: Re: issue with [PATCH v6 06/27] clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct

Hi Frank,

Quoted 63 lines · Frank Wunderlich

Hi,

this patch seems to break at least the mt7987 device i'm currently working on with torvalds/master + a bunch of some patches for mt7987 support.

if i revert these 2 commits my board works again:

Revert "clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct" => 8ceff24a754a Revert "clk: mediatek: clk-gate: Add ops for gates with HW voter"

if i reapply the first one (i had to revert the second before), it is broken again.

I have seen no changes to other clock drivers in mtk-folder. Mt7987 clk driver is not upstream yet, maybe you can help us changing this driver to work again.

this is "my" commit adding the mt7987 clock driver...

https://github.com/frank-w/BPI-Router-Linux/commit/7480615e752dee7ea9e60dfaf31f39580b4bf191

start of trace (had it sometimes with mmc or spi and a bit different with 2p5g phy, but this is maybe different issue):

[    5.593308] Unable to handle kernel paging request at virtual address ffffffc081371f88
[    5.593322] Mem abort info:
[    5.593324]   ESR = 0x0000000096000007
[    5.593326]   EC = 0x25: DABT (current EL), IL = 32 bits
[    5.593329]   SET = 0, FnV = 0
[    5.593331]   EA = 0, S1PTW = 0
[    5.593333]   FSC = 0x07: level 3 translation fault
[    5.593336] Data abort info:
[    5.593337]   ISV = 0, ISS = 0x00000007, ISS2 = 0x00000000
[    5.593340]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[    5.593343]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[    5.593345] swapper pgtable: 4k pages, 39-bit VAs, pgdp=0000000045294000
[    5.593349] [ffffffc081371f88] pgd=1000000045a7f003, p4d=1000000045a7f003, pud=1000000045a7f003, pmd=1000000045a82003, pte=0000000000000000
[    5.593364] Internal error: Oops: 0000000096000007 [#1]  SMP
[    5.593369] Modules linked in:
[    5.593375] CPU: 0 UID: 0 PID: 1570 Comm: udevd Not tainted 6.17.0-bpi-r4 #7 NONE 
[    5.593381] Hardware name: Bananapi BPI-R4-LITE (DT)
[    5.593385] pstate: 204000c5 (nzCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    5.593390] pc : mtk_cg_enable+0x14/0x38
[    5.593404] lr : clk_core_enable+0x70/0x16c
[    5.593411] sp : ffffffc085853090
[    5.593413] x29: ffffffc085853090 x28: 0000000000000000 x27: ffffffc0800b82c4
[    5.593420] x26: ffffffc085853754 x25: 0000000000000004 x24: ffffff80001828f4
[    5.593426] x23: 0000000000000000 x22: ffffff80030620c0 x21: ffffff8007819580
[    5.593432] x20: 0000000000000000 x19: ffffff8000feee00 x18: 0000003e39f23000
[    5.593438] x17: ffffffffffffffff x16: 0000000000020000 x15: ffffff8002f590a0
[    5.593444] x14: ffffff800346e000 x13: 0000000000000000 x12: 0000000000000000
[    5.593450] x11: 0000000000000001 x10: 0000000000000000 x9 : 0000000000000000
[    5.593455] x8 : ffffffc085853528 x7 : 0000000000000000 x6 : 0000000000002c01
[    5.593461] x5 : ffffffc080858794 x4 : 0000000000000014 x3 : 0000000000000001
[    5.593467] x2 : 0000000000000000 x1 : ffffffc081371f70 x0 : ffffff8001028c00
[    5.593473] Call trace:
[    5.593476]  mtk_cg_enable+0x14/0x38 (P)
[    5.593484]  clk_core_enable+0x70/0x16c
[    5.593490]  clk_enable+0x28/0x54
[    5.593496]  mtk_spi_runtime_resume+0x84/0x174
[    5.593506]  pm_generic_runtime_resume+0x2c/0x44
[    5.593513]  __rpm_callback+0x40/0x228
[    5.593521]  rpm_callback+0x38/0x80
[    5.593527]  rpm_resume+0x590/0x774
[    5.593533]  __pm_runtime_resume+0x5c/0xcc
[    5.593539]  spi_mem_access_start.isra.0+0x38/0xdc
[    5.593545]  spi_mem_exec_op+0x40c/0x4e0
Quoted 5 lines

it is not clear for me, how to debug further as i have different clock drivers (but i guess either the infracfg is the right). maybe the critical-flag is not passed?

regards Frank

Could you try adding some debug prints to help identify the specific gate/gates causing the issue? It would be very helpful in narrowing down the problem.

A couple notes - I noticed that some mux-gate clocks have -1 assigned to the _gate, _upd_ofs, and _upd unsigned int fields. Not sure this is directly related to the crash above, but it’s something that should be addressed regardless:

MUX_GATE_CLR_SET_UPD(CLK_INFRA_MUX_UART0_SEL, "infra_mux_uart0_sel",

		     infra_mux_uart0_parents, 0x0018, 0x0010, 0x0014,
		     0, 1, -1, -1, -1),

I think __initconst should also be removed from clocks that are used at runtime. I’m not certain this is directly related to the issue, but I wanted to mention it in case it’s helpful.

Best,

Laura

Quoted 22 lines
Quoted 21 lines

Gesendet: Sonntag, 21. September 2025 um 18:53
Von: "Stephen Boyd" <[email protected]>
An: "Laura Nao" <[email protected]>, [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
CC: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], "Laura Nao" <[email protected]>
Betreff: Re: [PATCH v6 06/27] clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct

Quoting Laura Nao (2025-09-15 08:19:26)

Quoted 11 lines

MT8196 uses a HW voter for gate enable/disable control, with set/clr/sta registers located in a separate regmap. Refactor mtk_clk_register_gate() to take a struct mtk_gate, and add a pointer to it in struct mtk_clk_gate. This allows reuse of the static gate data (including HW voter register offsets) without adding extra function arguments, and removes redundant duplication in the runtime data struct.

---

Applied to clk-next

author
#16 lore raw

Re: issue with [PATCH v6 06/27] clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct

Hi Frank,

Quoted 6 lines · On 10/23/25 19:34, [email protected] wrote:

Hi Laura

thanks for first look

tried to replace the -1 values in infracfg driver with 0, but then it's getting worse (debug uart issues came on top and still the "Unable to handle kernel paging request" for on mmc driver while enabling the clock gate - msdc_gate_clock).

If _gate is not defined, these appear to be mux clocks rather than mux-gates. In that case, they should be defined accordingly - I believe MUX_CLR_SET_UPD would be appropriate here?

Quoted 54 lines

i wonder why msdc_gate_clock disables the clocks and msdc_ungate_clock enables them...but in mmc driver first ungate is called which failes and then

mmc itself seems to be probed already, maybe switch to uhs triggers this

[    3.659479] mtk-msdc 11230000.mmc: Got CD GPIO
[    3.698999] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=52 arg=00000C00; host->error=0x00000002
[    3.708205] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=52 arg=80000C08; host->error=0x00000002
[    3.727275] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=5 arg=00000000; host->error=0x00000002
[    3.736355] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=5 arg=00000000; host->error=0x00000002
[    3.745425] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=5 arg=00000000; host->error=0x00000002
[    3.754505] mtk-msdc 11230000.mmc: msdc_track_cmd_data: cmd=5 arg=00000000; host->error=0x00000002
[    3.796499] mmc0: host does not support reading read-only switch, assuming write-enable
[    3.810131] mmc0: new high speed SDHC card at address aaaa
[    3.817725] mmcblk0: mmc0:aaaa SC32G 29.7 GiB
[    3.837920]  mmcblk0: p1 p2 p3 p4 p5 p6

the msdc_track_cmd_data errors already appearing on other boards since this error is printed at early boottime (not later) by a recent commit, so i guess this is unrelated.

the other code position where msdc_gate_clock is called it in msdc_runtime_suspend which seems to be called on first access to mmc while bootup (mount rootfs + starting init), not sure why...

which debugging do you want? tried adding debug in mtk_cg_enable / mtk_cg_disable and it is running through console...stopped that after 2 minutes.

and yes, the -1 cause very high "bit" through BIT(cg->gate->shift), but set this to 0 seems not fixing it

so i tried debugging it from the msdc driver

[    6.023214] systemd[1]: Hostname set to <bpi-r4-lite>. # first access to sdcard (read from /etc/hostname)
[    6.117320] mtk-msdc 11230000.mmc: msdc_runtime_suspend:3308 before gate_clock
[    6.124547] mtk-msdc 11230000.mmc: msdc_gate_clock:925 before bulk_disable_unprepare
[    6.132296] Unable to handle kernel paging request at virtual address ffffffc0813d2388
...
[    6.235005] pc : mtk_cg_disable+0x18/0x38
[    6.239009] lr : clk_core_disable+0x7c/0x150
[    6.243271] sp : ffffffc083a6bbc0
[    6.246573] x29: ffffffc083a6bbc0 x28: ffffff80012f2180 x27: 0000000000000000
[    6.253698] x26: ffffff80012f21c0 x25: 00000000000f4240 x24: ffffff80001a1ac0
[    6.260823] x23: 0000000000000008 x22: 0000000000000004 x21: ffffff80014c4738
[    6.267947] x20: ffffff800134e600 x19: ffffff800134e600 x18: 00000000ffffffff
[    6.275072] x17: 755f656c62617369 x16: 645f6b6c75622065 x15: 726f666562203532
[    6.282197] x14: 00000000ffffffea x13: ffffffc083a6b918 x12: ffffffc081869cf0
[    6.289321] x11: 0000000000000001 x10: 0000000000000001 x9 : 0000000000017fe8
[    6.296446] x8 : c0000000ffffefff x7 : ffffffc081811c70 x6 : 0000000000057fa8
[    6.303570] x5 : ffffffc081869c98 x4 : ffffffc081ace6a8 x3 : 0000000000000001
[    6.310695] x2 : 0000000000000001 x1 : ffffffc0813d2370 x0 : ffffff8001376800
[    6.317820] Call trace:
[    6.320256]  mtk_cg_disable+0x18/0x38 (P)
[    6.324258]  clk_core_disable+0x7c/0x150
[    6.328172]  clk_disable+0x30/0x4c
[    6.331566]  clk_bulk_disable+0x3c/0x58
[    6.335392]  msdc_gate_clock+0x48/0x15c
[    6.339220]  msdc_runtime_suspend+0x2a0/0x2e4
Quoted 6 lines

result is same with 0 instead of -1, but uart is than scrambled...tried also with changing only spi0/2 to 0 from -1 (sdmmc is connected to spi2 pins), but has same effect.

so than i tried removng the __initconst in infracfg clocks and this seems fixing the issue...wonder why this came up with your patch, imho this should also happen before.

I think that actually makes sense - before the patch, the fields from struct mtk_gate were copied into mtk_clk_gate, so it didn’t matter if the original data was freed. After the refactoring we store a pointer, so once those sections are released, any runtime clock enable ends up using a dangling pointer.

As those clocks seems to be used during runtime, removing __initconst seems like the right thing to do. Those mux-gates that lack a gate should be turned into plain muxes anyway though.

Best,

Laura

Quoted 128 lines

only noticed with my debugs, that sdmmc does the
gate_clock/ungate_clock nearly every second...not sure if this is normal as we normally do not see it.

regards Frank

Quoted 123 lines

Gesendet: Donnerstag, 23. Oktober 2025 um 13:09
Von: "Laura Nao" <[email protected]>
An: [email protected]
CC: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Betreff: Re: issue with [PATCH v6 06/27] clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct

Hi Frank,

Quoted 63 lines · Frank Wunderlich

Hi,

this patch seems to break at least the mt7987 device i'm currently working on with torvalds/master + a bunch of some patches for mt7987 support.

if i revert these 2 commits my board works again:

Revert "clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct" => 8ceff24a754a Revert "clk: mediatek: clk-gate: Add ops for gates with HW voter"

if i reapply the first one (i had to revert the second before), it is broken again.

I have seen no changes to other clock drivers in mtk-folder. Mt7987 clk driver is not upstream yet, maybe you can help us changing this driver to work again.

this is "my" commit adding the mt7987 clock driver...

https://github.com/frank-w/BPI-Router-Linux/commit/7480615e752dee7ea9e60dfaf31f39580b4bf191

start of trace (had it sometimes with mmc or spi and a bit different with 2p5g phy, but this is maybe different issue):

[    5.593308] Unable to handle kernel paging request at virtual address ffffffc081371f88
[    5.593322] Mem abort info:
[    5.593324]   ESR = 0x0000000096000007
[    5.593326]   EC = 0x25: DABT (current EL), IL = 32 bits
[    5.593329]   SET = 0, FnV = 0
[    5.593331]   EA = 0, S1PTW = 0
[    5.593333]   FSC = 0x07: level 3 translation fault
[    5.593336] Data abort info:
[    5.593337]   ISV = 0, ISS = 0x00000007, ISS2 = 0x00000000
[    5.593340]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[    5.593343]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[    5.593345] swapper pgtable: 4k pages, 39-bit VAs, pgdp=0000000045294000
[    5.593349] [ffffffc081371f88] pgd=1000000045a7f003, p4d=1000000045a7f003, pud=1000000045a7f003, pmd=1000000045a82003, pte=0000000000000000
[    5.593364] Internal error: Oops: 0000000096000007 [#1]  SMP
[    5.593369] Modules linked in:
[    5.593375] CPU: 0 UID: 0 PID: 1570 Comm: udevd Not tainted 6.17.0-bpi-r4 #7 NONE 
[    5.593381] Hardware name: Bananapi BPI-R4-LITE (DT)
[    5.593385] pstate: 204000c5 (nzCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    5.593390] pc : mtk_cg_enable+0x14/0x38
[    5.593404] lr : clk_core_enable+0x70/0x16c
[    5.593411] sp : ffffffc085853090
[    5.593413] x29: ffffffc085853090 x28: 0000000000000000 x27: ffffffc0800b82c4
[    5.593420] x26: ffffffc085853754 x25: 0000000000000004 x24: ffffff80001828f4
[    5.593426] x23: 0000000000000000 x22: ffffff80030620c0 x21: ffffff8007819580
[    5.593432] x20: 0000000000000000 x19: ffffff8000feee00 x18: 0000003e39f23000
[    5.593438] x17: ffffffffffffffff x16: 0000000000020000 x15: ffffff8002f590a0
[    5.593444] x14: ffffff800346e000 x13: 0000000000000000 x12: 0000000000000000
[    5.593450] x11: 0000000000000001 x10: 0000000000000000 x9 : 0000000000000000
[    5.593455] x8 : ffffffc085853528 x7 : 0000000000000000 x6 : 0000000000002c01
[    5.593461] x5 : ffffffc080858794 x4 : 0000000000000014 x3 : 0000000000000001
[    5.593467] x2 : 0000000000000000 x1 : ffffffc081371f70 x0 : ffffff8001028c00
[    5.593473] Call trace:
[    5.593476]  mtk_cg_enable+0x14/0x38 (P)
[    5.593484]  clk_core_enable+0x70/0x16c
[    5.593490]  clk_enable+0x28/0x54
[    5.593496]  mtk_spi_runtime_resume+0x84/0x174
[    5.593506]  pm_generic_runtime_resume+0x2c/0x44
[    5.593513]  __rpm_callback+0x40/0x228
[    5.593521]  rpm_callback+0x38/0x80
[    5.593527]  rpm_resume+0x590/0x774
[    5.593533]  __pm_runtime_resume+0x5c/0xcc
[    5.593539]  spi_mem_access_start.isra.0+0x38/0xdc
[    5.593545]  spi_mem_exec_op+0x40c/0x4e0
Quoted 5 lines

it is not clear for me, how to debug further as i have different clock drivers (but i guess either the infracfg is the right). maybe the critical-flag is not passed?

regards Frank

Could you try adding some debug prints to help identify the specific gate/gates causing the issue? It would be very helpful in narrowing down the problem.

A couple notes - I noticed that some mux-gate clocks have -1 assigned to the _gate, _upd_ofs, and _upd unsigned int fields. Not sure this is directly related to the crash above, but it’s something that should be addressed regardless:

MUX_GATE_CLR_SET_UPD(CLK_INFRA_MUX_UART0_SEL, "infra_mux_uart0_sel",

		     infra_mux_uart0_parents, 0x0018, 0x0010, 0x0014,
		     0, 1, -1, -1, -1),

I think __initconst should also be removed from clocks that are used at runtime. I’m not certain this is directly related to the issue, but I wanted to mention it in case it’s helpful.

Best,

Laura

Quoted 22 lines
Quoted 21 lines

Gesendet: Sonntag, 21. September 2025 um 18:53
Von: "Stephen Boyd" <[email protected]>
An: "Laura Nao" <[email protected]>, [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
CC: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], "Laura Nao" <[email protected]>
Betreff: Re: [PATCH v6 06/27] clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct

Quoting Laura Nao (2025-09-15 08:19:26)

Quoted 11 lines

MT8196 uses a HW voter for gate enable/disable control, with set/clr/sta registers located in a separate regmap. Refactor mtk_clk_register_gate() to take a struct mtk_gate, and add a pointer to it in struct mtk_clk_gate. This allows reuse of the static gate data (including HW voter register offsets) without adding extra function arguments, and removes redundant duplication in the runtime data struct.

---

Applied to clk-next

author
#17 lore raw

PATCH v6 7/27 clk: mediatek: clk-gate: Add ops for gates with HW voter

In reply to Laura Nao

MT8196 use a HW voter for gate enable/disable control. Voting is performed using set/clr regs, with a status bit used to verify the vote state. Add new set of gate clock operations with support for voting via set/clr regs.

---
 drivers/clk/mediatek/clk-gate.c | 71 +++++++++++++++++++++++++++++++--
 drivers/clk/mediatek/clk-gate.h |  3 ++
 2 files changed, 71 insertions(+), 3 deletions(-)
drivers/clk/mediatek/clk-gate.c +68 -3
index 816e5f2d4079..f6b1429ff757 100644
@@ -5,6 +5,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/dev_printk.h>
 #include <linux/mfd/syscon.h>
 #include <linux/module.h>
 #include <linux/printk.h>
@@ -12,11 +13,13 @@
 #include <linux/slab.h>
 #include <linux/types.h>
 
+#include "clk-mtk.h"
 #include "clk-gate.h"
 
 struct mtk_clk_gate {
 	struct clk_hw	hw;
 	struct regmap	*regmap;
+	struct regmap	*regmap_hwv;
 	const struct mtk_gate *gate;
 };
 
@@ -99,6 +102,32 @@ static void mtk_cg_disable_inv(struct clk_hw *hw)
 	mtk_cg_clr_bit(hw);
 }
 
+static int mtk_cg_hwv_set_en(struct clk_hw *hw, bool enable)
+{
+	struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
+	u32 val;
+
+	regmap_write(cg->regmap_hwv,
+		     enable ? cg->gate->hwv_regs->set_ofs :
+			      cg->gate->hwv_regs->clr_ofs,
+		     BIT(cg->gate->shift));
+
+	return regmap_read_poll_timeout_atomic(cg->regmap_hwv,
+					       cg->gate->hwv_regs->sta_ofs, val,
+					       val & BIT(cg->gate->shift), 0,
+					       MTK_WAIT_HWV_DONE_US);
+}
+
+static int mtk_cg_hwv_enable(struct clk_hw *hw)
+{
+	return mtk_cg_hwv_set_en(hw, true);
+}
+
+static void mtk_cg_hwv_disable(struct clk_hw *hw)
+{
+	mtk_cg_hwv_set_en(hw, false);
+}
+
 static int mtk_cg_enable_no_setclr(struct clk_hw *hw)
 {
 	mtk_cg_clr_bit_no_setclr(hw);
@@ -123,6 +152,15 @@ static void mtk_cg_disable_inv_no_setclr(struct clk_hw *hw)
 	mtk_cg_clr_bit_no_setclr(hw);
 }
 
+static bool mtk_cg_uses_hwv(const struct clk_ops *ops)
+{
+	if (ops == &mtk_clk_gate_hwv_ops_setclr ||
+	    ops == &mtk_clk_gate_hwv_ops_setclr_inv)
+		return true;
+
+	return false;
+}
+
 const struct clk_ops mtk_clk_gate_ops_setclr = {
 	.is_enabled	= mtk_cg_bit_is_cleared,
 	.enable		= mtk_cg_enable,
@@ -137,6 +175,20 @@ const struct clk_ops mtk_clk_gate_ops_setclr_inv = {
 };
 EXPORT_SYMBOL_GPL(mtk_clk_gate_ops_setclr_inv);
 
+const struct clk_ops mtk_clk_gate_hwv_ops_setclr = {
+	.is_enabled	= mtk_cg_bit_is_cleared,
+	.enable		= mtk_cg_hwv_enable,
+	.disable	= mtk_cg_hwv_disable,
+};
+EXPORT_SYMBOL_GPL(mtk_clk_gate_hwv_ops_setclr);
+
+const struct clk_ops mtk_clk_gate_hwv_ops_setclr_inv = {
+	.is_enabled	= mtk_cg_bit_is_set,
+	.enable		= mtk_cg_hwv_enable,
+	.disable	= mtk_cg_hwv_disable,
+};
+EXPORT_SYMBOL_GPL(mtk_clk_gate_hwv_ops_setclr_inv);
+
 const struct clk_ops mtk_clk_gate_ops_no_setclr = {
 	.is_enabled	= mtk_cg_bit_is_cleared,
 	.enable		= mtk_cg_enable_no_setclr,
@@ -152,8 +204,9 @@ const struct clk_ops mtk_clk_gate_ops_no_setclr_inv = {
 EXPORT_SYMBOL_GPL(mtk_clk_gate_ops_no_setclr_inv);
 
 static struct clk_hw *mtk_clk_register_gate(struct device *dev,
-						const struct mtk_gate *gate,
-						struct regmap *regmap)
+					    const struct mtk_gate *gate,
+					    struct regmap *regmap,
+					    struct regmap *regmap_hwv)
 {
 	struct mtk_clk_gate *cg;
 	int ret;
@@ -168,8 +221,13 @@ static struct clk_hw *mtk_clk_register_gate(struct device *dev,
 	init.parent_names = gate->parent_name ? &gate->parent_name : NULL;
 	init.num_parents = gate->parent_name ? 1 : 0;
 	init.ops = gate->ops;
+	if (mtk_cg_uses_hwv(init.ops) && !regmap_hwv)
+		return dev_err_ptr_probe(
+			dev, -ENXIO,
+			"regmap not found for hardware voter clocks\n");
 
 	cg->regmap = regmap;
+	cg->regmap_hwv = regmap_hwv;
 	cg->gate = gate;
 	cg->hw.init = &init;
 
@@ -201,6 +259,7 @@ int mtk_clk_register_gates(struct device *dev, struct device_node *node,
 	int i;
 	struct clk_hw *hw;
 	struct regmap *regmap;
+	struct regmap *regmap_hwv;
 
 	if (!clk_data)
 		return -ENOMEM;
@@ -211,6 +270,12 @@ int mtk_clk_register_gates(struct device *dev, struct device_node *node,
 		return PTR_ERR(regmap);
 	}
 
+	regmap_hwv = mtk_clk_get_hwv_regmap(node);
+	if (IS_ERR(regmap_hwv))
+		return dev_err_probe(
+			dev, PTR_ERR(regmap_hwv),
+			"Cannot find hardware voter regmap for %pOF\n", node);
+
 	for (i = 0; i < num; i++) {
 		const struct mtk_gate *gate = &clks[i];
 
@@ -220,7 +285,7 @@ int mtk_clk_register_gates(struct device *dev, struct device_node *node,
 			continue;
 		}
 
-		hw = mtk_clk_register_gate(dev, gate, regmap);
+		hw = mtk_clk_register_gate(dev, gate, regmap, regmap_hwv);
 
 		if (IS_ERR(hw)) {
 			pr_err("Failed to register clk %s: %pe\n", gate->name,
drivers/clk/mediatek/clk-gate.h +3 -0
index 1a46b4c56fc5..4f05b9855dae 100644
@@ -19,6 +19,8 @@ extern const struct clk_ops mtk_clk_gate_ops_setclr;
 extern const struct clk_ops mtk_clk_gate_ops_setclr_inv;
 extern const struct clk_ops mtk_clk_gate_ops_no_setclr;
 extern const struct clk_ops mtk_clk_gate_ops_no_setclr_inv;
+extern const struct clk_ops mtk_clk_gate_hwv_ops_setclr;
+extern const struct clk_ops mtk_clk_gate_hwv_ops_setclr_inv;
 
 struct mtk_gate_regs {
 	u32 sta_ofs;
@@ -31,6 +33,7 @@ struct mtk_gate {
 	const char *name;
 	const char *parent_name;
 	const struct mtk_gate_regs *regs;
+	const struct mtk_gate_regs *hwv_regs;
 	int shift;
 	const struct clk_ops *ops;
 	unsigned long flags;
Signature · 1 line
2.39.5
maintainer Applied
#18 lore raw

Re: [PATCH v6 07/27] clk: mediatek: clk-gate: Add ops for gates with HW voter

Quoting Laura Nao (2025-09-15 08:19:27)

Quoted 10 lines

MT8196 use a HW voter for gate enable/disable control. Voting is performed using set/clr regs, with a status bit used to verify the vote state. Add new set of gate clock operations with support for voting via set/clr regs.

---

Applied to clk-next

author
#19 lore raw

PATCH v6 8/27 clk: mediatek: clk-mtk: Add MUX_DIV_GATE macro

In reply to Laura Nao

On MT8196, some clocks use one register for parent selection and gating, and a separate register for frequency division. Since composite clocks can combine a mux, divider, and gate in a single entity, add a macro to simplify registration of such clocks by combining parent selection, frequency scaling, and enable control into one definition.

---
 drivers/clk/mediatek/clk-mtk.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/clk/mediatek/clk-mtk.h +19 -0
index c381d6a6d908..5417b9264e6d 100644
@@ -175,6 +175,25 @@ struct mtk_composite {
 		.flags = 0,						\
 	}
 
+#define MUX_DIV_GATE(_id, _name, _parents,		\
+		_mux_reg, _mux_shift, _mux_width,	\
+		_div_reg, _div_shift, _div_width,	\
+		_gate_reg, _gate_shift) {		\
+		.id            = _id,			\
+		.name          = _name,			\
+		.parent_names  = _parents,		\
+		.num_parents   = ARRAY_SIZE(_parents),	\
+		.mux_reg       = _mux_reg,		\
+		.mux_shift     = _mux_shift,		\
+		.mux_width     = _mux_width,		\
+		.divider_reg   = _div_reg,		\
+		.divider_shift = _div_shift,		\
+		.divider_width = _div_width,		\
+		.gate_reg      = _gate_reg,		\
+		.gate_shift    = _gate_shift,		\
+		.flags         = CLK_SET_RATE_PARENT,	\
+	}
+
 int mtk_clk_register_composites(struct device *dev,
 				const struct mtk_composite *mcs, int num,
 				void __iomem *base, spinlock_t *lock,
Signature · 1 line
2.39.5
maintainer Applied
#20 lore raw

Re: [PATCH v6 08/27] clk: mediatek: clk-mtk: Add MUX_DIV_GATE macro

Quoting Laura Nao (2025-09-15 08:19:28)

Quoted 11 lines

On MT8196, some clocks use one register for parent selection and gating, and a separate register for frequency division. Since composite clocks can combine a mux, divider, and gate in a single entity, add a macro to simplify registration of such clocks by combining parent selection, frequency scaling, and enable control into one definition.

---

Applied to clk-next

author
#21 lore raw

PATCH v6 9/27 dt-bindings: clock: mediatek: Describe MT8196 clock controllers

In reply to Laura Nao

Introduce binding documentation for system clocks, functional clocks, and PEXTP0/1 and UFS reset controllers on MediaTek MT8196.

This binding also includes a handle to the hardware voter, a fixed-function MCU designed to aggregate votes from the application processor and other remote processors to manage clocks and power domains.

The HWV on MT8196/MT6991 is incomplete and requires software to manually enable power supplies, parent clocks, and FENC, as well as write to both the HWV MMIO and the controller registers.
Because of these constraints, the HWV cannot be modeled using generic clock, power domain, or interconnect APIs. Instead, a custom phandle is exceptionally used to provide direct, syscon-like register access to drivers.

---
 .../bindings/clock/mediatek,mt8196-clock.yaml | 112 +++
 .../clock/mediatek,mt8196-sys-clock.yaml      | 107 +++
 .../dt-bindings/clock/mediatek,mt8196-clock.h | 803 ++++++++++++++++++
 .../reset/mediatek,mt8196-resets.h            |  26 +
 4 files changed, 1048 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml
 create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt8196-sys-clock.yaml
 create mode 100644 include/dt-bindings/clock/mediatek,mt8196-clock.h
 create mode 100644 include/dt-bindings/reset/mediatek,mt8196-resets.h
Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml new file +112 -0
new file mode 100644
index 000000000000..bfdbd2e4a167
@@ -0,0 +1,112 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/mediatek,mt8196-clock.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek Functional Clock Controller for MT8196
+
+maintainers:
+  - Guangjie Song <[email protected]>
+  - Laura Nao <[email protected]>
+
+description: |
+  The clock architecture in MediaTek SoCs is structured like below:
+  PLLs -->
+          dividers -->
+                      muxes
+                           -->
+                              clock gate
+
+  The device nodes provide clock gate control in different IP blocks.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - mediatek,mt8196-imp-iic-wrap-c
+          - mediatek,mt8196-imp-iic-wrap-e
+          - mediatek,mt8196-imp-iic-wrap-n
+          - mediatek,mt8196-imp-iic-wrap-w
+          - mediatek,mt8196-mdpsys0
+          - mediatek,mt8196-mdpsys1
+          - mediatek,mt8196-pericfg-ao
+          - mediatek,mt8196-pextp0cfg-ao
+          - mediatek,mt8196-pextp1cfg-ao
+          - mediatek,mt8196-ufscfg-ao
+          - mediatek,mt8196-vencsys
+          - mediatek,mt8196-vencsys-c1
+          - mediatek,mt8196-vencsys-c2
+          - mediatek,mt8196-vdecsys
+          - mediatek,mt8196-vdecsys-soc
+          - mediatek,mt8196-vdisp-ao
+      - const: syscon
+
+  reg:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 1
+
+  '#reset-cells':
+    const: 1
+    description:
+      Reset lines for PEXTP0/1 and UFS blocks.
+
+  mediatek,hardware-voter:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: |
+      Phandle to the "Hardware Voter" (HWV), as named in the vendor
+      documentation for MT8196/MT6991.
+
+      The HWV is a SoC-internal fixed-function MCU used to collect votes from
+      both the Application Processor and other remote processors within the SoC.
+      It is intended to transparently enable or disable hardware resources (such
+      as power domains or clocks) based on internal vote aggregation handled by
+      the MCU's internal state machine.
+
+      However, in practice, this design is incomplete. While the HWV performs
+      some internal vote aggregation,software is still required to
+      - Manually enable power supplies externally, if present and if required
+      - Manually enable parent clocks via direct MMIO writes to clock controllers
+      - Enable the FENC after the clock has been ungated via direct MMIO
+      writes to clock controllers
+
+      As such, the HWV behaves more like a hardware-managed clock reference
+      counter than a true voter. Furthermore, it is not a separate
+      controller. It merely serves as an alternative interface to the same
+      underlying clock or power controller. Actual control still requires
+      direct access to the controller's own MMIO register space, in
+      addition to writing to the HWV's MMIO region.
+
+      For this reason, a custom phandle is used here - drivers need to directly
+      access the HWV MMIO region in a syscon-like fashion, due to how the
+      hardware is wired. This differs from true hardware voting systems, which
+      typically do not require custom phandles and rely instead on generic APIs
+      (clocks, power domains, interconnects).
+
+      The name "hardware-voter" is retained to match vendor documentation, but
+      this should not be reused or misunderstood as a proper voting mechanism.
+
+required:
+  - compatible
+  - reg
+  - '#clock-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    pericfg_ao: clock-controller@16640000 {
+        compatible = "mediatek,mt8196-pericfg-ao", "syscon";
+        reg = <0x16640000 0x1000>;
+        mediatek,hardware-voter = <&scp_hwv>;
+        #clock-cells = <1>;
+    };
+  - |
+    pextp0cfg_ao: clock-controller@169b0000 {
+        compatible = "mediatek,mt8196-pextp0cfg-ao", "syscon";
+        reg = <0x169b0000 0x1000>;
+        #clock-cells = <1>;
+        #reset-cells = <1>;
+    };
Documentation/devicetree/bindings/clock/mediatek,mt8196-sys-clock.yaml new file +107 -0

107 lines not on this page · raw message

include/dt-bindings/clock/mediatek,mt8196-clock.h new file +803 -0

803 lines not on this page · raw message

include/dt-bindings/reset/mediatek,mt8196-resets.h new file +26 -0
new file mode 100644
index 000000000000..46ced0850d91
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Copyright (c) 2025 Collabora Ltd.
+ * Author: AngeloGioacchino Del Regno <[email protected]>
+ */
+
+#ifndef _DT_BINDINGS_RESET_CONTROLLER_MT8196
+#define _DT_BINDINGS_RESET_CONTROLLER_MT8196
+
+/* PEXTP0 resets */
+#define MT8196_PEXTP0_RST0_PCIE0_MAC		0
+#define MT8196_PEXTP0_RST0_PCIE0_PHY		1
+
+/* PEXTP1 resets */
+#define MT8196_PEXTP1_RST0_PCIE1_MAC		0
+#define MT8196_PEXTP1_RST0_PCIE1_PHY		1
+#define MT8196_PEXTP1_RST0_PCIE2_MAC		2
+#define MT8196_PEXTP1_RST0_PCIE2_PHY		3
+
+/* UFS resets */
+#define MT8196_UFSAO_RST0_UFS_MPHY		0
+#define MT8196_UFSAO_RST1_UFS_UNIPRO		1
+#define MT8196_UFSAO_RST1_UFS_CRYPTO		2
+#define MT8196_UFSAO_RST1_UFSHCI		3
+
+#endif  /* _DT_BINDINGS_RESET_CONTROLLER_MT8196 */
Signature · 1 line
2.39.5
maintainer Applied
#22 lore raw

Re: [PATCH v6 09/27] dt-bindings: clock: mediatek: Describe MT8196 clock controllers

Quoting Laura Nao (2025-09-15 08:19:29)

Quoted 16 lines

Introduce binding documentation for system clocks, functional clocks, and PEXTP0/1 and UFS reset controllers on MediaTek MT8196.

This binding also includes a handle to the hardware voter, a fixed-function MCU designed to aggregate votes from the application processor and other remote processors to manage clocks and power domains.

The HWV on MT8196/MT6991 is incomplete and requires software to manually enable power supplies, parent clocks, and FENC, as well as write to both the HWV MMIO and the controller registers.
Because of these constraints, the HWV cannot be modeled using generic clock, power domain, or interconnect APIs. Instead, a custom phandle is exceptionally used to provide direct, syscon-like register access to drivers.

Quoted 6 lines

---

Applied to clk-next

author
#23 lore raw

PATCH v6 10/27 clk: mediatek: Add MT8196 apmixedsys clock support

In reply to Laura Nao

Add support for the MT8196 apmixedsys clock controller, which provides PLLs generated from SoC 26m.

---
 drivers/clk/mediatek/Kconfig                 |   8 +
 drivers/clk/mediatek/Makefile                |   1 +
 drivers/clk/mediatek/clk-mt8196-apmixedsys.c | 204 +++++++++++++++++++
 3 files changed, 213 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-apmixedsys.c
drivers/clk/mediatek/Kconfig +8 -0
index 5f8e6d68fa14..1e0c6f177ecd 100644
@@ -1002,6 +1002,14 @@ config COMMON_CLK_MT8195_VENCSYS
 	help
 	  This driver supports MediaTek MT8195 vencsys clocks.
 
+config COMMON_CLK_MT8196
+	tristate "Clock driver for MediaTek MT8196"
+	depends on ARM64 || COMPILE_TEST
+	select COMMON_CLK_MEDIATEK
+	default ARCH_MEDIATEK
+	help
+	  This driver supports MediaTek MT8196 basic clocks.
+
 config COMMON_CLK_MT8365
 	tristate "Clock driver for MediaTek MT8365"
 	depends on ARCH_MEDIATEK || COMPILE_TEST
drivers/clk/mediatek/Makefile +1 -0
index 6efec95406bd..6144fdce3f9a 100644
@@ -150,6 +150,7 @@ obj-$(CONFIG_COMMON_CLK_MT8195_VDOSYS) += clk-mt8195-vdo0.o clk-mt8195-vdo1.o
 obj-$(CONFIG_COMMON_CLK_MT8195_VENCSYS) += clk-mt8195-venc.o
 obj-$(CONFIG_COMMON_CLK_MT8195_VPPSYS) += clk-mt8195-vpp0.o clk-mt8195-vpp1.o
 obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o
+obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o
 obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
 obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o
 obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.o
drivers/clk/mediatek/clk-mt8196-apmixedsys.c new file +204 -0

204 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#25 lore raw

PATCH v6 11/27 clk: mediatek: Add MT8196 topckgen clock support

In reply to Laura Nao

Add support for the MT8196 topckgen clock controller, which provides muxes and dividers for clock selection in other IP blocks.

---
 drivers/clk/mediatek/Makefile              |   2 +-
 drivers/clk/mediatek/clk-mt8196-topckgen.c | 985 +++++++++++++++++++++
 2 files changed, 986 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-topckgen.c
drivers/clk/mediatek/Makefile +1 -1
index 6144fdce3f9a..ad61621b8c95 100644
@@ -150,7 +150,7 @@ obj-$(CONFIG_COMMON_CLK_MT8195_VDOSYS) += clk-mt8195-vdo0.o clk-mt8195-vdo1.o
 obj-$(CONFIG_COMMON_CLK_MT8195_VENCSYS) += clk-mt8195-venc.o
 obj-$(CONFIG_COMMON_CLK_MT8195_VPPSYS) += clk-mt8195-vpp0.o clk-mt8195-vpp1.o
 obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o
-obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o
+obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o
 obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
 obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o
 obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.o
drivers/clk/mediatek/clk-mt8196-topckgen.c new file +985 -0

985 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#27 lore raw

PATCH v6 12/27 clk: mediatek: Add MT8196 topckgen2 clock support

In reply to Laura Nao

Add support for the MT8196 topckgen2 clock controller, which provides muxes and dividers for clock selection in other IP blocks.

---
 drivers/clk/mediatek/Makefile               |   3 +-
 drivers/clk/mediatek/clk-mt8196-topckgen2.c | 568 ++++++++++++++++++++
 2 files changed, 570 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-topckgen2.c
drivers/clk/mediatek/Makefile +2 -1
index ad61621b8c95..c415453e02fd 100644
@@ -150,7 +150,8 @@ obj-$(CONFIG_COMMON_CLK_MT8195_VDOSYS) += clk-mt8195-vdo0.o clk-mt8195-vdo1.o
 obj-$(CONFIG_COMMON_CLK_MT8195_VENCSYS) += clk-mt8195-venc.o
 obj-$(CONFIG_COMMON_CLK_MT8195_VPPSYS) += clk-mt8195-vpp0.o clk-mt8195-vpp1.o
 obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o
-obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o
+obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o \
+				   clk-mt8196-topckgen2.o
 obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
 obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o
 obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.o
drivers/clk/mediatek/clk-mt8196-topckgen2.c new file +568 -0

568 lines not on this page · raw message

Signature · 1 line
2.39.5
maintainer Applied
#28 lore raw

Re: [PATCH v6 12/27] clk: mediatek: Add MT8196 topckgen2 clock support

Quoting Laura Nao (2025-09-15 08:19:32)

Quoted 7 lines

Add support for the MT8196 topckgen2 clock controller, which provides muxes and dividers for clock selection in other IP blocks.

---

Applied to clk-next

author
#29 lore raw

PATCH v6 13/27 clk: mediatek: Add MT8196 vlpckgen clock support

In reply to Laura Nao

Add support for the MT8196 vlpckgen clock controller, which provides muxes and dividers for clock selection in other IP blocks.

---
 drivers/clk/mediatek/Makefile              |   2 +-
 drivers/clk/mediatek/clk-mt8196-vlpckgen.c | 725 +++++++++++++++++++++
 2 files changed, 726 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-vlpckgen.c
drivers/clk/mediatek/Makefile +1 -1
index c415453e02fd..031e7ac38804 100644
@@ -151,7 +151,7 @@ obj-$(CONFIG_COMMON_CLK_MT8195_VENCSYS) += clk-mt8195-venc.o
 obj-$(CONFIG_COMMON_CLK_MT8195_VPPSYS) += clk-mt8195-vpp0.o clk-mt8195-vpp1.o
 obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o
 obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o \
-				   clk-mt8196-topckgen2.o
+				   clk-mt8196-topckgen2.o clk-mt8196-vlpckgen.o
 obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
 obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o
 obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.o
drivers/clk/mediatek/clk-mt8196-vlpckgen.c new file +725 -0

725 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#31 lore raw

PATCH v6 14/27 clk: mediatek: Add MT8196 peripheral clock support

In reply to Laura Nao

Add support for the MT8196 peripheral clock controller, which provides clock gate control for dma/flashif/msdc/pwm/spi/uart.

---
 drivers/clk/mediatek/Makefile             |   3 +-
 drivers/clk/mediatek/clk-mt8196-peri_ao.c | 142 ++++++++++++++++++++++
 2 files changed, 144 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-peri_ao.c
drivers/clk/mediatek/Makefile +2 -1
index 031e7ac38804..8888ffd3d7ba 100644
@@ -151,7 +151,8 @@ obj-$(CONFIG_COMMON_CLK_MT8195_VENCSYS) += clk-mt8195-venc.o
 obj-$(CONFIG_COMMON_CLK_MT8195_VPPSYS) += clk-mt8195-vpp0.o clk-mt8195-vpp1.o
 obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o
 obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o \
-				   clk-mt8196-topckgen2.o clk-mt8196-vlpckgen.o
+				   clk-mt8196-topckgen2.o clk-mt8196-vlpckgen.o \
+				   clk-mt8196-peri_ao.o
 obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
 obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o
 obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.o
drivers/clk/mediatek/clk-mt8196-peri_ao.c new file +142 -0

142 lines not on this page · raw message

Signature · 1 line
2.39.5
maintainer Applied
#32 lore raw

Re: [PATCH v6 14/27] clk: mediatek: Add MT8196 peripheral clock support

Quoting Laura Nao (2025-09-15 08:19:34)

Quoted 7 lines

Add support for the MT8196 peripheral clock controller, which provides clock gate control for dma/flashif/msdc/pwm/spi/uart.

---

Applied to clk-next

author
#33 lore raw

PATCH v6 15/27 clk: mediatek: Add MT8196 ufssys clock support

In reply to Laura Nao

Add support for the MT8196 ufssys clock controller, which provides clock gate control for UFS.

---
 drivers/clk/mediatek/Kconfig             |   7 ++
 drivers/clk/mediatek/Makefile            |   1 +
 drivers/clk/mediatek/clk-mt8196-ufs_ao.c | 108 +++++++++++++++++++++++
 3 files changed, 116 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-ufs_ao.c
drivers/clk/mediatek/Kconfig +7 -0
index 1e0c6f177ecd..d99c39a7f10e 100644
@@ -1010,6 +1010,13 @@ config COMMON_CLK_MT8196
 	help
 	  This driver supports MediaTek MT8196 basic clocks.
 
+config COMMON_CLK_MT8196_UFSSYS
+	tristate "Clock driver for MediaTek MT8196 ufssys"
+	depends on COMMON_CLK_MT8196
+	default COMMON_CLK_MT8196
+	help
+	  This driver supports MediaTek MT8196 ufssys clocks.
+
 config COMMON_CLK_MT8365
 	tristate "Clock driver for MediaTek MT8365"
 	depends on ARCH_MEDIATEK || COMPILE_TEST
drivers/clk/mediatek/Makefile +1 -0
index 8888ffd3d7ba..1a497de00846 100644
@@ -153,6 +153,7 @@ obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o
 obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o \
 				   clk-mt8196-topckgen2.o clk-mt8196-vlpckgen.o \
 				   clk-mt8196-peri_ao.o
+obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o
 obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
 obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o
 obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.o
drivers/clk/mediatek/clk-mt8196-ufs_ao.c new file +108 -0

108 lines not on this page · raw message

Signature · 1 line
2.39.5
maintainer Applied
#34 lore raw

Re: [PATCH v6 15/27] clk: mediatek: Add MT8196 ufssys clock support

Quoting Laura Nao (2025-09-15 08:19:35)

Quoted 9 lines

Add support for the MT8196 ufssys clock controller, which provides clock gate control for UFS.

---

Applied to clk-next

author
#35 lore raw

PATCH v6 16/27 clk: mediatek: Add MT8196 pextpsys clock support

In reply to Laura Nao

Add support for the MT8196 pextpsys clock controller, which provides clock gate control for PCIe.

---
 drivers/clk/mediatek/Kconfig            |   7 ++
 drivers/clk/mediatek/Makefile           |   1 +
 drivers/clk/mediatek/clk-mt8196-pextp.c | 131 ++++++++++++++++++++++++
 3 files changed, 139 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-pextp.c
drivers/clk/mediatek/Kconfig +7 -0
index d99c39a7f10e..c977719046a4 100644
@@ -1010,6 +1010,13 @@ config COMMON_CLK_MT8196
 	help
 	  This driver supports MediaTek MT8196 basic clocks.
 
+config COMMON_CLK_MT8196_PEXTPSYS
+	tristate "Clock driver for MediaTek MT8196 pextpsys"
+	depends on COMMON_CLK_MT8196
+	default COMMON_CLK_MT8196
+	help
+	  This driver supports MediaTek MT8196 pextpsys clocks.
+
 config COMMON_CLK_MT8196_UFSSYS
 	tristate "Clock driver for MediaTek MT8196 ufssys"
 	depends on COMMON_CLK_MT8196
drivers/clk/mediatek/Makefile +1 -0
index 1a497de00846..88f7d8a229c2 100644
@@ -153,6 +153,7 @@ obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o
 obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o \
 				   clk-mt8196-topckgen2.o clk-mt8196-vlpckgen.o \
 				   clk-mt8196-peri_ao.o
+obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o
 obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o
 obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
 obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o
drivers/clk/mediatek/clk-mt8196-pextp.c new file +131 -0

131 lines not on this page · raw message

Signature · 1 line
2.39.5
maintainer Applied
#36 lore raw

Re: [PATCH v6 16/27] clk: mediatek: Add MT8196 pextpsys clock support

Quoting Laura Nao (2025-09-15 08:19:36)

Quoted 8 lines

Add support for the MT8196 pextpsys clock controller, which provides clock gate control for PCIe.

---

Applied to clk-next

author
#37 lore raw

PATCH v6 17/27 clk: mediatek: Add MT8196 I2C clock support

In reply to Laura Nao

Add support for the MT8196 I2C clock controller, which provides clock gate control for I2C.

---
 drivers/clk/mediatek/Kconfig                  |   7 ++
 drivers/clk/mediatek/Makefile                 |   1 +
 .../clk/mediatek/clk-mt8196-imp_iic_wrap.c    | 118 ++++++++++++++++++
 3 files changed, 126 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-imp_iic_wrap.c
drivers/clk/mediatek/Kconfig +7 -0
index c977719046a4..fe2697b64ef0 100644
@@ -1010,6 +1010,13 @@ config COMMON_CLK_MT8196
 	help
 	  This driver supports MediaTek MT8196 basic clocks.
 
+config COMMON_CLK_MT8196_IMP_IIC_WRAP
+	tristate "Clock driver for MediaTek MT8196 imp_iic_wrap"
+	depends on COMMON_CLK_MT8196
+	default COMMON_CLK_MT8196
+	help
+	  This driver supports MediaTek MT8196 i2c clocks.
+
 config COMMON_CLK_MT8196_PEXTPSYS
 	tristate "Clock driver for MediaTek MT8196 pextpsys"
 	depends on COMMON_CLK_MT8196
drivers/clk/mediatek/Makefile +1 -0
index 88f7d8a229c2..241e7f5e7316 100644
@@ -153,6 +153,7 @@ obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o
 obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o \
 				   clk-mt8196-topckgen2.o clk-mt8196-vlpckgen.o \
 				   clk-mt8196-peri_ao.o
+obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o
 obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o
 obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o
 obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
drivers/clk/mediatek/clk-mt8196-imp_iic_wrap.c new file +118 -0

118 lines not on this page · raw message

Signature · 1 line
2.39.5
maintainer Applied
#38 lore raw

Re: [PATCH v6 17/27] clk: mediatek: Add MT8196 I2C clock support

Quoting Laura Nao (2025-09-15 08:19:37)

Quoted 8 lines

Add support for the MT8196 I2C clock controller, which provides clock gate control for I2C.

---

Applied to clk-next

author
#39 lore raw

PATCH v6 18/27 clk: mediatek: Add MT8196 mcu clock support

In reply to Laura Nao

Add support for the MT8196 mcu clock controller, which provides PLL control for MCU.

---
 drivers/clk/mediatek/Kconfig          |   7 ++
 drivers/clk/mediatek/Makefile         |   1 +
 drivers/clk/mediatek/clk-mt8196-mcu.c | 167 ++++++++++++++++++++++++++
 3 files changed, 175 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-mcu.c
drivers/clk/mediatek/Kconfig +7 -0
index fe2697b64ef0..8e5cdae80748 100644
@@ -1017,6 +1017,13 @@ config COMMON_CLK_MT8196_IMP_IIC_WRAP
 	help
 	  This driver supports MediaTek MT8196 i2c clocks.
 
+config COMMON_CLK_MT8196_MCUSYS
+	tristate "Clock driver for MediaTek MT8196 mcusys"
+	depends on COMMON_CLK_MT8196
+	default COMMON_CLK_MT8196
+	help
+	  This driver supports MediaTek MT8196 mcusys clocks.
+
 config COMMON_CLK_MT8196_PEXTPSYS
 	tristate "Clock driver for MediaTek MT8196 pextpsys"
 	depends on COMMON_CLK_MT8196
drivers/clk/mediatek/Makefile +1 -0
index 241e7f5e7316..46358623c3e5 100644
@@ -154,6 +154,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o
 				   clk-mt8196-topckgen2.o clk-mt8196-vlpckgen.o \
 				   clk-mt8196-peri_ao.o
 obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o
+obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o
 obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o
 obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o
 obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
drivers/clk/mediatek/clk-mt8196-mcu.c new file +167 -0

167 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#41 lore raw

PATCH v6 19/27 clk: mediatek: Add MT8196 mdpsys clock support

In reply to Laura Nao

Add support for the MT8196 mdpsys clock controller, which provides clock gate control for MDP.

---
 drivers/clk/mediatek/Kconfig             |   7 +
 drivers/clk/mediatek/Makefile            |   1 +
 drivers/clk/mediatek/clk-mt8196-mdpsys.c | 186 +++++++++++++++++++++++
 3 files changed, 194 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-mdpsys.c
drivers/clk/mediatek/Kconfig +7 -0
index 8e5cdae80748..68ac08cf8e82 100644
@@ -1024,6 +1024,13 @@ config COMMON_CLK_MT8196_MCUSYS
 	help
 	  This driver supports MediaTek MT8196 mcusys clocks.
 
+config COMMON_CLK_MT8196_MDPSYS
+	tristate "Clock driver for MediaTek MT8196 mdpsys"
+	depends on COMMON_CLK_MT8196
+	default COMMON_CLK_MT8196
+	help
+	  This driver supports MediaTek MT8196 mdpsys clocks.
+
 config COMMON_CLK_MT8196_PEXTPSYS
 	tristate "Clock driver for MediaTek MT8196 pextpsys"
 	depends on COMMON_CLK_MT8196
drivers/clk/mediatek/Makefile +1 -0
index 46358623c3e5..d2d8bc43e45b 100644
@@ -155,6 +155,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o
 				   clk-mt8196-peri_ao.o
 obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o
 obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o
+obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o
 obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o
 obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o
 obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
drivers/clk/mediatek/clk-mt8196-mdpsys.c new file +186 -0

186 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#43 lore raw

PATCH v6 20/27 clk: mediatek: Add MT8196 mfg clock support

In reply to Laura Nao

Add support for the MT8196 mfg clock controller, which provides PLL control for the GPU.

---
 drivers/clk/mediatek/Kconfig          |   7 ++
 drivers/clk/mediatek/Makefile         |   1 +
 drivers/clk/mediatek/clk-mt8196-mfg.c | 150 ++++++++++++++++++++++++++
 3 files changed, 158 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-mfg.c
drivers/clk/mediatek/Kconfig +7 -0
index 68ac08cf8e82..1990721ec418 100644
@@ -1031,6 +1031,13 @@ config COMMON_CLK_MT8196_MDPSYS
 	help
 	  This driver supports MediaTek MT8196 mdpsys clocks.
 
+config COMMON_CLK_MT8196_MFGCFG
+	tristate "Clock driver for MediaTek MT8196 mfgcfg"
+	depends on COMMON_CLK_MT8196
+	default m
+	help
+	  This driver supports MediaTek MT8196 mfgcfg clocks.
+
 config COMMON_CLK_MT8196_PEXTPSYS
 	tristate "Clock driver for MediaTek MT8196 pextpsys"
 	depends on COMMON_CLK_MT8196
drivers/clk/mediatek/Makefile +1 -0
index d2d8bc43e45b..0040a3968858 100644
@@ -156,6 +156,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o
 obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o
 obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o
 obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o
+obj-$(CONFIG_COMMON_CLK_MT8196_MFGCFG) += clk-mt8196-mfg.o
 obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o
 obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o
 obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
drivers/clk/mediatek/clk-mt8196-mfg.c new file +150 -0

150 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#45 lore raw

PATCH v6 21/27 clk: mediatek: Add MT8196 disp0 clock support

In reply to Laura Nao

Add support for the MT8196 disp0 clock controller, which provides clock gate control for the display system. It is integrated with the mtk-mmsys driver, which registers the disp0 clock driver via platform_device_register_data().

---
 drivers/clk/mediatek/Kconfig            |   7 +
 drivers/clk/mediatek/Makefile           |   1 +
 drivers/clk/mediatek/clk-mt8196-disp0.c | 170 ++++++++++++++++++++++++
 3 files changed, 178 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-disp0.c
drivers/clk/mediatek/Kconfig +7 -0
index 1990721ec418..77e18bceae91 100644
@@ -1038,6 +1038,13 @@ config COMMON_CLK_MT8196_MFGCFG
 	help
 	  This driver supports MediaTek MT8196 mfgcfg clocks.
 
+config COMMON_CLK_MT8196_MMSYS
+	tristate "Clock driver for MediaTek MT8196 mmsys"
+	depends on COMMON_CLK_MT8196
+	default m
+	help
+	  This driver supports MediaTek MT8196 mmsys clocks.
+
 config COMMON_CLK_MT8196_PEXTPSYS
 	tristate "Clock driver for MediaTek MT8196 pextpsys"
 	depends on COMMON_CLK_MT8196
drivers/clk/mediatek/Makefile +1 -0
index 0040a3968858..a8c681f9fe64 100644
@@ -157,6 +157,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o
 obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o
 obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o
 obj-$(CONFIG_COMMON_CLK_MT8196_MFGCFG) += clk-mt8196-mfg.o
+obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o
 obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o
 obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o
 obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
drivers/clk/mediatek/clk-mt8196-disp0.c new file +170 -0

170 lines not on this page · raw message

Signature · 1 line
2.39.5
maintainer Applied
#46 lore raw

Re: [PATCH v6 21/27] clk: mediatek: Add MT8196 disp0 clock support

Quoting Laura Nao (2025-09-15 08:19:41)

Quoted 9 lines

Add support for the MT8196 disp0 clock controller, which provides clock gate control for the display system. It is integrated with the mtk-mmsys driver, which registers the disp0 clock driver via platform_device_register_data().

---

Applied to clk-next

author
#47 lore raw

PATCH v6 22/27 clk: mediatek: Add MT8196 disp1 clock support

In reply to Laura Nao

Add support for the MT8196 disp1 clock controller, which provides clock gate control for the display system. It is integrated with the mtk-mmsys driver, which registers the disp1 clock driver via platform_device_register_data().

---
 drivers/clk/mediatek/Makefile           |   2 +-
 drivers/clk/mediatek/clk-mt8196-disp1.c | 170 ++++++++++++++++++++++++
 2 files changed, 171 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-disp1.c
drivers/clk/mediatek/Makefile +1 -1
index a8c681f9fe64..fe5699411d8b 100644
@@ -157,7 +157,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o
 obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o
 obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o
 obj-$(CONFIG_COMMON_CLK_MT8196_MFGCFG) += clk-mt8196-mfg.o
-obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o
+obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk-mt8196-disp1.o
 obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o
 obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o
 obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
drivers/clk/mediatek/clk-mt8196-disp1.c new file +170 -0

170 lines not on this page · raw message

Signature · 1 line
2.39.5
maintainer Applied
#48 lore raw

Re: [PATCH v6 22/27] clk: mediatek: Add MT8196 disp1 clock support

Quoting Laura Nao (2025-09-15 08:19:42)

Quoted 9 lines

Add support for the MT8196 disp1 clock controller, which provides clock gate control for the display system. It is integrated with the mtk-mmsys driver, which registers the disp1 clock driver via platform_device_register_data().

---

Applied to clk-next

author
#49 lore raw

PATCH v6 23/27 clk: mediatek: Add MT8196 disp-ao clock support

In reply to Laura Nao

Add support for the MT8196 disp-ao clock controller, which provides clock gate control for the display system. It is integrated with the mtk-mmsys driver, which registers the disp-ao clock driver via platform_device_register_data().

---
 drivers/clk/mediatek/Makefile              |  2 +-
 drivers/clk/mediatek/clk-mt8196-vdisp_ao.c | 80 ++++++++++++++++++++++
 2 files changed, 81 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-vdisp_ao.c
drivers/clk/mediatek/Makefile +1 -1
index fe5699411d8b..5b8969ff1985 100644
@@ -157,7 +157,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o
 obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o
 obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o
 obj-$(CONFIG_COMMON_CLK_MT8196_MFGCFG) += clk-mt8196-mfg.o
-obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk-mt8196-disp1.o
+obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk-mt8196-disp1.o clk-mt8196-vdisp_ao.o
 obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o
 obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o
 obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
drivers/clk/mediatek/clk-mt8196-vdisp_ao.c new file +80 -0

80 lines not on this page · raw message

Signature · 1 line
2.39.5
maintainer Applied
#50 lore raw

Re: [PATCH v6 23/27] clk: mediatek: Add MT8196 disp-ao clock support

Quoting Laura Nao (2025-09-15 08:19:43)

Quoted 9 lines

Add support for the MT8196 disp-ao clock controller, which provides clock gate control for the display system. It is integrated with the mtk-mmsys driver, which registers the disp-ao clock driver via platform_device_register_data().

---

Applied to clk-next

author
#51 lore raw

PATCH v6 24/27 clk: mediatek: Add MT8196 ovl0 clock support

In reply to Laura Nao

Add support for the MT8196 ovl0 clock controller, which provides clock gate control for the display system. It is integrated with the mtk-mmsys driver, which registers the ovl0 clock driver via platform_device_register_data().

---
 drivers/clk/mediatek/Makefile          |   3 +-
 drivers/clk/mediatek/clk-mt8196-ovl0.c | 154 +++++++++++++++++++++++++
 2 files changed, 156 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-ovl0.c
drivers/clk/mediatek/Makefile +2 -1
index 5b8969ff1985..f42e29fcb19a 100644
@@ -157,7 +157,8 @@ obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o
 obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o
 obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o
 obj-$(CONFIG_COMMON_CLK_MT8196_MFGCFG) += clk-mt8196-mfg.o
-obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk-mt8196-disp1.o clk-mt8196-vdisp_ao.o
+obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk-mt8196-disp1.o clk-mt8196-vdisp_ao.o \
+					 clk-mt8196-ovl0.o
 obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o
 obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o
 obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
drivers/clk/mediatek/clk-mt8196-ovl0.c new file +154 -0

154 lines not on this page · raw message

Signature · 1 line
2.39.5
maintainer Applied
#52 lore raw

Re: [PATCH v6 24/27] clk: mediatek: Add MT8196 ovl0 clock support

Quoting Laura Nao (2025-09-15 08:19:44)

Quoted 9 lines

Add support for the MT8196 ovl0 clock controller, which provides clock gate control for the display system. It is integrated with the mtk-mmsys driver, which registers the ovl0 clock driver via platform_device_register_data().

---

Applied to clk-next

author
#53 lore raw

PATCH v6 25/27 clk: mediatek: Add MT8196 ovl1 clock support

In reply to Laura Nao

Add support for the MT8196 ovl1 clock controller, which provides clock gate control for the display system. It is integrated with the mtk-mmsys driver, which registers the ovl1 clock driver via platform_device_register_data().

---
 drivers/clk/mediatek/Makefile          |   2 +-
 drivers/clk/mediatek/clk-mt8196-ovl1.c | 154 +++++++++++++++++++++++++
 2 files changed, 155 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-ovl1.c
drivers/clk/mediatek/Makefile +1 -1
index f42e29fcb19a..f3afd34311c8 100644
@@ -158,7 +158,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o
 obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o
 obj-$(CONFIG_COMMON_CLK_MT8196_MFGCFG) += clk-mt8196-mfg.o
 obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk-mt8196-disp1.o clk-mt8196-vdisp_ao.o \
-					 clk-mt8196-ovl0.o
+					 clk-mt8196-ovl0.o clk-mt8196-ovl1.o
 obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o
 obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o
 obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
drivers/clk/mediatek/clk-mt8196-ovl1.c new file +154 -0

154 lines not on this page · raw message

Signature · 1 line
2.39.5
maintainer Applied
#54 lore raw

Re: [PATCH v6 25/27] clk: mediatek: Add MT8196 ovl1 clock support

Quoting Laura Nao (2025-09-15 08:19:45)

Quoted 9 lines

Add support for the MT8196 ovl1 clock controller, which provides clock gate control for the display system. It is integrated with the mtk-mmsys driver, which registers the ovl1 clock driver via platform_device_register_data().

---

Applied to clk-next

author
#55 lore raw

PATCH v6 26/27 clk: mediatek: Add MT8196 vdecsys clock support

In reply to Laura Nao

Add support for the MT8196 vdecsys clock controller, which provides clock gate control for the video decoder.

---
 drivers/clk/mediatek/Kconfig           |   7 +
 drivers/clk/mediatek/Makefile          |   1 +
 drivers/clk/mediatek/clk-mt8196-vdec.c | 253 +++++++++++++++++++++++++
 3 files changed, 261 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-vdec.c
drivers/clk/mediatek/Kconfig +7 -0
index 77e18bceae91..939d7d27c0c8 100644
@@ -1059,6 +1059,13 @@ config COMMON_CLK_MT8196_UFSSYS
 	help
 	  This driver supports MediaTek MT8196 ufssys clocks.
 
+config COMMON_CLK_MT8196_VDECSYS
+	tristate "Clock driver for MediaTek MT8196 vdecsys"
+	depends on COMMON_CLK_MT8196
+	default m
+	help
+	  This driver supports MediaTek MT8196 vdecsys clocks.
+
 config COMMON_CLK_MT8365
 	tristate "Clock driver for MediaTek MT8365"
 	depends on ARCH_MEDIATEK || COMPILE_TEST
drivers/clk/mediatek/Makefile +1 -0
index f3afd34311c8..131582b12783 100644
@@ -161,6 +161,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk-mt8196-disp1.o c
 					 clk-mt8196-ovl0.o clk-mt8196-ovl1.o
 obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o
 obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o
+obj-$(CONFIG_COMMON_CLK_MT8196_VDECSYS) += clk-mt8196-vdec.o
 obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
 obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o
 obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.o
drivers/clk/mediatek/clk-mt8196-vdec.c new file +253 -0

253 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#57 lore raw

PATCH v6 27/27 clk: mediatek: Add MT8196 vencsys clock support

In reply to Laura Nao

Add support for the MT8196 vencsys clock controller, which provides clock gate control for the video encoder.

---
 drivers/clk/mediatek/Kconfig           |   7 +
 drivers/clk/mediatek/Makefile          |   1 +
 drivers/clk/mediatek/clk-mt8196-venc.c | 236 +++++++++++++++++++++++++
 3 files changed, 244 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-venc.c
drivers/clk/mediatek/Kconfig +7 -0
index 939d7d27c0c8..0e8dd82aa84e 100644
@@ -1066,6 +1066,13 @@ config COMMON_CLK_MT8196_VDECSYS
 	help
 	  This driver supports MediaTek MT8196 vdecsys clocks.
 
+config COMMON_CLK_MT8196_VENCSYS
+	tristate "Clock driver for MediaTek MT8196 vencsys"
+	depends on COMMON_CLK_MT8196
+	default m
+	help
+	  This driver supports MediaTek MT8196 vencsys clocks.
+
 config COMMON_CLK_MT8365
 	tristate "Clock driver for MediaTek MT8365"
 	depends on ARCH_MEDIATEK || COMPILE_TEST
drivers/clk/mediatek/Makefile +1 -0
index 131582b12783..d8736a060dbd 100644
@@ -162,6 +162,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk-mt8196-disp1.o c
 obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o
 obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o
 obj-$(CONFIG_COMMON_CLK_MT8196_VDECSYS) += clk-mt8196-vdec.o
+obj-$(CONFIG_COMMON_CLK_MT8196_VENCSYS) += clk-mt8196-venc.o
 obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
 obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o
 obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.o
drivers/clk/mediatek/clk-mt8196-venc.c new file +236 -0

236 lines not on this page · raw message

Signature · 1 line
2.39.5