MT8189: Add support for system and base clock controllers
Subsystems (6)
v4 cover MT8189: Add support for system and base clock controllers
This series is a continuation by AngeloGioacchino Del Regno and I of a previous series ([1]), that adds the clock controller support for the Mediatek MT8189 SoC and its variants (MT8371, MT8391).
The first major changes is the split of the series in two:
- one for all basic clock controllers including system ones (this series)
- one for the multimedia and graphics related clock controllers (to be send in the future)
We chose to separate the multimedia clock drivers from the base system ones, as there is currently an unsolvable inter-dependency between the power domains and multimedia clocks; the power domains need a dual-stage bring-up, where only a part of the multimedia clocks are accessible in the first power domain powerup stage, and the rest when the second stage (SRAM enablement) is done.
The current workarounds for this issue, such as removing the is_enabled operation from the impacted clock controllers clk_ops table or let the multimedia power domain always on, were quickly discarded for upstream.
The second major change is the dt-bindings patch ([2]) that got heavily reworked, not only because of the split choice. We took the opportunity to regroup in the MT8186 clock and system clock dt-bindings the description of several other Mediatek SoC (MT8188, MT8192 and MT8195) and add in them the MT8189 new ones.
The rationale is to ease maintainability and have common files for several currently supported SoC or new future ones, that have the same kind of clock controller design.
Finally the pending remarks from peer reviews on the v6 revision of [1] were also taken into account and new fixes and cleanups were also added.
A more detailed changelog between [1] and this series:
- Removed multimedia and graphics related clock controllers code and definitions from series
- Added new dt-bindings patches to factorise existing MT8188, MT8192 and MT8195 in MT8186 clock dt-bindings
- Heavily modified the MT8189 dt-bindings to add new compatibles in MT8186 clock dt-bindings
- Created a new dt-bindings include for the MT8189 reset controller definitions (include/dt-bindings/reset/mediatek,mt8189-resets.h)
- Removed unnecessary syscon compatible fallback from MT8189 base clock controllers
- Added missing 'mediatek,mt8189-fhctl' compatible declaration in dt-bindings
- Modified Kconfig to COMMON_CLK_MT8189 be tristate (and not bool) to allow all MT8189 clock controller drivers to be built as modules (it was partial)
- Fix pll unregisters in clk_mt8189_apmixed_probe error case
- Reparent several clocks to correct 26M references in clk-mt8189-bus.c, clk-mt8189-topckgen.c and clk-mt8189-vlpckgen.c
- Removed CLK_SET_RATE_NO_REPARENT flag from mfg_sel_mfgpll
- Rename TOPCKGEN_fmipi_csi_up26m clock to fmipi_csi_up26m to remove caps usage
- Implemented reset controllers in clk-mt8189-ufs.c
- Updated all file headers to update copyrights and add all authors
- Added all co-developed-by trailers
The series is based on linux-next tree (tag: next-20260728) and has been tested on Mediatek Genio 520-EVK (MT8371) and 720-EVK (MT8391) boards, with hardware enablement patch series ([3]), and on Genio 510-EVK (MT8370, variant of MT8188) and Genio 1200-EVK (MT8395, variant of MT8195).
[1]: https://lore.kernel.org/linux-mediatek/[email protected]/
[2]: https://lore.kernel.org/linux-mediatek/[email protected]/
[3]: https://lore.kernel.org/linux-mediatek/20260701-add-mediatek-genio-520-720-evk-v2-0-19d5da4ef984@collabora.com/
---
Changes in v4:
- Rebased on next-20260728 tag
- Added patches 9 to 14 to add new clock ops data set for PLL and
PLL-FHCTL to handle a new PLL switch logic for PLL control and BAR
reset, supported by MT8189 SoC
- Patch 15:
- Removed useless includes (B. Masney)
- Fixed variable declaration order in clk_mt8189_apmixed_probe (B.
Masney)
- Added missing pwr_reg setting setting in PLL_SETCLR macro (B.
Masney, Sashiko)
- Added en_set_reg, en_clr_reg, rst_bar_reg, rst_bar_set_reg and
rst_bar_clr_reg fixed offsets and new mtk_pll_setclr_ops ops
setting in PLL_SETCLR macro
- Added pwr_reg offset values in apmixed_plls array
- Fixed rst_bar_mask for mainpll univpll, and mmpll in apmixed_plls
array to match rst_bar set/clr reg settings
- Fixed factor ratio for mainpll_d4_d8, tvdpll1_d16, tvdpll2_d16 and
osc_d16 clocks (Sashiko)
- Link to v3: https://lore.kernel.org/r/20260720-mt8189-clocks-system-base-v3-0-8e6d99ab3ad2@collabora.com
Changes in v3:
- Rebased on next-20260717 tag
- Added Fixes tags to patches 1, 2 and 3
- Reworded patch 8 subject and description messages
- Updated Reviewed-by and Acked-by trailers
- Link to v2: https://lore.kernel.org/r/20260709-mt8189-clocks-system-base-v2-0-2926da3db6cf@collabora.com
Changes in v2:
- Rebased on next-20260708 tag
- Added patch 1,2 and 3 to make the #clock-cells a required property in
MT8186, MT8192 and MT8195 clock controller dt-bindings
- Patch 5:
- Removed conditional blocks to check clock-cells property presence
for MT8188 clock controller compatible
- Reworded commit message to remove the note (no more applicable)
- Fixed incorrect property value in else block for #reset-cells
property check.
_ Removed from patch 9 conditional blocks to check clock-cells property
presence for MT8189 clock controller compatible
- Fixed missing MODULE_DEVICE_TABLE in patches 10, 11 and 12.
- Added devicetree series link in cover letter
- Link to v1: https://lore.kernel.org/r/20260701-mt8189-clocks-system-base-v1-0-2b048feea50a@collabora.com
---
Louis-Alexis Eyraud (24):
dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8186
dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8192
dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8195
dt-bindings: clock: mediatek: reorder MT8186 compatibles
dt-bindings: clock: mediatek: regroup MT8188 dt-bindings into MT8186
dt-bindings: clock: mediatek: regroup MT8192 dt-bindings into MT8186
dt-bindings: clock: mediatek: regroup MT8195 dt-bindings into MT8186
dt-bindings: clock: mediatek: Add MT8189 system/base clocks and resets
clk: mediatek: Harmonize mtk_pll_fenc related symbol names
clk: mediatek: pll: Add BAR reset register offsets
clk: mediatek: pll: split default prepare/unprepare callbacks
clk: mediatek: pll: Add ops for PLLs using set/clr regs
clk: mediatek: pllfh: Add configurable clock ops to mtk_pllfh_data
clk: mediatek: pllfh: Add ops for PLLs using set/clr regs
clk: mediatek: Add MT8189 apmixedsys clock support
clk: mediatek: Add MT8189 topckgen clock support
clk: mediatek: Add MT8189 vlpckgen clock support
clk: mediatek: Add MT8189 vlpcfg clock support
clk: mediatek: Add MT8189 bus clock support
clk: mediatek: Add MT8189 dbgao clock support
clk: mediatek: Add MT8189 dvfsrc clock support
clk: mediatek: Add MT8189 i2c clock support
clk: mediatek: Add MT8189 scp clock support
clk: mediatek: Add MT8189 ufs clock support
.../bindings/clock/mediatek,mt8186-clock.yaml | 128 ++- .../bindings/clock/mediatek,mt8186-fhctl.yaml | 1 + .../bindings/clock/mediatek,mt8186-sys-clock.yaml | 24 +- .../bindings/clock/mediatek,mt8188-clock.yaml | 93 -- .../bindings/clock/mediatek,mt8188-sys-clock.yaml | 58 -- .../bindings/clock/mediatek,mt8192-clock.yaml | 191 ---- .../bindings/clock/mediatek,mt8192-sys-clock.yaml | 68 -- .../bindings/clock/mediatek,mt8195-clock.yaml | 238 ----- .../bindings/clock/mediatek,mt8195-sys-clock.yaml | 76 -- drivers/clk/mediatek/Kconfig | 79 ++ drivers/clk/mediatek/Makefile | 8 + drivers/clk/mediatek/clk-mt8189-apmixedsys.c | 203 ++++ drivers/clk/mediatek/clk-mt8189-bus.c | 200 ++++ drivers/clk/mediatek/clk-mt8189-dbgao.c | 98 ++ drivers/clk/mediatek/clk-mt8189-dvfsrc.c | 58 ++ drivers/clk/mediatek/clk-mt8189-iic.c | 122 +++ drivers/clk/mediatek/clk-mt8189-scp.c | 77 ++ drivers/clk/mediatek/clk-mt8189-topckgen.c | 1025 ++++++++++++++++++++ drivers/clk/mediatek/clk-mt8189-ufs.c | 133 +++ drivers/clk/mediatek/clk-mt8189-vlpcfg.c | 116 +++ drivers/clk/mediatek/clk-mt8189-vlpckgen.c | 285 ++++++ drivers/clk/mediatek/clk-mt8196-apmixedsys.c | 2 +- drivers/clk/mediatek/clk-mt8196-vlpckgen.c | 2 +- drivers/clk/mediatek/clk-pll.c | 135 ++- drivers/clk/mediatek/clk-pll.h | 13 +- drivers/clk/mediatek/clk-pllfh.c | 15 +- drivers/clk/mediatek/clk-pllfh.h | 3 + include/dt-bindings/clock/mediatek,mt8189-clk.h | 433 +++++++++ include/dt-bindings/reset/mediatek,mt8189-resets.h | 17 + 29 files changed, 3135 insertions(+), 766 deletions(-)
---
base-commit: bbda95765d148ddea2f3876bb09aadd741cf3316
change-id: 20260630-mt8189-clocks-system-base-70714e4ff2aa
Best regards,
Signature · 1 line
Louis-Alexis Eyraud <[email protected]>
PATCH v4 1/24 dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8186
Both MT8186 clock controllers dt-bindings (clock and sys-clock) document the '#clock-cells' property but do not enforce it as required property.
As clock provider nodes should define this property in devicetrees, add it to the required property list in both its dt-bindings files.
--- Documentation/devicetree/bindings/clock/mediatek,mt8186-clock.yaml | 1 + Documentation/devicetree/bindings/clock/mediatek,mt8186-sys-clock.yaml | 1 + 2 files changed, 2 insertions(+)
Documentation/devicetree/bindings/clock/mediatek,mt8186-clock.yaml +1 -0
@@ -44,6 +44,7 @@ properties: required: - compatible - reg + - '#clock-cells' additionalProperties: false
Documentation/devicetree/bindings/clock/mediatek,mt8186-sys-clock.yaml +1 -0
@@ -45,6 +45,7 @@ properties: required: - compatible - reg + - '#clock-cells' additionalProperties: false
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH v4 01/24] dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8186
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Medium] The #reset-cells property is defined in the schema but is not conditionally enforced as a required property for the mediatek,mt8186-infracfg_ao hardware variant, which acts as a reset provider. This is a direct violation of the Device Tree Bindings Subsystem Guidelines ('Hardware Variant Required Properties'). --
--- Patch [1]: [PATCH v4 01/24] dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8186 --- commit d082742287ef7b48509a30300eb93b62072332ca
Author: Louis-Alexis Eyraud <[email protected]>
dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8186
This commit adds '#clock-cells' to the required properties list for both the MT8186 clock and sys-clock device tree bindings. This enforces that clock provider nodes properly define this property during validation.
[ ... ]
Documentation/devicetree/bindings/clock/mediatek,mt8186-sys-clock.yaml properties: · line 48
Quoted 9 lines
Documentation/devicetree/bindings/clock/mediatek,mt8186-sys-clock.yaml +1
-0@@ -45,6 +45,7 @@ properties: required: - compatible - reg + - '#clock-cells'
[Severity: Medium]
This is a pre-existing issue, but while we are updating the required properties here, should the schema also conditionally enforce '#reset-cells' for the mediatek,mt8186-infracfg_ao variant?
The '#reset-cells' property is defined in the schema but lacks an
allOf: if-then block to conditionally enforce it specifically for the mediatek,mt8186-infracfg_ao hardware variant, which acts as a reset provider.
Without this enforcement, device trees configuring the mediatek,mt8186-infracfg_ao variant but omitting the mandatory '#reset-cells' property will silently pass schema validation when running dt_binding_check.
Quoted 2 lines
Documentation/devicetree/bindings/clock/mediatek,mt8186-sys-clock.yaml +0
-0additionalProperties: false
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/20260729-mt8189-clocks-system-base-v4-0-e356b813a64c@collabora.com?part=1
PATCH v4 2/24 dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8192
In reply to Louis-Alexis EyraudBoth MT8192 clock controllers dt-bindings (clock and sys-clock) document the '#clock-cells' property but do not enforce it as required property.
As clock provider nodes should define this property in devicetrees, add it to the required property list in both its dt-bindings files.
--- Documentation/devicetree/bindings/clock/mediatek,mt8192-clock.yaml | 1 + Documentation/devicetree/bindings/clock/mediatek,mt8192-sys-clock.yaml | 1 + 2 files changed, 2 insertions(+)
Documentation/devicetree/bindings/clock/mediatek,mt8192-clock.yaml +1 -0
@@ -46,6 +46,7 @@ properties: required: - compatible - reg + - '#clock-cells' additionalProperties: false
Documentation/devicetree/bindings/clock/mediatek,mt8192-sys-clock.yaml +1 -0
@@ -35,6 +35,7 @@ properties: required: - compatible - reg + - '#clock-cells' additionalProperties: false
Signature · 1 line
2.55.0
PATCH v4 3/24 dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8195
In reply to Louis-Alexis EyraudBoth MT8195 clock controllers dt-bindings (clock and sys-clock) document the '#clock-cells' property but do not enforce it as required property.
As clock provider nodes should define this property in devicetrees, add it to the required property list in both its dt-bindings files.
--- Documentation/devicetree/bindings/clock/mediatek,mt8195-clock.yaml | 1 + Documentation/devicetree/bindings/clock/mediatek,mt8195-sys-clock.yaml | 1 + 2 files changed, 2 insertions(+)
Documentation/devicetree/bindings/clock/mediatek,mt8195-clock.yaml +1 -0
@@ -58,6 +58,7 @@ properties: required: - compatible - reg + - '#clock-cells' additionalProperties: false
Documentation/devicetree/bindings/clock/mediatek,mt8195-sys-clock.yaml +1 -0
@@ -43,6 +43,7 @@ properties: required: - compatible - reg + - '#clock-cells' additionalProperties: false
Signature · 1 line
2.55.0
PATCH v4 4/24 dt-bindings: clock: mediatek: reorder MT8186 compatibles
In reply to Louis-Alexis EyraudIn order to prepare regrouping several Mediatek SoC clock controller dt-bindings files into the MT8186 ones, reorder the MT8186 clock controller compatibles so they are sorted alphanumerically.
--- .../bindings/clock/mediatek,mt8186-clock.yaml | 17 +++++++++-------- .../bindings/clock/mediatek,mt8186-sys-clock.yaml | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-)
Documentation/devicetree/bindings/clock/mediatek,mt8186-clock.yaml +9 -8
@@ -23,18 +23,19 @@ properties: compatible: items: - enum: - - mediatek,mt8186-imp_iic_wrap - - mediatek,mt8186-mfgsys - - mediatek,mt8186-wpesys - - mediatek,mt8186-imgsys1 - - mediatek,mt8186-imgsys2 - - mediatek,mt8186-vdecsys - - mediatek,mt8186-vencsys - mediatek,mt8186-camsys - mediatek,mt8186-camsys_rawa - mediatek,mt8186-camsys_rawb - - mediatek,mt8186-mdpsys + - mediatek,mt8186-imgsys1 + - mediatek,mt8186-imgsys2 + - mediatek,mt8186-imp_iic_wrap - mediatek,mt8186-ipesys + - mediatek,mt8186-mdpsys + - mediatek,mt8186-mfgsys + - mediatek,mt8186-vdecsys + - mediatek,mt8186-vencsys + - mediatek,mt8186-wpesys + reg: maxItems: 1
Documentation/devicetree/bindings/clock/mediatek,mt8186-sys-clock.yaml +2 -2
@@ -27,10 +27,10 @@ properties: compatible: items: - enum: + - mediatek,mt8186-apmixedsys + - mediatek,mt8186-infracfg_ao - mediatek,mt8186-mcusys - mediatek,mt8186-topckgen - - mediatek,mt8186-infracfg_ao - - mediatek,mt8186-apmixedsys - const: syscon reg:
Signature · 1 line
2.55.0
PATCH v4 5/24 dt-bindings: clock: mediatek: regroup MT8188 dt-bindings into MT8186
In reply to Louis-Alexis EyraudRegroup the MT8188 clock and system clock dt-bindings into MT8186 ones to ease maintainability and have common files for several currently supported SoC or new future ones, that have the same kind of clock controller design.
--- .../bindings/clock/mediatek,mt8186-clock.yaml | 50 +++++++++++- .../bindings/clock/mediatek,mt8186-sys-clock.yaml | 6 +- .../bindings/clock/mediatek,mt8188-clock.yaml | 93 ---------------------- .../bindings/clock/mediatek,mt8188-sys-clock.yaml | 58 -------------- 4 files changed, 54 insertions(+), 153 deletions(-)
Documentation/devicetree/bindings/clock/mediatek,mt8186-clock.yaml +49 -1
@@ -4,7 +4,7 @@ $id: http://devicetree.org/schemas/clock/mediatek,mt8186-clock.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: MediaTek Functional Clock Controller for MT8186 +title: MediaTek Functional Clock Controller for Mediatek SoCs maintainers: - Chun-Jie Chen <[email protected]>
@@ -35,6 +35,29 @@ properties: - mediatek,mt8186-vdecsys - mediatek,mt8186-vencsys - mediatek,mt8186-wpesys + - mediatek,mt8188-adsp-audio26m + - mediatek,mt8188-camsys + - mediatek,mt8188-camsys-rawa + - mediatek,mt8188-camsys-rawb + - mediatek,mt8188-camsys-yuva + - mediatek,mt8188-camsys-yuvb + - mediatek,mt8188-ccusys + - mediatek,mt8188-imgsys + - mediatek,mt8188-imgsys-wpe1 + - mediatek,mt8188-imgsys-wpe2 + - mediatek,mt8188-imgsys-wpe3 + - mediatek,mt8188-imgsys1-dip-nr + - mediatek,mt8188-imgsys1-dip-top + - mediatek,mt8188-imp-iic-wrap-c + - mediatek,mt8188-imp-iic-wrap-en + - mediatek,mt8188-imp-iic-wrap-w + - mediatek,mt8188-ipesys + - mediatek,mt8188-mfgcfg + - mediatek,mt8188-vdecsys + - mediatek,mt8188-vdecsys-soc + - mediatek,mt8188-vencsys + - mediatek,mt8188-wpesys + - mediatek,mt8188-wpesys-vpp0 reg: maxItems: 1
@@ -42,11 +65,36 @@ properties: '#clock-cells': const: 1 + '#reset-cells': + const: 1 + required: - compatible - reg - '#clock-cells' +allOf: + - if: + properties: + compatible: + enum: + - mediatek,mt8188-camsys-rawa + - mediatek,mt8188-camsys-rawb + - mediatek,mt8188-camsys-yuva + - mediatek,mt8188-camsys-yuvb + - mediatek,mt8188-imgsys-wpe1 + - mediatek,mt8188-imgsys-wpe2 + - mediatek,mt8188-imgsys-wpe3 + - mediatek,mt8188-imgsys1-dip-nr + - mediatek,mt8188-imgsys1-dip-top + - mediatek,mt8188-ipesys + then: + required: + - '#reset-cells' + else: + properties: + '#reset-cells': false + additionalProperties: false examples:
Documentation/devicetree/bindings/clock/mediatek,mt8186-sys-clock.yaml +5 -1
@@ -4,7 +4,7 @@ $id: http://devicetree.org/schemas/clock/mediatek,mt8186-sys-clock.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: MediaTek System Clock Controller for MT8186 +title: MediaTek System Clock Controller for Mediatek SoCs maintainers: - Chun-Jie Chen <[email protected]>
@@ -31,6 +31,10 @@ properties: - mediatek,mt8186-infracfg_ao - mediatek,mt8186-mcusys - mediatek,mt8186-topckgen + - mediatek,mt8188-apmixedsys + - mediatek,mt8188-infracfg-ao + - mediatek,mt8188-pericfg-ao + - mediatek,mt8188-topckgen - const: syscon reg:
Documentation/devicetree/bindings/clock/mediatek,mt8188-clock.yaml deleted +0 -93
93 lines not on this page · raw message
Documentation/devicetree/bindings/clock/mediatek,mt8188-sys-clock.yaml deleted +0 -58
58 lines not on this page · raw message
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH v4 05/24] dt-bindings: clock: mediatek: regroup MT8188 dt-bindings into MT8186
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The `if` condition in `mediatek,mt8186-clock.yaml` incorrectly evaluates the `compatible` array…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The if condition in mediatek,mt8186-clock.yaml incorrectly evaluates the compatible array using a scalar enum without the contains: keyword, breaking schema validation. --
--- Patch [5]: [PATCH v4 05/24] dt-bindings: clock: mediatek: regroup MT8188 dt-bindings into MT8186 --- commit 1f0ad49080ff837b778f75346bbaeb49fc6d7fee
Author: Louis-Alexis Eyraud <[email protected]>
dt-bindings: clock: mediatek: regroup MT8188 dt-bindings into MT8186
This commit regroups the MT8188 clock and system clock dt-bindings into the MT8186 schema to ease maintainability. It merges the configurations into a common file for SoCs that share the same kind of clock controller design.
Quoted 3 lines
Documentation/devicetree/bindings/clock/mediatek,mt8186-clock.yaml +0
-0
[ ... ]
Quoted 11 lines
Documentation/devicetree/bindings/clock/mediatek,mt8186-clock.yaml +11
-0+allOf: + - if: + properties: + compatible: + enum: + - mediatek,mt8188-camsys-rawa + - mediatek,mt8188-camsys-rawb + - mediatek,mt8188-camsys-yuva + - mediatek,mt8188-camsys-yuvb + - mediatek,mt8188-imgsys-wpe1 + - mediatek,mt8188-imgsys-wpe2
Documentation/devicetree/bindings/clock/mediatek,mt8186-clock.yaml properties: · line 96
Quoted 10 lines
Documentation/devicetree/bindings/clock/mediatek,mt8186-clock.yaml +10
-0+ - mediatek,mt8188-imgsys-wpe3 + - mediatek,mt8188-imgsys1-dip-nr + - mediatek,mt8188-imgsys1-dip-top + - mediatek,mt8188-ipesys + then: + required: + - '#reset-cells' + else: + properties: + '#reset-cells': false
[Severity: Medium]
Does this compatible match need to be wrapped in a "contains:" keyword?
In dt-schema, the compatible property is evaluated as an array. Testing it directly against a scalar enum without "contains:" means this condition will always fail to match.
Consequently, the else block will unconditionally evaluate and force '#reset-cells': false on all MT8188 nodes, including those that actually require the property. Could this cause valid device trees to falsely fail dtbs_check validation?
Looking at the deleted mediatek,mt8188-clock.yaml file in this patch, the original schema correctly used:
compatible:
contains:
enum:
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/20260729-mt8189-clocks-system-base-v4-0-e356b813a64c@collabora.com?part=5
PATCH v4 6/24 dt-bindings: clock: mediatek: regroup MT8192 dt-bindings into MT8186
In reply to Louis-Alexis EyraudRegroup the MT8192 clock and system clock dt-bindings into MT8186 ones to ease maintainability and have common files for several currently supported SoC or new future ones, that have the same kind of clock controller design.
--- .../bindings/clock/mediatek,mt8186-clock.yaml | 20 +++ .../bindings/clock/mediatek,mt8186-sys-clock.yaml | 4 + .../bindings/clock/mediatek,mt8192-clock.yaml | 192 --------------------- .../bindings/clock/mediatek,mt8192-sys-clock.yaml | 69 -------- 4 files changed, 24 insertions(+), 261 deletions(-)
Documentation/devicetree/bindings/clock/mediatek,mt8186-clock.yaml +20 -0
@@ -58,6 +58,26 @@ properties: - mediatek,mt8188-vencsys - mediatek,mt8188-wpesys - mediatek,mt8188-wpesys-vpp0 + - mediatek,mt8192-camsys + - mediatek,mt8192-camsys_rawa + - mediatek,mt8192-camsys_rawb + - mediatek,mt8192-camsys_rawc + - mediatek,mt8192-imgsys + - mediatek,mt8192-imgsys2 + - mediatek,mt8192-imp_iic_wrap_c + - mediatek,mt8192-imp_iic_wrap_e + - mediatek,mt8192-imp_iic_wrap_s + - mediatek,mt8192-imp_iic_wrap_ws + - mediatek,mt8192-imp_iic_wrap_w + - mediatek,mt8192-imp_iic_wrap_n + - mediatek,mt8192-ipesys + - mediatek,mt8192-mdpsys + - mediatek,mt8192-mfgcfg + - mediatek,mt8192-msdc_top + - mediatek,mt8192-scp_adsp + - mediatek,mt8192-vdecsys_soc + - mediatek,mt8192-vdecsys + - mediatek,mt8192-vencsys reg: maxItems: 1
Documentation/devicetree/bindings/clock/mediatek,mt8186-sys-clock.yaml +4 -0
@@ -35,6 +35,10 @@ properties: - mediatek,mt8188-infracfg-ao - mediatek,mt8188-pericfg-ao - mediatek,mt8188-topckgen + - mediatek,mt8192-apmixedsys + - mediatek,mt8192-infracfg + - mediatek,mt8192-pericfg + - mediatek,mt8192-topckgen - const: syscon reg:
Documentation/devicetree/bindings/clock/mediatek,mt8192-clock.yaml deleted +0 -192
192 lines not on this page · raw message
Documentation/devicetree/bindings/clock/mediatek,mt8192-sys-clock.yaml deleted +0 -69
69 lines not on this page · raw message
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH v4 06/24] dt-bindings: clock: mediatek: regroup MT8192 dt-bindings into MT8186
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The `allOf` `if-then` block incorrectly uses `enum` directly under `compatible`, failing to…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The allOf if-then block incorrectly uses enum directly under compatible, failing to match device tree array values. --
--- Patch [6]: [PATCH v4 06/24] dt-bindings: clock: mediatek: regroup MT8192 dt-bindings into MT8186 --- commit f258fa892abdda9fb25c70a8dc0f201865aac7ab
Author: Louis-Alexis Eyraud <[email protected]>
dt-bindings: clock: mediatek: regroup MT8192 dt-bindings into MT8186
This commit consolidates the MT8192 functional clock and system clock device tree bindings into the existing MT8186 bindings to ease maintainability. The dedicated MT8192 YAML files are removed, and their compatible strings are added to the MT8186 schema properties.
Quoted 21 lines
Documentation/devicetree/bindings/clock/mediatek,mt8186-clock.yaml +13
-0@@ -58,6 +58,26 @@ properties: - mediatek,mt8188-vencsys - mediatek,mt8188-wpesys - mediatek,mt8188-wpesys-vpp0 + - mediatek,mt8192-camsys + - mediatek,mt8192-camsys_rawa + - mediatek,mt8192-camsys_rawb + - mediatek,mt8192-camsys_rawc + - mediatek,mt8192-imgsys + - mediatek,mt8192-imgsys2 + - mediatek,mt8192-imp_iic_wrap_c + - mediatek,mt8192-imp_iic_wrap_e + - mediatek,mt8192-imp_iic_wrap_s + - mediatek,mt8192-imp_iic_wrap_ws + - mediatek,mt8192-imp_iic_wrap_w + - mediatek,mt8192-imp_iic_wrap_n + - mediatek,mt8192-ipesys
Documentation/devicetree/bindings/clock/mediatek,mt8186-clock.yaml properties: · line 83
Quoted 10 lines
Documentation/devicetree/bindings/clock/mediatek,mt8186-clock.yaml +7
-0+ - mediatek,mt8192-mdpsys + - mediatek,mt8192-mfgcfg + - mediatek,mt8192-msdc_top + - mediatek,mt8192-scp_adsp + - mediatek,mt8192-vdecsys_soc + - mediatek,mt8192-vdecsys + - mediatek,mt8192-vencsys reg: maxItems: 1
[Severity: Medium]
In the same file under the allOf if-then block, the compatible match uses enum directly instead of contains:
allOf:
- if:
properties:
compatible:
enum:
- mediatek,mt8188-camsys-rawa
Because the compatible property evaluates as an array in device tree schema, applying JSON schema's enum directly against the array will fail to match the string scalar values.
Should this be updated to use contains: enum: so that the constraints correctly apply to these compatible strings during validation?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/20260729-mt8189-clocks-system-base-v4-0-e356b813a64c@collabora.com?part=6
PATCH v4 7/24 dt-bindings: clock: mediatek: regroup MT8195 dt-bindings into MT8186
In reply to Louis-Alexis EyraudRegroup the MT8195 clock and system clock dt-bindings into MT8186 ones to ease maintainability and have common files for several currently supported SoC or new future ones, that have the same kind of clock controller design.
--- .../bindings/clock/mediatek,mt8186-clock.yaml | 25 +++ .../bindings/clock/mediatek,mt8186-sys-clock.yaml | 4 + .../bindings/clock/mediatek,mt8195-clock.yaml | 239 --------------------- .../bindings/clock/mediatek,mt8195-sys-clock.yaml | 77 ------- 4 files changed, 29 insertions(+), 316 deletions(-)
Documentation/devicetree/bindings/clock/mediatek,mt8186-clock.yaml +25 -0
@@ -78,6 +78,31 @@ properties: - mediatek,mt8192-vdecsys_soc - mediatek,mt8192-vdecsys - mediatek,mt8192-vencsys + - mediatek,mt8195-apusys_pll + - mediatek,mt8195-camsys + - mediatek,mt8195-camsys_rawa + - mediatek,mt8195-camsys_yuva + - mediatek,mt8195-camsys_rawb + - mediatek,mt8195-camsys_yuvb + - mediatek,mt8195-camsys_mraw + - mediatek,mt8195-ccusys + - mediatek,mt8195-imgsys + - mediatek,mt8195-imgsys1_dip_top + - mediatek,mt8195-imgsys1_dip_nr + - mediatek,mt8195-imgsys1_wpe + - mediatek,mt8195-imp_iic_wrap_s + - mediatek,mt8195-imp_iic_wrap_w + - mediatek,mt8195-ipesys + - mediatek,mt8195-mfgcfg + - mediatek,mt8195-scp_adsp + - mediatek,mt8195-vdecsys_soc + - mediatek,mt8195-vdecsys + - mediatek,mt8195-vdecsys_core1 + - mediatek,mt8195-vencsys + - mediatek,mt8195-vencsys_core1 + - mediatek,mt8195-wpesys + - mediatek,mt8195-wpesys_vpp0 + - mediatek,mt8195-wpesys_vpp1 reg: maxItems: 1
Documentation/devicetree/bindings/clock/mediatek,mt8186-sys-clock.yaml +4 -0
@@ -39,6 +39,10 @@ properties: - mediatek,mt8192-infracfg - mediatek,mt8192-pericfg - mediatek,mt8192-topckgen + - mediatek,mt8195-apmixedsys + - mediatek,mt8195-infracfg_ao + - mediatek,mt8195-pericfg_ao + - mediatek,mt8195-topckgen - const: syscon reg:
Documentation/devicetree/bindings/clock/mediatek,mt8195-clock.yaml deleted +0 -239
239 lines not on this page · raw message
Documentation/devicetree/bindings/clock/mediatek,mt8195-sys-clock.yaml deleted +0 -77
77 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v4 8/24 dt-bindings: clock: mediatek: Add MT8189 system/base clocks and resets
In reply to Louis-Alexis EyraudAdd compatible and binding headers files for system and base clock controllers and reset controllers support of MediaTek MT8189 SoC. The MT8189 clock IP provide clock control for main system (apmixedsys, topcksys and vlpcksys) and subsys (eg. peri, scp, ufs...).
Also, add compatible for frequency hopping and spread spectrum clock functionality.
--- .../bindings/clock/mediatek,mt8186-clock.yaml | 15 + .../bindings/clock/mediatek,mt8186-fhctl.yaml | 1 + .../bindings/clock/mediatek,mt8186-sys-clock.yaml | 5 + include/dt-bindings/clock/mediatek,mt8189-clk.h | 433 +++++++++++++++++++++ include/dt-bindings/reset/mediatek,mt8189-resets.h | 17 + 5 files changed, 471 insertions(+)
Documentation/devicetree/bindings/clock/mediatek,mt8186-clock.yaml +15 -0
@@ -58,6 +58,19 @@ properties: - mediatek,mt8188-vencsys - mediatek,mt8188-wpesys - mediatek,mt8188-wpesys-vpp0 + - mediatek,mt8189-dbg-ao + - mediatek,mt8189-dem + - mediatek,mt8189-dvfsrc-top + - mediatek,mt8189-iic-wrap-e + - mediatek,mt8189-iic-wrap-en + - mediatek,mt8189-iic-wrap-s + - mediatek,mt8189-iic-wrap-ws + - mediatek,mt8189-scp-clk + - mediatek,mt8189-scp-i2c-clk + - mediatek,mt8189-ufscfg-ao + - mediatek,mt8189-ufscfg-pdn + - mediatek,mt8189-vlpcfg + - mediatek,mt8189-vlpcfg-ao - mediatek,mt8192-camsys - mediatek,mt8192-camsys_rawa - mediatek,mt8192-camsys_rawb
@@ -133,6 +146,8 @@ allOf: - mediatek,mt8188-imgsys1-dip-nr - mediatek,mt8188-imgsys1-dip-top - mediatek,mt8188-ipesys + - mediatek,mt8189-ufscfg-ao + - mediatek,mt8189-ufscfg-pdn then: required: - '#reset-cells'
Documentation/devicetree/bindings/clock/mediatek,mt8186-fhctl.yaml +1 -0
@@ -20,6 +20,7 @@ properties: - mediatek,mt6795-fhctl - mediatek,mt8173-fhctl - mediatek,mt8186-fhctl + - mediatek,mt8189-fhctl - mediatek,mt8192-fhctl - mediatek,mt8195-fhctl
Documentation/devicetree/bindings/clock/mediatek,mt8186-sys-clock.yaml +5 -0
@@ -35,6 +35,11 @@ properties: - mediatek,mt8188-infracfg-ao - mediatek,mt8188-pericfg-ao - mediatek,mt8188-topckgen + - mediatek,mt8189-apmixedsys + - mediatek,mt8189-infra-ao + - mediatek,mt8189-peri-ao + - mediatek,mt8189-topckgen + - mediatek,mt8189-vlpckgen - mediatek,mt8192-apmixedsys - mediatek,mt8192-infracfg - mediatek,mt8192-pericfg
include/dt-bindings/clock/mediatek,mt8189-clk.h new file +433 -0
433 lines not on this page · raw message
include/dt-bindings/reset/mediatek,mt8189-resets.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* +* Copyright (c) 2026 Collabora Ltd. +* Author: Louis-Alexis Eyraud <[email protected]> +*/ + +#ifndef _DT_BINDINGS_RESET_CONTROLLER_MT8189 +#define _DT_BINDINGS_RESET_CONTROLLER_MT8189 + +/* UFS resets */ +#define MT8189_UFSAO_RST_UFS_MPHY 0 + +#define MT8189_UFSPDN_RST_UFS_UNIPRO 0 +#define MT8189_UFSPDN_RST_UFS_CRYPTO 1 +#define MT8189_UFSPDN_RST_UFS_HCI 2 + +#endif /* _DT_BINDINGS_RESET_CONTROLLER_MT8189 */
Signature · 1 line
2.55.0
PATCH v4 9/24 clk: mediatek: Harmonize mtk_pll_fenc related symbol names
In reply to Louis-Alexis EyraudTo prepare for the new clock ops set addition, with support for set/clr enable logic only, rename mtk_pll_fenc_setclr_ops and its callback names to harmonize the naming with the same suffix.
--- drivers/clk/mediatek/clk-mt8196-apmixedsys.c | 2 +- drivers/clk/mediatek/clk-mt8196-vlpckgen.c | 2 +- drivers/clk/mediatek/clk-pll.c | 16 ++++++++-------- drivers/clk/mediatek/clk-pll.h | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-)
drivers/clk/mediatek/clk-mt8196-apmixedsys.c +1 -1
@@ -83,7 +83,7 @@ .en_set_reg = PLLEN_ALL_SET, \ .en_clr_reg = PLLEN_ALL_CLR, \ .pll_en_bit = _pll_en_bit, \ - .ops = &mtk_pll_fenc_clr_set_ops, \ + .ops = &mtk_pll_fenc_setclr_ops, \ }struct mtk_pll_desc {
drivers/clk/mediatek/clk-mt8196-vlpckgen.c +1 -1
@@ -162,7 +162,7 @@ .en_set_reg = VLP_PLLEN_ALL_SET, \ .en_clr_reg = VLP_PLLEN_ALL_CLR, \ .pll_en_bit = _pll_en_bit, \ - .ops = &mtk_pll_fenc_clr_set_ops, \ + .ops = &mtk_pll_fenc_setclr_ops, \ }static DEFINE_SPINLOCK (mt8196_clk_vlp_lock);
drivers/clk/mediatek/clk-pll.c +8 -8
@@ -38,7 +38,7 @@ 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) +static int mtk_pll_is_prepared_fenc_setclr (struct clk_hw *hw) {struct mtk_clk_pll *pll =to_mtk_clk_pll (hw);
@@ -285,7 +285,7 @@ void mtk_pll_unprepare(struct clk_hw *hw)writel (r, pll->pwr_addr); } -static int mtk_pll_prepare_setclr (struct clk_hw *hw) +static int mtk_pll_prepare_fenc_setclr (struct clk_hw *hw) {struct mtk_clk_pll *pll =to_mtk_clk_pll (hw);
@@ -297,7 +297,7 @@ static int mtk_pll_prepare_setclr(struct clk_hw *hw)return 0 ; } -static void mtk_pll_unprepare_setclr (struct clk_hw *hw) +static void mtk_pll_unprepare_fenc_setclr (struct clk_hw *hw) {struct mtk_clk_pll *pll =to_mtk_clk_pll (hw);
@@ -313,15 +313,15 @@ 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, +const struct clk_ops mtk_pll_fenc_setclr_ops = { + .is_prepared = mtk_pll_is_prepared_fenc_setclr, + .prepare = mtk_pll_prepare_fenc_setclr, + .unprepare = mtk_pll_unprepare_fenc_setclr, .recalc_rate = mtk_pll_recalc_rate, .determine_rate = mtk_pll_determine_rate, .set_rate = mtk_pll_set_rate, }; -EXPORT_SYMBOL_GPL (mtk_pll_fenc_clr_set_ops); +EXPORT_SYMBOL_GPL (mtk_pll_fenc_setclr_ops); struct clk_hw *mtk_clk_register_pll_ops(struct mtk_clk_pll *pll, const struct mtk_pll_data *data,
drivers/clk/mediatek/clk-pll.h +1 -1
@@ -85,7 +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; +extern const struct clk_ops mtk_pll_fenc_setclr_ops;static inline struct mtk_clk_pll *to_mtk_clk_pll (struct clk_hw *hw) {
Signature · 1 line
2.55.0
PATCH v4 10/24 clk: mediatek: pll: Add BAR reset register offsets
In reply to Louis-Alexis EyraudCurrently, the register offset to handle BAR reset, for PLLs that support it, is hardcoded to CON0.
On MT8189 SoC, there are separate status, set and clr registers to handle this, so differents offsets are needed.
Add the new fields for offsets and addresses to the MTK PLL data structure and modify mtk_clk_register_pll_ops function to compute the new register addresses so they are available for clock operation usage.
Also, replace reset BAR address computing by its computed address from MTK PLL data structure in prepare/unprepare callbacks.
--- drivers/clk/mediatek/clk-pll.c | 18 ++++++++++++++---- drivers/clk/mediatek/clk-pll.h | 6 ++++++ 2 files changed, 20 insertions(+), 4 deletions(-)
drivers/clk/mediatek/clk-pll.c +14 -4
@@ -249,9 +249,9 @@ int mtk_pll_prepare(struct clk_hw *hw)udelay (20 );if (pll->data->flags &HAVE_RST_BAR ) { - r =readl (pll->base_addr +REG_CON0 ); + r =readl (pll->rst_bar_addr); r |= pll->data->rst_bar_mask; -writel (r, pll->base_addr +REG_CON0 ); +writel (r, pll->rst_bar_addr); }return 0 ;
@@ -263,9 +263,9 @@ void mtk_pll_unprepare(struct clk_hw *hw)u32 r;if (pll->data->flags &HAVE_RST_BAR ) { - r =readl (pll->base_addr +REG_CON0 ); + r =readl (pll->rst_bar_addr); r &= ~pll->data->rst_bar_mask; -writel (r, pll->base_addr +REG_CON0 ); +writel (r, pll->rst_bar_addr); }__mtk_pll_tuner_disable (pll);
@@ -352,6 +352,16 @@ struct clk_hw *mtk_clk_register_pll_ops(struct mtk_clk_pll *pll, pll->en_set_addr = base + data->en_set_reg;if (data->en_clr_reg) pll->en_clr_addr = base + data->en_clr_reg; + +if (data->rst_bar_reg) + pll->rst_bar_addr = base + data->rst_bar_reg; +else + pll->rst_bar_addr = pll->base_addr +REG_CON0 ; +if (data->rst_bar_set_reg) + pll->rst_bar_set_addr = base + data->rst_bar_set_reg; +if (data->rst_bar_clr_reg) + pll->rst_bar_clr_addr = base + data->rst_bar_clr_reg; + pll->hw.init = &init; pll->data = data;
drivers/clk/mediatek/clk-pll.h +6 -0
@@ -49,6 +49,9 @@ struct mtk_pll_data {u32 en_reg;u32 en_set_reg;u32 en_clr_reg; +u32 rst_bar_reg; +u32 rst_bar_set_reg; +u32 rst_bar_clr_reg;u8 pll_en_bit;/* Assume 0, indicates BIT(0) by default */ u8 pcw_chg_bit;u8 fenc_sta_bit;
@@ -75,6 +78,9 @@ struct mtk_clk_pll {void __iomem *en_set_addr;void __iomem *en_clr_addr;void __iomem *fenc_addr; +void __iomem *rst_bar_addr; +void __iomem *rst_bar_set_addr; +void __iomem *rst_bar_clr_addr;const struct mtk_pll_data *data; };
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH v4 10/24] clk: mediatek: pll: Add BAR reset register offsets
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Medium] The newly added set and clear registers for the BAR reset (rst_bar_set_addr, rst_bar_clr_addr) are computed but never used in the prepare/unprepare callbacks.
Pre-existing issues:
- [High] The error handling rollback in mtk_clk_register_plls() blindly unregisters and frees clocks it previously skipped, leading to Use-After-Free and heap corruption. --
--- Patch [10]: [PATCH v4 10/24] clk: mediatek: pll: Add BAR reset register offsets --- commit 32dac933eac13088132963fe76e93c2f164b2862
Author: Louis-Alexis Eyraud <[email protected]>
clk: mediatek: pll: Add BAR reset register offsets
Currently, the register offset to handle BAR reset, for PLLs that support it, is hardcoded to CON0. On MT8189 SoC, there are separate status, set and clr registers to handle this, so differents offsets are needed.
drivers/clk/mediatek/clk-pll.c int mtk_pll_prepare(struct clk_hw *hw) · line 254
Quoted 13 lines
drivers/clk/mediatek/clk-pll.c +2
-2@@ -249,9 +249,9 @@ int mtk_pll_prepare(struct clk_hw *hw)udelay (20 );if (pll->data->flags &HAVE_RST_BAR ) { - r =readl (pll->base_addr +REG_CON0 ); + r =readl (pll->rst_bar_addr); r |= pll->data->rst_bar_mask; -writel (r, pll->base_addr +REG_CON0 ); +writel (r, pll->rst_bar_addr);
[Severity: Medium]
Will this fail to correctly assert the hardware reset BAR on the MT8189 SoC?
The newly added rst_bar_set_addr is computed in mtk_clk_register_pll_ops(), but it is never used here. Is it intended to write to the dedicated set register when it exists, rather than performing a read-modify-write on rst_bar_addr?
drivers/clk/mediatek/clk-pll.c void mtk_pll_unprepare(struct clk_hw *hw) · line 268
Quoted 12 lines
drivers/clk/mediatek/clk-pll.c +2
-2}return 0 ;@@ -263,9 +263,9 @@ void mtk_pll_unprepare(struct clk_hw *hw)u32 r;if (pll->data->flags &HAVE_RST_BAR ) { - r =readl (pll->base_addr +REG_CON0 ); + r =readl (pll->rst_bar_addr); r &= ~pll->data->rst_bar_mask; -writel (r, pll->base_addr +REG_CON0 ); +writel (r, pll->rst_bar_addr);
[Severity: Medium]
Similar to mtk_pll_prepare(), should this be writing to the newly added rst_bar_clr_addr instead of read-modify-writing rst_bar_addr?
Quoted 3 lines
drivers/clk/mediatek/clk-pll.c +0
-0}__mtk_pll_tuner_disable (pll);
[ ... ]
Quoted 4 lines
int mtk_clk_register_plls(struct device *dev,
const structmtk_pll_data*plls, intnum_plls, structclk_hw_onecell_data*clk_data)
{
[ ... ]
Quoted 8 lines
for (i = 0; i < num_plls; i++) {
const struct mtk_pll_data *pll = &plls[i];
if (!IS_ERR_OR_NULL(clk_data->hws[pll->id])) {
pr_warn("%pOF: Trying to register duplicate clock ID: %d\n",
dev->of_node, pll->id);
continue;
}[ ... ]
Quoted 7 lines
return 0;err:
while (--i >= 0) { const struct mtk_pll_data *pll = &plls[i]; mtk_clk_unregister_pll(clk_data->hws[pll->id]);
[Severity: High]
This isn't a bug introduced by this patch, but does this error handling rollback cause a use-after-free and memory corruption?
If the registration loop encounters a duplicate clock ID and skips it using continue, a subsequent failure in the array will trigger this rollback loop.
The rollback loop unconditionally unregisters clocks for all indices less than the failing index i. This will cause kfree() to be called on a clock object that was skipped by this function and passed in from elsewhere, destroying an actively used resource.
Should the rollback loop verify that the clock was actually registered by this function before unregistering it?
Quoted 4 lines
clk_data->hws[pll->id] = ERR_PTR(-ENOENT); } iounmap(base);
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/20260729-mt8189-clocks-system-base-v4-0-e356b813a64c@collabora.com?part=10
PATCH v4 11/24 clk: mediatek: pll: split default prepare/unprepare callbacks
In reply to Louis-Alexis EyraudIn order to prepare the MT8189 SoC support, that requires different registers to control PLL status and perform reset BAR, and so a different sets of clock operations, split both mtk_pll_prepare and mtk_pll_unprepare into several private subfunctions to factorize the common code.
--- drivers/clk/mediatek/clk-pll.c | 61 ++++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 20 deletions(-)
drivers/clk/mediatek/clk-pll.c +41 -20
@@ -31,6 +31,8 @@/* default 7 bits integer, can be overridden with pcwibits. */ #define INTEGER_BITS 7 +#define PLL_STABILIZATION_DELAY 20/* in us */ +int mtk_pll_is_prepared (struct clk_hw *hw) {struct mtk_clk_pll *pll =to_mtk_clk_pll (hw);
@@ -223,9 +225,9 @@ int mtk_pll_determine_rate(struct clk_hw *hw, struct clk_rate_request *req)return 0 ; } -int mtk_pll_prepare (struct clk_hw *hw) +static void mtk_pll_prepare_common (struct mtk_clk_pll *pll, +void __iomem *en_addr) { -struct mtk_clk_pll *pll =to_mtk_clk_pll (hw);u32 r; r =readl (pll->pwr_addr) |CON0_PWR_ON ;
@@ -236,8 +238,8 @@ int mtk_pll_prepare(struct clk_hw *hw)writel (r, pll->pwr_addr);udelay (1 ); - r =readl (pll->en_addr) |BIT (pll->data->pll_en_bit); -writel (r, pll->en_addr); + r =readl (en_addr) |BIT (pll->data->pll_en_bit); +writel (r, en_addr);if (pll->data->en_mask) { r =readl (pll->base_addr +REG_CON0 ) | pll->data->en_mask;
@@ -246,7 +248,37 @@ int mtk_pll_prepare(struct clk_hw *hw)__mtk_pll_tuner_enable (pll); -udelay (20 ); +udelay (PLL_STABILIZATION_DELAY ); +} + +static void mtk_pll_unprepare_common (struct mtk_clk_pll *pll, +void __iomem *en_addr) +{ +u32 r; + +__mtk_pll_tuner_disable (pll); + +if (pll->data->en_mask) { + r =readl (pll->base_addr +REG_CON0 ) & ~pll->data->en_mask; +writel (r, pll->base_addr +REG_CON0 ); + } + + r =readl (en_addr) & ~BIT (pll->data->pll_en_bit); +writel (r, en_addr); + + r =readl (pll->pwr_addr) |CON0_ISO_EN ; +writel (r, pll->pwr_addr); + + r =readl (pll->pwr_addr) & ~CON0_PWR_ON ; +writel (r, pll->pwr_addr); +} + +int mtk_pll_prepare (struct clk_hw *hw) +{ +struct mtk_clk_pll *pll =to_mtk_clk_pll (hw); +u32 r; + +mtk_pll_prepare_common (pll, pll->en_addr);if (pll->data->flags &HAVE_RST_BAR ) { r =readl (pll->rst_bar_addr);
@@ -256,6 +288,7 @@ int mtk_pll_prepare(struct clk_hw *hw)return 0 ; } +EXPORT_SYMBOL_GPL (mtk_pll_prepare);void mtk_pll_unprepare (struct clk_hw *hw) {
@@ -268,22 +301,9 @@ void mtk_pll_unprepare(struct clk_hw *hw)writel (r, pll->rst_bar_addr); } -__mtk_pll_tuner_disable (pll); - -if (pll->data->en_mask) { - r =readl (pll->base_addr +REG_CON0 ) & ~pll->data->en_mask; -writel (r, pll->base_addr +REG_CON0 ); - } - - r =readl (pll->en_addr) & ~BIT (pll->data->pll_en_bit); -writel (r, pll->en_addr); - - r =readl (pll->pwr_addr) |CON0_ISO_EN ; -writel (r, pll->pwr_addr); - - r =readl (pll->pwr_addr) & ~CON0_PWR_ON ; -writel (r, pll->pwr_addr); +mtk_pll_unprepare_common (pll, pll->en_addr); } +EXPORT_SYMBOL_GPL (mtk_pll_unprepare);static int mtk_pll_prepare_fenc_setclr (struct clk_hw *hw) {
@@ -312,6 +332,7 @@ const struct clk_ops mtk_pll_ops = { .determine_rate = mtk_pll_determine_rate, .set_rate = mtk_pll_set_rate, }; +EXPORT_SYMBOL_GPL (mtk_pll_ops);const struct clk_ops mtk_pll_fenc_setclr_ops = { .is_prepared = mtk_pll_is_prepared_fenc_setclr,
Signature · 1 line
2.55.0
PATCH v4 12/24 clk: mediatek: pll: Add ops for PLLs using set/clr regs
In reply to Louis-Alexis EyraudMT8189 SoC uses a new combination of status and set/clr registers to control its PLL power state and perform BAR reset, that are different than the current default clock prepare/unprepare operations are using.
Add new set of PLL clock operations to support this logic that relies on the following registers for prepare/unprepare operations:
- en/en_set/en_clr, rather than pwr register, for PLL power control
- rst_bar/rst_bar_set/rst_bar_clr, rather than default rst_bar register for BAR reset control
Also, handle rst_bar register setting/clearing with a timeout, to verify the operation was correctly performed.
--- drivers/clk/mediatek/clk-pll.c | 54 ++++++++++++++++++++++++++++++++++++++++++ drivers/clk/mediatek/clk-pll.h | 5 ++++ 2 files changed, 59 insertions(+)
drivers/clk/mediatek/clk-pll.c +54 -0
@@ -9,6 +9,7 @@#include <linux/delay.h> #include <linux/err.h> #include <linux/io.h> +#include <linux/iopoll.h> #include <linux/module.h> #include <linux/of_address.h> #include <linux/platform_device.h>
@@ -32,6 +33,7 @@#define INTEGER_BITS 7#define PLL_STABILIZATION_DELAY 20/* in us */ +#define RST_BAR_TIMEOUT 20/* in us */ int mtk_pll_is_prepared (struct clk_hw *hw) {
@@ -305,6 +307,48 @@ void mtk_pll_unprepare(struct clk_hw *hw) }EXPORT_SYMBOL_GPL (mtk_pll_unprepare); +int mtk_pll_prepare_setclr (struct clk_hw *hw) +{ +struct mtk_clk_pll *pll =to_mtk_clk_pll (hw); +u32 val =0 ; +int ret; + +mtk_pll_prepare_common (pll, pll->en_set_addr); + +if (pll->data->flags &HAVE_RST_BAR ) { +writel (pll->data->rst_bar_mask, pll->rst_bar_set_addr); + + ret =readl_poll_timeout (pll->rst_bar_addr, val, + (val & pll->data->rst_bar_mask),1 , +RST_BAR_TIMEOUT ); +if (ret) +return ret; + } + +return 0 ; +} +EXPORT_SYMBOL_GPL (mtk_pll_prepare_setclr); + +void mtk_pll_unprepare_setclr (struct clk_hw *hw) +{ +struct mtk_clk_pll *pll =to_mtk_clk_pll (hw); +u32 val =0 ; +int ret; + +if (pll->data->flags &HAVE_RST_BAR ) { +writel (pll->data->rst_bar_mask, pll->rst_bar_clr_addr); + + ret =readl_poll_timeout (pll->rst_bar_addr, val, + !(val & pll->data->rst_bar_mask),1 , +RST_BAR_TIMEOUT ); +if (ret) +return ; + } + +mtk_pll_unprepare_common (pll, pll->en_clr_addr); +} +EXPORT_SYMBOL_GPL (mtk_pll_unprepare_setclr); +static int mtk_pll_prepare_fenc_setclr (struct clk_hw *hw) {struct mtk_clk_pll *pll =to_mtk_clk_pll (hw);
@@ -334,6 +378,16 @@ const struct clk_ops mtk_pll_ops = { };EXPORT_SYMBOL_GPL (mtk_pll_ops); +const struct clk_ops mtk_pll_setclr_ops = { + .is_prepared = mtk_pll_is_prepared, + .prepare = mtk_pll_prepare_setclr, + .unprepare = mtk_pll_unprepare_setclr, + .recalc_rate = mtk_pll_recalc_rate, + .determine_rate = mtk_pll_determine_rate, + .set_rate = mtk_pll_set_rate, +}; +EXPORT_SYMBOL_GPL (mtk_pll_setclr_ops); +const struct clk_ops mtk_pll_fenc_setclr_ops = { .is_prepared = mtk_pll_is_prepared_fenc_setclr, .prepare = mtk_pll_prepare_fenc_setclr,
drivers/clk/mediatek/clk-pll.h +5 -0
@@ -92,6 +92,7 @@ void mtk_clk_unregister_plls(const struct mtk_pll_data *plls, int num_plls,extern const struct clk_ops mtk_pll_ops;extern const struct clk_ops mtk_pll_fenc_setclr_ops; +extern const struct clk_ops mtk_pll_setclr_ops;static inline struct mtk_clk_pll *to_mtk_clk_pll (struct clk_hw *hw) {
@@ -104,6 +105,10 @@ int mtk_pll_prepare(struct clk_hw *hw);void mtk_pll_unprepare (struct clk_hw *hw); +int mtk_pll_prepare_setclr (struct clk_hw *hw); + +void mtk_pll_unprepare_setclr (struct clk_hw *hw); +unsigned long mtk_pll_recalc_rate (struct clk_hw *hw,unsigned long parent_rate); void mtk_pll_calc_values(struct mtk_clk_pll *pll, u32 *pcw, u32 *postdiv,
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH v4 12/24] clk: mediatek: pll: Add ops for PLLs using set/clr regs
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider: - [Critical] Reusing common prepare/unprepare functions for SET/CLR registers incorrectly performs…
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [Critical] Reusing common prepare/unprepare functions for SET/CLR registers incorrectly performs read-modify-write (RMW) operations, failing to toggle the target PLL and potentially disabling unrelated active PLLs.
- [High] mtk_pll_prepare_setclr and unprepare_setclr improperly call common functions that execute pwr_addr register writes, contradicting the hardware design.
- [High] Missing hardware state rollback when rst_bar polling fails in mtk_pll_prepare_setclr().
- [High] Early return on rst_bar timeout in mtk_pll_unprepare_setclr() aborts PLL teardown, leaving the hardware fully powered on.
--
--- Patch [12]: [PATCH v4 12/24] clk: mediatek: pll: Add ops for PLLs using set/clr regs --- commit 85e380ac652f1fdab76c2fb7262d10466dfdb403
Author: Louis-Alexis Eyraud <[email protected]>
clk: mediatek: pll: Add ops for PLLs using set/clr regs
MT8189 SoC uses a new combination of status and set/clr registers to control its PLL power state and perform BAR reset, that are different than the current default clock prepare/unprepare operations are using.
Add new set of PLL clock operations to support this logic that relies on the following registers for prepare/unprepare operations:
- en/en_set/en_clr, rather than pwr register, for PLL power control
- rst_bar/rst_bar_set/rst_bar_clr, rather than default rst_bar register for BAR reset control
Also, handle rst_bar register setting/clearing with a timeout, to verify the operation was correctly performed.
Quoted 4 lines
drivers/clk/mediatek/clk-pll.c void mtk_pll_unprepare(struct clk_hw *hw) · line 316
Quoted 10 lines
drivers/clk/mediatek/clk-pll.c +7
-0@@ -305,6 +307,48 @@ void mtk_pll_unprepare(struct clk_hw *hw) }EXPORT_SYMBOL_GPL (mtk_pll_unprepare); +int mtk_pll_prepare_setclr (struct clk_hw *hw) +{ +struct mtk_clk_pll *pll =to_mtk_clk_pll (hw); +u32 val =0 ; +int ret; + +mtk_pll_prepare_common (pll, pll->en_set_addr);
[Severity: High]
The commit message mentions these new PLLs use en/en_set/en_clr rather than the pwr register for power control. Since mtk_pll_prepare_common() executes read-modify-write operations on pll->pwr_addr (such as setting CON0_PWR_ON), does this corrupt other configuration bits at REG_CON0 if pwr_addr points to the default base offset?
drivers/clk/mediatek/clk-pll.c void mtk_pll_unprepare(struct clk_hw *hw) · line 325
Quoted 9 lines
drivers/clk/mediatek/clk-pll.c +9
-0+ +if (pll->data->flags &HAVE_RST_BAR ) { +writel (pll->data->rst_bar_mask, pll->rst_bar_set_addr); + + ret =readl_poll_timeout (pll->rst_bar_addr, val, + (val & pll->data->rst_bar_mask),1 , +RST_BAR_TIMEOUT ); +if (ret) +return ret;
[Severity: High]
If the rst_bar readiness polling times out, does this leave the hardware in an inconsistent state?
Since mtk_pll_prepare_common() was already called to power on the PLL and enable the tuner, returning the error directly here skips undoing those steps. The clock core sees the prepare fail and will not invoke the unprepare callback on error paths, permanently leaking power.
Quoted 10 lines
drivers/clk/mediatek/clk-pll.c +10
-0+ } + +return 0 ; +} +EXPORT_SYMBOL_GPL (mtk_pll_prepare_setclr); + +void mtk_pll_unprepare_setclr (struct clk_hw *hw) +{ +struct mtk_clk_pll *pll =to_mtk_clk_pll (hw); +u32 val =0 ;
drivers/clk/mediatek/clk-pll.c void mtk_pll_unprepare(struct clk_hw *hw) · line 345
Quoted 10 lines
drivers/clk/mediatek/clk-pll.c +10
-0+int ret; + +if (pll->data->flags &HAVE_RST_BAR ) { +writel (pll->data->rst_bar_mask, pll->rst_bar_clr_addr); + + ret =readl_poll_timeout (pll->rst_bar_addr, val, + !(val & pll->data->rst_bar_mask),1 , +RST_BAR_TIMEOUT ); +if (ret) +return ;
[Severity: High]
If this polling times out, does the early return permanently leak the PLL's active state?
Skipping the final call to mtk_pll_unprepare_common() leaves the hardware fully powered on, but the clock core considers the clock disabled since this function returns void. Hardware teardown paths typically proceed on a best effort basis rather than bailing out at the first error.
drivers/clk/mediatek/clk-pll.c void mtk_pll_unprepare(struct clk_hw *hw) · line 348
Quoted 3 lines
drivers/clk/mediatek/clk-pll.c +3
-0+ } + +mtk_pll_unprepare_common (pll, pll->en_clr_addr);
[Severity: Critical]
Does passing a clear (W1C) register to mtk_pll_unprepare_common() cause unintended side effects?
Looking at mtk_pll_unprepare_common(), it performs a read-modify-write:
r = readl(en_addr) & ~BIT(pll->data->pll_en_bit);
writel(r, en_addr);If en_clr_addr reads back the status of all PLLs, wouldn't masking out the target bit to 0 and writing the result back write 1s for all other active PLLs, inadvertently disabling them?
Quoted 2 lines
drivers/clk/mediatek/clk-pll.c +2
-0+} +EXPORT_SYMBOL_GPL (mtk_pll_unprepare_setclr);
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/20260729-mt8189-clocks-system-base-v4-0-e356b813a64c@collabora.com?part=12
PATCH v4 13/24 clk: mediatek: pllfh: Add configurable clock ops to mtk_pllfh_data
In reply to Louis-Alexis EyraudCurrently, the mtk_clk_register_pllfh functions always registers the default PLL clock operation set (mtk_pllfh_ops). This does not allow use a custom one, for SoC such as MT8189, that needs different set with support for set/clr enable.
Add a new field for the ops to register in mtk_pllfh_data structure and use this new field to either register it when not null or the default ops otherwise.
--- drivers/clk/mediatek/clk-pllfh.c | 5 +++-- drivers/clk/mediatek/clk-pllfh.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/clk/mediatek/clk-pllfh.c +3 -2
@@ -153,6 +153,8 @@ static struct clk_hw * mtk_clk_register_pllfh(struct device *dev, const struct mtk_pll_data *pll_data, struct mtk_pllfh_data *pllfh_data, void __iomem *base) { + const struct clk_ops *pllfh_ops = pllfh_data->data.ops ? + pllfh_data->data.ops : &mtk_pllfh_ops;struct clk_hw *hw;struct mtk_fh *fh;int ret;
@@ -169,8 +171,7 @@ mtk_clk_register_pllfh(struct device *dev, const struct mtk_pll_data *pll_data, fh->clk_pll.dev = dev; - hw =mtk_clk_register_pll_ops (&fh->clk_pll, pll_data, base, - &mtk_pllfh_ops); + hw =mtk_clk_register_pll_ops (&fh->clk_pll, pll_data, base, pllfh_ops);if (IS_ERR (hw)) goto out;
drivers/clk/mediatek/clk-pllfh.h +1 -0
@@ -34,6 +34,7 @@ struct fh_pll_data {u32 updnlmt_shft;u32 msk_frddsx_dys;u32 msk_frddsx_dts; +const struct clk_ops *ops; };struct mtk_pllfh_data {
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH v4 13/24] clk: mediatek: pllfh: Add configurable clock ops to mtk_pllfh_data
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Missing function exports make it impossible to implement custom clk_ops for PLLFH without…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Missing function exports make it impossible to implement custom clk_ops for PLLFH without breaking frequency hopping. --
--- Patch [13]: [PATCH v4 13/24] clk: mediatek: pllfh: Add configurable clock ops to mtk_pllfh_data --- commit 3ac21b55d82d370931f28f17cf6b5de73f938fdf
Author: Louis-Alexis Eyraud <[email protected]>
clk: mediatek: pllfh: Add configurable clock ops to mtk_pllfh_data
This commit introduces a new ops field in the mtk_pllfh_data structure. It allows drivers to provide a custom clock operation set instead of using the default mtk_pllfh_ops, which is necessary for SoCs like MT8189 that require set/clr enable support.
drivers/clk/mediatek/clk-pllfh.c static struct clk_hw * · line 157
Quoted 10 lines
drivers/clk/mediatek/clk-pllfh.c +2
-0@@ -153,6 +153,8 @@ static struct clk_hw * mtk_clk_register_pllfh(struct device *dev, const struct mtk_pll_data *pll_data, struct mtk_pllfh_data *pllfh_data, void __iomem *base) { + const struct clk_ops *pllfh_ops = pllfh_data->data.ops ? + pllfh_data->data.ops : &mtk_pllfh_ops;
[Severity: Medium]
Will this allow drivers to safely implement a custom ops struct?
A correct pllfh ops structure must use mtk_fhctl_set_rate to maintain frequency hopping and spread spectrum clocking functionality. However, it seems mtk_fhctl_set_rate is static and unexported.
If a driver provides a custom ops struct (such as mtk_pll_setclr_ops) without being able to reference mtk_fhctl_set_rate, wouldn't it silently bypass the fhctl hardware when setting the rate, potentially causing glitches and breaking spread spectrum clocking?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/20260729-mt8189-clocks-system-base-v4-0-e356b813a64c@collabora.com?part=13
PATCH v4 14/24 clk: mediatek: pllfh: Add ops for PLLs using set/clr regs
In reply to Louis-Alexis EyraudAdd new set of PLL FHCTL clock operations, that uses the new prepare and unprepare methods, added in PLL for MT8189 SoC to support this logic.
--- drivers/clk/mediatek/clk-pllfh.c | 10 ++++++++++ drivers/clk/mediatek/clk-pllfh.h | 2 ++ 2 files changed, 12 insertions(+)
drivers/clk/mediatek/clk-pllfh.c +10 -0
@@ -47,6 +47,16 @@ static const struct clk_ops mtk_pllfh_ops = { .set_rate = mtk_fhctl_set_rate, }; +const struct clk_ops mtk_pllfh_setclr_ops = { + .is_prepared = mtk_pll_is_prepared, + .prepare = mtk_pll_prepare_setclr, + .unprepare = mtk_pll_unprepare_setclr, + .recalc_rate = mtk_pll_recalc_rate, + .determine_rate = mtk_pll_determine_rate, + .set_rate = mtk_fhctl_set_rate, +}; +EXPORT_SYMBOL_GPL (mtk_pllfh_setclr_ops); +static struct mtk_pllfh_data *get_pllfh_by_id (struct mtk_pllfh_data *pllfhs,int num_fhs,int pll_id) {
drivers/clk/mediatek/clk-pllfh.h +2 -0
@@ -69,6 +69,8 @@ struct fh_operation {int (*ssc_enable)(struct mtk_fh *fh,u32 rate); }; +extern const struct clk_ops mtk_pllfh_setclr_ops; + int mtk_clk_register_pllfhs(struct device *dev, const struct mtk_pll_data *plls, int num_plls, struct mtk_pllfh_data *pllfhs, int num_pllfhs,
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH v4 14/24] clk: mediatek: pllfh: Add ops for PLLs using set/clr regs
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Missing rollback on error path in `mtk_pll_prepare_setclr` leads to permanent PLL power leak. --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Missing rollback on error path in mtk_pll_prepare_setclr leads to permanent PLL power leak. --
--- Patch [14]: [PATCH v4 14/24] clk: mediatek: pllfh: Add ops for PLLs using set/clr regs --- commit 6499dae9fef2cef096ef23a01c06293418528fef
Author: Louis-Alexis Eyraud <[email protected]>
clk: mediatek: pllfh: Add ops for PLLs using set/clr regs
Add new set of PLL FHCTL clock operations, that uses the new prepare and unprepare methods, added in PLL for MT8189 SoC to support this logic.
Quoted 4 lines
drivers/clk/mediatek/clk-pllfh.c +0
-0
[ ... ]
drivers/clk/mediatek/clk-pllfh.c static const struct clk_ops mtk_pllfh_ops = { · line 52
Quoted 7 lines
drivers/clk/mediatek/clk-pllfh.c +3
-0@@ -47,6 +47,16 @@ static const struct clk_ops mtk_pllfh_ops = { .set_rate = mtk_fhctl_set_rate, }; +const struct clk_ops mtk_pllfh_setclr_ops = { + .is_prepared = mtk_pll_is_prepared, + .prepare = mtk_pll_prepare_setclr,
[Severity: Medium]
Could mtk_pll_prepare_setclr() leak power on the error path?
Looking at drivers/clk/mediatek/clk-pll.c:mtk_pll_prepare_setclr() which was introduced earlier in this series:
mtk_pll_prepare_common(pll, pll->en_set_addr);
if (pll->data->flags & HAVE_RST_BAR) {
writel(pll->data->rst_bar_mask, pll->rst_bar_set_addr);
ret = readl_poll_timeout(pll->rst_bar_addr, val,
(val & pll->data->rst_bar_mask), 1,
RST_BAR_TIMEOUT);
if (ret)
return ret;
}If readl_poll_timeout() fails, it returns the error directly without calling mtk_pll_unprepare_common() to undo the state change.
Since the Common Clock Framework won't call .unprepare() on a clock that failed to prepare, wouldn't the PLL be left permanently powered on?
Quoted 5 lines
drivers/clk/mediatek/clk-pllfh.c +5
-0+ .unprepare = mtk_pll_unprepare_setclr, + .recalc_rate = mtk_pll_recalc_rate, + .determine_rate = mtk_pll_determine_rate, + .set_rate = mtk_fhctl_set_rate, +};
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/20260729-mt8189-clocks-system-base-v4-0-e356b813a64c@collabora.com?part=14
PATCH v4 15/24 clk: mediatek: Add MT8189 apmixedsys clock support
In reply to Louis-Alexis EyraudAdd support for the MT8189 apmixedsys clock controller, which provides PLLs generated from SoC 26m.
--- drivers/clk/mediatek/Kconfig | 13 ++ drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8189-apmixedsys.c | 203 +++++++++++++++++++++++++++ 3 files changed, 217 insertions(+)
drivers/clk/mediatek/Kconfig +13 -0
@@ -815,6 +815,19 @@ config COMMON_CLK_MT8188_WPESYS help This driver supports MediaTek MT8188 Warp Engine clocks. +config COMMON_CLK_MT8189 + tristate "Clock driver for MediaTek MT8189" + depends on ARM64 || COMPILE_TEST + select COMMON_CLK_MEDIATEK + select COMMON_CLK_MEDIATEK_FHCTL + default ARCH_MEDIATEK + help + Enable this option to support the clock management for MediaTek MT8189 SoC. This + includes handling of all primary clock functions and features specific to the MT8189 + platform. Enabling this driver ensures that the system's clock functionality aligns + with the MediaTek MT8189 hardware capabilities, providing efficient management of + clock speeds and power consumption. + config COMMON_CLK_MT8192 tristate "Clock driver for MediaTek MT8192" depends on ARM64 || COMPILE_TEST
drivers/clk/mediatek/Makefile +1 -0
@@ -123,6 +123,7 @@ obj-$(CONFIG_COMMON_CLK_MT8188_VDOSYS) += clk-mt8188-vdo0.o clk-mt8188-vdo1.o obj-$(CONFIG_COMMON_CLK_MT8188_VENCSYS) += clk-mt8188-venc.o obj-$(CONFIG_COMMON_CLK_MT8188_VPPSYS) += clk-mt8188-vpp0.o clk-mt8188-vpp1.o obj-$(CONFIG_COMMON_CLK_MT8188_WPESYS) += clk-mt8188-wpe.o +obj-$(CONFIG_COMMON_CLK_MT8189) += clk-mt8189-apmixedsys.o obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192-apmixedsys.o clk-mt8192.o obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8189-apmixedsys.c new file +203 -0
203 lines not on this page · raw message
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH v4 15/24] clk: mediatek: Add MT8189 apmixedsys clock support
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Reusing `mtk_pll_unprepare_common()` with a CLR register breaks PLL disable logic, either…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Reusing mtk_pll_unprepare_common() with a CLR register breaks PLL disable logic, either accidentally clearing other active PLLs or failing to disable the target PLL. --
--- Patch [15]: [PATCH v4 15/24] clk: mediatek: Add MT8189 apmixedsys clock support --- commit 5a8d4164915ab1ef9117354d41ec7d48062de00e
Author: Louis-Alexis Eyraud <[email protected]>
clk: mediatek: Add MT8189 apmixedsys clock support
This commit adds support for the MT8189 apmixedsys clock controller, which provides PLLs generated from the SoC 26m.
Quoted 6 lines
drivers/clk/mediatek/clk-mt8189-apmixedsys.c new file +0
-0@@ -0,0 +1,203 @@
[ ... ]
Quoted 9 lines
drivers/clk/mediatek/clk-mt8189-apmixedsys.c new file +9
-0+#define MT8189_INTEGER_BITS 8 + +#define PLL_SETCLR (_id, _name, _reg, _pwr_reg, _en_setclr_bit, \ + _rstb_setclr_bit, _flags, _pd_reg, \ + _pd_shift, _tuner_reg, _tuner_en_reg, \ + _tuner_en_bit, _pcw_reg, _pcw_shift, \ + _pcwbits) { \ + .id = _id, \ + .name = _name, \
[ ... ]
drivers/clk/mediatek/clk-mt8189-apmixedsys.c line 60
Quoted 4 lines
drivers/clk/mediatek/clk-mt8189-apmixedsys.c new file +4
-0+ .pcw_shift = _pcw_shift, \ + .pcwbits = _pcwbits, \ + .pcwibits = MT8189_INTEGER_BITS, \ + .ops = &mtk_pll_setclr_ops, \
[Severity: High]
Will using mtk_pll_setclr_ops here cause system instability when disabling PLLs?
Looking at mtk_pll_unprepare_setclr() (which is called by these ops), it delegates to mtk_pll_unprepare_common(pll, pll->en_clr_addr). That common function performs a read-modify-write:
r = readl(en_addr) & ~BIT(pll->data->pll_en_bit);
writel(r, en_addr);If reading the CLR register returns the current PLL status, 'r' will contain 1s for all other active PLLs and 0 for the target PLL. Writing this back to the CLR register would clear all other active PLLs and leave the target PLL enabled.
If the CLR register returns 0 (write-only), 'r' becomes 0, and writing 0 does nothing, meaning the target PLL is never disabled.
Should this use a direct write instead of a read-modify-write on a CLR register, similar to how the reset bar CLR register is handled?
Quoted 4 lines
drivers/clk/mediatek/clk-mt8189-apmixedsys.c new file +4
-0+ } + +static const struct mtk_pll_data apmixed_plls[] = { + PLL_SETCLR(CLK_APMIXED_ARMPLL_LL, "armpll-ll", 0x204, 0x210, 18,
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/20260729-mt8189-clocks-system-base-v4-0-e356b813a64c@collabora.com?part=15
PATCH v4 16/24 clk: mediatek: Add MT8189 topckgen clock support
In reply to Louis-Alexis EyraudAdd support for the MT8189 topckgen clock controller, which provides muxes and dividers for clock selection in other IP blocks.
--- drivers/clk/mediatek/Makefile | 2 +- drivers/clk/mediatek/clk-mt8189-topckgen.c | 1025 ++++++++++++++++++++++++++++ 2 files changed, 1026 insertions(+), 1 deletion(-)
drivers/clk/mediatek/Makefile +1 -1
@@ -123,7 +123,7 @@ obj-$(CONFIG_COMMON_CLK_MT8188_VDOSYS) += clk-mt8188-vdo0.o clk-mt8188-vdo1.o obj-$(CONFIG_COMMON_CLK_MT8188_VENCSYS) += clk-mt8188-venc.o obj-$(CONFIG_COMMON_CLK_MT8188_VPPSYS) += clk-mt8188-vpp0.o clk-mt8188-vpp1.o obj-$(CONFIG_COMMON_CLK_MT8188_WPESYS) += clk-mt8188-wpe.o -obj-$(CONFIG_COMMON_CLK_MT8189) += clk-mt8189-apmixedsys.o +obj-$(CONFIG_COMMON_CLK_MT8189) += clk-mt8189-apmixedsys.o clk-mt8189-topckgen.o obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192-apmixedsys.o clk-mt8192.o obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8189-topckgen.c new file +1025 -0
1,025 lines not on this page · raw message
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH v4 16/24] clk: mediatek: Add MT8189 topckgen clock support
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Use-After-Free of struct clk during probe error path and device removal due to asymmetric teardown between devm and manual unregistration. --
--- Patch [16]: [PATCH v4 16/24] clk: mediatek: Add MT8189 topckgen clock support --- commit 1a2a1cefef48aac7c733656cfc07df67d4760fe4
Author: Louis-Alexis Eyraud <[email protected]>
clk: mediatek: Add MT8189 topckgen clock support
Add support for the MT8189 topckgen clock controller, which provides muxes and dividers for clock selection in other IP blocks.
Quoted 4 lines
drivers/clk/mediatek/clk-mt8189-topckgen.c new file +0
-0
[ ... ]
Quoted 5 lines
drivers/clk/mediatek/clk-mt8189-topckgen.c new file +5
-0+/* Register mux notifier for MFG mux */ +static int clk_mt8189_reg_mfg_mux_notifier (struct device *dev, +struct clk *clk) +{ +struct mtk_mux_nb *mfg_mux_nb;
drivers/clk/mediatek/clk-mt8189-topckgen.c line 992
Quoted 10 lines
drivers/clk/mediatek/clk-mt8189-topckgen.c new file +10
-0+ + mfg_mux_nb =devm_kzalloc (dev,sizeof (*mfg_mux_nb),GFP_KERNEL ); +if (!mfg_mux_nb) +return -ENOMEM ; + + mfg_mux_nb->ops = &mtk_mux_clr_set_upd_ops; + mfg_mux_nb->bypass_index =0 ;/* Bypass to CLK_TOP_MFG_REF_SEL */ + +return devm_mtk_clk_mux_notifier_register (dev, clk, mfg_mux_nb); +}
[Severity: High]
This is a pre-existing issue, but does using devm_mtk_clk_mux_notifier_register() here introduce a use-after-free during driver unbinding or probe failure?
If mtk_clk_simple_probe() fails after registering this notifier, or when the module is removed via mtk_clk_simple_remove(), the manual teardown functions like mtk_clk_unregister_muxes() execute immediately. This calls clk_hw_unregister(), which frees the struct clk object.
Later, the driver core initiates devres cleanup and invokes devm_clk_notifier_release(). This function will call clk_notifier_unregister() using the already freed clk pointer.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/20260729-mt8189-clocks-system-base-v4-0-e356b813a64c@collabora.com?part=16
PATCH v4 17/24 clk: mediatek: Add MT8189 vlpckgen clock support
In reply to Louis-Alexis EyraudAdd support for the MT8189 vlpckgen clock controller, which provides muxes and dividers for clock selection in vlp domain for other IP blocks.
--- drivers/clk/mediatek/Makefile | 3 +- drivers/clk/mediatek/clk-mt8189-vlpckgen.c | 285 +++++++++++++++++++++++++++++ 2 files changed, 287 insertions(+), 1 deletion(-)
drivers/clk/mediatek/Makefile +2 -1
@@ -123,7 +123,8 @@ obj-$(CONFIG_COMMON_CLK_MT8188_VDOSYS) += clk-mt8188-vdo0.o clk-mt8188-vdo1.o obj-$(CONFIG_COMMON_CLK_MT8188_VENCSYS) += clk-mt8188-venc.o obj-$(CONFIG_COMMON_CLK_MT8188_VPPSYS) += clk-mt8188-vpp0.o clk-mt8188-vpp1.o obj-$(CONFIG_COMMON_CLK_MT8188_WPESYS) += clk-mt8188-wpe.o -obj-$(CONFIG_COMMON_CLK_MT8189) += clk-mt8189-apmixedsys.o clk-mt8189-topckgen.o +obj-$(CONFIG_COMMON_CLK_MT8189) += clk-mt8189-apmixedsys.o clk-mt8189-topckgen.o \ + clk-mt8189-vlpckgen.o obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192-apmixedsys.o clk-mt8192.o obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8189-vlpckgen.c new file +285 -0
285 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v4 18/24 clk: mediatek: Add MT8189 vlpcfg clock support
In reply to Louis-Alexis EyraudAdd support for the MT8189 vlpcfg clock controller, which provides clock gate control for vlp domain IPs.
--- drivers/clk/mediatek/Makefile | 2 +- drivers/clk/mediatek/clk-mt8189-vlpcfg.c | 116 +++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 1 deletion(-)
drivers/clk/mediatek/Makefile +1 -1
@@ -124,7 +124,7 @@ obj-$(CONFIG_COMMON_CLK_MT8188_VENCSYS) += clk-mt8188-venc.o obj-$(CONFIG_COMMON_CLK_MT8188_VPPSYS) += clk-mt8188-vpp0.o clk-mt8188-vpp1.o obj-$(CONFIG_COMMON_CLK_MT8188_WPESYS) += clk-mt8188-wpe.o obj-$(CONFIG_COMMON_CLK_MT8189) += clk-mt8189-apmixedsys.o clk-mt8189-topckgen.o \ - clk-mt8189-vlpckgen.o + clk-mt8189-vlpckgen.o clk-mt8189-vlpcfg.o obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192-apmixedsys.o clk-mt8192.o obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8189-vlpcfg.c new file +116 -0
116 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v4 19/24 clk: mediatek: Add MT8189 bus clock support
In reply to Louis-Alexis EyraudAdd support for the MT8189 bus clock controller, which provides clock gate control for infra/peri IPs (such as spi, uart, msdc, flashif ...).
--- drivers/clk/mediatek/Kconfig | 11 ++ drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8189-bus.c | 200 ++++++++++++++++++++++++++++++++++ 3 files changed, 212 insertions(+)
drivers/clk/mediatek/Kconfig +11 -0
@@ -828,6 +828,17 @@ config COMMON_CLK_MT8189 with the MediaTek MT8189 hardware capabilities, providing efficient management of clock speeds and power consumption. +config COMMON_CLK_MT8189_BUS + tristate "Clock driver for MediaTek MT8189 bus" + depends on COMMON_CLK_MT8189 + default COMMON_CLK_MT8189 + help + Enable this configuration option to support the clock framework for + MediaTek MT8189 SoC bus clocks. It includes the necessary clock + management for bus-related peripherals and interconnects within the + MT8189 chipset, ensuring that all bus-related components receive the + correct clock signals for optimal performance. + config COMMON_CLK_MT8192 tristate "Clock driver for MediaTek MT8192" depends on ARM64 || COMPILE_TEST
drivers/clk/mediatek/Makefile +1 -0
@@ -125,6 +125,7 @@ obj-$(CONFIG_COMMON_CLK_MT8188_VPPSYS) += clk-mt8188-vpp0.o clk-mt8188-vpp1.o obj-$(CONFIG_COMMON_CLK_MT8188_WPESYS) += clk-mt8188-wpe.o obj-$(CONFIG_COMMON_CLK_MT8189) += clk-mt8189-apmixedsys.o clk-mt8189-topckgen.o \ clk-mt8189-vlpckgen.o clk-mt8189-vlpcfg.o +obj-$(CONFIG_COMMON_CLK_MT8189_BUS) += clk-mt8189-bus.o obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192-apmixedsys.o clk-mt8192.o obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8189-bus.c new file +200 -0
200 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v4 20/24 clk: mediatek: Add MT8189 dbgao clock support
In reply to Louis-Alexis EyraudAdd support for the MT8189 dbgao clock controller, which provides clock gate control for debug-system.
--- drivers/clk/mediatek/Kconfig | 10 ++++ drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8189-dbgao.c | 98 +++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+)
drivers/clk/mediatek/Kconfig +10 -0
@@ -839,6 +839,16 @@ config COMMON_CLK_MT8189_BUS MT8189 chipset, ensuring that all bus-related components receive the correct clock signals for optimal performance. +config COMMON_CLK_MT8189_DBGAO + tristate "Clock driver for MediaTek MT8189 debug ao" + depends on COMMON_CLK_MT8189 + default COMMON_CLK_MT8189 + help + Enable this to support the clock management for the debug function + on MediaTek MT8189 SoCs. This includes enabling and disabling + vcore debug system clocks. If you want to control its clocks, say Y or M + to include this driver in your kernel build. + config COMMON_CLK_MT8192 tristate "Clock driver for MediaTek MT8192" depends on ARM64 || COMPILE_TEST
drivers/clk/mediatek/Makefile +1 -0
@@ -126,6 +126,7 @@ obj-$(CONFIG_COMMON_CLK_MT8188_WPESYS) += clk-mt8188-wpe.o obj-$(CONFIG_COMMON_CLK_MT8189) += clk-mt8189-apmixedsys.o clk-mt8189-topckgen.o \ clk-mt8189-vlpckgen.o clk-mt8189-vlpcfg.o obj-$(CONFIG_COMMON_CLK_MT8189_BUS) += clk-mt8189-bus.o +obj-$(CONFIG_COMMON_CLK_MT8189_DBGAO) += clk-mt8189-dbgao.o obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192-apmixedsys.o clk-mt8192.o obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8189-dbgao.c new file +98 -0
98 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v4 21/24 clk: mediatek: Add MT8189 dvfsrc clock support
In reply to Louis-Alexis EyraudAdd support for the MT8189 dvfsrc clock controller, which provides clock gate control for dram dvfs.
--- drivers/clk/mediatek/Kconfig | 10 ++++++ drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8189-dvfsrc.c | 58 ++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+)
drivers/clk/mediatek/Kconfig +10 -0
@@ -849,6 +849,16 @@ config COMMON_CLK_MT8189_DBGAO vcore debug system clocks. If you want to control its clocks, say Y or M to include this driver in your kernel build. +config COMMON_CLK_MT8189_DVFSRC + tristate "Clock driver for MediaTek MT8189 dvfsrc" + depends on COMMON_CLK_MT8189 + default COMMON_CLK_MT8189 + help + Enable this to support the clock management for the dvfsrc + on MediaTek MT8189 SoCs. This includes enabling and disabling + vcore dvfs clocks. If you want to control its clocks, say Y or M + to include this driver in your kernel build. + config COMMON_CLK_MT8192 tristate "Clock driver for MediaTek MT8192" depends on ARM64 || COMPILE_TEST
drivers/clk/mediatek/Makefile +1 -0
@@ -127,6 +127,7 @@ obj-$(CONFIG_COMMON_CLK_MT8189) += clk-mt8189-apmixedsys.o clk-mt8189-topckgen.o clk-mt8189-vlpckgen.o clk-mt8189-vlpcfg.o obj-$(CONFIG_COMMON_CLK_MT8189_BUS) += clk-mt8189-bus.o obj-$(CONFIG_COMMON_CLK_MT8189_DBGAO) += clk-mt8189-dbgao.o +obj-$(CONFIG_COMMON_CLK_MT8189_DVFSRC) += clk-mt8189-dvfsrc.o obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192-apmixedsys.o clk-mt8192.o obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8189-dvfsrc.c new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v4 22/24 clk: mediatek: Add MT8189 i2c clock support
In reply to Louis-Alexis EyraudAdd support for the MT8189 i2c clock controller,
which provides clock gate control for i2c.
--- drivers/clk/mediatek/Kconfig | 13 ++++ drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8189-iic.c | 122 ++++++++++++++++++++++++++++++++++ 3 files changed, 136 insertions(+)
drivers/clk/mediatek/Kconfig +13 -0
@@ -859,6 +859,19 @@ config COMMON_CLK_MT8189_DVFSRC vcore dvfs clocks. If you want to control its clocks, say Y or M to include this driver in your kernel build. +config COMMON_CLK_MT8189_IIC + tristate "Clock driver for MediaTek MT8189 iic" + depends on COMMON_CLK_MT8189 + default COMMON_CLK_MT8189 + help + Enable this option to support the clock framework for MediaTek MT8189 + integrated circuits (iic). This driver is responsible for managing + clock sources, dividers, and gates specifically designed for MT8189 + SoCs. Enabling this driver ensures that the system can correctly + manage clock frequencies and power for various components within + the MT8189 chipset, improving the overall performance and power + efficiency of the device. + config COMMON_CLK_MT8192 tristate "Clock driver for MediaTek MT8192" depends on ARM64 || COMPILE_TEST
drivers/clk/mediatek/Makefile +1 -0
@@ -128,6 +128,7 @@ obj-$(CONFIG_COMMON_CLK_MT8189) += clk-mt8189-apmixedsys.o clk-mt8189-topckgen.o obj-$(CONFIG_COMMON_CLK_MT8189_BUS) += clk-mt8189-bus.o obj-$(CONFIG_COMMON_CLK_MT8189_DBGAO) += clk-mt8189-dbgao.o obj-$(CONFIG_COMMON_CLK_MT8189_DVFSRC) += clk-mt8189-dvfsrc.o +obj-$(CONFIG_COMMON_CLK_MT8189_IIC) += clk-mt8189-iic.o obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192-apmixedsys.o clk-mt8192.o obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8189-iic.c new file +122 -0
122 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v4 23/24 clk: mediatek: Add MT8189 scp clock support
In reply to Louis-Alexis EyraudAdd support for the MT8189 scp clock controller, which provides clock gate control for System Control Processor.
--- drivers/clk/mediatek/Kconfig | 10 +++++ drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8189-scp.c | 77 +++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+)
drivers/clk/mediatek/Kconfig +10 -0
@@ -872,6 +872,16 @@ config COMMON_CLK_MT8189_IIC the MT8189 chipset, improving the overall performance and power efficiency of the device. +config COMMON_CLK_MT8189_SCP + tristate "Clock driver for MediaTek MT8189 scp" + depends on COMMON_CLK_MT8189 + default COMMON_CLK_MT8189 + help + Enable this to support the clock framework for the System Control + Processor (SCP) in the MediaTek MT8189 SoC. This includes clock + management for SCP-related features, ensuring proper clock + distribution and gating for power efficiency and functionality. + config COMMON_CLK_MT8192 tristate "Clock driver for MediaTek MT8192" depends on ARM64 || COMPILE_TEST
drivers/clk/mediatek/Makefile +1 -0
@@ -129,6 +129,7 @@ obj-$(CONFIG_COMMON_CLK_MT8189_BUS) += clk-mt8189-bus.o obj-$(CONFIG_COMMON_CLK_MT8189_DBGAO) += clk-mt8189-dbgao.o obj-$(CONFIG_COMMON_CLK_MT8189_DVFSRC) += clk-mt8189-dvfsrc.o obj-$(CONFIG_COMMON_CLK_MT8189_IIC) += clk-mt8189-iic.o +obj-$(CONFIG_COMMON_CLK_MT8189_SCP) += clk-mt8189-scp.o obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192-apmixedsys.o clk-mt8192.o obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8189-scp.c new file +77 -0
77 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH v4 24/24 clk: mediatek: Add MT8189 ufs clock support
In reply to Louis-Alexis EyraudAdd support for the MT8189 ufs clock controller, which provides clock gate control for Universal Flash Storage.
--- drivers/clk/mediatek/Kconfig | 12 +++ drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8189-ufs.c | 133 ++++++++++++++++++++++++++++++++++ 3 files changed, 146 insertions(+)
drivers/clk/mediatek/Kconfig +12 -0
@@ -882,6 +882,18 @@ config COMMON_CLK_MT8189_SCP management for SCP-related features, ensuring proper clock distribution and gating for power efficiency and functionality. +config COMMON_CLK_MT8189_UFS + tristate "Clock driver for MediaTek MT8189 ufs" + depends on COMMON_CLK_MT8189 + default COMMON_CLK_MT8189 + help + Enable this to support the clock management for the Universal Flash + Storage (UFS) interface on MediaTek MT8189 SoCs. This includes + clock sources, dividers, and gates that are specific to the UFS + feature of the MT8189 platform. It is recommended to enable this + option if the system includes a UFS device that relies on the MT8189 + SoC for clock management. + config COMMON_CLK_MT8192 tristate "Clock driver for MediaTek MT8192" depends on ARM64 || COMPILE_TEST
drivers/clk/mediatek/Makefile +1 -0
@@ -130,6 +130,7 @@ obj-$(CONFIG_COMMON_CLK_MT8189_DBGAO) += clk-mt8189-dbgao.o obj-$(CONFIG_COMMON_CLK_MT8189_DVFSRC) += clk-mt8189-dvfsrc.o obj-$(CONFIG_COMMON_CLK_MT8189_IIC) += clk-mt8189-iic.o obj-$(CONFIG_COMMON_CLK_MT8189_SCP) += clk-mt8189-scp.o +obj-$(CONFIG_COMMON_CLK_MT8189_UFS) += clk-mt8189-ufs.o obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192-apmixedsys.o clk-mt8192.o obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
drivers/clk/mediatek/clk-mt8189-ufs.c new file +133 -0
133 lines not on this page · raw message
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH v4 24/24] clk: mediatek: Add MT8189 ufs clock support
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing of_clk_del_provider() in the error path of __mtk_clk_simple_probe() when reset controller registration fails, leading to a Use-After-Free. --
--- Patch [24]: [PATCH v4 24/24] clk: mediatek: Add MT8189 ufs clock support --- commit 73843c3d7b6ae3d2d34edc45116556bb9d3c1e8b
Author: Louis-Alexis Eyraud <[email protected]>
clk: mediatek: Add MT8189 ufs clock support
Add support for the MT8189 ufs clock controller, which provides clock gate control for Universal Flash Storage.
Quoted 2 lines
drivers/clk/mediatek/clk-mt8189-ufs.c new file +0
-0
[ ... ]
Quoted 5 lines
drivers/clk/mediatek/clk-mt8189-ufs.c new file +5
-0+static const struct mtk_clk_desc ufscfg_ao_reg_mcd = { + .clks = ufscfg_ao_reg_clks, + .num_clks =ARRAY_SIZE (ufscfg_ao_reg_clks), + .rst_desc = &ufscfg_ao_rst_desc, +};
[ ... ]
drivers/clk/mediatek/clk-mt8189-ufs.c line 129
Quoted 8 lines
drivers/clk/mediatek/clk-mt8189-ufs.c new file +8
-0+static struct platform_driver clk_mt8189_ufs_drv = { + .probe = mtk_clk_simple_probe, + .remove = mtk_clk_simple_remove, + .driver = { + .name ="clk-mt8189-ufs" , + .of_match_table = of_match_clk_mt8189_ufs, + }, +};
[Severity: High]
This isn't a bug introduced by this patch, but since this new driver uses mtk_clk_simple_probe() and registers a reset controller (rst_desc), it exposes a pre-existing issue in the error handling path of __mtk_clk_simple_probe().
If mtk_register_reset_controller_with_dev() fails, the code jumps to unregister_clks:
drivers/clk/mediatek/clk-mtk.c:__mtk_clk_simple_probe() {
...
if (mcd->rst_desc) {
r = mtk_register_reset_controller_with_dev(&pdev->dev,
mcd->rst_desc);
if (r)
goto unregister_clks;
}
...
unregister_clks:
...
free_data:
mtk_free_clk_data(clk_data);
}Does this cleanup path leave a dangling pointer in the OF clock provider list?
It appears to free clk_data but fails to call of_clk_del_provider() to remove the successfully registered clock provider.
If another driver attempts to look up a clock via the device tree after probe failure, could of_clk_hw_onecell_get() dereference the freed clk_data and cause a use-after-free?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/20260729-mt8189-clocks-system-base-v4-0-e356b813a64c@collabora.com?part=24
Quoted 163 lines · Louis-Alexis Eyraud
This series is a continuation by AngeloGioacchino Del Regno and I of a previous series ([1]), that adds the clock controller support for the Mediatek MT8189 SoC and its variants (MT8371, MT8391).
The first major changes is the split of the series in two:
- one for all basic clock controllers including system ones (this series)
- one for the multimedia and graphics related clock controllers (to be send in the future)We chose to separate the multimedia clock drivers from the base system ones, as there is currently an unsolvable inter-dependency between the power domains and multimedia clocks; the power domains need a dual-stage bring-up, where only a part of the multimedia clocks are accessible in the first power domain powerup stage, and the rest when the second stage (SRAM enablement) is done.
The current workarounds for this issue, such as removing theis_enabledoperation from the impacted clock controllersclk_opstable or let the multimedia power domain always on, were quickly discarded for upstream.The second major change is the dt-bindings patch ([2]) that got heavily reworked, not only because of the split choice. We took the opportunity to regroup in the MT8186 clock and system clock dt-bindings the description of several other Mediatek SoC (MT8188, MT8192 and MT8195) and add in them the MT8189 new ones.
The rationale is to ease maintainability and have common files for several currently supported SoC or new future ones, that have the same kind of clock controller design.Finally the pending remarks from peer reviews on the v6 revision of [1] were also taken into account and new fixes and cleanups were also added.
A more detailed changelog between [1] and this series:
- Removed multimedia and graphics related clock controllers code and definitions from series
- Added new dt-bindings patches to factorise existing MT8188, MT8192 and MT8195 in MT8186 clock dt-bindings
- Heavily modified the MT8189 dt-bindings to add new compatibles in MT8186 clock dt-bindings
- Created a new dt-bindings include for the MT8189 reset controller definitions (include/dt-bindings/reset/mediatek,mt8189-resets.h)
- Removed unnecessarysysconcompatible fallback from MT8189 base clock controllers
- Added missing 'mediatek,mt8189-fhctl' compatible declaration in dt-bindings
- ModifiedKconfigtoCOMMON_CLK_MT8189be tristate (and not bool) to allow all MT8189 clock controller drivers to be built as modules (it was partial)
- Fix pll unregisters inclk_mt8189_apmixed_probeerror case
- Reparent several clocks to correct 26M references inclk-mt8189-bus.c,clk-mt8189-topckgen.candclk-mt8189-vlpckgen.c
- RemovedCLK_SET_RATE_NO_REPARENTflag frommfg_sel_mfgpll
- RenameTOPCKGEN_fmipi_csi_up26mclock tofmipi_csi_up26mto remove caps usage
- Implemented reset controllers inclk-mt8189-ufs.c
- Updated all file headers to update copyrights and add all authors
- Added all co-developed-by trailersThe series is based on linux-next tree (tag: next-20260728) and has been tested on Mediatek Genio 520-EVK (MT8371) and 720-EVK (MT8391) boards, with hardware enablement patch series ([3]), and on Genio 510-EVK (MT8370, variant of MT8188) and Genio 1200-EVK (MT8395, variant of MT8195).
[1]: https://lore.kernel.org/linux-mediatek/[email protected]/
[2]: https://lore.kernel.org/linux-mediatek/[email protected]/
[3]: https://lore.kernel.org/linux-mediatek/20260701-add-mediatek-genio-520-720-evk-v2-0-19d5da4ef984@collabora.com/---
Changes in v4:
- Rebased on next-20260728 tag
- Added patches 9 to 14 to add new clock ops data set for PLL and
PLL-FHCTL to handle a new PLL switch logic for PLL control and BAR
reset, supported by MT8189 SoC
- Patch 15:
- Removed useless includes (B. Masney)
- Fixed variable declaration order inclk_mt8189_apmixed_probe(B.
Masney)
- Added missingpwr_regsetting setting inPLL_SETCLRmacro (B.
Masney, Sashiko)
- Addeden_set_reg,en_clr_reg,rst_bar_reg,rst_bar_set_regand
rst_bar_clr_regfixed offsets and newmtk_pll_setclr_opsops
setting inPLL_SETCLRmacro
- Addedpwr_regoffset values inapmixed_pllsarray
- Fixedrst_bar_maskfor mainpll univpll, and mmpll inapmixed_plls
array to matchrst_barset/clr reg settings
- Fixed factor ratio formainpll_d4_d8,tvdpll1_d16,tvdpll2_d16and
osc_d16clocks (Sashiko)
- Link to v3: https://lore.kernel.org/r/20260720-mt8189-clocks-system-base-v3-0-8e6d99ab3ad2@collabora.comChanges in v3:
- Rebased on next-20260717 tag
- Added Fixes tags to patches 1, 2 and 3
- Reworded patch 8 subject and description messages
- Updated Reviewed-by and Acked-by trailers
- Link to v2: https://lore.kernel.org/r/20260709-mt8189-clocks-system-base-v2-0-2926da3db6cf@collabora.comChanges in v2:
- Rebased on next-20260708 tag
- Added patch 1,2 and 3 to make the #clock-cells a required property in
MT8186, MT8192 and MT8195 clock controller dt-bindings
- Patch 5:
- Removed conditional blocks to check clock-cells property presence
for MT8188 clock controller compatible
- Reworded commit message to remove the note (no more applicable)
- Fixed incorrect property value in else block for #reset-cells
property check.
_ Removed from patch 9 conditional blocks to check clock-cells property
presence for MT8189 clock controller compatible
- Fixed missingMODULE_DEVICE_TABLEin patches 10, 11 and 12.
- Added devicetree series link in cover letter
- Link to v1: https://lore.kernel.org/r/20260701-mt8189-clocks-system-base-v1-0-2b048feea50a@collabora.com---
Louis-Alexis Eyraud (24):
dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8186
dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8192
dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8195
dt-bindings: clock: mediatek: reorder MT8186 compatibles
dt-bindings: clock: mediatek: regroup MT8188 dt-bindings into MT8186
dt-bindings: clock: mediatek: regroup MT8192 dt-bindings into MT8186
dt-bindings: clock: mediatek: regroup MT8195 dt-bindings into MT8186
dt-bindings: clock: mediatek: Add MT8189 system/base clocks and resets
clk: mediatek: Harmonizemtk_pll_fencrelated symbol names
clk: mediatek: pll: Add BAR reset register offsets
clk: mediatek: pll: split default prepare/unprepare callbacks
clk: mediatek: pll: Add ops for PLLs using set/clr regs
clk: mediatek: pllfh: Add configurable clock ops tomtk_pllfh_data
clk: mediatek: pllfh: Add ops for PLLs using set/clr regs
clk: mediatek: Add MT8189 apmixedsys clock support
clk: mediatek: Add MT8189 topckgen clock support
clk: mediatek: Add MT8189 vlpckgen clock support
clk: mediatek: Add MT8189 vlpcfg clock support
clk: mediatek: Add MT8189 bus clock support
clk: mediatek: Add MT8189 dbgao clock support
clk: mediatek: Add MT8189 dvfsrc clock support
clk: mediatek: Add MT8189 i2c clock support
clk: mediatek: Add MT8189 scp clock support
clk: mediatek: Add MT8189 ufs clock support.../bindings/clock/mediatek,mt8186-clock.yaml | 128 ++- .../bindings/clock/mediatek,mt8186-fhctl.yaml | 1 + .../bindings/clock/mediatek,mt8186-sys-clock.yaml | 24 +- .../bindings/clock/mediatek,mt8188-clock.yaml | 93 -- .../bindings/clock/mediatek,mt8188-sys-clock.yaml | 58 -- .../bindings/clock/mediatek,mt8192-clock.yaml | 191 ---- .../bindings/clock/mediatek,mt8192-sys-clock.yaml | 68 -- .../bindings/clock/mediatek,mt8195-clock.yaml | 238 ----- .../bindings/clock/mediatek,mt8195-sys-clock.yaml | 76 -- drivers/clk/mediatek/Kconfig | 79 ++ drivers/clk/mediatek/Makefile | 8 + drivers/clk/mediatek/clk-mt8189-apmixedsys.c | 203 ++++ drivers/clk/mediatek/clk-mt8189-bus.c | 200 ++++ drivers/clk/mediatek/clk-mt8189-dbgao.c | 98 ++ drivers/clk/mediatek/clk-mt8189-dvfsrc.c | 58 ++ drivers/clk/mediatek/clk-mt8189-iic.c | 122 +++ drivers/clk/mediatek/clk-mt8189-scp.c | 77 ++ drivers/clk/mediatek/clk-mt8189-topckgen.c | 1025 ++++++++++++++++++++ drivers/clk/mediatek/clk-mt8189-ufs.c | 133 +++ drivers/clk/mediatek/clk-mt8189-vlpcfg.c | 116 +++ drivers/clk/mediatek/clk-mt8189-vlpckgen.c | 285 ++++++ drivers/clk/mediatek/clk-mt8196-apmixedsys.c | 2 +-
Quoted 8 lines
drivers/clk/mediatek/clk-mt8196-vlpckgen.c | 2 +- drivers/clk/mediatek/clk-pll.c | 135 ++- drivers/clk/mediatek/clk-pll.h | 13 +- drivers/clk/mediatek/clk-pllfh.c | 15 +- drivers/clk/mediatek/clk-pllfh.h | 3 + include/dt-bindings/clock/mediatek,mt8189-clk.h | 433 +++++++++ include/dt-bindings/reset/mediatek,mt8189-resets.h | 17 + 29 files changed, 3135 insertions(+), 766 deletions(-)
Should there be a new MAINTAINERS entry added? There's currently 221 files under drivers/clk/mediatek/ and there's currently only one mediatek maintainer entry:
MEDIATEK MT6735 CLOCK & RESET DRIVERS.
Is there anyone from mediatek (or elsewhere) that could act as a clk subsystem maintainer similar to what the other SoC vendors do? Help with reviews, send in pulls, etc?
I'll review this one in a bit but this subsystem is big enough that it really should have some support from the vendor (or via a consulting company) in some form.
Brian
AngeloGioacchino Del Regno
maintainerQuoted 177 lines · Brian Masney
Quoted 163 lines · Louis-Alexis Eyraud
This series is a continuation by AngeloGioacchino Del Regno and I of a previous series ([1]), that adds the clock controller support for the Mediatek MT8189 SoC and its variants (MT8371, MT8391).
The first major changes is the split of the series in two:
- one for all basic clock controllers including system ones (this series)
- one for the multimedia and graphics related clock controllers (to be send in the future)We chose to separate the multimedia clock drivers from the base system ones, as there is currently an unsolvable inter-dependency between the power domains and multimedia clocks; the power domains need a dual-stage bring-up, where only a part of the multimedia clocks are accessible in the first power domain powerup stage, and the rest when the second stage (SRAM enablement) is done.
The current workarounds for this issue, such as removing theis_enabledoperation from the impacted clock controllersclk_opstable or let the multimedia power domain always on, were quickly discarded for upstream.The second major change is the dt-bindings patch ([2]) that got heavily reworked, not only because of the split choice. We took the opportunity to regroup in the MT8186 clock and system clock dt-bindings the description of several other Mediatek SoC (MT8188, MT8192 and MT8195) and add in them the MT8189 new ones.
The rationale is to ease maintainability and have common files for several currently supported SoC or new future ones, that have the same kind of clock controller design.Finally the pending remarks from peer reviews on the v6 revision of [1] were also taken into account and new fixes and cleanups were also added.
A more detailed changelog between [1] and this series:
- Removed multimedia and graphics related clock controllers code and definitions from series
- Added new dt-bindings patches to factorise existing MT8188, MT8192 and MT8195 in MT8186 clock dt-bindings
- Heavily modified the MT8189 dt-bindings to add new compatibles in MT8186 clock dt-bindings
- Created a new dt-bindings include for the MT8189 reset controller definitions (include/dt-bindings/reset/mediatek,mt8189-resets.h)
- Removed unnecessarysysconcompatible fallback from MT8189 base clock controllers
- Added missing 'mediatek,mt8189-fhctl' compatible declaration in dt-bindings
- ModifiedKconfigtoCOMMON_CLK_MT8189be tristate (and not bool) to allow all MT8189 clock controller drivers to be built as modules (it was partial)
- Fix pll unregisters inclk_mt8189_apmixed_probeerror case
- Reparent several clocks to correct 26M references inclk-mt8189-bus.c,clk-mt8189-topckgen.candclk-mt8189-vlpckgen.c
- RemovedCLK_SET_RATE_NO_REPARENTflag frommfg_sel_mfgpll
- RenameTOPCKGEN_fmipi_csi_up26mclock tofmipi_csi_up26mto remove caps usage
- Implemented reset controllers inclk-mt8189-ufs.c
- Updated all file headers to update copyrights and add all authors
- Added all co-developed-by trailersThe series is based on linux-next tree (tag: next-20260728) and has been tested on Mediatek Genio 520-EVK (MT8371) and 720-EVK (MT8391) boards, with hardware enablement patch series ([3]), and on Genio 510-EVK (MT8370, variant of MT8188) and Genio 1200-EVK (MT8395, variant of MT8195).
[1]: https://lore.kernel.org/linux-mediatek/[email protected]/
[2]: https://lore.kernel.org/linux-mediatek/[email protected]/
[3]: https://lore.kernel.org/linux-mediatek/20260701-add-mediatek-genio-520-720-evk-v2-0-19d5da4ef984@collabora.com/---
Changes in v4:
- Rebased on next-20260728 tag
- Added patches 9 to 14 to add new clock ops data set for PLL and
PLL-FHCTL to handle a new PLL switch logic for PLL control and BAR
reset, supported by MT8189 SoC
- Patch 15:
- Removed useless includes (B. Masney)
- Fixed variable declaration order inclk_mt8189_apmixed_probe(B.
Masney)
- Added missingpwr_regsetting setting inPLL_SETCLRmacro (B.
Masney, Sashiko)
- Addeden_set_reg,en_clr_reg,rst_bar_reg,rst_bar_set_regand
rst_bar_clr_regfixed offsets and newmtk_pll_setclr_opsops
setting inPLL_SETCLRmacro
- Addedpwr_regoffset values inapmixed_pllsarray
- Fixedrst_bar_maskfor mainpll univpll, and mmpll inapmixed_plls
array to matchrst_barset/clr reg settings
- Fixed factor ratio formainpll_d4_d8,tvdpll1_d16,tvdpll2_d16and
osc_d16clocks (Sashiko)
- Link to v3: https://lore.kernel.org/r/20260720-mt8189-clocks-system-base-v3-0-8e6d99ab3ad2@collabora.comChanges in v3:
- Rebased on next-20260717 tag
- Added Fixes tags to patches 1, 2 and 3
- Reworded patch 8 subject and description messages
- Updated Reviewed-by and Acked-by trailers
- Link to v2: https://lore.kernel.org/r/20260709-mt8189-clocks-system-base-v2-0-2926da3db6cf@collabora.comChanges in v2:
- Rebased on next-20260708 tag
- Added patch 1,2 and 3 to make the #clock-cells a required property in
MT8186, MT8192 and MT8195 clock controller dt-bindings
- Patch 5:
- Removed conditional blocks to check clock-cells property presence
for MT8188 clock controller compatible
- Reworded commit message to remove the note (no more applicable)
- Fixed incorrect property value in else block for #reset-cells
property check.
_ Removed from patch 9 conditional blocks to check clock-cells property
presence for MT8189 clock controller compatible
- Fixed missingMODULE_DEVICE_TABLEin patches 10, 11 and 12.
- Added devicetree series link in cover letter
- Link to v1: https://lore.kernel.org/r/20260701-mt8189-clocks-system-base-v1-0-2b048feea50a@collabora.com---
Louis-Alexis Eyraud (24):
dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8186
dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8192
dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8195
dt-bindings: clock: mediatek: reorder MT8186 compatibles
dt-bindings: clock: mediatek: regroup MT8188 dt-bindings into MT8186
dt-bindings: clock: mediatek: regroup MT8192 dt-bindings into MT8186
dt-bindings: clock: mediatek: regroup MT8195 dt-bindings into MT8186
dt-bindings: clock: mediatek: Add MT8189 system/base clocks and resets
clk: mediatek: Harmonizemtk_pll_fencrelated symbol names
clk: mediatek: pll: Add BAR reset register offsets
clk: mediatek: pll: split default prepare/unprepare callbacks
clk: mediatek: pll: Add ops for PLLs using set/clr regs
clk: mediatek: pllfh: Add configurable clock ops tomtk_pllfh_data
clk: mediatek: pllfh: Add ops for PLLs using set/clr regs
clk: mediatek: Add MT8189 apmixedsys clock support
clk: mediatek: Add MT8189 topckgen clock support
clk: mediatek: Add MT8189 vlpckgen clock support
clk: mediatek: Add MT8189 vlpcfg clock support
clk: mediatek: Add MT8189 bus clock support
clk: mediatek: Add MT8189 dbgao clock support
clk: mediatek: Add MT8189 dvfsrc clock support
clk: mediatek: Add MT8189 i2c clock support
clk: mediatek: Add MT8189 scp clock support
clk: mediatek: Add MT8189 ufs clock support.../bindings/clock/mediatek,mt8186-clock.yaml | 128 ++- .../bindings/clock/mediatek,mt8186-fhctl.yaml | 1 + .../bindings/clock/mediatek,mt8186-sys-clock.yaml | 24 +- .../bindings/clock/mediatek,mt8188-clock.yaml | 93 -- .../bindings/clock/mediatek,mt8188-sys-clock.yaml | 58 -- .../bindings/clock/mediatek,mt8192-clock.yaml | 191 ---- .../bindings/clock/mediatek,mt8192-sys-clock.yaml | 68 -- .../bindings/clock/mediatek,mt8195-clock.yaml | 238 ----- .../bindings/clock/mediatek,mt8195-sys-clock.yaml | 76 -- drivers/clk/mediatek/Kconfig | 79 ++ drivers/clk/mediatek/Makefile | 8 + drivers/clk/mediatek/clk-mt8189-apmixedsys.c | 203 ++++ drivers/clk/mediatek/clk-mt8189-bus.c | 200 ++++ drivers/clk/mediatek/clk-mt8189-dbgao.c | 98 ++ drivers/clk/mediatek/clk-mt8189-dvfsrc.c | 58 ++ drivers/clk/mediatek/clk-mt8189-iic.c | 122 +++ drivers/clk/mediatek/clk-mt8189-scp.c | 77 ++ drivers/clk/mediatek/clk-mt8189-topckgen.c | 1025 ++++++++++++++++++++ drivers/clk/mediatek/clk-mt8189-ufs.c | 133 +++ drivers/clk/mediatek/clk-mt8189-vlpcfg.c | 116 +++ drivers/clk/mediatek/clk-mt8189-vlpckgen.c | 285 ++++++ drivers/clk/mediatek/clk-mt8196-apmixedsys.c | 2 +-Quoted 8 lines
drivers/clk/mediatek/clk-mt8196-vlpckgen.c | 2 +- drivers/clk/mediatek/clk-pll.c | 135 ++- drivers/clk/mediatek/clk-pll.h | 13 +- drivers/clk/mediatek/clk-pllfh.c | 15 +- drivers/clk/mediatek/clk-pllfh.h | 3 + include/dt-bindings/clock/mediatek,mt8189-clk.h | 433 +++++++++ include/dt-bindings/reset/mediatek,mt8189-resets.h | 17 + 29 files changed, 3135 insertions(+), 766 deletions(-)Should there be a new
MAINTAINERSentry added? There's currently 221 files underdrivers/clk/mediatek/and there's currently only one mediatek maintainer entry:
Quoted 6 lines
MEDIATEK MT6735 CLOCK & RESET DRIVERS.
Is there anyone from mediatek (or elsewhere) that could act as a clk subsystem maintainer similar to what the other SoC vendors do? Help with reviews, send in pulls, etc?
I may be able to step in, but I have to check if it's feasible, time-wise, on my side.
Though, that won't happen until mid-September... because, well, I'm about to go on holiday (in a few days from now).
Quoted 3 lines
I'll review this one in a bit but this subsystem is big enough that it really should have some support from the vendor (or via a consulting company) in some form.
Thanks for that.
Cheers,
Angelo
Hi Angelo,
Quoted 12 lines · AngeloGioacchino Del Regno
Quoted 10 lines · Brian Masney
Should there be a new
MAINTAINERSentry added? There's currently 221 files underdrivers/clk/mediatek/and there's currently only one mediatek maintainer entry:MEDIATEK MT6735 CLOCK & RESET DRIVERS.
Is there anyone from mediatek (or elsewhere) that could act as a clk subsystem maintainer similar to what the other SoC vendors do? Help with reviews, send in pulls, etc?
Quoted 5 lines
I may be able to step in, but I have to check if it's feasible, time-wise, on my side.
Though, that won't happen until mid-September... because, well, I'm about to go on holiday (in a few days from now).
I'm checking in to see if you would be willing to be clk submaintainer for the MediaTek clk drivers?
Brian
AngeloGioacchino Del Regno
maintainerQuoted 18 lines · Brian Masney
Hi Angelo,
Quoted 15 lines · AngeloGioacchino Del Regno
Quoted 10 lines · Brian Masney
Should there be a new
MAINTAINERSentry added? There's currently 221 files underdrivers/clk/mediatek/and there's currently only one mediatek maintainer entry:MEDIATEK MT6735 CLOCK & RESET DRIVERS.
Is there anyone from mediatek (or elsewhere) that could act as a clk subsystem maintainer similar to what the other SoC vendors do? Help with reviews, send in pulls, etc?
I may be able to step in, but I have to check if it's feasible, time-wise, on my side.
Quoted 7 lines
Quoted 2 lines
Though, that won't happen until mid-September... because, well, I'm about to go on holiday (in a few days from now).
I'm checking in to see if you would be willing to be clk submaintainer for the MediaTek clk drivers?
Brian
Time is lacking, but I get that one hour from me is more than zero, which is a good thing.
Let's do it.
Cheers,
Angelo
Hi Angelo,
Quoted 20 lines · AngeloGioacchino Del Regno
Quoted 19 lines · Brian Masney
Quoted 17 lines · AngeloGioacchino Del Regno
Quoted 10 lines · Brian Masney
Should there be a new
MAINTAINERSentry added? There's currently 221 files underdrivers/clk/mediatek/and there's currently only one mediatek maintainer entry:MEDIATEK MT6735 CLOCK & RESET DRIVERS.
Is there anyone from mediatek (or elsewhere) that could act as a clk subsystem maintainer similar to what the other SoC vendors do? Help with reviews, send in pulls, etc?
I may be able to step in, but I have to check if it's feasible, time-wise, on my side.
Though, that won't happen until mid-September... because, well, I'm about to go on holiday (in a few days from now).
Quoted 6 lines
Quoted 4 lines
I'm checking in to see if you would be willing to be clk submaintainer for the MediaTek clk drivers?
Brian
Time is lacking
I can relate...
Quoted 4 lines
, but I get that one hour from me is more than zero, which is a good thing.
Let's do it.
Thank you. Please send a patch for MAINTAINERS when you get a chance.
Thanks,
Brian