MLK-16257: soc: imx: fix clock rate store issue in power off
In the case assign same clock in two device node in dts, which is
a parent clock used by two devices. In current design, we need to
assign this clock in two device node for clock rate recovery. In
this case, clock rate getted in imx8_pd_power_off() is zero for
second device, which will cause the clock recovery failed.
The calling sequence like this:
First device probe:
--> of_clk_set_defaults
--> clk_set_rate
--> clk_core_set_rate_nolock: clk_core->rate = 0, so execute
the calc rate and set rate. then update the clk_core->rate.
--> imx8_pd_power_on: enable the power
probe finished
--> imx8_pd_power_off
--> clk_get_rate: calc the rate, clk_core->rate !=0
--> power off in scfw
But scfw will set the "rate_div=0" for power is disabled.
Second device probe:
--> of_clk_set_defaults
--> clk_set_rate
--> clk_core_set_rate_nolock: for the clk_core->rate == rate, so
return directly.
--> imx8_pd_power_on: enable the power
probe finished
--> imx8_pd_power_off
--> clk_get_rate: calc the rate, but for the "rate_div ==0" in
scfw, so the returned rate is 0. !!!!
which will cause the clock recovery failed in pm_runtime_get_sync.
This patch is to use the clk_hw_get_rate instead the clk_get_rate, for
clk_hw_get_rate don't calc the rate, the clk_core->rate is what we want.
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Reviewed-by: Ranjani Vaidyanathan <ranjani.vaidyanathan@nxp.com>