Skip to contentSkip to conversation

Add support for MT8196 clock controllers

PATCH Superseded Laura Nao 4 participants 46 messages Jul 30, 2025 – Aug 4, 2025

Subsystems (6)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Laura Nao

author
#0 lore raw

v3 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 v3:
- Removed duplication in clock parent lists in the topckgen, topckgen2, and vlpckgen drivers
- Added vlp_clk26m parent and index table for audio clocks in the vlpckgen driver
- Added APLL tuner initialization to the probe function of the vlpckgen driver
- Dropped the adsp driver
- Merged reset controller binding into the clock binding doc commit
- Dropped .owner entry from mfg driver
- Added R-b tags

Link to v2: 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 |  86 ++
 .../clock/mediatek,mt8196-sys-clock.yaml      |  81 ++
 drivers/clk/mediatek/Kconfig                  |  71 ++
 drivers/clk/mediatek/Makefile                 |  13 +
 drivers/clk/mediatek/clk-gate.c               | 106 +-
 drivers/clk/mediatek/clk-gate.h               |   3 +
 drivers/clk/mediatek/clk-mt8196-apmixedsys.c  | 203 ++++
 drivers/clk/mediatek/clk-mt8196-disp0.c       | 169 +++
 drivers/clk/mediatek/clk-mt8196-disp1.c       | 170 +++
 .../clk/mediatek/clk-mt8196-imp_iic_wrap.c    | 117 +++
 drivers/clk/mediatek/clk-mt8196-mcu.c         | 166 +++
 drivers/clk/mediatek/clk-mt8196-mdpsys.c      | 187 ++++
 drivers/clk/mediatek/clk-mt8196-mfg.c         | 149 +++
 drivers/clk/mediatek/clk-mt8196-ovl0.c        | 154 +++
 drivers/clk/mediatek/clk-mt8196-ovl1.c        | 153 +++
 drivers/clk/mediatek/clk-mt8196-peri_ao.c     | 144 +++
 drivers/clk/mediatek/clk-mt8196-pextp.c       | 131 +++
 drivers/clk/mediatek/clk-mt8196-topckgen.c    | 984 ++++++++++++++++++
 drivers/clk/mediatek/clk-mt8196-topckgen2.c   | 567 ++++++++++
 drivers/clk/mediatek/clk-mt8196-ufs_ao.c      | 109 ++
 drivers/clk/mediatek/clk-mt8196-vdec.c        | 253 +++++
 drivers/clk/mediatek/clk-mt8196-vdisp_ao.c    |  79 ++
 drivers/clk/mediatek/clk-mt8196-venc.c        | 235 +++++
 drivers/clk/mediatek/clk-mt8196-vlpckgen.c    | 726 +++++++++++++
 drivers/clk/mediatek/clk-mtk.c                |  16 +
 drivers/clk/mediatek/clk-mtk.h                |  23 +
 drivers/clk/mediatek/clk-mux.c                | 119 ++-
 drivers/clk/mediatek/clk-mux.h                |  87 ++
 drivers/clk/mediatek/clk-pll.c                |  46 +-
 drivers/clk/mediatek/clk-pll.h                |   9 +
 .../dt-bindings/clock/mediatek,mt8196-clock.h | 802 ++++++++++++++
 .../reset/mediatek,mt8196-resets.h            |  26 +
 32 files changed, 6160 insertions(+), 24 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 v3 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 ce453e1718e5..49ca25dd5418 100644
@@ -308,6 +308,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 285c8db958b3..c4d06bb11516 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
author
#2 lore raw

PATCH v3 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 | 42 +++++++++++++++++++++++++++++++++-
 drivers/clk/mediatek/clk-pll.h |  5 ++++
 2 files changed, 46 insertions(+), 1 deletion(-)
drivers/clk/mediatek/clk-pll.c +41 -1
index 49ca25dd5418..8f46de77f42d 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) & pll->fenc_mask;
+}
+
 static unsigned long __mtk_pll_recalc_rate(struct mtk_clk_pll *pll, u32 fin,
 		u32 pcw, int postdiv)
 {
@@ -274,6 +281,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,
@@ -283,6 +309,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,
@@ -315,6 +351,9 @@ 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;
+	pll->fenc_mask = BIT(data->fenc_sta_bit);
+
 	init.name = data->name;
 	init.flags = (data->flags & PLL_AO) ? CLK_IS_CRITICAL : 0;
 	init.ops = pll_ops;
@@ -337,12 +376,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 +5 -0
index c4d06bb11516..7fdc5267a2b5 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,8 @@ struct mtk_clk_pll {
 	void __iomem	*en_addr;
 	void __iomem	*en_set_addr;
 	void __iomem	*en_clr_addr;
+	void __iomem	*fenc_addr;
+	u32		fenc_mask;
 	const struct mtk_pll_data *data;
 };
 
@@ -82,6 +86,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
author
#3 lore raw

PATCH v3 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-mtk.h |  2 ++
 drivers/clk/mediatek/clk-mux.c | 48 ++++++++++++++++++++++++++++++++++
 drivers/clk/mediatek/clk-mux.h | 45 +++++++++++++++++++++++++++++++
 3 files changed, 95 insertions(+)
drivers/clk/mediatek/clk-mtk.h +2 -0
index c17fe1c2d732..136a4bc6dbe6 100644
@@ -20,6 +20,8 @@
 
 #define MHZ (1000 * 1000)
 
+#define MTK_WAIT_FENC_DONE_US	30
+
 struct platform_device;
 
 /*
drivers/clk/mediatek/clk-mux.c +48 -0

72 lines not on this page · raw message

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

68 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#4 lore raw

PATCH v3 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 136a4bc6dbe6..8ed2c9208b1f 100644
@@ -247,5 +247,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
author
#5 lore raw

PATCH v3 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 |  1 +
 drivers/clk/mediatek/clk-mux.c | 71 +++++++++++++++++++++++++++++++++-
 drivers/clk/mediatek/clk-mux.h | 42 ++++++++++++++++++++
 3 files changed, 113 insertions(+), 1 deletion(-)
drivers/clk/mediatek/clk-mtk.h +1 -0
index 8ed2c9208b1f..e2cefd9bc5b8 100644
@@ -20,6 +20,7 @@
 
 #define MHZ (1000 * 1000)
 
+#define MTK_WAIT_HWV_DONE_US	30
 #define MTK_WAIT_FENC_DONE_US	30
 
 struct platform_device;
drivers/clk/mediatek/clk-mux.c +70 -1

130 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
#6 lore raw

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

Quoted 15 lines · Laura Nao
drivers/clk/mediatek/clk-mux.c +2 -0
 	clk_mux->regmap = regmap;
+	clk_mux->regmap_hwv = regmap_hwv;
 	clk_mux->data = mux;
 	clk_mux->lock = lock;
 	clk_mux->hw.init = &init;
@@ -268,6 +329,7 @@ int mtk_clk_register_muxes(struct device *dev,
 			   struct clk_hw_onecell_data *clk_data)
 {
 	struct regmap *regmap;
+	struct regmap *regmap_hwv;
 	struct clk_hw *hw;
 	int i;
 

drivers/clk/mediatek/clk-mux.c int mtk_clk_register_muxes(struct device *dev, · line 343

Quoted 5 lines
drivers/clk/mediatek/clk-mux.c +2 -0
@@ -277,6 +339,13 @@ int mtk_clk_register_muxes(struct device *dev,
 		return PTR_ERR(regmap);
 	}
 
+	regmap_hwv = mtk_clk_get_hwv_regmap(node);
+	if (IS_ERR(regmap_hwv)) {

This is either buggy or fragile. mtk_clk_get_hwv_regmap() returns NULL or valid pointer... or error? IS_ERR_OR_NULL is not the wait to go.

Choose one - IS_ERR or NULL, preferrably the first, since you must handle deferred probe.

Quoted 9 lines
drivers/clk/mediatek/clk-mux.c +5 -0
+		pr_err("Cannot find hardware voter regmap for %pOF: %pe\n",
+		       node, regmap_hwv);
+		return PTR_ERR(regmap_hwv);
+	}
+
 	for (i = 0; i < num; i++) {
 		const struct mtk_mux *mux = &muxes[i];
 

drivers/clk/mediatek/clk-mux.c int mtk_clk_register_muxes(struct device *dev, · line 358

Quoted 5 lines
drivers/clk/mediatek/clk-mux.c +1 -1
@@ -286,7 +355,7 @@ int mtk_clk_register_muxes(struct device *dev,
 			continue;
 		}
 
-		hw = mtk_clk_register_mux(dev, mux, regmap, lock);
+		hw = mtk_clk_register_mux(dev, mux, regmap, regmap_hwv, lock);

So NULL is passed and stored... are you sure this is 100% backwards compatible?

Best regards,
Krzysztof

#7 lore raw

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

Il 04/08/25 16:05, Krzysztof Kozlowski ha scritto:

Quoted 19 lines · Laura Nao
Quoted 18 lines
  
  	clk_mux->regmap = regmap;
drivers/clk/mediatek/clk-mux.c +2 -0
+	clk_mux->regmap_hwv = regmap_hwv;
  	clk_mux->data = mux;
  	clk_mux->lock = lock;
  	clk_mux->hw.init = &init;
@@ -268,6 +329,7 @@ int mtk_clk_register_muxes(struct device *dev,
  			   struct clk_hw_onecell_data *clk_data)
  {
  	struct regmap *regmap;
+	struct regmap *regmap_hwv;
  	struct clk_hw *hw;
  	int i;
 
@@ -277,6 +339,13 @@ int mtk_clk_register_muxes(struct device *dev,
  		return PTR_ERR(regmap);
  	}
 
Quoted 9 lines

drivers/clk/mediatek/clk-mux.c int mtk_clk_register_muxes(struct device *dev, · line 343

Quoted 2 lines
drivers/clk/mediatek/clk-mux.c +2 -0
+	regmap_hwv = mtk_clk_get_hwv_regmap(node);
+	if (IS_ERR(regmap_hwv)) {

This is either buggy or fragile. mtk_clk_get_hwv_regmap() returns NULL or valid pointer... or error? IS_ERR_OR_NULL is not the wait to go.

Choose one - IS_ERR or NULL, preferrably the first, since you must handle deferred probe.

if regmap_hwv == NULL -> there is no HWV for *this* clock
if regmap_hwv == -ERROR -> there is a HWV for *this* clock, but something
went wrong, we have to return the error.

Quoted 12 lines
Quoted 12 lines
drivers/clk/mediatek/clk-mux.c +5 -0
+		pr_err("Cannot find hardware voter regmap for %pOF: %pe\n",
+		       node, regmap_hwv);
+		return PTR_ERR(regmap_hwv);
+	}
+
  	for (i = 0; i < num; i++) {
  		const struct mtk_mux *mux = &muxes[i];
 
@@ -286,7 +355,7 @@ int mtk_clk_register_muxes(struct device *dev,
  			continue;
  		}
 
Quoted 6 lines

drivers/clk/mediatek/clk-mux.c int mtk_clk_register_muxes(struct device *dev, · line 358

Quoted 2 lines
drivers/clk/mediatek/clk-mux.c +1 -1
-		hw = mtk_clk_register_mux(dev, mux, regmap, lock);
+		hw = mtk_clk_register_mux(dev, mux, regmap, regmap_hwv, lock);

So NULL is passed and stored... are you sure this is 100% backwards compatible?

Yes, it is. This got tested on multiple legacy SoCs in our lab.

Quoted 4 lines

Best regards,
Krzysztof

author
#8 lore raw

PATCH v3 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 instead of individual parameters, avoiding the need to add three extra arguments to support HW voter register offsets.

---
 drivers/clk/mediatek/clk-gate.c | 35 ++++++++++++---------------------
 1 file changed, 13 insertions(+), 22 deletions(-)
drivers/clk/mediatek/clk-gate.c +13 -22
index 67d9e741c5e7..0375ccad4be3 100644
@@ -152,12 +152,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,17 +164,17 @@ 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->set_ofs = gate->regs->set_ofs;
+	cg->clr_ofs = gate->regs->clr_ofs;
+	cg->sta_ofs = gate->regs->sta_ofs;
+	cg->bit = gate->shift;
 
 	cg->hw.init = &init;
 
@@ -228,13 +225,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
author
#9 lore raw

PATCH v3 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 | 77 +++++++++++++++++++++++++++++++--
 drivers/clk/mediatek/clk-gate.h |  3 ++
 2 files changed, 77 insertions(+), 3 deletions(-)
drivers/clk/mediatek/clk-gate.c +74 -3
index 0375ccad4be3..426f3a25763d 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,14 +13,19 @@
 #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;
 	int		set_ofs;
 	int		clr_ofs;
 	int		sta_ofs;
+	unsigned int	hwv_set_ofs;
+	unsigned int	hwv_clr_ofs;
+	unsigned int	hwv_sta_ofs;
 	u8		bit;
 };
 
@@ -100,6 +106,28 @@ 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->hwv_set_ofs : cg->hwv_clr_ofs, BIT(cg->bit));
+
+	return regmap_read_poll_timeout_atomic(cg->regmap_hwv, cg->hwv_sta_ofs, val,
+					       val & BIT(cg->bit),
+					       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);
@@ -124,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,
@@ -138,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,
@@ -153,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;
@@ -169,11 +221,22 @@ 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) {
+		dev_err(dev, "regmap not found for hardware voter clocks\n");
+		return ERR_PTR(-ENXIO);
+	}
 
 	cg->regmap = regmap;
+	cg->regmap_hwv = regmap_hwv;
 	cg->set_ofs = gate->regs->set_ofs;
 	cg->clr_ofs = gate->regs->clr_ofs;
 	cg->sta_ofs = gate->regs->sta_ofs;
+	if (gate->hwv_regs) {
+		cg->hwv_set_ofs = gate->hwv_regs->set_ofs;
+		cg->hwv_clr_ofs = gate->hwv_regs->clr_ofs;
+		cg->hwv_sta_ofs = gate->hwv_regs->sta_ofs;
+	}
+
 	cg->bit = gate->shift;
 
 	cg->hw.init = &init;
@@ -206,6 +269,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;
@@ -216,6 +280,13 @@ 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)) {
+		pr_err("Cannot find hardware voter regmap for %pOF: %pe\n",
+		       node, regmap_hwv);
+		return PTR_ERR(regmap_hwv);
+	}
+
 	for (i = 0; i < num; i++) {
 		const struct mtk_gate *gate = &clks[i];
 
@@ -225,7 +296,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
author
#10 lore raw

PATCH v3 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 e2cefd9bc5b8..3498505b616e 100644
@@ -176,6 +176,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
author
#11 lore raw

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

In reply to Laura Nao

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

---
 .../bindings/clock/mediatek,mt8196-clock.yaml |  86 ++
 .../clock/mediatek,mt8196-sys-clock.yaml      |  81 ++
 .../dt-bindings/clock/mediatek,mt8196-clock.h | 802 ++++++++++++++++++
 .../reset/mediatek,mt8196-resets.h            |  26 +
 4 files changed, 995 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 +86 -0
new file mode 100644
index 000000000000..03ee0dff464b
@@ -0,0 +1,86 @@
+# 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:
+      On the MT8196 SoC, a Hardware Voter (HWV) backed by a fixed-function
+      MCU manages clock and power domain control across the AP and other
+      remote processors. By aggregating their votes, it ensures clocks are
+      safely enabled/disabled and power domains are active before register
+      access.
+
+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 +81 -0

81 lines not on this page · raw message

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

802 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
#12 lore raw

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

Quoted 77 lines · Laura Nao

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

---
 .../bindings/clock/mediatek,mt8196-clock.yaml |  86 ++
 .../clock/mediatek,mt8196-sys-clock.yaml      |  81 ++
 .../dt-bindings/clock/mediatek,mt8196-clock.h | 802 ++++++++++++++++++
 .../reset/mediatek,mt8196-resets.h            |  26 +
 4 files changed, 995 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 +53 -0
new file mode 100644
index 000000000000..03ee0dff464b
@@ -0,0 +1,86 @@
+# 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:

Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml line 63

Quoted 10 lines
Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml new file +10 -0
+      Reset lines for PEXTP0/1 and UFS blocks.
+
+  mediatek,hardware-voter:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      On the MT8196 SoC, a Hardware Voter (HWV) backed by a fixed-function
+      MCU manages clock and power domain control across the AP and other
+      remote processors. By aggregating their votes, it ensures clocks are
+      safely enabled/disabled and power domains are active before register
+      access.

I thought this was going away based on v2 discussion?

Rob

#13 lore raw

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

Quoted 13 lines · Rob Herring
Quoted 13 lines
Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml new file +13 -0
+  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
Quoted 8 lines

Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml line 63

Quoted 6 lines
Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml new file +6 -0
+    description:
+      On the MT8196 SoC, a Hardware Voter (HWV) backed by a fixed-function
+      MCU manages clock and power domain control across the AP and other
+      remote processors. By aggregating their votes, it ensures clocks are
+      safely enabled/disabled and power domains are active before register
+      access.

I thought this was going away based on v2 discussion?

Yes, I asked to drop it and do not include it in v3. There was also discussion clarifying review.

I am really surprised that review meant nothing and code is still the same.

Best regards,
Krzysztof

author
#14 lore raw

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

Hi,

Quoted 23 lines · Krzysztof Kozlowski
Quoted 13 lines · Rob Herring
Quoted 13 lines
Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml new file +13 -0
+  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
Quoted 8 lines

Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml line 63

Quoted 6 lines
Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml new file +6 -0
+    description:
+      On the MT8196 SoC, a Hardware Voter (HWV) backed by a fixed-function
+      MCU manages clock and power domain control across the AP and other
+      remote processors. By aggregating their votes, it ensures clocks are
+      safely enabled/disabled and power domains are active before register
+      access.

I thought this was going away based on v2 discussion?

Quoted 5 lines

Yes, I asked to drop it and do not include it in v3. There was also discussion clarifying review.

I am really surprised that review meant nothing and code is still the same.

This has been re-submitted as-is, following the outcome of the discussion
here: https://lore.kernel.org/all/[email protected]/

We haven't found a viable alternative to the current approach so far, and the thread outlines why other options don’t apply. I'm happy to continue the discussion there if anyone has further suggestions or ideas on how to address this.

Thanks,

Laura

Quoted 2 lines

Best regards,
Krzysztof

#15 lore raw

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

Quoted 32 lines · Laura Nao

Hi,

Quoted 23 lines · Krzysztof Kozlowski
Quoted 13 lines · Rob Herring
Quoted 13 lines
Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml new file +13 -0
+  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
Quoted 8 lines

Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml line 63

Quoted 6 lines
Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml new file +6 -0
+    description:
+      On the MT8196 SoC, a Hardware Voter (HWV) backed by a fixed-function
+      MCU manages clock and power domain control across the AP and other
+      remote processors. By aggregating their votes, it ensures clocks are
+      safely enabled/disabled and power domains are active before register
+      access.

I thought this was going away based on v2 discussion?

Quoted 5 lines

Yes, I asked to drop it and do not include it in v3. There was also discussion clarifying review.

I am really surprised that review meant nothing and code is still the same.

Quoted 8 lines

This has been re-submitted as-is, following the outcome of the discussion
here: https://lore.kernel.org/all/[email protected]/

We haven't found a viable alternative to the current approach so far, and the thread outlines why other options don’t apply. I'm happy to continue the discussion there if anyone has further suggestions or ideas on how to address this.

And where is any of that resolution/new facts in the commit msg? You must clearly reflect long discussions like that in the commit msg.

There was no objection from Chen to use clocks or power domains as I requested. The objection was about DUPLICATING interfaces or nodes.

And what was the resolution:

"Regarding that to be a single clock controller,"

So where is the clock controller? I still see HW voter!

Best regards,
Krzysztof

#16 lore raw

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

Il 04/08/25 11:16, Krzysztof Kozlowski ha scritto:

Quoted 36 lines · Laura Nao
Quoted 35 lines

Hi,

Quoted 23 lines · Krzysztof Kozlowski
Quoted 13 lines · Rob Herring
Quoted 13 lines
Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml new file +13 -0
+  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
Quoted 8 lines

Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml line 63

Quoted 6 lines
Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml new file +6 -0
+    description:
+      On the MT8196 SoC, a Hardware Voter (HWV) backed by a fixed-function
+      MCU manages clock and power domain control across the AP and other
+      remote processors. By aggregating their votes, it ensures clocks are
+      safely enabled/disabled and power domains are active before register
+      access.

I thought this was going away based on v2 discussion?

Quoted 5 lines

Yes, I asked to drop it and do not include it in v3. There was also discussion clarifying review.

I am really surprised that review meant nothing and code is still the same.

This has been re-submitted as-is, following the outcome of the discussion
here: https://lore.kernel.org/all/[email protected]/

Quoted 8 lines
Quoted 5 lines

We haven't found a viable alternative to the current approach so far, and the thread outlines why other options don’t apply. I'm happy to continue the discussion there if anyone has further suggestions or ideas on how to address this.

And where is any of that resolution/new facts in the commit msg? You must clearly reflect long discussions like that in the commit msg.

On that, I agree. That's a miss.

Quoted 3 lines

There was no objection from Chen to use clocks or power domains as I requested.

Sorry Krzysztof, but now I really think that you don't understand the basics of MediaTek SoCs and how they're split in hardware - and I'm sorry again, but to me it really looks like that you're not even trying to understand it.

Quoted 1 line

The objection was about DUPLICATING interfaces or nodes.

I don't see that duplication. The interface to each clock controller for each of the hardware subdomains of each controller is scattered all around the (broken by hardware and by concept, if you missed that in the discussion) HW Voter MMIO.

There are multiple clock controllers in the hardware. Each of those has its own interface to the HWV.

And there are some that require you to write to both its HWV interface and to the clock controller specific MMIO at the same time for the same operation. I explained that in the big discussion that Laura linked.

Quoted 6 lines

And what was the resolution:

"Regarding that to be a single clock controller,"

So where is the clock controller? I still see HW voter!

"especially the mux-gate clocks can't really be put in one single clock controller because to manage those we have to write to the HWV *and* to the clock controller MMIO"

Clarifying that, "the clock controller" -> "each clock controller of each hardware subdomain" (not a single clock controller, excuse my bad wording).

Regards,
Angelo

#17 lore raw

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

Quoted 49 lines · AngeloGioacchino Del Regno

Il 04/08/25 11:16, Krzysztof Kozlowski ha scritto:

Quoted 36 lines · Laura Nao
Quoted 35 lines

Hi,

Quoted 23 lines · Krzysztof Kozlowski
Quoted 13 lines · Rob Herring
Quoted 13 lines
Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml new file +13 -0
+  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
Quoted 8 lines

Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml line 63

Quoted 6 lines
Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml new file +6 -0
+    description:
+      On the MT8196 SoC, a Hardware Voter (HWV) backed by a fixed-function
+      MCU manages clock and power domain control across the AP and other
+      remote processors. By aggregating their votes, it ensures clocks are
+      safely enabled/disabled and power domains are active before register
+      access.

I thought this was going away based on v2 discussion?

Quoted 5 lines

Yes, I asked to drop it and do not include it in v3. There was also discussion clarifying review.

I am really surprised that review meant nothing and code is still the same.

This has been re-submitted as-is, following the outcome of the discussion
here: https://lore.kernel.org/all/[email protected]/

Quoted 8 lines
Quoted 5 lines

We haven't found a viable alternative to the current approach so far, and the thread outlines why other options don’t apply. I'm happy to continue the discussion there if anyone has further suggestions or ideas on how to address this.

And where is any of that resolution/new facts in the commit msg? You must clearly reflect long discussions like that in the commit msg.

On that, I agree. That's a miss.

Quoted 1 line
Quoted 6 lines
Quoted 2 lines

There was no objection from Chen to use clocks or power domains as I requested.

Sorry Krzysztof, but now I really think that you don't understand the basics of MediaTek SoCs and how they're split in hardware - and I'm sorry again, but to me it really looks like that you're not even trying to understand it.

There is no DTS here. No diagrams or some simplified drawings to help me understand.

Quoted 7 lines
Quoted 2 lines

The objection was about DUPLICATING interfaces or nodes.

I don't see that duplication. The interface to each clock controller for each of the hardware subdomains of each controller is scattered all around the (broken by hardware and by concept, if you missed that in the discussion) HW Voter MMIO.

Quoted 6 lines

There are multiple clock controllers in the hardware. Each of those has its own interface to the HWV.

And there are some that require you to write to both its HWV interface and to the clock controller specific MMIO at the same time for the same operation. I explained that in the big discussion that Laura linked.

That's not what property description says. I discussed that part. Your description says - to aggregate votes.

Above you say that control is split between two different MMIO blocks.

Aggregating votes is exactly what we discussed last time and you should not use custom phandle for it.

Maybe it is just the name, so avoid all the confusing "votes" if this is not voting system. If this is a voting system, then don't use custom phandles.

Best regards,
Krzysztof

#18 lore raw

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

Il 04/08/25 13:01, Krzysztof Kozlowski ha scritto:

Quoted 70 lines · AngeloGioacchino Del Regno
Quoted 49 lines

Il 04/08/25 11:16, Krzysztof Kozlowski ha scritto:

Quoted 36 lines · Laura Nao
Quoted 35 lines

Hi,

Quoted 23 lines · Krzysztof Kozlowski
Quoted 13 lines · Rob Herring
Quoted 13 lines
(quoted diff) +13 -0
+  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
Quoted 8 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+    description:
+      On the MT8196 SoC, a Hardware Voter (HWV) backed by a fixed-function
+      MCU manages clock and power domain control across the AP and other
+      remote processors. By aggregating their votes, it ensures clocks are
+      safely enabled/disabled and power domains are active before register
+      access.

I thought this was going away based on v2 discussion?

Quoted 5 lines

Yes, I asked to drop it and do not include it in v3. There was also discussion clarifying review.

I am really surprised that review meant nothing and code is still the same.

This has been re-submitted as-is, following the outcome of the discussion
here: https://lore.kernel.org/all/[email protected]/

Quoted 8 lines
Quoted 5 lines

We haven't found a viable alternative to the current approach so far, and the thread outlines why other options don’t apply. I'm happy to continue the discussion there if anyone has further suggestions or ideas on how to address this.

And where is any of that resolution/new facts in the commit msg? You must clearly reflect long discussions like that in the commit msg.

On that, I agree. That's a miss.

Quoted 1 line
Quoted 6 lines
Quoted 2 lines

There was no objection from Chen to use clocks or power domains as I requested.

Sorry Krzysztof, but now I really think that you don't understand the basics of MediaTek SoCs and how they're split in hardware - and I'm sorry again, but to me it really looks like that you're not even trying to understand it.

There is no DTS here. No diagrams or some simplified drawings to help me understand.

Quoted 10 lines
Quoted 2 lines

The objection was about DUPLICATING interfaces or nodes.

I don't see that duplication. The interface to each clock controller for each of the hardware subdomains of each controller is scattered all around the (broken by hardware and by concept, if you missed that in the discussion) HW Voter MMIO.

There are multiple clock controllers in the hardware. Each of those has its own interface to the HWV.

Quoted 7 lines
Quoted 3 lines

And there are some that require you to write to both its HWV interface and to the clock controller specific MMIO at the same time for the same operation. I explained that in the big discussion that Laura linked.

That's not what property description says. I discussed that part. Your description says - to aggregate votes.

Yes. That is what the datasheets say, but read down there.

Quoted 2 lines

Above you say that control is split between two different MMIO blocks.

Also yes.

Quoted 3 lines

Aggregating votes is exactly what we discussed last time and you should not use custom phandle for it.

We discussed about aggregating votes, yes, in software - this instead is a *broken* hardware that does the aggregation internally and does not require nor want external drivers to do the aggregation.

Quoted 3 lines

Maybe it is just the name, so avoid all the confusing "votes" if this is not voting system. If this is a voting system, then don't use custom phandles.

Being it fundamentally *broken*, this being a voting system is what the hardware initially wanted to be - but effectively, since it requires YOU to:
- Make sure that power supplies are turned on, if not, turn them on by "touching" HW registers (so, without any assistance from the voter MCU), if any;
- Turn on parent clocks manually, if any, before using the "voter mcu" to try to ungate that clock; and
- Enable the "FENC" manually, after the mcu says that the clock was ungated.

in the current state, it is just an hardware managed refcounting system and nothing else, because the MCU seems to be unfinished, hence, again, b r o k e n.

Note that by "manually" I always mean "with direct writes to a clock controller's registerS, and without any automation/assistance from the HWV MCU".

We're using the "hardware-voter" name because this is how MediaTek calls it in the datasheets, and no it doesn't really *deserve* that name for what it is exactly in MT8196 and MT6991.

And mind you - if using the "interconnect" property for this means that we have to add an interconnect driver for it, no, we will not do that, as placing a software vote that votes clocks in a a voter MCU that does exactly what the interconnect driver would do - then requiring virtual/fake clocks - is not a good solution.

So, what should we do then?

Change it to "mediatek,clock-hw-refcounter", and adding a comment to the binding saying that this is called "Hardware Voter (HWV)" in the datasheets?

Or is using the "interconnect" property without any driver in the interconnect API actually legit? - Because to me it doesn't look like being legit (and if it is, it shouldn't be, as I'm sure that everyone would expect an interconnect API driver when encountering an "interconnect" property in DT), and if so, we should just add a new "hw-interconnect" or "interconnect-hw" instead to not create confusion.

Regards,
Angelo

Quoted 3 lines

Best regards,
Krzysztof

#19 lore raw

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

Quoted 9 lines · AngeloGioacchino Del Regno

We discussed about aggregating votes, yes, in software - this instead is a *broken* hardware that does the aggregation internally and does not require nor want external drivers to do the aggregation.

Quoted 3 lines

Maybe it is just the name, so avoid all the confusing "votes" if this is not voting system. If this is a voting system, then don't use custom phandles.

Quoted 7 lines

Being it fundamentally *broken*, this being a voting system is what the hardware initially wanted to be - but effectively, since it requires YOU to:
- Make sure that power supplies are turned on, if not, turn them on by "touching"

    HW registers (so, without any assistance from the voter MCU), if any;

- Turn on parent clocks manually, if any, before using the "voter mcu" to try to ungate that clock; and
- Enable the "FENC" manually, after the mcu says that the clock was ungated.

I understand that "YOU" as Linux driver, when you want to do something (e.g. toggle) a clock?
If so this looks a lot like power domain, although with some differences.

Quoted 10 lines

in the current state, it is just an hardware managed refcounting system and nothing else, because the MCU seems to be unfinished, hence, again, b r o k e n.

Note that by "manually" I always mean "with direct writes to a clock controller's registerS, and without any automation/assistance from the HWV MCU".

We're using the "hardware-voter" name because this is how MediaTek calls it in the datasheets, and no it doesn't really *deserve* that name for what it is exactly in MT8196 and MT6991.

Please capture most/all of this in the property description, so it will be clear that we treat it as some sort of exception and other users of that property would need similar rationale.

I am asking for this because I do not want this to be re-used for any other work which would represent something like real voting for resources. I want it to be clear for whoever looks at it later during new SoC bringup.

If you send the same code as v4, the same commit msg, just like Laura did twice in v2 and v3, I will just keep NAKing via mutt macro because it's a waste of my time.

Quoted 3 lines

And mind you - if using the "interconnect" property for this means that we have to add an interconnect driver for it, no, we will not do that, as placing a software

Existing driver(s) can be as well interconnect providers. Same with power domains.

I do not talk here how you should implement this in the drivers.

Quoted 1 line

vote that votes clocks in a a voter MCU that does exactly what the interconnect

What is a "software vote"? How did you encode it in DT? Via that phandle?

Quoted 1 line

driver would do - then requiring virtual/fake clocks - is not a good solution.

We do not add "software votes" in DT as separate properties, because they are "software". So maybe that's another problem here...

Quoted 10 lines

So, what should we do then?

Change it to "mediatek,clock-hw-refcounter", and adding a comment to the binding saying that this is called "Hardware Voter (HWV)" in the datasheets?

Or is using the "interconnect" property without any driver in the interconnect API actually legit? - Because to me it doesn't look like being legit (and if it is, it shouldn't be, as I'm sure that everyone would expect an interconnect API driver when encountering an "interconnect" property in DT), and if so, we should just add

Why you would not add any interconnect driver for interconnect API? Look, the current phandle allows you to poke in some other MMIO space for the purpose of enabling the clock FOO? So interconnect or power domains or whatever allows you to have existing or new driver to receive xlate() and, when requested resources associated with clock FOO.

Instead of the FOO clock driver poking resources, you do clk_prepare_enable() or pm_domain or icc_enable().

Best regards,
Krzysztof

#20 lore raw

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

Il 04/08/25 15:58, Krzysztof Kozlowski ha scritto:

Quoted 19 lines · AngeloGioacchino Del Regno
Quoted 9 lines

We discussed about aggregating votes, yes, in software - this instead is a *broken* hardware that does the aggregation internally and does not require nor want external drivers to do the aggregation.

Quoted 3 lines

Maybe it is just the name, so avoid all the confusing "votes" if this is not voting system. If this is a voting system, then don't use custom phandles.

Quoted 7 lines

Being it fundamentally *broken*, this being a voting system is what the hardware initially wanted to be - but effectively, since it requires YOU to:
- Make sure that power supplies are turned on, if not, turn them on by "touching"

     HW registers (so, without any assistance from the voter MCU), if any;

- Turn on parent clocks manually, if any, before using the "voter mcu" to try to ungate that clock; and
- Enable the "FENC" manually, after the mcu says that the clock was ungated.

Quoted 2 lines

I understand that "YOU" as Linux driver, when you want to do something (e.g. toggle) a clock?

"you" == Linux driver, yes.

Quoted 2 lines

If so this looks a lot like power domain, although with some differences.

A power domain ungates power to something.

These are clocks, giving a (x) (M)Hz signal to something.

Quoted 11 lines
Quoted 10 lines

in the current state, it is just an hardware managed refcounting system and nothing else, because the MCU seems to be unfinished, hence, again, b r o k e n.

Note that by "manually" I always mean "with direct writes to a clock controller's registerS, and without any automation/assistance from the HWV MCU".

We're using the "hardware-voter" name because this is how MediaTek calls it in the datasheets, and no it doesn't really *deserve* that name for what it is exactly in MT8196 and MT6991.

Quoted 8 lines

Please capture most/all of this in the property description, so it will be clear that we treat it as some sort of exception and other users of that property would need similar rationale.

I am asking for this because I do not want this to be re-used for any other work which would represent something like real voting for resources. I want it to be clear for whoever looks at it later during new SoC bringup.

Okay, now that sounds reasonable, and that sounds like a clear suggestion with a clear action to take.

Perfect.

Laura, please do exactly that.

P.S.: I understand what you're trying to do here, and I agree; preventing stuff like this for things that aren't as broken as this is completely right.

Quoted 5 lines

If you send the same code as v4, the same commit msg, just like Laura did twice in v2 and v3, I will just keep NAKing via mutt macro because it's a waste of my time.

My time isn't infinite, either :-)

Quoted 9 lines
Quoted 3 lines

And mind you - if using the "interconnect" property for this means that we have to add an interconnect driver for it, no, we will not do that, as placing a software

Existing driver(s) can be as well interconnect providers. Same with power domains.

I do not talk here how you should implement this in the drivers.

Quoted 9 lines
Quoted 1 line

vote that votes clocks in a a voter MCU that does exactly what the interconnect

What is a "software vote"? How did you encode it in DT? Via that phandle?

Quoted 1 line

driver would do - then requiring virtual/fake clocks - is not a good solution.

We do not add "software votes" in DT as separate properties, because they are "software". So maybe that's another problem here...

Indeed - the point is, the only way to make this *broken* thing to work with an interconnect provider would be to place a software vote to place a vote in the HW voter, which would be ugly and wrong.

But anyway, a solution was reached. Let's just stop and avoid useless discussions about what X could be if hardware Y wasn't broken; that'd be just a waste of time.

Regards,
Angelo

Quoted 24 lines
Quoted 10 lines

So, what should we do then?

Change it to "mediatek,clock-hw-refcounter", and adding a comment to the binding saying that this is called "Hardware Voter (HWV)" in the datasheets?

Or is using the "interconnect" property without any driver in the interconnect API actually legit? - Because to me it doesn't look like being legit (and if it is, it shouldn't be, as I'm sure that everyone would expect an interconnect API driver when encountering an "interconnect" property in DT), and if so, we should just add

Why you would not add any interconnect driver for interconnect API? Look, the current phandle allows you to poke in some other MMIO space for the purpose of enabling the clock FOO? So interconnect or power domains or whatever allows you to have existing or new driver to receive xlate() and, when requested resources associated with clock FOO.

Instead of the FOO clock driver poking resources, you do clk_prepare_enable() or pm_domain or icc_enable().

Best regards,
Krzysztof

#21 lore raw

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

Quoted 23 lines · AngeloGioacchino Del Regno

Il 04/08/25 15:58, Krzysztof Kozlowski ha scritto:

Quoted 19 lines · AngeloGioacchino Del Regno
Quoted 9 lines

We discussed about aggregating votes, yes, in software - this instead is a *broken* hardware that does the aggregation internally and does not require nor want external drivers to do the aggregation.

Quoted 3 lines

Maybe it is just the name, so avoid all the confusing "votes" if this is not voting system. If this is a voting system, then don't use custom phandles.

Quoted 7 lines

Being it fundamentally *broken*, this being a voting system is what the hardware initially wanted to be - but effectively, since it requires YOU to:
- Make sure that power supplies are turned on, if not, turn them on by "touching"

     HW registers (so, without any assistance from the voter MCU), if any;

- Turn on parent clocks manually, if any, before using the "voter mcu" to try to ungate that clock; and
- Enable the "FENC" manually, after the mcu says that the clock was ungated.

Quoted 2 lines

I understand that "YOU" as Linux driver, when you want to do something (e.g. toggle) a clock?

Quoted 6 lines

"you" == Linux driver, yes.

Quoted 2 lines

If so this looks a lot like power domain, although with some differences.

A power domain ungates power to something.

Does more, it is not a simple supply.

Quoted 2 lines

These are clocks, giving a (x) (M)Hz signal to something.

Your earlier message about "YOU" said:

" - Make sure that power supplies are turned on, if not, turn them on
by "touching"
HW registers (so, without any assistance from the voter MCU), if any;"

so not a simple clocks stuff.

Best regards,
Krzysztof

#22 lore raw

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

Il 04/08/25 16:21, Krzysztof Kozlowski ha scritto:

Quoted 24 lines · AngeloGioacchino Del Regno
Quoted 23 lines

Il 04/08/25 15:58, Krzysztof Kozlowski ha scritto:

Quoted 21 lines · AngeloGioacchino Del Regno
Quoted 9 lines

We discussed about aggregating votes, yes, in software - this instead is a *broken* hardware that does the aggregation internally and does not require nor want external drivers to do the aggregation.

Quoted 3 lines

Maybe it is just the name, so avoid all the confusing "votes" if this is not voting system. If this is a voting system, then don't use custom phandles.

Quoted 7 lines

Being it fundamentally *broken*, this being a voting system is what the hardware initially wanted to be - but effectively, since it requires YOU to:
- Make sure that power supplies are turned on, if not, turn them on by "touching" HW registers (so, without any assistance from the voter MCU), if any;
- Turn on parent clocks manually, if any, before using the "voter mcu" to try to ungate that clock; and
- Enable the "FENC" manually, after the mcu says that the clock was ungated.

I understand that "YOU" as Linux driver, when you want to do something (e.g. toggle) a clock?

Quoted 9 lines
Quoted 6 lines

"you" == Linux driver, yes.

Quoted 2 lines

If so this looks a lot like power domain, although with some differences.

A power domain ungates power to something.

Does more, it is not a simple supply.

Yes, does more, but still manages power, and not clocks.

Quoted 10 lines
Quoted 2 lines

These are clocks, giving a (x) (M)Hz signal to something.

Your earlier message about "YOU" said:

" - Make sure that power supplies are turned on, if not, turn them on
by "touching"
HW registers (so, without any assistance from the voter MCU), if any;"

so not a simple clocks stuff.

That's a characteristic of MediaTek's clock controllers: each hardware macroblock needs to be powered in order to be able to enable clocks.

This is nothing new in MT8196/MT6991, it's how MediaTek SoCs have always been split by hardware, and it's like that since ages.

Some other SoCs have the clock controllers always powered on - MediaTek doesn't.

#23 lore raw

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

In reply to Krzysztof Kozlowski
Quoted 11 lines · Krzysztof Kozlowski
Quoted 10 lines

So, what should we do then?

Change it to "mediatek,clock-hw-refcounter", and adding a comment to the binding saying that this is called "Hardware Voter (HWV)" in the datasheets?

Or is using the "interconnect" property without any driver in the interconnect API actually legit? - Because to me it doesn't look like being legit (and if it is, it shouldn't be, as I'm sure that everyone would expect an interconnect API driver when encountering an "interconnect" property in DT), and if so, we should just add

Quoted 5 lines

Why you would not add any interconnect driver for interconnect API? Look, the current phandle allows you to poke in some other MMIO space for the purpose of enabling the clock FOO? So interconnect or power domains or whatever allows you to have existing or new driver to receive xlate() and, when requested resources associated with clock FOO.

Something got here cut. Last sentence is supposed to be:

"So interconnect or power
domains or whatever allows you to have existing or new driver to receive xlate() and, when requested, toggle the resources associated with clock FOO."

Quoted 3 lines

Instead of the FOO clock driver poking resources, you do clk_prepare_enable() or pm_domain or icc_enable().

I looked now at the driver and see your clock drivers poking via regmap to other MMIO. That's exactly usecase of syscon and exactly the pattern *we are usually discouraging*. It's limited, non-scalable and vendor-driven.

If this was a power domain provider then:
1. Your clock drivers would only do runtime PM.
2. Your MCU would be the power domain controller doing whatever is necessary - toggling these set/clr bits - when given clock is enabled. And it really looks like what you described...

Best regards,
Krzysztof

#24 lore raw

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

Il 04/08/25 16:19, Krzysztof Kozlowski ha scritto:

Quoted 26 lines · Krzysztof Kozlowski
Quoted 11 lines
Quoted 10 lines

So, what should we do then?

Change it to "mediatek,clock-hw-refcounter", and adding a comment to the binding saying that this is called "Hardware Voter (HWV)" in the datasheets?

Or is using the "interconnect" property without any driver in the interconnect API actually legit? - Because to me it doesn't look like being legit (and if it is, it shouldn't be, as I'm sure that everyone would expect an interconnect API driver when encountering an "interconnect" property in DT), and if so, we should just add

Quoted 5 lines

Why you would not add any interconnect driver for interconnect API? Look, the current phandle allows you to poke in some other MMIO space for the purpose of enabling the clock FOO? So interconnect or power domains or whatever allows you to have existing or new driver to receive xlate() and, when requested resources associated with clock FOO.

Something got here cut. Last sentence is supposed to be:

"So interconnect or power
domains or whatever allows you to have existing or new driver to receive xlate() and, when requested, toggle the resources associated with clock FOO."

Quoted 1 line
Quoted 7 lines
Quoted 2 lines

Instead of the FOO clock driver poking resources, you do clk_prepare_enable() or pm_domain or icc_enable().

I looked now at the driver and see your clock drivers poking via regmap to other MMIO. That's exactly usecase of syscon and exactly the pattern *we are usually discouraging*. It's limited, non-scalable and vendor-driven.

If the HWV wasn't BROKEN, I'd be the first one to go for generic stuff, but since it is what it is, adding bloat to generic, non vendor-driven APIs would be bad.

Quoted 2 lines

If this was a power domain provider then:
1. Your clock drivers would only do runtime PM.

The clock drivers would have to get a list of power domain that is *equal to* (in their amount) the list of clocks.
But then those are not power domains, as those registers in the MCU are ONLY ungating a clock and nothing else in the current state of the hardware.

Quoted 2 lines

2. Your MCU would be the power domain controller doing whatever is necessary - toggling these set/clr bits - when given clock is enabled.

That MCU does support power domain voting (for two power domains in the main PD Controller, and for all power domains in the multimedia PD controller), and this is something completely separated from the *clock* controllers.

Just to make the picture complete for you: the power domains that this MCU can manage are not in any way related to the clocks that it can manage. At all.

Quoted 5 lines

And it really looks like what you described...

Best regards,
Krzysztof

#25 lore raw

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

Quoted 50 lines · AngeloGioacchino Del Regno

Il 04/08/25 16:19, Krzysztof Kozlowski ha scritto:

Quoted 26 lines · Krzysztof Kozlowski
Quoted 11 lines
Quoted 10 lines

So, what should we do then?

Change it to "mediatek,clock-hw-refcounter", and adding a comment to the binding saying that this is called "Hardware Voter (HWV)" in the datasheets?

Or is using the "interconnect" property without any driver in the interconnect API actually legit? - Because to me it doesn't look like being legit (and if it is, it shouldn't be, as I'm sure that everyone would expect an interconnect API driver when encountering an "interconnect" property in DT), and if so, we should just add

Quoted 5 lines

Why you would not add any interconnect driver for interconnect API? Look, the current phandle allows you to poke in some other MMIO space for the purpose of enabling the clock FOO? So interconnect or power domains or whatever allows you to have existing or new driver to receive xlate() and, when requested resources associated with clock FOO.

Something got here cut. Last sentence is supposed to be:

"So interconnect or power
domains or whatever allows you to have existing or new driver to receive xlate() and, when requested, toggle the resources associated with clock FOO."

Quoted 1 line
Quoted 7 lines
Quoted 2 lines

Instead of the FOO clock driver poking resources, you do clk_prepare_enable() or pm_domain or icc_enable().

I looked now at the driver and see your clock drivers poking via regmap to other MMIO. That's exactly usecase of syscon and exactly the pattern *we are usually discouraging*. It's limited, non-scalable and vendor-driven.

If the HWV wasn't BROKEN, I'd be the first one to go for generic stuff, but since it is what it is, adding bloat to generic, non vendor-driven APIs would be bad.

Quoted 2 lines

If this was a power domain provider then:
1. Your clock drivers would only do runtime PM.

The clock drivers would have to get a list of power domain that is *equal to* (in their amount) the list of clocks.
But then those are not power domains, as those registers in the MCU are ONLY ungating a clock and nothing else in the current state of the hardware.

Quoted 2 lines

2. Your MCU would be the power domain controller doing whatever is necessary - toggling these set/clr bits - when given clock is enabled.

Quoted 6 lines

That MCU does support power domain voting (for two power domains in the main PD Controller, and for all power domains in the multimedia PD controller), and this is something completely separated from the *clock* controllers.

Just to make the picture complete for you: the power domains that this MCU can manage are not in any way related to the clocks that it can manage. At all.

OK, thanks for explanations. Please rephrase commit msg and property description in v4. I am fine in using "hardware voter" terminology in some places, so it will match datasheet, but I want to make it clear that it is not voting for resources how we usually understand it. It's just syscon stuff, poking in other system-like device registers because hardware is like that.

Best regards,
Krzysztof

#26 lore raw

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

Il 04/08/25 16:33, Krzysztof Kozlowski ha scritto:

Quoted 59 lines · AngeloGioacchino Del Regno
Quoted 50 lines

Il 04/08/25 16:19, Krzysztof Kozlowski ha scritto:

Quoted 26 lines · Krzysztof Kozlowski
Quoted 11 lines
Quoted 10 lines

So, what should we do then?

Change it to "mediatek,clock-hw-refcounter", and adding a comment to the binding saying that this is called "Hardware Voter (HWV)" in the datasheets?

Or is using the "interconnect" property without any driver in the interconnect API actually legit? - Because to me it doesn't look like being legit (and if it is, it shouldn't be, as I'm sure that everyone would expect an interconnect API driver when encountering an "interconnect" property in DT), and if so, we should just add

Quoted 5 lines

Why you would not add any interconnect driver for interconnect API? Look, the current phandle allows you to poke in some other MMIO space for the purpose of enabling the clock FOO? So interconnect or power domains or whatever allows you to have existing or new driver to receive xlate() and, when requested resources associated with clock FOO.

Something got here cut. Last sentence is supposed to be:

"So interconnect or power
domains or whatever allows you to have existing or new driver to receive xlate() and, when requested, toggle the resources associated with clock FOO."

Quoted 1 line
Quoted 7 lines
Quoted 2 lines

Instead of the FOO clock driver poking resources, you do clk_prepare_enable() or pm_domain or icc_enable().

I looked now at the driver and see your clock drivers poking via regmap to other MMIO. That's exactly usecase of syscon and exactly the pattern *we are usually discouraging*. It's limited, non-scalable and vendor-driven.

If the HWV wasn't BROKEN, I'd be the first one to go for generic stuff, but since it is what it is, adding bloat to generic, non vendor-driven APIs would be bad.

Quoted 2 lines

If this was a power domain provider then:
1. Your clock drivers would only do runtime PM.

The clock drivers would have to get a list of power domain that is *equal to* (in their amount) the list of clocks.
But then those are not power domains, as those registers in the MCU are ONLY ungating a clock and nothing else in the current state of the hardware.

Quoted 2 lines

2. Your MCU would be the power domain controller doing whatever is necessary - toggling these set/clr bits - when given clock is enabled.

Quoted 6 lines

That MCU does support power domain voting (for two power domains in the main PD Controller, and for all power domains in the multimedia PD controller), and this is something completely separated from the *clock* controllers.

Just to make the picture complete for you: the power domains that this MCU can manage are not in any way related to the clocks that it can manage. At all.

Quoted 7 lines

OK, thanks for explanations. Please rephrase commit msg and property description in v4. I am fine in using "hardware voter" terminology in some places, so it will match datasheet, but I want to make it clear that it is not voting for resources how we usually understand it. It's just syscon stuff, poking in other system-like device registers because hardware is like that.

I'm happy that we finally reached a conclusion that works for both of us, and I am sorry that all this went on for weeks with (very) long discussions.

Thanks for that.

Regards,
Angelo

Quoted 3 lines

Best regards,
Krzysztof

#27 lore raw

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

In reply to Laura Nao

Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml line 63

Quoted 9 lines · Laura Nao
Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml new file +9 -0
+
+  mediatek,hardware-voter:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      On the MT8196 SoC, a Hardware Voter (HWV) backed by a fixed-function
+      MCU manages clock and power domain control across the AP and other
+      remote processors. By aggregating their votes, it ensures clocks are
+      safely enabled/disabled and power domains are active before register
+      access.

No improvements, I already commented on this.

I also said:

"I already commented on this, so don't send v3 with the same."

NAK

Best regards,
Krzysztof

author
#28 lore raw

PATCH v3 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 | 203 +++++++++++++++++++
 3 files changed, 212 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-apmixedsys.c
drivers/clk/mediatek/Kconfig +8 -0
index ff8a87112969..c55a7c8bdcc5 100644
@@ -1060,6 +1060,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 73004e318702..b1773d2bcb3d 100644
@@ -160,6 +160,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 +203 -0

203 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#29 lore raw

PATCH v3 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 | 984 +++++++++++++++++++++
 2 files changed, 985 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-topckgen.c
drivers/clk/mediatek/Makefile +1 -1
index b1773d2bcb3d..bc0e86e20074 100644
@@ -160,7 +160,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 +984 -0

984 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#30 lore raw

PATCH v3 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 | 567 ++++++++++++++++++++
 2 files changed, 569 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-topckgen2.c
drivers/clk/mediatek/Makefile +2 -1
index bc0e86e20074..0688d7bf4979 100644
@@ -160,7 +160,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 +567 -0

567 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#31 lore raw

PATCH v3 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 | 726 +++++++++++++++++++++
 2 files changed, 727 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-vlpckgen.c
drivers/clk/mediatek/Makefile +1 -1
index 0688d7bf4979..24683dd51783 100644
@@ -161,7 +161,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 +726 -0

726 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#32 lore raw

PATCH v3 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 | 144 ++++++++++++++++++++++
 2 files changed, 146 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-peri_ao.c
drivers/clk/mediatek/Makefile +2 -1
index 24683dd51783..fc941b5baf04 100644
@@ -161,7 +161,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 +144 -0

144 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#33 lore raw

PATCH v3 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 | 109 +++++++++++++++++++++++
 3 files changed, 117 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-ufs_ao.c
drivers/clk/mediatek/Kconfig +7 -0
index c55a7c8bdcc5..848624792a23 100644
@@ -1068,6 +1068,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 fc941b5baf04..ee6a1bb5ce38 100644
@@ -163,6 +163,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 +109 -0

109 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#34 lore raw

PATCH v3 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 848624792a23..cd12e7ff3e12 100644
@@ -1068,6 +1068,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 ee6a1bb5ce38..21e768f67283 100644
@@ -163,6 +163,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
author
#35 lore raw

PATCH v3 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    | 117 ++++++++++++++++++
 3 files changed, 125 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-imp_iic_wrap.c
drivers/clk/mediatek/Kconfig +7 -0
index cd12e7ff3e12..09aeffc9887c 100644
@@ -1068,6 +1068,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 21e768f67283..d2d731213af3 100644
@@ -163,6 +163,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 +117 -0

117 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#36 lore raw

PATCH v3 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 | 166 ++++++++++++++++++++++++++
 3 files changed, 174 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-mcu.c
drivers/clk/mediatek/Kconfig +7 -0
index 09aeffc9887c..15d17e81865e 100644
@@ -1075,6 +1075,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 d2d731213af3..3353ac67a2f1 100644
@@ -164,6 +164,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 +166 -0

166 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#37 lore raw

PATCH v3 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 | 187 +++++++++++++++++++++++
 3 files changed, 195 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-mdpsys.c
drivers/clk/mediatek/Kconfig +7 -0
index 15d17e81865e..8ae5a0546202 100644
@@ -1082,6 +1082,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 m
+	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 3353ac67a2f1..5c327a7239bc 100644
@@ -165,6 +165,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 +187 -0

187 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#38 lore raw

PATCH v3 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 | 149 ++++++++++++++++++++++++++
 3 files changed, 157 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-mfg.c
drivers/clk/mediatek/Kconfig +7 -0
index 8ae5a0546202..fd3514325b45 100644
@@ -1089,6 +1089,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 5c327a7239bc..8a152c6e475f 100644
@@ -166,6 +166,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 +149 -0

149 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#39 lore raw

PATCH v3 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 | 169 ++++++++++++++++++++++++
 3 files changed, 177 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-disp0.c
drivers/clk/mediatek/Kconfig +7 -0
index fd3514325b45..81c2df501844 100644
@@ -1096,6 +1096,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 8a152c6e475f..badcde62c3d1 100644
@@ -167,6 +167,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 +169 -0

169 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#40 lore raw

PATCH v3 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 badcde62c3d1..195a473efb6c 100644
@@ -167,7 +167,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
author
#41 lore raw

PATCH v3 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 | 79 ++++++++++++++++++++++
 2 files changed, 80 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-vdisp_ao.c
drivers/clk/mediatek/Makefile +1 -1
index 195a473efb6c..4318b6dd4085 100644
@@ -167,7 +167,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 +79 -0

79 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#42 lore raw

PATCH v3 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 4318b6dd4085..25b03519ee81 100644
@@ -167,7 +167,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
author
#43 lore raw

PATCH v3 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 | 153 +++++++++++++++++++++++++
 2 files changed, 154 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-ovl1.c
drivers/clk/mediatek/Makefile +1 -1
index 25b03519ee81..7e8d7d5fce68 100644
@@ -168,7 +168,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 +153 -0

153 lines not on this page · raw message

Signature · 1 line
2.39.5
author
#44 lore raw

PATCH v3 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 81c2df501844..4c7f6715ed63 100644
@@ -1117,6 +1117,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 7e8d7d5fce68..54e895b73ecf 100644
@@ -171,6 +171,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
#45 lore raw

PATCH v3 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 | 235 +++++++++++++++++++++++++
 3 files changed, 243 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8196-venc.c
drivers/clk/mediatek/Kconfig +7 -0
index 4c7f6715ed63..53472d7de18c 100644
@@ -1124,6 +1124,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 54e895b73ecf..4daba371342f 100644
@@ -172,6 +172,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 +235 -0

235 lines not on this page · raw message

Signature · 1 line
2.39.5