]> git.ipfire.org Git - thirdparty/u-boot.git/commit
clk: mediatek: fix mux clocks with mapped parent IDs
authorDavid Lechner <dlechner@baylibre.com>
Wed, 14 Jan 2026 22:24:14 +0000 (16:24 -0600)
committerTom Rini <trini@konsulko.com>
Wed, 21 Jan 2026 19:30:52 +0000 (13:30 -0600)
commitc196b0a6882929bf0b6504eae963f24289ee5d85
treefdb2e36a225cd152df93eee5c360c242096d4f88
parent9fed667f890fb6bc7a1928cb85509613dd3dbc24
clk: mediatek: fix mux clocks with mapped parent IDs

Pass the unmapped parent ID when setting parent for mux clocks.

For technical reasons, some Mediatek clock driver have a mapping between
the clock IDs used in the devicetree and ID used in the generic clock
framework.

The mtk_clk_mux_set_parent() function is comparing the passed mapped
parent ID against the unmapped IDs in the chip-specific data structures.
Before this change, we were passing the mapped parent ID. When there is
a mapping, this resulted in buggy behavior (usually just incorrectly
failing to find a match and returning an error). We need to pass the
unmapped ID of the parent clock instead for the matching to work
correctly.

Since the reverse lookup is a bit verbose, a helper function is added to
keep the code clean.

Fixes: b1358915728b ("clk: mediatek: add of_xlate ops")
Signed-off-by: David Lechner <dlechner@baylibre.com>
drivers/clk/mediatek/clk-mtk.c