Add support for MT8196 clock controllers
Subsystems (6)
v5 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 v5:
- Used double negation in clk-mux/pll to return strict true/false values
- Dropped fenc_mask from clk-pll.c / clk-pll.h
- Moved MTK_WAIT_FENC_DONE_US definition to clk-mux.c
- Switched to dev_err_probe() / dev_err_ptr_probe() where applicable
- Added blank lines for separation when including binding headers
- Added struct mtk_gate * pointer in struct mtk_clk_gate, removed duplication in mtk_clk_register_gate()
- Dropped CLK_OPS_PARENT_ENABLE from gate macros when defining gates with different parents
- Used default COMMON_CLK_MT8196 for config COMMON_CLK_MT8196_MDPSYS in Kconfig
- Added vlp_clk26m definition in vlpckgen
- Renamed top_divs -> vlp_divs in vlpckgen
- Moved clk-mtk.h inclusion in clk-mux.c to the commit “clk: mediatek:
clk-mux: Add ops for mux gates with HW voter and FENC”
- Renamed adsppll_ck -> adsppll in topckgen
- Fixed checkpatch warning in clk-mt8196-mdpsys.c (line too long)
- Dropped R-b tags on patches 6 (refactoring), 13 (vlp_clk26m defined, reparented audio clocks), 14, 15, 16, 19, 22 (dropped CLK_OPS_PARENT_ENABLE, changing the behavior of the affected clocks).
Link to v4: https://lore.kernel.org/all/[email protected]/
Laura Nao (27):
clk: mediatek: clk-pll: Add set/clr regs for shared PLL enable control
clk: mediatek: clk-pll: Add ops for PLLs using set/clr regs and FENC
clk: mediatek: clk-mux: Add ops for mux gates with set/clr/upd and
FENC
clk: mediatek: clk-mtk: Introduce mtk_clk_get_hwv_regmap()
clk: mediatek: clk-mux: Add ops for mux gates with HW voter and FENC
clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use
mtk_gate struct
clk: mediatek: clk-gate: Add ops for gates with HW voter
clk: mediatek: clk-mtk: Add MUX_DIV_GATE macro
dt-bindings: clock: mediatek: Describe MT8196 clock controllers
clk: mediatek: Add MT8196 apmixedsys clock support
clk: mediatek: Add MT8196 topckgen clock support
clk: mediatek: Add MT8196 topckgen2 clock support
clk: mediatek: Add MT8196 vlpckgen clock support
clk: mediatek: Add MT8196 peripheral clock support
clk: mediatek: Add MT8196 ufssys clock support
clk: mediatek: Add MT8196 pextpsys clock support
clk: mediatek: Add MT8196 I2C clock support
clk: mediatek: Add MT8196 mcu clock support
clk: mediatek: Add MT8196 mdpsys clock support
clk: mediatek: Add MT8196 mfg clock support
clk: mediatek: Add MT8196 disp0 clock support
clk: mediatek: Add MT8196 disp1 clock support
clk: mediatek: Add MT8196 disp-ao clock support
clk: mediatek: Add MT8196 ovl0 clock support
clk: mediatek: Add MT8196 ovl1 clock support
clk: mediatek: Add MT8196 vdecsys clock support
clk: mediatek: Add MT8196 vencsys clock support
.../bindings/clock/mediatek,mt8196-clock.yaml | 112 ++ .../clock/mediatek,mt8196-sys-clock.yaml | 107 ++ drivers/clk/mediatek/Kconfig | 71 ++ drivers/clk/mediatek/Makefile | 13 + drivers/clk/mediatek/clk-gate.c | 119 ++- drivers/clk/mediatek/clk-gate.h | 3 + drivers/clk/mediatek/clk-mt8196-apmixedsys.c | 204 ++++ drivers/clk/mediatek/clk-mt8196-disp0.c | 170 +++ drivers/clk/mediatek/clk-mt8196-disp1.c | 170 +++ .../clk/mediatek/clk-mt8196-imp_iic_wrap.c | 118 +++ drivers/clk/mediatek/clk-mt8196-mcu.c | 167 +++ drivers/clk/mediatek/clk-mt8196-mdpsys.c | 186 ++++ drivers/clk/mediatek/clk-mt8196-mfg.c | 150 +++ drivers/clk/mediatek/clk-mt8196-ovl0.c | 154 +++ drivers/clk/mediatek/clk-mt8196-ovl1.c | 154 +++ drivers/clk/mediatek/clk-mt8196-peri_ao.c | 142 +++ drivers/clk/mediatek/clk-mt8196-pextp.c | 131 +++ drivers/clk/mediatek/clk-mt8196-topckgen.c | 985 ++++++++++++++++++ drivers/clk/mediatek/clk-mt8196-topckgen2.c | 568 ++++++++++ drivers/clk/mediatek/clk-mt8196-ufs_ao.c | 108 ++ drivers/clk/mediatek/clk-mt8196-vdec.c | 253 +++++ drivers/clk/mediatek/clk-mt8196-vdisp_ao.c | 80 ++ drivers/clk/mediatek/clk-mt8196-venc.c | 236 +++++ drivers/clk/mediatek/clk-mt8196-vlpckgen.c | 729 +++++++++++++ drivers/clk/mediatek/clk-mtk.c | 16 + drivers/clk/mediatek/clk-mtk.h | 22 + drivers/clk/mediatek/clk-mux.c | 122 ++- drivers/clk/mediatek/clk-mux.h | 87 ++ drivers/clk/mediatek/clk-pll.c | 45 +- drivers/clk/mediatek/clk-pll.h | 8 + .../dt-bindings/clock/mediatek,mt8196-clock.h | 803 ++++++++++++++ .../reset/mediatek,mt8196-resets.h | 26 + 32 files changed, 6224 insertions(+), 35 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt8196-sys-clock.yaml create mode 100644 drivers/clk/mediatek/clk-mt8196-apmixedsys.c create mode 100644 drivers/clk/mediatek/clk-mt8196-disp0.c create mode 100644 drivers/clk/mediatek/clk-mt8196-disp1.c create mode 100644 drivers/clk/mediatek/clk-mt8196-imp_iic_wrap.c create mode 100644 drivers/clk/mediatek/clk-mt8196-mcu.c create mode 100644 drivers/clk/mediatek/clk-mt8196-mdpsys.c create mode 100644 drivers/clk/mediatek/clk-mt8196-mfg.c create mode 100644 drivers/clk/mediatek/clk-mt8196-ovl0.c create mode 100644 drivers/clk/mediatek/clk-mt8196-ovl1.c create mode 100644 drivers/clk/mediatek/clk-mt8196-peri_ao.c create mode 100644 drivers/clk/mediatek/clk-mt8196-pextp.c create mode 100644 drivers/clk/mediatek/clk-mt8196-topckgen.c create mode 100644 drivers/clk/mediatek/clk-mt8196-topckgen2.c create mode 100644 drivers/clk/mediatek/clk-mt8196-ufs_ao.c create mode 100644 drivers/clk/mediatek/clk-mt8196-vdec.c create mode 100644 drivers/clk/mediatek/clk-mt8196-vdisp_ao.c create mode 100644 drivers/clk/mediatek/clk-mt8196-venc.c create mode 100644 drivers/clk/mediatek/clk-mt8196-vlpckgen.c create mode 100644 include/dt-bindings/clock/mediatek,mt8196-clock.h create mode 100644 include/dt-bindings/reset/mediatek,mt8196-resets.h
Signature · 1 line
2.39.5
PATCH v5 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
@@ -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
@@ -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
PATCH v5 2/27 clk: mediatek: clk-pll: Add ops for PLLs using set/clr regs and FENC
In reply to Laura NaoMT8196 uses a combination of set/clr registers to control the PLL enable state, along with a FENC bit to check the preparation status. Add new set of PLL clock operations with support for set/clr enable and FENC status logic.
--- drivers/clk/mediatek/clk-pll.c | 41 +++++++++++++++++++++++++++++++++- drivers/clk/mediatek/clk-pll.h | 4 ++++ 2 files changed, 44 insertions(+), 1 deletion(-)
drivers/clk/mediatek/clk-pll.c +40 -1
@@ -37,6 +37,13 @@ int mtk_pll_is_prepared(struct clk_hw *hw)return (readl (pll->en_addr) &BIT (pll->data->pll_en_bit)) !=0 ; } +static int mtk_pll_fenc_is_prepared (struct clk_hw *hw) +{ +struct mtk_clk_pll *pll =to_mtk_clk_pll (hw); + +return !!(readl (pll->fenc_addr) &BIT (pll->data->fenc_sta_bit)); +} +static unsigned long __mtk_pll_recalc_rate (struct mtk_clk_pll *pll,u32 fin,u32 pcw,int postdiv) {
@@ -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,8 @@ struct clk_hw *mtk_clk_register_pll_ops(struct mtk_clk_pll *pll, pll->hw.init = &init; pll->data = data; + pll->fenc_addr = base + data->fenc_sta_ofs; + init.name = data->name; init.flags = (data->flags &PLL_AO ) ?CLK_IS_CRITICAL :0 ; init.ops = pll_ops;
@@ -337,12 +375,13 @@ struct clk_hw *mtk_clk_register_pll(const struct mtk_pll_data *data, {struct mtk_clk_pll *pll;struct clk_hw *hw; +const struct clk_ops *pll_ops = data->ops ? data->ops : &mtk_pll_ops; pll =kzalloc (sizeof (*pll),GFP_KERNEL );if (!pll)return ERR_PTR (-ENOMEM ); - hw =mtk_clk_register_pll_ops (pll, data, base, &mtk_pll_ops); + hw =mtk_clk_register_pll_ops (pll, data, base, pll_ops);if (IS_ERR (hw))kfree (pll);
drivers/clk/mediatek/clk-pll.h +4 -0
@@ -29,6 +29,7 @@ struct mtk_pll_data {u32 reg;u32 pwr_reg;u32 en_mask; +u32 fenc_sta_ofs;u32 pd_reg;u32 tuner_reg;u32 tuner_en_reg;
@@ -51,6 +52,7 @@ struct mtk_pll_data {u32 en_clr_reg;u8 pll_en_bit;/* Assume 0, indicates BIT(0) by default */ u8 pcw_chg_bit; +u8 fenc_sta_bit; };/*
@@ -72,6 +74,7 @@ struct mtk_clk_pll {void __iomem *en_addr;void __iomem *en_set_addr;void __iomem *en_clr_addr; +void __iomem *fenc_addr;const struct mtk_pll_data *data; };
@@ -82,6 +85,7 @@ void mtk_clk_unregister_plls(const struct mtk_pll_data *plls, int num_plls, struct clk_hw_onecell_data *clk_data);extern const struct clk_ops mtk_pll_ops; +extern const struct clk_ops mtk_pll_fenc_clr_set_ops;static inline struct mtk_clk_pll *to_mtk_clk_pll (struct clk_hw *hw) {
Signature · 1 line
2.39.5
PATCH v5 3/27 clk: mediatek: clk-mux: Add ops for mux gates with set/clr/upd and FENC
In reply to Laura NaoMT8196 uses set/clr/upd registers for mux gate enable/disable control, along with a FENC bit to check the status. Add new set of mux gate clock operations with support for set/clr/upd and FENC status logic.
--- drivers/clk/mediatek/clk-mux.c | 49 ++++++++++++++++++++++++++++++++++ drivers/clk/mediatek/clk-mux.h | 45 +++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+)
drivers/clk/mediatek/clk-mux.c +49 -0
@@ -17,6 +17,8 @@#include "clk-mux.h" +#define MTK_WAIT_FENC_DONE_US 30 +struct mtk_clk_mux {struct clk_hw hw;struct regmap *regmap;
@@ -30,6 +32,33 @@ static inline struct mtk_clk_mux *to_mtk_clk_mux(struct clk_hw *hw) return container_of(hw, struct mtk_clk_mux, hw); } +static int mtk_clk_mux_fenc_enable_setclr (struct clk_hw *hw) +{ +struct mtk_clk_mux *mux =to_mtk_clk_mux (hw); +unsigned long flags; +u32 val; +int ret; + +if (mux->lock) +spin_lock_irqsave (mux->lock, flags); +else +__acquire (mux->lock); + +regmap_write (mux->regmap, mux->data->clr_ofs, +BIT (mux->data->gate_shift)); + + ret =regmap_read_poll_timeout_atomic (mux->regmap, mux->data->fenc_sta_mon_ofs, + val, val &BIT (mux->data->fenc_shift),1 , +MTK_WAIT_FENC_DONE_US ); + +if (mux->lock) +spin_unlock_irqrestore (mux->lock, flags); +else +__release (mux->lock); + +return ret; +} +static int mtk_clk_mux_enable_setclr (struct clk_hw *hw) {struct mtk_clk_mux *mux =to_mtk_clk_mux (hw);
@@ -70,6 +99,16 @@ static void mtk_clk_mux_disable_setclr(struct clk_hw *hw) BIT(mux->data->gate_shift)); } +static int mtk_clk_mux_fenc_is_enabled (struct clk_hw *hw) +{ +struct mtk_clk_mux *mux =to_mtk_clk_mux (hw); +u32 val; + +regmap_read (mux->regmap, mux->data->fenc_sta_mon_ofs, &val); + +return !!(val &BIT (mux->data->fenc_shift)); +} +static int mtk_clk_mux_is_enabled (struct clk_hw *hw) {struct mtk_clk_mux *mux =to_mtk_clk_mux (hw);
@@ -168,6 +207,16 @@ const struct clk_ops mtk_mux_gate_clr_set_upd_ops = { };EXPORT_SYMBOL_GPL (mtk_mux_gate_clr_set_upd_ops); +const struct clk_ops mtk_mux_gate_fenc_clr_set_upd_ops = { + .enable = mtk_clk_mux_fenc_enable_setclr, + .disable = mtk_clk_mux_disable_setclr, + .is_enabled = mtk_clk_mux_fenc_is_enabled, + .get_parent = mtk_clk_mux_get_parent, + .set_parent = mtk_clk_mux_set_parent_setclr_lock, + .determine_rate = mtk_clk_mux_determine_rate, +}; +EXPORT_SYMBOL_GPL (mtk_mux_gate_fenc_clr_set_upd_ops); + static struct clk_hw *mtk_clk_register_mux(struct device *dev, const struct mtk_mux *mux, struct regmap *regmap,
drivers/clk/mediatek/clk-mux.h +45 -0
68 lines not on this page · raw message
Signature · 1 line
2.39.5
Re: [PATCH v5 03/27] clk: mediatek: clk-mux: Add ops for mux gates with set/clr/upd and FENC
Quoted 8 lines · 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.
Reviewed-by Nícolas F. R. A. Prado <[email protected]>Reviewed-by AngeloGioacchino Del Regno <[email protected]>Signed-off-by Laura Nao <[email protected]>
PATCH v5 4/27 clk: mediatek: clk-mtk: Introduce mtk_clk_get_hwv_regmap()
In reply to Laura NaoOn 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
@@ -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
@@ -245,5 +245,6 @@ int mtk_clk_pdev_probe(struct platform_device *pdev);void mtk_clk_pdev_remove (struct platform_device *pdev);int mtk_clk_simple_probe (struct platform_device *pdev);void mtk_clk_simple_remove (struct platform_device *pdev); +struct regmap *mtk_clk_get_hwv_regmap (struct device_node *node);#endif /* __DRV_CLK_MTK_H */
Signature · 1 line
2.39.5
PATCH v5 5/27 clk: mediatek: clk-mux: Add ops for mux gates with HW voter and FENC
In reply to Laura NaoMT8196 use a HW voter for mux gate enable/disable control, along with a FENC status bit to check the status. Voting is performed using set/clr/upd registers, with a status bit used to verify the vote state. Add new set of mux gate clock operations with support for voting via set/clr/upd regs and FENC status logic.
--- drivers/clk/mediatek/clk-mtk.h | 2 + drivers/clk/mediatek/clk-mux.c | 73 +++++++++++++++++++++++++++++++++- drivers/clk/mediatek/clk-mux.h | 42 +++++++++++++++++++ 3 files changed, 116 insertions(+), 1 deletion(-)
drivers/clk/mediatek/clk-mtk.h +2 -0
@@ -20,6 +20,8 @@#define MHZ (1000 * 1000) +#define MTK_WAIT_HWV_DONE_US 30 +struct platform_device ;/*
drivers/clk/mediatek/clk-mux.c +72 -1
138 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
Re: [PATCH v5 05/27] clk: mediatek: clk-mux: Add ops for mux gates with HW voter and FENC
Quoted 136 lines · 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.
Reviewed-by Nícolas F. R. A. Prado <[email protected]>Reviewed-by AngeloGioacchino Del Regno <[email protected]>Signed-off-by Laura Nao <[email protected]>--- drivers/clk/mediatek/clk-mtk.h | 2 + drivers/clk/mediatek/clk-mux.c | 73 +++++++++++++++++++++++++++++++++- drivers/clk/mediatek/clk-mux.h | 42 +++++++++++++++++++ 3 files changed, 116 insertions(+), 1 deletion(-)drivers/clk/mediatek/clk-mtk.h +2
-0@@ -20,6 +20,8 @@#define MHZ (1000 * 1000) +#define MTK_WAIT_HWV_DONE_US 30 +struct platform_device ;/* drivers/clk/mediatek/clk-mux.c +57
-0@@ -8,6 +8,7 @@#include <linux/clk-provider.h> #include <linux/compiler_types.h> #include <linux/container_of.h> +#include <linux/dev_printk.h> #include <linux/err.h> #include <linux/mfd/syscon.h> #include <linux/module.h> @@ -15,6 +16,7 @@#include <linux/spinlock.h> #include <linux/slab.h> +#include "clk-mtk.h" #include "clk-mux.h" #define MTK_WAIT_FENC_DONE_US 30@@ -22,6 +24,7 @@struct mtk_clk_mux {struct clk_hw hw;struct regmap *regmap; +struct regmap *regmap_hwv;const struct mtk_mux *data;spinlock_t *lock;bool reparent;@@ -119,6 +122,41 @@ static int mtk_clk_mux_is_enabled(struct clk_hw *hw)return (val &BIT (mux->data->gate_shift)) ==0 ; } +static int mtk_clk_mux_hwv_fenc_enable (struct clk_hw *hw) +{ +struct mtk_clk_mux *mux =to_mtk_clk_mux (hw); +u32 val; +int ret; + +regmap_write (mux->regmap_hwv, mux->data->hwv_set_ofs, +BIT (mux->data->gate_shift)); + + ret =regmap_read_poll_timeout_atomic (mux->regmap_hwv, mux->data->hwv_sta_ofs, + val, val &BIT (mux->data->gate_shift),0 , +MTK_WAIT_HWV_DONE_US ); +if (ret) +return ret; + + ret =regmap_read_poll_timeout_atomic (mux->regmap, mux->data->fenc_sta_mon_ofs, + val, val &BIT (mux->data->fenc_shift),1 , +MTK_WAIT_FENC_DONE_US ); + +return ret; +} + +static void mtk_clk_mux_hwv_disable (struct clk_hw *hw) +{ +struct mtk_clk_mux *mux =to_mtk_clk_mux (hw); +u32 val; + +regmap_write (mux->regmap_hwv, mux->data->hwv_clr_ofs, +BIT (mux->data->gate_shift)); + +regmap_read_poll_timeout_atomic (mux->regmap_hwv, mux->data->hwv_sta_ofs, + val, (val &BIT (mux->data->gate_shift)), +0 ,MTK_WAIT_HWV_DONE_US ); +} +static u8 mtk_clk_mux_get_parent (struct clk_hw *hw) {struct mtk_clk_mux *mux =to_mtk_clk_mux (hw);@@ -190,6 +228,14 @@ static int mtk_clk_mux_determine_rate(struct clk_hw *hw,return clk_mux_determine_rate_flags (hw, req, mux->data->flags); } +static bool mtk_clk_mux_uses_hwv (const struct clk_ops *ops) +{ +if (ops == &mtk_mux_gate_hwv_fenc_clr_set_upd_ops) +return true; + +return false; +} +const struct clk_ops mtk_mux_clr_set_upd_ops = { .get_parent = mtk_clk_mux_get_parent, .set_parent = mtk_clk_mux_set_parent_setclr_lock,@@ -217,9 +263,20 @@ const struct clk_ops mtk_mux_gate_fenc_clr_set_upd_ops = { };EXPORT_SYMBOL_GPL (mtk_mux_gate_fenc_clr_set_upd_ops); +const struct clk_ops mtk_mux_gate_hwv_fenc_clr_set_upd_ops = { + .enable = mtk_clk_mux_hwv_fenc_enable, + .disable = mtk_clk_mux_hwv_disable, + .is_enabled = mtk_clk_mux_fenc_is_enabled, + .get_parent = mtk_clk_mux_get_parent, + .set_parent = mtk_clk_mux_set_parent_setclr_lock, + .determine_rate = mtk_clk_mux_determine_rate, +}; +EXPORT_SYMBOL_GPL (mtk_mux_gate_hwv_fenc_clr_set_upd_ops); +static struct clk_hw *mtk_clk_register_mux (struct device *dev,const struct mtk_mux *mux,struct regmap *regmap, +struct regmap *regmap_hwv,spinlock_t *lock) {struct mtk_clk_mux *clk_mux;
drivers/clk/mediatek/clk-mux.c static struct clk_hw *mtk_clk_register_mux(struct device *dev, · line 299
Quoted 8 lines
drivers/clk/mediatek/clk-mux.c +5
-0@@ -235,8 +292,14 @@ static struct clk_hw *mtk_clk_register_mux(struct device *dev, init.parent_names = mux->parent_names; init.num_parents = mux->num_parents; init.ops = mux->ops; +if (mtk_clk_mux_uses_hwv (init.ops) && !regmap_hwv) { +return dev_err_ptr_probe ( + dev, -ENXIO , +"regmap not found for hardware voter clocks\n" ); + }
Nit: The braces aren't really needed. But no need to respin just for this.
PATCH v5 6/27 clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct
In reply to Laura NaoMT8196 uses a HW voter for gate enable/disable control, with set/clr/sta registers located in a separate regmap. Refactor mtk_clk_register_gate() to take a struct mtk_gate, and add a pointer to it in struct mtk_clk_gate. This allows reuse of the static gate data (including HW voter register offsets) without adding extra function arguments, and removes redundant duplication in the runtime data struct.
--- drivers/clk/mediatek/clk-gate.c | 52 ++++++++++++--------------------- 1 file changed, 19 insertions(+), 33 deletions(-)
drivers/clk/mediatek/clk-gate.c +19 -33
@@ -17,10 +17,7 @@struct mtk_clk_gate {struct clk_hw hw;struct regmap *regmap; -int set_ofs; -int clr_ofs; -int sta_ofs; -u8 bit; +const struct mtk_gate *gate; };static inline struct mtk_clk_gate *to_mtk_clk_gate (struct clk_hw *hw)
@@ -33,9 +30,9 @@ static u32 mtk_get_clockgating(struct clk_hw *hw)struct mtk_clk_gate *cg =to_mtk_clk_gate (hw);u32 val; -regmap_read (cg->regmap, cg->sta_ofs, &val); +regmap_read (cg->regmap, cg->gate->regs->sta_ofs, &val); -return val &BIT (cg->bit); +return val &BIT (cg->gate->shift); }static int mtk_cg_bit_is_cleared (struct clk_hw *hw)
@@ -52,28 +49,30 @@ static void mtk_cg_set_bit(struct clk_hw *hw) {struct mtk_clk_gate *cg =to_mtk_clk_gate (hw); -regmap_write (cg->regmap, cg->set_ofs,BIT (cg->bit)); +regmap_write (cg->regmap, cg->gate->regs->set_ofs,BIT (cg->gate->shift)); }static void mtk_cg_clr_bit (struct clk_hw *hw) {struct mtk_clk_gate *cg =to_mtk_clk_gate (hw); -regmap_write (cg->regmap, cg->clr_ofs,BIT (cg->bit)); +regmap_write (cg->regmap, cg->gate->regs->clr_ofs,BIT (cg->gate->shift)); }static void mtk_cg_set_bit_no_setclr (struct clk_hw *hw) {struct mtk_clk_gate *cg =to_mtk_clk_gate (hw); -regmap_set_bits (cg->regmap, cg->sta_ofs,BIT (cg->bit)); +regmap_set_bits (cg->regmap, cg->gate->regs->sta_ofs, +BIT (cg->gate->shift)); }static void mtk_cg_clr_bit_no_setclr (struct clk_hw *hw) {struct mtk_clk_gate *cg =to_mtk_clk_gate (hw); -regmap_clear_bits (cg->regmap, cg->sta_ofs,BIT (cg->bit)); +regmap_clear_bits (cg->regmap, cg->gate->regs->sta_ofs, +BIT (cg->gate->shift)); }static int mtk_cg_enable (struct clk_hw *hw)
@@ -152,12 +151,9 @@ const struct clk_ops mtk_clk_gate_ops_no_setclr_inv = { };EXPORT_SYMBOL_GPL (mtk_clk_gate_ops_no_setclr_inv); -static struct clk_hw *mtk_clk_register_gate (struct device *dev,const char *name, -const char *parent_name, -struct regmap *regmap,int set_ofs, -int clr_ofs,int sta_ofs,u8 bit, -const struct clk_ops *ops, -unsigned long flags) +static struct clk_hw *mtk_clk_register_gate (struct device *dev, +const struct mtk_gate *gate, +struct regmap *regmap) {struct mtk_clk_gate *cg;int ret;
@@ -167,18 +163,14 @@ static struct clk_hw *mtk_clk_register_gate(struct device *dev, const char *nameif (!cg)return ERR_PTR (-ENOMEM ); - init.name = name; - init.flags = flags |CLK_SET_RATE_PARENT ; - init.parent_names = parent_name ? &parent_name :NULL ; - init.num_parents = parent_name ?1 :0 ; - init.ops = ops; + init.name = gate->name; + init.flags = gate->flags |CLK_SET_RATE_PARENT ; + init.parent_names = gate->parent_name ? &gate->parent_name :NULL ; + init.num_parents = gate->parent_name ?1 :0 ; + init.ops = gate->ops; cg->regmap = regmap; - cg->set_ofs = set_ofs; - cg->clr_ofs = clr_ofs; - cg->sta_ofs = sta_ofs; - cg->bit = bit; - + cg->gate = gate; cg->hw.init = &init; ret =clk_hw_register (dev, &cg->hw);
@@ -228,13 +220,7 @@ int mtk_clk_register_gates(struct device *dev, struct device_node *node,continue ; } - hw =mtk_clk_register_gate (dev, gate->name, gate->parent_name, - regmap, - gate->regs->set_ofs, - gate->regs->clr_ofs, - gate->regs->sta_ofs, - gate->shift, gate->ops, - gate->flags); + hw =mtk_clk_register_gate (dev, gate, regmap);if (IS_ERR (hw)) { pr_err("Failed to register clk %s: %pe\n", gate->name,
Signature · 1 line
2.39.5
Re: [PATCH v5 06/27] clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct
Quoted 9 lines · 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 structmtk_gate, and add a pointer to it in structmtk_clk_gate. This allows reuse of the static gate data (including HW voter register offsets) without adding extra function arguments, and removes redundant duplication in the runtime data struct.Signed-off-by Laura Nao <[email protected]>
Re: [PATCH v5 06/27] clk: mediatek: clk-gate: Refactor mtk_clk_register_gate to use mtk_gate struct
In reply to Laura NaoIl 29/08/25 11:18, Laura Nao ha scritto:
Quoted 8 lines
MT8196 uses a HW voter for gate enable/disable control, with set/clr/sta registers located in a separate regmap. Refactor
mtk_clk_register_gate()to take a structmtk_gate, and add a pointer to it in structmtk_clk_gate. This allows reuse of the static gate data (including HW voter register offsets) without adding extra function arguments, and removes redundant duplication in the runtime data struct.Signed-off-by Laura Nao <[email protected]>
Nice cleanup.
PATCH v5 7/27 clk: mediatek: clk-gate: Add ops for gates with HW voter
In reply to Laura NaoMT8196 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 | 73 +++++++++++++++++++++++++++++++-- drivers/clk/mediatek/clk-gate.h | 3 ++ 2 files changed, 73 insertions(+), 3 deletions(-)
drivers/clk/mediatek/clk-gate.c +70 -3
@@ -5,6 +5,7 @@*/ #include <linux/clk-provider.h> +#include <linux/dev_printk.h> #include <linux/mfd/syscon.h> #include <linux/module.h> #include <linux/printk.h>
@@ -12,11 +13,13 @@#include <linux/slab.h> #include <linux/types.h> +#include "clk-mtk.h" #include "clk-gate.h" struct mtk_clk_gate {struct clk_hw hw;struct regmap *regmap; +struct regmap *regmap_hwv;const struct mtk_gate *gate; };
@@ -99,6 +102,32 @@ static void mtk_cg_disable_inv(struct clk_hw *hw)mtk_cg_clr_bit (hw); } +static int mtk_cg_hwv_set_en (struct clk_hw *hw,bool enable) +{ +struct mtk_clk_gate *cg =to_mtk_clk_gate (hw); +u32 val; + +regmap_write (cg->regmap_hwv, + enable ? cg->gate->hwv_regs->set_ofs : + cg->gate->hwv_regs->clr_ofs, +BIT (cg->gate->shift)); + +return regmap_read_poll_timeout_atomic (cg->regmap_hwv, + cg->gate->hwv_regs->sta_ofs, val, + val &BIT (cg->gate->shift),0 , +MTK_WAIT_HWV_DONE_US ); +} + +static int mtk_cg_hwv_enable (struct clk_hw *hw) +{ +return mtk_cg_hwv_set_en (hw, true); +} + +static void mtk_cg_hwv_disable (struct clk_hw *hw) +{ +mtk_cg_hwv_set_en (hw, false); +} +static int mtk_cg_enable_no_setclr (struct clk_hw *hw) {mtk_cg_clr_bit_no_setclr (hw);
@@ -123,6 +152,15 @@ static void mtk_cg_disable_inv_no_setclr(struct clk_hw *hw)mtk_cg_clr_bit_no_setclr (hw); } +static bool mtk_cg_uses_hwv (const struct clk_ops *ops) +{ +if (ops == &mtk_clk_gate_hwv_ops_setclr || + ops == &mtk_clk_gate_hwv_ops_setclr_inv) +return true; + +return false; +} +const struct clk_ops mtk_clk_gate_ops_setclr = { .is_enabled = mtk_cg_bit_is_cleared, .enable = mtk_cg_enable,
@@ -137,6 +175,20 @@ const struct clk_ops mtk_clk_gate_ops_setclr_inv = { };EXPORT_SYMBOL_GPL (mtk_clk_gate_ops_setclr_inv); +const struct clk_ops mtk_clk_gate_hwv_ops_setclr = { + .is_enabled = mtk_cg_bit_is_cleared, + .enable = mtk_cg_hwv_enable, + .disable = mtk_cg_hwv_disable, +}; +EXPORT_SYMBOL_GPL (mtk_clk_gate_hwv_ops_setclr); + +const struct clk_ops mtk_clk_gate_hwv_ops_setclr_inv = { + .is_enabled = mtk_cg_bit_is_set, + .enable = mtk_cg_hwv_enable, + .disable = mtk_cg_hwv_disable, +}; +EXPORT_SYMBOL_GPL (mtk_clk_gate_hwv_ops_setclr_inv); +const struct clk_ops mtk_clk_gate_ops_no_setclr = { .is_enabled = mtk_cg_bit_is_cleared, .enable = mtk_cg_enable_no_setclr,
@@ -152,8 +204,9 @@ const struct clk_ops mtk_clk_gate_ops_no_setclr_inv = {EXPORT_SYMBOL_GPL (mtk_clk_gate_ops_no_setclr_inv);static struct clk_hw *mtk_clk_register_gate (struct device *dev, -const struct mtk_gate *gate, -struct regmap *regmap) +const struct mtk_gate *gate, +struct regmap *regmap, +struct regmap *regmap_hwv) {struct mtk_clk_gate *cg;int ret;
@@ -168,8 +221,14 @@ static struct clk_hw *mtk_clk_register_gate(struct device *dev, init.parent_names = gate->parent_name ? &gate->parent_name :NULL ; init.num_parents = gate->parent_name ?1 :0 ; init.ops = gate->ops; +if (mtk_cg_uses_hwv (init.ops) && !regmap_hwv) { +return dev_err_ptr_probe ( + dev, -ENXIO , +"regmap not found for hardware voter clocks\n" ); + } cg->regmap = regmap; + cg->regmap_hwv = regmap_hwv; cg->gate = gate; cg->hw.init = &init;
@@ -201,6 +260,7 @@ int mtk_clk_register_gates(struct device *dev, struct device_node *node,int i;struct clk_hw *hw;struct regmap *regmap; +struct regmap *regmap_hwv;if (!clk_data)return -ENOMEM ;
@@ -211,6 +271,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)) { +return dev_err_probe ( + dev,PTR_ERR (regmap_hwv), +"Cannot find hardware voter regmap for %pOF\n" , node); + } +for (i =0 ; i < num; i++) {const struct mtk_gate *gate = &clks[i];
@@ -220,7 +287,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
@@ -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
Re: [PATCH v5 07/27] clk: mediatek: clk-gate: Add ops for gates with HW voter
Quoted 9 lines · 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.
Reviewed-by Nícolas F. R. A. Prado <[email protected]>Reviewed-by AngeloGioacchino Del Regno <[email protected]>Signed-off-by Laura Nao <[email protected]>
PATCH v5 8/27 clk: mediatek: clk-mtk: Add MUX_DIV_GATE macro
In reply to Laura NaoOn 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
@@ -175,6 +175,25 @@ struct mtk_composite { .flags = 0, \ } +#define MUX_DIV_GATE (_id, _name, _parents, \ + _mux_reg, _mux_shift, _mux_width, \ + _div_reg, _div_shift, _div_width, \ + _gate_reg, _gate_shift) { \ + .id = _id, \ + .name = _name, \ + .parent_names = _parents, \ + .num_parents = ARRAY_SIZE(_parents), \ + .mux_reg = _mux_reg, \ + .mux_shift = _mux_shift, \ + .mux_width = _mux_width, \ + .divider_reg = _div_reg, \ + .divider_shift = _div_shift, \ + .divider_width = _div_width, \ + .gate_reg = _gate_reg, \ + .gate_shift = _gate_shift, \ + .flags = CLK_SET_RATE_PARENT, \ + } + int mtk_clk_register_composites(struct device *dev, const struct mtk_composite *mcs, int num, void __iomem *base, spinlock_t *lock,
Signature · 1 line
2.39.5
PATCH v5 9/27 dt-bindings: clock: mediatek: Describe MT8196 clock controllers
In reply to Laura NaoIntroduce binding documentation for system clocks, functional clocks, and PEXTP0/1 and UFS reset controllers on MediaTek MT8196.
This binding also includes a handle to the hardware voter, a fixed-function MCU designed to aggregate votes from the application processor and other remote processors to manage clocks and power domains.
The HWV on MT8196/MT6991 is incomplete and requires software to manually enable power supplies, parent clocks, and FENC, as well as write to both the HWV MMIO and the controller registers.
Because of these constraints, the HWV cannot be modeled using generic clock, power domain, or interconnect APIs. Instead, a custom phandle is exceptionally used to provide direct, syscon-like register access to drivers.
--- .../bindings/clock/mediatek,mt8196-clock.yaml | 112 +++ .../clock/mediatek,mt8196-sys-clock.yaml | 107 +++ .../dt-bindings/clock/mediatek,mt8196-clock.h | 803 ++++++++++++++++++ .../reset/mediatek,mt8196-resets.h | 26 + 4 files changed, 1048 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml create mode 100644 Documentation/devicetree/bindings/clock/mediatek,mt8196-sys-clock.yaml create mode 100644 include/dt-bindings/clock/mediatek,mt8196-clock.h create mode 100644 include/dt-bindings/reset/mediatek,mt8196-resets.h
Documentation/devicetree/bindings/clock/mediatek,mt8196-clock.yaml new file +112 -0
@@ -0,0 +1,112 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/mediatek,mt8196-clock.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MediaTek Functional Clock Controller for MT8196 + +maintainers: + - Guangjie Song <[email protected]> + - Laura Nao <[email protected]> + +description: | + The clock architecture in MediaTek SoCs is structured like below: + PLLs --> + dividers --> + muxes + --> + clock gate + + The device nodes provide clock gate control in different IP blocks. + +properties: + compatible: + items: + - enum: + - mediatek,mt8196-imp-iic-wrap-c + - mediatek,mt8196-imp-iic-wrap-e + - mediatek,mt8196-imp-iic-wrap-n + - mediatek,mt8196-imp-iic-wrap-w + - mediatek,mt8196-mdpsys0 + - mediatek,mt8196-mdpsys1 + - mediatek,mt8196-pericfg-ao + - mediatek,mt8196-pextp0cfg-ao + - mediatek,mt8196-pextp1cfg-ao + - mediatek,mt8196-ufscfg-ao + - mediatek,mt8196-vencsys + - mediatek,mt8196-vencsys-c1 + - mediatek,mt8196-vencsys-c2 + - mediatek,mt8196-vdecsys + - mediatek,mt8196-vdecsys-soc + - mediatek,mt8196-vdisp-ao + - const: syscon + + reg: + maxItems: 1 + + '#clock-cells': + const: 1 + + '#reset-cells': + const: 1 + description: + Reset lines for PEXTP0/1 and UFS blocks. + + mediatek,hardware-voter: + $ref: /schemas/types.yaml#/definitions/phandle + description: | + Phandle to the "Hardware Voter" (HWV), as named in the vendor + documentation for MT8196/MT6991. + + The HWV is a SoC-internal fixed-function MCU used to collect votes from + both the Application Processor and other remote processors within the SoC. + It is intended to transparently enable or disable hardware resources (such + as power domains or clocks) based on internal vote aggregation handled by + the MCU's internal state machine. + + However, in practice, this design is incomplete. While the HWV performs + some internal vote aggregation,software is still required to + - Manually enable power supplies externally, if present and if required + - Manually enable parent clocks via direct MMIO writes to clock controllers + - Enable the FENC after the clock has been ungated via direct MMIO + writes to clock controllers + + As such, the HWV behaves more like a hardware-managed clock reference + counter than a true voter. Furthermore, it is not a separate + controller. It merely serves as an alternative interface to the same + underlying clock or power controller. Actual control still requires + direct access to the controller's own MMIO register space, in + addition to writing to the HWV's MMIO region. + + For this reason, a custom phandle is used here - drivers need to directly + access the HWV MMIO region in a syscon-like fashion, due to how the + hardware is wired. This differs from true hardware voting systems, which + typically do not require custom phandles and rely instead on generic APIs + (clocks, power domains, interconnects). + + The name "hardware-voter" is retained to match vendor documentation, but + this should not be reused or misunderstood as a proper voting mechanism. + +required: + - compatible + - reg + - '#clock-cells' + +additionalProperties: false + +examples: + - | + pericfg_ao: clock-controller@16640000 { + compatible = "mediatek,mt8196-pericfg-ao", "syscon"; + reg = <0x16640000 0x1000>; + mediatek,hardware-voter = <&scp_hwv>; + #clock-cells = <1>; + }; + - | + pextp0cfg_ao: clock-controller@169b0000 { + compatible = "mediatek,mt8196-pextp0cfg-ao", "syscon"; + reg = <0x169b0000 0x1000>; + #clock-cells = <1>; + #reset-cells = <1>; + };
Documentation/devicetree/bindings/clock/mediatek,mt8196-sys-clock.yaml new file +107 -0
107 lines not on this page · raw message
include/dt-bindings/clock/mediatek,mt8196-clock.h new file +803 -0
803 lines not on this page · raw message
include/dt-bindings/reset/mediatek,mt8196-resets.h new file +26 -0
@@ -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
PATCH v5 10/27 clk: mediatek: Add MT8196 apmixedsys clock support
In reply to Laura NaoAdd support for the MT8196 apmixedsys clock controller, which provides PLLs generated from SoC 26m.
--- drivers/clk/mediatek/Kconfig | 8 + drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8196-apmixedsys.c | 204 +++++++++++++++++++ 3 files changed, 213 insertions(+) create mode 100644 drivers/clk/mediatek/clk-mt8196-apmixedsys.c
drivers/clk/mediatek/Kconfig +8 -0
@@ -1002,6 +1002,14 @@ config COMMON_CLK_MT8195_VENCSYS help This driver supports MediaTek MT8195 vencsys clocks. +config COMMON_CLK_MT8196 + tristate "Clock driver for MediaTek MT8196" + depends on ARM64 || COMPILE_TEST + select COMMON_CLK_MEDIATEK + default ARCH_MEDIATEK + help + This driver supports MediaTek MT8196 basic clocks. + config COMMON_CLK_MT8365 tristate "Clock driver for MediaTek MT8365" depends on ARCH_MEDIATEK || COMPILE_TEST
drivers/clk/mediatek/Makefile +1 -0
@@ -150,6 +150,7 @@ obj-$(CONFIG_COMMON_CLK_MT8195_VDOSYS) += clk-mt8195-vdo0.o clk-mt8195-vdo1.o obj-$(CONFIG_COMMON_CLK_MT8195_VENCSYS) += clk-mt8195-venc.o obj-$(CONFIG_COMMON_CLK_MT8195_VPPSYS) += clk-mt8195-vpp0.o clk-mt8195-vpp1.o obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o +obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.o
drivers/clk/mediatek/clk-mt8196-apmixedsys.c new file +204 -0
204 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH v5 11/27 clk: mediatek: Add MT8196 topckgen clock support
In reply to Laura NaoAdd support for the MT8196 topckgen clock controller, which provides muxes and dividers for clock selection in other IP blocks.
--- drivers/clk/mediatek/Makefile | 2 +- drivers/clk/mediatek/clk-mt8196-topckgen.c | 985 +++++++++++++++++++++ 2 files changed, 986 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/mediatek/clk-mt8196-topckgen.c
drivers/clk/mediatek/Makefile +1 -1
@@ -150,7 +150,7 @@ obj-$(CONFIG_COMMON_CLK_MT8195_VDOSYS) += clk-mt8195-vdo0.o clk-mt8195-vdo1.o obj-$(CONFIG_COMMON_CLK_MT8195_VENCSYS) += clk-mt8195-venc.o obj-$(CONFIG_COMMON_CLK_MT8195_VPPSYS) += clk-mt8195-vpp0.o clk-mt8195-vpp1.o obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o -obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o +obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.o
drivers/clk/mediatek/clk-mt8196-topckgen.c new file +985 -0
985 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH v5 12/27 clk: mediatek: Add MT8196 topckgen2 clock support
In reply to Laura NaoAdd support for the MT8196 topckgen2 clock controller, which provides muxes and dividers for clock selection in other IP blocks.
--- drivers/clk/mediatek/Makefile | 3 +- drivers/clk/mediatek/clk-mt8196-topckgen2.c | 568 ++++++++++++++++++++ 2 files changed, 570 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/mediatek/clk-mt8196-topckgen2.c
drivers/clk/mediatek/Makefile +2 -1
@@ -150,7 +150,8 @@ obj-$(CONFIG_COMMON_CLK_MT8195_VDOSYS) += clk-mt8195-vdo0.o clk-mt8195-vdo1.o obj-$(CONFIG_COMMON_CLK_MT8195_VENCSYS) += clk-mt8195-venc.o obj-$(CONFIG_COMMON_CLK_MT8195_VPPSYS) += clk-mt8195-vpp0.o clk-mt8195-vpp1.o obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o -obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o +obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o \ + clk-mt8196-topckgen2.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.o
drivers/clk/mediatek/clk-mt8196-topckgen2.c new file +568 -0
568 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH v5 13/27 clk: mediatek: Add MT8196 vlpckgen clock support
In reply to Laura NaoAdd 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 | 729 +++++++++++++++++++++ 2 files changed, 730 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/mediatek/clk-mt8196-vlpckgen.c
drivers/clk/mediatek/Makefile +1 -1
@@ -151,7 +151,7 @@ obj-$(CONFIG_COMMON_CLK_MT8195_VENCSYS) += clk-mt8195-venc.o obj-$(CONFIG_COMMON_CLK_MT8195_VPPSYS) += clk-mt8195-vpp0.o clk-mt8195-vpp1.o obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o \ - clk-mt8196-topckgen2.o + clk-mt8196-topckgen2.o clk-mt8196-vlpckgen.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.o
drivers/clk/mediatek/clk-mt8196-vlpckgen.c new file +729 -0
729 lines not on this page · raw message
Signature · 1 line
2.39.5
Re: [PATCH v5 13/27] clk: mediatek: Add MT8196 vlpckgen clock support
Quoted 29 lines · Laura Nao
Add support for the MT8196 vlpckgen clock controller, which provides muxes and dividers for clock selection in other IP blocks.
Signed-off-by Laura Nao <[email protected]>--- drivers/clk/mediatek/Makefile | 2 +- drivers/clk/mediatek/clk-mt8196-vlpckgen.c | 729 +++++++++++++++++++++ 2 files changed, 730 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/mediatek/clk-mt8196-vlpckgen.cdrivers/clk/mediatek/Makefile +1
-1@@ -151,7 +151,7 @@ obj-$(CONFIG_COMMON_CLK_MT8195_VENCSYS) += clk-mt8195-venc.o obj-$(CONFIG_COMMON_CLK_MT8195_VPPSYS) += clk-mt8195-vpp0.o clk-mt8195-vpp1.o obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o \ - clk-mt8196-topckgen2.o + clk-mt8196-topckgen2.o clk-mt8196-vlpckgen.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.odrivers/clk/mediatek/clk-mt8196-vlpckgen.c new file +0
-0
[...]
Quoted 17 lines
drivers/clk/mediatek/clk-mt8196-vlpckgen.c new file +17
-0+static const char *const vlp_audio_h_parents[] = { +"clk26m" , +"vlp_clk26m" , +"vlp_apll1" , +"vlp_apll2" +}; + +static const char *const vlp_aud_engen1_parents[] = { +"clk26m" , +"vlp_clk26m" , +"apll1_d8" , +"apll1_d4" +}; + +static const char *const vlp_aud_engen2_parents[] = { +"clk26m" , +"vlp_clk26m" ,
drivers/clk/mediatek/clk-mt8196-vlpckgen.c line 401
Quoted 10 lines
drivers/clk/mediatek/clk-mt8196-vlpckgen.c new file +10
-0+"apll2_d8" , + "apll2_d4" +}; + +static const char *const vlp_aud_intbus_parents[] = { +"clk26m" , +"vlp_clk26m" , +"mainpll_d7_d4" , +"mainpll_d4_d4" +};
The above parents lists are incorrect. What we want is to exclude the "clk26m" parent and only have the latter three parents. That is why we have the parent index table below.
So please remove "clk26m" from the lists that are used together with vlp_aud_parent_index.
I apologize if my previous explanation wasn't clear. The index table is meant for "skipping" parent mux values when the values don't start from 0 and/or the values aren't contiguous. The number of values still has to match the number of parents given. The index list below is essentially saying that "parent 0" is actually at "mux value 1".
Quoted 1 line
+static const u8 vlp_aud_parent_index[] = { 1, 2, 3 };
After this is fixed,
[...]
Re: [PATCH v5 13/27] clk: mediatek: Add MT8196 vlpckgen clock support
In reply to Laura NaoIl 29/08/25 11:18, Laura Nao ha scritto:
Quoted 36 lines
Add support for the MT8196 vlpckgen clock controller, which provides muxes and dividers for clock selection in other IP blocks.
Signed-off-by Laura Nao <[email protected]>--- drivers/clk/mediatek/Makefile | 2 +- drivers/clk/mediatek/clk-mt8196-vlpckgen.c | 729 +++++++++++++++++++++ 2 files changed, 730 insertions(+), 1 deletion(-)create mode 100644
drivers/clk/mediatek/clk-mt8196-vlpckgen.cdrivers/clk/mediatek/Makefile +1
-1@@ -151,7 +151,7 @@ obj-$(CONFIG_COMMON_CLK_MT8195_VENCSYS) += clk-mt8195-venc.o obj-$(CONFIG_COMMON_CLK_MT8195_VPPSYS) += clk-mt8195-vpp0.o clk-mt8195-vpp1.o obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o \ - clk-mt8196-topckgen2.o + clk-mt8196-topckgen2.o clk-mt8196-vlpckgen.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.odrivers/clk/mediatek/clk-mt8196-vlpckgen.c new file +7
-0@@ -0,0 +1,729 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) 2025 MediaTek Inc. +* Guangjie Song <[email protected]> +* Copyright (c) 2025 Collabora Ltd. +* Laura Nao <[email protected]> +*/
..snip..
drivers/clk/mediatek/clk-mt8196-vlpckgen.c line 376
Quoted 9 lines
drivers/clk/mediatek/clk-mt8196-vlpckgen.c new file +9
-0+ +static const char *const vlp_noc_vlp_parents[] = { +"clk26m" , +"osc_d20" , +"mainpll_d9" +}; + +static const char *const vlp_audio_h_parents[] = { +"clk26m" ,
Please remove clk26m from this list (and from engen1/2/intbus). We shall either use vlp_clk26m or clk26m directly - and I suspect that the VLP specific 26m one is there for a reason.
What I'm not sure of is whether vlp_clk26m is really parented to clk26m or if it is an additional internal crystal, but let's be cautious for now and keep the parenting.
Quoted 17 lines
drivers/clk/mediatek/clk-mt8196-vlpckgen.c new file +17
-0+"vlp_clk26m" , +"vlp_apll1" , +"vlp_apll2" +}; + +static const char *const vlp_aud_engen1_parents[] = { +"clk26m" , +"vlp_clk26m" , +"apll1_d8" , +"apll1_d4" +}; + +static const char *const vlp_aud_engen2_parents[] = { +"clk26m" , +"vlp_clk26m" , +"apll2_d8" , + "apll2_d4"
drivers/clk/mediatek/clk-mt8196-vlpckgen.c line 403
Quoted 10 lines
drivers/clk/mediatek/clk-mt8196-vlpckgen.c new file +10
-0+}; + +static const char *const vlp_aud_intbus_parents[] = { +"clk26m" , +"vlp_clk26m" , +"mainpll_d7_d4" , +"mainpll_d4_d4" +}; + +static const u8 vlp_aud_parent_index[] = {1 ,2 ,3 };
... of course, this index list doesn't match the parents list, so this will break all of the clocks above because you're selecting wrong index in HW and ignoring the last entry as well, producing a clock rate mismatch.
Once the clk26m is dropped from the names list, though, this index list becomes valid.
After fixing:
PATCH v5 14/27 clk: mediatek: Add MT8196 peripheral clock support
In reply to Laura NaoAdd support for the MT8196 peripheral clock controller, which provides clock gate control for dma/flashif/msdc/pwm/spi/uart.
--- drivers/clk/mediatek/Makefile | 3 +- drivers/clk/mediatek/clk-mt8196-peri_ao.c | 142 ++++++++++++++++++++++ 2 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/mediatek/clk-mt8196-peri_ao.c
drivers/clk/mediatek/Makefile +2 -1
@@ -151,7 +151,8 @@ obj-$(CONFIG_COMMON_CLK_MT8195_VENCSYS) += clk-mt8195-venc.o obj-$(CONFIG_COMMON_CLK_MT8195_VPPSYS) += clk-mt8195-vpp0.o clk-mt8195-vpp1.o obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o \ - clk-mt8196-topckgen2.o clk-mt8196-vlpckgen.o + clk-mt8196-topckgen2.o clk-mt8196-vlpckgen.o \ + clk-mt8196-peri_ao.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.o
drivers/clk/mediatek/clk-mt8196-peri_ao.c new file +142 -0
142 lines not on this page · raw message
Signature · 1 line
2.39.5
Re: [PATCH v5 14/27] clk: mediatek: Add MT8196 peripheral clock support
Quoted 5 lines · Laura Nao
Add support for the MT8196 peripheral clock controller, which provides clock gate control for dma/flashif/msdc/pwm/spi/uart.
Signed-off-by Laura Nao <[email protected]>
Not sure why CLK_OPS_PARENT_ENABLE was removed, but it does seem like the right thing to do, since this block is always on and doesn't require a clock to be enabled before accessing the registers.
Note that I did not go through the bit definitions. I assume the other Collabora folks did a good job of reviewing those.
Re: [PATCH v5 14/27] clk: mediatek: Add MT8196 peripheral clock support
Il 05/09/25 07:05, Chen-Yu Tsai ha scritto:
Quoted 7 lines · Laura Nao
Quoted 5 lines
Add support for the MT8196 peripheral clock controller, which provides clock gate control for dma/flashif/msdc/pwm/spi/uart.
Signed-off-by Laura Nao <[email protected]>
Quoted 8 lines
Not sure why
CLK_OPS_PARENT_ENABLEwas removed, but it does seem like the right thing to do, since this block is always on and doesn't require a clock to be enabled before accessing the registers.Note that I did not go through the bit definitions. I assume the other Collabora folks did a good job of reviewing those.
Yes, I did :-)
Cheers,
Angelo
PATCH v5 15/27 clk: mediatek: Add MT8196 ufssys clock support
In reply to Laura NaoAdd support for the MT8196 ufssys clock controller, which provides clock gate control for UFS.
--- drivers/clk/mediatek/Kconfig | 7 ++ drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8196-ufs_ao.c | 108 +++++++++++++++++++++++ 3 files changed, 116 insertions(+) create mode 100644 drivers/clk/mediatek/clk-mt8196-ufs_ao.c
drivers/clk/mediatek/Kconfig +7 -0
@@ -1010,6 +1010,13 @@ config COMMON_CLK_MT8196 help This driver supports MediaTek MT8196 basic clocks. +config COMMON_CLK_MT8196_UFSSYS + tristate "Clock driver for MediaTek MT8196 ufssys" + depends on COMMON_CLK_MT8196 + default COMMON_CLK_MT8196 + help + This driver supports MediaTek MT8196 ufssys clocks. + config COMMON_CLK_MT8365 tristate "Clock driver for MediaTek MT8365" depends on ARCH_MEDIATEK || COMPILE_TEST
drivers/clk/mediatek/Makefile +1 -0
@@ -153,6 +153,7 @@ obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o \ clk-mt8196-topckgen2.o clk-mt8196-vlpckgen.o \ clk-mt8196-peri_ao.o +obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.o
drivers/clk/mediatek/clk-mt8196-ufs_ao.c new file +108 -0
108 lines not on this page · raw message
Signature · 1 line
2.39.5
Re: [PATCH v5 15/27] clk: mediatek: Add MT8196 ufssys clock support
Quoted 7 lines · Laura Nao
Add support for the MT8196 ufssys clock controller, which provides clock gate control for UFS.
Co-developed-by AngeloGioacchino Del Regno <[email protected]>Signed-off-by AngeloGioacchino Del Regno <[email protected]>Signed-off-by Laura Nao <[email protected]>
Assuming the previous reviews for the bits are correct, the removal of CLK_OPS_PARENT_ENABLE IMO is the right thing to do.
However if the hardware ends up does having a requirement that _some_ clock be enabled before touching the registers, then I think the MTK clock library needs to be refactored, so that a register access clock can be tied to the regmap. That might also require some work on the syscon API.
Re: [PATCH v5 15/27] clk: mediatek: Add MT8196 ufssys clock support
In reply to Laura NaoIl 29/08/25 11:19, Laura Nao ha scritto:
Quoted 6 lines
Add support for the MT8196 ufssys clock controller, which provides clock gate control for UFS.
Co-developed-by AngeloGioacchino Del Regno <[email protected]>Signed-off-by AngeloGioacchino Del Regno <[email protected]>Signed-off-by Laura Nao <[email protected]>
PATCH v5 16/27 clk: mediatek: Add MT8196 pextpsys clock support
In reply to Laura NaoAdd 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
@@ -1010,6 +1010,13 @@ config COMMON_CLK_MT8196 help This driver supports MediaTek MT8196 basic clocks. +config COMMON_CLK_MT8196_PEXTPSYS + tristate "Clock driver for MediaTek MT8196 pextpsys" + depends on COMMON_CLK_MT8196 + default COMMON_CLK_MT8196 + help + This driver supports MediaTek MT8196 pextpsys clocks. + config COMMON_CLK_MT8196_UFSSYS tristate "Clock driver for MediaTek MT8196 ufssys" depends on COMMON_CLK_MT8196
drivers/clk/mediatek/Makefile +1 -0
@@ -153,6 +153,7 @@ obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o \ clk-mt8196-topckgen2.o clk-mt8196-vlpckgen.o \ clk-mt8196-peri_ao.o +obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o
drivers/clk/mediatek/clk-mt8196-pextp.c new file +131 -0
131 lines not on this page · raw message
Signature · 1 line
2.39.5
Re: [PATCH v5 16/27] clk: mediatek: Add MT8196 pextpsys clock support
Quoted 7 lines · Laura Nao
Add support for the MT8196 pextpsys clock controller, which provides clock gate control for PCIe.
Co-developed-by AngeloGioacchino Del Regno <[email protected]>Signed-off-by AngeloGioacchino Del Regno <[email protected]>Signed-off-by Laura Nao <[email protected]>
PATCH v5 17/27 clk: mediatek: Add MT8196 I2C clock support
In reply to Laura NaoAdd support for the MT8196 I2C clock controller, which provides clock gate control for I2C.
--- drivers/clk/mediatek/Kconfig | 7 ++ drivers/clk/mediatek/Makefile | 1 + .../clk/mediatek/clk-mt8196-imp_iic_wrap.c | 118 ++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 drivers/clk/mediatek/clk-mt8196-imp_iic_wrap.c
drivers/clk/mediatek/Kconfig +7 -0
@@ -1010,6 +1010,13 @@ config COMMON_CLK_MT8196 help This driver supports MediaTek MT8196 basic clocks. +config COMMON_CLK_MT8196_IMP_IIC_WRAP + tristate "Clock driver for MediaTek MT8196 imp_iic_wrap" + depends on COMMON_CLK_MT8196 + default COMMON_CLK_MT8196 + help + This driver supports MediaTek MT8196 i2c clocks. + config COMMON_CLK_MT8196_PEXTPSYS tristate "Clock driver for MediaTek MT8196 pextpsys" depends on COMMON_CLK_MT8196
drivers/clk/mediatek/Makefile +1 -0
@@ -153,6 +153,7 @@ obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o \ clk-mt8196-topckgen2.o clk-mt8196-vlpckgen.o \ clk-mt8196-peri_ao.o +obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
drivers/clk/mediatek/clk-mt8196-imp_iic_wrap.c new file +118 -0
118 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH v5 18/27 clk: mediatek: Add MT8196 mcu clock support
In reply to Laura NaoAdd support for the MT8196 mcu clock controller, which provides PLL control for MCU.
--- drivers/clk/mediatek/Kconfig | 7 ++ drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8196-mcu.c | 167 ++++++++++++++++++++++++++ 3 files changed, 175 insertions(+) create mode 100644 drivers/clk/mediatek/clk-mt8196-mcu.c
drivers/clk/mediatek/Kconfig +7 -0
@@ -1017,6 +1017,13 @@ config COMMON_CLK_MT8196_IMP_IIC_WRAP help This driver supports MediaTek MT8196 i2c clocks. +config COMMON_CLK_MT8196_MCUSYS + tristate "Clock driver for MediaTek MT8196 mcusys" + depends on COMMON_CLK_MT8196 + default COMMON_CLK_MT8196 + help + This driver supports MediaTek MT8196 mcusys clocks. + config COMMON_CLK_MT8196_PEXTPSYS tristate "Clock driver for MediaTek MT8196 pextpsys" depends on COMMON_CLK_MT8196
drivers/clk/mediatek/Makefile +1 -0
@@ -154,6 +154,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o clk-mt8196-topckgen2.o clk-mt8196-vlpckgen.o \ clk-mt8196-peri_ao.o obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o +obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
drivers/clk/mediatek/clk-mt8196-mcu.c new file +167 -0
167 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH v5 19/27 clk: mediatek: Add MT8196 mdpsys clock support
In reply to Laura NaoAdd support for the MT8196 mdpsys clock controller, which provides clock gate control for MDP.
--- drivers/clk/mediatek/Kconfig | 7 + drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8196-mdpsys.c | 186 +++++++++++++++++++++++ 3 files changed, 194 insertions(+) create mode 100644 drivers/clk/mediatek/clk-mt8196-mdpsys.c
drivers/clk/mediatek/Kconfig +7 -0
@@ -1024,6 +1024,13 @@ config COMMON_CLK_MT8196_MCUSYS help This driver supports MediaTek MT8196 mcusys clocks. +config COMMON_CLK_MT8196_MDPSYS + tristate "Clock driver for MediaTek MT8196 mdpsys" + depends on COMMON_CLK_MT8196 + default COMMON_CLK_MT8196 + help + This driver supports MediaTek MT8196 mdpsys clocks. + config COMMON_CLK_MT8196_PEXTPSYS tristate "Clock driver for MediaTek MT8196 pextpsys" depends on COMMON_CLK_MT8196
drivers/clk/mediatek/Makefile +1 -0
@@ -155,6 +155,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o clk-mt8196-peri_ao.o obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o +obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
drivers/clk/mediatek/clk-mt8196-mdpsys.c new file +186 -0
186 lines not on this page · raw message
Signature · 1 line
2.39.5
Re: [PATCH v5 19/27] clk: mediatek: Add MT8196 mdpsys clock support
Quoted 5 lines · Laura Nao
Add support for the MT8196 mdpsys clock controller, which provides clock gate control for MDP.
Signed-off-by Laura Nao <[email protected]>
IMO removing CLK_OPS_PARENT_ENABLE is the right thing to do.
However if the hardware ends up does having a requirement that _some_ clock be enabled before touching the registers, then I think the MTK clock library needs to be refactored, so that a register access clock can be tied to the regmap. That might also require some work on the syscon API.
Whether the hardware needs such a clock or not, we would need some input from MediaTek. There's nothing in the datasheet on this.
Re: [PATCH v5 19/27] clk: mediatek: Add MT8196 mdpsys clock support
In reply to Laura NaoIl 29/08/25 11:19, Laura Nao ha scritto:
Quoted 79 lines
Add support for the MT8196 mdpsys clock controller, which provides clock gate control for MDP.
Signed-off-by Laura Nao <[email protected]>--- drivers/clk/mediatek/Kconfig | 7 + drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8196-mdpsys.c | 186 +++++++++++++++++++++++ 3 files changed, 194 insertions(+)create mode 100644
drivers/clk/mediatek/clk-mt8196-mdpsys.cdrivers/clk/mediatek/Kconfig +7
-0@@ -1024,6 +1024,13 @@ config COMMON_CLK_MT8196_MCUSYS help This driver supports MediaTek MT8196 mcusys clocks. +config COMMON_CLK_MT8196_MDPSYS + tristate "Clock driver for MediaTek MT8196 mdpsys" + depends on COMMON_CLK_MT8196 + default COMMON_CLK_MT8196 + help + This driver supports MediaTek MT8196 mdpsys clocks. + config COMMON_CLK_MT8196_PEXTPSYS tristate "Clock driver for MediaTek MT8196 pextpsys" depends on COMMON_CLK_MT8196drivers/clk/mediatek/Makefile +1
-0@@ -155,6 +155,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o clk-mt8196-peri_ao.o obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o +obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.odrivers/clk/mediatek/clk-mt8196-mdpsys.c new file +32
-0@@ -0,0 +1,186 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) 2025 MediaTek Inc. +* Guangjie Song <[email protected]> +* Copyright (c) 2025 Collabora Ltd. +* Laura Nao <[email protected]> +*/ +#include <dt-bindings/clock/mediatek,mt8196-clock.h> + +#include <linux/clk-provider.h> +#include <linux/module.h> +#include <linux/of_device.h> +#include <linux/platform_device.h> + +#include "clk-gate.h" +#include "clk-mtk.h" + +static const struct mtk_gate_regs mdp0_cg_regs = { + .set_ofs =0x104 , + .clr_ofs =0x108 , + .sta_ofs =0x100 , +}; + +static const struct mtk_gate_regs mdp1_cg_regs = { + .set_ofs =0x114 , + .clr_ofs =0x118 , + .sta_ofs =0x110 , +}; + +static const struct mtk_gate_regs mdp2_cg_regs = { + .set_ofs =0x124 , + .clr_ofs =0x128 ,
drivers/clk/mediatek/clk-mt8196-mdpsys.c line 42
Quoted 10 lines
drivers/clk/mediatek/clk-mt8196-mdpsys.c new file +10
-0+ .sta_ofs = 0x120, +}; + +#define GATE_MDP0 (_id, _name, _parent, _shift) { \ + .id = _id, \ + .name = _name, \ + .parent_name = _parent, \ + .regs = &mdp0_cg_regs, \ + .shift = _shift, \ + .flags = CLK_OPS_PARENT_ENABLE, \
Why would MDP0 and MDP2 be different, as in why would MDP1 be so special to not need CLK_OPS_PARENT_ENABLE while the others do?
Either they all do, or they all don't.
I guess they all don't, but I'm not sure how you tested that at all, since the only way to test this is downstream (and upstream will very likely be different from that).
Even though I think they don't need that - please add back CLK_OPS_PARENT_ENABLE to GATE_MDP1 to be safe, as in (all) MediaTek SoCs the multimedia subsystem is kinda separate from the rest.
Once MT8196 MDP support is upstreamed, we will be able to run a number of tests to evaluate whether this flag is really needed or not.
After all, if it turns out we can remove it, it's going to be a 3 lines patch, not a big deal.
Quoted 22 lines
drivers/clk/mediatek/clk-mt8196-mdpsys.c new file +22
-0+ .ops = &mtk_clk_gate_ops_setclr, \ + } + +#define GATE_MDP1 (_id, _name, _parent, _shift) { \ + .id = _id, \ + .name = _name, \ + .parent_name = _parent, \ + .regs = &mdp1_cg_regs, \ + .shift = _shift, \ + .ops = &mtk_clk_gate_ops_setclr, \ + } + +#define GATE_MDP2 (_id, _name, _parent, _shift) { \ + .id = _id, \ + .name = _name, \ + .parent_name = _parent, \ + .regs = &mdp2_cg_regs, \ + .shift = _shift, \ + .flags = CLK_OPS_PARENT_ENABLE, \ + .ops = &mtk_clk_gate_ops_setclr, \ + } +
..snip..
drivers/clk/mediatek/clk-mt8196-mdpsys.c line 170
Quoted 10 lines
drivers/clk/mediatek/clk-mt8196-mdpsys.c new file +10
-0+ +static const struct mtk_clk_desc mdp_mcd = { + .clks = mdp_clks, + .num_clks =ARRAY_SIZE (mdp_clks), + .need_runtime_pm = true, +}; + +static const struct of_device_id of_match_clk_mt8196_mdpsys[] = { + { .compatible ="mediatek,mt8196-mdpsys1" , .data = &mdp1_mcd }, + { .compatible ="mediatek,mt8196-mdpsys0" , .data = &mdp_mcd },
0 comes before 1, swap those entries please.
After applying the proposed fixes
Quoted 16 lines
drivers/clk/mediatek/clk-mt8196-mdpsys.c new file +16
-0+ {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, of_match_clk_mt8196_mdpsys); + +static struct platform_driver clk_mt8196_mdpsys_drv = { + .probe = mtk_clk_simple_probe, + .remove = mtk_clk_simple_remove, + .driver = { + .name ="clk-mt8196-mdpsys" , + .of_match_table = of_match_clk_mt8196_mdpsys, + }, +}; +module_platform_driver (clk_mt8196_mdpsys_drv); + +MODULE_DESCRIPTION ("MediaTek MT8196 Multimedia Data Path clocks driver" ); +MODULE_LICENSE ("GPL" );
Re: [PATCH v5 19/27] clk: mediatek: Add MT8196 mdpsys clock support
Quoted 97 lines · AngeloGioacchino Del Regno
Il 29/08/25 11:19, Laura Nao ha scritto:
Quoted 79 lines
Add support for the MT8196 mdpsys clock controller, which provides clock gate control for MDP.
Signed-off-by Laura Nao <[email protected]>--- drivers/clk/mediatek/Kconfig | 7 + drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8196-mdpsys.c | 186 +++++++++++++++++++++++ 3 files changed, 194 insertions(+)create mode 100644
drivers/clk/mediatek/clk-mt8196-mdpsys.cdrivers/clk/mediatek/Kconfig +7
-0@@ -1024,6 +1024,13 @@ config COMMON_CLK_MT8196_MCUSYS help This driver supports MediaTek MT8196 mcusys clocks. +config COMMON_CLK_MT8196_MDPSYS + tristate "Clock driver for MediaTek MT8196 mdpsys" + depends on COMMON_CLK_MT8196 + default COMMON_CLK_MT8196 + help + This driver supports MediaTek MT8196 mdpsys clocks. + config COMMON_CLK_MT8196_PEXTPSYS tristate "Clock driver for MediaTek MT8196 pextpsys" depends on COMMON_CLK_MT8196drivers/clk/mediatek/Makefile +1
-0@@ -155,6 +155,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o clk-mt8196-peri_ao.o obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o +obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.odrivers/clk/mediatek/clk-mt8196-mdpsys.c new file +32
-0@@ -0,0 +1,186 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) 2025 MediaTek Inc. +* Guangjie Song <[email protected]> +* Copyright (c) 2025 Collabora Ltd. +* Laura Nao <[email protected]> +*/ +#include <dt-bindings/clock/mediatek,mt8196-clock.h> + +#include <linux/clk-provider.h> +#include <linux/module.h> +#include <linux/of_device.h> +#include <linux/platform_device.h> + +#include "clk-gate.h" +#include "clk-mtk.h" + +static const struct mtk_gate_regs mdp0_cg_regs = { + .set_ofs =0x104 , + .clr_ofs =0x108 , + .sta_ofs =0x100 , +}; + +static const struct mtk_gate_regs mdp1_cg_regs = { + .set_ofs =0x114 , + .clr_ofs =0x118 , + .sta_ofs =0x110 , +}; + +static const struct mtk_gate_regs mdp2_cg_regs = { + .set_ofs =0x124 , + .clr_ofs =0x128 ,drivers/clk/mediatek/clk-mt8196-mdpsys.c line 42
Quoted 10 lines
drivers/clk/mediatek/clk-mt8196-mdpsys.c new file +10
-0+ .sta_ofs = 0x120, +}; + +#define GATE_MDP0 (_id, _name, _parent, _shift) { \ + .id = _id, \ + .name = _name, \ + .parent_name = _parent, \ + .regs = &mdp0_cg_regs, \ + .shift = _shift, \ + .flags = CLK_OPS_PARENT_ENABLE, \Why would MDP0 and MDP2 be different, as in why would MDP1 be so special to not need
CLK_OPS_PARENT_ENABLEwhile the others do?Either they all do, or they all don't.
Quoted 7 lines
I guess they all don't, but I'm not sure how you tested that at all, since the only way to test this is downstream (and upstream will very likely be different from that).
Even though I think they don't need that - please add back
CLK_OPS_PARENT_ENABLEtoGATE_MDP1to be safe, as in (all) MediaTek SoCs the multimedia subsystem is kinda separate from the rest.
That kind of doesn't fly since the parent of mdp_f26m is clk26m, not the mdp clock. So either this block doesn't need a clock for register access or this clock is going to be broken.
This is why I raised the question about the validity of the flag in the first place.
Quoted 7 lines
+
GATE_MDP1(CLK_MDP_F26M, "mdp_f26m", "clk26m", 27),Once MT8196 MDP support is upstreamed, we will be able to run a number of tests to evaluate whether this flag is really needed or not.
After all, if it turns out we can remove it, it's going to be a 3 lines patch, not a big deal.
That also works. Though IMO it makes the error harder to notice.
ChenYu
Quoted 59 lines
Quoted 22 lines
drivers/clk/mediatek/clk-mt8196-mdpsys.c new file +22
-0+ .ops = &mtk_clk_gate_ops_setclr, \ + } + +#define GATE_MDP1 (_id, _name, _parent, _shift) { \ + .id = _id, \ + .name = _name, \ + .parent_name = _parent, \ + .regs = &mdp1_cg_regs, \ + .shift = _shift, \ + .ops = &mtk_clk_gate_ops_setclr, \ + } + +#define GATE_MDP2 (_id, _name, _parent, _shift) { \ + .id = _id, \ + .name = _name, \ + .parent_name = _parent, \ + .regs = &mdp2_cg_regs, \ + .shift = _shift, \ + .flags = CLK_OPS_PARENT_ENABLE, \ + .ops = &mtk_clk_gate_ops_setclr, \ + } +..snip..
drivers/clk/mediatek/clk-mt8196-mdpsys.c line 170
Quoted 10 lines
drivers/clk/mediatek/clk-mt8196-mdpsys.c new file +10
-0+ +static const struct mtk_clk_desc mdp_mcd = { + .clks = mdp_clks, + .num_clks =ARRAY_SIZE (mdp_clks), + .need_runtime_pm = true, +}; + +static const struct of_device_id of_match_clk_mt8196_mdpsys[] = { + { .compatible ="mediatek,mt8196-mdpsys1" , .data = &mdp1_mcd }, + { .compatible ="mediatek,mt8196-mdpsys0" , .data = &mdp_mcd },0 comes before 1, swap those entries please.
After applying the proposed fixes
Reviewed-by AngeloGioacchino Del Regno <[email protected]>Quoted 16 lines
drivers/clk/mediatek/clk-mt8196-mdpsys.c new file +16
-0+ {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, of_match_clk_mt8196_mdpsys); + +static struct platform_driver clk_mt8196_mdpsys_drv = { + .probe = mtk_clk_simple_probe, + .remove = mtk_clk_simple_remove, + .driver = { + .name ="clk-mt8196-mdpsys" , + .of_match_table = of_match_clk_mt8196_mdpsys, + }, +}; +module_platform_driver (clk_mt8196_mdpsys_drv); + +MODULE_DESCRIPTION ("MediaTek MT8196 Multimedia Data Path clocks driver" ); +MODULE_LICENSE ("GPL" );
AngeloGioacchino Del Regno
maintainerRe: [PATCH v5 19/27] clk: mediatek: Add MT8196 mdpsys clock support
Il 05/09/25 10:53, Chen-Yu Tsai ha scritto:
Quoted 116 lines
Quoted 97 lines · AngeloGioacchino Del Regno
Il 29/08/25 11:19, Laura Nao ha scritto:
Quoted 79 lines
Add support for the MT8196 mdpsys clock controller, which provides clock gate control for MDP.
Signed-off-by Laura Nao <[email protected]>--- drivers/clk/mediatek/Kconfig | 7 + drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8196-mdpsys.c | 186 +++++++++++++++++++++++ 3 files changed, 194 insertions(+)create mode 100644
drivers/clk/mediatek/clk-mt8196-mdpsys.cdrivers/clk/mediatek/Kconfig +7
-0@@ -1024,6 +1024,13 @@ config COMMON_CLK_MT8196_MCUSYS help This driver supports MediaTek MT8196 mcusys clocks. +config COMMON_CLK_MT8196_MDPSYS + tristate "Clock driver for MediaTek MT8196 mdpsys" + depends on COMMON_CLK_MT8196 + default COMMON_CLK_MT8196 + help + This driver supports MediaTek MT8196 mdpsys clocks. + config COMMON_CLK_MT8196_PEXTPSYS tristate "Clock driver for MediaTek MT8196 pextpsys" depends on COMMON_CLK_MT8196drivers/clk/mediatek/Makefile +1
-0@@ -155,6 +155,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o clk-mt8196-peri_ao.o obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o +obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.odrivers/clk/mediatek/clk-mt8196-mdpsys.c new file +32
-0@@ -0,0 +1,186 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) 2025 MediaTek Inc. +* Guangjie Song <[email protected]> +* Copyright (c) 2025 Collabora Ltd. +* Laura Nao <[email protected]> +*/ +#include <dt-bindings/clock/mediatek,mt8196-clock.h> + +#include <linux/clk-provider.h> +#include <linux/module.h> +#include <linux/of_device.h> +#include <linux/platform_device.h> + +#include "clk-gate.h" +#include "clk-mtk.h" + +static const struct mtk_gate_regs mdp0_cg_regs = { + .set_ofs =0x104 , + .clr_ofs =0x108 , + .sta_ofs =0x100 , +}; + +static const struct mtk_gate_regs mdp1_cg_regs = { + .set_ofs =0x114 , + .clr_ofs =0x118 , + .sta_ofs =0x110 , +}; + +static const struct mtk_gate_regs mdp2_cg_regs = { + .set_ofs =0x124 , + .clr_ofs =0x128 ,drivers/clk/mediatek/clk-mt8196-mdpsys.c line 42
Quoted 10 lines
drivers/clk/mediatek/clk-mt8196-mdpsys.c new file +10
-0+ .sta_ofs = 0x120, +}; + +#define GATE_MDP0 (_id, _name, _parent, _shift) { \ + .id = _id, \ + .name = _name, \ + .parent_name = _parent, \ + .regs = &mdp0_cg_regs, \ + .shift = _shift, \ + .flags = CLK_OPS_PARENT_ENABLE, \Why would MDP0 and MDP2 be different, as in why would MDP1 be so special to not need
CLK_OPS_PARENT_ENABLEwhile the others do?Either they all do, or they all don't.
Quoted 7 lines
I guess they all don't, but I'm not sure how you tested that at all, since the only way to test this is downstream (and upstream will very likely be different from that).
Even though I think they don't need that - please add back
CLK_OPS_PARENT_ENABLEtoGATE_MDP1to be safe, as in (all) MediaTek SoCs the multimedia subsystem is kinda separate from the rest.That kind of doesn't fly since the parent of
mdp_f26mis clk26m, not the mdp clock. So either this block doesn't need a clock for register access or this clock is going to be broken.This is why I raised the question about the validity of the flag in the first place.
Quoted 1 line
+
GATE_MDP1(CLK_MDP_F26M, "mdp_f26m", "clk26m", 27),
Quoted 8 lines
Quoted 5 lines
Once MT8196 MDP support is upstreamed, we will be able to run a number of tests to evaluate whether this flag is really needed or not.
After all, if it turns out we can remove it, it's going to be a 3 lines patch, not a big deal.
That also works. Though IMO it makes the error harder to notice.
Okay, I understand your point.
Let's keep CLK_OPS_PARENT_ENABLE out of MDP1.
Cheers,
Angelo
PATCH v5 20/27 clk: mediatek: Add MT8196 mfg clock support
In reply to Laura NaoAdd support for the MT8196 mfg clock controller, which provides PLL control for the GPU.
--- drivers/clk/mediatek/Kconfig | 7 ++ drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8196-mfg.c | 150 ++++++++++++++++++++++++++ 3 files changed, 158 insertions(+) create mode 100644 drivers/clk/mediatek/clk-mt8196-mfg.c
drivers/clk/mediatek/Kconfig +7 -0
@@ -1031,6 +1031,13 @@ config COMMON_CLK_MT8196_MDPSYS help This driver supports MediaTek MT8196 mdpsys clocks. +config COMMON_CLK_MT8196_MFGCFG + tristate "Clock driver for MediaTek MT8196 mfgcfg" + depends on COMMON_CLK_MT8196 + default m + help + This driver supports MediaTek MT8196 mfgcfg clocks. + config COMMON_CLK_MT8196_PEXTPSYS tristate "Clock driver for MediaTek MT8196 pextpsys" depends on COMMON_CLK_MT8196
drivers/clk/mediatek/Makefile +1 -0
@@ -156,6 +156,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196) += clk-mt8196-apmixedsys.o clk-mt8196-topckgen.o obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o +obj-$(CONFIG_COMMON_CLK_MT8196_MFGCFG) += clk-mt8196-mfg.o obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
drivers/clk/mediatek/clk-mt8196-mfg.c new file +150 -0
150 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH v5 21/27 clk: mediatek: Add MT8196 disp0 clock support
In reply to Laura NaoAdd support for the MT8196 disp0 clock controller, which provides clock gate control for the display system. It is integrated with the mtk-mmsys driver, which registers the disp0 clock driver via platform_device_register_data().
--- drivers/clk/mediatek/Kconfig | 7 + drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8196-disp0.c | 170 ++++++++++++++++++++++++ 3 files changed, 178 insertions(+) create mode 100644 drivers/clk/mediatek/clk-mt8196-disp0.c
drivers/clk/mediatek/Kconfig +7 -0
@@ -1038,6 +1038,13 @@ config COMMON_CLK_MT8196_MFGCFG help This driver supports MediaTek MT8196 mfgcfg clocks. +config COMMON_CLK_MT8196_MMSYS + tristate "Clock driver for MediaTek MT8196 mmsys" + depends on COMMON_CLK_MT8196 + default m + help + This driver supports MediaTek MT8196 mmsys clocks. + config COMMON_CLK_MT8196_PEXTPSYS tristate "Clock driver for MediaTek MT8196 pextpsys" depends on COMMON_CLK_MT8196
drivers/clk/mediatek/Makefile +1 -0
@@ -157,6 +157,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o obj-$(CONFIG_COMMON_CLK_MT8196_MFGCFG) += clk-mt8196-mfg.o +obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
drivers/clk/mediatek/clk-mt8196-disp0.c new file +170 -0
170 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH v5 22/27 clk: mediatek: Add MT8196 disp1 clock support
In reply to Laura NaoAdd 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
@@ -157,7 +157,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o obj-$(CONFIG_COMMON_CLK_MT8196_MFGCFG) += clk-mt8196-mfg.o -obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o +obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk-mt8196-disp1.o obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
drivers/clk/mediatek/clk-mt8196-disp1.c new file +170 -0
170 lines not on this page · raw message
Signature · 1 line
2.39.5
Re: [PATCH v5 22/27] clk: mediatek: Add MT8196 disp1 clock support
Quoted 7 lines · 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().Signed-off-by Laura Nao <[email protected]>
IMO removing CLK_OPS_PARENT_ENABLE is the right thing to do.
However if the hardware ends up does having a requirement that _some_ clock be enabled before touching the registers, then I think the MTK clock library needs to be refactored, so that a register access clock can be tied to the regmap. That might also require some work on the syscon API.
Whether the hardware needs such a clock or not, we would need some input from MediaTek. There's nothing in the datasheet on this.
Re: [PATCH v5 22/27] clk: mediatek: Add MT8196 disp1 clock support
In reply to Laura NaoIl 29/08/25 11:19, Laura Nao ha scritto:
Quoted 6 lines
Add support for the MT8196 disp1 clock controller, which provides clock gate control for the display system. It is integrated with the mtk-mmsys driver, which registers the disp1 clock driver via
platform_device_register_data().Signed-off-by Laura Nao <[email protected]>
PATCH v5 23/27 clk: mediatek: Add MT8196 disp-ao clock support
In reply to Laura NaoAdd support for the MT8196 disp-ao clock controller, which provides clock gate control for the display system. It is integrated with the mtk-mmsys driver, which registers the disp-ao clock driver via platform_device_register_data().
--- drivers/clk/mediatek/Makefile | 2 +- drivers/clk/mediatek/clk-mt8196-vdisp_ao.c | 80 ++++++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/mediatek/clk-mt8196-vdisp_ao.c
drivers/clk/mediatek/Makefile +1 -1
@@ -157,7 +157,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o obj-$(CONFIG_COMMON_CLK_MT8196_MFGCFG) += clk-mt8196-mfg.o -obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk-mt8196-disp1.o +obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk-mt8196-disp1.o clk-mt8196-vdisp_ao.o obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
drivers/clk/mediatek/clk-mt8196-vdisp_ao.c new file +80 -0
80 lines not on this page · raw message
Signature · 1 line
2.39.5
Re: [PATCH v5 23/27] clk: mediatek: Add MT8196 disp-ao clock support
Quoted 108 lines · 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().Reviewed-by Nícolas F. R. A. Prado <[email protected]>Reviewed-by AngeloGioacchino Del RegnoSigned-off-by Laura Nao <[email protected]>---
drivers/clk/mediatek/Makefile | 2 +-drivers/clk/mediatek/clk-mt8196-vdisp_ao.c| 80
++++++++++++++++++++++2 files changed, 81 insertions(+), 1 deletion(-)create mode 100644
drivers/clk/mediatek/clk-mt8196-vdisp_ao.cdrivers/clk/mediatek/Makefile +0
-0@@ -157,7 +157,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) +=clk-mt8196-imp_iic_wrap.o obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o obj-$(CONFIG_COMMON_CLK_MT8196_MFGCFG) += clk-mt8196-mfg.o -obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk- mt8196-disp1.o
+obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk- mt8196-disp1.o clk-mt8196-vdisp_ao.o obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk- mt8365.odrivers/clk/mediatek/clk-mt8196-vdisp_ao.c new file +53
-0@@ -0,0 +1,80 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) 2025 MediaTek Inc. +* Guangjie Song <[email protected]> +* Copyright (c) 2025 Collabora Ltd. +* Laura Nao <[email protected]> +*/ +#include <dt-bindings/clock/mediatek,mt8196-clock.h> + +#include <linux/clk-provider.h> +#include <linux/module.h> +#include <linux/of_device.h> +#include <linux/platform_device.h> + +#include "clk-gate.h" +#include "clk-mtk.h" + +static const struct mtk_gate_regs mm_v_cg_regs = { + .set_ofs =0x104 , + .clr_ofs =0x108 , + .sta_ofs =0x100 , +}; + +static const struct mtk_gate_regs mm_v_hwv_regs = { + .set_ofs =0x0030 , + .clr_ofs =0x0034 , + .sta_ofs =0x2c18 , +}; + +#define GATE_MM_AO_V (_id, _name, _parent, _shift) { \ + .id = _id, \ + .name = _name, \ + .parent_name = _parent, \ + .regs = &mm_v_cg_regs, \ + .shift = _shift, \ + .ops = &mtk_clk_gate_ops_setclr, \ + .flags = CLK_OPS_PARENT_ENABLE | \ + CLK_IS_CRITICAL, \ + } + +#define GATE_HWV_MM_V (_id, _name, _parent, _shift) { \ + .id = _id, \ + .name = _name, \ + .parent_name = _parent, \ + .regs = &mm_v_cg_regs, \ + .hwv_regs = &mm_v_hwv_regs, \ + .shift = _shift, \ + .ops = &mtk_clk_gate_hwv_ops_setclr, \ + .flags = CLK_OPS_PARENT_ENABLE, \ + } + +static const struct mtk_gate mm_v_clks[] = { + GATE_HWV_MM_V(CLK_MM_V_DISP_VDISP_AO_CONFIG,"
mm_v_disp_vdisp_ao_config", "disp", 0),drivers/clk/mediatek/clk-mt8196-vdisp_ao.c new file +1
-0+ GATE_HWV_MM_V(CLK_MM_V_DISP_DPC, "mm_v_disp_dpc", "disp",16),
drivers/clk/mediatek/clk-mt8196-vdisp_ao.c new file +1
-0+ GATE_MM_AO_V(CLK_MM_V_SMI_SUB_SOMM0, "mm_v_smi_sub_somm0","disp", 2),
drivers/clk/mediatek/clk-mt8196-vdisp_ao.c new file +9
-0+}; + +static const struct mtk_clk_desc mm_v_mcd = { + .clks = mm_v_clks, + .num_clks =ARRAY_SIZE (mm_v_clks), +}; + +static const struct of_device_id of_match_clk_mt8196_vdisp_ao[] = { + { .compatible = "mediatek,mt8196-vdisp-ao", .data =
Quoted 1 line
&mm_v_mcd},
Hi Laura,
We are going to send mtk-mmsys driver for MT8196 recently, but we found the compatible name is used here.
As your commit message, vdisp-ao is integrated with the mtk-mmsys driver, which registers the vdisp-ao clock driver via platform_device_register_data().
Shouldn't this compatible name belong to mmsys driver for MT8196?
drivers/clk/mediatek/clk-mt8196-vdisp_ao.c line 74
Quoted 10 lines
drivers/clk/mediatek/clk-mt8196-vdisp_ao.c new file +10
-0+ {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, of_match_clk_mt8196_vdisp_ao); + +static struct platform_driver clk_mt8196_vdisp_ao_drv = { + .probe = mtk_clk_pdev_probe, + .remove = mtk_clk_pdev_remove, + .driver = { + .name ="clk-mt8196-vdisp-ao" , + .of_match_table = of_match_clk_mt8196_vdisp_ao,
In clk-mt8196-ovl0/ovl1/disp0/disp1.c, they use .id_table instead of .of_match_table here. Shouldn't this align to them?
Regards,
Jason-JH Lin
Quoted 6 lines
drivers/clk/mediatek/clk-mt8196-vdisp_ao.c new file +6
-0+ }, +}; +module_platform_driver (clk_mt8196_vdisp_ao_drv); + +MODULE_DESCRIPTION ("MediaTek MT8196 vdisp_ao clocks driver" ); +MODULE_LICENSE ("GPL" );
Re: [PATCH v5 23/27] clk: mediatek: Add MT8196 disp-ao clock support
Hi Jason-JH,
Quoted 113 lines · Jason-JH Lin (林睿祥)
Quoted 108 lines · 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().Reviewed-by Nícolas F. R. A. Prado <[email protected]>Reviewed-by AngeloGioacchino Del RegnoSigned-off-by Laura Nao <[email protected]>--- drivers/clk/mediatek/Makefile | 2 +- drivers/clk/mediatek/clk-mt8196-vdisp_ao.c | 80 ++++++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/mediatek/clk-mt8196-vdisp_ao.cdrivers/clk/mediatek/Makefile +0
-0@@ -157,7 +157,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) +=clk-mt8196-imp_iic_wrap.o
obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o obj-$(CONFIG_COMMON_CLK_MT8196_MFGCFG) += clk-mt8196-mfg.o
-obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk- mt8196-disp1.o
+obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk- mt8196-disp1.o clk-mt8196-vdisp_ao.o
obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-
mt8365.odrivers/clk/mediatek/clk-mt8196-vdisp_ao.c new file +53
-0@@ -0,0 +1,80 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) 2025 MediaTek Inc. +* Guangjie Song <[email protected]> +* Copyright (c) 2025 Collabora Ltd. +* Laura Nao <[email protected]> +*/ +#include <dt-bindings/clock/mediatek,mt8196-clock.h> + +#include <linux/clk-provider.h> +#include <linux/module.h> +#include <linux/of_device.h> +#include <linux/platform_device.h> + +#include "clk-gate.h" +#include "clk-mtk.h" + +static const struct mtk_gate_regs mm_v_cg_regs = { + .set_ofs =0x104 , + .clr_ofs =0x108 , + .sta_ofs =0x100 , +}; + +static const struct mtk_gate_regs mm_v_hwv_regs = { + .set_ofs =0x0030 , + .clr_ofs =0x0034 , + .sta_ofs =0x2c18 , +}; + +#define GATE_MM_AO_V (_id, _name, _parent, _shift) { \ + .id = _id, \ + .name = _name, \ + .parent_name = _parent, \ + .regs = &mm_v_cg_regs, \ + .shift = _shift, \ + .ops = &mtk_clk_gate_ops_setclr, \ + .flags = CLK_OPS_PARENT_ENABLE | \ + CLK_IS_CRITICAL, \ + } + +#define GATE_HWV_MM_V (_id, _name, _parent, _shift) { \ + .id = _id, \ + .name = _name, \ + .parent_name = _parent, \ + .regs = &mm_v_cg_regs, \ + .hwv_regs = &mm_v_hwv_regs, \ + .shift = _shift, \ + .ops = &mtk_clk_gate_hwv_ops_setclr, \ + .flags = CLK_OPS_PARENT_ENABLE, \ + } + +static const struct mtk_gate mm_v_clks[] = { + GATE_HWV_MM_V(CLK_MM_V_DISP_VDISP_AO_CONFIG,"
mm_v_disp_vdisp_ao_config", "disp", 0),drivers/clk/mediatek/clk-mt8196-vdisp_ao.c new file +1
-0+ GATE_HWV_MM_V(CLK_MM_V_DISP_DPC, "mm_v_disp_dpc", "disp",16),
drivers/clk/mediatek/clk-mt8196-vdisp_ao.c new file +1
-0+ GATE_MM_AO_V(CLK_MM_V_SMI_SUB_SOMM0, "mm_v_smi_sub_somm0","disp", 2),
drivers/clk/mediatek/clk-mt8196-vdisp_ao.c new file +9
-0+}; + +static const struct mtk_clk_desc mm_v_mcd = { + .clks = mm_v_clks, + .num_clks =ARRAY_SIZE (mm_v_clks), +}; + +static const struct of_device_id of_match_clk_mt8196_vdisp_ao[] = { + { .compatible = "mediatek,mt8196-vdisp-ao", .data =Quoted 1 line
&mm_v_mcd},Hi Laura,
Quoted 9 lines
We are going to send mtk-mmsys driver for MT8196 recently, but we found the compatible name is used here.
As your commit message, vdisp-ao is integrated with the mtk-mmsys driver, which registers the vdisp-ao clock driver via
platform_device_register_data().Shouldn't this compatible name belong to mmsys driver for MT8196?
That's right, my fault for missing that! Thanks for the heads up.
I'm aware Angelo is currently restructuring mediatek-drm (including mmsys and mutex), and that might affect the way vdisp-ao is loaded too. So I'm not sure whether it makes sense to send a patch to fix this right away.
Best,
Laura
Re: [PATCH v5 23/27] clk: mediatek: Add MT8196 disp-ao clock support
[snip]
Quoted 18 lines
Quoted 11 lines
Quoted 4 lines
+static const struct
of_device_idof_match_clk_mt8196_vdisp_ao[] = {(quoted diff) +1
-0+ { .compatible = "mediatek,mt8196-vdisp-ao", .data =
&mm_v_mcd},Hi Laura,
We are going to send mtk-mmsys driver for MT8196 recently, but we found
the compatible name is used here.Quoted 6 lines
As your commit message, vdisp-ao is integrated with the mtk-mmsys driver, which registers the vdisp-ao clock driver via
platform_device_register_data().Shouldn't this compatible name belong to mmsys driver for MT8196?
Quoted 7 lines
That's right, my fault for missing that! Thanks for the heads up.
I'm aware Angelo is currently restructuring mediatek-drm (including mmsys and mutex), and that might affect the way vdisp-ao is loaded too.
So I'm not sure whether it makes sense to send a patch to fix this right away.
OK, we'll try to contact Angelo from other places. Thanks for your confirmation!
Regards,
Jason-JH.Lin
Quoted 5 lines
Best,
Laura
A message that is not in the archive (sent off-list or not yet received): CAHCN7x+K25H-QWLDA6SoGSzxv9koO0wFOrjfWNePc+0AfjCVZg@mail.gmail.com
Re: [PATCH v5 23/27] clk: mediatek: Add MT8196 disp-ao clock support
Quoted 1 line
[snip]
Quoted 38 lines
Quoted 33 lines
Quoted 24 lines
Quoted 13 lines
Quoted 5 lines
+static const struct
of_device_idof_match_clk_mt8196_vdisp_ao[]
= {
+ { .compatible = "mediatek,mt8196-vdisp-ao", .data =&mm_v_mcd},Hi Laura,
We are going to send mtk-mmsys driver for MT8196 recently, but we
found
the compatible name is used here.Quoted 8 lines
As your commit message, vdisp-ao is integrated with the mtk- mmsys
driver, which registers the vdisp-ao clock driver viaplatform_device_register_data().Shouldn't this compatible name belong to mmsys driver for MT8196?
That's right, my fault for missing that! Thanks for the heads up.
Quoted 8 lines
I'm aware Angelo is currently restructuring mediatek-drm (including
mmsys and mutex), and that might affect the way vdisp-ao is loaded
too.
So I'm not sure whether it makes sense to send a patch to fix this
right away.Quoted 3 lines
OK, we'll try to contact Angelo from other places. Thanks for your confirmation!
Quoted 7 lines
If anyone wants me to test anything, I have a Chromebook with the mt8196 that I can test code, so feel free to CC me on anything that you want tested. I'd love to see this stuff pushed upstream.
thanks
adam
Hi Adam,
However, we still need some more time to discuss and refactor this. We'll send the new patch if necessary.
Thank you for your help!
Regards,
Jason-JH Lin
Quoted 10 lines
Quoted 10 lines
Regards,
Jason-JH.LinQuoted 5 lines
Best,
Laura
PATCH v5 24/27 clk: mediatek: Add MT8196 ovl0 clock support
In reply to Laura NaoAdd 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
@@ -157,7 +157,8 @@ obj-$(CONFIG_COMMON_CLK_MT8196_IMP_IIC_WRAP) += clk-mt8196-imp_iic_wrap.o obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o obj-$(CONFIG_COMMON_CLK_MT8196_MFGCFG) += clk-mt8196-mfg.o -obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk-mt8196-disp1.o clk-mt8196-vdisp_ao.o +obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk-mt8196-disp1.o clk-mt8196-vdisp_ao.o \ + clk-mt8196-ovl0.o obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
drivers/clk/mediatek/clk-mt8196-ovl0.c new file +154 -0
154 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH v5 25/27 clk: mediatek: Add MT8196 ovl1 clock support
In reply to Laura NaoAdd support for the MT8196 ovl1 clock controller, which provides clock gate control for the display system. It is integrated with the mtk-mmsys driver, which registers the ovl1 clock driver via platform_device_register_data().
--- drivers/clk/mediatek/Makefile | 2 +- drivers/clk/mediatek/clk-mt8196-ovl1.c | 154 +++++++++++++++++++++++++ 2 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/mediatek/clk-mt8196-ovl1.c
drivers/clk/mediatek/Makefile +1 -1
@@ -158,7 +158,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196_MCUSYS) += clk-mt8196-mcu.o obj-$(CONFIG_COMMON_CLK_MT8196_MDPSYS) += clk-mt8196-mdpsys.o obj-$(CONFIG_COMMON_CLK_MT8196_MFGCFG) += clk-mt8196-mfg.o obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk-mt8196-disp1.o clk-mt8196-vdisp_ao.o \ - clk-mt8196-ovl0.o + clk-mt8196-ovl0.o clk-mt8196-ovl1.o obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
drivers/clk/mediatek/clk-mt8196-ovl1.c new file +154 -0
154 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH v5 26/27 clk: mediatek: Add MT8196 vdecsys clock support
In reply to Laura NaoAdd 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
@@ -1059,6 +1059,13 @@ config COMMON_CLK_MT8196_UFSSYS help This driver supports MediaTek MT8196 ufssys clocks. +config COMMON_CLK_MT8196_VDECSYS + tristate "Clock driver for MediaTek MT8196 vdecsys" + depends on COMMON_CLK_MT8196 + default m + help + This driver supports MediaTek MT8196 vdecsys clocks. + config COMMON_CLK_MT8365 tristate "Clock driver for MediaTek MT8365" depends on ARCH_MEDIATEK || COMPILE_TEST
drivers/clk/mediatek/Makefile +1 -0
@@ -161,6 +161,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk-mt8196-disp1.o c clk-mt8196-ovl0.o clk-mt8196-ovl1.o obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o +obj-$(CONFIG_COMMON_CLK_MT8196_VDECSYS) += clk-mt8196-vdec.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.o
drivers/clk/mediatek/clk-mt8196-vdec.c new file +253 -0
253 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH v5 27/27 clk: mediatek: Add MT8196 vencsys clock support
In reply to Laura NaoAdd support for the MT8196 vencsys clock controller, which provides clock gate control for the video encoder.
--- drivers/clk/mediatek/Kconfig | 7 + drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8196-venc.c | 236 +++++++++++++++++++++++++ 3 files changed, 244 insertions(+) create mode 100644 drivers/clk/mediatek/clk-mt8196-venc.c
drivers/clk/mediatek/Kconfig +7 -0
@@ -1066,6 +1066,13 @@ config COMMON_CLK_MT8196_VDECSYS help This driver supports MediaTek MT8196 vdecsys clocks. +config COMMON_CLK_MT8196_VENCSYS + tristate "Clock driver for MediaTek MT8196 vencsys" + depends on COMMON_CLK_MT8196 + default m + help + This driver supports MediaTek MT8196 vencsys clocks. + config COMMON_CLK_MT8365 tristate "Clock driver for MediaTek MT8365" depends on ARCH_MEDIATEK || COMPILE_TEST
drivers/clk/mediatek/Makefile +1 -0
@@ -162,6 +162,7 @@ obj-$(CONFIG_COMMON_CLK_MT8196_MMSYS) += clk-mt8196-disp0.o clk-mt8196-disp1.o c obj-$(CONFIG_COMMON_CLK_MT8196_PEXTPSYS) += clk-mt8196-pextp.o obj-$(CONFIG_COMMON_CLK_MT8196_UFSSYS) += clk-mt8196-ufs_ao.o obj-$(CONFIG_COMMON_CLK_MT8196_VDECSYS) += clk-mt8196-vdec.o +obj-$(CONFIG_COMMON_CLK_MT8196_VENCSYS) += clk-mt8196-venc.o obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.o
drivers/clk/mediatek/clk-mt8196-venc.c new file +236 -0
236 lines not on this page · raw message
Signature · 1 line
2.39.5