MediaTek SoCs split their clock tree over several controllers built from
the same blocks. Add a base driver that maps a controller's registers
and registers its table of clocks, and the node types the tables use:
- PLL with the MT7986 register layout: the rate is set by the frequency control word and the post divider. A new control word is only taken over when the PLL is enabled, so a running PLL is stopped while its rate is changed, and a PLL that cannot stop keeps its rate. Without a lock bit, a PLL that was never programmed cannot be told from a stopped one, so the node has no gate: firmware starts the PLLs, and a PLL that is off reports 0 Hz and cannot be set.
- Mux with an optional gate bit and an optional update latch, changed by read-modify-write or, where the mux register is read-only, through set/clear registers.
- Gate, changed in the same two ways.
Clocks of other controllers are linked clocks, so the registration order
does not matter. A registration failure, including a mux selection the
table does not describe, panics, since nodes cannot be unregistered.
The clocks the system runs on (bus, DRAM) are marked
CLK_NODE_CANNOT_STOP in the tables, together with every node on their
path to the crystal that could stop.
A controller can also be a reset controller, with banks of assert,
deassert and status registers. The single register per bank of older
SoCs is not supported yet.
Sponsored by: Alchemilla Ventures Private Limited