[PATCH v2 0/8] clk: mediatek: implement of_xlate and dump
David Lechner
dlechner at baylibre.com
Wed Jan 7 16:50:10 CET 2026
I started looking into fixing some bugs in the mt8365 clock driver and
realized that there was no way to inspect or debug the clock trees.
I set out to implement the dump function to help with this. The driver
architecture didn't make this easy since there was no way to know the
number of elements in each of the clock arrays. The first few patches
in this series are adding fields to the data structures to hold this
information.
Once that was fixed, I was still getting crashes due to other bugs. To
work around this, I implemented the of_xlate function to validate clk
IDs as early as possible and return errors instead of crashing when
requested IDs are invalid. This also makes use of the new size fields
to prevent out of bounds array accesses. There are a couple of drivers
that remap IDs, so there are a few extra patches to handle that as well.
Then finally, I was able to implement the dump function to print out the
clock tree information without crashing. In the v1 cover letter, there
is an example of the output (it is quite long and doesn't need to be
repeated here).
---
Changes in v2:
- Rebased to latest master.
- Added changes for mt8188 clocks that were picked up since v1.
- Link to v1: https://lore.kernel.org/r/20251218-clk-mtk-improvements-v1-0-72db131ba148@baylibre.com
---
David Lechner (8):
clk: mediatek: add array size fields to clk trees
clk: mediatek: add array size fields to cg gates
clk: mediatek: add array size field for id_offs_map
clk: mediatek: organize infrasys functions
clk: mediatek: add of_xlate ops
clk: mediatek: clarify mapped vs. unmapped ID
clk: mediatek: mt7623: set unmapped IDs to -1
clk: mediatek: implement dump callbacks
drivers/clk/mediatek/clk-mt7622.c | 21 +-
drivers/clk/mediatek/clk-mt7623.c | 24 +-
drivers/clk/mediatek/clk-mt7629.c | 23 +-
drivers/clk/mediatek/clk-mt7981.c | 13 +-
drivers/clk/mediatek/clk-mt7986.c | 11 +-
drivers/clk/mediatek/clk-mt7987.c | 9 +-
drivers/clk/mediatek/clk-mt7988.c | 18 +-
drivers/clk/mediatek/clk-mt8183.c | 7 +-
drivers/clk/mediatek/clk-mt8188.c | 28 +-
drivers/clk/mediatek/clk-mt8365.c | 10 +-
drivers/clk/mediatek/clk-mt8512.c | 10 +-
drivers/clk/mediatek/clk-mt8516.c | 7 +-
drivers/clk/mediatek/clk-mt8518.c | 7 +-
drivers/clk/mediatek/clk-mtk.c | 669 +++++++++++++++++++++++++++++---------
drivers/clk/mediatek/clk-mtk.h | 43 ++-
15 files changed, 697 insertions(+), 203 deletions(-)
---
base-commit: 53c0d5b387956bb4070a943b61991898373a20e2
change-id: 20251215-clk-mtk-improvements-db0b9d1d3113
Best regards,
--
David Lechner <dlechner at baylibre.com>
More information about the U-Boot
mailing list