clk: k210: Re-add support for setting rate
authorSean Anderson <seanga2@gmail.com>
Fri, 11 Jun 2021 04:16:11 +0000 (00:16 -0400)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Thu, 17 Jun 2021 01:40:57 +0000 (09:40 +0800)
commit29e3067d911b498c9676a695312fa3d3e83a7e4f
tree0f8b5a133d9e01a13f30e1b5151e4f97aec2b463
parent612a8334cd16a6a5310605244a44ce7f29430f0e
clk: k210: Re-add support for setting rate

This adds support for setting clock rates, which was left out of the
initial CCF expunging. There are several tricky bits here, mostly related
to the PLLS:

* The PLL's bypass is broken. If the PLL is reconfigured, any child clocks
  will be stopped.
* PLL0 is the parent of ACLK which is the CPU and SRAM's clock. To prevent
  stopping the CPU while we configure PLL0's rate, ACLK is reparented
  to IN0 while PLL0 is disabled.
* PLL1 is the parent of the AISRAM clock. This clock cannot be reparented,
  so we instead just disallow changing PLL1's rate after relocation (when
  we are using the AISRAM).

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
drivers/clk/kendryte/clk.c