clk: rockchip: allow additional mux options for cpu-clock frequency changes
authorElaine Zhang <zhangqing@rock-chips.com>
Tue, 18 Oct 2022 15:14:04 +0000 (17:14 +0200)
committerHeiko Stuebner <heiko@sntech.de>
Mon, 14 Nov 2022 14:34:18 +0000 (15:34 +0100)
commit2004b7b1803719eaaaee5fa6b089b1699a65d31d
tree9d6648192a45632849fca5cadb6ffcf23ffcef01
parent8f6594494b1cb0ad14493795b436413cfe64a0f8
clk: rockchip: allow additional mux options for cpu-clock frequency changes

In order to improve the main frequency of CPU, the clock path of CPU is
simplified as follows:
                         |--\
                         |   \            |--\
 --apll--|\              |    \           |   \
         | |--apll_core--|     \          |    \
 --24M---|/              |mux1 |--[gate]--|mux2|---clk_core
                         |     /          |    /
 --gpll--|\              |    /    |------|   /
         | |--gpll_core--|   /     |      |--/
 --24M---|/              |--/      |
                                   |
 -------apll_directly--------------|

When the CPU requests high frequency, we want to use MUX2 select the
"apll_directly".
At low frequencies use MUX1 to select “apll_core" and then MUX2 to
select "apll_core_gate".

However, in this way, the CPU frequency conversion needs to be
in the following order:
1. MUX2 select to "apll_core_gate", MUX1 select "gpll_core"
2. Apll sets slow_mode, sets APLL parameters, locks APLL, and then APLL
sets normal_mode
3. MUX1 select "apll_core", MUX2 select "apll_directly"

So add pre_mux and post_mux options to cover this special requirements.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
[rebase]
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/20221018151407.63395-7-sebastian.reichel@collabora.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
drivers/clk/rockchip/clk-cpu.c
drivers/clk/rockchip/clk.h